17 Commits
Author SHA1 Message Date
Dylan Carr c318048d7d Build: move the shared build system to Kazarov (#163)
* Build: check out scripts with LF line endings

* Build: replace the build scripts with Kazarov

* Port: rename PC_OVERRIDE to Kazarov's PORT_OVERRIDE

* Build: build the PS2 executables through Kazarov's CMake modules

* Scripts: remove unused tooling

* Build: update Kazarov

* Build: update Kazarov

* Build: run the port without a disc when its data exists, reject the old REGION variable, and lock the shared Windows dependencies

* Build: update Kazarov

* Port: serialise game data extraction across configurations

* Build: update Kazarov

* Port: hold a shared data lock while the game runs

* Port: refuse to start on data another configuration re-extracted

* Build: update Kazarov
2026-10-11 19:03:41 +11:00
Adubbz 4ea55517b3 Repo restructured 2026-10-03 13:05:59 +00:00
Adubbz 127352c7f2 Port bringup 2026-10-01 13:36:53 +10:00
Adubbz 0245a72aab Split the tree into src/ps2 and src/port
src/common becomes src/ps2 and holds only the game's code as MWCC compiles
it: every DC_PC guard is gone, leaving those units as they were before the
port. src/pc becomes src/port.

The root CMakeLists.txt only picks the platform. The PS2 build moves to
src/ps2/CMakeLists.txt (with its modules in src/ps2/cmake), the port's to
src/port/CMakeLists.txt.

The port copies each src/ps2 unit into the build tree with its MWCC inline
assembly turned into PS2_ASM() stubs (src/port/cmake/StubAsm.cmake), so the
hand-written stubs for assembly functions are no longer needed. A unit that
needs MWCC-only names supplied gets src/port/shims/<unit>.h; mathutil's
renames the runtime's std::exception apart from the host's. __dl's
declaration gains the throw() its definition has.

src/ps2 now compiles with -Wall rather than -w. Retail's uninitialised
reads and missing returns stay in the source -- initialising any of them
changes what MWCC emits -- and the port defines them instead with
-ftrivial-auto-var-init=zero and -fno-strict-return.
2026-10-01 12:07:58 +10:00
Adubbz 833eafb422 Move the game's code to src/common and add the PC port 2026-10-01 11:53:33 +10:00
AdubbzandAlessandro Suha ccec0abd2e PAL (#41)
* Name the discs by region and put every build input and output under a region directory

The disc images are rom/Dark Cloud (NTSC).iso and rom/Dark Cloud (PAL).iso;
each region's checksums and extracted files live under rom/ntsc and rom/pal.
scripts/build/region.py turns REGION (NTSC by default, or PAL) into the paths
every script and CMake use: config/<region> holds the split configuration,
symbol lists, fixups and linker script, splat writes asm/<region>, and CMake
builds into build/<region>. The overlay headers and pads are splat pad
segments, so no assets/ tree is written, and the unused config/reference_asm
and reference_asm.py are gone. overlay_private.sh places a private-repository
file still kept under rom/extracted/ in rom/ntsc/extracted/.


* Carry PR 40's PAL source differences; NTSC unchanged

The PAL prototype's small divergences sit inline under #ifdef PAL in 30
units; common.h gains the per-region screen geometry and GS Y offset,
clsmes.hpp the message window width and ClsMes size. The twenty PAL-only
functions stand as stubs at their retail positions, dataread's four
tree-building functions are NTSC-only, and PAL compiler-state pragma
blocks sit beside NTSC's. config/pal/splice.txt lists the 213 functions
whose PAL bytes are not yet expressed in C. Every unit compiles with
-DPAL; every NTSC object is byte-identical.

Co-authored-by: Alessandro Suha <plarpoon@zandark.eu>

* Generate the PAL split configuration from NTSC's

scripts/build/splat_config.py writes a release's symbol lists from its own
executable and carries NTSC's yaml, linker script and object fixups over to
another release by symbol and relocation pairing: the overlay entry points by
the retail name they note, _gp from .reginfo, @ORDER comments and the dun text
start, and function-local statics through the function that owns them. The
carried files are written once and maintained by hand; --check compares the
symbol lists and, on NTSC, proves the carry is the identity. region.paths()
names any release's files.

config/pal holds the PAL prototype's yaml, symbol lists, linker script, fixups
and expression-node overrides. NTSC unchanged.

Co-authored-by: Alessandro Suha <plarpoon@zandark.eu>

* Supply the PAL prototype's undecompiled functions from INCLUDE_ASM markers

Each PAL function not yet in C is `#ifdef PAL INCLUDE_ASM("asm/pal/nonmatchings/
<unit>", <symbol>)` beside its NTSC body (207 markers); include_asm.h and the
mwccgap marker path are back for PAL, with the name counter pinned where a
marker stands so later compiler constants keep their names. PAL-differing data
is C under #ifdef PAL in the owning units. datacheck.py reads a relocation's
target section from the REL entry's info field. docs/PAL.md describes the PAL
build. NTSC is byte-identical; PAL links with 120 functions and 2 data bytes
still to reconcile.

Co-authored-by: Alessandro Suha <plarpoon@zandark.eu>

* Carry PR 40's PAL data and layout; every PAL image verifies

The PAL linker script places EditGaijiTbl at 0x0025f02c, aligns _dun_end to
128, drops dngmessageman's small-data line (PAL's LanguageStr is in
hitvalue.cpp) and aligns editmapscript's .sbss to 16 over retail's unnamed
pad at 0x002a9f3c. title/op_c loads the Chara__3 entries NTSC does in
OpC_InitProcess2/5; battlemenu loads wepstatus and reloads DrawAallWeapon's
textures from BtlMenuExtBlock under PAL.

datacheck.py resolves retail's name__N spellings (Names), scores each voted
anchor on its own layout and resolves a pointer word by its exact name.

PAL: SCUS_971.11 3048 perfect / 154 asm, TITLE.BIN 126 / 44, DUN.BIN 52 / 9,
data perfect. NTSC unchanged.

Co-authored-by: Alessandro Suha <plarpoon@zandark.eu>

* PAL: 29 main-executable functions in C from PR 40; NTSC unchanged

battle_globals, battlemenu (9), memcard (2), menu_dungeon, shot_freefuncs,
clsmes, dataread (2), edit, editloop, fireomni, frame, mglib, texture (3),
stockitem, chararead, dungeonmap and spritetable express their PAL
differences under #ifdef PAL instead of INCLUDE_ASM markers; editloop's PAL
argument-flag indices follow. mglib.hpp declares PAL's mgTopVRAM and
mgZBufferAdr.

Co-authored-by: Alessandro Suha <plarpoon@zandark.eu>

* PAL: 10 title-overlay functions in C from PR 40; NTSC unchanged

op_a (2), op_b, op_c (2), op_d, opening, rushmovi (2) and title express their
PAL differences under #ifdef PAL. A string retail shares with a function
still supplied by a marker is reached through PAL_POOLED, so the compiled
function does not emit a second copy.

Co-authored-by: Alessandro Suha <plarpoon@zandark.eu>

* PAL: dun, gamepad, eastking, menu_draw and collisiondata functions in C from PR 40

dun/gameloop (2), gamepad (3), eastking (2), menu_draw (2) and collisiondata
express their PAL differences under #ifdef PAL; dun/gameloop takes PR 40's
PAL argument-flag block, InitEastKingEvent returns int under PAL, and the
PAL expression-node overrides carry PR 40's five entries. The PAL fixups
follow every unit's renumbered statics. All three PAL images verify with
158 functions still supplied by markers; NTSC unchanged.

Co-authored-by: Alessandro Suha <plarpoon@zandark.eu>

* Make decompile.sh's m2c context parse again

m2ctx.py spells a C++ template-id as a plain identifier, and now declares each
one it spells as an opaque struct, so CDataAlloc<1, 1690000> no longer breaks
m2c's C parser. decompile.sh generates a missing context with the container's
venv Python, which has libclang's bindings.


* Work on the PAL version

---------

Co-authored-by: Alessandro Suha <plarpoon@zandark.eu>
2026-09-30 21:49:16 +10:00
Adubbz f23e93a6d1 Create drafts for various functions and split tus 2026-09-15 21:26:34 +10:00
Adubbz 13d494dfea fish: OK 2026-09-03 05:49:42 +00:00
Adubbz 64038f569e Initial work on the dun overlay 2026-08-21 00:44:03 +00:00
Adubbz b3f3341cf1 More build fixes 2026-08-17 06:12:22 +00:00
Adubbz 2711c96a91 DungeonMap progress 2026-08-12 10:53:10 +00:00
Adubbz 6023e5326a Buildsystem overhaul 2026-08-08 11:56:22 +00:00
Adubbz 9e6276a027 Misc progress 2026-08-03 13:06:32 +00:00
Adubbz 31f5520c2f Various fixes 2026-08-03 06:34:25 +00:00
Adubbz 616762dcc3 Build improvements 2026-08-02 00:01:06 +00:00
Adubbz bc3be56b40 More overhaul 2026-07-29 03:37:52 +00:00
Adubbz 461a3ba19f Overhaul 2026-07-29 03:34:37 +00:00