mirror of
https://github.com/geode-sdk/geode.git
synced 2024-11-23 07:57:51 -05:00
Merge branch 'tulip-hook' of https://github.com/geode-sdk/geode into tulip-hook
This commit is contained in:
commit
7f52356955
5 changed files with 31 additions and 9 deletions
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -134,6 +134,7 @@ namespace geode {
|
|||
bool isReadyToHook() const;
|
||||
void addInternalHook(Hook* hook, Mod* mod);
|
||||
|
||||
Mod* createInternalMod();
|
||||
void setupInternalMod();
|
||||
};
|
||||
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
}
|
|
@ -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 "
|
||||
|
|
Loading…
Reference in a new issue