Live mod options: restart-only changes do not reach the running plugin

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Shokunin
2026-10-08 19:03:21 -07:00
parent 00671ce845
commit a32471d5fd
3 changed files with 13 additions and 7 deletions
+7 -4
View File
@@ -1099,17 +1099,20 @@ int main(int argc, char** argv) {
check(psx_mod_set_option_live("runtime.ram", "big-ram", "size", "four") == 0,
"without an option-changed callback a live set waits for restart");
check(psx_mod_option_value("runtime.ram", "big-ram", "size", value, sizeof(value)) == 1 &&
std::string(value) == "four",
"a live override must answer later reads");
std::string(value) == "eight",
"a restart-only change must not reach the running plugin");
check(!psx_mod_option_live_capable("runtime.ram", "big-ram"),
"no callback yet: not live-capable");
check(psx_mod_register_option_changed_plugin("runtime.big-ram", test_option_changed),
"option-changed hook must register");
check(psx_mod_option_live_capable("runtime.ram", "big-ram"),
"a registered callback makes the feature live-capable");
check(psx_mod_set_option_live("runtime.ram", "big-ram", "size", "eight") == 1 &&
option_changed_hits == 1 && option_changed_value == "eight",
check(psx_mod_set_option_live("runtime.ram", "big-ram", "size", "four") == 1 &&
option_changed_hits == 1 && option_changed_value == "four",
"the plugin must see the change in its own context");
check(psx_mod_option_value("runtime.ram", "big-ram", "size", value, sizeof(value)) == 1 &&
std::string(value) == "four",
"a live override must answer later reads");
check(psx_mod_set_option_live("runtime.ram", "no-such-feature", "size", "x") == 0,
"features outside the plan are not live-settable");
test_netplay_active = 1;