So, you want to start hacking Sonic?

Discussion in 'Engineering & Reverse Engineering' started by Jayextee, May 28, 2008.

  1. Jayextee

    Jayextee

    Comic Mischief Member
    3,218
    0
    0
    Kathmandu, Nepal
    I DONE MAKED GAMES.
    In this post, I attempt to reach out to the newcomers who don't know where to begin. (Mods, if this is out of line I'll gladly see this post trashed and my wrists slapped. No worries.)

    So you love Sonic the Hedgehog and always wanted to make your own, but Sega won't return your calls? This is the place. Or rather, that is the place that this is the message board to. Before you ask any questions, you should read this.


    BEFORE YOU START

    The wiki here contains many guides to Sonic hacking, and is the definitive source of information for doing so. However, you can't charge in without knowing a few things. First, the difference between hex and a split disassembly.

    Hex hacking was the first method by which a Sonic ROM was hacked. What this entails is opening up the binary ROM in a Hex Editor to see the various bytes that make up the ROM image. There needs to be some understanding as to what exactly these bytes are before you start changing them, otherwise it's a chaotic process and you won't get a lot done, and everything essentially needs to be the same size, in the same locations as when you started.

    A split disassembly is the binary ROM image split into various files, the code and the data. This is the more modern, arguably more powerful way to hack a ROM. Files can be edited separately and put back together.

    Of course, you can hack a ROM without either of these two methods, by using utilities designed for hacking the ROM directly (Sort of automating the hex-hacking process), but this is more than a little bit limiting; you'll be able to change palettes, object positions and level layouts but very little else.

    Secondly, it's worth stating that the most is known about hacking for Sonic the Hedgehog (1), followed very closely by Sonic 2. Anything else has information in various quantities, but if you're totally new you should stick to 1 or 2.

    FIRST, BABY STEPS

    You've decided how you're going to hack your game. You need tools!

    Hacking with a utility
    SonEd (1) is a very easy place to start. You'll need a Sonic 1, 2 or Sonic 3 & Knuckles ROM, and a savestate (Not for Sonic 2) of the level you wish to edit, but you are limited to (As stated above) palettes, layouts and objects. In the case of Sonic 2, you can also edit graphics, pixel by pixel in the editor.
    Esrael Sonic Editor (Or ESE) is a little more powerful. Unlike SonEd, for example, it can edit Sonic 1 special stages.

    There is an important thing to note, though. With one exception, if you have hacked a ROM directly with one utility, another won't be able to 'read' it properly. The exception is that any program can seemingly read a Sonic 1 ROM hacked with SonEd1*, but not the other way around. You have been warned; this is a very limited way to hack. If you really don't want to learn anything technical, though - this is the place to start.

    *; Remember this, for a point I'll make later.

    Hex-hacking
    Hex-hacking is definitely not something I could tell you how to do. To me, it's like looking for a needle in a haystack, and replacing the needle with one of a different colour (That absolutely has got to be the same size and weight) without moving a single other straw of hay. Repeat until you've changed everything you wish.
    If this didn't put you off, Hex Workshop will be a good ally to assist you in figuring out most of the hacking guides here: on the Sonic Community Hacking Guide (The ones that aren't, say, SonEd2 specific). Because I'm dyslexic, all these tables of numbers and values make me dizzy (Occasionally physically sick). If that doesn't bother you in the slightest, you may wish to take a look.

    Incidentally, you may need to hex-hack some things in a split disassembly, depending on how you wish to edit them (For example, it is possible to port some songs from other games into Sonic games).

    Split disassembly hacking
    Okay, first you NEED SonEd2. This is a program designed specifically to work on the files split from the ROM. I'll tell you how to edit Sonic 1 in this way.

    There is a nice guide here by Qjimbo on how to start, but since I am a very simple person, I can tell you in simple language. Disassemblies are found on this page, and any of the ones by Hivebrain will be good to go for; they should include two important things you'll need;
    split.bat -- a batch file which can be double-clicked to split your Sonic 1 ROM (Which must be renamed s1.bin) into the various chunks.
    build.bat -- this can be double-clicked to put it all together again.

    It has to be noted that SonEd2 initially doesn't handle Green Hill Zone very well. A workaround with this is to simply edit your Green Hill Zone layouts in SonEd1 first before splitting. However, to fix it properly something else has to be done. I'll detail this later.

    Before you go any further I recommend you play around a little with the tools you've been given. This is not the time to work on your superüberleet hack, but to experiment and make some things work. Try a new layout or two, go on. Make the hardest (Or easiest) level you can. Or, draw some basic level tiles in SonEd2's tile editor. Knock yourself out. Just make sure you read every possible thing that comes with the programs, or even the Sonic Retro wiki before you post here, and you're more likely to get a good answer as to your problem.

    In part two, I help out people who want to make sweet music, fix Green Hill Zone with absolutely no technical know-how, and start on their brave journey into ASM.
     
  2. Dark Sonic

    Dark Sonic

    I'll find the old avatar eventually Member
    11,962
    1
    18
    Working on my art!
    Talk about properly changing the Sonic 1 sprites to those of Sonic 2. That might help me out.
     
  3. Spanner

    Spanner

    The Tool Member
    3,209
    0
    16
    United Kingdom
    Sonic Hacking Contest
    Don't click here then, just don't.
    Nice work on this guide by the way, looking forward to part 2.
     
  4. redhotsonic

    redhotsonic

    Also known as RHS Tech Member
    1,584
    0
    0
    United Kingdom
    YouTuber
    Yay, I can start hacking Sonic games!

    Good guide for newbies.
     
  5. Shoemanbundy

    Shoemanbundy

    Researcher Researcher
    1,016
    0
    0
    Chicago, Illinois
    selling shoes
    Glad to see someone finally doing something like this. I look forward to when/if you get to the art import feature, among other things :)
     
  6. Tweaker

    Tweaker

    Misfits
    12,389
    0
    0
    Interesting. Hoping you'll consider slamming this on the Wiki when all is said and done.
     
  7. Scarred Sun

    Scarred Sun

    Wut Administrator
    7,511
    7
    76
    San Francisco, CA
    Welp, this.
    I approve with full force~
     
  8. Shoemanbundy

    Shoemanbundy

    Researcher Researcher
    1,016
    0
    0
    Chicago, Illinois
    selling shoes
    Is there gonna be a sequel to this? Besides art, which got a pretty good guide, there are still some things that confuse major noobies( I.e me), like getting GHZ to display like you said you'd do in the next part. I swear I try everything and it still shows up wrong. So this is pretty much to just state, we want more :P
     
  9. Elratauru

    Elratauru

    Oooh Shiny stuff! don't touch it >:( Member
    960
    0
    0
    Montevideo, Uruguay
    Web Developer
    Well, nice guide for newbies ^^... By the way, I'll be waiting for a part about "art replacement" =P
     
  10. Typhlosion0221

    Typhlosion0221

    Pending Approvals
    21
    0
    0
    This sounds really helpful, I am looking forward to the completed guide!
     
  11. filmzombie

    filmzombie

    The real spindash... Member
    155
    0
    0
    England- The Land of Tea
    Sonic Synthesis
    This seems like an excellent guide. I'm willing to give it a go. However, I feel no shame in saying the baby steps still seem oddly scary.

    I have just downloaded the latest SonicED. However, very suprisingly my current problem seems not to be with SonicED itself. Its obtaining a save state for the original Sonic 1 I am remarkably struggling with.

    I have downloaded various hacks on this site now and Kega plays them perfectly well. However, when it comes to downloading a basic Sonic 1 or 2 original game it doesn't even load. A tad ironic. I've tried finding or adding seperate BIOS and I've downloaded different versions but it still remains a blank screen. Still working on it. Shouldn't take too long to fix.


    Being a newbie I just have a question for the more skillful hackers before I start.

    How long did it take you guys to come to grips with getting the basics? Hearing snippets from your earlier stories when you were all still in nappies might prove comforting.
     
  12. Phos

    Phos

    Going for the high score on whatever that little b Member
    3,318
    0
    0
    I've had similar problems with ROM's I've downloaded. I think what happens is the ROM site owner doesn't want to post any ESA protected ROMs, so they act like they have the ROM available for download (they have the page for it and such), but the file is bunk. I downloaded an "F-Zero" (fingerquotes) ROM that didn't work, and ZSNES behaved as though I hadn't loaded anything.
     
  13. Bareirito

    Bareirito

    Member Member
    102
    0
    0
    Argentina
    Sonic - Mystery of the Chaos Emeralds
    Excellent guide. I think is very useful for newbies as me. =P But well, when is coming part two?
     
  14. Watkins

    Watkins

    Member Member
    45
    0
    0
    Very nice, I'm a newb at hacking and I found this very useful when I found it awhile ago.

    Granted, I have nothing worth showing here yet, but this certainly helped me with my first few steps into the hacking world and someday you might even see a pretty decent hack from me. ;P
     
  15. MooMoo

    MooMoo

    Leader Bean Member
    I don't suppose theres a Mac version of those user-friendly programs? :v:
     
  16. Overlord

    Overlord

    ...did we just switch realities? Moderator
    Unless specifically said, no. Your best bet is to use something like Parallels.
     
  17. Graxer

    Graxer

    Member Member
    Sorry for the noob question, but is it possible to split and fully edit a hack that has already been edited in SonED1? I have made a layout hack of EHZ1 and am interested to know whether I can.

    I have decided that my hack shouldn't have it's own thread, (At the moment at least) as projects that never got anywhere clutter the forums. In a way it is just me experimenting with SonED1 anyway. If anyone wants to check it out, here is my first attempt at editing S2. Its a SonED1 EHZ1 layout hack, with ChaoSaX used to edit palettes.

    <a href="http://www.mediafire.com/?m4nog2jjffm" target="_blank">Sonic 2 EHZ1 Layout Hack</a>

    I am aware the waterfall in the background scrolls in a wierd way; I haven't changed any code yet. I'd be interested to know what people think though.
     
  18. Mikel

    Mikel

    Member Member
    495
    0
    16
    Oklahoma
    MUGEN Stuff
    <!--quoteo(post=317033:date=Jun 8 2009, 12:15 PM:name=Graxer)--><div class='quotetop'>QUOTE (Graxer @ Jun 8 2009, 12:15 PM) <a href="index.php?act=findpost&pid=317033"><img src="public/style_images/retro/snapback.png"></a></div><div class='quotemain'><!--quotec-->Sorry for the noob question, but is it possible to split and fully edit a hack that has already been edited in SonED1? I have made a layout hack of EHZ1 and am interested to know whether I can.

    I have decided that my hack shouldn't have it's own thread, (At the moment at least) as projects that never got anywhere clutter the forums. In a way it is just me experimenting with SonED1 anyway. If anyone wants to check it out, here is my first attempt at editing S2. Its a SonED1 EHZ1 layout hack, with ChaoSaX used to edit palettes.

    <a href="http://www.mediafire.com/?m4nog2jjffm" target="_blank">Sonic 2 EHZ1 Layout Hack</a>

    I am aware the waterfall in the background scrolls in a wierd way; I haven't changed any code yet. I'd be interested to know what people think though.<!--QuoteEnd--></div><!--QuoteEEnd-->
    Well, not really, because if you split a rom that has been already edited in SonED1 (I know that you only edited EHZ Act 1), you would end up with the original EHZ Act 1 layout and Start Position, if you want the layout of EHZ Act 1 you edited with SonED1, this screenshot will tell you what to click:

    <img src="http://mikel93.sepwich.com/images/ImagesforGuides/SonED1.png" border="0" class="linked-image" />

    And after you click Level Layout in the "Write Data->File" Menu, you will find a file named "S2lev.dat" (Without the Apostrophes), if the level you save that file as is EHZ1, you will need to rename it to "EHZ_1.bin" (Again, without the Apostrophes), and place it in the layout folder that is inside your level folder in your Sonic 2 Disassembly (It only works after you split S2.bin).

    Then, you will have to edit the Start Locations in the ASM File, to do that, open up s2.asm and search for "WrdArr_StartLoc:" (Yet again, without the Apostrophes), and when you are at that label, change the following line:

    <!--g1--><div class='geshitop'>Syntax Highlighted Code: ASM</div><div class='codemain'><!--eg1--><pre class="asm" style="font-family:monospace;"> <span style="color: #00bfff;">dc</span>.<span style="color: #00bfff;">w</span> <span style="color: #ff0000;">$</span><span style="color: #ff0000;">60</span>, <span style="color: #ff0000;">$</span><span style="color: #ff0000;">28F</span> <span style="color: #adadad; font-style: italic;">; $00</span></pre><!--gc2--><!--CWRjLncJJiMwMzY7NjAsCSYjMDM2OzI4Rgk7ICYjMDM2OzAw--><!--egc2--><!--g2--></div><!--eg2-->
    To:

    <!--g1--><div class='geshitop'>Syntax Highlighted Code: ASM</div><div class='codemain'><!--eg1--><pre class="asm" style="font-family:monospace;"> <span style="color: #00bfff;">dc</span>.<span style="color: #00bfff;">w</span> <span style="color: #ff0000;">$</span><span style="color: #ff0000;">1B</span>, <span style="color: #ff0000;">$</span><span style="color: #ff0000;">41</span> <span style="color: #adadad; font-style: italic;">; $00 ; EHZ1</span></pre><!--gc2--><!--CWRjLncJJiMwMzY7MUIsCSYjMDM2OzQxCTsgJiMwMzY7MDAgOyBFSFox--><!--egc2--><!--g2--></div><!--eg2-->
    That will be your start location (I used SonED2 to check where you put the start location, and I had to include the "; EHZ1" in that line because that will tell you what Zone and Act it is).

    And for the EHZ Background in your hack, do you want it to scroll, or not?

    Well, I hope you can understand, and I hope to see updates to your hack in the near future.
     
  19. Graxer

    Graxer

    Member Member
    Thanks for the help! I will try the ASM alterations at some point later.

    I don't think I want the background to scroll, no. What would I do to fix that?

    Thanks again for your help! :)
     
  20. Alriightyman

    Alriightyman

    !!!!!!!!!!!!!!!!&#33 Tech Member
    351
    0
    0
    Largo, Fl
    0101001101101111011011100110100101100011 00000010: 0101001100000011 01000101011001000110100101110100011010010110111101101110
    You could also rip the level data out of the rom via hex editor. Iirc all the level data is moved to the end of the rom.