From a554a7c13c8eac3e998c06c2f5e1b0e070ba554e Mon Sep 17 00:00:00 2001 From: Valiantsin Dzerakh Date: Sat, 31 Oct 2026 19:56:48 +0300 Subject: [PATCH] Take the virtual core gate out of the settings menu The row was labelled "Virtual core gate" with the text "Lets only one thread run per virtual core, as on the console", but switching it on wrote free_cores = 1, which lifts the gate. Without the gate guest threads run in parallel on one virtual core, and TotK keeps its per-core data without locks: an Arc B580 player who turned it on crashed at every start with "CallCommands: command handle ... is not a live recording" (#212). free_cores stays an ini key for experiments; the log now says when it is set, and totk.ini.example warns that the game can crash. Co-Authored-By: Claude Opus 5.5 --- runtime/kernel.c | 3 +++ runtime/ui/menu.cpp | 1 - runtime/ui_text.c | 4 ---- runtime/ui_text.h | 1 - totk.ini.example | 3 ++- 5 files changed, 5 insertions(+), 7 deletions(-) diff --git a/runtime/kernel.c b/runtime/kernel.c index d879de9b..cd75797b 100644 --- a/runtime/kernel.c +++ b/runtime/kernel.c @@ -306,6 +306,9 @@ static void ap_init(void); static int cores_enabled(void) { if (g_cores_on < 0) { g_cores_on = !cfg_bool("TOTK_FREE_CORES"); // "0" keeps the gate, like unset + if (!g_cores_on) + rt_log("kernel: virtual core gate off (TOTK_FREE_CORES): guest threads run without the limit of one per " + "core that the game's per-core data needs; for experiments only, the game can fail"); diag_init(); ap_init(); } diff --git a/runtime/ui/menu.cpp b/runtime/ui/menu.cpp index b6c08720..ab351286 100644 --- a/runtime/ui/menu.cpp +++ b/runtime/ui/menu.cpp @@ -667,7 +667,6 @@ static void tab_advanced(float scale) { static const UiTextId preempt[] = {UI_MENU_PREEMPT_OFF, UI_MENU_PREEMPT_ON, UI_MENU_PREEMPT_INHERIT}; // 0|1|2 opt_choice("TOTK_ASYNC_PREEMPT", UI_MENU_ASYNC_PREEMPT, preempt, 3, UI_MENU_ASYNC_PREEMPT_DESC); opt_toggle("TOTK_REPLAY_ASYNC", UI_MENU_REPLAY_ASYNC, UI_MENU_REPLAY_ASYNC_DESC); - opt_toggle("TOTK_FREE_CORES", UI_MENU_FREE_CORES, UI_MENU_FREE_CORES_DESC); opt_toggle("TOTK_TIMER_1MS", UI_MENU_TIMER_1MS, UI_MENU_TIMER_1MS_DESC); opt_group(UI_MENU_GROUP_SHADERS); diff --git a/runtime/ui_text.c b/runtime/ui_text.c index a8ac7155..90b5f107 100644 --- a/runtime/ui_text.c +++ b/runtime/ui_text.c @@ -178,8 +178,6 @@ static const char *const text_en[UI_TEXT_COUNT] = { [UI_MENU_PREEMPT_OFF] = "Off", [UI_MENU_PREEMPT_ON] = "On", [UI_MENU_PREEMPT_INHERIT] = "Inheritance only", [UI_MENU_REPLAY_ASYNC] = "GPU frame prep on its own thread", [UI_MENU_REPLAY_ASYNC_DESC] = "Prepares frames for the GPU on a separate thread instead of the game thread. Adds up to one frame of latency.", - [UI_MENU_FREE_CORES] = "Virtual core gate", - [UI_MENU_FREE_CORES_DESC] = "Lets only one thread run per virtual core, as on the console.", [UI_MENU_TIMER_1MS] = "1 ms Windows timer", [UI_MENU_TIMER_1MS_DESC] = "Raises the system timer resolution to 1 ms for steadier frame pacing.", [UI_MENU_PIPE_WAIT] = "Waiting draw handling", @@ -427,8 +425,6 @@ static const char *const text_ru[UI_TEXT_COUNT] = { [UI_MENU_PREEMPT_OFF] = "Выкл.", [UI_MENU_PREEMPT_ON] = "Вкл.", [UI_MENU_PREEMPT_INHERIT] = "Только наследование", [UI_MENU_REPLAY_ASYNC] = "Подготовка кадра для GPU в отдельном потоке", [UI_MENU_REPLAY_ASYNC_DESC] = "Кадр для GPU готовится в отдельном потоке, а не в потоке игры. Добавляет до одного кадра задержки.", - [UI_MENU_FREE_CORES] = "Ограничение виртуальных ядер", - [UI_MENU_FREE_CORES_DESC] = "На каждом виртуальном ядре работает один поток, как на консоли.", [UI_MENU_TIMER_1MS] = "Таймер Windows 1 мс", [UI_MENU_TIMER_1MS_DESC] = "Повышает точность системного таймера до 1 мс для ровного темпа кадров.", [UI_MENU_PIPE_WAIT] = "Обработка ожидающих отрисовок", diff --git a/runtime/ui_text.h b/runtime/ui_text.h index b9e95194..a50c8f69 100644 --- a/runtime/ui_text.h +++ b/runtime/ui_text.h @@ -108,7 +108,6 @@ typedef enum { UI_MENU_ASYNC_PREEMPT, UI_MENU_ASYNC_PREEMPT_DESC, UI_MENU_PREEMPT_OFF, UI_MENU_PREEMPT_ON, UI_MENU_PREEMPT_INHERIT, UI_MENU_REPLAY_ASYNC, UI_MENU_REPLAY_ASYNC_DESC, - UI_MENU_FREE_CORES, UI_MENU_FREE_CORES_DESC, UI_MENU_TIMER_1MS, UI_MENU_TIMER_1MS_DESC, UI_MENU_PIPE_WAIT, UI_MENU_PIPE_WAIT_DESC, UI_MENU_PIPE_WAIT_DEFAULT, UI_MENU_PIPE_WAIT_DRAW, UI_MENU_PIPE_SKIP, UI_MENU_PIPE_SKIP_DESC, UI_MENU_PIPE_SKIP_STRICT, UI_MENU_PIPE_SKIP_ANY, diff --git a/totk.ini.example b/totk.ini.example index 2b8c5d7d..55e0bdbf 100644 --- a/totk.ini.example +++ b/totk.ini.example @@ -26,7 +26,8 @@ # async_preempt = 1 # Replay NVN submissions on their own thread, at most one frame behind the game (1 = on). Adds up to a frame of latency. # replay_async = 0 -# 1 lifts the virtual core gate: guest threads run without the console's limit of one thread per core. +# 1 lifts the virtual core gate: guest threads run without the console's limit of one thread per core. For experiments +# only: the game keeps per-core data without locks and can crash. # free_cores = 0 # Windows timer resolution of 1 ms for steadier frame pacing (0 = the Windows default). # timer_1ms = 1