mirror of
https://github.com/HarbourMasters/2ship2harkinian.git
synced 2025-02-18 13:21:10 +00:00
macOS Game Mode Support for 2Ship2Harkinian (#811)
Some checks are pending
Some checks are pending
* final commit(hopefully) * Moving directory creation logic out of LUS * Update BenPort.cpp * move Ternary operator one line down to keep to the clang limit * I have no idea how clang works * Using ChatGPT to hopefully fix the formatting because I'm tired * ChatGPT is useless, it's brain time * Will Putin become the next Miss America? * I hope this works for slimming down 2s2h(Mac) as well My builds have gotten double their original size since I started taking care of them and I feel bad about it :( * Some final pre merge cleanup Removed the bash script and its references * Updated to follow Archez's new conventions * Parity with upstream * updated git ignore * update git ignore again * Re-added the folder creation function * I should pay more attention to what I am doing * Update mm/macosx/Info.plist.in Co-authored-by: Archez <Archez@users.noreply.github.com> * Update CMakeLists.txt * desperation * Revert "desperation" This reverts commit 6aea78dc92b767bc5073a6e632e3955a2b9ad451. * Update .gitignore * does this do the trick? * Revert "does this do the trick?" This reverts commit 267fbfb2bbb5a6306f485c30eb335870f90318b3. * Revert "Parity with upstream" This reverts commit 6bfdee805e0c8b41b104e1131a7341e14259f82b. * Update libultraship * Revert "Update libultraship" This reverts commit e9e07473bc5216311de92f0aeded00564079f7e7. --------- Co-authored-by: Archez <Archez@users.noreply.github.com>
This commit is contained in:
parent
a36b4aa977
commit
ac1ad42db8
@ -24,6 +24,5 @@ if (CPACK_GENERATOR MATCHES "Bundle")
|
||||
set(CPACK_BUNDLE_NAME "2s2h")
|
||||
set(CPACK_BUNDLE_PLIST "macosx/Info.plist")
|
||||
set(CPACK_BUNDLE_ICON "macosx/2s2h.icns")
|
||||
set(CPACK_BUNDLE_STARTUP_COMMAND "macosx/2s2h-macos.sh")
|
||||
set(CPACK_BUNDLE_APPLE_CERT_APP "-")
|
||||
endif()
|
||||
|
@ -217,9 +217,11 @@ install(FILES "${CMAKE_SOURCE_DIR}/OTRExporter/CFG/SymbolMap_MM.txt" DESTINATION
|
||||
# PERMISSIONS ${PROGRAM_PERMISSIONS_EXECUTE}
|
||||
# )
|
||||
|
||||
# Rename the installed soh binary to drop the macos suffix
|
||||
INSTALL(CODE "FILE(RENAME \${CMAKE_INSTALL_PREFIX}/../MacOS/2s2h-macos \${CMAKE_INSTALL_PREFIX}/../MacOS/2s2h)")
|
||||
install(CODE "
|
||||
include(BundleUtilities)
|
||||
fixup_bundle(\"\${CMAKE_INSTALL_PREFIX}/2s2h-macos\" \"\" \"${dirs}\")
|
||||
fixup_bundle(\"\${CMAKE_INSTALL_PREFIX}/../MacOS/2s2h\" \"\" \"${dirs}\")
|
||||
")
|
||||
|
||||
endif()
|
||||
|
@ -614,6 +614,23 @@ void DetectArchiveVersion(std::string fileName, bool isO2rType) {
|
||||
}
|
||||
}
|
||||
|
||||
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__
|
||||
@ -639,6 +656,7 @@ extern "C" void InitOTR() {
|
||||
}
|
||||
|
||||
#if not defined(__SWITCH__) && not defined(__WIIU__)
|
||||
CheckAndCreateModFolder();
|
||||
if (!std::filesystem::exists(mmPathO2R) && !std::filesystem::exists(mmPathZIP) &&
|
||||
!std::filesystem::exists(mmPathOtr)) {
|
||||
std::string installPath = Ship::Context::GetAppBundlePath();
|
||||
|
@ -604,7 +604,7 @@ else()
|
||||
)
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_SYSTEM_NAME MATCHES "NintendoSwitch|CafeOS")
|
||||
if(NOT CMAKE_SYSTEM_NAME MATCHES "Darwin|NintendoSwitch|CafeOS")
|
||||
INSTALL(TARGETS 2ship DESTINATION . COMPONENT 2s2h)
|
||||
endif()
|
||||
|
||||
@ -622,7 +622,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/2s2h-macos.sh.in ${CMAKE_BINARY_DIR}/macosx/2s2h-macos.sh @ONLY)
|
||||
INSTALL(TARGETS 2ship DESTINATION ../MacOS COMPONENT 2s2h)
|
||||
INSTALL(FILES ${CMAKE_BINARY_DIR}/gamecontrollerdb.txt DESTINATION ../MacOS COMPONENT 2s2h)
|
||||
INSTALL(FILES ${CMAKE_BINARY_DIR}/mm/2ship.o2r DESTINATION ../Resources COMPONENT 2s2h)
|
||||
elseif(NOT "${CMAKE_SYSTEM_NAME}" MATCHES "NintendoSwitch|CafeOS")
|
||||
|
@ -1,21 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
SNAME="$(dirname $0)"
|
||||
export SHIP_HOME="$HOME/Library/Application Support/com.2ship2harkinian.2s2h"
|
||||
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"/2s2h-macos
|
||||
|
||||
exit
|
@ -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.2ship2harkinian.2s2h</string>
|
||||
</dict>
|
||||
<key>LSArchitecturePriority</key>
|
||||
<array>
|
||||
<string>arm64</string>
|
||||
|
Loading…
x
Reference in New Issue
Block a user