mirror of
https://github.com/geode-sdk/geode.git
synced 2024-12-02 12:17:10 -05:00
Merge branch '1.2.0-dev' of https://github.com/geode-sdk/geode into 1.2.0-dev
This commit is contained in:
commit
d6ef0a9650
10 changed files with 24 additions and 19 deletions
|
@ -101,7 +101,8 @@ namespace geode {
|
||||||
void updateResources();
|
void updateResources();
|
||||||
void updateResources(bool forceReload);
|
void updateResources(bool forceReload);
|
||||||
|
|
||||||
void queueInGDThread(ScheduledFunction func);
|
[[deprecated("use queueInMainThread instead")]] void queueInGDThread(ScheduledFunction func);
|
||||||
|
void queueInMainThread(ScheduledFunction func);
|
||||||
void waitForModsToBeLoaded();
|
void waitForModsToBeLoaded();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -91,7 +91,7 @@ struct CustomLoadingLayer : Modify<CustomLoadingLayer, LoadingLayer> {
|
||||||
void loadAssets() {
|
void loadAssets() {
|
||||||
if (Loader::get()->getLoadingState() != Loader::LoadingState::Done) {
|
if (Loader::get()->getLoadingState() != Loader::LoadingState::Done) {
|
||||||
this->updateLoadedModsLabel();
|
this->updateLoadedModsLabel();
|
||||||
Loader::get()->queueInGDThread([this]() {
|
Loader::get()->queueInMainThread([this]() {
|
||||||
this->loadAssets();
|
this->loadAssets();
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -668,7 +668,7 @@ void Index::Impl::installNext(size_t index, IndexInstallList const& list) {
|
||||||
}
|
}
|
||||||
|
|
||||||
auto const& eventModID = list.target->getMetadata().getID();
|
auto const& eventModID = list.target->getMetadata().getID();
|
||||||
Loader::get()->queueInGDThread([eventModID]() {
|
Loader::get()->queueInMainThread([eventModID]() {
|
||||||
ModInstallEvent(eventModID, UpdateFinished()).post();
|
ModInstallEvent(eventModID, UpdateFinished()).post();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -741,7 +741,7 @@ void Index::Impl::installNext(size_t index, IndexInstallList const& list) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Index::cancelInstall(IndexItemHandle item) {
|
void Index::cancelInstall(IndexItemHandle item) {
|
||||||
Loader::get()->queueInGDThread([this, item]() {
|
Loader::get()->queueInMainThread([this, item]() {
|
||||||
if (m_impl->m_runningInstallations.count(item)) {
|
if (m_impl->m_runningInstallations.count(item)) {
|
||||||
m_impl->m_runningInstallations.at(item)->cancel();
|
m_impl->m_runningInstallations.at(item)->cancel();
|
||||||
m_impl->m_runningInstallations.erase(item);
|
m_impl->m_runningInstallations.erase(item);
|
||||||
|
@ -750,13 +750,13 @@ void Index::cancelInstall(IndexItemHandle item) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Index::install(IndexInstallList const& list) {
|
void Index::install(IndexInstallList const& list) {
|
||||||
Loader::get()->queueInGDThread([this, list]() {
|
Loader::get()->queueInMainThread([this, list]() {
|
||||||
m_impl->installNext(0, list);
|
m_impl->installNext(0, list);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void Index::install(IndexItemHandle item) {
|
void Index::install(IndexItemHandle item) {
|
||||||
Loader::get()->queueInGDThread([this, item]() {
|
Loader::get()->queueInMainThread([this, item]() {
|
||||||
if (m_impl->m_runningInstallations.count(item)) {
|
if (m_impl->m_runningInstallations.count(item)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -112,7 +112,11 @@ void Loader::updateResources(bool forceReload) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Loader::queueInGDThread(ScheduledFunction func) {
|
void Loader::queueInGDThread(ScheduledFunction func) {
|
||||||
return m_impl->queueInGDThread(func);
|
return m_impl->queueInMainThread(func);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Loader::queueInMainThread(ScheduledFunction func) {
|
||||||
|
return m_impl->queueInMainThread(func);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Loader::waitForModsToBeLoaded() {
|
void Loader::waitForModsToBeLoaded() {
|
||||||
|
|
|
@ -347,7 +347,7 @@ void Loader::Impl::populateModList(std::vector<ModMetadata>& modQueue) {
|
||||||
|
|
||||||
m_mods.insert({metadata.getID(), mod});
|
m_mods.insert({metadata.getID(), mod});
|
||||||
|
|
||||||
queueInGDThread([this, mod]() {
|
queueInMainThread([this, mod]() {
|
||||||
auto searchPath = dirs::getModRuntimeDir() / mod->getID() / "resources";
|
auto searchPath = dirs::getModRuntimeDir() / mod->getID() / "resources";
|
||||||
CCFileUtils::get()->addSearchPath(searchPath.string().c_str());
|
CCFileUtils::get()->addSearchPath(searchPath.string().c_str());
|
||||||
updateModResources(mod);
|
updateModResources(mod);
|
||||||
|
@ -579,7 +579,7 @@ void Loader::Impl::refreshModGraph() {
|
||||||
else
|
else
|
||||||
m_loadingState = LoadingState::Mods;
|
m_loadingState = LoadingState::Mods;
|
||||||
|
|
||||||
queueInGDThread([]() {
|
queueInMainThread([]() {
|
||||||
Loader::get()->m_impl->continueRefreshModGraph();
|
Loader::get()->m_impl->continueRefreshModGraph();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -619,7 +619,7 @@ void Loader::Impl::continueRefreshModGraph() {
|
||||||
log::info("Took {}s", static_cast<float>(time) / 1000.f);
|
log::info("Took {}s", static_cast<float>(time) / 1000.f);
|
||||||
|
|
||||||
if (m_loadingState != LoadingState::Done) {
|
if (m_loadingState != LoadingState::Done) {
|
||||||
queueInGDThread([]() {
|
queueInMainThread([]() {
|
||||||
Loader::get()->m_impl->continueRefreshModGraph();
|
Loader::get()->m_impl->continueRefreshModGraph();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -675,7 +675,7 @@ bool Loader::Impl::loadHooks() {
|
||||||
return !thereWereErrors;
|
return !thereWereErrors;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Loader::Impl::queueInGDThread(ScheduledFunction func) {
|
void Loader::Impl::queueInMainThread(ScheduledFunction func) {
|
||||||
std::lock_guard<std::mutex> lock(m_gdThreadMutex);
|
std::lock_guard<std::mutex> lock(m_gdThreadMutex);
|
||||||
m_gdThreadQueue.push_back(func);
|
m_gdThreadQueue.push_back(func);
|
||||||
}
|
}
|
||||||
|
|
|
@ -158,7 +158,7 @@ namespace geode {
|
||||||
|
|
||||||
json::Value processRawIPC(void* rawHandle, std::string const& buffer);
|
json::Value processRawIPC(void* rawHandle, std::string const& buffer);
|
||||||
|
|
||||||
void queueInGDThread(ScheduledFunction func);
|
void queueInMainThread(ScheduledFunction func);
|
||||||
void executeGDThreadQueue();
|
void executeGDThreadQueue();
|
||||||
|
|
||||||
void logConsoleMessage(std::string const& msg);
|
void logConsoleMessage(std::string const& msg);
|
||||||
|
|
|
@ -155,7 +155,7 @@ std::vector<Hook*> Mod::Impl::getHooks() const {
|
||||||
// Settings and saved values
|
// Settings and saved values
|
||||||
|
|
||||||
Result<> Mod::Impl::loadData() {
|
Result<> Mod::Impl::loadData() {
|
||||||
Loader::get()->queueInGDThread([&]() {
|
Loader::get()->queueInMainThread([&]() {
|
||||||
ModStateEvent(m_self, ModEventType::DataLoaded).post();
|
ModStateEvent(m_self, ModEventType::DataLoaded).post();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -227,7 +227,7 @@ void ModCell::onEnable(CCObject* sender) {
|
||||||
else {
|
else {
|
||||||
tryOrAlert(m_mod->disable(), "Error disabling mod");
|
tryOrAlert(m_mod->disable(), "Error disabling mod");
|
||||||
}
|
}
|
||||||
Loader::get()->queueInGDThread([this]() {
|
Loader::get()->queueInMainThread([this]() {
|
||||||
if (m_layer) {
|
if (m_layer) {
|
||||||
m_layer->updateAllStates();
|
m_layer->updateAllStates();
|
||||||
}
|
}
|
||||||
|
|
|
@ -602,7 +602,7 @@ Result<> file::watchFile(ghc::filesystem::path const& file) {
|
||||||
auto watcher = std::make_unique<FileWatcher>(
|
auto watcher = std::make_unique<FileWatcher>(
|
||||||
file,
|
file,
|
||||||
[](auto const& path) {
|
[](auto const& path) {
|
||||||
Loader::get()->queueInGDThread([=] {
|
Loader::get()->queueInMainThread([=] {
|
||||||
FileWatchEvent(path).post();
|
FileWatchEvent(path).post();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -277,7 +277,7 @@ SentAsyncWebRequest::Impl::Impl(SentAsyncWebRequest* self, AsyncWebRequest const
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
Loader::get()->queueInGDThread([self = data->self, now, total]() {
|
Loader::get()->queueInMainThread([self = data->self, now, total]() {
|
||||||
std::lock_guard _(self->m_mutex);
|
std::lock_guard _(self->m_mutex);
|
||||||
for (auto& prog : self->m_progresses) {
|
for (auto& prog : self->m_progresses) {
|
||||||
prog(*self->m_self, now, total);
|
prog(*self->m_self, now, total);
|
||||||
|
@ -302,7 +302,7 @@ SentAsyncWebRequest::Impl::Impl(SentAsyncWebRequest* self, AsyncWebRequest const
|
||||||
// request, then they may still cancel it
|
// request, then they may still cancel it
|
||||||
m_finished = true;
|
m_finished = true;
|
||||||
|
|
||||||
Loader::get()->queueInGDThread([this, ret]() {
|
Loader::get()->queueInMainThread([this, ret]() {
|
||||||
std::lock_guard _(m_mutex);
|
std::lock_guard _(m_mutex);
|
||||||
for (auto& then : m_thens) {
|
for (auto& then : m_thens) {
|
||||||
then(*m_self, ret);
|
then(*m_self, ret);
|
||||||
|
@ -329,7 +329,7 @@ void SentAsyncWebRequest::Impl::doCancel() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Loader::get()->queueInGDThread([this]() {
|
Loader::get()->queueInMainThread([this]() {
|
||||||
std::lock_guard _(m_mutex);
|
std::lock_guard _(m_mutex);
|
||||||
for (auto& canc : m_cancelleds) {
|
for (auto& canc : m_cancelleds) {
|
||||||
canc(*m_self);
|
canc(*m_self);
|
||||||
|
@ -366,7 +366,7 @@ void SentAsyncWebRequest::Impl::error(std::string const& error, int code) {
|
||||||
m_statusCV.wait(lock, [this]() {
|
m_statusCV.wait(lock, [this]() {
|
||||||
return !m_paused;
|
return !m_paused;
|
||||||
});
|
});
|
||||||
Loader::get()->queueInGDThread([this, error, code]() {
|
Loader::get()->queueInMainThread([this, error, code]() {
|
||||||
{
|
{
|
||||||
std::lock_guard _(m_mutex);
|
std::lock_guard _(m_mutex);
|
||||||
for (auto& expect : m_expects) {
|
for (auto& expect : m_expects) {
|
||||||
|
|
Loading…
Reference in a new issue