void RestoreHealth(){ //Original function
u16* curHealth=(u16*)0x3001310;
u16* maxHealth=(u16*)0x3001312;
unsigned short val=*maxHealth-*curHealth;
*curHealth+=val;
}
Here's the assembeled copy
EXPORT RestoreHealth
RestoreHealth
var_8 = -8
var_4 = -4
SUB SP, SP, #0x10
LDR R3, =0x3001310
STR R3, [SP,#0x10+var_4]
LDR R3, =0x3001312
STR R3, [SP,#0x10+var_8]
LDR R3, [SP,#0x10+var_8]
LDRH R1, [R3]
LDR R3, [SP,#0x10+var_4]
LDRH R2, [R3]
MOV R3, SP
ADDS R3, #6
SUBS R2, R1, R2
STRH R2, [R3]
LDR R3, [SP,#0x10+var_4]
LDRH R2, [R3]
MOV R3, SP
ADDS R3, #6
LDRH R3, [R3]
ADDS R3, R2, R3
LSLS R3, R3, #0x10
LSRS R2, R3, #0x10
LDR R3, [SP,#0x10+var_4]
STRH R2, [R3]
ADD SP, SP, #0x10
BX LR
; End of function RestoreHealth
; ---------------------------------------------------------------------------
ALIGN 0x10
dword_8000320 DCD 0x3001310 ; DATA XREF: RestoreHealth+2 r
dword_8000324 DCD 0x3001312 ; DATA XREF: RestoreHealth+6 r
And here's the decompiled version!
; ---------------------------------------------------------------------------
EXPORT RestoreHealth
RestoreHealth
void RestoreHealth() { // framesize 0x10
(unsigned long)SP+0xC = 0x3001310;
(unsigned long)SP+8 = 0x3001312;
(unsigned short)SP+6 = word<(unsigned long)SP+8> - word<(unsigned long)SP+0xC>;
word<(unsigned long)SP+0xC> = word<(unsigned long)SP+0xC> + (unsigned short)SP+6 & 0xFFFF;
return void
}
; ---------------------------------------------------------------------------
No comments:
Post a Comment