don't click here

Rather irritating first time hack

Discussion in 'Engineering & Reverse Engineering' started by mcbpete, Jan 27, 2006.

Thread Status:
Not open for further replies.
  1. mcbpete

    mcbpete

    Musical musicals Member
    12
    0
    0
    Hey there everyone.

    Just got started with the whole hacking scene thing and I thought I'd post something I've started with. It's not very good, and was just a play more than anything. I'm more interested in the sound kind of things more than anything and I'm quite interested in how the whole sound driver thing is implemented on here. All I've done so far is play with the tunings on what I guess is the lookup tables for the frequencies.

    As a result, here's a version of Sonic but with music played by 5 year olds:

    Clicky Click

    See if you can last more that 20 seconds before reaching for the mute button :lol:

    On a slightly more 'serious' note though, you'll notice that there's a horrible click sound twice at the end of the 'Sega' replacement sound. I'm trying to work out why, it sounds like a DC offset style click, but I deliberatly edited the sound so that it ends with the same DC offset, so I can't quite work it out.

    Secondly I'm trying to look at the code that alters the speed of the music. Obviously the code for this can be found within the Speed Boots code I.e.:

    Code (Text):
    1. Obj2E_ChkShoes:
    2.   cmpi.b   #3,d0; does monitor contain speed shoes?
    3.   bne.s    Obj2E_ChkShield
    4.   move.b   #1,($FFFFFE2E).w; speed up the  BG music
    5.   move.w   #$4B0,($FFFFD034).w; time limit for the power-up
    6.   move.w   #$C00,($FFFFF760).w; change Sonic's top speed
    7.   move.w   #$18,($FFFFF762).w
    8.   move.w   #$80,($FFFFF764).w
    9.   move.w   #$E2,d0
    10.   jmp  (PlaySound).l; Speed    up the music
    The move.b #1,($FFFFFE2E).w line however doesn't seem to do anything except either 1 crash if the $ value is too low, 2 do nothing if its around a tolerance value or 3 corrupt the music if its too high.

    However the line "move.w #$E2,d0" DOES seem to affect the music. If I change the value to E3 the music does not change speed (a la the address when the boots run out) and if I change it to anything lower it plays whatever value of sound effect that has that address.

    So how does one actually go about altering the tempo of the tracks. And where exactly are the tracks stored in the de-compiled binary?

    Cheers,
    Pete...
     
  2. stormislandgal

    stormislandgal

    It's not a phase! Tech Member
    4,534
    10
    18
    Married life <3
    Sound E2, if I'm not mistaken, is the code to speed up music. not sure how to edit it though.

    EDIT: Fixed fuckup.
     
  3. Tweaker

    Tweaker

    Banned
    12,387
    2
    0
    "E2" is a special subroutine in the music driver that adds a certain value to the tempo counter for the song, speeding it up. Modifying this subroutine will allow you to determine how much the song is sped up by.

    d0 is the whore for most subroutines in the game. In this case, the PlaySound routine snags the music value places in d0 and processes that song.

    The tracks are stored as data. I assume you're using Hivebrain's split disassembly, so each track is stored as a seperate file in the /sound directory. You can read up on the format of this music data using my guide. A wiki version of it is availiable at http://shit.sclassic.net/ in the "Sonic Community Hacking Guide" section. I intend on updating it soon, so keep on the lookout for a new topic containing my updates in the near future.

    Welcome to S2B, by the way. Enjoy your stay.
     
  4. mcbpete

    mcbpete

    Musical musicals Member
    12
    0
    0
    Cheers Tweaker, thanks for both the warm welcome and the excellent advice (yeah I'm currently using the Hivebrain's split disassembly code) :)
     
  5. Hivebrain

    Hivebrain

    Administrator
    3,050
    166
    43
    53.4N, 1.5W
    Github
    $FFFFFE2E is the speed shoes flag. I need to change that comment.
     
Thread Status:
Not open for further replies.