Press Button to Spawn TC [1superchip]
#1
Press Button to Spawn TC [1superchip]

This code spawns a TC on a specific player on a button press. This code is server sided.

NTSC-U
C0000000 0000000B
3C608034 6063XXXX
A0630000 2C03ZZZZ
40820044 3C60809B
6063EE20 80630000
2C030000 41820030
9421FF80 7D8802A6
BC610008 3D808079
618C128C 7D8803A6
3880000X 4E800021
B8610008 7D8803A6
38210080 4E800020

PAL
C0000000 0000000B
3C608034 6063XXXX
A0630000 2C03ZZZZ
40820044 3C60809C
60633618 80630000
2C030000 41820030
9421FF80 7D8802A6
BC610008 3D808079
618CA298 7D8803A6
3880000X 4E800021
B8610008 7D8803A6
38210080 4E800020

NTSC-J
C0000000 0000000B
3C608034 6063XXXX
A0630000 2C03ZZZZ
40820044 3C60809C
60632678 80630000
2C030000 41820030
9421FF80 7D8802A6
BC610008 3D808079
618C9904 7D8803A6
3880000X 4E800021
B8610008 7D8803A6
38210080 4E800020

NTSC-K
C0000000 0000000B
3C608033 6063XXXX
A0630000 2C03ZZZZ
40820044 3C60809B
60631C58 80630000
2C030000 41820030
9421FF80 7D8802A6
BC610008 3D808078
618C8658 7D8803A6
3880000X 4E800021
B8610008 7D8803A6
38210080 4E800020

XXXX = controller address
ZZZZ = button value
X = player slot


Source:

.set region, ''
.set TargetPlayerID, x

.if (region == 'E' || region == 'e')
lis r3, 0x8034
.set ItemStruct, 0x809BEE20
.set SpawnTC, 0x8079128c
.elseif (region == 'P' || region == 'p')
lis r3, 0x8034
.set ItemStruct, 0x809C3618
.set SpawnTC, 0x8079A298
.elseif (region == 'J' || region == 'j')
lis r3, 0x8034
.set ItemStruct, 0x809C2678
.set SpawnTC, 0x80799904
.elseif (region == 'K' || region == 'k')
lis r3, 0x8033
.set ItemStruct, 0x809B1C58
.set SpawnTC, 0x80788658
.else # Invalid Region
.err
.endif

ori r3, r3, 0xXXXX # Controller Address
lhz r3, 0 (r3)

cmpwi r3, 0xZZZZ # button value
bne- end

#Check ItemStruct pointer and keep in r3
lis r3, ItemStruct@h
ori r3, r3, ItemStruct@l
lwz r3, 0 (r3)
cmpwi r3, 0
beq- end

stwu sp, -0x0080 (sp) #Make stack frame
mflr r12 #Backup LR because C0
stmw r3, 0x8 (sp)

lis r12, SpawnTC@h
ori r12, r12, SpawnTC@l
mtlr r12
li r4, TargetPlayerID
blrl

lmw r3, 0x8 (sp) #Pop stack frame
mtlr r12 #Recover LR because c0
addi sp, sp, 0x0080

end:
blr



This code is untested on NTSC-J and NTSC-K.

Code Creator: 1superchip
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)