08-09-2019, 09:01 PM
So i'm working on a battle project that will add many new features to battle mode (inspired by CTGP)
And one of the features that I want to add is a mode called "No mercy" mode. I have completed the coin runners portion where you lose all your coins when hit once (through minigame.kmg edits) and now, I am working on a balloon battle version, where you will die instantly, lose a point, and respawn, (similar to when your last balloon is popped) regardless of the amount of balloons you have.
Anyway, I generated a code for this:
Lose all of your balloons after being hit once
c2865c70 00000002
38000000 981d03c4
60000000 00000000
ASM version:
li r0, 0; /*r0 contains the amount of balloons a player has. Set it to 0 so that the next time a player is hit, trigger the same effects as when they're hit with one balloon left */
stb r0, 964(r29); /*The original instruction after a player is hit, stores the value of r0 into the memory address referenced by r29 + 0x03C4*/
nop;
I tested it through gecko, and it works! However, I want to make this work through Bean's CT-code engine, as it will greatly help me organize the new features i'm adding instead of adding 20 different options in Riivolution. However, there seems to be an issue.
The very first instruction I create is always replaced by another, and I am unsure why. For example;
My sourcecode to implement this using Bean's MOD engine in ct-code:
The values:
This is what I see in dolphin once the new ct-code is executed:
^ Perfect, just like my code says.
^ Nearly perfect... but my li r0, 0 instruction is replaced by subi rtoc, rtoc?
Everything is fine and dandy, the instruction at 0x80865c70 branches to 0x80002348 successfully, but this is where the problem comes in. The instruction "li r0, 0" is replaced by "subi rtoc, rtoc, 1691" and i'm not sure why. Everything else beneath this works perfectly, and it's just as I coded it in perfect order. The problem is the "subi rtoc, rtoc, 1691" causes the game to crash, but thats not supposed to be there in the first place. I tried replacing this instruction with my original "li, r0, 0" through dolphin, and bam: code works perfectly!
So to sum it up, any idea why this "subi rtoc, rtoc, 1691" replaces my original "li r0, 0" instruction, and how I could fix this?
And one of the features that I want to add is a mode called "No mercy" mode. I have completed the coin runners portion where you lose all your coins when hit once (through minigame.kmg edits) and now, I am working on a balloon battle version, where you will die instantly, lose a point, and respawn, (similar to when your last balloon is popped) regardless of the amount of balloons you have.
Anyway, I generated a code for this:
Lose all of your balloons after being hit once
c2865c70 00000002
38000000 981d03c4
60000000 00000000
ASM version:
li r0, 0; /*r0 contains the amount of balloons a player has. Set it to 0 so that the next time a player is hit, trigger the same effects as when they're hit with one balloon left */
stb r0, 964(r29); /*The original instruction after a player is hit, stores the value of r0 into the memory address referenced by r29 + 0x03C4*/
nop;
I tested it through gecko, and it works! However, I want to make this work through Bean's CT-code engine, as it will greatly help me organize the new features i'm adding instead of adding 20 different options in Riivolution. However, there seems to be an issue.
The very first instruction I create is always replaced by another, and I am unsure why. For example;
My sourcecode to implement this using Bean's MOD engine in ct-code:
The values:
This is what I see in dolphin once the new ct-code is executed:
^ Perfect, just like my code says.
^ Nearly perfect... but my li r0, 0 instruction is replaced by subi rtoc, rtoc?
Everything is fine and dandy, the instruction at 0x80865c70 branches to 0x80002348 successfully, but this is where the problem comes in. The instruction "li r0, 0" is replaced by "subi rtoc, rtoc, 1691" and i'm not sure why. Everything else beneath this works perfectly, and it's just as I coded it in perfect order. The problem is the "subi rtoc, rtoc, 1691" causes the game to crash, but thats not supposed to be there in the first place. I tried replacing this instruction with my original "li, r0, 0" through dolphin, and bam: code works perfectly!
So to sum it up, any idea why this "subi rtoc, rtoc, 1691" replaces my original "li r0, 0" instruction, and how I could fix this?