Bring public main's Steam co-op, the removal of the old co-op and the launcher's Steam library file into the 0.10.0 line.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
chrg6
2026-11-13 04:37:01 -05:00
61 changed files with 3270 additions and 19149 deletions

View File

@@ -13,7 +13,6 @@
#include "cfg.h"
#include "cfg_private.h"
#include "coop_app.h"
#include "discord_app.h"
#include "host.h"
#include "platform/platform.h"
@@ -84,12 +83,12 @@ 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_BETA", "COOP_NAME", "COOP_SERVER", "COOP_PORT", "COOP_ROOM", "COOP_AUTO", "COOP_DROP", // co-op (coop.c); the last three have no menu row
"COOP_PROGRESS", "COOP_ITEMS", "COOP_SONGS", "COOP_QUEST", "COOP_KEYS", "COOP_RUPEES", "COOP_AMMO", // the room's rules (coop_game.c)
"COOP_TEST_SET", // test: sets flags by hash at given frames (coop_game.c); no menu row
"COOP_ACCEPT", // accepts a co-op room's members and rules before anything of it is applied (coop_game.c)
"COOP_REMOVE", // the room's maker removes a member: its id (coop.c), or a key's fingerprint (coop_game.c); no row (the Co-op tab's Remove)
"COOP_RESET_POOLS", // the room's maker resets the pools when it changes to a value other than 0 (coop_game.c); no row (the tab's Reset the pools)
"COOP", "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",
"COOP_PROGRESS", "COOP_ITEMS", "COOP_SONGS", "COOP_QUEST", "COOP_KEYS", "COOP_RUPEES", "COOP_AMMO",
"COOP_TEST_SET", "COOP_ACCEPT", "COOP_REMOVE", "COOP_RESET_POOLS",
};
// The nx2navi.ini section a key cfg_set may write goes to when the file lacks it (nx2navi.ini.example's sections).
@@ -118,9 +117,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_BETA", "coop"}, {"COOP_NAME", "coop"}, {"COOP_SERVER", "coop"}, {"COOP_PORT", "coop"},
{"COOP_PROGRESS", "coop"}, {"COOP_ITEMS", "coop"}, {"COOP_SONGS", "coop"}, {"COOP_QUEST", "coop"}, {"COOP_KEYS", "coop"},
{"COOP_RUPEES", "coop"}, {"COOP_AMMO", "coop"}, {"COOP_ACCEPT", "coop"},
{"COOP", "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"},
@@ -280,18 +277,11 @@ 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. The server is host[:port] of a relay (tools/coop_relay.py), and has no
// default until coop_app.h names one; the name is at most 24 bytes, empty for Player-xxxx; the port is the local UDP port
// (0: any). COOP_ROOM, COOP_AUTO, COOP_DROP and COOP_TEST_SET are read with cfg_get, no row.
{"COOP", "0", "0|1", LIVE}, {"COOP_BETA", "0", "0|1", LIVE}, {"COOP_NAME", "", NULL, LIVE},
{"COOP_SERVER", NX2NAVI_COOP_SERVER_DEFAULT, NULL, LIVE}, {"COOP_PORT", "0", "0..65535", RESTART},
// The rules a room made by this player syncs by (coop_state.h, docs/coop.md); a joiner's own are not used in the room.
{"COOP_PROGRESS", "shared", "shared|own", LIVE}, {"COOP_ITEMS", "shared", "shared|own", LIVE},
{"COOP_SONGS", "shared", "shared|own", LIVE}, {"COOP_QUEST", "shared", "shared|own", LIVE},
{"COOP_KEYS", "pool", "pool|own", LIVE}, {"COOP_RUPEES", "own", "own|pool", LIVE}, {"COOP_AMMO", "own", "own|pool", LIVE},
// Nothing from a room is applied before its members and rules are accepted (coop_game.c): ask (the log names the
// offer's number, which this setting or the menu accepts), always (every room, the save still copied first), or a number.
{"COOP_ACCEPT", "ask", 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
// 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_CHAT", "1", "0|1", LIVE},
// Advanced: scheduling
{"ASYNC_PREEMPT", "1", "0|1|2", RESTART}, {"REPLAY_ASYNC", "0", "0|1", RESTART},
{"REPLAY_PIPE", "0", "0..4", RESTART},
@@ -1196,7 +1186,7 @@ static void log_file_settings(void) {
char key[64];
snprintf(key, sizeof key, "%s", entries[i].key);
for (char *p = key; *p; p++) *p = (char)tolower((unsigned char)*p);
// a co-op room's secret, the relay, the player's name: only that they are set (cfg_private.h)
// a private setting (cfg_private.h): only that it is set
const char *value = cfg_private_key(entries[i].key) && entries[i].value[0] ? CFG_PRIVATE_SHOWN : entries[i].value;
size_t vl = strlen(value);
if (vl > 200) vl = 200; // a long value (a list of mods) is cut: the line shows that the key is set
@@ -1228,43 +1218,6 @@ static void load_ini(void) {
}
}
int cfg_ini_read(const char *path, const char *key, char *out, size_t cap) {
if (cap) out[0] = 0;
uint64_t size = 0;
uint8_t *data = plat_file_read(path, &size);
if (!data || !size) { // gone or empty for a moment (an editor saving it), or locked: no reading, not "no value"
free(data);
return -1;
}
int found = 0;
char *p = (char *)data;
if (size >= 3 && !memcmp(p, "\xEF\xBB\xBF", 3)) p += 3; // as cfg_load: editors add a BOM
for (;;) {
char *eol = strchr(p, '\n');
if (eol) *eol = 0;
char *s = trim(p), *eq = strchr(s, '=');
if (*s && *s != '#' && *s != ';' && *s != '[' && eq) {
*eq = 0;
const char *k = trim(s);
size_t i = 0;
while (k[i] && key[i] && tolower((unsigned char)k[i]) == tolower((unsigned char)key[i])) i++;
if (!k[i] && !key[i]) { // as cfg_load: a repeated key's later line wins, quotes go, "key =" sets nothing
char *v = trim(eq + 1);
size_t vl = strlen(v);
if (vl >= 2 && v[0] == '"' && v[vl - 1] == '"') v[vl - 1] = 0, v++;
snprintf(out, cap, "%s", v);
found = *v != 0;
}
}
if (!eol) break;
p = eol + 1;
}
free(data);
return found;
}
int cfg_ini_now(const char *key, char *out, size_t cap) { return find_ini() ? cfg_ini_read(ini_path, key, out, cap) : 0; }
void cfg_init(void) {
load_ini();
__atomic_store_n(&lowend, -1, __ATOMIC_RELEASE); // asked before the file was read: decided again (lowend_of)