Files
jurjen.ladeniusandClaude Opus 5 cbde457da5 M2 complete: disk saving works via MSXgl's tool/disk_save module
Replaces the hand-rolled PHYDIO/DSKIO sector writer, which never worked,
with engine/src/tool/disk_save.h — added in MSXgl v1.3.0 for exactly this
("save to disk from a ROM application"). Saves are now a real FAT file,
KISSAT00.SAV, on the disk in drive A.

Four non-obvious requirements, all documented in CLAUDE.md:
- LibModules needs both "tool/disk_save" and "dos"
- ROMDelayBoot = true, or the Disk ROM's INIT never runs
- boot then takes 40-90s of emulated time (use `set throttle off`)
- DiskSave_Check() returns SAVEDATA_UNSIGNED for good files: with APPSIGN
  it wants the first 4 bytes to be g_AppSignature, but DiskSave_Save()
  writes the payload raw and never adds it

Also fixes a save-timing bug: the write now happens in AdvanceDay() after
the day increments, so the file describes the morning the player wakes to.
Saving during the evening made a reload replay that day and double-count
its cups.

Verified: play a full day, cold boot, resume at day 2 with served intact.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-27 22:17:49 +02:00

38 lines
1.5 KiB
JavaScript

// Kissaten Yūgure - MSXgl project configuration
// MSX2 · SCREEN 5 · ASCII16 MegaROM (see docs/DESIGN.md §5)
// ASCII-safe name: used for output filenames (ROM, symbols, intermediates)
ProjName = "kissaten";
ProjModules = [ ProjName ];
// "tool/disk_save" needs "dos" alongside it — see projects/samples/s_save.js
LibModules = [ "system", "bios", "vdp", "print", "input", "memory", "math",
"tool/disk_save", "dos" ];
Machine = "2";
// ASCII16 MegaROM from day one: dialogue, portraits and music banks will not
// fit in 32KB (DESIGN.md §5). 16KB segments; segments 0-1 are the fixed main
// code at 4000h~BFFFh, segments 2+ are banked data (dialogue, art, music).
Target = "ROM_ASCII16";
ROMSize = 128;
ROMMainSegments = 2;
// Enable when banked data/code actually lands (stage 3 dialogue banks);
// with it on from day one, RAM globals were getting corrupted at runtime.
BankedCall = false;
CheckVersion = true; // MSX2 required (SCREEN 5, V9938 commands)
AddROMSignature = true;
// Required for disk saving. A cartridge's INIT normally runs *during* the BIOS
// slot scan and MSXgl never returns from it, so the Disk ROM's own INIT never
// happens — NMBDRV stays 0 and the PHYDIO hook is never patched. This option
// instead installs an H.STKE hook and returns to the scan, so the game starts
// after the disk system is up. Boot takes visibly longer as a result.
ROMDelayBoot = true;
AppSignature = true;
AppCompany = "JL";
AppID = "KY";
Verbose = true;