diff --git a/docs/coop.md b/docs/coop.md index ad0c2134..52f3a409 100644 --- a/docs/coop.md +++ b/docs/coop.md @@ -5,7 +5,7 @@ other players' names where their Link stands in your world, you can chat, and pr 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 -`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 and the time of day are each game's own. @@ -90,7 +90,7 @@ dropped and counted in the log. | 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_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 | diff --git a/docs/releases/v0.9.3.md b/docs/releases/v0.9.3.md index e680af09..aaa41465 100644 --- a/docs/releases/v0.9.3.md +++ b/docs/releases/v0.9.3.md @@ -21,7 +21,7 @@ ## 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 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 @@ -44,4 +44,4 @@ 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 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". diff --git a/nx2navi.ini.example b/nx2navi.ini.example index 25935fe6..7f905d44 100644 --- a/nx2navi.ini.example +++ b/nx2navi.ini.example @@ -794,7 +794,7 @@ # 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. # 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 # folder first. 0 = only names, positions and chat. # coop_share = 1 diff --git a/runtime/cfg.c b/runtime/cfg.c index a41f1133..30caeea6 100644 --- a/runtime/cfg.c +++ b/runtime/cfg.c @@ -83,10 +83,11 @@ static const char *const known[] = { "VMA_BLOCK_MB", "SYNC_WAKE_ALL", "LOG_ASYNC", "DEVICE_LOST_AT", "STAGING_FAIL_AT", "VRAM_BALLAST_MB", "TEX_COMPACT", "TEX_COMPACT_MIN_MB", "TEX_COMPACT_FRAME_MB", // texture compaction (vk_texture.c); no menu row "STANDIN_FILTER", // the filter of the scene upscaler's stand-in (vk_tonemap.c); no menu row - "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 - // sets them logs no unknown key - "COOP_BETA", "COOP_NAME", "COOP_SERVER", "COOP_PORT", "COOP_ROOM", "COOP_AUTO", "COOP_DROP", + // 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" + // 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_TEST_SET", "COOP_ACCEPT", "COOP_REMOVE", "COOP_RESET_POOLS", }; @@ -118,7 +119,7 @@ static const struct { const char *key, *section; } sections[] = { {"LOW_LATENCY", "display"}, {"DEVICE_PROFILE", "display"}, {"ASSUME_FOCUS", "display"}, {"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"}, {"PCSS", "display"}, {"MODS_DIR", "mods"}, {"MODS_ORDER", "mods"}, {"MODS_DISABLED", "mods"}, {"MODS_REBUILD", "mods"}, @@ -282,10 +283,10 @@ static const CfgMeta metas[] = { {"DISCORD_RPC", "1", "0|1", LIVE}, {"DISCORD_APP_ID", NX2NAVI_DISCORD_APP_ID_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), // 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}, // Advanced: scheduling {"ASYNC_PREEMPT", "1", "0|1|2", RESTART}, {"REPLAY_ASYNC", "0", "0|1", RESTART}, diff --git a/runtime/cfg_probe.c b/runtime/cfg_probe.c index efe5e75e..446b1445 100644 --- a/runtime/cfg_probe.c +++ b/runtime/cfg_probe.c @@ -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 diff --git a/runtime/coop.c b/runtime/coop.c index d6379bc0..153a41a1 100644 --- a/runtime/coop.c +++ b/runtime/coop.c @@ -590,7 +590,7 @@ static void coop_main(void *arg) { while (!__atomic_load_n(&P.stop, __ATOMIC_ACQUIRE)) { uint64_t now = plat_now_ms(); 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) { net_down(); if (G.state != COOP_OFF) G.state = COOP_OFF, G.note = COOP_NOTE_NONE, publish(now); diff --git a/runtime/coop_game.c b/runtime/coop_game.c index f95a0449..1fd1d2ad 100644 --- a/runtime/coop_game.c +++ b/runtime/coop_game.c @@ -633,7 +633,7 @@ void coop_present(Cpu *c) { unsigned v = cfg_version(); if (v != G.cfg_seen) { 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); G.share = cfg_bool("NX2NAVI_COOP_SHARE"); } diff --git a/runtime/ui/coop_page.cpp b/runtime/ui/coop_page.cpp index 34887965..97e951f8 100644 --- a/runtime/ui/coop_page.cpp +++ b/runtime/ui/coop_page.cpp @@ -82,7 +82,7 @@ static void want_room(int what, const char *code) { else coop_join(code); 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; snprintf(g_pending_code, sizeof g_pending_code, "%s", code ? code : ""); 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_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", 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) { @@ -122,7 +122,7 @@ static void chat_text(const CoopChatLine &l, char *out, size_t cap) { static void rows_out(void) { 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; } if (g_view.local) opt_text(UI_MENU_COOP_LOCAL); @@ -439,7 +439,7 @@ static bool g_over_on; bool coop_overlay_tick(void) { static unsigned cfg_seen = ~0u; 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 (uint32_t s = coop_serial(); s != serial) serial = s, coop_view(&g_over); if (g_over.invite_room) return true;