mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2024-11-25 02:42:18 -05:00
MacOS OTR (#973)
This commit is contained in:
parent
ad3efccb88
commit
9bc6aac81e
@ -31,15 +31,15 @@ endif()
|
||||
# Set target arch type if empty. Visual studio solution generator provides it.
|
||||
################################################################################
|
||||
if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
||||
if(NOT CMAKE_VS_PLATFORM_NAME)
|
||||
set(CMAKE_VS_PLATFORM_NAME "x64")
|
||||
endif()
|
||||
message("${CMAKE_VS_PLATFORM_NAME} architecture in use")
|
||||
if(NOT CMAKE_VS_PLATFORM_NAME)
|
||||
set(CMAKE_VS_PLATFORM_NAME "x64")
|
||||
endif()
|
||||
message("${CMAKE_VS_PLATFORM_NAME} architecture in use")
|
||||
|
||||
if(NOT ("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64"
|
||||
OR "${CMAKE_VS_PLATFORM_NAME}" STREQUAL "Win32"))
|
||||
message(FATAL_ERROR "${CMAKE_VS_PLATFORM_NAME} arch is not supported!")
|
||||
endif()
|
||||
if(NOT ("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64"
|
||||
OR "${CMAKE_VS_PLATFORM_NAME}" STREQUAL "Win32"))
|
||||
message(FATAL_ERROR "${CMAKE_VS_PLATFORM_NAME} arch is not supported!")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
################################################################################
|
||||
@ -57,7 +57,7 @@ set(CMAKE_OBJCXX_FLAGS_RELEASE "-O2 -DNDEBUG")
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_BUILD_TYPE )
|
||||
set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Choose the type of build." FORCE)
|
||||
set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Choose the type of build." FORCE)
|
||||
endif()
|
||||
|
||||
################################################################################
|
||||
@ -131,7 +131,7 @@ set_property(TARGET soh PROPERTY APPIMAGE_DESKTOP_FILE "${CMAKE_SOURCE_DIR}/scri
|
||||
set_property(TARGET soh PROPERTY APPIMAGE_ICON_FILE "${CMAKE_BINARY_DIR}/sohIcon.png")
|
||||
|
||||
if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
|
||||
INSTALL(PROGRAMS "${CMAKE_SOURCE_DIR}/scripts/linux/appimage/soh.sh" DESTINATION . COMPONENT appimage)
|
||||
install(PROGRAMS "${CMAKE_SOURCE_DIR}/scripts/linux/appimage/soh.sh" DESTINATION . COMPONENT appimage)
|
||||
endif()
|
||||
|
||||
find_package(Python3 COMPONENTS Interpreter)
|
||||
@ -177,14 +177,32 @@ add_custom_target(CreateOSXIcons
|
||||
COMMENT "Creating OSX icons ..."
|
||||
)
|
||||
add_dependencies(soh CreateOSXIcons)
|
||||
|
||||
add_custom_target(Assets ALL
|
||||
COMMAND ${CMAKE_COMMAND} -Dsrc_dir="${CMAKE_SOURCE_DIR}/OTRGui/assets/extractor" -Ddst_dir="${CMAKE_BINARY_DIR}/assets/extractor" -P "${CMAKE_SOURCE_DIR}/OTRGui/Overwrite.cmake"
|
||||
COMMAND ${CMAKE_COMMAND} -Dsrc_dir="${CMAKE_SOURCE_DIR}/OTRExporter/assets" -Ddst_dir="${CMAKE_BINARY_DIR}/assets/game" -P "${CMAKE_SOURCE_DIR}/OTRGui/Overwrite.cmake"
|
||||
COMMAND ${CMAKE_COMMAND} -Dsrc_dir="${CMAKE_SOURCE_DIR}/soh/assets/xml" -Ddst_dir="${CMAKE_BINARY_DIR}/assets/extractor/xmls" -P "${CMAKE_SOURCE_DIR}/OTRGui/Overwrite.cmake"
|
||||
)
|
||||
add_dependencies(soh Assets)
|
||||
|
||||
install(TARGETS ZAPD DESTINATION ${CMAKE_BINARY_DIR}/assets/extractor)
|
||||
|
||||
set(PROGRAM_PERMISSIONS_EXECUTE OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_EXECUTE WORLD_READ)
|
||||
|
||||
install(DIRECTORY ${CMAKE_BINARY_DIR}/assets
|
||||
DESTINATION .
|
||||
PATTERN ZAPD.out
|
||||
PERMISSIONS ${PROGRAM_PERMISSIONS_EXECUTE}
|
||||
)
|
||||
|
||||
endif()
|
||||
|
||||
if(CMAKE_SYSTEM_NAME MATCHES "Windows|NintendoSwitch|CafeOS")
|
||||
INSTALL(FILES ${CMAKE_SOURCE_DIR}/README.md DESTINATION . COMPONENT ship RENAME readme.txt )
|
||||
install(FILES ${CMAKE_SOURCE_DIR}/README.md DESTINATION . COMPONENT ship RENAME readme.txt )
|
||||
endif()
|
||||
|
||||
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
|
||||
set(CPACK_GENERATOR "External")
|
||||
set(CPACK_GENERATOR "External")
|
||||
elseif(CMAKE_SYSTEM_NAME MATCHES "Windows|NintendoSwitch|CafeOS")
|
||||
set(CPACK_GENERATOR "ZIP")
|
||||
elseif(CMAKE_SYSTEM_NAME MATCHES "Darwin")
|
||||
|
2
Jenkinsfile
vendored
2
Jenkinsfile
vendored
@ -23,7 +23,7 @@ pipeline {
|
||||
])
|
||||
sh '''
|
||||
cp ../../ZELOOTD.z64 OTRExporter/baserom_non_mq.z64
|
||||
cmake --no-warn-unused-cli -H. -Bbuild-cmake -GNinja -DCMAKE_BUILD_TYPE:STRING=Release
|
||||
cmake --no-warn-unused-cli -H. -Bbuild-cmake -GNinja -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64"
|
||||
cmake --build build-cmake --target ExtractAssets --config Release
|
||||
'''
|
||||
stash includes: 'soh/assets/**/*', name: 'assets'
|
||||
|
@ -1,8 +1,69 @@
|
||||
#!/bin/sh
|
||||
BUNDLE="`echo "$0" | sed -e 's/\/Contents\/MacOS\/.*//'`"
|
||||
RESOURCES="$BUNDLE/Contents/Resources"
|
||||
#!/bin/bash
|
||||
|
||||
export DYLD_FRAMEWORK_PATH=$RESOURCES/Frameworks
|
||||
export DYLD_LIBRARY_PATH=$RESOURCES/bin
|
||||
SNAME="$(dirname $0)"
|
||||
export DATA_SHARE="$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"
|
||||
|
||||
exec "$RESOURCES/soh-macos"
|
||||
while [ ! -e "$DATA_SHARE/oot.otr" ]; do
|
||||
ASSETDIR="$(mktemp -d /tmp/assets-XXXXX)"
|
||||
export ASSETDIR
|
||||
cp -r "$RESPATH/assets" "$ASSETDIR"
|
||||
mkdir -p "$ASSETDIR"/tmp
|
||||
mkdir -p "$ASSETDIR"/Extract/assets
|
||||
DROPROM="$(osascript -ss - "$ASSETDIR" <<-EOF
|
||||
set romFile to choose file of type {"b64","n64","v64","z64"} with prompt "Please select your ROM:"
|
||||
set destinationFolder to POSIX file "$ASSETDIR"
|
||||
tell application "Finder"
|
||||
duplicate romFile to destinationFolder
|
||||
end tell
|
||||
EOF
|
||||
)"
|
||||
"$DROPROM"
|
||||
for rom in "$ASSETDIR"/*.*64
|
||||
do
|
||||
if [ ! -e "$rom" ]; then
|
||||
echo "no ROM"
|
||||
osascript -e 'display dialog "Select ROM to generate OTR" giving up after 5'
|
||||
rm -r "$ASSETDIR"
|
||||
exit
|
||||
fi
|
||||
done
|
||||
cp "$ASSETDIR"/*.*64 "$ASSETDIR"/tmp/rom.z64
|
||||
cp -r "$ASSETDIR"/assets/game/ship_of_harkinian "$ASSETDIR"/Extract/assets/
|
||||
cd "$ASSETDIR" || return
|
||||
ROMHASH="$(shasum "$ASSETDIR"/tmp/rom.z64 | awk '{ print $1 }')"
|
||||
case "$ROMHASH" in
|
||||
cee6bc3c2a634b41728f2af8da54d9bf8cc14099)
|
||||
export ROM=GC_NMQ_D;;
|
||||
0227d7c0074f2d0ac935631990da8ec5914597b4)
|
||||
export ROM=GC_NMQ_PAL_F;;
|
||||
*)
|
||||
WRONGHASH="$(osascript -ss - "$ROMHASH" <<-EOF
|
||||
display dialog "Incompatible ROM hash $ROMHASH" \
|
||||
with title "Incompatible ROM hash" \
|
||||
with icon caution \
|
||||
giving up after 5
|
||||
EOF
|
||||
)"
|
||||
"$WRONGHASH"
|
||||
rm -r "$ASSETDIR"
|
||||
exit;;
|
||||
esac
|
||||
echo "$ROM"
|
||||
|
||||
osascript -e 'display notification "Processing OTR..." with title "SOH: Generating OTR"'
|
||||
assets/extractor/ZAPD.out ed -i assets/extractor/xmls/"${ROM}" -b tmp/rom.z64 -fl assets/extractor/filelists -o placeholder -osf placeholder -gsf 1 -rconf assets/extractor/Config_"${ROM}".xml -se OTR
|
||||
if [ -e "$PWD"/oot.otr ]; then
|
||||
osascript -e 'display notification "OTR Successfully Generated" with title "SOH: Generating OTR"'
|
||||
if [ ! -e "$DATA_SHARE" ]; then mkdir "$DATA_SHARE"; fi
|
||||
cp "$ASSETDIR"/oot.otr "$DATA_SHARE"
|
||||
rm -r "$ASSETDIR"
|
||||
fi
|
||||
break
|
||||
done
|
||||
|
||||
"$RESPATH"/soh-macos
|
||||
exit
|
||||
|
Loading…
Reference in New Issue
Block a user