Give the new co-op's switch a name of its own, so an old "coop = 1" turns nothing on.

The Steam co-op took the setting name of the old beta's switch, coop. A player whose nx2navi.ini still had coop = 1 from that beta got the new co-op switched on at the first start of the new build, unasked: the game signed in to Steam as its test app. The switch is now coop_steam (NX2NAVI_COOP_STEAM), off by default, and coop is a retired key like the old co-op's other settings: known, read by nothing.

--probe-cfg now loads a file of the old co-op and checks that its keys are no unknown keys, that coop = 1 leaves the new co-op off, and that coop_steam = 1 turns it on; it passes on a build of this commit. The game itself was not started with the change.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
epicmeme546
2026-11-13 05:30:56 -05:00
parent e60677ed87
commit a01910d905
8 changed files with 34 additions and 17 deletions

View File

@@ -88,6 +88,22 @@ int probe_cfg(void) {
CHECK(EQ(cfg_unknown_keys(&n), "") && n == 0, "a missing file leaves no unknown keys either");
}
// A file from the co-op of versions up to 0.9.2: its lines are retired settings, not unknown keys, and its switch,
// coop = 1, does not turn the new co-op on, whose switch has a name of its own (coop_steam).
{
static const char old_coop[] = "[coop]\ncoop = 1\ncoop_beta = 1\ncoop_name = someone\ncoop_progress = shared\n";
cfg_setenv("NX2NAVI_COOP_STEAM", NULL);
CHECK(plat_file_write(path, old_coop, sizeof old_coop - 1) && cfg_load(path) == 1, "load a file of the old co-op");
int n = -1;
CHECK(EQ(cfg_unknown_keys(&n), "") && n == 0, "the old co-op's settings are no unknown keys");
CHECK(!cfg_bool("NX2NAVI_COOP_STEAM"), "the old co-op's coop = 1 does not turn the new co-op on");
static const char new_coop[] = "[coop]\ncoop = 0\ncoop_steam = 1\n";
CHECK(plat_file_write(path, new_coop, sizeof new_coop - 1) && cfg_load(path) == 1 && cfg_bool("NX2NAVI_COOP_STEAM"),
"coop_steam = 1 turns the new co-op on");
plat_file_delete(path);
CHECK(cfg_load(path) == 0, "the co-op file is gone again");
}
// A player's file as a report showed it: settings the menu wrote, and three lines added by hand that are no
// settings of this version (the player took the first for the fix of a crash). The three are named as such, a
// repeated one once, a key of other characters is counted without being listed, and the menu's save keeps every