don't click here

Sonic Advance 1 Android Port Decompile

Discussion in 'Engineering & Reverse Engineering' started by evilhamwizard, Jul 21, 2014.

  1. Tanks

    Tanks

    Member
    1,045
    103
    43
    Yeah, that's the cracked version since loading the .apk on any non-JP device offered a SIM error. I forget who made that, but I don't think it would be a problem using that version though since I think it was a minor edit.
     
  2. Hitaxas

    Hitaxas

    Retro 80's themed Twitch streamer ( on hiatus) Member
    Just curious... Since this was converted into a disassembled java, in theory would it be possible to recompile it into a normal .jar and run it from a pc maybe? That would be interesting, and further research could lead to a decent engine for java based fangames or "hacks".
     
  3. ICEknight

    ICEknight

    Researcher Researcher
    Isn't it just that the game is always locked to 30FPS?
     
  4. DustArma

    DustArma

    Member
    1,324
    5
    18
    Santiago, Chile
    Learning Python.
    Not even that, the game runs way more sluggishly than 30FPS, someone with a rooted Android device could try using GL Tools, it includes a framerate overlay so we can see just how bad the game runs.
     
  5. Tanks

    Tanks

    Member
    1,045
    103
    43
    Running it on my Nexus 4. It can't keep a set framerate but its about 16fps on average with a max of ~22-24fps. Minimum usually drops to about ~9-12fps.

    If I remember correctly, this ran better on my HP Touchpad back whenit was running CM9. I've upgraded since then to 11, but I could try it on there as well and see how it goes.
     
  6. Montblanc

    Montblanc

    Member
    98
    3
    6
    It runs at 15-17 FPS, 20 at most on my Galaxy S4 (qualcomm version) with a clean ROM (the Google Edition).

    If someone wants to mess with the graphics just replace the .PNG's without decompressing the file and use ZipSigner afterwards:

    https://play.google.com/store/apps/details?id=kellinwood.zipsigner2

    I always wanted to replace all the characters of SA1 with the classic designs. But it's not worth if it runs so bad...

    [​IMG]

    A quick edit of the Sonic sprite :v:
     
  7. evilhamwizard

    evilhamwizard

    Researcher
    1,371
    360
    63
    I tried looking around for a possible frame limit, but it doesn't look like the frame rate is limited by anything.

    Has anyone tried running it with BlueStacks?
     
  8. Hitaxas

    Hitaxas

    Retro 80's themed Twitch streamer ( on hiatus) Member
    It does run on bluestacks. Though I am not sure of the framerate. At the least it seems playable.
     
  9. Tanks

    Tanks

    Member
    1,045
    103
    43
    [​IMG]

    It ain't pretty but it works :colbert:
     
  10. Clownacy

    Clownacy

    Tech Member
    929
    241
    43
    Darkon called; He said he wants his hack back :v:.
     
  11. Delta

    Delta

    Oldbie
    If only it were that easy!

    Basically, no, you won't magically get a PC version. The game would likely be calling into several Android-specific APIs since it's made for Android. That said, a good chunk of the code would probably be independent of the fact that it's running on Android (such as physics), so perhaps with a bit of effort it can be turned into a PC Java game. Not a trivial task, though, since you would need to rip out anything relating to the touchscreen, make sure it uses PC graphics APIs, reimplement key/button input if it doesn't have it already, and probably a bunch of small things that wouldn't be apparent at first.

    But as a way to research implementing Sonic physics in a language like Java, it could perhaps be more useful.

    On the main topic: Decompilers for Java (as well as .NET) are pretty common. The reason that they exist and work so well is due to the fact that Java apps/games compile down to the same cross-platform bytecode (like machine language except for a Java Virtual Machine), which is a well-understood and well-researched format. It's known how certain patterns of bytecode correspond to Java syntax.

    This is why the modding community around, say, Minecraft (probably the most popular Java game right now) is so goddamn huge. It wasn't because the developers made a nice modding API for everyone to use. It's because Java is in an easily decompiled and deconstructed format, so it was relatively simple to reverse-engineer compared to a natively compiled application.
     
  12. Panko

    Panko

    Member
    8
    0
    1
    If the Java code could be magically converted into a format that is compatible for PC, it is very plausible that a Genesis port could be made. But that is just a theory.

    If a port were to happen, there would have to be a lot of streamlining in order to get the game to run with full color (yes, the Genesis is capable of >64 colors, but it's difficult), and plenty of rewriting and debugging. A PC version would be good because users can then create their own hacks/fan-games without using an emulator or running from an unofficial engine.

    The physics are an important part of it. Sonic the Hedgehog (Game Boy Advance) was based on the Sonic Advance engine, and it had quite a few issues dealing with momentum and underwater movement.
     
  13. MainMemory

    MainMemory

    Kate the Wolf Tech Member
    4,648
    214
    43
    SonLVL
    I don't follow. How does a PC port bring us any closer to a Genesis port? The code would still be Java, so you'd have to convert it to 68000 ASM either way, which is just as possible (read: extremely time consuming and difficult) with the Android version's decompiled code. You'd also have to reduce the colors from 32 palettes (16 plane palettes and 16 sprite palettes) to four palettes per level, remove all rotation and scaling effects, and possibly reduce the number of tiles.
     
  14. Panko

    Panko

    Member
    8
    0
    1
    The Genesis is capable of more than 32/64 colors on-screen. And, yes, it would be very time consuming.

    Here is video proof of >64 colors:

     
  15. GerbilSoft

    GerbilSoft

    RickRotate'd. Administrator
    2,905
    40
    28
    USA
    rom-properties
    How about just a plain old screenshot?

    [​IMG]

    The underwater segment uses a completely separate 64-color palette compared to the above-water segment.

    Color limitations aren't the hardest part of porting Sonic Advance from Android to MD. The limiting factor is it's Java. Rewriting Java to 68000 assembly language (or any assembly language, for that matter) is very time-consuming. Even using C instead of assembly language (using one of the various C compilers available for MD) would still take a good long time, since a lot of Java functionality isn't available.
     
  16. Clownacy

    Clownacy

    Tech Member
    929
    241
    43
    And here I was thinking that all high level languages were the same... Is it because interpreted languages (if that's even the word) are more flexable than compiled languages or something?
     
  17. GerbilSoft

    GerbilSoft

    RickRotate'd. Administrator
    2,905
    40
    28
    USA
    rom-properties
    Java has all sorts of object-oriented stuff like polymorphism and reflection. Some of this is relatively easy to port to procedural languages like C, but reflection is extremely painful and time-consuming. (Reflection is basically querying an object to determine what methods and fields it has, which requires storing that data somewhere and providing a standard interface for querying it.)

    I haven't actually looked at the Sonic Advance decompiled source to see if it uses reflection, but it probably does use polymorphism aka inherited classes, where one class is a 'base' class that provides a common interface, and other classes derive from it to add specific functionality. This can be replicated in C, but it's somewhat annoying to do so. (Look up how Microsoft's COM system works in C and you'll know what I mean.)
     
  18. Jeffery Mewtamer

    Jeffery Mewtamer

    Blind Bookworm Member
    1,730
    21
    18
    I would imagine a Java Virtual Machine would be too resorce intensive for the Genesis, even if you stripped out anything Advance doesn't use, but Are there no C++ to 68k machine code compilers? Not that a Java to C++ rewrite is easy per se, but the two do have similar syntax and have comparable levels of object orientedness.
     
  19. bookman the stinky

    bookman the stinky

    literal trash Member
    188
    14
    18
    the dong
    find motivation
    My guess is they didn't have the license to Nakamura's tracks like they did for the first Sonic Advance.
     
  20. Montblanc

    Montblanc

    Member
    98
    3
    6
    They already removed some of the old tracks back then when the game was re-released for the N-Gage.