Warning #
Possibly imcompatible with some stages or modified stage modules.
idk.
🤖<Use this at your own risk.
Gecko Code #
Unbreakable(not completely) rolling crate [nisetynet]
C29bdeb4 00000007
3821fffc 90610000
80650008 806308c0
2c03000a 40820010
3c600000 60630000
90660028 80610000
38210004 7c992378
60000000 00000000
Assembly Source Code, Implementation #
Probably, by following BaseItem or itCustomizer vtables, I could make it completely unbreakable but I can’t devote time to this.
Thanks to #
- 🔗Sammi-Husky for hosting shared ghidra project.
- All brawl researchers.
Source Code #
Target function.(Inserts at 0x809bdeb4
)
void damageItem/[itDamageTransactorImpl]/(it_damage_transactor_impl.o)
(undefined4 param_1,undefined4 param_2,soModuleAccesser *param_3,int param_4,
int param_5)
For example, lwz 3, 0x8(5)
is equivalent to lwz r3, 0x8(r5)
.
llvm-mc does not allow the later syntax.
echo '
.section .text
.globl _start
_start:
## save registers to prevent crash
subi 1, 1, 0x4 ## push r3
stw 3, 0(1)
lwz 3, 0x8(5) ## get BaseItem
lwz 3, 0x8c0(3) ## load BaseItem::itKind
cmpi 0, 0, 3, 0xa ## if rolling crate?
bne 0x10 ## if not -> _end
_zerodamage:
## patch damage
lis 3, 0x0000
ori 3, 3, 0x0000
stw 3, 0x28(6) ## update damage with 0.0
_end:
## restore registers
lwz 3, 0(1) ## pop r3
addi 1, 1, 0x4
## replaced instruction
or 25,4,4
' | llvm-mc -triple=powerpc-unknown-linux-gnu -show-encoding
llvm-mc Output #
.text
.globl _start
_start:
addi 1, 1, -4 # encoding: [0x38,0x21,0xff,0xfc]
stw 3, 0(1) # encoding: [0x90,0x61,0x00,0x00]
lwz 3, 8(5) # encoding: [0x80,0x65,0x00,0x08]
lwz 3, 2240(3) # encoding: [0x80,0x63,0x08,0xc0]
cmpwi 3, 10 # encoding: [0x2c,0x03,0x00,0x0a]
bne 0, .+16 # encoding: [0x40,0x82,0x00,0x10]
_zerodamage:
lis 3, 0 # encoding: [0x3c,0x60,0x00,0x00]
ori 3, 3, 0 # encoding: [0x60,0x63,0x00,0x00]
stw 3, 40(6) # encoding: [0x90,0x66,0x00,0x28]
_end:
lwz 3, 0(1) # encoding: [0x80,0x61,0x00,0x00]
addi 1, 1, 4 # encoding: [0x38,0x21,0x00,0x04]
mr 25, 4 # encoding: [0x7c,0x99,0x23,0x78]
Editorial #
- PowerPC is hard.