Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

macOS Game Mode Support for 2Ship2Harkinian #811

Merged
merged 27 commits into from
Feb 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
f734204
final commit(hopefully)
larsy1995 Oct 15, 2024
a0c7db1
Moving directory creation logic out of LUS
larsy1995 Oct 16, 2024
795819c
Update BenPort.cpp
larsy1995 Oct 16, 2024
9bc908f
move Ternary operator one line down to keep to the clang limit
larsy1995 Oct 16, 2024
611f313
I have no idea how clang works
larsy1995 Oct 16, 2024
b446042
Using ChatGPT to hopefully fix the formatting because I'm tired
larsy1995 Oct 16, 2024
b4e6bec
ChatGPT is useless, it's brain time
larsy1995 Oct 16, 2024
031c13c
Will Putin become the next Miss America?
larsy1995 Oct 16, 2024
d0b06bd
I hope this works for slimming down 2s2h(Mac) as well
larsy1995 Oct 18, 2024
18ea36d
Some final pre merge cleanup
larsy1995 Oct 20, 2024
657b08d
Updated to follow Archez's new conventions
larsy1995 Feb 5, 2025
6bfdee8
Parity with upstream
larsy1995 Feb 5, 2025
52af158
updated git ignore
larsy1995 Feb 5, 2025
0064df0
update git ignore again
larsy1995 Feb 5, 2025
7198554
Merge branch 'develop' into FinalTest
larsy1995 Feb 5, 2025
8cc02df
Re-added the folder creation function
larsy1995 Feb 5, 2025
65e3fc0
I should pay more attention to what I am doing
larsy1995 Feb 5, 2025
018c18a
Update mm/macosx/Info.plist.in
larsy1995 Feb 5, 2025
507b56f
Update CMakeLists.txt
larsy1995 Feb 5, 2025
6aea78d
desperation
larsy1995 Feb 5, 2025
3e8fd8a
Revert "desperation"
larsy1995 Feb 5, 2025
f8ba7d8
Update .gitignore
larsy1995 Feb 5, 2025
267fbfb
does this do the trick?
larsy1995 Feb 5, 2025
22d2346
Revert "does this do the trick?"
larsy1995 Feb 5, 2025
09a2b76
Revert "Parity with upstream"
larsy1995 Feb 5, 2025
e9e0747
Update libultraship
larsy1995 Feb 5, 2025
f3e9e04
Revert "Update libultraship"
larsy1995 Feb 5, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion CMake/Packaging-2.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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()
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
18 changes: 18 additions & 0 deletions mm/2s2h/BenPort.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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__
Expand All @@ -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();
Expand Down
4 changes: 2 additions & 2 deletions mm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand All @@ -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)
larsy1995 marked this conversation as resolved.
Show resolved Hide resolved
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")
Expand Down
21 changes: 0 additions & 21 deletions mm/macosx/2s2h-macos.sh.in

This file was deleted.

5 changes: 5 additions & 0 deletions mm/macosx/Info.plist.in
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
Loading