Something I've been wanted to do for a while. Importing all DRA builds,
with the recent TEK discovery in the equation, allowed me to get a more
concrete idea of the builds lineage.
I am putting the PR in draft for two reasons:
1. I want to collect feedback on this already big PR.
2. I am planning to make jp10, jp11, us, hk, and jp12 builds optional,
and just let the CI to always test them. Reason is I realize not
everyone has/wants these additional builds. Moreover, it would further
creep the build time.
The most interesting change is
https://github.com/Xeeynamo/sotn-decomp/blob/dec7c323d50ac22fd7511d6e1c1fdb3027ddf82a/include/version.h
, which drastically changes how versions are tested on the
pre-processor. Gone are `VERSION_US` and friends. Instead they're
replaced with `#define VER_US 19970901U`, corresponding to the greatest
creation date of each file from a given build. TEK and HD have unknown
build dates, so I gave them numbers prior to `VER_JP10`.
This allows us to document the code as follows:
```
// before
#if defined(VERSION_US) || defined(VERSION_EU) || defined(VERSION_HK) || \
defined(VERSION_USPROTO) || defined(VERSION_JP10) || \
defined(VERSION_JP11) || defined(VERSION_JP12)
// after
#if VERSION >= VERSION_JP10
```
Helpers such as `IS_VER_INTL` are created to indicate all English PS1
builds, excluding the USPROTO. INTL is a short name for "International".
I took the chance to also change how we test a region with the new macro
`REGION_*`. The PSP exclusive paths are now tested with `'#if TARGET ==
TARGET_PSP`. I could've used `#if defined(TARGET_PSP)` but we may have
run to the same traps as earlier. Instead, we could create a simple
helper to do `#if IS_TARGET_PSP` but I did not want to add too many
unnecessary wrappers.
I also eliminate almost all inverted conditions. `#if !(defined(xxx) &&
defined(yyy))` and similar were far too hard to read.
`VER_NEXT` is our custom "ultimate" build with community fixes. It could
be paired with `PLATFORM_PSYZ`, which now replaces `VERSION_PC`
Previously diffing Saturn locally was pointing to the wrong files. This
attempts to fix that.
DIffing locally is still broken, I am unsure since which commit. But
this at least fixes the obvious problems.
It's a TT_000 beta, there's a lot of copy&paste from that overlay. It is
linked to a pre-release of `main.exe` which means most shared symbols
need to be rebased on the new `config/symbols.beta_fname.txt`.
I will attempt to merge the two overlays once this `fname` is fully
matching.
The development timeline, from older to newest, seems to be:
SD overlay > MAD stage > FNAME beta familiar > HD beta build > JP 1.0
In looking at #2321, I found that the pathing wasn't being built
properly. I reworked it so that it should now be returning all of the
proper pathing for all versions and overlays, as well as adding `_psp`
`src/` directories for stage, boss, dra, and ric
Matches 72% of the entire overlay in one go. Around 80% of the overlay
code is made of duplicate function.
A few observations:
* `func_us_8018AC0C` seems to be an older, buggy version of
`func_801B246C` and it seem to indicate `ObjInit2` was either a `u16`
array or there were macros involved.
* `e_breakable` is the same function, but the data changes in most
overlays; I had to pull the data out. The SFX ID is also different.
Data handled through the asset manager and BSS will come as part of a
separate PR.
Extract ST/WRP out of #1119 . All the function symbols should have been
cross-referenced. There as some PSX functions missing from PSP and some
new functions from PSP that are not present on PSX (e.g.
`st_init_wrp.c`).
The files `st_debug.c` and `e_breakable.c` are shared between WRP PSX
and WRP PSP. Everything else from PSP is isolated into its own folder. I
had to do some tricks on the YAML config to allow shared code.
`ST_WRP_MERGE = st_debug e_breakable` in the `Makefile` is a bit
annoying as MWCC complains about every single minute detail from the C
source that has been already decompiled for the PSX US build.
`EntityWarpSmallRocks` is matching on PSP but I couldn't extract the
rodata without having a bunch of linker errors. This might be a Splat
issue. I need to investigate further.
`func_psp_09244760` is soooo interesting. The values from `0x11` to
`0x17` matches the Entity IDs that are unique to the WRP overlay. This
aligns to what we have in `typedef enum EntityIDs`.
Overall I am very excited to the recent discoveries from the PSP build!
OK. Here goes. Version 0.0.1 alpha of the MWCC Global Assembly Processor
(mwccgap). It's currently very simple/limited, but it appears to work
for `src/servant/tt_000/10E8.c`.
There is lot more that can be done to improve mwccgap - i.e. supporting
.rodata migration would be a good addition, but let's see how far we can
get with it in it's current state.
Note that the Makefile could do with some improvements - we don't nede
to use mwccgap for any C file that *dont* have INCLUDE_ASM macros (it's
a waste of time) so these could be ignored, i.e. for SSSV I do something
like this to find the files that need fixing up:
```
GLOBAL_ASM_C_FILES := $(shell $(GREP) GLOBAL_ASM $(SRC_DIR) </dev/null 2>/dev/null)
```
.. although this is perhaps too simple given that SOTN has a mix of PSP
and PSX functions (and therefore there may be INCLUDE_ASM for a PSX
function but none for PSP functions...

Matches w_000, effectively opening the doors to understand how hand
equippables work. That includes weapons, shields, consumable; all of
them internally named as Weapons). This overlay is used by:
* Tyrfing
* Namakura
* Gladius
* Scimitar
* Cutlass
* Saber
* Falchion
* Broadsword
* Bekatowa
* Damascus sword
* Hunter sword
* Bastard sword
* Talwar
* Sword of Hador
* Luminus
* Harper
* Gram
* Mormegil
* Terminus Est
* Dark Blade
* Mourneblade
* Badelaire
Due to the nature of splat, renaming the symbols is hella hard but
possible once we start importing the `.data` section in it. As far I
know this overlay does not contain any `.rodata`.
Checklist to convert it from Draft to Ready:
- [x] Decompile [func_4000_8017B1D8](https://decomp.me/scratch/HLPI0)
- [x] Confirm name of the functions
- [X] ~~Put shareable code in the appropriate folder (either as `.h` or
`.c`~~ not all overlays have identical functions (see w_029). Needs more
research
- [X] ~~Import `.data` in the C file~~ needs substancial re-work in the
spriteparts asset extractor
- [x] Move `AnimSoundEvent` to the appropriate header
- [X] ~~Rename `Entity::unk58` and `Entity::`unk6A`~~ more appropriate
as a separate PR
This worked fine for me locally like this, example is for this PR
https://github.com/Xeeynamo/sotn-decomp/pull/269
`make build_saturn_docker && make check_saturn_docker`
`python3 ./tools/asm-differ/diff.py --overlay game --version saturn
AddHearts`
Co-authored-by: sozud <[email protected]>