Skip to content

fix: point VMCDIR.TXT at disc 1's folder, not its VCD file - #69

Merged
casmith merged 1 commit into
mainfrom
fix/vmcdir-names-the-folder
Sep 6, 2026
Merged

fix: point VMCDIR.TXT at disc 1's folder, not its VCD file#69
casmith merged 1 commit into
mainfrom
fix/vmcdir-names-the-folder

Conversation

@casmith

@casmith casmith commented Sep 5, 2026

Copy link
Copy Markdown
Owner

A multi-disc game would have lost the player's save at the disc change.

VMCDIR.TXT names the support directory whose memory card a disc shares. ps2hdd wrote the VCD's filename into it:

SLUS_005.94.Metal Gear Solid_CD1.VCD    was written
SLUS_005.94.Metal Gear Solid_CD1        is correct

Four characters, and it fails silently. POPStarter finds no folder of that name, falls back to giving the disc a virtual memory card of its own, and a save made on disc 1 is simply not there on disc 2.

That is precisely the failure the comment on writePS1Support describes and says must not happen:

a three-disc RPG that loses your save at the disc change is technically installed and practically useless

Found while answering a question about how disc swapping works, by reading POPStarter's documented file formats instead of assuming ours matched them.

Two more limits from the same source, both silent

Filename length. A VCD name has to fit the buffer DISCS.TXT paths are read into, which caps it at roughly 73 characters — not the 89 POPStarter's wiki quotes. maxVCDNameLen drops to 73 for every title: a name is only an identifier, and a shorter one costs nothing next to a multi-disc game that cannot change discs.

Disc count. DISCS.TXT describes at most four discs. A title with more installs and boots exactly as before, and now says its disc-swap menu will not work rather than leaving that to be discovered mid-game.

The tests encoded the bug

All three of them — the unit test, the app-level test, and scripts/demo-smoke.sh — asserted _CD1.VCD in VMCDIR.TXT. They now assert the documented format, and explicitly that the file carries no .VCD extension, along with POPStarter's 103-byte and no-path-separator limits.

Mutation-checked: restoring the old one-line contents compiles and fails both the unit test and the app test.

New coverage:

  • TestVCDNameFitsTheDiscsFileBuffer — names stay inside the buffer at every disc number, and the _CDn suffix survives truncation, since a title cut back to a shared prefix would install four files under one name.
  • TestDiscsFileListsFilenames — every line names a .VCD (unlike VMCDIR.TXT), lines are in disc order, and each fits the buffer.

Full suite, go vet, gofmt and the smoke test pass.

Source: POPStarter Docs — Multi-disc & VMC

https://claude.ai/code/session_018eBAB3V9GRxNwgpQcpGje4

A multi-disc game would have lost the player's save at the disc change.

VMCDIR.TXT names the support DIRECTORY whose memory card a disc shares.
ps2hdd wrote the VCD's filename into it instead:

  SLUS_005.94.Metal Gear Solid_CD1.VCD    was written
  SLUS_005.94.Metal Gear Solid_CD1        is correct

The difference is four characters and it fails silently. POPStarter
finds no folder of that name, falls back to giving the disc a virtual
memory card of its own, and a save made on disc 1 is simply not there on
disc 2 -- which is exactly the failure the comment on writePS1Support
describes and says must not happen.

Two more limits from the same documentation, both silent when exceeded.

A VCD filename has to fit the buffer DISCS.TXT paths are read into,
which caps it at about 73 characters rather than the 89 the wiki quotes.
The smaller number now applies to every title: a name is only an
identifier, and a shorter one costs nothing next to a multi-disc game
that cannot change discs.

DISCS.TXT describes at most four discs. A title with more installs and
boots as before, and now says that its disc-swap menu will not work
rather than leaving it to be discovered mid-game.

The tests and the smoke check asserted the old contents, so all three
encoded the bug. They now assert the documented format, and that
VMCDIR.TXT carries no .VCD extension at all.

Claude-Session: https://claude.ai/code/session_018eBAB3V9GRxNwgpQcpGje4
@casmith
casmith merged commit 6e19bfe into main Sep 6, 2026
5 checks passed
@casmith
casmith deleted the fix/vmcdir-names-the-folder branch September 6, 2026 17:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant