Avoid re-initializing game_main

This commit is contained in:
Luke Street
2026-04-10 16:45:51 -06:00
parent 6deee934b5
commit ce727b71fb
2 changed files with 11 additions and 2 deletions
+2 -2
View File
@@ -20,7 +20,7 @@ using json = nlohmann::json;
aurora::Module DuskConfigLog("dusk::config");
static absl::flat_hash_map<std::string_view, ConfigVarBase*> RegisteredConfigVars;
static bool RegistrationDone;
static bool RegistrationDone = false;
static std::string GetConfigJsonPath() {
return fmt::format("{}{}", configPath, ConfigFileName);
@@ -219,4 +219,4 @@ ConfigVarBase* dusk::config::GetConfigVar(std::string_view name) {
}
return nullptr;
}
}
+9
View File
@@ -366,10 +366,19 @@ static constexpr PADDefaultMapping defaultPadMapping = {
},
};
static bool mainCalled = false;
// =========================================================================
// PC ENTRY POINT
// =========================================================================
int game_main(int argc, char* argv[]) {
// On iOS, when connected to an external monitor, SDLUIKitSceneDelegate scene:willConnectToSession:
// can call our main function again. Explicitly guard against this reinitialization.
if (mainCalled) {
return 0;
}
mainCalled = true;
dusk::registerSettings();
dusk::config::FinishRegistration();