don't click here

In before 2007

Discussion in 'Engineering & Reverse Engineering' started by Stealth, Dec 31, 2006.

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

    Stealth

    Tech Member
    594
    30
    28
    Sonic Mania, HCGE, Sonic Megamix, SonED2, [...]
    What a pain. You're all very lucky right now :P

    This has been my on-again, off-again (and mostly off-again) project this year after the long start I got on it last. I had invisioned this having some accompaniment, but circumstances forbid. I actually thought I was having trouble with this at the beginning of the year and "privately" asked for some help that didn't come along until too late, which is where all of the new Sonic 3 knowledge that's been showing up this year came from :P

    Anyway, here it is, the world's first functioning Sonic and Knuckles disassembly:
    http://www.s2beta.com/!trash/stealth/skdisasm.rar

    In the rar is an IDB database of the main Sonic and Knuckles ROM (no "upmem"), which has been disassembled, analyzed, and corrected to the point where I can't find any errors during gameplay from start to finish, even with Sonic 3 "locked-on" (Considering certain changes in the coding style between Sonic 2 and Sonic 3, as well as IDA's inherent inability to handle some of it, I see this as a pretty hefty accomplishment). No scripts were used in the process, as I wanted to make absolutely sure I covered everything myself. Alot of routines and data are identified or at least categorized, and all data areas are formatted as seemed appropriate. There's also an extra segment added to the end to accommodate for Sonic 3 address space, which allows the use of labels in reference to data that only exists in Sonic 3. The space is filled with ds.b directives, so when using the output ASM as-is, all the labels will always point to the proper relative position in Sonic 3 (affixing an existing Sonic 3 ROM to the end of the built Sonic and Knuckles ROM will produce a working Sonic 3 and Knuckles*). The package also has some of the notes I took down for myself all throughout the time I spent working on the disassembly

    Here is a ROM built from the above disassembly, with the code and data shifted from their original position (*with the exception of the sound drivers and data for BOTH Sonic and Knuckles and Sonic 3 aligned to their original positions). A clean Sonic 3 ROM is attached directly to the new end of the Sonic and Knuckles ROM. The only problem you should see during playback is the torn "Sonic/Miles" background on the level select, which I just didn't bother to align:
    http://www.s2beta.com/!trash/stealth/s3kshift.rar

    Note that Sonic 3 (and Knuckles) is NOT ideal for "hacking", as there's alot of specialty code for most of the levels and events, and beginners will probably have a harder time picking up on the way things work in Sonic 3 than the way they work in Sonic 1 and 2. Sonic 3 is best used as a reference or for interest's sake. Also, for developing certain Sonic3-esque features for other games, remember that some of them are easier than they look, and try to use Sonic 3 only as a last resort (Read: I don't want this disassembly to breed laziness :P). In some cases, it will end up easier than trying to "port" it anyway :P

    That said, I hope you all enjoy it thoroughly, especially after the effort I put into it. Hopefully it will entertain and inspire throughout the new year
     
  2. Tweaker

    Tweaker

    Banned
    12,387
    2
    0
    Cool shit! Hopefully this can help the lot of us understand Sonic 3/Sonic & Knuckles better (hell, they were about the same anyway, right? :P), and perhaps give some inspiration and whatnot to aspiring hackers to learn some better ASM techniques, since I hear the programming was brilliant in this little clique of the Sonic series. Hell, KosinskiM's no joke... XD

    And yeah, I hope this doesn't turn into a leechfest either. Everybody seems to think porting stuff is cool these days. How curious... =P
     
  3. Ultima

    Ultima

    Games Publisher Tech Member
    2,398
    1
    18
    London, England
    Publishing mobile games!
    Porting stuff can be cool if done right.

    Anyway, yet again stealth makes an awesome achievement, and just in time for the end of the year.

    Congrats ;P
     
  4. drx

    drx

    mfw Researcher
    2,254
    350
    63
    :rolleyes:
    Great job. :P

    edit: stupid emoticons
     
  5. Upthorn

    Upthorn

    TAS Tech Member
    239
    0
    0
    Awesome. Now I can (in theory) get to work on the project I tabled because I didn't have an S&K disasm.

    (getting a character swap monitor, and making the debug monitor conditional)
     
  6. Miles Prower

    Miles Prower

    Renard Oldbie
    698
    0
    16
    Neat!
     
  7. ddrmaxromance

    ddrmaxromance

    Member
    477
    0
    0
    Happy new year to you too. :( This should bring in more S3 / K hacks finally.
     
  8. Tweaker

    Tweaker

    Banned
    12,387
    2
    0
    Not really... I think what a few of you failed to notice is that this is just the IDB database - you're not gonna be doing much direct hacking unless you decide to make a split disassembly of it yourself, which, even if you're capable of doing so, isn't exactly a fun task.
     
  9. drx

    drx

    mfw Researcher
    2,254
    350
    63
    :rolleyes:
    I think you just don't know that it's possible to export & assemble it without splitting it to separate files.
     
  10. Tweaker

    Tweaker

    Banned
    12,387
    2
    0
    I know it IS, but the last time I exported this disassembly to an asm file it was too big to open. :P
     
  11. drx

    drx

    mfw Researcher
    2,254
    350
    63
    :rolleyes:
    There are better text editors than notepad.exe =P
     
  12. Puto

    Puto

    Shin'ichi Kudō, detective. Tech Member
    2,013
    0
    16
    Portugal, Oeiras
    Part of Team Megamix, but haven't done any actual work in ages.
    Notepad2 ftw.
     
  13. Hayate

    Hayate

    Tech Member
    Speaking of which, could somebody upload an ASM version of it?
     
  14. jman2050

    jman2050

    Teh Sonik Haker Tech Member
    634
    4
    18
    Excellent work, as usual. Having looked at the disassembly extensively, there's a LOT of interesting crap in there that hackers can learn from when making their own objects. Because of the differences in coding styles, it isn't ideal for porting, but trust me when I say that looking at S3 objects and methods will be no less than inspiring.

    However, there are a few things I do believe deserve the port treatment. S3K's superior drawing method is one of them, as well as its vastly superior level format. I also like the style that's used for level events and layer deformation and the like, so emulating that (not porting it, since it's level specific) would be pretty nice as well.

    But yeah, don't take stuff like the porting of the shields (which I didn't even do completely. Stealth was the first to truly port it to the full) and the porting ofgravity as something you can do willy-nilly. If (key word, IF) you decide to port select things from this disassembly, be ready to put some elbow-grease into it. As Stealth said, it's likely better to just write it from scratch.
     
  15. Puto

    Puto

    Shin'ichi Kudō, detective. Tech Member
    2,013
    0
    16
    Portugal, Oeiras
    Part of Team Megamix, but haven't done any actual work in ages.
    http://pu7o.planetaclix.pt/sandk.asm.gz <- use WinRAR to decompress it or something.
     
  16. stormislandgal

    stormislandgal

    It's not a phase! Tech Member
    4,534
    10
    18
    Married life <3
    Yes, yes, yes! *killed*

    So, most of the errors from the last edition have been fixed? I just might look into this. =P
     
  17. Sith

    Sith

    The molotov bitch Member
    Finally. :D You rule!

    No more excuses not to make S3 hacks people... unless Tweaker's arguments prove it to be too difficult.
     
  18. Tweaker

    Tweaker

    Banned
    12,387
    2
    0
    You'd have to be a fucking idiot to use notepad to edit ASM. I use Crimson Editor.
     
  19. Stealth

    Stealth

    Tech Member
    594
    30
    28
    Sonic Mania, HCGE, Sonic Megamix, SonED2, [...]
    Which I also use, and it's lag hell just because of how humungous it is :P

    I already said so myself, it would be very difficult and tedious to make a significant hack of Sonic 3 (and Knuckles)
     
  20. stormislandgal

    stormislandgal

    It's not a phase! Tech Member
    4,534
    10
    18
    Married life <3
    Just use EditPlus. bobxp linked to it somewhere around here.

    Uh oh, serious error here... dunno wtf happened.

    Code (Text):
    1.                 dc.w LoadWaterPalette-Map_187888
    2. sk_asm.asm(264285) : Error 03008 : Cannot fit value 0xffe800e4 (-1572636) into w
    3. ord
    4.                 dc.w Pal_7A4A+4-Map_187888
    5. sk_asm.asm(264299) : Error 03008 : Cannot fit value 0xffe801c6 (-1572410) into w
    6. ord
    7.                 dc.w Pal_7A4A+$1E-Map_187888
    8. sk_asm.asm(264300) : Error 03008 : Cannot fit value 0xffe801e0 (-1572384) into w
    9. ord
    10.                 dc.w loc_8E94+2-Map_188E7C
    11. sk_asm.asm(264617) : Error 03008 : Cannot fit value 0xffe8001a (-1572838) into w
    12. ord
    13.                 dc.w loc_8EA4+2-Map_188E7C
    14. sk_asm.asm(264619) : Error 03008 : Cannot fit value 0xffe8002a (-1572822) into w
    15. ord
    16.                 dc.w loc_8ECA+4-Map_188E7C
    17. sk_asm.asm(264621) : Error 03008 : Cannot fit value 0xffe80052 (-1572782) into w
    18. ord
    19.                 dc.w loc_8EDE-Map_188E7C
    20. sk_asm.asm(264623) : Error 03008 : Cannot fit value 0xffe80062 (-1572766) into w
    21. ord
    22.  
    23. 2719 errors encountered processing file 'sk_asm.asm'
    24. 252119 source statements in 296871 lines processed in 1.7 seconds
    25.  
    26. C:\PROGRA~1\NIGHTM~1\SONICA~1>
    I just exported from IDA 4.8 to an ASM file and used "snasm68k.exe -emax 0 -p -o ae- sk_asm.asm,skbuilt.bin" in the build.bat file. I also took out the ds.b opcodes, cutting down I think 5 errors, if memory serves. What the hell happened here?

    Also, what's in the codebox right there is all that I could see, for errors at least. I wanted to try to split-disassemble this, as my ammount of free time would allow it. =P
     
Thread Status:
Not open for further replies.