Help with ASM through Bean's CT-Code engine
#3
You could find and set a flag that only activates when the battle loads, then use that flag like this:


#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
#Set flag at XXXXXXXX address (I'm just using 80830A08 as an example)#
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

#~~~~~~~~~~~#
#Inject > 80830A08#
#~~~~~~~~~~~#

lis r12, 0x8157
stb r3, 0x0284 (r28) #Example Vanilla Instruction
stw r12, 0 (r12) #Store r12's value as a flag for later

Then, write the main code like this:

#~~~~~~~~~~~#
#Inject > 80865C70#
#~~~~~~~~~~~#

lis r12, 0x8157
bl grab_address #The Branch-Link will Dynamically grab the address of our "li r0, 0" instruction no matter the circumstance.
grab_address:
li r0, 0
lhz r12, 0 (r12) #Grab flag from Mem81
cmplwi r12, 0
beq no_overwrite #Branch past our overwrite if Flag is not set.
mflr r12 #Copy the address from Link Register (The "li r0, 0" instruction address) to Register 12
lis r11, 0x3800 #Load the value 0x38000000 (This is a "li r0, 0" instruction) into Register 11
stw r11, 0 (r12) #Store Register 11's value into the address specified by Register 12 + an offset of 0 (Overwrite "subi rtoc, rtoc, 1691" with "li r0, 0")
no_overwrite:
stb r0, 964(r29) #Vanilla Instruction


Let me know if this helps. If you want to try what I put down, just find an address that only reads when a Battle is loaded and/or running, and set a flag there.
Super Mario Eclipse, what Super Mario Sunshine could've been.
Reply


Messages In This Thread
RE: Help with ASM through Bean's CT-Code engine - by JoshuaMK - 08-09-2019, 10:00 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)