don't click here

So, you want to start hacking Sonic?

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

  1. Jayextee

    Jayextee

    Unpopular Opinions™ Member
    3,250
    42
    28
    Atro City
    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

    Member
    14,631
    1,610
    93
    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
    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,587
    10
    18
    United Kingdom
    YouTuber
    Yay, I can start hacking Sonic games!

    Good guide for newbies.
     
  5. Shoemanbundy

    Shoemanbundy

    Researcher
    1,094
    30
    28
    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

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

    Scarred Sun

    Be who you needed when you were younger Administrator
    7,745
    127
    101
    Tower 8 ️
    Welp, this.
    I approve with full force~
     
  8. Shoemanbundy

    Shoemanbundy

    Researcher
    1,094
    30
    28
    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

    Little Shiny Emurralds Member
    Well, nice guide for newbies ^^... By the way, I'll be waiting for a part about "art replacement" =P
     
  10. 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
    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
    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

    Now playable in Smash Bros Ultimate Moderator
    19,214
    956
    93
    Long-term happiness
    Unless specifically said, no. Your best bet is to use something like Parallels.
     
  17. Graxer

    Graxer

    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.

    Sonic 2 EHZ1 Layout Hack

    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
    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]

    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:

    Code (ASM):
    1.     dc.w    $60,    $28F    ; $00
    To:

    Code (ASM):
    1.     dc.w    $1B,    $41 ; $00 ; EHZ1
    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
    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

    I am back... from the dead! Tech Member
    357
    11
    18
    Somewhere in hot, death Florida
    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.