New S3K disassembly

Discussion in 'Engineering & Reverse Engineering' started by Hayate, Nov 19, 2010.

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

    Hayate

    Tech Member
    <a href="http://var.projectnanako.com/junk/scc.zip" target="_blank">http://var.projectnanako.com/junk/scc.zip</a>

    This is essentially Puto's IDA export, ran through a Python script I wrote to:
    - convert all IDA's CP437 characters to 7-bit ASCII
    - remove all IDA's useless and ugly comments (e.g. placing characters after every byte constant, putting cross-references everywhere) and format the code nicely
    - extract all blocks of data that are 256 bytes or more into .bin files

    In addition, I wrote a second script to extract all the data from S3 as according to Nemesis' address listing, and this data is now incbin'd with automatically generated labels (admittedly not very good labels, but I wasn't going to sit there and name all 924 of them manually).

    And it comes with ASM68K and a build script. It should generate a byte-for-byte identical ROM.
    I was going to make it use AS, but AS kept complaining at me - when it decided not to compile legitimate lea(pc,dn) instructions I gave up with that.

    I hope this is useful to anyone starting a new S3K hack.

    If anyone wants the Python scripts I'll post them on request.
     
  2. Selbi

    Selbi

    The Euphonic Mess Member
    1,485
    10
    18
    Northern Germany
    Sonic ERaZor
    <!--quoteo(post=531602:date=Nov 19 2010, 02:16 PM:name=Hayate)--><div class='quotetop'>QUOTE (Hayate @ Nov 19 2010, 02:16 PM) <a href="index.php?act=findpost&pid=531602">[​IMG]</a></div><div class='quotemain'><!--quotec-->If anyone wants the Python scripts I'll post them on request.<!--QuoteEnd--></div><!--QuoteEEnd-->
    I do. I'd like to know how you removed IDA comment bullcrap, since my try some time ago was doing anything but that.

    There's one thing I either haven't noticed before or your script made something... not so nice:
    <!--g1--><div class='geshitop'>Syntax Highlighted Code: ASM</div><div class='codemain'><!--eg1--><pre class="asm" style="font-family:monospace;"> <span style="color: #00bfff;">rts</span>
    Obj_Lightning_Shield:
    <span style="color: #00bfff;">move</span>.<span style="color: #00bfff;">l</span> <span style="color: #ff0000;">#</span>ArtUnc_LighteningShield_Sparks,<span style="font-weight:bold;">d1</span></pre><!--gc2--><!--CQlydHMKT2JqX0xpZ2h0bmluZ19TaGllbGQ6CgkJbW92ZS5sCSNBcnRVbmNfTGlnaHRlbmluZ1NoaWVs
    ZF9TcGFya3MsZDE=--><!--egc2--><!--g2--></div><!--eg2-->
    I remember before each label to have an empty line. Not that this is anything big, it just makes it look more organized. Unless you made it on purpose of course (because it saved about 60KB, at least from what I calculated).

    Anyway, great job. I might take a deeper look into it now. Also, can this be on the Wiki?
     
  3. Hayate

    Hayate

    Tech Member
    My apologies, it was intended to have the blank lines before labels. I've corrected the script and re-uploaded the disasm.

    The script removes all comments that don't start at the start of the line. As far as I know the only useful comments from the original export were at the beginning of the line which is why I coded it this way.

    Here are the scripts, note they're not well commented but they do the job:

    <a href="http://var.projectnanako.com/junk/fixc.py.txt" target="_blank">http://var.projectnanako.com/junk/fixc.py.txt</a>
    <a href="http://var.projectnanako.com/junk/nemext.py.txt" target="_blank">http://var.projectnanako.com/junk/nemext.py.txt</a>

    And here's the input for nemext.py that I used:

    <a href="http://var.projectnanako.com/junk/Nem_s3.txt" target="_blank">http://var.projectnanako.com/junk/Nem_s3.txt</a>

    This was obtained by downloading the HTML source of the <a href="http://info.sonicretro.org/SCHG:Nem s3/Address listing" target="_blank" style="background: url(http://info.sonicretro.org/images/5/50/Reticon.png) right no-repeat; padding-right: 20px; border-bottom: 1px dotted #3366BB; color: #3366BB; cursor:pointer; text-decoration:none;" class="wiki">SCHG:Nem s3/Address listing</a> page and doing a bunch of regexp replace alls... and swapping a few lines around because they weren't in order in the original (!).

    And yeah, it can go on the wiki.
     
  4. Varion Icaria

    Varion Icaria

    He's waiting.... Tech Member
    1,014
    3
    18
    S4: Cybernetic Outbreak
    Very nice. a Good alternative till my full S3K Disassembly comes out. Great job!
     
  5. MarkeyJester

    MarkeyJester

    A D V A N C E Resident Jester
    2,083
    215
    43
    Japan
    <!--quoteo(post=531642:date=Nov 19 2010, 04:53 PM:name=Varion Icaria)--><div class='quotetop'>QUOTE (Varion Icaria @ Nov 19 2010, 04:53 PM) <a href="index.php?act=findpost&pid=531642">[​IMG]</a></div><div class='quotemain'><!--quotec-->...a Good alternative till my full S3K Disassembly comes out...<!--QuoteEnd--></div><!--QuoteEEnd-->
    Well gee, talk about rub it in =P <span style='color:#000000;background:#000000'>Nah you know I'm joking, I'm sure we'll all be looking forward to your release also...</span>

    Nice work Hayate, it's about time we have at least one build-able public disassembly of this masterpiece of a game! =)

    My only concern with having source code to a far out advanced and fully functional game such as this, is that people will typically want the best of the best, and hence it's most likely that this game will be selected above all other known games, or selected code will be passed down to older source platforms (S1/2, etc) rather than, programming it from bottom upwards. I find that there's just no joy in playing a hack knowing that none of the code is unique or genuinely done from start (as of recent) by the directors of said hacks... It's like, where's the genius? Where's the pride? =(
     
  6. Varion Icaria

    Varion Icaria

    He's waiting.... Tech Member
    1,014
    3
    18
    S4: Cybernetic Outbreak
    :P. I do agree with you Markey, There is no joy in coding just reusing or porting code most of the time. The fun is when you create something unique to what you need to structure your game.
     
  7. Hayate

    Hayate

    Tech Member
    <!--quoteo(post=531655:date=Nov 19 2010, 05:52 PM:name=MarkeyJester)--><div class='quotetop'>QUOTE (MarkeyJester @ Nov 19 2010, 05:52 PM) <a href="index.php?act=findpost&pid=531655">[​IMG]</a></div><div class='quotemain'><!--quotec-->I find that there's just no joy in playing a hack knowing that none of the code is unique or genuinely done from start (as of recent) by the directors of said hacks... It's like, where's the genius? Where's the pride? =(<!--QuoteEnd--></div><!--QuoteEEnd-->

    People have been porting S&K code to S1/S2 for ages already, where have you been? =P
     
  8. MarkeyJester

    MarkeyJester

    A D V A N C E Resident Jester
    2,083
    215
    43
    Japan
    ...on mars, in a cave, with my fingers in my ears, singing la la la for the past decade, but yeah, I've known and it just doesn't impress me if 90% of it is a copy/paste job, no disrespect to your research though, I've heard one or two mention in a private conversation already they're working on something big with this, so I say expect some awesome work to come out of no where sometime in the future... =)
     
  9. Hayate

    Hayate

    Tech Member
    I'd just like to mention that when I fixed Selbi's issue, I'd made a mistake involving not escaping a backslash in fixc.py, which turned into an assembler error.

    This has now been fixed and the files have been re-uploaded. Anyone who downloaded previously and is seeing an error should delete the last (invisible) character on line 5 and replace it with \1.
     
  10. ICEknight

    ICEknight

    Researcher Researcher
    <!--quoteo(post=531655:date=Nov 19 2010, 01:52 PM:name=MarkeyJester)--><div class='quotetop'>QUOTE (MarkeyJester @ Nov 19 2010, 01:52 PM) <a href="index.php?act=findpost&pid=531655">[​IMG]</a></div><div class='quotemain'><!--quotec-->My only concern with having source code to a far out advanced and fully functional game such as this, is that people will typically want the best of the best, and hence it's most likely that this game will be selected above all other known games, or selected code will be passed down to older source platforms (S1/2, etc) rather than, programming it from bottom upwards. I find that there's just no joy in playing a hack knowing that none of the code is unique or genuinely done from start (as of recent) by the directors of said hacks... It's like, where's the genius? Where's the pride? =(<!--QuoteEnd--></div><!--QuoteEEnd-->
    If it's fun to play, all the kudos to them.
     
  11. Dark Sonic

    Dark Sonic

    Member
    13,470
    703
    93
    Working on my art!
    <!--quoteo(post=531711:date=Nov 19 2010, 01:34 PM:name=ICEknight)--><div class='quotetop'>QUOTE (ICEknight @ Nov 19 2010, 01:34 PM) <a href="index.php?act=findpost&pid=531711">[​IMG]</a></div><div class='quotemain'><!--quotec--><!--quoteo(post=531655:date=Nov 19 2010, 01:52 PM:name=MarkeyJester)--><div class='quotetop'>QUOTE (MarkeyJester @ Nov 19 2010, 01:52 PM) <a href="index.php?act=findpost&pid=531655">[​IMG]</a></div><div class='quotemain'><!--quotec-->My only concern with having source code to a far out advanced and fully functional game such as this, is that people will typically want the best of the best, and hence it's most likely that this game will be selected above all other known games, or selected code will be passed down to older source platforms (S1/2, etc) rather than, programming it from bottom upwards. I find that there's just no joy in playing a hack knowing that none of the code is unique or genuinely done from start (as of recent) by the directors of said hacks... It's like, where's the genius? Where's the pride? =(<!--QuoteEnd--></div><!--QuoteEEnd-->
    If it's fun to play, all the kudos to them.
    <!--QuoteEnd--></div><!--QuoteEEnd-->
    Ya I'm going to have to go with this. Ya it may not be a technical masterpiece but the base is more solid, plus there are almost no Sonic 3 hacks out there. If it's fun, it's worth playing
     
  12. Banoon

    Banoon

    yes Member
    577
    0
    16
    Auckland, New Zealand
    Yeth (hack)
    <!--quoteo(post=531655:date=Nov 19 2010, 01:52 PM:name=MarkeyJester)--><div class='quotetop'>QUOTE (MarkeyJester @ Nov 19 2010, 01:52 PM) <a href="index.php?act=findpost&pid=531655">[​IMG]</a></div><div class='quotemain'><!--quotec-->My only concern with having source code to a far out advanced and fully functional game such as this, is that people will typically want the best of the best, and hence it's most likely that this game will be selected above all other known games, or selected code will be passed down to older source platforms (S1/2, etc) rather than, programming it from bottom upwards. I find that there's just no joy in playing a hack knowing that none of the code is unique or genuinely done from start (as of recent) by the directors of said hacks... It's like, where's the genius? Where's the pride? =(<!--QuoteEnd--></div><!--QuoteEEnd-->
    I'm likely in the minority here, but hacks should be more about art, level design, and fun than who can make the fanciest, leetest ASM edits - in my opinion the entire point of a ROM hack is to see how much you can do and how creative you can be with an existing engine and its limitations, so hacking S3K with its much more advanced features is a great idea to me
     
  13. MarkeyJester

    MarkeyJester

    A D V A N C E Resident Jester
    2,083
    215
    43
    Japan
    Well actually... I was referring to previous hacks that go by the exact opposite of your description =P
     
  14. Xenowhirl

    Xenowhirl

    Tech Member
    175
    0
    0
    <!--quoteo(post=531602:date=Nov 19 2010, 08:16 AM:name=Hayate)--><div class='quotetop'>QUOTE (Hayate @ Nov 19 2010, 08:16 AM) <a href="index.php?act=findpost&pid=531602">[​IMG]</a></div><div class='quotemain'><!--quotec-->I was going to make it use AS, but AS kept complaining at me - when it decided not to compile legitimate lea(pc,dn) instructions I gave up with that.<!--QuoteEnd--></div><!--QuoteEEnd-->
    That's because you have to be explicit about jmp and jsr instructions being long. Here's a version of the disassembly that builds in AS:
    <a href="http://www.fileden.com/files/2006/12/3/457443//s3kdasm_AS.zip" target="_blank">http://www.fileden.com/files/2006/12/3/457.../s3kdasm_AS.zip</a>
     
  15. Azu

    Azu

    I must be stupid. Member
    Is it possible to get this working with SonED2?

    Why doesn't quit editor work?

    Anyway, is there a tutorial on port music to Sonic rom? like, if I had a midi and I wanted to port it to .bin.
     
  16. Hayate

    Hayate

    Tech Member
    <!--quoteo(post=531832:date=Nov 20 2010, 04:34 AM:name=Azu)--><div class='quotetop'>QUOTE (Azu @ Nov 20 2010, 04:34 AM) <a href="index.php?act=findpost&pid=531832">[​IMG]</a></div><div class='quotemain'><!--quotec-->Is it possible to get this working with SonED2?<!--QuoteEnd--></div><!--QuoteEEnd-->

    There is a privately released SonED2 version which works with S3&K levels, but I'm not going to leak it, so I'm afraid you'll have to wait for Stealth to decide to release it publicly.

    If and when he does, I'll make seps for all the levels.

    <!--quoteo--><div class='quotetop'>QUOTE </div><div class='quotemain'><!--quotec-->Why doesn't quit editor work?<!--QuoteEnd--></div><!--QuoteEEnd-->

    Are you talking about SonED2 here or something else? Either way I don't know.

    <!--quoteo--><div class='quotetop'>QUOTE </div><div class='quotemain'><!--quotec-->Anyway, is there a tutorial on port music to Sonic rom? like, if I had a midi and I wanted to port it to .bin.<!--QuoteEnd--></div><!--QuoteEEnd-->

    There are plenty of music hacking resources around, I don't know if there's a tutorial, but check the wiki and search the forum. This topic isn't the right place to talk about music hacking.

    ------------------------------

    More importantly, I've noticed that my fixc.py was erroneously moving comment blocks (I.e. separators) down a label, which gets especially confusing. This has now been fixed and I've reuploaded the zip and fixc.py again.
     
  17. Spanner

    Spanner

    The Tool Member
    3,312
    115
    43
    United Kingdom
    Sonic Hacking Contest
    If anyone is willing to spend some time getting things to work, there's always the <a href="http://segaretro.org/Esrael Neto Assembler Editor" target="_blank" style="background: url(http://segaretro.org/segaret_icon.png) right no-repeat; padding-right: 20px; border-bottom: 1px dotted #3366BB; color: #3366BB; cursor:pointer; text-decoration:none;" class="wiki">Esrael Neto Assembler Editor</a>.
     
  18. Chaos Rush

    Chaos Rush

    AKA J.Matz Member
    510
    25
    28
    Does anyone know if you could build an S3&K rom with this, but without 2P Competition mode, would the space be lowered enough to run on jEnesis (the DS one)?
     
  19. Ravenfreak

    Ravenfreak

    Is actually a guy. Tech Member
    2,964
    98
    28
    O'Fallon Mo
    Hacking Sonic Drift, Writer at Sonic Cage Dome
    <!--quoteo(post=531934:date=Nov 20 2010, 11:17 AM:name=Chaos Rush)--><div class='quotetop'>QUOTE (Chaos Rush @ Nov 20 2010, 11:17 AM) <a href="index.php?act=findpost&pid=531934">[​IMG]</a></div><div class='quotemain'><!--quotec-->Does anyone know if you could build an S3&K rom with this, but without 2P Competition mode, would the space be lowered enough to run on jEnesis (the DS one)?<!--QuoteEnd--></div><!--QuoteEEnd-->It's possible, but isn't going to be easy. (At least for less experienced hackers.) You'd have to delete everything associated with the 2 player mode, sprites, levels, the menus, etc. Varion Icaria was making a hack that deleted most of the space in the ROM that's redundant, but he's been focusing more on his disassembly and his other hack.
     
  20. Varion Icaria

    Varion Icaria

    He's waiting.... Tech Member
    1,014
    3
    18
    S4: Cybernetic Outbreak
    Thanks for the mention, I might consider this but not sure yet. I just finished splitting off most of the data for my disassembly and still working hard on it. My disassembly may be more useful than the current one since I've got Enumerations for Ram and SST among other things to help those who are inexperienced to know what they are changing. I am trying to get my disassembly done so I can work on a public release of both it and the first publically released version of my hack using the disassembly to it's full advantage.
     
Thread Status:
Not open for further replies.