Basic Questions and Answers Thread

Discussion in 'Discussion & Q&A' started by Malevolence, Jul 7, 2009.

  1. MainMemory

    MainMemory Well-Known Member Member

    Joined:
    Mar 29, 2011
    Messages:
    922
    You can't just "make another bank", the sound driver is hardcoded to only look in two banks for music, one of which has the continue music and a bunch of random stuff, and the other which has all the rest of the music and the sound effects. What you can do, is try setting the sound effects in a new bank, which will give you a bit more space for music, or move it to the continue bank and move around the assorted art to get more space. Note that if you put music in the continue bank, you need to use a specific notation in the Z80 playlist section of the sound driver (see the continue music for details).
    Or, you could replace the sound driver entirely, such as the Clone Driver (works like Sonic 1), the KEH sound driver with multi-bank management system, or even the S3K driver.

    Also, when importing music to Sonic 2, you need to either use SMPS2ASM and set the 'uncompressed' flag in the Z80 playlist, or convert the song into the Sonic 2 format with a base address of 1380 and compress it as Saxman (with size). You can't just drop a Sonic 1 format binary into the ROM and expect it to work.
     
    Last edited: May 10, 2019
    Unused Account and Tanman Tanner like this.
  2. Tanman Tanner

    Tanman Tanner Well-Known Member Member

    Joined:
    Dec 23, 2016
    Messages:
    116
    Location:
    Buffalo, New York
    My mistake. Sonic 3 lets me get away with making more banks, but it's not hardcoded like Sonic 2 (at least, not that I know of). I just assumed it'd be the same with Sonic 2, add a new bank, problem solved. Apologies @RyeBread.
     
    Unused Account likes this.
  3. Kilo

    Kilo Foxy Fren Exiled

    Joined:
    Oct 9, 2017
    Messages:
    391
    Location:
    A warm and lovely place~
    I'm currently working on a disassembly of Earthworm Jim, and I'm quite new to IDA Pro (6.8), so the question I have to ask: how do I run a second auto analysis? I've still got a lot of data unexplored and I'm not too sure how to handle it, other than doing another run.
     
  4. Unused Account

    Unused Account Well-Known Member Member

    Joined:
    May 10, 2013
    Messages:
    153
    Right, so I ported the clone driver, but now when I start the game it's almost like it's muted. (It's not, I checked everywhere and Sonic 1 still has its music.)
    I doublechecked the steps and I think I did everything right? Not sure where exactly I went wrong to the point there's no errors but no music is playing.
     
  5. Devon

    Devon Down you're going... down you're going... Member

    Joined:
    Aug 26, 2013
    Messages:
    1,372
    Location:
    your mom
    Lemme ask first, what exactly is your disassembling process like?
     
  6. Kilo

    Kilo Foxy Fren Exiled

    Joined:
    Oct 9, 2017
    Messages:
    391
    Location:
    A warm and lovely place~
    Well, I open the file in IDA, set the processor to 68000 and let it do it's thing.
     
  7. Devon

    Devon Down you're going... down you're going... Member

    Joined:
    Aug 26, 2013
    Messages:
    1,372
    Location:
    your mom
    IDA's auto analysis is unreliable, since by itself, it doesn't know how a Genesis ROM is formatted. I THINK there is a module for IDA that opens Genesis ROMs properly, but I don't remember.

    Unfortunately, no matter what you do, IDA isn't going to magically disassemble the entire ROM for you and properly split the data from the code. There's a lot of manual changes you'll need to make. You'll need a very good understanding of the Genesis hardware and know how to analyze code in order to effectively make a proper disassembly.

    Here are some points to get you started with operating IDA, though:

    What should really be done is that the first thing you do when disassembling a Genesis ROM is set up the vector table at the very start of the ROM (data can be turned into longwords by pressing Q, and into actual pointers by pressing O). There are documents online on which pointers are which. Then, I manually start converting data into code by pressing C on the data I want to convert, with going to each vector table pointer as starting points.

    As for other data, you can press D to change the size of the currently selected line of data. With the 68000, it will go from byte to word, and then word to longword, and then back from longword to byte.

    You can set a label by pressing N at the currently selected line. If you have a pointer or already existing label highlighted, it will change the name of that.

    You probably would also want to set up segments for hardware registers and RAM. You can handle segments by going to Edit>Segments.

    You can set up arrays by selecting the data you want to convert into an array and then pressing *. The size of each member in the array is dependent on the size of the first element selected.

    For relative pointer lists (if you don't know what that is, just look at how Sonic 1/2 objects handle pointers to object routines), you can press Ctrl+R on the pointer you want to set up and set the base address and all that. Make sure you also set the correct type of pointer.

    Oh yeah, and I believe even with your version of IDA, it won't properly disassembly PC relative instructions. See here on how to fix that.
     
  8. Kilo

    Kilo Foxy Fren Exiled

    Joined:
    Oct 9, 2017
    Messages:
    391
    Location:
    A warm and lovely place~
    Well, that's about the same answer I got elsewhere: Here are some shortcuts. This was certainly a lot more in deph however. And yes, there is a Genesis plugin for IDA, but I couldn't figure out how to work it. I'm probably getting to ahead of myself with my current skillset, so maybe it'd be for the best that I drop this project.
     
  9. EMK-20218

    EMK-20218 The Fuss Maker Exiled

    Joined:
    Aug 8, 2008
    Messages:
    1,067
    Location:
    Jardim Capelinha, São Paulo
    Well... whatever. Forget this. Anyone please trash this thing here.
     
    Last edited: May 10, 2019
  10. Unused Account

    Unused Account Well-Known Member Member

    Joined:
    May 10, 2013
    Messages:
    153
    Alright, so after finding out there was a newer version of the clone driver not on the github releases but on the github itself, I've almost seemingly gotten it working. The only issue is, after building without issues, the screen is black.

    I've ran into many issues and after several hours I've fixed them but this one's gotten me stumped.

    Edit:
    So that came from me "fixing" this issue, which I can't seem to actually fix. I followed the github guide and I've redone it all about 6 times, no luck. [​IMG]
     
    Last edited: May 9, 2019
  11. Kilo

    Kilo Foxy Fren Exiled

    Joined:
    Oct 9, 2017
    Messages:
    391
    Location:
    A warm and lovely place~
    This was way way too short for a full post, so here's a mini no-brainer tutorial.
    In Sonic 1, if you were to run at full speed and enter edit mode (or debug mode), you will keep your momentum once you exit out. The fix is extremely simple. Go to Debug_Main. Immediately after the label, insert this.
    Code:
            clr.w    ($FFFFD000+$14).w
    Now let's go over what exactly this is. clr.w is obviously clear word. And ($FFFFD000+$14).w is the destination. So clear the upper word of ($FFFFD000+$14).w
    But what's ($FFFFD000+$14).w? The first part, $FFFFD000 is the start of Sonic's SST. And then it adds $14. Now, this could be read out as $FFFFD014. And $FFFFD014 is where Sonic's inertia is stored. And that's it. All this is doing is, when Sonic enters debug mode, his inertia value is cleared. Hope this helps some of you guys.
    Edit: Changed from clr.b to clr.w, Sonic will now completely stop.
    Edit 2: Just throw this in
    Code:
            clr    ($FFFFD000+$14).w
            clr    ($FFFFD000+$12).w
            clr    ($FFFFD000+$10).w
    Not gonna bother explaining. But this will now absolutely stop Sonic. Before, he would still be able to keep momentum in air.
     
    Last edited: May 15, 2019
    Tanman Tanner likes this.
  12. Aier

    Aier "Aieru Dotsuto" Member

    Joined:
    Nov 10, 2018
    Messages:
    41
    Location:
    Gensokyo's Boundaries
    This is something that has been bothering me for a while.
    You guys know how I was working on Amy's Hammer code? Well, one of the main problems of it was the ground animation, it's was so hard to do because the walking sprites overlaps it, at the end I gave up.
    But now I'm trying to do a "win" animation when the result screen pops up, for that I modified the End of Act subroutine(aka Load_EndOfAct) to lock the player's movement and play X animation. Like this:

    Code:
    Load_EndOfAct:
        lea    (MainCharacter).w,a1                      ; a1=character
        clr.b    status_secondary(a1)
        clr.b    (Update_HUD_timer).w
        move.b    #1,(Control_Locked).w               ; *NEW* lock character controls
        move.b    #AniIDSonAni_Roll,anim(a1)      ; *NEW* play a random animation for test purposes
        bsr.w    SingleObjLoad
        bne.s    +
        move.b    #ObjID_Results,id(a1)               ; load obj3A (end of level results screen)
    But this just doesn't work, and I'm not sure why, Kilo told me to use $FFFFD000+$1C but that didn't do it either.
    I hope someone can help me with this, thanks in advance.
     
  13. ProjectFM

    ProjectFM Optimistic and self-dependent Member

    Joined:
    Oct 4, 2014
    Messages:
    912
    Location:
    Orono, Maine
    $FFFFD000+$1C is the exact same thing as anim(a1) in this case, but for Sonic 1's Sonic SST location. I think you didn't remove
    Code:
        move.w    #(button_right_mask<<8)|0,(Ctrl_1_Logical).w
    from Obj0D_Main_State3, which results in Sonic walking away instead of playing the animation you set.
    Code:
        move.b    #1,(Control_Locked).w
    is unnecessary because it is already set in Obj0D_Main_State3.
     
    Aier likes this.
  14. Aier

    Aier "Aieru Dotsuto" Member

    Joined:
    Nov 10, 2018
    Messages:
    41
    Location:
    Gensokyo's Boundaries
    Sonic doesn't moves to the right when ending a level, because I removed
    Code:
       move.w    #(button_right_mask<<8)|0,(Ctrl_1_Logical).w
    and added
    Code:
    move.b    #1,(Control_Locked).w
    Let's say that sonic is waiting for the result screen to pop up, his animation keeps being waiting.
    Maybe if I left this here you'll understand better the changes.
    Code:
    Obj0D_Main_State3:
        tst.w    (Debug_placement_mode).w
        bne.w    return_194D0
        btst    #1,(MainCharacter+status).w
        bne.s    loc_19434
        move.b    #1,(Control_Locked).w ; *NEW* Lock controls
    ;    move.w    #(button_right_mask<<8)|0,(Ctrl_1_Logical).w
    loc_19434:
        ; This check here is for S1's Big Ring, which would set Sonic's Object ID to 0
        tst.b    (MainCharacter+id).w
        beq.s    loc_1944C
        move.w    (MainCharacter+x_pos).w,d0
        move.w    (Camera_Max_X_pos).w,d1
    ;    addi.w    #$128,d1
    ;    cmp.w    d1,d0
    ;    blo.w    return_194D0
    loc_1944C:
        move.b    #0,routine_secondary(a0) ; => Obj0D_Main_StateNull
    ;loc_19452:
    Load_EndOfAct:
        lea    (MainCharacter).w,a1 ; a1=character
        clr.b    status_secondary(a1)
        clr.b    (Update_HUD_timer).w
        move.b    #AniIDSonAni_Roll,anim(a1)    ; *NEW* Use random animation for test purposes
        bsr.w    SingleObjLoad
        bne.s    +                                 
     
  15. Devon

    Devon Down you're going... down you're going... Member

    Joined:
    Aug 26, 2013
    Messages:
    1,372
    Location:
    your mom
    You should add a flag to check if Sonic should remain in your new animation, and if it's set, then make it so that other animations don't override it.
     
    Aier likes this.
  16. Trickster

    Trickster Well-Known Member Member

    Joined:
    Aug 22, 2018
    Messages:
    110
    Location:
    Brazil Bad Future
    So, I'm making the missing graphics (seen in the purple placeholder part) of the ramps.
    But, I have no idea what to put there.
    upload_2019-5-31_12-24-57.png

    This is one of my tries.
    upload_2019-5-31_12-25-26.png
    Any ideas, please? ;u;
     
  17. MarkeyJester

    MarkeyJester ♡ ! Member

    Joined:
    Jun 27, 2009
    Messages:
    2,867
  18. Samey

    Samey Le Bored Hedgie Member

    Joined:
    May 3, 2017
    Messages:
    57
    I'm having a problem trying to get the peelout charging animation to rotate in my hack. the peelout sprites themselves (when Sonic is running 'n stuff) do rotate fine, but I want it to be as accurate to CD, which means trying to get it to rotate when Sonic charges one up on a slope.

    I have a feeling it's similar to the code in "SAnim_WalkRun:" but I've tried a few times to get it to work to no avail.
     
  19. Kilo

    Kilo Foxy Fren Exiled

    Joined:
    Oct 9, 2017
    Messages:
    391
    Location:
    A warm and lovely place~
    It would help if you could specify the game and which disam. But here's how to do it in Sonic 1 Hivebrain:
    Under loc_13A9C: place this:
    Code:
       lea    (SonAni_Dash).l,a1
       cmpi.w    #$A00,d2    ; is Sonic at dashing speed?
       bcc.s    loc_13AB4    ; if yes, branch
    You can modify $A00 to be whatever you want to get the dash animation to show up. $A00 is just accurate to Sonic CD.
    And despite the fact that there's so little code, this will handle everything.
     
    ProjectFM likes this.
  20. Devon

    Devon Down you're going... down you're going... Member

    Joined:
    Aug 26, 2013
    Messages:
    1,372
    Location:
    your mom
    The reason Sonic's sprite rotates when charging up the peelout on a slope, is because Sonic CD actually sets the animation ID to the walking/running animation, and then just increments Sonic's ground velocity, but also has it so that the ground speed does not get calculated into the X and Y velocities, so that he doesn't move. This is also how the animation for charging the peelout is handled. Same thing for the spindash.
     
    ProjectFM, Samey, Painto and 2 others like this.