Jump to content

Sonic Adventure Autodemo/Restoration

From SA Docs
Revision as of 21:06, 21 February 2026 by Speeps (talk | contribs) (It's a start.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

(WIP)

When the Sonic Adventure Autodemo was first dumped in 2013, it was quickly found that only some stages could be loaded in-game. While the non-functional stages could have their assets extracted using SA Tools and ported to the PC version, being able to play them in the Autodemo itself was desirable in order to see differences in the game's code, which couldn't be exported by the tools.

This restoration was achieved in 2024 through a collaboration of X-Hax users and symbol information acquired from the leaked Xbox 360 SADX prototype.

Background

Initial Research

Early discussion/findings were posted on the Sonic Retro Forums.

Only stages that match 1ST_READ's date (October 15, 1998) could load in-game. All others crash immediately due to containing older pointers to 1ST_READ functions and texture lists. Despite this, the pointers in 1ST_READ has to the stage files are still correct.

There are 3 build dates for stages:

  • October 15, 1998: Emerald Coast, Speed Highway, Red Mountain, Icecap, Final Egg, Chaos 2, Station Square, Egg Carrier, SS Chao Garden.
  • October 7, 1998: EC Chao Garden, MR Chao Garden.
  • September 24, 1998: Everything else.

Every map (except MR Jungle, which had a geometry bug) could still be viewed and extracted by SA Tools, so a lot of them (Early WV) were quickly ported to PC.

The first attempt at fixing the broken stages was done by evilhamwizard in 2015. He got Windy Valley 3 to load as well as a few objects by comparing the pointers in E103 and E104 (Red Mountain, a working stage), which are almost identical objects:

(TODO: add his gifs)

At the time there wasn't enough known about the game to get the rest of the correct pointers and it was only possible to go so far with one object as a reference, so gathering info about these broken maps was left to extracting the data with external tools.

2015-2024

A few notable things were discovered in the following years:

  • In 2018, the MR Jungle map was finally extracted (Thanks to ItsEasyActually) - it was the version from the Tokyo International Announcement video, with lots of paths that were removed.
  • In 2020, PkR discovered the pirate ship for Twinkle Park had a different model:
  • In 2024, woofmute learned how to skip the intro video, found part of the object editor (Also seen in SADX:Preview and the SA2 May 7 build) and an early results tally.

It turned out Practice 1 could load by just removing its SET File (Object Layout) because it only references 1ST_READ through that.

Restoration Begins

In 2024, Speeps posted that he had loaded Twinkle Park's map without crashing, after removing all the ways running STG03 would encounter a pointer to 1ST_READ. This was partly thanks to ehw's original research, which provided the address of the Round Manager pointer list in 1ST_READ.

(TODO: Maybe I should write a tutorial instead of this wordy list lol -Speeps)

The broken pointers were fixed with the following method:

  1. Get the address of all pointers that read the stage's file from 1ST_READ. These are the Round Manager, Background Manager, Object List and Path List.
  2. Using IDA's graph view, gather all pointers to 1ST_READ (8Cxxxxxx).
  3. Using Ghidra, identify an object (using its name string) and check if the same code exists in SADX, where its symbol information can be taken from the 360 symbols.
  4. For all references to broken pointers in the object, attempt to find a working reference in a functional AutoDemo stage, such as Speed Highway.
  5. Replace the broken pointer with the working one.

All pointers were added to a spreadsheet along with their fixed version.

For any code that didn't have a matching reference in the PC version or a functional Autodemo stage file, such as code for objects that didn't exist in the final game, the original byte difference method was used instead. Using Ghidra, the resulting pointer was checked to ensure it led to an appropriate address (The beginning of a function etc.). Any pointers "fixed" with this method were marked in the table as unsure.

Stages that were similar enough to their final counterparts to share a lot of code (Twinkle Park, Lost World) were repaired first to build the database of known pointers, as stages with larger changes (Windy Valley) consisted almost entirely of code that didn't exist in the final game.

The restoration was primarily discussed in a Discord thread, which this page will attempt to archive.

(TODO)