Get geode working on macos wine

This commit is contained in:
alk 2022-11-19 15:05:10 +03:00 committed by GitHub
parent df14e82fdf
commit 7b9c68567a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 29 additions and 15 deletions

View file

@ -1,5 +1,4 @@
// included by default in every geode project // included by default in every geode project
#include <Geode/Loader.hpp> #include <Geode/Loader.hpp>
GEODE_API bool GEODE_CALL geode_implicit_load(geode::Mod* m) { GEODE_API bool GEODE_CALL geode_implicit_load(geode::Mod* m) {

View file

@ -79,8 +79,6 @@ namespace geode {
void updateAllDependencies(); void updateAllDependencies();
void releaseScheduledFunctions(Mod* mod);
friend class Mod; friend class Mod;
friend class CustomLoader; friend class CustomLoader;
friend struct ModInfo; friend struct ModInfo;
@ -93,6 +91,9 @@ namespace geode {
void updateResourcePaths(); void updateResourcePaths();
void updateModResources(Mod* mod); void updateModResources(Mod* mod);
// used internally in geode_implicit_load
void releaseScheduledFunctions(Mod* mod);
friend bool GEODE_CALL ::geode_implicit_load(Mod*); friend bool GEODE_CALL ::geode_implicit_load(Mod*);
public: public:

View file

@ -331,6 +331,7 @@ namespace geode {
template <class = void> template <class = void>
static inline GEODE_HIDDEN Mod* sharedMod = nullptr; static inline GEODE_HIDDEN Mod* sharedMod = nullptr;
// used internally in geode_implicit_load
template <class = void> template <class = void>
static inline GEODE_HIDDEN void setSharedMod(Mod* mod) { static inline GEODE_HIDDEN void setSharedMod(Mod* mod) {
sharedMod<> = mod; sharedMod<> = mod;

View file

@ -86,7 +86,6 @@ struct CustomMenuLayer : Modify<CustomMenuLayer, MenuLayer> {
bool init() { bool init() {
if (!MenuLayer::init()) return false; if (!MenuLayer::init()) return false;
// set IDs to everything // set IDs to everything
this->setID("main-menu-layer"); this->setID("main-menu-layer");
setIDSafe(this, 0, "main-menu-bg"); setIDSafe(this, 0, "main-menu-bg");

View file

@ -42,6 +42,7 @@ static ModInfo getInternalModInfo() {
InternalMod::InternalMod() : Mod(getInternalModInfo()) { InternalMod::InternalMod() : Mod(getInternalModInfo()) {
m_saveDirPath = Loader::get()->getGeodeSaveDirectory() / GEODE_MOD_DIRECTORY / m_info.m_id; m_saveDirPath = Loader::get()->getGeodeSaveDirectory() / GEODE_MOD_DIRECTORY / m_info.m_id;
ghc::filesystem::create_directories(m_saveDirPath); ghc::filesystem::create_directories(m_saveDirPath);
// make sure spritesheets get added // make sure spritesheets get added

View file

@ -426,10 +426,19 @@ ghc::filesystem::path Loader::getGameDirectory() const {
return ghc::filesystem::path(CCFileUtils::sharedFileUtils()->getWritablePath2().c_str()); return ghc::filesystem::path(CCFileUtils::sharedFileUtils()->getWritablePath2().c_str());
} }
#ifdef GEODE_IS_WINDOWS
#include <filesystem>
#endif
ghc::filesystem::path Loader::getSaveDirectory() const { ghc::filesystem::path Loader::getSaveDirectory() const {
// not using ~/Library/Caches // not using ~/Library/Caches
#ifdef GEODE_IS_MACOS #ifdef GEODE_IS_MACOS
return ghc::filesystem::path("/Users/Shared/Geode"); return ghc::filesystem::path("/Users/Shared/Geode");
#elif defined(GEODE_IS_WINDOWS)
return ghc::filesystem::path(
std::filesystem::weakly_canonical(CCFileUtils::sharedFileUtils()->getWritablePath().c_str())
.string()
);
#else #else
return ghc::filesystem::path(CCFileUtils::sharedFileUtils()->getWritablePath().c_str()); return ghc::filesystem::path(CCFileUtils::sharedFileUtils()->getWritablePath().c_str());
#endif #endif

View file

@ -118,7 +118,9 @@ int geodeEntry(void* platformData) {
"internal tools and Geode can not be loaded. " "internal tools and Geode can not be loaded. "
"(InternalLoader::get returned nullptr)" "(InternalLoader::get returned nullptr)"
); );
return 1;
} }
if (!geode::core::hook::initialize()) { if (!geode::core::hook::initialize()) {
InternalLoader::platformMessageBox( InternalLoader::platformMessageBox(
"Unable to load Geode!", "Unable to load Geode!",
@ -126,7 +128,9 @@ int geodeEntry(void* platformData) {
"internal tools and Geode can not be loaded. " "internal tools and Geode can not be loaded. "
"(Unable to set up hook manager)" "(Unable to set up hook manager)"
); );
return 1;
} }
geode_implicit_load(InternalMod::get()); geode_implicit_load(InternalMod::get());
if (!InternalLoader::get()->setup()) { if (!InternalLoader::get()->setup()) {