Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions nonmatching/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,51 @@ Some older game drafts record experiments with the compiler recipe at
`ace3f7be822bae9e85af0ae9010bd5c0dca91986`. Those residuals are historical observations;
later dated entries record their own profiles and measurements. Neither is proof
of semantic correctness or matching credit without a strict linked build.

## Functional C

`functional/` and `functional.tsv` hold C that does what a still-assembly
function does without matching its bytes, written for the native port (see
`functional/README.md` and OpenRAC's `docs/port/BACKFILL.md`). It is never
linked, never counted by `tools/progress.py` (which reads `src/` only), and
`tests/check_repository.py` checks that each listed function is still
`INCLUDE_ASM` in `src/`.

A functional file is done only when the gate says SAME: `tools/fcheck.py`
compiles it in place of the function's `INCLUDE_ASM` line (with the unit's
flags; on its own when that does not compile), places it at 0x000A0000 and
runs OpenRAC's test-only interpreter on call states captured from the US
disc, comparing memory, the result, the kept registers and device accesses
with retail. It covers boot functions called in the boot, title, menu pages
and New Game up to the first level's load, and level 00 (Aranos, the
tutorial): New Game into it, played a while (`level00`). A function with a
place in level 00's program (a `func_L00_` function, or a boot or shared one
with a `00:` place in `config/levels/functions.tsv`) is checked at that
place, its symbols resolved at level 00's addresses; a boot function below
0x1A7C80 stays resident in the level and is checked as the boot's. Other
levels are not covered yet. With OpenRAC's interpreter built
(`build/interpreter/`) and the compiler reachable through `RAC2_LINUX` (on a
Mac, `docker run -d --name rac2-gate --platform linux/386 -v $HOME:$HOME
rac2-build:latest sleep infinity`, then `RAC2_LINUX="docker exec
rac2-gate"`):

```sh
python3 tools/build.py boot # build/boot/placed.json: the values placement uses
python3 tools/build.py level 00 # build/00_aranos_tutorial/placed.json, for level 00
python3 tools/fcheck.py capture LIST # states of the listed functions (every run)
python3 tools/fcheck.py capture LIST --script level00 # level 00 only (states about 16 MB each)
python3 tools/fcheck.py check func_XXXXXXXX nonmatching/functional/func_XXXXXXXX.c
python3 tools/fcheck.py check func_L00_XXXXXXXX nonmatching/functional/func_L00_XXXXXXXX.c
```

The batch form, which writes the verdicts to OpenRAC's
`port/game/rac2-ntsc/fcheck.tsv`, is OpenRAC's `python3 tools/fcheck_gate.py
run --game rac2` (its `docs/port/BACKFILL.md`, "The gate"). Exit codes and
the placement rules are in `tools/fcheck.py`'s docstring; its tests are
`tests/test_fcheck.py`.

## The drafts

| Function | Size | Status and remaining differences |
| --- | ---: | ---: |
| [`func_00285030`](game/func_00285030.c) | 680 | 26 October 2026 (xcarry): carried from rac3-decomp func_00392820, whose match uses an empty asm register fence (not allowed here). Without it, as a -g8 unit, the TEX0 build order and the second packet's registers differ (about 25 lines). See source. |
Expand Down
103 changes: 103 additions & 0 deletions nonmatching/functional.tsv
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
# C for functions this decompilation still has as assembly, for the native port only (OpenRAC port/game/rac2-ntsc, hostgen.json "candidates").
# Each does what the retail function does without matching its bytes; the matching build never reads it.
# Files under nonmatching/functional/ are C written for the port only (no matching attempt behind them).
# name file
func_00115FC0 nonmatching/functional/func_00115FC0.c
func_00119BF8 nonmatching/functional/func_00119BF8.c
func_00128FD0 nonmatching/functional/func_00128FD0.c
func_00132028 nonmatching/functional/func_00132028.c
func_00132498 nonmatching/functional/func_00132498.c
func_001325E0 nonmatching/functional/func_001325E0.c
func_00132C48 nonmatching/functional/func_00132C48.c
func_00133108 nonmatching/functional/func_00133108.c
func_001334B8 nonmatching/functional/func_001334B8.c
func_00133580 nonmatching/functional/func_00133580.c
func_0026FC78 nonmatching/functional/func_0026FC78.c
func_00279D18 nonmatching/functional/func_00279D18.c
func_0027A9F0 nonmatching/functional/func_0027A9F0.c
func_0027AB40 nonmatching/functional/func_0027AB40.c
func_0027B440 nonmatching/functional/func_0027B440.c
func_0027C540 nonmatching/functional/func_0027C540.c
func_0027C878 nonmatching/functional/func_0027C878.c
func_0027DE50 nonmatching/functional/func_0027DE50.c
func_0027E018 nonmatching/functional/func_0027E018.c
func_0027F2A8 nonmatching/functional/func_0027F2A8.c
func_0027F640 nonmatching/functional/func_0027F640.c
func_0027FC70 nonmatching/functional/func_0027FC70.c
func_00280710 nonmatching/functional/func_00280710.c
func_00283CB8 nonmatching/functional/func_00283CB8.c
func_00283CF0 nonmatching/functional/func_00283CF0.c
func_00284088 nonmatching/functional/func_00284088.c
func_00284268 nonmatching/functional/func_00284268.c
func_002859C8 nonmatching/functional/func_002859C8.c
func_00286738 nonmatching/functional/func_00286738.c
func_0028AB70 nonmatching/functional/func_0028AB70.c
func_0028B160 nonmatching/functional/func_0028B160.c
func_0028B3D0 nonmatching/functional/func_0028B3D0.c
func_0028E640 nonmatching/functional/func_0028E640.c
func_0028EA58 nonmatching/functional/func_0028EA58.c
func_00290B48 nonmatching/functional/func_00290B48.c
func_00291850 nonmatching/functional/func_00291850.c
func_00291CA8 nonmatching/functional/func_00291CA8.c
func_00291EC0 nonmatching/functional/func_00291EC0.c
func_00292888 nonmatching/functional/func_00292888.c
func_00292B88 nonmatching/functional/func_00292B88.c
func_00293000 nonmatching/functional/func_00293000.c
func_002933D0 nonmatching/functional/func_002933D0.c
func_002934F8 nonmatching/functional/func_002934F8.c
func_00294F10 nonmatching/functional/func_00294F10.c
func_00295870 nonmatching/functional/func_00295870.c
func_0029EFD0 nonmatching/functional/func_0029EFD0.c
func_0029F0C8 nonmatching/functional/func_0029F0C8.c
func_0029FDF0 nonmatching/functional/func_0029FDF0.c
func_002A0048 nonmatching/functional/func_002A0048.c
func_002A0250 nonmatching/functional/func_002A0250.c
func_002AD7B8 nonmatching/functional/func_002AD7B8.c
func_002AD860 nonmatching/functional/func_002AD860.c
func_002B6828 nonmatching/functional/func_002B6828.c
func_002B68C8 nonmatching/functional/func_002B68C8.c
func_002B6E78 nonmatching/functional/func_002B6E78.c
func_002B7578 nonmatching/functional/func_002B7578.c
func_002B85F8 nonmatching/functional/func_002B85F8.c
func_002B88F0 nonmatching/functional/func_002B88F0.c
func_002BA0E0 nonmatching/functional/func_002BA0E0.c
func_002C9CF8 nonmatching/functional/func_002C9CF8.c
func_002CA8A8 nonmatching/functional/func_002CA8A8.c
func_002CAB00 nonmatching/functional/func_002CAB00.c
func_002CAF18 nonmatching/functional/func_002CAF18.c
func_002CBAE0 nonmatching/functional/func_002CBAE0.c
func_002CBC58 nonmatching/functional/func_002CBC58.c
func_002D6F38 nonmatching/functional/func_002D6F38.c
func_002DDEC8 nonmatching/functional/func_002DDEC8.c
func_002E35E0 nonmatching/functional/func_002E35E0.c
func_002E3998 nonmatching/functional/func_002E3998.c
func_002E3BD8 nonmatching/functional/func_002E3BD8.c
func_002E48E8 nonmatching/functional/func_002E48E8.c
func_002E4AC8 nonmatching/functional/func_002E4AC8.c
func_002E5AD0 nonmatching/functional/func_002E5AD0.c
func_002E6178 nonmatching/functional/func_002E6178.c
func_002E64A0 nonmatching/functional/func_002E64A0.c
func_002E6A60 nonmatching/functional/func_002E6A60.c
func_002E76C0 nonmatching/functional/func_002E76C0.c
func_002E8368 nonmatching/functional/func_002E8368.c
func_002ECB70 nonmatching/functional/func_002ECB70.c
func_002F0FA0 nonmatching/functional/func_002F0FA0.c
func_002FC280 nonmatching/functional/func_002FC280.c
func_00300AA8 nonmatching/functional/func_00300AA8.c
func_00336F20 nonmatching/functional/func_00336F20.c
func_00337C10 nonmatching/functional/func_00337C10.c
func_003380B0 nonmatching/functional/func_003380B0.c
func_003384C0 nonmatching/functional/func_003384C0.c
func_0033C590 nonmatching/functional/func_0033C590.c
func_0033D028 nonmatching/functional/func_0033D028.c
func_0033EA60 nonmatching/functional/func_0033EA60.c
func_0033FB98 nonmatching/functional/func_0033FB98.c
func_00341030 nonmatching/functional/func_00341030.c
func_00342978 nonmatching/functional/func_00342978.c
func_003458F8 nonmatching/functional/func_003458F8.c
func_00345F70 nonmatching/functional/func_00345F70.c
func_00346C60 nonmatching/functional/func_00346C60.c
func_00347F80 nonmatching/functional/func_00347F80.c
func_003489E8 nonmatching/functional/func_003489E8.c
func_0034B2C8 nonmatching/functional/func_0034B2C8.c
func_0034E070 nonmatching/functional/func_0034E070.c
14 changes: 14 additions & 0 deletions nonmatching/functional/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Functional C

C that behaves like the retail function without matching its bytes. It is for
the native port only: the matching build never reads it, `src/` never holds it,
and the progress report never counts it.

- One file per function (or per small group), named after the function.
- List each in [`../functional.tsv`](../functional.tsv) as `name<TAB>file`.
`tests/check_repository.py` requires every listed function to still be
`INCLUDE_ASM` in `src/` and its file to exist here.
- When a function matches, put the match in `src/` and delete its row and file.
- OpenRAC reads the table through `port/game/rac2-ntsc/hostgen.json`
("candidates"); how to write and verify this C is in OpenRAC's
`docs/port/BACKFILL.md`.
Loading
Loading