Rapid Fire (GCN) [mdmwii]
#1
Rapid Fire (GCN) [mdmwii]

NOTE: Outdated by Vega's Rapid Fire code. Vega's code works with any controller.

When you press and hold on a desired button, it will automatically be pressed repeatedly until you let go of said button. Does not work for analog stick or C stick.

XX = Rate of Rapidfire

Anything from 01 to FE, the higher the value, the slower the Rapidfire

ZZZZ = Button value

ZZZZ value list:
0001 = Left
0002 = Right
0004 = Down
0008 = Up
0010 = Z
0020 = R
0040 = L
0100 = A
0200 = B
0400 = X
0800 = Y
1000 = Start

NOTE: This code makes use of memory address 0x800005FD, make sure no other codes in your GCT/Cheat-Manager are using those addresses.

NTSC-U
C21AFCE8 0000000F
3D808000 3960ZZZZ
2F8B0040 419E0010
2F8B0020 419E0010
48000014 39200006
48000008 39200007
7CA920AE A1440000
7D685038 7C085800
40A20020 88CC05FD
2C0600XX 40800014
38C60001 7D4B5050
38A00000 48000008
38C00000 B1440000
98CC05FD 40BE0008
7CA921AE 98040008
60000000 00000000

PAL
C21AFD88 0000000F
3D808000 3960ZZZZ
2F8B0040 419E0010
2F8B0020 419E0010
48000014 39200006
48000008 39200007
7CA920AE A1440000
7D685038 7C085800
40A20020 88CC05FD
2C0600XX 40800014
38C60001 7D4B5050
38A00000 48000008
38C00000 B1440000
98CC05FD 40BE0008
7CA921AE 98040008
60000000 00000000

NTSC-J
C21AFCA8 0000000F
3D808000 3960ZZZZ
2F8B0040 419E0010
2F8B0020 419E0010
48000014 39200006
48000008 39200007
7CA920AE A1440000
7D685038 7C085800
40A20020 88CC05FD
2C0600XX 40800014
38C60001 7D4B5050
38A00000 48000008
38C00000 B1440000
98CC05FD 40BE0008
7CA921AE 98040008
60000000 00000000

NTSC-K
C21B00E4 0000000F
3D808000 3960ZZZZ
2F8B0040 419E0010
2F8B0020 419E0010
48000014 39200006
48000008 39200007
7CA920AE A1440000
7D685038 7C085800
40A20020 88CC05FD
2C0600XX 40800014
38C60001 7D4B5050
38A00000 48000008
38C00000 B1440000
98CC05FD 40BE0008
7CA921AE 98040008
60000000 00000000



Code creator: mdmwii
Code credits: Vega (added extra ASM + changed address slightly so L/R buttons can be utilized)



Source:
#~~~~~~~~~~~~~~~~#
# START ASSEMBLY #
#~~~~~~~~~~~~~~~~#

#Address Ports
#NTSC-U = 801AFCE8
#PAL = 801AFD88
#NTSC-J = 801AFCA8
#NTSC-K = 801B00E4

#~~~~~~~~~~~~~~~~#
# Register Notes #
#~~~~~~~~~~~~~~~~#

#r5, r6, r8, r9, r10, r11, & r12 safe for use

#~~~~~~~~~~~~~~#
# Memory Notes #
#~~~~~~~~~~~~~~#

#0x800005FD = Where Rapidfire Status Byte is located at
#r4 = Button Halfword Combo Location
#r4 + 6 = L Trigger Byte
#r4 + 7 = R Trigger Byte

#Code Address is one instruction after the R Trigger byte is writetn to memory (which comes 4 instructions after L Trigger, which is a little bit after overall button halfword combo is stored

#~~~~~~~~~~~~~~~#
# Set Registers #
#~~~~~~~~~~~~~~~#

lis r12, 0x8000
li r11, 0x0040 #GCN L Button used just for compilation purposes, set this to w/e value you want to use

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# Check If User is using L or R Button for Code #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

#Using cr7 for this because a conditional branch at the end will be used based on the condition of the following two branches, thus we need the condition to not be altered during the execution of this code

cmpwi cr7, r11, 0x0040
beq- cr7, L_Button_setup
cmpwi cr7, r11, 0x0020
beq- cr7, R_Button_setup
b load_halfword #User NOT using L/R, skip over rest of L/R setup

L_Button_setup:
li r9, 0x6
b load_LR_byte

R_Button_setup:
li r9, 0x7

load_LR_byte:
lbzx r5, r9, r4 #r9 used as offset value for loading (and later storing) depending on whether L or R button is being used

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# Load Button Halfword; Check if Button was Pressed #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

load_halfword:
lhz r10, 0 (r4)
and r8, r11, r10
cmpw r8, r11

bne+ reset_rapidfire_byte

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# Button is being Pressed, Load & Check Rapidfire Byte #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

lbz r6, 0x05FD (r12)
cmpwi r6, 1 #Value of 1 used for compilation purposes, can be anything from 0x01 to 0xFE, higher value = slower rapidfire
bge- reset_rapidfire_byte

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# Rapidfire Byte not at Max yet, Increase it, Remove User's button Input #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

addi r6, r6, 1
subf r10, r11, r10

li r5, 0 #Reset L/R values

b store_button_values_and_rapidfire_byte

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# Byte has hit Max, reset it #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

reset_rapidfire_byte:
li r6, 0

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# Store All Values to Memory #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

store_button_values_and_rapidfire_byte:
sth r10, 0 (r4) #Button Halfword combo
stb r6, 0x05FD (r12) #Rapidfire byte
bne+ cr7, the_end

stbx r5, r9, r4 #L/R values

the_end:
stb r0, 0x0008 (r4) #Default instruction

#~~~~~~~~~~~~~~#
# END ASSEMBLY #
#~~~~~~~~~~~~~~#
Reply
#2
Bump!

Added extra ASM instructions plus changed code address so the user can incorporate L/R triggers.
Reply
#3
Its not working for me and i think its something to do with the memory address, how can i delete anything thats using the same one?
Reply
#4
(01-22-2021, 01:57 PM)SteeredBeast Wrote: Its not working for me and i think its something to do with the memory address, how can i delete anything thats using the same one?

Ok, so if something is using the same address as this code in your gct, it is called a Memory Conflict. Pretty much the only way to fix this issue it to delete one of the codes. However, I don't think that's your issue, make sure you are putting the correct region into your gct.
~MarioKartWii.com #1~
Reply
#5
Make sure no other codes are utilizing the memory address of 0x800005FD.

Also make sure no other codes have a hook/base (C2/04, etc) address as the same as this code.

I've personally tested this code on every region on both console and Dolphin, and it works fine.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)