Mario Kart Wii Gecko Codes, Cheats, & Hacks
Timed Automatic Item Usage [Seeky] - Printable Version

+- Mario Kart Wii Gecko Codes, Cheats, & Hacks (https://mariokartwii.com)
+-- Forum: Cheat Codes (https://mariokartwii.com/forumdisplay.php?fid=51)
+--- Forum: Offline; Item (https://mariokartwii.com/forumdisplay.php?fid=58)
+--- Thread: Timed Automatic Item Usage [Seeky] (/showthread.php?tid=1389)



Timed Automatic Item Usage [Seeky] - Seeky - 12-27-2019

Timed Automatic Item Usage [Seeky]

This code will automatically press the item button at a set interval. NNNN is the number of frames to wait between presses (ex. 0x012C, which is 5 seconds) and PPPP is the exception vector area offset from 0x80000000 that the timer is stored at (ex. 0x0C98) - this has no impact on the function of the code but may need to be changed for compatibility with other codes using the exception vector area. 

NTSC-U
C0000000 00000004
3D608000 818BPPPP
398C0001 2C0CNNNN
40A10008 39800000
918BPPPP 4E800020
C251CE8C 00000005
3D608000 818BPPPP
2C0CNNNN 4182000C
540007B8 48000008
60000004 B01E002C
60000000 00000000


PAL
C0000000 00000004
3D608000 818BPPPP
398C0001 2C0CNNNN
40A10008 39800000
918BPPPP 4E800020
C2521300 00000005
3D608000 818BPPPP
2C0CNNNN 4182000C
540007B8 48000008
60000004 B01E002C
60000000 00000000

NTSC-J
C0000000 00000004
3D608000 818BPPPP
398C0001 2C0CNNNN
40A10008 39800000
918BPPPP 4E800020
C2520C80 00000005
3D608000 818BPPPP
2C0CNNNN 4182000C
540007B8 48000008
60000004 B01E002C
60000000 00000000

NTSC-K
C0000000 00000004
3D608000 818BPPPP
398C0001 2C0CNNNN
40A10008 39800000
918BPPPP 4E800020
C250F324 00000005
3D608000 818BPPPP
2C0CNNNN 4182000C
540007B8 48000008
60000004 B01E002C
60000000 00000000

Source ASM:
.set INTERVAL, 300 # Delay in frames between item uses (NNNN)
.set EVAADDRESS, 0x0C98 # Set to any free exception vector area address offset (PPPP)

C2 write (Controls the item button input)
0x80521300 PAL
0x8051CE8C NTSC-U
0x8050F324 NTSC-K
0x80520C80 NTSC-J
======================================================
lis r11, 0x8000
lwz r12, EVAADDRESS (r11) # Loads timer from memory
cmpwi r12, INTERVAL #Checks if it's time
beq- on
off:
rlwinm r0, r0, 0, 30, 28 # Clears the bit for the item input
b end
on:
ori r0, r0, 0x4 # Turns on the bit for the item input
end:
sth r0, 0x002C (r30) # Default instruction (stores the input to memory)

C0 timer (Region free)
=======================================================
lis r11, 0x8000
lwz r12, EVAADDRESS (r11) # Gets current timer value
addi r12, r12, 1 # Increments by 1
cmpwi r12, INTERVAL # If the timer has reached the value where items were pressed, restarts it
ble+ end
li r12, 0
end:
stw r12, EVAADDRESS (r11)
blr

Code created by: Seeky


RE: Timed Automatic Item Usage [Seeky] - Vega - 12-27-2019

Nice code!


RE: Timed Automatic Item Usage [Seeky] - Vega - 12-30-2019

lis r11, 0x8000
lwz r12, EVAADDRESS (r11) # Loads timer from memory
cmpwi r12, INTERVAL #Checks if it's time
beq- on
off:
rlwinm r0, r0, 0, 30, 28 # Clears the bit for the item input
b end
on:
ori r0, r0, 0x4 # Turns on the bit for the item input
end:
sth r0, 0x002C (r30) # Default instruction (stores the input to memory)




Since this is the default state for off, you should be able to put the bit clear instruction at the top and the code will still work. Like this:

rlwinm r0, r0, 0, 30, 28
lis r11, 0x8000
lwz r12, 0xEVAADDRESS (r11)
cmpwi r12, INTERVAL
bne+ end

ori r0, r0, 0x0004

end:


RE: Timed Automatic Item Usage [Seeky] - Seeky - 12-30-2019

Good point, another thing I've realised since is that it might not be worth clearing that bit anyway, since not clearing it would allow player inputs to still work in addition to the automatic press.


RE: Timed Automatic Item Usage [Seeky] - Vega - 12-30-2019

Might as well design the code to allow the user to choose if they want that or not.


RE: Timed Automatic Item Usage [Seeky] - Seeky - 01-16-2020

I've fixed a pretty major mistake in the code where 1 of the values that should be PPPP was already set to 0x0C98, meaning the code broke for all other addresses