Coin Magnet [Unnamed]
#1
Coin Magnet [Unnamed]

Coin Runners only


Editing KMPs to move coins (and maybe start positions) has in my eyes two disadvantages: First you have to waste time to find the correct configuration of where to put them, and second you will not be able to play normal games anymore, unless you find a way to toggle between custom track files.

This is a much easier way to do "coin KMP" now, with this code! Simply press your activator and you will attract the coins like a magnet. Of course, this is only working for free coins. Works offline and online.

NOTE: You mustn't press any other buttons when pressing your button(s) to make the code work.


NTSC-U
C27815F0 00000013
3D608034 A16BXXXX
280BZZZZ 40820080
8168FFD0 3D80808D
618C78EC 7C0C5800
4082006C 3D60809C
814BD110 818B8F68
898C0B84 814A0020
1D8C0004 7D8C502E
818C0000 818C0008
818C0090 818C0004
814C0068 816C006C
818C0070 91480000
91680004 91880008
91480034 91680044
91880054 9148009C
916800A0 918800A4
9148016C 91680170
91880174 C0250008
60000000 00000000

PAL
C2785A20 00000013
3D60803Q A16BXXXX
280BZZZZ 40820080
8168FFD0 3D80808D
618CC774 7C0C5800
4082006C 3D60809C
814B18F8 818BD728
898C0B84 814A0020
1D8C0004 7D8C502E
818C0000 818C0008
818C0090 818C0004
814C0068 816C006C
818C0070 91480000
91680004 91880008
91480034 91680044
91880054 9148009C
916800A0 918800A4
9148016C 91680170
91880174 C0250008
60000000 00000000

NTSC-J
C278508C 00000013
3D608034 A16BXXXX
280BZZZZ 40820080
8168FFD0 3D80808D
618CB8C4 7C0C5800
4082006C 3D60809C
814B0958 818BC788
898C0B84 814A0020
1D8C0004 7D8C502E
818C0000 818C0008
818C0090 818C0004
814C0068 816C006C
818C0070 91480000
91680004 91880008
91480034 91680044
91880054 9148009C
916800A0 918800A4
9148016C 91680170
91880174 C0250008
60000000 00000000

NTSC-K
C2773DE0 00000013
3D608033 A16BXXXX
280BZZZZ 40820080
8168FFD0 3D80808C
618CAC0C 7C0C5800
4082006C 3D60809B
814BFF38 818BBD68
898C0B84 814A0020
1D8C0004 7D8C502E
818C0000 818C0008
818C0090 818C0004
814C0068 816C006C
818C0070 91480000
91680004 91880008
91480034 91680044
91880054 9148009C
916800A0 918800A4
9148016C 91680170
91880174 C0250008
60000000 00000000


Values:

XXXX: Controller Adress
ZZZZ: Button
Q: Higher CA (PAL only)
Q = 5 for GCN controller
else Q = 4


---------------------------------------------------------------------------------------------------------


Source:
#### Hook Adresses ####
### 807815F0 (NTSC-U)
### 80785A20 (PAL)
### 8078508C (NTSC-J)
### 80773DE0 (NTSC-K)

## The Hook adress seems like to be in a function that loads the coordinates of objects and then do some calculations (no Idea what lol), we can use this adress for our code. ##
## (Function name is BoxColManager_calc according to symbol map) ##

### RaceData ###
## 809B8F68 (NTSC-U)
## 809BD728 (PAL)
## 809BC788 (NTSC-J)
## 809ABD68 (NTSC-K)

### PlayerBase ###
## 809BD110 (NTSC-U)
## 809C18F8 (PAL)
## 809C0958 (NTSC-J)
## 809AFF38 (NTSC-K)

### CoinIdentifier ###
## 808D78EC (NTSC-U)
## 808DC774 (PAL)
## 808DB8C4 (NTSC-J)
## 808CAC0C (NTSC-K)

###########################################


lis r11, CA_upper
lhz r11, CA_lower ## CA means controller adress
cmplwi r11, _button
bne skip
####################
### r8 helds the pointer to the coordinates of the current object
####################
lwz r11, -0x30 (r8) ## load Identifier adress of current object.
lis r12, CoinIdentifier_upper
ori r12, r12, CoinIdentifier_lower  ## load Identifier adress of coin.
cmpw r12, r11 ## compare them, if they are not equal, this object is not a coin, skip code
bne skip
####################
# if this is a coin, get the player coordinates and store them to the coin coordinates.
####################
lis r11, RaceData_upper ## same as PlayerBase_upper
lwz r10, PlayerBase_lower
lwz r12, RaceData_lower
lbz r12, 0xB84 (r12) ## load player slot of local player
lwz r10, 0x20 (r10)
mulli r12, r12, 4
lwzx r12, r12, r10 ## load player base of local player
lwz r12, 0 (r12)
lwz r12, 8 (r12)
lwz r12, 0x90 (r12)
lwz r12, 4 (r12) ## get pointer to coordinates
lwz r10, 0x68 (r12)
lwz r11, 0x6C (r12)
lwz r12, 0x70 (r12) ## load each coordinate in register
stw r10, 0 (r8)
stw r11, 4 (r8)
stw r12, 8 (r8)
stw r10, 0x34 (r8)
stw r11, 0x44 (r8)
stw r12, 0x54 (r8)
stw r10, 0x9C (r8)
stw r11, 0xA0 (r8)
stw r12, 0xA4 (r8)
stw r10, 0x16C (r8)
stw r11, 0x170 (r8)
stw r12, 0x174 (r8) ## we need to store each player coordinate to four different spots.

skip:
lfs f1, 8(r5) ## Default instruction

---------------------------------------------------------

Code Creator: Unnamed
Code Credits: Vega (for Player Coordinate Pointer Chain)
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)