don't click here

Sonic Advance 2 decompilation

Discussion in 'Engineering & Reverse Engineering' started by freshollie, May 7, 2022.

  1. freshollie

    freshollie

    Member
    17
    121
    28
    I never played Advance 1 or 3, but from the person who wrote the wiki from my findings, it seems most of the actions are just leftover from the Advance 1 Multiplayer teamplay mode
     
  2. Willie

    Willie

    Each day the world turns Laugh 'til it all burns Member
    I think if you put a ton of effort into speedrunning, you could probably get way better at speedrunning Sonic Advance 2 now compared to when you were a child, especially if you learn how to do optimal routes. The level leaderboard on Speedrun.com and SonicCenter.org showcase a lot of the current best strats for beating levels. I also reccomend watching the TAS for Sonic and Knuckles by Dashjump. A lot of the strats with Sonic in his TAS is impossible to do irl, but most of the Knuckles strats in his TAS can be done with any character.





    I also recommend checking out the The Sonic Speedrun Community Discord server. A lot of people in the #sonic-advance_series text channel are super helpful to anyone who wants to get better at speedrunning any of the Sonic Advance games.

    Oh, I didn't know Sonic Advance 1 had a teamplay mode. I have never had the opportunity to try out its multiplayer.
     
  3. Jeffery Mewtamer

    Jeffery Mewtamer

    Blind Bookworm Member
    1,901
    108
    43
    Now that I think of it, I don't think my speedrun rutes ever differed much, if at all, from the SP Ring routes, at least not for the first act of the first 6 Zones and Egg Utopia 2(can't remember why, but it was always Egg Utopia 2 I used at attempts to get Emeral 7 when I used Act 1 for all the others... Makes me wonder if there's ever been an Any% versus 100% like categorization for single act times where any% has you beating the level as quickly as possible and 100% has you beating as quickly as possible while getting all of the SP Rings... Or a low% where the goal is to get the fastest time collecting none of the SP rings.
     
  4. freshollie

    freshollie

    Member
    17
    121
    28
    Hi all.

    Just to update we hit 30% tonight.

    We now have:

    - The special stage decompiled
    - All cutscenes decompiled
    - Some work to decompile chao garden
    - Many interactables, and enemies documented in asm and some interactables decompiled
     
  5. freshollie

    freshollie

    Member
    17
    121
    28
    I finished decompiling the True Area 53 intro today, so we can finally answer the age old question of what was behind the super sonic transformation graphic.

    [​IMG]

    A little bit anti-climatic. I guess they just didn't have time to create the transformation animation?

    (This has probably already been done with an emulator, but I've not seen it documented anywhere)
     
    • Like Like x 5
    • Informative Informative x 2
    • Agree Agree x 1
    • Useful Useful x 1
    • List
  6. LordOfSquad

    LordOfSquad

    bobs over baghdad Member
    5,216
    249
    43
    Winnipeg, MB
    making cool music no one gives a shit about
    I've been replaying Advance 2 on my handheld in little post-work bites recently, and been really enjoying it. I remember the reception being generally negative when it first came out but it really is the best Advance game. I think we just didn't know how good we had it until all the actually bad Sonic games starting coming out after...

    Anyway, all this to say I really appreciate the work you're doing and can't wait to see what comes of it. Some new levels (with more tuned up level design) would be such a treat to blast through.
     
  7. Shaddy the guy

    Shaddy the guy

    Professional Internet asshole Member
    2,154
    1,164
    93
    OR
    Ironically, Advance 2 was always my least favorite, but I can see this becoming a foundation for so much cool shit. Good work, always love seeing the progress!
     
  8. freshollie

    freshollie

    Member
    17
    121
    28
    Hi all,

    We've hit 40% decompiled, which feels like another decent milestone!

    Some achievements in the past few months:
    - Large chunk of animation scripts and related sprites have been extracted and are used in the compilation process, you can view these within the "graphics" folder
    - The Tiny Chao Garden songs have been extracted to matching midi files
    - More interactables decompiled (some of which were never used in the game) https://twitter.com/JaceCear/status/1625274754667016192
    - Main camera logic decompiled as well as lots of stage init functions
    - Level entity position data has been extracted (though this is stored in a binary format which will need tools to edit)
     
  9. Iko MattOrr

    Iko MattOrr

    Member
    29
    20
    3
    Just want to say that Advance 2 is my favorite Sonic game and I'm looking forward to this.
    Actually, I love that game so much that I wish I could help in some way... I know that there's a Discord server for people who want to join the project, but my knownledge of assembly and decompiling are very limited, so I doubt I could be helpful. (I looked at some .c files in the github repository and it definitely looks too complex for me, on a first look at least).

    Making custom levels for this game is one of my dreams since when the game came out, and there are some moves of the characters that I would like to tweak, so I would really like to learn how to mess with this decompilation at some point.
     
  10. freshollie

    freshollie

    Member
    17
    121
    28
    That's great to hear! Feel free to join the discord as it's not entirely related to decompiling, more about researching the advance trilogy. You'll be surprised how quickly you can pick up decompiling, it takes a skill but if you have a programming background you may pick it up :)
     
  11. Willie

    Willie

    Each day the world turns Laugh 'til it all burns Member
    I had no idea there was a Discord server. Can I get a link? I love to speedrun Sonic Advance 2, so it would be fun to connect with other fans of the game.



    I don't have the skillset to do some of the stuff required for the decompilation, but I'm open minded to learning new skills so I can help with the project.
     
  12. Iko MattOrr

    Iko MattOrr

    Member
    29
    20
    3
    The link to the Discord server is in the Github readme.

    https://discord.gg/rckwpnYUXF

    I spent the whole day configuring the wsl into PowerShell because I don't have a Linux system at the moment... but it works now, I can compile the rom... I hope to learn more as well.

    I don't like to speedrun the game because for me the appeal is the great freedom of movement that the game offers, so I prefer to mess with the physics and do tricks instead of optimizing a playthrough; but yeah Advance 2 is great for speedrunners. Though, I learned the position of all the 98 special rings in the game and I like to get them every time. I think that there's some charm in the special stage access method in this game, all it needs is some quality of life changes to make it more forgiving and easier. I've seen an hack that reduced the amount of rings required, but I think that something like letting the player carry them between levels and lose only one instead of all on death might be more ideal for preserving the original feel, and allowing the crazy players like me to be able to get all of them in a single level (maybe twice in a zone) like in the original game.
    EDIT: that or maybe add different ways to generate more special rings, like as a reward for keeping the boost mode for long enough, or with trick combos (chain tricks close to each other until you get one as a reward). I wouldn't change the number 7 anyway, they're 7 like the emeralds.
     
    Last edited: Jun 9, 2023
  13. Jeffery Mewtamer

    Jeffery Mewtamer

    Blind Bookworm Member
    1,901
    108
    43
    As I remember from my days speed running this game, I think at least half of my speed run routes actually netted all seven SP Rings. Though, it does make me wonder how level-by-level records compare for zero versus any versus all SP Rings, assuming such divisions exist in organized speed running for this gane.
     
  14. freshollie

    freshollie

    Member
    17
    121
    28
    Hi all!

    To update, we've hit 60% decompiled (I forgot to update at 50%)

    Jace has been doing so much work over the past few months so I can hardly the credit for all of this.

    What's changed since the last update:

    - All interactables decompiled (about 60 in the game so quite a feat). Interactables is what we've categorised for all entities in the stage which are not enemies or rings
    - Entity and ring managers decompiled (though not matching yet as we are having some trouble there)
    - Pause menu, demo manager (which let us see what happens after the demo screen fades out, pretty boring tbh), music manager and loads more of the stage related code decompiled
    - Fully Decompiled the multiboot loader. That's the sub-rom which runs on the child GBAs when booting the collect the rings game from a single cartridge
    - Decompiled the demo manager, and stage UI
    - Match the Europe rom. That means this repo can build 2 of the released roms from the same sourcecode. The Japanese rom will be the final one to match.
    - A ton of player physics (player callbacks) which are already being used as reference for building new copies of the game with the same physics
    - All sprites combined which go into building whole animation frames (previously we had extracted the individual sprites which were hard to work with). You can find these under the graphics folder. Thanks a ton to Jace for that!
    - Restructured the project to represent, from what we can deduce, the original file structure for the original source code
    - Categorised all boss related assembly code

    This project is now over a year old and with the help of others progress is still going really strong. Discord link is above and in the README. If you have any programming experience and want to get involved, building the rom is the first step and from there learning to understand how to turn assembly into C code (we can help). At this pace we hope to reach 100% decompiled within the next year and then moving onto potentially creating a PC port, but if others get involved the progress will be quicker.
     
    Last edited: Jun 12, 2023
  15. Shaddy the guy

    Shaddy the guy

    Professional Internet asshole Member
    2,154
    1,164
    93
    OR
    This is really exciting. Between this and mainmemory's hacking tools we're gonna see a lot of cool content emerge from the Advance games. Hope that can inspire SEGA to finally rerelease them.
     
  16. BenoitRen

    BenoitRen

    Tech Member
    468
    205
    43
    Decompiling assembler to C code is one thing, but there are no debug symbols available to name function arguments and local variables, are there?
     
  17. I would assume unless a debug rom shows up at some point no.

    Hey we could always hope if sega ever decides to re-release them they pull a *Gems collection* again and leave it hanging around.
     
  18. freshollie

    freshollie

    Member
    17
    121
    28
    No debug symbols, but enough context to name most globals and functions. We are mostly documenting as we go along and >80% of globals are named
     
    • Informative Informative x 1
    • List
  19. freshollie

    freshollie

    Member
    17
    121
    28
    Hi all,

    No major progress percentage wise, however we have a pretty amazing achievement:

    TL;DR: The codebase is now shiftable, so you can start writing any mods in C code. However, keep in mind the codebase is not yet properly documented, and major changes may still occur so don't base major projects off this (yet).

    Up until the last few weeks, attempting to make major modifications to the code base would cause the rom to crash on startup. This was due to a problem known as "shifting".

    When decompiling a game, we rely on data from the existing rom to allow us to decompile portions of the game at a time but still build a "whole game" with small amount of the game decompiled.

    Shifting occurs when additional code added to the rom causes memory addresses to "shift" from their previous position. As we were relying on read only data from the existing rom, which has hard coded addresses to other parts of the rom, shifting makes these addresses invalid as they start pointing to random bits of data in the game.

    Jace has been working really hard on extracting this data into the decompilation project, which means when the rom is compiled from sourcecode the data addresses are updated to point to the correct locations after any shifting which has occurs.

    It's a major milestone in the project, and I look forward to seeing any interesting hacks which are created as a result :)

    In other news, I plan to start repos for SA1 and SA3 soon. We won't be spending much effort decompiling these yet, but they will be useful to have.
     
    Last edited: Aug 17, 2023
  20. MainMemory

    MainMemory

    Kate the Wolf Tech Member
    4,744
    338
    63
    SonLVL
    With a little manual work, it is possible to use my tools to make edits to the decomp by copying binary files and possibly editing some C structures. At some point in the future the tools and decomp may be more directly compatible.
     
    • Like Like x 4
    • Informative Informative x 1
    • Useful Useful x 1
    • List