From 0ed1a41426bb5bead62af93e6eb76e7b41168954 Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Mon, 2 Oct 2023 14:37:02 +0300 Subject: [PATCH] Fix unzip modify date & add verifying text --- loader/src/hooks/LoadingLayer.cpp | 30 +++++++++++++++++------------- loader/src/loader/ModImpl.cpp | 6 ++++-- 2 files changed, 21 insertions(+), 15 deletions(-) diff --git a/loader/src/hooks/LoadingLayer.cpp b/loader/src/hooks/LoadingLayer.cpp index c765def5..3cdf20e7 100644 --- a/loader/src/hooks/LoadingLayer.cpp +++ b/loader/src/hooks/LoadingLayer.cpp @@ -70,20 +70,24 @@ struct CustomLoadingLayer : Modify { } void setupLoaderResources() { + log::debug("Verifying Loader Resources"); + this->setSmallText("Verifying Loader Resources"); // verify loader resources - if (!LoaderImpl::get()->verifyLoaderResources()) { - log::debug("Downloading Loader Resources"); - this->setSmallText("Downloading Loader Resources"); - this->addChild(EventListenerNode::create( - this, &CustomLoadingLayer::updateResourcesProgress - )); - } - else { - log::debug("Loading Loader Resources"); - this->setSmallText("Loading Loader Resources"); - LoaderImpl::get()->updateSpecialFiles(); - this->continueLoadAssets(); - } + Loader::get()->queueInMainThread([&]() { + if (!LoaderImpl::get()->verifyLoaderResources()) { + log::debug("Downloading Loader Resources"); + this->setSmallText("Downloading Loader Resources"); + this->addChild(EventListenerNode::create( + this, &CustomLoadingLayer::updateResourcesProgress + )); + } + else { + log::debug("Loading Loader Resources"); + this->setSmallText("Loading Loader Resources"); + LoaderImpl::get()->updateSpecialFiles(); + this->continueLoadAssets(); + } + }); } void updateResourcesProgress(ResourceDownloadEvent* event) { diff --git a/loader/src/loader/ModImpl.cpp b/loader/src/loader/ModImpl.cpp index 7075349f..adf335f5 100644 --- a/loader/src/loader/ModImpl.cpp +++ b/loader/src/loader/ModImpl.cpp @@ -596,11 +596,13 @@ Result<> Mod::Impl::unzipGeodeFile(ModMetadata metadata) { if (ec) { return Err("Unable to delete temp dir: " + ec.message()); } - + + (void)utils::file::createDirectoryAll(tempDir); auto res = file::writeString(datePath, modifiedHash); if (!res) { - log::warn("Failed to write modified date of geode zip"); + log::warn("Failed to write modified date of geode zip: {}", res.unwrapErr()); } + GEODE_UNWRAP_INTO(auto unzip, file::Unzip::create(metadata.getPath())); if (!unzip.hasEntry(metadata.getBinaryName())) {