macOS Game Mode Support for 2Ship2Harkinian (#811)
Some checks are pending
generate-builds / generate-2ship-otr (push) Waiting to run
generate-builds / build-macos (push) Blocked by required conditions
generate-builds / build-linux (push) Blocked by required conditions
generate-builds / build-windows (push) Blocked by required conditions

* 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:
Lars-Christian Selland 2025-02-05 19:53:29 +01:00 committed by GitHub
parent a36b4aa977
commit ac1ad42db8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 28 additions and 25 deletions

View File

@ -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()

View File

@ -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()

View File

@ -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();

View File

@ -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")

View File

@ -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

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.2ship2harkinian.2s2h</string>
</dict>
<key>LSArchitecturePriority</key>
<array>
<string>arm64</string>