mirror of
https://github.com/OpenRCT2/OpenRCT2.git
synced 2025-01-22 10:21:57 -05: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:
parent
bc0f6c4489
commit
4bfd3f3369
8 changed files with 29 additions and 10 deletions
|
@ -3719,6 +3719,7 @@ STR_6644 :Touch enhancements
|
|||
STR_6645 :Makes some UI elements bigger so they are easier to click or tap.
|
||||
STR_6646 :Author: {STRING}
|
||||
STR_6647 :Authors: {STRING}
|
||||
STR_6648 :Loading plugin engine…
|
||||
|
||||
#############
|
||||
# Scenarios #
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
- 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: [#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.
|
||||
|
||||
0.4.12 (2024-07-07)
|
||||
|
|
|
@ -131,7 +131,7 @@ public:
|
|||
SDL_QuitSubSystem(SDL_INIT_VIDEO);
|
||||
}
|
||||
|
||||
void Initialise() override
|
||||
void InitialiseScriptExtensions() override
|
||||
{
|
||||
#ifdef ENABLE_SCRIPTING
|
||||
auto& scriptEngine = GetContext()->GetScriptEngine();
|
||||
|
|
|
@ -523,18 +523,14 @@ namespace OpenRCT2
|
|||
|
||||
// TODO: preload the title scene in another (parallel) job.
|
||||
preloaderScene->AddJob([this]() { InitialiseRepositories(); });
|
||||
preloaderScene->AddJob([this]() { InitialiseScriptEngine(); });
|
||||
}
|
||||
else
|
||||
{
|
||||
InitialiseRepositories();
|
||||
InitialiseScriptEngine();
|
||||
}
|
||||
|
||||
#ifdef ENABLE_SCRIPTING
|
||||
_scriptEngine.Initialise();
|
||||
#endif
|
||||
|
||||
_uiContext->Initialise();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -574,6 +570,17 @@ namespace OpenRCT2
|
|||
OpenProgress(STR_LOADING_GENERIC);
|
||||
}
|
||||
|
||||
void InitialiseScriptEngine()
|
||||
{
|
||||
#ifdef ENABLE_SCRIPTING
|
||||
OpenProgress(STR_LOADING_PLUGIN_ENGINE);
|
||||
_scriptEngine.Initialise();
|
||||
_uiContext->InitialiseScriptExtensions();
|
||||
|
||||
OpenProgress(STR_LOADING_GENERIC);
|
||||
#endif
|
||||
}
|
||||
|
||||
public:
|
||||
void InitialiseDrawingEngine() final override
|
||||
{
|
||||
|
@ -1349,7 +1356,10 @@ namespace OpenRCT2
|
|||
|
||||
ChatUpdate();
|
||||
#ifdef ENABLE_SCRIPTING
|
||||
_scriptEngine.Tick();
|
||||
if (GetActiveScene() != GetPreloaderScene())
|
||||
{
|
||||
_scriptEngine.Tick();
|
||||
}
|
||||
#endif
|
||||
_stdInOutConsole.ProcessEvalQueue();
|
||||
_uiContext->Tick();
|
||||
|
|
|
@ -1692,6 +1692,8 @@ enum : StringId
|
|||
STR_STRING_M_OF_N = 6642,
|
||||
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
|
||||
/* 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()
|
||||
{
|
||||
if (!_initialised)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
PROFILED_FUNCTION();
|
||||
|
||||
CheckAndStartPlugins();
|
||||
|
|
|
@ -24,7 +24,7 @@ namespace OpenRCT2::Ui
|
|||
std::unique_ptr<IWindowManager> const _windowManager = CreateDummyWindowManager();
|
||||
|
||||
public:
|
||||
void Initialise() override
|
||||
void InitialiseScriptExtensions() override
|
||||
{
|
||||
}
|
||||
void Tick() override
|
||||
|
|
|
@ -99,7 +99,7 @@ namespace OpenRCT2
|
|||
{
|
||||
virtual ~IUiContext() = default;
|
||||
|
||||
virtual void Initialise() abstract;
|
||||
virtual void InitialiseScriptExtensions() abstract;
|
||||
virtual void Tick() abstract;
|
||||
virtual void Draw(DrawPixelInfo& dpi) abstract;
|
||||
|
||||
|
|
Loading…
Reference in a new issue