diff --git a/loader/include/Geode/cocos/cocoa/CCObject.h b/loader/include/Geode/cocos/cocoa/CCObject.h index daeb19bf..baeb8bf9 100644 --- a/loader/include/Geode/cocos/cocoa/CCObject.h +++ b/loader/include/Geode/cocos/cocoa/CCObject.h @@ -47,14 +47,13 @@ NS_CC_BEGIN * @{ */ -RT_ADD( - // please someone tell we why in higher being(s)'s name rob did this - enum class CCObjectType { - PlayLayer = 5, - LevelEditorLayer = 6, - MenuLayer = 15, - }; -) +// please someone tell we why in higher being(s)'s name rob did this +enum class CCObjectType { + PlayLayer = 5, + LevelEditorLayer = 6, + GameObject = 13, + MenuLayer = 15, +}; class CCZone; class CCObject; diff --git a/loader/src/loader/ModImpl.cpp b/loader/src/loader/ModImpl.cpp index dc51c84a..4bb01c95 100644 --- a/loader/src/loader/ModImpl.cpp +++ b/loader/src/loader/ModImpl.cpp @@ -116,7 +116,9 @@ std::vector Mod::Impl::getHooks() const { // Settings and saved values Result<> Mod::Impl::loadData() { - ModStateEvent(m_self, ModEventType::DataLoaded).post(); + Loader::get()->queueInGDThread([&]() { + ModStateEvent(m_self, ModEventType::DataLoaded).post(); + }); // Settings // Check if settings exist @@ -182,6 +184,7 @@ Result<> Mod::Impl::loadData() { } Result<> Mod::Impl::saveData() { + // saveData is expected to be synchronous, and always called from GD thread ModStateEvent(m_self, ModEventType::DataSaved).post(); // Data saving should be fully fail-safe @@ -308,7 +311,9 @@ Result<> Mod::Impl::loadBinary() { LoaderImpl::get()->releaseNextMod(); - ModStateEvent(m_self, ModEventType::Loaded).post(); + Loader::get()->queueInGDThread([&]() { + ModStateEvent(m_self, ModEventType::Loaded).post(); + }); Loader::get()->updateAllDependencies(); @@ -329,7 +334,9 @@ Result<> Mod::Impl::unloadBinary() { GEODE_UNWRAP(this->saveData()); GEODE_UNWRAP(this->disable()); - ModStateEvent(m_self, ModEventType::Unloaded).post(); + Loader::get()->queueInGDThread([&]() { + ModStateEvent(m_self, ModEventType::Unloaded).post(); + }); // Disabling unhooks and unpatches already for (auto const& hook : m_hooks) { @@ -367,7 +374,9 @@ Result<> Mod::Impl::enable() { } } - ModStateEvent(m_self, ModEventType::Enabled).post(); + Loader::get()->queueInGDThread([&]() { + ModStateEvent(m_self, ModEventType::Enabled).post(); + }); m_enabled = true; return Ok(); @@ -381,7 +390,9 @@ Result<> Mod::Impl::disable() { return Err("Mod does not support disabling"); } - ModStateEvent(m_self, ModEventType::Disabled).post(); + Loader::get()->queueInGDThread([&]() { + ModStateEvent(m_self, ModEventType::Disabled).post(); + }); for (auto const& hook : m_hooks) { GEODE_UNWRAP(this->disableHook(hook));