200cc (CTGP Replica)
#11
This will help you play with this code if you mean that you don’t know how to use this code.
https://mkwii.com/showthread.php?tid=223
#12
Brake drifting v0.3

NTSC-U:
c251bea0 00000006
55040739 41820020
a09c0090 548406b5
41820014 a09c0090
548405ad 41820008
61080010 b11d0004
60000000 00000000
c251b1ec 00000005
54c40739 41820018
54640673 41820010
546405ad 41820008
60c60010 5464073b
60000000 00000000
c2735e6c 00000005
57e00739 41820018
5460077b 41820010
5460056b 41820008
63ff0010 b3fc0004
60000000 00000000
c2736200 00000006
54040739 41820020
a09c0002 548405ad
41820014 a09c0002
5484056b 41820008
60000010 b01b0004
60000000 00000000
c258e1cc 00000003
540307fe 5400e7fe
68000001 7c001839
60000000 00000000
045776e8 60000000
c2574620 00000002
2c000001 41820008
548307ff 00000000

PAL:
c2520314 00000006
55040739 41820020
a09c0090 548406b5
41820014 a09c0090
548405ad 41820008
61080010 b11d0004
60000000 00000000
c251f660 00000005
54c40739 41820018
54640673 41820010
546405ad 41820008
60c60010 5464073b
60000000 00000000
c2745d38 00000005
57e00739 41820018
5460077b 41820010
5460056b 41820008
63ff0010 b3fc0004
60000000 00000000
c27460cc 00000006
54040739 41820020
a09c0002 548405ad
41820014 a09c0002
5484056b 41820008
60000010 b01b0004
60000000 00000000
c25949f0 00000003
540307fe 5400e7fe
68000001 7c001839
60000000 00000000
0457df4c 60000000
c257ae84 00000002
2c000001 41820008
548307ff 00000000

NTSC-J:
c251fc94 00000006
55040739 41820020
a09c0090 548406b5
41820014 a09c0090
548405ad 41820008
61080010 b11d0004
60000000 00000000
c251efe0 00000005
54c40739 41820018
54640673 41820010
546405ad 41820008
60c60010 5464073b
60000000 00000000
c2745d38 00000005
57e00739 41820018
5460077b 41820010
5460056b 41820008
63ff0010 b3fc0004
60000000 00000000
c2745738 00000006
54040739 41820020
a09c0002 548405ad
41820014 a09c0002
5484056b 41820008
60000010 b01b0004
60000000 00000000
c2594370 00000003
540307fe 5400e7fe
68000001 7c001839
60000000 00000000
0457d8cc 60000000
c257a804 00000002
2c000001 41820008
548307ff 00000000

NTSC-K:
c250e338 00000006
55040739 41820020
a09c0090 548406b5
41820014 a09c0090
548405ad 41820008
61080010 b11d0004
60000000 00000000
c250d684 00000005
54c40739 41820018
54640673 41820010
546405ad 41820008
60c60010 5464073b
60000000 00000000
c27340f8 00000005
57e00739 41820018
5460077b 41820010
5460056b 41820008
63ff0010 b3fc0004
60000000 00000000
c273448c 00000006
54040739 41820020
a09c0002 548405ad
41820014 a09c0002
5484056b 41820008
60000010 b01b0004
60000000 00000000
c2582a48 00000003
540307fe 5400e7fe
68000001 7c001839
60000000 00000000
0456bfa4 60000000
c2568edc 00000002
2c000001 41820008
548307ff 00000000

Patch 1: set the brake drifting bit when both B and R are pressed and the player is drifting (GCN controller)
# inject at 8051BEA0 (NTSC-U)
# inject at 80520314 (PAL)
# inject at 8051FC94 (NTSC-J)
# inject at 8050E338 (NTSC-K)
rlwinm. r4, r8, 0, 28, 28
beq end
lhz r4, 0x90 (r28)
rlwinm. r4, r4, 0, 26, 26
beq end
lhz r4, 0x90 (r28)
rlwinm. r4, r4, 0, 22, 22
beq end
ori r8, r8, 0x10
end:
sth r8, 0x4 (r29)

Patch 2: set the brake drifting bit when both B and R are pressed and the player is drifting (classic controller)
# inject at 8051B1EC (NTSC-U)
# inject at 8051F660 (PAL)
# inject at 8051EFE0 (NTSC-J)
# inject at 8050D684 (NTSC-K)
rlwinm. r4, r6, 0, 28, 28
beq end
rlwinm. r4, r3, 0, 25, 25
beq end
rlwinm. r4, r3, 0, 22, 22
beq end
ori r6, r6, 0x10
end:
rlwinm. r4, r3, 0, 28, 29

Patch 3: set the brake drifting bit when both B and d-pad down are pressed and the player is drifting (nunchuk)
# inject at 80735E6C (NTSC-U)
# inject at 80745D38 (PAL)
# inject at 80745D38 (NTSC-J)
# inject at 807340F8 (NTSC-K)
rlwinm. r0, r31, 0, 28, 28
beq end
rlwinm. r0, r3, 0, 29, 29
beq end
rlwinm. r0, r3, 0, 21, 21
beq end
ori r31, r31, 0x10
end:
sth r31, 0x4 (r28)

Patch 4: set the brake drifting bit when both 1 and B are pressed and the player is drifting (wii wheel)
# inject at 80736200 (NTSC-U)
# inject at 807460CC (PAL)
# inject at 80745738 (NTSC-J)
# inject at 8073448C (NTSC-K)
rlwinm. r4, r0, 0, 28, 28
beq end
lhz r4, 0x2 (r28)
rlwinm. r4, r4, 0, 22, 22
beq end
lhz r4, 0x2 (r28)
rlwinm. r4, r4, 0, 21, 21
beq end
ori r0, r0, 0x10
end:
sth r0, 0x4 (r27)

Patch 5: do not accelerate when the brake drifting bit is set
# inject at 8058E1CC (NTSC-U)
# inject at 805949F0 (PAL)
# inject at 80594370 (NTSC-J)
# inject at 80582A48 (NTSC-K)
rlwinm r3, r0, 0, 31, 31
rlwinm r0, r0, 28, 31, 31
xori r0, r0, 1
and. r0, r0, r3

Patch 6: do not cancel the drifting when the player is no longer accelerating
# replace at 805776E8 (NTSC-U)
# replace at 8057DF4C (PAL)
# replace at 8057D8CC (NTSC-J)
# replace at 8056BFA4 (NTSC-K)
nop

Patch 7: allow breaking while drifting
# replace at 80574620 (NTSC-U)
# replace at 8057AE84 (PAL)
# replace at 8057A804 (NTSC-J)
# replace at 80568EDC (NTSC-K)
cmpwi r0, 1
beq end
rlwinm. r3, r4, 0, 31, 31
end:

Note: just like CTGP, this code uses bit 4 of the button input variable for brake drifting (0 = accelerate, 1 = brake or drift, 2 = use item, 3 = drift, 5 = look backwards).

TODO:
* check that it works online
* work on perfect CTGP compatibility (using ghost replay)

This is my first time working on a code for MKW, so any feedback is welcome!
#13
For someone totally new to these forums, its awesome to see you already can write some good ASM. Have you done any sort of programming in the past?

And welcome to Mkwii.com
#14
(10-30-2020, 04:41 PM)stebler Wrote: Brake drifting POC

NTSC-U:
c251bea0 00000006
55040739 41820020
a09c0090 548406b5
41820014 a09c0090
548405ad 41820008
61080010 b11d0004
60000000 00000000
c251b1ec 00000005
54c40739 41820018
54640673 41820010
546405ad 41820008
60c60010 5464073b
60000000 00000000
c258e1cc 00000003
540307fe 5400e7fe
68000001 7c001839
60000000 00000000
045776e8 60000000
04575a40 60000000

ASM patch 1: set the brake drifting bit when both B and R are pressed and the player is drifting (GCN controller)
# inject at 8051bea0
rlwinm. r4, r8, 0, 28, 28
beq end
lhz r4, 0x90 (r28)
rlwinm. r4, r4, 0, 26, 26
beq end
lhz r4, 0x90 (r28)
rlwinm. r4, r4, 0, 22, 22
beq end
ori r8, r8, 0x10
end:
sth r8, 0x4 (r29)

ASM patch 2: set the brake drifting bit when both B and R are pressed and the player is drifting (classic controller)
# inject at 8051b1ec
rlwinm. r4, r6, 0, 28, 28
beq end
rlwinm. r4, r3, 0, 25, 25
beq end
rlwinm. r4, r3, 0, 22, 22
beq end
ori r6, r6, 0x10
end:
rlwinm. r4, r3, 0, 28, 29

ASM patch 3: do not accelerate when the brake drifting bit is set
# inject at 8058e1cc
rlwinm r3, r0, 0, 31, 31
rlwinm r0, r0, 28, 31, 31
xori r0, r0, 1
and. r0, r0, r3

ASM patch 4: do not cancel the drifting when the player is no longer accelerating
# replace at 805776e8
nop

ASM patch 5: allow breaking while drifting
# replace at 80575a40
nop

Note: just like CTGP, this code uses bit 4 of the button input variable for brake drifting (0 = accelerate, 1 = brake or drift, 2 = use item, 3 = drift, 5 = look backwards).

TODO:
* nunchuk
* wii wheel
* other regions
* test on real Wii
* check that it works online
* check that time trials are saved/loaded correctly
* work on perfect CTGP compatibility (using ghost replay)

This is my first time working on a code for MKW, so any feedback is welcome!

Wow this is amazing! I was wondering if it would be possible to have the PAL version of the code too. Thank you anyway!
#15
(10-31-2020, 10:53 AM)Vega Wrote: For someone totally new to these forums, its awesome to see you already can write some good ASM. Have you done any sort of programming in the past?
Yes, I'm a computer science student.
(10-31-2020, 10:53 AM)Vega Wrote: And welcome to Mkwii.com
Thank you!
#16
(11-02-2020, 11:24 AM)Luke1911 Wrote: Wow this is amazing! I was wondering if it would be possible to have the PAL version of the code too. Thank you anyway!
Added!
#17
(11-04-2020, 11:50 AM)stebler Wrote: Yes, I'm a computer science student.

Then you will learn really fast here. The majority of ASM codes here on the site use very rudimentary ASM w/o any sort of use of actual static analysis. Do you want join our Discord Server?
#18
Holy Shit, I'll try to get an updated version of this code soon. I've been very lazy and this code does have some small issues on the PAL side I need to fix.
~MarioKartWii.com #1~
#19
(10-30-2020, 04:41 PM)stebler Wrote: Brake drifting POC

NTSC-U:
c251bea0 00000006
55040739 41820020
a09c0090 548406b5
41820014 a09c0090
548405ad 41820008
61080010 b11d0004
60000000 00000000
c251b1ec 00000005
54c40739 41820018
54640673 41820010
546405ad 41820008
60c60010 5464073b
60000000 00000000
c258e1cc 00000003
540307fe 5400e7fe
68000001 7c001839
60000000 00000000
045776e8 60000000
04575a40 60000000

PAL:
c2520314 00000006
55040739 41820020
a09c0090 548406b5
41820014 a09c0090
548405ad 41820008
61080010 b11d0004
60000000 00000000
c251f660 00000005
54c40739 41820018
54640673 41820010
546405ad 41820008
60c60010 5464073b
60000000 00000000
c25949f0 00000003
540307fe 5400e7fe
68000001 7c001839
60000000 00000000
0457df4c 60000000
0457c2a4 60000000

ASM patch 1: set the brake drifting bit when both B and R are pressed and the player is drifting (GCN controller)
# inject at 8051bea0 (NTSC-U)
# inject at 80520314 (PAL)
rlwinm. r4, r8, 0, 28, 28
beq end
lhz r4, 0x90 (r28)
rlwinm. r4, r4, 0, 26, 26
beq end
lhz r4, 0x90 (r28)
rlwinm. r4, r4, 0, 22, 22
beq end
ori r8, r8, 0x10
end:
sth r8, 0x4 (r29)

ASM patch 2: set the brake drifting bit when both B and R are pressed and the player is drifting (classic controller)
# inject at 8051b1ec (NTSC-U)
# inject at 8051f660 (PAL)
rlwinm. r4, r6, 0, 28, 28
beq end
rlwinm. r4, r3, 0, 25, 25
beq end
rlwinm. r4, r3, 0, 22, 22
beq end
ori r6, r6, 0x10
end:
rlwinm. r4, r3, 0, 28, 29

ASM patch 3: do not accelerate when the brake drifting bit is set
# inject at 8058e1cc (NTSC-U)
# inject at 805949f0 (PAL)
rlwinm r3, r0, 0, 31, 31
rlwinm r0, r0, 28, 31, 31
xori r0, r0, 1
and. r0, r0, r3

ASM patch 4: do not cancel the drifting when the player is no longer accelerating
# replace at 805776e8 (NTSC-U)
# replace at 8057df4c (PAL)
nop

ASM patch 5: allow breaking while drifting
# replace at 80575a40 (NTSC-U)
# replace at 8057c2a4 (PAL)
nop

Note: just like CTGP, this code uses bit 4 of the button input variable for brake drifting (0 = accelerate, 1 = brake or drift, 2 = use item, 3 = drift, 5 = look backwards).

TODO:
* nunchuk
* wii wheel
* NTSC-J, NTSC-K
* test on real Wii
* check that it works online
* check that time trials are saved/loaded correctly
* work on perfect CTGP compatibility (using ghost replay)

This is my first time working on a code for MKW, so any feedback is welcome!
I tested online and it works for the player using the code, I just need to test multiple players with the code.
~MarioKartWii.com #1~
#20
(11-04-2020, 11:52 AM)stebler Wrote:
(11-02-2020, 11:24 AM)Luke1911 Wrote: Wow this is amazing! I was wondering if it would be possible to have the PAL version of the code too. Thank you anyway!
Added!

Thank you very much!


Forum Jump:


Users browsing this thread: 10 Guest(s)