Coding Questions and other Quandaries
#96
Cocoto Kart Racer - Weapon/Item Auto-fire

C0000000 00000005
3D60801A 616BD000
A18B0A8C 2C0C0800
41A2000C 2C0C0C00
4C820020 38A00000
B0AB0A94 4E800020

On yet another Wii game, I found a button activator address that when held to 0x0, gives all buttons auto-fire
capabilities.

Searching for the button activator addresses returned 22 results.
In the watch window, one by one, I wrote 0x0 to the addresses and checked to see if pressing the A button gave me auto-fire.
The third address in the list gave me just that.
Rather than using the button write cycle, I wrote a simple C0 code to do the trick.

I used one of the nonauto-fire button activator addresses for the conditionals.

The nonauto-fire button activator address is: 0x801ADA8C
The auto-fire button activator address is: 0x801ADA94

I needed two conditionals. One for when only the fire (A) button is pressed, and the other for when the accelerator (B) button is being pressed also.

#Source
#C0 insert:

  lis r11, 0x801A #ASM loads r11 with upper half-word of button activator address(es)
  ori r11, r11, 0xD000 #ASM loads r11 lower half-word of button activator address(es)
  lhz r12, 0xA8C (r11) #ASM loads r12 with current value at nonauto-fire button address
  cmpwi r12, 0x800 #ASM check to see if "A" being pressed
  beq+ fire_button_pressed
  
  cmpwi r12, 0xC00 #ASM check to see if "A and B" are being pressed
  bnelr- #if not, end C0

fire_button_pressed: 
  li r5, 0x0 #ASM load r5 with 0x0
  sth r5, 0xA94 (r11) #ASM stores 0x0 at auto-fire button activator address
  blr #end C0
 
Works great!!!
Reply


Messages In This Thread
RE: Coding Questions and other Quandaries - by Hackwiz - 02-05-2022, 09:31 PM

Forum Jump:


Users browsing this thread: 2 Guest(s)