Port Sonic 2 Level Select to Sonic 1
From Sonic Retro
Revision as of 13:59, 3 December 2017 by The Catman 22 (talk | contribs)
(Original guide by DelayHacks)
You need to download the level select by Esrael:
Download Sonic 2 Level Select in Sonic 1
File: s2menu.rar (29 kB) (info)
|
and extract it to the root of your dissassembly.
Hivebrain's 2005 disassembly
After downloading and extracting the file, go to the end of the main file (sonic1.asm) and you'll find this:
; end of 'ROM'
EndOfRom:
END
Add this line before it:
include "s2_menu.asm" ; Sonic 2 level select
Now go to:
Title_ChkLevSel:
tst.b ($FFFFFFE0).w ; check if level select code is on
beq.w PlayLevel ; if not, play level
btst #iA,(Joypad|Held).w ; check if A is held
beq.w PlayLevel ; if not, play level
moveq #2,d0
bsr.w PalLoad2 ; load level select pallet
lea ($FFFFCC00).w,a1
moveq #0,d0
move.w #$DF,d1
and replace with this:
Title_ChkLevSel:
tst.b ($FFFFFFE0).w ; check if level select code is on
beq.w PlayLevel ; if not, play level
btst #iA,(Joypad|Held).w ; check if A is held
beq.w PlayLevel ; if not, play level
jmp Level_Select_Menu ; if yes, goto Sonic 2 level select
moveq #2,d0
lea ($FFFFCC00).w,a1
moveq #0,d0
move.w #$DF,d1
GitHub disassembly
After downloading and extracting the file, go to the end of the main file (sonic.asm) and you'll find this:
; end of 'ROM'
EndOfRom:
END
Add this line before it:
include "s2_menu.asm" ; Sonic 2 level select
Now go to:
Tit_ChkLevSel:
tst.b (f_levselcheat).w ; check if level select code is on
beq.w PlayLevel ; if not, play level
btst #bitA,(v_jpadhold1).w ; check if A is pressed
beq.w PlayLevel ; if not, play level
moveq #palid_LevelSel,d0
bsr.w PalLoad2 ; load level select palette
lea (v_hscrolltablebuffer).w,a1
moveq #0,d0
move.w #$DF,d1
and replace with this:
Tit_ChkLevSel:
tst.b (f_levselcheat).w ; check if level select code is on
beq.w PlayLevel ; if not, play level
btst #bitA,(v_jpadhold1).w ; check if A is pressed
beq.w PlayLevel ; if not, play level
jmp Level_Select_Menu; Go to Sonic 2 Level Select
moveq #palid_LevelSel,d0
bsr.w PalLoad2 ; load level select palette
lea (v_hscrolltablebuffer).w,a1
moveq #0,d0
move.w #$DF,d1
Open s2_menu.asm and change this:
Menu_Palette:
incbin 'data\menu\menu.pal'
Menu_ClearScreen:
jmp ClearScreen
Menu_ShowVDPGraphics:
jmp ShowVDPGraphics
Menu_NemesisDec:
jmp NemDec
Menu_LoadPLC2:
jmp LoadPLC2
Menu_RunPLC:
jmp RunPLC_RAM
Menu_EnigmaDec
jmp EniDec
Menu_Pal_FadeTo:
jmp Pal_FadeTo
Menu_Pal_FadeFrom:
jmp Pal_FadeFrom
Menu_Play_Music:
jmp PlaySound
Menu_PalLoad1:
jmp PalLoad1
Menu_DelayProgram:
jmp DelayProgram
and replace with this:
Pal_Menu:
incbin 'data\menu\menu.pal'
Menu_ClearScreen:
jmp ClearScreen
Menu_ShowVDPGraphics:
jmp TilemapToVRAM
Menu_NemesisDec:
jmp NemDec
Menu_LoadPLC2:
jmp NewPLC
Menu_RunPLC:
jmp RunPLC
Menu_EnigmaDec
jmp EniDec
Menu_Pal_FadeTo:
jmp PaletteFadeIn
Menu_Pal_FadeFrom:
jmp PaletteFadeOut
Menu_Play_Music:
jmp PlaySound
Menu_PalLoad1:
jmp PalLoad1
Menu_DelayProgram:
jmp WaitForVBla
Other
Open "_inc\Pallet pointers.asm" and after this:
dc.l Pal_Ending
dc.w $FB00
dc.w $1F
add this:
dc.l Menu_Palette; pallet address
dc.w $FB00 ; RAM address
dc.w $1F ; (pallet length / 2) - 1
Git Dissasembly:
Open "_inc\Pallet pointers.asm" and after this:
ptr_Pal_Ending: palp Pal_Ending,v_pal_dry,$40 ; $13 (19) - ending sequence
add this:
ptr_Pal_Menu: palp Pal_Menu,v_pal_dry,$40 ; 2 - level select
Now you have Sonic 2's level select palette.
Now goto "s2menu.asm". See this line?
Level_Select_Menu_snd = $0081
Replace "81" with music you want in the level select (# of music + 80). See this line?
Emerald_Snd = $0093
and replace "93" with sound what you want after "All emeralds code". To edit ring sound after "debug mode" code, change B5 in this line:
Ring_Snd = $00B5
To edit texts, find label "Menu_Level_Select_Text:" and you see
dc.b $0E, _G, _R, _E, _E, _N, __, _H, _I, _L, _L, __, __, __, __, __
dc.b $0E, _L, _A, _B, _Y, _R, _I, _N, _T, _H, __, __, __, __, __, __
dc.b $0E, _M, _A, _R, _B, _L, _E, __, __, __, __, __, __, __, __, __
dc.b $0E, _S, _P, _R, _I, _N, _G, __, _Y, _A, _R, _D, __, __, __, __
dc.b $0E, _S, _T, _A, _R, __, _L, _I, _G, _H, _T, __, __, __, __, __
dc.b $0E, _S, _C, _R, _A, _P, __, _B, _R, _A, _I, _N, __, __, __, __
dc.b $0E, _F, _I, _N, _A, _L, __, __, __, __, __, __, __, __, __, __
dc.b $0E, _S, _P, _E, _C, _I, _A, _L, __, _S, _T, _A, _G, _E, __, __
dc.b $0E, _E, _N, _D, _I, _N, _G, __, _S, _E, _Q, _U, _E, _N, _C, _E
dc.b $0E, _S, _O, _U, _N, _D, __, _T, _E, _S, _T, __, __, _st,__, __
Now you can edit the text in the level select. To edit "debug mode" code go to the label "Code_Debug_Mode:". To edit "all emeralds" code go to label "Code_All_Emeralds:" That's all. All permissions for this level select code goes to Esrael. Result: