Sonic 1 sound driver in Sonic 2

Discussion in 'Engineering & Reverse Engineering' started by Tweaker, Jun 8, 2007.

  1. Tweaker

    Tweaker

    Misfits
    12,389
    0
    0
    For anyone who's worked with Sonic 2 before, you'll notice that managing music can be a bit of a hassle. Music has to be in a specific location, has to stay within a certain sound bank... and there's a limited number of sounds you can have in the game. However, the sound driver in Sonic 1 is entirely written in 68k (except for the DAC driver), making it much easier to edit, and much easier to manage music with. You can place music data anywhere, as the pointers use relative addressing, and there are no limitations on where you can place music data.

    So, when Puto comes to me with his own port of the Sonic 1 sound driver, and said he had problems, I showed him a personal port that Esrael made for Sonic 2 Megamix. Together, we were able to fully patch up all the issues that the driver has when ported to Sonic 2. Therefore, we decided we'd make a guide, that, when followed correctly, allows anybody to use the Sonic 1 sound driver in their hack! Included below is the Sonic 1 sound driver in its own seperate ASM file, which you can edit freely, along with the original folder structure for the sound driver's music data, sound data, etc.

    Anyway, on with the guide!

    ---------------------------------------------------

    Okay, first we're going to get the actual driver to load. Go to loc_45E, which should be this:
    <!--g1--><div class='geshitop'>Syntax Highlighted Code: ASM</div><div class='codemain'><!--eg1--><pre class="asm">loc_45E:[color= #adadad; font-style: italic;]; CODE XREF: ROM:000004C2j[/color]
    [color= #adadad; font-style: italic;]; ROM:00000562j ...[/color]
    [color= #00bfff;]addq[/color].[color= #00bfff;]l[/color] [color= #ff0000;]#[/color][color= #ff0000;]1[/color],<span style="">(</span>[color= #ff0000;]$[/color][color= #ff0000;]FFFFFE0C[/color]<span style="">)</span>.[color= #00bfff;]w[/color]
    [color= #00bfff;]movem[/color].[color= #00bfff;]l[/color] <span style="">(</span><span style="font-weight:bold;">sp</span><span style="">)</span>+,d0-<span style="font-weight:bold;">a6</span>
    [color= #00bfff;]rte[/color]</pre><!--gc2--><!--bG9jXzQ1RTo7IENPREUgWFJFRjogUk9NOjAwMDAwNEMyGWoKOyBST006MDAwMDA1NjIZaiAuLi4KCQlh
    ZGRxLmwJIzEsKCYjMDM2O0ZGRkZGRTBDKS53CgkJbW92ZW0ubAkoc3ApKyxkMC1hNgoJCXJ0ZQ==--><!--egc2--><!--g2--></div><!--eg2-->

    And change it to this...
    <!--g1--><div class='geshitop'>Syntax Highlighted Code: ASM</div><div class='codemain'><!--eg1--><pre class="asm">loc_45E:[color= #adadad; font-style: italic;]; CODE XREF: ROM:000004C2j[/color]
    [color= #adadad; font-style: italic;]; ROM:00000562j ...[/color]
    [color= #00bfff;]jsr[/color] Init_Sonic1_Sound_Driver[color= #adadad; font-style: italic;]; Esrael L. G. Neto [/color]
    [color= #00bfff;]addq[/color].[color= #00bfff;]l[/color] [color= #ff0000;]#[/color][color= #ff0000;]1[/color],<span style="">(</span>[color= #ff0000;]$[/color][color= #ff0000;]FFFFFE0C[/color]<span style="">)</span>.[color= #00bfff;]w[/color]
    [color= #00bfff;]movem[/color].[color= #00bfff;]l[/color] <span style="">(</span><span style="font-weight:bold;">sp</span><span style="">)</span>+,d0-<span style="font-weight:bold;">a6</span>
    [color= #00bfff;]rte[/color]</pre><!--gc2--><!--bG9jXzQ1RTo7IENPREUgWFJFRjogUk9NOjAwMDAwNEMyGWoKOyBST006MDAwMDA1NjIZaiAuLi4KCQlq
    c3IJIEluaXRfU29uaWMxX1NvdW5kX0RyaXZlcjsgRXNyYWVsIEwuIEcuIE5ldG8gCgkJCQlhZGRxLmwJI
    zEsKCYjMDM2O0ZGRkZGRTBDKS53CgkJbW92ZW0ubAkoc3ApKyxkMC1hNgoJCXJ0ZQ==--><!--egc2--><!--g2--></div><!--eg2-->

    Next, go to sub_130A, which should be this:
    <!--g1--><div class='geshitop'>Syntax Highlighted Code: ASM</div><div class='codemain'><!--eg1--><pre class="asm">sub_130A:[color= #adadad; font-style: italic;]; CODE XREF: ROM:00000386p[/color]
    [color= #00bfff;]nop[/color]
    [color= #00bfff;]jmp[/color] loc_EC000
    [color= #adadad; font-style: italic;]; End of function sub_130A[/color]</pre><!--gc2--><!--c3ViXzEzMEE6OyBDT0RFIFhSRUY6IFJPTTowMDAwMDM4NhhwCgkJbm9wCQoJCWptcAlsb2NfRUMwMDAK
    OyBFbmQgb2YgZnVuY3Rpb24gc3ViXzEzMEE=--><!--egc2--><!--g2--></div><!--eg2-->

    And change it to this...
    <!--g1--><div class='geshitop'>Syntax Highlighted Code: ASM</div><div class='geshimain'><!--eg1--><pre class="asm">sub_130A:[color= #adadad; font-style: italic;]; CODE XREF: ROM:00000386p[/color]
    [color= #00bfff;]nop[/color]
    [color= #adadad; font-style: italic;];jmp loc_EC000[/color]
    [color= #00bfff;]move[/color].[color= #00bfff;]w[/color] [color= #ff0000;]#[/color][color= #ff0000;]$[/color][color= #ff0000;][color= #ff0000;]0100[/color][/color], <span style="">(</span>[color= #ff0000;]$[/color][color= #ff0000;]00A11100[/color]<span style="">)</span>[color= #adadad; font-style: italic;]; Esrael L. G. Neto Add Sonic 1 Sound Driver[/color]
    [color= #00bfff;]move[/color].[color= #00bfff;]w[/color] [color= #ff0000;]#[/color][color= #ff0000;]$[/color][color= #ff0000;][color= #ff0000;]0100[/color][/color], <span style="">(</span>[color= #ff0000;]$[/color][color= #ff0000;]00A11200[/color]<span style="">)</span>[color= #adadad; font-style: italic;]; Esrael L. G. Neto Add Sonic 1 Sound Driver[/color]
    [color= #00bfff;]lea[/color] Kos_Z80, <span style="font-weight:bold;">A0</span>[color= #adadad; font-style: italic;]; Esrael L. G. Neto Add Sonic 1 Sound Driver[/color]
    [color= #00bfff;]lea[/color] <span style="">(</span>[color= #ff0000;]$[/color][color= #ff0000;]00A00000[/color]<span style="">)</span>, <span style="font-weight:bold;">A1</span>[color= #adadad; font-style: italic;]; Esrael L. G. Neto Add Sonic 1 Sound Driver[/color]
    [color= #00bfff;]bsr[/color] KozDec_193A[color= #adadad; font-style: italic;]; Esrael L. G. Neto Add Sonic 1 Sound Driver[/color]
    [color= #00bfff;]move[/color].[color= #00bfff;]b[/color] [color= #ff0000;]#[/color]<span style="">(</span><span style="">(</span>SegaPCM>>[color= #ff0000;]$[/color][color= #ff0000;][color= #ff0000;]10[/color][/color]<span style="">)</span>&[color= #ff0000;]$[/color][color= #ff0000;]FF[/color]<span style="">)</span>, <span style="">(</span>[color= #ff0000;]$[/color][color= #ff0000;]00A00019[/color]<span style="">)</span>[color= #adadad; font-style: italic;]; Esrael L. G. Neto Add Sonic 1 Sound Driver[/color]
    [color= #00bfff;]move[/color].[color= #00bfff;]w[/color] [color= #ff0000;]#[/color][color= #ff0000;]$[/color][color= #ff0000;][color= #ff0000;]0000[/color][/color], <span style="">(</span>[color= #ff0000;]$[/color][color= #ff0000;]00A11200[/color]<span style="">)</span>[color= #adadad; font-style: italic;]; Esrael L. G. Neto Add Sonic 1 Sound Driver[/color]
    [color= #00bfff;]nop[/color] [color= #adadad; font-style: italic;]; Esrael L. G. Neto Add Sonic 1 Sound Driver[/color]
    [color= #00bfff;]nop[/color] [color= #adadad; font-style: italic;]; Esrael L. G. Neto Add Sonic 1 Sound Driver[/color]
    [color= #00bfff;]nop[/color] [color= #adadad; font-style: italic;]; Esrael L. G. Neto Add Sonic 1 Sound Driver[/color]
    [color= #00bfff;]nop[/color] [color= #adadad; font-style: italic;]; Esrael L. G. Neto Add Sonic 1 Sound Driver[/color]
    [color= #00bfff;]move[/color].[color= #00bfff;]w[/color] [color= #ff0000;]#[/color][color= #ff0000;]$[/color][color= #ff0000;][color= #ff0000;]0100[/color][/color], <span style="">(</span>[color= #ff0000;]$[/color][color= #ff0000;]00A11200[/color]<span style="">)</span>[color= #adadad; font-style: italic;]; Esrael L. G. Neto Add Sonic 1 Sound Driver[/color]
    [color= #00bfff;]move[/color].[color= #00bfff;]w[/color] [color= #ff0000;]#[/color][color= #ff0000;]$[/color][color= #ff0000;][color= #ff0000;]0000[/color][/color], <span style="">(</span>[color= #ff0000;]$[/color][color= #ff0000;]00A11100[/color]<span style="">)</span>[color= #adadad; font-style: italic;]; Esrael L. G. Neto Add Sonic 1 Sound Driver[/color]
    [color= #00bfff;]rts[/color] [color= #adadad; font-style: italic;]; Esrael L. G. Neto Add Sonic 1 Sound Driver[/color]
    [color= #adadad; font-style: italic;]; End of function sub_130A[/color]</pre><!--gc2--><!--c3ViXzEzMEE6OyBDT0RFIFhSRUY6IFJPTTowMDAwMDM4NhhwCgkJbm9wCQo7am1wCWxvY19FQzAwMAoJ
    CW1vdmUudyAgIyYjMDM2OzAxMDAsICgmIzAzNjswMEExMTEwMCk7IEVzcmFlbCBMLiBHLiBOZXRvIEFkZ
    CBTb25pYyAxIFNvdW5kIERyaXZlcgoJCW1vdmUudyAgIyYjMDM2OzAxMDAsICgmIzAzNjswMEExMTIwMC
    k7IEVzcmFlbCBMLiBHLiBOZXRvIEFkZCBTb25pYyAxIFNvdW5kIERyaXZlcgoJCWxlYQkgS29zX1o4MCw
    gQTA7IEVzcmFlbCBMLiBHLiBOZXRvIEFkZCBTb25pYyAxIFNvdW5kIERyaXZlcgoJCWxlYQkgKCYjMDM2
    OzAwQTAwMDAwKSwgQTE7IEVzcmFlbCBMLiBHLiBOZXRvIEFkZCBTb25pYyAxIFNvdW5kIERyaXZlcgoJC
    WJzcgkgS296RGVjXzE5M0E7IEVzcmFlbCBMLiBHLiBOZXRvIEFkZCBTb25pYyAxIFNvdW5kIERyaXZlcg
    oJCW1vdmUuYiAgIygoU2VnYVBDTSZndDsmZ3Q7JiMwMzY7MTApJmFtcDsmIzAzNjtGRiksICgmIzAzNjs
    wMEEwMDAxOSk7IEVzcmFlbCBMLiBHLiBOZXRvIEFkZCBTb25pYyAxIFNvdW5kIERyaXZlcgoJCW1vdmUu
    dyAgIyYjMDM2OzAwMDAsICgmIzAzNjswMEExMTIwMCk7IEVzcmFlbCBMLiBHLiBOZXRvIEFkZCBTb25pY
    yAxIFNvdW5kIERyaXZlcgoJCW5vcAkJOyBFc3JhZWwgTC4gRy4gTmV0byBBZGQgU29uaWMgMSBTb3VuZC
    BEcml2ZXIKCQlub3AJCTsgRXNyYWVsIEwuIEcuIE5ldG8gQWRkIFNvbmljIDEgU291bmQgRHJpdmVyCgk
    Jbm9wCQk7IEVzcmFlbCBMLiBHLiBOZXRvIEFkZCBTb25pYyAxIFNvdW5kIERyaXZlcgoJCW5vcAkJOyBF
    c3JhZWwgTC4gRy4gTmV0byBBZGQgU29uaWMgMSBTb3VuZCBEcml2ZXIKCQltb3ZlLncgICMmIzAzNjswM
    TAwLCAoJiMwMzY7MDBBMTEyMDApOyBFc3JhZWwgTC4gRy4gTmV0byBBZGQgU29uaWMgMSBTb3VuZCBEcm
    l2ZXIKCQltb3ZlLncgICMmIzAzNjswMDAwLCAoJiMwMzY7MDBBMTExMDApOyBFc3JhZWwgTC4gRy4gTmV
    0byBBZGQgU29uaWMgMSBTb3VuZCBEcml2ZXIKCQlydHMJCTsgRXNyYWVsIEwuIEcuIE5ldG8gQWRkIFNv
    bmljIDEgU291bmQgRHJpdmVyCjsgRW5kIG9mIGZ1bmN0aW9uIHN1Yl8xMzBB--><!--egc2--><!--g2--></div><!--eg2-->

    Next, find sub_135E, which should be this:
    <!--g1--><div class='geshitop'>Syntax Highlighted Code: ASM</div><div class='geshimain'><!--eg1--><pre class="asm">sub_135E:[color= #adadad; font-style: italic;]; CODE XREF: ROM:000037BCp[/color]
    [color= #adadad; font-style: italic;]; ROM:0000399Cp ...[/color]
    [color= #00bfff;]tst[/color].[color= #00bfff;]b[/color] <span style="">(</span>[color= #ff0000;]$[/color][color= #ff0000;]FFFFFFE0[/color]<span style="">)</span>.[color= #00bfff;]w[/color]
    [color= #00bfff;]bne[/color].[color= #00bfff;]s[/color] loc_136A
    [color= #00bfff;]move[/color].[color= #00bfff;]b[/color] <span style="font-weight:bold;">d0</span>,<span style="">(</span>[color= #ff0000;]$[/color][color= #ff0000;]FFFFFFE0[/color]<span style="">)</span>.[color= #00bfff;]w[/color]
    [color= #00bfff;]rts[/color]
    [color= #adadad; font-style: italic;]; ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
    ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ[/color]
    &nbsp;
    loc_136A:[color= #adadad; font-style: italic;]; CODE XREF: sub_135E+4j[/color]
    [color= #00bfff;]move[/color].[color= #00bfff;]b[/color] <span style="font-weight:bold;">d0</span>,<span style="">(</span>[color= #ff0000;]$[/color][color= #ff0000;]FFFFFFE4[/color]<span style="">)</span>.[color= #00bfff;]w[/color]
    [color= #00bfff;]rts[/color]
    [color= #adadad; font-style: italic;]; End of function sub_135E[/color]</pre><!--gc2--><!--c3ViXzEzNUU6OyBDT0RFIFhSRUY6IFJPTTowMDAwMzdCQxlwCjsgUk9NOjAwMDAzOTlDGXAgLi4uCgkJ
    dHN0LmIJKCYjMDM2O0ZGRkZGRkUwKS53CgkJYm5lLnMJbG9jXzEzNkEKCQltb3ZlLmIJZDAsKCYjMDM2O
    0ZGRkZGRkUwKS53CgkJcnRzCQo7IMOEw4TDhMOEw4TDhMOEw4TDhMOEw4TDhMOEw4TDhMOEw4TDhMOEw4
    TDhMOEw4TDhMOEw4TDhMOEw4TDhMOEw4TDhMOEw4TDhMOEw4TDhMOEw4TDhMOEw4TDhMOEw4TDhMOEw4T
    DhMOEw4TDhMOEw4TDhMOEw4TDhMOEw4TDhMOEw4TDhMOEw4TDhMOEw4TDhMOEw4TDhAoKbG9jXzEzNkE6
    OyBDT0RFIFhSRUY6IHN1Yl8xMzVFKzQYagoJCW1vdmUuYglkMCwoJiMwMzY7RkZGRkZGRTQpLncKCQlyd
    HMJCjsgRW5kIG9mIGZ1bmN0aW9uIHN1Yl8xMzVF--><!--egc2--><!--g2--></div><!--eg2-->

    And change it to this...
    <!--g1--><div class='geshitop'>Syntax Highlighted Code: ASM</div><div class='geshimain'><!--eg1--><pre class="asm">sub_135E:[color= #adadad; font-style: italic;]; CODE XREF: ROM:000037BCp[/color]
    [color= #adadad; font-style: italic;]; ROM:0000399Cp ...[/color]
    [color= #adadad; font-style: italic;];tst.b ($FFFFFFE0).w[/color]
    [color= #adadad; font-style: italic;];bne.s loc_136A[/color]
    [color= #adadad; font-style: italic;];move.b d0,($FFFFFFE0).w[/color]
    [color= #00bfff;]move[/color].[color= #00bfff;]b[/color] <span style="font-weight:bold;">D0</span>, <span style="">(</span>[color= #ff0000;]$[/color][color= #ff0000;]FFFFF00A[/color]<span style="">)</span>.[color= #00bfff;]w[/color][color= #adadad; font-style: italic;]; Esrael L. G. Neto Change Sonic 1 Sound Driver [/color]
    [color= #00bfff;]rts[/color]
    [color= #adadad; font-style: italic;]; ================================================================================
    ====================================================[/color]
    &nbsp;
    loc_136A:[color= #adadad; font-style: italic;]; CODE XREF: sub_135E+4j[/color]
    [color= #adadad; font-style: italic;];move.b d0,($FFFFFFE4).w[/color]
    [color= #00bfff;]move[/color].[color= #00bfff;]b[/color] <span style="font-weight:bold;">D0</span>, <span style="">(</span>[color= #ff0000;]$[/color][color= #ff0000;]FFFFF00A[/color]<span style="">)</span>.[color= #00bfff;]w[/color][color= #adadad; font-style: italic;]; Esrael L. G. Neto Change Sonic 1 Sound Driver[/color]
    [color= #00bfff;]rts[/color]
    [color= #adadad; font-style: italic;]; End of function sub_135E[/color]</pre><!--gc2--><!--c3ViXzEzNUU6OyBDT0RFIFhSRUY6IFJPTTowMDAwMzdCQxlwCjsgUk9NOjAwMDAzOTlDGXAgLi4uCjt0
    c3QuYgkoJiMwMzY7RkZGRkZGRTApLncKO2JuZS5zCWxvY18xMzZBCjttb3ZlLmIJZDAsKCYjMDM2O0ZGR
    kZGRkUwKS53CgkJbW92ZS5iCUQwLCAoJiMwMzY7RkZGRkYwMEEpLnc7IEVzcmFlbCBMLiBHLiBOZXRvIE
    NoYW5nZSBTb25pYyAxIFNvdW5kIERyaXZlcgkJCgkJcnRzCQo7ID09PT09PT09PT09PT09PT09PT09PT0
    9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
    PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PQoKbG9jXzEzNkE6O
    yBDT0RFIFhSRUY6IHN1Yl8xMzVFKzQYago7bW92ZS5iCWQwLCgmIzAzNjtGRkZGRkZFNCkudwoJCW1vdm
    UuYglEMCwgKCYjMDM2O0ZGRkZGMDBBKS53OyBFc3JhZWwgTC4gRy4gTmV0byBDaGFuZ2UgU29uaWMgMSB
    Tb3VuZCBEcml2ZXIKCQlydHMJCjsgRW5kIG9mIGZ1bmN0aW9uIHN1Yl8xMzVF--><!--egc2--><!--g2--></div><!--eg2-->

    Next find sub_1370, and find this:
    <!--g1--><div class='geshitop'>Syntax Highlighted Code: ASM</div><div class='codemain'><!--eg1--><pre class="asm">sub_1370:[color= #adadad; font-style: italic;]; CODE XREF: ROM:0000392Cp[/color]
    [color= #adadad; font-style: italic;]; ROM:00003CB4p ...[/color]
    [color= #00bfff;]move[/color].[color= #00bfff;]b[/color] <span style="font-weight:bold;">d0</span>,<span style="">(</span>[color= #ff0000;]$[/color][color= #ff0000;]FFFFFFE1[/color]<span style="">)</span>.[color= #00bfff;]w[/color]
    [color= #00bfff;]rts[/color]
    [color= #adadad; font-style: italic;]; End of function sub_1370[/color]</pre><!--gc2--><!--c3ViXzEzNzA6OyBDT0RFIFhSRUY6IFJPTTowMDAwMzkyQxlwCjsgUk9NOjAwMDAzQ0I0GXAgLi4uCgkJ
    bW92ZS5iCWQwLCgmIzAzNjtGRkZGRkZFMSkudwoJCXJ0cwkKOyBFbmQgb2YgZnVuY3Rpb24gc3ViXzEzN
    zA=--><!--egc2--><!--g2--></div><!--eg2-->

    And replace it with this...
    <!--g1--><div class='geshitop'>Syntax Highlighted Code: ASM</div><div class='codemain'><!--eg1--><pre class="asm">sub_1370:[color= #adadad; font-style: italic;]; CODE XREF: ROM:0000392Cp[/color]
    [color= #adadad; font-style: italic;]; ROM:00003CB4p ...[/color]
    [color= #adadad; font-style: italic;];move.b d0,($FFFFFFE1).w [/color]
    [color= #00bfff;]move[/color].[color= #00bfff;]b[/color] <span style="font-weight:bold;">D0</span>, <span style="">(</span>[color= #ff0000;]$[/color][color= #ff0000;]FFFFF00B[/color]<span style="">)</span>.[color= #00bfff;]w[/color][color= #adadad; font-style: italic;]; Esrael L. G. Neto Change Sonic 1 Sound Driver[/color]
    [color= #00bfff;]rts[/color]
    [color= #adadad; font-style: italic;]; End of function sub_1370[/color]</pre><!--gc2--><!--c3ViXzEzNzA6OyBDT0RFIFhSRUY6IFJPTTowMDAwMzkyQxlwCjsgUk9NOjAwMDAzQ0I0GXAgLi4uCjtt
    b3ZlLmIJZDAsKCYjMDM2O0ZGRkZGRkUxKS53IAoJCQkJbW92ZS5iCUQwLCAoJiMwMzY7RkZGRkYwMEIpL
    nc7IEVzcmFlbCBMLiBHLiBOZXRvIENoYW5nZSBTb25pYyAxIFNvdW5kIERyaXZlcgoJCXJ0cwkKOyBFbm
    Qgb2YgZnVuY3Rpb24gc3ViXzEzNzA=--><!--egc2--><!--g2--></div><!--eg2-->

    Now, we're going to fix the broken sound effects, such as rings. Look for sub_1376. It should be this:
    <!--g1--><div class='geshitop'>Syntax Highlighted Code: ASM</div><div class='codemain'><!--eg1--><pre class="asm">sub_1376: [color= #adadad; font-style: italic;]; CODE XREF: sub_11FC2+54j[/color]
    [color= #adadad; font-style: italic;]; sub_11FC2+B0j ...[/color]
    [color= #00bfff;]move[/color].[color= #00bfff;]b[/color] <span style="font-weight:bold;">d0</span>,<span style="">(</span>[color= #ff0000;]$[/color][color= #ff0000;]FFFFFFE2[/color]<span style="">)</span>.[color= #00bfff;]w[/color]
    [color= #00bfff;]rts[/color]
    [color= #adadad; font-style: italic;]; End of function sub_1376[/color]</pre><!--gc2--><!--c3ViXzEzNzY6CQk7IENPREUgWFJFRjogc3ViXzExRkMyKzU0GWoKCQkJOyBzdWJfMTFGQzIrQjAZaiAu
    Li4KCQltb3ZlLmIJZDAsKCYjMDM2O0ZGRkZGRkUyKS53CgkJcnRzCQo7IEVuZCBvZiBmdW5jdGlvbiBzd
    WJfMTM3Ng==--><!--egc2--><!--g2--></div><!--eg2-->

    Replace it with this:
    <!--g1--><div class='geshitop'>Syntax Highlighted Code: ASM</div><div class='codemain'><!--eg1--><pre class="asm">sub_1376: [color= #adadad; font-style: italic;]; CODE XREF: sub_11FC2+54j[/color]
    [color= #adadad; font-style: italic;]; sub_11FC2+B0j ...[/color]
    [color= #00bfff;]bra[/color].[color= #00bfff;]s[/color] sub_135E[color= #adadad; font-style: italic;]; branch to normal sfx playing routine[/color]
    [color= #00bfff;]move[/color].[color= #00bfff;]b[/color] <span style="font-weight:bold;">d0</span>,<span style="">(</span>[color= #ff0000;]$[/color][color= #ff0000;]FFFFFFE2[/color]<span style="">)</span>.[color= #00bfff;]w[/color]
    [color= #00bfff;]rts[/color]
    [color= #adadad; font-style: italic;]; End of function sub_1376[/color]</pre><!--gc2--><!--c3ViXzEzNzY6CQk7IENPREUgWFJFRjogc3ViXzExRkMyKzU0GWoKCQkJOyBzdWJfMTFGQzIrQjAZaiAu
    Li4KCQlicmEucwlzdWJfMTM1RTsgYnJhbmNoIHRvIG5vcm1hbCBzZnggcGxheWluZyByb3V0aW5lCgkJb
    W92ZS5iCWQwLCgmIzAzNjtGRkZGRkZFMikudwoJCXJ0cwo7IEVuZCBvZiBmdW5jdGlvbiBzdWJfMTM3Ng
    ==--><!--egc2--><!--g2--></div><!--eg2-->

    Now, look for sub_137C. It should be this:
    <!--g1--><div class='geshitop'>Syntax Highlighted Code: ASM</div><div class='codemain'><!--eg1--><pre class="asm">sub_137C:[color= #adadad; font-style: italic;]; CODE XREF: sub_FE70+24p h+B576p ...[/color]
    [color= #00bfff;]tst[/color].[color= #00bfff;]b[/color] [color= #ff0000;]1[/color]<span style="">(</span><span style="font-weight:bold;">a0</span><span style="">)</span>
    [color= #00bfff;]bpl[/color].[color= #00bfff;]s[/color] locret_1386
    [color= #00bfff;]move[/color].[color= #00bfff;]b[/color] <span style="font-weight:bold;">d0</span>,<span style="">(</span>[color= #ff0000;]$[/color][color= #ff0000;]FFFFFFE1[/color]<span style="">)</span>.[color= #00bfff;]w[/color]
    &nbsp;
    locret_1386:[color= #adadad; font-style: italic;]; CODE XREF: sub_137C+4j[/color]
    [color= #00bfff;]rts[/color]
    [color= #adadad; font-style: italic;]; End of function sub_137C[/color]</pre><!--gc2--><!--c3ViXzEzN0M6OyBDT0RFIFhSRUY6IHN1Yl9GRTcwKzI0GXAgaCtCNTc2GXAgLi4uCgkJdHN0LmIJMShh
    MCkKCQlicGwucwlsb2NyZXRfMTM4NgoJCW1vdmUuYglkMCwoJiMwMzY7RkZGRkZGRTEpLncKCmxvY3Jld
    F8xMzg2OjsgQ09ERSBYUkVGOiBzdWJfMTM3Qys0GGoKCQlydHMJCjsgRW5kIG9mIGZ1bmN0aW9uIHN1Yl
    8xMzdD--><!--egc2--><!--g2--></div><!--eg2-->

    Replace it with this:
    <!--g1--><div class='geshitop'>Syntax Highlighted Code: ASM</div><div class='geshimain'><!--eg1--><pre class="asm">sub_137C:[color= #adadad; font-style: italic;]; CODE XREF: sub_FE70+24p h+B576p ...[/color]
    [color= #00bfff;]tst[/color].[color= #00bfff;]b[/color] [color= #ff0000;]1[/color]<span style="">(</span><span style="font-weight:bold;">a0</span><span style="">)</span>
    [color= #00bfff;]bpl[/color].[color= #00bfff;]s[/color] locret_1386
    [color= #adadad; font-style: italic;];move.b d0,($FFFFFFE1).w[/color]
    [color= #00bfff;]move[/color].[color= #00bfff;]b[/color] <span style="font-weight:bold;">D0</span>, <span style="">(</span>[color= #ff0000;]$[/color][color= #ff0000;]FFFFF00B[/color]<span style="">)</span>.[color= #00bfff;]w[/color][color= #adadad; font-style: italic;]; Esrael L. G. Neto Change Sonic 1 Sound Driver[/color]
    &nbsp;
    locret_1386:[color= #adadad; font-style: italic;]; CODE XREF: sub_137C+4j[/color]
    [color= #00bfff;]rts[/color]
    [color= #adadad; font-style: italic;]; End of function sub_137C[/color]</pre><!--gc2--><!--c3ViXzEzN0M6OyBDT0RFIFhSRUY6IHN1Yl9GRTcwKzI0GXAgaCtCNTc2GXAgLi4uCgkJdHN0LmIJMShh
    MCkKCQlicGwucwlsb2NyZXRfMTM4Ngo7bW92ZS5iCWQwLCgmIzAzNjtGRkZGRkZFMSkudwoJCW1vdmUuY
    glEMCwgKCYjMDM2O0ZGRkZGMDBCKS53OyBFc3JhZWwgTC4gRy4gTmV0byBDaGFuZ2UgU29uaWMgMSBTb3
    VuZCBEcml2ZXIKCmxvY3JldF8xMzg2OjsgQ09ERSBYUkVGOiBzdWJfMTM3Qys0GGoKCQlydHMJCjsgRW5
    kIG9mIGZ1bmN0aW9uIHN1Yl8xMzdD--><!--egc2--><!--g2--></div><!--eg2-->

    Next, we're going to fix the music so it stops correctly when you pause. Find loc_13A6, which should be this:
    <!--g1--><div class='geshitop'>Syntax Highlighted Code: ASM</div><div class='codemain'><!--eg1--><pre class="asm">loc_13A6:[color= #adadad; font-style: italic;]; CODE XREF: sub_1388+Ej[/color]
    [color= #00bfff;]move[/color].[color= #00bfff;]w[/color] [color= #ff0000;]#[/color][color= #ff0000;]1[/color],<span style="">(</span>[color= #ff0000;]$[/color][color= #ff0000;]FFFFF63A[/color]<span style="">)</span>.[color= #00bfff;]w[/color]
    [color= #00bfff;]move[/color].[color= #00bfff;]b[/color] [color= #ff0000;]#[/color][color= #ff0000;]-2[/color],<span style="">(</span>[color= #ff0000;]$[/color][color= #ff0000;]FFFFFFE0[/color]<span style="">)</span>.[color= #00bfff;]w[/color]</pre><!--gc2--><!--bG9jXzEzQTY6OyBDT0RFIFhSRUY6IHN1Yl8xMzg4K0UYagoJCW1vdmUudwkjMSwoJiMwMzY7RkZGRkY2
    M0EpLncKCQltb3ZlLmIJIy0yLCgmIzAzNjtGRkZGRkZFMCkudw==--><!--egc2--><!--g2--></div><!--eg2-->

    And replace it with this...
    <!--g1--><div class='geshitop'>Syntax Highlighted Code: ASM</div><div class='codemain'><!--eg1--><pre class="asm">loc_13A6:[color= #adadad; font-style: italic;]; CODE XREF: sub_1388+Ej[/color]
    [color= #00bfff;]move[/color].[color= #00bfff;]w[/color] [color= #ff0000;]#[/color][color= #ff0000;]1[/color],<span style="">(</span>[color= #ff0000;]$[/color][color= #ff0000;]FFFFF63A[/color]<span style="">)</span>.[color= #00bfff;]w[/color]
    [color= #adadad; font-style: italic;];move.b #-2,($FFFFFFE0).w [/color]
    [color= #00bfff;]move[/color].[color= #00bfff;]b[/color] [color= #ff0000;]#[/color][color= #ff0000;]$[/color][color= #ff0000;][color= #ff0000;]01[/color][/color],<span style="">(</span>[color= #ff0000;]$[/color][color= #ff0000;]FFFFF003[/color]<span style="">)</span>.[color= #00bfff;]w[/color][color= #adadad; font-style: italic;]; Esrael L. G. Neto Change Sonic 1 Sound Driver - Pause[/color]</pre><!--gc2--><!--bG9jXzEzQTY6OyBDT0RFIFhSRUY6IHN1Yl8xMzg4K0UYagoJCW1vdmUudwkjMSwoJiMwMzY7RkZGRkY2
    M0EpLncKO21vdmUuYgkjLTIsKCYjMDM2O0ZGRkZGRkUwKS53IAoJCW1vdmUuYgkjJiMwMzY7MDEsKCYjM
    DM2O0ZGRkZGMDAzKS53OyBFc3JhZWwgTC4gRy4gTmV0byBDaGFuZ2UgU29uaWMgMSBTb3VuZCBEcml2ZX
    IgLSBQYXVzZQ==--><!--egc2--><!--g2--></div><!--eg2-->

    Next, go to loc_13F2, which should be this:
    <!--g1--><div class='geshitop'>Syntax Highlighted Code: ASM</div><div class='codemain'><!--eg1--><pre class="asm">loc_13F2:[color= #adadad; font-style: italic;]; CODE XREF: sub_1388+4Aj[/color]
    [color= #00bfff;]move[/color].[color= #00bfff;]b[/color] [color= #ff0000;]#[/color][color= #ff0000;]-1[/color],<span style="">(</span>[color= #ff0000;]$[/color][color= #ff0000;]FFFFFFE0[/color]<span style="">)</span>.[color= #00bfff;]w[/color]</pre><!--gc2--><!--bG9jXzEzRjI6OyBDT0RFIFhSRUY6IHN1Yl8xMzg4KzRBGGoKCQltb3ZlLmIJIy0xLCgmIzAzNjtGRkZG
    RkZFMCkudw==--><!--egc2--><!--g2--></div><!--eg2-->

    And replace it with this...
    <!--g1--><div class='geshitop'>Syntax Highlighted Code: ASM</div><div class='codemain'><!--eg1--><pre class="asm">loc_13F2:[color= #adadad; font-style: italic;]; CODE XREF: sub_1388+4Aj[/color]
    [color= #adadad; font-style: italic;];move.b #-1,($FFFFFFE0).w [/color]
    [color= #00bfff;]move[/color].[color= #00bfff;]b[/color] [color= #ff0000;]#[/color][color= #ff0000;]$[/color][color= #ff0000;][color= #ff0000;]80[/color][/color],<span style="">(</span>[color= #ff0000;]$[/color][color= #ff0000;]FFFFF003[/color]<span style="">)</span>.[color= #00bfff;]w[/color][color= #adadad; font-style: italic;]; Esrael L. G. Neto Change Sonic 1 Sound Driver - Pause[/color]</pre><!--gc2--><!--bG9jXzEzRjI6OyBDT0RFIFhSRUY6IHN1Yl8xMzg4KzRBGGoKO21vdmUuYgkjLTEsKCYjMDM2O0ZGRkZG
    RkUwKS53IAoJCW1vdmUuYgkjJiMwMzY7ODAsKCYjMDM2O0ZGRkZGMDAzKS53OyBFc3JhZWwgTC4gRy4gT
    mV0byBDaGFuZ2UgU29uaWMgMSBTb3VuZCBEcml2ZXIgLSBQYXVzZQ==--><!--egc2--><!--g2--></div><!--eg2-->

    Now, find loc_1400, which should be this:
    <!--g1--><div class='geshitop'>Syntax Highlighted Code: ASM</div><div class='codemain'><!--eg1--><pre class="asm">loc_1400:[color= #adadad; font-style: italic;]; CODE XREF: sub_1388+52j sub_1388+5Aj[/color]
    [color= #00bfff;]move[/color].[color= #00bfff;]w[/color] [color= #ff0000;]#[/color][color= #ff0000;]1[/color],<span style="">(</span>[color= #ff0000;]$[/color][color= #ff0000;]FFFFF63A[/color]<span style="">)</span>.[color= #00bfff;]w[/color]
    [color= #00bfff;]move[/color].[color= #00bfff;]b[/color] [color= #ff0000;]#[/color][color= #ff0000;]-1[/color],<span style="">(</span>[color= #ff0000;]$[/color][color= #ff0000;]FFFFFFE0[/color]<span style="">)</span>.[color= #00bfff;]w[/color]
    [color= #00bfff;]rts[/color]</pre><!--gc2--><!--bG9jXzE0MDA6OyBDT0RFIFhSRUY6IHN1Yl8xMzg4KzUyGGogc3ViXzEzODgrNUEYagoJCW1vdmUudwkj
    MSwoJiMwMzY7RkZGRkY2M0EpLncKCQltb3ZlLmIJIy0xLCgmIzAzNjtGRkZGRkZFMCkudwoJCXJ0cw==--><!--egc2--><!--g2--></div><!--eg2-->

    And replace it with this...
    <!--g1--><div class='geshitop'>Syntax Highlighted Code: ASM</div><div class='codemain'><!--eg1--><pre class="asm">loc_1400:[color= #adadad; font-style: italic;]; CODE XREF: sub_1388+52j sub_1388+5Aj[/color]
    [color= #00bfff;]move[/color].[color= #00bfff;]w[/color] [color= #ff0000;]#[/color][color= #ff0000;]1[/color],<span style="">(</span>[color= #ff0000;]$[/color][color= #ff0000;]FFFFF63A[/color]<span style="">)</span>.[color= #00bfff;]w[/color]
    [color= #adadad; font-style: italic;];move.b #-1,($FFFFFFE0).w [/color]
    [color= #00bfff;]move[/color].[color= #00bfff;]b[/color] [color= #ff0000;]#[/color][color= #ff0000;]$[/color][color= #ff0000;][color= #ff0000;]01[/color][/color],<span style="">(</span>[color= #ff0000;]$[/color][color= #ff0000;]FFFFF003[/color]<span style="">)</span>.[color= #00bfff;]w[/color][color= #adadad; font-style: italic;]; Esrael L. G. Neto Change Sonic 1 Sound Driver - Pause[/color]
    [color= #00bfff;]rts[/color]</pre><!--gc2--><!--bG9jXzE0MDA6OyBDT0RFIFhSRUY6IHN1Yl8xMzg4KzUyGGogc3ViXzEzODgrNUEYagoJCW1vdmUudwkj
    MSwoJiMwMzY7RkZGRkY2M0EpLncKO21vdmUuYgkjLTEsKCYjMDM2O0ZGRkZGRkUwKS53IAoJCW1vdmUuY
    gkjJiMwMzY7MDEsKCYjMDM2O0ZGRkZGMDAzKS53OyBFc3JhZWwgTC4gRy4gTmV0byBDaGFuZ2UgU29uaW
    MgMSBTb3VuZCBEcml2ZXIgLSBQYXVzZQoJCXJ0cw==--><!--egc2--><!--g2--></div><!--eg2-->

    Next, find loc_541A, which should be this:
    <!--g1--><div class='geshitop'>Syntax Highlighted Code: ASM</div><div class='codemain'><!--eg1--><pre class="asm">loc_541A:[color= #adadad; font-style: italic;]; CODE XREF: ROM:00005212j[/color]
    [color= #adadad; font-style: italic;]; ROM:0000525Aj[/color]
    [color= #00bfff;]move[/color].[color= #00bfff;]b[/color] [color= #ff0000;]#[/color][color= #ff0000;]-1[/color],<span style="">(</span>[color= #ff0000;]$[/color][color= #ff0000;]FFFFFFE0[/color]<span style="">)</span>.[color= #00bfff;]w[/color]
    [color= #00bfff;]move[/color].[color= #00bfff;]b[/color] [color= #ff0000;]#[/color][color= #ff0000;]8[/color],<span style="">(</span>[color= #ff0000;]$[/color][color= #ff0000;]FFFFF62A[/color]<span style="">)</span>.[color= #00bfff;]w[/color]
    [color= #00bfff;]bra[/color].[color= #00bfff;]w[/color] sub_3384</pre><!--gc2--><!--bG9jXzU0MUE6OyBDT0RFIFhSRUY6IFJPTTowMDAwNTIxMhhqCjsgUk9NOjAwMDA1MjVBGGoKCQltb3Zl
    LmIJIy0xLCgmIzAzNjtGRkZGRkZFMCkudwoJCW1vdmUuYgkjOCwoJiMwMzY7RkZGRkY2MkEpLncKCQlic
    mEudwlzdWJfMzM4NA==--><!--egc2--><!--g2--></div><!--eg2-->

    And replace it with this...
    <!--g1--><div class='geshitop'>Syntax Highlighted Code: ASM</div><div class='codemain'><!--eg1--><pre class="asm">loc_541A:[color= #adadad; font-style: italic;]; CODE XREF: ROM:00005212j[/color]
    [color= #adadad; font-style: italic;]; ROM:0000525Aj[/color]
    [color= #adadad; font-style: italic;];move.b #-1,($FFFFFFE0).w[/color]
    [color= #00bfff;]move[/color].[color= #00bfff;]b[/color] [color= #ff0000;]#[/color][color= #ff0000;]$[/color][color= #ff0000;][color= #ff0000;]01[/color][/color],<span style="">(</span>[color= #ff0000;]$[/color][color= #ff0000;]FFFFF003[/color]<span style="">)</span>.[color= #00bfff;]w[/color][color= #adadad; font-style: italic;]; Esrael L. G. Neto Change Sonic 1 Sound Driver - Pause [/color]
    [color= #00bfff;]move[/color].[color= #00bfff;]b[/color] [color= #ff0000;]#[/color][color= #ff0000;]8[/color],<span style="">(</span>[color= #ff0000;]$[/color][color= #ff0000;]FFFFF62A[/color]<span style="">)</span>.[color= #00bfff;]w[/color]
    [color= #00bfff;]bra[/color].[color= #00bfff;]w[/color] sub_3384</pre><!--gc2--><!--bG9jXzU0MUE6OyBDT0RFIFhSRUY6IFJPTTowMDAwNTIxMhhqCjsgUk9NOjAwMDA1MjVBGGoKO21vdmUu
    YgkjLTEsKCYjMDM2O0ZGRkZGRkUwKS53CgkJbW92ZS5iCSMmIzAzNjswMSwoJiMwMzY7RkZGRkYwMDMpL
    nc7IEVzcmFlbCBMLiBHLiBOZXRvIENoYW5nZSBTb25pYyAxIFNvdW5kIERyaXZlciAtIFBhdXNlCQkKCQ
    ltb3ZlLmIJIzgsKCYjMDM2O0ZGRkZGNjJBKS53CgkJYnJhLncJc3ViXzMzODQ=--><!--egc2--><!--g2--></div><!--eg2-->

    Now, we're going to fix the underwater palettes, since the sound driver uses some space in RAM that, in S2, is used for underwater palettes. Do a search and replace (ctrl+h) and replace all instances of "$FFFFF08" with "$FFFFFA8" - what this will do is make the game read from the Sonic 1 location for underwater palettes, which is unused in S2, and unaffected by the sound driver.

    Next, go to sub_2764. This is the Sonic 2 equivalent of "PalLoad4_Water" in Sonic 1, and what we're going to do is change a line in it to match the Sonic 1 routine, so the underwater palettes load to the correct address. The routine should look like this:
    <!--g1--><div class='geshitop'>Syntax Highlighted Code: ASM</div><div class='geshimain'><!--eg1--><pre class="asm">sub_2764:[color= #adadad; font-style: italic;]; CODE XREF: ROM:000042E4p[/color]
    [color= #00bfff;]lea[/color] <span style="">(</span>PalPoint<span style="">)</span>.[color= #00bfff;]l[/color],<span style="font-weight:bold;">a1</span>
    [color= #00bfff;]lsl[/color].[color= #00bfff;]w[/color] [color= #ff0000;]#[/color][color= #ff0000;]3[/color],<span style="font-weight:bold;">d0</span>
    [color= #00bfff;]adda[/color].[color= #00bfff;]w[/color] <span style="font-weight:bold;">d0</span>,<span style="font-weight:bold;">a1</span>
    [color= #00bfff;]movea[/color].[color= #00bfff;]l[/color] <span style="">(</span><span style="font-weight:bold;">a1</span><span style="">)</span>+,<span style="font-weight:bold;">a2</span>
    [color= #00bfff;]movea[/color].[color= #00bfff;]w[/color] <span style="">(</span><span style="font-weight:bold;">a1</span><span style="">)</span>+,<span style="font-weight:bold;">a3</span>
    [color= #00bfff;]suba[/color].[color= #00bfff;]l[/color] [color= #ff0000;]#[/color][color= #ff0000;]$[/color][color= #ff0000;]B00[/color],<span style="font-weight:bold;">a3</span>
    [color= #00bfff;]move[/color].[color= #00bfff;]w[/color] <span style="">(</span><span style="font-weight:bold;">a1</span><span style="">)</span>+,<span style="font-weight:bold;">d7</span>
    &nbsp;
    loc_277A:[color= #adadad; font-style: italic;]; CODE XREF: sub_2764+18j[/color]
    [color= #00bfff;]move[/color].[color= #00bfff;]l[/color] <span style="">(</span><span style="font-weight:bold;">a2</span><span style="">)</span>+,<span style="">(</span><span style="font-weight:bold;">a3</span><span style="">)</span>+
    [color= #00bfff;]dbf[/color] <span style="font-weight:bold;">d7</span>,loc_277A
    [color= #00bfff;]rts[/color]
    [color= #adadad; font-style: italic;]; End of function sub_2764[/color]</pre><!--gc2--><!--c3ViXzI3NjQ6OyBDT0RFIFhSRUY6IFJPTTowMDAwNDJFNBlwCgkJbGVhCShQYWxQb2ludCkubCxhMQoJ
    CWxzbC53CSMzLGQwCgkJYWRkYS53CWQwLGExCgkJbW92ZWEubAkoYTEpKyxhMgoJCW1vdmVhLncJKGExK
    SssYTMKCQlzdWJhLmwJIyYjMDM2O0IwMCxhMwoJCW1vdmUudwkoYTEpKyxkNwoKbG9jXzI3N0E6OyBDT0
    RFIFhSRUY6IHN1Yl8yNzY0KzE4GWoKCQltb3ZlLmwJKGEyKSssKGEzKSsKCQlkYmYJZDcsbG9jXzI3N0E
    KCQlydHMJCjsgRW5kIG9mIGZ1bmN0aW9uIHN1Yl8yNzY0--><!--egc2--><!--g2--></div><!--eg2-->

    Change it to this:
    <!--g1--><div class='geshitop'>Syntax Highlighted Code: ASM</div><div class='geshimain'><!--eg1--><pre class="asm">sub_2764:[color= #adadad; font-style: italic;]; CODE XREF: ROM:000042E4p[/color]
    [color= #00bfff;]lea[/color] <span style="">(</span>PalPoint<span style="">)</span>.[color= #00bfff;]l[/color],<span style="font-weight:bold;">a1</span>
    [color= #00bfff;]lsl[/color].[color= #00bfff;]w[/color] [color= #ff0000;]#[/color][color= #ff0000;]3[/color],<span style="font-weight:bold;">d0</span>
    [color= #00bfff;]adda[/color].[color= #00bfff;]w[/color] <span style="font-weight:bold;">d0</span>,<span style="font-weight:bold;">a1</span>
    [color= #00bfff;]movea[/color].[color= #00bfff;]l[/color] <span style="">(</span><span style="font-weight:bold;">a1</span><span style="">)</span>+,<span style="font-weight:bold;">a2</span>
    [color= #00bfff;]movea[/color].[color= #00bfff;]w[/color] <span style="">(</span><span style="font-weight:bold;">a1</span><span style="">)</span>+,<span style="font-weight:bold;">a3</span>
    [color= #00bfff;]suba[/color].[color= #00bfff;]l[/color] [color= #ff0000;]#[/color][color= #ff0000;]$[/color][color= #ff0000;][color= #ff0000;]80[/color][/color],<span style="font-weight:bold;">a3</span>
    [color= #00bfff;]move[/color].[color= #00bfff;]w[/color] <span style="">(</span><span style="font-weight:bold;">a1</span><span style="">)</span>+,<span style="font-weight:bold;">d7</span>
    &nbsp;
    loc_277A:[color= #adadad; font-style: italic;]; CODE XREF: sub_2764+18j[/color]
    [color= #00bfff;]move[/color].[color= #00bfff;]l[/color] <span style="">(</span><span style="font-weight:bold;">a2</span><span style="">)</span>+,<span style="">(</span><span style="font-weight:bold;">a3</span><span style="">)</span>+
    [color= #00bfff;]dbf[/color] <span style="font-weight:bold;">d7</span>,loc_277A
    [color= #00bfff;]rts[/color]
    [color= #adadad; font-style: italic;]; End of function sub_2764[/color]</pre><!--gc2--><!--c3ViXzI3NjQ6OyBDT0RFIFhSRUY6IFJPTTowMDAwNDJFNBlwCgkJbGVhCShQYWxQb2ludCkubCxhMQoJ
    CWxzbC53CSMzLGQwCgkJYWRkYS53CWQwLGExCgkJbW92ZWEubAkoYTEpKyxhMgoJCW1vdmVhLncJKGExK
    SssYTMKCQlzdWJhLmwJIyYjMDM2OzgwLGEzCgkJbW92ZS53CShhMSkrLGQ3Cgpsb2NfMjc3QTo7IENPRE
    UgWFJFRjogc3ViXzI3NjQrMTgZagoJCW1vdmUubAkoYTIpKywoYTMpKwoJCWRiZglkNyxsb2NfMjc3QQo
    JCXJ0cwkKOyBFbmQgb2YgZnVuY3Rpb24gc3ViXzI3NjQ=--><!--egc2--><!--g2--></div><!--eg2-->

    What this does is change how much the game subtracts from $FB00, in order to calculate the location to move underwater palettes to.

    The last thing we have to do in order to fix underwater palettes for good is to change a VDP instruction, which is what changes the palette fully to the underwater pallete once you're deep enough underwater, and the raster effects are no longer in effect. Do a search and replace for "-$69076AC0" and replace all instances of it with "$96FD9540" - this will make sure that when you're deep enough underwater, the correct palette is loaded.

    The final step is to grab a slightly modified version of the Sonic 1 sound driver from Hivebrain's 2005 Sonic 1 disassembly (link below), and insert it into the Sonic 2 disassembly - the location does not matter, though I personally reccomend the end of the ROM. You can also delete the Sonic 2 sound driver now, if you wish, though it is not required to do so.

    You can either use the include directive to insert S1 Sound Driver.asm, or you can simply copy/paste what's in there. Either will be sufficient.

    NOTE: Certain sound effects and music from Sonic 2 WILL be missing, and you WILL need to add these yourself if you wish to still have them in game. To add a sound effect/music, simply tack it at the end of SoundIndex or MusicIndex. You can also get rid of SoundD0Index (and related setup) if you wish, as Sonic 2 does not have any sound effects that require it. Kega may also mess up a tad bit, not sure why - if anyone can figure it out, let us know.

    Also, Sega sound is garbled. If you want to use it, either use a custom song, or figure out how to get it working. If anyone figures out how to do the latter, it would be appreciated if you shared your methods.

    Sound driver files: http://www.fileden.com/files/15774/S1SoundDriverFiles.rar

    CREDITS:
    Varion Icaria - Puto's sound driver port.
    Esrael - My 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.
    Myself - I helped Puto fix the underwater stuff, and I wrote the guide. =P

    And that's it! Enjoy! Let me or Puto know if there's any issues left, and we'll try and patch them up.
     
  2. drx

    drx

    mfw Researcher
    2,196
    12
    18
    :rolleyes:
    Esrael puts nice watermarks in his stuff :P
     
  3. LocalH

    LocalH

    roxoring your soxors Tech Member
    3,256
    0
    16
    wouldn't you like to know
    Super Guitar Hero II
    One thing to be aware of when you do this - you're taking time away from the main program code on the 68k in order to run your music driver now, so the chance for the game to lag is a bit higher.
     
  4. Tweaker

    Tweaker

    Misfits
    12,389
    0
    0
    I'm aware. But, at least in the case of the original Sonic 2, no more noticable lag is induced, even in 2-player splitscreen mode.
     
  5. StephenUK

    StephenUK

    Liquor in the front, poker in the rear Tech Member
    1,675
    0
    0
    Manchester, UK
    Quackshot Disassembly
    Except on the title card, where it has a small amount of lag. You can hear it in the music, but it's not a lot.
     
  6. Puto

    Puto

    Shin'ichi Kudō, detective. Tech Member
    2,013
    0
    0
    Portugal, Oeiras
    Part of Team Megamix, but haven't done any actual work in ages.
    I think we no longer have any lag on the title card. Either that, or it's such a small amount, that it's un-noticeable.
     
  7. Quickman

    Quickman

    Tech Members Tech Member
    5,584
    0
    0
    :x
    omg porjcet
    I must be unique in wanting to do the exact opposite to what this guide is doing - I'd rather port the Sonic 2 sound driver to Sonic 1 - the Sonic 2 sound driver is far more modular, so it's easier to drag it around as a bundle.

    (Besides which there's actually a disassembly of Sonic 1, whereas there isn't one for Sonic 2. :P)
     
  8. Puto

    Puto

    Shin'ichi Kudō, detective. Tech Member
    2,013
    0
    0
    Portugal, Oeiras
    Part of Team Megamix, but haven't done any actual work in ages.
    drx already did that once, it's somewhere here on s2b.
     
  9. drx

    drx

    mfw Researcher
    2,196
    12
    18
    :rolleyes:
    Yea, and an I did that before the ASM times if I remember correctly.
     
  10. Dracula

    Dracula

    Oldbie Oldbie
    602
    0
    16
    I'm watching you!
    Restoring Thunder Force II Music and Voices from X68000 Version
    Awesome guide!
     
  11. Esrael

    Esrael

    Tech Members Tech Member
    187
    0
    0
    Brazil, São Paulo, Guarulhos
    Neto Assembler Editor / Sonic 2 Delta / Neto Boot Loader
    To Fix Sega Sound Change The Following instrunctions:

    Edit:
    Code (Text):
    1.  
    2. Replace  
    3.         move.b  $0F, ($00A00019); Esrael L. G. Neto Add Sonic 1 Sound Driver
    4.   With   
    5.         move.b  #((SegaPCm>>$10)&$FF), ($00A00019); Esrael L. G. Neto Add Sonic 1 Sound Driver
    And
    Edit: Use this code before SegaPCM this will calculate Segaaaa Bank

    Code (Text):
    1.         cnop $0, (((((*+$6978)>>$10)+$01)*$10000)-$6978); Esrael L. G. Neto Auto Detect Bank   
    2. SegaPCM:   
    3.         incbin  sound\segapcm.bin
     
  12. Puto

    Puto

    Shin'ichi Kudō, detective. Tech Member
    2,013
    0
    0
    Portugal, Oeiras
    Part of Team Megamix, but haven't done any actual work in ages.
    "Oops". Apparently, I made a mistake when I fixed the water palettes. Here's a fixed version of that part of the guide, with changes in bold:

    Also, for the record, you forgot to credit drx. I couldn't have fixed the underwater palettes without his VDP Calculator =P.
     
  13. Tweaker

    Tweaker

    Misfits
    12,389
    0
    0
    Thanks, guide edited.
     
  14. Tweaker

    Tweaker

    Misfits
    12,389
    0
    0
    Another edit; this one includes dynamic recalculation of the Sega sound's location, so the Sega sound now works perfectly. Redownload the sound driver files and make the necessary edits if you've already followed this guide before.
     
  15. Ultima

    Ultima

    Games Publisher Tech Member
    2,396
    0
    0
    London, England
    Publishing mobile games!
    Nice one, guys.
     
  16. Tweaker

    Tweaker

    Misfits
    12,389
    0
    0
    Made another edit. This one fixes all sound effect errors for good, from what I can tell. Look over your implementation, make the edits, etc.
     
  17. Flygon

    Flygon

    Pictured: Dolt Member
    Excuse me but is there a chance of a Xenowirl compatible version of this guide?
     
  18. shobiz

    shobiz

    Tech Members Tech Member
  19. Flygon

    Flygon

    Pictured: Dolt Member
    It has, thanks for the help.

    Edit: I am confused as to how to put in the sound driver into the ROM, it says I can either put it in the include directory or whatever it is again or I could just put it at the end of the ROM, sad thing is I am not entirely sure how to do either, help?
     
  20. Hitaxas

    Hitaxas

    Retro 80's themed Paladins Twich streamer Member
    1,438
    0
    0
    Litchfield,CT
    Becoming a Twitch partner, and getting my life back together
    If I still had a pc, I'd walk you through it with some pictures... but I don't and cannot.
    Anyway,open the asm file for the game, and before the "end of rom" line, paste the code. :thumbsup: