CTGP 200cc [MrBean35000vr, _tZ, stebler]
#1
CTGP 200cc [MrBean35000vr, _tZ, stebler]

PAL:
048a5ab0 42e10000
048a5abc 43430000
048a5bc4 43c30000
048a5c24 43430000
048a5c34 496a6000
048a5dc0 431d8000
048b5b1c 3ebbbbbc
048b5c78 40900000
048cb550 42d20000
04578558 3d804334
0457855c 919e002c
0457b99c 3c804359
0457b9a0 60848000
0457b9a4 9083002c
0457b9b0 3c804334
0457b9b4 9083002c
c257bbc4 00000003
48000009 43598000
7d8802a6 c00c0000
60000000 00000000
c25858c8 00000003
48000009 43598000
7d8802a6 c00c0000
60000000 00000000
c257bd5c 00000003
48000009 430e8000
7d8802a6 c00c0000
60000000 00000000
c257bd80 00000003
48000009 431d8000
7d8802a6 c00c0000
60000000 00000000
c2592194 00000006
48000009 3fc00000
7d8802a6 c04c0000
c063000c ec6200f2
d063000c ec020032
ec220072 ec01002a
60000000 00000000
045921b4 ec0100ba
045921c4 ec0100ba
045921d4 ec0100ba
045921e4 ec0100ba
c25850c8 00000004
48000009 3f2aaaab
7d8802a6 c0ec0000
ec070032 d01e0020
60000000 00000000
c251f5f8 00000003
70680240 2c080240
40820008 60c60010
60c60001 00000000
c252029c 00000003
70a40220 2c040220
40820008 61080010
61080001 00000000
c2745cb4 00000003
70660404 2c060404
40820008 63ff0010
63ff0001 00000000
c2745f70 00000003
70830600 2c030600
40820008 60000010
60000001 00000000
c257adec 00000009
7c8b2378 5563073e
2c03000f 40820034
7fa3eb78 3c808059
608403f4 7c8903a6
4e800421 a063002c
546306f7 41820014
3c808057 6084ae8c
7c8903a6 4e800420
556307ff 00000000
c26faff8 0000000d
7c0a0378 7c6b1b78
7c8c2378 555bf7fe
554506fe 2c05000f
40820040 806c0018
3ca08059 60a503f4
7ca903a6 4e800421
a0a3002c 54a506f7
41820020 55450001
40820018 554502d7
40820010 3b600000
3b800001 3bc00000
7d846378 7d635b78
7d405378 00000000
c2699c98 00000014
807e0118 80630000
80630004 80c30004
54c506fe 2c05000f
40820048 80630018
3ca08059 60a503f4
7ca903a6 4e800421
a0a3002c 54a506f7
41820028 54c50001
40820020 54c502d7
40820018 38a00001
98a30015 3fa0806a
63bd19d8 48000020
88a30015 2c050001
40820030 38a00000
98a30015 3fa0806a
63bd1b68 7fc3f378
809e0614 38a00019
38c0001a 38e00001
7fa903a6 4e800421
396100a0 00000000
c2698f50 00000019
7c1e0378 807f0118
80630000 80630004
80c30004 54c506fe
2c05000f 40820048
80630018 3ca08059
60a503f4 7ca903a6
4e800421 a0a3002c
54a506f7 41820028
54c50001 40820020
54c502d7 40820018
38a00001 98a30015
3fa0806a 63bd19d8
48000020 88a30015
2c050001 4082004c
38a00000 98a30015
3fa0806a 63bd1b68
7fe3fb78 809f0530
38a00022 38c00023
38e00000 7fa903a6
4e800421 7fe3fb78
809f0530 38a00023
38c00024 38e00001
7fa903a6 4e800421
7fc0f378 80010024
60000000 00000000
c259678c 0000000f
4800000d 3e99999a
3f800000 7d8802a6
7c8b2378 c01f004c
807d001c 8083001c
2c040001 40810048
89030096 2c080001
4082000c 2c040012
40810034 80630018
3c808059 608403f4
7c8903a6 4e800421
c0430034 fc601210
ec42182a c06c0000
c08c0004 ec4220fa
ec0000b2 7d645b78
7fc3f378 00000000
c2597390 00000013
4800000d 3e99999a
3f800000 7d8802a6
39000001 807c001c
8083001c 2c040000
40820020 39000000
99030096 81030004
55080631 4182000c
39000001 99030096
2c040001 40810048
89030096 2c080001
4082000c 2c040012
40810034 80630018
3c808059 608403f4
7c8903a6 4e800421
c0430034 fc601210
ec42182a c06c0000
c08c0004 ec4220fa
ec0000b2 7f83e378
60000000 00000000

NTSC-U:
048a0fd8 42e10000
048a0fe4 43430000
048a10ec 43c30000
048a114c 43430000
048a115c 496a6000
048a12e8 431d8000
048b125c 3ebbbbbc
048b13b8 40900000
048c6048 42d20000
04571cf4 3d804334
04571cf8 919e002c
04575138 3c804359
0457513c 60848000
04575140 9083002c
0457514c 3c804334
04575150 9083002c
c2575360 00000003
48000009 43598000
7d8802a6 c00c0000
60000000 00000000
c257f0a4 00000003
48000009 43598000
7d8802a6 c00c0000
60000000 00000000
c25754f8 00000003
48000009 430e8000
7d8802a6 c00c0000
60000000 00000000
c257551c 00000003
48000009 431d8000
7d8802a6 c00c0000
60000000 00000000
c258b970 00000006
48000009 3fc00000
7d8802a6 c04c0000
c063000c ec6200f2
d063000c ec020032
ec220072 ec01002a
60000000 00000000
0458b990 ec0100ba
0458b9a0 ec0100ba
0458b9b0 ec0100ba
0458b9c0 ec0100ba
c257e8a4 00000004
48000009 3f2aaaab
7d8802a6 c0ec0000
ec070032 d01e0020
60000000 00000000
c251b184 00000003
70680240 2c080240
40820008 60c60010
60c60001 00000000
c251be28 00000003
70a40220 2c040220
40820008 61080010
61080001 00000000
c2735de8 00000003
70660404 2c060404
40820008 63ff0010
63ff0001 00000000
c27360a4 00000003
70830600 2c030600
40820008 60000010
60000001 00000000
c2574588 00000009
7c8b2378 5563073e
2c03000f 40820034
7fa3eb78 3c808058
60849bd0 7c8903a6
4e800421 a063002c
546306f7 41820014
3c808057 60844628
7c8903a6 4e800420
556307ff 00000000
c26f6090 0000000d
7c0a0378 7c6b1b78
7c8c2378 555bf7fe
554506fe 2c05000f
40820040 806c0018
3ca08058 60a59bd0
7ca903a6 4e800421
a0a3002c 54a506f7
41820020 55450001
40820018 554502d7
40820010 3b600000
3b800001 3bc00000
7d846378 7d635b78
7d405378 00000000
c2695810 00000014
807e0118 80630000
80630004 80c30004
54c506fe 2c05000f
40820048 80630018
3ca08058 60a59bd0
7ca903a6 4e800421
a0a3002c 54a506f7
41820028 54c50001
40820020 54c502d7
40820018 38a00001
98a30015 3fa08069
63bdd550 48000020
88a30015 2c050001
40820030 38a00000
98a30015 3fa08069
63bdd6e0 7fc3f378
809e0614 38a00019
38c0001a 38e00001
7fa903a6 4e800421
396100a0 00000000
c2694ac8 00000019
7c1e0378 807f0118
80630000 80630004
80c30004 54c506fe
2c05000f 40820048
80630018 3ca08058
60a59bd0 7ca903a6
4e800421 a0a3002c
54a506f7 41820028
54c50001 40820020
54c502d7 40820018
38a00001 98a30015
3fa08069 63bdd550
48000020 88a30015
2c050001 4082004c
38a00000 98a30015
3fa08069 63bdd6e0
7fe3fb78 809f0530
38a00022 38c00023
38e00000 7fa903a6
4e800421 7fe3fb78
809f0530 38a00023
38c00024 38e00001
7fa903a6 4e800421
7fc0f378 80010024
60000000 00000000
c258ff68 0000000f
4800000d 3e99999a
3f800000 7d8802a6
7c8b2378 c01f004c
807d001c 8083001c
2c040001 40810048
89030096 2c080001
4082000c 2c040012
40810034 80630018
3c808058 60849bd0
7c8903a6 4e800421
c0430034 fc601210
ec42182a c06c0000
c08c0004 ec4220fa
ec0000b2 7d645b78
7fc3f378 00000000
c2590b6c 00000013
4800000d 3e99999a
3f800000 7d8802a6
39000001 807c001c
8083001c 2c040000
40820020 39000000
99030096 81030004
55080631 4182000c
39000001 99030096
2c040001 40810048
89030096 2c080001
4082000c 2c040012
40810034 80630018
3c808058 60849bd0
7c8903a6 4e800421
c0430034 fc601210
ec42182a c06c0000
c08c0004 ec4220fa
ec0000b2 7f83e378
60000000 00000000

NTSC-J:
048a4c10 42e10000
048a4c1c 43430000
048a4d24 43c30000
048a4d84 43430000
048a4d94 496a6000
048a4f20 431d8000
048b4c7c 3ebbbbbc
048b4dd8 40900000
048ca6a0 42d20000
04577ed8 3d804334
04577edc 919e002c
0457b31c 3c804359
0457b320 60848000
0457b324 9083002c
0457b330 3c804334
0457b334 9083002c
c257b544 00000003
48000009 43598000
7d8802a6 c00c0000
60000000 00000000
c2585248 00000003
48000009 43598000
7d8802a6 c00c0000
60000000 00000000
c257b6dc 00000003
48000009 430e8000
7d8802a6 c00c0000
60000000 00000000
c257b700 00000003
48000009 431d8000
7d8802a6 c00c0000
60000000 00000000
c2591b14 00000006
48000009 3fc00000
7d8802a6 c04c0000
c063000c ec6200f2
d063000c ec020032
ec220072 ec01002a
60000000 00000000
04591b34 ec0100ba
04591b44 ec0100ba
04591b54 ec0100ba
04591b64 ec0100ba
c2584a48 00000004
48000009 3f2aaaab
7d8802a6 c0ec0000
ec070032 d01e0020
60000000 00000000
c251ef78 00000003
70680240 2c080240
40820008 60c60010
60c60001 00000000
c251fc1c 00000003
70a40220 2c040220
40820008 61080010
61080001 00000000
c2745320 00000003
70660404 2c060404
40820008 63ff0010
63ff0001 00000000
c27455dc 00000003
70830600 2c030600
40820008 60000010
60000001 00000000
c257a76c 00000009
7c8b2378 5563073e
2c03000f 40820034
7fa3eb78 3c808058
6084fd74 7c8903a6
4e800421 a063002c
546306f7 41820014
3c808057 6084a80c
7c8903a6 4e800420
556307ff 00000000
c26fa664 0000000d
7c0a0378 7c6b1b78
7c8c2378 555bf7fe
554506fe 2c05000f
40820040 806c0018
3ca08058 60a5fd74
7ca903a6 4e800421
a0a3002c 54a506f7
41820020 55450001
40820018 554502d7
40820010 3b600000
3b800001 3bc00000
7d846378 7d635b78
7d405378 00000000
c2699304 00000014
807e0118 80630000
80630004 80c30004
54c506fe 2c05000f
40820048 80630018
3ca08058 60a5fd74
7ca903a6 4e800421
a0a3002c 54a506f7
41820028 54c50001
40820020 54c502d7
40820018 38a00001
98a30015 3fa0806a
63bd1044 48000020
88a30015 2c050001
40820030 38a00000
98a30015 3fa0806a
63bd11d4 7fc3f378
809e0614 38a00019
38c0001a 38e00001
7fa903a6 4e800421
396100a0 00000000
c26985bc 00000019
7c1e0378 807f0118
80630000 80630004
80c30004 54c506fe
2c05000f 40820048
80630018 3ca08058
60a5fd74 7ca903a6
4e800421 a0a3002c
54a506f7 41820028
54c50001 40820020
54c502d7 40820018
38a00001 98a30015
3fa0806a 63bd1044
48000020 88a30015
2c050001 4082004c
38a00000 98a30015
3fa0806a 63bd11d4
7fe3fb78 809f0530
38a00022 38c00023
38e00000 7fa903a6
4e800421 7fe3fb78
809f0530 38a00023
38c00024 38e00001
7fa903a6 4e800421
7fc0f378 80010024
60000000 00000000
c259610c 0000000f
4800000d 3e99999a
3f800000 7d8802a6
7c8b2378 c01f004c
807d001c 8083001c
2c040001 40810048
89030096 2c080001
4082000c 2c040012
40810034 80630018
3c808058 6084fd74
7c8903a6 4e800421
c0430034 fc601210
ec42182a c06c0000
c08c0004 ec4220fa
ec0000b2 7d645b78
7fc3f378 00000000
c2596d10 00000013
4800000d 3e99999a
3f800000 7d8802a6
39000001 807c001c
8083001c 2c040000
40820020 39000000
99030096 81030004
55080631 4182000c
39000001 99030096
2c040001 40810048
89030096 2c080001
4082000c 2c040012
40810034 80630018
3c808058 6084fd74
7c8903a6 4e800421
c0430034 fc601210
ec42182a c06c0000
c08c0004 ec4220fa
ec0000b2 7f83e378
60000000 00000000

NTSC-K:
04893f10 42e10000
04893f1c 43430000
04894024 43c30000
04894084 43430000
04894094 496a6000
04894220 431d8000
048a3f94 3ebbbbbc
048a40f0 40900000
048b99e8 42d20000
045665b0 3d804334
045665b4 919e002c
045699f4 3c804359
045699f8 60848000
045699fc 9083002c
04569a08 3c804334
04569a0c 9083002c
c2569c1c 00000003
48000009 43598000
7d8802a6 c00c0000
60000000 00000000
c2573920 00000003
48000009 43598000
7d8802a6 c00c0000
60000000 00000000
c2569db4 00000003
48000009 430e8000
7d8802a6 c00c0000
60000000 00000000
c2569dd8 00000003
48000009 431d8000
7d8802a6 c00c0000
60000000 00000000
c25801ec 00000006
48000009 3fc00000
7d8802a6 c04c0000
c063000c ec6200f2
d063000c ec020032
ec220072 ec01002a
60000000 00000000
0458020c ec0100ba
0458021c ec0100ba
0458022c ec0100ba
0458023c ec0100ba
c2573120 00000004
48000009 3f2aaaab
7d8802a6 c0ec0000
ec070032 d01e0020
60000000 00000000
c250d61c 00000003
70680240 2c080240
40820008 60c60010
60c60001 00000000
c250e2c0 00000003
70a40220 2c040220
40820008 61080010
61080001 00000000
c2734074 00000003
70660404 2c060404
40820008 63ff0010
63ff0001 00000000
c2734330 00000003
70830600 2c030600
40820008 60000010
60000001 00000000
c2568e44 00000009
7c8b2378 5563073e
2c03000f 40820034
7fa3eb78 3c808057
6084e44c 7c8903a6
4e800421 a063002c
546306f7 41820014
3c808056 60848ee4
7c8903a6 4e800420
556307ff 00000000
c26e93a0 0000000d
7c0a0378 7c6b1b78
7c8c2378 555bf7fe
554506fe 2c05000f
40820040 806c0018
3ca08057 60a5e44c
7ca903a6 4e800421
a0a3002c 54a506f7
41820020 55450001
40820018 554502d7
40820010 3b600000
3b800001 3bc00000
7d846378 7d635b78
7d405378 00000000
c2688040 00000014
807e0118 80630000
80630004 80c30004
54c506fe 2c05000f
40820048 80630018
3ca08057 60a5e44c
7ca903a6 4e800421
a0a3002c 54a506f7
41820028 54c50001
40820020 54c502d7
40820018 38a00001
98a30015 3fa08068
63bdfd80 48000020
88a30015 2c050001
40820030 38a00000
98a30015 3fa08068
63bdff10 7fc3f378
809e0614 38a00019
38c0001a 38e00001
7fa903a6 4e800421
396100a0 00000000
c26872f8 00000019
7c1e0378 807f0118
80630000 80630004
80c30004 54c506fe
2c05000f 40820048
80630018 3ca08057
60a5e44c 7ca903a6
4e800421 a0a3002c
54a506f7 41820028
54c50001 40820020
54c502d7 40820018
38a00001 98a30015
3fa08068 63bdfd80
48000020 88a30015
2c050001 4082004c
38a00000 98a30015
3fa08068 63bdff10
7fe3fb78 809f0530
38a00022 38c00023
38e00000 7fa903a6
4e800421 7fe3fb78
809f0530 38a00023
38c00024 38e00001
7fa903a6 4e800421
7fc0f378 80010024
60000000 00000000
c25847e4 0000000f
4800000d 3e99999a
3f800000 7d8802a6
7c8b2378 c01f004c
807d001c 8083001c
2c040001 40810048
89030096 2c080001
4082000c 2c040012
40810034 80630018
3c808057 6084e44c
7c8903a6 4e800421
c0430034 fc601210
ec42182a c06c0000
c08c0004 ec4220fa
ec0000b2 7d645b78
7fc3f378 00000000
c25853e8 00000013
4800000d 3e99999a
3f800000 7d8802a6
39000001 807c001c
8083001c 2c040000
40820020 39000000
99030096 81030004
55080631 4182000c
39000001 99030096
2c040001 40810048
89030096 2c080001
4082000c 2c040012
40810034 80630018
3c808057 6084e44c
7c8903a6 4e800421
c0430034 fc601210
ec42182a c06c0000
c08c0004 ec4220fa
ec0000b2 7f83e378
60000000 00000000

Source code:

Patch some game constants:

Code:
PAL      NTSC-U   NTSC-J   NTSC-K   value    description
808a5ab0 808a0fd8 808a4c10 80893f10 42e10000
808a5abc 808a0fe4 808a4c1c 80893f1c 43430000
808a5bc4 808a10ec 808a4d24 80894024 43c30000
808a5c24 808a114c 808a4d84 80894084 43430000
808a5c34 808a115c 808a4d94 80894094 496a6000
808a5dc0 808a12e8 808a4f20 80894220 431d8000
808b5b1c 808b125c 808b4c7c 808a3f94 3ebbbbbc minimum drift speed
808b5c78 808b13b8 808b4dd8 808a40f0 40900000 regular boost acceleration
808cb550 808c6048 808ca6a0 808b99e8 42d20000
Multiply some speed limits by 1.5:

Code:
# replace at 80578558 (PAL)
# replace at 80571cf4 (NTSC-U)
# replace at 80577ed8 (NTSC-J)
# replace at 805665b0 (NTSC-K)

lis r12, 0x4334 # 180.0f
stw r12, 0x2c (r30)


# replace at 8057b99c (PAL)
# replace at 80575138 (NTSC-U)
# replace at 8057b31c (NTSC-J)
# replace at 805699f4 (NTSC-K)

lis r4, 0x4359
ori r4, r4, 0x8000 # 217.5f
stw r4, 0x2c (r3)


# replace at 8057b9b0 (PAL)
# replace at 8057514c (NTSC-U)
# replace at 8057b330 (NTSC-J)
# replace at 80569a08 (NTSC-K)

lis r4, 0x4334 # 180.0f
stw r4, 0x2c (r3)


# inject at 8057bbc4 (PAL)
# inject at 80575360 (NTSC-U)
# inject at 8057b544 (NTSC-J)
# inject at 80569c1c (NTSC-K)

bl float

.long 0x43598000 # 217.5f

float:
mflr r12

lfs f0, 0x0 (r12)


# inject at 805858c8 (PAL)
# inject at 8057f0a4 (NTSC-U)
# inject at 80585248 (NTSC-J)
# inject at 80573920 (NTSC-K)

bl float

.long 0x43598000 # 217.5f

float:
mflr r12

lfs f0, 0x0 (r12)


# inject at 8057bd5c (PAL)
# inject at 805754f8 (NTSC-U)
# inject at 8057b6dc (NTSC-J)
# inject at 80569db4 (NTSC-K)

bl float

.long 0x430e8000 # 142.5f

float:
mflr r12

lfs f0, 0x0 (r12)


# inject at 8057bd80 (PAL)
# inject at 8057551c (NTSC-U)
# inject at 8057b700 (NTSC-J)
# inject at 80569dd8 (NTSC-K)

bl float

.long 0x431d8000 # 157.5f

float:
mflr r12

lfs f0, 0x0 (r12)
Multiply the speed stat and the vehicle standard acceleration stat by 1.5:

Code:
# inject at 80592194 (PAL)
# inject at 8058b970 (NTSC-U)
# inject at 80591b14 (NTSC-J)
# inject at 805801ec (NTSC-K)

bl float

.long 0x3fc00000 # 1.5f

float:
mflr r12

lfs f2, 0x0 (r12)

lfs f3, 0xc (r3)
fmuls f3, f2, f3
stfs f3, 0xc (r3)

fmuls f0, f2, f0
fmuls f1, f2, f1
fadds f0, f1, f0


# replace at 805921b4 (PAL)
# replace at 8058b990 (NTSC-U)
# replace at 80591b34 (NTSC-J)
# replace at 8058020c (NTSC-K)

fmadds f0, f1, f2, f0


# replace at 805921c4 (PAL)
# replace at 8058b9a0 (NTSC-U)
# replace at 80591b44 (NTSC-J)
# replace at 8058021c (NTSC-K)

fmadds f0, f1, f2, f0


# replace at 805921d4 (PAL)
# replace at 8058b9b0 (NTSC-U)
# replace at 80591b54 (NTSC-J)
# replace at 8058022c (NTSC-K)

fmadds f0, f1, f2, f0


# replace at 805921e4 (PAL)
# replace at 8058b9c0 (NTSC-U)
# replace at 80591b64 (NTSC-J)
# replace at 8058023c (NTSC-K)

fmadds f0, f1, f2, f0
Divide the cannon exit speed by 1.5

Code:
# inject at 805850c8 (PAL)
# inject at 8057e8a4 (NTSC-U)
# inject at 80584a48 (NTSC-J)
# inject at 80573120 (NTSC-K)

bl float

.long 0x3f2aaaab # 0.6666667

float:
mflr r12

lfs f7, 0x0 (r12)
fmuls f0, f7, f0
stfs f0, 0x20 (r30)
Set the brake drifting bit when pressing A, B and R with the classic controller:

Code:
# inject at 8051f5f8 (PAL)
# inject at 8051b184 (NTSC-U)
# inject at 8051ef78 (NTSC-J)
# inject at 8050d61c (NTSC-K)

andi. r8, r3, 0x240
cmpwi r8, 0x240
bne end # (buttonRaw & (B | R)) != (B | R)

ori r6, r6, 0x10

end:
ori r6, r6, 0x1 # original instruction
Set the brake drifting bit when pressing A, B and R with the GCN controller:

Code:
# inject at 8052029c (PAL)
# inject at 8051be28 (NTSC-U)
# inject at 8051fc1c (NTSC-J)
# inject at 8050e2c0 (NTSC-K)

andi. r4, r5, 0x220
cmpwi r4, 0x220
bne end # (buttonRaw & (B | R)) != (B | R)

ori r8, r8, 0x10

end:
ori r8, r8, 0x1 # original instruction
Set the brake drifting bit when pressing A, B and D-pad down with the Nunchuk:

Code:
# inject at 80745cb4 (PAL)
# inject at 80735de8 (NTSC-U)
# inject at 80745320 (NTSC-J)
# inject at 80734074 (NTSC-K)

andi. r6, r3, 0x404
cmpwi r6, 0x404
bne end # (buttonRaw & (B | R)) != (B | R)

ori r31, r31, 0x10

end:
ori r31, r31, 0x1 # original instruction
Set the brake drifting bit when pressing 2, 1 and B with the Wii Wheel:

Code:
# inject at 80745f70 (PAL)
# inject at 807360a4 (NTSC-U)
# inject at 807455dc (NTSC-J)
# inject at 80734330 (NTSC-K)

andi. r3, r4, 0x600
cmpwi r3, 0x600
bne end

ori r0, r0, 0x10

end:
ori r0, r0, 0x1 # original instruction
Brake when drifting and the brake drifting bit is set:

Code:
# inject at 8057adec (PAL)
# inject at 80574588 (NTSC-U)
# inject at 8057a76c (NTSC-J)
# inject at 80568e44 (NTSC-K)

.set region, ''

.if (region == 'P')
        .set Player_getControllerHolder, 0x805903f4
        .set braking, 0x8057ae8c
.elseif (region == 'E')
        .set Player_getControllerHolder, 0x80589bd0
        .set braking, 0x80574628
.elseif (region == 'J')
        .set Player_getControllerHolder, 0x8058fd74
        .set braking, 0x8057a80c
.elseif (region == 'K')
        .set Player_getControllerHolder, 0x8057e44c
        .set braking, 0x80568ee4
.else
        .err
.endif

mr r11, r4

rlwinm r3, r11, 0, 28, 31
cmpwi r3, 0xf
bne end

mr r3, r29
lis r4, Player_getControllerHolder@h
ori r4, r4, Player_getControllerHolder@l
mtctr r4
bctrl

lhz r3, 0x2c (r3)
rlwinm. r3, r3, 0, 27, 27
beq end

lis r4, braking@h
ori r4, r4, braking@l
mtctr r4
bctr

end:
rlwinm. r3, r11, 0, 31, 31 # original instruction
Brake drifting sound:

Code:
# inject at 806faff8 (PAL)
# inject at 806f6090 (NTSC-U)
# inject at 806fa664 (NTSC-J)
# inject at 806e93a0 (NTSC-K)

.set region, ''

.if (region == 'P')
        .set Player_getControllerHolder, 0x805903f4
.elseif (region == 'E')
        .set Player_getControllerHolder, 0x80589bd0
.elseif (region == 'J')
        .set Player_getControllerHolder, 0x8058fd74
.elseif (region == 'K')
        .set Player_getControllerHolder, 0x8057e44c
.else
        .err
.endif

mr r10, r0
mr r11, r3
mr r12, r4

rlwinm r27, r10, 30, 31, 31 # original instruction

rlwinm r5, r10, 0, 27, 31
cmpwi r5, 0xf
bne end # !drifting

lwz r3, 0x18 (r12)
lis r5, Player_getControllerHolder@h
ori r5, r5, Player_getControllerHolder@l
mtctr r5
bctrl

lhz r5, 0x2c (r3)
rlwinm. r5, r5, 0, 27, 27
beq end

rlwinm. r5, r10, 0, 0, 0
bne end

rlwinm. r5, r10, 0, 11, 11
bne end

li r27, 0x0
li r28, 0x1
li r30, 0x0

end:
mr r4, r12
mr r3, r11
mr r0, r10
Brake drifting particles effect for bikes:

Code:
# inject at 80699c98 (PAL)
# inject at 80695810 (NTSC-U)
# inject at 80699304 (NTSC-J)
# inject at 80688040 (NTSC-K)

.set region, ''

.if (region == 'P')
        .set Player_getControllerHolder, 0x805903f4
        .set func0, 0x806a19d8
        .set func1, 0x806a1b68
.elseif (region =='E')
        .set Player_getControllerHolder, 0x80589bd0
        .set func0, 0x8069d550
        .set func1, 0x8069d6e0
.elseif (region =='J')
        .set Player_getControllerHolder, 0x8058fd74
        .set func0, 0x806a1044
        .set func1, 0x806a11d4
.elseif (region =='K')
        .set Player_getControllerHolder, 0x8057e44c
        .set func0, 0x8068fd80
        .set func1, 0x8068ff10
.else
        .err
.endif

lwz r3, 0x118 (r30)
lwz r3, 0x0 (r3)
lwz r3, 0x4 (r3)
lwz r6, 0x4 (r3)
rlwinm r5, r6, 0, 27, 31
cmpwi r5, 0xf
bne not_brake_drifting # !drifting

lwz r3, 0x18 (r3)
lis r5, Player_getControllerHolder@h
ori r5, r5, Player_getControllerHolder@l
mtctr r5
bctrl

lhz r5, 0x2c (r3)
rlwinm. r5, r5, 0, 27, 27
beq not_brake_drifting

rlwinm. r5, r6, 0, 0, 0
bne not_brake_drifting

rlwinm. r5, r6, 0, 11, 11
bne not_brake_drifting

li r5, 0x1
stb r5, 0x15 (r3)

lis r29, func0@h
ori r29, r29, func0@l

b call_func

not_brake_drifting:
lbz r5, 0x15 (r3)

cmpwi r5, 0x1
bne end

li r5, 0x0
stb r5, 0x15 (r3)

lis r29, func1@h
ori r29, r29, func1@l

call_func:
mr r3, r30
lwz r4, 0x614 (r30)
li r5, 0x19
li r6, 0x1a
li r7, 0x1
mtctr r29
bctrl

end:
addi r11, r1, 0xa0 # original instruction
Brake drifting particles effect for karts:

Code:
# inject at 80698f50 (PAL)
# inject at 80694ac8 (NTSC-U)
# inject at 806985bc (NTSC-J)
# inject at 806872f8 (NTSC-K)

.set region, ''

.if (region == 'P')
        .set Player_getControllerHolder, 0x805903f4
        .set func0, 0x806a19d8
        .set func1, 0x806a1b68
.elseif (region =='E')
        .set Player_getControllerHolder, 0x80589bd0
        .set func0, 0x8069d550
        .set func1, 0x8069d6e0
.elseif (region =='J')
        .set Player_getControllerHolder, 0x8058fd74
        .set func0, 0x806a1044
        .set func1, 0x806a11d4
.elseif (region =='K')
        .set Player_getControllerHolder, 0x8057e44c
        .set func0, 0x8068fd80
        .set func1, 0x8068ff10
.else
        .err
.endif

mr r30, r0

lwz r3, 0x118 (r31)
lwz r3, 0x0 (r3)
lwz r3, 0x4 (r3)
lwz r6, 0x4 (r3)
rlwinm r5, r6, 0, 27, 31
cmpwi r5, 0xf
bne not_brake_drifting # !drifting

lwz r3, 0x18 (r3)
lis r5, Player_getControllerHolder@h
ori r5, r5, Player_getControllerHolder@l
mtctr r5
bctrl

lhz r5, 0x2c (r3)
rlwinm. r5, r5, 0, 27, 27
beq not_brake_drifting

rlwinm. r5, r6, 0, 0, 0
bne not_brake_drifting

rlwinm. r5, r6, 0, 11, 11
bne not_brake_drifting

li r5, 0x1
stb r5, 0x15 (r3)

lis r29, func0@h
ori r29, r29, func0@l

b call_funcs

not_brake_drifting:
lbz r5, 0x15 (r3)

cmpwi r5, 0x1
bne end

li r5, 0x0
stb r5, 0x15 (r3)

lis r29, func1@h
ori r29, r29, func1@l

call_funcs:
mr r3, r31
lwz r4, 0x530 (r31)
li r5, 0x22
li r6, 0x23
li r7, 0x0
mtctr r29
bctrl

mr r3, r31
lwz r4, 0x530 (r31)
li r5, 0x23
li r6, 0x24
li r7, 0x1
mtctr r29
bctrl

end:
mr r0, r30

lwz r0, 0x24 (r1) # original instruction
Update the vehicle body gravity when fast falling:

Code:
# inject at 8059678c (PAL)
# inject at 8058ff68 (NTSC-U)
# inject at 8059610c (NTSC-J)
# inject at 805847e4 (NTSC-K)

.set region, ''

.if (region == 'P')
        .set Player_getControllerHolder, 0x805903f4
.elseif (region == 'E')
        .set Player_getControllerHolder, 0x80589bd0
.elseif (region == 'J')
        .set Player_getControllerHolder, 0x8058fd74
.elseif (region == 'K')
        .set Player_getControllerHolder, 0x8057e44c
.else
        .err
.endif

bl floats

.long 0x3e99999a # 0.3f
.long 0x3f800000 # 1.0f

floats:
mflr r12

mr r11, r4

lfs f0, 0x4c (r31) # -1.3f

lwz r3, 0x1c (r29) # playerSub->playerSub_1c
lwz r4, 0x1c (r3) # playerSub_1c->airtime

cmpwi r4, 0x1
ble end # airtime < 2

lbz r8, 0x96 (r3)
cmpwi r8, 0x1
bne not_hopping

cmpwi r4, 0x12
ble end # airtime < 19

not_hopping:
lwz r3, 0x18 (r3)
lis r4, Player_getControllerHolder@h
ori r4, r4, Player_getControllerHolder@l
mtctr r4
bctrl

lfs f2, 0x34 (r3) # controllerHolder->currentInputState.stickY
fabs f3, f2
fadds f2, f2, f3 # stickY <= 0.0f ? 0.0f : 2.0f * stickY
lfs f3, 0x0 (r12) # 0.3f
lfs f4, 0x4 (r12) # 1.0f
fmadds f2, f2, f3, f4
fmuls f0, f0, f2

end:

mr r4, r11
mr r3, r30
Update the wheel gravity when fast falling, and store wheter the current sequence was caused by hopping or not:

Code:
# inject at 80597390 (PAL)
# inject at 80590b6c (NTSC-U)
# inject at 80596d10 (NTSC-J)
# inject at 805853e8 (NTSC-K)

.set region, ''

.if (region == 'P')
        .set Player_getControllerHolder, 0x805903f4
.elseif (region == 'E')
        .set Player_getControllerHolder, 0x80589bd0
.elseif (region == 'J')
        .set Player_getControllerHolder, 0x8058fd74
.elseif (region == 'K')
        .set Player_getControllerHolder, 0x8057e44c
.else
        .err
.endif

bl floats

.long 0x3e99999a # 0.3f
.long 0x3f800000 # 1.0f

floats:
mflr r12

li r8, 0x1

lwz r3, 0x1c (r28) # playerSub->playerSub_1c
lwz r4, 0x1c (r3) # playerSub_1c->airtime

cmpwi r4, 0x0
bne not_first_frame # airtime != 0

li r8, 0x0
stb r8, 0x96 (r3)
lwz r8, 0x4 (r3)
rlwinm. r8, r8, 0, 24, 24
beq not_pressing_hop_button # !(playerSub_1c->bitfield0 & DRIFT_START)

li r8, 0x1
stb r8, 0x96 (r3)

not_pressing_hop_button:
not_first_frame:
cmpwi r4, 0x1
ble end # airtime < 2

lbz r8, 0x96 (r3)
cmpwi r8, 0x1
bne not_hopping

cmpwi r4, 0x12
ble end # airtime < 19

not_hopping:
lwz r3, 0x18 (r3)
lis r4, Player_getControllerHolder@h
ori r4, r4, Player_getControllerHolder@l
mtctr r4
bctrl

lfs f2, 0x34 (r3) # controllerHolder->currentInputState.stickY
fabs f3, f2
fadds f2, f2, f3 # stickY <= 0.0f ? 0.0f : 2.0f * stickY
lfs f3, 0x0 (r12) # 0.3f
lfs f4, 0x4 (r12) # 1.0f
fmadds f2, f2, f3, f4
fmuls f0, f0, f2

end:
mr r3, r28 # original instruction

Original code by: MrBean35000vr

Ported to GCT and shortened by: _tZ and stebler
Reply
#2
i found bugs that bill speed is still default, and the max speed returns to default after billed.
but anyway, it's a nice code
Reply
#3
(12-29-2020, 06:21 AM)9Paran Wrote: i found bugs that bill speed is still default, and the max speed returns to default after billed.
but anyway, it's a nice code

I just updated the code with the fix for this bug.
Reply
#4
Thank you so much! May the 200cc TASes commence!
Reply
#5
Question, does this only go over 150cc? or is it its own cc engine class?
~MarioKartWii.com #1~
Reply
#6
(12-30-2020, 10:15 PM)TheNinjaKingOW Wrote: Question, does this only go over 150cc? or is it its own cc engine class?

It replaces 150cc.
Reply
#7
(01-02-2021, 02:19 PM)stebler Wrote:
(12-30-2020, 10:15 PM)TheNinjaKingOW Wrote: Question, does this only go over 150cc? or is it its own cc engine class?

It replaces 150cc.
Ok, thats good!
~MarioKartWii.com #1~
Reply
#8
Can we just have a F for the replica I spent like 3 days finding codes for?
~MarioKartWii.com #1~
Reply
#9
To use brake drifting and fast falling with speed multipliers other than 1.5, you can remove the 48 first lines (last removed line is a "60000000 00000000") and replace them with the following.

50cc (0.8): CC Changer with X = 0.

100cc (0.9): CC Changer with X = 1.

150cc (1.0): nothing.

"350cc" (2.0):

PAL:
048a5ab0 43160000
048a5abc 43820000
048a5bc4 44020000
048a5c24 43820000
048a5c34 499c4000
048a5dc0 43520000
048b5b1c 3e8ccccd
048b5c78 40c00000
048cb550 430c0000
04578558 3d804370
0457855c 919e002c
0457b9a0 3c804391
0457b9a4 9083002c
0457b9b0 3c804370
0457b9b4 9083002c
c257bbc4 00000003
48000009 43910000
7d8802a6 c00c0000
60000000 00000000
c25858c8 00000003
48000009 43910000
7d8802a6 c00c0000
60000000 00000000
c257bd5c 00000003
48000009 433e0000
7d8802a6 c00c0000
60000000 00000000
c257bd80 00000003
48000009 43520000
7d8802a6 c00c0000
60000000 00000000
c2592194 00000006
48000009 40000000
7d8802a6 c04c0000
c063000c ec6200f2
d063000c ec020032
ec220072 ec01002a
60000000 00000000
045921b4 ec0100ba
045921c4 ec0100ba
045921d4 ec0100ba
045921e4 ec0100ba
c25850c8 00000004
48000009 3f000000
7d8802a6 c0ec0000
ec070032 d01e0020
60000000 00000000

NTSC-U:
048a0fd8 43160000
048a0fe4 43820000
048a10ec 44020000
048a114c 43820000
048a115c 499c4000
048a12e8 43520000
048b125c 3e8ccccd
048b13b8 40c00000
048c6048 430c0000
04571cf4 3d804370
04571cf8 919e002c
0457513c 3c804391
04575140 9083002c
0457514c 3c804370
04575150 9083002c
c2575360 00000003
48000009 43910000
7d8802a6 c00c0000
60000000 00000000
c257f0a4 00000003
48000009 43910000
7d8802a6 c00c0000
60000000 00000000
c25754f8 00000003
48000009 433e0000
7d8802a6 c00c0000
60000000 00000000
c257551c 00000003
48000009 43520000
7d8802a6 c00c0000
60000000 00000000
c258b970 00000006
48000009 40000000
7d8802a6 c04c0000
c063000c ec6200f2
d063000c ec020032
ec220072 ec01002a
60000000 00000000
0458b990 ec0100ba
0458b9a0 ec0100ba
0458b9b0 ec0100ba
0458b9c0 ec0100ba
c257e8a4 00000004
48000009 3f000000
7d8802a6 c0ec0000
ec070032 d01e0020
60000000 00000000

NTSC-J:
048a4c10 43160000
048a4c1c 43820000
048a4d24 44020000
048a4d84 43820000
048a4d94 499c4000
048a4f20 43520000
048b4c7c 3e8ccccd
048b4dd8 40c00000
048ca6a0 430c0000
04577ed8 3d804370
04577edc 919e002c
0457b320 3c804391
0457b324 9083002c
0457b330 3c804370
0457b334 9083002c
c257b544 00000003
48000009 43910000
7d8802a6 c00c0000
60000000 00000000
c2585248 00000003
48000009 43910000
7d8802a6 c00c0000
60000000 00000000
c257b6dc 00000003
48000009 433e0000
7d8802a6 c00c0000
60000000 00000000
c257b700 00000003
48000009 43520000
7d8802a6 c00c0000
60000000 00000000
c2591b14 00000006
48000009 40000000
7d8802a6 c04c0000
c063000c ec6200f2
d063000c ec020032
ec220072 ec01002a
60000000 00000000
04591b34 ec0100ba
04591b44 ec0100ba
04591b54 ec0100ba
04591b64 ec0100ba
c2584a48 00000004
48000009 3f000000
7d8802a6 c0ec0000
ec070032 d01e0020
60000000 00000000

NTSC-K:
04893f10 43160000
04893f1c 43820000
04894024 44020000
04894084 43820000
04894094 499c4000
04894220 43520000
048a3f94 3e8ccccd
048a40f0 40c00000
048b99e8 430c0000
045665b0 3d804370
045665b4 919e002c
045699f8 3c804391
045699fc 9083002c
04569a08 3c804370
04569a0c 9083002c
c2569c1c 00000003
48000009 43910000
7d8802a6 c00c0000
60000000 00000000
c2573920 00000003
48000009 43910000
7d8802a6 c00c0000
60000000 00000000
c2569db4 00000003
48000009 433e0000
7d8802a6 c00c0000
60000000 00000000
c2569dd8 00000003
48000009 43520000
7d8802a6 c00c0000
60000000 00000000
c25801ec 00000006
48000009 40000000
7d8802a6 c04c0000
c063000c ec6200f2
d063000c ec020032
ec220072 ec01002a
60000000 00000000
0458020c ec0100ba
0458021c ec0100ba
0458022c ec0100ba
0458023c ec0100ba
c2573120 00000004
48000009 3f000000
7d8802a6 c0ec0000
ec070032 d01e0020
60000000 00000000

400cc (2.25): TBD

Bigger speed multipliers: TBD
Reply
#10
I could be wrong, But the JPN code doesn't work for me.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)