Sonic and Sega Retro Message Board: How To Port the Sonic 2 Clone Driver into Sonic 2 HG Dissasembly - Sonic and Sega Retro Message Board

Jump to content

Hey there, Guest!  (Log In · Register) Help
Page 1 of 1
    Locked
    Locked Forum

How To Port the Sonic 2 Clone Driver into Sonic 2 HG Dissasembly Updated with the Sega Sound fix.

#1 User is offline Caverns 4 

Posted 09 June 2013 - 06:00 PM

  • Posts: 271
  • Joined: 07-December 12
  • Gender:Male
  • Project:Sanik Quest: Journey To The Right
There are a few bugs I have noticed. One is that the spindash sound will not raise pitch. The music is not a perfect adaptation of Sonic 2's music, particularly sometimes the PSG channels sound slightly different. This is most noticable in Emerald Hill's music. Besides this, there are no problems.

If the above bugs will not bother you too badly, then you'll like using the Sonic 2 Clone Driver after working with Sonic 2's own sound driver. The Clone Driver is much easier to port music to, and in fact, Sonic 1 music can even just be bincluded into the ROM. This is because it's based on the Sonic 1 sound driver, and uses similar (if not the same) formatting.

With this out of the way, now it's time to edit the Sonic 2 HG Dissasembly!

Step 1 - getting started
---------------------------------------------------------------------------------------------------------------------------------------------------------------

Back up your dissasembly if you haven't already.

To start, go into your sound folder, where you'll have a DAC folder, a music folder, and a PCM folder.

DELETE THEM ALL!

and then extract "Sonic 2 Clone Driver_fixed.7z" into the main folder of your dissasembly.

And then open up s2.sounddriver.asm, we're going to delete a lot of data from it.

Find zMasterPlaylist and delete the following lines:
; zbyte_11F5h:
zMasterPlaylist:

; Music IDs
offset :=	MusicPoint2
ptrsize :=	2
idstart :=	80h
; note: +20h means uncompressed, here
; +40h is an (ignored) flag, possibly to force PAL mode on/off

zMusIDPtr_2PResult:	db	id(MusPtr_2PResult)	; 92
zMusIDPtr_EHZ:    	db	id(MusPtr_EHZ)    	; 81
zMusIDPtr_MCZ_2P:	db	id(MusPtr_MCZ_2P)	; 85
zMusIDPtr_OOZ:    	db	id(MusPtr_OOZ)    	; 8F
zMusIDPtr_MTZ:    	db	id(MusPtr_MTZ)    	; 82
zMusIDPtr_HTZ:    	db	id(MusPtr_HTZ)    	; 94
zMusIDPtr_ARZ:    	db	id(MusPtr_ARZ)    	; 86
zMusIDPtr_CNZ_2P:	db	id(MusPtr_CNZ_2P)	; 80
zMusIDPtr_CNZ:    	db	id(MusPtr_CNZ)    	; 83
zMusIDPtr_DEZ:    	db	id(MusPtr_DEZ)    	; 87
zMusIDPtr_MCZ:    	db	id(MusPtr_MCZ)    	; 84
zMusIDPtr_EHZ_2P:	db	id(MusPtr_EHZ_2P)	; 91
zMusIDPtr_SCZ:    	db	id(MusPtr_SCZ)    	; 8E
zMusIDPtr_CPZ:    	db	id(MusPtr_CPZ)    	; 8C
zMusIDPtr_WFZ:    	db	id(MusPtr_WFZ)    	; 90
zMusIDPtr_HPZ:    	db	id(MusPtr_HPZ)    	; 9B
zMusIDPtr_Options:	db	id(MusPtr_Options)	; 89
zMusIDPtr_SpecStage:	db	id(MusPtr_SpecStage)	; 88
zMusIDPtr_Boss:    	db	id(MusPtr_Boss)    	; 8D
zMusIDPtr_EndBoss:	db	id(MusPtr_EndBoss)	; 8B
zMusIDPtr_Ending:	db	id(MusPtr_Ending)	; 8A
zMusIDPtr_SuperSonic:	db	id(MusPtr_SuperSonic)	; 93
zMusIDPtr_Invincible:	db	id(MusPtr_Invincible)	; 99
zMusIDPtr_ExtraLife:	db	id(MusPtr_ExtraLife)+20h; B5
zMusIDPtr_Title:	db	id(MusPtr_Title)	; 96
zMusIDPtr_EndLevel:	db	id(MusPtr_EndLevel)	; 97
zMusIDPtr_GameOver:	db	id(MusPtr_GameOver)+20h	; B8
zMusIDPtr_Continue:	db	(MusPtr_Continue-MusicPoint1)/ptrsize	; 0
zMusIDPtr_Emerald:	db	id(MusPtr_Emerald)+20h	; BA
zMusIDPtr_Credits:	db	id(MusPtr_Credits)+20h	; BD
zMusIDPtr_Countdown:	db	id(MusPtr_Drowning)+40h	; DC
zMusIDPtr__End:


Then go to zDACMasterPlaylist, and delete these:
	db	id(zDACPtr_Sample1),17h    	; 81h
	db	id(zDACPtr_Sample2),1    	; 82h
	db	id(zDACPtr_Sample3),6    	; 83h
	db	id(zDACPtr_Sample4),8    	; 84h
	db	id(zDACPtr_Sample5),1Bh    	; 85h
	db	id(zDACPtr_Sample6),0Ah    	; 86h
	db	id(zDACPtr_Sample7),1Bh    	; 87h
	db	id(zDACPtr_Sample5),12h    	; 88h
	db	id(zDACPtr_Sample5),15h    	; 89h
	db	id(zDACPtr_Sample5),1Ch    	; 8Ah
	db	id(zDACPtr_Sample5),1Dh    	; 8Bh
	db	id(zDACPtr_Sample6),2    	; 8Ch
	db	id(zDACPtr_Sample6),5    	; 8Dh
	db	id(zDACPtr_Sample6),8    	; 8Eh
	db	id(zDACPtr_Sample7),8    	; 8Fh
	db	id(zDACPtr_Sample7),0Bh    	; 90h
	db	id(zDACPtr_Sample7),12h    	; 91h


Step 2 - Deleting broken references
---------------------------------------------------------------------------------------------------------------------------------------------------------------
Now open up s2.asm, and search for the line "; end of 'ROM'" near the end of your dissasemby.

On the empty line before it, past this:

  include "Sonic 2 Clone Driver.asm"
  even


After this, search for "SoundIndex:", and delete everything for it, up to and including "SndPtr__End:"
Now there are many unused sounds, Sound20 - Sound70 in the dissasembly that will be unused. If you wish, delete those too, as they will only take space.

Once you've done that, locate "MusicPoint2:", and delete that, and everything below it it until the following line:

	if * > soundBankStart + $8000


Leave this line and everything below it alone for the time being.

Now find the line
; loc_F1E8C:


Below this line is where the Sega sound is included. If we delete it, we will get errors. If we leave I, we will get errors. So what do we do? Change it!
Replace this:
; -------------------------------------------------------------------------------
; Sega Intro Sound
; 8-bit unsigned raw audio at 16Khz
; -------------------------------------------------------------------------------
; loc_F1E8C:
Snd_Sega:	BINCLUDE	"sound/PCM/SEGA.bin"
Snd_Sega_End:

	if Snd_Sega_End - Snd_Sega > $8000
    	fatal "Sega sound must fit within $8000 bytes, but you have a $\{Snd_Sega_End-Snd_Sega} byte Sega sound."
	endif
	if Snd_Sega_End - Snd_Sega > Size_of_SEGA_sound
    	fatal "Size_of_SEGA_sound = $\{Size_of_SEGA_sound}, but you have a $\{Snd_Sega_End-Snd_Sega} byte Sega sound."
	endif


With this:

; loc_F1E8C:
Snd_Sega:	rts
Snd_Sega_End:


Now, we need to delete the old BINCLUDEd DAC samples. Got to loc_ED100, or SndDAC_Start.
Staring at line "; loc_ED100:", delete everything down to (But not including) this chunk of code.

; --------------------------------------------------------------------
; Nemesis compressed art (20 blocks)
; Buzzer's fireball
ArtNem_Buzzer_Fireball:	BINCLUDE	"art/nemesis/Fireball 1 (Buzzer).bin"
; --------------------------------------------------------------------


That is art used in the game, so obviously we don't want that to get deleted.

Right above if, you will also see this line:

	cnop -Size_of_DAC_samples, $8000


You need to delete that too.

Finally, search for sub_EC000, or "SoundDriverLoad", which will look like this:

; ---------------------------------------------------------------------------
; Subroutine to load the sound driver
; ---------------------------------------------------------------------------
; sub_EC000:
SoundDriverLoad:
	move	sr,-(sp)
	movem.l	d0-a6,-(sp)
	move	#$2700,sr
	lea	(Z80_Bus_Request).l,a3
	lea	(Z80_Reset).l,a2
	moveq	#0,d2
	move.w	#$100,d1
	move.w	d1,(a3)	; get Z80 bus
	move.w	d1,(a2)	; release Z80 reset (was held high by console on startup)
-	btst	d2,(a3)
	bne.s	-	; wait until the 68000 has the bus
	jsr	DecompressSoundDriver(pc)
	btst	#0,(VDP_control_port+1).l	; check video mode
	sne	(Z80_RAM+zPalModeByte).l	; set if PAL
	move.w	d2,(a2)	; hold Z80 reset
	move.w	d2,(a3)	; release Z80 bus
	moveq	#$E6,d0
-	dbf	d0,-	; wait for 2,314 cycles
	move.w	d1,(a2)	; release Z80 reset
	movem.l	(sp)+,d0-a6
	move	(sp)+,sr
	rts


Delete the whole thing, as it will now do nothing but cause an error.

Step 3 - Replace a bunch of stuff.
---------------------------------------------------------------------------------------------------------------------------------------------------------------
Search for the routine VintRet (Search for "VintRet:"), and you'll have something like this:

VintRet:
	addq.l	#1,(Vint_runcount).w
	movem.l	(sp)+,d0-a6
	rte


Replace it with this:

VintRet:
	jsr	Init_Sonic1_Sound_Driver	; init Sonic 1 sound driver
	addq.l	#1,(Vint_runcount).w
	movem.l	(sp)+,d0-a6
	rte


Next, go to JmpTo_SoundDriverLoad, and find all of this:

JmpTo_SoundDriverLoad

	nop

	jmp	(SoundDriverLoad).l
; End of function JmpTo_SoundDriverLoad

; ===========================================================================

; unused mostly-leftover subroutine to load the sound driver

; SoundDriverLoadS1:
	move.w	#$100,(Z80_Bus_Request).l ; stop the Z80
	move.w	#$100,(Z80_Reset).l; reset the Z80
	lea	(Z80_RAM).l,a1
	move.b	#$F3,(a1)+
	move.b	#$F3,(a1)+
	move.b	#$C3,(a1)+
	move.b	#0,(a1)+
	move.b	#0,(a1)+
	move.w	#0,(Z80_Reset).l
	nop
	nop
	nop
	nop
	move.w	#$100,(Z80_Reset).l ; reset the Z80
	move.w	#0,(Z80_Bus_Request).l ; start the Z80
	rts


and replace it like this:

JmpTo_SoundDriverLoad
	move.w	#$100,(Z80_Bus_Request).l ; stop the Z80
	move.w	#$100,(Z80_Reset).l ; reset the Z80
	lea	(Kos_Z80).l,a0
	lea	(Z80_RAM).l,a1
	bsr.w	KosDec
	move.b	#$F3,(a1)+
	move.b	#$F3,(a1)+
	move.b	#$C3,(a1)+
	move.b	#0,(a1)+
	move.b	#0,(a1)+
	move.w	#0,(Z80_Reset).l
	nop
	nop
	nop
	nop
	move.w	#$100,(Z80_Reset).l ; reset the Z80
	move.w	#0,(Z80_Bus_Request).l ; start the Z80
	rts


Next, find PlayMusic, which should look like this this:

; sub_135E:
PlayMusic:
	tst.b	(Music_to_play).w
	bne.s	+
	move.b	d0,(Music_to_play).w
	rts
+
	move.b	d0,(Music_to_play_2).w
	rts
; End of function PlayMusic


And replace it with this:
; sub_135E:
PlayMusic:
;	tst.b	($FFFFFFE0).w
;	bne.s	+
;	move.b	d0,($FFFFFFE0).w
	move.b	d0,($FFFFF00A).w
	rts
+
	move.b	d0,($FFFFF00A).w
	rts
; End of function PlayMusic


Right beneath that should be PlaySound. Replace PlaySound with this:
; sub_1370
PlaySound:
	move.b	d0,($FFFFF00B).w
	rts
; End of function PlaySound


Now we need to change PlaySoundStereo, which should be right beath PlaySound.
Replace it with this:
; sub_1376:
PlaySoundStereo:
	bra.s	PlayMusic	; skip over routine (For S1 driver)
	move.b	d0,(SFX_to_play_2).w
	rts
; End of function PlaySoundStereo


Now PlaySoundLocal is the next thing to edit, and again, it should be right below PlaySoundStereo.
Replace it with this:
; sub_137C:
PlaySoundLocal:
	tst.b	render_flags(a0)
	bpl.s	+
	move.b	d0,($FFFFF00B).w
+
	rts


Below this is the routine PauseGame. Rather than replacing that entire routine, we are simply going to find this:

+
	move.w	#1,(Game_paused).w	; freeze time
	move.b	#MusID_Pause,(Music_to_play).w	; pause music


And replace it with this:

+
	move.w	#1,(Game_paused).w	; freeze time
	move.b	#1,($FFFFF003).w	; pause music


Now go to Pause_Resume, which should look like this:

; loc_13F2:
Pause_Resume:
	move.b	#MusID_Unpause,(Music_to_play).w


Replace it with this:

; loc_13F2:
Pause_Resume:
	move.b	#$80,($FFFFF003).w


Now, find Pause_SlowMo, which should be this:

; loc_1400:
Pause_SlowMo:
	move.w	#1,(Game_paused).w
	move.b
	#MusID_Unpause,(Music_to_play).w
	rts

Replace it with the following:

; loc_1400:
Pause_SlowMo:
	move.w	#1,(Game_paused).w
	move.b	#1,($FFFFF003).w
	rts


Next, find SpecialStage_Unpause, which should be this:

; loc_541A:
SpecialStage_Unpause:
	move.b	#MusID_Unpause,(Music_to_play).w
	move.b	#8,(Vint_routine).w
	bra.w	WaitForVint


And replace it with this:

; loc_541A:
SpecialStage_Unpause:
	move.b	#1,($FFFFF003).w
	move.b	#8,(Vint_routine).w
	bra.w	WaitForVint


Finally, we're going to do something that will clean up some RAM for us later in the guide.
Do a search and replace (Usually CTRL+H) for "Underwater_palette_2". Replace all with "Underwater_palette".
I don't know why the game used two different section for underwater palettes, but I've done this change in my hack and it did no harm.

We're done with the first part of this guide! Try to build your Rom, and you'll get some errors! Fun!
Next up, we'll be fixing these errors.

Step 4 - Break it until it's fixed!
---------------------------------------------------------------------------------------------------------------------------------------------------------------
If you look at the log, you'll see a lot of errors like this one:

> > >Sonic 2 Clone Driver.asm(42): error: unknown opcode
> > > INCBIN
> > > PSG7: incbin sound\psg7.bin

Luckily, this is a simple fix. Open up Sonic 2 Clone Driver.asm, anf find and replace (CRTL+H usually) all instances of "INCBIN" with "BINCLUDE" (Without the quotes, obviously).

Now repeat the process, replacing all intances of "@loc" with "Lloc". The HG dissasembly does not like local routines, so this converts them into normal routines to avoid errors.

Save the file, and compile the ROM again. I got 437 errors, and of course, they need to be fixed as well.

On the bright side, you can close s2.asm and Sonic 2 Clone Driver.asn, they are all fixed.

Step 5 - Strippers
------------------------------------------------------------------------------------------------------------------------------------------------------------------
Re-Open s2.sounddriver.asm, because we need to strip it down even more.

Find zDACPtrTbl, and delete everything down to the line "idstart := 81h"

Go to "zBankSwitchToMusic:", and delete the contents of that routine.(Everything between "zBankSwitchToMusic:" and "ret"
Go to "zUpdateDAC:" and again delete everything down to "ret".

Now find this line:

ensure1byteoffset macro maxsize


Delete everything between that and endm, but leave those two lines, otherwise you will get errors.

If you build the ROM now, you will get 393 errors, but almost all of these are duplicates or fixed just by fixing another.
Don't close s2.sounddriver.asm just yet, we'll be stripping more content from that later. Right now however, we're going to fix the bulk of these errors.

Step 6 - Identity Crisis
------------------------------------------------------------------------------------------------------------------------------------------------------------------
Open s2.constants.asm. 393 is a lot of errors, but all it takes to fix them is a copy+paste job for you.

Find the line "; Music IDs". You'll see this:

; Music IDs
offset :=	zMasterPlaylist
ptrsize :=	1
idstart :=	$81
; $80 is reserved for silence, so if you make idstart $80 or less,
; you may need to insert a dummy zMusIDPtr in the $80 slot


delete everything from there down to "MusID__End = id(zMusIDPtr__End) ; A0", and paste the following where it used to be:

; Music IDs
offset :=	MusicIndex
ptrsize :=	1
idstart :=	$81
; $80 is reserved for silence, so if you make idstart $80 or less,
; you may need to insert a dummy zMusIDPtr in the $80 slot

MusID__First =   		idstart
MusID_2PResult =  	$81
MusID_EHZ =          	$82
MusID_MCZ_2P =      	$83
MusID_OOZ =          	$84
MusID_MTZ =          	$85
MusID_HTZ =          	$86
MusID_ARZ =          	$87
MusID_CNZ_2P =      	$88
MusID_CNZ =          	$89
MusID_DEZ =          	$8A
MusID_MCZ =          	$8B
MusID_EHZ_2P =      	$8C
MusID_SCZ =          	$8D
MusID_CPZ =          	$8E
MusID_WFZ =          	$8F
MusID_HPZ =          	$90
MusID_Options =      	$91
MusID_SpecStage =  	$92
MusID_Boss =        	$93
MusID_EndBoss =      	$94
MusID_Ending =      	$95
MusID_SuperSonic =	$96
MusID_Invincible =	$97
MusID_ExtraLife =  	$98
MusID_Title =        	$99
MusID_EndLevel =  	$9A
MusID_GameOver =  	$9B
MusID_Continue =  	$9C
MusID_Emerald =      	$9D
MusID_Credits =      	$9E
MusID_Countdown =  	$9F
MusID__End   =  	$A0


The music is all fixed, now all that's left is the sound effects:

Find the line "; Sound IDs", and delete everything down to the line "; Special sound IDs". Leve the special IDs alone.

In place of the text you deleted, just paste this:

; Sound IDs
offset :=	SoundIndex
ptrsize :=	2
idstart :=	$A0

SndID__First = idstart
SndID_Jump =                	$A0            	; A0
SndID_Checkpoint =        	$A1          	; A1
SndID_SpikeSwitch =        	$A2          	; A2
SndID_Hurt =                	$A3            	; A3
SndID_Skidding =          	$A4            	; A4
SndID_BlockPush =          	$A5          	; A5
SndID_HurtBySpikes =      	$A6   	; A6
SndID_Sparkle =            	$A7
SndID_Beep =              	$A8
SndID_Bwoop =              	$A9
SndID_Splash =            	$AA
SndID_Swish =              	$AB
SndID_BossHit =            	$AC
SndID_InhalingBubble =    	$AD
SndID_ArrowFiring =        	$AE
SndID_LavaBall =          	$AE
SndID_Shield =            	$Af
SndID_LaserBeam =          	$B0
SndID_Zap =                	$B1
SndID_Drown =              	$B2
SndID_FireBurn =          	$B3
SndID_Bumper =            	$B4
SndID_Ring =              	$B5 	; B5
SndID_RingRight =          	$B5
SndID_SpikesMove =        	$B6
SndID_Rumbling =          	$B7
SndID_Smash =              	$B9
SndID_DoorSlam =          	$BB
SndID_SpindashRelease =    	$BC 	; BC
SndID_Hammer =            	$BD
SndID_Roll =              	$BE
SndID_ContinueJingle =    	$BF
SndID_CasinoBonus =        	$C0
SndID_Explosion =          	$C1
SndID_WaterWarning =      	$C2
SndID_EnterGiantRing =    	$C3
SndID_BossExplosion =      	$C4
SndID_TallyEnd =          	$C5
SndID_RingSpill =          	$C6
SndID_Flamethrower =      	$C8
SndID_Bonus =              	$C9
SndID_SpecStageEntry =    	$CA
SndID_SlowSmash =          	$CB
SndID_Spring =            	$CC
SndID_Blip =              	$CD
SndID_RingLeft =          	$B5
SndID_Signpost =          	$CF
SndID_CNZBossZap =        	$D0
SndID_Signpost2P =        	$D3
SndID_OOZLidPop =            	$D4
SndID_SlidingSpike =      	$D5
SndID_CNZElevator =        	$D6
SndID_PlatformKnock =      	$D7
SndID_BonusBumper =        	$D8
SndID_LargeBumper =        	$D9
SndID_Gloop =              	$DA
SndID_PreArrowFiring =    	$DB
SndID_Fire =              	$DC
SndID_ArrowStick =        	$DD
SndID_Helicopter =        	$DE
SndID_SuperTransform =    	$DF
SndID_SpindashRev =        	$E0
SndID_Rumbling2 =          	$E1
SndID_CNZLaunch =          	$E2
SndID_Flipper =            	$E3
SndID_HTZLiftClick =      	$E4
SndID_Leaves =            	$E5
SndID_MegaMackDrop =      	$E6
SndID_DrawbridgeMove =    	$E7
SndID_QuickDoorSlam =      	$E8
SndID_DrawbridgeDown =    	$E9
SndID_LaserBurst =        	$EA
SndID_Scatter =            	$EB
SndID_LaserFloor =        	$EB
SndID_Teleport =          	$EC
SndID_Error =              	$ED
SndID_MechaSonicBuzz =    	$EE
SndID_LargeLaser =        	$EF
SndID_OilSlide =          	$F0
SndID__End 	=        	$F7


Step 7 - I am Error
------------------------------------------------------------------------------------------------------------------------------------------------------------------
Now we are going back to s2.sounddriver.asm.
There are 4 more errors here.
As before, we're going to solve this by simply emptying out the relavent routines. We can't just delete stuff because a few things in it are still going to be referenced.
So the first Routine to clean out is zDACAfterDur. change that and remove zloc_22A inside it so it looks like this:

zDACAfterDur:
	ret


There is one more routine to empty. That routine is zloc_78E, or zBGMLoad. Starting at this line:

zBGMLoad:


delete everything down to here:

	; End of DAC/FM init, begin PSG init


And there you have it! Close s2.sounddriver.asm, Build you ROM and test it!

Additional Step
------------------------------------------------------------------------------------------------------------------------------------------------------------------
Uh-oh! if you've played up to Chemical Plant Zone Act 2, you'll notice the driver crashes on that level!

This is because of water. In Sonic 2, the underwater palettes are stored in a section of RAM that is now used by the sound driver, because it's based on Sonic 1's sound driver.
What we need to do now is relocate the water palette table in RAM, so the Sound Driver can do what it likes. I am going to assume you haven't modified the RAM allocation in your hack here, and go step by step. If you have modifying the RAM in your game, you are probably on your own.

Let's go back to s2.constants.asm, and find these lines:

Underwater_palette_2:    	ds.w palette_line_size	; not sure what it's used for but it's only used when there's water
Underwater_palette_2_line2:	ds.w palette_line_size
Underwater_palette_2_line3:	ds.w palette_line_size
Underwater_palette_2_line4:	ds.w palette_line_size

Underwater_palette:    	ds.w palette_line_size	; main palette for underwater parts of the screen
Underwater_palette_line2:	ds.w palette_line_size
Underwater_palette_line3:	ds.w palette_line_size
Underwater_palette_line4:	ds.w palette_line_size

            	ds.b	$500	; $FFFFF100-$FFFFF5FF ; unused, leftover from the Sonic 1 sound driver (and used by it when you port it to Sonic 2)


The last four lines before the ds.b $500 are used by the sound driver now, in addition to the 500 that is labeled as such.

Replace all of the above lines with this:

   			ds.b  $100  ; Sonic 1 Sound Driver
                	ds.b	$500	; Sonic 1 Sound Driver


After doing that, you will need to find at least $80 free bytes in RAM (besides the space we just put in)
Fortunately, there is an area of RAM that has $C0 free bytes, and that is where the four lines we lost will go. Search for this:

CNZ_saucer_data:


And you will see this:

CNZ_saucer_data:    	ds.b	$40	; the number of saucer bumpers in a group which have been destroyed. Used to decide when to give 500 points instead of 10
            	ds.b	$C0	; $FFFFE740-$FFFFE7FF ; unused as far as I can tell
Ring_Positions:        	ds.b	$600


Replace it with this:

CNZ_saucer_data:    	ds.b	$40	; the number of saucer bumpers in a group which have been destroyed. Used to decide when to give 500 points instead of 10
Underwater_palette:    	ds.w palette_line_size	; main palette for underwater parts of the screen
Underwater_palette_line2:	ds.w palette_line_size
Underwater_palette_line3:	ds.w palette_line_size
Underwater_palette_line4:	ds.w palette_line_size
            	ds.b	$40	; $FFFFE740-$FFFFE7FF ; unused as far as I can tell
Ring_Positions:        	ds.b	$600


Build it, and test!

The sega sound will be glitched up, and you can fix it by following this link. Everything that needs to be fixed will be in "Sonic 2 Clone Driver.asm".
------------------------------------------------------------------------------------------------------------------------------------------------------------------
Credits
Varion Icaria - Puto's sound driver port.
Esrael - Tweakers driver port, plus fixes for things broken in Puto's port, such as hanging on the title card. Extra thanks for fixing the Sega sound.
Puto - Fixes for underwater palette stuff, as well as special stage ring stuff, and various other fixes.
StephenUK - Hints on how to fix the underwater stuff.
drx - Hacking CulT's VDP calculator.
Tweaker - Wrote the orignal guide to port Sonic 1's sound driver into Sonic 2.
ValleyBell - lots of miscallanious help to get this to work, as well as worked on the Sonic 2 Clone Driver.
ShadowsofYesterday - Telling me the fix for the SEGA sound.
Caverns4 - I wrote this guide!



I'm posting this here because I wanted to get some input on improvements I can make, or changes I need to make before posting a How-To on the Wiki. If anyone has any suggestions or help, I would appreciate it very much. One other thing I wasnt cleared up is the credits - did I miss anyone?
This post has been edited by Caverns 4: 12 June 2013 - 06:15 PM

#2 User is offline ShadowsofYesterday 

Posted 12 June 2013 - 04:47 PM

  • I have no idea what's going on.
  • Posts: 169
  • Joined: 16-June 08
  • Gender:Female
  • Location:Fort Wayne, IN
  • Project:Sonic and the Magic Hat
Nice guide. Certain parts could use a bit more clarity, like the ds.b $100 thing near the end there (how many of those lines am I replacing with that? All of them, or just four?), but overall it makes something that's a pain in the neck much easier to do, and to my knowledge there isn't an existing guide of this out there.

Liked, commented, and subscribed.

Also, the "of" in my name isn't capitalized, but it's a common mistake.

#3 User is offline Caverns 4 

Posted 17 June 2013 - 05:18 PM

  • Posts: 271
  • Joined: 07-December 12
  • Gender:Male
  • Project:Sanik Quest: Journey To The Right
Alright, since it's been here a while with no response, I'm working off the assumption that everything is fine, and and I have posted the guide on the Wiki here:

http://info.sonicret...sion_of_Sonic_2

I forgot the "SCHG How-To:" prefix, so I don't know if anyone is capable of editing page titles, but I would appreciate it. I thought is was added automatically to How-to's.

Again though, if there are any other issues with this guide, feel free to let me know.

#4 User is offline MainMemory 

Posted 17 June 2013 - 08:57 PM

  • Every day's the same old thing... Same place, different day...
  • Posts: 3369
  • Joined: 14-August 09
  • Gender:Not Telling
  • Project:SonLVL
  • Wiki edits:1,339
Fixed.

#5 User is offline Caverns 4 

Posted 18 June 2013 - 09:15 AM

  • Posts: 271
  • Joined: 07-December 12
  • Gender:Male
  • Project:Sanik Quest: Journey To The Right

View PostMainMemory, on 17 June 2013 - 08:57 PM, said:

Fixed.


Thank you very much!

There is one more thing I noticed.

under the table for SCHG How-To Guide: Sonic the Hedgehog 2 (16-bit) atthe bottom of the page, my guide doesn't appear on there. It should be there under "Extending the Game". What's wrong?

#6 User is offline MainMemory 

Posted 18 June 2013 - 09:23 AM

  • Every day's the same old thing... Same place, different day...
  • Posts: 3369
  • Joined: 14-August 09
  • Gender:Not Telling
  • Project:SonLVL
  • Wiki edits:1,339
It is there, it's the second item in the list.

#7 User is offline Caverns 4 

Posted 18 June 2013 - 11:35 AM

  • Posts: 271
  • Joined: 07-December 12
  • Gender:Male
  • Project:Sanik Quest: Journey To The Right
Odd, it doesn't show for me... Does a page not show in lists for the creator or something?

#8 User is online Clownacy 

  Posted 09 July 2013 - 07:20 PM

  • Needs to make an avatar
  • Posts: 309
  • Joined: 06-July 13
  • Gender:Male
  • Location:Englandland
Thanks for the guide, Caverns 4, I have been using it myself until recently, and I believe I have some useful information: while examining the original Sonic 1 sound driver guide for the Xenowhirl disassembly, I noticed that towards the end, the author mentioned removing the Sonic 2 sound driver, and I began thinking "Can the Clone Driver completely replace the original?" which pretty much translates to "Is there a way to just delete s2.sounddriver.asm without incurring several thousand errors?", unfortunately, the guide didn't specify how, leaving it to our imaginations. Now I can happily say that I have found a way, this eliminates the stripping detailed in your guide but doesn't fix any of the faults you mentioned, such as the rev-less spindash or another fault I had discovered: the music doesn't speed up correctly.

I have, however, a fix for one two and *a* finding for the other. First though, is my method of porting the Clone Driver, the main benefit, as I mentioned, is the elimination of s2.soundriver.asm.
Spoiler

Here's the spindash rev fix.
Spoiler

Fixing the PSGs.
Spoiler

Here's what (little) I have on the music speed up.
Spoiler

This post has been edited by Clownacy: 16 July 2014 - 05:43 AM

#9 User is offline ValleyBell 

Posted 10 July 2013 - 03:43 AM

  • Posts: 204
  • Joined: 08-September 10
  • Gender:Male
  • Project:researching SMPS sound drivers
  • Wiki edits:10
This reminds me, while helping someone to port the Clone Driver to Sonic 2 HG, I tried making a clean-as-possible port by myself. (I just forgot to post it.)
The results were these notes: (copy-pasted from my .txt file)
Spoiler


It should strip everything related to the S2 sound driver. (unless I missed something)
And although it doesn't include the spindash fix, it includes a quick and easy fix for the SEGA sound issue.

About the speed up table: The tempo algorithms between Sonic 1 and Sonic 2 are completely different, so you'll need to translate the tempo values.
There are formulas to convert tempo value between any of the Sonic games on the wiki: SCHG:Music_Hacking/Pointer_and_Header_Format#SMPS_main_header

btw: The SoundDriverLoad was probably added by me. But because I'm cleaning Sonic 2 of all sound code first and insert the Clone Driver then, this wasn't a problem for me.
This has also the advantage, that it's easily possible to insert the Clone Driver into any other game. (You'd possibly need to port the KosDec, too.)

Page 1 of 1
    Locked
    Locked Forum

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users