Initialize OTRGlobals' Context early to prevent non-portable crash during asset archive lookup. (#5605)
This commit is contained in:
@@ -261,6 +261,10 @@ const char* constCameraStrings[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
OTRGlobals::OTRGlobals() {
|
OTRGlobals::OTRGlobals() {
|
||||||
|
context = Ship::Context::CreateUninitializedInstance("Ship of Harkinian", appShortName, "shipofharkinian.json");
|
||||||
|
}
|
||||||
|
|
||||||
|
void OTRGlobals::Initialize() {
|
||||||
std::vector<std::string> OTRFiles;
|
std::vector<std::string> OTRFiles;
|
||||||
std::string mqPath = Ship::Context::LocateFileAcrossAppDirs("oot-mq.otr", appShortName);
|
std::string mqPath = Ship::Context::LocateFileAcrossAppDirs("oot-mq.otr", appShortName);
|
||||||
if (std::filesystem::exists(mqPath)) {
|
if (std::filesystem::exists(mqPath)) {
|
||||||
@@ -300,8 +304,6 @@ OTRGlobals::OTRGlobals() {
|
|||||||
OOT_NTSC_JP_GC, OOT_NTSC_US_GC, OOT_PAL_GC, OOT_PAL_GC_DBG1, OOT_PAL_GC_DBG2,
|
OOT_NTSC_JP_GC, OOT_NTSC_US_GC, OOT_PAL_GC, OOT_PAL_GC_DBG1, OOT_PAL_GC_DBG2,
|
||||||
};
|
};
|
||||||
|
|
||||||
context = Ship::Context::CreateUninitializedInstance("Ship of Harkinian", appShortName, "shipofharkinian.json");
|
|
||||||
|
|
||||||
context->InitLogging();
|
context->InitLogging();
|
||||||
context->InitGfxDebugger();
|
context->InitGfxDebugger();
|
||||||
context->InitConfiguration();
|
context->InitConfiguration();
|
||||||
@@ -1100,7 +1102,7 @@ void CheckAndCreateModFolder() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
extern "C" void InitOTR() {
|
extern "C" void InitOTR() {
|
||||||
|
OTRGlobals::Instance = new OTRGlobals();
|
||||||
#ifdef __SWITCH__
|
#ifdef __SWITCH__
|
||||||
Ship::Switch::Init(Ship::PreInitPhase);
|
Ship::Switch::Init(Ship::PreInitPhase);
|
||||||
#elif defined(__WIIU__)
|
#elif defined(__WIIU__)
|
||||||
@@ -1207,7 +1209,7 @@ extern "C" void InitOTR() {
|
|||||||
DetectOTRVersion("oot.otr", false);
|
DetectOTRVersion("oot.otr", false);
|
||||||
DetectOTRVersion("oot-mq.otr", true);
|
DetectOTRVersion("oot-mq.otr", true);
|
||||||
|
|
||||||
OTRGlobals::Instance = new OTRGlobals();
|
OTRGlobals::Instance->Initialize();
|
||||||
CustomMessageManager::Instance = new CustomMessageManager();
|
CustomMessageManager::Instance = new CustomMessageManager();
|
||||||
ItemTableManager::Instance = new ItemTableManager();
|
ItemTableManager::Instance = new ItemTableManager();
|
||||||
GameInteractor::Instance = new GameInteractor();
|
GameInteractor::Instance = new GameInteractor();
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ class OTRGlobals {
|
|||||||
~OTRGlobals();
|
~OTRGlobals();
|
||||||
|
|
||||||
void ScaleImGui();
|
void ScaleImGui();
|
||||||
|
void Initialize();
|
||||||
bool HasMasterQuest();
|
bool HasMasterQuest();
|
||||||
bool HasOriginal();
|
bool HasOriginal();
|
||||||
uint32_t GetInterpolationFPS();
|
uint32_t GetInterpolationFPS();
|
||||||
|
|||||||
Reference in New Issue
Block a user