Make defining steam appID for xcode release builds completely optional

This commit is contained in:
Struma 2021-09-14 16:03:42 -04:00 committed by Roza
parent 5605817e5d
commit 869f9d6918
8 changed files with 21 additions and 25 deletions

View file

@ -5,9 +5,9 @@
// Created by ゾロアーク on 1/3/21. // Created by ゾロアーク on 1/3/21.
// //
// Will be used when building releases. Make sure to set it correctly. // If this is set to anything but 0, steamshim will use RestartAppIfNecessary instead of requiring
// Debug builds require steam_appid.txt // a steam_appid.txt
STEAM_APP_ID = 435150 STEAM_APP_ID = 0
STEAMSHIM_DEFINES = "GAME_LAUNCH_NAME=\"Z.steam\"" STEAM_APPID=$(STEAM_APP_ID) STEAMSHIM_DEFINES = "GAME_LAUNCH_NAME=\"Z.steam\"" STEAM_APPID=$(STEAM_APP_ID)

View file

@ -227,7 +227,6 @@
3B1C242025A1A8660075EF5D /* libsteam_api.dylib in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B1C241125A1A7120075EF5D /* libsteam_api.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; 3B1C242025A1A8660075EF5D /* libsteam_api.dylib in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B1C241125A1A7120075EF5D /* libsteam_api.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
3B1C242625A1A90B0075EF5D /* shim in CopyFiles */ = {isa = PBXBuildFile; fileRef = 3B1C235625A199370075EF5D /* shim */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; 3B1C242625A1A90B0075EF5D /* shim in CopyFiles */ = {isa = PBXBuildFile; fileRef = 3B1C235625A199370075EF5D /* shim */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
3B1C242B25A1AA1F0075EF5D /* steamshim_child.c in Sources */ = {isa = PBXBuildFile; fileRef = 3B1C236925A19B960075EF5D /* steamshim_child.c */; }; 3B1C242B25A1AA1F0075EF5D /* steamshim_child.c in Sources */ = {isa = PBXBuildFile; fileRef = 3B1C236925A19B960075EF5D /* steamshim_child.c */; };
3B1C244425A1BD220075EF5D /* steam_appid.txt in CopyFiles */ = {isa = PBXBuildFile; fileRef = 3B1C243E25A1B8D20075EF5D /* steam_appid.txt */; };
3B251DA626DA2CFA00E5D09B /* 3.0.0 in CopyFiles */ = {isa = PBXBuildFile; fileRef = 3B251DA526DA2CFA00E5D09B /* 3.0.0 */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; 3B251DA626DA2CFA00E5D09B /* 3.0.0 in CopyFiles */ = {isa = PBXBuildFile; fileRef = 3B251DA526DA2CFA00E5D09B /* 3.0.0 */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
3B251DA826DA2E9000E5D09B /* 3.0.0 in CopyFiles */ = {isa = PBXBuildFile; fileRef = 3B251DA526DA2CFA00E5D09B /* 3.0.0 */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; 3B251DA826DA2E9000E5D09B /* 3.0.0 in CopyFiles */ = {isa = PBXBuildFile; fileRef = 3B251DA526DA2CFA00E5D09B /* 3.0.0 */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
3B251DAA26DA2EAB00E5D09B /* 3.0.0 in CopyFiles */ = {isa = PBXBuildFile; fileRef = 3B251DA526DA2CFA00E5D09B /* 3.0.0 */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; 3B251DAA26DA2EAB00E5D09B /* 3.0.0 in CopyFiles */ = {isa = PBXBuildFile; fileRef = 3B251DA526DA2CFA00E5D09B /* 3.0.0 */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
@ -287,6 +286,7 @@
3B5E1F1E25A8820B0086FFDC /* libGLESv2.dylib in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B5E1F0A25A881FB0086FFDC /* libGLESv2.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; 3B5E1F1E25A8820B0086FFDC /* libGLESv2.dylib in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B5E1F0A25A881FB0086FFDC /* libGLESv2.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
3B5E1F1F25A8820D0086FFDC /* libEGL.dylib in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B5E1F0925A881FB0086FFDC /* libEGL.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; 3B5E1F1F25A8820D0086FFDC /* libEGL.dylib in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B5E1F0925A881FB0086FFDC /* libEGL.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
3B5E1F2025A8820F0086FFDC /* libGLESv2.dylib in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B5E1F0A25A881FB0086FFDC /* libGLESv2.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; 3B5E1F2025A8820F0086FFDC /* libGLESv2.dylib in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B5E1F0A25A881FB0086FFDC /* libGLESv2.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
3B5F5E7D26F1360C00DF792F /* steam_appid.txt in CopyFiles */ = {isa = PBXBuildFile; fileRef = 3B1C243E25A1B8D20075EF5D /* steam_appid.txt */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
3B97F77025E6178200A569B5 /* GameController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B480E9E25DCD16D001686B4 /* GameController.framework */; }; 3B97F77025E6178200A569B5 /* GameController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B480E9E25DCD16D001686B4 /* GameController.framework */; };
3BA08E9B256638C900449CFF /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3BD2B46925651C1B003DAD8A /* AudioToolbox.framework */; }; 3BA08E9B256638C900449CFF /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3BD2B46925651C1B003DAD8A /* AudioToolbox.framework */; };
3BA69454263DAB53004194EB /* libnsgif.c in Sources */ = {isa = PBXBuildFile; fileRef = 3BA6944E263DAB53004194EB /* libnsgif.c */; }; 3BA69454263DAB53004194EB /* libnsgif.c in Sources */ = {isa = PBXBuildFile; fileRef = 3BA6944E263DAB53004194EB /* libnsgif.c */; };
@ -594,6 +594,7 @@
dstSubfolderSpec = 7; dstSubfolderSpec = 7;
files = ( files = (
3B1C23E925A19C600075EF5D /* Assets.bundle in CopyFiles */, 3B1C23E925A19C600075EF5D /* Assets.bundle in CopyFiles */,
3B5F5E7D26F1360C00DF792F /* steam_appid.txt in CopyFiles */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
@ -632,16 +633,6 @@
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
3B1C244325A1BD1D0075EF5D /* CopyFiles */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "";
dstSubfolderSpec = 16;
files = (
3B1C244425A1BD220075EF5D /* steam_appid.txt in CopyFiles */,
);
runOnlyForDeploymentPostprocessing = 0;
};
3B251D9F26DA2C2A00E5D09B /* CopyFiles */ = { 3B251D9F26DA2C2A00E5D09B /* CopyFiles */ = {
isa = PBXCopyFilesBuildPhase; isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
@ -1908,7 +1899,6 @@
3B1C23EA25A19C600075EF5D /* CopyFiles */, 3B1C23EA25A19C600075EF5D /* CopyFiles */,
3B251DAB26DA2EBB00E5D09B /* CopyFiles */, 3B251DAB26DA2EBB00E5D09B /* CopyFiles */,
3B1C23EC25A19C600075EF5D /* Embed Frameworks */, 3B1C23EC25A19C600075EF5D /* Embed Frameworks */,
3B1C244325A1BD1D0075EF5D /* CopyFiles */,
); );
buildRules = ( buildRules = (
); );

View file

@ -31,7 +31,7 @@ std::string contentsOfAssetAsString(const char *baseName, const char *ext);
std::string getResourcePath(); std::string getResourcePath();
#ifdef MKXPZ_DEBUG #ifdef MKXPZ_DEBUG
std::string selectPath(SDL_Window *win); std::string selectPath(SDL_Window *win, const char *msg, const char *prompt);
#endif #endif
#endif #endif

View file

@ -101,10 +101,13 @@ std::string filesystemImpl::getResourcePath() {
} }
#ifdef MKXPZ_DEBUG #ifdef MKXPZ_DEBUG
std::string filesystemImpl::selectPath(SDL_Window *win) { std::string filesystemImpl::selectPath(SDL_Window *win, const char *msg, const char *prompt) {
NSOpenPanel *panel = [NSOpenPanel openPanel]; NSOpenPanel *panel = [NSOpenPanel openPanel];
panel.canChooseDirectories = true; panel.canChooseDirectories = true;
panel.canChooseFiles = false; panel.canChooseFiles = false;
if (msg) panel.message = @(msg);
if (prompt) panel.prompt = @(prompt);
//panel.directoryURL = [NSURL fileURLWithPath:NSFileManager.defaultManager.currentDirectoryPath]; //panel.directoryURL = [NSURL fileURLWithPath:NSFileManager.defaultManager.currentDirectoryPath];
SDL_SysWMinfo windowinfo{}; SDL_SysWMinfo windowinfo{};
@ -115,6 +118,9 @@ std::string filesystemImpl::selectPath(SDL_Window *win) {
}]; }];
[NSApp runModalForWindow:windowinfo.info.cocoa.window]; [NSApp runModalForWindow:windowinfo.info.cocoa.window];
// The window needs to be brought to the front again after the OpenPanel closes
[NSApplication.sharedApplication activateIgnoringOtherApps:true];
if (panel.URLs.count > 0) if (panel.URLs.count > 0)
return std::string(NSTOPATH(panel.URLs[0].path)); return std::string(NSTOPATH(panel.URLs[0].path));

View file

@ -334,9 +334,10 @@ int main(int argc, char *argv[]) {
return 0; return 0;
} }
// Temporary fix for easier debugging
#if defined(MKXPZ_BUILD_XCODE) && defined(MKXPZ_DEBUG) #if defined(MKXPZ_BUILD_XCODE) && defined(MKXPZ_DEBUG)
std::string dataDirStr = mkxp_fs::selectPath(win); #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."
#define DEBUG_FSELECT_PROMPT "Load Game"
std::string dataDirStr = mkxp_fs::selectPath(win, DEBUG_FSELECT_MSG, DEBUG_FSELECT_PROMPT);
if (!dataDirStr.empty()) { if (!dataDirStr.empty()) {
conf.gameFolder = dataDirStr; conf.gameFolder = dataDirStr;
mkxp_fs::setCurrentDirectory(dataDirStr.c_str()); mkxp_fs::setCurrentDirectory(dataDirStr.c_str());

View file

@ -12,5 +12,5 @@
std::string execPath(); std::string execPath();
std::string appParentPath(); std::string appResourcePath();
#endif /* steamshim_mac_helpers_h */ #endif /* steamshim_mac_helpers_h */

View file

@ -14,7 +14,6 @@ std::string execPath() {
return ret; return ret;
} }
std::string appParentPath() { std::string appResourcePath() {
std::string ret([NSBundle.mainBundle.bundlePath stringByDeletingLastPathComponent].UTF8String); return std::string(NSBundle.mainBundle.resourcePath.UTF8String);
return ret;
} }

View file

@ -658,12 +658,12 @@ static void deinitSteamworks(void) {
static int mainline(void) { static int mainline(void) {
#if (defined(MKXPZ_BUILD_XCODE) && !defined(MKXPZ_DEBUG)) || \ #if (defined(MKXPZ_BUILD_XCODE) && STEAM_APPID != 0) || \
(!defined(MKXPZ_BUILD_XCODE) && defined(STEAM_APPID)) (!defined(MKXPZ_BUILD_XCODE) && defined(STEAM_APPID))
if (SteamAPI_RestartAppIfNecessary(STEAM_APPID)) if (SteamAPI_RestartAppIfNecessary(STEAM_APPID))
return 0; return 0;
#elif defined(MKXPZ_BUILD_XCODE) && defined(MKXPZ_DEBUG) #elif defined(MKXPZ_BUILD_XCODE) && defined(MKXPZ_DEBUG)
chdir(appParentPath().c_str()); chdir(appResourcePath().c_str());
#endif #endif
PipeType pipeParentRead = NULLPIPE; PipeType pipeParentRead = NULLPIPE;