From bba9b6c7ed04717045d6ee8ff451d5f1c454bc98 Mon Sep 17 00:00:00 2001 From: dankmeme01 <42031238+dankmeme01@users.noreply.github.com> Date: Sun, 25 Feb 2024 21:17:44 +0100 Subject: [PATCH 1/6] impostor playlayer fix (#562) --- loader/src/hooks/ImpostorPlayLayerFix.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 loader/src/hooks/ImpostorPlayLayerFix.cpp diff --git a/loader/src/hooks/ImpostorPlayLayerFix.cpp b/loader/src/hooks/ImpostorPlayLayerFix.cpp new file mode 100644 index 00000000..2f17f97b --- /dev/null +++ b/loader/src/hooks/ImpostorPlayLayerFix.cpp @@ -0,0 +1,18 @@ +#include <Geode/DefaultInclude.hpp> +#include <Geode/modify/LevelPage.hpp> + +using namespace geode::prelude; + +// When pressing spacebar during the transition into LevelSelectLayer, +// a PlayLayer will be created but it will never be added to a scene. +// It will still exist in memory, potentially causing issues in mods, i.e. Custom Keybinds. +// +// This workaround solves the issue by making it impossible to start the level during a transition. + +struct CustomLevelPage : Modify<CustomLevelPage, LevelPage> { + void onPlay(cocos2d::CCObject* sender) { + if (!typeinfo_cast<CCTransitionScene*>(CCScene::get())) { + LevelPage::onPlay(sender); + } + } +}; From 0d64935a11138bf77f036381882be02d1aeaadfc Mon Sep 17 00:00:00 2001 From: iAndyHD3 <54410739+iAndyHD3@users.noreply.github.com> Date: Sun, 25 Feb 2024 22:05:13 +0100 Subject: [PATCH 2/6] fix pch being treated as c files (#565) --- CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 91d31197..0a92f8fe 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -254,7 +254,7 @@ add_subdirectory(${GEODE_BINDINGS_REPO_PATH} ${CMAKE_BINARY_DIR}/bindings) if (NOT GEODE_DISABLE_PRECOMPILED_HEADERS) target_precompile_headers(GeodeBindings INTERFACE - "${GEODE_LOADER_PATH}/include/Geode/Bindings.hpp" + "$<$<COMPILE_LANGUAGE:CXX>:${GEODE_LOADER_PATH}/include/Geode/Bindings.hpp>" ) endif() @@ -292,8 +292,8 @@ elseif (EXISTS ${GEODE_PLATFORM_BIN_PATH}) target_link_libraries(${PROJECT_NAME} INTERFACE "${GEODE_PLATFORM_BIN_PATH}") if (NOT GEODE_DISABLE_PRECOMPILED_HEADERS) target_precompile_headers(${PROJECT_NAME} INTERFACE - "${GEODE_LOADER_PATH}/include/Geode/DefaultInclude.hpp" - "${GEODE_LOADER_PATH}/include/Geode/Geode.hpp" + "$<$<COMPILE_LANGUAGE:CXX>:${GEODE_LOADER_PATH}/include/Geode/DefaultInclude.hpp>" + "$<$<COMPILE_LANGUAGE:CXX>:${GEODE_LOADER_PATH}/include/Geode/Geode.hpp>" # please stop adding modify here its not here because it makes windows compilation take longer than geode 1.0 release date ) endif() From 6ee63091de8873454b47c4f6c1f33929ead7fa50 Mon Sep 17 00:00:00 2001 From: Talis <95105680+TheSillyDoggo@users.noreply.github.com> Date: Mon, 26 Feb 2024 21:50:43 +1100 Subject: [PATCH 3/6] Fix the failed to set locale on devices that don't have us english (like my phone) (#566) --- loader/include/Geode/utils/general.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/loader/include/Geode/utils/general.hpp b/loader/include/Geode/utils/general.hpp index e95ffe4f..7b19095b 100644 --- a/loader/include/Geode/utils/general.hpp +++ b/loader/include/Geode/utils/general.hpp @@ -113,7 +113,7 @@ namespace geode { Num val; char* strEnd; errno = 0; - if (std::setlocale(LC_NUMERIC, "en_US.utf8")) { + if (std::setlocale(LC_NUMERIC, "C")) { if constexpr (std::is_same_v<Num, float>) val = std::strtof(str.data(), &strEnd); else if constexpr (std::is_same_v<Num, double>) val = std::strtod(str.data(), &strEnd); else if constexpr (std::is_same_v<Num, long double>) val = std::strtold(str.data(), &strEnd); From c94e350cdfa6b24ff5b199cbeb3d7de6cc78b757 Mon Sep 17 00:00:00 2001 From: Fire <17692105+FireMario211@users.noreply.github.com> Date: Mon, 26 Feb 2024 12:37:27 +0000 Subject: [PATCH 4/6] Fix Wine crashing when launching via terminal (#501) --- loader/src/platform/windows/console.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/loader/src/platform/windows/console.cpp b/loader/src/platform/windows/console.cpp index 540e77a1..028f2cfa 100644 --- a/loader/src/platform/windows/console.cpp +++ b/loader/src/platform/windows/console.cpp @@ -117,7 +117,7 @@ void console::setup() { // count == 0 => not a console and not a file, assume it's closed // wine does something weird with /dev/null? not sure tbh but it's definitely up to no good - if (count == 0 || path.ends_with("\\dev\\null")) { + if ((count == 0 || path.ends_with("\\dev\\null")) && Mod::get()->getSettingValue<bool>("show-platform-console")) { s_outHandle = nullptr; CloseHandle(GetStdHandle(STD_OUTPUT_HANDLE)); CloseHandle(GetStdHandle(STD_INPUT_HANDLE)); From a5475bda11c5f0e7add542df372a40df474c4340 Mon Sep 17 00:00:00 2001 From: matcool <26722564+matcool@users.noreply.github.com> Date: Mon, 26 Feb 2024 11:58:35 -0300 Subject: [PATCH 5/6] add missing GEODE_DLL --- loader/include/Geode/utils/cocos.hpp | 4 ++-- loader/src/utils/cocos.cpp | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/loader/include/Geode/utils/cocos.hpp b/loader/include/Geode/utils/cocos.hpp index 4192cdcb..a740f2ad 100644 --- a/loader/include/Geode/utils/cocos.hpp +++ b/loader/include/Geode/utils/cocos.hpp @@ -747,7 +747,7 @@ namespace geode::cocos { * @returns True if the node has the given sprite frame * name */ - bool isSpriteFrameName(cocos2d::CCNode* node, const char* name); + GEODE_DLL bool isSpriteFrameName(cocos2d::CCNode* node, const char* name); /** * Get the first child that has the given sprite frame @@ -759,7 +759,7 @@ namespace geode::cocos { * @returns Child with the given sprite frame name, or * nullptr if there is none */ - cocos2d::CCNode* getChildBySpriteFrameName(cocos2d::CCNode* parent, const char* name); + GEODE_DLL cocos2d::CCNode* getChildBySpriteFrameName(cocos2d::CCNode* parent, const char* name); /** * Checks if a given file exists in CCFileUtils diff --git a/loader/src/utils/cocos.cpp b/loader/src/utils/cocos.cpp index d4bf49f9..c8d111ef 100644 --- a/loader/src/utils/cocos.cpp +++ b/loader/src/utils/cocos.cpp @@ -340,6 +340,8 @@ std::shared_ptr<WeakRefController> WeakRefPool::manage(CCObject* obj) { } bool geode::cocos::isSpriteFrameName(CCNode* node, const char* name) { + if (!node) return false; + auto cache = CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName(name); if (!cache) return false; From d139049b89dcfffc046258afe6fb8fe51ca9aa7a Mon Sep 17 00:00:00 2001 From: matcool <26722564+matcool@users.noreply.github.com> Date: Mon, 26 Feb 2024 12:31:18 -0300 Subject: [PATCH 6/6] prevent updater from hanging, also copy pdb --- loader/launcher/windows/Updater.cpp | 34 +++++++++++++++++++---------- 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/loader/launcher/windows/Updater.cpp b/loader/launcher/windows/Updater.cpp index 3a1506ef..8f26286a 100644 --- a/loader/launcher/windows/Updater.cpp +++ b/loader/launcher/windows/Updater.cpp @@ -22,33 +22,39 @@ bool waitForFile(std::filesystem::path const& path) { if (GetLastError() == ERROR_SHARING_VIOLATION) { Sleep(delay); // the delay would raise and go up to about 5 seconds, after which it will fail - if (delay < 5120) + if (delay < 5120) { delay *= 2; - } - else + } else { + // delay too long, just give up now + hFile = NULL; + break; + } + } else { break; + } } - if (hFile) + if (hFile) { CloseHandle(hFile); - else { + } else { showError("Unable to update Geode: " + path.filename().string() + " is open by another process."); return false; } return true; } -void updateFile(std::string const& name) { +bool updateFile(std::string const& name) { std::error_code error; if (!std::filesystem::exists(updatesDir / name, error) || error) - return; + return true; if (!waitForFile(workingDir / name)) - return; + return false; std::filesystem::rename(updatesDir / name, workingDir / name, error); if (error) { showError("Unable to update Geode: Unable to move " + name + " - " + error.message()); - return; + return false; } + return true; } void removePath(std::filesystem::path const& path) { @@ -98,10 +104,14 @@ int main(int argc, char* argv[]) { removePath(workingDir / "GeodeBootstrapper.dll"); if (std::filesystem::exists(geodeDir) && std::filesystem::exists(updatesDir)) { - updateFile("XInput9_1_0.dll"); - updateFile("Geode.dll"); + bool updateSuccess = true; + updateSuccess &= updateFile("XInput9_1_0.dll"); + updateSuccess &= updateFile("Geode.dll"); + updateSuccess &= updateFile("Geode.pdb"); updateResources(); - removePath(updatesDir); + // if couldnt update the files, dont delete the updates folder + if (updateSuccess) + removePath(updatesDir); } if (argc < 2)