mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-04-28 13:17:58 +03:00
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:
parent
11e07a8f9d
commit
40f2e16842
6 changed files with 32 additions and 23 deletions
|
@ -24,6 +24,5 @@ if (CPACK_GENERATOR MATCHES "Bundle")
|
|||
set(CPACK_BUNDLE_NAME "soh")
|
||||
set(CPACK_BUNDLE_PLIST "macosx/Info.plist")
|
||||
set(CPACK_BUNDLE_ICON "macosx/soh.icns")
|
||||
set(CPACK_BUNDLE_STARTUP_COMMAND "macosx/soh-macos.sh")
|
||||
set(CPACK_BUNDLE_APPLE_CERT_APP "-")
|
||||
endif()
|
||||
|
|
|
@ -272,9 +272,12 @@ install(DIRECTORY ${CMAKE_BINARY_DIR}/assets
|
|||
PERMISSIONS ${PROGRAM_PERMISSIONS_EXECUTE}
|
||||
)
|
||||
|
||||
# Rename the installed soh binary to drop the macos suffix
|
||||
INSTALL(CODE "FILE(RENAME \${CMAKE_INSTALL_PREFIX}/../MacOS/soh-macos \${CMAKE_INSTALL_PREFIX}/../MacOS/soh)")
|
||||
|
||||
install(CODE "
|
||||
include(BundleUtilities)
|
||||
fixup_bundle(\"\${CMAKE_INSTALL_PREFIX}/soh-macos\" \"\" \"${dirs}\")
|
||||
fixup_bundle(\"\${CMAKE_INSTALL_PREFIX}/../MacOS/soh\" \"\" \"${dirs}\")
|
||||
")
|
||||
|
||||
endif()
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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
|
|
@ -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)) &&
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue