• Welcome to Smashboards, the world's largest Super Smash Brothers community! Over 250,000 Smash Bros. fans from around the world have come to discuss these great games in over 19 million posts!

    You are currently viewing our boards as a visitor. Click here to sign up right now and start on your path in the Smash community!

Completed D-pad up/down on CSS to toggle rumble (with cursor shake effect)

Joined
Oct 10, 2011
Messages
1,126
Location
Boise, ID
NNID
dansalvato
Relevant blog post:
http://www.20xx.me/blog/toggling-rumble-the-te-way

Code:
Dpad up/down toggles rumble on CSS [Dan Salvato]
C22608D8 00000019
887F0007 2C030000
40820070 7C972378
57800739 40820010
5780077B 40820034
4800009C 7EE3BB78
38800000 38A0000E
38C00000 38ED9950
3D808037 618C8430
7D8903A6 4E800421
38800001 48000008
38800000 7EE3BB78
3D808015 618CED4C
7D8903A6 4E800421
38800001 989F0007
3C80C040 909F0014
C03F0014 C0428E0C
C01F000C EC01002A
D01F000C FC600850
FC030840 41810008
EC6300B2 D07F0014
4180001C C0828258
FC032040 41810010
38800000 909F0014
989F0007 889F0004
60000000 00000000
Pair with the below codes for best results. Causes controller to rumble when a player selects their character, giving a nice indicator for whether or not rumble is on.
Code:
Rumble when character is selected [Dan Salvato]
C2260C3C 00000008
7E639B78 800D8840
7C801A14 88841CC0
2C040000 41820024
38800000 38A0000E
38C00000 38ED9950
3D808037 618C8430
7D8903A6 4E800421
880DB655 00000000
C2260A58 00000008
7E639B78 800D8840
7C801A14 88841CC0
2C040000 41820024
38800000 38A0000E
38C00000 38ED9950
3D808037 618C8430
7D8903A6 4E800421
38000005 00000000
Code:
Ignore Nametag Rumble Setting [Dan Salvato]
04167810 60000000
 
Last edited:

Noc

Smash Journeyman
Joined
Dec 30, 2008
Messages
225
Location
Galveston, TX
I just tested this on console and it works! One thing I noticed is, just like the 20XX change rumble settings from CSS code, it does not change the rumble setting associated with previously made tags. It's not a big deal though since you can still tell if rumble is truly on by the little rumble that occurs when advancing to the stage select screen and it's likely rare for someone to want to change the rumble setting associated with a tag.
 
Joined
Oct 10, 2011
Messages
1,126
Location
Boise, ID
NNID
dansalvato
I just tested this on console and it works! One thing I noticed is, just like the 20XX change rumble settings from CSS code, it does not change the rumble setting associated with previously made tags. It's not a big deal though since you can still tell if rumble is truly on by the little rumble that occurs when advancing to the stage select screen and it's likely rare for someone to want to change the rumble setting associated with a tag.
Thank you for reminding me of this scenario.

Code:
Ignore Nametag Rumble Setting [Dan Salvato]
04167810 60000000
 

Aerros11

Smash Journeyman
Joined
Sep 5, 2009
Messages
284
How does one inject this C2 code into DOL instead of gecko? o__o'|l
 

Achilles1515

Smash Master
Joined
Jun 18, 2007
Messages
3,211
Location
Cincinnati / Columbus OH
Was it really that easy to find XD?
Thank you~
Or use DRGNs DOL Manager program.

This is a cool code, Dan. The shake effect is really creative.
Fwiw, the D-Pad Up/Down to change rumble settings was just a code by Sham Rock and is not used in the 20XX Hack Pack (I was already using those button toggles as well as using the CSP color changes for other things).
 

Aerros11

Smash Journeyman
Joined
Sep 5, 2009
Messages
284
Or use DRGNs DOL Manager program.

This is a cool code, Dan. The shake effect is really creative.
Fwiw, the D-Pad Up/Down to change rumble settings was just a code by Sham Rock and is not used in the 20XX Hack Pack (I was already using those button toggles as well as using the CSP color changes for other things).
Oh DRGN said in his spoiler section
DRGN said:
not all Gecko codes will work (typically 02 & 04 type codes seem to work, but C2 codes fail).
 

Achilles1515

Smash Master
Joined
Jun 18, 2007
Messages
3,211
Location
Cincinnati / Columbus OH
Oh DRGN said in his spoiler section
It definitely works, just don't use the Gecko codes portion of the program.

Use the add new code function in the tools tab and it will be an inject code. The first line of Dans gecko code is
C22608D8

This means the RAM address it is being hooked into is 802608D8.

Use that RAM address as the inject address. Copy the entire code except for the first two lines

C22608D8 00000019

And then change the very last line from 00000000 to 48000000.

Put that in his program as the code to inject. Apply it to your DOL. Done.
 
Last edited:

DRGN

Technowizard
Moderator
Joined
Aug 20, 2005
Messages
2,179
Location
Sacramento, CA
It definitely works, just don't use the Gecko codes portion of the program.

Use the add new code function in the tools tab and it will be an inject code. The first line of Dans gecko code is
C22608D8

This means the RAM address it is being hooked into is 802608D8.

Use that RAM address as the inject address. Copy the entire code except for the first two lines

C22608D8 00000019

And then change the very last line from 00000000 to 48000000.

Put that in his program as the code to inject. Apply it to your DOL. Done.
You don't actually have to change the last line; you can leave it as 00000000 (changing them to 48000000 for any you've already done won't hurt anything or make any difference though).

This definitely saved a few headaches.
Was this explained anywhere D:?

That was so easy.
OMG @__@ Thank you again~
Yeah. A little buried though. It's in the second post, in the "Converting Gecko Codes" spoiler. But thanks for pointing this out. I'll add a note where I first mention Gecko codes in the first post that they can be converted and that that little guide is down there.
 
Last edited:

Aerros11

Smash Journeyman
Joined
Sep 5, 2009
Messages
284
DRGN DRGN , yah I found it right after Achilles told me how to do it. It was a little buried but all in all easy to find. And your thread should've been the first place I looked. Even tatatat0 and myougi ended up messaging me with questions on how I added geckos to dol.

Your program is awesome btw~
(b'--')b
 
Last edited:

jacob91

Smash Cadet
Joined
Feb 4, 2005
Messages
39
Hi, I posted this a couple places elsewhere, and have gone a few days without any help or feedback.

I'm trying to make a simple hack and am having trouble getting the syntax correct or am making some mistake in getting the flash white on successful L-cancel to function.

For reference, I edited the injection codes text file with the following code added:

-==-



Flash White on successful L-cancel
- Character flashes white upon successful L-Cancel
[Geuse]
Version -- DOL Offset ------ Hex to Replace -------
1.02 ------ 0x8A280 ----- C00600E8 -> 4BF76F60
----------- 0xBCD28 ----- 387F0488 -> 4BF444C8

C00600E8 39E000D4
99E30564 48089098
387F0488 89FE0564
2C0F00D4 41820008
480BBB2C 39E00091
99FE0564 3DE0C200
91FE0518 91FE051C
91FE0520 91FE0524
3DE00000 91FE0528
91FE052C 91FE0530
3DE0C280 91FE0534
3DE0800C 61EF0150
7DE903A6 4E800420
480BBB08

-==-
Unfortunately, the above didn't seem to work at all. Can anyone help me figure out how it should be written into the text file to properly function when loaded?

I've looked everywhere I can for answers and I would really appreciate it if someone more familiar with this subject could help me to figure out what I need to do.
 

Punkline

Dr. Frankenstack
Joined
May 15, 2015
Messages
423
tufferugli tufferugli requested some help porting this to PAL, so I’ve commented the ASM, made some ports, and converted it all into DOL mods for MCM.

To make it easier to port, 2 floating points originally loaded from rtoc were changed to instead be built from immediates placed in the stack redzone. One of the constants "0.8" has been approximated as "0.797". There should otherwise be no differences.

Let me know if there are any problems with the ports:

Code:
-==-

Dpad up/down toggles rumble on CSS
[Dan Salvato]
Revision ---- DOL Offset ---- Hex to Replace ---------- ASM Code -
NTSC 1.02 --- 0x802608D8 ---- 889F0004 -> Branch
887F0007 2C030000 40820058 7C972378 57800739 40820010 5780077B 40820028 48000094 7EE3BB78 38800000 38A0000E 38C00000 38ED9950
bl 0x80378430
38800001 48000008 38800000 7EE3BB78
bl 0x8015ED4C
38800001 989F0007 3C80C040 909F0014 C03F0014 3C003F4C 9001FFF0 C041FFF0 C01F000C EC01002A D01F000C FC600850 FC030840 41810008 EC6300B2 D07F0014 41800024 3C003C80 9001FFF0 C081FFF0 FC032040 41810010 38800000 909F0014 989F0007 889F0004 00000000

PAL 1.00 --- 0x80261078 ---- 889F0004 -> Branch
887F0007 2C030000 40820058 7C972378 57800739 40820010 5780077B 40820028 48000094 7EE3BB78 38800000 38A0000E 38C00000 38ED9B00
bl 0x80378334
38800001 48000008 38800000 7EE3BB78
bl 0x8015F4F0
38800001 989F0007 3C80C040 909F0014 C03F0014 3C003F4C 9001FFF0 C041FFF0 C01F000C EC01002A D01F000C FC600850 FC030840 41810008 EC6300B2 D07F0014 41800024 3C003C80 9001FFF0 C081FFF0 FC032040 41810010 38800000 909F0014 989F0007 889F0004 00000000

NTSC 1.01 --- 0x8026013C ---- 889F0004 -> Branch
887F0007 2C030000 40820058 7C972378 57800739 40820010 5780077B 40820028 48000094 7EE3BB78 38800000 38A0000E 38C00000 38ED9950
bl 0x80377750
38800001 48000008 38800000 7EE3BB78
bl 0x8015E8B0
38800001 989F0007 3C80C040 909F0014 C03F0014 3C003F4C 9001FFF0 C041FFF0 C01F000C EC01002A D01F000C FC600850 FC030840 41810008 EC6300B2 D07F0014 41800024 3C003C80 9001FFF0 C081FFF0 FC032040 41810010 38800000 909F0014 989F0007 889F0004 00000000

NTSC 1.00 --- 0x8025F5CC ---- 889F0004 -> Branch
887F0007 2C030000 40820058 7C972378 57800739 40820010 5780077B 40820028 48000094 7EE3BB78 38800000 38A0000E 38C00000 38ED9950
bl 0x8037657C
38800001 48000008 38800000 7EE3BB78
bl 0x8015E2D0
38800001 989F0007 3C80C040 909F0014 C03F0014 3C003F4C 9001FFF0 C041FFF0 C01F000C EC01002A D01F000C FC600850 FC030840 41810008 EC6300B2 D07F0014 41800024 3C003C80 9001FFF0 C081FFF0 FC032040 41810010 38800000 909F0014 989F0007 889F0004 00000000
#
Code:
-==-
!
ASM - Dpad up/down toggles rumble on CSS
[Dan Salvato]
Revision ---- DOL Offset ---- Hex to Replace ---------- ASM Code -
NTSC 1.02 --- 0x802608D8 ---- 889F0004 -> Branch
# code written by Dan Salvato
# comments by Punkline

# registers:
.set rPadID,  23  # HSD PAD ID identifies the controller port
.set rPad,    28  # HSD PAD structure contains input information
.set rCursor, 31  # structure contains cursor coordinates

# offsets:
.set xPadID,      0x4
.set xShakeFlag,  0x7
.set xCursorX,    0xC
.set xShakeTrans, 0x14

# masks:
.set mDPadUp,   0x08
.set mDPadDown, 0x04

# states:
.set Shaking,    1
.set NotShaking, 0

_check_shaking:
lbz   r3, xShakeFlag(rCursor)
cmpwi r3, NotShaking
bne- _shaking
# if flag != 0, then cursor is shaking
# else, check for dpad inputs

  _check_dpad_up:
  mr rPadID, r4
  rlwinm. r0, rPad, 0, mDPadUp
  bne- _enable
  # if dpad up, then enable rumble

    _check_dpad_down:
    rlwinm. r0, rPad, 0, mDPadDown
    bne- _disable
    b _return
    # if dpad down, then disable rumble;  else, do nothing

  _enable:
  mr r3, rPadID
  li r4, 0
  li r5, 14
  li r6, 0
  subi r7, r13, 0x66B0  # NTSC 1.00, 1.01, 1.02
  ##subi r7, r13, 0x6500  # PAL
  # r13 reference needs to be ported

  bl 0x80378430  # 1.02
  ##bl 0x80378334  # PAL
  ##bl 0x80377750  # 1.01
  ##bl 0x8037657C  # 1.00
  # HSD_PadRumbleActiveId

  li r4, 1
  b _set_rumble_flag
  # enabled

    _disable:
    li r4, 0
    # if disabling, r4 = 0 instead of 1

  _set_rumble_flag:
  mr r3, rPadID
  bl 0x8015ED4C  # 1.02
  ##bl 0x8015F4F0  # PAL
  ##bl 0x8015E8B0  # 1.01
  ##bl 0x8015E2D0  # 1.00
  # Rumble_StoreRumbleFlag

  _initialize_shaking_state:
  li  r4, Shaking
  stb r4, xShakeFlag(rCursor)
  lis r4, 0xC040  # -3
  stw r4, xShakeTrans(rCursor)
  # shaking state has been initialized

_shaking:
lfs   f1, xShakeTrans(rCursor)
lis   r0, 0x3F4C    # ~0.8
stw   r0, -0x10(sp)
lfs   f2, -0x10(sp)
lfs   f0, xCursorX(rCursor)
# f0 = Cursor X position
# f1 = Decaying shake translation
# f2 =  ~0.8

fadds f0, f1, f0
stfs  f0, xCursorX(rCursor)
# apply shake translation to current X position

fneg  f3, f1
# f3 = old shake translation * -1.0

fcmpo cr0, f3, f1
bgt- _store_cursor_X
  fmuls f3, f3, f2
  # if new translation value is positive,
  # then we decay the value with *= 0.8

_store_cursor_X:
stfs f3, xShakeTrans(rCursor)
blt- _return
# shake translation has been updated for next frame

_check_for_shake_end:
lis r0, 0x3C80
stw r0, -0x10(sp)
lfs f4, -0x10(sp)
# f4 = 0.015625

fcmpo cr0, f3, f4
bgt- _return
# if decay has almost reached 0, then exit Shaking state

  _end_of_shake_effect:
  li  r4, NotShaking  # null used as both bool and float
  stw r4, xShakeTrans(rCursor)  # 0.0
  stb r4, xShakeFlag(rCursor)   # 00
  # no longer in Shaking state

_return:
lbz r4, xPadID(rCursor)
.long 0



PAL 1.00 --- 0x80261078 ---- 889F0004 -> Branch

.set rPadID,  23
.set rPad,    28
.set rCursor, 31
.set xPadID,      0x4
.set xShakeFlag,  0x7
.set xCursorX,    0xC
.set xShakeTrans, 0x14
.set mDPadUp,   0x08
.set mDPadDown, 0x04
.set Shaking,    1
.set NotShaking, 0

_check_shaking:
lbz   r3, xShakeFlag(rCursor)
cmpwi r3, NotShaking
bne- _shaking
  _check_dpad_up:
  mr rPadID, r4
  rlwinm. r0, rPad, 0, mDPadUp
  bne- _enable
    _check_dpad_down:
    rlwinm. r0, rPad, 0, mDPadDown
    bne- _disable
    b _return
  _enable:
  mr r3, rPadID
  li r4, 0
  li r5, 14
  li r6, 0

  ##subi r7, r13, 0x66B0  # NTSC 1.00, 1.01, 1.02
  subi r7, r13, 0x6500  # PAL
  # r13 reference needs to be ported

  ##bl 0x80378430  # 1.02
  bl 0x80378334  # PAL
  ##bl 0x80377750  # 1.01
  ##bl 0x8037657C  # 1.00
  # HSD_PadRumbleActiveId

  li r4, 1
  b _set_rumble_flag
    _disable:
    li r4, 0

  _set_rumble_flag:
  mr r3, rPadID
  ##bl 0x8015ED4C  # 1.02
  bl 0x8015F4F0  # PAL
  ##bl 0x8015E8B0  # 1.01
  ##bl 0x8015E2D0  # 1.00
  # Rumble_StoreRumbleFlag

  _initialize_shaking_state:
  li  r4, Shaking
  stb r4, xShakeFlag(rCursor)
  lis r4, 0xC040  # -3
  stw r4, xShakeTrans(rCursor)
_shaking:
lfs   f1, xShakeTrans(rCursor)
lis   r0, 0x3F4C    # ~0.8
stw   r0, -0x10(sp)
lfs   f2, -0x10(sp)
lfs   f0, xCursorX(rCursor)
fadds f0, f1, f0
stfs  f0, xCursorX(rCursor)
fneg  f3, f1
fcmpo cr0, f3, f1
bgt- _store_cursor_X
  fmuls f3, f3, f2
_store_cursor_X:
stfs f3, xShakeTrans(rCursor)
blt- _return
_check_for_shake_end:
lis r0, 0x3C80
stw r0, -0x10(sp)
lfs f4, -0x10(sp)
fcmpo cr0, f3, f4
bgt- _return
  _end_of_shake_effect:
  li  r4, NotShaking
  stw r4, xShakeTrans(rCursor)
  stb r4, xShakeFlag(rCursor)
_return:
lbz r4, xPadID(rCursor)
.long 0



NTSC 1.01 --- 0x8026013C ---- 889F0004 -> Branch
.set rPadID,  23
.set rPad,    28
.set rCursor, 31
.set xPadID,      0x4
.set xShakeFlag,  0x7
.set xCursorX,    0xC
.set xShakeTrans, 0x14
.set mDPadUp,   0x08
.set mDPadDown, 0x04
.set Shaking,    1
.set NotShaking, 0

_check_shaking:
lbz   r3, xShakeFlag(rCursor)
cmpwi r3, NotShaking
bne- _shaking
  _check_dpad_up:
  mr rPadID, r4
  rlwinm. r0, rPad, 0, mDPadUp
  bne- _enable
    _check_dpad_down:
    rlwinm. r0, rPad, 0, mDPadDown
    bne- _disable
    b _return
  _enable:
  mr r3, rPadID
  li r4, 0
  li r5, 14
  li r6, 0

  subi r7, r13, 0x66B0  # NTSC 1.00, 1.01, 1.02
  ##subi r7, r13, 0x6500  # PAL
  # r13 reference needs to be ported

  ##bl 0x80378430  # 1.02
  ##bl 0x80378334  # PAL
  bl 0x80377750  # 1.01
  ##bl 0x8037657C  # 1.00
  # HSD_PadRumbleActiveId

  li r4, 1
  b _set_rumble_flag
    _disable:
    li r4, 0

  _set_rumble_flag:
  mr r3, rPadID
  ##bl 0x8015ED4C  # 1.02
  ##bl 0x8015F4F0  # PAL
  bl 0x8015E8B0  # 1.01
  ##bl 0x8015E2D0  # 1.00
  # Rumble_StoreRumbleFlag

  _initialize_shaking_state:
  li  r4, Shaking
  stb r4, xShakeFlag(rCursor)
  lis r4, 0xC040  # -3
  stw r4, xShakeTrans(rCursor)
_shaking:
lfs   f1, xShakeTrans(rCursor)
lis   r0, 0x3F4C    # ~0.8
stw   r0, -0x10(sp)
lfs   f2, -0x10(sp)
lfs   f0, xCursorX(rCursor)
fadds f0, f1, f0
stfs  f0, xCursorX(rCursor)
fneg  f3, f1
fcmpo cr0, f3, f1
bgt- _store_cursor_X
  fmuls f3, f3, f2
_store_cursor_X:
stfs f3, xShakeTrans(rCursor)
blt- _return
_check_for_shake_end:
lis r0, 0x3C80
stw r0, -0x10(sp)
lfs f4, -0x10(sp)
fcmpo cr0, f3, f4
bgt- _return
  _end_of_shake_effect:
  li  r4, NotShaking
  stw r4, xShakeTrans(rCursor)
  stb r4, xShakeFlag(rCursor)
_return:
lbz r4, xPadID(rCursor)
.long 0



NTSC 1.00 --- 0x8025F5CC ---- 889F0004 -> Branch
.set rPadID,  23
.set rPad,    28
.set rCursor, 31
.set xPadID,      0x4
.set xShakeFlag,  0x7
.set xCursorX,    0xC
.set xShakeTrans, 0x14
.set mDPadUp,   0x08
.set mDPadDown, 0x04
.set Shaking,    1
.set NotShaking, 0

_check_shaking:
lbz   r3, xShakeFlag(rCursor)
cmpwi r3, NotShaking
bne- _shaking
  _check_dpad_up:
  mr rPadID, r4
  rlwinm. r0, rPad, 0, mDPadUp
  bne- _enable
    _check_dpad_down:
    rlwinm. r0, rPad, 0, mDPadDown
    bne- _disable
    b _return
  _enable:
  mr r3, rPadID
  li r4, 0
  li r5, 14
  li r6, 0

  subi r7, r13, 0x66B0  # NTSC 1.00, 1.01, 1.02
  ##subi r7, r13, 0x6500  # PAL
  # r13 reference needs to be ported

  ##bl 0x80378430  # 1.02
  ##bl 0x80378334  # PAL
  ##bl 0x80377750  # 1.01
  bl 0x8037657C  # 1.00
  # HSD_PadRumbleActiveId

  li r4, 1
  b _set_rumble_flag
    _disable:
    li r4, 0

  _set_rumble_flag:
  mr r3, rPadID
  ##bl 0x8015ED4C  # 1.02
  ##bl 0x8015F4F0  # PAL
  ##bl 0x8015E8B0  # 1.01
  bl 0x8015E2D0  # 1.00
  # Rumble_StoreRumbleFlag

  _initialize_shaking_state:
  li  r4, Shaking
  stb r4, xShakeFlag(rCursor)
  lis r4, 0xC040  # -3
  stw r4, xShakeTrans(rCursor)
_shaking:
lfs   f1, xShakeTrans(rCursor)
lis   r0, 0x3F4C    # ~0.8
stw   r0, -0x10(sp)
lfs   f2, -0x10(sp)
lfs   f0, xCursorX(rCursor)
fadds f0, f1, f0
stfs  f0, xCursorX(rCursor)
fneg  f3, f1
fcmpo cr0, f3, f1
bgt- _store_cursor_X
  fmuls f3, f3, f2
_store_cursor_X:
stfs f3, xShakeTrans(rCursor)
blt- _return
_check_for_shake_end:
lis r0, 0x3C80
stw r0, -0x10(sp)
lfs f4, -0x10(sp)
fcmpo cr0, f3, f4
bgt- _return
  _end_of_shake_effect:
  li  r4, NotShaking
  stw r4, xShakeTrans(rCursor)
  stb r4, xShakeFlag(rCursor)
_return:
lbz r4, xPadID(rCursor)
.long 0
Code:
$Dpad up/down toggles rumble on CSS -- PAL 1.00[Dan Salvato]
C2261078 0000001B
887F0007 2C030000
40820070 7C972378
57800739 40820010
5780077B 40820034
480000AC 7EE3BB78
38800000 38A0000E
38C00000 38ED9B00
3D808037 618C8334
7D8903A6 4E800421
38800001 48000008
38800000 7EE3BB78
3D808015 618CF4F0
7D8903A6 4E800421
38800001 989F0007
3C80C040 909F0014
C03F0014 3C003F4C
9001FFF0 C041FFF0
C01F000C EC01002A
D01F000C FC600850
FC030840 41810008
EC6300B2 D07F0014
41800024 3C003C80
9001FFF0 C081FFF0
FC032040 41810010
38800000 909F0014
989F0007 889F0004
60000000 00000000
 
Last edited:

tufferugli

Smash Rookie
Joined
Oct 14, 2018
Messages
15
tufferugli tufferugli requested some help porting this to PAL, so I’ve commented the ASM, made some ports, and converted it all into DOL mods for MCM.

To make it easier to port, 2 floating points originally loaded from rtoc were changed to instead be built from immediates placed in the stack redzone. One of the constants "0.8" has been approximated as "0.797". There should otherwise be no differences.

Let me know if there are any problems with the ports:

Code:
-==-

Dpad up/down toggles rumble on CSS
[Dan Salvato]
Revision ---- DOL Offset ---- Hex to Replace ---------- ASM Code -
NTSC 1.02 --- 0x802608D8 ---- 889F0004 -> Branch
887F0007 2C030000 40820058 7C972378 57800739 40820010 5780077B 40820028 48000094 7EE3BB78 38800000 38A0000E 38C00000 38ED9950
bl 0x80378430
38800001 48000008 38800000 7EE3BB78
bl 0x8015ED4C
38800001 989F0007 3C80C040 909F0014 C03F0014 3C003F4C 9001FFF0 C041FFF0 C01F000C EC01002A D01F000C FC600850 FC030840 41810008 EC6300B2 D07F0014 41800024 3C003C80 9001FFF0 C081FFF0 FC032040 41810010 38800000 909F0014 989F0007 889F0004 00000000

PAL 1.00 --- 0x80261078 ---- 889F0004 -> Branch
887F0007 2C030000 40820058 7C972378 57800739 40820010 5780077B 40820028 48000094 7EE3BB78 38800000 38A0000E 38C00000 38ED9B00
bl 0x80378334
38800001 48000008 38800000 7EE3BB78
bl 0x8015F4F0
38800001 989F0007 3C80C040 909F0014 C03F0014 3C003F4C 9001FFF0 C041FFF0 C01F000C EC01002A D01F000C FC600850 FC030840 41810008 EC6300B2 D07F0014 41800024 3C003C80 9001FFF0 C081FFF0 FC032040 41810010 38800000 909F0014 989F0007 889F0004 00000000

NTSC 1.01 --- 0x8026013C ---- 889F0004 -> Branch
887F0007 2C030000 40820058 7C972378 57800739 40820010 5780077B 40820028 48000094 7EE3BB78 38800000 38A0000E 38C00000 38ED9950
bl 0x80377750
38800001 48000008 38800000 7EE3BB78
bl 0x8015E8B0
38800001 989F0007 3C80C040 909F0014 C03F0014 3C003F4C 9001FFF0 C041FFF0 C01F000C EC01002A D01F000C FC600850 FC030840 41810008 EC6300B2 D07F0014 41800024 3C003C80 9001FFF0 C081FFF0 FC032040 41810010 38800000 909F0014 989F0007 889F0004 00000000

NTSC 1.00 --- 0x8025F5CC ---- 889F0004 -> Branch
887F0007 2C030000 40820058 7C972378 57800739 40820010 5780077B 40820028 48000094 7EE3BB78 38800000 38A0000E 38C00000 38ED9950
bl 0x8037657C
38800001 48000008 38800000 7EE3BB78
bl 0x8015E2D0
38800001 989F0007 3C80C040 909F0014 C03F0014 3C003F4C 9001FFF0 C041FFF0 C01F000C EC01002A D01F000C FC600850 FC030840 41810008 EC6300B2 D07F0014 41800024 3C003C80 9001FFF0 C081FFF0 FC032040 41810010 38800000 909F0014 989F0007 889F0004 00000000
#
Code:
-==-
!
ASM - Dpad up/down toggles rumble on CSS
[Dan Salvato]
Revision ---- DOL Offset ---- Hex to Replace ---------- ASM Code -
NTSC 1.02 --- 0x802608D8 ---- 889F0004 -> Branch
# code written by Dan Salvato
# comments by Punkline

# registers:
.set rPadID,  23  # HSD PAD ID identifies the controller port
.set rPad,    28  # HSD PAD structure contains input information
.set rCursor, 31  # structure contains cursor coordinates

# offsets:
.set xPadID,      0x4
.set xShakeFlag,  0x7
.set xCursorX,    0xC
.set xShakeTrans, 0x14

# masks:
.set mDPadUp,   0x08
.set mDPadDown, 0x04

# states:
.set Shaking,    1
.set NotShaking, 0

_check_shaking:
lbz   r3, xShakeFlag(rCursor)
cmpwi r3, NotShaking
bne- _shaking
# if flag != 0, then cursor is shaking
# else, check for dpad inputs

  _check_dpad_up:
  mr rPadID, r4
  rlwinm. r0, rPad, 0, mDPadUp
  bne- _enable
  # if dpad up, then enable rumble

    _check_dpad_down:
    rlwinm. r0, rPad, 0, mDPadDown
    bne- _disable
    b _return
    # if dpad down, then disable rumble;  else, do nothing

  _enable:
  mr r3, rPadID
  li r4, 0
  li r5, 14
  li r6, 0
  subi r7, r13, 0x66B0  # NTSC 1.00, 1.01, 1.02
  ##subi r7, r13, 0x6500  # PAL
  # r13 reference needs to be ported

  bl 0x80378430  # 1.02
  ##bl 0x80378334  # PAL
  ##bl 0x80377750  # 1.01
  ##bl 0x8037657C  # 1.00
  # HSD_PadRumbleActiveId

  li r4, 1
  b _set_rumble_flag
  # enabled

    _disable:
    li r4, 0
    # if disabling, r4 = 0 instead of 1

  _set_rumble_flag:
  mr r3, rPadID
  bl 0x8015ED4C  # 1.02
  ##bl 0x8015F4F0  # PAL
  ##bl 0x8015E8B0  # 1.01
  ##bl 0x8015E2D0  # 1.00
  # Rumble_StoreRumbleFlag

  _initialize_shaking_state:
  li  r4, Shaking
  stb r4, xShakeFlag(rCursor)
  lis r4, 0xC040  # -3
  stw r4, xShakeTrans(rCursor)
  # shaking state has been initialized

_shaking:
lfs   f1, xShakeTrans(rCursor)
lis   r0, 0x3F4C    # ~0.8
stw   r0, -0x10(sp)
lfs   f2, -0x10(sp)
lfs   f0, xCursorX(rCursor)
# f0 = Cursor X position
# f1 = Decaying shake translation
# f2 =  ~0.8

fadds f0, f1, f0
stfs  f0, xCursorX(rCursor)
# apply shake translation to current X position

fneg  f3, f1
# f3 = old shake translation * -1.0

fcmpo cr0, f3, f1
bgt- _store_cursor_X
  fmuls f3, f3, f2
  # if new translation value is positive,
  # then we decay the value with *= 0.8

_store_cursor_X:
stfs f3, xShakeTrans(rCursor)
blt- _return
# shake translation has been updated for next frame

_check_for_shake_end:
lis r0, 0x3C80
stw r0, -0x10(sp)
lfs f4, -0x10(sp)
# f4 = 0.015625

fcmpo cr0, f3, f4
bgt- _return
# if decay has almost reached 0, then exit Shaking state

  _end_of_shake_effect:
  li  r4, NotShaking  # null used as both bool and float
  stw r4, xShakeTrans(rCursor)  # 0.0
  stb r4, xShakeFlag(rCursor)   # 00
  # no longer in Shaking state

_return:
lbz r4, xPadID(rCursor)
.long 0



PAL 1.00 --- 0x80261078 ---- 889F0004 -> Branch

.set rPadID,  23
.set rPad,    28
.set rCursor, 31
.set xPadID,      0x4
.set xShakeFlag,  0x7
.set xCursorX,    0xC
.set xShakeTrans, 0x14
.set mDPadUp,   0x08
.set mDPadDown, 0x04
.set Shaking,    1
.set NotShaking, 0

_check_shaking:
lbz   r3, xShakeFlag(rCursor)
cmpwi r3, NotShaking
bne- _shaking
  _check_dpad_up:
  mr rPadID, r4
  rlwinm. r0, rPad, 0, mDPadUp
  bne- _enable
    _check_dpad_down:
    rlwinm. r0, rPad, 0, mDPadDown
    bne- _disable
    b _return
  _enable:
  mr r3, rPadID
  li r4, 0
  li r5, 14
  li r6, 0

  ##subi r7, r13, 0x66B0  # NTSC 1.00, 1.01, 1.02
  subi r7, r13, 0x6500  # PAL
  # r13 reference needs to be ported

  ##bl 0x80378430  # 1.02
  bl 0x80378334  # PAL
  ##bl 0x80377750  # 1.01
  ##bl 0x8037657C  # 1.00
  # HSD_PadRumbleActiveId

  li r4, 1
  b _set_rumble_flag
    _disable:
    li r4, 0

  _set_rumble_flag:
  mr r3, rPadID
  ##bl 0x8015ED4C  # 1.02
  bl 0x8015F4F0  # PAL
  ##bl 0x8015E8B0  # 1.01
  ##bl 0x8015E2D0  # 1.00
  # Rumble_StoreRumbleFlag

  _initialize_shaking_state:
  li  r4, Shaking
  stb r4, xShakeFlag(rCursor)
  lis r4, 0xC040  # -3
  stw r4, xShakeTrans(rCursor)
_shaking:
lfs   f1, xShakeTrans(rCursor)
lis   r0, 0x3F4C    # ~0.8
stw   r0, -0x10(sp)
lfs   f2, -0x10(sp)
lfs   f0, xCursorX(rCursor)
fadds f0, f1, f0
stfs  f0, xCursorX(rCursor)
fneg  f3, f1
fcmpo cr0, f3, f1
bgt- _store_cursor_X
  fmuls f3, f3, f2
_store_cursor_X:
stfs f3, xShakeTrans(rCursor)
blt- _return
_check_for_shake_end:
lis r0, 0x3C80
stw r0, -0x10(sp)
lfs f4, -0x10(sp)
fcmpo cr0, f3, f4
bgt- _return
  _end_of_shake_effect:
  li  r4, NotShaking
  stw r4, xShakeTrans(rCursor)
  stb r4, xShakeFlag(rCursor)
_return:
lbz r4, xPadID(rCursor)
.long 0



NTSC 1.01 --- 0x8026013C ---- 889F0004 -> Branch
.set rPadID,  23
.set rPad,    28
.set rCursor, 31
.set xPadID,      0x4
.set xShakeFlag,  0x7
.set xCursorX,    0xC
.set xShakeTrans, 0x14
.set mDPadUp,   0x08
.set mDPadDown, 0x04
.set Shaking,    1
.set NotShaking, 0

_check_shaking:
lbz   r3, xShakeFlag(rCursor)
cmpwi r3, NotShaking
bne- _shaking
  _check_dpad_up:
  mr rPadID, r4
  rlwinm. r0, rPad, 0, mDPadUp
  bne- _enable
    _check_dpad_down:
    rlwinm. r0, rPad, 0, mDPadDown
    bne- _disable
    b _return
  _enable:
  mr r3, rPadID
  li r4, 0
  li r5, 14
  li r6, 0

  subi r7, r13, 0x66B0  # NTSC 1.00, 1.01, 1.02
  ##subi r7, r13, 0x6500  # PAL
  # r13 reference needs to be ported

  ##bl 0x80378430  # 1.02
  ##bl 0x80378334  # PAL
  bl 0x80377750  # 1.01
  ##bl 0x8037657C  # 1.00
  # HSD_PadRumbleActiveId

  li r4, 1
  b _set_rumble_flag
    _disable:
    li r4, 0

  _set_rumble_flag:
  mr r3, rPadID
  ##bl 0x8015ED4C  # 1.02
  ##bl 0x8015F4F0  # PAL
  bl 0x8015E8B0  # 1.01
  ##bl 0x8015E2D0  # 1.00
  # Rumble_StoreRumbleFlag

  _initialize_shaking_state:
  li  r4, Shaking
  stb r4, xShakeFlag(rCursor)
  lis r4, 0xC040  # -3
  stw r4, xShakeTrans(rCursor)
_shaking:
lfs   f1, xShakeTrans(rCursor)
lis   r0, 0x3F4C    # ~0.8
stw   r0, -0x10(sp)
lfs   f2, -0x10(sp)
lfs   f0, xCursorX(rCursor)
fadds f0, f1, f0
stfs  f0, xCursorX(rCursor)
fneg  f3, f1
fcmpo cr0, f3, f1
bgt- _store_cursor_X
  fmuls f3, f3, f2
_store_cursor_X:
stfs f3, xShakeTrans(rCursor)
blt- _return
_check_for_shake_end:
lis r0, 0x3C80
stw r0, -0x10(sp)
lfs f4, -0x10(sp)
fcmpo cr0, f3, f4
bgt- _return
  _end_of_shake_effect:
  li  r4, NotShaking
  stw r4, xShakeTrans(rCursor)
  stb r4, xShakeFlag(rCursor)
_return:
lbz r4, xPadID(rCursor)
.long 0



NTSC 1.00 --- 0x8025F5CC ---- 889F0004 -> Branch
.set rPadID,  23
.set rPad,    28
.set rCursor, 31
.set xPadID,      0x4
.set xShakeFlag,  0x7
.set xCursorX,    0xC
.set xShakeTrans, 0x14
.set mDPadUp,   0x08
.set mDPadDown, 0x04
.set Shaking,    1
.set NotShaking, 0

_check_shaking:
lbz   r3, xShakeFlag(rCursor)
cmpwi r3, NotShaking
bne- _shaking
  _check_dpad_up:
  mr rPadID, r4
  rlwinm. r0, rPad, 0, mDPadUp
  bne- _enable
    _check_dpad_down:
    rlwinm. r0, rPad, 0, mDPadDown
    bne- _disable
    b _return
  _enable:
  mr r3, rPadID
  li r4, 0
  li r5, 14
  li r6, 0

  subi r7, r13, 0x66B0  # NTSC 1.00, 1.01, 1.02
  ##subi r7, r13, 0x6500  # PAL
  # r13 reference needs to be ported

  ##bl 0x80378430  # 1.02
  ##bl 0x80378334  # PAL
  ##bl 0x80377750  # 1.01
  bl 0x8037657C  # 1.00
  # HSD_PadRumbleActiveId

  li r4, 1
  b _set_rumble_flag
    _disable:
    li r4, 0

  _set_rumble_flag:
  mr r3, rPadID
  ##bl 0x8015ED4C  # 1.02
  ##bl 0x8015F4F0  # PAL
  ##bl 0x8015E8B0  # 1.01
  bl 0x8015E2D0  # 1.00
  # Rumble_StoreRumbleFlag

  _initialize_shaking_state:
  li  r4, Shaking
  stb r4, xShakeFlag(rCursor)
  lis r4, 0xC040  # -3
  stw r4, xShakeTrans(rCursor)
_shaking:
lfs   f1, xShakeTrans(rCursor)
lis   r0, 0x3F4C    # ~0.8
stw   r0, -0x10(sp)
lfs   f2, -0x10(sp)
lfs   f0, xCursorX(rCursor)
fadds f0, f1, f0
stfs  f0, xCursorX(rCursor)
fneg  f3, f1
fcmpo cr0, f3, f1
bgt- _store_cursor_X
  fmuls f3, f3, f2
_store_cursor_X:
stfs f3, xShakeTrans(rCursor)
blt- _return
_check_for_shake_end:
lis r0, 0x3C80
stw r0, -0x10(sp)
lfs f4, -0x10(sp)
fcmpo cr0, f3, f4
bgt- _return
  _end_of_shake_effect:
  li  r4, NotShaking
  stw r4, xShakeTrans(rCursor)
  stb r4, xShakeFlag(rCursor)
_return:
lbz r4, xPadID(rCursor)
.long 0
Code:
$Dpad up/down toggles rumble on CSS -- PAL 1.00[Dan Salvato]
C2261078 0000001B
887F0007 2C030000
40820070 7C972378
57800739 40820010
5780077B 40820034
480000AC 7EE3BB78
38800000 38A0000E
38C00000 38ED9B00
3D808037 618C8334
7D8903A6 4E800421
38800001 48000008
38800000 7EE3BB78
3D808015 618CF4F0
7D8903A6 4E800421
38800001 989F0007
3C80C040 909F0014
C03F0014 3C003F4C
9001FFF0 C041FFF0
C01F000C EC01002A
D01F000C FC600850
FC030840 41810008
EC6300B2 D07F0014
41800024 3C003C80
9001FFF0 C081FFF0
FC032040 41810010
38800000 909F0014
989F0007 889F0004
60000000 00000000
it now behaves like the ntsc one, thank you!
 
Top Bottom