mirror of
https://github.com/geode-sdk/geode.git
synced 2024-11-22 15:37:53 -05:00
Get geode working on macos wine
This commit is contained in:
parent
df14e82fdf
commit
7b9c68567a
7 changed files with 29 additions and 15 deletions
|
@ -1,10 +1,9 @@
|
|||
// included by default in every geode project
|
||||
|
||||
#include <Geode/Loader.hpp>
|
||||
|
||||
GEODE_API bool GEODE_CALL geode_implicit_load(geode::Mod* m) {
|
||||
geode::Mod::setSharedMod(m);
|
||||
geode::log::releaseSchedules(m);
|
||||
geode::Loader::get()->releaseScheduledFunctions(m);
|
||||
return true;
|
||||
geode::Mod::setSharedMod(m);
|
||||
geode::log::releaseSchedules(m);
|
||||
geode::Loader::get()->releaseScheduledFunctions(m);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -79,8 +79,6 @@ namespace geode {
|
|||
|
||||
void updateAllDependencies();
|
||||
|
||||
void releaseScheduledFunctions(Mod* mod);
|
||||
|
||||
friend class Mod;
|
||||
friend class CustomLoader;
|
||||
friend struct ModInfo;
|
||||
|
@ -93,6 +91,9 @@ namespace geode {
|
|||
void updateResourcePaths();
|
||||
void updateModResources(Mod* mod);
|
||||
|
||||
// used internally in geode_implicit_load
|
||||
void releaseScheduledFunctions(Mod* mod);
|
||||
|
||||
friend bool GEODE_CALL ::geode_implicit_load(Mod*);
|
||||
|
||||
public:
|
||||
|
|
|
@ -331,6 +331,7 @@ namespace geode {
|
|||
template <class = void>
|
||||
static inline GEODE_HIDDEN Mod* sharedMod = nullptr;
|
||||
|
||||
// used internally in geode_implicit_load
|
||||
template <class = void>
|
||||
static inline GEODE_HIDDEN void setSharedMod(Mod* mod) {
|
||||
sharedMod<> = mod;
|
||||
|
|
|
@ -59,7 +59,7 @@ static void updateIndexProgress(UpdateStatus status, std::string const& info, ui
|
|||
|
||||
template <class T = CCNode>
|
||||
|
||||
requires std::is_base_of_v<CCNode, T>
|
||||
requires std::is_base_of_v<CCNode, T>
|
||||
T* setIDSafe(CCNode* node, int index, char const* id) {
|
||||
if constexpr (std::is_same_v<CCNode, T>) {
|
||||
if (auto child = getChild(node, index)) {
|
||||
|
@ -86,7 +86,6 @@ struct CustomMenuLayer : Modify<CustomMenuLayer, MenuLayer> {
|
|||
|
||||
bool init() {
|
||||
if (!MenuLayer::init()) return false;
|
||||
|
||||
// set IDs to everything
|
||||
this->setID("main-menu-layer");
|
||||
setIDSafe(this, 0, "main-menu-bg");
|
||||
|
|
|
@ -42,6 +42,7 @@ static ModInfo getInternalModInfo() {
|
|||
|
||||
InternalMod::InternalMod() : Mod(getInternalModInfo()) {
|
||||
m_saveDirPath = Loader::get()->getGeodeSaveDirectory() / GEODE_MOD_DIRECTORY / m_info.m_id;
|
||||
|
||||
ghc::filesystem::create_directories(m_saveDirPath);
|
||||
|
||||
// make sure spritesheets get added
|
||||
|
|
|
@ -37,9 +37,9 @@ void Loader::createDirectories() {
|
|||
auto tempDir = this->getGeodeDirectory() / GEODE_TEMP_DIRECTORY;
|
||||
auto confDir = this->getGeodeDirectory() / GEODE_CONFIG_DIRECTORY;
|
||||
|
||||
#ifdef GEODE_IS_MACOS
|
||||
#ifdef GEODE_IS_MACOS
|
||||
ghc::filesystem::create_directory(this->getSaveDirectory());
|
||||
#endif
|
||||
#endif
|
||||
|
||||
ghc::filesystem::create_directories(resDir);
|
||||
ghc::filesystem::create_directory(confDir);
|
||||
|
@ -426,13 +426,22 @@ ghc::filesystem::path Loader::getGameDirectory() const {
|
|||
return ghc::filesystem::path(CCFileUtils::sharedFileUtils()->getWritablePath2().c_str());
|
||||
}
|
||||
|
||||
#ifdef GEODE_IS_WINDOWS
|
||||
#include <filesystem>
|
||||
#endif
|
||||
|
||||
ghc::filesystem::path Loader::getSaveDirectory() const {
|
||||
// not using ~/Library/Caches
|
||||
#ifdef GEODE_IS_MACOS
|
||||
// not using ~/Library/Caches
|
||||
#ifdef GEODE_IS_MACOS
|
||||
return ghc::filesystem::path("/Users/Shared/Geode");
|
||||
#else
|
||||
#elif defined(GEODE_IS_WINDOWS)
|
||||
return ghc::filesystem::path(
|
||||
std::filesystem::weakly_canonical(CCFileUtils::sharedFileUtils()->getWritablePath().c_str())
|
||||
.string()
|
||||
);
|
||||
#else
|
||||
return ghc::filesystem::path(CCFileUtils::sharedFileUtils()->getWritablePath().c_str());
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
ghc::filesystem::path Loader::getGeodeDirectory() const {
|
||||
|
|
|
@ -118,7 +118,9 @@ int geodeEntry(void* platformData) {
|
|||
"internal tools and Geode can not be loaded. "
|
||||
"(InternalLoader::get returned nullptr)"
|
||||
);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!geode::core::hook::initialize()) {
|
||||
InternalLoader::platformMessageBox(
|
||||
"Unable to load Geode!",
|
||||
|
@ -126,7 +128,9 @@ int geodeEntry(void* platformData) {
|
|||
"internal tools and Geode can not be loaded. "
|
||||
"(Unable to set up hook manager)"
|
||||
);
|
||||
return 1;
|
||||
}
|
||||
|
||||
geode_implicit_load(InternalMod::get());
|
||||
|
||||
if (!InternalLoader::get()->setup()) {
|
||||
|
|
Loading…
Reference in a new issue