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

@@ -5,7 +5,7 @@ other players' names where their Link stands in your world, you can chat, and pr
counts for everyone. counts for everyone.
**Co-op is experimental and off by default.** Turn it on in the menu's Co-op tab (*Co-op (experimental)*), or with **Co-op is experimental and off by default.** Turn it on in the menu's Co-op tab (*Co-op (experimental)*), or with
`coop = 1` under `[coop]` in `nx2navi.ini`. With it off the game uses no network at all. `coop_steam = 1` under `[coop]` in `nx2navi.ini`. With it off the game uses no network at all.
Not in this version: the other players are shown as a name with a distance, not as a Link model, and enemies, pots Not in this version: the other players are shown as a name with a distance, not as a Link model, and enemies, pots
and the time of day are each game's own. and the time of day are each game's own.
@@ -90,7 +90,7 @@ dropped and counted in the log.
| Key | Default | | | Key | Default | |
|---|---|---| |---|---|---|
| `coop` | `0` | on or off, at once. On: the game signs in to Steam; off: no network | | `coop_steam` | `0` | on or off, at once. On: the game signs in to Steam; off: no network. (`coop`, the switch of the co-op of versions up to 0.9.2, does nothing: a line of it left in a file turns nothing on) |
| `coop_share` | `1` | in a room, share progress, items and songs (above) | | `coop_share` | `1` | in a room, share progress, items and songs (above) |
| `coop_names` | `1` | show the other players' names where they stand. Needs DLSS, FSR or TAA on: only then does the menu know where the camera looks | | `coop_names` | `1` | show the other players' names where they stand. Needs DLSS, FSR or TAA on: only then does the menu know where the camera looks |
| `coop_chat` | `1` | show new chat lines, and who joined or left, over the game for a few seconds while the menu is closed | | `coop_chat` | `1` | show new chat lines, and who joined or left, over the game for a few seconds while the menu is closed |

View File

@@ -21,7 +21,7 @@
## New ## New
- **Experimental: co-op through Steam** (the menu's new Co-op tab; off by default; `coop = 1` in nx2navi.ini). Up to - **Experimental: co-op through Steam** (the menu's new Co-op tab; off by default; `coop_steam = 1` in nx2navi.ini). Up to
four players, each in their own game and save, meet in a room: *Create a room* gives a room ID to pass on, *Join a four players, each in their own game and save, meet in a room: *Create a room* gives a room ID to pass on, *Join a
room* takes one, and *Invite a friend* sends a Steam invite. Nobody forwards a port and nobody runs a server: rooms room* takes one, and *Invite a friend* sends a Steam invite. Nobody forwards a port and nobody runs a server: rooms
are Steam lobbies and the games talk through Steam's network. NX2navi signs in to Steam as its test app, so Steam are Steam lobbies and the games talk through Steam's network. NX2navi signs in to Steam as its test app, so Steam
@@ -44,4 +44,4 @@
does nothing without another one is greyed out and says which it needs. does nothing without another one is greyed out and says which it needs.
- **The co-op beta of 0.8.0 is replaced.** It shared story progress through a relay a player had to run, with a - **The co-op beta of 0.8.0 is replaced.** It shared story progress through a relay a player had to run, with a
forwarded port, and never showed the other players. Its relay, its rules and pools, its settings and its hidden tab forwarded port, and never showed the other players. Its relay, its rules and pools, its settings and its hidden tab
are gone; lines of it left in an nx2navi.ini do nothing, and a bug report still keeps their values out. See "New". are gone; lines of it left in an nx2navi.ini do nothing (its `coop = 1` does not turn the new co-op on), and a bug report still keeps their values out. See "New".

View File

@@ -643,7 +643,7 @@
# steam_api64.dll beside ocarina.exe, which the launcher copies there from a Steam game you have installed. Rooms are # steam_api64.dll beside ocarina.exe, which the launcher copies there from a Steam game you have installed. Rooms are
# made and joined in the menu's Co-op tab, never from this file. # made and joined in the menu's Co-op tab, never from this file.
# 0 = off, the game uses no network. Takes effect at once. # 0 = off, the game uses no network. Takes effect at once.
# coop = 0 # coop_steam = 0
# In a room, share progress, items and songs with the other players; your save is copied to coop-backup in the profile # In a room, share progress, items and songs with the other players; your save is copied to coop-backup in the profile
# folder first. 0 = only names, positions and chat. # folder first. 0 = only names, positions and chat.
# coop_share = 1 # coop_share = 1

View File

@@ -80,10 +80,11 @@ static const char *const known[] = {
"TEXUP_LOG_MS", "DYN_RES", "DYN_RES_TARGET", "DYN_RES_STEP", "TEXTURE_DETAIL", "TEXUP_LOG_MS", "DYN_RES", "DYN_RES_TARGET", "DYN_RES_STEP", "TEXTURE_DETAIL",
"RECORDER_CORE", "RECORDER_PRIO", "REPLAY_TIME", "LOCK_TIME", "POOL_CREATE_BUDGET", "POOL_CREATE_MS", "POOL_FINI_IDLE", "POOL_LOAD_BACKLOG", "POOL_LOAD_MS", "RECORDER_CORE", "RECORDER_PRIO", "REPLAY_TIME", "LOCK_TIME", "POOL_CREATE_BUDGET", "POOL_CREATE_MS", "POOL_FINI_IDLE", "POOL_LOAD_BACKLOG", "POOL_LOAD_MS",
"VMA_BLOCK_MB", "SYNC_WAKE_ALL", "LOG_ASYNC", "DEVICE_LOST_AT", "STAGING_FAIL_AT", "VRAM_BALLAST_MB", "VMA_BLOCK_MB", "SYNC_WAKE_ALL", "LOG_ASYNC", "DEVICE_LOST_AT", "STAGING_FAIL_AT", "VRAM_BALLAST_MB",
"COOP", "COOP_SHARE", "COOP_NAMES", "COOP_CHAT", // co-op (coop.c, coop_game.c, ui/coop_page.cpp) "COOP_STEAM", "COOP_SHARE", "COOP_NAMES", "COOP_CHAT", // co-op (coop.c, coop_game.c, ui/coop_page.cpp)
// retired: the settings of the co-op of versions up to 0.9.2; read by nothing, listed so that a file which still // retired: the settings of the co-op of versions up to 0.9.2; read by nothing, listed so that a file which still
// sets them logs no unknown key // sets them logs no unknown key. COOP was that co-op's switch: the new one's is COOP_STEAM, so that a "coop = 1"
"COOP_BETA", "COOP_NAME", "COOP_SERVER", "COOP_PORT", "COOP_ROOM", "COOP_AUTO", "COOP_DROP", // left in a file from then turns nothing on
"COOP", "COOP_BETA", "COOP_NAME", "COOP_SERVER", "COOP_PORT", "COOP_ROOM", "COOP_AUTO", "COOP_DROP",
"COOP_PROGRESS", "COOP_ITEMS", "COOP_SONGS", "COOP_QUEST", "COOP_KEYS", "COOP_RUPEES", "COOP_AMMO", "COOP_PROGRESS", "COOP_ITEMS", "COOP_SONGS", "COOP_QUEST", "COOP_KEYS", "COOP_RUPEES", "COOP_AMMO",
"COOP_TEST_SET", "COOP_ACCEPT", "COOP_REMOVE", "COOP_RESET_POOLS", "COOP_TEST_SET", "COOP_ACCEPT", "COOP_REMOVE", "COOP_RESET_POOLS",
}; };
@@ -111,7 +112,7 @@ static const struct { const char *key, *section; } sections[] = {
{"FRAMEGEN", "display"}, {"FRAMEGEN_MULTIPLIER", "display"}, {"FG_MULT", "display"}, {"FRAMEGEN", "display"}, {"FRAMEGEN_MULTIPLIER", "display"}, {"FG_MULT", "display"},
{"DEVICE_PROFILE", "display"}, {"ASSUME_FOCUS", "display"}, {"DEVICE_PROFILE", "display"}, {"ASSUME_FOCUS", "display"},
{"DISCORD_RPC", "discord"}, {"DISCORD_APP_ID", "discord"}, {"DISCORD_IMAGE", "discord"}, {"DISCORD_RPC", "discord"}, {"DISCORD_APP_ID", "discord"}, {"DISCORD_IMAGE", "discord"},
{"COOP", "coop"}, {"COOP_SHARE", "coop"}, {"COOP_NAMES", "coop"}, {"COOP_CHAT", "coop"}, {"COOP_STEAM", "coop"}, {"COOP_SHARE", "coop"}, {"COOP_NAMES", "coop"}, {"COOP_CHAT", "coop"},
{"SHADOW_SCALE", "display"}, {"SHADOW_RANGE", "display"}, {"CONTACT_SHADOWS", "display"}, {"SHADOW_SCALE", "display"}, {"SHADOW_RANGE", "display"}, {"CONTACT_SHADOWS", "display"},
{"PCSS", "display"}, {"PCSS", "display"},
{"MODS_DIR", "mods"}, {"MODS_ORDER", "mods"}, {"MODS_DISABLED", "mods"}, {"MODS_REBUILD", "mods"}, {"MODS_DIR", "mods"}, {"MODS_ORDER", "mods"}, {"MODS_DISABLED", "mods"}, {"MODS_REBUILD", "mods"},
@@ -242,10 +243,10 @@ static const CfgMeta metas[] = {
{"DISCORD_RPC", "1", "0|1", LIVE}, {"DISCORD_RPC", "1", "0|1", LIVE},
{"DISCORD_APP_ID", NX2NAVI_DISCORD_APP_ID_DEFAULT, NULL, LIVE}, {"DISCORD_APP_ID", NX2NAVI_DISCORD_APP_ID_DEFAULT, NULL, LIVE},
{"DISCORD_IMAGE", NX2NAVI_DISCORD_IMAGE_DEFAULT, NULL, LIVE}, {"DISCORD_IMAGE", NX2NAVI_DISCORD_IMAGE_DEFAULT, NULL, LIVE},
// Co-op (coop.c): off until the player turns it on; then the game signs in to Steam as its test app and can make // Co-op (coop.c): COOP_STEAM is its switch, off until the player turns it on; then the game signs in to Steam as its test app and can make
// or join a room. In a room: COOP_SHARE shares progress, items and songs with the other players (coop_game.c), // or join a room. In a room: COOP_SHARE shares progress, items and songs with the other players (coop_game.c),
// COOP_NAMES shows the other players' names where they stand, COOP_CHAT shows the chat's lines over the game. // COOP_NAMES shows the other players' names where they stand, COOP_CHAT shows the chat's lines over the game.
{"COOP", "0", "0|1", LIVE}, {"COOP_SHARE", "1", "0|1", LIVE}, {"COOP_NAMES", "1", "0|1", LIVE}, {"COOP_STEAM", "0", "0|1", LIVE}, {"COOP_SHARE", "1", "0|1", LIVE}, {"COOP_NAMES", "1", "0|1", LIVE},
{"COOP_CHAT", "1", "0|1", LIVE}, {"COOP_CHAT", "1", "0|1", LIVE},
// Advanced: scheduling // Advanced: scheduling
{"ASYNC_PREEMPT", "1", "0|1|2", RESTART}, {"REPLAY_ASYNC", "0", "0|1", RESTART}, {"ASYNC_PREEMPT", "1", "0|1|2", RESTART}, {"REPLAY_ASYNC", "0", "0|1", RESTART},

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"); 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 // 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 // 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 // repeated one once, a key of other characters is counted without being listed, and the menu's save keeps every

View File

@@ -590,7 +590,7 @@ static void coop_main(void *arg) {
while (!__atomic_load_n(&P.stop, __ATOMIC_ACQUIRE)) { while (!__atomic_load_n(&P.stop, __ATOMIC_ACQUIRE)) {
uint64_t now = plat_now_ms(); uint64_t now = plat_now_ms();
unsigned v = cfg_version(); unsigned v = cfg_version();
if (v != cfg_seen) cfg_seen = v, on = cfg_bool("NX2NAVI_COOP") && RT_V111; if (v != cfg_seen) cfg_seen = v, on = cfg_bool("NX2NAVI_COOP_STEAM") && RT_V111;
if (!on) { if (!on) {
net_down(); net_down();
if (G.state != COOP_OFF) G.state = COOP_OFF, G.note = COOP_NOTE_NONE, publish(now); if (G.state != COOP_OFF) G.state = COOP_OFF, G.note = COOP_NOTE_NONE, publish(now);

View File

@@ -633,7 +633,7 @@ void coop_present(Cpu *c) {
unsigned v = cfg_version(); unsigned v = cfg_version();
if (v != G.cfg_seen) { if (v != G.cfg_seen) {
G.cfg_seen = v; G.cfg_seen = v;
G.on = cfg_bool("NX2NAVI_COOP"); G.on = cfg_bool("NX2NAVI_COOP_STEAM");
__atomic_store_n(&X.on, G.on, __ATOMIC_RELAXED); __atomic_store_n(&X.on, G.on, __ATOMIC_RELAXED);
G.share = cfg_bool("NX2NAVI_COOP_SHARE"); G.share = cfg_bool("NX2NAVI_COOP_SHARE");
} }

View File

@@ -82,7 +82,7 @@ static void want_room(int what, const char *code) {
else coop_join(code); else coop_join(code);
return; return;
} }
if (g_view.state == COOP_OFF) opt_apply("NX2NAVI_COOP", "1"); if (g_view.state == COOP_OFF) opt_apply("NX2NAVI_COOP_STEAM", "1");
g_pending = what; g_pending = what;
snprintf(g_pending_code, sizeof g_pending_code, "%s", code ? code : ""); snprintf(g_pending_code, sizeof g_pending_code, "%s", code ? code : "");
g_pending_until = plat_now_ms() + PENDING_MS; g_pending_until = plat_now_ms() + PENDING_MS;
@@ -112,7 +112,7 @@ static void settings_rows(void) {
opt_toggle("NX2NAVI_COOP_SHARE", UI_MENU_COOP_SHARE, UI_MENU_COOP_SHARE_DESC); opt_toggle("NX2NAVI_COOP_SHARE", UI_MENU_COOP_SHARE, UI_MENU_COOP_SHARE_DESC);
opt_toggle("NX2NAVI_COOP_NAMES", UI_MENU_COOP_NAMES, UI_MENU_COOP_NAMES_DESC); opt_toggle("NX2NAVI_COOP_NAMES", UI_MENU_COOP_NAMES, UI_MENU_COOP_NAMES_DESC);
opt_toggle("NX2NAVI_COOP_CHAT", UI_MENU_COOP_CHAT_SHOW, UI_MENU_COOP_CHAT_SHOW_DESC); opt_toggle("NX2NAVI_COOP_CHAT", UI_MENU_COOP_CHAT_SHOW, UI_MENU_COOP_CHAT_SHOW_DESC);
opt_toggle("NX2NAVI_COOP", UI_MENU_COOP_ON, UI_MENU_COOP_ON_DESC); opt_toggle("NX2NAVI_COOP_STEAM", UI_MENU_COOP_ON, UI_MENU_COOP_ON_DESC);
} }
static void chat_text(const CoopChatLine &l, char *out, size_t cap) { static void chat_text(const CoopChatLine &l, char *out, size_t cap) {
@@ -122,7 +122,7 @@ static void chat_text(const CoopChatLine &l, char *out, size_t cap) {
static void rows_out(void) { static void rows_out(void) {
if (g_view.state == COOP_OFF && !g_pending) { if (g_view.state == COOP_OFF && !g_pending) {
opt_toggle("NX2NAVI_COOP", UI_MENU_COOP_ON, UI_MENU_COOP_ON_DESC); opt_toggle("NX2NAVI_COOP_STEAM", UI_MENU_COOP_ON, UI_MENU_COOP_ON_DESC);
return; return;
} }
if (g_view.local) opt_text(UI_MENU_COOP_LOCAL); if (g_view.local) opt_text(UI_MENU_COOP_LOCAL);
@@ -439,7 +439,7 @@ static bool g_over_on;
bool coop_overlay_tick(void) { bool coop_overlay_tick(void) {
static unsigned cfg_seen = ~0u; static unsigned cfg_seen = ~0u;
static uint32_t serial; static uint32_t serial;
if (unsigned v = cfg_version(); v != cfg_seen) cfg_seen = v, g_over_on = cfg_bool("NX2NAVI_COOP") != 0; if (unsigned v = cfg_version(); v != cfg_seen) cfg_seen = v, g_over_on = cfg_bool("NX2NAVI_COOP_STEAM") != 0;
if (!g_over_on) return false; if (!g_over_on) return false;
if (uint32_t s = coop_serial(); s != serial) serial = s, coop_view(&g_over); if (uint32_t s = coop_serial(); s != serial) serial = s, coop_view(&g_over);
if (g_over.invite_room) return true; if (g_over.invite_room) return true;