mirror of
https://github.com/mkxp-z/mkxp-z.git
synced 2025-09-10 12:02:53 +02:00
When debugging from Xcode, prompt for target path
This commit is contained in:
parent
5cc49efe2c
commit
4069863fa9
4 changed files with 90 additions and 8 deletions
|
@ -123,6 +123,12 @@
|
|||
3B1C230C25A144A40075EF5D /* libruby.3.0.dylib in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B1C230A25A144A10075EF5D /* libruby.3.0.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
|
||||
3B1C230E25A144BF0075EF5D /* libruby.3.0.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B1C230D25A144BF0075EF5D /* libruby.3.0.dylib */; };
|
||||
3B1C230F25A144C90075EF5D /* libruby.3.0.dylib in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B1C230D25A144BF0075EF5D /* libruby.3.0.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
|
||||
3B1C232F25A16CAC0075EF5D /* AppKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3BE081582568D3A60006849F /* AppKit.framework */; };
|
||||
3B1C233025A16CB20075EF5D /* AppKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3BE081582568D3A60006849F /* AppKit.framework */; };
|
||||
3B1C233125A16CB70075EF5D /* AppKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3BE081582568D3A60006849F /* AppKit.framework */; };
|
||||
3B1C233525A17C670075EF5D /* Assets.bundle in CopyFiles */ = {isa = PBXBuildFile; fileRef = 3BA08EA4256641ED00449CFF /* Assets.bundle */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
|
||||
3B1C233925A17CB80075EF5D /* Assets.bundle in CopyFiles */ = {isa = PBXBuildFile; fileRef = 3BA08EA4256641ED00449CFF /* Assets.bundle */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
|
||||
3B1C233C25A17CC40075EF5D /* Assets.bundle in CopyFiles */ = {isa = PBXBuildFile; fileRef = 3BA08EA4256641ED00449CFF /* Assets.bundle */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
|
||||
3B312843259E7DC1002EAB43 /* miniffi.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3B312842259E7DC1002EAB43 /* miniffi.cpp */; };
|
||||
3B312844259E7DC1002EAB43 /* miniffi.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3B312842259E7DC1002EAB43 /* miniffi.cpp */; };
|
||||
3B312845259E7DC1002EAB43 /* miniffi.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3B312842259E7DC1002EAB43 /* miniffi.cpp */; };
|
||||
|
@ -153,7 +159,6 @@
|
|||
3B5A8445256A0F6300BAF2E5 /* libopenal.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B5A8444256A0F6300BAF2E5 /* libopenal.a */; };
|
||||
3B5A8464256A46B200BAF2E5 /* systemImplApple.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3B5A8463256A46B200BAF2E5 /* systemImplApple.mm */; };
|
||||
3BA08E9B256638C900449CFF /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3BD2B46925651C1B003DAD8A /* AudioToolbox.framework */; };
|
||||
3BA08ED4256643C200449CFF /* Assets.bundle in CopyFiles */ = {isa = PBXBuildFile; fileRef = 3BA08EA4256641ED00449CFF /* Assets.bundle */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
|
||||
3BA08FA525674C9900449CFF /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3BA08FA425674C9400449CFF /* OpenGL.framework */; };
|
||||
3BC65CCD2584EDC60063AFF1 /* tilemapvx.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3B10ED7D2568E95D00372D13 /* tilemapvx.cpp */; };
|
||||
3BC65CCE2584EDC60063AFF1 /* SDL_sound.c in Sources */ = {isa = PBXBuildFile; fileRef = 3B10ED112568E8F100372D13 /* SDL_sound.c */; };
|
||||
|
@ -248,7 +253,6 @@
|
|||
3BC65D362584EDC60063AFF1 /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 3BD2B46525651BF3003DAD8A /* libz.tbd */; };
|
||||
3BC65D372584EDC60063AFF1 /* libiconv.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 3BD2B46825651C12003DAD8A /* libiconv.tbd */; };
|
||||
3BC65D3D2584EDC60063AFF1 /* icon.icns in Resources */ = {isa = PBXBuildFile; fileRef = 3BDB23E22564546E00C4A63D /* icon.icns */; };
|
||||
3BC65D402584EDC60063AFF1 /* Assets.bundle in CopyFiles */ = {isa = PBXBuildFile; fileRef = 3BA08EA4256641ED00449CFF /* Assets.bundle */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
|
||||
3BC65D5A2584EED10063AFF1 /* libvorbis.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3BC65D4A2584EED10063AFF1 /* libvorbis.a */; };
|
||||
3BC65D5B2584EED10063AFF1 /* libpixman-1.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3BC65D4B2584EED10063AFF1 /* libpixman-1.a */; };
|
||||
3BC65D5C2584EED10063AFF1 /* libphysfs.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3BC65D4C2584EED10063AFF1 /* libphysfs.a */; };
|
||||
|
@ -357,7 +361,6 @@
|
|||
3BC65E022584F3AD0063AFF1 /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 3BD2B46525651BF3003DAD8A /* libz.tbd */; };
|
||||
3BC65E062584F3AD0063AFF1 /* libiconv.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 3BD2B46825651C12003DAD8A /* libiconv.tbd */; };
|
||||
3BC65E0E2584F3AD0063AFF1 /* icon.icns in Resources */ = {isa = PBXBuildFile; fileRef = 3BDB23E22564546E00C4A63D /* icon.icns */; };
|
||||
3BC65E112584F3AD0063AFF1 /* Assets.bundle in CopyFiles */ = {isa = PBXBuildFile; fileRef = 3BA08EA4256641ED00449CFF /* Assets.bundle */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
|
||||
3BC65E1F2584F4290063AFF1 /* libturbojpeg.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3BC65D7E2584F3780063AFF1 /* libturbojpeg.a */; };
|
||||
3BC65E202584F4290063AFF1 /* libpixman-1.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3BC65D882584F3780063AFF1 /* libpixman-1.a */; };
|
||||
3BC65E212584F4290063AFF1 /* libopenal.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3BC65D842584F3780063AFF1 /* libopenal.a */; };
|
||||
|
@ -421,6 +424,36 @@
|
|||
/* End PBXContainerItemProxy section */
|
||||
|
||||
/* Begin PBXCopyFilesBuildPhase section */
|
||||
3B1C233325A17C380075EF5D /* CopyFiles */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
dstPath = Contents/PrivateAssets;
|
||||
dstSubfolderSpec = 1;
|
||||
files = (
|
||||
3B1C233525A17C670075EF5D /* Assets.bundle in CopyFiles */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
3B1C233725A17CAB0075EF5D /* CopyFiles */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
dstPath = Contents/PrivateAssets;
|
||||
dstSubfolderSpec = 1;
|
||||
files = (
|
||||
3B1C233925A17CB80075EF5D /* Assets.bundle in CopyFiles */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
3B1C233B25A17CBE0075EF5D /* CopyFiles */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
dstPath = Contents/PrivateAssets;
|
||||
dstSubfolderSpec = 1;
|
||||
files = (
|
||||
3B1C233C25A17CC40075EF5D /* Assets.bundle in CopyFiles */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
3B522D79259BA0E3003301C4 /* Embed Frameworks */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
|
@ -463,7 +496,6 @@
|
|||
dstPath = "";
|
||||
dstSubfolderSpec = 7;
|
||||
files = (
|
||||
3BA08ED4256643C200449CFF /* Assets.bundle in CopyFiles */,
|
||||
3B522DEF259C3E9D003301C4 /* mkxp.json in CopyFiles */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
|
@ -529,7 +561,6 @@
|
|||
dstPath = "";
|
||||
dstSubfolderSpec = 7;
|
||||
files = (
|
||||
3BC65D402584EDC60063AFF1 /* Assets.bundle in CopyFiles */,
|
||||
3B522DF1259C3E9F003301C4 /* mkxp.json in CopyFiles */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
|
@ -540,7 +571,6 @@
|
|||
dstPath = "";
|
||||
dstSubfolderSpec = 7;
|
||||
files = (
|
||||
3BC65E112584F3AD0063AFF1 /* Assets.bundle in CopyFiles */,
|
||||
3B522DED259C3E97003301C4 /* mkxp.json in CopyFiles */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
|
@ -870,6 +900,7 @@
|
|||
3BC65D5C2584EED10063AFF1 /* libphysfs.a in Frameworks */,
|
||||
3BC65D302584EDC60063AFF1 /* CoreGraphics.framework in Frameworks */,
|
||||
3BC65D312584EDC60063AFF1 /* libbz2.tbd in Frameworks */,
|
||||
3B1C233125A16CB70075EF5D /* AppKit.framework in Frameworks */,
|
||||
3B522DD0259BFF0B003301C4 /* libcrypto.a in Frameworks */,
|
||||
3BC65D322584EDC60063AFF1 /* CoreAudio.framework in Frameworks */,
|
||||
3BC65D332584EDC60063AFF1 /* AudioToolbox.framework in Frameworks */,
|
||||
|
@ -910,6 +941,7 @@
|
|||
3BC65E232584F4290063AFF1 /* libfreetype.a in Frameworks */,
|
||||
3BC65E2A2584F4290063AFF1 /* libsigc-2.0.a in Frameworks */,
|
||||
3BC65DFA2584F3AD0063AFF1 /* CoreGraphics.framework in Frameworks */,
|
||||
3B1C232F25A16CAC0075EF5D /* AppKit.framework in Frameworks */,
|
||||
3B522DCA259BFEE0003301C4 /* libcrypto.a in Frameworks */,
|
||||
3BC65DFB2584F3AD0063AFF1 /* libbz2.tbd in Frameworks */,
|
||||
3BC65DFC2584F3AD0063AFF1 /* CoreAudio.framework in Frameworks */,
|
||||
|
@ -938,6 +970,7 @@
|
|||
3B522DD8259BFF2D003301C4 /* libcrypto.a in Frameworks */,
|
||||
3B5A8445256A0F6300BAF2E5 /* libopenal.a in Frameworks */,
|
||||
3BE08107256879FE0006849F /* libpixman-1.a in Frameworks */,
|
||||
3B1C233025A16CB20075EF5D /* AppKit.framework in Frameworks */,
|
||||
3BE0811B256879FE0006849F /* libogg.a in Frameworks */,
|
||||
3BE08109256879FE0006849F /* libSDL2.a in Frameworks */,
|
||||
3BE0814A2568A5F60006849F /* libturbojpeg.a in Frameworks */,
|
||||
|
@ -1523,6 +1556,7 @@
|
|||
3BC65CCC2584EDC60063AFF1 /* Sources */,
|
||||
3BC65D1A2584EDC60063AFF1 /* Frameworks */,
|
||||
3BC65D3C2584EDC60063AFF1 /* Resources */,
|
||||
3B1C233B25A17CBE0075EF5D /* CopyFiles */,
|
||||
3BC65D3E2584EDC60063AFF1 /* CopyFiles */,
|
||||
3B522D7F259BA0EC003301C4 /* Embed Frameworks */,
|
||||
);
|
||||
|
@ -1543,6 +1577,7 @@
|
|||
3BC65D8D2584F3AD0063AFF1 /* Sources */,
|
||||
3BC65DDB2584F3AD0063AFF1 /* Frameworks */,
|
||||
3BC65E0D2584F3AD0063AFF1 /* Resources */,
|
||||
3B1C233325A17C380075EF5D /* CopyFiles */,
|
||||
3BC65E0F2584F3AD0063AFF1 /* CopyFiles */,
|
||||
3B522D79259BA0E3003301C4 /* Embed Frameworks */,
|
||||
);
|
||||
|
@ -1563,6 +1598,7 @@
|
|||
3BD2B64C2565AEC0003DAD8A /* Sources */,
|
||||
3BD2B6E12565AEC0003DAD8A /* Frameworks */,
|
||||
3BD2B6F82565AEC0003DAD8A /* Resources */,
|
||||
3B1C233725A17CAB0075EF5D /* CopyFiles */,
|
||||
3B5A843B2569F95A00BAF2E5 /* CopyFiles */,
|
||||
3B522D7C259BA0E8003301C4 /* Embed Frameworks */,
|
||||
);
|
||||
|
@ -2510,6 +2546,7 @@
|
|||
"MKXPZ_ALCDEVICE=ALCdevice",
|
||||
"MKXPZ_VERSION=\"$(MARKETING_VERSION)\"",
|
||||
MKXPZ_MINIFFI,
|
||||
MKXPZ_DEBUG,
|
||||
AL_LIBTYPE_STATIC,
|
||||
);
|
||||
HEADER_SEARCH_PATHS = (
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#define filesystemImpl_h
|
||||
|
||||
#include <string>
|
||||
#include <SDL_video.h>
|
||||
|
||||
namespace filesystemImpl {
|
||||
bool fileExists(const char *path);
|
||||
|
@ -24,6 +25,10 @@ std::string normalizePath(const char *path, bool preferred, bool absolute);
|
|||
#ifdef MKXPZ_BUILD_XCODE
|
||||
std::string getPathForAsset(const char *baseName, const char *ext);
|
||||
std::string contentsOfAssetAsString(const char *baseName, const char *ext);
|
||||
|
||||
#ifdef MKXPZ_DEBUG
|
||||
std::string selectPath(SDL_Window *win);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
};
|
||||
|
|
|
@ -5,7 +5,13 @@
|
|||
// Created by ゾロアーク on 11/21/20.
|
||||
//
|
||||
|
||||
#ifdef MKXPZ_DEBUG
|
||||
#import <AppKit/AppKit.h>
|
||||
#import <SDL_syswm.h>
|
||||
#else
|
||||
#import <Foundation/Foundation.h>
|
||||
#endif
|
||||
|
||||
#import "filesystemImpl.h"
|
||||
#import "util/exception.h"
|
||||
|
||||
|
@ -52,8 +58,9 @@ std::string filesystemImpl::normalizePath(const char *path, bool preferred, bool
|
|||
NSString *getPathForAsset_internal(const char *baseName, const char *ext) {
|
||||
NSBundle *assetBundle = [NSBundle bundleWithPath:
|
||||
[NSString stringWithFormat:
|
||||
@"%@/%s",
|
||||
NSBundle.mainBundle.resourcePath,
|
||||
@"%@/%s/%s",
|
||||
NSBundle.mainBundle.bundlePath,
|
||||
"Contents/PrivateAssets",
|
||||
"Assets.bundle"
|
||||
]
|
||||
];
|
||||
|
@ -83,3 +90,23 @@ std::string filesystemImpl::contentsOfAssetAsString(const char *baseName, const
|
|||
return std::string(fileContents.UTF8String);
|
||||
|
||||
}
|
||||
|
||||
std::string filesystemImpl::selectPath(SDL_Window *win) {
|
||||
NSOpenPanel *panel = [NSOpenPanel openPanel];
|
||||
panel.canChooseDirectories = true;
|
||||
panel.canChooseFiles = false;
|
||||
//panel.directoryURL = [NSURL fileURLWithPath:NSFileManager.defaultManager.currentDirectoryPath];
|
||||
|
||||
SDL_SysWMinfo windowinfo{};
|
||||
SDL_GetWindowWMInfo(win, &windowinfo);
|
||||
|
||||
[panel beginSheetModalForWindow:windowinfo.info.cocoa.window completionHandler:^(NSModalResponse res){
|
||||
[NSApp stopModalWithCode:res];
|
||||
}];
|
||||
|
||||
[NSApp runModalForWindow:windowinfo.info.cocoa.window];
|
||||
if (panel.URLs.count > 0)
|
||||
return std::string(NSTOPATH(panel.URLs[0].path));
|
||||
|
||||
return std::string();
|
||||
}
|
||||
|
|
13
src/main.cpp
13
src/main.cpp
|
@ -311,6 +311,19 @@ int main(int argc, char *argv[]) {
|
|||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Temporary fix for easier debugging
|
||||
#if defined(MKXPZ_BUILD_XCODE) && defined(MKXPZ_DEBUG)
|
||||
std::string dataDirStr = mkxp_fs::selectPath(win);
|
||||
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
|
||||
* dealing with icons; don't interfere with them */
|
||||
|
|
Loading…
Add table
Reference in a new issue