Skip to content

Commit

Permalink
Update Mario Clash to v1.3
Browse files Browse the repository at this point in the history
  • Loading branch information
vaguerant committed May 7, 2024
1 parent f3ce18c commit 8e4055c
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Here's a few assembly patches for Virtual Boy games.
* compatible with `Mario Clash (Japan, USA).vb`
* adds support for saving your level progress, high scores and brightness
* replaces the original capped 1 to 40 level select with the option to select any level that you've previously reached, all the way up to 99
* optionally remap the controls to be closer to other Mario games (based on [Controller Fix by DogP](https://www.virtual-boy.com/games/mario-clash/downloads/))
* erase save by pressing **L** + **R** + **Left D-Pad Down** + **Right D-Pad Down** on the title screen
* `redalarm-save.asm`
* compatible with either `Red Alarm (USA).vb` or `Red Alarm (Japan).vb`
Expand Down Expand Up @@ -62,6 +63,7 @@ You can build your patched ROMs like so:
MV810Asm golf-save.asm golf-save.vb /V /H "Golf (USA).vb"
MV810Asm jackbros-save.asm jackbros-save.vb /V /H "Jack Bros. (USA).vb"
MV810Asm marioclash-save.asm marioclash-save.vb /V /H "Mario Clash (Japan, USA).vb"
MV810Asm marioclash-save.asm marioclash-save-bswap.vb /V /I BUTTON_SWAP 1 /H "Mario Clash (Japan, USA).vb"
MV810Asm redalarm-save.asm redalarm-save.vb /V /H "Red Alarm (USA).vb"
MV810Asm sposh-save.asm sposh-save.vb /V /H "Space Squash (Japan).vb"
MV810Asm vert-u-save.asm vert-u-save.vb /V /H "Vertical Force (USA).vb"
Expand Down
73 changes: 73 additions & 0 deletions marioclash-save.asm
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,42 @@ LOAD_SCORE_LEVELS_RETURN:
mov r0, r0
LOAD_BRIGHTNESS_RETURN:

!IF BUTTON_SWAP
; Swap the buttons themselves
!SEEK 0xEE206
movhi 0x4, r0, r10
!SEEK 0xEE28C
movhi 0x8, r0, r13
!SEEK 0xEE62E
movhi 0x4, r0, r10
!SEEK 0xEE6BE
movhi 0x4, r0, r10
!SEEK 0xEEB9E
andi 0x30, r20, r10
!SEEK 0xEEF42
movhi 0x4, r0, r10
!SEEK 0xEEFD6
andi 0x4, r20, r10

; Fix gameplay demos for swapped buttons
!ORG 0xFFFDEA72
!SEEK 0xDEA72
jr FIX_ATTRACT_1 ; st.w r10, 0x0044[sp]
FIX_ATTRACT_1_RETURN:
!ORG 0xFFFDEADA
!SEEK 0xDEADA
jr FIX_ATTRACT_2
FIX_ATTRACT_2_RETURN:
!ORG 0xFFFDEB42
!SEEK 0xDEB42
jr FIX_ATTRACT_3
FIX_ATTRACT_3_RETURN:
!ORG 0xFFFDEBAA
!SEEK 0xDEBAA
jr FIX_ATTRACT_4
FIX_ATTRACT_4_RETURN:
!ENDIF

; Save max level to SRAM when reaching new level
!ORG 0xFFFDF6B0
!SEEK 0xDF6B0
Expand Down Expand Up @@ -159,6 +195,43 @@ LOAD_BRIGHTNESS:
st.b r10, 0x1A63[gp]
?br LOAD_BRIGHTNESS_RETURN

!IF BUTTON_SWAP
FIX_ATTRACT_1:
?push lp
jal ATTRACT_SWAP
?pop lp
jr FIX_ATTRACT_1_RETURN
FIX_ATTRACT_2:
?push lp
jal ATTRACT_SWAP
?pop lp
jr FIX_ATTRACT_2_RETURN
FIX_ATTRACT_3:
?push lp
jal ATTRACT_SWAP
?pop lp
jr FIX_ATTRACT_3_RETURN
FIX_ATTRACT_4:
?push lp
jal ATTRACT_SWAP
?pop lp
jr FIX_ATTRACT_4_RETURN

ATTRACT_SWAP:
?push r9
movhi 0x10, r9, r9
movea 0x10, r9, r9
and r10, r9
movea 0xFFFF, r0, r1
xor r9, r1
and r1, r10
shr 2, r9
or r9, r10
st.w r10, 0x004C[sp]
?pop r9
jmp [lp]
!ENDIF

SAVE_LEVEL:
movhi 0x601, r0, r1
st.b r10, -0x658C[r1]
Expand Down

0 comments on commit 8e4055c

Please sign in to comment.