Coding Questions and other Quandaries
At first glance, you can chop down the source to something like this. Btw I have no idea what any of the checks are for. I don't own the game and have never made codes for it.

lbz r4, 0x7 (r31)
lis r12, 0x803A

cmpwi r4, 0
lhz r11, 6862 (r12)
beq- check_bit_19
cmpwi r4, 1
lhz r11, 8262 (r12)
beq- check_bit_19
cmpwi r4, 2
lhz r11, 9662 (r12)
beq- check_bit_19
cmpwi r4, 3
lhz r11, 11062 (r12)
bne- original_instruction

check_bit_19:
cmpwi r11, 0x1000 #Considering this appear to be a bit check, I would try to use andi. instead
bne- original_instruction #If using andi. switch this to beq-

mr r4, r0
addi r4, r4, 1 #Instead of doing addi, there may be a way to implement subic. with a free check against 0 due to record bit usage. Retweak rest of code for check against 0 instead of seven.
cmplwi r4, 7
ble- store_it

li r4, 0

store_it:
stw r4, 5344 (r31)

original_instruction:
lwz r4, 5344 (r31)

NOTE: On the discord screenshot you gave me, the source doesn't use the actual original instruction. The original instruction uses r3 as the source register, not r31.
Reply


Messages In This Thread
RE: Coding Questions and other Quandaries - by Vega - 05-07-2022, 03:51 PM

Forum Jump:


Users browsing this thread: 35 Guest(s)