From f4c1332159fd7ee46bab17eddd639e7a635e5d4e Mon Sep 17 00:00:00 2001 From: GaryOderNichts <12049776+GaryOderNichts@users.noreply.github.com> Date: Wed, 17 Aug 2022 17:27:33 +0200 Subject: [PATCH 1/4] Fix Wii U stick input --- libultraship/libultraship/WiiUController.cpp | 8 ++++++++ libultraship/libultraship/WiiUGamepad.cpp | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/libultraship/libultraship/WiiUController.cpp b/libultraship/libultraship/WiiUController.cpp index cfaa9dbd7..19835a548 100644 --- a/libultraship/libultraship/WiiUController.cpp +++ b/libultraship/libultraship/WiiUController.cpp @@ -406,6 +406,14 @@ namespace Ship { x *= scale; y *= scale; } + + if (isRightStick) { + getRightStickX(virtualSlot) = x; + getRightStickY(virtualSlot) = y; + } else { + getLeftStickX(virtualSlot) = x; + getLeftStickY(virtualSlot) = y; + } } void WiiUController::CreateDefaultBinding(int32_t virtualSlot) { diff --git a/libultraship/libultraship/WiiUGamepad.cpp b/libultraship/libultraship/WiiUGamepad.cpp index 79d41b35f..64ef9e90f 100644 --- a/libultraship/libultraship/WiiUGamepad.cpp +++ b/libultraship/libultraship/WiiUGamepad.cpp @@ -279,6 +279,14 @@ namespace Ship { x *= scale; y *= scale; } + + if (isRightStick) { + getRightStickX(virtualSlot) = x; + getRightStickY(virtualSlot) = y; + } else { + getLeftStickX(virtualSlot) = x; + getLeftStickY(virtualSlot) = y; + } } void WiiUGamepad::CreateDefaultBinding(int32_t virtualSlot) { From 9bc6aac81e8918187e17448ed0d6d0081aedf558 Mon Sep 17 00:00:00 2001 From: qurious-pixel <62252937+qurious-pixel@users.noreply.github.com> Date: Thu, 18 Aug 2022 10:40:41 -0700 Subject: [PATCH 2/4] MacOS OTR (#973) --- CMakeLists.txt | 408 +++++++++++++++++++++------------------- Jenkinsfile | 2 +- soh/macosx/soh-macos.sh | 73 ++++++- 3 files changed, 281 insertions(+), 202 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f42fb69cb..38739bc8c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,195 +1,213 @@ -cmake_minimum_required(VERSION 3.16.0 FATAL_ERROR) - -set(CMAKE_SYSTEM_VERSION 10.0 CACHE STRING "" FORCE) -set(CMAKE_CXX_STANDARD 20 CACHE STRING "The C++ standard to use") -#set(CMAKE_C_STANDARD 11 CACHE STRING "The C standard to use") - issue with soh compile with MSVC - -if (CMAKE_SYSTEM_NAME STREQUAL "Darwin") -set(MACOSX_DEPLOYMENT_TARGET "10.15" CACHE STRING "Minimum OS X deployment version" FORCE) -endif() - -project(Ship C CXX) - -set(PROJECT_VERSION_MAJOR "3") -set(PROJECT_VERSION_MINOR "0") -set(PROJECT_VERSION_PATCH "0") - -set_property(DIRECTORY ${CMAKE_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT soh) -add_compile_options($<$:/MP>) - -if (CMAKE_SYSTEM_NAME STREQUAL "Windows") -include(CMake/automate-vcpkg.cmake) - -set(VCPKG_TRIPLET x64-windows-static) -set(VCPKG_TARGET_TRIPLET x64-windows-static) - -vcpkg_bootstrap() -vcpkg_install_packages(zlib bzip2 libpng SDL2 GLEW glfw3) -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}" STREQUAL "x64" - OR "${CMAKE_VS_PLATFORM_NAME}" STREQUAL "Win32")) - message(FATAL_ERROR "${CMAKE_VS_PLATFORM_NAME} arch is not supported!") - endif() -endif() - -################################################################################ -# Global configuration types -################################################################################ -if (CMAKE_SYSTEM_NAME STREQUAL "NintendoSwitch") -set(CMAKE_C_FLAGS_DEBUG "-O3 -ffast-math") -set(CMAKE_CXX_FLAGS_DEBUG "-O3 -ffast-math") -set(CMAKE_C_FLAGS_RELEASE "-O3 -ffast-math -DNDEBUG") -set(CMAKE_CXX_FLAGS_RELEASE "-O3 -ffast-math -DNDEBUG") -else() -set(CMAKE_C_FLAGS_RELEASE "-O2 -DNDEBUG") -set(CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG") -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) -endif() - -################################################################################ -# Global compiler options -################################################################################ -if(MSVC) - # remove default flags provided with CMake for MSVC - set(CMAKE_C_FLAGS "") - set(CMAKE_C_FLAGS_DEBUG "") - set(CMAKE_C_FLAGS_RELEASE "") - set(CMAKE_CXX_FLAGS "") - set(CMAKE_CXX_FLAGS_DEBUG "") - set(CMAKE_CXX_FLAGS_RELEASE "") -endif() - -################################################################################ -# Global linker options -################################################################################ -if(MSVC) - # remove default flags provided with CMake for MSVC - set(CMAKE_EXE_LINKER_FLAGS "") - set(CMAKE_MODULE_LINKER_FLAGS "") - set(CMAKE_SHARED_LINKER_FLAGS "") - set(CMAKE_STATIC_LINKER_FLAGS "") - set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS}") - set(CMAKE_MODULE_LINKER_FLAGS_DEBUG "${CMAKE_MODULE_LINKER_FLAGS}") - set(CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS}") - set(CMAKE_STATIC_LINKER_FLAGS_DEBUG "${CMAKE_STATIC_LINKER_FLAGS}") - set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS}") - set(CMAKE_MODULE_LINKER_FLAGS_RELEASE "${CMAKE_MODULE_LINKER_FLAGS}") - set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS}") - set(CMAKE_STATIC_LINKER_FLAGS_RELEASE "${CMAKE_STATIC_LINKER_FLAGS}") -endif() - -################################################################################ -# Common utils -################################################################################ -include(CMake/Utils.cmake) - -if(CMAKE_SYSTEM_NAME MATCHES "Linux") - get_linux_lsb_release_information() - message(STATUS "Linux ${LSB_RELEASE_ID_SHORT} ${LSB_RELEASE_VERSION_SHORT} ${LSB_RELEASE_CODENAME_SHORT}") -else() - message(STATUS ${CMAKE_SYSTEM_NAME}) -endif() - -################################################################################ -# Additional Global Settings(add specific info there) -################################################################################ -include(CMake/GlobalSettingsInclude.cmake OPTIONAL) - -################################################################################ -# Use solution folders feature -################################################################################ -set_property(GLOBAL PROPERTY USE_FOLDERS ON) - -################################################################################ -# Sub-projects -################################################################################ -add_subdirectory(libultraship/libultraship ${CMAKE_BINARY_DIR}/libultraship) -add_subdirectory(ZAPDTR/ZAPD ${CMAKE_BINARY_DIR}/ZAPD) -add_subdirectory(ZAPDTR/ZAPDUtils ${CMAKE_BINARY_DIR}/ZAPDUtils) -add_subdirectory(OTRExporter) -add_subdirectory(soh) -if(NOT CMAKE_SYSTEM_NAME MATCHES "Darwin|NintendoSwitch|CafeOS") -add_subdirectory(OTRGui) -endif() - -set_property(TARGET soh PROPERTY APPIMAGE_DESKTOP_FILE_TERMINAL YES) -set_property(TARGET soh PROPERTY APPIMAGE_DESKTOP_FILE "${CMAKE_SOURCE_DIR}/scripts/linux/appimage/soh.desktop") -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) -endif() - -find_package(Python3 COMPONENTS Interpreter) - -add_custom_target( - ExtractAssets - # CMake versions prior to 3.17 do not have the rm command, use remove instead for older versions - COMMAND ${CMAKE_COMMAND} -E $,remove,rm> -f oot.otr - COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/OTRExporter/extract_assets.py -z "$" - COMMAND ${CMAKE_COMMAND} -E copy oot.otr ${CMAKE_SOURCE_DIR} - COMMAND ${CMAKE_COMMAND} -E copy oot.otr ${CMAKE_BINARY_DIR}/soh - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/OTRExporter - COMMENT "Running asset extraction..." - DEPENDS ZAPD - BYPRODUCTS oot.otr ${CMAKE_SOURCE_DIR}/oot.otr -) - -if(CMAKE_SYSTEM_NAME MATCHES "Linux") - find_package(ImageMagick COMPONENTS convert) - if (ImageMagick_FOUND) - execute_process ( - COMMAND ${ImageMagick_convert_EXECUTABLE} soh/macosx/sohIcon.png -resize 512x512 ${CMAKE_BINARY_DIR}/sohIcon.png - OUTPUT_VARIABLE outVar - ) - endif() -endif() - -if(CMAKE_SYSTEM_NAME MATCHES "Darwin") -add_custom_target(CreateOSXIcons - COMMAND mkdir -p ${CMAKE_BINARY_DIR}/macosx/soh.iconset - COMMAND sips -z 16 16 soh/macosx/sohIcon.png --out ${CMAKE_BINARY_DIR}/macosx/soh.iconset/icon_16x16.png - COMMAND sips -z 32 32 soh/macosx/sohIcon.png --out ${CMAKE_BINARY_DIR}/macosx/soh.iconset/icon_16x16@2x.png - COMMAND sips -z 32 32 soh/macosx/sohIcon.png --out ${CMAKE_BINARY_DIR}/macosx/soh.iconset/icon_32x32.png - COMMAND sips -z 64 64 soh/macosx/sohIcon.png --out ${CMAKE_BINARY_DIR}/macosx/soh.iconset/icon_32x32@2x.png - COMMAND sips -z 128 128 soh/macosx/sohIcon.png --out ${CMAKE_BINARY_DIR}/macosx/soh.iconset/icon_128x128.png - COMMAND sips -z 256 256 soh/macosx/sohIcon.png --out ${CMAKE_BINARY_DIR}/macosx/soh.iconset/icon_128x128@2x.png - COMMAND sips -z 256 256 soh/macosx/sohIcon.png --out ${CMAKE_BINARY_DIR}/macosx/soh.iconset/icon_256x256.png - COMMAND sips -z 512 512 soh/macosx/sohIcon.png --out ${CMAKE_BINARY_DIR}/macosx/soh.iconset/icon_256x256@2x.png - COMMAND sips -z 512 512 soh/macosx/sohIcon.png --out ${CMAKE_BINARY_DIR}/macosx/soh.iconset/icon_512x512.png - COMMAND cp soh/macosx/sohIcon.png ${CMAKE_BINARY_DIR}/macosx/soh.iconset/icon_512x512@2x.png - COMMAND iconutil -c icns -o ${CMAKE_BINARY_DIR}/macosx/soh.icns ${CMAKE_BINARY_DIR}/macosx/soh.iconset - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} - COMMENT "Creating OSX icons ..." - ) -add_dependencies(soh CreateOSXIcons) -endif() - -if(CMAKE_SYSTEM_NAME MATCHES "Windows|NintendoSwitch|CafeOS") -INSTALL(FILES ${CMAKE_SOURCE_DIR}/README.md DESTINATION . COMPONENT ship RENAME readme.txt ) -endif() - -if(CMAKE_SYSTEM_NAME MATCHES "Linux") - set(CPACK_GENERATOR "External") -elseif(CMAKE_SYSTEM_NAME MATCHES "Windows|NintendoSwitch|CafeOS") - set(CPACK_GENERATOR "ZIP") -elseif(CMAKE_SYSTEM_NAME MATCHES "Darwin") - set(CPACK_GENERATOR "Bundle") -endif() - -set(CPACK_PROJECT_CONFIG_FILE ${CMAKE_SOURCE_DIR}/CMake/Packaging-2.cmake) -include(CMake/Packaging.cmake) +cmake_minimum_required(VERSION 3.16.0 FATAL_ERROR) + +set(CMAKE_SYSTEM_VERSION 10.0 CACHE STRING "" FORCE) +set(CMAKE_CXX_STANDARD 20 CACHE STRING "The C++ standard to use") +#set(CMAKE_C_STANDARD 11 CACHE STRING "The C standard to use") - issue with soh compile with MSVC + +if (CMAKE_SYSTEM_NAME STREQUAL "Darwin") +set(MACOSX_DEPLOYMENT_TARGET "10.15" CACHE STRING "Minimum OS X deployment version" FORCE) +endif() + +project(Ship C CXX) + +set(PROJECT_VERSION_MAJOR "3") +set(PROJECT_VERSION_MINOR "0") +set(PROJECT_VERSION_PATCH "0") + +set_property(DIRECTORY ${CMAKE_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT soh) +add_compile_options($<$:/MP>) + +if (CMAKE_SYSTEM_NAME STREQUAL "Windows") +include(CMake/automate-vcpkg.cmake) + +set(VCPKG_TRIPLET x64-windows-static) +set(VCPKG_TARGET_TRIPLET x64-windows-static) + +vcpkg_bootstrap() +vcpkg_install_packages(zlib bzip2 libpng SDL2 GLEW glfw3) +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}" STREQUAL "x64" + OR "${CMAKE_VS_PLATFORM_NAME}" STREQUAL "Win32")) + message(FATAL_ERROR "${CMAKE_VS_PLATFORM_NAME} arch is not supported!") + endif() +endif() + +################################################################################ +# Global configuration types +################################################################################ +if (CMAKE_SYSTEM_NAME STREQUAL "NintendoSwitch") +set(CMAKE_C_FLAGS_DEBUG "-O3 -ffast-math") +set(CMAKE_CXX_FLAGS_DEBUG "-O3 -ffast-math") +set(CMAKE_C_FLAGS_RELEASE "-O3 -ffast-math -DNDEBUG") +set(CMAKE_CXX_FLAGS_RELEASE "-O3 -ffast-math -DNDEBUG") +else() +set(CMAKE_C_FLAGS_RELEASE "-O2 -DNDEBUG") +set(CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG") +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) +endif() + +################################################################################ +# Global compiler options +################################################################################ +if(MSVC) + # remove default flags provided with CMake for MSVC + set(CMAKE_C_FLAGS "") + set(CMAKE_C_FLAGS_DEBUG "") + set(CMAKE_C_FLAGS_RELEASE "") + set(CMAKE_CXX_FLAGS "") + set(CMAKE_CXX_FLAGS_DEBUG "") + set(CMAKE_CXX_FLAGS_RELEASE "") +endif() + +################################################################################ +# Global linker options +################################################################################ +if(MSVC) + # remove default flags provided with CMake for MSVC + set(CMAKE_EXE_LINKER_FLAGS "") + set(CMAKE_MODULE_LINKER_FLAGS "") + set(CMAKE_SHARED_LINKER_FLAGS "") + set(CMAKE_STATIC_LINKER_FLAGS "") + set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS}") + set(CMAKE_MODULE_LINKER_FLAGS_DEBUG "${CMAKE_MODULE_LINKER_FLAGS}") + set(CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS}") + set(CMAKE_STATIC_LINKER_FLAGS_DEBUG "${CMAKE_STATIC_LINKER_FLAGS}") + set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS}") + set(CMAKE_MODULE_LINKER_FLAGS_RELEASE "${CMAKE_MODULE_LINKER_FLAGS}") + set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS}") + set(CMAKE_STATIC_LINKER_FLAGS_RELEASE "${CMAKE_STATIC_LINKER_FLAGS}") +endif() + +################################################################################ +# Common utils +################################################################################ +include(CMake/Utils.cmake) + +if(CMAKE_SYSTEM_NAME MATCHES "Linux") + get_linux_lsb_release_information() + message(STATUS "Linux ${LSB_RELEASE_ID_SHORT} ${LSB_RELEASE_VERSION_SHORT} ${LSB_RELEASE_CODENAME_SHORT}") +else() + message(STATUS ${CMAKE_SYSTEM_NAME}) +endif() + +################################################################################ +# Additional Global Settings(add specific info there) +################################################################################ +include(CMake/GlobalSettingsInclude.cmake OPTIONAL) + +################################################################################ +# Use solution folders feature +################################################################################ +set_property(GLOBAL PROPERTY USE_FOLDERS ON) + +################################################################################ +# Sub-projects +################################################################################ +add_subdirectory(libultraship/libultraship ${CMAKE_BINARY_DIR}/libultraship) +add_subdirectory(ZAPDTR/ZAPD ${CMAKE_BINARY_DIR}/ZAPD) +add_subdirectory(ZAPDTR/ZAPDUtils ${CMAKE_BINARY_DIR}/ZAPDUtils) +add_subdirectory(OTRExporter) +add_subdirectory(soh) +if(NOT CMAKE_SYSTEM_NAME MATCHES "Darwin|NintendoSwitch|CafeOS") +add_subdirectory(OTRGui) +endif() + +set_property(TARGET soh PROPERTY APPIMAGE_DESKTOP_FILE_TERMINAL YES) +set_property(TARGET soh PROPERTY APPIMAGE_DESKTOP_FILE "${CMAKE_SOURCE_DIR}/scripts/linux/appimage/soh.desktop") +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) +endif() + +find_package(Python3 COMPONENTS Interpreter) + +add_custom_target( + ExtractAssets + # CMake versions prior to 3.17 do not have the rm command, use remove instead for older versions + COMMAND ${CMAKE_COMMAND} -E $,remove,rm> -f oot.otr + COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/OTRExporter/extract_assets.py -z "$" + COMMAND ${CMAKE_COMMAND} -E copy oot.otr ${CMAKE_SOURCE_DIR} + COMMAND ${CMAKE_COMMAND} -E copy oot.otr ${CMAKE_BINARY_DIR}/soh + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/OTRExporter + COMMENT "Running asset extraction..." + DEPENDS ZAPD + BYPRODUCTS oot.otr ${CMAKE_SOURCE_DIR}/oot.otr +) + +if(CMAKE_SYSTEM_NAME MATCHES "Linux") + find_package(ImageMagick COMPONENTS convert) + if (ImageMagick_FOUND) + execute_process ( + COMMAND ${ImageMagick_convert_EXECUTABLE} soh/macosx/sohIcon.png -resize 512x512 ${CMAKE_BINARY_DIR}/sohIcon.png + OUTPUT_VARIABLE outVar + ) + endif() +endif() + +if(CMAKE_SYSTEM_NAME MATCHES "Darwin") +add_custom_target(CreateOSXIcons + COMMAND mkdir -p ${CMAKE_BINARY_DIR}/macosx/soh.iconset + COMMAND sips -z 16 16 soh/macosx/sohIcon.png --out ${CMAKE_BINARY_DIR}/macosx/soh.iconset/icon_16x16.png + COMMAND sips -z 32 32 soh/macosx/sohIcon.png --out ${CMAKE_BINARY_DIR}/macosx/soh.iconset/icon_16x16@2x.png + COMMAND sips -z 32 32 soh/macosx/sohIcon.png --out ${CMAKE_BINARY_DIR}/macosx/soh.iconset/icon_32x32.png + COMMAND sips -z 64 64 soh/macosx/sohIcon.png --out ${CMAKE_BINARY_DIR}/macosx/soh.iconset/icon_32x32@2x.png + COMMAND sips -z 128 128 soh/macosx/sohIcon.png --out ${CMAKE_BINARY_DIR}/macosx/soh.iconset/icon_128x128.png + COMMAND sips -z 256 256 soh/macosx/sohIcon.png --out ${CMAKE_BINARY_DIR}/macosx/soh.iconset/icon_128x128@2x.png + COMMAND sips -z 256 256 soh/macosx/sohIcon.png --out ${CMAKE_BINARY_DIR}/macosx/soh.iconset/icon_256x256.png + COMMAND sips -z 512 512 soh/macosx/sohIcon.png --out ${CMAKE_BINARY_DIR}/macosx/soh.iconset/icon_256x256@2x.png + COMMAND sips -z 512 512 soh/macosx/sohIcon.png --out ${CMAKE_BINARY_DIR}/macosx/soh.iconset/icon_512x512.png + COMMAND cp soh/macosx/sohIcon.png ${CMAKE_BINARY_DIR}/macosx/soh.iconset/icon_512x512@2x.png + COMMAND iconutil -c icns -o ${CMAKE_BINARY_DIR}/macosx/soh.icns ${CMAKE_BINARY_DIR}/macosx/soh.iconset + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + 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 ) +endif() + +if(CMAKE_SYSTEM_NAME MATCHES "Linux") + set(CPACK_GENERATOR "External") +elseif(CMAKE_SYSTEM_NAME MATCHES "Windows|NintendoSwitch|CafeOS") + set(CPACK_GENERATOR "ZIP") +elseif(CMAKE_SYSTEM_NAME MATCHES "Darwin") + set(CPACK_GENERATOR "Bundle") +endif() + +set(CPACK_PROJECT_CONFIG_FILE ${CMAKE_SOURCE_DIR}/CMake/Packaging-2.cmake) +include(CMake/Packaging.cmake) diff --git a/Jenkinsfile b/Jenkinsfile index ca6c9aef5..55c4b4f28 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -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' diff --git a/soh/macosx/soh-macos.sh b/soh/macosx/soh-macos.sh index 6ce17f55d..790c649fd 100755 --- a/soh/macosx/soh-macos.sh +++ b/soh/macosx/soh-macos.sh @@ -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 From 0971b9aa78444a0e773b47c757deb9f4cddf1444 Mon Sep 17 00:00:00 2001 From: briaguya <70942617+briaguya-ai@users.noreply.github.com> Date: Fri, 19 Aug 2022 09:46:11 -0400 Subject: [PATCH 3/4] only toggle menu with controller when controller nav enabled (#1043) --- libultraship/libultraship/ControlDeck.cpp | 5 ----- libultraship/libultraship/ImGuiImpl.cpp | 17 ++++------------- soh/soh/Enhancements/bootcommands.c | 3 +++ 3 files changed, 7 insertions(+), 18 deletions(-) diff --git a/libultraship/libultraship/ControlDeck.cpp b/libultraship/libultraship/ControlDeck.cpp index 6e3328053..36e581fc7 100644 --- a/libultraship/libultraship/ControlDeck.cpp +++ b/libultraship/libultraship/ControlDeck.cpp @@ -73,12 +73,7 @@ namespace Ship { } void ControlDeck::WriteToPad(OSContPad* pad) const { - - #ifdef __SWITCH__ - bool shouldBlockGameInput = CVar_GetS32("gOpenMenuBar", 0); - #else bool shouldBlockGameInput = CVar_GetS32("gOpenMenuBar", 0) && CVar_GetS32("gControlNav", 0); - #endif for (size_t i = 0; i < virtualDevices.size(); i++) { const std::shared_ptr backend = physicalDevices[virtualDevices[i]]; diff --git a/libultraship/libultraship/ImGuiImpl.cpp b/libultraship/libultraship/ImGuiImpl.cpp index b6353a736..b3b8a1c78 100644 --- a/libultraship/libultraship/ImGuiImpl.cpp +++ b/libultraship/libultraship/ImGuiImpl.cpp @@ -484,12 +484,7 @@ namespace SohImGui { io->ConfigFlags |= ImGuiConfigFlags_ViewportsEnable; } - #ifdef __SWITCH__ - bool enableControllerNavigation = true; - #else - bool enableControllerNavigation = CVar_GetS32("gControlNav", 0); - #endif - if (enableControllerNavigation && CVar_GetS32("gOpenMenuBar", 0)) { + if (CVar_GetS32("gControlNav", 0) && CVar_GetS32("gOpenMenuBar", 0)) { io->ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad | ImGuiConfigFlags_NavEnableKeyboard; } else { io->ConfigFlags &= ~ImGuiConfigFlags_NavEnableGamepad; @@ -921,19 +916,15 @@ namespace SohImGui { ImGui::DockSpace(dockId, ImVec2(0.0f, 0.0f), ImGuiDockNodeFlags_None | ImGuiDockNodeFlags_NoDockingInCentralNode); - if (ImGui::IsKeyPressed(TOGGLE_BTN) || ImGui::IsKeyPressed(TOGGLE_PAD_BTN)) { + if (ImGui::IsKeyPressed(TOGGLE_BTN) || + (ImGui::IsKeyPressed(TOGGLE_PAD_BTN) && CVar_GetS32("gControlNav", 0))) { bool menu_bar = CVar_GetS32("gOpenMenuBar", 0); CVar_SetS32("gOpenMenuBar", !menu_bar); needs_save = true; GlobalCtx2::GetInstance()->GetWindow()->SetMenuBar(menu_bar); ShowCursor(menu_bar, Dialogues::dMenubar); GlobalCtx2::GetInstance()->GetWindow()->GetControlDeck()->SaveControllerSettings(); - #ifdef __SWITCH__ - bool enableControllerNavigation = true; - #else - bool enableControllerNavigation = CVar_GetS32("gControlNav", 0); - #endif - if (enableControllerNavigation && CVar_GetS32("gOpenMenuBar", 0)) { + if (CVar_GetS32("gControlNav", 0) && CVar_GetS32("gOpenMenuBar", 0)) { io->ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad | ImGuiConfigFlags_NavEnableKeyboard; } else { io->ConfigFlags &= ~ImGuiConfigFlags_NavEnableGamepad; diff --git a/soh/soh/Enhancements/bootcommands.c b/soh/soh/Enhancements/bootcommands.c index c766049ae..c5d4fcdbc 100644 --- a/soh/soh/Enhancements/bootcommands.c +++ b/soh/soh/Enhancements/bootcommands.c @@ -25,6 +25,9 @@ void BootCommands_Init() CVar_RegisterS32("gDebugEnabled", 0); CVar_RegisterS32("gLanguages", 0); //0 = English / 1 = German / 2 = French CVar_RegisterS32("gHudColors", 1); //0 = N64 / 1 = NGC / 2 = Custom +#ifdef __SWITCH__ + CVar_RegisterS32("gControlNav", 1); // always enable controller nav on switch +#endif } //void BootCommands_ParseBootArgs(char* str) From a67c6b9e674a98dc8c4118c515e10a9fb46d7503 Mon Sep 17 00:00:00 2001 From: Christopher Leggett Date: Fri, 19 Aug 2022 19:36:44 -0400 Subject: [PATCH 4/4] Fixes vanilla ice traps and randomized ice smoke --- soh/soh/Enhancements/item-tables/ItemTableTypes.h | 2 +- soh/src/overlays/actors/ovl_En_Box/z_en_box.c | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/soh/soh/Enhancements/item-tables/ItemTableTypes.h b/soh/soh/Enhancements/item-tables/ItemTableTypes.h index 1a703f30d..7e5f1a9a3 100644 --- a/soh/soh/Enhancements/item-tables/ItemTableTypes.h +++ b/soh/soh/Enhancements/item-tables/ItemTableTypes.h @@ -19,7 +19,7 @@ typedef struct { /* 0x03 */ uint16_t textId; /* 0x04 */ uint16_t objectId; /* 0x06 */ uint16_t modIndex; // 0 = Vanilla, 1 = Randomizer, future mods will increment up? - /* 0x08 */ uint16_t getItemId; + /* 0x08 */ int16_t getItemId; /* 0x0A */ uint16_t gid; // Stores the GID value unmodified for future reference. /* 0x0C */ uint16_t collectable; // determines whether the item can be collected on the overworld. Will be true in most cases. } GetItemEntry; // size = 0x0F diff --git a/soh/src/overlays/actors/ovl_En_Box/z_en_box.c b/soh/src/overlays/actors/ovl_En_Box/z_en_box.c index a2f57ad6a..3e78982a3 100644 --- a/soh/src/overlays/actors/ovl_En_Box/z_en_box.c +++ b/soh/src/overlays/actors/ovl_En_Box/z_en_box.c @@ -481,8 +481,12 @@ void EnBox_WaitOpen(EnBox* this, GlobalContext* globalCtx) { } // Chests need to have a negative getItemId in order to not immediately give their item // when approaching. - sItem.getItemId = 0 - sItem.getItemId; - GiveItemEntryFromActorWithFixedRange(&this->dyna.actor, globalCtx, sItem); + if (gSaveContext.n64ddFlag) { + sItem.getItemId = 0 - sItem.getItemId; + GiveItemEntryFromActorWithFixedRange(&this->dyna.actor, globalCtx, sItem); + } else { + func_8002F554(&this->dyna.actor, globalCtx, -(this->dyna.actor.params >> 5 & 0x7F)); + } } if (Flags_GetTreasure(globalCtx, this->dyna.actor.params & 0x1F)) { EnBox_SetupAction(this, EnBox_Open); @@ -594,7 +598,7 @@ void EnBox_Update(Actor* thisx, GlobalContext* globalCtx) { } if (((!gSaveContext.n64ddFlag && ((this->dyna.actor.params >> 5 & 0x7F) == 0x7C)) || - (gSaveContext.n64ddFlag && sItem.getItemId == RG_ICE_TRAP)) && + (gSaveContext.n64ddFlag && ABS(sItem.getItemId) == RG_ICE_TRAP)) && this->actionFunc == EnBox_Open && this->skelanime.curFrame > 45 && this->iceSmokeTimer < 100) EnBox_SpawnIceSmoke(this, globalCtx); }