Merge branch 'tulip-hook' of https://github.com/geode-sdk/geode into tulip-hook

This commit is contained in:
HJfod 2023-01-21 19:02:59 +02:00
commit 7f52356955
5 changed files with 31 additions and 9 deletions

View file

@ -3799,6 +3799,7 @@ class LevelSettingsObject : cocos2d::CCNode {
int m_groundIndex;
int m_fontIndex;
bool m_startsWithStartPos;
bool m_isFlipped;
GJGameLevel* m_level;
gd::string m_guidelineString;
int m_unknown;

View file

@ -591,13 +591,14 @@ ResourceDownloadFilter::ResourceDownloadFilter() {}
void Loader::Impl::provideNextMod(Mod* mod) {
m_nextModLock.lock();
m_nextMod = mod;
if (mod) {
m_nextMod = mod;
}
}
Mod* Loader::Impl::takeNextMod() {
if (!m_nextMod) {
this->setupInternalMod();
m_nextMod = Mod::sharedMod<>;
m_nextMod = this->createInternalMod();
}
auto ret = m_nextMod;
return ret;

View file

@ -134,6 +134,7 @@ namespace geode {
bool isReadyToHook() const;
void addInternalHook(Hook* hook, Mod* mod);
Mod* createInternalMod();
void setupInternalMod();
};

View file

@ -670,8 +670,17 @@ static ModInfo getModImplInfo() {
}
}
void Loader::Impl::setupInternalMod() {
Mod* Loader::Impl::createInternalMod() {
auto& mod = Mod::sharedMod<>;
if (mod) return;
mod = new Mod(getModImplInfo());
if (!mod) {
mod = new Mod(getModImplInfo());
}
return mod;
}
void Loader::Impl::setupInternalMod() {
auto setupRes = Mod::get()->m_impl->setup();
if (!setupRes) {
log::error("Failed to setup internal mod! ({})", setupRes.unwrapErr());
}
}

View file

@ -176,9 +176,19 @@ int geodeEntry(void* platformData) {
return 1;
}
// set up internal mod, settings and data
if (!LoaderImpl::get()->setupInternalMod()) {
LoaderImpl::get()->platformMessageBox(
"Unable to Load Geode!",
"There was an unknown fatal error setting up "
"the internal mod and Geode can not be loaded."
);
LoaderImpl::get()->reset();
return 1;
}
// set up loader, load mods, etc.
auto setupRes = LoaderImpl::get()->setup();
if (!setupRes) {
if (!LoaderImpl::get()->setup()) {
LoaderImpl::get()->platformMessageBox(
"Unable to Load Geode!",
"There was an unknown fatal error setting up "