Search app parent directory for steam_appid.txt

This commit is contained in:
Roza 2021-01-03 04:27:14 -05:00
parent 61a6f646eb
commit cead3a8145
6 changed files with 49 additions and 15 deletions

View file

@ -0,0 +1 @@
435150

View file

@ -5,7 +5,11 @@
// Created by ゾロアーク on 1/3/21. // Created by ゾロアーク on 1/3/21.
// //
STEAMSHIM_DEFINES = "GAME_LAUNCH_NAME=\"Z.steam\"" //STEAM_APPID=12345678 // Will be used when building releases. Make sure to set it correctly.
// Debug builds require steam_appid.txt
STEAM_APP_ID = 435150
STEAMSHIM_DEFINES = "GAME_LAUNCH_NAME=\"Z.steam\"" STEAM_APPID=$(STEAM_APP_ID)
// Configuration settings file format documentation can be found at: // Configuration settings file format documentation can be found at:
// https://help.apple.com/xcode/#/dev745c5c974 // https://help.apple.com/xcode/#/dev745c5c974

View file

@ -256,6 +256,7 @@
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 */; };
3B312843259E7DC1002EAB43 /* miniffi.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3B312842259E7DC1002EAB43 /* miniffi.cpp */; }; 3B312843259E7DC1002EAB43 /* miniffi.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3B312842259E7DC1002EAB43 /* miniffi.cpp */; };
3B312844259E7DC1002EAB43 /* 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 */; }; 3B312845259E7DC1002EAB43 /* miniffi.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3B312842259E7DC1002EAB43 /* miniffi.cpp */; };
@ -647,6 +648,16 @@
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
3B1C244325A1BD1D0075EF5D /* CopyFiles */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "";
dstSubfolderSpec = 16;
files = (
3B1C244425A1BD220075EF5D /* steam_appid.txt in CopyFiles */,
);
runOnlyForDeploymentPostprocessing = 0;
};
3B522D79259BA0E3003301C4 /* Embed Frameworks */ = { 3B522D79259BA0E3003301C4 /* Embed Frameworks */ = {
isa = PBXCopyFilesBuildPhase; isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
@ -968,6 +979,7 @@
3B1C240025A19FD60075EF5D /* steamshim_mac_helpers.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = steamshim_mac_helpers.h; path = ../steamshim/steamshim_mac_helpers.h; sourceTree = "<group>"; }; 3B1C240025A19FD60075EF5D /* steamshim_mac_helpers.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = steamshim_mac_helpers.h; path = ../steamshim/steamshim_mac_helpers.h; sourceTree = "<group>"; };
3B1C240C25A1A4C50075EF5D /* steamshim.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = steamshim.xcconfig; path = config/steamshim.xcconfig; sourceTree = "<group>"; }; 3B1C240C25A1A4C50075EF5D /* steamshim.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = steamshim.xcconfig; path = config/steamshim.xcconfig; sourceTree = "<group>"; };
3B1C241125A1A7120075EF5D /* libsteam_api.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libsteam_api.dylib; path = Dependencies/Frameworks/steam/sdk/redistributable_bin/osx/libsteam_api.dylib; sourceTree = "<group>"; }; 3B1C241125A1A7120075EF5D /* libsteam_api.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libsteam_api.dylib; path = Dependencies/Frameworks/steam/sdk/redistributable_bin/osx/libsteam_api.dylib; sourceTree = "<group>"; };
3B1C243E25A1B8D20075EF5D /* steam_appid.txt */ = {isa = PBXFileReference; lastKnownFileType = text; name = steam_appid.txt; path = config/steam_appid.txt; sourceTree = "<group>"; };
3B312841259E7DC1002EAB43 /* miniffi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = miniffi.h; sourceTree = "<group>"; }; 3B312841259E7DC1002EAB43 /* miniffi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = miniffi.h; sourceTree = "<group>"; };
3B312842259E7DC1002EAB43 /* miniffi.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = miniffi.cpp; sourceTree = "<group>"; }; 3B312842259E7DC1002EAB43 /* miniffi.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = miniffi.cpp; sourceTree = "<group>"; };
3B426F6B256B8AC0009EA00F /* fs_std_impl.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = fs_std_impl.hpp; sourceTree = "<group>"; }; 3B426F6B256B8AC0009EA00F /* fs_std_impl.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = fs_std_impl.hpp; sourceTree = "<group>"; };
@ -1591,12 +1603,13 @@
name = steamshim; name = steamshim;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
3B1C240B25A1A43B0075EF5D /* steamshim */ = { 3B1C240B25A1A43B0075EF5D /* steam */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
3B1C240C25A1A4C50075EF5D /* steamshim.xcconfig */, 3B1C240C25A1A4C50075EF5D /* steamshim.xcconfig */,
3B1C243E25A1B8D20075EF5D /* steam_appid.txt */,
); );
name = steamshim; name = steam;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
3B1C241F25A1A84D0075EF5D /* Steam */ = { 3B1C241F25A1A84D0075EF5D /* Steam */ = {
@ -1694,7 +1707,7 @@
3BD2B3B2256518A1003DAD8A /* Configuration */ = { 3BD2B3B2256518A1003DAD8A /* Configuration */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
3B1C240B25A1A43B0075EF5D /* steamshim */, 3B1C240B25A1A43B0075EF5D /* steam */,
3B1C231D25A15F8F0075EF5D /* mkxp */, 3B1C231D25A15F8F0075EF5D /* mkxp */,
3BD2B7282565B35D003DAD8A /* mkxp.json */, 3BD2B7282565B35D003DAD8A /* mkxp.json */,
3BD2B3AF25651885003DAD8A /* entitlements.plist */, 3BD2B3AF25651885003DAD8A /* entitlements.plist */,
@ -1842,6 +1855,7 @@
3B1C23E825A19C600075EF5D /* CopyFiles */, 3B1C23E825A19C600075EF5D /* CopyFiles */,
3B1C23EA25A19C600075EF5D /* CopyFiles */, 3B1C23EA25A19C600075EF5D /* CopyFiles */,
3B1C23EC25A19C600075EF5D /* Embed Frameworks */, 3B1C23EC25A19C600075EF5D /* Embed Frameworks */,
3B1C244325A1BD1D0075EF5D /* CopyFiles */,
); );
buildRules = ( buildRules = (
); );
@ -2455,9 +2469,10 @@
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Manual;
COPY_PHASE_STRIP = NO; COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = dwarf; DEBUG_INFORMATION_FORMAT = dwarf;
DEVELOPMENT_TEAM = "";
ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES; ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu11; GCC_C_LANGUAGE_STANDARD = gnu11;
@ -2466,7 +2481,7 @@
GCC_OPTIMIZATION_LEVEL = 0; GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = ( GCC_PREPROCESSOR_DEFINITIONS = (
"$(STEAMSHIM_DEFINES)", "$(STEAMSHIM_DEFINES)",
STEAMSHIM_DEBUG, "$(inherited)",
); );
GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
@ -2482,7 +2497,9 @@
MTL_FAST_MATH = YES; MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES; ONLY_ACTIVE_ARCH = YES;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SDKROOT = macosx; SDKROOT = macosx;
SKIP_INSTALL = YES;
}; };
name = Debug; name = Debug;
}; };
@ -2521,14 +2538,18 @@
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Manual;
COPY_PHASE_STRIP = NO; COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEVELOPMENT_TEAM = "";
ENABLE_NS_ASSERTIONS = NO; ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu11; GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_NO_COMMON_BLOCKS = YES; GCC_NO_COMMON_BLOCKS = YES;
GCC_PREPROCESSOR_DEFINITIONS = "$(STEAMSHIM_DEFINES)"; GCC_PREPROCESSOR_DEFINITIONS = (
"$(STEAMSHIM_DEFINES)",
"$(inherited)",
);
GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNDECLARED_SELECTOR = YES;
@ -2542,7 +2563,9 @@
MTL_ENABLE_DEBUG_INFO = NO; MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES; MTL_FAST_MATH = YES;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SDKROOT = macosx; SDKROOT = macosx;
SKIP_INSTALL = YES;
}; };
name = Release; name = Release;
}; };

View file

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

View file

@ -9,9 +9,12 @@
#import "steamshim_mac_helpers.h" #import "steamshim_mac_helpers.h"
std::string execPath() { std::string execPath() {
std::string ret([NSString pathWithComponents:@[ NSString *p = [NSBundle.mainBundle.executablePath stringByDeletingLastPathComponent];
NSBundle.mainBundle.executablePath, std::string ret([NSString pathWithComponents:@[p, @(GAME_LAUNCH_NAME)]].UTF8String);
@(GAME_LAUNCH_NAME) return ret;
]].UTF8String); }
std::string appParentPath() {
std::string ret([NSBundle.mainBundle.bundlePath stringByDeletingLastPathComponent].UTF8String);
return ret;
} }

View file

@ -221,7 +221,6 @@ static bool launchChild(ProcessType *pid) {
#ifdef __APPLE__ #ifdef __APPLE__
char buf[300]; char buf[300];
strncpy(buf, execPath().c_str(), sizeof(buf)); strncpy(buf, execPath().c_str(), sizeof(buf));
strcat(buf, "_rt");
GArgv[0] = buf; GArgv[0] = buf;
#else #else
GArgv[0] = strdup("./" GAME_LAUNCH_NAME); GArgv[0] = strdup("./" GAME_LAUNCH_NAME);
@ -659,9 +658,12 @@ static void deinitSteamworks(void) {
static int mainline(void) { static int mainline(void) {
#ifdef STEAM_APPID #if (defined(MKXPZ_BUILD_XCODE) && !defined(MKXPZ_DEBUG)) || \
(!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)
chdir(appParentPath().c_str());
#endif #endif
PipeType pipeParentRead = NULLPIPE; PipeType pipeParentRead = NULLPIPE;