mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2025-12-24 00:03:11 +01:00
Initialise script engine off main thread (#22230)
* Initialise script engine off main thread * Do not run ScriptEngine.Tick() during initialisation/preloading * Add 'Loading plugin engine…' string * Add changelog entry --------- Co-authored-by: Bas <Basssiiie@users.noreply.github.com>
This commit is contained in:
@@ -3719,6 +3719,7 @@ STR_6644 :Touch enhancements
|
|||||||
STR_6645 :Makes some UI elements bigger so they are easier to click or tap.
|
STR_6645 :Makes some UI elements bigger so they are easier to click or tap.
|
||||||
STR_6646 :Author: {STRING}
|
STR_6646 :Author: {STRING}
|
||||||
STR_6647 :Authors: {STRING}
|
STR_6647 :Authors: {STRING}
|
||||||
|
STR_6648 :Loading plugin engine…
|
||||||
|
|
||||||
#############
|
#############
|
||||||
# Scenarios #
|
# Scenarios #
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
- Feature: [#20832] The ride music tab now shows a track listing for the current music style.
|
- Feature: [#20832] The ride music tab now shows a track listing for the current music style.
|
||||||
- Feature: [#22172] [Plugin] Expose ride satisfaction ratings to the plugin API.
|
- Feature: [#22172] [Plugin] Expose ride satisfaction ratings to the plugin API.
|
||||||
- Feature: [#22213] [Plugin] Allow plugins to focus on textboxes in custom windows.
|
- Feature: [#22213] [Plugin] Allow plugins to focus on textboxes in custom windows.
|
||||||
|
- Change: [#22230] The plugin/script engine is now initialised off the main thread.
|
||||||
- Change: [#22251] Hide author info in the scenery window unless debug tools are active.
|
- Change: [#22251] Hide author info in the scenery window unless debug tools are active.
|
||||||
|
|
||||||
0.4.12 (2024-07-07)
|
0.4.12 (2024-07-07)
|
||||||
|
|||||||
@@ -131,7 +131,7 @@ public:
|
|||||||
SDL_QuitSubSystem(SDL_INIT_VIDEO);
|
SDL_QuitSubSystem(SDL_INIT_VIDEO);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Initialise() override
|
void InitialiseScriptExtensions() override
|
||||||
{
|
{
|
||||||
#ifdef ENABLE_SCRIPTING
|
#ifdef ENABLE_SCRIPTING
|
||||||
auto& scriptEngine = GetContext()->GetScriptEngine();
|
auto& scriptEngine = GetContext()->GetScriptEngine();
|
||||||
|
|||||||
@@ -523,18 +523,14 @@ namespace OpenRCT2
|
|||||||
|
|
||||||
// TODO: preload the title scene in another (parallel) job.
|
// TODO: preload the title scene in another (parallel) job.
|
||||||
preloaderScene->AddJob([this]() { InitialiseRepositories(); });
|
preloaderScene->AddJob([this]() { InitialiseRepositories(); });
|
||||||
|
preloaderScene->AddJob([this]() { InitialiseScriptEngine(); });
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
InitialiseRepositories();
|
InitialiseRepositories();
|
||||||
|
InitialiseScriptEngine();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_SCRIPTING
|
|
||||||
_scriptEngine.Initialise();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
_uiContext->Initialise();
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -574,6 +570,17 @@ namespace OpenRCT2
|
|||||||
OpenProgress(STR_LOADING_GENERIC);
|
OpenProgress(STR_LOADING_GENERIC);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void InitialiseScriptEngine()
|
||||||
|
{
|
||||||
|
#ifdef ENABLE_SCRIPTING
|
||||||
|
OpenProgress(STR_LOADING_PLUGIN_ENGINE);
|
||||||
|
_scriptEngine.Initialise();
|
||||||
|
_uiContext->InitialiseScriptExtensions();
|
||||||
|
|
||||||
|
OpenProgress(STR_LOADING_GENERIC);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void InitialiseDrawingEngine() final override
|
void InitialiseDrawingEngine() final override
|
||||||
{
|
{
|
||||||
@@ -1349,7 +1356,10 @@ namespace OpenRCT2
|
|||||||
|
|
||||||
ChatUpdate();
|
ChatUpdate();
|
||||||
#ifdef ENABLE_SCRIPTING
|
#ifdef ENABLE_SCRIPTING
|
||||||
_scriptEngine.Tick();
|
if (GetActiveScene() != GetPreloaderScene())
|
||||||
|
{
|
||||||
|
_scriptEngine.Tick();
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
_stdInOutConsole.ProcessEvalQueue();
|
_stdInOutConsole.ProcessEvalQueue();
|
||||||
_uiContext->Tick();
|
_uiContext->Tick();
|
||||||
|
|||||||
@@ -1692,6 +1692,8 @@ enum : StringId
|
|||||||
STR_STRING_M_OF_N = 6642,
|
STR_STRING_M_OF_N = 6642,
|
||||||
STR_STRING_M_OF_N_KIB = 6643,
|
STR_STRING_M_OF_N_KIB = 6643,
|
||||||
|
|
||||||
|
STR_LOADING_PLUGIN_ENGINE = 6648,
|
||||||
|
|
||||||
// Have to include resource strings (from scenarios and objects) for the time being now that language is partially working
|
// Have to include resource strings (from scenarios and objects) for the time being now that language is partially working
|
||||||
/* MAX_STR_COUNT = 32768 */ // MAX_STR_COUNT - upper limit for number of strings, not the current count strings
|
/* MAX_STR_COUNT = 32768 */ // MAX_STR_COUNT - upper limit for number of strings, not the current count strings
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -913,6 +913,11 @@ bool ScriptEngine::ShouldStartPlugin(const std::shared_ptr<Plugin>& plugin)
|
|||||||
|
|
||||||
void ScriptEngine::Tick()
|
void ScriptEngine::Tick()
|
||||||
{
|
{
|
||||||
|
if (!_initialised)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
PROFILED_FUNCTION();
|
PROFILED_FUNCTION();
|
||||||
|
|
||||||
CheckAndStartPlugins();
|
CheckAndStartPlugins();
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ namespace OpenRCT2::Ui
|
|||||||
std::unique_ptr<IWindowManager> const _windowManager = CreateDummyWindowManager();
|
std::unique_ptr<IWindowManager> const _windowManager = CreateDummyWindowManager();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void Initialise() override
|
void InitialiseScriptExtensions() override
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
void Tick() override
|
void Tick() override
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ namespace OpenRCT2
|
|||||||
{
|
{
|
||||||
virtual ~IUiContext() = default;
|
virtual ~IUiContext() = default;
|
||||||
|
|
||||||
virtual void Initialise() abstract;
|
virtual void InitialiseScriptExtensions() abstract;
|
||||||
virtual void Tick() abstract;
|
virtual void Tick() abstract;
|
||||||
virtual void Draw(DrawPixelInfo& dpi) abstract;
|
virtual void Draw(DrawPixelInfo& dpi) abstract;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user