Coding Questions and other Quandaries
#23
(12-09-2021, 02:30 PM)Vega Wrote: Yes you can run multiple F6 Codetypes. Just be sure each one has it own End-If.

No that wasn't a typo. I don't own the Celia game, so I was just supplying a random instruction in the unique string as an example.

(12-09-2021, 01:58 PM)Hackwiz Wrote: 28###### 00001000 #Control line activator. Press (-)
F6000001 80E080FF #Example unique string takes up 1 row/line. Search from 0x80E00000 thru 0x80FF0000
907D0014 887D0020 #Example unique string to look for
D2000000 00000004 #Insert ASM at pointer (zero offset); D2 = Codetype for Pointer ASM
39600004 7FAB5838 #ASM code: li r11, 0x4; and r11, r29, r11
2C0B0004 41820000 #ASM code: cmpwi r11, 0x4; beq some_label
386000C8 907D0014 #ASM code: some_label: li r3, 0xC8; stw r3, 0x0014 (r29)
60000000 00000000 #End of ASM code
E0000000 80008000 #End if (final terminator)

Everything looks fine here as far as the F6 structure is concerned.

(12-09-2021, 01:58 PM)Hackwiz Wrote: Being that Celia’s health address ends with 0x4, possibly this could do the trick.

li r11, 0x4 
and r11, r29, r11
cmpwi r11, 0x4
beq some_label
Some_label:
li r3, 0xC8
stw r3, 0x14 (r29)

There's a better way to check if that address ends in 4 plus I see a mistake in your branching. Try this..

Code:
andi. r12, r29, 0x000F #This will AND with a value of 0x0000000F. All binary values in the final Hex digit are preserved. The dot in the instruction operand is required in the andi instruction because the Broadway CPU developers never made a version of the andi instruction without the dot. The dot isn't applicable to us in this situation but it's a free use of cmpwi rD, 0.

cmpwi r12, 4 #Check if Address ends in the digit 4.
bne- default_instruction #If not, it's not an address for Celia, don't execute

li r3, 0xC8 #Update Celia's health

default_instruction:
stw r3, 0x0014 (r29) #Store health to dynamic memory

r12 is usually more safe than r11 as an fyi. And be sure this string of "907D0014 887D0020" is truly unique in memory. Take a Memory dump of your game. Open up Dolphin's own Memory tab/window (NOT the Aldelaro memory engine), and choose the top option for dumping RAM. Go to where you Mem dumps are exported in your computer depending on your Dolphin config (this varies widely so there's no way I can know this). Open up the Mem/RAM Dump in a Hex editor (i.e. HxD). And do a search of that string in Hex Mode. If it only pops up once in the dump, you're good to go.

Brilliant!!!!
I see the mistake I made with the branch.
I'll give it a try later.
Reply


Messages In This Thread
RE: Coding Questions and other Quandaries - by Hackwiz - 12-09-2021, 03:34 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)