Created
July 7, 2026 08:05
-
-
Save hsjunnesson/a3b09bed5b83cf0749ec192bc0bd3b93 to your computer and use it in GitHub Desktop.
Live++ Defold Patch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/engine/engine/src/engine.cpp b/engine/engine/src/engine.cpp | |
| index b1e3e0585c4669488f3825121fe560dfb9fb5dde..90bfd8862c6f0d30fb938d3196acf7dfbfeb9f94 100644 | |
| --- a/engine/engine/src/engine.cpp | |
| +++ b/engine/engine/src/engine.cpp | |
| @@ -73,6 +73,9 @@ | |
| #include "engine_web.h" | |
| #endif | |
| +#if defined(HAS_LIVEPP) | |
| + #include <LPP_API_x64_CPP.h> | |
| +#endif | |
| // Embedded resources | |
| // Unfortunately, the draw_line et. al are used in production code | |
| @@ -2246,6 +2249,19 @@ bail: | |
| void Step(HEngine engine) | |
| { | |
| +#if defined(HAS_LIVEPP) | |
| + engine->m_didReload = false; | |
| + | |
| + if (engine->m_lppAgent.WantsReload(lpp::LPP_RELOAD_OPTION_SYNCHRONIZE_WITH_RELOAD)) { | |
| + engine->m_lppAgent.Reload(lpp::LPP_RELOAD_BEHAVIOUR_WAIT_UNTIL_CHANGES_ARE_APPLIED); | |
| + engine->m_didReload = true; | |
| + } | |
| + | |
| + if (engine->m_lppAgent.WantsRestart()) { | |
| + engine->m_lppAgent.Restart(lpp::LPP_RESTART_BEHAVIOUR_INSTANT_TERMINATION, 0, NULL); | |
| + } | |
| +#endif | |
| + | |
| engine->m_Alive = true; | |
| engine->m_RunResult.m_ExitCode = 0; | |
| engine->m_RunResult.m_Action = dmEngine::RunResult::NONE; | |
| diff --git a/engine/engine/src/engine_loop.cpp b/engine/engine/src/engine_loop.cpp | |
| index 8312fb007c16680a1df1dbd07b81f43464c8ac8a..239f81e154fccb2f1b8f0514fc49c52c9338cc31 100644 | |
| --- a/engine/engine/src/engine_loop.cpp | |
| +++ b/engine/engine/src/engine_loop.cpp | |
| @@ -21,6 +21,10 @@ | |
| #include <emscripten/emscripten.h> | |
| #endif | |
| +#if defined(HAS_LIVEPP) | |
| + #include <LPP_API_x64_CPP.h> | |
| +#endif | |
| + | |
| namespace dmEngine | |
| { | |
| @@ -74,6 +78,16 @@ namespace dmEngine | |
| exit_code = 1; | |
| break; | |
| } | |
| + | |
| +#if defined(HAS_LIVEPP) | |
| + engine->m_lppAgent = lpp::LppCreateSynchronizedAgent(nullptr, L"../../../../LivePP"); | |
| + if (!lpp::LppIsValidSynchronizedAgent(&engine->m_lppAgent)) { | |
| + exit_code = 1; | |
| + break; | |
| + } | |
| + | |
| + engine->m_lppAgent.EnableModule(lpp::LppGetCurrentModulePath(), lpp::LPP_MODULES_OPTION_ALL_IMPORT_MODULES, nullptr, nullptr); | |
| +#endif | |
| } | |
| #ifdef __EMSCRIPTEN__ | |
| @@ -104,6 +118,10 @@ namespace dmEngine | |
| allocated_argc = argc; | |
| } | |
| +#if defined(HAS_LIVEPP) | |
| + lpp::LppDestroySynchronizedAgent(&engine->m_lppAgent); | |
| +#endif | |
| + | |
| params->m_EngineDestroy(engine); | |
| engine = 0; | |
| @@ -123,7 +141,7 @@ namespace dmEngine | |
| free(allocated_argv[i]); | |
| } | |
| free(allocated_argv); | |
| - | |
| + | |
| return exit_code; | |
| } | |
| diff --git a/engine/engine/src/engine_private.h b/engine/engine/src/engine_private.h | |
| index 2f21105bf01b631e1449092fe9ca0104d7484e02..9d8653afa4959ffb4496ac59e049e0e5cc534f20 100644 | |
| --- a/engine/engine/src/engine_private.h | |
| +++ b/engine/engine/src/engine_private.h | |
| @@ -43,6 +43,10 @@ | |
| #include "engine.h" | |
| #include <engine/engine_ddf.h> | |
| +#if defined(HAS_LIVEPP) | |
| + #include <LPP_API_x64_CPP.h> | |
| +#endif | |
| + | |
| namespace dmGameSystem | |
| { | |
| struct FontResource; | |
| @@ -181,6 +185,11 @@ namespace dmEngine | |
| RecordData m_RecordData; | |
| uint8_t m_GuiSafeAreaMode; | |
| + | |
| +#if defined(HAS_LIVEPP) | |
| + lpp::LppSynchronizedAgent m_lppAgent; | |
| + bool m_didReload; | |
| +#endif | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment