Sonic 1 J2ME General Hacking Thread

Discussion in 'Discussion & Q&A' started by Iso Kilo, Apr 29, 2020.

  1. Iso Kilo

    Iso Kilo Local Wolf-Fox Member

    Joined:
    Oct 9, 2017
    Messages:
    250
    Location:
    Small Town in BC, Canada
    In case you are unaware, Sonic 1 J2ME is a port of the original Sonic the Hedgehog for mobile phones from 2005. It's actually what the 2006 'Sonic Genesis' GBA port is based on. Over the past month, some users such as @HyperPolygon64 @AURORA☆FIELDS and @CuckyDev along with I and others have been researching how it all works. As of April 29th, everything is still fairly new, and our decompilation is heavily obfuscated and unbuildable. However, now as interest is starting to wane, I figured it'd be appropriate to make this thread to renew interest. This version of Sonic 1 is very easy to modify because the graphics are literally just PNGs and the music, MIDI. We're working towards making a cleaned up decompilation, so code and level modifications can be achieved too.

    Here are a couple of resources to help you start with S1 J2ME hacking.
    Decompilation Github Page
    Discord Community
    KEmulator 1.0.3 (Provided by LilShootDawg)
    FernFlower Java Decompiler
    An original JAR of the game (Essentially a ROM) has been provided as well, I made sure to talk to Lazlo about this and it should be fine, legally.

    Feel free to also use this thread for discussion and showcasing what you've been able to do with S1 J2ME as well!~
     

    Attached Files:

    Last edited: Apr 30, 2020
    rika_chou and TheChosenHacker like this.
  2. TheChosenHacker

    TheChosenHacker Hi, how are you Member

    Joined:
    Aug 7, 2019
    Messages:
    186
    Location:
    A shed
    Is there no possibilities of changing the level design?
     
  3. Iso Kilo

    Iso Kilo Local Wolf-Fox Member

    Joined:
    Oct 9, 2017
    Messages:
    250
    Location:
    Small Town in BC, Canada
    Not yet. We don't understand the layout's file format, but once we do, there'll supposedly be a fork of SonLVL made.
     
  4. Tanman Tanner

    Tanman Tanner Well-Known Member Member

    Joined:
    Dec 23, 2016
    Messages:
    100
    Location:
    Buffalo, New York
    I'm assuming by that the fact the music is in midi format is that you can simply swap out music tracks with other midi files, but I have a feeling there's a catch: does the midi file have to fit within a specific size constraint and be formatted a certain way?
     
    ProjectFM likes this.
  5. Iso Kilo

    Iso Kilo Local Wolf-Fox Member

    Joined:
    Oct 9, 2017
    Messages:
    250
    Location:
    Small Town in BC, Canada
    As far as we can tell, there are no limits at all. As long as it's a MIDI, it works. Anything we've thrown at it plays out properly.

    However, there is a catch with the PNGs. You can only use 256 color (or less) images, or else you lose transparency. As well, you can extend the sizes of images that only use 1 frame (Like the Sega logo) but multiframe sprites (Like Sonic) are not the case. We're still working to figure out how to edit the sizes of frames and whatnot, so stick around for that. Hopefully we can make an animation tool or something afterwards.
     
    Last edited: Apr 30, 2020
    Tanman Tanner likes this.
  6. Iso Kilo

    Iso Kilo Local Wolf-Fox Member

    Joined:
    Oct 9, 2017
    Messages:
    250
    Location:
    Small Town in BC, Canada
    New commit to the decomp, the first one since April. Rolled back the class decompiles because the obfuscation was too much to handle. They'll have to be decompiled more carefully by paying attention to the bytecode. Also added Part 2, but because it was made by a different developer from Part 1 (iFone made Part 1, glu made Part 2), the highest resolution available was 208x208. Hopefully the next major commit will at least be buildable.
     
  7. Iso Kilo

    Iso Kilo Local Wolf-Fox Member

    Joined:
    Oct 9, 2017
    Messages:
    250
    Location:
    Small Town in BC, Canada
    Thanks to the research of Leia Ivon Flame over at the Sonic Java ME Hacking Server, we now know what BMD files are! They're the chunk files. This was discovered while she was also working on a new level editor for us called "SON_ME". Here's a bit of a look. Please note that the chunks aren't exactly being read properly, but it's just about there.
    [​IMG][​IMG][​IMG]
    It's impressive how she figured this out so quickly too. With the BMD files being loaded up in a matter of about an hour and a half. It's my theory that BMD stands for "Background Meta Data". Let me know what you think!~
     
  8. Iso Kilo

    Iso Kilo Local Wolf-Fox Member

    Joined:
    Oct 9, 2017
    Messages:
    250
    Location:
    Small Town in BC, Canada
    Update: SON_ME can now load level layouts. And as for these graphical corruptions; it's because tile attributes like flipping are contained in external BLT files that determine those attributes.
    [​IMG]
     
    ProjectFM likes this.
  9. Iso Kilo

    Iso Kilo Local Wolf-Fox Member

    Joined:
    Oct 9, 2017
    Messages:
    250
    Location:
    Small Town in BC, Canada
    Final update for tonight, objects now load. Currently, they just display their IDs, no fancy graphics.
    unknown-1.png
     
    Ravenfreak and ProjectFM like this.
  10. Iso Kilo

    Iso Kilo Local Wolf-Fox Member

    Joined:
    Oct 9, 2017
    Messages:
    250
    Location:
    Small Town in BC, Canada
    Updates on file names. Comparing bytes to Sonic 1 MD, I've found the following equivalents (Based on Hivebrain file names;
    scdtblwk.scd = collide/carray_n.bin
    scddirtbl.blt = collide/anglemap.bin (With $100 other bytes that I'm still trying to track)
    zone1.blt = collide/ghz.bin (And same for other zones)

    All that's left in terms of figuring out these files are the Map L files (Looked into them and they consist of seemingly only 0 or 1), and those $100 bytes on scddirtbl.

    For those curious about the naming of scdtblwk and scddirtbl, those are abbreviations for their functions, according to Kaz on Discord, they mean "Sonic Collision Detection Table Work" and "Sonic Collision Detection Direction Table". Note in Naka terms, direction means angle.

    It's both shocking and intriguing how much data was actually directly copied from Sonic 1's source, considering the quality of the port in action. It makes me curious what went wrong down the road to porting this.

    Really looking forward to this decomp being complete, and it excites me how many discoveries and information is popping up on Sonic 1 J2ME, these past few days.

    Oh yeah- and SON_ME can write data now, instead of merely reading it.[​IMG]
     
    vladikcomper and MarkeyJester like this.
  11. Iso Kilo

    Iso Kilo Local Wolf-Fox Member

    Joined:
    Oct 9, 2017
    Messages:
    250
    Location:
    Small Town in BC, Canada
    Thanks to @MarkeyJester providing the original assets to us, Sonic 1 J2ME now has it's first custom level! Straight from Pana Der Hejhog. Background's a little screwy since we don't know how to edit those just yet. But still, this is huge!~
    [​IMG]