Coding Questions and other Quandaries
#53
First code making use of the LR. Infinite health.
Because of where I was at at the time, when I first started fudging around with this game, all I was able to do was give myself infinite health, along with the enemies SadSadSad

Had to use two different checks with LR so the game wouldn't freeze during cutscenes etc.

Has worked fine as far as I have gotten into the game

Let me know if you see any craziness in it.

Specifics:

LR = 0x80073798 During cutscenes/intros
LR = 0x800798E4 When taking damage


Army Men Sarge's War (GCN)

sub. r28, r28, r5 #ASM default code. Amount of damage taken
mflr r11 #ASM move address in LR to r11
andi. r11, r11, 0xfff #ASM drop bits 0 -> 20
cmpwi r11, 0x798 #ASM if in cutscene branch to the_end
beq- the_end
mflr r12 #ASM move address in LR to r12
andi. r12, r12, 0xfff #ASM drop bits 0 -> 20
cmpwi r12, 0x8e4 #ASM equal if taking damage; if not, branch to the_end
bne- the_end
li r28, 0x12C #ASM load r28 with full health value to be stored shortly.
the_end:
lis r12, 0x7F85 #ASM Loads r12 with upper half-word of default code 0x7F85E051
ori r12, r12, 0xE051 #ASM Loads r12 with lower half-word of default code 0x7F85E051
lis r11, 0x8007 #ASM Loads r11 with upper half-word of address default code to be stored at 0x8007673C
ori r11, r11, 0x673C #ASM Loads r11 with lower half-word of address default code to be stored at 0x8007673C
stw r12, 0x0 (r11) #ASM restores original code when not taking damage or during cutscenes/intros
Reply


Messages In This Thread
RE: Coding Questions and other Quandaries - by Hackwiz - 12-18-2021, 08:16 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)