Open LagoLunatic opened 2 months ago
In this game, overlay 0 doesn't have any code in it, instead it has the game's entire script in it.
That's interesting 🤔 Should be a simple fix, but I also noticed this warning:
[2024-09-09T20:14:22Z WARN dsd::config::module] Expected .text to end (0x20163e0) where .init starts (0x20d7ff4)
The .text
section should continue all the way until .init
starts, unless I'm mistaken about the section order being consistent for all retail games. Regardless, this massive gap is a bigger concern, as the rest of the analysis relies on there being symbols for every function in the game. I'll have to look into the byte contents after 0x20163e0
so I can find out what the function analysis is missing.
Yeah, there are many functions after 0x20163e0 and before 0x20d7ff4 that it misses. 2886 functions, if ghidra's analysis is correct. The next function after 0x20163e0 starts at 0x020163f4 and it seems to reference a literal pool starting at 0x20163e0.
There are similar warnings for Dawn of Sorrow and Portrait of Ruin (and the same overlay error, because these games also use a few overlays for things like graphics data):
>dsd init --extract-path orig/ACVE00 --output-path config/ACVE00 --dry false
[2024-09-11T20:02:34Z INFO ds_rom::rom::rom] Loading ROM from path orig/ACVE00
[2024-09-11T20:02:34Z INFO ds_rom::rom::rom] Loading ROM assets
[2024-09-11T20:02:34Z WARN dsd::config::module] Expected .text to end (0x20728f4) where .init starts (0x208ac14)
thread 'main' panicked at src\config\module.rs:223:49:
called `Option::unwrap()` on a `None` value
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
>dsd init --extract-path orig/ACBE00 --output-path config/ACBE00 --dry false
[2024-09-11T20:02:48Z INFO ds_rom::rom::rom] Loading ROM from path orig/ACBE00
[2024-09-11T20:02:48Z INFO ds_rom::rom::rom] Loading ROM assets
[2024-09-11T20:02:48Z WARN dsd::config::module] Expected .text to end (0x20a3620) where .init starts (0x20ca560)
thread 'main' panicked at src\config\module.rs:223:49:
called `Option::unwrap()` on a `None` value
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
The PoR one seems similar to the OoE one in that it thinks .text ends at a literal pool that appears before the function that uses it. The DoS one also ends at a literal pool, but this one appears after the function that uses it, not before.
Tested on Castlevania: Order of Ecclesia:
In this game, overlay 0 doesn't have any code in it, instead it has the game's entire script in it. find_functions currently seems to assume every overlay will have functions in it, so it fails when an empty list is returned: https://github.com/AetiasHax/ds-decomp/blob/074e28e7ebf104341c0fe329769257bc3b7af5c1/src/config/module.rs#L223-L224