From 8aa7fc7cc38d1bac32520e29ce70b1e79633ab54 Mon Sep 17 00:00:00 2001 From: Struma Date: Sun, 16 Jan 2022 22:56:58 -0500 Subject: [PATCH] Use path select based on env rather than Debug Building a Release seems to just break newer versions of ANGLE, so now let's just use Debug always. the environment variable `MKXPZ_SELECT_PATH` can be set to any value to bring up the option to select a path --- .../xcshareddata/WorkspaceSettings.xcsettings | 8 +++++++ .../xcschemes/Intel (Steam).xcscheme | 7 +++++++ .../xcshareddata/xcschemes/Intel.xcscheme | 7 +++++++ .../xcschemes/Universal (Steam).xcscheme | 7 +++++++ .../xcshareddata/xcschemes/Universal.xcscheme | 9 +++++++- src/filesystem/filesystemImpl.h | 2 -- src/filesystem/filesystemImplApple.mm | 6 ------ src/main.cpp | 21 ++++++++++--------- 8 files changed, 48 insertions(+), 19 deletions(-) create mode 100644 macos/mkxp-z.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings diff --git a/macos/mkxp-z.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/macos/mkxp-z.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 00000000..08de0be8 --- /dev/null +++ b/macos/mkxp-z.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -0,0 +1,8 @@ + + + + + IDEWorkspaceSharedSettings_AutocreateContextsIfNeeded + + + diff --git a/macos/mkxp-z.xcodeproj/xcshareddata/xcschemes/Intel (Steam).xcscheme b/macos/mkxp-z.xcodeproj/xcshareddata/xcschemes/Intel (Steam).xcscheme index 8329051a..98afbda6 100644 --- a/macos/mkxp-z.xcodeproj/xcshareddata/xcschemes/Intel (Steam).xcscheme +++ b/macos/mkxp-z.xcodeproj/xcshareddata/xcschemes/Intel (Steam).xcscheme @@ -56,6 +56,13 @@ isEnabled = "YES"> + + + + + + + + + + + + + + + + diff --git a/src/filesystem/filesystemImpl.h b/src/filesystem/filesystemImpl.h index 22b0be69..a5f013dc 100644 --- a/src/filesystem/filesystemImpl.h +++ b/src/filesystem/filesystemImpl.h @@ -30,10 +30,8 @@ std::string contentsOfAssetAsString(const char *baseName, const char *ext); std::string getResourcePath(); -#ifdef MKXPZ_DEBUG std::string selectPath(SDL_Window *win, const char *msg, const char *prompt); #endif -#endif }; #endif /* filesystemImpl_h */ diff --git a/src/filesystem/filesystemImplApple.mm b/src/filesystem/filesystemImplApple.mm index 91221f45..63141e29 100644 --- a/src/filesystem/filesystemImplApple.mm +++ b/src/filesystem/filesystemImplApple.mm @@ -5,12 +5,8 @@ // Created by ゾロアーク on 11/21/20. // -#ifdef MKXPZ_DEBUG #import #import -#else -#import -#endif #import @@ -100,7 +96,6 @@ std::string filesystemImpl::getResourcePath() { return std::string(NSTOPATH(NSBundle.mainBundle.resourcePath)); } -#ifdef MKXPZ_DEBUG std::string filesystemImpl::selectPath(SDL_Window *win, const char *msg, const char *prompt) { NSOpenPanel *panel = [NSOpenPanel openPanel]; panel.canChooseDirectories = true; @@ -126,4 +121,3 @@ std::string filesystemImpl::selectPath(SDL_Window *win, const char *msg, const c return std::string(); } -#endif diff --git a/src/main.cpp b/src/main.cpp index fc34488b..8fc32b85 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -344,18 +344,19 @@ int main(int argc, char *argv[]) { return 0; } -#if defined(MKXPZ_BUILD_XCODE) && defined(MKXPZ_DEBUG) -#define DEBUG_FSELECT_MSG "Select the folder to load game files from. This is the folder containing the INI and/or configuration JSON.\nThis prompt does not appear in release builds." +#if defined(MKXPZ_BUILD_XCODE) +#define DEBUG_FSELECT_MSG "Select the folder to load game files from. This is the folder containing the INI and/or configuration JSON." #define DEBUG_FSELECT_PROMPT "Load Game" - std::string dataDirStr = mkxp_fs::selectPath(win, DEBUG_FSELECT_MSG, DEBUG_FSELECT_PROMPT); - if (!dataDirStr.empty()) { - conf.gameFolder = dataDirStr; - mkxp_fs::setCurrentDirectory(dataDirStr.c_str()); - Debug() << "DEBUG: Current directory set to" << dataDirStr; - conf.read(argc, argv); - conf.readGameINI(); + if (SDL_getenv("MKXPZ_SELECT_PATH")) { + std::string dataDirStr = mkxp_fs::selectPath(win, DEBUG_FSELECT_MSG, DEBUG_FSELECT_PROMPT); + if (!dataDirStr.empty()) { + conf.gameFolder = dataDirStr; + mkxp_fs::setCurrentDirectory(dataDirStr.c_str()); + Debug() << "DEBUG: Current directory set to" << dataDirStr; + conf.read(argc, argv); + conf.readGameINI(); + } } - #endif /* OSX and Windows have their own native ways of