mirror of
https://github.com/valentderah/totk-pc-recomp.git
synced 2026-11-19 12:25:56 +00:00
Rebuild the game at start when an enabled mod has unbuilt code cheats
Code cheats need the game lifted and compiled with them. Running the setup again did that, but it lifted and compiled everything and prepared the shaders again. - The setup keeps the generated C and the objects in its temp folder (about 1.3 GB). gen.py rewrites only the chunks whose C changed, so Ninja recompiles only those. One new code cheat on 1.4.3 took a 47 s lift and 19 s of compile and link on 24 cores. - Prepare's key no longer follows the compile key, only the runtime, the translator and the game version, so a rebuild keeps the prepared shaders. - The cleanup writes build-cache/rebuild.txt, the command that opens the setup window in a new --rebuild mode on the install folder. That mode runs at once and starts the game again when it succeeds. - At start, runtime/cheats.c runs that command and exits when an enabled mod has code cheats the build lacks (plat_spawn, new for Windows and Linux). build-cache/rebuild.skip keeps a failed or cancelled rebuild from starting again for the same cheats. "Rebuild the game now" on the Cheats tab tries again, and [mods] mods_rebuild = off turns the rebuild off. Scripted runs never start it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
3dd7f846b8
commit
1bebcfd9ef
21 files changed
+337
-48
No files matched your search
+16
-4
@@ -56,7 +56,7 @@ double frame_step_limit_hz(void);
|
||||
extern const int rt_game_version;
|
||||
extern const char rt_port_version[];
|
||||
void cheats_frame(uint64_t frame); // cheats.c
|
||||
void tab_cheats(float scale); // ui/cheats_tab.cpp
|
||||
bool tab_cheats(float scale); // ui/cheats_tab.cpp; true: restart into the rebuild
|
||||
}
|
||||
|
||||
// Roboto Medium (Apache-2.0, ui/fonts/LICENSE-Roboto.txt) with Latin and Cyrillic glyphs.
|
||||
@@ -771,7 +771,9 @@ static const char *prompts_note(bool *restart) {
|
||||
|
||||
// The confirmation of "Restart now", over the menu; Cancel has the cursor first. Restart writes totk.ini, then closes
|
||||
// the game as Quit does and starts it again (gfx_window_request_restart). It waits while the game writes a save, and
|
||||
// the game stays when totk.ini cannot be written, as the new prompts would not come back.
|
||||
// the game stays when totk.ini cannot be written, as the new prompts would not come back. From the Cheats tab
|
||||
// (restart_rebuild) Restart also lets the next start rebuild for cheats whose last rebuild failed (cheats_rebuild_allow).
|
||||
static bool restart_rebuild;
|
||||
static void restart_confirm(void) {
|
||||
g_modal = false;
|
||||
ImGui::SetNextWindowPos(ImGui::GetMainViewport()->GetCenter(), ImGuiCond_Always, ImVec2(0.5f, 0.5f));
|
||||
@@ -792,12 +794,16 @@ static void restart_confirm(void) {
|
||||
if (ImGui::IsWindowAppearing()) ImGui::SetItemDefaultFocus();
|
||||
ImGui::SameLine();
|
||||
ImGui::BeginDisabled(saving);
|
||||
if (ImGui::Button(yes, ImVec2(bw, 0)) && cfg_save()) gfx_window_request_restart();
|
||||
if (ImGui::Button(yes, ImVec2(bw, 0)) && cfg_save()) {
|
||||
if (restart_rebuild) cheats_rebuild_allow();
|
||||
gfx_window_request_restart();
|
||||
}
|
||||
ImGui::EndDisabled();
|
||||
if (ImGui::IsKeyPressed(ImGuiKey_Escape, false) || ImGui::IsKeyPressed(ImGuiKey_GamepadFaceRight, false))
|
||||
close = true;
|
||||
if (close) {
|
||||
ImGui::CloseCurrentPopup();
|
||||
restart_rebuild = false;
|
||||
opt_focus_key("##restart"); // back on the row it came from
|
||||
}
|
||||
ImGui::EndPopup();
|
||||
@@ -1140,7 +1146,13 @@ static void layout_menu(uint32_t w, uint32_t h, float scale) {
|
||||
case TAB_CONTROLS: tab_controls(scale); break;
|
||||
case TAB_AMIIBO: tab_amiibo(scale); break;
|
||||
case TAB_MENU: tab_menu(scale); break;
|
||||
case TAB_CHEATS: tab_cheats(scale); break;
|
||||
case TAB_CHEATS:
|
||||
if (tab_cheats(scale)) {
|
||||
restart_rebuild = true;
|
||||
ImGui::OpenPopup("##restart_confirm");
|
||||
}
|
||||
restart_confirm();
|
||||
break;
|
||||
case TAB_ADVANCED: tab_advanced(scale); break;
|
||||
}
|
||||
ImGui::EndTabItem();
|
||||
|
||||
Reference in new issue
Block a user