From f7f35c73ffe5486e0ea4697424535514f96d2916 Mon Sep 17 00:00:00 2001 From: Solessfir <34831419+Solessfir@users.noreply.github.com> Date: Sat, 12 Sep 2026 17:15:57 +0200 Subject: [PATCH] Restore Ikarus runtime bindings after loading a save --- common/game/gamescript.h | 2 ++ common/game/gamesession.cpp | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/common/game/gamescript.h b/common/game/gamescript.h index 2cccb630b..8bd3dc740 100644 --- a/common/game/gamescript.h +++ b/common/game/gamescript.h @@ -75,6 +75,8 @@ class GameScript final { void savePerc(Serialize& fout); void loadPerc(Serialize& fin); + bool usesMemoryExtensions() const { return dma!=nullptr; } + inline auto& getVm() { return vm; } auto questLog() const -> const QuestLog&; diff --git a/common/game/gamesession.cpp b/common/game/gamesession.cpp index 6f5c5492e..e3b639812 100644 --- a/common/game/gamesession.cpp +++ b/common/game/gamesession.cpp @@ -165,6 +165,11 @@ GameSession::GameSession(Serialize &fin) { if(auto hero = wrld->player()) vm->setInstanceNPC("HERO",*hero); + // Saved variables do not restore Ikarus's transient parser and engine bindings. + // Reconnect those without replaying gameplay initialization or resetting NPC routines. + if(vm->usesMemoryExtensions()) + vm->getVm().call_function("MEM_InitAll"); + fin.setEntry("game/camera"); cam->load(fin,wrld->player()); Gothic::inst().setLoadingProgress(96);