Macos game mode support (#4993)

* Remove macos startup script and rework cpack bundling

---------

Co-authored-by: Lars-Christian Selland <larsy1995@gmail.com>

* Add helper for creating mods folder

---------

Co-authored-by: Lars-Christian Selland <larsy1995@gmail.com>

---------

Co-authored-by: Lars-Christian Selland <larsy1995@gmail.com>
This commit is contained in:
Archez 2025-02-04 04:48:41 -05:00 committed by GitHub
commit 40f2e16842
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 32 additions and 23 deletions

View file

@ -702,7 +702,7 @@ else()
)
endif()
if(NOT CMAKE_SYSTEM_NAME MATCHES "NintendoSwitch|CafeOS")
if(NOT CMAKE_SYSTEM_NAME MATCHES "Darwin|NintendoSwitch|CafeOS")
INSTALL(TARGETS soh DESTINATION . COMPONENT ship)
endif()
@ -720,7 +720,7 @@ execute_process(COMMAND ${CURL} -sSfL https://raw.githubusercontent.com/gabomdq/
if("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")
configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/macosx/Info.plist.in ${CMAKE_BINARY_DIR}/macosx/Info.plist @ONLY)
configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/macosx/soh-macos.sh.in ${CMAKE_BINARY_DIR}/macosx/soh-macos.sh @ONLY)
INSTALL(TARGETS soh DESTINATION ../MacOS COMPONENT ship)
INSTALL(FILES ${CMAKE_BINARY_DIR}/gamecontrollerdb.txt DESTINATION ../MacOS COMPONENT ship)
INSTALL(FILES ${CMAKE_BINARY_DIR}/soh/soh.otr DESTINATION ../Resources COMPONENT ship)
elseif(NOT "${CMAKE_SYSTEM_NAME}" MATCHES "NintendoSwitch|CafeOS")

View file

@ -33,6 +33,11 @@
<string>public.app-category.games</string>
<key>LSMinimumSystemVersion</key>
<string>10.15</string>
<key>LSEnvironment</key>
<dict>
<key>SHIP_HOME</key>
<string>~/Library/Application Support/com.shipofharkinian.soh</string>
</dict>
<key>LSArchitecturePriority</key>
<array>
<string>arm64</string>

View file

@ -1,19 +0,0 @@
#!/bin/bash
SNAME="$(dirname $0)"
export SHIP_HOME="$HOME/Library/Application Support/com.shipofharkinian.soh"
export SNAME
export RESPATH="${SNAME%/MacOS*}/Resources"
export LIBPATH="${SNAME%/MacOS*}/Frameworks"
export DYLD_FALLBACK_LIBRARY_PATH="$LIBPATH"
if [ ! -e "$SHIP_HOME" ]; then mkdir "$SHIP_HOME"; fi
if [ ! -e "$SHIP_HOME"/mods ]; then
mkdir -p "$SHIP_HOME"/mods
touch "$SHIP_HOME"/mods/custom_otr_files_go_here.txt
fi
"$RESPATH"/soh-macos
exit

View file

@ -1038,6 +1038,23 @@ bool PathTestCleanup(FILE* tfile) {
return true;
}
void CheckAndCreateModFolder() {
try {
std::string modsPath = Ship::Context::LocateFileAcrossAppDirs("mods", appShortName);
if (!std::filesystem::exists(modsPath)) {
// Create mods folder relative to app dir
modsPath = Ship::Context::GetPathRelativeToAppDirectory("mods", appShortName);
std::string filePath = modsPath + "/custom_mod_files_go_here.txt";
if (std::filesystem::create_directories(modsPath)) {
std::ofstream(filePath).close();
}
}
} catch (std::filesystem::filesystem_error const& ex) {
// Couldn't make the folder, continue silently
return;
}
}
extern "C" void InitOTR() {
#ifdef __SWITCH__
@ -1083,6 +1100,10 @@ extern "C" void InitOTR() {
}
#endif
#if not defined(__SWITCH__) && not defined(__WIIU__)
CheckAndCreateModFolder();
#endif
CheckSoHOTRVersion(Ship::Context::GetPathRelativeToAppBundle("soh.otr"));
if (!std::filesystem::exists(Ship::Context::LocateFileAcrossAppDirs("oot-mq.otr", appShortName)) &&