[Sonic 1] Basic Tutorial on Extra Characters in S1

Discussion in 'Tutorials Archive' started by PsychoSk8r, Aug 12, 2007.

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

    PsychoSk8r HighKnights Member

    Joined:
    Aug 9, 2007
    Messages:
    271
    Location:
    Birmingham, UK
    Okay, everything below this was written by Vitesse, and is directly copied/pasted from the old forum (i have a back-up of the page). So basically, give all credit to Vitesse if you use this:


    Multiple characters is a fad in hacks nowadays, but not everyone knows how to add multiple characters to their hacks. That's what this tutorial is here for. This tutorial assumes you have basic knowledge of how to use a split disassembly, and is assuming you are using Hivebrain's 2005 disassembly. It is also assuming that your art fits with Sonic's mappings.


    First of all, extract the art that you want from the ROM. You could do this by splitting it, or going into a hex editor and extracting the portion you want into a seperate file. Either way, once you have your file, put it into the 'artunc' folder of your split disassembly. My file is named 'msonic.bin', but yours could be named anything; just replace all instances of 'msonic.bin' that I say with your file's name.


    The first step is to search for 'Art_Sonic:' in your disassembly. The result of the search should look something like this:



    ; ---------------------------------------------------------------------------
    ; Uncompressed graphics - Sonic


    ; ---------------------------------------------------------------------------


    Art_Sonic: incbin artunc\sonic.bin; Sonic


    even



    Now, copy that data and paste it below. Then change Art_Sonic to another label, and replace the sonic.bin with your filename. My result was this:



    ; ---------------------------------------------------------------------------
    ; Uncompressed graphics - Metal Sonic


    ; ---------------------------------------------------------------------------


    Art_MetalSonic: incbin artunc\msonic.bin; Metal Sonic


    even



    Next, you have to decide how you want to have your character be chosen. I chose to make the character Metal Sonic if B was pressed at the title screen. For the purposes of this tutorial, I will assume you want to do it that way too. So search for 'loc_3230:'. You should find something like this:



    loc_3230:
    tst.w ($FFFFF614).w


    beq.w Demo


    andi.b #$80,($FFFFF605).w; check if Start is pressed


    beq.w loc_317C; if not, branch



    After the beq.w Demo, put this in:



    Title_CheckForB:
    cmpi.b #$10, ($FFFFF605) ; has B been pressed?


    bne.s StartCheck ; if not, branch


    Title_SecondCharacter:


    move.b #$01, ($FFFFFFFE) ; set the multiple character flag to $01 (indicating Metal Sonic)


    move.b #$B5,d0 ; put value of ring sound into d0


    bsr.w PlaySound_Special ; jump to the subroutine that plays the sound currently in d0 ($B5, at the moment)


    StartCheck:



    This checks if B is pressed, and sets a flag at $FFFFFFFE if it is. It also plays the ring sound (which is $B5 in the sound test). You can change the sound it plays by changing $B5 to the sound test value of whatever sound you want to play.


    Now, go to the LoadSonicDynPLC subroutine, and find this instruction:



    lea (Art_Sonic).l,a1



    Replace it With:



    cmpi.b #$01, ($FFFFFFFE) ; is the multiple character flag set to $01 (Metal Sonic)?
    bne.s SonicArtLoad ; if not, load Sonic's art


    lea (Art_MetalSonic).l,a1 ; load Metal Sonic's art


    bra.s ContLoadPLC ; branch to rest of code


    SonicArtLoad:


    lea (Art_Sonic).l, a1 ; load Sonic's art


    ContLoadPLC:



    This code tests if the multiple character flag (which we set to $01 if you pressed B at the title screen) is set to $01. If it isn't, it just loads Sonic's art like normal and continues to the ContLoadPLC subroutine. If it is, it loads Metal Sonic's art and jumps directly to the ContLoadPLC subroutine (so that we don't load Sonic's art at all).


    And...that's all. Compile the code, and if you run into any errors you either chose a subroutine name that was already taken or did something else wrong. Have fun putting new characters in your hacks!


    ==================


    There you Go. Hope it's helpful, Cheers Vitesse =P
     
    Last edited by a moderator: Feb 6, 2009
  2. Selbi

    Selbi The Euphonic Mess Member

    Joined:
    Jul 20, 2008
    Messages:
    2,429
    Location:
    Northern Germany
    The Code Boxes should replaced with a ASM-Box! (just a tip)
     
  3. Rydia3667

    Rydia3667 Guest

    Sorry, but this guide fails. It causes too many illegal instructions
     
  4. Selbi

    Selbi The Euphonic Mess Member

    Joined:
    Jul 20, 2008
    Messages:
    2,429
    Location:
    Northern Germany
    Uh no? It's working 100% perfectly after doing it. The only possible thing is this:



    ; ---------------------------------------------------------------------------
    ; Uncompressed graphics - Metal Sonic


    ; ---------------------------------------------------------------------------


    Art_MetalSonic: incbin artunc\msonic.bin; Metal Sonic


    even



    Since there are many illegal instructions, you probably didn't renamed Art_Sonic to Art_MetalSonic.
     
  5. iojnekns

    iojnekns OBAMA '012!!!!1!!!!!&#33 Member

    Joined:
    Mar 27, 2009
    Messages:
    258
    Gift. Horse. Mouth.


    First of all, the whole idea between these 'guides' is not to spoonfeed you mouthfuls of code which you can simply copy and paste and then strut about with as though you actually did anything at all. It is, or at least in theory, supposed to allow a member to follow the logic behind each of the steps and come to an understanding about what the changes do, and how the OP (or in this case - Vitesse) came to a finished product. Its hugely unfortunate that people abuse the kindness of these intelligent and generous people by doing what you've just done and ripping it out without even attempting to understand it.


    The upshot is, you won't learn a thing via this practice and so you're only shooting yourself in the foot when you decide to do something that isn't on the beaten trail of sonic hacking and you don't even know where to begin (although I'm sure you'll soon rectify that by making brash, in-your-face topics demanding help, or (as I've seen you doing recently) demanding help on the IRC channel and becoming indignant that no-one is prepared to write your code for you.


    On top of all that, you're now saying that the guide "fails"?!?!? No "thank you ever so much for documenting something which you struggled with, but eventually succeeded with, then had the good grace to try and help people, lest they fall into the same hurdles you did," no "thanks, but I ran into a problem" no fucking "thanks" at all! This. Guide. Fails. Unbelievable. If the guide fails so much, you write a better one. No, didn't think so.


    I'm going to have to insist that you apologise.


    What a fine way to encourage other people to try and help you!


    Utterly gobsmacked.
     
  6. Rydia3667

    Rydia3667 Guest

    Sorry for that, Im just sayingthe code didn't work for me. Either it loaded a garbled up sonic or no sonic at all. Freezes when I try to move.
     
  7. iojnekns

    iojnekns OBAMA '012!!!!1!!!!!&#33 Member

    Joined:
    Mar 27, 2009
    Messages:
    258
    Your original post implied that the code did not compile at all. Now, it seems as though the code is compiling, but crashes when the new character is loaded. Do you have any inklings or theories as to why this might be the case?
     
  8. Rydia3667

    Rydia3667 Guest

    I tried to add tails not metal sonic
     
  9. iojnekns

    iojnekns OBAMA '012!!!!1!!!!!&#33 Member

    Joined:
    Mar 27, 2009
    Messages:
    258
    The only difference between tails and metal sonic in this capacity is the art. Do you really believe that is why the tutorial didn't work for you?
     
  10. Selbi

    Selbi The Euphonic Mess Member

    Joined:
    Jul 20, 2008
    Messages:
    2,429
    Location:
    Northern Germany
    This guide tells you how to add the function to select the character. You have to do the whole art by yourself.
     
  11. Rydia3667

    Rydia3667 Guest

    I had the art done
     
Thread Status:
Not open for further replies.