Merge branch 'main' into 1.4.0-dev

# Conflicts:
#	VERSION
#	loader/src/ui/internal/list/ModListCell.cpp
This commit is contained in:
ConfiG 2023-09-11 16:46:54 +03:00
commit 899b0ce82c
No known key found for this signature in database
GPG key ID: 44DA1983F524C11B
85 changed files with 76 additions and 90 deletions

View file

@ -1,5 +1,8 @@
# Geode Changelog # Geode Changelog
## v1.3.1
* Fix TulipHook not relocating RIP relative operands on MacOS (6cad19d)
## v1.3.0 ## v1.3.0
* Completely remove runtime enabling & disabling of mods (d817749) * Completely remove runtime enabling & disabling of mods (d817749)
* Patches auto enabling can be disabled (69821f3) * Patches auto enabling can be disabled (69821f3)

View file

@ -174,7 +174,7 @@ class cocos2d::CCDirector {
auto convertToGL(cocos2d::CCPoint const&) = mac 0x24a210; auto convertToGL(cocos2d::CCPoint const&) = mac 0x24a210;
auto convertToUI(cocos2d::CCPoint const&) = mac 0x24a340; auto convertToUI(cocos2d::CCPoint const&) = mac 0x24a340;
auto drawScene() = mac 0x249690; auto drawScene() = mac 0x249690;
auto willSwitchToScene(cocos2d::CCScene* scene); auto willSwitchToScene(cocos2d::CCScene* scene) = mac 0x24a520;
auto setOpenGLView(cocos2d::CCEGLView *pobOpenGLView) = mac 0x249be0; auto setOpenGLView(cocos2d::CCEGLView *pobOpenGLView) = mac 0x249be0;
auto updateScreenScale(cocos2d::CCSize) = mac 0x249f10; auto updateScreenScale(cocos2d::CCSize) = mac 0x249f10;
auto setContentScaleFactor(float); auto setContentScaleFactor(float);

View file

@ -86,14 +86,14 @@ namespace geode {
ghc::filesystem::path getPackagePath() const; ghc::filesystem::path getPackagePath() const;
VersionInfo getVersion() const; VersionInfo getVersion() const;
bool isEnabled() const; bool isEnabled() const;
bool isLoaded() const; [[deprecated("use isEnabled instead")]] bool isLoaded() const;
bool supportsDisabling() const; bool supportsDisabling() const;
bool canDisable() const; [[deprecated("always true")]] bool canDisable() const;
bool canEnable() const; [[deprecated("always true")]] bool canEnable() const;
bool needsEarlyLoad() const; bool needsEarlyLoad() const;
[[deprecated]] bool supportsUnloading() const; [[deprecated("always false")]] bool supportsUnloading() const;
[[deprecated("use wasSuccessfullyLoaded instead")]] bool wasSuccesfullyLoaded() const; [[deprecated("use isEnabled instead")]] bool wasSuccesfullyLoaded() const;
bool wasSuccessfullyLoaded() const; [[deprecated("use isEnabled instead")]] bool wasSuccessfullyLoaded() const;
[[deprecated("use getMetadata instead")]] ModInfo getModInfo() const; [[deprecated("use getMetadata instead")]] ModInfo getModInfo() const;
ModMetadata getMetadata() const; ModMetadata getMetadata() const;
ghc::filesystem::path getTempDir() const; ghc::filesystem::path getTempDir() const;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.3 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.9 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 111 KiB

After

Width:  |  Height:  |  Size: 73 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 46 KiB

After

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 64 KiB

After

Width:  |  Height:  |  Size: 71 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 51 KiB

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.2 KiB

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.6 KiB

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.5 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.8 KiB

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.7 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 105 KiB

After

Width:  |  Height:  |  Size: 86 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 51 KiB

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.2 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.4 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.7 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.7 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.6 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.1 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.3 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.6 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.3 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.3 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.6 KiB

After

Width:  |  Height:  |  Size: 8.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.1 KiB

After

Width:  |  Height:  |  Size: 9.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.2 KiB

After

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.8 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.1 KiB

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.7 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.7 KiB

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.9 KiB

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View file

@ -16,7 +16,7 @@ struct CustomLoadingLayer : Modify<CustomLoadingLayer, LoadingLayer> {
void updateLoadedModsLabel() { void updateLoadedModsLabel() {
auto allMods = Loader::get()->getAllMods(); auto allMods = Loader::get()->getAllMods();
auto count = std::count_if(allMods.begin(), allMods.end(), [&](auto& item) { auto count = std::count_if(allMods.begin(), allMods.end(), [&](auto& item) {
return item->isLoaded(); return item->isEnabled();
}); });
auto str = fmt::format("Geode: Loaded {}/{} mods", count, allMods.size()); auto str = fmt::format("Geode: Loaded {}/{} mods", count, allMods.size());
m_fields->m_loadedModsLabel->setCString(str.c_str()); m_fields->m_loadedModsLabel->setCString(str.c_str());

View file

@ -24,14 +24,13 @@ static void printGeodeInfo(std::stringstream& stream) {
static void printMods(std::stringstream& stream) { static void printMods(std::stringstream& stream) {
auto mods = Loader::get()->getAllMods(); auto mods = Loader::get()->getAllMods();
if (!mods.size()) { if (mods.empty()) {
stream << "<None>\n"; stream << "<None>\n";
} }
using namespace std::string_view_literals; using namespace std::string_view_literals;
for (auto& mod : mods) { for (auto& mod : mods) {
stream << fmt::format("{:>8} | {:>8} | [{}] {}\n", stream << fmt::format("{} | [{}] {}\n",
mod->isLoaded() ? "Loaded"sv : "Unloaded"sv, mod->isEnabled() ? "x"sv : " "sv,
mod->isEnabled() ? "Enabled"sv : "Disabled"sv,
mod->getVersion().toString(), mod->getID() mod->getVersion().toString(), mod->getID()
); );
} }

View file

@ -8,6 +8,8 @@
#include <hash/hash.hpp> #include <hash/hash.hpp>
#include <Geode/utils/JsonValidation.hpp> #include <Geode/utils/JsonValidation.hpp>
#include <thread>
#ifdef GEODE_IS_WINDOWS #ifdef GEODE_IS_WINDOWS
#include <filesystem> #include <filesystem>
#endif #endif
@ -318,19 +320,25 @@ void Index::Impl::downloadIndex() {
return; return;
} }
// unzip new index std::thread([=, this]() {
auto unzip = file::Unzip::intoDir(targetFile, targetDir, true) // unzip new index
.expect("Unable to unzip new index"); auto unzip = file::Unzip::intoDir(targetFile, targetDir, true)
if (!unzip) { .expect("Unable to unzip new index");
IndexUpdateEvent(UpdateFailed(unzip.unwrapErr())).post(); if (!unzip) {
return; Loader::get()->queueInMainThread([unzip] {
} IndexUpdateEvent(UpdateFailed(unzip.unwrapErr())).post();
});
return;
}
// remove the directory github adds to the root of the zip // remove the directory github adds to the root of the zip
(void)flattenGithubRepo(targetDir); (void)flattenGithubRepo(targetDir);
// update index Loader::get()->queueInMainThread([this] {
this->updateFromLocalTree(); // update index
this->updateFromLocalTree();
});
}).detach();
}) })
.expect([](std::string const& err) { .expect([](std::string const& err) {
IndexUpdateEvent(UpdateFailed(fmt::format("Error downloading: {}", err))).post(); IndexUpdateEvent(UpdateFailed(fmt::format("Error downloading: {}", err))).post();
@ -448,7 +456,8 @@ void Index::update(bool force) {
// update sources // update sources
if (force) { if (force) {
m_impl->downloadIndex(); m_impl->downloadIndex();
} else { }
else {
m_impl->checkForUpdates(); m_impl->checkForUpdates();
} }
} }

View file

@ -201,13 +201,13 @@ Mod* Loader::Impl::getInstalledMod(std::string const& id) const {
} }
bool Loader::Impl::isModLoaded(std::string const& id) const { bool Loader::Impl::isModLoaded(std::string const& id) const {
return m_mods.count(id) && m_mods.at(id)->isLoaded(); return m_mods.count(id) && m_mods.at(id)->isEnabled();
} }
Mod* Loader::Impl::getLoadedMod(std::string const& id) const { Mod* Loader::Impl::getLoadedMod(std::string const& id) const {
if (m_mods.count(id)) { if (m_mods.count(id)) {
auto mod = m_mods.at(id); auto mod = m_mods.at(id);
if (mod->isLoaded()) { if (mod->isEnabled()) {
return mod; return mod;
} }
} }
@ -225,8 +225,6 @@ void Loader::Impl::updateModResources(Mod* mod) {
if (mod->getMetadata().getSpritesheets().empty()) if (mod->getMetadata().getSpritesheets().empty())
return; return;
auto searchPath = mod->getResourcesDir();
log::debug("Adding resources for {}", mod->getID()); log::debug("Adding resources for {}", mod->getID());
// add spritesheets // add spritesheets
@ -402,7 +400,7 @@ void Loader::Impl::loadModGraph(Mod* node, bool early) {
log::debug("{} {}", node->getID(), node->getVersion()); log::debug("{} {}", node->getID(), node->getVersion());
log::pushNest(); log::pushNest();
if (node->isLoaded()) { if (node->isEnabled()) {
for (auto const& dep : node->m_impl->m_dependants) { for (auto const& dep : node->m_impl->m_dependants) {
this->loadModGraph(dep, early); this->loadModGraph(dep, early);
} }
@ -438,7 +436,7 @@ void Loader::Impl::findProblems() {
log::pushNest(); log::pushNest();
for (auto const& dep : mod->getMetadata().getDependencies()) { for (auto const& dep : mod->getMetadata().getDependencies()) {
if (dep.mod && dep.mod->isLoaded() && dep.version.compare(dep.mod->getVersion())) if (dep.mod && dep.mod->isEnabled() && dep.version.compare(dep.mod->getVersion()))
continue; continue;
switch(dep.importance) { switch(dep.importance) {
case ModMetadata::Dependency::Importance::Suggested: case ModMetadata::Dependency::Importance::Suggested:
@ -493,19 +491,21 @@ void Loader::Impl::findProblems() {
Mod* myEpicMod = mod; // clang fix Mod* myEpicMod = mod; // clang fix
// if the mod is not loaded but there are no problems related to it // if the mod is not loaded but there are no problems related to it
// if (!mod->isLoaded() && !std::any_of(m_problems.begin(), m_problems.end(), [myEpicMod](auto& item) { if (!mod->isEnabled() &&
// return std::holds_alternative<ModMetadata>(item.cause) && Mod::get()->getSavedValue<bool>("should-load-" + mod->getID(), true) &&
// std::get<ModMetadata>(item.cause).getID() == myEpicMod->getID() || !std::any_of(m_problems.begin(), m_problems.end(), [myEpicMod](auto& item) {
// std::holds_alternative<Mod*>(item.cause) && return std::holds_alternative<ModMetadata>(item.cause) &&
// std::get<Mod*>(item.cause) == myEpicMod; std::get<ModMetadata>(item.cause).getID() == myEpicMod->getID() ||
// })) { std::holds_alternative<Mod*>(item.cause) &&
// m_problems.push_back({ std::get<Mod*>(item.cause) == myEpicMod;
// LoadProblem::Type::Unknown, })) {
// mod, m_problems.push_back({
// "" LoadProblem::Type::Unknown,
// }); mod,
// log::error("{} failed to load for an unknown reason", id); ""
// } });
log::error("{} failed to load for an unknown reason", id);
}
log::popNest(); log::popNest();
} }

View file

@ -47,7 +47,7 @@ bool Mod::isEnabled() const {
} }
bool Mod::isLoaded() const { bool Mod::isLoaded() const {
return m_impl->isLoaded(); return this->isEnabled();
} }
bool Mod::supportsDisabling() const { bool Mod::supportsDisabling() const {
@ -55,11 +55,11 @@ bool Mod::supportsDisabling() const {
} }
bool Mod::canDisable() const { bool Mod::canDisable() const {
return m_impl->canDisable(); return true;
} }
bool Mod::canEnable() const { bool Mod::canEnable() const {
return m_impl->canEnable(); return true;
} }
bool Mod::needsEarlyLoad() const { bool Mod::needsEarlyLoad() const {
@ -71,10 +71,10 @@ bool Mod::supportsUnloading() const {
} }
bool Mod::wasSuccesfullyLoaded() const { bool Mod::wasSuccesfullyLoaded() const {
return this->wasSuccessfullyLoaded(); return this->isEnabled();
} }
bool Mod::wasSuccessfullyLoaded() const { bool Mod::wasSuccessfullyLoaded() const {
return m_impl->wasSuccessfullyLoaded(); return this->isEnabled();
} }
ModInfo Mod::getModInfo() const { ModInfo Mod::getModInfo() const {

View file

@ -42,8 +42,9 @@ Result<> Mod::Impl::setup() {
if (!loadRes) { if (!loadRes) {
log::warn("Unable to load data for \"{}\": {}", m_metadata.getID(), loadRes.unwrapErr()); log::warn("Unable to load data for \"{}\": {}", m_metadata.getID(), loadRes.unwrapErr());
} }
if (LoaderImpl::get()->m_isSetup) { if (!m_resourcesLoaded) {
Loader::get()->updateResources(false); LoaderImpl::get()->updateModResources(m_self);
m_resourcesLoaded = true;
} }
return Ok(); return Ok();
@ -112,22 +113,10 @@ bool Mod::Impl::isEnabled() const {
return m_enabled; return m_enabled;
} }
bool Mod::Impl::isLoaded() const {
return m_binaryLoaded;
}
bool Mod::Impl::supportsDisabling() const { bool Mod::Impl::supportsDisabling() const {
return m_metadata.getID() != "geode.loader"; return m_metadata.getID() != "geode.loader";
} }
bool Mod::Impl::canDisable() const {
return true;
}
bool Mod::Impl::canEnable() const {
return true;
}
bool Mod::Impl::needsEarlyLoad() const { bool Mod::Impl::needsEarlyLoad() const {
auto deps = m_dependants; auto deps = m_dependants;
return getMetadata().needsEarlyLoad() || return getMetadata().needsEarlyLoad() ||
@ -136,10 +125,6 @@ bool Mod::Impl::needsEarlyLoad() const {
}); });
} }
bool Mod::Impl::wasSuccessfullyLoaded() const {
return !this->isEnabled() || this->isLoaded();
}
std::vector<Hook*> Mod::Impl::getHooks() const { std::vector<Hook*> Mod::Impl::getHooks() const {
return m_hooks; return m_hooks;
} }
@ -321,7 +306,7 @@ bool Mod::Impl::hasSetting(std::string const& key) const {
Result<> Mod::Impl::loadBinary() { Result<> Mod::Impl::loadBinary() {
log::debug("Loading binary for mod {}", m_metadata.getID()); log::debug("Loading binary for mod {}", m_metadata.getID());
if (m_binaryLoaded) if (m_enabled)
return Ok(); return Ok();
LoaderImpl::get()->provideNextMod(m_self); LoaderImpl::get()->provideNextMod(m_self);
@ -333,7 +318,6 @@ Result<> Mod::Impl::loadBinary() {
log::error("Failed to load binary for mod {}: {}", m_metadata.getID(), res.unwrapErr()); log::error("Failed to load binary for mod {}: {}", m_metadata.getID(), res.unwrapErr());
return res; return res;
} }
m_binaryLoaded = true;
LoaderImpl::get()->releaseNextMod(); LoaderImpl::get()->releaseNextMod();
@ -630,8 +614,9 @@ ModJson Mod::Impl::getRuntimeInfo() const {
for (auto patch : m_patches) { for (auto patch : m_patches) {
obj["patches"].as_array().push_back(ModJson(patch->getRuntimeInfo())); obj["patches"].as_array().push_back(ModJson(patch->getRuntimeInfo()));
} }
// TODO: so which one is it
// obj["enabled"] = m_enabled; // obj["enabled"] = m_enabled;
obj["loaded"] = m_binaryLoaded; obj["loaded"] = m_enabled;
obj["temp-dir"] = this->getTempDir(); obj["temp-dir"] = this->getTempDir();
obj["save-dir"] = this->getSaveDir(); obj["save-dir"] = this->getSaveDir();
obj["config-dir"] = this->getConfigDir(false); obj["config-dir"] = this->getConfigDir(false);
@ -678,7 +663,6 @@ Mod* Loader::Impl::createInternalMod() {
else { else {
mod = new Mod(infoRes.unwrap()); mod = new Mod(infoRes.unwrap());
} }
mod->m_impl->m_binaryLoaded = true;
mod->m_impl->m_enabled = true; mod->m_impl->m_enabled = true;
m_mods.insert({ mod->getID(), mod }); m_mods.insert({ mod->getID(), mod });
return mod; return mod;

View file

@ -26,10 +26,6 @@ namespace geode {
* Whether the mod is enabled or not * Whether the mod is enabled or not
*/ */
bool m_enabled = false; bool m_enabled = false;
/**
* Whether the mod binary is loaded or not
*/
bool m_binaryLoaded = false;
/** /**
* Mod temp directory name * Mod temp directory name
*/ */
@ -66,7 +62,6 @@ namespace geode {
bool m_loggingEnabled = true; bool m_loggingEnabled = true;
ModRequestedAction m_requestedAction = ModRequestedAction::None; ModRequestedAction m_requestedAction = ModRequestedAction::None;
Impl(Mod* self, ModMetadata const& metadata); Impl(Mod* self, ModMetadata const& metadata);
@ -88,12 +83,8 @@ namespace geode {
ghc::filesystem::path getPackagePath() const; ghc::filesystem::path getPackagePath() const;
VersionInfo getVersion() const; VersionInfo getVersion() const;
bool isEnabled() const; bool isEnabled() const;
bool isLoaded() const;
bool supportsDisabling() const; bool supportsDisabling() const;
bool canDisable() const;
bool canEnable() const;
bool needsEarlyLoad() const; bool needsEarlyLoad() const;
bool wasSuccessfullyLoaded() const;
ModMetadata getMetadata() const; ModMetadata getMetadata() const;
ghc::filesystem::path getTempDir() const; ghc::filesystem::path getTempDir() const;
ghc::filesystem::path getBinaryPath() const; ghc::filesystem::path getBinaryPath() const;

View file

@ -15,7 +15,7 @@ ModInfo::Impl& ModInfoImpl::getImpl(ModInfo& info) {
bool Dependency::isResolved() const { bool Dependency::isResolved() const {
return !this->required || return !this->required ||
(this->mod && this->mod->isLoaded() && this->mod->isEnabled() && (this->mod && this->mod->isEnabled() &&
this->version.compare(this->mod->getVersion())); this->version.compare(this->mod->getVersion()));
} }

View file

@ -18,7 +18,7 @@ ModMetadata::Impl& ModMetadataImpl::getImpl(ModMetadata& info) {
bool ModMetadata::Dependency::isResolved() const { bool ModMetadata::Dependency::isResolved() const {
return this->importance != Importance::Required || return this->importance != Importance::Required ||
this->mod && this->mod->isLoaded() && this->version.compare(this->mod->getVersion()); this->mod && this->mod->isEnabled() && this->version.compare(this->mod->getVersion());
} }
bool ModMetadata::Incompatibility::isResolved() const { bool ModMetadata::Incompatibility::isResolved() const {

View file

@ -151,7 +151,7 @@ static Mod* modFromAddress(void const* addr) {
} }
for (auto& mod : Loader::get()->getAllMods()) { for (auto& mod : Loader::get()->getAllMods()) {
if (!mod->isLoaded() || !ghc::filesystem::exists(mod->getBinaryPath())) { if (!mod->isEnabled() || !ghc::filesystem::exists(mod->getBinaryPath())) {
continue; continue;
} }
if (ghc::filesystem::equivalent(imagePath, mod->getBinaryPath())) { if (ghc::filesystem::equivalent(imagePath, mod->getBinaryPath())) {

View file

@ -126,7 +126,7 @@ void Loader::Impl::setupIPC() {
if (ConnectNamedPipe(pipe, nullptr)) { if (ConnectNamedPipe(pipe, nullptr)) {
// log::debug("Got connection, creating thread"); // log::debug("Got connection, creating thread");
std::thread pipeThread(&ipcPipeThread, pipe); std::thread pipeThread(&ipcPipeThread, pipe);
SetThreadDescription(pipeThread.native_handle(), L"Geode IPC Pipe"); // SetThreadDescription(pipeThread.native_handle(), L"Geode IPC Pipe");
pipeThread.detach(); pipeThread.detach();
} }
else { else {
@ -135,7 +135,7 @@ void Loader::Impl::setupIPC() {
} }
} }
}); });
SetThreadDescription(ipcThread.native_handle(), L"Geode Main IPC"); // SetThreadDescription(ipcThread.native_handle(), L"Geode Main IPC");
ipcThread.detach(); ipcThread.detach();
log::debug("IPC set up"); log::debug("IPC set up");

View file

@ -54,7 +54,7 @@ void ModListCell::setupInfo(
if (inactive && logoSprColor) { if (inactive && logoSprColor) {
logoSprColor->setColor({ 163, 163, 163 }); logoSprColor->setColor({ 163, 163, 163 });
} }
m_menu->addChild(logoSpr); m_menu->addChild(logoSpr);
m_columnMenu = CCMenu::create(); m_columnMenu = CCMenu::create();
m_columnMenu->setContentSize({m_width, m_height}); m_columnMenu->setContentSize({m_width, m_height});
@ -115,7 +115,7 @@ void ModListCell::setupInfo(
m_labelMenu->addChild(versionLabel); m_labelMenu->addChild(versionLabel);
TagNode* apiLabel = nullptr; TagNode* apiLabel = nullptr;
if (auto tag = metadata.getVersion().getTag()) { if (auto tag = metadata.getVersion().getTag()) {
auto tagLabel = TagNode::create(tag.value().toString().c_str()); auto tagLabel = TagNode::create(tag.value().toString().c_str());
@ -302,7 +302,7 @@ bool ModCell::init(
m_menu->addChild(restartBtn); m_menu->addChild(restartBtn);
} }
else { else {
if (m_mod->wasSuccessfullyLoaded() && m_mod->getMetadata().getID() != "geode.loader") { if (m_mod->getMetadata().getID() != "geode.loader") {
m_enableToggle = m_enableToggle =
CCMenuItemToggler::createWithStandardSprites(this, menu_selector(ModCell::onEnable), .7f); CCMenuItemToggler::createWithStandardSprites(this, menu_selector(ModCell::onEnable), .7f);
m_menu->addChild(m_enableToggle); m_menu->addChild(m_enableToggle);
@ -314,7 +314,7 @@ bool ModCell::init(
auto viewBtn = CCMenuItemSpriteExtra::create(viewSpr, this, menu_selector(ModCell::onInfo)); auto viewBtn = CCMenuItemSpriteExtra::create(viewSpr, this, menu_selector(ModCell::onInfo));
m_menu->addChild(viewBtn); m_menu->addChild(viewBtn);
if (m_mod->wasSuccessfullyLoaded()) { if (m_mod->isEnabled()) {
auto latestIndexItem = Index::get()->getMajorItem( auto latestIndexItem = Index::get()->getMajorItem(
mod->getMetadata().getID() mod->getMetadata().getID()
); );

View file

@ -349,7 +349,7 @@ bool ModListLayer::init() {
m_tabsGradientNode->ignoreAnchorPointForPosition(true); m_tabsGradientNode->ignoreAnchorPointForPosition(true);
m_tabsGradientNode->setZOrder(9); m_tabsGradientNode->setZOrder(9);
m_tabsGradientNode->setInverted(false); m_tabsGradientNode->setInverted(false);
m_tabsGradientNode->setAlphaThreshold(0.f); m_tabsGradientNode->setAlphaThreshold(0.7f);
m_tabsGradientSprite = CCSprite::create("tab-gradient.png"_spr); m_tabsGradientSprite = CCSprite::create("tab-gradient.png"_spr);
m_tabsGradientNode->addChild(m_tabsGradientSprite); m_tabsGradientNode->addChild(m_tabsGradientSprite);
@ -682,7 +682,7 @@ void ModListLayer::onTab(CCObject* pSender) {
member->release(); member->release();
} }
if (isSelected && m_tabsGradientStencil) if (isSelected && m_tabsGradientStencil)
m_tabsGradientStencil->setPosition(member->m_onButton->convertToWorldSpace({0.f, -1.f})); m_tabsGradientStencil->setPosition(member->m_onButton->convertToWorldSpace({0.f, 0.f}));
}; };
toggleTab(m_downloadTabBtn); toggleTab(m_downloadTabBtn);