diff --git a/.gitignore b/.gitignore index e4e07589b..1df76208d 100644 --- a/.gitignore +++ b/.gitignore @@ -24,6 +24,10 @@ docs/doxygen/ *.map *.dump out.txt +*.sln +*.vcxproj +*.vcxproj.user +*.vcxproj.filters # Tool artifacts tools/mipspro7.2_compiler/ @@ -423,3 +427,19 @@ xcuserdata/ !*.xcworkspace/contents.xcworkspacedata /*.gcno **/xcshareddata/WorkspaceSettings.xcsettings + +# cmake +CMakeLists.txt.user +CMakeCache.txt +CMakeFiles +CMakeScripts +Testing +Makefile +cmake_install.cmake +install_manifest.txt +compile_commands.json +CTestTestfile.cmake +_deps +*/extract_assets_cmake* +/build* +build.c diff --git a/BUILDING.md b/BUILDING.md index 2a52e3f58..7606032ba 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -2,22 +2,62 @@ ## Windows - 1. Requires [Python](https://www.python.org/downloads/) >= 3.6. - 2. Install [Visual Studio 2022 Community Edition](https://visualstudio.microsoft.com/vs/community/) - 3. In the Visual Studio Installer, install `MSVC v142 - VS 2019 C++`. - 4. Clone the Ship of Harkinian repository. - 5. Place one or more [compatible](#compatible-roms) roms in the `OTRExporter` directory with namings of your choice. - 6. Run `OTRExporter/OTRExporter.sln`. - 7. Switch the solution to `Release x64`. - 8. Build the solution. - 9. Launching `OTRExporter/extract_assets.py` will generate an `oot.otr` archive file in `OTRExporter/oot.otr`. - 10. Run `soh/soh.sln` - 11. Switch the solution to `Release x86` or `Release x64`. - 12. Build the solution. - 13. Copy the `OTRExporter/oot.otr` archive file to `soh/Release`. - 14. Launch `soh.exe`. +1. Requires Visual Studio 2022 Community Edition && `python3, cmake, git` (can be installed via chocolatey or manually) +2. Clone the Ship of Harkinian repository +3. Place one or more [compatible](#compatible-roms) roms in the `OTRExporter` directory with namings of your choice + +_Note: Instructions assume using powershell_ +```powershell +# Navigate to the Shipwright repo within powershell. ie: cd "C:\yourpath\Shipwright" +cd Shipwright + +# Setup cmake project +& 'C:\Program Files\CMake\bin\cmake' -S . -B "build/x64" -G "Visual Studio 17 2022" -T v142 -A x64 # -DCMAKE_BUILD_TYPE:STRING=Release (if you're packaging) +# Extract assets & generate OTR (run this anytime you need to regenerate OTR) +& 'C:\Program Files\CMake\bin\cmake.exe' --build .\build\x64 --target ExtractAssets # --config Release (if you're packaging) +# Compile project +& 'C:\Program Files\CMake\bin\cmake.exe' --build .\build\x64 # --config Release (if you're packaging) + +# Now you can run the executable in .\build\x64 + +# If you need to clean the project you can run +& 'C:\Program Files\CMake\bin\cmake.exe' --build .\build\x64 --target clean +``` + +### Developing SoH +With the cmake build system you have two options for working on the project: + +#### Visual Studio +To develop using Visual Studio you only need to use cmake to generate the solution file: +```powershell +# Generates Ship.sln at `build/x64` +& 'C:\Program Files\CMake\bin\cmake' -S . -B "build/x64" -G "Visual Studio 17 2022" -T v142 -A x64 +``` + +#### Visual Studio Code or another editor +To develop using Visual Studio Code or another editor you only need to open the repository in it. +To build you'll need to follow the instructions from the building section. + +_Note: If you're using Visual Studio Code, the [cpack plugin](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cmake-tools) makes it very easy to just press run and debug._ + +_Experimental: You can also use another build system entirely rathen than MSVC like [Ninja](https://ninja-build.org/) for possibly better performance._ + + +### Generating the distributable +After compiling the project you can generate the distributable by running: +```powershell +# Go to build folder +cd "build/x64" +# Generate +& 'C:\Program Files\CMake\bin\cpack.exe' -G ZIP +``` ## Linux +1. Requires `gcc >= 10, x11, curl, python3, sdl2 >= 2.0.22, libpng, glew >= 2.2, ninja, cmake, lld` + +**Important: For maximum performance make sure you have ninja build tools installed!** + +_Note: If you're using Visual Studio Code, the [cpack plugin](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cmake-tools) makes it very easy to just press run and debug._ ```bash # Clone the repo @@ -25,41 +65,87 @@ git clone https://github.com/HarbourMasters/Shipwright.git cd Shipwright # Copy the baserom to the OTRExporter folder cp OTRExporter -# Build the docker image -sudo docker build . -t soh -# Run the docker image with the working directory mounted to /soh -sudo docker run --rm -it -v $(pwd):/soh soh /bin/bash +# Generate Ninja project +cmake -H. -Bbuild-cmake -GNinja # -DCMAKE_BUILD_TYPE:STRING=Release (if you're packaging) +# Extract assets & generate OTR (run this anytime you need to regenerate OTR) +cmake --build build-cmake --target ExtractAssets +# Compile the project +cmake --build build-cmake # --config Release (if you're packaging) + +# Now you can run the executable in ./build-cmake/soh/soh.elf +# To develop the project open the repository in VSCode (or your preferred editor) + +# If you need to clean the project you can run +cmake --build build-cmake --target clean ``` -Inside the Docker container: + +### Generating a distributable +After compiling the project you can generate a distributable by running of the following: ```bash -cd soh -# Extract the assets/Compile the exporter/Run the exporter -make setup -j$(nproc) OPTFLAGS=-O2 DEBUG=0 -# Compile the code -make -j $(nproc) OPTFLAGS=-O2 DEBUG=0 +# Go to build folder +cd build-cmake +# Generate +cpack -G DEB +cpack -G ZIP +cpack -G External (creates appimage) ``` ## macOS +1. Requires Xcode (or xcode-tools) && `sdl2, libpng, glew, ninja, cmake` (can be installed via homebrew, macports, etc) + +**Important: For maximum performance make sure you have ninja build tools installed!** + +_Note: If you're using Visual Studio Code, the [cpack plugin](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cmake-tools) makes it very easy to just press run and debug._ -1. Requires Xcode (or xcode-tools) && `sdl2, libpng, glew, cmake, pkgconfig, dylibbundler` (can be installed via homebrew, macports, etc) ```bash # Clone the repo git clone https://github.com/HarbourMasters/Shipwright.git cd ShipWright # Copy the baserom to the OTRExporter folder cp OTRExporter +# Generate Ninja project +cmake -H. -Bbuild-cmake -GNinja # -DCMAKE_BUILD_TYPE:STRING=Release (if you're packaging) +# Extract assets & generate OTR (run this anytime you need to regenerate OTR) +cmake --build build-cmake --target ExtractAssets +# Compile the project +cmake --build build-cmake # --config Release (if you're packaging) -cd soh -# Extract the assets/Compile the exporter/Run the exporter -# -jX defines number of cores to use for compilation - lower or remove entirely if having issues -make setup -j8 DEBUG=0 -# Compile the code (watch the -j parameter as above) -make -j8 DEBUG=0 -# Create macOS app bundle -make appbundle +# Now you can run the executable in ./build-cmake/soh/soh-macos +# To develop the project open the repository in VSCode (or your preferred editor) + +# If you need to clean the project you can run +cmake --build build-cmake --target clean +``` + +### Generating a distributable +After compiling the project you can generate a distributable by running of the following: +```bash +# Go to build folder +cd build-cmake +# Generate +cpack +``` + +## Switch +1. Requires that your build machine is setup with the tools necessary for your platform above +2. Requires that you have the switch build tools installed +3. Clone the Ship of Harkinian repository +4. Place one or more [compatible](#compatible-roms) roms in the `OTRExporter` directory with namings of your choice + +```bash +cd Shipwright +# Setup cmake project for your host machine +cmake -H. -Bbuild-cmake -GNinja +# Extract assets & generate OTR (run this anytime you need to regenerate OTR) +cmake --build build-cmake --target ExtractAssets +# Setup cmake project for building for Switch +cmake -H. -Bbuild-switch -GNinja -DCMAKE_TOOLCHAIN_FILE=/opt/devkitpro/cmake/Switch.cmake +# Build project and generate nro +cmake --build build-switch --target soh_nro + +# Now you can run the executable in ./build-switch/soh/soh.nro +# To develop the project open the repository in VSCode (or your preferred editor) ``` -9. Copy your OTR file to ~/Library/Application\ Support/com.shipofharkinian.soh -10. Launch soh app in the soh folder! # Compatible Roms ``` diff --git a/CMake/Default.cmake b/CMake/Default.cmake new file mode 100644 index 000000000..f4d0ba084 --- /dev/null +++ b/CMake/Default.cmake @@ -0,0 +1,65 @@ +################################################################################ +# Command for variable_watch. This command issues error message, if a variable +# is changed. If variable PROPERTY_READER_GUARD_DISABLED is TRUE nothing happens +# variable_watch( property_reader_guard) +################################################################################ +function(property_reader_guard VARIABLE ACCESS VALUE CURRENT_LIST_FILE STACK) + if("${PROPERTY_READER_GUARD_DISABLED}") + return() + endif() + + if("${ACCESS}" STREQUAL "MODIFIED_ACCESS") + message(FATAL_ERROR + " Variable ${VARIABLE} is not supposed to be changed.\n" + " It is used only for reading target property ${VARIABLE}.\n" + " Use\n" + " set_target_properties(\"\" PROPERTIES \"${VARIABLE}\" \"\")\n" + " or\n" + " set_target_properties(\"\" PROPERTIES \"${VARIABLE}_\" \"\")\n" + " instead.\n") + endif() +endfunction() + +################################################################################ +# Create variable with generator expression that expands to value of +# target property _. If property is empty or not set then property +# is used instead. Variable has watcher property_reader_guard that +# doesn't allow to edit it. +# create_property_reader() +# Input: +# name - Name of watched property and output variable +################################################################################ +function(create_property_reader NAME) + set(PROPERTY_READER_GUARD_DISABLED TRUE) + set(CONFIG_VALUE "$>>>") + set(IS_CONFIG_VALUE_EMPTY "$") + set(GENERAL_VALUE "$>") + set("${NAME}" "$" PARENT_SCOPE) + variable_watch("${NAME}" property_reader_guard) +endfunction() + +################################################################################ +# Set property $_${PROPS_CONFIG_U} of ${PROPS_TARGET} to +# set_config_specific_property( ) +# Input: +# name - Prefix of property name +# value - New value +################################################################################ +function(set_config_specific_property NAME VALUE) + set_target_properties("${PROPS_TARGET}" PROPERTIES "${NAME}_${PROPS_CONFIG_U}" "${VALUE}") +endfunction() + +################################################################################ + +create_property_reader("TARGET_NAME") +create_property_reader("OUTPUT_DIRECTORY") + +set_config_specific_property("TARGET_NAME" "${PROPS_TARGET}") +set_config_specific_property("OUTPUT_NAME" "${TARGET_NAME}") +set_config_specific_property("ARCHIVE_OUTPUT_NAME" "${TARGET_NAME}") +set_config_specific_property("LIBRARY_OUTPUT_NAME" "${TARGET_NAME}") +set_config_specific_property("RUNTIME_OUTPUT_NAME" "${TARGET_NAME}") + +set_config_specific_property("ARCHIVE_OUTPUT_DIRECTORY" "${OUTPUT_DIRECTORY}") +set_config_specific_property("LIBRARY_OUTPUT_DIRECTORY" "${OUTPUT_DIRECTORY}") +set_config_specific_property("RUNTIME_OUTPUT_DIRECTORY" "${OUTPUT_DIRECTORY}") \ No newline at end of file diff --git a/CMake/DefaultCXX.cmake b/CMake/DefaultCXX.cmake new file mode 100644 index 000000000..e87721511 --- /dev/null +++ b/CMake/DefaultCXX.cmake @@ -0,0 +1,12 @@ +include("${CMAKE_CURRENT_LIST_DIR}/Default.cmake") + +set_config_specific_property("OUTPUT_DIRECTORY" "${CMAKE_SOURCE_DIR}$<$>:/${CMAKE_VS_PLATFORM_NAME}>/${PROPS_CONFIG}") + +if(MSVC) + create_property_reader("DEFAULT_CXX_EXCEPTION_HANDLING") + create_property_reader("DEFAULT_CXX_DEBUG_INFORMATION_FORMAT") + + set_target_properties("${PROPS_TARGET}" PROPERTIES MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>DLL") + set_config_specific_property("DEFAULT_CXX_EXCEPTION_HANDLING" "/EHsc") + set_config_specific_property("DEFAULT_CXX_DEBUG_INFORMATION_FORMAT" "/Zi") +endif() \ No newline at end of file diff --git a/CMake/Packaging-2.cmake b/CMake/Packaging-2.cmake new file mode 100644 index 000000000..2e1183190 --- /dev/null +++ b/CMake/Packaging-2.cmake @@ -0,0 +1,30 @@ +set(CPACK_ARCHIVE_COMPONENT_INSTALL ON) +set(CPACK_COMPONENT_INCLUDE_TOPLEVEL_DIRECTORY 0) +set(CPACK_COMPONENTS_ALL "ship" "appimage") + +if (NOT CPACK_GENERATOR STREQUAL "External") + list(REMOVE_ITEM CPACK_COMPONENTS_ALL "appimage") +endif() + +if (CPACK_GENERATOR MATCHES "DEB|RPM") +# https://unix.stackexchange.com/a/11552/254512 +set(CPACK_PACKAGING_INSTALL_PREFIX "/opt/ship/bin")#/${CMAKE_PROJECT_VERSION}") +set(CPACK_COMPONENT_INCLUDE_TOPLEVEL_DIRECTORY 0) +elseif (CPACK_GENERATOR MATCHES "ZIP") +set(CPACK_PACKAGING_INSTALL_PREFIX "") +endif() + +if (CPACK_GENERATOR MATCHES "External") +set(CPACK_ARCHIVE_COMPONENT_INSTALL ON) +SET(CPACK_MONOLITHIC_INSTALL 1) +set(CPACK_PACKAGING_INSTALL_PREFIX "/usr/bin") +endif() + +if (CPACK_GENERATOR MATCHES "Bundle") + set(CPACK_BUNDLE_NAME "soh") + set(CPACK_BUNDLE_PLIST "../soh/macosx/Info.plist") + set(CPACK_BUNDLE_ICON "macosx/soh.icns") + set(CPACK_BUNDLE_STARTUP_COMMAND "../soh/macosx/soh-macos.sh") + set(CPACK_BUNDLE_APPLE_CERT_APP "-") +endif() + diff --git a/CMake/Packaging.cmake b/CMake/Packaging.cmake new file mode 100644 index 000000000..907f8da76 --- /dev/null +++ b/CMake/Packaging.cmake @@ -0,0 +1,90 @@ +# these are cache variables, so they could be overwritten with -D, + +set(CPACK_PACKAGE_NAME "${PROJECT_NAME}" + CACHE STRING "The resulting package name" +) + +set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Simple C++ application" + CACHE STRING "Package description for the package metadata" +) +set(CPACK_PACKAGE_VENDOR "Some Company") + +set(CPACK_VERBATIM_VARIABLES YES) + +set(CPACK_PACKAGE_INSTALL_DIRECTORY ${CPACK_PACKAGE_NAME}) +SET(CPACK_OUTPUT_FILE_PREFIX "${CMAKE_SOURCE_DIR}/_packages") + +set(CPACK_PACKAGE_VERSION_MAJOR ${PROJECT_VERSION_MAJOR}) +set(CPACK_PACKAGE_VERSION_MINOR ${PROJECT_VERSION_MINOR}) +set(CPACK_PACKAGE_VERSION_PATCH ${PROJECT_VERSION_PATCH}) +set(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}") + +set(CPACK_PACKAGE_CONTACT "YOUR@E-MAIL.net") +set(CPACK_DEBIAN_PACKAGE_MAINTAINER "YOUR NAME") + +#set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE") +set(CPACK_RESOURCE_FILE_README "${CMAKE_SOURCE_DIR}/README.md") + +if (CMAKE_SYSTEM_NAME STREQUAL "Linux") +set(CPACK_SYSTEM_NAME ${LSB_RELEASE_CODENAME_SHORT}) +# package name for deb +# if set, then instead of some-application-0.9.2-Linux.deb +# you'll get some-application_0.9.2_amd64.deb (note the underscores too) +#set(CPACK_DEBIAN_FILE_NAME DEB-DEFAULT) +execute_process(COMMAND dpkg --print-architecture OUTPUT_VARIABLE ARCHITECTURE OUTPUT_STRIP_TRAILING_WHITESPACE) +set( CPACK_DEBIAN_FILE_NAME ${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${CPACK_SYSTEM_NAME}-${ARCHITECTURE}.deb ) +# if you want every group to have its own package, +# although the same happens if this is not sent (so it defaults to ONE_PER_GROUP) +# and CPACK_DEB_COMPONENT_INSTALL is set to YES +set(CPACK_COMPONENTS_GROUPING ALL_COMPONENTS_IN_ONE)#ONE_PER_GROUP) +# without this you won't be able to pack only specified component +set(CPACK_DEB_COMPONENT_INSTALL YES) + +set(CPACK_EXTERNAL_ENABLE_STAGING YES) +set(CPACK_EXTERNAL_PACKAGE_SCRIPT "${PROJECT_BINARY_DIR}/appimage-generate.cmake") + +file(GENERATE + OUTPUT "${PROJECT_BINARY_DIR}/appimage-generate.cmake" + CONTENT [[ +include(CMakePrintHelpers) +cmake_print_variables(CPACK_TEMPORARY_DIRECTORY) +cmake_print_variables(CPACK_TOPLEVEL_DIRECTORY) +cmake_print_variables(CPACK_PACKAGE_DIRECTORY) +cmake_print_variables(CPACK_PACKAGE_FILE_NAME) + +find_program(LINUXDEPLOY_EXECUTABLE + NAMES linuxdeploy linuxdeploy-x86_64.AppImage + PATHS ${CPACK_PACKAGE_DIRECTORY}/linuxdeploy) + +if (NOT LINUXDEPLOY_EXECUTABLE) + message(STATUS "Downloading linuxdeploy") + set(LINUXDEPLOY_EXECUTABLE ${CPACK_PACKAGE_DIRECTORY}/linuxdeploy/linuxdeploy) + file(DOWNLOAD + https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage + ${LINUXDEPLOY_EXECUTABLE} + INACTIVITY_TIMEOUT 10 + LOG ${CPACK_PACKAGE_DIRECTORY}/linuxdeploy/download.log + STATUS LINUXDEPLOY_DOWNLOAD) + execute_process(COMMAND chmod +x ${LINUXDEPLOY_EXECUTABLE} COMMAND_ECHO STDOUT) +endif() + +execute_process( + COMMAND + ${CMAKE_COMMAND} -E env + OUTPUT=${CPACK_PACKAGE_FILE_NAME}.appimage + VERSION=$,${CPACK_PACKAGE_VERSION},0.1.0> + ${LINUXDEPLOY_EXECUTABLE} + --appimage-extract-and-run + --appdir=${CPACK_TEMPORARY_DIRECTORY} + --executable=$ + $<$>:--desktop-file=$> + $<$>:--icon-file=$> + --output=appimage + # --verbosity=2 +) +]]) + +endif() + +include(CPack) + diff --git a/CMake/Utils.cmake b/CMake/Utils.cmake new file mode 100644 index 000000000..c691eefc6 --- /dev/null +++ b/CMake/Utils.cmake @@ -0,0 +1,248 @@ +# utils file for projects came from visual studio solution with cmake-converter. + +################################################################################ +# Wrap each token of the command with condition +################################################################################ +cmake_policy(PUSH) +cmake_policy(SET CMP0054 NEW) +macro(prepare_commands) + unset(TOKEN_ROLE) + unset(COMMANDS) + foreach(TOKEN ${ARG_COMMANDS}) + if("${TOKEN}" STREQUAL "COMMAND") + set(TOKEN_ROLE "KEYWORD") + elseif("${TOKEN_ROLE}" STREQUAL "KEYWORD") + set(TOKEN_ROLE "CONDITION") + elseif("${TOKEN_ROLE}" STREQUAL "CONDITION") + set(TOKEN_ROLE "COMMAND") + elseif("${TOKEN_ROLE}" STREQUAL "COMMAND") + set(TOKEN_ROLE "ARG") + endif() + + if("${TOKEN_ROLE}" STREQUAL "KEYWORD") + list(APPEND COMMANDS "${TOKEN}") + elseif("${TOKEN_ROLE}" STREQUAL "CONDITION") + set(CONDITION ${TOKEN}) + elseif("${TOKEN_ROLE}" STREQUAL "COMMAND") + list(APPEND COMMANDS "$<$:${DUMMY}>$<${CONDITION}:${TOKEN}>") + elseif("${TOKEN_ROLE}" STREQUAL "ARG") + list(APPEND COMMANDS "$<${CONDITION}:${TOKEN}>") + endif() + endforeach() +endmacro() +cmake_policy(POP) + +################################################################################ +# Transform all the tokens to absolute paths +################################################################################ +macro(prepare_output) + unset(OUTPUT) + foreach(TOKEN ${ARG_OUTPUT}) + if(IS_ABSOLUTE ${TOKEN}) + list(APPEND OUTPUT "${TOKEN}") + else() + list(APPEND OUTPUT "${CMAKE_CURRENT_SOURCE_DIR}/${TOKEN}") + endif() + endforeach() +endmacro() + +################################################################################ +# Parse add_custom_command_if args. +# +# Input: +# PRE_BUILD - Pre build event option +# PRE_LINK - Pre link event option +# POST_BUILD - Post build event option +# TARGET - Target +# OUTPUT - List of output files +# DEPENDS - List of files on which the command depends +# COMMANDS - List of commands(COMMAND condition1 commannd1 args1 COMMAND +# condition2 commannd2 args2 ...) +# Output: +# OUTPUT - Output files +# DEPENDS - Files on which the command depends +# COMMENT - Comment +# PRE_BUILD - TRUE/FALSE +# PRE_LINK - TRUE/FALSE +# POST_BUILD - TRUE/FALSE +# TARGET - Target name +# COMMANDS - Prepared commands(every token is wrapped in CONDITION) +# NAME - Unique name for custom target +# STEP - PRE_BUILD/PRE_LINK/POST_BUILD +################################################################################ +function(add_custom_command_if_parse_arguments) + cmake_parse_arguments("ARG" "PRE_BUILD;PRE_LINK;POST_BUILD" "TARGET;COMMENT" "DEPENDS;OUTPUT;COMMANDS" ${ARGN}) + + if(WIN32) + set(DUMMY "cd.") + elseif(UNIX) + set(DUMMY "true") + endif() + + prepare_commands() + prepare_output() + + set(DEPENDS "${ARG_DEPENDS}") + set(COMMENT "${ARG_COMMENT}") + set(PRE_BUILD "${ARG_PRE_BUILD}") + set(PRE_LINK "${ARG_PRE_LINK}") + set(POST_BUILD "${ARG_POST_BUILD}") + set(TARGET "${ARG_TARGET}") + if(PRE_BUILD) + set(STEP "PRE_BUILD") + elseif(PRE_LINK) + set(STEP "PRE_LINK") + elseif(POST_BUILD) + set(STEP "POST_BUILD") + endif() + set(NAME "${TARGET}_${STEP}") + + set(OUTPUT "${OUTPUT}" PARENT_SCOPE) + set(DEPENDS "${DEPENDS}" PARENT_SCOPE) + set(COMMENT "${COMMENT}" PARENT_SCOPE) + set(PRE_BUILD "${PRE_BUILD}" PARENT_SCOPE) + set(PRE_LINK "${PRE_LINK}" PARENT_SCOPE) + set(POST_BUILD "${POST_BUILD}" PARENT_SCOPE) + set(TARGET "${TARGET}" PARENT_SCOPE) + set(COMMANDS "${COMMANDS}" PARENT_SCOPE) + set(STEP "${STEP}" PARENT_SCOPE) + set(NAME "${NAME}" PARENT_SCOPE) +endfunction() + +################################################################################ +# Add conditional custom command +# +# Generating Files +# The first signature is for adding a custom command to produce an output: +# add_custom_command_if( +# +# +# +# [COMMAND condition command2 [args2...]] +# [DEPENDS [depends...]] +# [COMMENT comment] +# +# Build Events +# add_custom_command_if( +# +# +# +# [COMMAND condition command2 [args2...]] +# [COMMENT comment] +# +# Input: +# output - Output files the command is expected to produce +# condition - Generator expression for wrapping the command +# command - Command-line(s) to execute at build time. +# args - Command`s args +# depends - Files on which the command depends +# comment - Display the given message before the commands are executed at +# build time. +# PRE_BUILD - Run before any other rules are executed within the target +# PRE_LINK - Run after sources have been compiled but before linking the +# binary +# POST_BUILD - Run after all other rules within the target have been +# executed +################################################################################ +function(add_custom_command_if) + add_custom_command_if_parse_arguments(${ARGN}) + + if(OUTPUT AND TARGET) + message(FATAL_ERROR "Wrong syntax. A TARGET and OUTPUT can not both be specified.") + endif() + + if(OUTPUT) + add_custom_command(OUTPUT ${OUTPUT} + ${COMMANDS} + DEPENDS ${DEPENDS} + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + COMMENT ${COMMENT}) + elseif(TARGET) + if(PRE_BUILD AND NOT ${CMAKE_GENERATOR} MATCHES "Visual Studio") + add_custom_target( + ${NAME} + ${COMMANDS} + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + COMMENT ${COMMENT}) + add_dependencies(${TARGET} ${NAME}) + else() + add_custom_command( + TARGET ${TARGET} + ${STEP} + ${COMMANDS} + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + COMMENT ${COMMENT}) + endif() + else() + message(FATAL_ERROR "Wrong syntax. A TARGET or OUTPUT must be specified.") + endif() +endfunction() + +################################################################################ +# Use props file for a target and configs +# use_props( ) +# Inside there are following variables: +# PROPS_TARGET - +# PROPS_CONFIG - One of +# PROPS_CONFIG_U - Uppercase PROPS_CONFIG +# Input: +# target - Target to apply props file +# configs - Build configurations to apply props file +# props_file - CMake script +################################################################################ +macro(use_props TARGET CONFIGS PROPS_FILE) + set(PROPS_TARGET "${TARGET}") + foreach(PROPS_CONFIG ${CONFIGS}) + string(TOUPPER "${PROPS_CONFIG}" PROPS_CONFIG_U) + + get_filename_component(ABSOLUTE_PROPS_FILE "${PROPS_FILE}" ABSOLUTE BASE_DIR "${CMAKE_CURRENT_LIST_DIR}") + if(EXISTS "${ABSOLUTE_PROPS_FILE}") + include("${ABSOLUTE_PROPS_FILE}") + else() + message(WARNING "Corresponding cmake file from props \"${ABSOLUTE_PROPS_FILE}\" doesn't exist") + endif() + endforeach() +endmacro() + +################################################################################ +# Add compile options to source file +# source_file_compile_options( [compile_options...]) +# Input: +# source_file - Source file +# compile_options - Options to add to COMPILE_FLAGS property +################################################################################ +function(source_file_compile_options SOURCE_FILE) + if("${ARGC}" LESS_EQUAL "1") + return() + endif() + + get_source_file_property(COMPILE_OPTIONS "${SOURCE_FILE}" COMPILE_OPTIONS) + + if(COMPILE_OPTIONS) + list(APPEND COMPILE_OPTIONS ${ARGN}) + else() + set(COMPILE_OPTIONS "${ARGN}") + endif() + + set_source_files_properties("${SOURCE_FILE}" PROPERTIES COMPILE_OPTIONS "${COMPILE_OPTIONS}") +endfunction() + +################################################################################ +# Default properties of visual studio projects +################################################################################ +set(DEFAULT_CXX_PROPS "${CMAKE_CURRENT_LIST_DIR}/DefaultCXX.cmake") + +function(get_linux_lsb_release_information) + find_program(LSB_RELEASE_EXEC lsb_release) + if(NOT LSB_RELEASE_EXEC) + message(FATAL_ERROR "Could not detect lsb_release executable, can not gather required information") + endif() + + execute_process(COMMAND "${LSB_RELEASE_EXEC}" --short --id OUTPUT_VARIABLE LSB_RELEASE_ID_SHORT OUTPUT_STRIP_TRAILING_WHITESPACE) + execute_process(COMMAND "${LSB_RELEASE_EXEC}" --short --release OUTPUT_VARIABLE LSB_RELEASE_VERSION_SHORT OUTPUT_STRIP_TRAILING_WHITESPACE) + execute_process(COMMAND "${LSB_RELEASE_EXEC}" --short --codename OUTPUT_VARIABLE LSB_RELEASE_CODENAME_SHORT OUTPUT_STRIP_TRAILING_WHITESPACE) + + set(LSB_RELEASE_ID_SHORT "${LSB_RELEASE_ID_SHORT}" PARENT_SCOPE) + set(LSB_RELEASE_VERSION_SHORT "${LSB_RELEASE_VERSION_SHORT}" PARENT_SCOPE) + set(LSB_RELEASE_CODENAME_SHORT "${LSB_RELEASE_CODENAME_SHORT}" PARENT_SCOPE) +endfunction() diff --git a/CMake/automate-vcpkg.cmake b/CMake/automate-vcpkg.cmake new file mode 100644 index 000000000..ee07f6bfb --- /dev/null +++ b/CMake/automate-vcpkg.cmake @@ -0,0 +1,191 @@ +#------------------------------------------------------------------------------------------------------------ +# +# Automate-VCPKG by Andre Taulien +# =============================== +# +# Project Repository: https://github.com/REGoth-project/Automate-VCPKG +# License ..........: MIT, see end of file. +# +# Based on: https://github.com/sutambe/cpptruths/blob/vcpkg_cmake_blog/cpp0x/vcpkg_test/CMakeLists.txt +# +# +# While [Vcpkg](https://github.com/microsoft/vcpkg) on it's own is awesome, it does add +# a little bit of complexity to getting a project to build. Even more if the one trying +# to compile your application is not too fond of the commandline. Additionally, CMake +# commands tend to get rather long with the toolchain path. +# +# To keep things simple for new users who just want to get the project to build, this +# script offers a solution. +# +# Lets assume your main `CMakelists.txt` looks something like this: +# +# cmake_minimum_required (VERSION 3.12.0) +# project (MyProject) +# +# add_executable(MyExecutable main.c) +# +# To integrate Vcpkg into that `CMakelists.txt`, simple put the following lines before the +# call to `project(MyProject)`: +# +# include(cmake/automate-vcpkg.cmake) +# +# vcpkg_bootstrap() +# vcpkg_install_packages(libsquish physfs) +# +# The call to `vcpkg_bootstrap()` will clone the official Vcpkg repository and bootstrap it. +# If it detected an existing environment variable defining a valid `VCPKG_ROOT`, it will +# update the existing installation of Vcpkg. +# +# Arguments to `vcpkg_install_packages()` are the packages you want to install using Vcpkg. +# +# If you want to keep the possibility for users to chose their own copy of Vcpkg, you can +# simply not run the code snippet mentioned above, something like this will work: +# +# option(SKIP_AUTOMATE_VCPKG "When ON, you will need to built the packages +# required by MyProject on your own or supply your own vcpkg toolchain.") +# +# if (NOT SKIP_AUTOMATE_VCPKG) +# include(cmake/automate-vcpkg.cmake) +# +# vcpkg_bootstrap() +# vcpkg_install_packages(libsquish physfs) +# endif() +# +# Then, the user has to supply the packages on their own, be it through Vcpkg or manually +# specifying their locations. +#------------------------------------------------------------------------------------------------------------ + +cmake_minimum_required (VERSION 3.12) + +if(WIN32) + set(VCPKG_FALLBACK_ROOT ${CMAKE_CURRENT_BINARY_DIR}/vcpkg CACHE STRING "vcpkg configuration directory to use if vcpkg was not installed on the system before") +else() + set(VCPKG_FALLBACK_ROOT ${CMAKE_CURRENT_BINARY_DIR}/.vcpkg CACHE STRING "vcpkg configuration directory to use if vcpkg was not installed on the system before") +endif() + +# On Windows, Vcpkg defaults to x86, even on x64 systems. If we're +# doing a 64-bit build, we need to fix that. +if (WIN32) + + # Since the compiler checks haven't run yet, we need to figure + # out the value of CMAKE_SIZEOF_VOID_P ourselfs + + include(CheckTypeSize) + enable_language(C) + check_type_size("void*" SIZEOF_VOID_P BUILTIN_TYPES_ONLY) + + if (SIZEOF_VOID_P EQUAL 8) + message(STATUS "Using Vcpkg triplet 'x64-windows'") + + set(VCPKG_TRIPLET x64-windows) + endif() +endif() + +if(NOT DEFINED VCPKG_ROOT) + if(NOT DEFINED ENV{VCPKG_ROOT}) + set(VCPKG_ROOT ${VCPKG_FALLBACK_ROOT}) + else() + set(VCPKG_ROOT $ENV{VCPKG_ROOT}) + endif() +endif() + +# Installs a new copy of Vcpkg or updates an existing one +macro(vcpkg_bootstrap) + _install_or_update_vcpkg() + + # Find out whether the user supplied their own VCPKG toolchain file + if(NOT DEFINED ${CMAKE_TOOLCHAIN_FILE}) + # We know this wasn't set before so we need point the toolchain file to the newly found VCPKG_ROOT + set(CMAKE_TOOLCHAIN_FILE ${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake CACHE STRING "") + + # Just setting vcpkg.cmake as toolchain file does not seem to actually pull in the code + include(${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake) + + set(AUTOMATE_VCPKG_USE_SYSTEM_VCPKG OFF) + else() + # VCPKG_ROOT has been defined by the toolchain file already + set(AUTOMATE_VCPKG_USE_SYSTEM_VCPKG ON) + endif() + + message(STATUS "Automate VCPKG status:") + message(STATUS " VCPKG_ROOT.....: ${VCPKG_ROOT}") + message(STATUS " VCPKG_EXEC.....: ${VCPKG_EXEC}") + message(STATUS " VCPKG_BOOTSTRAP: ${VCPKG_BOOTSTRAP}") +endmacro() + +macro(_install_or_update_vcpkg) + if(NOT EXISTS ${VCPKG_ROOT}) + message(STATUS "Cloning vcpkg in ${VCPKG_ROOT}") + execute_process(COMMAND git clone https://github.com/Microsoft/vcpkg.git ${VCPKG_ROOT}) + + # If a reproducible build is desired (and potentially old libraries are # ok), uncomment the + # following line and pin the vcpkg repository to a specific githash. + # execute_process(COMMAND git checkout 745a0aea597771a580d0b0f4886ea1e3a94dbca6 WORKING_DIRECTORY ${VCPKG_ROOT}) + else() + # The following command has no effect if the vcpkg repository is in a detached head state. + message(STATUS "Auto-updating vcpkg in ${VCPKG_ROOT}") + execute_process(COMMAND git pull WORKING_DIRECTORY ${VCPKG_ROOT}) + endif() + + if(NOT EXISTS ${VCPKG_ROOT}/README.md) + message(FATAL_ERROR "***** FATAL ERROR: Could not clone vcpkg *****") + endif() + + if(WIN32) + set(VCPKG_EXEC ${VCPKG_ROOT}/vcpkg.exe) + set(VCPKG_BOOTSTRAP ${VCPKG_ROOT}/bootstrap-vcpkg.bat) + else() + set(VCPKG_EXEC ${VCPKG_ROOT}/vcpkg) + set(VCPKG_BOOTSTRAP ${VCPKG_ROOT}/bootstrap-vcpkg.sh) + endif() + + if(NOT EXISTS ${VCPKG_EXEC}) + message("Bootstrapping vcpkg in ${VCPKG_ROOT}") + execute_process(COMMAND ${VCPKG_BOOTSTRAP} WORKING_DIRECTORY ${VCPKG_ROOT}) + endif() + + if(NOT EXISTS ${VCPKG_EXEC}) + message(FATAL_ERROR "***** FATAL ERROR: Could not bootstrap vcpkg *****") + endif() + +endmacro() + +# Installs the list of packages given as parameters using Vcpkg +macro(vcpkg_install_packages) + + # Need the given list to be space-separated + #string (REPLACE ";" " " PACKAGES_LIST_STR "${ARGN}") + + message(STATUS "Installing/Updating the following vcpkg-packages: ${PACKAGES_LIST_STR}") + + if (VCPKG_TRIPLET) + set(ENV{VCPKG_DEFAULT_TRIPLET} "${VCPKG_TRIPLET}") + endif() + + execute_process( + COMMAND ${VCPKG_EXEC} install ${ARGN} + WORKING_DIRECTORY ${VCPKG_ROOT} + ) +endmacro() + +# MIT License +# +# Copyright (c) 2019 REGoth-project +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 000000000..c9698c68f --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,201 @@ +cmake_minimum_required(VERSION 3.19.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) +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") +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() + +file(READ ${CMAKE_CURRENT_SOURCE_DIR}/OTRExporter/extract_assets.py filedata) +string(REGEX REPLACE "../ZAPDTR/ZAPD.out" "${CMAKE_BINARY_DIR}/ZAPD/ZAPD.out" filedata "${filedata}") +string(REGEX REPLACE "x64" "..\\\\\\\\x64" filedata "${filedata}") +string(REGEX REPLACE "Release" "${CMAKE_BUILD_TYPE}" filedata "${filedata}") +file(WRITE "${CMAKE_CURRENT_SOURCE_DIR}/OTRExporter/extract_assets_cmake2.py" "${filedata}") +file(CHMOD "${CMAKE_CURRENT_SOURCE_DIR}/OTRExporter/extract_assets_cmake2.py" PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_WRITE GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) + +find_package(Python3 COMPONENTS Interpreter) + +add_custom_target( + ExtractAssets + COMMAND ${CMAKE_COMMAND} -E rm -f oot.otr + COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/OTRExporter/extract_assets_cmake2.py + 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 + +) + +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") +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") + 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/Dockerfile b/Dockerfile index bf7d49ad5..1c23dafa4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,49 +5,58 @@ ARG DEBIAN_FRONTEND=noninteractive ENV GCCVER=10 RUN apt-get update && \ - apt-get upgrade -y && \ - apt-get install -y \ - binutils \ - gcc-${GCCVER} \ - g++-${GCCVER} \ - p7zip-full \ - python3 \ - make \ - cmake \ - curl \ - git \ - lld \ - wget \ - libglew-dev \ - libsdl2-dev \ - zlib1g-dev \ - libbz2-dev \ - libpng-dev \ - libgles2-mesa-dev && \ - update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${GCCVER} 10 && \ - update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-${GCCVER} 10 - + apt-get upgrade -y && \ + apt-get install -y \ + binutils \ + gcc-${GCCVER} \ + g++-${GCCVER} \ + patchelf \ + p7zip-full \ + python3 \ + cmake \ + make \ + curl \ + git \ + lld \ + libsdl2-dev \ + zlib1g-dev \ + libbz2-dev \ + libpng-dev \ + libgles2-mesa-dev \ + wget \ + gpg \ + imagemagick \ + ninja-build && \ + apt-get install -y software-properties-common && \ + wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | tee /etc/apt/trusted.gpg.d/kitware.gpg >/dev/null && \ + apt-add-repository "deb https://apt.kitware.com/ubuntu/ focal main" && \ + apt-get update && \ + apt-get upgrade -y && \ + update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${GCCVER} 10 && \ + update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-${GCCVER} 10 + RUN git clone https://github.com/Perlmint/glew-cmake.git && \ - cmake glew-cmake && \ - make -j$(nproc) && \ - make install + cmake glew-cmake && \ + make -j$(nproc) && \ + make install ENV SDL2VER=2.0.22 RUN curl -sLO https://libsdl.org/release/SDL2-${SDL2VER}.tar.gz && \ - tar -xzf SDL2-${SDL2VER}.tar.gz && \ - cd SDL2-${SDL2VER} && \ - ./configure --build=x86_64-linux-gnu && \ - make -j$(nproc) && make install && \ - rm ../SDL2-${SDL2VER}.tar.gz + tar -xzf SDL2-${SDL2VER}.tar.gz && \ + cd SDL2-${SDL2VER} && \ + ./configure --build=x86_64-linux-gnu && \ + make -j$(nproc) && make install && \ + rm ../SDL2-${SDL2VER}.tar.gz && \ + cp -av /usr/local/lib/libSDL* /lib/x86_64-linux-gnu/ RUN \ - ln -sf /proc/self/mounts /etc/mtab && \ - mkdir -p /usr/local/share/keyring/ && \ - wget -O /usr/local/share/keyring/devkitpro-pub.gpg https://apt.devkitpro.org/devkitpro-pub.gpg && \ - echo "deb [signed-by=/usr/local/share/keyring/devkitpro-pub.gpg] https://apt.devkitpro.org stable main" > /etc/apt/sources.list.d/devkitpro.list && \ - apt-get update -y && \ - apt-get install -y devkitpro-pacman && \ - yes | dkp-pacman -Syu switch-dev switch-portlibs --noconfirm + ln -sf /proc/self/mounts /etc/mtab && \ + mkdir -p /usr/local/share/keyring/ && \ + wget -O /usr/local/share/keyring/devkitpro-pub.gpg https://apt.devkitpro.org/devkitpro-pub.gpg && \ + echo "deb [signed-by=/usr/local/share/keyring/devkitpro-pub.gpg] https://apt.devkitpro.org stable main" > /etc/apt/sources.list.d/devkitpro.list && \ + apt-get update -y && \ + apt-get install -y devkitpro-pacman && \ + yes | dkp-pacman -Syu switch-dev switch-portlibs --noconfirm ENV DEVKITPRO=/opt/devkitpro ENV DEVKITARM=/opt/devkitpro/devkitARM diff --git a/Jenkinsfile b/Jenkinsfile index 60f022253..5f976bb4e 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -8,20 +8,40 @@ pipeline { } stages { + stage('Generate Assets') { + options { + timeout(time: 10) + } + agent { + label "SoH-Mac-Builders" + } + steps { + checkout([ + $class: 'GitSCM', + branches: scm.branches, + doGenerateSubmoduleConfigurations: scm.doGenerateSubmoduleConfigurations, + extensions: scm.extensions, + userRemoteConfigs: scm.userRemoteConfigs + ]) + catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') { + sh ''' + cp ../../ZELOOTD.z64 OTRExporter/baserom_non_mq.z64 + + cmake --no-warn-unused-cli -H. -Bbuild-cmake -GNinja -DCMAKE_BUILD_TYPE:STRING=Release + cmake --build build-cmake --target ExtractAssets --config Release + ''' + stash includes: 'soh/assets/**/*', name: 'assets' + } + } + } stage('Build SoH') { parallel { stage ('Build Windows') { - options { - timeout(time: 20) - } environment { - MSBUILD='C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\Msbuild\\Current\\Bin\\msbuild.exe' - CONFIG='Release' - OTRPLATFORM='x64' PLATFORM='x64' - ZIP='C:\\Program Files\\7-Zip\\7z.exe' PYTHON='C:\\Users\\jenkins\\AppData\\Local\\Programs\\Python\\Python310\\python.exe' CMAKE='C:\\Program Files\\CMake\\bin\\cmake.exe' + CPACK='C:\\Program Files\\CMake\\bin\\cpack.exe' TOOLSET='v142' } agent { @@ -37,37 +57,17 @@ pipeline { ]) catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') { - bat """ - - "${env.MSBUILD}" ".\\OTRExporter\\OTRExporter.sln" -t:build -p:Configuration=${env.CONFIG};Platform=${env.OTRPLATFORM};PlatformToolset=${env.TOOLSET};RestorePackagesConfig=true /restore /nodeReuse:false /m - - xcopy "..\\..\\ZELOOTD.z64" "OTRExporter\\" - - cd "OTRExporter" - "${env.PYTHON}" ".\\extract_assets.py" - cd "..\\" - - "${env.MSBUILD}" ".\\soh\\soh.sln" -t:build -p:Configuration=${env.CONFIG};Platform=${env.PLATFORM};PlatformToolset=${env.TOOLSET} /nodeReuse:false /m - - cd OTRGui - mkdir build - cd build - - "${env.CMAKE}" .. - "${env.CMAKE}" --build . --config Release - + unstash 'assets' + bat """ + "${env.CMAKE}" -S . -B "build\\${env.PLATFORM}" -G "Visual Studio 17 2022" -T ${env.TOOLSET} -A ${env.PLATFORM} -D Python_EXECUTABLE=${env.PYTHON} -D CMAKE_BUILD_TYPE:STRING=Release + "${env.CMAKE}" --build ".\\build\\${env.PLATFORM}" --config Release + cd ".\\build\\${env.PLATFORM}" + "${env.CPACK}" -G ZIP cd "..\\..\\" - - move "soh\\x64\\Release\\soh.exe" ".\\" - move "OTRGui\\build\\assets" ".\\" - move ".\\OTRExporter\\x64\\Release\\ZAPD.exe" ".\\assets\\extractor\\" - move ".\\OTRGui\\build\\Release\\OTRGui.exe" ".\\" - rename README.md readme.txt - - "${env.ZIP}" a soh.7z soh.exe OTRGui.exe assets readme.txt - + + move "_packages\\*.zip" "soh.zip" """ - archiveArtifacts artifacts: 'soh.7z', followSymlinks: false, onlyIfSuccessful: true + archiveArtifacts artifacts: 'soh.zip', followSymlinks: false, onlyIfSuccessful: true } } post { @@ -77,9 +77,6 @@ pipeline { } } stage ('Build Linux') { - options { - timeout(time: 20) - } agent { label "SoH-Linux-Builders" } @@ -92,23 +89,16 @@ pipeline { userRemoteConfigs: scm.userRemoteConfigs ]) catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') { + unstash 'assets' sh ''' - - cp ../../ZELOOTD.z64 OTRExporter/baserom_non_mq.z64 docker build . -t soh docker run --name sohcont -dit --rm -v $(pwd):/soh soh /bin/bash - docker exec sohcont scripts/linux/build.sh + docker exec sohcont scripts/linux/appimage/build.sh - mkdir build - mv soh/soh.elf build/ - mv OTRGui/build/OTRGui build/ - mv OTRGui/build/assets build/ - mv ZAPDTR/ZAPD.out build/assets/extractor/ mv README.md readme.txt - - docker exec sohcont scripts/linux/build-appimage.sh - - 7z a soh-linux.7z SOH-Linux.AppImage readme.txt + mv build-cmake/*.appimage soh.appimage + + 7z a soh-linux.7z soh.appimage readme.txt ''' } @@ -125,11 +115,6 @@ pipeline { agent { label "SoH-Mac-Builders" } - environment { - CC = 'clang -arch arm64 -arch x86_64' - CXX = 'clang++ -arch arm64 -arch x86_64' - MACOSX_DEPLOYMENT_TARGET = 10.15 - } steps { checkout([ $class: 'GitSCM', @@ -139,17 +124,19 @@ pipeline { userRemoteConfigs: scm.userRemoteConfigs ]) catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') { + unstash 'assets' sh ''' - cp ../../ZELOOTD.z64 OTRExporter/baserom_non_mq.z64 - cd soh - make setup -j$(sysctl -n hw.physicalcpu) OPTFLAGS=-O2 DEBUG=0 LD="ld" - make -j$(sysctl -n hw.physicalcpu) DEBUG=0 OPTFLAGS=-O2 LD="ld" - make appbundle - mv ../README.md readme.txt - 7z a soh-mac.7z soh.app readme.txt + cmake --no-warn-unused-cli -H. -Bbuild-cmake -GNinja -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" + cmake --build build-cmake --config Release -- + (cd build-cmake && cpack) + + mv README.md readme.txt + mv _packages/*.dmg SoH.dmg + + 7z a soh-mac.7z SoH.dmg readme.txt ''' } - archiveArtifacts artifacts: 'soh/soh-mac.7z', followSymlinks: false, onlyIfSuccessful: true + archiveArtifacts artifacts: 'soh-mac.7z', followSymlinks: false, onlyIfSuccessful: true } post { always { @@ -158,9 +145,6 @@ pipeline { } } stage ('Build Switch') { - options { - timeout(time: 20) - } agent { label "SoH-Linux-Builders" } @@ -173,14 +157,13 @@ pipeline { userRemoteConfigs: scm.userRemoteConfigs ]) catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') { - sh ''' - - cp ../../ZELOOTD.z64 OTRExporter/baserom_non_mq.z64 + unstash 'assets' + sh ''' docker build . -t sohswitch docker run --name sohcont -dit --rm -v $(pwd):/soh sohswitch /bin/bash docker exec sohcont scripts/switch/build.sh - mv soh/soh.nro . + mv build-switch/soh/*.nro soh.nro mv README.md readme.txt 7z a soh-switch.7z soh.nro readme.txt diff --git a/Makefile.switch b/Makefile.switch deleted file mode 100644 index 2dd9f5ea2..000000000 --- a/Makefile.switch +++ /dev/null @@ -1,36 +0,0 @@ -#------------------------------------------------------------------------------- -.SUFFIXES: -#------------------------------------------------------------------------------- - -export SOH_TOP_DIR := $(CURDIR) - -.PHONY: all clean ZAPDUtils libultraship soh StormLib - -all: soh - @echo "Done!" - -ZAPDUtils: - @echo "Building $@..." - @$(MAKE) --no-print-directory -C $(CURDIR)/ZAPDTR/ZAPDUtils -f $(CURDIR)/ZAPDTR/ZAPDUtils/Makefile.switch - -StormLib: - @echo "Building $@..." - LDFLAGS="" ${DEVKITPRO}/portlibs/switch/bin/aarch64-none-elf-cmake -DCMAKE_TOOLCHAIN_FILE=${DEVKITPRO}/cmake/Switch.cmake -DCMAKE_BUILD_TYPE=Release -B $(CURDIR)/StormLib/nxbuild -S $(CURDIR)/StormLib - @$(MAKE) --no-print-directory -C $(CURDIR)/StormLib/nxbuild -f $(CURDIR)/StormLib/nxbuild/Makefile - -libultraship: StormLib ZAPDUtils - @echo "Building $@..." - @$(MAKE) --no-print-directory -C $(CURDIR)/libultraship -f $(CURDIR)/libultraship/Makefile.switch - -soh: libultraship - @echo "Building $@..." - @$(MAKE) --no-print-directory -C $(CURDIR)/soh -f $(CURDIR)/soh/Makefile.switch - -otr: - @echo "Building $@..." - @$(MAKE) --no-print-directory -C $(CURDIR)/soh -f $(CURDIR)/soh/Makefile setup - -clean: - @$(MAKE) --no-print-directory -C $(CURDIR)/ZAPDTR/ZAPDUtils -f $(CURDIR)/ZAPDTR/ZAPDUtils/Makefile.switch clean - @$(MAKE) --no-print-directory -C $(CURDIR)/libultraship -f $(CURDIR)/libultraship/Makefile.switch clean - @$(MAKE) --no-print-directory -C $(CURDIR)/soh -f $(CURDIR)/soh/Makefile.switch clean \ No newline at end of file diff --git a/OTRExporter/CMake/Default.cmake b/OTRExporter/CMake/Default.cmake new file mode 100644 index 000000000..f4d0ba084 --- /dev/null +++ b/OTRExporter/CMake/Default.cmake @@ -0,0 +1,65 @@ +################################################################################ +# Command for variable_watch. This command issues error message, if a variable +# is changed. If variable PROPERTY_READER_GUARD_DISABLED is TRUE nothing happens +# variable_watch( property_reader_guard) +################################################################################ +function(property_reader_guard VARIABLE ACCESS VALUE CURRENT_LIST_FILE STACK) + if("${PROPERTY_READER_GUARD_DISABLED}") + return() + endif() + + if("${ACCESS}" STREQUAL "MODIFIED_ACCESS") + message(FATAL_ERROR + " Variable ${VARIABLE} is not supposed to be changed.\n" + " It is used only for reading target property ${VARIABLE}.\n" + " Use\n" + " set_target_properties(\"\" PROPERTIES \"${VARIABLE}\" \"\")\n" + " or\n" + " set_target_properties(\"\" PROPERTIES \"${VARIABLE}_\" \"\")\n" + " instead.\n") + endif() +endfunction() + +################################################################################ +# Create variable with generator expression that expands to value of +# target property _. If property is empty or not set then property +# is used instead. Variable has watcher property_reader_guard that +# doesn't allow to edit it. +# create_property_reader() +# Input: +# name - Name of watched property and output variable +################################################################################ +function(create_property_reader NAME) + set(PROPERTY_READER_GUARD_DISABLED TRUE) + set(CONFIG_VALUE "$>>>") + set(IS_CONFIG_VALUE_EMPTY "$") + set(GENERAL_VALUE "$>") + set("${NAME}" "$" PARENT_SCOPE) + variable_watch("${NAME}" property_reader_guard) +endfunction() + +################################################################################ +# Set property $_${PROPS_CONFIG_U} of ${PROPS_TARGET} to +# set_config_specific_property( ) +# Input: +# name - Prefix of property name +# value - New value +################################################################################ +function(set_config_specific_property NAME VALUE) + set_target_properties("${PROPS_TARGET}" PROPERTIES "${NAME}_${PROPS_CONFIG_U}" "${VALUE}") +endfunction() + +################################################################################ + +create_property_reader("TARGET_NAME") +create_property_reader("OUTPUT_DIRECTORY") + +set_config_specific_property("TARGET_NAME" "${PROPS_TARGET}") +set_config_specific_property("OUTPUT_NAME" "${TARGET_NAME}") +set_config_specific_property("ARCHIVE_OUTPUT_NAME" "${TARGET_NAME}") +set_config_specific_property("LIBRARY_OUTPUT_NAME" "${TARGET_NAME}") +set_config_specific_property("RUNTIME_OUTPUT_NAME" "${TARGET_NAME}") + +set_config_specific_property("ARCHIVE_OUTPUT_DIRECTORY" "${OUTPUT_DIRECTORY}") +set_config_specific_property("LIBRARY_OUTPUT_DIRECTORY" "${OUTPUT_DIRECTORY}") +set_config_specific_property("RUNTIME_OUTPUT_DIRECTORY" "${OUTPUT_DIRECTORY}") \ No newline at end of file diff --git a/OTRExporter/CMake/DefaultCXX.cmake b/OTRExporter/CMake/DefaultCXX.cmake new file mode 100644 index 000000000..e06b3cd2f --- /dev/null +++ b/OTRExporter/CMake/DefaultCXX.cmake @@ -0,0 +1,12 @@ +include("${CMAKE_CURRENT_LIST_DIR}/Default.cmake") + +set_config_specific_property("OUTPUT_DIRECTORY" "${CMAKE_SOURCE_DIR}$<$>:/${CMAKE_VS_PLATFORM_NAME}>/${PROPS_CONFIG}") + +if(MSVC) + create_property_reader("DEFAULT_CXX_EXCEPTION_HANDLING") + create_property_reader("DEFAULT_CXX_DEBUG_INFORMATION_FORMAT") + + set_target_properties("${PROPS_TARGET}" PROPERTIES MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>DLL") + set_config_specific_property("DEFAULT_CXX_EXCEPTION_HANDLING" "/EHsc") + set_config_specific_property("DEFAULT_CXX_DEBUG_INFORMATION_FORMAT" "/Zi") +endif() diff --git a/OTRExporter/CMake/Utils.cmake b/OTRExporter/CMake/Utils.cmake new file mode 100644 index 000000000..d9822f0a3 --- /dev/null +++ b/OTRExporter/CMake/Utils.cmake @@ -0,0 +1,233 @@ +# utils file for projects came from visual studio solution with cmake-converter. + +################################################################################ +# Wrap each token of the command with condition +################################################################################ +cmake_policy(PUSH) +cmake_policy(SET CMP0054 NEW) +macro(prepare_commands) + unset(TOKEN_ROLE) + unset(COMMANDS) + foreach(TOKEN ${ARG_COMMANDS}) + if("${TOKEN}" STREQUAL "COMMAND") + set(TOKEN_ROLE "KEYWORD") + elseif("${TOKEN_ROLE}" STREQUAL "KEYWORD") + set(TOKEN_ROLE "CONDITION") + elseif("${TOKEN_ROLE}" STREQUAL "CONDITION") + set(TOKEN_ROLE "COMMAND") + elseif("${TOKEN_ROLE}" STREQUAL "COMMAND") + set(TOKEN_ROLE "ARG") + endif() + + if("${TOKEN_ROLE}" STREQUAL "KEYWORD") + list(APPEND COMMANDS "${TOKEN}") + elseif("${TOKEN_ROLE}" STREQUAL "CONDITION") + set(CONDITION ${TOKEN}) + elseif("${TOKEN_ROLE}" STREQUAL "COMMAND") + list(APPEND COMMANDS "$<$:${DUMMY}>$<${CONDITION}:${TOKEN}>") + elseif("${TOKEN_ROLE}" STREQUAL "ARG") + list(APPEND COMMANDS "$<${CONDITION}:${TOKEN}>") + endif() + endforeach() +endmacro() +cmake_policy(POP) + +################################################################################ +# Transform all the tokens to absolute paths +################################################################################ +macro(prepare_output) + unset(OUTPUT) + foreach(TOKEN ${ARG_OUTPUT}) + if(IS_ABSOLUTE ${TOKEN}) + list(APPEND OUTPUT "${TOKEN}") + else() + list(APPEND OUTPUT "${CMAKE_CURRENT_SOURCE_DIR}/${TOKEN}") + endif() + endforeach() +endmacro() + +################################################################################ +# Parse add_custom_command_if args. +# +# Input: +# PRE_BUILD - Pre build event option +# PRE_LINK - Pre link event option +# POST_BUILD - Post build event option +# TARGET - Target +# OUTPUT - List of output files +# DEPENDS - List of files on which the command depends +# COMMANDS - List of commands(COMMAND condition1 commannd1 args1 COMMAND +# condition2 commannd2 args2 ...) +# Output: +# OUTPUT - Output files +# DEPENDS - Files on which the command depends +# COMMENT - Comment +# PRE_BUILD - TRUE/FALSE +# PRE_LINK - TRUE/FALSE +# POST_BUILD - TRUE/FALSE +# TARGET - Target name +# COMMANDS - Prepared commands(every token is wrapped in CONDITION) +# NAME - Unique name for custom target +# STEP - PRE_BUILD/PRE_LINK/POST_BUILD +################################################################################ +function(add_custom_command_if_parse_arguments) + cmake_parse_arguments("ARG" "PRE_BUILD;PRE_LINK;POST_BUILD" "TARGET;COMMENT" "DEPENDS;OUTPUT;COMMANDS" ${ARGN}) + + if(WIN32) + set(DUMMY "cd.") + elseif(UNIX) + set(DUMMY "true") + endif() + + prepare_commands() + prepare_output() + + set(DEPENDS "${ARG_DEPENDS}") + set(COMMENT "${ARG_COMMENT}") + set(PRE_BUILD "${ARG_PRE_BUILD}") + set(PRE_LINK "${ARG_PRE_LINK}") + set(POST_BUILD "${ARG_POST_BUILD}") + set(TARGET "${ARG_TARGET}") + if(PRE_BUILD) + set(STEP "PRE_BUILD") + elseif(PRE_LINK) + set(STEP "PRE_LINK") + elseif(POST_BUILD) + set(STEP "POST_BUILD") + endif() + set(NAME "${TARGET}_${STEP}") + + set(OUTPUT "${OUTPUT}" PARENT_SCOPE) + set(DEPENDS "${DEPENDS}" PARENT_SCOPE) + set(COMMENT "${COMMENT}" PARENT_SCOPE) + set(PRE_BUILD "${PRE_BUILD}" PARENT_SCOPE) + set(PRE_LINK "${PRE_LINK}" PARENT_SCOPE) + set(POST_BUILD "${POST_BUILD}" PARENT_SCOPE) + set(TARGET "${TARGET}" PARENT_SCOPE) + set(COMMANDS "${COMMANDS}" PARENT_SCOPE) + set(STEP "${STEP}" PARENT_SCOPE) + set(NAME "${NAME}" PARENT_SCOPE) +endfunction() + +################################################################################ +# Add conditional custom command +# +# Generating Files +# The first signature is for adding a custom command to produce an output: +# add_custom_command_if( +# +# +# +# [COMMAND condition command2 [args2...]] +# [DEPENDS [depends...]] +# [COMMENT comment] +# +# Build Events +# add_custom_command_if( +# +# +# +# [COMMAND condition command2 [args2...]] +# [COMMENT comment] +# +# Input: +# output - Output files the command is expected to produce +# condition - Generator expression for wrapping the command +# command - Command-line(s) to execute at build time. +# args - Command`s args +# depends - Files on which the command depends +# comment - Display the given message before the commands are executed at +# build time. +# PRE_BUILD - Run before any other rules are executed within the target +# PRE_LINK - Run after sources have been compiled but before linking the +# binary +# POST_BUILD - Run after all other rules within the target have been +# executed +################################################################################ +function(add_custom_command_if) + add_custom_command_if_parse_arguments(${ARGN}) + + if(OUTPUT AND TARGET) + message(FATAL_ERROR "Wrong syntax. A TARGET and OUTPUT can not both be specified.") + endif() + + if(OUTPUT) + add_custom_command(OUTPUT ${OUTPUT} + ${COMMANDS} + DEPENDS ${DEPENDS} + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + COMMENT ${COMMENT}) + elseif(TARGET) + if(PRE_BUILD AND NOT ${CMAKE_GENERATOR} MATCHES "Visual Studio") + add_custom_target( + ${NAME} + ${COMMANDS} + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + COMMENT ${COMMENT}) + add_dependencies(${TARGET} ${NAME}) + else() + add_custom_command( + TARGET ${TARGET} + ${STEP} + ${COMMANDS} + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + COMMENT ${COMMENT}) + endif() + else() + message(FATAL_ERROR "Wrong syntax. A TARGET or OUTPUT must be specified.") + endif() +endfunction() + +################################################################################ +# Use props file for a target and configs +# use_props( ) +# Inside there are following variables: +# PROPS_TARGET - +# PROPS_CONFIG - One of +# PROPS_CONFIG_U - Uppercase PROPS_CONFIG +# Input: +# target - Target to apply props file +# configs - Build configurations to apply props file +# props_file - CMake script +################################################################################ +macro(use_props TARGET CONFIGS PROPS_FILE) + set(PROPS_TARGET "${TARGET}") + foreach(PROPS_CONFIG ${CONFIGS}) + string(TOUPPER "${PROPS_CONFIG}" PROPS_CONFIG_U) + + get_filename_component(ABSOLUTE_PROPS_FILE "${PROPS_FILE}" ABSOLUTE BASE_DIR "${CMAKE_CURRENT_LIST_DIR}") + if(EXISTS "${ABSOLUTE_PROPS_FILE}") + include("${ABSOLUTE_PROPS_FILE}") + else() + message(WARNING "Corresponding cmake file from props \"${ABSOLUTE_PROPS_FILE}\" doesn't exist") + endif() + endforeach() +endmacro() + +################################################################################ +# Add compile options to source file +# source_file_compile_options( [compile_options...]) +# Input: +# source_file - Source file +# compile_options - Options to add to COMPILE_FLAGS property +################################################################################ +function(source_file_compile_options SOURCE_FILE) + if("${ARGC}" LESS_EQUAL "1") + return() + endif() + + get_source_file_property(COMPILE_OPTIONS "${SOURCE_FILE}" COMPILE_OPTIONS) + + if(COMPILE_OPTIONS) + list(APPEND COMPILE_OPTIONS ${ARGN}) + else() + set(COMPILE_OPTIONS "${ARGN}") + endif() + + set_source_files_properties("${SOURCE_FILE}" PROPERTIES COMPILE_OPTIONS "${COMPILE_OPTIONS}") +endfunction() + +################################################################################ +# Default properties of visual studio projects +################################################################################ +set(DEFAULT_CXX_PROPS "${CMAKE_CURRENT_LIST_DIR}/DefaultCXX.cmake") diff --git a/OTRExporter/CMakeLists.txt b/OTRExporter/CMakeLists.txt new file mode 100644 index 000000000..5f314926e --- /dev/null +++ b/OTRExporter/CMakeLists.txt @@ -0,0 +1,102 @@ +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") +set(CMAKE_C_STANDARD 11) + +project(OTRExporter C CXX) + +################################################################################ +# 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 +################################################################################ +set(CMAKE_CONFIGURATION_TYPES + "Debug" + "Release" + CACHE STRING "" FORCE +) + +################################################################################ +# 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) + +################################################################################ +# 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 +################################################################################ +if (NOT TARGET libultraship) + add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/libultraship ${CMAKE_BINARY_DIR}/libultraship) +endif() + +if (NOT TARGET ZAPD) + add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../ZAPDTR/ZAPD ${CMAKE_BINARY_DIR}/ZAPD) +endif() + +if (NOT TARGET ZAPDUtils) + add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../ZAPDTR/ZAPDUtils ${CMAKE_BINARY_DIR}/ZAPDUtils) +endif() + +add_subdirectory(OTRExporter) + +file(READ ${CMAKE_CURRENT_SOURCE_DIR}/extract_assets.py filedata) +string(REGEX REPLACE "../ZAPDTR/ZAPD.out" "${CMAKE_BINARY_DIR}/ZAPD/ZAPD.out" filedata "${filedata}") +file(WRITE "${CMAKE_CURRENT_SOURCE_DIR}/extract_assets_cmake.py" "${filedata}") +file(CHMOD "${CMAKE_CURRENT_SOURCE_DIR}/extract_assets_cmake.py" PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_WRITE GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) + diff --git a/OTRExporter/OTRExporter.sln b/OTRExporter/OTRExporter.sln deleted file mode 100644 index 5379a92c8..000000000 --- a/OTRExporter/OTRExporter.sln +++ /dev/null @@ -1,79 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.30320.27 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OTRExporter", "OTRExporter\OTRExporter.vcxproj", "{A6103FD3-0709-4FC7-B066-1A6E056D6306}" - ProjectSection(ProjectDependencies) = postProject - {6DA9B521-65B7-41E2-8F8A-F0451CC18ED8} = {6DA9B521-65B7-41E2-8F8A-F0451CC18ED8} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libultraship", "..\libultraship\libultraship\libultraship.vcxproj", "{6DA9B521-65B7-41E2-8F8A-F0451CC18ED8}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ZAPD", "..\ZAPDTR\ZAPD\ZAPD.vcxproj", "{B53F9E5B-0A58-4BAE-9AFE-856C8CBB8D36}" - ProjectSection(ProjectDependencies) = postProject - {78424708-1F6E-4D4B-920C-FB6D26847055} = {78424708-1F6E-4D4B-920C-FB6D26847055} - {6DA9B521-65B7-41E2-8F8A-F0451CC18ED8} = {6DA9B521-65B7-41E2-8F8A-F0451CC18ED8} - {A2E01C3E-D647-45D1-9788-043DEBC1A908} = {A2E01C3E-D647-45D1-9788-043DEBC1A908} - {A6103FD3-0709-4FC7-B066-1A6E056D6306} = {A6103FD3-0709-4FC7-B066-1A6E056D6306} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ZAPDUtils", "..\ZAPDTR\ZAPDUtils\ZAPDUtils.vcxproj", "{A2E01C3E-D647-45D1-9788-043DEBC1A908}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "StormLib", "..\StormLib\StormLib_vs19.vcxproj", "{78424708-1F6E-4D4B-920C-FB6D26847055}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|x64 = Debug|x64 - Debug|x86 = Debug|x86 - Release|x64 = Release|x64 - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {A6103FD3-0709-4FC7-B066-1A6E056D6306}.Debug|x64.ActiveCfg = Debug|x64 - {A6103FD3-0709-4FC7-B066-1A6E056D6306}.Debug|x64.Build.0 = Debug|x64 - {A6103FD3-0709-4FC7-B066-1A6E056D6306}.Debug|x86.ActiveCfg = Debug|Win32 - {A6103FD3-0709-4FC7-B066-1A6E056D6306}.Debug|x86.Build.0 = Debug|Win32 - {A6103FD3-0709-4FC7-B066-1A6E056D6306}.Release|x64.ActiveCfg = Release|x64 - {A6103FD3-0709-4FC7-B066-1A6E056D6306}.Release|x64.Build.0 = Release|x64 - {A6103FD3-0709-4FC7-B066-1A6E056D6306}.Release|x86.ActiveCfg = Release|Win32 - {A6103FD3-0709-4FC7-B066-1A6E056D6306}.Release|x86.Build.0 = Release|Win32 - {6DA9B521-65B7-41E2-8F8A-F0451CC18ED8}.Debug|x64.ActiveCfg = Debug|x64 - {6DA9B521-65B7-41E2-8F8A-F0451CC18ED8}.Debug|x64.Build.0 = Debug|x64 - {6DA9B521-65B7-41E2-8F8A-F0451CC18ED8}.Debug|x86.ActiveCfg = Debug|Win32 - {6DA9B521-65B7-41E2-8F8A-F0451CC18ED8}.Debug|x86.Build.0 = Debug|Win32 - {6DA9B521-65B7-41E2-8F8A-F0451CC18ED8}.Release|x64.ActiveCfg = Release|x64 - {6DA9B521-65B7-41E2-8F8A-F0451CC18ED8}.Release|x64.Build.0 = Release|x64 - {6DA9B521-65B7-41E2-8F8A-F0451CC18ED8}.Release|x86.ActiveCfg = Release|Win32 - {6DA9B521-65B7-41E2-8F8A-F0451CC18ED8}.Release|x86.Build.0 = Release|Win32 - {B53F9E5B-0A58-4BAE-9AFE-856C8CBB8D36}.Debug|x64.ActiveCfg = Debug|x64 - {B53F9E5B-0A58-4BAE-9AFE-856C8CBB8D36}.Debug|x64.Build.0 = Debug|x64 - {B53F9E5B-0A58-4BAE-9AFE-856C8CBB8D36}.Debug|x86.ActiveCfg = Debug|Win32 - {B53F9E5B-0A58-4BAE-9AFE-856C8CBB8D36}.Debug|x86.Build.0 = Debug|Win32 - {B53F9E5B-0A58-4BAE-9AFE-856C8CBB8D36}.Release|x64.ActiveCfg = Release|x64 - {B53F9E5B-0A58-4BAE-9AFE-856C8CBB8D36}.Release|x64.Build.0 = Release|x64 - {B53F9E5B-0A58-4BAE-9AFE-856C8CBB8D36}.Release|x86.ActiveCfg = Release|Win32 - {B53F9E5B-0A58-4BAE-9AFE-856C8CBB8D36}.Release|x86.Build.0 = Release|Win32 - {A2E01C3E-D647-45D1-9788-043DEBC1A908}.Debug|x64.ActiveCfg = Debug|x64 - {A2E01C3E-D647-45D1-9788-043DEBC1A908}.Debug|x64.Build.0 = Debug|x64 - {A2E01C3E-D647-45D1-9788-043DEBC1A908}.Debug|x86.ActiveCfg = Debug|Win32 - {A2E01C3E-D647-45D1-9788-043DEBC1A908}.Debug|x86.Build.0 = Debug|Win32 - {A2E01C3E-D647-45D1-9788-043DEBC1A908}.Release|x64.ActiveCfg = Release|x64 - {A2E01C3E-D647-45D1-9788-043DEBC1A908}.Release|x64.Build.0 = Release|x64 - {A2E01C3E-D647-45D1-9788-043DEBC1A908}.Release|x86.ActiveCfg = Release|Win32 - {A2E01C3E-D647-45D1-9788-043DEBC1A908}.Release|x86.Build.0 = Release|Win32 - {78424708-1F6E-4D4B-920C-FB6D26847055}.Debug|x64.ActiveCfg = DebugUS|x64 - {78424708-1F6E-4D4B-920C-FB6D26847055}.Debug|x64.Build.0 = DebugUS|x64 - {78424708-1F6E-4D4B-920C-FB6D26847055}.Debug|x86.ActiveCfg = DebugAD|Win32 - {78424708-1F6E-4D4B-920C-FB6D26847055}.Debug|x86.Build.0 = DebugAD|Win32 - {78424708-1F6E-4D4B-920C-FB6D26847055}.Release|x64.ActiveCfg = ReleaseUS|x64 - {78424708-1F6E-4D4B-920C-FB6D26847055}.Release|x64.Build.0 = ReleaseUS|x64 - {78424708-1F6E-4D4B-920C-FB6D26847055}.Release|x86.ActiveCfg = ReleaseAS|Win32 - {78424708-1F6E-4D4B-920C-FB6D26847055}.Release|x86.Build.0 = ReleaseAS|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {DCE19FF1-37C0-49CD-915A-DD695E15F00B} - EndGlobalSection -EndGlobal diff --git a/OTRExporter/OTRExporter/CMakeLists.txt b/OTRExporter/OTRExporter/CMakeLists.txt new file mode 100644 index 000000000..e3209e198 --- /dev/null +++ b/OTRExporter/OTRExporter/CMakeLists.txt @@ -0,0 +1,249 @@ +set(PROJECT_NAME OTRExporter) + +################################################################################ +# Source groups +################################################################################ +set(Header_Files + "AnimationExporter.h" + "ArrayExporter.h" + "AudioExporter.h" + "BackgroundExporter.h" + "BlobExporter.h" + "CollisionExporter.h" + "command_macros_base.h" + "CutsceneExporter.h" + "DisplayListExporter.h" + "Exporter.h" + "Main.h" + "MtxExporter.h" + "PathExporter.h" + "PlayerAnimationExporter.h" + "RoomExporter.h" + "SkeletonExporter.h" + "SkeletonLimbExporter.h" + "TextExporter.h" + "TextureExporter.h" + "VersionInfo.h" + "VtxExporter.h" + "z64cutscene.h" + "z64cutscene_commands.h" +) +source_group("Header Files" FILES ${Header_Files}) + +set(Source_Files + "AnimationExporter.cpp" + "ArrayExporter.cpp" + "AudioExporter.cpp" + "BackgroundExporter.cpp" + "BlobExporter.cpp" + "CollisionExporter.cpp" + "CutsceneExporter.cpp" + "DisplayListExporter.cpp" + "Exporter.cpp" + "Main.cpp" + "MtxExporter.cpp" + "PathExporter.cpp" + "PlayerAnimationExporter.cpp" + "RoomExporter.cpp" + "SkeletonExporter.cpp" + "SkeletonLimbExporter.cpp" + "TextExporter.cpp" + "TextureExporter.cpp" + "VersionInfo.cpp" + "VtxExporter.cpp" +) +source_group("Source Files" FILES ${Source_Files}) + +set(ALL_FILES + ${Header_Files} + ${Source_Files} +) + +################################################################################ +# Target +################################################################################ +add_library(${PROJECT_NAME} STATIC ${ALL_FILES}) + +if (CMAKE_SYSTEM_NAME STREQUAL "Windows") +use_props(${PROJECT_NAME} "${CMAKE_CONFIGURATION_TYPES}" "${DEFAULT_CXX_PROPS}") +endif() + +set(ROOT_NAMESPACE OTRExporter) + +if (CMAKE_SYSTEM_NAME STREQUAL "Windows") + set_target_properties(${PROJECT_NAME} PROPERTIES + VS_GLOBAL_KEYWORD "Win32Proj" + ) + if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64") + set_target_properties(${PROJECT_NAME} PROPERTIES + INTERPROCEDURAL_OPTIMIZATION_RELEASE "TRUE" + ) + elseif("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x86") + set_target_properties(${PROJECT_NAME} PROPERTIES + INTERPROCEDURAL_OPTIMIZATION_RELEASE "TRUE" + ) + endif() +endif() +################################################################################ +# MSVC runtime library +################################################################################ +if (CMAKE_SYSTEM_NAME STREQUAL "Windows") + get_property(MSVC_RUNTIME_LIBRARY_DEFAULT TARGET ${PROJECT_NAME} PROPERTY MSVC_RUNTIME_LIBRARY) + if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64") + string(CONCAT "MSVC_RUNTIME_LIBRARY_STR" + $<$: + MultiThreadedDebug + > + $<$: + MultiThreaded + > + $<$,$>>:${MSVC_RUNTIME_LIBRARY_DEFAULT}> + ) + endif() + set_target_properties(${PROJECT_NAME} PROPERTIES MSVC_RUNTIME_LIBRARY ${MSVC_RUNTIME_LIBRARY_STR}) +endif() +################################################################################ +# Compile definitions +################################################################################ +if (CMAKE_SYSTEM_NAME STREQUAL "Windows") + if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64") + target_compile_definitions(${PROJECT_NAME} PRIVATE + "$<$:" + "_DEBUG" + ">" + "$<$:" + "NDEBUG" + ">" + "_CONSOLE;" + "_CRT_SECURE_NO_WARNINGS;" + "UNICODE;" + "_UNICODE" + STORMLIB_NO_AUTO_LINK + ) + elseif("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x86") + target_compile_definitions(${PROJECT_NAME} PRIVATE + "$<$:" + "_DEBUG;" + "_CRT_SECURE_NO_WARNINGS" + ">" + "$<$:" + "NDEBUG" + ">" + "WIN32;" + "_CONSOLE;" + "UNICODE;" + "_UNICODE" + STORMLIB_NO_AUTO_LINK + ) + endif() +endif() + +if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU|Clang|AppleClang") + target_compile_definitions(${PROJECT_NAME} PRIVATE + "$<$:" + "_DEBUG" + ">" + "$<$:" + "NDEBUG" + ">" + "_CONSOLE;" + "_CRT_SECURE_NO_WARNINGS;" + "UNICODE;" + "_UNICODE" + ) +endif() +################################################################################ +# Compile and link options +################################################################################ + +target_include_directories(${PROJECT_NAME} PRIVATE + ${CMAKE_CURRENT_SOURCE_DIR}/../../ZAPDTR/ZAPD/ + ${CMAKE_CURRENT_SOURCE_DIR}/../../ZAPDTR/ZAPDUtils + ${CMAKE_CURRENT_SOURCE_DIR}/../../ZAPDTR/lib/tinyxml2 + ${CMAKE_CURRENT_SOURCE_DIR}/../../libultraship/libultraship + ${CMAKE_CURRENT_SOURCE_DIR}/../../libultraship/libultraship/Lib/spdlog/include + ${CMAKE_CURRENT_SOURCE_DIR}/../../libultraship/libultraship/Lib/Fast3D/U64 + ${CMAKE_CURRENT_SOURCE_DIR}/../../StormLib/src + . +) + +if(MSVC) + if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64") + target_compile_options(${PROJECT_NAME} PRIVATE + $<$: + /Oi; + /Gy + > + /permissive-; + /sdl; + /W3; + ${DEFAULT_CXX_DEBUG_INFORMATION_FORMAT}; + ${DEFAULT_CXX_EXCEPTION_HANDLING} + ) + elseif("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x86") + target_compile_options(${PROJECT_NAME} PRIVATE + $<$: + /Oi; + /Gy + > + /permissive-; + /sdl; + /W3; + ${DEFAULT_CXX_DEBUG_INFORMATION_FORMAT}; + ${DEFAULT_CXX_EXCEPTION_HANDLING} + ) + endif() + if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64") + target_link_options(${PROJECT_NAME} PRIVATE + $<$: + /OPT:REF; + /OPT:ICF + > + /SUBSYSTEM:CONSOLE + ) + elseif("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x86") + target_link_options(${PROJECT_NAME} PRIVATE + $<$: + /DEBUG; + /OPT:REF; + /OPT:ICF; + /INCREMENTAL:NO + > + /SUBSYSTEM:CONSOLE + ) + endif() +endif() + +if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU|Clang|AppleClang") + target_compile_options(${PROJECT_NAME} PRIVATE + -Wall -Wextra -Wno-error + -Wno-unused-parameter + -Wno-unused-function + -Wno-unused-variable + -Wno-missing-field-initializers + -Wno-parentheses + -Wno-narrowing + $<$:-Wno-deprecated-enum-enum-conversion> + ) +endif() +################################################################################ +# Dependencies +################################################################################ +add_dependencies(${PROJECT_NAME} + libultraship +) + +# Link with other targets. + +if (CMAKE_SYSTEM_NAME STREQUAL "Windows") + if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64") + set(ADDITIONAL_LIBRARY_DEPENDENCIES + "$<$:" + "ZAPDUtils;" + "OTRLib" + ">" + ) + endif() +endif() +target_link_libraries(${PROJECT_NAME} PUBLIC "${ADDITIONAL_LIBRARY_DEPENDENCIES}") + diff --git a/OTRExporter/OTRExporter/Makefile b/OTRExporter/OTRExporter/Makefile deleted file mode 100644 index c3882b5e3..000000000 --- a/OTRExporter/OTRExporter/Makefile +++ /dev/null @@ -1,72 +0,0 @@ -# Only used for standalone compilation, usually inherits these from the main makefile - -CXX ?= g++ -AR := ar -FORMAT := clang-format-11 - -ASAN ?= 0 -DEBUG ?= 1 -OPTFLAGS ?= -O0 -LTO ?= 0 - -WARN := -Wall -Wextra -Werror \ - -Wno-unused-parameter \ - -Wno-unused-function \ - -Wno-unused-variable \ - -Wno-error=multichar - - -CXXFLAGS := $(WARN) -std=c++17 -CPPFLAGS := -MMD - -ifneq ($(DEBUG),0) - CXXFLAGS += -g -endif - -ifneq ($(ASAN),0) - CXXFLAGS += -fsanitize=address -endif - -ifneq ($(LTO),0) - CXXFLAGS += -flto -endif - -SRC_DIRS := $(shell find . -type d -not -path "*build*") -CXX_FILES := $(foreach dir,$(SRC_DIRS),$(wildcard $(dir)/*.cpp)) -H_FILES := $(foreach dir,$(SRC_DIRS),$(wildcard $(dir)/*.h)) - -O_FILES := $(CXX_FILES:%.cpp=build/%.o) -D_FILES := $(O_FILES:%.o=%.d) -LIB := OTRExporter.a - -INC_DIRS := $(addprefix -I, \ - ../../ZAPDTR/ZAPD \ - ../../ZAPDTR/lib/tinyxml2 \ - ../../ZAPDTR/lib/libgfxd \ - ../../ZAPDTR/ZAPDUtils \ - ../../libultraship/libultraship \ - ../../libultraship/libultraship/Lib/spdlog/include \ - ../../libultraship/libultraship/Lib/Fast3D/U64 \ - ../../StormLib/src \ -) - -# create build directories -$(shell mkdir -p $(SRC_DIRS:%=build/%)) - -all: $(LIB) - -clean: - rm -rf build $(LIB) - -format: - $(FORMAT) -i $(CXX_FILES) $(H_FILES) - -.PHONY: all clean format - -build/%.o: %.cpp - $(CXX) $(CXXFLAGS) $(CPPFLAGS) $(OPTFLAGS) $(INC_DIRS) -c $< -o $@ - -$(LIB): $(O_FILES) - $(AR) rcs $@ $^ - --include $(D_FILES) diff --git a/OTRExporter/OTRExporter/OTRExporter.vcxproj b/OTRExporter/OTRExporter/OTRExporter.vcxproj deleted file mode 100644 index c39da3df5..000000000 --- a/OTRExporter/OTRExporter/OTRExporter.vcxproj +++ /dev/null @@ -1,216 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 16.0 - Win32Proj - {a6103fd3-0709-4fc7-b066-1a6e056d6306} - OTRExporter - 10.0 - - - - StaticLibrary - true - v142 - Unicode - - - Application - false - v142 - true - Unicode - - - StaticLibrary - true - v142 - Unicode - - - StaticLibrary - false - v142 - true - Unicode - - - - - - - - - - - - - - - - - - - - - true - $(SolutionDir)otrlib;$(SolutionDir)\ZAPD\ZAPD\;$(SolutionDir)\ZAPD\lib\tinyxml2;$(SolutionDir)\ZAPD\lib\libgfxd;$(SolutionDir)\ZAPD\lib\elfio;$(SolutionDir)\ZAPD\lib\assimp\include;$(SolutionDir)\ZAPD\lib\stb;$(ProjectDir);$(IncludePath) - MinimumRecommendedRules.ruleset - - - - - false - MinimumRecommendedRules.ruleset - - - - - true - $(ProjectDir)..\..\ZAPDTR\ZAPD;$(ProjectDir)..\..\ZAPDTR\lib\tinyxml2;$(ProjectDir)..\..\ZAPDTR\lib\libgfxd;$(ProjectDir)..\..\ZAPDTR\ZAPDUtils;$(ProjectDir)..\..\libultraship\libultraship;$(ProjectDir)..\..\libultraship\libultraship\lib\spdlog\include;$(ProjectDir)..\..\libultraship\libultraship\Lib\Fast3D\U64;$(ProjectDir)..\..\StormLib\src\;$(IncludePath) - $(ProjectDir)..\..\libultraship\libultraship;$(LibraryPath) - MinimumRecommendedRules.ruleset - - - - - false - $(ProjectDir)..\..\ZAPDTR\ZAPD;$(ProjectDir)..\..\ZAPDTR\lib\tinyxml2;$(ProjectDir)..\..\ZAPDTR\lib\libgfxd;$(ProjectDir)..\..\ZAPDTR\ZAPDUtils;$(ProjectDir)..\..\libultraship\libultraship;$(ProjectDir)..\..\libultraship\libultraship\lib\spdlog\include;$(ProjectDir)..\..\libultraship\libultraship\Lib\Fast3D\U64;$(ProjectDir)..\..\StormLib\src\;$(IncludePath) - $(ProjectDir)..\..\libultraship\libultraship;$(LibraryPath) - MinimumRecommendedRules.ruleset - - - - - - Level3 - true - WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - true - stdcpp17 - - - Console - true - - - - - Level3 - true - true - true - WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - - - Console - true - true - true - - - - - Level3 - true - _DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - true - stdcpp17 - stdc11 - MultiThreadedDebug - - - Console - true - ZAPDUtils.lib;OTRLib.lib;%(AdditionalDependencies) - - - - - Level3 - true - true - true - NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - true - stdcpp17 - stdc11 - MultiThreaded - - - Console - true - true - true - - - - - - \ No newline at end of file diff --git a/OTRExporter/OTRExporter/OTRExporter.vcxproj.filters b/OTRExporter/OTRExporter/OTRExporter.vcxproj.filters deleted file mode 100644 index a8cf56737..000000000 --- a/OTRExporter/OTRExporter/OTRExporter.vcxproj.filters +++ /dev/null @@ -1,150 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - \ No newline at end of file diff --git a/OTRGui/CMake/Default.cmake b/OTRGui/CMake/Default.cmake new file mode 100644 index 000000000..70bfa9038 --- /dev/null +++ b/OTRGui/CMake/Default.cmake @@ -0,0 +1,65 @@ +################################################################################ +# Command for variable_watch. This command issues error message, if a variable +# is changed. If variable PROPERTY_READER_GUARD_DISABLED is TRUE nothing happens +# variable_watch( property_reader_guard) +################################################################################ +function(property_reader_guard VARIABLE ACCESS VALUE CURRENT_LIST_FILE STACK) + if("${PROPERTY_READER_GUARD_DISABLED}") + return() + endif() + + if("${ACCESS}" STREQUAL "MODIFIED_ACCESS") + message(FATAL_ERROR + " Variable ${VARIABLE} is not supposed to be changed.\n" + " It is used only for reading target property ${VARIABLE}.\n" + " Use\n" + " set_target_properties(\"\" PROPERTIES \"${VARIABLE}\" \"\")\n" + " or\n" + " set_target_properties(\"\" PROPERTIES \"${VARIABLE}_\" \"\")\n" + " instead.\n") + endif() +endfunction() + +################################################################################ +# Create variable with generator expression that expands to value of +# target property _. If property is empty or not set then property +# is used instead. Variable has watcher property_reader_guard that +# doesn't allow to edit it. +# create_property_reader() +# Input: +# name - Name of watched property and output variable +################################################################################ +function(create_property_reader NAME) + set(PROPERTY_READER_GUARD_DISABLED TRUE) + set(CONFIG_VALUE "$>>>") + set(IS_CONFIG_VALUE_EMPTY "$") + set(GENERAL_VALUE "$>") + set("${NAME}" "$" PARENT_SCOPE) + variable_watch("${NAME}" property_reader_guard) +endfunction() + +################################################################################ +# Set property $_${PROPS_CONFIG_U} of ${PROPS_TARGET} to +# set_config_specific_property( ) +# Input: +# name - Prefix of property name +# value - New value +################################################################################ +function(set_config_specific_property NAME VALUE) + set_target_properties("${PROPS_TARGET}" PROPERTIES "${NAME}_${PROPS_CONFIG_U}" "${VALUE}") +endfunction() + +################################################################################ + +create_property_reader("TARGET_NAME") +create_property_reader("OUTPUT_DIRECTORY") + +set_config_specific_property("TARGET_NAME" "${PROPS_TARGET}") +set_config_specific_property("OUTPUT_NAME" "${TARGET_NAME}") +set_config_specific_property("ARCHIVE_OUTPUT_NAME" "${TARGET_NAME}") +set_config_specific_property("LIBRARY_OUTPUT_NAME" "${TARGET_NAME}") +set_config_specific_property("RUNTIME_OUTPUT_NAME" "${TARGET_NAME}") + +set_config_specific_property("ARCHIVE_OUTPUT_DIRECTORY" "${OUTPUT_DIRECTORY}") +set_config_specific_property("LIBRARY_OUTPUT_DIRECTORY" "${OUTPUT_DIRECTORY}") +set_config_specific_property("RUNTIME_OUTPUT_DIRECTORY" "${OUTPUT_DIRECTORY}") \ No newline at end of file diff --git a/OTRGui/CMake/DefaultCXX.cmake b/OTRGui/CMake/DefaultCXX.cmake new file mode 100644 index 000000000..eff0e569b --- /dev/null +++ b/OTRGui/CMake/DefaultCXX.cmake @@ -0,0 +1,12 @@ +include("${CMAKE_CURRENT_LIST_DIR}/Default.cmake") + +set_config_specific_property("OUTPUT_DIRECTORY" "${CMAKE_SOURCE_DIR}$<$>:/${CMAKE_VS_PLATFORM_NAME}>/${PROPS_CONFIG}") + +if(MSVC) + create_property_reader("DEFAULT_CXX_EXCEPTION_HANDLING") + create_property_reader("DEFAULT_CXX_DEBUG_INFORMATION_FORMAT") + + set_target_properties("${PROPS_TARGET}" PROPERTIES MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>DLL") + set_config_specific_property("DEFAULT_CXX_EXCEPTION_HANDLING" "/EHsc") + set_config_specific_property("DEFAULT_CXX_DEBUG_INFORMATION_FORMAT" "/Zi") +endif() diff --git a/OTRGui/CMake/Utils.cmake b/OTRGui/CMake/Utils.cmake new file mode 100644 index 000000000..9e2f961eb --- /dev/null +++ b/OTRGui/CMake/Utils.cmake @@ -0,0 +1,234 @@ +# utils file for projects came from visual studio solution with cmake-converter. + +################################################################################ +# Wrap each token of the command with condition +################################################################################ +cmake_policy(PUSH) +cmake_policy(SET CMP0054 NEW) +macro(prepare_commands) + unset(TOKEN_ROLE) + unset(COMMANDS) + foreach(TOKEN ${ARG_COMMANDS}) + if("${TOKEN}" STREQUAL "COMMAND") + set(TOKEN_ROLE "KEYWORD") + elseif("${TOKEN_ROLE}" STREQUAL "KEYWORD") + set(TOKEN_ROLE "CONDITION") + elseif("${TOKEN_ROLE}" STREQUAL "CONDITION") + set(TOKEN_ROLE "COMMAND") + elseif("${TOKEN_ROLE}" STREQUAL "COMMAND") + set(TOKEN_ROLE "ARG") + endif() + + if("${TOKEN_ROLE}" STREQUAL "KEYWORD") + list(APPEND COMMANDS "${TOKEN}") + elseif("${TOKEN_ROLE}" STREQUAL "CONDITION") + set(CONDITION ${TOKEN}) + elseif("${TOKEN_ROLE}" STREQUAL "COMMAND") + list(APPEND COMMANDS "$<$:${DUMMY}>$<${CONDITION}:${TOKEN}>") + elseif("${TOKEN_ROLE}" STREQUAL "ARG") + list(APPEND COMMANDS "$<${CONDITION}:${TOKEN}>") + endif() + endforeach() +endmacro() +cmake_policy(POP) + +################################################################################ +# Transform all the tokens to absolute paths +################################################################################ +macro(prepare_output) + unset(OUTPUT) + foreach(TOKEN ${ARG_OUTPUT}) + if(IS_ABSOLUTE ${TOKEN}) + list(APPEND OUTPUT "${TOKEN}") + else() + list(APPEND OUTPUT "${CMAKE_CURRENT_SOURCE_DIR}/${TOKEN}") + endif() + endforeach() +endmacro() + +################################################################################ +# Parse add_custom_command_if args. +# +# Input: +# PRE_BUILD - Pre build event option +# PRE_LINK - Pre link event option +# POST_BUILD - Post build event option +# TARGET - Target +# OUTPUT - List of output files +# DEPENDS - List of files on which the command depends +# COMMANDS - List of commands(COMMAND condition1 commannd1 args1 COMMAND +# condition2 commannd2 args2 ...) +# Output: +# OUTPUT - Output files +# DEPENDS - Files on which the command depends +# COMMENT - Comment +# PRE_BUILD - TRUE/FALSE +# PRE_LINK - TRUE/FALSE +# POST_BUILD - TRUE/FALSE +# TARGET - Target name +# COMMANDS - Prepared commands(every token is wrapped in CONDITION) +# NAME - Unique name for custom target +# STEP - PRE_BUILD/PRE_LINK/POST_BUILD +################################################################################ +function(add_custom_command_if_parse_arguments) + cmake_parse_arguments("ARG" "PRE_BUILD;PRE_LINK;POST_BUILD" "TARGET;COMMENT" "DEPENDS;OUTPUT;COMMANDS" ${ARGN}) + + if(WIN32) + set(DUMMY "cd.") + elseif(UNIX) + set(DUMMY "true") + endif() + + prepare_commands() + prepare_output() + + set(DEPENDS "${ARG_DEPENDS}") + set(COMMENT "${ARG_COMMENT}") + set(PRE_BUILD "${ARG_PRE_BUILD}") + set(PRE_LINK "${ARG_PRE_LINK}") + set(POST_BUILD "${ARG_POST_BUILD}") + set(TARGET "${ARG_TARGET}") + if(PRE_BUILD) + set(STEP "PRE_BUILD") + elseif(PRE_LINK) + set(STEP "PRE_LINK") + elseif(POST_BUILD) + set(STEP "POST_BUILD") + endif() + set(NAME "${TARGET}_${STEP}") + + set(OUTPUT "${OUTPUT}" PARENT_SCOPE) + set(DEPENDS "${DEPENDS}" PARENT_SCOPE) + set(COMMENT "${COMMENT}" PARENT_SCOPE) + set(PRE_BUILD "${PRE_BUILD}" PARENT_SCOPE) + set(PRE_LINK "${PRE_LINK}" PARENT_SCOPE) + set(POST_BUILD "${POST_BUILD}" PARENT_SCOPE) + set(TARGET "${TARGET}" PARENT_SCOPE) + set(COMMANDS "${COMMANDS}" PARENT_SCOPE) + set(STEP "${STEP}" PARENT_SCOPE) + set(NAME "${NAME}" PARENT_SCOPE) +endfunction() + +################################################################################ +# Add conditional custom command +# +# Generating Files +# The first signature is for adding a custom command to produce an output: +# add_custom_command_if( +# +# +# +# [COMMAND condition command2 [args2...]] +# [DEPENDS [depends...]] +# [COMMENT comment] +# +# Build Events +# add_custom_command_if( +# +# +# +# [COMMAND condition command2 [args2...]] +# [COMMENT comment] +# +# Input: +# output - Output files the command is expected to produce +# condition - Generator expression for wrapping the command +# command - Command-line(s) to execute at build time. +# args - Command`s args +# depends - Files on which the command depends +# comment - Display the given message before the commands are executed at +# build time. +# PRE_BUILD - Run before any other rules are executed within the target +# PRE_LINK - Run after sources have been compiled but before linking the +# binary +# POST_BUILD - Run after all other rules within the target have been +# executed +################################################################################ +function(add_custom_command_if) + add_custom_command_if_parse_arguments(${ARGN}) + + if(OUTPUT AND TARGET) + message(FATAL_ERROR "Wrong syntax. A TARGET and OUTPUT can not both be specified.") + endif() + + if(OUTPUT) + add_custom_command(OUTPUT ${OUTPUT} + ${COMMANDS} + DEPENDS ${DEPENDS} + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + COMMENT ${COMMENT}) + elseif(TARGET) + if(PRE_BUILD AND NOT ${CMAKE_GENERATOR} MATCHES "Visual Studio") + add_custom_target( + ${NAME} + ${COMMANDS} + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + COMMENT ${COMMENT}) + add_dependencies(${TARGET} ${NAME}) + else() + add_custom_command( + TARGET ${TARGET} + ${STEP} + ${COMMANDS} + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + COMMENT ${COMMENT}) + endif() + else() + message(FATAL_ERROR "Wrong syntax. A TARGET or OUTPUT must be specified.") + endif() +endfunction() + +################################################################################ +# Use props file for a target and configs +# use_props( ) +# Inside there are following variables: +# PROPS_TARGET - +# PROPS_CONFIG - One of +# PROPS_CONFIG_U - Uppercase PROPS_CONFIG +# Input: +# target - Target to apply props file +# configs - Build configurations to apply props file +# props_file - CMake script +################################################################################ +macro(use_props TARGET CONFIGS PROPS_FILE) + set(PROPS_TARGET "${TARGET}") + foreach(PROPS_CONFIG ${CONFIGS}) + string(TOUPPER "${PROPS_CONFIG}" PROPS_CONFIG_U) + + get_filename_component(ABSOLUTE_PROPS_FILE "${PROPS_FILE}" ABSOLUTE BASE_DIR "${CMAKE_CURRENT_LIST_DIR}") + if(EXISTS "${ABSOLUTE_PROPS_FILE}") + include("${ABSOLUTE_PROPS_FILE}") + else() + message(WARNING "Corresponding cmake file from props \"${ABSOLUTE_PROPS_FILE}\" doesn't exist") + endif() + endforeach() +endmacro() + +################################################################################ +# Add compile options to source file +# source_file_compile_options( [compile_options...]) +# Input: +# source_file - Source file +# compile_options - Options to add to COMPILE_FLAGS property +################################################################################ +function(source_file_compile_options SOURCE_FILE) + if("${ARGC}" LESS_EQUAL "1") + return() + endif() + + get_source_file_property(COMPILE_OPTIONS "${SOURCE_FILE}" COMPILE_OPTIONS) + + if(COMPILE_OPTIONS) + list(APPEND COMPILE_OPTIONS ${ARGN}) + else() + set(COMPILE_OPTIONS "${ARGN}") + endif() + + set_source_files_properties("${SOURCE_FILE}" PROPERTIES COMPILE_OPTIONS "${COMPILE_OPTIONS}") +endfunction() + +################################################################################ +# Default properties of visual studio projects +################################################################################ +set(DEFAULT_CXX_PROPS "${CMAKE_CURRENT_LIST_DIR}/DefaultCXX.cmake") +set(DEFAULT_Fortran_PROPS "${CMAKE_CURRENT_LIST_DIR}/DefaultFortran.cmake") diff --git a/OTRGui/CMakeLists.txt b/OTRGui/CMakeLists.txt index 532e24d2d..a1562beb4 100644 --- a/OTRGui/CMakeLists.txt +++ b/OTRGui/CMakeLists.txt @@ -3,27 +3,61 @@ project(OTRGui) set(PLATFORM "Desktop") set(CMAKE_CXX_STANDARD 20) -set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/build) +#set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/build) set(APP_ICON_RESOURCE_WINDOWS ${CMAKE_CURRENT_SOURCE_DIR}/appicon.rc) -add_subdirectory(libs/raylib) +if (CMAKE_SYSTEM_NAME STREQUAL "Linux") + set(OpenGL_GL_PREFERENCE "GLVND") +endif() + +include(CMake/Utils.cmake) + +add_subdirectory(libs/raylib EXCLUDE_FROM_ALL) include_directories(src) include_directories(src/game) include_directories(include) -include_external_msproject(ZAPD ../../ZAPDTR/ZAPD/ZAPD.vcproj) -include_external_msproject(ZAPDUtils ../../ZAPDTR/ZAPDUtils/ZAPDUtils.vcproj) -include_external_msproject(libultraship ../../libultraship/libultraship/libultraship.vcproj) -include_external_msproject(OTRExporter ../../OTRExporter/OTRExporter/OTRExporter.vcproj) +if (NOT TARGET libultraship) + add_subdirectory(../libultraship/libultraship ${CMAKE_BINARY_DIR}/libultraship) +endif() +if (NOT TARGET ZAPD) + add_subdirectory(../ZAPDTR/ZAPD ${CMAKE_BINARY_DIR}/ZAPD) +endif() +if (NOT TARGET ZAPDUtils) + add_subdirectory(../ZAPDTR/ZAPDUtils ${CMAKE_BINARY_DIR}/ZAPDUtils) +endif() +if (NOT TARGET OTRExporter) + add_subdirectory(../OTRExporter/OTRExporter ${CMAKE_BINARY_DIR}/OTRExporter) +endif() +if (NOT TARGET storm) + add_subdirectory(../StormLib ${CMAKE_BINARY_DIR}/StormLib) +endif() file(GLOB_RECURSE HEADERS src/*.h) file(GLOB_RECURSE SOURCES src/*.cpp) file(GLOB_RECURSE C_SOURCES src/*.c) add_executable(${PROJECT_NAME} ${SOURCES} ${C_SOURCES} ${HEADERS} ${APP_ICON_RESOURCE_WINDOWS}) -add_custom_command(TARGET ${PROJECT_NAME} PRE_BUILD COMMAND ${CMAKE_COMMAND} -Dsrc_dir="${CMAKE_SOURCE_DIR}/assets" -Ddst_dir="${CMAKE_CURRENT_BINARY_DIR}/assets" -P "${CMAKE_CURRENT_SOURCE_DIR}/Overwrite.cmake") -add_custom_command(TARGET ${PROJECT_NAME} PRE_BUILD COMMAND ${CMAKE_COMMAND} -Dsrc_dir="${CMAKE_SOURCE_DIR}/../OTRExporter/assets" -Ddst_dir="${CMAKE_CURRENT_BINARY_DIR}/assets/game" -P "${CMAKE_CURRENT_SOURCE_DIR}/Overwrite.cmake") -add_custom_command(TARGET ${PROJECT_NAME} PRE_BUILD COMMAND ${CMAKE_COMMAND} -Dsrc_dir="${CMAKE_SOURCE_DIR}/../soh/assets/xml" -Ddst_dir="${CMAKE_CURRENT_BINARY_DIR}/assets/extractor/xmls" -P "${CMAKE_CURRENT_SOURCE_DIR}/Overwrite.cmake") + +if (CMAKE_SYSTEM_NAME STREQUAL "Windows") +use_props(${PROJECT_NAME} "${CMAKE_CONFIGURATION_TYPES}" "${DEFAULT_CXX_PROPS}") +endif() + +add_custom_target(Assets ALL + COMMAND ${CMAKE_COMMAND} -Dsrc_dir="${CMAKE_CURRENT_SOURCE_DIR}/assets" -Ddst_dir="${CMAKE_CURRENT_BINARY_DIR}/assets" -P "${CMAKE_CURRENT_SOURCE_DIR}/Overwrite.cmake" + COMMAND ${CMAKE_COMMAND} -Dsrc_dir="${CMAKE_CURRENT_SOURCE_DIR}/../OTRExporter/assets" -Ddst_dir="${CMAKE_CURRENT_BINARY_DIR}/assets/game" -P "${CMAKE_CURRENT_SOURCE_DIR}/Overwrite.cmake" + COMMAND ${CMAKE_COMMAND} -Dsrc_dir="${CMAKE_CURRENT_SOURCE_DIR}/../soh/assets/xml" -Ddst_dir="${CMAKE_CURRENT_BINARY_DIR}/assets/extractor/xmls" -P "${CMAKE_CURRENT_SOURCE_DIR}/Overwrite.cmake" + ) + +add_dependencies(OTRGui Assets) target_link_libraries(${PROJECT_NAME} PUBLIC raylib) + +INSTALL(TARGETS OTRGui DESTINATION . COMPONENT ship) +install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/assets + DESTINATION . + COMPONENT ship +) +INSTALL(TARGETS ZAPD DESTINATION assets/extractor COMPONENT ship) + diff --git a/OTRGui/Overwrite.cmake b/OTRGui/Overwrite.cmake index d3f3c4bcd..8eeaf6889 100644 --- a/OTRGui/Overwrite.cmake +++ b/OTRGui/Overwrite.cmake @@ -1,10 +1,15 @@ -file(GLOB_RECURSE _file_list RELATIVE "${src_dir}" "${src_dir}/*") +include(CMakePrintHelpers) + +string(REPLACE "\\ " " " sources_dir "${src_dir}") +string(REPLACE "\\ " " " destination_dir "${dst_dir}") + +file(GLOB_RECURSE _file_list RELATIVE "${sources_dir}" "${sources_dir}/*") foreach( each_file ${_file_list} ) - set(destinationfile "${dst_dir}/${each_file}") - set(sourcefile "${src_dir}/${each_file}") + set(destinationfile "${destination_dir}/${each_file}") + set(sourcefile "${sources_dir}/${each_file}") if(NOT EXISTS ${destinationfile} OR ${sourcefile} IS_NEWER_THAN ${destinationfile}) get_filename_component(destinationdir ${destinationfile} DIRECTORY) file(COPY ${sourcefile} DESTINATION ${destinationdir}) endif() -endforeach(each_file) \ No newline at end of file +endforeach(each_file) diff --git a/StormLib/CMakeLists.txt b/StormLib/CMakeLists.txt index 243dea578..1469e841d 100644 --- a/StormLib/CMakeLists.txt +++ b/StormLib/CMakeLists.txt @@ -1,8 +1,9 @@ -project(StormLib) +set(PROJECT_NAME StormLib) +#project(StormLib) cmake_minimum_required(VERSION 3.10) set(LIBRARY_NAME storm) -set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_EXTENSIONS OFF) set(CMAKE_CXX_STANDARD_REQUIRED ON) @@ -15,6 +16,13 @@ option(STORM_BUILD_TESTS # "BUILD_TESTING" OFF # Stay coherent with CTest variables ) +if (CMAKE_SYSTEM_NAME STREQUAL "Windows") +set(Source_Files__Windows + src/lzma/C/LzFindMt.c + src/lzma/C/Threads.c +) +endif() + set(SRC_FILES src/adpcm/adpcm.cpp src/huffman/huff.cpp @@ -46,6 +54,7 @@ set(SRC_FILES src/SFileVerify.cpp src/libtomcrypt/src/pk/rsa/rsa_verify_simple.c src/libtomcrypt/src/misc/crypt_libc.c + ${Source_Files__Windows} ) if(MSVC) @@ -333,6 +342,76 @@ if(WIN32) set_target_properties(${LIBRARY_NAME} PROPERTIES OUTPUT_NAME "StormLib") endif() +if (CMAKE_SYSTEM_NAME STREQUAL "Windows") +use_props(${LIBRARY_NAME} "${CMAKE_CONFIGURATION_TYPES}" "${DEFAULT_CXX_PROPS}") +endif() + +################################################################################ +# Compile definitions +################################################################################ + +if (CMAKE_SYSTEM_NAME STREQUAL "Windows") + if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64") + target_compile_definitions(${LIBRARY_NAME} PRIVATE + "$<$:" + "_DEBUG;" + "_CRT_SECURE_NO_WARNINGS;" + ">" + "$<$:" + "NDEBUG" + ">" + WIN32 + _LIB + "UNICODE;" + "_UNICODE" + ) + elseif("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "Win32") + target_compile_definitions(${LIBRARY_NAME} PRIVATE + "$<$:" + "_DEBUG;" + "_CRT_SECURE_NO_WARNINGS;" + ">" + "$<$:" + "NDEBUG;" + ">" + "WIN32;" + _LIB + "UNICODE;" + "_UNICODE" + ) + endif() +endif() + +################################################################################ +# MSVC runtime library +################################################################################ +if (CMAKE_SYSTEM_NAME STREQUAL "Windows") + get_property(MSVC_RUNTIME_LIBRARY_DEFAULT TARGET ${LIBRARY_NAME} PROPERTY MSVC_RUNTIME_LIBRARY) + if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64") + string(CONCAT "MSVC_RUNTIME_LIBRARY_STR" + $<$: + MultiThreadedDebug + > + $<$: + MultiThreaded + > + $<$,$>>:${MSVC_RUNTIME_LIBRARY_DEFAULT}> + ) + elseif("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "Win32") + string(CONCAT "MSVC_RUNTIME_LIBRARY_STR" + $<$: + MultiThreadedDebug + > + $<$: + MultiThreaded + > + $<$,$>>:${MSVC_RUNTIME_LIBRARY_DEFAULT}> + ) + endif() + set_target_properties(${LIBRARY_NAME} PROPERTIES MSVC_RUNTIME_LIBRARY ${MSVC_RUNTIME_LIBRARY_STR}) +endif() + + target_link_libraries(${LIBRARY_NAME} ${LINK_LIBS}) target_compile_definitions(${LIBRARY_NAME} INTERFACE STORMLIB_NO_AUTO_LINK) #CMake will take care of the linking target_include_directories(${LIBRARY_NAME} PUBLIC src/) diff --git a/ZAPDTR/Makefile b/ZAPDTR/Makefile deleted file mode 100644 index 660e0469c..000000000 --- a/ZAPDTR/Makefile +++ /dev/null @@ -1,146 +0,0 @@ -# use variables in submakes -export -OPTIMIZATION_ON ?= 1 -ASAN ?= 0 -DEPRECATION_ON ?= 1 -DEBUG ?= 0 -COPYCHECK_ARGS ?= -LLD ?= 0 -WERROR ?= 0 -UNAME := $(shell uname) - -# Use clang++ if available, else use g++ -ifeq ($(shell command -v clang++ >/dev/null 2>&1; echo $$?),0) - CXX ?= clang++ -else - CXX ?= g++ -endif - -INC := -I ZAPD -I lib/elfio -I lib/libgfxd -I lib/tinyxml2 -I ZAPDUtils -CXXFLAGS := -fpic -std=c++17 -Wall -Wextra -fno-omit-frame-pointer -OPTFLAGS := - -ifneq ($(DEBUG),0) - OPTIMIZATION_ON = 0 - CXXFLAGS += -g3 -DDEVELOPMENT -D_DEBUG - COPYCHECK_ARGS += --devel - DEPRECATION_ON = 0 -endif - -ifneq ($(WERROR),0) - CXXFLAGS += -Werror -endif - -ifeq ($(OPTIMIZATION_ON),0) - OPTFLAGS := -O0 -else - OPTFLAGS := -O2 -endif - -ifneq ($(ASAN),0) - CXXFLAGS += -fsanitize=address -fsanitize=pointer-compare -fsanitize=pointer-subtract -fsanitize=undefined -endif -ifneq ($(DEPRECATION_ON),0) - CXXFLAGS += -DDEPRECATION_ON -endif -# CXXFLAGS += -DTEXTURE_DEBUG - -LDFLAGS := -Llib/libgfxd -L../libultraship -L../StormLib/build \ - -pthread -lgfxd -lultraship ZAPDUtils/ZAPDUtils.a -lstorm -lbz2 -lm -ldl - -LDFLAGS += $(shell pkg-config --libs glew libpng zlib) $(shell sdl2-config --libs) -INC += $(shell pkg-config --cflags libpng) - -ifeq ($(UNAME), Darwin) - LDFLAGS += -framework OpenGL -framework Foundation -endif - -ifeq ($(UNAME), Linux) - LDFLAGS += $(shell pkg-config --libs x11 libpulse) -endif - -# Use LLD if available. Set LLD=0 to not use it -ifeq ($(shell command -v ld.lld >/dev/null 2>&1; echo $$?),0) - LLD := 1 -endif - -ifneq ($(LLD),0) - LDFLAGS += -fuse-ld=lld -endif - -UNAMEM := $(shell uname -m) -ifeq ($(UNAME), Linux) - LDFLAGS += -Wl,-export-dynamic -lstdc++fs - EXPORTERS := -Wl,--whole-archive ../OTRExporter/OTRExporter/OTRExporter.a -Wl,--no-whole-archive -endif - -ifeq ($(UNAME), Darwin) - EXPORTERS := -Wl,-force_load ../OTRExporter/OTRExporter/OTRExporter.a -endif - - -ZAPD_SRC_DIRS := $(shell find ZAPD -type d) -SRC_DIRS = $(ZAPD_SRC_DIRS) lib/tinyxml2 - -ZAPD_CPP_FILES := $(foreach dir,$(ZAPD_SRC_DIRS),$(wildcard $(dir)/*.cpp)) -ZAPD_H_FILES := $(foreach dir,$(ZAPD_SRC_DIRS),$(wildcard $(dir)/*.h)) - -CPP_FILES += $(ZAPD_CPP_FILES) lib/tinyxml2/tinyxml2.cpp -O_FILES := $(foreach f,$(CPP_FILES:.cpp=.o),build/$f) -O_FILES += build/ZAPD/BuildInfo.o - -# create build directories -$(shell mkdir -p $(foreach dir,$(SRC_DIRS),build/$(dir))) - - -# Main targets -all: ZAPD.out copycheck - -build/ZAPD/BuildInfo.o: - python3 ZAPD/genbuildinfo.py $(COPYCHECK_ARGS) - $(CXX) $(CXXFLAGS) $(OPTFLAGS) $(INC) -c $(OUTPUT_OPTION) build/ZAPD/BuildInfo.cpp - -copycheck: ZAPD.out - python3 copycheck.py - -clean: - rm -rf build ZAPD.out - $(MAKE) -C lib/libgfxd clean - $(MAKE) -C ZAPDUtils clean - $(MAKE) -C ExporterTest clean - rm -rf ../StormLib/build - -rebuild: clean all - -format: - clang-format-11 -i $(ZAPD_CPP_FILES) $(ZAPD_H_FILES) - $(MAKE) -C ZAPDUtils format - $(MAKE) -C ExporterTest format - -.PHONY: all build/ZAPD/BuildInfo.o copycheck clean rebuild format - -build/%.o: %.cpp - $(CXX) $(CXXFLAGS) $(OPTFLAGS) $(INC) -c $(OUTPUT_OPTION) $< - - -# Submakes -lib/libgfxd/libgfxd.a: - $(MAKE) -C lib/libgfxd - -.PHONY: StormLib -StormLib: - LDFLAGS="" cmake -B ../StormLib/build -S ../StormLib - $(MAKE) -C ../StormLib/build - -.PHONY: ExporterTest -ExporterTest: - $(MAKE) -C ExporterTest - -.PHONY: ZAPDUtils -ZAPDUtils: - $(MAKE) -C ZAPDUtils - - -# Linking -ZAPD.out: $(O_FILES) lib/libgfxd/libgfxd.a ExporterTest ZAPDUtils StormLib - $(CXX) $(CXXFLAGS) $(O_FILES) $(EXPORTERS) $(LDFLAGS) $(OUTPUT_OPTION) diff --git a/ZAPDTR/ZAPD/CMakeLists.txt b/ZAPDTR/ZAPD/CMakeLists.txt new file mode 100644 index 000000000..748793885 --- /dev/null +++ b/ZAPDTR/ZAPD/CMakeLists.txt @@ -0,0 +1,486 @@ +set(PROJECT_NAME ZAPD) + +set(CMAKE_CXX_STANDARD 20 CACHE STRING "The C++ standard to use") +#set(CMAKE_C_STANDARD 11 CACHE STRING "The C standard to use") +set(CMAKE_C_STANDARD 11) + +################################################################################ +# Source groups +################################################################################ +set(Header_Files + "../lib/tinyxml2/tinyxml2.h" + "CRC32.h" + "Declaration.h" + "FileWorker.h" + "GameConfig.h" + "Globals.h" + "ImageBackend.h" + "OutputFormatter.h" + "WarningHandler.h" +) +source_group("Header Files" FILES ${Header_Files}) + +set(Header_Files__Libraries + "../../libultraship/libultraship/Lib/stb/stb_image.h" + "../../libultraship/libultraship/Lib/stb/stb_image_write.h" + "ctpl_stl.h" +) +source_group("Header Files\\Libraries" FILES ${Header_Files__Libraries}) + +set(Header_Files__Libraries__elfio + "../lib/elfio/elfio/elf_types.hpp" + "../lib/elfio/elfio/elfio.hpp" + "../lib/elfio/elfio/elfio_dump.hpp" + "../lib/elfio/elfio/elfio_dynamic.hpp" + "../lib/elfio/elfio/elfio_header.hpp" + "../lib/elfio/elfio/elfio_note.hpp" + "../lib/elfio/elfio/elfio_relocation.hpp" + "../lib/elfio/elfio/elfio_section.hpp" + "../lib/elfio/elfio/elfio_segment.hpp" + "../lib/elfio/elfio/elfio_strings.hpp" + "../lib/elfio/elfio/elfio_symbols.hpp" + "../lib/elfio/elfio/elfio_utils.hpp" +) +source_group("Header Files\\Libraries\\elfio" FILES ${Header_Files__Libraries__elfio}) + +set(Header_Files__Libraries__libgfxd + "../lib/libgfxd/gbi.h" + "../lib/libgfxd/gfxd.h" + "../lib/libgfxd/priv.h" +) +source_group("Header Files\\Libraries\\libgfxd" FILES ${Header_Files__Libraries__libgfxd}) + +set(Header_Files__Yaz0 + "yaz0/readwrite.h" + "yaz0/yaz0.h" +) +source_group("Header Files\\Yaz0" FILES ${Header_Files__Yaz0}) + +set(Header_Files__Z64 + "OtherStructs/SkinLimbStructs.h" + "Overlays/ZOverlay.h" + "ZAnimation.h" + "ZArray.h" + "ZAudio.h" + "ZBackground.h" + "ZBlob.h" + "ZCollision.h" + "ZCutscene.h" + "ZCutsceneMM.h" + "ZDisplayList.h" + "ZFile.h" + "ZLimb.h" + "ZMtx.h" + "ZPath.h" + "ZPlayerAnimationData.h" + "ZResource.h" + "ZRom.h" + "ZScalar.h" + "ZSkeleton.h" + "ZString.h" + "ZSymbol.h" + "ZText.h" + "ZTexture.h" + "ZTextureAnimation.h" + "ZVector.h" + "ZVtx.h" +) +source_group("Header Files\\Z64" FILES ${Header_Files__Z64}) + +set(Header_Files__Z64__ZRoom + "ZRoom/ZRoom.h" + "ZRoom/ZRoomCommand.h" +) +source_group("Header Files\\Z64\\ZRoom" FILES ${Header_Files__Z64__ZRoom}) + +set(Header_Files__Z64__ZRoom__Commands + "ZRoom/Commands/EndMarker.h" + "ZRoom/Commands/SetActorCutsceneList.h" + "ZRoom/Commands/SetActorList.h" + "ZRoom/Commands/SetAlternateHeaders.h" + "ZRoom/Commands/SetAnimatedMaterialList.h" + "ZRoom/Commands/SetCameraSettings.h" + "ZRoom/Commands/SetCollisionHeader.h" + "ZRoom/Commands/SetCsCamera.h" + "ZRoom/Commands/SetCutscenes.h" + "ZRoom/Commands/SetEchoSettings.h" + "ZRoom/Commands/SetEntranceList.h" + "ZRoom/Commands/SetExitList.h" + "ZRoom/Commands/SetLightingSettings.h" + "ZRoom/Commands/SetLightList.h" + "ZRoom/Commands/SetMesh.h" + "ZRoom/Commands/SetMinimapChests.h" + "ZRoom/Commands/SetMinimapList.h" + "ZRoom/Commands/SetObjectList.h" + "ZRoom/Commands/SetPathways.h" + "ZRoom/Commands/SetRoomBehavior.h" + "ZRoom/Commands/SetRoomList.h" + "ZRoom/Commands/SetSkyboxModifier.h" + "ZRoom/Commands/SetSkyboxSettings.h" + "ZRoom/Commands/SetSoundSettings.h" + "ZRoom/Commands/SetSpecialObjects.h" + "ZRoom/Commands/SetStartPositionList.h" + "ZRoom/Commands/SetTimeSettings.h" + "ZRoom/Commands/SetTransitionActorList.h" + "ZRoom/Commands/SetWind.h" + "ZRoom/Commands/SetWorldMapVisited.h" + "ZRoom/Commands/Unused09.h" + "ZRoom/Commands/Unused1D.h" + "ZRoom/Commands/ZRoomCommandUnk.h" +) +source_group("Header Files\\Z64\\ZRoom\\Commands" FILES ${Header_Files__Z64__ZRoom__Commands}) + +set(Resource_Files + "../../OTRExporter/CFG/SymbolMap_OoTMqDbg.txt" +) +source_group("Resource Files" FILES ${Resource_Files}) + +set(Source_Files + "Declaration.cpp" + "FileWorker.cpp" + "GameConfig.cpp" + "Globals.cpp" + "ImageBackend.cpp" + "Main.cpp" + "OutputFormatter.cpp" + "WarningHandler.cpp" +) +source_group("Source Files" FILES ${Source_Files}) + +set(Source_Files__Libraries__libgfxd + "../lib/libgfxd/gfxd.c" + "../lib/libgfxd/uc.c" + "../lib/libgfxd/uc_f3d.c" + "../lib/libgfxd/uc_f3db.c" + "../lib/libgfxd/uc_f3dex.c" + "../lib/libgfxd/uc_f3dex2.c" + "../lib/libgfxd/uc_f3dexb.c" +) +source_group("Source Files\\Libraries\\libgfxd" FILES ${Source_Files__Libraries__libgfxd}) + +set(Source_Files__Yaz0 + "yaz0/yaz0.cpp" +) +source_group("Source Files\\Yaz0" FILES ${Source_Files__Yaz0}) + +set(Source_Files__Z64 + "OtherStructs/SkinLimbStructs.cpp" + "Overlays/ZOverlay.cpp" + "ZAnimation.cpp" + "ZArray.cpp" + "ZAudio.cpp" + "ZAudioDecode.cpp" + "ZBackground.cpp" + "ZBlob.cpp" + "ZCollision.cpp" + "ZCutscene.cpp" + "ZCutsceneMM.cpp" + "ZDisplayList.cpp" + "ZFile.cpp" + "ZLimb.cpp" + "ZMtx.cpp" + "ZPath.cpp" + "ZPlayerAnimationData.cpp" + "ZResource.cpp" + "ZRom.cpp" + "ZScalar.cpp" + "ZSkeleton.cpp" + "ZString.cpp" + "ZSymbol.cpp" + "ZText.cpp" + "ZTexture.cpp" + "ZTextureAnimation.cpp" + "ZVector.cpp" + "ZVtx.cpp" +) +source_group("Source Files\\Z64" FILES ${Source_Files__Z64}) + +set(Source_Files__Z64__ZRoom + "ZRoom/ZRoom.cpp" + "ZRoom/ZRoomCommand.cpp" +) +source_group("Source Files\\Z64\\ZRoom" FILES ${Source_Files__Z64__ZRoom}) + +set(Source_Files__Z64__ZRoom__Commands + "ZRoom/Commands/EndMarker.cpp" + "ZRoom/Commands/SetActorCutsceneList.cpp" + "ZRoom/Commands/SetActorList.cpp" + "ZRoom/Commands/SetAlternateHeaders.cpp" + "ZRoom/Commands/SetAnimatedMaterialList.cpp" + "ZRoom/Commands/SetCameraSettings.cpp" + "ZRoom/Commands/SetCollisionHeader.cpp" + "ZRoom/Commands/SetCsCamera.cpp" + "ZRoom/Commands/SetCutscenes.cpp" + "ZRoom/Commands/SetEchoSettings.cpp" + "ZRoom/Commands/SetEntranceList.cpp" + "ZRoom/Commands/SetExitList.cpp" + "ZRoom/Commands/SetLightingSettings.cpp" + "ZRoom/Commands/SetLightList.cpp" + "ZRoom/Commands/SetMesh.cpp" + "ZRoom/Commands/SetMinimapChests.cpp" + "ZRoom/Commands/SetMinimapList.cpp" + "ZRoom/Commands/SetObjectList.cpp" + "ZRoom/Commands/SetPathways.cpp" + "ZRoom/Commands/SetRoomBehavior.cpp" + "ZRoom/Commands/SetRoomList.cpp" + "ZRoom/Commands/SetSkyboxModifier.cpp" + "ZRoom/Commands/SetSkyboxSettings.cpp" + "ZRoom/Commands/SetSoundSettings.cpp" + "ZRoom/Commands/SetSpecialObjects.cpp" + "ZRoom/Commands/SetStartPositionList.cpp" + "ZRoom/Commands/SetTimeSettings.cpp" + "ZRoom/Commands/SetTransitionActorList.cpp" + "ZRoom/Commands/SetWind.cpp" + "ZRoom/Commands/SetWorldMapVisited.cpp" + "ZRoom/Commands/Unused09.cpp" + "ZRoom/Commands/Unused1D.cpp" + "ZRoom/Commands/ZRoomCommandUnk.cpp" +) +source_group("Source Files\\Z64\\ZRoom\\Commands" FILES ${Source_Files__Z64__ZRoom__Commands}) + +set(ALL_FILES + ${Header_Files} + ${Header_Files__Libraries} + ${Header_Files__Libraries__elfio} + ${Header_Files__Libraries__libgfxd} + ${Header_Files__Yaz0} + ${Header_Files__Z64} + ${Header_Files__Z64__ZRoom} + ${Header_Files__Z64__ZRoom__Commands} + ${Resource_Files} + ${Source_Files} + ${Source_Files__Libraries__libgfxd} + ${Source_Files__Yaz0} + ${Source_Files__Z64} + ${Source_Files__Z64__ZRoom} + ${Source_Files__Z64__ZRoom__Commands} + ${any__any} +) + +################################################################################ +# Target +################################################################################ +add_executable(${PROJECT_NAME} ${ALL_FILES}) + +if (CMAKE_SYSTEM_NAME STREQUAL "Windows") +use_props(${PROJECT_NAME} "${CMAKE_CONFIGURATION_TYPES}" "${DEFAULT_CXX_PROPS}") +endif() +################################################################################ +# Includes for CMake from *.props +################################################################################ + +set(ROOT_NAMESPACE ZAPD) + +if (CMAKE_SYSTEM_NAME STREQUAL "Windows") + if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64") + set_target_properties(${PROJECT_NAME} PROPERTIES + INTERPROCEDURAL_OPTIMIZATION_RELEASE "TRUE" + ) + elseif("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x86") + set_target_properties(${PROJECT_NAME} PROPERTIES + INTERPROCEDURAL_OPTIMIZATION_RELEASE "TRUE" + ) + endif() +elseif (CMAKE_SYSTEM_NAME MATCHES "Linux|Darwin") + set_target_properties(${PROJECT_NAME} PROPERTIES + OUTPUT_NAME "ZAPD.out" + ) +endif() +################################################################################ +# MSVC runtime library +################################################################################ +if (CMAKE_SYSTEM_NAME STREQUAL "Windows") + get_property(MSVC_RUNTIME_LIBRARY_DEFAULT TARGET ${PROJECT_NAME} PROPERTY MSVC_RUNTIME_LIBRARY) + if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64") + string(CONCAT "MSVC_RUNTIME_LIBRARY_STR" + $<$: + MultiThreadedDebug + > + $<$: + MultiThreaded + > + $<$,$>>:${MSVC_RUNTIME_LIBRARY_DEFAULT}> + ) + endif() + set_target_properties(${PROJECT_NAME} PROPERTIES MSVC_RUNTIME_LIBRARY ${MSVC_RUNTIME_LIBRARY_STR}) +endif() +################################################################################ +# Compile definitions +################################################################################ +if (CMAKE_SYSTEM_NAME STREQUAL "Windows") + if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64") + target_compile_definitions(${PROJECT_NAME} PRIVATE + "_CRT_SECURE_NO_WARNINGS;" + "_MBCS" + STORMLIB_NO_AUTO_LINK + ) + elseif("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x86") + target_compile_definitions(${PROJECT_NAME} PRIVATE + "$<$:" + "_CRT_SECURE_NO_WARNINGS" + ">" + "_MBCS" + STORMLIB_NO_AUTO_LINK + ) + endif() +endif() + +################################################################################ +# Compile and link options +################################################################################ + +find_package(PNG REQUIRED) + +target_include_directories(${PROJECT_NAME} PRIVATE + ${CMAKE_CURRENT_SOURCE_DIR}/../../ZAPDTR/ZAPDUtils + ${CMAKE_CURRENT_SOURCE_DIR}/../../ZAPDTR/lib/tinyxml2 + ${CMAKE_CURRENT_SOURCE_DIR}/../../ZAPDTR/lib/libgfxd + ${PNG_PNG_INCLUDE_DIR}/ + . + ) + +if(MSVC) + if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64") + target_compile_options(${PROJECT_NAME} PRIVATE + $<$: + /Od; + /RTC1 + > + $<$: + /Oi; + /Gy + > + /permissive-; + /sdl; + /W3; + ${DEFAULT_CXX_DEBUG_INFORMATION_FORMAT}; + ${DEFAULT_CXX_EXCEPTION_HANDLING} + ) + elseif("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x86") + target_compile_options(${PROJECT_NAME} PRIVATE + $<$: + /Od + > + $<$: + /O2; + /Oi; + /Gy + > + /permissive-; + /sdl; + /W3; + ${DEFAULT_CXX_DEBUG_INFORMATION_FORMAT}; + ${DEFAULT_CXX_EXCEPTION_HANDLING} + ) + endif() + if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64") + target_link_options(${PROJECT_NAME} PRIVATE + $<$: + /PROFILE + > + $<$: + /OPT:REF; + /OPT:ICF + > + /DEBUG:FULL + ) + elseif("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x86") + target_link_options(${PROJECT_NAME} PRIVATE + $<$: + /PROFILE + > + $<$: + /OPT:REF; + /OPT:ICF + > + /DEBUG:FULL + ) + endif() +endif() + +if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU|Clang|AppleClang") + target_compile_options(${PROJECT_NAME} PRIVATE + -Wall -Wextra -Wno-error + -Wno-unused-parameter + -Wno-unused-function + -Wno-unused-variable + -Wno-missing-field-initializers + -Wno-parentheses + -Wno-narrowing + $<$:-Wno-deprecated-enum-enum-conversion> + -pthread + ) + + if (CMAKE_SYSTEM_NAME STREQUAL "Darwin") + target_link_options(${PROJECT_NAME} PRIVATE + -pthread + ) + else() + target_link_options(${PROJECT_NAME} PRIVATE + -pthread + -Wl,-export-dynamic + ) + endif() + +endif() + +################################################################################ +# Dependencies +################################################################################ +add_dependencies(${PROJECT_NAME} + OTRExporter + ZAPDUtils + libultraship +) + +if (CMAKE_SYSTEM_NAME STREQUAL "Windows") + if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64") + set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) + set(ADDITIONAL_LIBRARY_DEPENDENCIES + "ZAPDUtils;" + "-WHOLEARCHIVE:$/$" + "libultraship;" + storm + PNG::PNG + ) + endif() +elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin") + set(THREADS_PREFER_PTHREAD_FLAG ON) + find_package(Threads REQUIRED) + set(ADDITIONAL_LIBRARY_DEPENDENCIES + "ZAPDUtils;" + -Wl,-force_load $/$ + "libultraship;" + PNG::PNG + ${CMAKE_DL_LIBS} + Threads::Threads + ) +elseif(CMAKE_SYSTEM_NAME STREQUAL "NintendoSwitch") + set(THREADS_PREFER_PTHREAD_FLAG ON) + find_package(Threads REQUIRED) + set(ADDITIONAL_LIBRARY_DEPENDENCIES + "ZAPDUtils;" + -Wl,--whole-archive $/$ -Wl,--no-whole-archive + "libultraship;" + PNG::PNG + Threads::Threads + ) +else() + set(THREADS_PREFER_PTHREAD_FLAG ON) + find_package(Threads REQUIRED) + set(ADDITIONAL_LIBRARY_DEPENDENCIES + "ZAPDUtils;" + -Wl,--whole-archive $/$ -Wl,--no-whole-archive + "libultraship;" + PNG::PNG + ${CMAKE_DL_LIBS} + Threads::Threads + ) +endif() + +if(CMAKE_SYSTEM_NAME STREQUAL "NintendoSwitch") +add_library(pathconf OBJECT pathconf.c) +target_link_libraries(${PROJECT_NAME} PRIVATE "${ADDITIONAL_LIBRARY_DEPENDENCIES}" $ ) +else() +target_link_libraries(${PROJECT_NAME} PRIVATE "${ADDITIONAL_LIBRARY_DEPENDENCIES}") +endif() diff --git a/ZAPDTR/ZAPD/ZResource.cpp b/ZAPDTR/ZAPD/ZResource.cpp index 89238d9a0..7536fa019 100644 --- a/ZAPDTR/ZAPD/ZResource.cpp +++ b/ZAPDTR/ZAPD/ZResource.cpp @@ -348,11 +348,14 @@ std::string ZResource::GetSourceOutputHeader([[maybe_unused]] const std::string& str += StringHelper::Sprintf("#define d%s \"__OTR__%s/%s\"", name.c_str(), outName.c_str(), nameStr.c_str()); if (nameSet && nameSet->find(name) == nameSet->end()) { + str += StringHelper::Sprintf(R"( #ifdef _WIN32 - str += StringHelper::Sprintf("\nstatic const __declspec(align(2)) char %s[] = d%s;", name.c_str(), name.c_str()); +static const __declspec(align(2)) char %s[] = d%s; #else - str += StringHelper::Sprintf("\nstatic const char %s[] __attribute__((aligned (2))) = d%s;", name.c_str(), name.c_str()); +static const char %s[] __attribute__((aligned (2))) = d%s; #endif + )", name.c_str(), name.c_str(), name.c_str(), name.c_str()); + if (nameSet) { nameSet->insert(name); } diff --git a/ZAPDTR/ZAPD/pathconf.c b/ZAPDTR/ZAPD/pathconf.c new file mode 100644 index 000000000..8ef448999 --- /dev/null +++ b/ZAPDTR/ZAPD/pathconf.c @@ -0,0 +1,6 @@ +#include + +long pathconf(const char *path, int name) { + return -1; +} + diff --git a/ZAPDTR/ZAPDTR.sln b/ZAPDTR/ZAPDTR.sln deleted file mode 100644 index 82538dd9f..000000000 --- a/ZAPDTR/ZAPDTR.sln +++ /dev/null @@ -1,82 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.30320.27 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ZAPD", "ZAPD\ZAPD.vcxproj", "{B53F9E5B-0A58-4BAE-9AFE-856C8CBB8D36}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ExporterExample", "ExporterTest\ExporterTest.vcxproj", "{65608EB0-1A47-45AD-AB66-192FB64C762C}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ZAPDUtils", "ZAPDUtils\ZAPDUtils.vcxproj", "{A2E01C3E-D647-45D1-9788-043DEBC1A908}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|x64 = Debug|x64 - Debug|x86 = Debug|x86 - MinSizeRel|x64 = MinSizeRel|x64 - MinSizeRel|x86 = MinSizeRel|x86 - Release|x64 = Release|x64 - Release|x86 = Release|x86 - RelWithDebInfo|x64 = RelWithDebInfo|x64 - RelWithDebInfo|x86 = RelWithDebInfo|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {B53F9E5B-0A58-4BAE-9AFE-856C8CBB8D36}.Debug|x64.ActiveCfg = Debug|x64 - {B53F9E5B-0A58-4BAE-9AFE-856C8CBB8D36}.Debug|x64.Build.0 = Debug|x64 - {B53F9E5B-0A58-4BAE-9AFE-856C8CBB8D36}.Debug|x86.ActiveCfg = Debug|Win32 - {B53F9E5B-0A58-4BAE-9AFE-856C8CBB8D36}.Debug|x86.Build.0 = Debug|Win32 - {B53F9E5B-0A58-4BAE-9AFE-856C8CBB8D36}.MinSizeRel|x64.ActiveCfg = Release|x64 - {B53F9E5B-0A58-4BAE-9AFE-856C8CBB8D36}.MinSizeRel|x64.Build.0 = Release|x64 - {B53F9E5B-0A58-4BAE-9AFE-856C8CBB8D36}.MinSizeRel|x86.ActiveCfg = Release|Win32 - {B53F9E5B-0A58-4BAE-9AFE-856C8CBB8D36}.MinSizeRel|x86.Build.0 = Release|Win32 - {B53F9E5B-0A58-4BAE-9AFE-856C8CBB8D36}.Release|x64.ActiveCfg = Release|x64 - {B53F9E5B-0A58-4BAE-9AFE-856C8CBB8D36}.Release|x64.Build.0 = Release|x64 - {B53F9E5B-0A58-4BAE-9AFE-856C8CBB8D36}.Release|x86.ActiveCfg = Release|Win32 - {B53F9E5B-0A58-4BAE-9AFE-856C8CBB8D36}.Release|x86.Build.0 = Release|Win32 - {B53F9E5B-0A58-4BAE-9AFE-856C8CBB8D36}.RelWithDebInfo|x64.ActiveCfg = Release|x64 - {B53F9E5B-0A58-4BAE-9AFE-856C8CBB8D36}.RelWithDebInfo|x64.Build.0 = Release|x64 - {B53F9E5B-0A58-4BAE-9AFE-856C8CBB8D36}.RelWithDebInfo|x86.ActiveCfg = Release|Win32 - {B53F9E5B-0A58-4BAE-9AFE-856C8CBB8D36}.RelWithDebInfo|x86.Build.0 = Release|Win32 - {65608EB0-1A47-45AD-AB66-192FB64C762C}.Debug|x64.ActiveCfg = Debug|x64 - {65608EB0-1A47-45AD-AB66-192FB64C762C}.Debug|x64.Build.0 = Debug|x64 - {65608EB0-1A47-45AD-AB66-192FB64C762C}.Debug|x86.ActiveCfg = Debug|Win32 - {65608EB0-1A47-45AD-AB66-192FB64C762C}.Debug|x86.Build.0 = Debug|Win32 - {65608EB0-1A47-45AD-AB66-192FB64C762C}.MinSizeRel|x64.ActiveCfg = Debug|x64 - {65608EB0-1A47-45AD-AB66-192FB64C762C}.MinSizeRel|x64.Build.0 = Debug|x64 - {65608EB0-1A47-45AD-AB66-192FB64C762C}.MinSizeRel|x86.ActiveCfg = Debug|Win32 - {65608EB0-1A47-45AD-AB66-192FB64C762C}.MinSizeRel|x86.Build.0 = Debug|Win32 - {65608EB0-1A47-45AD-AB66-192FB64C762C}.Release|x64.ActiveCfg = Release|x64 - {65608EB0-1A47-45AD-AB66-192FB64C762C}.Release|x64.Build.0 = Release|x64 - {65608EB0-1A47-45AD-AB66-192FB64C762C}.Release|x86.ActiveCfg = Release|Win32 - {65608EB0-1A47-45AD-AB66-192FB64C762C}.Release|x86.Build.0 = Release|Win32 - {65608EB0-1A47-45AD-AB66-192FB64C762C}.RelWithDebInfo|x64.ActiveCfg = Release|x64 - {65608EB0-1A47-45AD-AB66-192FB64C762C}.RelWithDebInfo|x64.Build.0 = Release|x64 - {65608EB0-1A47-45AD-AB66-192FB64C762C}.RelWithDebInfo|x86.ActiveCfg = Release|Win32 - {65608EB0-1A47-45AD-AB66-192FB64C762C}.RelWithDebInfo|x86.Build.0 = Release|Win32 - {A2E01C3E-D647-45D1-9788-043DEBC1A908}.Debug|x64.ActiveCfg = Debug|x64 - {A2E01C3E-D647-45D1-9788-043DEBC1A908}.Debug|x64.Build.0 = Debug|x64 - {A2E01C3E-D647-45D1-9788-043DEBC1A908}.Debug|x86.ActiveCfg = Debug|Win32 - {A2E01C3E-D647-45D1-9788-043DEBC1A908}.Debug|x86.Build.0 = Debug|Win32 - {A2E01C3E-D647-45D1-9788-043DEBC1A908}.MinSizeRel|x64.ActiveCfg = Debug|x64 - {A2E01C3E-D647-45D1-9788-043DEBC1A908}.MinSizeRel|x64.Build.0 = Debug|x64 - {A2E01C3E-D647-45D1-9788-043DEBC1A908}.MinSizeRel|x86.ActiveCfg = Debug|Win32 - {A2E01C3E-D647-45D1-9788-043DEBC1A908}.MinSizeRel|x86.Build.0 = Debug|Win32 - {A2E01C3E-D647-45D1-9788-043DEBC1A908}.Release|x64.ActiveCfg = Release|x64 - {A2E01C3E-D647-45D1-9788-043DEBC1A908}.Release|x64.Build.0 = Release|x64 - {A2E01C3E-D647-45D1-9788-043DEBC1A908}.Release|x86.ActiveCfg = Release|Win32 - {A2E01C3E-D647-45D1-9788-043DEBC1A908}.Release|x86.Build.0 = Release|Win32 - {A2E01C3E-D647-45D1-9788-043DEBC1A908}.RelWithDebInfo|x64.ActiveCfg = Release|x64 - {A2E01C3E-D647-45D1-9788-043DEBC1A908}.RelWithDebInfo|x64.Build.0 = Release|x64 - {A2E01C3E-D647-45D1-9788-043DEBC1A908}.RelWithDebInfo|x86.ActiveCfg = Release|Win32 - {A2E01C3E-D647-45D1-9788-043DEBC1A908}.RelWithDebInfo|x86.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {C2E1CC72-7A50-3249-AFD5-DFF6FE25CDCA} - EndGlobalSection - GlobalSection(Performance) = preSolution - HasPerformanceSessions = true - EndGlobalSection -EndGlobal diff --git a/ZAPDTR/ZAPDUtils/CMakeLists.txt b/ZAPDTR/ZAPDUtils/CMakeLists.txt new file mode 100644 index 000000000..68e83591e --- /dev/null +++ b/ZAPDTR/ZAPDUtils/CMakeLists.txt @@ -0,0 +1,218 @@ +set(PROJECT_NAME ZAPDUtils) + +################################################################################ +# Source groups +################################################################################ +set(Header_Files + "Color3b.h" + "StrHash.h" + "Vec2f.h" + "Vec3f.h" + "Vec3s.h" +) +source_group("Header Files" FILES ${Header_Files}) + +set(Header_Files__Utils + "Utils/BinaryReader.h" + "Utils/BinaryWriter.h" + "Utils/BitConverter.h" + "Utils/Directory.h" + "Utils/File.h" + "Utils/MemoryStream.h" + "Utils/Path.h" + "Utils/Stream.h" + "Utils/StringHelper.h" +) +source_group("Header Files\\Utils" FILES ${Header_Files__Utils}) + +set(Source_Files__Libraries + "../lib/tinyxml2/tinyxml2.cpp" +) +source_group("Source Files\\Libraries" FILES ${Source_Files__Libraries}) + +set(Source_Files__Utils + "Utils/BinaryReader.cpp" + "Utils/BinaryWriter.cpp" + "Utils/MemoryStream.cpp" + "Utils/StringHelper.cpp" +) +source_group("Source Files\\Utils" FILES ${Source_Files__Utils}) + +set(ALL_FILES + ${Header_Files} + ${Header_Files__Utils} + ${Source_Files__Libraries} + ${Source_Files__Utils} +) + +################################################################################ +# Target +################################################################################ +add_library(${PROJECT_NAME} STATIC ${ALL_FILES}) + +if (CMAKE_SYSTEM_NAME STREQUAL "Windows") +use_props(${PROJECT_NAME} "${CMAKE_CONFIGURATION_TYPES}" "${DEFAULT_CXX_PROPS}") +endif() + +set(ROOT_NAMESPACE ZAPDUtils) + +if (CMAKE_SYSTEM_NAME STREQUAL "Windows") + set_target_properties(${PROJECT_NAME} PROPERTIES + VS_GLOBAL_KEYWORD "Win32Proj" + ) + if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64") + set_target_properties(${PROJECT_NAME} PROPERTIES + INTERPROCEDURAL_OPTIMIZATION_RELEASE "TRUE" + ) + elseif("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "Win32") + set_target_properties(${PROJECT_NAME} PROPERTIES + INTERPROCEDURAL_OPTIMIZATION_RELEASE "TRUE" + ) + endif() +endif() +################################################################################ +# MSVC runtime library +################################################################################ +if (CMAKE_SYSTEM_NAME STREQUAL "Windows") + get_property(MSVC_RUNTIME_LIBRARY_DEFAULT TARGET ${PROJECT_NAME} PROPERTY MSVC_RUNTIME_LIBRARY) + if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64") + string(CONCAT "MSVC_RUNTIME_LIBRARY_STR" + $<$: + MultiThreadedDebug + > + $<$: + MultiThreaded + > + $<$,$>>:${MSVC_RUNTIME_LIBRARY_DEFAULT}> + ) + elseif("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "Win32") + string(CONCAT "MSVC_RUNTIME_LIBRARY_STR" + MultiThreaded + ) + endif() + set_target_properties(${PROJECT_NAME} PROPERTIES MSVC_RUNTIME_LIBRARY ${MSVC_RUNTIME_LIBRARY_STR}) +endif() +################################################################################ +# Compile definitions +################################################################################ +if (CMAKE_SYSTEM_NAME STREQUAL "Windows") + if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64") + target_compile_definitions(${PROJECT_NAME} PRIVATE + "$<$:" + "_DEBUG;" + "_MBCS" + ">" + "$<$:" + "NDEBUG;" + "UNICODE;" + "_UNICODE" + ">" + "_CONSOLE;" + "_CRT_SECURE_NO_WARNINGS" + STORMLIB_NO_AUTO_LINK + ) + elseif("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "Win32") + target_compile_definitions(${PROJECT_NAME} PRIVATE + "$<$:" + "_DEBUG" + ">" + "$<$:" + "NDEBUG" + ">" + "WIN32;" + "_CONSOLE;" + "_CRT_SECURE_NO_WARNINGS;" + "UNICODE;" + "_UNICODE" + STORMLIB_NO_AUTO_LINK + ) + endif() +endif() + +if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU|Clang|AppleClang") + target_compile_definitions(${PROJECT_NAME} PRIVATE + "$<$:" + "_DEBUG" + ">" + "$<$:" + "NDEBUG" + ">" + "_CONSOLE;" + "_CRT_SECURE_NO_WARNINGS;" + "UNICODE;" + "_UNICODE" + ) +endif() + +################################################################################ +# Compile and link options +################################################################################ +if(MSVC) + if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64") + target_compile_options(${PROJECT_NAME} PRIVATE + $<$: + /Oi; + /Gy + > + /permissive-; + /MP; + /sdl; + /W3; + ${DEFAULT_CXX_DEBUG_INFORMATION_FORMAT}; + ${DEFAULT_CXX_EXCEPTION_HANDLING} + ) + elseif("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "Win32") + target_compile_options(${PROJECT_NAME} PRIVATE + $<$: + /O2; + /Ot + > + $<$: + /Gy + > + /permissive-; + /MP; + /Oi; + /sdl; + /W3; + ${DEFAULT_CXX_DEBUG_INFORMATION_FORMAT}; + ${DEFAULT_CXX_EXCEPTION_HANDLING} + ) + endif() + if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64") + target_link_options(${PROJECT_NAME} PRIVATE + $<$: + /OPT:REF; + /OPT:ICF + > + /SUBSYSTEM:CONSOLE + ) + elseif("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "Win32") + target_link_options(${PROJECT_NAME} PRIVATE + $<$: + /OPT:REF; + /OPT:ICF + > + /SUBSYSTEM:CONSOLE + ) + endif() +endif() + +if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU|Clang|AppleClang") + target_compile_options(${PROJECT_NAME} PRIVATE + -Wall -Wextra -Wno-error + -Wno-unused-parameter + -Wno-unused-function + -Wno-unused-variable + -Wno-missing-field-initializers + -Wno-parentheses + -Wno-narrowing + $<$:-Wno-deprecated-enum-enum-conversion> + ) +endif() +################################################################################ +# Dependencies +################################################################################ +# Link with other targets. + + diff --git a/ZAPDTR/ZAPDUtils/Makefile b/ZAPDTR/ZAPDUtils/Makefile deleted file mode 100644 index b9c4e29ad..000000000 --- a/ZAPDTR/ZAPDUtils/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -# Only used for standalone compilation, usually inherits these from the main makefile -CXX ?= g++ -CXXFLAGS ?= -Wall -Wextra -O2 -g -std=c++17 - -SRC_DIRS := $(shell find . -type d -not -path "*build*") -CPP_FILES := $(foreach dir,$(SRC_DIRS),$(wildcard $(dir)/*.cpp)) -H_FILES := $(foreach dir,$(SRC_DIRS),$(wildcard $(dir)/*.h)) - -O_FILES := $(foreach f,$(CPP_FILES:.cpp=.o),build/$f) -LIB := ZAPDUtils.a - -# create build directories -$(shell mkdir -p $(foreach dir,$(SRC_DIRS),build/$(dir))) - -all: $(LIB) - -clean: - rm -rf build $(LIB) - -format: - clang-format-11 -i $(CPP_FILES) $(H_FILES) - -.PHONY: all clean format - -build/%.o: %.cpp - $(CXX) $(CXXFLAGS) $(OPTFLAGS) -c $(OUTPUT_OPTION) $< - -$(LIB): $(O_FILES) - $(AR) rcs $@ $^ diff --git a/ZAPDTR/ZAPDUtils/Makefile.switch b/ZAPDTR/ZAPDUtils/Makefile.switch deleted file mode 100644 index ed173c44f..000000000 --- a/ZAPDTR/ZAPDUtils/Makefile.switch +++ /dev/null @@ -1,171 +0,0 @@ -#--------------------------------------------------------------------------------- -.SUFFIXES: -#--------------------------------------------------------------------------------- - -ifeq ($(strip $(DEVKITPRO)),) -$(error "Please set DEVKITPRO in your environment. export DEVKITPRO=/devkitpro") -endif - -TOPDIR ?= $(CURDIR) -include $(DEVKITPRO)/libnx/switch_rules - -#--------------------------------------------------------------------------------- -# TARGET is the name of the output -# BUILD is the directory where object files & intermediate files will be placed -# SOURCES is a list of directories containing source code -# DATA is a list of directories containing data files -# INCLUDES is a list of directories containing header files -# ROMFS is the directory containing data to be added to RomFS, relative to the Makefile (Optional) -# -# NO_ICON: if set to anything, do not use icon. -# NO_NACP: if set to anything, no .nacp file is generated. -# APP_TITLE is the name of the app stored in the .nacp file (Optional) -# APP_AUTHOR is the author of the app stored in the .nacp file (Optional) -# APP_VERSION is the version of the app stored in the .nacp file (Optional) -# APP_TITLEID is the titleID of the app stored in the .nacp file (Optional) -# ICON is the filename of the icon (.jpg), relative to the project folder. -# If not set, it attempts to use one of the following (in this order): -# - .jpg -# - icon.jpg -# - /default_icon.jpg -# -# CONFIG_JSON is the filename of the NPDM config file (.json), relative to the project folder. -# If not set, it attempts to use one of the following (in this order): -# - .json -# - config.json -# If a JSON file is provided or autodetected, an ExeFS PFS0 (.nsp) is built instead -# of a homebrew executable (.nro). This is intended to be used for sysmodules. -# NACP building is skipped as well. -#--------------------------------------------------------------------------------- -TARGET := ZAPDUtils -BUILD := build -SOURCES := Utils -DATA := -INCLUDES := - -#------------------------------------------------------------------------------- -# source files -#------------------------------------------------------------------------------- -SOURCEFILES_C := - -SOURCEFILES_CPP := - -#--------------------------------------------------------------------------------- -# options for code generation -#--------------------------------------------------------------------------------- -ARCH := -march=armv8-a+crc+crypto -mtune=cortex-a57 -mtp=soft -fPIE - -CFLAGS := -g -Wall -O2 -ffunction-sections \ - $(ARCH) $(DEFINES) - -CFLAGS += $(INCLUDE) -D__SWITCH__ - -CXXFLAGS := $(CFLAGS) -fno-rtti -fexceptions -std=gnu++20 -CFLAGS += -std=gnu11 - -ASFLAGS := -g $(ARCH) -LDFLAGS = -specs=$(DEVKITPRO)/libnx/switch.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map) - -LIBS := -lnx - -#--------------------------------------------------------------------------------- -# list of directories containing libraries, this must be the top level containing -# include and lib -#--------------------------------------------------------------------------------- -LIBDIRS := $(PORTLIBS) $(LIBNX) - - -#--------------------------------------------------------------------------------- -# no real need to edit anything past this point unless you need to add additional -# rules for different file extensions -#--------------------------------------------------------------------------------- -ifneq ($(BUILD),$(notdir $(CURDIR))) -#--------------------------------------------------------------------------------- - -export OUTPUT := $(CURDIR)/lib/lib$(TARGET).a -export TOPDIR := $(CURDIR) - -export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \ - $(foreach dir,$(DATA),$(CURDIR)/$(dir)) \ - $(foreach sf,$(SOURCEFILES_C),$(CURDIR)/$(dir $(sf))) \ - $(foreach sf,$(SOURCEFILES_CPP),$(CURDIR)/$(dir $(sf))) - -export DEPSDIR := $(CURDIR)/$(BUILD) - -CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c))) \ - $(foreach f,$(SOURCEFILES_C),$(notdir $(f))) -CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp))) \ - $(foreach f,$(SOURCEFILES_CPP),$(notdir $(f))) -SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s))) -BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*))) - -#--------------------------------------------------------------------------------- -# use CXX for linking C++ projects, CC for standard C -#--------------------------------------------------------------------------------- -ifeq ($(strip $(CPPFILES)),) -#--------------------------------------------------------------------------------- - export LD := $(CC) -#--------------------------------------------------------------------------------- -else -#--------------------------------------------------------------------------------- - export LD := $(CXX) -#--------------------------------------------------------------------------------- -endif -#--------------------------------------------------------------------------------- - -export OFILES_BIN := $(addsuffix .o,$(BINFILES)) -export OFILES_SRC := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o) -export OFILES := $(OFILES_BIN) $(OFILES_SRC) -export HFILES_BIN := $(addsuffix .h,$(subst .,_,$(BINFILES))) - -export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \ - $(foreach dir,$(LIBDIRS),-I$(dir)/include) \ - -I$(CURDIR)/$(BUILD) - -export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) - -.PHONY: $(BUILD) clean all - -#--------------------------------------------------------------------------------- -all: $(BUILD) - -lib: - @[ -d $@ ] || mkdir -p $@ - -$(BUILD) : lib - @[ -d $@ ] || mkdir -p $@ - @$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile.switch - -#--------------------------------------------------------------------------------- -clean: - @echo clean ... - @rm -rf build lib - -#--------------------------------------------------------------------------------- -else -.PHONY: all - -DEPENDS := $(OFILES:.o=.d) - -#--------------------------------------------------------------------------------- -# main targets -#--------------------------------------------------------------------------------- - -$(OUTPUT) : $(OFILES) - -$(OFILES_SRC) : $(HFILES) -$(OFILES_SRC) : $(HFILES_BIN) - -#--------------------------------------------------------------------------------- -# you need a rule like this for each extension you use as binary data -#--------------------------------------------------------------------------------- -%.bin.o %_bin.h : %.bin -#--------------------------------------------------------------------------------- - @echo $(notdir $<) - @$(bin2o) - --include $(DEPENDS) - -#--------------------------------------------------------------------------------------- -endif -#--------------------------------------------------------------------------------------- \ No newline at end of file diff --git a/ZAPDTR/ZAPDUtils/Utils/Directory.h b/ZAPDTR/ZAPDUtils/Utils/Directory.h index 1ced139be..ea792d8da 100644 --- a/ZAPDTR/ZAPDUtils/Utils/Directory.h +++ b/ZAPDTR/ZAPDUtils/Utils/Directory.h @@ -1,8 +1,9 @@ #pragma once -#include #include #include +#include "StringHelper.h" +#include #if __has_include() #include @@ -12,8 +13,6 @@ namespace fs = std::filesystem; namespace fs = std::experimental::filesystem; #endif -#include "StringHelper.h" - #undef GetCurrentDirectory #undef CreateDirectory @@ -21,7 +20,7 @@ class Directory { public: #ifndef PATH_HACK - static std::string GetCurrentDirectory() { return fs::current_path().u8string().c_str(); } + static std::string GetCurrentDirectory() { return fs::current_path().string(); } #endif static bool Exists(const fs::path& path) { return fs::exists(path); } diff --git a/libultraship/Makefile b/libultraship/Makefile deleted file mode 100644 index 8369126f4..000000000 --- a/libultraship/Makefile +++ /dev/null @@ -1,149 +0,0 @@ -# Only used for standalone compilation, usually inherits these from the main makefile - -CXX ?= g++ -CC ?= gcc -AR := ar -FORMAT := clang-format-11 -UNAME := $(shell uname) - -ASAN ?= 0 -DEBUG ?= 1 -OPTFLAGS ?= -O0 -X11 ?= 0 -LTO ?= 0 - -# flag to save whether the compiler being used is clang or gcc by checking CXX --version -CXX_IS_CLANG ?= $(shell $(CXX) --version | grep -c clang) -ifeq ($(CXX_IS_CLANG),1) - MXX := $(CXX) -else - MXX ?= clang++ -endif - - -WARN := -Wall -Wextra -Werror \ - -Wno-unused-variable \ - -Wno-unused-parameter \ - -Wno-unused-function \ - -Wno-parentheses \ - -Wno-narrowing \ - -Wno-missing-field-initializers \ - -Wno-error=multichar \ - -Wno-delete-non-abstract-non-virtual-dtor \ - -Wno-unused-private-field \ - -Wno-deprecated-copy-with-user-provided-copy \ - -Wno-deprecated-declarations \ - -Wno-unknown-warning-option - -CWARN := -CXXWARN := -Wno-deprecated-enum-enum-conversion -Wno-deprecated-copy - -ifneq ($(CXX_IS_CLANG),1) - WARN += -Wno-error=stringop-overflow - CXXWARN += -Wno-error=maybe-uninitialized -endif - -CXXFLAGS := $(WARN) $(CXXWARN) -std=c++20 -D_GNU_SOURCE -DENABLE_OPENGL -DSPDLOG_ACTIVE_LEVEL=0 -CFLAGS := $(WARN) $(CWARN) -std=c99 -D_GNU_SOURCE -DENABLE_OPENGL -DSPDLOG_ACTIVE_LEVEL=0 -CPPFLAGS := -MMD $(shell pkg-config --cflags sdl2 glew) - -MMFLAGS := -Wno-deprecated-declarations -ObjC++ -fobjc-weak -fobjc-arc - -ifeq ($(X11), 1) -CXXFLAGS += -DX11_SUPPORTED -CFLAGS += -DX11_SUPPORTED -endif - -# if not using clang, ask clang to use gcc standard library -ifneq ($(CXX_IS_CLANG),1) - STD_ISYSTEM=$(shell ${CXX} -xc++ -E -v - < /dev/null 2>&1 | grep "> search starts here" -A2 | tail -n 2 | head -n 1) - CXX_ISYSTEM=$(shell ${CXX} -xc++ -E -v - < /dev/null 2>&1 | grep "> search starts here" -A2 | tail -n 2 | tail -n 1) - MMFLAGS += -stdlib++-isystem ${STD_ISYSTEM} -cxx-isystem ${CXX_ISYSTEM} -endif - -ifneq ($(DEBUG),0) - CXXFLAGS += -g -D_DEBUG - CFLAGS += -g -D_DEBUG -endif - -ifneq ($(ASAN),0) - CXXFLAGS += -fsanitize=address - CFLAGS += -fsanitize=address -endif - -ifneq ($(LTO),0) - CXXFLAGS += -flto - CFLAGS += -flto -endif - -SRC_DIRS := $(shell find . -type d -not -path "*build*") - -CXX_FILES := \ - $(shell find libultraship/Factories -name "*.cpp") \ - $(shell find libultraship/Lib/Fast3D -name "*.cpp") \ - $(shell find libultraship -maxdepth 1 -name "*.cpp") \ - $(shell find libultraship/Lib/ImGui -maxdepth 1 -name "*.cpp") \ - $(shell find libultraship/Lib/Mercury -maxdepth 1 -name "*.cpp") \ - libultraship/Lib/ImGui/backends/imgui_impl_opengl3.cpp \ - libultraship/Lib/ImGui/backends/imgui_impl_sdl.cpp \ - libultraship/Lib/StrHash64.cpp \ - libultraship/Lib/tinyxml2/tinyxml2.cpp - -C_FILES := \ - libultraship/mixer.c \ - libultraship/Lib/stb/stb_impl.c - -MM_FILES := \ - libultraship/OSXFolderManager.mm - -FMT_FILES := $(shell find libultraship/ -type f \( -name "*.cpp" -o -name "*.h" \) -a -not -path "libultraship/Lib/*") - -O_FILES := \ - $(CXX_FILES:%.cpp=build/%.o) \ - $(C_FILES:%.c=build/%.o) - -ifeq ($(UNAME), Darwin) #APPLE - O_FILES += $(MM_FILES:%.mm=build/%.o) -endif - -D_FILES := $(O_FILES:%.o=%.d) - -LIB := libultraship.a - -INC_DIRS := $(addprefix -I, \ - ../ZAPDTR/ZAPDUtils \ - libultraship/Lib/Fast3D/U64 \ - libultraship/Lib/spdlog \ - libultraship/Lib/spdlog/include \ - libultraship/Lib/ImGui \ - libultraship/Lib/Mercury \ - libultraship \ - ../StormLib/src \ -) - -# create build directories -$(shell mkdir -p $(SRC_DIRS:%=build/%)) - -all: $(LIB) - -clean: - rm -rf build $(LIB) - -format: - $(FORMAT) -i $(FMT_FILES) - -.PHONY: all clean format - -build/%.o: %.cpp - $(CXX) $(CXXFLAGS) $(CPPFLAGS) $(OPTFLAGS) $(INC_DIRS) -c $< -o $@ - -build/%.o: %.c - $(CC) $(CFLAGS) $(CPPFLAGS) $(OPTFLAGS) $(INC_DIRS) -c $< -o $@ - -build/%.o: %.mm - $(MXX) $(MMFLAGS) $(CXXFLAGS) $(OPTFLAGS) $(INC_DIRS) -c $< -o $@ - -$(LIB): $(O_FILES) - $(AR) rcs $@ $^ - --include $(D_FILES) diff --git a/libultraship/Makefile.switch b/libultraship/Makefile.switch deleted file mode 100644 index 72f0171aa..000000000 --- a/libultraship/Makefile.switch +++ /dev/null @@ -1,192 +0,0 @@ -#--------------------------------------------------------------------------------- -.SUFFIXES: -#--------------------------------------------------------------------------------- - -ifeq ($(strip $(DEVKITPRO)),) -$(error "Please set DEVKITPRO in your environment. export DEVKITPRO=/devkitpro") -endif - -TOPDIR ?= $(CURDIR) -include $(DEVKITPRO)/libnx/switch_rules - -#--------------------------------------------------------------------------------- -# TARGET is the name of the output -# BUILD is the directory where object files & intermediate files will be placed -# SOURCES is a list of directories containing source code -# DATA is a list of directories containing data files -# INCLUDES is a list of directories containing header files -# ROMFS is the directory containing data to be added to RomFS, relative to the Makefile (Optional) -# -# NO_ICON: if set to anything, do not use icon. -# NO_NACP: if set to anything, no .nacp file is generated. -# APP_TITLE is the name of the app stored in the .nacp file (Optional) -# APP_AUTHOR is the author of the app stored in the .nacp file (Optional) -# APP_VERSION is the version of the app stored in the .nacp file (Optional) -# APP_TITLEID is the titleID of the app stored in the .nacp file (Optional) -# ICON is the filename of the icon (.jpg), relative to the project folder. -# If not set, it attempts to use one of the following (in this order): -# - .jpg -# - icon.jpg -# - /default_icon.jpg -# -# CONFIG_JSON is the filename of the NPDM config file (.json), relative to the project folder. -# If not set, it attempts to use one of the following (in this order): -# - .json -# - config.json -# If a JSON file is provided or autodetected, an ExeFS PFS0 (.nsp) is built instead -# of a homebrew executable (.nro). This is intended to be used for sysmodules. -# NACP building is skipped as well. -#--------------------------------------------------------------------------------- -TARGET := ultraship -BUILD := build -SOURCES := \ - libultraship/Factories \ - libultraship/Lib/Fast3D \ - libultraship/Lib/ImGui \ - libultraship/Lib/Mercury \ - libultraship -DATA := -INCLUDES := \ - ../ZAPDTR/ZAPDUtils \ - ../StormLib/src \ - libultraship/Lib/Fast3D/U64 \ - libultraship/Lib/ImGui \ - libultraship/Lib/spdlog \ - libultraship/Lib/spdlog/include \ - libultraship - -#------------------------------------------------------------------------------- -# source files -#------------------------------------------------------------------------------- - -SOURCEFILES_C := \ - libultraship/mixer.c \ - libultraship/Lib/stb/stb_impl.c \ - -SOURCEFILES_CPP := \ - libultraship/Lib/ImGui/backends/imgui_impl_opengl3.cpp \ - libultraship/Lib/ImGui/backends/imgui_impl_sdl.cpp \ - libultraship/Lib/StrHash64.cpp \ - libultraship/Lib/tinyxml2/tinyxml2.cpp - -#--------------------------------------------------------------------------------- -# options for code generation -#--------------------------------------------------------------------------------- -ARCH := -march=armv8-a+crc+crypto -mtune=cortex-a57 -mtp=soft -fPIE -ffast-math -O3 - -CFLAGS := -Wall -ffunction-sections \ - $(ARCH) $(DEFINES) \ - -DSPDLOG_NO_THREAD_ID \ - -DSTBI_NO_THREAD_LOCALS - -CFLAGS += $(INCLUDE) -D__SWITCH__ -DENABLE_OPENGL - -CXXFLAGS := $(CFLAGS) -std=gnu++20 -CFLAGS += -std=gnu11 - -ASFLAGS := -g $(ARCH) -LDFLAGS = -specs=$(DEVKITPRO)/libnx/switch.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map) - -LIBS := -lnx - -#--------------------------------------------------------------------------------- -# list of directories containing libraries, this must be the top level containing -# include and lib -#--------------------------------------------------------------------------------- -LIBDIRS := $(PORTLIBS) $(LIBNX) - - -#--------------------------------------------------------------------------------- -# no real need to edit anything past this point unless you need to add additional -# rules for different file extensions -#--------------------------------------------------------------------------------- -ifneq ($(BUILD),$(notdir $(CURDIR))) -#--------------------------------------------------------------------------------- - -export OUTPUT := $(CURDIR)/lib/lib$(TARGET).a -export TOPDIR := $(CURDIR) - -export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \ - $(foreach dir,$(DATA),$(CURDIR)/$(dir)) \ - $(foreach sf,$(SOURCEFILES_C),$(CURDIR)/$(dir $(sf))) \ - $(foreach sf,$(SOURCEFILES_CPP),$(CURDIR)/$(dir $(sf))) - -export DEPSDIR := $(CURDIR)/$(BUILD) - -CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c))) \ - $(foreach f,$(SOURCEFILES_C),$(notdir $(f))) -CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp))) \ - $(foreach f,$(SOURCEFILES_CPP),$(notdir $(f))) -SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s))) -BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*))) - -#--------------------------------------------------------------------------------- -# use CXX for linking C++ projects, CC for standard C -#--------------------------------------------------------------------------------- -ifeq ($(strip $(CPPFILES)),) -#--------------------------------------------------------------------------------- - export LD := $(CC) -#--------------------------------------------------------------------------------- -else -#--------------------------------------------------------------------------------- - export LD := $(CXX) -#--------------------------------------------------------------------------------- -endif -#--------------------------------------------------------------------------------- - -export OFILES_BIN := $(addsuffix .o,$(BINFILES)) -export OFILES_SRC := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o) -export OFILES := $(OFILES_BIN) $(OFILES_SRC) -export HFILES_BIN := $(addsuffix .h,$(subst .,_,$(BINFILES))) - -export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \ - $(foreach dir,$(LIBDIRS),-I$(dir)/include) \ - -I$(CURDIR)/$(BUILD) - -export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) - -.PHONY: $(BUILD) clean all - -#--------------------------------------------------------------------------------- -all: $(BUILD) - -lib: - @[ -d $@ ] || mkdir -p $@ - -$(BUILD) : lib - @[ -d $@ ] || mkdir -p $@ - @$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile.switch - -#--------------------------------------------------------------------------------- -clean: - @echo clean ... - @rm -rf build lib - -#--------------------------------------------------------------------------------- -else -.PHONY: all - -DEPENDS := $(OFILES:.o=.d) - -#--------------------------------------------------------------------------------- -# main targets -#--------------------------------------------------------------------------------- - -$(OUTPUT) : $(OFILES) - -$(OFILES_SRC) : $(HFILES) -$(OFILES_SRC) : $(HFILES_BIN) - -#--------------------------------------------------------------------------------- -# you need a rule like this for each extension you use as binary data -#--------------------------------------------------------------------------------- -%.bin.o %_bin.h : %.bin -#--------------------------------------------------------------------------------- - @echo $(notdir $<) - @$(bin2o) - --include $(DEPENDS) - -#--------------------------------------------------------------------------------------- -endif -#--------------------------------------------------------------------------------------- \ No newline at end of file diff --git a/libultraship/libultraship.sln b/libultraship/libultraship.sln deleted file mode 100644 index b0adce9b9..000000000 --- a/libultraship/libultraship.sln +++ /dev/null @@ -1,64 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.30320.27 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libultraship", "libultraship\libultraship.vcxproj", "{6DA9B521-65B7-41E2-8F8A-F0451CC18ED8}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestApp", "TestApp\TestApp.vcxproj", "{3C4A8151-48D1-4518-BE1A-24016A5B800F}" - ProjectSection(ProjectDependencies) = postProject - {6DA9B521-65B7-41E2-8F8A-F0451CC18ED8} = {6DA9B521-65B7-41E2-8F8A-F0451CC18ED8} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ZAPD", "..\ZAPDTR\ZAPD\ZAPD.vcxproj", "{B53F9E5B-0A58-4BAE-9AFE-856C8CBB8D36}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ZAPDUtils", "..\ZAPDTR\ZAPDUtils\ZAPDUtils.vcxproj", "{A2E01C3E-D647-45D1-9788-043DEBC1A908}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|x64 = Debug|x64 - Debug|x86 = Debug|x86 - Release|x64 = Release|x64 - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {6DA9B521-65B7-41E2-8F8A-F0451CC18ED8}.Debug|x64.ActiveCfg = Debug|x64 - {6DA9B521-65B7-41E2-8F8A-F0451CC18ED8}.Debug|x64.Build.0 = Debug|x64 - {6DA9B521-65B7-41E2-8F8A-F0451CC18ED8}.Debug|x86.ActiveCfg = Debug|Win32 - {6DA9B521-65B7-41E2-8F8A-F0451CC18ED8}.Debug|x86.Build.0 = Debug|Win32 - {6DA9B521-65B7-41E2-8F8A-F0451CC18ED8}.Release|x64.ActiveCfg = Release|x64 - {6DA9B521-65B7-41E2-8F8A-F0451CC18ED8}.Release|x64.Build.0 = Release|x64 - {6DA9B521-65B7-41E2-8F8A-F0451CC18ED8}.Release|x86.ActiveCfg = Release|Win32 - {6DA9B521-65B7-41E2-8F8A-F0451CC18ED8}.Release|x86.Build.0 = Release|Win32 - {3C4A8151-48D1-4518-BE1A-24016A5B800F}.Debug|x64.ActiveCfg = Debug|x64 - {3C4A8151-48D1-4518-BE1A-24016A5B800F}.Debug|x64.Build.0 = Debug|x64 - {3C4A8151-48D1-4518-BE1A-24016A5B800F}.Debug|x86.ActiveCfg = Debug|Win32 - {3C4A8151-48D1-4518-BE1A-24016A5B800F}.Debug|x86.Build.0 = Debug|Win32 - {3C4A8151-48D1-4518-BE1A-24016A5B800F}.Release|x64.ActiveCfg = Release|x64 - {3C4A8151-48D1-4518-BE1A-24016A5B800F}.Release|x64.Build.0 = Release|x64 - {3C4A8151-48D1-4518-BE1A-24016A5B800F}.Release|x86.ActiveCfg = Release|Win32 - {3C4A8151-48D1-4518-BE1A-24016A5B800F}.Release|x86.Build.0 = Release|Win32 - {B53F9E5B-0A58-4BAE-9AFE-856C8CBB8D36}.Debug|x64.ActiveCfg = Debug|x64 - {B53F9E5B-0A58-4BAE-9AFE-856C8CBB8D36}.Debug|x64.Build.0 = Debug|x64 - {B53F9E5B-0A58-4BAE-9AFE-856C8CBB8D36}.Debug|x86.ActiveCfg = Debug|Win32 - {B53F9E5B-0A58-4BAE-9AFE-856C8CBB8D36}.Debug|x86.Build.0 = Debug|Win32 - {B53F9E5B-0A58-4BAE-9AFE-856C8CBB8D36}.Release|x64.ActiveCfg = Release|x64 - {B53F9E5B-0A58-4BAE-9AFE-856C8CBB8D36}.Release|x64.Build.0 = Release|x64 - {B53F9E5B-0A58-4BAE-9AFE-856C8CBB8D36}.Release|x86.ActiveCfg = Release|Win32 - {B53F9E5B-0A58-4BAE-9AFE-856C8CBB8D36}.Release|x86.Build.0 = Release|Win32 - {A2E01C3E-D647-45D1-9788-043DEBC1A908}.Debug|x64.ActiveCfg = Debug|x64 - {A2E01C3E-D647-45D1-9788-043DEBC1A908}.Debug|x64.Build.0 = Debug|x64 - {A2E01C3E-D647-45D1-9788-043DEBC1A908}.Debug|x86.ActiveCfg = Debug|Win32 - {A2E01C3E-D647-45D1-9788-043DEBC1A908}.Debug|x86.Build.0 = Debug|Win32 - {A2E01C3E-D647-45D1-9788-043DEBC1A908}.Release|x64.ActiveCfg = Release|x64 - {A2E01C3E-D647-45D1-9788-043DEBC1A908}.Release|x64.Build.0 = Release|x64 - {A2E01C3E-D647-45D1-9788-043DEBC1A908}.Release|x86.ActiveCfg = Release|Win32 - {A2E01C3E-D647-45D1-9788-043DEBC1A908}.Release|x86.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {DCE19FF1-37C0-49CD-915A-DD695E15F00B} - EndGlobalSection -EndGlobal diff --git a/libultraship/libultraship/AudioPlayer.h b/libultraship/libultraship/AudioPlayer.h index 346239624..863cac875 100644 --- a/libultraship/libultraship/AudioPlayer.h +++ b/libultraship/libultraship/AudioPlayer.h @@ -14,3 +14,11 @@ namespace Ship { constexpr int GetSampleRate() const { return 44100; } }; } + +#ifdef _WIN32 +#include "WasapiAudioPlayer.h" +#elif defined(__linux) +#include "PulseAudioPlayer.h" +#else +#include "SDLAudioPlayer.h" +#endif diff --git a/libultraship/libultraship/CMakeLists.txt b/libultraship/libultraship/CMakeLists.txt new file mode 100644 index 000000000..78331cbaf --- /dev/null +++ b/libultraship/libultraship/CMakeLists.txt @@ -0,0 +1,656 @@ +set(PROJECT_NAME libultraship) + +if (CMAKE_SYSTEM_NAME STREQUAL "Darwin") + enable_language(OBJCXX) + #set(CMAKE_OBJCXX_FLAGS "-Wno-deprecated-declarations -ObjC++") +endif() + +################################################################################ +# Source groups +################################################################################ +set(Header_Files__Resources__Factories + "Factories/AnimationFactory.h" + "Factories/ArrayFactory.h" + "Factories/AudioFactory.h" + "Factories/BlobFactory.h" + "Factories/CollisionHeaderFactory.h" + "Factories/CutsceneFactory.h" + "Factories/DisplayListFactory.h" + "Factories/MaterialFactory.h" + "Factories/MtxFactory.h" + "Factories/PathFactory.h" + "Factories/PlayerAnimationFactory.h" + "Factories/ResourceLoader.h" + "Factories/SceneFactory.h" + "Factories/SkeletonFactory.h" + "Factories/SkeletonLimbFactory.h" + "Factories/TextFactory.h" + "Factories/TextureFactory.h" + "Factories/VtxFactory.h" +) +source_group("Header Files\\Resources\\Factories" FILES ${Header_Files__Resources__Factories}) + +set(Header_Files__Resources__Files + "Animation.h" + "Array.h" + "Audio.h" + "Blob.h" + "CollisionHeader.h" + "Cutscene.h" + "DisplayList.h" + "Material.h" + "Matrix.h" + "Model.h" + "Path.h" + "PlayerAnimation.h" + "Scene.h" + "Skeleton.h" + "SkeletonLimb.h" + "Text.h" + "Texture.h" + "Vertex.h" +) +source_group("Header Files\\Resources\\Files" FILES ${Header_Files__Resources__Files}) + +set(Source_Files__Audio + "abi.h" + "AudioPlayer.h" + "mixer.c" + "mixer.h" + "SDLAudioPlayer.cpp" + "SDLAudioPlayer.h" +) + +if (CMAKE_SYSTEM_NAME STREQUAL "Windows") +set(Source_Files__Audio__extra + "WasapiAudioPlayer.cpp" + "WasapiAudioPlayer.h" +) +else() +set(Source_Files__Audio__extra + "PulseAudioPlayer.cpp" + "PulseAudioPlayer.h" +) +endif () + +source_group("Source Files\\Audio" FILES ${Source_Files__Audio} ${Source_Files__Audio__extra}) + +set(Source_Files__Controller + "ControlDeck.cpp" + "ControlDeck.h" + "Controller.cpp" + "Controller.h" + "ControllerAttachment.cpp" + "ControllerAttachment.h" + "InputEditor.cpp" + "InputEditor.h" + "KeyboardController.cpp" + "KeyboardController.h" + "SDLController.cpp" + "SDLController.h" + "UltraController.h" + "VirtualController.h" +) +source_group("Source Files\\Controller" FILES ${Source_Files__Controller}) + +set(Source_Files__Controller__Attachment + "ControllerAttachment.cpp" + "ControllerAttachment.h" + "MemoryPack.cpp" + "MemoryPack.h" + "RumblePack.cpp" + "RumblePack.h" +) +source_group("Source Files\\Controller\\Attachment" FILES ${Source_Files__Controller__Attachment}) + +set(Source_Files__CustomImpl + "GameOverlay.cpp" + "GameOverlay.h" + "Console.cpp" + "Console.h" + "ImGuiImpl.cpp" + "ImGuiImpl.h" +) +source_group("Source Files\\CustomImpl" FILES ${Source_Files__CustomImpl}) + +set(Source_Files__CustomImpl__Hooks + "Hooks.h" +) +source_group("Source Files\\CustomImpl\\Hooks" FILES ${Source_Files__CustomImpl__Hooks}) + +set(Source_Files__CustomImpl__Utils + "Utils.cpp" + "Utils.h" +) +source_group("Source Files\\CustomImpl\\Utils" FILES ${Source_Files__CustomImpl__Utils}) + +set(Source_Files__Globals + "Cvar.cpp" + "Cvar.h" + "GlobalCtx2.cpp" + "GlobalCtx2.h" + "LUSMacros.h" + "Window.cpp" + "Window.h" + "WindowShim.cpp" + "WindowShim.h" +) +source_group("Source Files\\Globals" FILES ${Source_Files__Globals}) + +set(Source_Files__Lib + "Lib/mINI/src/mini/ini.h" + "Lib/StrHash64.cpp" + "Lib/StrHash64.h" + "Lib/tinyxml2/tinyxml2.cpp" + "stox.cpp" + "stox.h" +) +source_group("Source Files\\Lib" FILES ${Source_Files__Lib}) + +set(Source_Files__Lib__Fast3D + "Lib/Fast3D/gfx_cc.cpp" + "Lib/Fast3D/gfx_cc.h" + "Lib/Fast3D/gfx_opengl.cpp" + "Lib/Fast3D/gfx_opengl.h" + "Lib/Fast3D/gfx_pc.cpp" + "Lib/Fast3D/gfx_pc.h" + "Lib/Fast3D/gfx_rendering_api.h" + "Lib/Fast3D/gfx_screen_config.h" + "Lib/Fast3D/gfx_sdl.h" + "Lib/Fast3D/gfx_sdl2.cpp" + "Lib/Fast3D/gfx_window_manager_api.h" +) +source_group("Source Files\\Lib\\Fast3D" FILES ${Source_Files__Lib__Fast3D}) + +if (CMAKE_SYSTEM_NAME STREQUAL "Windows") +set(Source_Files__Lib__Fast3D__extra + "Lib/Fast3D/gfx_direct3d11.cpp" + "Lib/Fast3D/gfx_direct3d11.h" + "Lib/Fast3D/gfx_direct3d12.cpp" + "Lib/Fast3D/gfx_direct3d12.h" + "Lib/Fast3D/gfx_direct3d12_guids.h" + "Lib/Fast3D/gfx_direct3d_common.cpp" + "Lib/Fast3D/gfx_direct3d_common.h" + "Lib/Fast3D/gfx_dxgi.cpp" + "Lib/Fast3D/gfx_dxgi.h" +) +elseif (CMAKE_SYSTEM_NAME STREQUAL "Linux") +set(Source_Files__Lib__Fast3D__extra + "Lib/Fast3D/gfx_glx.cpp" + "Lib/Fast3D/gfx_glx.h" +) +endif() +source_group("Source Files\\Lib\\Fast3D\\extra" FILES ${Source_Files__Lib__Fast3D__extra}) + +set(Source_Files__Lib__ImGui + "Lib/ImGui/backends/imgui_impl_opengl3.cpp" + "Lib/ImGui/backends/imgui_impl_opengl3.h" + "Lib/ImGui/backends/imgui_impl_sdl.cpp" + "Lib/ImGui/backends/imgui_impl_sdl.h" + "Lib/ImGui/imconfig.h" + "Lib/ImGui/imgui.cpp" + "Lib/ImGui/imgui.h" + "Lib/ImGui/imgui_demo.cpp" + "Lib/ImGui/imgui_draw.cpp" + "Lib/ImGui/imgui_internal.h" + "Lib/ImGui/imgui_tables.cpp" + "Lib/ImGui/imgui_widgets.cpp" + "Lib/ImGui/imstb_rectpack.h" + "Lib/ImGui/imstb_textedit.h" + "Lib/ImGui/imstb_truetype.h" +) +if (CMAKE_SYSTEM_NAME STREQUAL "Windows") +set(Source_Files__Lib__ImGui__Windows + "Lib/ImGui/backends/imgui_impl_dx11.cpp" + "Lib/ImGui/backends/imgui_impl_dx11.h" + "Lib/ImGui/backends/imgui_impl_win32.cpp" + "Lib/ImGui/backends/imgui_impl_win32.h" +) +endif () +source_group("Source Files\\Lib\\ImGui" FILES ${Source_Files__Lib__ImGui} ${Source_Files__Lib__ImGui__Windows}) + +set(Source_Files__Lib__Mercury + "Lib/Mercury/Mercury.cpp" + "Lib/Mercury/Mercury.h" +) +source_group("Source Files\\Lib\\Mercury" FILES ${Source_Files__Lib__Mercury}) + +set(Source_Files__Lib__stb + "Lib/stb/stb_image.h" + "Lib/stb/stb_image_write.h" + "Lib/stb/stb_impl.c" +) +source_group("Source Files\\Lib\\stb" FILES ${Source_Files__Lib__stb}) + +set(Source_Files__Lib__dr_libs + "Lib/dr_libs/mp3.h" + "Lib/dr_libs/wav.h" +) +source_group("Source Files\\Lib\\dr_libs" FILES ${Source_Files__Lib__dr_libs}) + +set(Source_Files__Lib__tinyxml2 + "Lib/tinyxml2/tinyxml2.h" +) +source_group("Source Files\\Lib\\tinyxml2" FILES ${Source_Files__Lib__tinyxml2}) + +set(Source_Files__Logging + "luslog.cpp" + "luslog.h" +) +source_group("Source Files\\Logging" FILES ${Source_Files__Logging}) + +set(Source_Files__Resources + "GameVersions.h" + "Resource.cpp" + "Resource.h" + "ResourceMgr.cpp" + "ResourceMgr.h" +) +source_group("Source Files\\Resources" FILES ${Source_Files__Resources}) + +set(Source_Files__Resources__Factories + "Factories/AnimationFactory.cpp" + "Factories/ArrayFactory.cpp" + "Factories/AudioFactory.cpp" + "Factories/BlobFactory.cpp" + "Factories/CollisionHeaderFactory.cpp" + "Factories/CutsceneFactory.cpp" + "Factories/DisplayListFactory.cpp" + "Factories/MaterialFactory.cpp" + "Factories/MtxFactory.cpp" + "Factories/PathFactory.cpp" + "Factories/PlayerAnimationFactory.cpp" + "Factories/ResourceLoader.cpp" + "Factories/SceneFactory.cpp" + "Factories/SkeletonFactory.cpp" + "Factories/SkeletonLimbFactory.cpp" + "Factories/TextFactory.cpp" + "Factories/TextureFactory.cpp" + "Factories/VtxFactory.cpp" +) +source_group("Source Files\\Resources\\Factories" FILES ${Source_Files__Resources__Factories}) + +set(Source_Files__Resources__Files + "Animation.cpp" + "Array.cpp" + "Audio.cpp" + "Blob.cpp" + "CollisionHeader.cpp" + "Cutscene.cpp" + "DisplayList.cpp" + "Material.cpp" + "Matrix.cpp" + "Model.cpp" + "Path.cpp" + "PlayerAnimation.cpp" + "Scene.cpp" + "Skeleton.cpp" + "SkeletonLimb.cpp" + "Text.cpp" + "Texture.cpp" + "Vertex.cpp" +) +source_group("Source Files\\Resources\\Files" FILES ${Source_Files__Resources__Files}) + +set(Source_Files__Resources__mpq + "Archive.cpp" + "Archive.h" + "File.cpp" + "File.h" +) +source_group("Source Files\\Resources\\mpq" FILES ${Source_Files__Resources__mpq}) + +if (CMAKE_SYSTEM_NAME STREQUAL "Darwin") +set(Source_Files__Darwin + "OSXFolderManager.mm" + "OSXFolderManager.h" +) +source_group("Source Files\\Darwin" FILES ${Source_Files__Darwin}) +endif() + +if (CMAKE_SYSTEM_NAME STREQUAL "NintendoSwitch") +set(Source_Files__NintendoSwitch + "SwitchImpl.cpp" + "SwitchImpl.h" +) +source_group("Source Files\\NintendoSwitch" FILES ${Source_Files__NintendoSwitch}) +endif() + +set(ALL_FILES + ${Header_Files__Resources__Factories} + ${Header_Files__Resources__Files} + ${Source_Files__Audio} + ${Source_Files__Audio__extra} + ${Source_Files__Controller} + ${Source_Files__Controller__Attachment} + ${Source_Files__CustomImpl} + ${Source_Files__CustomImpl__Hooks} + ${Source_Files__CustomImpl__Utils} + ${Source_Files__Globals} + ${Source_Files__Lib} + ${Source_Files__Lib__Fast3D} + ${Source_Files__Lib__Fast3D__extra} + ${Source_Files__Lib__ImGui} + ${Source_Files__Lib__ImGui__Windows} + ${Source_Files__Lib__Mercury} + ${Source_Files__Lib__stb} + ${Source_Files__Lib__dr_libs} + ${Source_Files__Lib__tinyxml2} + ${Source_Files__Logging} + ${Source_Files__Resources} + ${Source_Files__Resources__Factories} + ${Source_Files__Resources__Files} + ${Source_Files__Resources__mpq} + ${Source_Files__Darwin} + ${Source_Files__NintendoSwitch} +) + +################################################################################ +# Target +################################################################################ +add_library(${PROJECT_NAME} STATIC ${ALL_FILES}) + +if (NOT TARGET storm) + add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../../StormLib ${CMAKE_BINARY_DIR}/StormLib EXCLUDE_FROM_ALL) +endif() + +if (CMAKE_SYSTEM_NAME STREQUAL "Windows") +use_props(${PROJECT_NAME} "${CMAKE_CONFIGURATION_TYPES}" "${DEFAULT_CXX_PROPS}") +endif() + +set(ROOT_NAMESPACE libultraship) + +if (CMAKE_SYSTEM_NAME STREQUAL "Windows") + set_target_properties(${PROJECT_NAME} PROPERTIES + VS_GLOBAL_KEYWORD "Win32Proj" + ) + if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64") + set_target_properties(${PROJECT_NAME} PROPERTIES + INTERPROCEDURAL_OPTIMIZATION_RELEASE "TRUE" + ) + elseif("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "Win32") + set_target_properties(${PROJECT_NAME} PROPERTIES + INTERPROCEDURAL_OPTIMIZATION_RELEASE "TRUE" + ) + endif() +endif() +################################################################################ +# MSVC runtime library +################################################################################ +if (CMAKE_SYSTEM_NAME STREQUAL "Windows") + get_property(MSVC_RUNTIME_LIBRARY_DEFAULT TARGET ${PROJECT_NAME} PROPERTY MSVC_RUNTIME_LIBRARY) + if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64") + string(CONCAT "MSVC_RUNTIME_LIBRARY_STR" + $<$: + MultiThreadedDebug + > + $<$: + MultiThreaded + > + $<$,$>>:${MSVC_RUNTIME_LIBRARY_DEFAULT}> + ) + elseif("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "Win32") + string(CONCAT "MSVC_RUNTIME_LIBRARY_STR" + $<$: + MultiThreadedDebug + > + $<$: + MultiThreaded + > + $<$,$>>:${MSVC_RUNTIME_LIBRARY_DEFAULT}> + ) + endif() + set_target_properties(${PROJECT_NAME} PROPERTIES MSVC_RUNTIME_LIBRARY ${MSVC_RUNTIME_LIBRARY_STR}) +endif() +################################################################################ +# Compile definitions +################################################################################ +if (CMAKE_SYSTEM_NAME STREQUAL "Windows") + if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64") + target_compile_definitions(${PROJECT_NAME} PRIVATE + "$<$:" + "_DEBUG" + ">" + "$<$:" + "NDEBUG" + ">" + "SPDLOG_ACTIVE_LEVEL=0;" + "WIN32;" + "_CONSOLE;" + "_CRT_SECURE_NO_WARNINGS;" + "ENABLE_DX11;" + "ENABLE_OPENGL;" + "%(PreprocessorDefinitions)GLEW_STATIC;" + "UNICODE;" + "_UNICODE" + STORMLIB_NO_AUTO_LINK + ) + elseif("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "Win32") + target_compile_definitions(${PROJECT_NAME} PRIVATE + "$<$:" + "_DEBUG" + ">" + "$<$:" + "NDEBUG" + ">" + "SPDLOG_ACTIVE_LEVEL=0;" + "WIN32;" + "_CONSOLE;" + "_CRT_SECURE_NO_WARNINGS;" + "ENABLE_OPENGL;" + "ENABLE_DX11;" + "%(PreprocessorDefinitions)GLEW_STATIC;" + "UNICODE;" + "_UNICODE" + STORMLIB_NO_AUTO_LINK + ) + endif() +endif() + +if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU|Clang|AppleClang") + target_compile_definitions(${PROJECT_NAME} PRIVATE + "$<$:" + "_DEBUG" + ">" + "$<$:" + "NDEBUG" + ">" + "ENABLE_OPENGL;" + "SPDLOG_ACTIVE_LEVEL=0;" + ) +endif() +################################################################################ +# Compile and link options +################################################################################ +if (NOT CMAKE_SYSTEM_NAME MATCHES "Windows|NintendoSwitch") + find_package(SDL2) + find_package(GLEW) + find_package(X11) + if (NOT GLEW_FOUND) + if (NOT CMAKE_SYSTEM_NAME MATCHES "Windows|Darwin") + include (FetchContent) + FetchContent_Declare( + glew + GIT_REPOSITORY https://github.com/Perlmint/glew-cmake.git + SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../external/glew + ) + FetchContent_MakeAvailable(glew) + add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../../external/glew/build/cmake ${CMAKE_BINARY_DIR}/glew EXCLUDE_FROM_ALL) + endif() + endif() + + if (NOT GLEW_FOUND) + set(GLEW-INCLUDE ${CMAKE_CURRENT_SOURCE_DIR}/../../external/glew/include) + else() + set(GLEW-INCLUDE ${GLEW_INCLUDE_DIRS}) + endif() + set(SDL2-INCLUDE ${SDL2_INCLUDE_DIRS}) +elseif (CMAKE_SYSTEM_NAME MATCHES "NintendoSwitch") + find_package(SDL2) +else() + set(GLEW-INCLUDE ${CMAKE_CURRENT_SOURCE_DIR}/Lib/GLEW/) + set(SDL2-INCLUDE ${CMAKE_CURRENT_SOURCE_DIR}/Lib/SDL/) +endif() + +target_include_directories(${PROJECT_NAME} PRIVATE + ${CMAKE_CURRENT_SOURCE_DIR}/Lib/spdlog/include/ + ${CMAKE_CURRENT_SOURCE_DIR}/Lib/Fast3D/U64/ + ${CMAKE_CURRENT_SOURCE_DIR}/Lib/Fast3D/U64/PR + ${SDL2-INCLUDE} + ${GLEW-INCLUDE} + ${SWITCH-INCLUDE} + ${CMAKE_CURRENT_SOURCE_DIR}/Lib/ImGui/ + ${CMAKE_CURRENT_SOURCE_DIR}/../../ZAPDTR/ZAPDUtils + ${CMAKE_CURRENT_SOURCE_DIR}/../../StormLib/src + . + ) + +if(MSVC) + if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64") + target_compile_options(${PROJECT_NAME} PRIVATE + $<$: + /std:c++latest; + /Oi; + /Gy + > + /permissive-; + /MP; + /sdl; + /W3; + ${DEFAULT_CXX_DEBUG_INFORMATION_FORMAT}; + ${DEFAULT_CXX_EXCEPTION_HANDLING} + ) + elseif("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "Win32") + target_compile_options(${PROJECT_NAME} PRIVATE + $<$: + /Od; + /Oi-; + /W2 + > + $<$: + /Oi; + /Gy; + /W3 + > + /permissive-; + /MP; + /sdl; + ${DEFAULT_CXX_DEBUG_INFORMATION_FORMAT}; + ${DEFAULT_CXX_EXCEPTION_HANDLING} + ) + endif() + if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64") + target_link_options(${PROJECT_NAME} PRIVATE + $<$: + /OPT:REF; + /OPT:ICF + > + /SUBSYSTEM:CONSOLE + ) + elseif("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "Win32") + target_link_options(${PROJECT_NAME} PRIVATE + $<$: + /OPT:REF; + /OPT:ICF + > + /SUBSYSTEM:CONSOLE + ) + endif() +endif() + +if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") + target_compile_options(${PROJECT_NAME} PRIVATE + -Wall + -Wextra + -Wno-error + -Wno-unused-variable + -Wno-unused-parameter + -Wno-unused-function + -Wno-parentheses + -Wno-narrowing + -Wno-missing-field-initializers + ) +endif() +################################################################################ +# Dependencies +################################################################################ +# Link with other targets. + +find_package(OpenGL QUIET) + +if (CMAKE_SYSTEM_NAME STREQUAL "Linux") + find_package(X11) + find_package(PulseAudio) +endif() + +if (NOT GLEW_FOUND) + set(GLEW-LIB glew_s) +else() + set(GLEW-LIB GLEW::GLEW) +endif() + +if (CMAKE_SYSTEM_NAME STREQUAL "Windows") + if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64") + target_link_libraries(${PROJECT_NAME} + "glew32s;" + "opengl32;" + "storm;" + ) + elseif("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "Win32") + target_link_libraries(${PROJECT_NAME} + "glew32s;" + "opengl32;" + "storm;" + ) + endif() +elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin") + find_package(SDL2) + find_package(GLEW) + find_package(OpenGL QUIET) + find_Library(OSX_FOUNDATION Foundation) + set(THREADS_PREFER_PTHREAD_FLAG ON) + find_package(Threads REQUIRED) + target_link_libraries(${PROJECT_NAME} + "storm;" + SDL2::SDL2 + GLEW::GLEW + ${OPENGL_opengl_LIBRARY} + ${CMAKE_DL_LIBS} + Threads::Threads + ${OSX_FOUNDATION} + ) +elseif(CMAKE_SYSTEM_NAME STREQUAL "NintendoSwitch") + set(THREADS_PREFER_PTHREAD_FLAG ON) + find_package(Threads REQUIRED) + target_link_libraries(${PROJECT_NAME} + storm + SDL2::SDL2 + Threads::Threads + ) +else() + target_link_libraries(${PROJECT_NAME} + SDL2::SDL2 + ${PULSEAUDIO_LIBRARY} + ${GLEW-LIB} + ${OPENGL_glx_LIBRARY} + ${OPENGL_opengl_LIBRARY} + ${X11_LIBRARIES} + storm + ) +endif() + +if (CMAKE_SYSTEM_NAME STREQUAL "Windows") + if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64") + add_library(glew32s STATIC IMPORTED ) + set_property(TARGET glew32s PROPERTY + IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/Lib/GLEW/x64/glew32s.lib ) + set_property(TARGET glew32s PROPERTY + IMPORTED_IMPLIB ${CMAKE_CURRENT_SOURCE_DIR}/Lib/GLEW/x64/glew32s.lib) + elseif("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "Win32") + add_library(glew32s STATIC IMPORTED ) + set_property(TARGET glew32s PROPERTY + IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/Lib/GLEW/x86/glew32s.lib ) + set_property(TARGET glew32s PROPERTY + IMPORTED_IMPLIB ${CMAKE_CURRENT_SOURCE_DIR}/Lib/GLEW/x86/glew32s.lib) + endif() +endif() diff --git a/libultraship/libultraship/Console.cpp b/libultraship/libultraship/Console.cpp index 85ba1f78d..b7158bd3b 100644 --- a/libultraship/libultraship/Console.cpp +++ b/libultraship/libultraship/Console.cpp @@ -10,115 +10,116 @@ #include "Utils/StringHelper.h" #include "Lib/ImGui/imgui_internal.h" -std::map Bindings; -std::map BindingToggle; +namespace Ship { + std::map Bindings; + std::map BindingToggle; -static bool HelpCommand(const std::vector&) { - INFO("SoH Commands:"); - for(const auto& cmd : SohImGui::console->Commands) { - INFO("%s", (" - " + cmd.first).c_str()); + static bool HelpCommand(const std::vector&) { + INFO("SoH Commands:"); + for (const auto& cmd : SohImGui::console->Commands) { + INFO("%s", (" - " + cmd.first).c_str()); + } + return CMD_SUCCESS; } - return CMD_SUCCESS; -} -static bool ClearCommand(const std::vector&) { - SohImGui::console->Log[SohImGui::console->selected_channel].clear(); - return CMD_SUCCESS; -} + static bool ClearCommand(const std::vector&) { + SohImGui::console->Log[SohImGui::console->selected_channel].clear(); + return CMD_SUCCESS; + } -std::string toLowerCase(std::string in) { - std::string cpy(in); - std::transform(cpy.begin(), cpy.end(), cpy.begin(), ::tolower); - return cpy; -} + std::string toLowerCase(std::string in) { + std::string cpy(in); + std::transform(cpy.begin(), cpy.end(), cpy.begin(), ::tolower); + return cpy; + } -static bool BindCommand(const std::vector& args) { - if(args.size() > 2) { - const ImGuiIO* io = &ImGui::GetIO();; - for (size_t k = 0; k < std::size(io->KeysData); k++) { - std::string key(ImGui::GetKeyName(k)); + static bool BindCommand(const std::vector& args) { + if (args.size() > 2) { + const ImGuiIO* io = &ImGui::GetIO();; + for (size_t k = 0; k < std::size(io->KeysData); k++) { + std::string key(ImGui::GetKeyName(k)); - if(toLowerCase(args[1]) == toLowerCase(key)) { - std::vector tmp; - const char* const delim = " "; - std::ostringstream imploded; - std::copy(args.begin() + 2, args.end(), std::ostream_iterator(imploded, delim)); - Bindings[k] = imploded.str(); - INFO("Binding '%s' to %s", args[1].c_str(), Bindings[k].c_str()); - break; + if (toLowerCase(args[1]) == toLowerCase(key)) { + std::vector tmp; + const char* const delim = " "; + std::ostringstream imploded; + std::copy(args.begin() + 2, args.end(), std::ostream_iterator(imploded, delim)); + Bindings[k] = imploded.str(); + INFO("Binding '%s' to %s", args[1].c_str(), Bindings[k].c_str()); + break; + } + } + } + return CMD_SUCCESS; + } + + static bool BindToggleCommand(const std::vector& args) { + if (args.size() > 2) { + const ImGuiIO* io = &ImGui::GetIO();; + for (size_t k = 0; k < std::size(io->KeysData); k++) { + std::string key(ImGui::GetKeyName(k)); + + if (toLowerCase(args[1]) == toLowerCase(key)) { + BindingToggle[k] = args[2]; + INFO("Binding toggle '%s' to %s", args[1].c_str(), BindingToggle[k].c_str()); + break; + } + } + } + return CMD_SUCCESS; + } + + std::string BuildUsage(const CommandEntry& entry) { + std::string usage; + for (const auto& arg : entry.arguments) + usage += StringHelper::Sprintf(arg.optional ? "[%s] " : "<%s> ", arg.info.c_str()); + return usage; + } + + void Console::Init() { + this->InputBuffer = new char[MAX_BUFFER_SIZE]; + strcpy(this->InputBuffer, ""); + this->FilterBuffer = new char[MAX_BUFFER_SIZE]; + strcpy(this->FilterBuffer, ""); + this->Commands["help"] = { HelpCommand, "Shows all the commands" }; + this->Commands["clear"] = { ClearCommand, "Clear the console history" }; + this->Commands["bind"] = { BindCommand, "Binds key to commands" }; + this->Commands["bind-toggle"] = { BindToggleCommand, "Bind key as a bool toggle" }; + } + + void Console::Update() { + for (auto [key, cmd] : Bindings) { + if (ImGui::IsKeyPressed(key)) Dispatch(cmd); + } + for (auto [key, var] : BindingToggle) { + if (ImGui::IsKeyPressed(key)) { + CVar* cvar = CVar_Get(var.c_str()); + Dispatch("set " + var + " " + std::to_string(cvar == nullptr ? 0 : !static_cast(cvar->value.valueS32))); } } } - return CMD_SUCCESS; -} -static bool BindToggleCommand(const std::vector& args) { - if (args.size() > 2) { - const ImGuiIO* io = &ImGui::GetIO();; - for (size_t k = 0; k < std::size(io->KeysData); k++) { - std::string key(ImGui::GetKeyName(k)); + void Console::Draw() { + bool input_focus = false; + if (!this->opened) return; - if (toLowerCase(args[1]) == toLowerCase(key)) { - BindingToggle[k] = args[2]; - INFO("Binding toggle '%s' to %s", args[1].c_str(), BindingToggle[k].c_str()); - break; - } - } - } - return CMD_SUCCESS; -} - -std::string BuildUsage(const CommandEntry& entry) { - std::string usage; - for (const auto& arg : entry.arguments) - usage += StringHelper::Sprintf(arg.optional ? "[%s] " : "<%s> ", arg.info.c_str()); - return usage; -} - -void Console::Init() { - this->InputBuffer = new char[MAX_BUFFER_SIZE]; - strcpy(this->InputBuffer, ""); - this->FilterBuffer = new char[MAX_BUFFER_SIZE]; - strcpy(this->FilterBuffer, ""); - this->Commands["help"] = { HelpCommand, "Shows all the commands" }; - this->Commands["clear"] = { ClearCommand, "Clear the console history" }; - this->Commands["bind"] = { BindCommand, "Binds key to commands" }; - this->Commands["bind-toggle"] = { BindToggleCommand, "Bind key as a bool toggle" }; -} - -void Console::Update() { - for(auto [key, cmd] : Bindings) { - if (ImGui::IsKeyPressed(key)) Dispatch(cmd); - } - for (auto [key, var] : BindingToggle) { - if (ImGui::IsKeyPressed(key)) { - CVar* cvar = CVar_Get(var.c_str()); - Dispatch("set " + var + " " + std::to_string(cvar == nullptr ? 0 : !static_cast(cvar->value.valueS32))); - } - } -} - -void Console::Draw() { - bool input_focus = false; - if (!this->opened) return; - - ImGui::SetNextWindowSize(ImVec2(520, 600), ImGuiCond_FirstUseEver); - ImGui::Begin("Console", nullptr, ImGuiWindowFlags_NoFocusOnAppearing); + ImGui::SetNextWindowSize(ImVec2(520, 600), ImGuiCond_FirstUseEver); + ImGui::Begin("Console", nullptr, ImGuiWindowFlags_NoFocusOnAppearing); const ImVec2 pos = ImGui::GetWindowPos(); const ImVec2 size = ImGui::GetWindowSize(); // SohImGui::ShowCursor(ImGui::IsWindowHovered(ImGuiHoveredFlags_RootAndChildWindows | ImGuiHoveredFlags_RectOnly), SohImGui::Dialogues::dConsole); // Renders autocomplete window - if(this->OpenAutocomplete) { + if (this->OpenAutocomplete) { ImGui::SetNextWindowSize(ImVec2(350, std::min(static_cast(this->Autocomplete.size()), 3) * 20.f), ImGuiCond_Once); ImGui::SetNextWindowPos(ImVec2(pos.x + 8, pos.y + size.y - 1)); ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(3, 3)); - ImGui::Begin("##WndAutocomplete", nullptr, ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoMove ); + ImGui::Begin("##WndAutocomplete", nullptr, ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoMove); ImGui::BeginChild("AC_Child", ImVec2(0, 0), false, ImGuiWindowFlags_HorizontalScrollbar); ImGui::PushStyleColor(ImGuiCol_FrameBgActive, ImVec4(.3f, .3f, .3f, 1.0f)); if (ImGui::BeginTable("AC_History", 1)) { - for (const auto &cmd : this->Autocomplete) { - std::string usage = BuildUsage(this->Commands[cmd]); + for (const auto& cmd : this->Autocomplete) { + std::string usage = BuildUsage(this->Commands[cmd]); std::string preview = cmd + " - " + this->Commands[cmd].description; std::string autocomplete = (usage == NULLSTR ? cmd : usage); ImGui::TableNextRow(); @@ -186,53 +187,53 @@ void Console::Draw() { // Renders console history const float footer_height_to_reserve = ImGui::GetStyle().ItemSpacing.y + ImGui::GetFrameHeightWithSpacing(); ImGui::BeginChild("ScrollingRegion", ImVec2(0, -footer_height_to_reserve), false, ImGuiWindowFlags_HorizontalScrollbar); - ImGui::PushStyleColor(ImGuiCol_FrameBgActive, ImVec4(.3f, .3f, .3f, 1.0f)); - if (ImGui::BeginTable("History", 1)) { + ImGui::PushStyleColor(ImGuiCol_FrameBgActive, ImVec4(.3f, .3f, .3f, 1.0f)); + if (ImGui::BeginTable("History", 1)) { - if (ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_DownArrow))) - if (this->selectedId < (int)this->Log.size() - 1) ++this->selectedId; - if (ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_UpArrow))) - if (this->selectedId > 0) --this->selectedId; + if (ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_DownArrow))) + if (this->selectedId < (int)this->Log.size() - 1)++this->selectedId; + if (ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_UpArrow))) + if (this->selectedId > 0)--this->selectedId; - const std::vector channel = this->Log[this->selected_channel]; - for (int i = 0; i < static_cast(channel.size()); i++) { - ConsoleLine line = channel[i]; - if(!this->filter.empty() && line.text.find(this->filter) == std::string::npos) continue; - if(this->level_filter != NULLSTR && line.priority != (std::find(priority_filters.begin(), priority_filters.end(), this->level_filter) - priority_filters.begin()) - 1) continue; - std::string id = line.text + "##" + std::to_string(i); - ImGui::TableNextRow(); - ImGui::TableSetColumnIndex(0); - const bool is_selected = (this->selectedId == i) || std::find(this->selectedEntries.begin(), this->selectedEntries.end(), i) != this->selectedEntries.end(); - ImGui::PushStyleColor(ImGuiCol_Text, this->priority_colors[line.priority]); - if (ImGui::Selectable(id.c_str(), is_selected)) { - if (ImGui::IsKeyDown(ImGui::GetKeyIndex(ImGuiKey_LeftCtrl)) && !is_selected) - this->selectedEntries.push_back(i); + const std::vector channel = this->Log[this->selected_channel]; + for (int i = 0; i < static_cast(channel.size()); i++) { + ConsoleLine line = channel[i]; + if (!this->filter.empty() && line.text.find(this->filter) == std::string::npos) continue; + if (this->level_filter != NULLSTR && line.priority != (std::find(priority_filters.begin(), priority_filters.end(), this->level_filter) - priority_filters.begin()) - 1) continue; + std::string id = line.text + "##" + std::to_string(i); + ImGui::TableNextRow(); + ImGui::TableSetColumnIndex(0); + const bool is_selected = (this->selectedId == i) || std::find(this->selectedEntries.begin(), this->selectedEntries.end(), i) != this->selectedEntries.end(); + ImGui::PushStyleColor(ImGuiCol_Text, this->priority_colors[line.priority]); + if (ImGui::Selectable(id.c_str(), is_selected)) { + if (ImGui::IsKeyDown(ImGui::GetKeyIndex(ImGuiKey_LeftCtrl)) && !is_selected) + this->selectedEntries.push_back(i); - else this->selectedEntries.clear(); - this->selectedId = is_selected ? -1 : i; - } - ImGui::PopStyleColor(); - if (is_selected) ImGui::SetItemDefaultFocus(); + else this->selectedEntries.clear(); + this->selectedId = is_selected ? -1 : i; } - ImGui::EndTable(); + ImGui::PopStyleColor(); + if (is_selected) ImGui::SetItemDefaultFocus(); } - ImGui::PopStyleColor(); - if (ImGui::GetScrollY() >= ImGui::GetScrollMaxY()) - ImGui::SetScrollHereY(1.0f); + ImGui::EndTable(); + } + ImGui::PopStyleColor(); + if (ImGui::GetScrollY() >= ImGui::GetScrollMaxY()) + ImGui::SetScrollHereY(1.0f); ImGui::EndChild(); // Renders input textfield constexpr ImGuiInputTextFlags flags = ImGuiInputTextFlags_EnterReturnsTrue | ImGuiInputTextFlags_CallbackEdit | - ImGuiInputTextFlags_CallbackCompletion | ImGuiInputTextFlags_CallbackHistory; + ImGuiInputTextFlags_CallbackCompletion | ImGuiInputTextFlags_CallbackHistory; ImGui::PushItemWidth(-53); - if(ImGui::InputTextWithHint("##CMDInput", ">", this->InputBuffer, MAX_BUFFER_SIZE, flags, &Console::CallbackStub, this)) { + if (ImGui::InputTextWithHint("##CMDInput", ">", this->InputBuffer, MAX_BUFFER_SIZE, flags, &Console::CallbackStub, this)) { input_focus = true; - if(this->InputBuffer[0] != '\0' && this->InputBuffer[0] != ' ') + if (this->InputBuffer[0] != '\0' && this->InputBuffer[0] != ' ') this->Dispatch(std::string(this->InputBuffer)); memset(this->InputBuffer, 0, MAX_BUFFER_SIZE); } - if(this->CMDHint != NULLSTR) { + if (this->CMDHint != NULLSTR) { if (ImGui::IsItemFocused()) { ImGui::SetNextWindowPos(ImVec2(pos.x, pos.y + size.y)); ImGui::SameLine(); @@ -246,38 +247,38 @@ void Console::Draw() { ImGui::SameLine(); ImGui::SetCursorPosX(ImGui::GetCursorPosX() + ImGui::GetContentRegionAvail().x - 50); - if(ImGui::Button("Submit") && !input_focus && this->InputBuffer[0] != '\0' && this->InputBuffer[0] != ' '){ - this->Dispatch(std::string(this->InputBuffer)); + if (ImGui::Button("Submit") && !input_focus && this->InputBuffer[0] != '\0' && this->InputBuffer[0] != ' ') { + this->Dispatch(std::string(this->InputBuffer)); memset(this->InputBuffer, 0, MAX_BUFFER_SIZE); } ImGui::SetItemDefaultFocus(); if (input_focus) ImGui::SetKeyboardFocusHere(-1); ImGui::PopItemWidth(); - ImGui::End(); -} - -void Console::Dispatch(const std::string& line) { - this->CMDHint = NULLSTR; - this->History.push_back(line); - this->Log[this->selected_channel].push_back({ "> " + line } ); - const std::vector cmd_args = StringHelper::Split(line, " "); - if (this->Commands.contains(cmd_args[0])) { - const CommandEntry entry = this->Commands[cmd_args[0]]; - if(!entry.handler(cmd_args) && !entry.arguments.empty()) - this->Log[this->selected_channel].push_back({ "[SOH] Usage: " + cmd_args[0] + " " + BuildUsage(entry), ERROR_LVL}); - return; + ImGui::End(); } - this->Log[this->selected_channel].push_back({ "[SOH] Command not found", ERROR_LVL }); -} -int Console::CallbackStub(ImGuiInputTextCallbackData* data) { - const auto instance = static_cast(data->UserData); - const bool empty_history = instance->History.empty(); - const int history_index = instance->HistoryIndex; - std::string history; + void Console::Dispatch(const std::string& line) { + this->CMDHint = NULLSTR; + this->History.push_back(line); + this->Log[this->selected_channel].push_back({ "> " + line }); + const std::vector cmd_args = StringHelper::Split(line, " "); + if (this->Commands.contains(cmd_args[0])) { + const CommandEntry entry = this->Commands[cmd_args[0]]; + if (!entry.handler(cmd_args) && !entry.arguments.empty()) + this->Log[this->selected_channel].push_back({ "[SOH] Usage: " + cmd_args[0] + " " + BuildUsage(entry), ERROR_LVL }); + return; + } + this->Log[this->selected_channel].push_back({ "[SOH] Command not found", ERROR_LVL }); + } - switch(data->EventKey) { + int Console::CallbackStub(ImGuiInputTextCallbackData* data) { + const auto instance = static_cast(data->UserData); + const bool empty_history = instance->History.empty(); + const int history_index = instance->HistoryIndex; + std::string history; + + switch (data->EventKey) { case ImGuiKey_Tab: instance->Autocomplete.clear(); for (auto& [cmd, entry] : instance->Commands) @@ -287,7 +288,7 @@ int Console::CallbackStub(ImGuiInputTextCallbackData* data) { break; case ImGuiKey_UpArrow: if (empty_history) break; - if(history_index < static_cast(instance->History.size()) - 1) instance->HistoryIndex += 1; + if (history_index < static_cast(instance->History.size()) - 1) instance->HistoryIndex += 1; data->DeleteChars(0, data->BufTextLen); data->InsertChars(0, instance->History[instance->HistoryIndex].c_str()); instance->CMDHint = NULLSTR; @@ -296,7 +297,7 @@ int Console::CallbackStub(ImGuiInputTextCallbackData* data) { if (empty_history) break; if (history_index > -1) instance->HistoryIndex -= 1; data->DeleteChars(0, data->BufTextLen); - if(history_index >= 0) + if (history_index >= 0) data->InsertChars(0, instance->History[history_index].c_str()); instance->CMDHint = NULLSTR; break; @@ -316,16 +317,17 @@ int Console::CallbackStub(ImGuiInputTextCallbackData* data) { } instance->CMDHint = NULLSTR; } + } + return 0; } - return 0; -} -void Console::Append(const std::string& channel, Priority priority, const char* fmt, ...) { - char buf[1024]; - va_list args; - va_start(args, fmt); - vsnprintf(buf, IM_ARRAYSIZE(buf), fmt, args); - buf[IM_ARRAYSIZE(buf) - 1] = 0; - va_end(args); - this->Log[channel].push_back({ std::string(buf), priority }); -} + void Console::Append(const std::string& channel, Priority priority, const char* fmt, ...) { + char buf[1024]; + va_list args; + va_start(args, fmt); + vsnprintf(buf, IM_ARRAYSIZE(buf), fmt, args); + buf[IM_ARRAYSIZE(buf) - 1] = 0; + va_end(args); + this->Log[channel].push_back({ std::string(buf), priority }); + } +} \ No newline at end of file diff --git a/libultraship/libultraship/Console.h b/libultraship/libultraship/Console.h index bfbffd0b9..a174450e1 100644 --- a/libultraship/libultraship/Console.h +++ b/libultraship/libultraship/Console.h @@ -7,75 +7,77 @@ #include "Lib/ImGui/imgui.h" -#define LOG(msg, ...) SohImGui::console->Append("Main", Priority::LOG_LVL, msg, ##__VA_ARGS__) -#define INFO(msg, ...) SohImGui::console->Append("Main", Priority::INFO_LVL, msg, ##__VA_ARGS__) -#define WARNING(msg, ...) SohImGui::console->Append("Main", Priority::WARNING_LVL, msg, ##__VA_ARGS__) -#define ERROR(msg, ...) SohImGui::console->Append("Main", Priority::ERROR_LVL, msg, ##__VA_ARGS__) -#define CMD_SUCCESS true -#define CMD_FAILED false -#define MAX_BUFFER_SIZE 255 -#define NULLSTR "None" +namespace Ship { + #define LOG(msg, ...) SohImGui::console->Append("Main", Ship::Priority::LOG_LVL, msg, ##__VA_ARGS__) + #define INFO(msg, ...) SohImGui::console->Append("Main", Ship::Priority::INFO_LVL, msg, ##__VA_ARGS__) + #define WARNING(msg, ...) SohImGui::console->Append("Main", Ship::Priority::WARNING_LVL, msg, ##__VA_ARGS__) + #define ERROR(msg, ...) SohImGui::console->Append("Main", Ship::Priority::ERROR_LVL, msg, ##__VA_ARGS__) + #define CMD_SUCCESS true + #define CMD_FAILED false + #define MAX_BUFFER_SIZE 255 + #define NULLSTR "None" -typedef std::function args)> CommandHandler; + typedef std::function args)> CommandHandler; -enum Priority { - INFO_LVL, - LOG_LVL, - WARNING_LVL, - ERROR_LVL -}; - -enum class ArgumentType { - TEXT, NUMBER, PLAYER_POS, PLAYER_ROT -}; - -struct CommandArgument { - std::string info; - ArgumentType type = ArgumentType::NUMBER; - bool optional = false; -}; - -struct CommandEntry { - CommandHandler handler; - std::string description; - std::vector arguments; -}; - -struct ConsoleLine { - std::string text; - Priority priority = Priority::INFO_LVL; - std::string channel = "Main"; -}; - -class Console { - int selectedId = -1; - std::vector selectedEntries; - std::string filter; - std::string level_filter = NULLSTR; - std::vector log_channels = { "Main", "SoH Logging"}; - std::vector priority_filters = { "None", "Info", "Log", "Warning", "Error" }; - std::vector priority_colors = { - ImVec4(1.0f, 1.0f, 1.0f, 1.0f), - ImVec4(0.2f, 1.0f, 0.2f, 1.0f), - ImVec4(0.9f, 0.8f, 0.4f, 0.01f), - ImVec4(1.0f, 0.2f, 0.2f, 1.0f) + enum Priority { + INFO_LVL, + LOG_LVL, + WARNING_LVL, + ERROR_LVL }; -public: - std::map> Log; - std::map Commands; - std::vector Autocomplete; - std::vector History; - std::string CMDHint = NULLSTR; - char* FilterBuffer = nullptr; - char* InputBuffer = nullptr; - bool OpenAutocomplete = false; - int HistoryIndex = -1; - std::string selected_channel = "Main"; - bool opened = false; - void Init(); - void Update(); - void Draw(); - void Append(const std::string& channel, Priority priority, const char* fmt, ...) IM_FMTARGS(4); - void Dispatch(const std::string& line); - static int CallbackStub(ImGuiInputTextCallbackData* data); -}; \ No newline at end of file + + enum class ArgumentType { + TEXT, NUMBER, PLAYER_POS, PLAYER_ROT + }; + + struct CommandArgument { + std::string info; + ArgumentType type = ArgumentType::NUMBER; + bool optional = false; + }; + + struct CommandEntry { + CommandHandler handler; + std::string description; + std::vector arguments; + }; + + struct ConsoleLine { + std::string text; + Priority priority = Priority::INFO_LVL; + std::string channel = "Main"; + }; + + class Console { + int selectedId = -1; + std::vector selectedEntries; + std::string filter; + std::string level_filter = NULLSTR; + std::vector log_channels = { "Main", "SoH Logging" }; + std::vector priority_filters = { "None", "Info", "Log", "Warning", "Error" }; + std::vector priority_colors = { + ImVec4(1.0f, 1.0f, 1.0f, 1.0f), + ImVec4(0.2f, 1.0f, 0.2f, 1.0f), + ImVec4(0.9f, 0.8f, 0.4f, 0.01f), + ImVec4(1.0f, 0.2f, 0.2f, 1.0f) + }; + public: + std::map> Log; + std::map Commands; + std::vector Autocomplete; + std::vector History; + std::string CMDHint = NULLSTR; + char* FilterBuffer = nullptr; + char* InputBuffer = nullptr; + bool OpenAutocomplete = false; + int HistoryIndex = -1; + std::string selected_channel = "Main"; + bool opened = false; + void Init(); + void Update(); + void Draw(); + void Append(const std::string& channel, Priority priority, const char* fmt, ...) IM_FMTARGS(4); + void Dispatch(const std::string& line); + static int CallbackStub(ImGuiInputTextCallbackData* data); + }; +} \ No newline at end of file diff --git a/libultraship/libultraship/ControlDeck.cpp b/libultraship/libultraship/ControlDeck.cpp index fd6511f78..31eb90067 100644 --- a/libultraship/libultraship/ControlDeck.cpp +++ b/libultraship/libultraship/ControlDeck.cpp @@ -7,148 +7,170 @@ #include "SDLController.h" #include -uint8_t* controllerBits; +namespace Ship { + uint8_t* controllerBits; -void Ship::ControlDeck::Init(uint8_t* bits) { - ScanPhysicalDevices(); - controllerBits = bits; -} + void ControlDeck::Init(uint8_t* bits) { + ScanPhysicalDevices(); + controllerBits = bits; + } -void Ship::ControlDeck::ScanPhysicalDevices() { + void ControlDeck::ScanPhysicalDevices() { - virtualDevices.clear(); - physicalDevices.clear(); + virtualDevices.clear(); + physicalDevices.clear(); - for (int i = 0; i < SDL_NumJoysticks(); i++) { - if (SDL_IsGameController(i)) { - auto sdl = std::make_shared(i); - sdl->Open(); - physicalDevices.push_back(sdl); - } - } + for (int i = 0; i < SDL_NumJoysticks(); i++) { + if (SDL_IsGameController(i)) { + auto sdl = std::make_shared(i); + sdl->Open(); + physicalDevices.push_back(sdl); + } + } - physicalDevices.push_back(std::make_shared("Auto", "Auto", true)); - physicalDevices.push_back(std::make_shared()); - physicalDevices.push_back(std::make_shared("Disconnected", "None", false)); + physicalDevices.push_back(std::make_shared("Auto", "Auto", true)); + physicalDevices.push_back(std::make_shared()); + physicalDevices.push_back(std::make_shared("Disconnected", "None", false)); - for (const auto& device : physicalDevices) { - for (int i = 0; i < MAXCONTROLLERS; i++) { - device->CreateDefaultBinding(i); - } - } + for (const auto& device : physicalDevices) { + for (int i = 0; i < MAXCONTROLLERS; i++) { + device->CreateDefaultBinding(i); + } + } - for (int i = 0; i < MAXCONTROLLERS; i++) { - virtualDevices.push_back(i == 0 ? 0 : static_cast(physicalDevices.size()) - 1); - } + for (int i = 0; i < MAXCONTROLLERS; i++) { + virtualDevices.push_back(i == 0 ? 0 : static_cast(physicalDevices.size()) - 1); + } - LoadControllerSettings(); -} + LoadControllerSettings(); + } -void Ship::ControlDeck::SetPhysicalDevice(int slot, int deviceSlot) { - const std::shared_ptr backend = physicalDevices[deviceSlot]; - virtualDevices[slot] = deviceSlot; - *controllerBits |= (backend->Connected()) << slot; -} + void ControlDeck::SetPhysicalDevice(int slot, int deviceSlot) { + const std::shared_ptr backend = physicalDevices[deviceSlot]; + virtualDevices[slot] = deviceSlot; + *controllerBits |= (backend->Connected()) << slot; + } -void Ship::ControlDeck::WriteToPad(OSContPad* pad) const { - for (size_t i = 0; i < virtualDevices.size(); i++) { - const std::shared_ptr backend = physicalDevices[virtualDevices[i]]; - if (backend->GetGuid() == "Auto") { - for (const auto& device : physicalDevices) { - device->Read(&pad[i], i); - } - continue; - } - backend->Read(&pad[i], i); - } -} + void ControlDeck::WriteToPad(OSContPad* pad) const { + for (size_t i = 0; i < virtualDevices.size(); i++) { + const std::shared_ptr backend = physicalDevices[virtualDevices[i]]; + if (backend->GetGuid() == "Auto") { + for (const auto& device : physicalDevices) { + device->Read(&pad[i], i); + } + continue; + } + backend->Read(&pad[i], i); + } + } #define NESTED(key, ...) StringHelper::Sprintf("Controllers.%s.Slot_%d." key, device->GetGuid().c_str(), slot, __VA_ARGS__) -void Ship::ControlDeck::LoadControllerSettings() { - std::shared_ptr Config = GlobalCtx2::GetInstance()->GetConfig(); + void ControlDeck::LoadControllerSettings() { + std::shared_ptr Config = GlobalCtx2::GetInstance()->GetConfig(); - for (auto const& val : Config->rjson["Controllers"]["Deck"].items()) { - int slot = std::stoi(val.key().substr(5)); + for (auto const& val : Config->rjson["Controllers"]["Deck"].items()) { + int slot = std::stoi(val.key().substr(5)); - for (size_t dev = 0; dev < physicalDevices.size(); dev++) { - std::string guid = physicalDevices[dev]->GetGuid(); - if(guid != val.value()) continue; + for (size_t dev = 0; dev < physicalDevices.size(); dev++) { + std::string guid = physicalDevices[dev]->GetGuid(); + if (guid != val.value()) continue; - virtualDevices[slot] = dev; - } - } + virtualDevices[slot] = dev; + } + } - for (size_t i = 0; i < virtualDevices.size(); i++) { - std::shared_ptr backend = physicalDevices[virtualDevices[i]]; - Config->setString(StringHelper::Sprintf("Controllers.Deck.Slot_%d", (int)i), backend->GetGuid()); - } + for (size_t i = 0; i < virtualDevices.size(); i++) { + std::shared_ptr backend = physicalDevices[virtualDevices[i]]; + Config->setString(StringHelper::Sprintf("Controllers.Deck.Slot_%d", (int)i), backend->GetGuid()); + } - for (const auto& device : physicalDevices) { + for (const auto& device : physicalDevices) { - std::string guid = device->GetGuid(); + std::string guid = device->GetGuid(); - for (int slot = 0; slot < MAXCONTROLLERS; slot++) { + for (int slot = 0; slot < MAXCONTROLLERS; slot++) { - if (!(Config->rjson["Controllers"].contains(guid) && Config->rjson["Controllers"][guid].contains(StringHelper::Sprintf("Slot_%d", slot)))) continue; + if (!(Config->rjson["Controllers"].contains(guid) && Config->rjson["Controllers"][guid].contains(StringHelper::Sprintf("Slot_%d", slot)))) continue; - auto& profile = device->profiles[slot]; - auto rawProfile = Config->rjson["Controllers"][guid][StringHelper::Sprintf("Slot_%d", slot)]; + auto& profile = device->profiles[slot]; + auto rawProfile = Config->rjson["Controllers"][guid][StringHelper::Sprintf("Slot_%d", slot)]; - profile.Mappings.clear(); - profile.Thresholds.clear(); - profile.UseRumble = Config->getBool(NESTED("Rumble.Enabled", "")); - profile.RumbleStrength = Config->getFloat(NESTED("Rumble.Strength", "")); - profile.UseGyro = Config->getBool(NESTED("Gyro.Enabled", "")); + profile.Mappings.clear(); + profile.Thresholds.clear(); + profile.UseRumble = Config->getBool(NESTED("Rumble.Enabled", "")); + profile.RumbleStrength = Config->getFloat(NESTED("Rumble.Strength", "")); + profile.UseGyro = Config->getBool(NESTED("Gyro.Enabled", "")); - for (auto const& val : rawProfile["Thresholds"].items()) { - profile.Thresholds[static_cast(std::stoi(val.key()))] = val.value(); - } + for (auto const& val : rawProfile["Thresholds"].items()) { + profile.Thresholds[static_cast(std::stoi(val.key()))] = val.value(); + } - for (auto const& val : rawProfile["Mappings"].items()) { - device->SetButtonMapping(slot, std::stoi(val.key().substr(4)), val.value()); - } - } - } -} + for (auto const& val : rawProfile["Mappings"].items()) { + device->SetButtonMapping(slot, std::stoi(val.key().substr(4)), val.value()); + } + } + } + } -void Ship::ControlDeck::SaveControllerSettings() { - std::shared_ptr Config = GlobalCtx2::GetInstance()->GetConfig(); + void ControlDeck::SaveControllerSettings() { + std::shared_ptr Config = GlobalCtx2::GetInstance()->GetConfig(); - for (size_t i = 0; i < virtualDevices.size(); i++) { - std::shared_ptr backend = physicalDevices[virtualDevices[i]]; - Config->setString(StringHelper::Sprintf("Controllers.Deck.Slot_%d", (int)i), backend->GetGuid()); - } + for (size_t i = 0; i < virtualDevices.size(); i++) { + std::shared_ptr backend = physicalDevices[virtualDevices[i]]; + Config->setString(StringHelper::Sprintf("Controllers.Deck.Slot_%d", (int)i), backend->GetGuid()); + } - for (const auto& device : physicalDevices) { + for (const auto& device : physicalDevices) { - int slot = 0; - std::string guid = device->GetGuid(); + int slot = 0; + std::string guid = device->GetGuid(); - for (const auto& profile : device->profiles) { + for (const auto& profile : device->profiles) { - if (!device->Connected()) continue; + if (!device->Connected()) continue; - auto rawProfile = Config->rjson["Controllers"][guid][StringHelper::Sprintf("Slot_%d", slot)]; - Config->setBool(NESTED("Rumble.Enabled", ""), profile.UseRumble); - Config->setFloat(NESTED("Rumble.Strength", ""), profile.RumbleStrength); - Config->setBool(NESTED("Gyro.Enabled", ""), profile.UseGyro); + auto rawProfile = Config->rjson["Controllers"][guid][StringHelper::Sprintf("Slot_%d", slot)]; + Config->setBool(NESTED("Rumble.Enabled", ""), profile.UseRumble); + Config->setFloat(NESTED("Rumble.Strength", ""), profile.RumbleStrength); + Config->setBool(NESTED("Gyro.Enabled", ""), profile.UseGyro); - for (auto const& val : rawProfile["Mappings"].items()) { - Config->setInt(NESTED("Mappings.%s", val.key().c_str()), -1); - } + for (auto const& val : rawProfile["Mappings"].items()) { + Config->setInt(NESTED("Mappings.%s", val.key().c_str()), -1); + } - for (auto const& [key, val] : profile.Thresholds) { - Config->setFloat(NESTED("Thresholds.%d", key), val); - } + for (auto const& [key, val] : profile.Thresholds) { + Config->setFloat(NESTED("Thresholds.%d", key), val); + } - for (auto const& [key, val] : profile.Mappings) { - Config->setInt(NESTED("Mappings.BTN_%d", val), key); - } + for (auto const& [key, val] : profile.Mappings) { + Config->setInt(NESTED("Mappings.BTN_%d", val), key); + } - slot++; - } - } + slot++; + } + } - Config->save(); -} + Config->save(); + } + + std::shared_ptr ControlDeck::GetPhysicalDevice(int deviceSlot) { + return physicalDevices[deviceSlot]; + } + + size_t ControlDeck::GetNumPhysicalDevices() { + return physicalDevices.size(); + } + + int ControlDeck::GetVirtualDevice(int slot) { + return virtualDevices[slot]; + } + + size_t ControlDeck::GetNumVirtualDevices() { + return virtualDevices.size(); + } + + std::shared_ptr ControlDeck::GetPhysicalDeviceFromVirtualSlot(int slot) { + return GetPhysicalDevice(GetVirtualDevice(slot)); + } +} \ No newline at end of file diff --git a/libultraship/libultraship/ControlDeck.h b/libultraship/libultraship/ControlDeck.h index fbbaca7ab..15cba08e9 100644 --- a/libultraship/libultraship/ControlDeck.h +++ b/libultraship/libultraship/ControlDeck.h @@ -2,19 +2,24 @@ #include "Controller.h" #include -#include namespace Ship { class ControlDeck { public: - std::vector virtualDevices; - std::vector> physicalDevices = {}; void Init(uint8_t* controllerBits); void ScanPhysicalDevices(); void WriteToPad(OSContPad* pad) const; void LoadControllerSettings(); void SaveControllerSettings(); void SetPhysicalDevice(int slot, int deviceSlot); + std::shared_ptr GetPhysicalDevice(int deviceSlot); + std::shared_ptr GetPhysicalDeviceFromVirtualSlot(int slot); + size_t GetNumPhysicalDevices(); + int GetVirtualDevice(int slot); + size_t GetNumVirtualDevices(); + private: + std::vector virtualDevices; + std::vector> physicalDevices = {}; }; } diff --git a/libultraship/libultraship/Cvar.cpp b/libultraship/libultraship/Cvar.cpp index d5b3af750..242b4c913 100644 --- a/libultraship/libultraship/Cvar.cpp +++ b/libultraship/libultraship/Cvar.cpp @@ -1,11 +1,11 @@ #include "Cvar.h" #include -#include +#include #include #include #include -#include -#include "imgui_internal.h" +#include +#include "GlobalCtx2.h" std::map, std::less<>> cvars; @@ -96,7 +96,7 @@ extern "C" void CVar_SetS32(const char* name, int32_t value) { cvar->value.valueS32 = value; } -void CVar_SetFloat(const char* name, float value) { +extern "C" void CVar_SetFloat(const char* name, float value) { auto& cvar = cvars[name]; if (!cvar) { cvar = std::make_unique(); @@ -111,7 +111,11 @@ extern "C" void CVar_SetString(const char* name, const char* value) { cvar = std::make_unique(); } cvar->type = CVarType::String; - cvar->value.valueStr = ImStrdup(value); +#ifdef _MSC_VER + cvar->value.valueStr = _strdup(value); +#else + cvar->value.valueStr = strdup(value); +#endif } extern "C" void CVar_RegisterRGBA(const char* name, Color_RGBA8 defaultValue) { @@ -133,3 +137,126 @@ extern "C" void CVar_RegisterString(const char* name, const char* defaultValue) if (!CVar_Get(name)) CVar_SetString(name, defaultValue); } + +template bool is_number(const std::string& s) { + Numeric n; + return ((std::istringstream(s) >> n >> std::ws).eof()); +} + +void CVar_LoadLegacy() { + auto cvarsConfig = Ship::GlobalCtx2::GetPathRelativeToAppDirectory("cvars.cfg"); + if (File::Exists(cvarsConfig)) { + const auto lines = File::ReadAllLines(cvarsConfig); + + for (const std::string& line : lines) { + std::vector cfg = StringHelper::Split(line, " = "); + if (line.empty()) continue; + if (cfg.size() < 2) continue; + + if (cfg[1].find("\"") == std::string::npos && (cfg[1].find("#") != std::string::npos)) + { + std::string value(cfg[1]); + value.erase(std::remove_if(value.begin(), value.end(), [](char c) { return c == '#'; }), value.end()); + auto splitTest = StringHelper::Split(value, "\r")[0]; + + uint32_t val = std::stoul(splitTest, nullptr, 16); + Color_RGBA8 clr; + clr.r = val >> 24; + clr.g = val >> 16; + clr.b = val >> 8; + clr.a = val & 0xFF; + CVar_SetRGBA(cfg[0].c_str(), clr); + } + + if (cfg[1].find("\"") != std::string::npos) { + std::string value(cfg[1]); + value.erase(std::remove(value.begin(), value.end(), '\"'), value.end()); +#ifdef _MSC_VER + CVar_SetString(cfg[0].c_str(), _strdup(value.c_str())); +#else + CVar_SetString(cfg[0].c_str(), strdup(value.c_str())); +#endif + } + if (is_number(cfg[1])) { + CVar_SetFloat(cfg[0].c_str(), std::stof(cfg[1])); + } + if (is_number(cfg[1])) { + CVar_SetS32(cfg[0].c_str(), std::stoi(cfg[1])); + } + } + + fs::remove(cvarsConfig); + } +} + + +extern "C" void CVar_Load() { + std::shared_ptr pConf = Ship::GlobalCtx2::GetInstance()->GetConfig(); + pConf->reload(); + + for (const auto& item : pConf->rjson["CVars"].items()) { + auto value = item.value(); + switch (value.type()) { + case nlohmann::detail::value_t::array: + break; + case nlohmann::detail::value_t::object: + if (value["Type"].get() == mercuryRGBAObjectType) { + Color_RGBA8 clr; + clr.r = value["R"].get(); + clr.g = value["G"].get(); + clr.b = value["B"].get(); + clr.a = value["A"].get(); + CVar_SetRGBA(item.key().c_str(), clr); + } + + break; + case nlohmann::detail::value_t::string: + CVar_SetString(item.key().c_str(), value.get().c_str()); + break; + case nlohmann::detail::value_t::boolean: + CVar_SetS32(item.key().c_str(), value.get()); + break; + case nlohmann::detail::value_t::number_unsigned: + case nlohmann::detail::value_t::number_integer: + CVar_SetS32(item.key().c_str(), value.get()); + break; + case nlohmann::detail::value_t::number_float: + CVar_SetFloat(item.key().c_str(), value.get()); + break; + default:; + } + if (item.key() == "gOpenMenuBar") { + int bp = 0; + } + } + + CVar_LoadLegacy(); +} + +extern "C" void CVar_Save() +{ + std::shared_ptr pConf = Ship::GlobalCtx2::GetInstance()->GetConfig(); + + for (const auto& cvar : cvars) { + const std::string key = StringHelper::Sprintf("CVars.%s", cvar.first.c_str()); + + if (cvar.second->type == CVarType::String && cvar.second->value.valueStr != nullptr) + pConf->setString(key, std::string(cvar.second->value.valueStr)); + else if (cvar.second->type == CVarType::S32) + pConf->setInt(key, cvar.second->value.valueS32); + else if (cvar.second->type == CVarType::Float) + pConf->setFloat(key, cvar.second->value.valueFloat); + else if (cvar.second->type == CVarType::RGBA) + { + auto keyStr = key.c_str(); + Color_RGBA8 clr = cvar.second->value.valueRGBA; + pConf->setUInt(StringHelper::Sprintf("%s.R", keyStr), clr.r); + pConf->setUInt(StringHelper::Sprintf("%s.G", keyStr), clr.r); + pConf->setUInt(StringHelper::Sprintf("%s.B", keyStr), clr.r); + pConf->setUInt(StringHelper::Sprintf("%s.A", keyStr), clr.r); + pConf->setString(StringHelper::Sprintf("%s.Type", keyStr), mercuryRGBAObjectType); + } + } + + pConf->save(); +} diff --git a/libultraship/libultraship/Cvar.h b/libultraship/libultraship/Cvar.h index b8f294be6..b13e1ab32 100644 --- a/libultraship/libultraship/Cvar.h +++ b/libultraship/libultraship/Cvar.h @@ -32,22 +32,24 @@ extern "C" CVar * CVar_Get(const char* name); extern "C" { #endif -//#include -int32_t CVar_GetS32(const char* name, int32_t defaultValue); -float CVar_GetFloat(const char* name, float defaultValue); -const char* CVar_GetString(const char* name, const char* defaultValue); -void CVar_SetS32(const char* name, int32_t value); -void CVar_SetString(const char* name, const char* value); + float CVar_GetFloat(const char* name, float defaultValue); + void CVar_SetFloat(const char* name, float value); + int32_t CVar_GetS32(const char* name, int32_t defaultValue); + void CVar_SetS32(const char* name, int32_t value); + const char* CVar_GetString(const char* name, const char* defaultValue); + void CVar_SetString(const char* name, const char* value); + Color_RGB8 CVar_GetRGB(const char* name, Color_RGB8 defaultValue); + Color_RGBA8 CVar_GetRGBA(const char* name, Color_RGBA8 defaultValue); + void CVar_SetRGBA(const char* name, Color_RGBA8 value); -Color_RGB8 CVar_GetRGB(const char* name, Color_RGB8 defaultValue); -Color_RGBA8 CVar_GetRGBA(const char* name, Color_RGBA8 defaultValue); -void CVar_SetRGBA(const char* name, Color_RGBA8 value); + void CVar_RegisterS32(const char* name, int32_t defaultValue); + void CVar_RegisterFloat(const char* name, float defaultValue); + void CVar_RegisterString(const char* name, const char* defaultValue); + void CVar_RegisterRGBA(const char* name, Color_RGBA8 defaultValue); -void CVar_RegisterS32(const char* name, int32_t defaultValue); -void CVar_RegisterFloat(const char* name, float defaultValue); -void CVar_RegisterString(const char* name, const char* defaultValue); -void CVar_RegisterRGBA(const char* name, Color_RGBA8 defaultValue); + void CVar_Load(); + void CVar_Save(); #ifdef __cplusplus }; @@ -56,11 +58,8 @@ void CVar_RegisterRGBA(const char* name, Color_RGBA8 defaultValue); #ifdef __cplusplus #include #include -#include #include -//extern "C" CVar * CVar_Get(const char* name); extern std::map, std::less<>> cvars; -void CVar_SetFloat(const char* name, float value); #endif #endif diff --git a/libultraship/libultraship/Environment.cpp b/libultraship/libultraship/Environment.cpp deleted file mode 100644 index 53d0f330b..000000000 --- a/libultraship/libultraship/Environment.cpp +++ /dev/null @@ -1,16 +0,0 @@ -#include "Environment.h" - -#include -#include - -std::map environmentVars; - -namespace SohUtils { - void saveEnvironmentVar(const std::string& key, const std::string& value) { - environmentVars[key] = value; - } - - std::string getEnvironmentVar(const std::string& key) { - return environmentVars[key]; - } -} \ No newline at end of file diff --git a/libultraship/libultraship/Environment.h b/libultraship/libultraship/Environment.h deleted file mode 100644 index 4d6ab3346..000000000 --- a/libultraship/libultraship/Environment.h +++ /dev/null @@ -1,8 +0,0 @@ -#pragma once - -#include - -namespace SohUtils { - void saveEnvironmentVar(const std::string& key, const std::string& value); - std::string getEnvironmentVar(const std::string& key); -} \ No newline at end of file diff --git a/libultraship/libultraship/GameOverlay.cpp b/libultraship/libultraship/GameOverlay.cpp index ccbdc142c..00bab575f 100644 --- a/libultraship/libultraship/GameOverlay.cpp +++ b/libultraship/libultraship/GameOverlay.cpp @@ -6,223 +6,229 @@ #include "ResourceMgr.h" #include "Console.h" #include "ImGuiImpl.h" -#include "TextureMod.h" #include "Lib/ImGui/imgui_internal.h" #include "Utils/StringHelper.h" -void Ship::GameOverlay::LoadFont(const std::string& name, const std::string& path, float fontSize) { - ImGuiIO& io = ImGui::GetIO(); - std::shared_ptr base = GlobalCtx2::GetInstance()->GetResourceManager()->GetArchive(); - std::shared_ptr font = std::make_shared(); - base->LoadFile(path, false, font); - if (font->bIsLoaded) { - char* font_data = new char[font->dwBufferSize]; - memcpy(font_data, font->buffer.get(), font->dwBufferSize); - Fonts[name] = io.Fonts->AddFontFromMemoryTTF(font_data, font->dwBufferSize, fontSize); +namespace Ship { + void GameOverlay::LoadFont(const std::string& name, const std::string& path, float fontSize) { + ImGuiIO& io = ImGui::GetIO(); + std::shared_ptr base = GlobalCtx2::GetInstance()->GetResourceManager()->GetArchive(); + std::shared_ptr font = std::make_shared(); + base->LoadFile(path, false, font); + if (font->bIsLoaded) { + char* font_data = new char[font->dwBufferSize]; + memcpy(font_data, font->buffer.get(), font->dwBufferSize); + Fonts[name] = io.Fonts->AddFontFromMemoryTTF(font_data, font->dwBufferSize, fontSize); + } } -} -void Ship::GameOverlay::TextDraw(float x, float y, bool shadow, ImVec4 color, const char* fmt, ...) { - char buf[1024]; - va_list args; - va_start(args, fmt); - vsnprintf(buf, IM_ARRAYSIZE(buf), fmt, args); - buf[IM_ARRAYSIZE(buf) - 1] = 0; - va_end(args); + void GameOverlay::TextDraw(float x, float y, bool shadow, ImVec4 color, const char* fmt, ...) { + char buf[1024]; + va_list args; + va_start(args, fmt); + vsnprintf(buf, IM_ARRAYSIZE(buf), fmt, args); + buf[IM_ARRAYSIZE(buf) - 1] = 0; + va_end(args); - ImGui::PushStyleColor(ImGuiCol_Text, color); - ImGui::PushFont(Fonts[this->CurrentFont]); - if (shadow) { - ImGui::SetCursorPos(ImVec2(x + 1, y + 1)); - ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(.0f, .0f, .0f, color.w)); + ImGui::PushStyleColor(ImGuiCol_Text, color); + ImGui::PushFont(Fonts[this->CurrentFont]); + if (shadow) { + ImGui::SetCursorPos(ImVec2(x + 1, y + 1)); + ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(.0f, .0f, .0f, color.w)); + ImGui::Text(buf, args); + } + ImGui::PopStyleColor(); + ImGui::SetCursorPos(ImVec2(x, y)); ImGui::Text(buf, args); + ImGui::PopFont(); + ImGui::PopStyleColor(); } - ImGui::PopStyleColor(); - ImGui::SetCursorPos(ImVec2(x, y)); - ImGui::Text(buf, args); - ImGui::PopFont(); - ImGui::PopStyleColor(); -} -void Ship::GameOverlay::TextDrawNotification(float duration, bool shadow, const char* fmt, ...) { - char buf[1024]; - va_list args; - va_start(args, fmt); - vsnprintf(buf, IM_ARRAYSIZE(buf), fmt, args); - buf[IM_ARRAYSIZE(buf) - 1] = 0; - va_end(args); - this->RegisteredOverlays[StringHelper::Sprintf("NotificationID:%d%d", rand(), this->RegisteredOverlays.size())] = new Overlay({ OverlayType::NOTIFICATION, ImStrdup(buf), duration, duration }); - NeedsCleanup = true; -} - -void Ship::GameOverlay::CleanupNotifications() { - if(!NeedsCleanup) return; - for (auto it = this->RegisteredOverlays.begin(); it != this->RegisteredOverlays.end(); ) { - if (it->second->type == OverlayType::NOTIFICATION && it->second->duration <= 0.0f) { - it = this->RegisteredOverlays.erase(it); - } else { - ++it; - } + void GameOverlay::TextDrawNotification(float duration, bool shadow, const char* fmt, ...) { + char buf[1024]; + va_list args; + va_start(args, fmt); + vsnprintf(buf, IM_ARRAYSIZE(buf), fmt, args); + buf[IM_ARRAYSIZE(buf) - 1] = 0; + va_end(args); + this->RegisteredOverlays[StringHelper::Sprintf("NotificationID:%d%d", rand(), this->RegisteredOverlays.size())] = new Overlay({ OverlayType::NOTIFICATION, ImStrdup(buf), duration, duration }); + NeedsCleanup = true; } - NeedsCleanup = false; -} -float Ship::GameOverlay::GetScreenWidth() { - const ImGuiViewport* viewport = ImGui::GetMainViewport(); - return viewport->Size.x; -} - -float Ship::GameOverlay::GetScreenHeight() { - const ImGuiViewport* viewport = ImGui::GetMainViewport(); - return viewport->Size.y; -} - -float Ship::GameOverlay::GetStringWidth(const char* text) { - return CalculateTextSize(text).x; -} - -ImVec2 Ship::GameOverlay::CalculateTextSize(const char* text, const char* text_end, bool hide_text_after_double_hash, float wrap_width) { - ImGuiContext& g = *GImGui; - - const char* text_display_end; - if (hide_text_after_double_hash) - text_display_end = ImGui::FindRenderedTextEnd(text, text_end); // Hide anything after a '##' string - else - text_display_end = text_end; - - GameOverlay* overlay = SohImGui::overlay; - - ImFont* font = overlay->CurrentFont == "Default" ? g.Font : overlay->Fonts[overlay->CurrentFont]; - const float font_size = font->FontSize; - if (text == text_display_end) - return ImVec2(0.0f, font_size); - ImVec2 text_size = font->CalcTextSizeA(font_size, FLT_MAX, wrap_width, text, text_display_end, NULL); - - // Round - // FIXME: This has been here since Dec 2015 (7b0bf230) but down the line we want this out. - // FIXME: Investigate using ceilf or e.g. - // - https://git.musl-libc.org/cgit/musl/tree/src/math/ceilf.c - // - https://embarkstudios.github.io/rust-gpu/api/src/libm/math/ceilf.rs.html - text_size.x = IM_FLOOR(text_size.x + 0.99999f); - - return text_size; -} - -void Ship::GameOverlay::Init() { - this->LoadFont("Press Start 2P", "assets/ship_of_harkinian/fonts/PressStart2P-Regular.ttf", 12.0f); - this->LoadFont("Fipps", "assets/ship_of_harkinian/fonts/Fipps-Regular.otf", 32.0f); - const std::string DefaultFont = this->Fonts.begin()->first; - if(!this->Fonts.empty()) { - const std::string font = CVar_GetString("gOverlayFont", ImStrdup(DefaultFont.c_str())); - for (auto& [name, _] : this->Fonts) { - if (font.starts_with(name)) { - this->CurrentFont = name; - break; + void GameOverlay::CleanupNotifications() { + if (!NeedsCleanup) return; + for (auto it = this->RegisteredOverlays.begin(); it != this->RegisteredOverlays.end(); ) { + if (it->second->type == OverlayType::NOTIFICATION && it->second->duration <= 0.0f) { + it = this->RegisteredOverlays.erase(it); } - this->CurrentFont = DefaultFont; - } - } - SohImGui::console->Commands["overlay"] = { OverlayCommand, "Draw an overlay using a cvar value" }; -} - -void Ship::GameOverlay::DrawSettings() { - ImGui::Text("Overlays Text Font"); - if (ImGui::BeginCombo("##TextFont", this->CurrentFont.c_str())) { - for (auto& [name, font] : this->Fonts) { - if (ImGui::Selectable(name.c_str(), name == this->CurrentFont)) { - this->CurrentFont = name; - CVar_SetString("gOverlayFont", ImStrdup(name.c_str())); - SohImGui::needs_save = true; + else { + ++it; } - - } - ImGui::EndCombo(); - } -} - - -void Ship::GameOverlay::Draw() { - const ImGuiViewport* viewport = ImGui::GetMainViewport(); - - ImGui::SetNextWindowPos(viewport->Pos, ImGuiCond_Always); - ImGui::SetNextWindowSize(viewport->Size, ImGuiCond_Always); - ImGui::Begin("SoHOverlay", nullptr, ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoBackground | - ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoInputs); - - this->CleanupNotifications(); - - float textY = 50; - float notY = 0; - - for (auto &[key, overlay] : this->RegisteredOverlays) { - - if (overlay->type == OverlayType::TEXT) { - const char* text = ImStrdup(overlay->value); - const CVar* var = CVar_Get(text); - ImVec4 color = ImVec4(1.0f, 1.0f, 1.0f, 1.0f); - - switch (var->type) { - case CVarType::Float: - this->TextDraw(30, textY, true, color, "%s %.2f", text, var->value.valueFloat); - break; - case CVarType::S32: - this->TextDraw(30, textY, true, color, "%s %d", text, var->value.valueS32); - break; - case CVarType::String: - this->TextDraw(30, textY, true, color, "%s %s", text, var->value.valueStr); - break; - case CVarType::RGBA: - this->TextDraw(30, textY, true, color, "#%08X", text, var->value.valueRGBA); - break; - } - - free((void*) text); - textY += 30; - } - - if (overlay->type == OverlayType::NOTIFICATION && overlay->duration > 0) { - const char* text = overlay->value; - const float duration = overlay->duration / overlay->fadeTime; - - const ImVec4 color = ImVec4(1.0f, 1.0f, 1.0f, duration); - const float textWidth = this->GetStringWidth(overlay->value); - - this->TextDraw(GetScreenWidth() - textWidth - 40, GetScreenHeight() - 40 - notY, true, color, text); - notY += 30; - overlay->duration -= .05f; } + NeedsCleanup = false; } - ImGui::End(); -} - - -bool Ship::OverlayCommand(const std::vector& args) { - if (args.size() < 3) { - return CMD_FAILED; + float GameOverlay::GetScreenWidth() { + const ImGuiViewport* viewport = ImGui::GetMainViewport(); + return viewport->Size.x; } - if (CVar_Get(args[2].c_str()) != nullptr) { - const char* key = args[2].c_str(); + float GameOverlay::GetScreenHeight() { + const ImGuiViewport* viewport = ImGui::GetMainViewport(); + return viewport->Size.y; + } + + float GameOverlay::GetStringWidth(const char* text) { + return CalculateTextSize(text).x; + } + + ImVec2 GameOverlay::CalculateTextSize(const char* text, const char* text_end, bool hide_text_after_double_hash, float wrap_width) { + ImGuiContext& g = *GImGui; + + const char* text_display_end; + if (hide_text_after_double_hash) + text_display_end = ImGui::FindRenderedTextEnd(text, text_end); // Hide anything after a '##' string + else + text_display_end = text_end; + GameOverlay* overlay = SohImGui::overlay; - if (args[1] == "add") { - if (!overlay->RegisteredOverlays.contains(key)) { - overlay->RegisteredOverlays[key] = new Overlay({ OverlayType::TEXT, ImStrdup(key), -1.0f }); - INFO("Added overlay: %s ", key); - } else { - ERROR("Overlay already exists: %s", key); - } - } else if (args[1] == "remove") { - if (overlay->RegisteredOverlays.contains(key)) { - overlay->RegisteredOverlays.erase(key); - INFO("Removed overlay: %s ", key); - } else { - ERROR("Overlay not found: %s ", key); - } - } - } else { - ERROR("CVar %s does not exist", args[2].c_str()); + + ImFont* font = overlay->CurrentFont == "Default" ? g.Font : overlay->Fonts[overlay->CurrentFont]; + const float font_size = font->FontSize; + if (text == text_display_end) + return ImVec2(0.0f, font_size); + ImVec2 text_size = font->CalcTextSizeA(font_size, FLT_MAX, wrap_width, text, text_display_end, NULL); + + // Round + // FIXME: This has been here since Dec 2015 (7b0bf230) but down the line we want this out. + // FIXME: Investigate using ceilf or e.g. + // - https://git.musl-libc.org/cgit/musl/tree/src/math/ceilf.c + // - https://embarkstudios.github.io/rust-gpu/api/src/libm/math/ceilf.rs.html + text_size.x = IM_FLOOR(text_size.x + 0.99999f); + + return text_size; } - return CMD_SUCCESS; -} \ No newline at end of file + void GameOverlay::Init() { + this->LoadFont("Press Start 2P", "assets/ship_of_harkinian/fonts/PressStart2P-Regular.ttf", 12.0f); + this->LoadFont("Fipps", "assets/ship_of_harkinian/fonts/Fipps-Regular.otf", 32.0f); + const std::string DefaultFont = this->Fonts.begin()->first; + if (!this->Fonts.empty()) { + const std::string font = CVar_GetString("gOverlayFont", ImStrdup(DefaultFont.c_str())); + for (auto& [name, _] : this->Fonts) { + if (font.starts_with(name)) { + this->CurrentFont = name; + break; + } + this->CurrentFont = DefaultFont; + } + } + SohImGui::console->Commands["overlay"] = { OverlayCommand, "Draw an overlay using a cvar value" }; + } + + void GameOverlay::DrawSettings() { + ImGui::Text("Overlays Text Font"); + if (ImGui::BeginCombo("##TextFont", this->CurrentFont.c_str())) { + for (auto& [name, font] : this->Fonts) { + if (ImGui::Selectable(name.c_str(), name == this->CurrentFont)) { + this->CurrentFont = name; + CVar_SetString("gOverlayFont", ImStrdup(name.c_str())); + SohImGui::needs_save = true; + } + + } + ImGui::EndCombo(); + } + } + + + void GameOverlay::Draw() { + const ImGuiViewport* viewport = ImGui::GetMainViewport(); + + ImGui::SetNextWindowPos(viewport->Pos, ImGuiCond_Always); + ImGui::SetNextWindowSize(viewport->Size, ImGuiCond_Always); + ImGui::Begin("SoHOverlay", nullptr, ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoBackground | + ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoInputs); + + this->CleanupNotifications(); + + float textY = 50; + float notY = 0; + + for (auto& [key, overlay] : this->RegisteredOverlays) { + + if (overlay->type == OverlayType::TEXT) { + const char* text = ImStrdup(overlay->value); + const CVar* var = CVar_Get(text); + ImVec4 color = ImVec4(1.0f, 1.0f, 1.0f, 1.0f); + + switch (var->type) { + case CVarType::Float: + this->TextDraw(30, textY, true, color, "%s %.2f", text, var->value.valueFloat); + break; + case CVarType::S32: + this->TextDraw(30, textY, true, color, "%s %d", text, var->value.valueS32); + break; + case CVarType::String: + this->TextDraw(30, textY, true, color, "%s %s", text, var->value.valueStr); + break; + case CVarType::RGBA: + this->TextDraw(30, textY, true, color, "#%08X", text, var->value.valueRGBA); + break; + } + + free((void*)text); + textY += 30; + } + + if (overlay->type == OverlayType::NOTIFICATION && overlay->duration > 0) { + const char* text = overlay->value; + const float duration = overlay->duration / overlay->fadeTime; + + const ImVec4 color = ImVec4(1.0f, 1.0f, 1.0f, duration); + const float textWidth = this->GetStringWidth(overlay->value); + + this->TextDraw(GetScreenWidth() - textWidth - 40, GetScreenHeight() - 40 - notY, true, color, text); + notY += 30; + overlay->duration -= .05f; + } + } + + ImGui::End(); + } + + + bool OverlayCommand(const std::vector& args) { + if (args.size() < 3) { + return CMD_FAILED; + } + + if (CVar_Get(args[2].c_str()) != nullptr) { + const char* key = args[2].c_str(); + GameOverlay* overlay = SohImGui::overlay; + if (args[1] == "add") { + if (!overlay->RegisteredOverlays.contains(key)) { + overlay->RegisteredOverlays[key] = new Overlay({ OverlayType::TEXT, ImStrdup(key), -1.0f }); + INFO("Added overlay: %s ", key); + } + else { + ERROR("Overlay already exists: %s", key); + } + } + else if (args[1] == "remove") { + if (overlay->RegisteredOverlays.contains(key)) { + overlay->RegisteredOverlays.erase(key); + INFO("Removed overlay: %s ", key); + } + else { + ERROR("Overlay not found: %s ", key); + } + } + } + else { + ERROR("CVar %s does not exist", args[2].c_str()); + } + + return CMD_SUCCESS; + } +} diff --git a/libultraship/libultraship/GameOverlay.h b/libultraship/libultraship/GameOverlay.h index c9290390e..061d259ba 100644 --- a/libultraship/libultraship/GameOverlay.h +++ b/libultraship/libultraship/GameOverlay.h @@ -3,21 +3,21 @@ #include #include "Lib/ImGui/imgui.h" -#include #include -enum class OverlayType { - TEXT, IMAGE, NOTIFICATION -}; - -struct Overlay { - OverlayType type; - const char* value; - float fadeTime; - float duration; -}; - namespace Ship { + + enum class OverlayType { + TEXT, IMAGE, NOTIFICATION + }; + + struct Overlay { + OverlayType type; + const char* value; + float fadeTime; + float duration; + }; + class GameOverlay { public: std::unordered_map RegisteredOverlays; diff --git a/libultraship/libultraship/GameSettings.cpp b/libultraship/libultraship/GameSettings.cpp deleted file mode 100644 index e3f95ad76..000000000 --- a/libultraship/libultraship/GameSettings.cpp +++ /dev/null @@ -1,56 +0,0 @@ -#include "GameSettings.h" - -// Audio -#include -#include -#include -#include -#include - -#include "Cvar.h" -#include "GlobalCtx2.h" -#include "ImGuiImpl.h" -#include "../../soh/include/z64audio.h" -#include "Hooks.h" -#include "../../soh/soh/Enhancements/debugconsole.h" - -#include "Window.h" -#include "Lib/Fast3D/gfx_rendering_api.h" - -#define ABS(var) var < 0 ? -(var) : var - -using namespace Ship; - -namespace Game { - - bool DeSyncAudio = false; - - void UpdateAudio() { - Audio_SetGameVolume(SEQ_BGM_MAIN, CVar_GetFloat("gMainMusicVolume", 1)); - Audio_SetGameVolume(SEQ_BGM_SUB, CVar_GetFloat("gSubMusicVolume", 1)); - Audio_SetGameVolume(SEQ_FANFARE, CVar_GetFloat("gSFXMusicVolume", 1)); - Audio_SetGameVolume(SEQ_SFX, CVar_GetFloat("gFanfareVolume", 1)); - } - - void LoadSettings() { - DebugConsole_LoadCVars(); - } - - void SaveSettings() { - DebugConsole_SaveCVars(); - } - - void InitSettings() { - ModInternal::RegisterHook(UpdateAudio); - ModInternal::RegisterHook([] { - gfx_get_current_rendering_api()->set_texture_filter((FilteringMode) CVar_GetS32("gTextureFilter", FILTER_THREE_POINT)); - SohImGui::console->opened = CVar_GetS32("gConsoleEnabled", 0); - SohImGui::controller->Opened = CVar_GetS32("gControllerConfigurationEnabled", 0); - UpdateAudio(); - }); - } - - void SetSeqPlayerVolume(SeqPlayers playerId, float volume) { - Audio_SetGameVolume(playerId, volume); - } -} diff --git a/libultraship/libultraship/GameSettings.h b/libultraship/libultraship/GameSettings.h deleted file mode 100644 index 0a9aa0ee6..000000000 --- a/libultraship/libultraship/GameSettings.h +++ /dev/null @@ -1,17 +0,0 @@ -#pragma once - -enum SeqPlayers { - /* 0 */ SEQ_BGM_MAIN, - /* 1 */ SEQ_FANFARE, - /* 2 */ SEQ_SFX, - /* 3 */ SEQ_BGM_SUB, - /* 4 */ SEQ_MAX - }; - -namespace Game { - void InitSettings(); - void LoadSettings(); - void LoadPadSettings(); - void SaveSettings(); - void SetSeqPlayerVolume(SeqPlayers playerId, float volume); -} diff --git a/libultraship/libultraship/GlobalCtx2.cpp b/libultraship/libultraship/GlobalCtx2.cpp index 5eb449ad3..4d6046de3 100644 --- a/libultraship/libultraship/GlobalCtx2.cpp +++ b/libultraship/libultraship/GlobalCtx2.cpp @@ -7,7 +7,6 @@ #include "spdlog/sinks/rotating_file_sink.h" #include "spdlog/sinks/stdout_color_sinks.h" #include "spdlog/sinks/sohconsole_sink.h" -#include "ModManager.h" #ifdef __APPLE__ #include "OSXFolderManager.h" #elif defined(__SWITCH__) @@ -16,7 +15,6 @@ namespace Ship { std::weak_ptr GlobalCtx2::Context; - ModManager* INSTANCE; std::shared_ptr GlobalCtx2::GetInstance() { return Context.lock(); } @@ -56,7 +54,6 @@ namespace Ship { GlobalCtx2::~GlobalCtx2() { SPDLOG_INFO("destruct GlobalCtx2"); - INSTANCE->Exit(); } void GlobalCtx2::InitWindow() { @@ -84,8 +81,6 @@ namespace Ship { #ifdef __SWITCH__ Ship::Switch::Init(PostInitPhase); #endif - INSTANCE = new ModManager(ResMan); - INSTANCE->Init(); } void GlobalCtx2::InitLogging() { diff --git a/libultraship/libultraship/Hooks.cpp b/libultraship/libultraship/Hooks.cpp deleted file mode 100644 index 2b66ed318..000000000 --- a/libultraship/libultraship/Hooks.cpp +++ /dev/null @@ -1,10 +0,0 @@ -#include "Hooks.h" -#include -#include -#include -#include -#include - -void ModInternal_ExecuteAudioInitHooks() { - ModInternal::ExecuteHooks(); -} diff --git a/libultraship/libultraship/Hooks.h b/libultraship/libultraship/Hooks.h index 411cffe42..5f29a831c 100644 --- a/libultraship/libultraship/Hooks.h +++ b/libultraship/libultraship/Hooks.h @@ -1,15 +1,12 @@ #pragma once -#ifdef __cplusplus - #include - #include "UltraController.h" -#include "Controller.h" #define DEFINE_HOOK(name, type) struct name { typedef std::function fn; } -namespace ModInternal { +namespace Ship { + class Controller; template struct RegisteredHooks { @@ -29,22 +26,9 @@ namespace ModInternal { } DEFINE_HOOK(ControllerRead, void(OSContPad* cont_pad)); - DEFINE_HOOK(ControllerRawInput, void(Ship::Controller* backend, uint32_t raw)); + DEFINE_HOOK(ControllerRawInput, void(Controller* backend, uint32_t raw)); DEFINE_HOOK(AudioInit, void()); DEFINE_HOOK(LoadTexture, void(const char* path, uint8_t** texture)); DEFINE_HOOK(GfxInit, void()); DEFINE_HOOK(ExitGame, void()); - } - -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -void ModInternal_ExecuteAudioInitHooks(); - -#ifdef __cplusplus -} -#endif diff --git a/libultraship/libultraship/ImGuiImpl.cpp b/libultraship/libultraship/ImGuiImpl.cpp index ef1aec431..032ca119c 100644 --- a/libultraship/libultraship/ImGuiImpl.cpp +++ b/libultraship/libultraship/ImGuiImpl.cpp @@ -7,16 +7,19 @@ #include #include +#include +#include +#include +#include +#include +#include "../../soh/include/z64audio.h" #include "Archive.h" -#include "Environment.h" -#include "GameSettings.h" #include "Console.h" #include "Hooks.h" #define IMGUI_DEFINE_MATH_OPERATORS #include "Lib/ImGui/imgui_internal.h" #include "GlobalCtx2.h" #include "ResourceMgr.h" -#include "TextureMod.h" #include "Window.h" #include "Cvar.h" #include "GameOverlay.h" @@ -25,7 +28,7 @@ #include "Lib/stb/stb_image.h" #include "Lib/Fast3D/gfx_rendering_api.h" #include "Lib/spdlog/include/spdlog/common.h" -#include "Utils/StringHelper.h" +#include "UltraController.h" #if __APPLE__ #include @@ -70,6 +73,14 @@ std::vector emptyArgs; bool isBetaQuestEnabled = false; +enum SeqPlayers { + /* 0 */ SEQ_BGM_MAIN, + /* 1 */ SEQ_FANFARE, + /* 2 */ SEQ_SFX, + /* 3 */ SEQ_BGM_SUB, + /* 4 */ SEQ_MAX +}; + extern "C" { void enableBetaQuest() { isBetaQuestEnabled = true; } void disableBetaQuest() { isBetaQuestEnabled = false; } @@ -117,6 +128,23 @@ namespace SohImGui { std::map> windowCategories; std::map customWindows; + void UpdateAudio() { + Audio_SetGameVolume(SEQ_BGM_MAIN, CVar_GetFloat("gMainMusicVolume", 1)); + Audio_SetGameVolume(SEQ_BGM_SUB, CVar_GetFloat("gSubMusicVolume", 1)); + Audio_SetGameVolume(SEQ_FANFARE, CVar_GetFloat("gSFXMusicVolume", 1)); + Audio_SetGameVolume(SEQ_SFX, CVar_GetFloat("gFanfareVolume", 1)); + } + + void InitSettings() { + Ship::RegisterHook(UpdateAudio); + Ship::RegisterHook([] { + gfx_get_current_rendering_api()->set_texture_filter((FilteringMode)CVar_GetS32("gTextureFilter", FILTER_THREE_POINT)); + SohImGui::console->opened = CVar_GetS32("gConsoleEnabled", 0); + SohImGui::controller->Opened = CVar_GetS32("gControllerConfigurationEnabled", 0); + UpdateAudio(); + }); + } + int GetBackendID(std::shared_ptr cfg) { std::string backend = cfg->getString("Window.GfxBackend"); if (backend.empty()) { @@ -349,7 +377,7 @@ namespace SohImGui { } void Init(WindowImpl window_impl) { - Game::LoadSettings(); + CVar_Load(); impl = window_impl; ImGuiContext* ctx = ImGui::CreateContext(); ImGui::SetCurrentContext(ctx); @@ -386,7 +414,7 @@ namespace SohImGui { ImGui::GetStyle().ScaleAllSizes(2); #endif - ModInternal::RegisterHook([] { + Ship::RegisterHook([] { if (GlobalCtx2::GetInstance()->GetWindow()->IsFullscreen()) ShowCursor(CVar_GetS32("gOpenMenuBar", 0), Dialogues::dLoadSettings); @@ -403,11 +431,11 @@ namespace SohImGui { LoadTexture("C-Down", "assets/ship_of_harkinian/buttons/CDown.png"); }); - ModInternal::RegisterHook([](OSContPad* cont_pad) { + Ship::RegisterHook([](OSContPad* cont_pad) { pads = cont_pad; }); - Game::InitSettings(); + InitSettings(); CVar_SetS32("gRandoGenerating", 0); CVar_SetS32("gNewSeedGenerated", 0); @@ -421,7 +449,7 @@ namespace SohImGui { void Update(EventImpl event) { if (needs_save) { - Game::SaveSettings(); + CVar_Save(); needs_save = false; } ImGuiProcessEvent(event); @@ -438,11 +466,10 @@ namespace SohImGui { const float volume = floorf(value * 100) / 100; CVar_SetFloat(key, volume); needs_save = true; - Game::SetSeqPlayerVolume(playerId, volume); + Audio_SetGameVolume(playerId, volume); } } - void EnhancementCombobox(const char* name, const char* ComboArray[], size_t arraySize, uint8_t FirstTimeValue = 0) { if (FirstTimeValue <= 0) { FirstTimeValue = 0; @@ -792,7 +819,7 @@ namespace SohImGui { bool menu_bar = CVar_GetS32("gOpenMenuBar", 0); CVar_SetS32("gOpenMenuBar", !menu_bar); needs_save = true; - GlobalCtx2::GetInstance()->GetWindow()->dwMenubar = menu_bar; + GlobalCtx2::GetInstance()->GetWindow()->SetMenuBar(menu_bar); ShowCursor(menu_bar, Dialogues::dMenubar); GlobalCtx2::GetInstance()->GetWindow()->GetControlDeck()->SaveControllerSettings(); if (CVar_GetS32("gControlNav", 0)) { @@ -1014,6 +1041,9 @@ namespace SohImGui { Tooltip("Allow Link to put items away without having to wait around"); EnhancementCheckbox("Mask Select in Inventory", "gMaskSelect"); Tooltip("After completing the mask trading sub-quest, press A and any direction on the mask slot to change masks"); + EnhancementCheckbox("Remember Save Location", "gRememberSaveLocation"); + Tooltip("When loading a save, places Link at the last entrance he went through.\n" + "This doesn't work if the save was made in a grotto."); ImGui::EndMenu(); } @@ -1266,6 +1296,12 @@ namespace SohImGui { ImGui::EndMenu(); } + EnhancementCheckbox("Autosave", "gAutosave"); + Tooltip("Automatically save the game every time a new area is entered or item is obtained\n" + "To disable saving when obtaining an item, manually set gAutosaveAllItems and gAutosaveMajorItems to 0\n" + "gAutosaveAllItems takes priority over gAutosaveMajorItems if both are set to 1\n" + "gAutosaveMajorItems excludes rupees and health/magic/ammo refills (but includes bombchus)"); + EXPERIMENTAL(); const char* fps_cvar = "gInterpolationFPS"; @@ -1414,6 +1450,9 @@ namespace SohImGui { Tooltip("Prevents the Deku Shield from burning on contact with fire"); EnhancementCheckbox("Shield with Two-Handed Weapons", "gShieldTwoHanded"); Tooltip("This allows you to put up your shield with any two-handed weapon in hand except for Deku Sticks"); + Tooltip("This allows you to put up your shield with any two-handed weapon in hand\nexcept for Deku Sticks"); + EnhancementCheckbox("Time Sync", "gTimeSync"); + Tooltip("This syncs the ingame time with the real world time"); { static int32_t betaQuestEnabled = CVar_GetS32("gEnableBetaQuest", 0); @@ -1626,12 +1665,10 @@ namespace SohImGui { pos = ImVec2(size.x / 2 - sw / 2, 0); size = ImVec2(sw, size.y); } - std::string fb_str = SohUtils::getEnvironmentVar("framebuffer"); - if (!fb_str.empty()) { - uintptr_t fbuf = (uintptr_t)std::stoull(fb_str); - //ImGui::ImageSimple(reinterpret_cast(fbuf), pos, size); + if (gfxFramebuffer) { + //ImGui::ImageSimple(reinterpret_cast(gfxFramebuffer), pos, size); ImGui::SetCursorPos(pos); - ImGui::Image(reinterpret_cast(fbuf), size); + ImGui::Image(reinterpret_cast(gfxFramebuffer), size); } ImGui::End(); diff --git a/libultraship/libultraship/ImGuiImpl.h b/libultraship/libultraship/ImGuiImpl.h index 01235d411..6913fce61 100644 --- a/libultraship/libultraship/ImGuiImpl.h +++ b/libultraship/libultraship/ImGuiImpl.h @@ -69,7 +69,7 @@ namespace SohImGui { WindowDrawFunc drawFunc; } CustomWindow; - extern Console* console; + extern Ship::Console* console; extern Ship::InputEditor* controller; extern Ship::GameOverlay* overlay; extern bool needs_save; @@ -92,7 +92,7 @@ namespace SohImGui { void Render(void); void CancelFrame(void); void ShowCursor(bool hide, Dialogues w); - void BindCmd(const std::string& cmd, CommandEntry entry); + void BindCmd(const std::string& cmd, Ship::CommandEntry entry); void AddWindow(const std::string& category, const std::string& name, WindowDrawFunc drawFunc, bool isEnabled=false, bool isHidden=false); void LoadResource(const std::string& name, const std::string& path, const ImVec4& tint = ImVec4(1, 1, 1, 1)); void LoadPickersColors(ImVec4& ColorArray, const char* cvarname, const ImVec4& default_colors, bool has_alpha=false); diff --git a/libultraship/libultraship/InputEditor.cpp b/libultraship/libultraship/InputEditor.cpp index eb191cc20..9186e2b22 100644 --- a/libultraship/libultraship/InputEditor.cpp +++ b/libultraship/libultraship/InputEditor.cpp @@ -16,8 +16,8 @@ namespace Ship { } std::shared_ptr GetControllerPerSlot(int slot) { - const std::vector vDevices = Window::ControllerApi->virtualDevices; - return Window::ControllerApi->physicalDevices[vDevices[slot]]; + auto controlDeck = Ship::GlobalCtx2::GetInstance()->GetWindow()->GetControlDeck(); + return controlDeck->GetPhysicalDeviceFromVirtualSlot(slot); } void InputEditor::DrawButton(const char* label, int n64Btn) { @@ -82,20 +82,21 @@ namespace Ship { } void InputEditor::DrawControllerSchema() { - - const std::vector vDevices = Window::ControllerApi->virtualDevices; - const std::vector> devices = Window::ControllerApi->physicalDevices; - - std::shared_ptr Backend = devices[vDevices[CurrentPort]]; - DeviceProfile& profile =Backend->profiles[CurrentPort]; + auto controlDeck = Ship::GlobalCtx2::GetInstance()->GetWindow()->GetControlDeck(); + auto Backend = controlDeck->GetPhysicalDeviceFromVirtualSlot(CurrentPort); + DeviceProfile& profile = Backend->profiles[CurrentPort]; float sensitivity = profile.Thresholds[SENSITIVITY]; bool IsKeyboard = Backend->GetGuid() == "Keyboard" || Backend->GetGuid() == "Auto" || !Backend->Connected(); const char* ControllerName = Backend->GetControllerName(); if (ControllerName != nullptr && ImGui::BeginCombo("##ControllerEntries", ControllerName)) { - for (uint8_t i = 0; i < devices.size(); i++) { - if (ImGui::Selectable(devices[i]->GetControllerName(), i == vDevices[CurrentPort])) { - Window::ControllerApi->SetPhysicalDevice(CurrentPort, i); + for (uint8_t i = 0; i < controlDeck->GetNumPhysicalDevices(); i++) { + std::string DeviceName = controlDeck->GetPhysicalDevice(i)->GetControllerName(); + if (DeviceName != "Keyboard" && DeviceName != "Auto") { + DeviceName+="##"+std::to_string(i); + } + if (ImGui::Selectable(DeviceName.c_str(), i == controlDeck->GetVirtualDevice(CurrentPort))) { + controlDeck->SetPhysicalDevice(CurrentPort, i); } } ImGui::EndCombo(); @@ -104,7 +105,7 @@ namespace Ship { ImGui::SameLine(); if(ImGui::Button("Refresh")) { - Window::ControllerApi->ScanPhysicalDevices(); + controlDeck->ScanPhysicalDevices(); } SohImGui::BeginGroupPanel("Buttons", ImVec2(150, 20)); diff --git a/libultraship/libultraship/InputEditor.h b/libultraship/libultraship/InputEditor.h index 39bddd51d..81b1997ec 100644 --- a/libultraship/libultraship/InputEditor.h +++ b/libultraship/libultraship/InputEditor.h @@ -1,7 +1,5 @@ #pragma once -#include - #include "Lib/ImGui/imgui.h" namespace Ship { diff --git a/libultraship/libultraship/Lib/Fast3D/gfx_dxgi.cpp b/libultraship/libultraship/Lib/Fast3D/gfx_dxgi.cpp index 6e0c2e4d6..3e81f56fa 100644 --- a/libultraship/libultraship/Lib/Fast3D/gfx_dxgi.cpp +++ b/libultraship/libultraship/Lib/Fast3D/gfx_dxgi.cpp @@ -32,7 +32,6 @@ #define DECLARE_GFX_DXGI_FUNCTIONS #include "gfx_dxgi.h" -#include "../../GameSettings.h" #define WINCLASS_NAME L"N64GAME" #define GFX_API_NAME "DirectX" @@ -240,8 +239,8 @@ static LRESULT CALLBACK gfx_dxgi_wnd_proc(HWND h_wnd, UINT message, WPARAM w_par dxgi.current_height = (uint32_t)(l_param >> 16); break; case WM_DESTROY: - ModInternal::ExecuteHooks(); - exit(0); + PostQuitMessage(0); + break; case WM_PAINT: if (dxgi.in_paint) { dxgi.recursive_paint_detected = true; @@ -274,7 +273,7 @@ static LRESULT CALLBACK gfx_dxgi_wnd_proc(HWND h_wnd, UINT message, WPARAM w_par DragQueryFileA((HDROP)w_param, 0, fileName, 256); CVar_SetString("gDroppedFile", fileName); CVar_SetS32("gNewFileDropped", 1); - Game::SaveSettings(); + CVar_Save(); break; case WM_SYSKEYDOWN: if ((w_param == VK_RETURN) && ((l_param & 1 << 30) == 0)) { @@ -358,7 +357,6 @@ static void gfx_dxgi_show_cursor(bool hide) { * @bug When menubar is open in windowed mode and you toggle fullscreen * ShowCursor no longer responds. Debugging shows the bool to be correct. **/ - INFO("renderer: %s", hide ? "true" : "false"); ShowCursor(hide); } @@ -380,6 +378,8 @@ static void gfx_dxgi_main_loop(void (*run_one_game_iter)(void)) { TranslateMessage(&msg); DispatchMessage(&msg); } + + Ship::ExecuteHooks(); } static void gfx_dxgi_get_dimensions(uint32_t *width, uint32_t *height) { diff --git a/libultraship/libultraship/Lib/Fast3D/gfx_opengl.cpp b/libultraship/libultraship/Lib/Fast3D/gfx_opengl.cpp index ad683e047..7b70ba11b 100644 --- a/libultraship/libultraship/Lib/Fast3D/gfx_opengl.cpp +++ b/libultraship/libultraship/Lib/Fast3D/gfx_opengl.cpp @@ -29,7 +29,7 @@ #define GL_GLEXT_PROTOTYPES 1 #include "SDL_opengl.h" #elif __APPLE__ -#include +#include #include #elif __SWITCH__ #include @@ -44,7 +44,6 @@ #include "gfx_cc.h" #include "gfx_rendering_api.h" #include "../../ImGuiImpl.h" -#include "../../Environment.h" #include "../../GlobalCtx2.h" #include "gfx_pc.h" diff --git a/libultraship/libultraship/Lib/Fast3D/gfx_pc.cpp b/libultraship/libultraship/Lib/Fast3D/gfx_pc.cpp index 10ba45ec5..8aebec9e2 100644 --- a/libultraship/libultraship/Lib/Fast3D/gfx_pc.cpp +++ b/libultraship/libultraship/Lib/Fast3D/gfx_pc.cpp @@ -32,7 +32,6 @@ #include "../../luslog.h" #include "../StrHash64.h" #include "../../ImGuiImpl.h" -#include "../../Environment.h" #include "../../GameVersions.h" #include "../../ResourceMgr.h" #include "../../Utils.h" @@ -49,6 +48,8 @@ extern "C" { int ResourceMgr_OTRSigCheck(char* imgData); } +uintptr_t gfxFramebuffer; + using namespace std; #define SEG_ADDR(seg, addr) (addr | (seg << 24) | 1) @@ -1065,8 +1066,8 @@ static void gfx_sp_vertex(size_t n_vertices, size_t dest_index, const Vtx *verti dotx /= 127.0f; doty /= 127.0f; - dotx = math::clamp(dotx, -1.0f, 1.0f); - doty = math::clamp(doty, -1.0f, 1.0f); + dotx = Ship::Math::clamp(dotx, -1.0f, 1.0f); + doty = Ship::Math::clamp(doty, -1.0f, 1.0f); if (rsp.geometry_mode & G_TEXTURE_GEN_LINEAR) { // Not sure exactly what formula we should use to get accurate values @@ -1118,7 +1119,7 @@ static void gfx_sp_vertex(size_t n_vertices, size_t dest_index, const Vtx *verti if (winv < 0.0f) winv = std::numeric_limits::max(); float fog_z = z * winv * rsp.fog_mul + rsp.fog_offset; - fog_z = math::clamp(fog_z, 0.0f, 255.0f); + fog_z = Ship::Math::clamp(fog_z, 0.0f, 255.0f); d->color.a = fog_z; // Use alpha variable to store fog factor } else { d->color.a = v->cn[3]; @@ -2698,7 +2699,7 @@ void gfx_init(struct GfxWindowManagerAPI *wapi, struct GfxRenderingAPI *rapi, co //gfx_lookup_or_create_shader_program(precomp_shaders[i]); } - ModInternal::ExecuteHooks(); + Ship::ExecuteHooks(); } struct GfxRenderingAPI *gfx_get_current_rendering_api(void) { @@ -2782,7 +2783,7 @@ void gfx_run(Gfx *commands, const std::unordered_map& mtx_replaceme rendering_state.scissor = {}; gfx_run_dl(commands); gfx_flush(); - SohUtils::saveEnvironmentVar("framebuffer", string()); + gfxFramebuffer = 0; if (game_renders_to_framebuffer) { gfx_rapi->start_draw_to_framebuffer(0, 1); gfx_rapi->clear_framebuffer(); @@ -2792,12 +2793,12 @@ void gfx_run(Gfx *commands, const std::unordered_map& mtx_replaceme if (different_size) { gfx_rapi->resolve_msaa_color_buffer(game_framebuffer_msaa_resolved, game_framebuffer); - SohUtils::saveEnvironmentVar("framebuffer", std::to_string((uintptr_t)gfx_rapi->get_framebuffer_texture_id(game_framebuffer_msaa_resolved))); + gfxFramebuffer = (uintptr_t)gfx_rapi->get_framebuffer_texture_id(game_framebuffer_msaa_resolved); } else { gfx_rapi->resolve_msaa_color_buffer(0, game_framebuffer); } } else { - SohUtils::saveEnvironmentVar("framebuffer", std::to_string((uintptr_t)gfx_rapi->get_framebuffer_texture_id(game_framebuffer))); + gfxFramebuffer = (uintptr_t)gfx_rapi->get_framebuffer_texture_id(game_framebuffer); } } SohImGui::DrawFramebufferAndGameInput(); diff --git a/libultraship/libultraship/Lib/Fast3D/gfx_pc.h b/libultraship/libultraship/Lib/Fast3D/gfx_pc.h index 4e620ef2d..feab8e3d9 100644 --- a/libultraship/libultraship/Lib/Fast3D/gfx_pc.h +++ b/libultraship/libultraship/Lib/Fast3D/gfx_pc.h @@ -14,6 +14,8 @@ #define SCREEN_WIDTH 320 #define SCREEN_HEIGHT 240 +extern uintptr_t gfxFramebuffer; + struct GfxRenderingAPI; struct GfxWindowManagerAPI; diff --git a/libultraship/libultraship/Lib/Fast3D/gfx_sdl2.cpp b/libultraship/libultraship/Lib/Fast3D/gfx_sdl2.cpp index 2576bc17b..23cff4698 100644 --- a/libultraship/libultraship/Lib/Fast3D/gfx_sdl2.cpp +++ b/libultraship/libultraship/Lib/Fast3D/gfx_sdl2.cpp @@ -35,8 +35,6 @@ #ifdef _WIN32 #include #endif -#include -#include "../../GameSettings.h" #define GFX_API_NAME "SDL2 - OpenGL" @@ -239,7 +237,9 @@ static void gfx_sdl_main_loop(void (*run_one_game_iter)(void)) { #ifdef __SWITCH__ Ship::Switch::Exit(); #endif - ModInternal::ExecuteHooks(); + Ship::ExecuteHooks(); + + SDL_Quit(); } static void gfx_sdl_get_dimensions(uint32_t *width, uint32_t *height) { @@ -306,12 +306,11 @@ static void gfx_sdl_handle_events(void) { case SDL_DROPFILE: CVar_SetString("gDroppedFile", event.drop.file); CVar_SetS32("gNewFileDropped", 1); - Game::SaveSettings(); + CVar_Save(); break; case SDL_QUIT: - ModInternal::ExecuteHooks(); - SDL_Quit(); // bandaid fix for linux window closing issue - exit(0); + is_running = false; + break; } } } diff --git a/libultraship/libultraship/Lib/spdlog/include/spdlog/sinks/sohconsole_sink.h b/libultraship/libultraship/Lib/spdlog/include/spdlog/sinks/sohconsole_sink.h index b9d3cdbf3..7b5da63fd 100644 --- a/libultraship/libultraship/Lib/spdlog/include/spdlog/sinks/sohconsole_sink.h +++ b/libultraship/libultraship/Lib/spdlog/include/spdlog/sinks/sohconsole_sink.h @@ -9,7 +9,6 @@ #include #include #include "ImGuiImpl.h" -#include "GameSettings.h" #include "Cvar.h" #include #include @@ -34,7 +33,7 @@ public: protected: void sink_it_(const details::log_msg &msg) override { - const Priority priority = convert_to_soh(msg.level); + const Ship::Priority priority = convert_to_soh(msg.level); memory_buf_t formatted; if (use_raw_msg_) { @@ -53,24 +52,25 @@ protected: void flush_() override {} private: - static Priority convert_to_soh(spdlog::level::level_enum level) { + static Ship::Priority convert_to_soh(spdlog::level::level_enum level) + { switch (level) { case spdlog::level::trace: - return Priority::INFO_LVL; + return Ship::Priority::INFO_LVL; case spdlog::level::debug: - return Priority::LOG_LVL; + return Ship::Priority::LOG_LVL; case spdlog::level::info: - return Priority::LOG_LVL; + return Ship::Priority::LOG_LVL; case spdlog::level::warn: - return Priority::WARNING_LVL; + return Ship::Priority::WARNING_LVL; case spdlog::level::err: - return Priority::ERROR_LVL; + return Ship::Priority::ERROR_LVL; case spdlog::level::critical: - return Priority::ERROR_LVL; + return Ship::Priority::ERROR_LVL; default: break; } - return Priority::LOG_LVL; + return Ship::Priority::LOG_LVL; } std::string tag_; diff --git a/libultraship/libultraship/ModManager.cpp b/libultraship/libultraship/ModManager.cpp deleted file mode 100644 index 8aa2715de..000000000 --- a/libultraship/libultraship/ModManager.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include "ModManager.h" -#include "TextureMod.h" -#include "ModModule.h" -#include "ImGuiImpl.h" - -namespace Ship { - std::vector modules; - - void ModManager::Init() { - // ResManager->GetArchive()->loa - // modules.push_back(new TextureModule(this)); - // std::shared_ptr archive = std::make_shared("mods/TexMods.otr", "", false); - for (auto& mod : modules) { - mod->Init(); - // mod->Open(archive); - } - } - - void ModManager::Exit() { - for (auto& mod : modules) - mod->Exit(); - } -} \ No newline at end of file diff --git a/libultraship/libultraship/ModManager.h b/libultraship/libultraship/ModManager.h deleted file mode 100644 index ca25355b5..000000000 --- a/libultraship/libultraship/ModManager.h +++ /dev/null @@ -1,12 +0,0 @@ -#pragma once -#include "ResourceMgr.h" - -namespace Ship { - class ModManager { - public: - std::shared_ptr ResManager; - explicit ModManager(std::shared_ptr manager) : ResManager(manager) {} - void Init(); - void Exit(); - }; -} \ No newline at end of file diff --git a/libultraship/libultraship/ModModule.h b/libultraship/libultraship/ModModule.h deleted file mode 100644 index da62273db..000000000 --- a/libultraship/libultraship/ModModule.h +++ /dev/null @@ -1,19 +0,0 @@ -#pragma once -#include "ModManager.h" -#include "Hooks.h" -#include "Console.h" -#include "Archive.h" - -namespace Ship { - class ModModule { - protected: - ModManager* Manager; - public: - virtual ~ModModule() = default; - explicit ModModule(ModManager* Manager) : Manager(Manager) {} - virtual void Init() = 0; - virtual void Open(std::shared_ptr archive) = 0; - virtual void Close(Ship::Archive archive) = 0; - virtual void Exit() = 0; - }; -} \ No newline at end of file diff --git a/libultraship/libultraship/SDLAudioPlayer.h b/libultraship/libultraship/SDLAudioPlayer.h index 0bb6d3665..05e4befd3 100644 --- a/libultraship/libultraship/SDLAudioPlayer.h +++ b/libultraship/libultraship/SDLAudioPlayer.h @@ -1,10 +1,6 @@ #pragma once #include "AudioPlayer.h" -#if __APPLE__ -#include -#else #include -#endif namespace Ship { class SDLAudioPlayer : public AudioPlayer { diff --git a/libultraship/libultraship/SDLController.h b/libultraship/libultraship/SDLController.h index e5d24c946..b5005e323 100644 --- a/libultraship/libultraship/SDLController.h +++ b/libultraship/libultraship/SDLController.h @@ -1,10 +1,6 @@ #pragma once #include "Controller.h" -#if __APPLE__ -#include -#else #include -#endif namespace Ship { class SDLController : public Controller { diff --git a/libultraship/libultraship/TextureMod.cpp b/libultraship/libultraship/TextureMod.cpp deleted file mode 100644 index 87f17ed2c..000000000 --- a/libultraship/libultraship/TextureMod.cpp +++ /dev/null @@ -1,128 +0,0 @@ -#include "TextureMod.h" - -#if 0 - -#include -#include -#include -#include -#include -#include "Lib/stb/stb_image.h" -#include "Lib/Fast3D/gfx_pc.h" -#define STB_IMAGE_WRITE_IMPLEMENTATION -#include "Lib/stb/stb_image_write.h" -#include "Lib/Fast3D/gfx_rendering_api.h" -#include "SohImGuiImpl.h" - -namespace fs = std::filesystem; - -namespace Ship { - void TextureModule::Init() { - BIND_HOOK(LOOKUP_TEXTURE, Hook_LookupTexture); - BIND_HOOK(GRAYOUT_TEXTURE, Hook_GrayScaleFilter); - BIND_HOOK(INVALIDATE_TEXTURE, Hook_InvalidateTexture); - - SohImGui::BindCmd("reload", { .handler = [&](const std::vector&) { - INFO("Reloading all textures!"); - gfx_texture_cache_clear(); - this->TexturePool.clear(); - this->TextureCache.clear(); - return true; - } }); - } - - void TextureModule::Open(std::shared_ptr archive) { - this->LoadedOTRS.push_back(archive); - } - - void TextureModule::Close(Ship::Archive otr) { - // Remove all loaded textures - // this->LoadedOTRS.erase(std::find(this->LoadedOTRS.begin(), this->LoadedOTRS.end(), otr)); - } - - void TextureModule::Hook_LookupTexture(HookEvent call) { - const auto raw_path = BIND_PTR("path", char*); - if (raw_path == nullptr) return; - - const auto api = BIND_PTR("gfx_api", GfxRenderingAPI*); - const auto path = std::string(raw_path) + ".png"; - const auto node = BIND_PTR("node", TextureCacheNode**); - const auto fmt = BIND_VAR("fmt", uint32_t*); - const auto siz = BIND_VAR("siz", uint32_t*); - const auto tile = BIND_VAR("tile", int*); - const auto palette = BIND_VAR("palette", uint32_t*); - const auto orig_addr = BIND_VAR("addr", const uint8_t**); - - // INFO("The game is trying to load %s", path.c_str()); - - if (this->TextureCache.contains(path) && this->TextureCache[path][tile] != nullptr) { - *node = this->TextureCache[path][tile]; - api->select_texture(tile, (*node)->second.texture_id); - call->cancelled = true; - return; - } - - // OTRTODO: Implement loading order - TextureData* tex_data = nullptr; - if (!this->TexturePool.contains(path)) { - std::shared_ptr raw_data = std::make_shared(); - this->Manager->ResManager->GetArchive()->LoadPatchFile(path, false, raw_data); - - if (raw_data->bIsLoaded) { - char* tdata = new char[raw_data->dwBufferSize]; - memcpy(tdata, raw_data->buffer.get(), raw_data->dwBufferSize); - tex_data = new TextureData({ .data = tdata, .size = raw_data->dwBufferSize }); - INFO("Loaded %s", path.c_str()); - this->TexturePool[path] = tex_data; - } - } - - if (tex_data == nullptr) - return; - - if (!this->TextureCache.contains(path)) this->TextureCache[path].resize(10); - - TextureCacheKey key = { orig_addr, { }, static_cast(fmt), static_cast(siz), static_cast(palette) }; - TextureCacheValue value = { api->new_texture(), 0, 0, false }; - const auto entry = new TextureCacheNode(key, value); - api->select_texture(tile, entry->second.texture_id); - api->set_sampler_parameters(tile, false, 0, 0); - *node = entry; - - uint8_t* img_data = stbi_load_from_memory(reinterpret_cast(tex_data->data), tex_data->size, &tex_data->width, &tex_data->height, nullptr, 4); - - if (!img_data) - return; - - switch (tex_data->color_modifier) { - case GRAYSCALE: { - GrayOutTexture(img_data, tex_data->width, tex_data->height); - } - default:; - } - - std::cout << "Uploading to the GPU" << std::endl; - api->upload_texture(img_data, tex_data->width, tex_data->height); - this->TextureCache[path][tile] = entry; - - stbi_image_free(img_data); - call->cancelled = true; - } - - - void TextureModule::Hook_GrayScaleFilter(HookEvent event) { - // this->Exit(); - } - - void TextureModule::Hook_InvalidateTexture(HookEvent event) { - // this->Exit(); - } - - void TextureModule::Exit() { - TextureCache.clear(); - TexturePool.clear(); - LoadedOTRS.clear(); - } -} - -#endif diff --git a/libultraship/libultraship/TextureMod.h b/libultraship/libultraship/TextureMod.h deleted file mode 100644 index 5f41873ca..000000000 --- a/libultraship/libultraship/TextureMod.h +++ /dev/null @@ -1,55 +0,0 @@ -#pragma once -#include "ModModule.h" -#include -#include "Lib/Fast3D/gfx_pc.h" - -#if 0 - -namespace Ship { - enum TextureMod { - GRAYSCALE, - NONE - }; - - struct TextureData { - char* data; - uint32_t size; - int width; - int height; - char* loaded_data; - std::shared_ptr parent; - TextureMod color_modifier = NONE; - }; - - class TextureModule : public ModModule { - public: - explicit TextureModule(ModManager* Manager) : ModModule(Manager) {} - private: - std::vector> LoadedOTRS; - std::map TexturePool; - std::map> TextureCache; - void Init() override; - void Open(std::shared_ptr archive) override; - void Close(Ship::Archive mod) override; - void Exit() override; - protected: - void Hook_LookupTexture(HookEvent event); - void Hook_GrayScaleFilter(HookEvent event); - void Hook_InvalidateTexture(HookEvent event); - }; - - inline void GrayOutTexture(uint8_t* data, int width, int height) { - for (int x = 0; x < width * height * 4; x += 4) { - - int red = data[x]; - int green = data[x + 1]; - int blue = data[x + 2]; - int gray = (red + green + blue) / 3; - data[x] = gray; - data[x + 1] = gray; - data[x + 2] = gray; - } - } -} - -#endif diff --git a/libultraship/libultraship/Utils.cpp b/libultraship/libultraship/Utils.cpp index 2b813aee7..185c21c24 100644 --- a/libultraship/libultraship/Utils.cpp +++ b/libultraship/libultraship/Utils.cpp @@ -5,14 +5,14 @@ #define strdup _strdup #endif -namespace math { - float clamp(float d, float min, float max) { - const float t = d < min ? min : d; - return t > max ? max : t; +namespace Ship { + namespace Math { + float clamp(float d, float min, float max) { + const float t = d < min ? min : d; + return t > max ? max : t; + } } -} -namespace Utils { std::vector SplitText(const std::string text, char separator = ' ', bool keep_quotes = false) { std::vector args; char* input = strdup(text.c_str()); diff --git a/libultraship/libultraship/Utils.h b/libultraship/libultraship/Utils.h index 25c6dd64b..1dc3d3491 100644 --- a/libultraship/libultraship/Utils.h +++ b/libultraship/libultraship/Utils.h @@ -3,10 +3,11 @@ #include #include -namespace math { - float clamp(float d, float min, float max); -} +namespace Ship { + + namespace Math { + float clamp(float d, float min, float max); + } -namespace Utils { std::vector SplitText(const std::string& text, char separator, bool keep_quotes); -} +} \ No newline at end of file diff --git a/libultraship/libultraship/VirtualController.h b/libultraship/libultraship/VirtualController.h index 017373e55..825d7df59 100644 --- a/libultraship/libultraship/VirtualController.h +++ b/libultraship/libultraship/VirtualController.h @@ -4,32 +4,34 @@ #include "Controller.h" -class VirtualController final : public Ship::Controller { -public: - VirtualController(const std::string& CUID, const std::string& KeyName, bool Connected) { - GUID = CUID; - isConnected = Connected; - ButtonName = KeyName; - } +namespace Ship { + class VirtualController final : public Controller { + public: + VirtualController(const std::string& CUID, const std::string& KeyName, bool Connected) { + GUID = CUID; + isConnected = Connected; + ButtonName = KeyName; + } - std::map, int32_t> ReadButtonPress(); - void ReadFromSource(int32_t slot) override {} - const char* GetControllerName() override { return GUID.c_str(); } - const char* GetButtonName(int slot, int n64Button) override { return ButtonName.c_str(); } - void WriteToSource(int32_t slot, ControllerCallback* controller) override { } - bool Connected() const override { return isConnected; } - bool CanRumble() const override { return false; } - bool CanGyro() const override { return false; } + std::map, int32_t> ReadButtonPress(); + void ReadFromSource(int32_t slot) override {} + const char* GetControllerName() override { return GUID.c_str(); } + const char* GetButtonName(int slot, int n64Button) override { return ButtonName.c_str(); } + void WriteToSource(int32_t slot, ControllerCallback* controller) override { } + bool Connected() const override { return isConnected; } + bool CanRumble() const override { return false; } + bool CanGyro() const override { return false; } - void ClearRawPress() override {} - int32_t ReadRawPress() override { return -1; } - bool HasPadConf() const { return true; } - std::optional GetPadConfSection() { return "Unk"; } - void CreateDefaultBinding(int32_t slot) override {} -protected: - std::string ButtonName; - bool isConnected = false; - std::string GetControllerType() { return "Unk"; } - std::string GetConfSection() { return "Unk"; } - std::string GetBindingConfSection() { return "Unk"; } -}; + void ClearRawPress() override {} + int32_t ReadRawPress() override { return -1; } + bool HasPadConf() const { return true; } + std::optional GetPadConfSection() { return "Unk"; } + void CreateDefaultBinding(int32_t slot) override {} + protected: + std::string ButtonName; + bool isConnected = false; + std::string GetControllerType() { return "Unk"; } + std::string GetConfSection() { return "Unk"; } + std::string GetBindingConfSection() { return "Unk"; } + }; +} \ No newline at end of file diff --git a/libultraship/libultraship/Window.cpp b/libultraship/libultraship/Window.cpp index 39d4aad06..0db33792e 100644 --- a/libultraship/libultraship/Window.cpp +++ b/libultraship/libultraship/Window.cpp @@ -1,7 +1,6 @@ #include "Window.h" #include "spdlog/spdlog.h" #include "KeyboardController.h" -#include "SDLController.h" #include "GlobalCtx2.h" #include "DisplayList.h" #include "Vertex.h" @@ -11,22 +10,14 @@ #include "Blob.h" #include "Matrix.h" #include "AudioPlayer.h" -#include "WasapiAudioPlayer.h" -#include "PulseAudioPlayer.h" -#include "SDLAudioPlayer.h" +#include "Hooks.h" +#include "UltraController.h" #include "Lib/Fast3D/gfx_pc.h" #include "Lib/Fast3D/gfx_sdl.h" #include "Lib/Fast3D/gfx_opengl.h" -#include "stox.h" -#if __APPLE__ -#include -#else #include -#endif -#include #include #include -#include "Hooks.h" #include "Console.h" #include "Cvar.h" @@ -57,7 +48,7 @@ extern "C" { } #endif - Ship::Window::ControllerApi->Init(controllerBits); + Ship::GlobalCtx2::GetInstance()->GetWindow()->GetControlDeck()->Init(controllerBits); return 0; } @@ -77,10 +68,10 @@ extern "C" { pad->gyro_y = 0; if (!CVar_GetS32("gOpenMenuBar", 0)) { - Ship::Window::ControllerApi->WriteToPad(pad); + Ship::GlobalCtx2::GetInstance()->GetWindow()->GetControlDeck()->WriteToPad(pad); } - ModInternal::ExecuteHooks(pad); + Ship::ExecuteHooks(pad); } const char* ResourceMgr_GetNameByCRC(uint64_t crc) { @@ -126,7 +117,7 @@ extern "C" { if (hashStr != nullptr) { const auto res = LOAD_TEX(hashStr->c_str()); - ModInternal::ExecuteHooks(hashStr->c_str(), &res->imageData); + Ship::ExecuteHooks(hashStr->c_str(), &res->imageData); return reinterpret_cast(res->imageData); } else { @@ -153,7 +144,7 @@ extern "C" { char* ResourceMgr_LoadTexByName(char* texPath) { const auto res = LOAD_TEX(texPath); - ModInternal::ExecuteHooks(texPath, &res->imageData); + Ship::ExecuteHooks(texPath, &res->imageData); return (char*)res->imageData; } @@ -221,7 +212,7 @@ namespace Ship { int32_t Window::lastScancode; - Window::Window(std::shared_ptr Context) : Context(Context), APlayer(nullptr) { + Window::Window(std::shared_ptr Context) : Context(Context), APlayer(nullptr), ControllerApi(nullptr) { WmApi = nullptr; RenderingApi = nullptr; bIsFullscreen = false; @@ -259,8 +250,9 @@ namespace Ship { std::shared_ptr pConf = GlobalCtx2::GetInstance()->GetConfig(); CreateDefaults(); + InitializeAudioPlayer(); + InitializeControlDeck(); - SetAudioPlayer(); bIsFullscreen = pConf->getBool("Window.Fullscreen.Enabled", false); if (bIsFullscreen) { @@ -279,7 +271,7 @@ namespace Ship { WmApi->set_fullscreen_changed_callback(OnFullscreenChanged); WmApi->set_keyboard_callbacks(KeyDown, KeyUp, AllKeysUp); - ModInternal::RegisterHook([]() { + Ship::RegisterHook([this]() { ControllerApi->SaveControllerSettings(); }); } @@ -347,7 +339,8 @@ namespace Ship { lastScancode = -1; bool bIsProcessed = false; - const auto pad = dynamic_cast(ControllerApi->physicalDevices[ControllerApi->physicalDevices.size() - 2].get()); + auto controlDeck = GlobalCtx2::GetInstance()->GetWindow()->GetControlDeck(); + const auto pad = dynamic_cast(controlDeck->GetPhysicalDevice(controlDeck->GetNumPhysicalDevices() - 2).get()); if (pad != nullptr) { if (pad->ReleaseButton(dwScancode)) { bIsProcessed = true; @@ -359,8 +352,8 @@ namespace Ship { bool Window::KeyDown(int32_t dwScancode) { bool bIsProcessed = false; - - const auto pad = dynamic_cast(ControllerApi->physicalDevices[ControllerApi->physicalDevices.size() - 2].get()); + auto controlDeck = GlobalCtx2::GetInstance()->GetWindow()->GetControlDeck(); + const auto pad = dynamic_cast(controlDeck->GetPhysicalDevice(controlDeck->GetNumPhysicalDevices() - 2).get()); if (pad != nullptr) { if (pad->PressButton(dwScancode)) { bIsProcessed = true; @@ -374,7 +367,8 @@ namespace Ship { void Window::AllKeysUp(void) { - const auto pad = dynamic_cast(ControllerApi->physicalDevices[ControllerApi->physicalDevices.size() - 2].get()); + auto controlDeck = GlobalCtx2::GetInstance()->GetWindow()->GetControlDeck(); + const auto pad = dynamic_cast(controlDeck->GetPhysicalDevice(controlDeck->GetNumPhysicalDevices() - 2).get()); if (pad != nullptr) { pad->ReleaseAllButtons(); } @@ -400,7 +394,7 @@ namespace Ship { return dwHeight; } - void Window::SetAudioPlayer() { + void Window::InitializeAudioPlayer() { #ifdef _WIN32 APlayer = std::make_shared(); #elif defined(__linux) @@ -409,4 +403,8 @@ namespace Ship { APlayer = std::make_shared(); #endif } + + void Window::InitializeControlDeck() { + ControllerApi = std::make_shared(); + } } diff --git a/libultraship/libultraship/Window.h b/libultraship/libultraship/Window.h index 1fa43abeb..52737dd37 100644 --- a/libultraship/libultraship/Window.h +++ b/libultraship/libultraship/Window.h @@ -16,7 +16,6 @@ namespace Ship { class Window { public: static int32_t lastScancode; - inline static ControlDeck* ControllerApi = new ControlDeck; Window(std::shared_ptr Context); ~Window(); @@ -32,12 +31,12 @@ namespace Ship { void ToggleFullscreen(); void SetFullscreen(bool bIsFullscreen); void ShowCursor(bool hide); - bool IsFullscreen() { return bIsFullscreen; } uint32_t GetCurrentWidth(); uint32_t GetCurrentHeight(); - ControlDeck* GetControlDeck() { return ControllerApi; }; - uint32_t dwMenubar; + uint32_t GetMenuBar() { return dwMenubar; } + void SetMenuBar(uint32_t dwMenuBar) { this->dwMenubar = dwMenuBar; } + std::shared_ptr GetControlDeck() { return ControllerApi; }; std::shared_ptr GetContext() { return Context.lock(); } std::shared_ptr GetAudioPlayer() { return APlayer; } const char* GetKeyName(int scancode) { return WmApi->get_key_name(scancode); } @@ -48,15 +47,18 @@ namespace Ship { static bool KeyUp(int32_t dwScancode); static void AllKeysUp(void); static void OnFullscreenChanged(bool bIsNowFullscreen); - void SetAudioPlayer(); + void InitializeControlDeck(); + void InitializeAudioPlayer(); std::weak_ptr Context; std::shared_ptr APlayer; + std::shared_ptr ControllerApi; GfxRenderingAPI* RenderingApi; GfxWindowManagerAPI* WmApi; bool bIsFullscreen; uint32_t dwWidth; uint32_t dwHeight; + uint32_t dwMenubar; }; } diff --git a/libultraship/libultraship/libultraship.vcxproj b/libultraship/libultraship/libultraship.vcxproj deleted file mode 100644 index 4d7eab9b4..000000000 --- a/libultraship/libultraship/libultraship.vcxproj +++ /dev/null @@ -1,457 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - Testing - Win32 - - - Testing - x64 - - - - 16.0 - Win32Proj - {6da9b521-65b7-41e2-8f8a-f0451cc18ed8} - libultraship - 10.0 - libultraship - - - - StaticLibrary - true - v142 - Unicode - - - StaticLibrary - true - v142 - Unicode - - - StaticLibrary - false - v142 - true - Unicode - - - StaticLibrary - true - v142 - Unicode - - - StaticLibrary - true - v142 - Unicode - - - StaticLibrary - false - v142 - true - Unicode - - - - - - - - - - - - - - - - - - - - - - - - - - - true - $(ProjectDir)..\..\ZAPDTR\ZAPDUtils;$(ProjectDir)Lib\Fast3D\U64;$(ProjectDir)Lib\ImGui;$(ProjectDir)Lib\libjpeg\include;$(ProjectDir)Lib\spdlog\include;$(ProjectDir)Lib\SDL;$(ProjectDir)Lib\GLEW;$(ProjectDir)..\..\StormLib\src\;$(IncludePath) - $(ProjectDir)Lib\SDL\lib\x86;$(LibraryPath) - MinimumRecommendedRules.ruleset - - - - - true - $(ProjectDir)..\..\ZAPDTR\ZAPDUtils;$(ProjectDir)Lib\Fast3D\U64;$(ProjectDir)Lib\ImGui;$(ProjectDir)Lib\libjpeg\include;$(ProjectDir)Lib\spdlog\include;$(ProjectDir)Lib\SDL;$(ProjectDir)Lib\GLEW;$(IncludePath) - $(ProjectDir)Lib\SDL\lib\x86;$(LibraryPath) - MinimumRecommendedRules.ruleset - - - - - false - $(ProjectDir)..\..\ZAPDTR\ZAPDUtils;$(ProjectDir)Lib\Fast3D\U64;$(ProjectDir)Lib\ImGui;$(ProjectDir)Lib\spdlog\include;$(ProjectDir)Lib\SDL;$(ProjectDir)Lib\GLEW;$(ProjectDir)..\..\StormLib\src\;$(IncludePath) - $(ProjectDir)Lib\SDL\lib\x86;$(LibraryPath) - MinimumRecommendedRules.ruleset - - - - - true - $(ProjectDir)..\..\ZAPDTR\ZAPDUtils;$(ProjectDir)Lib\Fast3D\U64;$(ProjectDir)Lib\ImGui;$(ProjectDir)Lib\spdlog\include;$(ProjectDir)Lib\SDL;$(ProjectDir)Lib\GLEW;$(ProjectDir)..\..\StormLib\src\;$(IncludePath) - $(ProjectDir)Lib\SDL\lib\x64;$(LibraryPath) - MinimumRecommendedRules.ruleset - - - - - true - $(ProjectDir)..\..\ZAPDTR\ZAPDUtils;$(ProjectDir)Lib\Fast3D\U64;$(ProjectDir)Lib\ImGui;$(ProjectDir)Lib\spdlog\include;$(ProjectDir)Lib\SDL;$(ProjectDir)Lib\GLEW;$(IncludePath) - $(ProjectDir)Lib\SDL\lib\x64;$(LibraryPath) - MinimumRecommendedRules.ruleset - - - - - false - $(ProjectDir)..\..\ZAPDTR\ZAPDUtils;$(ProjectDir)Lib\Fast3D\U64;$(ProjectDir)Lib\ImGui;$(ProjectDir)Lib\spdlog\include;$(ProjectDir)Lib\SDL;$(ProjectDir)Lib\GLEW;$(ProjectDir)..\..\StormLib\src\;$(IncludePath) - $(ProjectDir)Lib\SDL\lib\x64;$(LibraryPath) - MinimumRecommendedRules.ruleset - - - - - - Level2 - true - SPDLOG_ACTIVE_LEVEL=0;WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;ENABLE_OPENGL;ENABLE_DX11;%(PreprocessorDefinitions)GLEW_STATIC - true - stdcpp20 - stdc17 - MultiThreadedDebug - true - Disabled - Default - false - - - Console - true - - - - - Level2 - true - SPDLOG_ACTIVE_LEVEL=0;WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;ENABLE_OPENGL;%(PreprocessorDefinitions)GLEW_STATIC - true - stdcpp20 - stdc17 - MultiThreadedDebug - true - - - Console - true - - - - - Level3 - true - true - true - SPDLOG_ACTIVE_LEVEL=0;WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;ENABLE_OPENGL;ENABLE_DX11;%(PreprocessorDefinitions)GLEW_STATIC - true - stdcpp20 - stdc17 - MultiThreaded - true - - - Console - true - true - true - - - - - Level3 - true - SPDLOG_ACTIVE_LEVEL=0;WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;ENABLE_OPENGL;ENABLE_DX11;%(PreprocessorDefinitions)GLEW_STATIC - true - stdcpp20 - stdc17 - MultiThreadedDebug - true - Default - - - Console - true - - - - - Level3 - true - SPDLOG_ACTIVE_LEVEL=0;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;ENABLE_OPENGL;%(PreprocessorDefinitions)GLEW_STATIC - true - stdcpp20 - stdc17 - MultiThreadedDebug - true - - - Console - true - - - - - Level3 - true - true - true - SPDLOG_ACTIVE_LEVEL=0;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;ENABLE_OPENGL;ENABLE_DX11;%(PreprocessorDefinitions)GLEW_STATIC - true - stdcpplatest - stdc11 - MultiThreaded - true - - - Console - true - true - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/libultraship/libultraship/libultraship.vcxproj.filters b/libultraship/libultraship/libultraship.vcxproj.filters deleted file mode 100644 index fa5c505aa..000000000 --- a/libultraship/libultraship/libultraship.vcxproj.filters +++ /dev/null @@ -1,690 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;c++;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - {50e27c70-2679-4f41-9127-fca2c66989ce} - - - {19d4557f-ea31-4405-88d5-15504070f479} - - - {12c0e217-75b9-47a5-bc2e-a2ea4e5dd992} - - - {bec61d88-f3a8-466d-b3e8-cf2e7d963f1b} - - - {ad191ad0-c9eb-495d-9d45-5d12b9e7c269} - - - {c0f07350-c627-444e-9f66-23e19407ad9a} - - - {2aa34c3b-6148-480f-a4fc-19c4e0f8c822} - - - {6b6658ad-694d-4943-83b8-c9dbd31ca67d} - - - {ef3683ce-934c-44c3-ae84-99cf22764875} - - - {58ff8972-9dba-4719-aec5-6edc5e6b033d} - - - {dde367c4-c14a-4bf3-b6d9-bc0d2d7d34e6} - - - {1f5e0ba2-0f3f-456c-9b66-873ed62e9fbe} - - - {3376a196-8303-4613-9721-62f31e746b0d} - - - {cf7f1b29-bb9a-4844-9ea5-4ac085f942e1} - - - {70cd453d-a4dc-4c56-b64e-e50394fd18ee} - - - {a66f6337-5cde-4e46-8f49-a6c991ea2fe7} - - - {11039197-0b49-4fb9-b9e6-56196220c9d4} - - - {ccd6359f-e357-41ca-9b89-5f509dd30649} - - - {94ca4b98-cee2-48e6-a88b-68b8d2fed287} - - - {0dca2d94-45ba-4916-b03a-1dd5f949114c} - - - {8e970531-d0cd-4c29-9800-a7e6edc92036} - - - {05f273a3-f147-430e-9853-aeef59e6288d} - - - {cc8de11b-7305-4482-853f-7f0f843eef28} - - - {bd6557f1-9480-413b-b0cd-843f8efc1939} - - - {3285ab8a-06d8-4dac-9af9-efb2a9723ab1} - - - {db6e02cc-fc4c-4138-8219-1d281ad93ec2} - - - {2be7c90f-ba21-455d-8a11-6f99452be15c} - - - {7e415dd2-403b-4d4d-b4f2-3e311f91db19} - - - {010dc29b-d1f6-4793-a4e7-4156aa4fcdd6} - - - - - Source Files\Resources\Factories - - - Source Files\Resources\Factories - - - Source Files\Lib\Fast3D - - - Source Files\Lib\Fast3D - - - Source Files\Lib\Fast3D - - - Source Files\Resources\mpq - - - Source Files\Resources\mpq - - - Source Files\Lib - - - Source Files\Lib - - - Source Files\Resources\Factories - - - Source Files\Resources\Factories - - - Source Files\Resources\Factories - - - Source Files\Resources\Factories - - - Source Files\Resources\Factories - - - Source Files\Resources\Factories - - - Source Files\Controller - - - Source Files\Controller - - - Source Files\Globals - - - Source Files\Globals - - - Source Files\Globals - - - Source Files\Controller\Attachment - - - Source Files\Controller\Attachment - - - Source Files\Controller\Attachment - - - Source Files\Resources\Files - - - Source Files\Resources\Files - - - Source Files\Resources\Files - - - Source Files\Resources\Files - - - Source Files\Resources\Files - - - Source Files\Resources\Files - - - Source Files\Resources\Files - - - Source Files\Resources\Files - - - Source Files\Resources\Files - - - Source Files\Resources - - - Source Files\Lib - - - Source Files\Resources\Files - - - Source Files\Resources\Factories - - - Source Files\Resources\Files - - - Source Files\Resources\Files - - - Source Files\Resources\Factories - - - Source Files\Controller - - - Source Files\Resources\Factories - - - Source Files\Resources\Files - - - Source Files\Resources\Factories - - - Source Files\Resources\Files - - - Source Files\Resources\Factories - - - Source Files\Resources - - - Source Files\Lib\Fast3D - - - Source Files\Lib\Fast3D - - - Source Files\Lib\Fast3D - - - Source Files\Lib\Fast3D - - - Source Files\Lib\Fast3D - - - Source Files\Lib\Fast3D - - - Source Files\Resources\Factories - - - Source Files\Resources\Files - - - Source Files\Resources\Factories - - - Source Files\Resources\Factories - - - Source Files\Resources\Files - - - Source Files\Lib\stb - - - Source Files\Resources\Files - - - Source Files\Resources\Factories - - - Source Files\Lib\ImGui - - - Source Files\Lib\ImGui - - - Source Files\Lib\ImGui - - - Source Files\Lib\ImGui - - - Source Files\Lib\ImGui - - - Source Files\Lib\ImGui - - - Source Files\Lib\ImGui - - - Source Files\CustomImpl - - - Source Files\CustomImpl - - - Source Files\Lib\ImGui - - - Source Files\Lib\ImGui - - - Source Files\Audio - - - Source Files\Audio - - - Source Files\CustomImpl\Environment - - - Source Files\CustomImpl\Utils - - - Source Files\Audio - - - Source Files\Globals - - - Source Files\ModManager\ModModule - - - Source Files\ModManager - - - Source Files\CustomImpl\Hooks - - - Source Files\Logging - - - Source Files\CustomImpl - - - Source Files\CustomImpl\Overlay - - - Source Files\Resources\Files - - - Source Files\Resources\Factories - - - Source Files\Controller\InputEditor - - - Source Files\Controller - - - Source Files\Lib\Mercury - - - - - Source Files\Lib\tinyxml2 - - - Source Files\Controller - - - Source Files\Controller - - - Source Files\Globals - - - Source Files\Globals - - - Source Files\Lib - - - Source Files\Controller - - - Source Files\Controller\Attachment - - - Source Files\Controller\Attachment - - - Source Files\Controller\Attachment - - - Source Files\Resources - - - Source Files\Resources\mpq - - - Source Files\Resources\mpq - - - Source Files\Lib\Fast3D - - - Source Files\Lib\Fast3D - - - Source Files\Lib\Fast3D - - - Source Files\Lib - - - Source Files\Globals - - - Source Files\Lib - - - Source Files\Controller - - - Source Files\Resources - - - Source Files\Lib\Fast3D - - - Source Files\Lib\Fast3D - - - Source Files\Lib\Fast3D - - - Source Files\Globals - - - Source Files\Lib\Fast3D - - - Source Files\Lib\Fast3D - - - Source Files\Lib\Fast3D - - - Source Files\Lib\Fast3D - - - Source Files\Lib\Fast3D - - - Source Files\Lib\Fast3D - - - Source Files\Lib\Fast3D - - - Header Files\Resources\Factories - - - Header Files\Resources\Factories - - - Header Files\Resources\Factories - - - Header Files\Resources\Factories - - - Header Files\Resources\Factories - - - Header Files\Resources\Factories - - - Header Files\Resources\Factories - - - Header Files\Resources\Factories - - - Header Files\Resources\Factories - - - Header Files\Resources\Factories - - - Header Files\Resources\Factories - - - Header Files\Resources\Factories - - - Header Files\Resources\Factories - - - Header Files\Resources\Factories - - - Header Files\Resources\Factories - - - Header Files\Resources\Files - - - Header Files\Resources\Files - - - Header Files\Resources\Files - - - Header Files\Resources\Files - - - Header Files\Resources\Files - - - Header Files\Resources\Files - - - Header Files\Resources\Files - - - Header Files\Resources\Files - - - Header Files\Resources\Files - - - Header Files\Resources\Files - - - Header Files\Resources\Files - - - Header Files\Resources\Files - - - Header Files\Resources\Files - - - Header Files\Resources\Files - - - Header Files\Resources\Files - - - Header Files\Resources\Files - - - Header Files\Resources\Files - - - Source Files\Lib\stb - - - Header Files\Resources\Files - - - Header Files\Resources\Factories - - - Source Files\Lib\ImGui - - - Source Files\Lib\ImGui - - - Source Files\Lib\ImGui - - - Source Files\Lib\ImGui - - - Source Files\Lib\ImGui - - - Source Files\Lib\ImGui - - - Source Files\Lib\ImGui - - - Source Files\Lib\ImGui - - - Source Files\CustomImpl - - - Source Files\CustomImpl - - - Source Files\Lib\ImGui - - - Source Files\Lib\ImGui - - - Source Files\CustomImpl\Environment - - - Source Files\CustomImpl\Utils - - - Source Files\Audio - - - Source Files\Audio - - - Source Files\Audio - - - Source Files\Audio - - - Source Files\Audio - - - Source Files\Globals - - - Source Files\Lib\stb - - - Source Files\ModManager\ModModule - - - Source Files\ModManager - - - Source Files\ModManager\ModModule - - - Source Files\CustomImpl\Hooks - - - Source Files\Logging - - - Source Files\CustomImpl - - - Source Files\Resources - - - Header Files - - - Source Files\CustomImpl\Overlay - - - Header Files\Resources\Files - - - Header Files\Resources\Factories - - - Source Files\Lib\dr_libs - - - Source Files\Lib\dr_libs - - - Source Files\Controller\InputEditor - - - Source Files\Controller - - - Source Files\Lib\nlohmann - - - Source Files\Lib\Mercury - - - Source Files\Controller - - - \ No newline at end of file diff --git a/scripts/linux/appimage/build.sh b/scripts/linux/appimage/build.sh new file mode 100755 index 000000000..86f46fb90 --- /dev/null +++ b/scripts/linux/appimage/build.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +cmake --no-warn-unused-cli -H. -Bbuild-cmake -GNinja -DCMAKE_BUILD_TYPE:STRING=Release +cmake --build build-cmake --config Release -- + +(cd build-cmake && cpack -G External) diff --git a/scripts/linux/soh.desktop b/scripts/linux/appimage/soh.desktop similarity index 79% rename from scripts/linux/soh.desktop rename to scripts/linux/appimage/soh.desktop index a637d03c3..b1fc2696b 100644 --- a/scripts/linux/soh.desktop +++ b/scripts/linux/appimage/soh.desktop @@ -1,9 +1,9 @@ [Desktop Entry] Version=1.0 Name=SOH -Exec=AppRun +Exec=soh.sh Terminal=false -Icon=soh +Icon=sohIcon Type=Application Categories=Game; Name[en_US]= diff --git a/scripts/linux/soh.sh b/scripts/linux/appimage/soh.sh similarity index 100% rename from scripts/linux/soh.sh rename to scripts/linux/appimage/soh.sh diff --git a/scripts/linux/build-appimage.sh b/scripts/linux/build-appimage.sh deleted file mode 100755 index 053ce580a..000000000 --- a/scripts/linux/build-appimage.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash - -curl -sSfLO "https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage" -chmod a+x linuxdeploy*.AppImage -curl -sSfL https://github.com$(curl https://github.com/probonopd/go-appimage/releases | grep "mkappimage-.*-x86_64.AppImage" | head -n 1 | cut -d '"' -f 2) -o mkappimage.AppImage -chmod a+x mkappimage.AppImage - -mkdir -p AppDir/usr/bin -cp scripts/linux/{soh.desktop,soh.sh} AppDir/ -cp soh/macosx/sohIcon.png AppDir/soh.png -curl -sSfL https://raw.githubusercontent.com/gabomdq/SDL_GameControllerDB/master/gamecontrollerdb.txt -o AppDir/usr/bin/gamecontrollerdb.txt - -mkdir -p AppDir/usr/share/applications -mkdir -p AppDir/usr/share/icons/hicolor/scalable/apps -mkdir -p AppDir/usr/lib - -mv AppDir/soh.sh AppDir/usr/bin -cp -r build/* AppDir/usr/bin - -chmod +x AppDir/usr/bin/{soh.elf,OTRGui,soh.sh} - -cd AppDir && ln -s ./usr/bin/soh.sh ./AppRun && cd .. - -export UPD_INFO="gh-releases-zsync|HarbourMasters|Shipwright-linux|develop|SOH-Linux.AppImage.zsync" -./linuxdeploy-x86_64.AppImage --appimage-extract-and-run \ - --appdir=./AppDir/ \ - -d ./AppDir/soh.desktop \ - -i ./AppDir/soh.png \ - -e ./AppDir/usr/bin/soh.elf - -cd /soh - -VERSION=Linux ./mkappimage.AppImage --appimage-extract-and-run ./AppDir # "SOH-Linux-x86_64.AppImage" -mv SOH-Linux-x86_64.AppImage SOH-Linux.AppImage # Keep Original Name diff --git a/scripts/linux/build.sh b/scripts/linux/build.sh deleted file mode 100755 index f9d1f9e2c..000000000 --- a/scripts/linux/build.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash - -cd soh -make setup -j$(nproc) OPTFLAGS=-O2 DEBUG=0 -make -j$(nproc) OPTFLAGS=-O2 DEBUG=0 - -cd ../OTRGui -mkdir build -cd build -cmake .. -cmake --build . --config Release diff --git a/scripts/switch/build.sh b/scripts/switch/build.sh index e5d65d99d..2a208dd43 100755 --- a/scripts/switch/build.sh +++ b/scripts/switch/build.sh @@ -1,4 +1,4 @@ #!/bin/bash -make setup -C soh -j$(nproc) OPTFLAGS=-O2 DEBUG=0 -make -f Makefile.switch -j$(nproc) +cmake -H. -Bbuild-switch -GNinja -DCMAKE_TOOLCHAIN_FILE=/opt/devkitpro/cmake/Switch.cmake +cmake --build build-switch --target soh_nro diff --git a/soh/CMake/Default.cmake b/soh/CMake/Default.cmake new file mode 100644 index 000000000..70bfa9038 --- /dev/null +++ b/soh/CMake/Default.cmake @@ -0,0 +1,65 @@ +################################################################################ +# Command for variable_watch. This command issues error message, if a variable +# is changed. If variable PROPERTY_READER_GUARD_DISABLED is TRUE nothing happens +# variable_watch( property_reader_guard) +################################################################################ +function(property_reader_guard VARIABLE ACCESS VALUE CURRENT_LIST_FILE STACK) + if("${PROPERTY_READER_GUARD_DISABLED}") + return() + endif() + + if("${ACCESS}" STREQUAL "MODIFIED_ACCESS") + message(FATAL_ERROR + " Variable ${VARIABLE} is not supposed to be changed.\n" + " It is used only for reading target property ${VARIABLE}.\n" + " Use\n" + " set_target_properties(\"\" PROPERTIES \"${VARIABLE}\" \"\")\n" + " or\n" + " set_target_properties(\"\" PROPERTIES \"${VARIABLE}_\" \"\")\n" + " instead.\n") + endif() +endfunction() + +################################################################################ +# Create variable with generator expression that expands to value of +# target property _. If property is empty or not set then property +# is used instead. Variable has watcher property_reader_guard that +# doesn't allow to edit it. +# create_property_reader() +# Input: +# name - Name of watched property and output variable +################################################################################ +function(create_property_reader NAME) + set(PROPERTY_READER_GUARD_DISABLED TRUE) + set(CONFIG_VALUE "$>>>") + set(IS_CONFIG_VALUE_EMPTY "$") + set(GENERAL_VALUE "$>") + set("${NAME}" "$" PARENT_SCOPE) + variable_watch("${NAME}" property_reader_guard) +endfunction() + +################################################################################ +# Set property $_${PROPS_CONFIG_U} of ${PROPS_TARGET} to +# set_config_specific_property( ) +# Input: +# name - Prefix of property name +# value - New value +################################################################################ +function(set_config_specific_property NAME VALUE) + set_target_properties("${PROPS_TARGET}" PROPERTIES "${NAME}_${PROPS_CONFIG_U}" "${VALUE}") +endfunction() + +################################################################################ + +create_property_reader("TARGET_NAME") +create_property_reader("OUTPUT_DIRECTORY") + +set_config_specific_property("TARGET_NAME" "${PROPS_TARGET}") +set_config_specific_property("OUTPUT_NAME" "${TARGET_NAME}") +set_config_specific_property("ARCHIVE_OUTPUT_NAME" "${TARGET_NAME}") +set_config_specific_property("LIBRARY_OUTPUT_NAME" "${TARGET_NAME}") +set_config_specific_property("RUNTIME_OUTPUT_NAME" "${TARGET_NAME}") + +set_config_specific_property("ARCHIVE_OUTPUT_DIRECTORY" "${OUTPUT_DIRECTORY}") +set_config_specific_property("LIBRARY_OUTPUT_DIRECTORY" "${OUTPUT_DIRECTORY}") +set_config_specific_property("RUNTIME_OUTPUT_DIRECTORY" "${OUTPUT_DIRECTORY}") \ No newline at end of file diff --git a/soh/CMake/DefaultCXX.cmake b/soh/CMake/DefaultCXX.cmake new file mode 100644 index 000000000..7b052b9cc --- /dev/null +++ b/soh/CMake/DefaultCXX.cmake @@ -0,0 +1,12 @@ +include("${CMAKE_CURRENT_LIST_DIR}/Default.cmake") + +set_config_specific_property("OUTPUT_DIRECTORY" "${CMAKE_SOURCE_DIR}$<$>:/${CMAKE_VS_PLATFORM_NAME}>/${PROPS_CONFIG}") + +if(MSVC) + create_property_reader("DEFAULT_CXX_EXCEPTION_HANDLING") + create_property_reader("DEFAULT_CXX_DEBUG_INFORMATION_FORMAT") + + set_target_properties("${PROPS_TARGET}" PROPERTIES MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>DLL") + set_config_specific_property("DEFAULT_CXX_EXCEPTION_HANDLING" "/EHsc") + set_config_specific_property("DEFAULT_CXX_DEBUG_INFORMATION_FORMAT" "/Zi") +endif() \ No newline at end of file diff --git a/soh/CMake/Linux32bit-toolchain.cmake b/soh/CMake/Linux32bit-toolchain.cmake new file mode 100644 index 000000000..824f63263 --- /dev/null +++ b/soh/CMake/Linux32bit-toolchain.cmake @@ -0,0 +1,15 @@ +# which compilers to use for C and C++ +set(CMAKE_C_COMPILER gcc) +set(CMAKE_C_FLAGS "-m32") +set(CMAKE_CXX_COMPILER g++) +set(CMAKE_CXX_FLAGS -m32) + +# here is the target environment located +#set(CMAKE_FIND_ROOT_PATH /lib/i386-linux-gnu ) + +# adjust the default behaviour of the FIND_XXX() commands: +# search headers and libraries in the target environment, search +# programs in the host environment +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE BOTH) diff --git a/soh/CMake/Utils.cmake b/soh/CMake/Utils.cmake new file mode 100644 index 000000000..5bce7d488 --- /dev/null +++ b/soh/CMake/Utils.cmake @@ -0,0 +1,233 @@ +# utils file for projects came from visual studio solution with cmake-converter. + +################################################################################ +# Wrap each token of the command with condition +################################################################################ +cmake_policy(PUSH) +cmake_policy(SET CMP0054 NEW) +macro(prepare_commands) + unset(TOKEN_ROLE) + unset(COMMANDS) + foreach(TOKEN ${ARG_COMMANDS}) + if("${TOKEN}" STREQUAL "COMMAND") + set(TOKEN_ROLE "KEYWORD") + elseif("${TOKEN_ROLE}" STREQUAL "KEYWORD") + set(TOKEN_ROLE "CONDITION") + elseif("${TOKEN_ROLE}" STREQUAL "CONDITION") + set(TOKEN_ROLE "COMMAND") + elseif("${TOKEN_ROLE}" STREQUAL "COMMAND") + set(TOKEN_ROLE "ARG") + endif() + + if("${TOKEN_ROLE}" STREQUAL "KEYWORD") + list(APPEND COMMANDS "${TOKEN}") + elseif("${TOKEN_ROLE}" STREQUAL "CONDITION") + set(CONDITION ${TOKEN}) + elseif("${TOKEN_ROLE}" STREQUAL "COMMAND") + list(APPEND COMMANDS "$<$:${DUMMY}>$<${CONDITION}:${TOKEN}>") + elseif("${TOKEN_ROLE}" STREQUAL "ARG") + list(APPEND COMMANDS "$<${CONDITION}:${TOKEN}>") + endif() + endforeach() +endmacro() +cmake_policy(POP) + +################################################################################ +# Transform all the tokens to absolute paths +################################################################################ +macro(prepare_output) + unset(OUTPUT) + foreach(TOKEN ${ARG_OUTPUT}) + if(IS_ABSOLUTE ${TOKEN}) + list(APPEND OUTPUT "${TOKEN}") + else() + list(APPEND OUTPUT "${CMAKE_CURRENT_SOURCE_DIR}/${TOKEN}") + endif() + endforeach() +endmacro() + +################################################################################ +# Parse add_custom_command_if args. +# +# Input: +# PRE_BUILD - Pre build event option +# PRE_LINK - Pre link event option +# POST_BUILD - Post build event option +# TARGET - Target +# OUTPUT - List of output files +# DEPENDS - List of files on which the command depends +# COMMANDS - List of commands(COMMAND condition1 commannd1 args1 COMMAND +# condition2 commannd2 args2 ...) +# Output: +# OUTPUT - Output files +# DEPENDS - Files on which the command depends +# COMMENT - Comment +# PRE_BUILD - TRUE/FALSE +# PRE_LINK - TRUE/FALSE +# POST_BUILD - TRUE/FALSE +# TARGET - Target name +# COMMANDS - Prepared commands(every token is wrapped in CONDITION) +# NAME - Unique name for custom target +# STEP - PRE_BUILD/PRE_LINK/POST_BUILD +################################################################################ +function(add_custom_command_if_parse_arguments) + cmake_parse_arguments("ARG" "PRE_BUILD;PRE_LINK;POST_BUILD" "TARGET;COMMENT" "DEPENDS;OUTPUT;COMMANDS" ${ARGN}) + + if(WIN32) + set(DUMMY "cd.") + elseif(UNIX) + set(DUMMY "true") + endif() + + prepare_commands() + prepare_output() + + set(DEPENDS "${ARG_DEPENDS}") + set(COMMENT "${ARG_COMMENT}") + set(PRE_BUILD "${ARG_PRE_BUILD}") + set(PRE_LINK "${ARG_PRE_LINK}") + set(POST_BUILD "${ARG_POST_BUILD}") + set(TARGET "${ARG_TARGET}") + if(PRE_BUILD) + set(STEP "PRE_BUILD") + elseif(PRE_LINK) + set(STEP "PRE_LINK") + elseif(POST_BUILD) + set(STEP "POST_BUILD") + endif() + set(NAME "${TARGET}_${STEP}") + + set(OUTPUT "${OUTPUT}" PARENT_SCOPE) + set(DEPENDS "${DEPENDS}" PARENT_SCOPE) + set(COMMENT "${COMMENT}" PARENT_SCOPE) + set(PRE_BUILD "${PRE_BUILD}" PARENT_SCOPE) + set(PRE_LINK "${PRE_LINK}" PARENT_SCOPE) + set(POST_BUILD "${POST_BUILD}" PARENT_SCOPE) + set(TARGET "${TARGET}" PARENT_SCOPE) + set(COMMANDS "${COMMANDS}" PARENT_SCOPE) + set(STEP "${STEP}" PARENT_SCOPE) + set(NAME "${NAME}" PARENT_SCOPE) +endfunction() + +################################################################################ +# Add conditional custom command +# +# Generating Files +# The first signature is for adding a custom command to produce an output: +# add_custom_command_if( +# +# +# +# [COMMAND condition command2 [args2...]] +# [DEPENDS [depends...]] +# [COMMENT comment] +# +# Build Events +# add_custom_command_if( +# +# +# +# [COMMAND condition command2 [args2...]] +# [COMMENT comment] +# +# Input: +# output - Output files the command is expected to produce +# condition - Generator expression for wrapping the command +# command - Command-line(s) to execute at build time. +# args - Command`s args +# depends - Files on which the command depends +# comment - Display the given message before the commands are executed at +# build time. +# PRE_BUILD - Run before any other rules are executed within the target +# PRE_LINK - Run after sources have been compiled but before linking the +# binary +# POST_BUILD - Run after all other rules within the target have been +# executed +################################################################################ +function(add_custom_command_if) + add_custom_command_if_parse_arguments(${ARGN}) + + if(OUTPUT AND TARGET) + message(FATAL_ERROR "Wrong syntax. A TARGET and OUTPUT can not both be specified.") + endif() + + if(OUTPUT) + add_custom_command(OUTPUT ${OUTPUT} + ${COMMANDS} + DEPENDS ${DEPENDS} + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + COMMENT ${COMMENT}) + elseif(TARGET) + if(PRE_BUILD AND NOT ${CMAKE_GENERATOR} MATCHES "Visual Studio") + add_custom_target( + ${NAME} + ${COMMANDS} + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + COMMENT ${COMMENT}) + add_dependencies(${TARGET} ${NAME}) + else() + add_custom_command( + TARGET ${TARGET} + ${STEP} + ${COMMANDS} + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + COMMENT ${COMMENT}) + endif() + else() + message(FATAL_ERROR "Wrong syntax. A TARGET or OUTPUT must be specified.") + endif() +endfunction() + +################################################################################ +# Use props file for a target and configs +# use_props( ) +# Inside there are following variables: +# PROPS_TARGET - +# PROPS_CONFIG - One of +# PROPS_CONFIG_U - Uppercase PROPS_CONFIG +# Input: +# target - Target to apply props file +# configs - Build configurations to apply props file +# props_file - CMake script +################################################################################ +macro(use_props TARGET CONFIGS PROPS_FILE) + set(PROPS_TARGET "${TARGET}") + foreach(PROPS_CONFIG ${CONFIGS}) + string(TOUPPER "${PROPS_CONFIG}" PROPS_CONFIG_U) + + get_filename_component(ABSOLUTE_PROPS_FILE "${PROPS_FILE}" ABSOLUTE BASE_DIR "${CMAKE_CURRENT_LIST_DIR}") + if(EXISTS "${ABSOLUTE_PROPS_FILE}") + include("${ABSOLUTE_PROPS_FILE}") + else() + message(WARNING "Corresponding cmake file from props \"${ABSOLUTE_PROPS_FILE}\" doesn't exist") + endif() + endforeach() +endmacro() + +################################################################################ +# Add compile options to source file +# source_file_compile_options( [compile_options...]) +# Input: +# source_file - Source file +# compile_options - Options to add to COMPILE_FLAGS property +################################################################################ +function(source_file_compile_options SOURCE_FILE) + if("${ARGC}" LESS_EQUAL "1") + return() + endif() + + get_source_file_property(COMPILE_OPTIONS "${SOURCE_FILE}" COMPILE_OPTIONS) + + if(COMPILE_OPTIONS) + list(APPEND COMPILE_OPTIONS ${ARGN}) + else() + set(COMPILE_OPTIONS "${ARGN}") + endif() + + set_source_files_properties("${SOURCE_FILE}" PROPERTIES COMPILE_OPTIONS "${COMPILE_OPTIONS}") +endfunction() + +################################################################################ +# Default properties of visual studio projects +################################################################################ +set(DEFAULT_CXX_PROPS "${CMAKE_CURRENT_LIST_DIR}/DefaultCXX.cmake") diff --git a/soh/CMakeLists.txt b/soh/CMakeLists.txt new file mode 100644 index 000000000..67d5db850 --- /dev/null +++ b/soh/CMakeLists.txt @@ -0,0 +1,1994 @@ +cmake_minimum_required(VERSION 3.16.0 FATAL_ERROR) + +set(CMAKE_SYSTEM_VERSION 10.0 CACHE STRING "" FORCE) + +project(soh C CXX) +set(CMAKE_CXX_STANDARD 20 CACHE STRING "The C++ standard to use") + +set (BUILD_UTILS OFF CACHE STRING "no utilities") +set (BUILD_SHARED_LIBS OFF CACHE STRING "install/link shared instead of static libs") + +################################################################################ +# 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 +################################################################################ +set(CMAKE_CONFIGURATION_TYPES + "Debug" + "Release" + CACHE STRING "" FORCE +) + +################################################################################ +# 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) + +################################################################################ +# 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 +################################################################################ +if (NOT TARGET libultraship) + add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/libultraship ${CMAKE_BINARY_DIR}/libultraship) +endif() + +if (NOT TARGET ZAPDUtils) + add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../ZAPDTR/ZAPDUtils ${CMAKE_BINARY_DIR}/ZAPDUtils) +endif() + +set(PROJECT_NAME soh) + +################################################################################ +# Source groups +################################################################################ +set(Header_Files + "resource.h" +) +source_group("Header Files" FILES ${Header_Files}) + +set(Header_Files__include + "include/alloca.h" + #"include/bgm.h" + "include/command_macros_base.h" + "include/fp.h" + "include/functions.h" + "include/global.h" + "include/ichain.h" + "include/macro.inc" + "include/macros.h" + #"include/math_n64.h" + "include/regs.h" + "include/segment_symbols.h" + "include/sfx.h" + "include/libc/stdarg.h" + #"include/stdbool_n64.h" + #"include/stddef_n64.h" + #"include/stdlib_n64.h" + "include/ultra64.h" + "include/unk.h" + "include/variables.h" + "include/vt.h" + "include/z64.h" + "include/z64actor.h" + "include/z64animation.h" + "include/z64audio.h" + "include/z64bgcheck.h" + "include/z64camera.h" + "include/z64collision_check.h" + "include/z64cutscene.h" + "include/z64cutscene_commands.h" + "include/z64dma.h" + "include/z64effect.h" + "include/z64environment.h" + "include/z64interface.h" + "include/z64item.h" + "include/z64light.h" + "include/z64map_mark.h" + "include/z64math.h" + "include/z64object.h" + "include/z64player.h" + "include/z64save.h" + "include/z64scene.h" + "include/z64transition.h" +) +source_group("Header Files\\include" FILES ${Header_Files__include}) + +set(Header_Files__soh__Enhancements + "soh/Enhancements/bootcommands.h" + #"soh/Enhancements/cvar.h" + "soh/Enhancements/debugconsole.h" + "soh/Enhancements/gameconsole.h" + "soh/Enhancements/savestates.h" + "soh/Enhancements/savestates_extern.inc" +) +source_group("Header Files\\soh\\Enhancements" FILES ${Header_Files__soh__Enhancements}) + +set(Header_Files__soh__Enhancements__cosmetics + "soh/Enhancements/cosmetics/CosmeticsEditor.h" +) +source_group("Header Files\\soh\\Enhancements\\cosmetics" FILES ${Header_Files__soh__Enhancements__cosmetics}) + +set(Header_Files__soh__Enhancements__debugger + "soh/Enhancements/debugger/actorViewer.h" + "soh/Enhancements/debugger/colViewer.h" + "soh/Enhancements/debugger/debugger.h" + "soh/Enhancements/debugger/debugSaveEditor.h" + "soh/Enhancements/debugger/ImGuiHelpers.h" +) +source_group("Header Files\\soh\\Enhancements\\debugger" FILES ${Header_Files__soh__Enhancements__debugger}) + +set(Header_Files__soh__Enhancements__randomizer + "soh/Enhancements/randomizer/randomizer.h" + "soh/Enhancements/randomizer/randomizer_item_tracker.h" +) +source_group("Header Files\\soh\\Enhancements\\randomizer" FILES ${Header_Files__soh__Enhancements__randomizer}) + +set(Header_Files__soh__Enhancements__randomizer__3drando + "soh/Enhancements/randomizer/3drando/category.hpp" + "soh/Enhancements/randomizer/3drando/cosmetics.hpp" + "soh/Enhancements/randomizer/3drando/custom_messages.hpp" + "soh/Enhancements/randomizer/3drando/debug.hpp" + "soh/Enhancements/randomizer/3drando/dungeon.hpp" + "soh/Enhancements/randomizer/3drando/entrance.hpp" + "soh/Enhancements/randomizer/3drando/fill.hpp" + "soh/Enhancements/randomizer/3drando/hint_list.hpp" + "soh/Enhancements/randomizer/3drando/hints.hpp" + "soh/Enhancements/randomizer/3drando/item.hpp" + "soh/Enhancements/randomizer/3drando/item_list.hpp" + "soh/Enhancements/randomizer/3drando/item_location.hpp" + "soh/Enhancements/randomizer/3drando/item_pool.hpp" + "soh/Enhancements/randomizer/3drando/keys.hpp" + "soh/Enhancements/randomizer/3drando/location_access.hpp" + "soh/Enhancements/randomizer/3drando/logic.hpp" + "soh/Enhancements/randomizer/3drando/menu.hpp" + "soh/Enhancements/randomizer/3drando/music.hpp" + "soh/Enhancements/randomizer/3drando/patch.hpp" + "soh/Enhancements/randomizer/3drando/playthrough.hpp" + "soh/Enhancements/randomizer/3drando/pool_functions.hpp" + "soh/Enhancements/randomizer/3drando/preset.hpp" + "soh/Enhancements/randomizer/3drando/rando_main.hpp" + "soh/Enhancements/randomizer/3drando/random.hpp" + "soh/Enhancements/randomizer/3drando/setting_descriptions.hpp" + "soh/Enhancements/randomizer/3drando/settings.hpp" + "soh/Enhancements/randomizer/3drando/shops.hpp" + "soh/Enhancements/randomizer/3drando/sound_effects.hpp" + "soh/Enhancements/randomizer/3drando/spoiler_log.hpp" + "soh/Enhancements/randomizer/3drando/starting_inventory.hpp" + "soh/Enhancements/randomizer/3drando/text.hpp" + "soh/Enhancements/randomizer/3drando/tinyxml2.h" + "soh/Enhancements/randomizer/3drando/trial.hpp" + "soh/Enhancements/randomizer/3drando/utils.hpp" +) +source_group("Header Files\\soh\\Enhancements\\randomizer\\3drando" FILES ${Header_Files__soh__Enhancements__randomizer__3drando}) + +set(Source_Files__soh + "soh/GbiWrap.cpp" + "soh/OTRAudio.h" + "soh/OTRGlobals.cpp" + "soh/OTRGlobals.h" + "soh/SaveManager.h" + "soh/SaveManager.cpp" + "soh/frame_interpolation.h" + "soh/frame_interpolation.cpp" + "soh/gu_pc.c" + "soh/stubs.c" + "soh/util.h" + "soh/util.cpp" + "soh/z_message_OTR.cpp" + "soh/z_play_otr.cpp" + "soh/z_scene_otr.cpp" +) +source_group("Source Files\\soh" FILES ${Source_Files__soh}) + +set(Source_Files__soh__Enhancements + "soh/Enhancements/bootcommands.c" + "soh/Enhancements/debugconsole.cpp" + "soh/Enhancements/gameconsole.c" + "soh/Enhancements/savestates.cpp" +) +source_group("Source Files\\soh\\Enhancements" FILES ${Source_Files__soh__Enhancements}) + +set(Source_Files__soh__Enhancements__cosmetics + "soh/Enhancements/cosmetics/CosmeticsEditor.cpp" +) +source_group("Source Files\\soh\\Enhancements\\cosmetics" FILES ${Source_Files__soh__Enhancements__cosmetics}) + +set(Source_Files__soh__Enhancements__debugger + "soh/Enhancements/debugger/actorViewer.cpp" + "soh/Enhancements/debugger/colViewer.cpp" + "soh/Enhancements/debugger/debugger.cpp" + "soh/Enhancements/debugger/debugSaveEditor.cpp" + "soh/Enhancements/debugger/ImGuiHelpers.cpp" +) +source_group("Source Files\\soh\\Enhancements\\debugger" FILES ${Source_Files__soh__Enhancements__debugger}) + +set(Source_Files__soh__Enhancements__randomizer + "soh/Enhancements/randomizer/randomizer.cpp" + "soh/Enhancements/randomizer/randomizer_item_tracker.cpp" +) +source_group("Source Files\\soh\\Enhancements\\randomizer" FILES ${Source_Files__soh__Enhancements__randomizer}) + +set(Source_Files__soh__Enhancements__randomizer__3drando + "soh/Enhancements/randomizer/3drando/cosmetics.cpp" + "soh/Enhancements/randomizer/3drando/custom_messages.cpp" + "soh/Enhancements/randomizer/3drando/debug.cpp" + "soh/Enhancements/randomizer/3drando/dungeon.cpp" + "soh/Enhancements/randomizer/3drando/entrance.cpp" + "soh/Enhancements/randomizer/3drando/fill.cpp" + "soh/Enhancements/randomizer/3drando/hint_list.cpp" + "soh/Enhancements/randomizer/3drando/hints.cpp" + "soh/Enhancements/randomizer/3drando/item.cpp" + "soh/Enhancements/randomizer/3drando/item_list.cpp" + "soh/Enhancements/randomizer/3drando/item_location.cpp" + "soh/Enhancements/randomizer/3drando/item_pool.cpp" + "soh/Enhancements/randomizer/3drando/location_access.cpp" + "soh/Enhancements/randomizer/3drando/logic.cpp" + "soh/Enhancements/randomizer/3drando/menu.cpp" + "soh/Enhancements/randomizer/3drando/music.cpp" + "soh/Enhancements/randomizer/3drando/patch.cpp" + "soh/Enhancements/randomizer/3drando/playthrough.cpp" + "soh/Enhancements/randomizer/3drando/preset.cpp" + "soh/Enhancements/randomizer/3drando/rando_main.cpp" + "soh/Enhancements/randomizer/3drando/random.cpp" + "soh/Enhancements/randomizer/3drando/setting_descriptions.cpp" + "soh/Enhancements/randomizer/3drando/settings.cpp" + "soh/Enhancements/randomizer/3drando/shops.cpp" + "soh/Enhancements/randomizer/3drando/sound_effects.cpp" + "soh/Enhancements/randomizer/3drando/spoiler_log.cpp" + "soh/Enhancements/randomizer/3drando/starting_inventory.cpp" + "soh/Enhancements/randomizer/3drando/tinyxml2.cpp" + "soh/Enhancements/randomizer/3drando/trial.cpp" + "soh/Enhancements/randomizer/3drando/utils.cpp" +) +source_group("Source Files\\soh\\Enhancements\\randomizer\\3drando" FILES ${Source_Files__soh__Enhancements__randomizer__3drando}) + +set(Source_Files__soh__Enhancements__randomizer__3drando__hint_list + "soh/Enhancements/randomizer/3drando/hint_list/hint_list_exclude_dungeon.cpp" + "soh/Enhancements/randomizer/3drando/hint_list/hint_list_exclude_overworld.cpp" + "soh/Enhancements/randomizer/3drando/hint_list/hint_list_item.cpp" +) +source_group("Source Files\\soh\\Enhancements\\randomizer\\3drando\\hint_list" FILES ${Source_Files__soh__Enhancements__randomizer__3drando__hint_list}) + +set(Source_Files__soh__Enhancements__randomizer__3drando__location_access + "soh/Enhancements/randomizer/3drando/location_access/locacc_bottom_of_the_well.cpp" + "soh/Enhancements/randomizer/3drando/location_access/locacc_castle_town.cpp" + "soh/Enhancements/randomizer/3drando/location_access/locacc_death_mountain.cpp" + "soh/Enhancements/randomizer/3drando/location_access/locacc_deku_tree.cpp" + "soh/Enhancements/randomizer/3drando/location_access/locacc_dodongos_cavern.cpp" + "soh/Enhancements/randomizer/3drando/location_access/locacc_fire_temple.cpp" + "soh/Enhancements/randomizer/3drando/location_access/locacc_forest_temple.cpp" + "soh/Enhancements/randomizer/3drando/location_access/locacc_ganons_castle.cpp" + "soh/Enhancements/randomizer/3drando/location_access/locacc_gerudo_training_grounds.cpp" + "soh/Enhancements/randomizer/3drando/location_access/locacc_gerudo_valley.cpp" + "soh/Enhancements/randomizer/3drando/location_access/locacc_hyrule_field.cpp" + "soh/Enhancements/randomizer/3drando/location_access/locacc_ice_cavern.cpp" + "soh/Enhancements/randomizer/3drando/location_access/locacc_jabujabus_belly.cpp" + "soh/Enhancements/randomizer/3drando/location_access/locacc_kakariko.cpp" + "soh/Enhancements/randomizer/3drando/location_access/locacc_lost_woods.cpp" + "soh/Enhancements/randomizer/3drando/location_access/locacc_shadow_temple.cpp" + "soh/Enhancements/randomizer/3drando/location_access/locacc_spirit_temple.cpp" + "soh/Enhancements/randomizer/3drando/location_access/locacc_water_temple.cpp" + "soh/Enhancements/randomizer/3drando/location_access/locacc_zoras_domain.cpp" +) +source_group("Source Files\\soh\\Enhancements\\randomizer\\3drando\\location_access" FILES ${Source_Files__soh__Enhancements__randomizer__3drando__location_access}) + +set(Source_Files__src__boot + "src/boot/assert.c" + "src/boot/boot_main.c" + "src/boot/build.c" + "src/boot/idle.c" + "src/boot/is_debug.c" + "src/boot/logutils.c" + "src/boot/missing_gcc_functions.c" + "src/boot/stackcheck.c" + "src/boot/viconfig.c" + "src/boot/yaz0.c" + "src/boot/z_locale.c" + "src/boot/z_std_dma.c" +) +source_group("Source Files\\src\\boot" FILES ${Source_Files__src__boot}) + +set(Source_Files__src__buffers + "src/buffers/gfxbuffers.c" + "src/buffers/heaps.c" + "src/buffers/zbuffer.c" +) +source_group("Source Files\\src\\buffers" FILES ${Source_Files__src__buffers}) + +set(Source_Files__src__code + "src/code/__osMalloc.c" + "src/code/audio_data.c" + "src/code/audio_effects.c" + "src/code/audio_heap.c" + "src/code/audio_init_params.c" + "src/code/audio_load.c" + "src/code/audio_playback.c" + "src/code/audio_seqplayer.c" + "src/code/audio_sound_params.c" + "src/code/audio_synthesis.c" + "src/code/audioMgr.c" + "src/code/code_800430A0.c" + "src/code/code_80043480.c" + "src/code/code_8006C3A0.c" + "src/code/code_8006C510.c" + "src/code/code_80097A00.c" + "src/code/code_800A9F30.c" + "src/code/code_800ACE70.c" + "src/code/code_800AD920.c" + "src/code/code_800BB0A0.c" + "src/code/code_800C3C20.c" + "src/code/code_800D2E30.c" + "src/code/code_800D31A0.c" + "src/code/code_800E4FE0.c" + "src/code/code_800E6840.c" + "src/code/code_800EC960.c" + "src/code/code_800F7260.c" + "src/code/code_800F9280.c" + "src/code/code_800FBCE0.c" + "src/code/code_800FC620.c" + "src/code/code_800FCE80.c" + "src/code/code_800FD970.c" + "src/code/code_801067F0.c" + "src/code/code_801068B0.c" + "src/code/db_camera.c" + "src/code/debug_malloc.c" + "src/code/fault.c" + "src/code/fault_drawer.c" + "src/code/flg_set.c" + "src/code/game.c" + "src/code/gamealloc.c" + "src/code/gfxprint.c" + "src/code/graph.c" + "src/code/irqmgr.c" + "src/code/jpegdecoder.c" + "src/code/jpegutils.c" + "src/code/listalloc.c" + "src/code/loadfragment2.c" + "src/code/logseverity.c" + "src/code/main.c" + "src/code/mempak.c" + "src/code/mtxuty-cvt.c" + "src/code/padmgr.c" + "src/code/padsetup.c" + "src/code/padutils.c" + "src/code/PreRender.c" + "src/code/printutils.c" + "src/code/relocation.c" + "src/code/sched.c" + "src/code/shrink_window.c" + "src/code/sleep.c" + "src/code/speed_meter.c" + "src/code/sys_cfb.c" + "src/code/sys_math.c" + "src/code/sys_math3d.c" + "src/code/sys_math_atan.c" + "src/code/sys_matrix.c" + "src/code/sys_ucode.c" + "src/code/system_malloc.c" + "src/code/title_setup.c" + "src/code/TwoHeadArena.c" + "src/code/ucode_disas.c" + "src/code/z_actor.c" + "src/code/z_actor_dlftbls.c" + "src/code/z_bgcheck.c" + "src/code/z_camera.c" + "src/code/z_cheap_proc.c" + "src/code/z_collision_btltbls.c" + "src/code/z_collision_check.c" + "src/code/z_common_data.c" + "src/code/z_construct.c" + "src/code/z_debug.c" + "src/code/z_debug_display.c" + "src/code/z_demo.c" + "src/code/z_DLF.c" + "src/code/z_draw.c" + "src/code/z_eff_blure.c" + "src/code/z_eff_shield_particle.c" + "src/code/z_eff_spark.c" + "src/code/z_eff_ss_dead.c" + "src/code/z_effect.c" + "src/code/z_effect_soft_sprite.c" + "src/code/z_effect_soft_sprite_dlftbls.c" + "src/code/z_effect_soft_sprite_old_init.c" + "src/code/z_elf_message.c" + "src/code/z_en_a_keep.c" + "src/code/z_en_item00.c" + "src/code/z_face_reaction.c" + "src/code/z_fbdemo.c" + "src/code/z_fbdemo_circle.c" + "src/code/z_fbdemo_fade.c" + "src/code/z_fbdemo_triforce.c" + "src/code/z_fbdemo_wipe1.c" + "src/code/z_fcurve_data_skelanime.c" + "src/code/z_frame_advance.c" + "src/code/z_game_dlftbls.c" + "src/code/z_game_over.c" + "src/code/z_horse.c" + "src/code/z_jpeg.c" + "src/code/z_kaleido_manager.c" + "src/code/z_kaleido_scope_call.c" + "src/code/z_kaleido_setup.c" + "src/code/z_kanfont.c" + "src/code/z_kankyo.c" + "src/code/z_lib.c" + "src/code/z_lifemeter.c" + "src/code/z_lights.c" + "src/code/z_malloc.c" + "src/code/z_map_data.c" + "src/code/z_map_exp.c" + "src/code/z_map_mark.c" + "src/code/z_message_PAL.c" + "src/code/z_moji.c" + "src/code/z_msgevent.c" + "src/code/z_olib.c" + "src/code/z_onepointdemo.c" + "src/code/z_onepointdemo_data.inc" + "src/code/z_parameter.c" + "src/code/z_path.c" + "src/code/z_play.c" + "src/code/z_player_call.c" + "src/code/z_player_lib.c" + "src/code/z_prenmi.c" + "src/code/z_prenmi_buff.c" + "src/code/z_quake.c" + "src/code/z_rcp.c" + "src/code/z_room.c" + "src/code/z_sample.c" + "src/code/z_scene.c" + "src/code/z_scene_table.c" + "src/code/z_skelanime.c" + "src/code/z_skin.c" + "src/code/z_skin_awb.c" + "src/code/z_skin_matrix.c" + "src/code/z_sound_source.c" + "src/code/z_sram.c" + "src/code/z_ss_sram.c" + "src/code/z_view.c" + "src/code/z_vimode.c" + "src/code/z_vismono.c" + "src/code/z_vr_box.c" + "src/code/z_vr_box_draw.c" +) +source_group("Source Files\\src\\code" FILES ${Source_Files__src__code}) + +set(Source_Files__src__libultra + "src/libultra/gu/coss.c" + "src/libultra/gu/guLookAt.c" + "src/libultra/gu/guLookAtHilite.c" + "src/libultra/gu/guPerspectiveF.c" + "src/libultra/gu/guPosition.c" + "src/libultra/gu/guS2DInitBg.c" + "src/libultra/gu/ortho.c" + "src/libultra/gu/rotate.c" + "src/libultra/gu/sins.c" + "src/libultra/gu/sintable.c" + "src/libultra/libc/sprintf.c" +) +source_group("Source Files\\src\\libultra" FILES ${Source_Files__src__libultra}) + +set(Source_Files__src__overlays__actors + "src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c" + "src/overlays/actors/ovl_Arms_Hook/z_arms_hook.h" + "src/overlays/actors/ovl_Arrow_Fire/z_arrow_fire.c" + "src/overlays/actors/ovl_Arrow_Fire/z_arrow_fire.h" + "src/overlays/actors/ovl_Arrow_Ice/z_arrow_ice.c" + "src/overlays/actors/ovl_Arrow_Ice/z_arrow_ice.h" + "src/overlays/actors/ovl_Arrow_Light/z_arrow_light.c" + "src/overlays/actors/ovl_Arrow_Light/z_arrow_light.h" + "src/overlays/actors/ovl_Bg_Bdan_Objects/z_bg_bdan_objects.c" + "src/overlays/actors/ovl_Bg_Bdan_Objects/z_bg_bdan_objects.h" + "src/overlays/actors/ovl_Bg_Bdan_Switch/z_bg_bdan_switch.c" + "src/overlays/actors/ovl_Bg_Bdan_Switch/z_bg_bdan_switch.h" + "src/overlays/actors/ovl_Bg_Bom_Guard/z_bg_bom_guard.c" + "src/overlays/actors/ovl_Bg_Bom_Guard/z_bg_bom_guard.h" + "src/overlays/actors/ovl_Bg_Bombwall/z_bg_bombwall.c" + "src/overlays/actors/ovl_Bg_Bombwall/z_bg_bombwall.h" + "src/overlays/actors/ovl_Bg_Bowl_Wall/z_bg_bowl_wall.c" + "src/overlays/actors/ovl_Bg_Bowl_Wall/z_bg_bowl_wall.h" + "src/overlays/actors/ovl_Bg_Breakwall/z_bg_breakwall.c" + "src/overlays/actors/ovl_Bg_Breakwall/z_bg_breakwall.h" + "src/overlays/actors/ovl_Bg_Ddan_Jd/z_bg_ddan_jd.c" + "src/overlays/actors/ovl_Bg_Ddan_Jd/z_bg_ddan_jd.h" + "src/overlays/actors/ovl_Bg_Ddan_Kd/z_bg_ddan_kd.c" + "src/overlays/actors/ovl_Bg_Ddan_Kd/z_bg_ddan_kd.h" + "src/overlays/actors/ovl_Bg_Dodoago/z_bg_dodoago.c" + "src/overlays/actors/ovl_Bg_Dodoago/z_bg_dodoago.h" + "src/overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.c" + "src/overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.h" + "src/overlays/actors/ovl_Bg_Ganon_Otyuka/z_bg_ganon_otyuka.c" + "src/overlays/actors/ovl_Bg_Ganon_Otyuka/z_bg_ganon_otyuka.h" + "src/overlays/actors/ovl_Bg_Gate_Shutter/z_bg_gate_shutter.c" + "src/overlays/actors/ovl_Bg_Gate_Shutter/z_bg_gate_shutter.h" + "src/overlays/actors/ovl_Bg_Gjyo_Bridge/z_bg_gjyo_bridge.c" + "src/overlays/actors/ovl_Bg_Gjyo_Bridge/z_bg_gjyo_bridge.h" + "src/overlays/actors/ovl_Bg_Gnd_Darkmeiro/z_bg_gnd_darkmeiro.c" + "src/overlays/actors/ovl_Bg_Gnd_Darkmeiro/z_bg_gnd_darkmeiro.h" + "src/overlays/actors/ovl_Bg_Gnd_Firemeiro/z_bg_gnd_firemeiro.c" + "src/overlays/actors/ovl_Bg_Gnd_Firemeiro/z_bg_gnd_firemeiro.h" + "src/overlays/actors/ovl_Bg_Gnd_Iceblock/z_bg_gnd_iceblock.c" + "src/overlays/actors/ovl_Bg_Gnd_Iceblock/z_bg_gnd_iceblock.h" + "src/overlays/actors/ovl_Bg_Gnd_Nisekabe/z_bg_gnd_nisekabe.c" + "src/overlays/actors/ovl_Bg_Gnd_Nisekabe/z_bg_gnd_nisekabe.h" + "src/overlays/actors/ovl_Bg_Gnd_Soulmeiro/z_bg_gnd_soulmeiro.c" + "src/overlays/actors/ovl_Bg_Gnd_Soulmeiro/z_bg_gnd_soulmeiro.h" + "src/overlays/actors/ovl_Bg_Haka/z_bg_haka.c" + "src/overlays/actors/ovl_Bg_Haka/z_bg_haka.h" + "src/overlays/actors/ovl_Bg_Haka_Gate/z_bg_haka_gate.c" + "src/overlays/actors/ovl_Bg_Haka_Gate/z_bg_haka_gate.h" + "src/overlays/actors/ovl_Bg_Haka_Huta/z_bg_haka_huta.c" + "src/overlays/actors/ovl_Bg_Haka_Huta/z_bg_haka_huta.h" + "src/overlays/actors/ovl_Bg_Haka_Megane/z_bg_haka_megane.c" + "src/overlays/actors/ovl_Bg_Haka_Megane/z_bg_haka_megane.h" + "src/overlays/actors/ovl_Bg_Haka_MeganeBG/z_bg_haka_meganebg.c" + "src/overlays/actors/ovl_Bg_Haka_MeganeBG/z_bg_haka_meganebg.h" + "src/overlays/actors/ovl_Bg_Haka_Sgami/z_bg_haka_sgami.c" + "src/overlays/actors/ovl_Bg_Haka_Sgami/z_bg_haka_sgami.h" + "src/overlays/actors/ovl_Bg_Haka_Ship/z_bg_haka_ship.c" + "src/overlays/actors/ovl_Bg_Haka_Ship/z_bg_haka_ship.h" + "src/overlays/actors/ovl_Bg_Haka_Trap/z_bg_haka_trap.c" + "src/overlays/actors/ovl_Bg_Haka_Trap/z_bg_haka_trap.h" + "src/overlays/actors/ovl_Bg_Haka_Tubo/z_bg_haka_tubo.c" + "src/overlays/actors/ovl_Bg_Haka_Tubo/z_bg_haka_tubo.h" + "src/overlays/actors/ovl_Bg_Haka_Water/z_bg_haka_water.c" + "src/overlays/actors/ovl_Bg_Haka_Water/z_bg_haka_water.h" + "src/overlays/actors/ovl_Bg_Haka_Zou/z_bg_haka_zou.c" + "src/overlays/actors/ovl_Bg_Haka_Zou/z_bg_haka_zou.h" + "src/overlays/actors/ovl_Bg_Heavy_Block/z_bg_heavy_block.c" + "src/overlays/actors/ovl_Bg_Heavy_Block/z_bg_heavy_block.h" + "src/overlays/actors/ovl_Bg_Hidan_Curtain/z_bg_hidan_curtain.c" + "src/overlays/actors/ovl_Bg_Hidan_Curtain/z_bg_hidan_curtain.h" + "src/overlays/actors/ovl_Bg_Hidan_Dalm/z_bg_hidan_dalm.c" + "src/overlays/actors/ovl_Bg_Hidan_Dalm/z_bg_hidan_dalm.h" + "src/overlays/actors/ovl_Bg_Hidan_Firewall/z_bg_hidan_firewall.c" + "src/overlays/actors/ovl_Bg_Hidan_Firewall/z_bg_hidan_firewall.h" + "src/overlays/actors/ovl_Bg_Hidan_Fslift/z_bg_hidan_fslift.c" + "src/overlays/actors/ovl_Bg_Hidan_Fslift/z_bg_hidan_fslift.h" + "src/overlays/actors/ovl_Bg_Hidan_Fwbig/z_bg_hidan_fwbig.c" + "src/overlays/actors/ovl_Bg_Hidan_Fwbig/z_bg_hidan_fwbig.h" + "src/overlays/actors/ovl_Bg_Hidan_Hamstep/z_bg_hidan_hamstep.c" + "src/overlays/actors/ovl_Bg_Hidan_Hamstep/z_bg_hidan_hamstep.h" + "src/overlays/actors/ovl_Bg_Hidan_Hrock/z_bg_hidan_hrock.c" + "src/overlays/actors/ovl_Bg_Hidan_Hrock/z_bg_hidan_hrock.h" + "src/overlays/actors/ovl_Bg_Hidan_Kousi/z_bg_hidan_kousi.c" + "src/overlays/actors/ovl_Bg_Hidan_Kousi/z_bg_hidan_kousi.h" + "src/overlays/actors/ovl_Bg_Hidan_Kowarerukabe/z_bg_hidan_kowarerukabe.c" + "src/overlays/actors/ovl_Bg_Hidan_Kowarerukabe/z_bg_hidan_kowarerukabe.h" + "src/overlays/actors/ovl_Bg_Hidan_Rock/z_bg_hidan_rock.c" + "src/overlays/actors/ovl_Bg_Hidan_Rock/z_bg_hidan_rock.h" + "src/overlays/actors/ovl_Bg_Hidan_Rsekizou/z_bg_hidan_rsekizou.c" + "src/overlays/actors/ovl_Bg_Hidan_Rsekizou/z_bg_hidan_rsekizou.h" + "src/overlays/actors/ovl_Bg_Hidan_Sekizou/z_bg_hidan_sekizou.c" + "src/overlays/actors/ovl_Bg_Hidan_Sekizou/z_bg_hidan_sekizou.h" + "src/overlays/actors/ovl_Bg_Hidan_Sima/z_bg_hidan_sima.c" + "src/overlays/actors/ovl_Bg_Hidan_Sima/z_bg_hidan_sima.h" + "src/overlays/actors/ovl_Bg_Hidan_Syoku/z_bg_hidan_syoku.c" + "src/overlays/actors/ovl_Bg_Hidan_Syoku/z_bg_hidan_syoku.h" + "src/overlays/actors/ovl_Bg_Ice_Objects/z_bg_ice_objects.c" + "src/overlays/actors/ovl_Bg_Ice_Objects/z_bg_ice_objects.h" + "src/overlays/actors/ovl_Bg_Ice_Shelter/z_bg_ice_shelter.c" + "src/overlays/actors/ovl_Bg_Ice_Shelter/z_bg_ice_shelter.h" + "src/overlays/actors/ovl_Bg_Ice_Shutter/z_bg_ice_shutter.c" + "src/overlays/actors/ovl_Bg_Ice_Shutter/z_bg_ice_shutter.h" + "src/overlays/actors/ovl_Bg_Ice_Turara/z_bg_ice_turara.c" + "src/overlays/actors/ovl_Bg_Ice_Turara/z_bg_ice_turara.h" + "src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c" + "src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.h" + "src/overlays/actors/ovl_Bg_Jya_1flift/z_bg_jya_1flift.c" + "src/overlays/actors/ovl_Bg_Jya_1flift/z_bg_jya_1flift.h" + "src/overlays/actors/ovl_Bg_Jya_Amishutter/z_bg_jya_amishutter.c" + "src/overlays/actors/ovl_Bg_Jya_Amishutter/z_bg_jya_amishutter.h" + "src/overlays/actors/ovl_Bg_Jya_Bigmirror/z_bg_jya_bigmirror.c" + "src/overlays/actors/ovl_Bg_Jya_Bigmirror/z_bg_jya_bigmirror.h" + "src/overlays/actors/ovl_Bg_Jya_Block/z_bg_jya_block.c" + "src/overlays/actors/ovl_Bg_Jya_Block/z_bg_jya_block.h" + "src/overlays/actors/ovl_Bg_Jya_Bombchuiwa/z_bg_jya_bombchuiwa.c" + "src/overlays/actors/ovl_Bg_Jya_Bombchuiwa/z_bg_jya_bombchuiwa.h" + "src/overlays/actors/ovl_Bg_Jya_Bombiwa/z_bg_jya_bombiwa.c" + "src/overlays/actors/ovl_Bg_Jya_Bombiwa/z_bg_jya_bombiwa.h" + "src/overlays/actors/ovl_Bg_Jya_Cobra/z_bg_jya_cobra.c" + "src/overlays/actors/ovl_Bg_Jya_Cobra/z_bg_jya_cobra.h" + "src/overlays/actors/ovl_Bg_Jya_Goroiwa/z_bg_jya_goroiwa.c" + "src/overlays/actors/ovl_Bg_Jya_Goroiwa/z_bg_jya_goroiwa.h" + "src/overlays/actors/ovl_Bg_Jya_Haheniron/z_bg_jya_haheniron.c" + "src/overlays/actors/ovl_Bg_Jya_Haheniron/z_bg_jya_haheniron.h" + "src/overlays/actors/ovl_Bg_Jya_Ironobj/z_bg_jya_ironobj.c" + "src/overlays/actors/ovl_Bg_Jya_Ironobj/z_bg_jya_ironobj.h" + "src/overlays/actors/ovl_Bg_Jya_Kanaami/z_bg_jya_kanaami.c" + "src/overlays/actors/ovl_Bg_Jya_Kanaami/z_bg_jya_kanaami.h" + "src/overlays/actors/ovl_Bg_Jya_Lift/z_bg_jya_lift.c" + "src/overlays/actors/ovl_Bg_Jya_Lift/z_bg_jya_lift.h" + "src/overlays/actors/ovl_Bg_Jya_Megami/z_bg_jya_megami.c" + "src/overlays/actors/ovl_Bg_Jya_Megami/z_bg_jya_megami.h" + "src/overlays/actors/ovl_Bg_Jya_Zurerukabe/z_bg_jya_zurerukabe.c" + "src/overlays/actors/ovl_Bg_Jya_Zurerukabe/z_bg_jya_zurerukabe.h" + "src/overlays/actors/ovl_Bg_Menkuri_Eye/z_bg_menkuri_eye.c" + "src/overlays/actors/ovl_Bg_Menkuri_Eye/z_bg_menkuri_eye.h" + "src/overlays/actors/ovl_Bg_Menkuri_Kaiten/z_bg_menkuri_kaiten.c" + "src/overlays/actors/ovl_Bg_Menkuri_Kaiten/z_bg_menkuri_kaiten.h" + "src/overlays/actors/ovl_Bg_Menkuri_Nisekabe/z_bg_menkuri_nisekabe.c" + "src/overlays/actors/ovl_Bg_Menkuri_Nisekabe/z_bg_menkuri_nisekabe.h" + "src/overlays/actors/ovl_Bg_Mizu_Bwall/z_bg_mizu_bwall.c" + "src/overlays/actors/ovl_Bg_Mizu_Bwall/z_bg_mizu_bwall.h" + "src/overlays/actors/ovl_Bg_Mizu_Movebg/z_bg_mizu_movebg.c" + "src/overlays/actors/ovl_Bg_Mizu_Movebg/z_bg_mizu_movebg.h" + "src/overlays/actors/ovl_Bg_Mizu_Shutter/z_bg_mizu_shutter.c" + "src/overlays/actors/ovl_Bg_Mizu_Shutter/z_bg_mizu_shutter.h" + "src/overlays/actors/ovl_Bg_Mizu_Uzu/z_bg_mizu_uzu.c" + "src/overlays/actors/ovl_Bg_Mizu_Uzu/z_bg_mizu_uzu.h" + "src/overlays/actors/ovl_Bg_Mizu_Water/z_bg_mizu_water.c" + "src/overlays/actors/ovl_Bg_Mizu_Water/z_bg_mizu_water.h" + "src/overlays/actors/ovl_Bg_Mjin/z_bg_mjin.c" + "src/overlays/actors/ovl_Bg_Mjin/z_bg_mjin.h" + "src/overlays/actors/ovl_Bg_Mori_Bigst/z_bg_mori_bigst.c" + "src/overlays/actors/ovl_Bg_Mori_Bigst/z_bg_mori_bigst.h" + "src/overlays/actors/ovl_Bg_Mori_Elevator/z_bg_mori_elevator.c" + "src/overlays/actors/ovl_Bg_Mori_Elevator/z_bg_mori_elevator.h" + "src/overlays/actors/ovl_Bg_Mori_Hashigo/z_bg_mori_hashigo.c" + "src/overlays/actors/ovl_Bg_Mori_Hashigo/z_bg_mori_hashigo.h" + "src/overlays/actors/ovl_Bg_Mori_Hashira4/z_bg_mori_hashira4.c" + "src/overlays/actors/ovl_Bg_Mori_Hashira4/z_bg_mori_hashira4.h" + "src/overlays/actors/ovl_Bg_Mori_Hineri/z_bg_mori_hineri.c" + "src/overlays/actors/ovl_Bg_Mori_Hineri/z_bg_mori_hineri.h" + "src/overlays/actors/ovl_Bg_Mori_Idomizu/z_bg_mori_idomizu.c" + "src/overlays/actors/ovl_Bg_Mori_Idomizu/z_bg_mori_idomizu.h" + "src/overlays/actors/ovl_Bg_Mori_Kaitenkabe/z_bg_mori_kaitenkabe.c" + "src/overlays/actors/ovl_Bg_Mori_Kaitenkabe/z_bg_mori_kaitenkabe.h" + "src/overlays/actors/ovl_Bg_Mori_Rakkatenjo/z_bg_mori_rakkatenjo.c" + "src/overlays/actors/ovl_Bg_Mori_Rakkatenjo/z_bg_mori_rakkatenjo.h" + "src/overlays/actors/ovl_Bg_Po_Event/z_bg_po_event.c" + "src/overlays/actors/ovl_Bg_Po_Event/z_bg_po_event.h" + "src/overlays/actors/ovl_Bg_Po_Syokudai/z_bg_po_syokudai.c" + "src/overlays/actors/ovl_Bg_Po_Syokudai/z_bg_po_syokudai.h" + "src/overlays/actors/ovl_Bg_Pushbox/z_bg_pushbox.c" + "src/overlays/actors/ovl_Bg_Pushbox/z_bg_pushbox.h" + "src/overlays/actors/ovl_Bg_Relay_Objects/z_bg_relay_objects.c" + "src/overlays/actors/ovl_Bg_Relay_Objects/z_bg_relay_objects.h" + "src/overlays/actors/ovl_Bg_Spot00_Break/z_bg_spot00_break.c" + "src/overlays/actors/ovl_Bg_Spot00_Break/z_bg_spot00_break.h" + "src/overlays/actors/ovl_Bg_Spot00_Hanebasi/z_bg_spot00_hanebasi.c" + "src/overlays/actors/ovl_Bg_Spot00_Hanebasi/z_bg_spot00_hanebasi.h" + "src/overlays/actors/ovl_Bg_Spot01_Fusya/z_bg_spot01_fusya.c" + "src/overlays/actors/ovl_Bg_Spot01_Fusya/z_bg_spot01_fusya.h" + "src/overlays/actors/ovl_Bg_Spot01_Idohashira/z_bg_spot01_idohashira.c" + "src/overlays/actors/ovl_Bg_Spot01_Idohashira/z_bg_spot01_idohashira.h" + "src/overlays/actors/ovl_Bg_Spot01_Idomizu/z_bg_spot01_idomizu.c" + "src/overlays/actors/ovl_Bg_Spot01_Idomizu/z_bg_spot01_idomizu.h" + "src/overlays/actors/ovl_Bg_Spot01_Idosoko/z_bg_spot01_idosoko.c" + "src/overlays/actors/ovl_Bg_Spot01_Idosoko/z_bg_spot01_idosoko.h" + "src/overlays/actors/ovl_Bg_Spot01_Objects2/z_bg_spot01_objects2.c" + "src/overlays/actors/ovl_Bg_Spot01_Objects2/z_bg_spot01_objects2.h" + "src/overlays/actors/ovl_Bg_Spot02_Objects/z_bg_spot02_objects.c" + "src/overlays/actors/ovl_Bg_Spot02_Objects/z_bg_spot02_objects.h" + "src/overlays/actors/ovl_Bg_Spot03_Taki/z_bg_spot03_taki.c" + "src/overlays/actors/ovl_Bg_Spot03_Taki/z_bg_spot03_taki.h" + "src/overlays/actors/ovl_Bg_Spot05_Soko/z_bg_spot05_soko.c" + "src/overlays/actors/ovl_Bg_Spot05_Soko/z_bg_spot05_soko.h" + "src/overlays/actors/ovl_Bg_Spot06_Objects/z_bg_spot06_objects.c" + "src/overlays/actors/ovl_Bg_Spot06_Objects/z_bg_spot06_objects.h" + "src/overlays/actors/ovl_Bg_Spot07_Taki/z_bg_spot07_taki.c" + "src/overlays/actors/ovl_Bg_Spot07_Taki/z_bg_spot07_taki.h" + "src/overlays/actors/ovl_Bg_Spot08_Bakudankabe/z_bg_spot08_bakudankabe.c" + "src/overlays/actors/ovl_Bg_Spot08_Bakudankabe/z_bg_spot08_bakudankabe.h" + "src/overlays/actors/ovl_Bg_Spot08_Iceblock/z_bg_spot08_iceblock.c" + "src/overlays/actors/ovl_Bg_Spot08_Iceblock/z_bg_spot08_iceblock.h" + "src/overlays/actors/ovl_Bg_Spot09_Obj/z_bg_spot09_obj.c" + "src/overlays/actors/ovl_Bg_Spot09_Obj/z_bg_spot09_obj.h" + "src/overlays/actors/ovl_Bg_Spot11_Bakudankabe/z_bg_spot11_bakudankabe.c" + "src/overlays/actors/ovl_Bg_Spot11_Bakudankabe/z_bg_spot11_bakudankabe.h" + "src/overlays/actors/ovl_Bg_Spot11_Oasis/z_bg_spot11_oasis.c" + "src/overlays/actors/ovl_Bg_Spot11_Oasis/z_bg_spot11_oasis.h" + "src/overlays/actors/ovl_Bg_Spot12_Gate/z_bg_spot12_gate.c" + "src/overlays/actors/ovl_Bg_Spot12_Gate/z_bg_spot12_gate.h" + "src/overlays/actors/ovl_Bg_Spot12_Saku/z_bg_spot12_saku.c" + "src/overlays/actors/ovl_Bg_Spot12_Saku/z_bg_spot12_saku.h" + "src/overlays/actors/ovl_Bg_Spot15_Rrbox/z_bg_spot15_rrbox.c" + "src/overlays/actors/ovl_Bg_Spot15_Rrbox/z_bg_spot15_rrbox.h" + "src/overlays/actors/ovl_Bg_Spot15_Saku/z_bg_spot15_saku.c" + "src/overlays/actors/ovl_Bg_Spot15_Saku/z_bg_spot15_saku.h" + "src/overlays/actors/ovl_Bg_Spot16_Bombstone/z_bg_spot16_bombstone.c" + "src/overlays/actors/ovl_Bg_Spot16_Bombstone/z_bg_spot16_bombstone.h" + "src/overlays/actors/ovl_Bg_Spot16_Doughnut/z_bg_spot16_doughnut.c" + "src/overlays/actors/ovl_Bg_Spot16_Doughnut/z_bg_spot16_doughnut.h" + "src/overlays/actors/ovl_Bg_Spot17_Bakudankabe/z_bg_spot17_bakudankabe.c" + "src/overlays/actors/ovl_Bg_Spot17_Bakudankabe/z_bg_spot17_bakudankabe.h" + "src/overlays/actors/ovl_Bg_Spot17_Funen/z_bg_spot17_funen.c" + "src/overlays/actors/ovl_Bg_Spot17_Funen/z_bg_spot17_funen.h" + "src/overlays/actors/ovl_Bg_Spot18_Basket/z_bg_spot18_basket.c" + "src/overlays/actors/ovl_Bg_Spot18_Basket/z_bg_spot18_basket.h" + "src/overlays/actors/ovl_Bg_Spot18_Futa/z_bg_spot18_futa.c" + "src/overlays/actors/ovl_Bg_Spot18_Futa/z_bg_spot18_futa.h" + "src/overlays/actors/ovl_Bg_Spot18_Obj/z_bg_spot18_obj.c" + "src/overlays/actors/ovl_Bg_Spot18_Obj/z_bg_spot18_obj.h" + "src/overlays/actors/ovl_Bg_Spot18_Shutter/z_bg_spot18_shutter.c" + "src/overlays/actors/ovl_Bg_Spot18_Shutter/z_bg_spot18_shutter.h" + "src/overlays/actors/ovl_Bg_Sst_Floor/z_bg_sst_floor.c" + "src/overlays/actors/ovl_Bg_Sst_Floor/z_bg_sst_floor.h" + "src/overlays/actors/ovl_Bg_Toki_Hikari/z_bg_toki_hikari.c" + "src/overlays/actors/ovl_Bg_Toki_Hikari/z_bg_toki_hikari.h" + "src/overlays/actors/ovl_Bg_Toki_Swd/z_bg_toki_swd.c" + "src/overlays/actors/ovl_Bg_Toki_Swd/z_bg_toki_swd.h" + "src/overlays/actors/ovl_Bg_Toki_Swd/z_bg_toki_swd_cutscene_data_1.c" + "src/overlays/actors/ovl_Bg_Toki_Swd/z_bg_toki_swd_cutscene_data_2.c" + "src/overlays/actors/ovl_Bg_Toki_Swd/z_bg_toki_swd_cutscene_data_3.c" + "src/overlays/actors/ovl_Bg_Treemouth/z_bg_treemouth.c" + "src/overlays/actors/ovl_Bg_Treemouth/z_bg_treemouth.h" + "src/overlays/actors/ovl_Bg_Treemouth/z_bg_treemouth_cutscene_data.c" + "src/overlays/actors/ovl_Bg_Umajump/z_bg_umajump.c" + "src/overlays/actors/ovl_Bg_Umajump/z_bg_umajump.h" + "src/overlays/actors/ovl_Bg_Vb_Sima/z_bg_vb_sima.c" + "src/overlays/actors/ovl_Bg_Vb_Sima/z_bg_vb_sima.h" + "src/overlays/actors/ovl_Bg_Ydan_Hasi/z_bg_ydan_hasi.c" + "src/overlays/actors/ovl_Bg_Ydan_Hasi/z_bg_ydan_hasi.h" + "src/overlays/actors/ovl_Bg_Ydan_Maruta/z_bg_ydan_maruta.c" + "src/overlays/actors/ovl_Bg_Ydan_Maruta/z_bg_ydan_maruta.h" + "src/overlays/actors/ovl_Bg_Ydan_Sp/z_bg_ydan_sp.c" + "src/overlays/actors/ovl_Bg_Ydan_Sp/z_bg_ydan_sp.h" + "src/overlays/actors/ovl_Bg_Zg/z_bg_zg.c" + "src/overlays/actors/ovl_Bg_Zg/z_bg_zg.h" + "src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.c" + "src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.h" + "src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo_data.c" + "src/overlays/actors/ovl_Boss_Fd/z_boss_fd.c" + "src/overlays/actors/ovl_Boss_Fd/z_boss_fd.h" + "src/overlays/actors/ovl_Boss_Fd/z_boss_fd_colchk.c" + "src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2.c" + "src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2.h" + "src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2_colchk.c" + "src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c" + "src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.h" + "src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c" + "src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.h" + "src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2_data.c" + "src/overlays/actors/ovl_Boss_Ganondrof/z_boss_ganondrof.c" + "src/overlays/actors/ovl_Boss_Ganondrof/z_boss_ganondrof.h" + "src/overlays/actors/ovl_Boss_Goma/z_boss_goma.c" + "src/overlays/actors/ovl_Boss_Goma/z_boss_goma.h" + "src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c" + "src/overlays/actors/ovl_Boss_Mo/z_boss_mo.h" + "src/overlays/actors/ovl_Boss_Mo/z_boss_mo_colchk.c" + "src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c" + "src/overlays/actors/ovl_Boss_Sst/z_boss_sst.h" + "src/overlays/actors/ovl_Boss_Sst/z_boss_sst_colchk.c" + "src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c" + "src/overlays/actors/ovl_Boss_Tw/z_boss_tw.h" + "src/overlays/actors/ovl_Boss_Va/z_boss_va.c" + "src/overlays/actors/ovl_Boss_Va/z_boss_va.h" + "src/overlays/actors/ovl_Demo_6K/z_demo_6k.c" + "src/overlays/actors/ovl_Demo_6K/z_demo_6k.h" + "src/overlays/actors/ovl_Demo_Du/z_demo_du.c" + "src/overlays/actors/ovl_Demo_Du/z_demo_du.h" + "src/overlays/actors/ovl_Demo_Du/z_demo_du_cutscene_data.c" + "src/overlays/actors/ovl_Demo_Ec/z_demo_ec.c" + "src/overlays/actors/ovl_Demo_Ec/z_demo_ec.h" + "src/overlays/actors/ovl_Demo_Effect/z_demo_effect.c" + "src/overlays/actors/ovl_Demo_Effect/z_demo_effect.h" + "src/overlays/actors/ovl_Demo_Ext/z_demo_ext.c" + "src/overlays/actors/ovl_Demo_Ext/z_demo_ext.h" + "src/overlays/actors/ovl_Demo_Geff/z_demo_geff.c" + "src/overlays/actors/ovl_Demo_Geff/z_demo_geff.h" + "src/overlays/actors/ovl_Demo_Gj/z_demo_gj.c" + "src/overlays/actors/ovl_Demo_Gj/z_demo_gj.h" + "src/overlays/actors/ovl_Demo_Go/z_demo_go.c" + "src/overlays/actors/ovl_Demo_Go/z_demo_go.h" + "src/overlays/actors/ovl_Demo_Gt/z_demo_gt.c" + "src/overlays/actors/ovl_Demo_Gt/z_demo_gt.h" + "src/overlays/actors/ovl_Demo_Ik/z_demo_ik.c" + "src/overlays/actors/ovl_Demo_Ik/z_demo_ik.h" + "src/overlays/actors/ovl_Demo_Im/z_demo_im.c" + "src/overlays/actors/ovl_Demo_Im/z_demo_im.h" + "src/overlays/actors/ovl_Demo_Im/z_demo_im_cutscene_data.c" + "src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c" + "src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.h" + "src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo_cutscene_data1.c" + "src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo_cutscene_data2.c" + "src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo_cutscene_data3.c" + "src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo_cutscene_data4.c" + "src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo_cutscene_data5.c" + "src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo_cutscene_data6.c" + "src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo_cutscene_data7.c" + "src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo_cutscene_data8.c" + "src/overlays/actors/ovl_Demo_Kekkai/z_demo_kekkai.c" + "src/overlays/actors/ovl_Demo_Kekkai/z_demo_kekkai.h" + "src/overlays/actors/ovl_Demo_Sa/z_demo_sa.c" + "src/overlays/actors/ovl_Demo_Sa/z_demo_sa.h" + "src/overlays/actors/ovl_Demo_Sa/z_demo_sa_cutscene_data.c" + "src/overlays/actors/ovl_Demo_Shd/z_demo_shd.c" + "src/overlays/actors/ovl_Demo_Shd/z_demo_shd.h" + "src/overlays/actors/ovl_Demo_Tre_Lgt/z_demo_tre_lgt.c" + "src/overlays/actors/ovl_Demo_Tre_Lgt/z_demo_tre_lgt.h" + "src/overlays/actors/ovl_Door_Ana/z_door_ana.c" + "src/overlays/actors/ovl_Door_Ana/z_door_ana.h" + "src/overlays/actors/ovl_Door_Gerudo/z_door_gerudo.c" + "src/overlays/actors/ovl_Door_Gerudo/z_door_gerudo.h" + "src/overlays/actors/ovl_Door_Killer/z_door_killer.c" + "src/overlays/actors/ovl_Door_Killer/z_door_killer.h" + "src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c" + "src/overlays/actors/ovl_Door_Shutter/z_door_shutter.h" + "src/overlays/actors/ovl_Door_Toki/z_door_toki.c" + "src/overlays/actors/ovl_Door_Toki/z_door_toki.h" + "src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c" + "src/overlays/actors/ovl_Door_Warp1/z_door_warp1.h" + "src/overlays/actors/ovl_Efc_Erupc/z_efc_erupc.c" + "src/overlays/actors/ovl_Efc_Erupc/z_efc_erupc.h" + "src/overlays/actors/ovl_Eff_Dust/z_eff_dust.c" + "src/overlays/actors/ovl_Eff_Dust/z_eff_dust.h" + "src/overlays/actors/ovl_Elf_Msg/z_elf_msg.c" + "src/overlays/actors/ovl_Elf_Msg/z_elf_msg.h" + "src/overlays/actors/ovl_Elf_Msg2/z_elf_msg2.c" + "src/overlays/actors/ovl_Elf_Msg2/z_elf_msg2.h" + "src/overlays/actors/ovl_En_Am/z_en_am.c" + "src/overlays/actors/ovl_En_Am/z_en_am.h" + "src/overlays/actors/ovl_En_Ani/z_en_ani.c" + "src/overlays/actors/ovl_En_Ani/z_en_ani.h" + "src/overlays/actors/ovl_En_Anubice/z_en_anubice.c" + "src/overlays/actors/ovl_En_Anubice/z_en_anubice.h" + "src/overlays/actors/ovl_En_Anubice_Fire/z_en_anubice_fire.c" + "src/overlays/actors/ovl_En_Anubice_Fire/z_en_anubice_fire.h" + "src/overlays/actors/ovl_En_Anubice_Tag/z_en_anubice_tag.c" + "src/overlays/actors/ovl_En_Anubice_Tag/z_en_anubice_tag.h" + "src/overlays/actors/ovl_En_Arow_Trap/z_en_arow_trap.c" + "src/overlays/actors/ovl_En_Arow_Trap/z_en_arow_trap.h" + "src/overlays/actors/ovl_En_Arrow/z_en_arrow.c" + "src/overlays/actors/ovl_En_Arrow/z_en_arrow.h" + "src/overlays/actors/ovl_En_Attack_Niw/z_en_attack_niw.c" + "src/overlays/actors/ovl_En_Attack_Niw/z_en_attack_niw.h" + "src/overlays/actors/ovl_En_Ba/z_en_ba.c" + "src/overlays/actors/ovl_En_Ba/z_en_ba.h" + "src/overlays/actors/ovl_En_Bb/z_en_bb.c" + "src/overlays/actors/ovl_En_Bb/z_en_bb.h" + "src/overlays/actors/ovl_En_Bdfire/z_en_bdfire.c" + "src/overlays/actors/ovl_En_Bdfire/z_en_bdfire.h" + "src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c" + "src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.h" + "src/overlays/actors/ovl_En_Bili/z_en_bili.c" + "src/overlays/actors/ovl_En_Bili/z_en_bili.h" + "src/overlays/actors/ovl_En_Bird/z_en_bird.c" + "src/overlays/actors/ovl_En_Bird/z_en_bird.h" + "src/overlays/actors/ovl_En_Blkobj/z_en_blkobj.c" + "src/overlays/actors/ovl_En_Blkobj/z_en_blkobj.h" + "src/overlays/actors/ovl_En_Bom/z_en_bom.c" + "src/overlays/actors/ovl_En_Bom/z_en_bom.h" + "src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c" + "src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.h" + "src/overlays/actors/ovl_En_Bom_Bowl_Pit/z_en_bom_bowl_pit.c" + "src/overlays/actors/ovl_En_Bom_Bowl_Pit/z_en_bom_bowl_pit.h" + "src/overlays/actors/ovl_En_Bom_Chu/z_en_bom_chu.c" + "src/overlays/actors/ovl_En_Bom_Chu/z_en_bom_chu.h" + "src/overlays/actors/ovl_En_Bombf/z_en_bombf.c" + "src/overlays/actors/ovl_En_Bombf/z_en_bombf.h" + "src/overlays/actors/ovl_En_Boom/z_en_boom.c" + "src/overlays/actors/ovl_En_Boom/z_en_boom.h" + "src/overlays/actors/ovl_En_Box/z_en_box.c" + "src/overlays/actors/ovl_En_Box/z_en_box.h" + "src/overlays/actors/ovl_En_Brob/z_en_brob.c" + "src/overlays/actors/ovl_En_Brob/z_en_brob.h" + "src/overlays/actors/ovl_En_Bubble/z_en_bubble.c" + "src/overlays/actors/ovl_En_Bubble/z_en_bubble.h" + "src/overlays/actors/ovl_En_Butte/z_en_butte.c" + "src/overlays/actors/ovl_En_Butte/z_en_butte.h" + "src/overlays/actors/ovl_En_Bw/z_en_bw.c" + "src/overlays/actors/ovl_En_Bw/z_en_bw.h" + "src/overlays/actors/ovl_En_Bx/z_en_bx.c" + "src/overlays/actors/ovl_En_Bx/z_en_bx.h" + "src/overlays/actors/ovl_En_Changer/z_en_changer.c" + "src/overlays/actors/ovl_En_Changer/z_en_changer.h" + "src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.c" + "src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.h" + "src/overlays/actors/ovl_En_Cow/z_en_cow.c" + "src/overlays/actors/ovl_En_Cow/z_en_cow.h" + "src/overlays/actors/ovl_En_Crow/z_en_crow.c" + "src/overlays/actors/ovl_En_Crow/z_en_crow.h" + "src/overlays/actors/ovl_En_Cs/z_en_cs.c" + "src/overlays/actors/ovl_En_Cs/z_en_cs.h" + "src/overlays/actors/ovl_En_Daiku/z_en_daiku.c" + "src/overlays/actors/ovl_En_Daiku/z_en_daiku.h" + "src/overlays/actors/ovl_En_Daiku_Kakariko/z_en_daiku_kakariko.c" + "src/overlays/actors/ovl_En_Daiku_Kakariko/z_en_daiku_kakariko.h" + "src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c" + "src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.h" + "src/overlays/actors/ovl_En_Dekunuts/z_en_dekunuts.c" + "src/overlays/actors/ovl_En_Dekunuts/z_en_dekunuts.h" + "src/overlays/actors/ovl_En_Dh/z_en_dh.c" + "src/overlays/actors/ovl_En_Dh/z_en_dh.h" + "src/overlays/actors/ovl_En_Dha/z_en_dha.c" + "src/overlays/actors/ovl_En_Dha/z_en_dha.h" + "src/overlays/actors/ovl_En_Diving_Game/z_en_diving_game.c" + "src/overlays/actors/ovl_En_Diving_Game/z_en_diving_game.h" + "src/overlays/actors/ovl_En_Dns/z_en_dns.c" + "src/overlays/actors/ovl_En_Dns/z_en_dns.h" + "src/overlays/actors/ovl_En_Dnt_Demo/z_en_dnt_demo.c" + "src/overlays/actors/ovl_En_Dnt_Demo/z_en_dnt_demo.h" + "src/overlays/actors/ovl_En_Dnt_Jiji/z_en_dnt_jiji.c" + "src/overlays/actors/ovl_En_Dnt_Jiji/z_en_dnt_jiji.h" + "src/overlays/actors/ovl_En_Dnt_Nomal/z_en_dnt_nomal.c" + "src/overlays/actors/ovl_En_Dnt_Nomal/z_en_dnt_nomal.h" + "src/overlays/actors/ovl_En_Dodojr/z_en_dodojr.c" + "src/overlays/actors/ovl_En_Dodojr/z_en_dodojr.h" + "src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.c" + "src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.h" + "src/overlays/actors/ovl_En_Dog/z_en_dog.c" + "src/overlays/actors/ovl_En_Dog/z_en_dog.h" + "src/overlays/actors/ovl_En_Door/z_en_door.c" + "src/overlays/actors/ovl_En_Door/z_en_door.h" + "src/overlays/actors/ovl_En_Ds/z_en_ds.c" + "src/overlays/actors/ovl_En_Ds/z_en_ds.h" + "src/overlays/actors/ovl_En_Du/z_en_du.c" + "src/overlays/actors/ovl_En_Du/z_en_du.h" + "src/overlays/actors/ovl_En_Dy_Extra/z_en_dy_extra.c" + "src/overlays/actors/ovl_En_Dy_Extra/z_en_dy_extra.h" + "src/overlays/actors/ovl_En_Eg/z_en_eg.c" + "src/overlays/actors/ovl_En_Eg/z_en_eg.h" + "src/overlays/actors/ovl_En_Eiyer/z_en_eiyer.c" + "src/overlays/actors/ovl_En_Eiyer/z_en_eiyer.h" + "src/overlays/actors/ovl_En_Elf/z_en_elf.c" + "src/overlays/actors/ovl_En_Elf/z_en_elf.h" + "src/overlays/actors/ovl_En_Encount1/z_en_encount1.c" + "src/overlays/actors/ovl_En_Encount1/z_en_encount1.h" + "src/overlays/actors/ovl_En_Encount2/z_en_encount2.c" + "src/overlays/actors/ovl_En_Encount2/z_en_encount2.h" + "src/overlays/actors/ovl_En_Ex_Item/z_en_ex_item.c" + "src/overlays/actors/ovl_En_Ex_Item/z_en_ex_item.h" + "src/overlays/actors/ovl_En_Ex_Ruppy/z_en_ex_ruppy.c" + "src/overlays/actors/ovl_En_Ex_Ruppy/z_en_ex_ruppy.h" + "src/overlays/actors/ovl_En_Fd/z_en_fd.c" + "src/overlays/actors/ovl_En_Fd/z_en_fd.h" + "src/overlays/actors/ovl_En_Fd_Fire/z_en_fd_fire.c" + "src/overlays/actors/ovl_En_Fd_Fire/z_en_fd_fire.h" + "src/overlays/actors/ovl_En_fHG/z_en_fhg.c" + "src/overlays/actors/ovl_En_fHG/z_en_fhg.h" + "src/overlays/actors/ovl_En_Fhg_Fire/z_en_fhg_fire.c" + "src/overlays/actors/ovl_En_Fhg_Fire/z_en_fhg_fire.h" + "src/overlays/actors/ovl_En_Fire_Rock/z_en_fire_rock.c" + "src/overlays/actors/ovl_En_Fire_Rock/z_en_fire_rock.h" + "src/overlays/actors/ovl_En_Firefly/z_en_firefly.c" + "src/overlays/actors/ovl_En_Firefly/z_en_firefly.h" + "src/overlays/actors/ovl_En_Fish/z_en_fish.c" + "src/overlays/actors/ovl_En_Fish/z_en_fish.h" + "src/overlays/actors/ovl_En_Floormas/z_en_floormas.c" + "src/overlays/actors/ovl_En_Floormas/z_en_floormas.h" + "src/overlays/actors/ovl_En_Fr/z_en_fr.c" + "src/overlays/actors/ovl_En_Fr/z_en_fr.h" + "src/overlays/actors/ovl_En_Fu/z_en_fu.c" + "src/overlays/actors/ovl_En_Fu/z_en_fu.h" + "src/overlays/actors/ovl_En_Fw/z_en_fw.c" + "src/overlays/actors/ovl_En_Fw/z_en_fw.h" + "src/overlays/actors/ovl_En_Fz/z_en_fz.c" + "src/overlays/actors/ovl_En_Fz/z_en_fz.h" + "src/overlays/actors/ovl_En_G_Switch/z_en_g_switch.c" + "src/overlays/actors/ovl_En_G_Switch/z_en_g_switch.h" + "src/overlays/actors/ovl_En_Ganon_Mant/z_en_ganon_mant.c" + "src/overlays/actors/ovl_En_Ganon_Mant/z_en_ganon_mant.h" + "src/overlays/actors/ovl_En_Ganon_Organ/z_en_ganon_organ.c" + "src/overlays/actors/ovl_En_Ganon_Organ/z_en_ganon_organ.h" + "src/overlays/actors/ovl_En_Gb/z_en_gb.c" + "src/overlays/actors/ovl_En_Gb/z_en_gb.h" + "src/overlays/actors/ovl_En_Ge1/z_en_ge1.c" + "src/overlays/actors/ovl_En_Ge1/z_en_ge1.h" + "src/overlays/actors/ovl_En_Ge2/z_en_ge2.c" + "src/overlays/actors/ovl_En_Ge2/z_en_ge2.h" + "src/overlays/actors/ovl_En_Ge3/z_en_ge3.c" + "src/overlays/actors/ovl_En_Ge3/z_en_ge3.h" + "src/overlays/actors/ovl_En_GeldB/z_en_geldb.c" + "src/overlays/actors/ovl_En_GeldB/z_en_geldb.h" + "src/overlays/actors/ovl_En_GirlA/z_en_girla.c" + "src/overlays/actors/ovl_En_GirlA/z_en_girla.h" + "src/overlays/actors/ovl_En_Gm/z_en_gm.c" + "src/overlays/actors/ovl_En_Gm/z_en_gm.h" + "src/overlays/actors/ovl_En_Go/z_en_go.c" + "src/overlays/actors/ovl_En_Go/z_en_go.h" + "src/overlays/actors/ovl_En_Go2/z_en_go2.c" + "src/overlays/actors/ovl_En_Go2/z_en_go2.h" + "src/overlays/actors/ovl_En_Goma/z_en_goma.c" + "src/overlays/actors/ovl_En_Goma/z_en_goma.h" + "src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c" + "src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.h" + "src/overlays/actors/ovl_En_Gs/z_en_gs.c" + "src/overlays/actors/ovl_En_Gs/z_en_gs.h" + "src/overlays/actors/ovl_En_Guest/z_en_guest.c" + "src/overlays/actors/ovl_En_Guest/z_en_guest.h" + "src/overlays/actors/ovl_En_Hata/z_en_hata.c" + "src/overlays/actors/ovl_En_Hata/z_en_hata.h" + "src/overlays/actors/ovl_En_Heishi1/z_en_heishi1.c" + "src/overlays/actors/ovl_En_Heishi1/z_en_heishi1.h" + "src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.c" + "src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.h" + "src/overlays/actors/ovl_En_Heishi3/z_en_heishi3.c" + "src/overlays/actors/ovl_En_Heishi3/z_en_heishi3.h" + "src/overlays/actors/ovl_En_Heishi4/z_en_heishi4.c" + "src/overlays/actors/ovl_En_Heishi4/z_en_heishi4.h" + "src/overlays/actors/ovl_En_Hintnuts/z_en_hintnuts.c" + "src/overlays/actors/ovl_En_Hintnuts/z_en_hintnuts.h" + "src/overlays/actors/ovl_En_Holl/z_en_holl.c" + "src/overlays/actors/ovl_En_Holl/z_en_holl.h" + "src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.c" + "src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.h" + "src/overlays/actors/ovl_En_Horse/z_en_horse.c" + "src/overlays/actors/ovl_En_Horse/z_en_horse.h" + "src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.c" + "src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.h" + "src/overlays/actors/ovl_En_Horse_Ganon/z_en_horse_ganon.c" + "src/overlays/actors/ovl_En_Horse_Ganon/z_en_horse_ganon.h" + "src/overlays/actors/ovl_En_Horse_Link_Child/z_en_horse_link_child.c" + "src/overlays/actors/ovl_En_Horse_Link_Child/z_en_horse_link_child.h" + "src/overlays/actors/ovl_En_Horse_Normal/z_en_horse_normal.c" + "src/overlays/actors/ovl_En_Horse_Normal/z_en_horse_normal.h" + "src/overlays/actors/ovl_En_Horse_Zelda/z_en_horse_zelda.c" + "src/overlays/actors/ovl_En_Horse_Zelda/z_en_horse_zelda.h" + "src/overlays/actors/ovl_En_Hs/z_en_hs.c" + "src/overlays/actors/ovl_En_Hs/z_en_hs.h" + "src/overlays/actors/ovl_En_Hs2/z_en_hs2.c" + "src/overlays/actors/ovl_En_Hs2/z_en_hs2.h" + "src/overlays/actors/ovl_En_Hy/z_en_hy.c" + "src/overlays/actors/ovl_En_Hy/z_en_hy.h" + "src/overlays/actors/ovl_En_Ice_Hono/z_en_ice_hono.c" + "src/overlays/actors/ovl_En_Ice_Hono/z_en_ice_hono.h" + "src/overlays/actors/ovl_En_Ik/z_en_ik.c" + "src/overlays/actors/ovl_En_Ik/z_en_ik.h" + "src/overlays/actors/ovl_En_In/z_en_in.c" + "src/overlays/actors/ovl_En_In/z_en_in.h" + "src/overlays/actors/ovl_En_Insect/z_en_insect.c" + "src/overlays/actors/ovl_En_Insect/z_en_insect.h" + "src/overlays/actors/ovl_En_Ishi/z_en_ishi.c" + "src/overlays/actors/ovl_En_Ishi/z_en_ishi.h" + "src/overlays/actors/ovl_En_It/z_en_it.c" + "src/overlays/actors/ovl_En_It/z_en_it.h" + "src/overlays/actors/ovl_En_Jj/z_en_jj.c" + "src/overlays/actors/ovl_En_Jj/z_en_jj.h" + "src/overlays/actors/ovl_En_Jj/z_en_jj_cutscene_data.c" + "src/overlays/actors/ovl_En_Js/z_en_js.c" + "src/overlays/actors/ovl_En_Js/z_en_js.h" + "src/overlays/actors/ovl_En_Jsjutan/z_en_jsjutan.c" + "src/overlays/actors/ovl_En_Jsjutan/z_en_jsjutan.h" + "src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c" + "src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.h" + "src/overlays/actors/ovl_En_Kakasi2/z_en_kakasi2.c" + "src/overlays/actors/ovl_En_Kakasi2/z_en_kakasi2.h" + "src/overlays/actors/ovl_En_Kakasi3/z_en_kakasi3.c" + "src/overlays/actors/ovl_En_Kakasi3/z_en_kakasi3.h" + "src/overlays/actors/ovl_En_Kanban/z_en_kanban.c" + "src/overlays/actors/ovl_En_Kanban/z_en_kanban.h" + "src/overlays/actors/ovl_En_Kanban/z_en_kanban_gfx.c" + "src/overlays/actors/ovl_En_Karebaba/z_en_karebaba.c" + "src/overlays/actors/ovl_En_Karebaba/z_en_karebaba.h" + "src/overlays/actors/ovl_En_Ko/z_en_ko.c" + "src/overlays/actors/ovl_En_Ko/z_en_ko.h" + "src/overlays/actors/ovl_En_Kusa/z_en_kusa.c" + "src/overlays/actors/ovl_En_Kusa/z_en_kusa.h" + "src/overlays/actors/ovl_En_Kz/z_en_kz.c" + "src/overlays/actors/ovl_En_Kz/z_en_kz.h" + "src/overlays/actors/ovl_En_Light/z_en_light.c" + "src/overlays/actors/ovl_En_Light/z_en_light.h" + "src/overlays/actors/ovl_En_Lightbox/z_en_lightbox.c" + "src/overlays/actors/ovl_En_Lightbox/z_en_lightbox.h" + "src/overlays/actors/ovl_En_M_Fire1/z_en_m_fire1.c" + "src/overlays/actors/ovl_En_M_Fire1/z_en_m_fire1.h" + "src/overlays/actors/ovl_En_M_Thunder/z_en_m_thunder.c" + "src/overlays/actors/ovl_En_M_Thunder/z_en_m_thunder.h" + "src/overlays/actors/ovl_En_Ma1/z_en_ma1.c" + "src/overlays/actors/ovl_En_Ma1/z_en_ma1.h" + "src/overlays/actors/ovl_En_Ma2/z_en_ma2.c" + "src/overlays/actors/ovl_En_Ma2/z_en_ma2.h" + "src/overlays/actors/ovl_En_Ma3/z_en_ma3.c" + "src/overlays/actors/ovl_En_Ma3/z_en_ma3.h" + "src/overlays/actors/ovl_En_Mag/z_en_mag.c" + "src/overlays/actors/ovl_En_Mag/z_en_mag.h" + "src/overlays/actors/ovl_En_Mb/z_en_mb.c" + "src/overlays/actors/ovl_En_Mb/z_en_mb.h" + "src/overlays/actors/ovl_En_Md/z_en_md.c" + "src/overlays/actors/ovl_En_Md/z_en_md.h" + "src/overlays/actors/ovl_En_Mk/z_en_mk.c" + "src/overlays/actors/ovl_En_Mk/z_en_mk.h" + "src/overlays/actors/ovl_En_Mm/z_en_mm.c" + "src/overlays/actors/ovl_En_Mm/z_en_mm.h" + "src/overlays/actors/ovl_En_Mm2/z_en_mm2.c" + "src/overlays/actors/ovl_En_Mm2/z_en_mm2.h" + "src/overlays/actors/ovl_En_Ms/z_en_ms.c" + "src/overlays/actors/ovl_En_Ms/z_en_ms.h" + "src/overlays/actors/ovl_En_Mu/z_en_mu.c" + "src/overlays/actors/ovl_En_Mu/z_en_mu.h" + "src/overlays/actors/ovl_En_Nb/z_en_nb.c" + "src/overlays/actors/ovl_En_Nb/z_en_nb.h" + "src/overlays/actors/ovl_En_Nb/z_en_nb_cutscene_data.c" + "src/overlays/actors/ovl_En_Niw/z_en_niw.c" + "src/overlays/actors/ovl_En_Niw/z_en_niw.h" + "src/overlays/actors/ovl_En_Niw_Girl/z_en_niw_girl.c" + "src/overlays/actors/ovl_En_Niw_Girl/z_en_niw_girl.h" + "src/overlays/actors/ovl_En_Niw_Lady/z_en_niw_lady.c" + "src/overlays/actors/ovl_En_Niw_Lady/z_en_niw_lady.h" + "src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.c" + "src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.h" + "src/overlays/actors/ovl_En_Nwc/z_en_nwc.c" + "src/overlays/actors/ovl_En_Nwc/z_en_nwc.h" + "src/overlays/actors/ovl_En_Ny/z_en_ny.c" + "src/overlays/actors/ovl_En_Ny/z_en_ny.h" + "src/overlays/actors/ovl_En_OE2/z_en_oe2.c" + "src/overlays/actors/ovl_En_OE2/z_en_oe2.h" + "src/overlays/actors/ovl_En_Okarina_Effect/z_en_okarina_effect.c" + "src/overlays/actors/ovl_En_Okarina_Effect/z_en_okarina_effect.h" + "src/overlays/actors/ovl_En_Okarina_Tag/z_en_okarina_tag.c" + "src/overlays/actors/ovl_En_Okarina_Tag/z_en_okarina_tag.h" + "src/overlays/actors/ovl_En_Okarina_Tag/z_en_okarina_tag_cutscene_data.c" + "src/overlays/actors/ovl_En_Okuta/z_en_okuta.c" + "src/overlays/actors/ovl_En_Okuta/z_en_okuta.h" + "src/overlays/actors/ovl_En_Ossan/z_en_ossan.c" + "src/overlays/actors/ovl_En_Ossan/z_en_ossan.h" + "src/overlays/actors/ovl_En_Owl/z_en_owl.c" + "src/overlays/actors/ovl_En_Owl/z_en_owl.h" + "src/overlays/actors/ovl_En_Part/z_en_part.c" + "src/overlays/actors/ovl_En_Part/z_en_part.h" + "src/overlays/actors/ovl_En_Peehat/z_en_peehat.c" + "src/overlays/actors/ovl_En_Peehat/z_en_peehat.h" + "src/overlays/actors/ovl_En_Po_Desert/z_en_po_desert.c" + "src/overlays/actors/ovl_En_Po_Desert/z_en_po_desert.h" + "src/overlays/actors/ovl_En_Po_Field/z_en_po_field.c" + "src/overlays/actors/ovl_En_Po_Field/z_en_po_field.h" + "src/overlays/actors/ovl_En_Po_Relay/z_en_po_relay.c" + "src/overlays/actors/ovl_En_Po_Relay/z_en_po_relay.h" + "src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c" + "src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.h" + "src/overlays/actors/ovl_En_Poh/z_en_poh.c" + "src/overlays/actors/ovl_En_Poh/z_en_poh.h" + "src/overlays/actors/ovl_En_Pu_box/z_en_pu_box.c" + "src/overlays/actors/ovl_En_Pu_box/z_en_pu_box.h" + "src/overlays/actors/ovl_En_Rd/z_en_rd.c" + "src/overlays/actors/ovl_En_Rd/z_en_rd.h" + "src/overlays/actors/ovl_En_Reeba/z_en_reeba.c" + "src/overlays/actors/ovl_En_Reeba/z_en_reeba.h" + "src/overlays/actors/ovl_En_River_Sound/z_en_river_sound.c" + "src/overlays/actors/ovl_En_River_Sound/z_en_river_sound.h" + "src/overlays/actors/ovl_En_Rl/z_en_rl.c" + "src/overlays/actors/ovl_En_Rl/z_en_rl.h" + "src/overlays/actors/ovl_En_Rr/z_en_rr.c" + "src/overlays/actors/ovl_En_Rr/z_en_rr.h" + "src/overlays/actors/ovl_En_Ru1/z_en_ru1.c" + "src/overlays/actors/ovl_En_Ru1/z_en_ru1.h" + "src/overlays/actors/ovl_En_Ru1/z_en_ru1_cutscene_data.c" + "src/overlays/actors/ovl_En_Ru2/z_en_ru2.c" + "src/overlays/actors/ovl_En_Ru2/z_en_ru2.h" + "src/overlays/actors/ovl_En_Ru2/z_en_ru2_cutscene_data.c" + "src/overlays/actors/ovl_En_Sa/z_en_sa.c" + "src/overlays/actors/ovl_En_Sa/z_en_sa.h" + "src/overlays/actors/ovl_En_Sb/z_en_sb.c" + "src/overlays/actors/ovl_En_Sb/z_en_sb.h" + "src/overlays/actors/ovl_En_Scene_Change/z_en_scene_change.c" + "src/overlays/actors/ovl_En_Scene_Change/z_en_scene_change.h" + "src/overlays/actors/ovl_En_Sda/z_en_sda.c" + "src/overlays/actors/ovl_En_Sda/z_en_sda.h" + "src/overlays/actors/ovl_En_Shopnuts/z_en_shopnuts.c" + "src/overlays/actors/ovl_En_Shopnuts/z_en_shopnuts.h" + "src/overlays/actors/ovl_En_Si/z_en_si.c" + "src/overlays/actors/ovl_En_Si/z_en_si.h" + "src/overlays/actors/ovl_En_Siofuki/z_en_siofuki.c" + "src/overlays/actors/ovl_En_Siofuki/z_en_siofuki.h" + "src/overlays/actors/ovl_En_Skb/z_en_skb.c" + "src/overlays/actors/ovl_En_Skb/z_en_skb.h" + "src/overlays/actors/ovl_En_Skj/z_en_skj.c" + "src/overlays/actors/ovl_En_Skj/z_en_skj.h" + "src/overlays/actors/ovl_En_Skjneedle/z_en_skjneedle.c" + "src/overlays/actors/ovl_En_Skjneedle/z_en_skjneedle.h" + "src/overlays/actors/ovl_En_Ssh/z_en_ssh.c" + "src/overlays/actors/ovl_En_Ssh/z_en_ssh.h" + "src/overlays/actors/ovl_En_St/z_en_st.c" + "src/overlays/actors/ovl_En_St/z_en_st.h" + "src/overlays/actors/ovl_En_Sth/z_en_sth.c" + "src/overlays/actors/ovl_En_Sth/z_en_sth.h" + "src/overlays/actors/ovl_En_Stream/z_en_stream.c" + "src/overlays/actors/ovl_En_Stream/z_en_stream.h" + "src/overlays/actors/ovl_En_Sw/z_en_sw.c" + "src/overlays/actors/ovl_En_Sw/z_en_sw.h" + "src/overlays/actors/ovl_En_Syateki_Itm/z_en_syateki_itm.c" + "src/overlays/actors/ovl_En_Syateki_Itm/z_en_syateki_itm.h" + "src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c" + "src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.h" + "src/overlays/actors/ovl_En_Syateki_Niw/z_en_syateki_niw.c" + "src/overlays/actors/ovl_En_Syateki_Niw/z_en_syateki_niw.h" + "src/overlays/actors/ovl_En_Ta/z_en_ta.c" + "src/overlays/actors/ovl_En_Ta/z_en_ta.h" + "src/overlays/actors/ovl_En_Takara_Man/z_en_takara_man.c" + "src/overlays/actors/ovl_En_Takara_Man/z_en_takara_man.h" + "src/overlays/actors/ovl_En_Tana/z_en_tana.c" + "src/overlays/actors/ovl_En_Tana/z_en_tana.h" + "src/overlays/actors/ovl_En_Test/z_en_test.c" + "src/overlays/actors/ovl_En_Test/z_en_test.h" + "src/overlays/actors/ovl_En_Tg/z_en_tg.c" + "src/overlays/actors/ovl_En_Tg/z_en_tg.h" + "src/overlays/actors/ovl_En_Tite/z_en_tite.c" + "src/overlays/actors/ovl_En_Tite/z_en_tite.h" + "src/overlays/actors/ovl_En_Tk/z_en_tk.c" + "src/overlays/actors/ovl_En_Tk/z_en_tk.h" + "src/overlays/actors/ovl_En_Torch/z_en_torch.c" + "src/overlays/actors/ovl_En_Torch/z_en_torch.h" + "src/overlays/actors/ovl_En_Torch2/z_en_torch2.c" + "src/overlays/actors/ovl_En_Torch2/z_en_torch2.h" + "src/overlays/actors/ovl_En_Toryo/z_en_toryo.c" + "src/overlays/actors/ovl_En_Toryo/z_en_toryo.h" + "src/overlays/actors/ovl_En_Tp/z_en_tp.c" + "src/overlays/actors/ovl_En_Tp/z_en_tp.h" + "src/overlays/actors/ovl_En_Tr/z_en_tr.c" + "src/overlays/actors/ovl_En_Tr/z_en_tr.h" + "src/overlays/actors/ovl_En_Trap/z_en_trap.c" + "src/overlays/actors/ovl_En_Trap/z_en_trap.h" + "src/overlays/actors/ovl_En_Tubo_Trap/z_en_tubo_trap.c" + "src/overlays/actors/ovl_En_Tubo_Trap/z_en_tubo_trap.h" + "src/overlays/actors/ovl_En_Vali/z_en_vali.c" + "src/overlays/actors/ovl_En_Vali/z_en_vali.h" + "src/overlays/actors/ovl_En_Vase/z_en_vase.c" + "src/overlays/actors/ovl_En_Vase/z_en_vase.h" + "src/overlays/actors/ovl_En_Vb_Ball/z_en_vb_ball.c" + "src/overlays/actors/ovl_En_Vb_Ball/z_en_vb_ball.h" + "src/overlays/actors/ovl_En_Viewer/z_en_viewer.c" + "src/overlays/actors/ovl_En_Viewer/z_en_viewer.h" + "src/overlays/actors/ovl_En_Vm/z_en_vm.c" + "src/overlays/actors/ovl_En_Vm/z_en_vm.h" + "src/overlays/actors/ovl_En_Wall_Tubo/z_en_wall_tubo.c" + "src/overlays/actors/ovl_En_Wall_Tubo/z_en_wall_tubo.h" + "src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c" + "src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.h" + "src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.c" + "src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.h" + "src/overlays/actors/ovl_En_Weiyer/z_en_weiyer.c" + "src/overlays/actors/ovl_En_Weiyer/z_en_weiyer.h" + "src/overlays/actors/ovl_En_Wf/z_en_wf.c" + "src/overlays/actors/ovl_En_Wf/z_en_wf.h" + "src/overlays/actors/ovl_En_Wonder_Item/z_en_wonder_item.c" + "src/overlays/actors/ovl_En_Wonder_Item/z_en_wonder_item.h" + "src/overlays/actors/ovl_En_Wonder_Talk/z_en_wonder_talk.c" + "src/overlays/actors/ovl_En_Wonder_Talk/z_en_wonder_talk.h" + "src/overlays/actors/ovl_En_Wonder_Talk2/z_en_wonder_talk2.c" + "src/overlays/actors/ovl_En_Wonder_Talk2/z_en_wonder_talk2.h" + "src/overlays/actors/ovl_En_Wood02/z_en_wood02.c" + "src/overlays/actors/ovl_En_Wood02/z_en_wood02.h" + "src/overlays/actors/ovl_En_Xc/z_en_xc.c" + "src/overlays/actors/ovl_En_Xc/z_en_xc.h" + "src/overlays/actors/ovl_En_Yabusame_Mark/z_en_yabusame_mark.c" + "src/overlays/actors/ovl_En_Yabusame_Mark/z_en_yabusame_mark.h" + "src/overlays/actors/ovl_En_Yukabyun/z_en_yukabyun.c" + "src/overlays/actors/ovl_En_Yukabyun/z_en_yukabyun.h" + "src/overlays/actors/ovl_En_Zf/z_en_zf.c" + "src/overlays/actors/ovl_En_Zf/z_en_zf.h" + "src/overlays/actors/ovl_En_Zl1/z_en_zl1.c" + "src/overlays/actors/ovl_En_Zl1/z_en_zl1.h" + "src/overlays/actors/ovl_En_Zl1/z_en_zl1_camera_data.c" + "src/overlays/actors/ovl_En_Zl1/z_en_zl1_cutscene_data.c" + "src/overlays/actors/ovl_En_Zl2/z_en_zl2.c" + "src/overlays/actors/ovl_En_Zl2/z_en_zl2.h" + "src/overlays/actors/ovl_En_Zl3/z_en_zl3.c" + "src/overlays/actors/ovl_En_Zl3/z_en_zl3.h" + "src/overlays/actors/ovl_En_Zl4/z_en_zl4.c" + "src/overlays/actors/ovl_En_Zl4/z_en_zl4.h" + "src/overlays/actors/ovl_En_Zl4/z_en_zl4_cutscene_data.c" + "src/overlays/actors/ovl_En_Zo/z_en_zo.c" + "src/overlays/actors/ovl_En_Zo/z_en_zo.h" + "src/overlays/actors/ovl_End_Title/z_end_title.c" + "src/overlays/actors/ovl_End_Title/z_end_title.h" + "src/overlays/actors/ovl_Fishing/z_fishing.c" + "src/overlays/actors/ovl_Fishing/z_fishing.h" + "src/overlays/actors/ovl_Item_B_Heart/z_item_b_heart.c" + "src/overlays/actors/ovl_Item_B_Heart/z_item_b_heart.h" + "src/overlays/actors/ovl_Item_Etcetera/z_item_etcetera.c" + "src/overlays/actors/ovl_Item_Etcetera/z_item_etcetera.h" + "src/overlays/actors/ovl_Item_Inbox/z_item_inbox.c" + "src/overlays/actors/ovl_Item_Inbox/z_item_inbox.h" + "src/overlays/actors/ovl_Item_Ocarina/z_item_ocarina.c" + "src/overlays/actors/ovl_Item_Ocarina/z_item_ocarina.h" + "src/overlays/actors/ovl_Item_Shield/z_item_shield.c" + "src/overlays/actors/ovl_Item_Shield/z_item_shield.h" + "src/overlays/actors/ovl_Magic_Dark/z_magic_dark.c" + "src/overlays/actors/ovl_Magic_Dark/z_magic_dark.h" + "src/overlays/actors/ovl_Magic_Fire/z_magic_fire.c" + "src/overlays/actors/ovl_Magic_Fire/z_magic_fire.h" + "src/overlays/actors/ovl_Magic_Wind/z_magic_wind.c" + "src/overlays/actors/ovl_Magic_Wind/z_magic_wind.h" + "src/overlays/actors/ovl_Mir_Ray/z_mir_ray.c" + "src/overlays/actors/ovl_Mir_Ray/z_mir_ray.h" + "src/overlays/actors/ovl_Obj_Bean/z_obj_bean.c" + "src/overlays/actors/ovl_Obj_Bean/z_obj_bean.h" + "src/overlays/actors/ovl_Obj_Blockstop/z_obj_blockstop.c" + "src/overlays/actors/ovl_Obj_Blockstop/z_obj_blockstop.h" + "src/overlays/actors/ovl_Obj_Bombiwa/z_obj_bombiwa.c" + "src/overlays/actors/ovl_Obj_Bombiwa/z_obj_bombiwa.h" + "src/overlays/actors/ovl_Obj_Comb/z_obj_comb.c" + "src/overlays/actors/ovl_Obj_Comb/z_obj_comb.h" + "src/overlays/actors/ovl_Obj_Dekujr/z_obj_dekujr.c" + "src/overlays/actors/ovl_Obj_Dekujr/z_obj_dekujr.h" + "src/overlays/actors/ovl_Obj_Elevator/z_obj_elevator.c" + "src/overlays/actors/ovl_Obj_Elevator/z_obj_elevator.h" + "src/overlays/actors/ovl_Obj_Hamishi/z_obj_hamishi.c" + "src/overlays/actors/ovl_Obj_Hamishi/z_obj_hamishi.h" + "src/overlays/actors/ovl_Obj_Hana/z_obj_hana.c" + "src/overlays/actors/ovl_Obj_Hana/z_obj_hana.h" + "src/overlays/actors/ovl_Obj_Hsblock/z_obj_hsblock.c" + "src/overlays/actors/ovl_Obj_Hsblock/z_obj_hsblock.h" + "src/overlays/actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.c" + "src/overlays/actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.h" + "src/overlays/actors/ovl_Obj_Kibako/z_obj_kibako.c" + "src/overlays/actors/ovl_Obj_Kibako/z_obj_kibako.h" + "src/overlays/actors/ovl_Obj_Kibako2/z_obj_kibako2.c" + "src/overlays/actors/ovl_Obj_Kibako2/z_obj_kibako2.h" + "src/overlays/actors/ovl_Obj_Lift/z_obj_lift.c" + "src/overlays/actors/ovl_Obj_Lift/z_obj_lift.h" + "src/overlays/actors/ovl_Obj_Lightswitch/z_obj_lightswitch.c" + "src/overlays/actors/ovl_Obj_Lightswitch/z_obj_lightswitch.h" + "src/overlays/actors/ovl_Obj_Makekinsuta/z_obj_makekinsuta.c" + "src/overlays/actors/ovl_Obj_Makekinsuta/z_obj_makekinsuta.h" + "src/overlays/actors/ovl_Obj_Makeoshihiki/z_obj_makeoshihiki.c" + "src/overlays/actors/ovl_Obj_Makeoshihiki/z_obj_makeoshihiki.h" + "src/overlays/actors/ovl_Obj_Mure/z_obj_mure.c" + "src/overlays/actors/ovl_Obj_Mure/z_obj_mure.h" + "src/overlays/actors/ovl_Obj_Mure2/z_obj_mure2.c" + "src/overlays/actors/ovl_Obj_Mure2/z_obj_mure2.h" + "src/overlays/actors/ovl_Obj_Mure3/z_obj_mure3.c" + "src/overlays/actors/ovl_Obj_Mure3/z_obj_mure3.h" + "src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.c" + "src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.h" + "src/overlays/actors/ovl_Obj_Roomtimer/z_obj_roomtimer.c" + "src/overlays/actors/ovl_Obj_Roomtimer/z_obj_roomtimer.h" + "src/overlays/actors/ovl_Obj_Switch/z_obj_switch.c" + "src/overlays/actors/ovl_Obj_Switch/z_obj_switch.h" + "src/overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.c" + "src/overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.h" + "src/overlays/actors/ovl_Obj_Timeblock/z_obj_timeblock.c" + "src/overlays/actors/ovl_Obj_Timeblock/z_obj_timeblock.h" + "src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.c" + "src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.h" + "src/overlays/actors/ovl_Obj_Warp2block/z_obj_warp2block.c" + "src/overlays/actors/ovl_Obj_Warp2block/z_obj_warp2block.h" + "src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c" + "src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.h" + "src/overlays/actors/ovl_Oceff_Spot/z_oceff_spot.c" + "src/overlays/actors/ovl_Oceff_Spot/z_oceff_spot.h" + "src/overlays/actors/ovl_Oceff_Storm/z_oceff_storm.c" + "src/overlays/actors/ovl_Oceff_Storm/z_oceff_storm.h" + "src/overlays/actors/ovl_Oceff_Wipe/z_oceff_wipe.c" + "src/overlays/actors/ovl_Oceff_Wipe/z_oceff_wipe.h" + "src/overlays/actors/ovl_Oceff_Wipe2/z_oceff_wipe2.c" + "src/overlays/actors/ovl_Oceff_Wipe2/z_oceff_wipe2.h" + "src/overlays/actors/ovl_Oceff_Wipe3/z_oceff_wipe3.c" + "src/overlays/actors/ovl_Oceff_Wipe3/z_oceff_wipe3.h" + "src/overlays/actors/ovl_Oceff_Wipe4/z_oceff_wipe4.c" + "src/overlays/actors/ovl_Oceff_Wipe4/z_oceff_wipe4.h" + "src/overlays/actors/ovl_player_actor/z_player.c" + "src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c" + "src/overlays/actors/ovl_Shot_Sun/z_shot_sun.h" +) +source_group("Source Files\\src\\overlays\\actors" FILES ${Source_Files__src__overlays__actors}) + +set(Source_Files__src__overlays__effects + "src/overlays/effects/ovl_Effect_Ss_Blast/z_eff_ss_blast.c" + "src/overlays/effects/ovl_Effect_Ss_Blast/z_eff_ss_blast.h" + "src/overlays/effects/ovl_Effect_Ss_Bomb/z_eff_ss_bomb.c" + "src/overlays/effects/ovl_Effect_Ss_Bomb/z_eff_ss_bomb.h" + "src/overlays/effects/ovl_Effect_Ss_Bomb2/z_eff_ss_bomb2.c" + "src/overlays/effects/ovl_Effect_Ss_Bomb2/z_eff_ss_bomb2.h" + "src/overlays/effects/ovl_Effect_Ss_Bubble/z_eff_ss_bubble.c" + "src/overlays/effects/ovl_Effect_Ss_Bubble/z_eff_ss_bubble.h" + "src/overlays/effects/ovl_Effect_Ss_D_Fire/z_eff_ss_d_fire.c" + "src/overlays/effects/ovl_Effect_Ss_D_Fire/z_eff_ss_d_fire.h" + "src/overlays/effects/ovl_Effect_Ss_Dead_Db/z_eff_ss_dead_db.c" + "src/overlays/effects/ovl_Effect_Ss_Dead_Db/z_eff_ss_dead_db.h" + "src/overlays/effects/ovl_Effect_Ss_Dead_Dd/z_eff_ss_dead_dd.c" + "src/overlays/effects/ovl_Effect_Ss_Dead_Dd/z_eff_ss_dead_dd.h" + "src/overlays/effects/ovl_Effect_Ss_Dead_Ds/z_eff_ss_dead_ds.c" + "src/overlays/effects/ovl_Effect_Ss_Dead_Ds/z_eff_ss_dead_ds.h" + "src/overlays/effects/ovl_Effect_Ss_Dead_Sound/z_eff_ss_dead_sound.c" + "src/overlays/effects/ovl_Effect_Ss_Dead_Sound/z_eff_ss_dead_sound.h" + "src/overlays/effects/ovl_Effect_Ss_Dt_Bubble/z_eff_ss_dt_bubble.c" + "src/overlays/effects/ovl_Effect_Ss_Dt_Bubble/z_eff_ss_dt_bubble.h" + "src/overlays/effects/ovl_Effect_Ss_Dust/z_eff_ss_dust.c" + "src/overlays/effects/ovl_Effect_Ss_Dust/z_eff_ss_dust.h" + "src/overlays/effects/ovl_Effect_Ss_En_Fire/z_eff_ss_en_fire.c" + "src/overlays/effects/ovl_Effect_Ss_En_Fire/z_eff_ss_en_fire.h" + "src/overlays/effects/ovl_Effect_Ss_En_Ice/z_eff_ss_en_ice.c" + "src/overlays/effects/ovl_Effect_Ss_En_Ice/z_eff_ss_en_ice.h" + "src/overlays/effects/ovl_Effect_Ss_Extra/z_eff_ss_extra.c" + "src/overlays/effects/ovl_Effect_Ss_Extra/z_eff_ss_extra.h" + "src/overlays/effects/ovl_Effect_Ss_Fcircle/z_eff_ss_fcircle.c" + "src/overlays/effects/ovl_Effect_Ss_Fcircle/z_eff_ss_fcircle.h" + "src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.c" + "src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.h" + "src/overlays/effects/ovl_Effect_Ss_Fire_Tail/z_eff_ss_fire_tail.c" + "src/overlays/effects/ovl_Effect_Ss_Fire_Tail/z_eff_ss_fire_tail.h" + "src/overlays/effects/ovl_Effect_Ss_G_Fire/z_eff_ss_g_fire.c" + "src/overlays/effects/ovl_Effect_Ss_G_Fire/z_eff_ss_g_fire.h" + "src/overlays/effects/ovl_Effect_Ss_G_Magma/z_eff_ss_g_magma.c" + "src/overlays/effects/ovl_Effect_Ss_G_Magma/z_eff_ss_g_magma.h" + "src/overlays/effects/ovl_Effect_Ss_G_Magma2/z_eff_ss_g_magma2.c" + "src/overlays/effects/ovl_Effect_Ss_G_Magma2/z_eff_ss_g_magma2.h" + "src/overlays/effects/ovl_Effect_Ss_G_Ripple/z_eff_ss_g_ripple.c" + "src/overlays/effects/ovl_Effect_Ss_G_Ripple/z_eff_ss_g_ripple.h" + "src/overlays/effects/ovl_Effect_Ss_G_Spk/z_eff_ss_g_spk.c" + "src/overlays/effects/ovl_Effect_Ss_G_Spk/z_eff_ss_g_spk.h" + "src/overlays/effects/ovl_Effect_Ss_G_Splash/z_eff_ss_g_splash.c" + "src/overlays/effects/ovl_Effect_Ss_G_Splash/z_eff_ss_g_splash.h" + "src/overlays/effects/ovl_Effect_Ss_Hahen/z_eff_ss_hahen.c" + "src/overlays/effects/ovl_Effect_Ss_Hahen/z_eff_ss_hahen.h" + "src/overlays/effects/ovl_Effect_Ss_HitMark/z_eff_ss_hitmark.c" + "src/overlays/effects/ovl_Effect_Ss_HitMark/z_eff_ss_hitmark.h" + "src/overlays/effects/ovl_Effect_Ss_Ice_Piece/z_eff_ss_ice_piece.c" + "src/overlays/effects/ovl_Effect_Ss_Ice_Piece/z_eff_ss_ice_piece.h" + "src/overlays/effects/ovl_Effect_Ss_Ice_Smoke/z_eff_ss_ice_smoke.c" + "src/overlays/effects/ovl_Effect_Ss_Ice_Smoke/z_eff_ss_ice_smoke.h" + "src/overlays/effects/ovl_Effect_Ss_K_Fire/z_eff_ss_k_fire.c" + "src/overlays/effects/ovl_Effect_Ss_K_Fire/z_eff_ss_k_fire.h" + "src/overlays/effects/ovl_Effect_Ss_Kakera/z_eff_ss_kakera.c" + "src/overlays/effects/ovl_Effect_Ss_Kakera/z_eff_ss_kakera.h" + "src/overlays/effects/ovl_Effect_Ss_KiraKira/z_eff_ss_kirakira.c" + "src/overlays/effects/ovl_Effect_Ss_KiraKira/z_eff_ss_kirakira.h" + "src/overlays/effects/ovl_Effect_Ss_Lightning/z_eff_ss_lightning.c" + "src/overlays/effects/ovl_Effect_Ss_Lightning/z_eff_ss_lightning.h" + "src/overlays/effects/ovl_Effect_Ss_Sibuki/z_eff_ss_sibuki.c" + "src/overlays/effects/ovl_Effect_Ss_Sibuki/z_eff_ss_sibuki.h" + "src/overlays/effects/ovl_Effect_Ss_Sibuki2/z_eff_ss_sibuki2.c" + "src/overlays/effects/ovl_Effect_Ss_Sibuki2/z_eff_ss_sibuki2.h" + "src/overlays/effects/ovl_Effect_Ss_Solder_Srch_Ball/z_eff_ss_solder_srch_ball.c" + "src/overlays/effects/ovl_Effect_Ss_Solder_Srch_Ball/z_eff_ss_solder_srch_ball.h" + "src/overlays/effects/ovl_Effect_Ss_Stick/z_eff_ss_stick.c" + "src/overlays/effects/ovl_Effect_Ss_Stick/z_eff_ss_stick.h" + "src/overlays/effects/ovl_Effect_Ss_Stone1/z_eff_ss_stone1.c" + "src/overlays/effects/ovl_Effect_Ss_Stone1/z_eff_ss_stone1.h" +) +source_group("Source Files\\src\\overlays\\effects" FILES ${Source_Files__src__overlays__effects}) + +set(Source_Files__src__overlays__gamestates__ovl_file_choose + "src/overlays/gamestates/ovl_file_choose/z_file_choose.c" + "src/overlays/gamestates/ovl_file_choose/z_file_copy_erase.c" + "src/overlays/gamestates/ovl_file_choose/z_file_nameset_data.c" + "src/overlays/gamestates/ovl_file_choose/z_file_nameset_PAL.c" +) +source_group("Source Files\\src\\overlays\\gamestates\\ovl_file_choose" FILES ${Source_Files__src__overlays__gamestates__ovl_file_choose}) + +set(Source_Files__src__overlays__gamestates__ovl_opening + "src/overlays/gamestates/ovl_opening/z_opening.c" +) +source_group("Source Files\\src\\overlays\\gamestates\\ovl_opening" FILES ${Source_Files__src__overlays__gamestates__ovl_opening}) + +set(Source_Files__src__overlays__gamestates__ovl_select + "src/overlays/gamestates/ovl_select/z_select.c" +) +source_group("Source Files\\src\\overlays\\gamestates\\ovl_select" FILES ${Source_Files__src__overlays__gamestates__ovl_select}) + +set(Source_Files__src__overlays__gamestates__ovl_title + "src/overlays/gamestates/ovl_title/z_title.c" +) +source_group("Source Files\\src\\overlays\\gamestates\\ovl_title" FILES ${Source_Files__src__overlays__gamestates__ovl_title}) + +set(Source_Files__src__overlays__misc__ovl_kaleido_scope + #"src/overlays/actors/ovl_kaleido_scope/z_kaleido_scope.h" + "src/overlays/misc/ovl_kaleido_scope/z_kaleido_collect.c" + "src/overlays/misc/ovl_kaleido_scope/z_kaleido_debug.c" + "src/overlays/misc/ovl_kaleido_scope/z_kaleido_equipment.c" + "src/overlays/misc/ovl_kaleido_scope/z_kaleido_item.c" + "src/overlays/misc/ovl_kaleido_scope/z_kaleido_map_PAL.c" + "src/overlays/misc/ovl_kaleido_scope/z_kaleido_prompt.c" + "src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope.h" + "src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c" + "src/overlays/misc/ovl_kaleido_scope/z_lmap_mark.c" + "src/overlays/misc/ovl_kaleido_scope/z_lmap_mark_data.c" +) +source_group("Source Files\\src\\overlays\\misc\\ovl_kaleido_scope" FILES ${Source_Files__src__overlays__misc__ovl_kaleido_scope}) + +set(Source_Files__src__overlays__misc__ovl_map_mark_data + "src/overlays/misc/ovl_map_mark_data/z_map_mark_data.c" +) +source_group("Source Files\\src\\overlays\\misc\\ovl_map_mark_data" FILES ${Source_Files__src__overlays__misc__ovl_map_mark_data}) + +set(ALL_FILES + ${Header_Files} + ${Header_Files__include} + ${Header_Files__soh__Enhancements} + ${Header_Files__soh__Enhancements__cosmetics} + ${Header_Files__soh__Enhancements__debugger} + ${Header_Files__soh__Enhancements__randomizer} + ${Header_Files__soh__Enhancements__randomizer__3drando} + ${Source_Files__soh} + ${Source_Files__soh__Enhancements} + ${Source_Files__soh__Enhancements__cosmetics} + ${Source_Files__soh__Enhancements__debugger} + ${Source_Files__soh__Enhancements__randomizer} + ${Source_Files__soh__Enhancements__randomizer__3drando} + ${Source_Files__soh__Enhancements__randomizer__3drando__hint_list} + ${Source_Files__soh__Enhancements__randomizer__3drando__location_access} + ${Source_Files__src__boot} + ${Source_Files__src__buffers} + ${Source_Files__src__code} + ${Source_Files__src__libultra} + ${Source_Files__src__overlays__actors} + ${Source_Files__src__overlays__effects} + ${Source_Files__src__overlays__gamestates__ovl_file_choose} + ${Source_Files__src__overlays__gamestates__ovl_opening} + ${Source_Files__src__overlays__gamestates__ovl_select} + ${Source_Files__src__overlays__gamestates__ovl_title} + ${Source_Files__src__overlays__misc__ovl_kaleido_scope} + ${Source_Files__src__overlays__misc__ovl_map_mark_data} +) + +################################################################################ +# Target +################################################################################ +add_executable(${PROJECT_NAME} ${ALL_FILES} ${CMAKE_CURRENT_SOURCE_DIR}/Resource.rc) + +if (CMAKE_SYSTEM_NAME STREQUAL "Windows") +use_props(${PROJECT_NAME} "${CMAKE_CONFIGURATION_TYPES}" "${DEFAULT_CXX_PROPS}") +endif() + +set(ROOT_NAMESPACE soh) + +if (CMAKE_SYSTEM_NAME STREQUAL "Windows") + set_target_properties(${PROJECT_NAME} PROPERTIES + VS_GLOBAL_KEYWORD "Win32Proj" + ) + if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64") + set_target_properties(${PROJECT_NAME} PROPERTIES + INTERPROCEDURAL_OPTIMIZATION_RELEASE "TRUE" + ) + elseif("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "Win32") + set_target_properties(${PROJECT_NAME} PROPERTIES + INTERPROCEDURAL_OPTIMIZATION_RELEASE "TRUE" + ) + endif() +elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin") + set_target_properties(${PROJECT_NAME} PROPERTIES + OUTPUT_NAME "soh-macos" + ) +elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux") + set_target_properties(${PROJECT_NAME} PROPERTIES + OUTPUT_NAME "soh.elf" + ) +endif() +################################################################################ +# MSVC runtime library +################################################################################ +if (CMAKE_SYSTEM_NAME STREQUAL "Windows") + get_property(MSVC_RUNTIME_LIBRARY_DEFAULT TARGET ${PROJECT_NAME} PROPERTY MSVC_RUNTIME_LIBRARY) + if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64") + string(CONCAT "MSVC_RUNTIME_LIBRARY_STR" + $<$: + MultiThreadedDebug + > + $<$: + MultiThreaded + > + $<$,$>>:${MSVC_RUNTIME_LIBRARY_DEFAULT}> + ) + elseif("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "Win32") + string(CONCAT "MSVC_RUNTIME_LIBRARY_STR" + $<$: + MultiThreadedDebug + > + $<$: + MultiThreaded + > + $<$,$>>:${MSVC_RUNTIME_LIBRARY_DEFAULT}> + ) + endif() + set_target_properties(${PROJECT_NAME} PROPERTIES MSVC_RUNTIME_LIBRARY ${MSVC_RUNTIME_LIBRARY_STR}) +endif() +################################################################################ +# Compile definitions +################################################################################ +if (NOT CMAKE_SYSTEM_NAME STREQUAL "Windows") + find_package(SDL2) + set(SDL2-INCLUDE ${SDL2_INCLUDE_DIRS}) +else() + set(SDL2-INCLUDE ${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/libultraship/Lib/SDL/) +endif() + +target_include_directories(${PROJECT_NAME} PRIVATE assets + ${CMAKE_CURRENT_SOURCE_DIR}/include/ + ${CMAKE_CURRENT_SOURCE_DIR}/src/ + ${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/libultraship/Lib/libjpeg/include/ + ${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/libultraship/ + ${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/libultraship/Lib/spdlog/include/ + ${CMAKE_CURRENT_SOURCE_DIR}/../ZAPDTR/ZAPDUtils + ${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/libultraship/Lib/Fast3D/U64 + ${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/libultraship/Lib/Fast3D/U64/PR + ${SDL2-INCLUDE} + ${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/libultraship/ + ${CMAKE_CURRENT_SOURCE_DIR}/assets/ + . +) + +if (CMAKE_SYSTEM_NAME STREQUAL "Windows") + if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64") + target_compile_definitions(${PROJECT_NAME} PRIVATE + "$<$:" + "_DEBUG;" + "_CRT_SECURE_NO_WARNINGS;" + "ENABLE_DX11" + ">" + "$<$:" + "NDEBUG" + ">" + "INCLUDE_GAME_PRINTF;" + "_CONSOLE;" + "%(PreprocessorDefinitions)GLEW_STATIC;" + "UNICODE;" + "_UNICODE" + STORMLIB_NO_AUTO_LINK + "_CRT_SECURE_NO_WARNINGS;" + ) + elseif("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "Win32") + target_compile_definitions(${PROJECT_NAME} PRIVATE + "$<$:" + "NOINCLUDE_GAME_PRINTF;" + "_DEBUG;" + "_CRT_SECURE_NO_WARNINGS;" + "ENABLE_OPENGL" + ">" + "$<$:" + "INCLUDE_GAME_PRINTF;" + "NDEBUG;" + "%(PreprocessorDefinitions)GLEW_STATIC" + ">" + "WIN32;" + "_CONSOLE;" + "UNICODE;" + "_UNICODE" + STORMLIB_NO_AUTO_LINK + ) + endif() +endif() + +if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU|Clang|AppleClang") + target_compile_definitions(${PROJECT_NAME} PRIVATE + "$<$:" + "_DEBUG" + ">" + "$<$:" + "NDEBUG" + ">" + "SPDLOG_ACTIVE_LEVEL=0;" + "_CONSOLE;" + "_CRT_SECURE_NO_WARNINGS;" + "ENABLE_OPENGL;" + "UNICODE;" + "_UNICODE" + ) +endif() +################################################################################ +# Compile and link options +################################################################################ +if(MSVC) + if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64") + target_compile_options(${PROJECT_NAME} PRIVATE + $<$: + /sdl-; + /w + > + $<$: + /Oi; + /sdl-; + /Gy; + /W3 + > + /permissive-; + /MP; + ${DEFAULT_CXX_DEBUG_INFORMATION_FORMAT}; + ${DEFAULT_CXX_EXCEPTION_HANDLING} + ) + elseif("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "Win32") + target_compile_options(${PROJECT_NAME} PRIVATE + $<$: + /RTCs + > + $<$: + /O2; + /Oi; + /Gy + > + /permissive-; + /MP; + /sdl-; + /w; + ${DEFAULT_CXX_DEBUG_INFORMATION_FORMAT}; + ${DEFAULT_CXX_EXCEPTION_HANDLING} + ) + endif() + if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64") + target_link_options(${PROJECT_NAME} PRIVATE + $<$: + /INCREMENTAL + > + $<$: + /OPT:REF; + /OPT:ICF; + /INCREMENTAL:NO + > + /DEBUG; + /SUBSYSTEM:CONSOLE; + /FORCE:MULTIPLE + ) + elseif("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "Win32") + target_link_options(${PROJECT_NAME} PRIVATE + $<$: + /STACK:8777216 + > + $<$: + /OPT:REF; + /OPT:ICF; + /INCREMENTAL:NO; + /FORCE:MULTIPLE + > + /DEBUG; + /SUBSYSTEM:CONSOLE + ) + endif() +endif() + +if (CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang|AppleClang") + if (CMAKE_SYSTEM_NAME STREQUAL "Darwin") + target_compile_options(${PROJECT_NAME} PRIVATE + -Wall -Wextra -Wno-error + -Wno-return-type + -Wno-unused-parameter + -Wno-unused-function + -Wno-unused-variable + -Wno-missing-field-initializers + -Wno-parentheses + -Wno-narrowing + -Wno-c++11-narrowing + -Wno-implicit-function-declaration + $<$:-fpermissive> + $<$:-Wno-deprecated-enum-enum-conversion> + -pthread + ) + + target_link_options(${PROJECT_NAME} PRIVATE + -pthread + ) + elseif (CMAKE_SYSTEM_NAME STREQUAL "NintendoSwitch") + target_compile_options(${PROJECT_NAME} PRIVATE + -Wall -Wextra -Wno-error + -Wno-return-type + -Wno-unused-parameter + -Wno-unused-function + -Wno-unused-variable + -Wno-missing-field-initializers + -Wno-parentheses + -Wno-narrowing + -Wno-c++11-narrowing + -Wno-implicit-function-declaration + $<$:-fpermissive> + $<$:-Wno-deprecated-enum-enum-conversion> + -pthread + ) + + target_link_options(${PROJECT_NAME} PRIVATE + -pthread + ) + else() + if(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64") + set(CPU_OPTION -msse2 -mfpmath=sse) + endif() + + target_compile_options(${PROJECT_NAME} PRIVATE + -Wall -Wextra -Wno-error + -Wno-unused-parameter + -Wno-unused-function + -Wno-unused-variable + -Wno-missing-field-initializers + -Wno-parentheses + -Wno-narrowing + $<$:-fpermissive> + $<$:-Wno-deprecated-enum-enum-conversion> + -pthread + ${CPU_OPTION} + ) + + target_link_options(${PROJECT_NAME} PRIVATE + -pthread + -Wl,-export-dynamic + ) + endif() +endif() +################################################################################ +# Pre build events +################################################################################ +if (CMAKE_SYSTEM_NAME STREQUAL "Windows") + add_custom_command_if( + TARGET ${PROJECT_NAME} + PRE_BUILD + COMMANDS + COMMAND $ copy /b $src\\boot\\build.c +,, + ) +endif() +################################################################################ +# Dependencies +################################################################################ +add_dependencies(${PROJECT_NAME} + ZAPDUtils + libultraship +) + +if (CMAKE_SYSTEM_NAME STREQUAL "Windows") + if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64") + set(ADDITIONAL_LIBRARY_DEPENDENCIES + "libultraship;" + "ZAPDUtils;" + "glu32;" + "SDL2;" + "SDL2main;" + "glfw3dll;" + "winmm;" + "imm32;" + "version;" + "setupapi" + ) + elseif("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "Win32") + set(ADDITIONAL_LIBRARY_DEPENDENCIES + "libultraship;" + "ZAPDUtils;" + "glu32;" + "SDL2;" + "SDL2main;" + "glfw3dll;" + "winmm;" + "imm32;" + "version;" + "setupapi" + ) + endif() +elseif(CMAKE_SYSTEM_NAME STREQUAL "NintendoSwitch") + find_package(SDL2) + set(THREADS_PREFER_PTHREAD_FLAG ON) + find_package(Threads REQUIRED) + set(ADDITIONAL_LIBRARY_DEPENDENCIES + "libultraship;" + "ZAPDUtils;" + SDL2::SDL2 + -lglad + Threads::Threads + ) +else() + find_package(SDL2) + set(THREADS_PREFER_PTHREAD_FLAG ON) + find_package(Threads REQUIRED) + set(ADDITIONAL_LIBRARY_DEPENDENCIES + "libultraship;" + "ZAPDUtils;" + SDL2::SDL2 + ${CMAKE_DL_LIBS} + Threads::Threads + ) +endif() + +if (CMAKE_SYSTEM_NAME STREQUAL "Windows") + if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64") + add_library( SDL2 STATIC IMPORTED ) + set_property(TARGET SDL2 PROPERTY + IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/libultraship/Lib/SDL/lib/x64/SDL2.lib ) + set_property(TARGET SDL2 PROPERTY + IMPORTED_IMPLIB ${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/libultraship/Lib/SDL/lib/x64/SDL2.lib) + + add_library( SDL2main STATIC IMPORTED ) + set_property(TARGET SDL2main PROPERTY + IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/libultraship/Lib/SDL/lib/x64/SDL2main.lib ) + set_property(TARGET SDL2main PROPERTY + IMPORTED_IMPLIB ${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/libultraship/Lib/SDL/lib/x64/SDL2main.lib) + + add_library(glfw3dll STATIC IMPORTED ) + set_property(TARGET glfw3dll PROPERTY + IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/libultraship/Lib/GLFW/glfw3dll.lib ) + set_property(TARGET glfw3dll PROPERTY + IMPORTED_IMPLIB ${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/libultraship/Lib/GLFW/glfw3dll.lib) + + elseif("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "Win32") + add_library( SDL2 STATIC IMPORTED ) + set_property(TARGET SDL2 PROPERTY IMPORTED_LOCATION ${PROJECT_SOURCE_DIR}/../libultraship/libultraship/Lib/SDL/lib/x86/SDL2.lib ) + set_property(TARGET SDL2 PROPERTY + IMPORTED_IMPLIB ../libultraship/libultraship/Lib/SDL/lib/x86/SDL2.lib) + + add_library( SDL2main STATIC IMPORTED ) + set_property(TARGET SDL2main PROPERTY IMPORTED_LOCATION ${PROJECT_SOURCE_DIR}/../libultraship/libultraship/Lib/SDL/lib/x86/SDL2main.lib ) + set_property(TARGET SDL2main PROPERTY + IMPORTED_IMPLIB ../libultraship/libultraship/Lib/SDL/lib/x86/SDL2main.lib) + + add_library(glfw3dll STATIC IMPORTED ) + set_property(TARGET glfw3dll PROPERTY + IMPORTED_LOCATION ${PROJECT_SOURCE_DIR}/../libultraship/libultraship/Lib/GLFW/glfw3dll.lib ) + set_property(TARGET glfw3dll PROPERTY + IMPORTED_IMPLIB ${PROJECT_SOURCE_DIR}/../libultraship/libultraship/Lib/GLFW/glfw3dll.lib) + + endif() +endif() + +if(NOT CMAKE_SYSTEM_NAME STREQUAL "NintendoSwitch") +INSTALL(TARGETS soh DESTINATION . COMPONENT ship) +endif() + +find_program(CURL NAMES curl DOC "Path to the curl program. Used to download files.") +execute_process(COMMAND ${CURL} -sSfL https://raw.githubusercontent.com/gabomdq/SDL_GameControllerDB/master/gamecontrollerdb.txt -o ${CMAKE_BINARY_DIR}/gamecontrollerdb.txt OUTPUT_VARIABLE RESULT) + +if("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin") +INSTALL(FILES ${CMAKE_BINARY_DIR}/gamecontrollerdb.txt DESTINATION ../MacOS COMPONENT ship) +elseif(NOT "${CMAKE_SYSTEM_NAME}" STREQUAL "NintendoSwitch") +INSTALL(FILES ${CMAKE_BINARY_DIR}/gamecontrollerdb.txt DESTINATION . COMPONENT ship) +endif() + +if("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin") +install(CODE " + include(InstallRequiredSystemLibraries) + include(BundleUtilities) + fixup_bundle(\"\${CMAKE_INSTALL_PREFIX}/soh-macos\" \"\" \"${dirs}\") + ") +endif() + +if(CMAKE_SYSTEM_NAME STREQUAL "NintendoSwitch") + if (NOT TARGET pathconf) + add_library(pathconf OBJECT switch/pathconf.c) + endif() + target_link_libraries(${PROJECT_NAME} PRIVATE "${ADDITIONAL_LIBRARY_DEPENDENCIES}" $ ) +else() + target_link_libraries(${PROJECT_NAME} PRIVATE "${ADDITIONAL_LIBRARY_DEPENDENCIES}") +endif() + +if(CMAKE_SYSTEM_NAME MATCHES "NintendoSwitch") + +nx_generate_nacp(Ship.nacp + NAME "Ship of Harkinian" + AUTHOR "Harbour Masters" + VERSION "3.1.0" +) + +nx_create_nro(soh + NACP Ship.nacp + ICON ${CMAKE_CURRENT_SOURCE_DIR}/icon.jpg +) + +INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/soh.nro DESTINATION . COMPONENT ship) + +endif() diff --git a/soh/Makefile b/soh/Makefile deleted file mode 100644 index 24b3c9e8b..000000000 --- a/soh/Makefile +++ /dev/null @@ -1,235 +0,0 @@ -CXX ?= g++ -CC ?= gcc -LD := lld -AR := ar -FORMAT := clang-format-11 -ZAPD := ../ZAPDTR/ZAPD.out -UNAME := $(shell uname) -UNAMEM := $(shell uname -m) - -LIBULTRASHIP := ../libultraship/libultraship.a -ZAPDUTILS := ../ZAPDTR/ZAPDUtils/ZAPDUtils.a -LIBSTORM := ../StormLib/build/libstorm.a - -ASAN ?= 0 -DEBUG ?= 1 -OPTFLAGS ?= -O0 -LTO ?= 0 - -# flag to save whether the compiler being used is clang or gcc by checking CXX --version -CXX_IS_CLANG ?= $(shell $(CXX) --version | grep -c clang) - -WARN := \ - -Wno-return-type \ - -funsigned-char \ - -fno-stack-protector -fno-common -fno-zero-initialized-in-bss -fno-strict-aliasing -fno-inline-functions -fno-inline-small-functions -ffreestanding -fwrapv \ - -ifeq ($(CXX_IS_CLANG),1) - WARN += -Wno-c++11-narrowing -endif - -CXXFLAGS := $(WARN) -std=c++20 -D_GNU_SOURCE -fpermissive -nostdlib $(shell pkg-config --cflags glew) $(shell sdl2-config --cflags) -CFLAGS := $(WARN) -std=c99 -Wno-implicit-function-declaration -D_GNU_SOURCE -nostdlib $(shell pkg-config --cflags glew) $(shell sdl2-config --cflags) -LDFLAGS := - -ifneq ($(CXX_IS_CLANG),1) - CXXFLAGS += -no-pie - CFLAGS += -no-pie -endif - -ifeq ($(UNAME), Linux) - ifeq ($(UNAMEM), x86_64) - CXXFLAGS += -msse2 -mfpmath=sse -mhard-float - CFLAGS += -msse2 -mfpmath=sse -mhard-float - endif - - CXXFLAGS += $(shell pkg-config --cflags libpulse) - CFLAGS += $(shell pkg-config --cflags libpulse) -endif - -CPPFLAGS := -MMD - -ifneq ($(DEBUG),0) - CXXFLAGS += -g - CFLAGS += -g -endif - -ifneq ($(ASAN),0) - CXXFLAGS += -fsanitize=address - CFLAGS += -fsanitize=address - LDFLAGS += -fsanitize=address -endif - -ifneq ($(LTO),0) - CXXFLAGS += -flto - CFLAGS += -flto - LDFLAGS += -flto -endif - -ifeq ($(UNAME), Linux) -TARGET := soh.elf -endif - -ifeq ($(UNAME), Darwin) -TARGET := soh-$(UNAMEM) -endif - -INC_DIRS := $(addprefix -I, \ - . \ - assets \ - build \ - include \ - src \ - ../ZAPDTR/ZAPDUtils \ - ../libultraship/libultraship \ - ../libultraship/libultraship/Lib/spdlog/include \ - ../libultraship/libultraship/Lib/Fast3D/U64 \ - ../libultraship/libultraship/Lib/Fast3D/U64/PR \ -) - -LDDIRS := $(addprefix -L, \ - ../libultraship/ \ -) - -LDLIBS := \ - $(ZAPDUTILS) \ - $(LIBSTORM) \ - $(shell sdl2-config --libs) \ - $(shell pkg-config --libs glew) \ - $(addprefix -l, \ - dl \ - bz2 \ - z \ - pthread \ - ultraship \ -) - -ifeq ($(UNAME), Linux) -LDLIBS += $(shell pkg-config --libs x11 libpulse) -endif - -ifeq ($(UNAME), Darwin) -LDLIBS += \ - $(addprefix -framework , \ - OpenGL \ - Foundation \ -) -endif - -ASSET_BIN_DIRS := $(shell find assets/* -type d -not -path "assets/xml*") -ASSET_FILES_XML := $(foreach dir,$(ASSET_BIN_DIRS),$(wildcard $(dir)/*.xml)) -ASSET_FILES_BIN := $(foreach dir,$(ASSET_BIN_DIRS),$(wildcard $(dir)/*.bin)) -ASSET_FILES_OUT := $(foreach f,$(ASSET_FILES_XML:.xml=.c),$f) \ - $(foreach f,$(ASSET_FILES_BIN:.bin=.bin.inc.c),build/$f) - -TEXTURE_FILES_PNG := $(foreach dir,$(ASSET_BIN_DIRS),$(wildcard $(dir)/*.png)) -TEXTURE_FILES_JPG := $(foreach dir,$(ASSET_BIN_DIRS),$(wildcard $(dir)/*.jpg)) -TEXTURE_FILES_OUT := $(foreach f,$(TEXTURE_FILES_PNG:.png=.inc.c),build/$f) \ - $(foreach f,$(TEXTURE_FILES_JPG:.jpg=.jpg.inc.c),build/$f) \ - -CXX_FILES := \ - $(shell find soh -type f -name "*.cpp") - -C_FILES := \ - $(shell find soh -type f -name "*.c") \ - $(shell find src/boot -type f -name "*.c") \ - $(shell find src/buffers -type f -name "*.c") \ - $(shell find src/code -type f -name "*.c") \ - $(shell find src/overlays -type f -name "*.c") \ - src/libultra/gu/coss.c \ - src/libultra/gu/guLookAt.c \ - src/libultra/gu/guLookAtHilite.c \ - src/libultra/gu/guPerspectiveF.c \ - src/libultra/gu/guPosition.c \ - src/libultra/gu/guS2DInitBg.c \ - src/libultra/gu/ortho.c \ - src/libultra/gu/rotate.c \ - src/libultra/gu/sins.c \ - src/libultra/gu/sintable.c \ - src/libultra/libc/sprintf.c - -O_FILES := \ - $(C_FILES:%.c=build/%.o) \ - $(CXX_FILES:%.cpp=build/%.o) -D_FILES := $(O_FILES:%.o=%.d) - -# Apple App Bundle -APPNAME=soh -APPBUNDLE=$(APPNAME).app -APPBUNDLECONTENTS=$(APPBUNDLE)/Contents -APPBUNDLEEXE=$(APPBUNDLECONTENTS)/MacOS -APPBUNDLERESOURCES=$(APPBUNDLECONTENTS)/Resources -APPBUNDLEICON=$(APPBUNDLECONTENTS)/Resources - -# create build directory -SRC_DIRS := $(shell find . -type d -a -not -path "*build*") -$(shell mkdir -p $(SRC_DIRS:%=build/%)) - -all: - $(MAKE) -C ../libultraship - $(MAKE) $(TARGET) - -setup: - cd ../OTRExporter - $(MAKE) mpq - -mpq: - $(MAKE) -C ../libultraship - $(MAKE) -C ../OTRExporter/OTRExporter - $(MAKE) -C ../ZAPDTR - rm -rf ../OTRExporter/oot.otr - cd ../OTRExporter && python3 extract_assets.py - cp ../OTRExporter/oot.otr . - -distclean: clean - $(RM) -r baserom/ - $(MAKE) clean -C ../libultraship - $(MAKE) clean -C ../OTRExporter/OTRExporter - $(MAKE) clean -C ../ZAPDTR - -clean: - rm -rf build $(TARGET) - -.PHONY: all clean distclean setup mpq - -build/%.o: %.cpp - $(CXX) -c $(CXXFLAGS) $(CPPFLAGS) $(OPTFLAGS) $(INC_DIRS) $< -o $@ - -build/%.o: %.c - $(CC) -c $(CFLAGS) $(CPPFLAGS) $(OPTFLAGS) $(INC_DIRS) $< -o $@ - -# make soh depend on libultraship -$(TARGET): $(LIBULTRASHIP) - -$(TARGET): $(O_FILES) - $(CXX) $^ -o $@ $(LDFLAGS) $(LDDIRS) $(LDLIBS) - --include $(D_FILES) - -appbundle: macosx/$(APPNAME).icns - rm -rf $(APPBUNDLE) - mkdir $(APPBUNDLE) - mkdir $(APPBUNDLE)/Contents - mkdir $(APPBUNDLE)/Contents/MacOS - mkdir $(APPBUNDLE)/Contents/Resources - cp macosx/Info.plist $(APPBUNDLECONTENTS)/ - cp macosx/PkgInfo $(APPBUNDLECONTENTS)/ - cp macosx/$(APPNAME).icns $(APPBUNDLEICON)/ - cp $(TARGET) $(APPBUNDLEEXE)/soh - otool -l $(TARGET) | grep -A 2 LC_RPATH | tail -n 1 | awk '{print $2}' | dylibbundler -od -b -x $(APPBUNDLEEXE)/soh -d $(APPBUNDLECONTENTS)/libs - -macosx/$(APPNAME).icns: macosx/$(APPNAME)Icon.png - rm -rf macosx/$(APPNAME).iconset - mkdir macosx/$(APPNAME).iconset - sips -z 16 16 macosx/$(APPNAME)Icon.png --out macosx/$(APPNAME).iconset/icon_16x16.png - sips -z 32 32 macosx/$(APPNAME)Icon.png --out macosx/$(APPNAME).iconset/icon_16x16@2x.png - sips -z 32 32 macosx/$(APPNAME)Icon.png --out macosx/$(APPNAME).iconset/icon_32x32.png - sips -z 64 64 macosx/$(APPNAME)Icon.png --out macosx/$(APPNAME).iconset/icon_32x32@2x.png - sips -z 128 128 macosx/$(APPNAME)Icon.png --out macosx/$(APPNAME).iconset/icon_128x128.png - sips -z 256 256 macosx/$(APPNAME)Icon.png --out macosx/$(APPNAME).iconset/icon_128x128@2x.png - sips -z 256 256 macosx/$(APPNAME)Icon.png --out macosx/$(APPNAME).iconset/icon_256x256.png - sips -z 512 512 macosx/$(APPNAME)Icon.png --out macosx/$(APPNAME).iconset/icon_256x256@2x.png - sips -z 512 512 macosx/$(APPNAME)Icon.png --out macosx/$(APPNAME).iconset/icon_512x512.png - cp macosx/$(APPNAME)Icon.png macosx/$(APPNAME).iconset/icon_512x512@2x.png - iconutil -c icns -o macosx/$(APPNAME).icns macosx/$(APPNAME).iconset - rm -r macosx/$(APPNAME).iconset diff --git a/soh/Makefile.switch b/soh/Makefile.switch deleted file mode 100644 index 10eaaebab..000000000 --- a/soh/Makefile.switch +++ /dev/null @@ -1,280 +0,0 @@ -#--------------------------------------------------------------------------------- -.SUFFIXES: -#--------------------------------------------------------------------------------- - -ifeq ($(strip $(DEVKITPRO)),) -$(error "Please set DEVKITPRO in your environment. export DEVKITPRO=/devkitpro") -endif - -TOPDIR ?= $(CURDIR) -include $(DEVKITPRO)/libnx/switch_rules - -#--------------------------------------------------------------------------------- -# TARGET is the name of the output -# BUILD is the directory where object files & intermediate files will be placed -# SOURCES is a list of directories containing source code -# DATA is a list of directories containing data files -# INCLUDES is a list of directories containing header files -# ROMFS is the directory containing data to be added to RomFS, relative to the Makefile (Optional) -# -# NO_ICON: if set to anything, do not use icon. -# NO_NACP: if set to anything, no .nacp file is generated. -# APP_TITLE is the name of the app stored in the .nacp file (Optional) -# APP_AUTHOR is the author of the app stored in the .nacp file (Optional) -# APP_VERSION is the version of the app stored in the .nacp file (Optional) -# APP_TITLEID is the titleID of the app stored in the .nacp file (Optional) -# ICON is the filename of the icon (.jpg), relative to the project folder. -# If not set, it attempts to use one of the following (in this order): -# - .jpg -# - icon.jpg -# - /default_icon.jpg -# -# CONFIG_JSON is the filename of the NPDM config file (.json), relative to the project folder. -# If not set, it attempts to use one of the following (in this order): -# - .json -# - config.json -# If a JSON file is provided or autodetected, an ExeFS PFS0 (.nsp) is built instead -# of a homebrew executable (.nro). This is intended to be used for sysmodules. -# NACP building is skipped as well. -#--------------------------------------------------------------------------------- -TARGET := $(notdir $(CURDIR)) -BUILD := build -SOURCES := switch -DATA := -INCLUDES := \ - . \ - assets \ - build \ - include \ - src \ - ../ZAPDTR/ZAPDUtils \ - ../libultraship/libultraship \ - ../libultraship/libultraship/Lib/spdlog/include \ - ../libultraship/libultraship/Lib/Fast3D/U64 \ - ../libultraship/libultraship/Lib/Fast3D/U64/PR - -#------------------------------------------------------------------------------- -# source files -#------------------------------------------------------------------------------- -SOURCEFILES_C := \ - $(shell find soh -type f -name "*.c") \ - $(shell find src/boot -type f -name "*.c") \ - $(shell find src/buffers -type f -name "*.c") \ - $(shell find src/code -type f -name "*.c") \ - $(shell find src/overlays -type f -name "*.c") \ - src/libultra/gu/coss.c \ - src/libultra/gu/guLookAt.c \ - src/libultra/gu/guLookAtHilite.c \ - src/libultra/gu/guPerspectiveF.c \ - src/libultra/gu/guPosition.c \ - src/libultra/gu/guS2DInitBg.c \ - src/libultra/gu/ortho.c \ - src/libultra/gu/rotate.c \ - src/libultra/gu/sins.c \ - src/libultra/gu/sintable.c \ - src/libultra/libc/sprintf.c - -SOURCEFILES_CPP := \ - $(shell find soh -type f -name "*.cpp") -#--------------------------------------------------------------------------------- -# app info -#--------------------------------------------------------------------------------- - -APP_TITLE := Ship of Harkinian -APP_AUTHOR := Harbour Masters -APP_VERSION := Rachael-Alfa - -#--------------------------------------------------------------------------------- -# options for code generation -#--------------------------------------------------------------------------------- -ARCH := -march=armv8-a+crc+crypto -mtune=cortex-a57 -mtp=soft -fPIE -ffast-math -O3 - -CFLAGS := -ffunction-sections \ - $(ARCH) $(DEFINES) - -CFLAGS += $(INCLUDE) -D__SWITCH__ \ - -DSPDLOG_NO_THREAD_ID \ - -DSTBI_NO_THREAD_LOCALS \ - `sdl2-config --cflags` - -CXXFLAGS := $(CFLAGS) -std=gnu++20 -fpermissive -CFLAGS += -std=gnu11 - -# disable some warnings -CFLAGS += -Wno-incompatible-pointer-types -Wno-int-conversion \ - -Wno-builtin-declaration-mismatch -Wno-implicit-function-declaration \ - -Wno-stringop-overflow -Wno-discarded-qualifiers -Wno-switch-unreachable - -ASFLAGS := -g $(ARCH) -LDFLAGS = -specs=$(DEVKITPRO)/libnx/switch.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map) - -STATIC_LIBS := $(SOH_TOP_DIR)/libultraship/lib/libultraship.a \ - $(SOH_TOP_DIR)/ZAPDTR/ZAPDUtils/lib/libZAPDUtils.a \ - $(SOH_TOP_DIR)/ZAPDTR/ZAPDUtils/lib/libZAPDUtils.a \ - $(SOH_TOP_DIR)/StormLib/nxbuild/libstorm.a \ - -LIBS := -L$(SOH_TOP_DIR)/StormLib/nxbuild/ -lultraship -lZAPDUtils -lstorm -lz -lbz2 -lnx -lglad -lglapi -ldrm_nouveau -lm `sdl2-config --libs` - -#--------------------------------------------------------------------------------- -# list of directories containing libraries, this must be the top level containing -# include and lib -#--------------------------------------------------------------------------------- -LIBDIRS := $(PORTLIBS) $(LIBNX) $(SOH_TOP_DIR)/StormLib/nxbuild $(SOH_TOP_DIR)/libultraship $(SOH_TOP_DIR)/ZAPDTR/ZAPDUtils - -#--------------------------------------------------------------------------------- -# no real need to edit anything past this point unless you need to add additional -# rules for different file extensions -#--------------------------------------------------------------------------------- -ifneq ($(BUILD),$(notdir $(CURDIR))) -#--------------------------------------------------------------------------------- - -export OUTPUT := $(CURDIR)/$(TARGET) -export TOPDIR := $(CURDIR) - -export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \ - $(foreach dir,$(DATA),$(CURDIR)/$(dir)) \ - $(foreach sf,$(SOURCEFILES_C),$(CURDIR)/$(dir $(sf))) \ - $(foreach sf,$(SOURCEFILES_CPP),$(CURDIR)/$(dir $(sf))) - -export DEPSDIR := $(CURDIR)/$(BUILD) - -CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c))) \ - $(foreach f,$(SOURCEFILES_C),$(notdir $(f))) -CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp))) \ - $(foreach f,$(SOURCEFILES_CPP),$(notdir $(f))) -SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s))) -BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*))) - -#--------------------------------------------------------------------------------- -# use CXX for linking C++ projects, CC for standard C -#--------------------------------------------------------------------------------- -ifeq ($(strip $(CPPFILES)),) -#--------------------------------------------------------------------------------- - export LD := $(CC) -#--------------------------------------------------------------------------------- -else -#--------------------------------------------------------------------------------- - export LD := $(CXX) -#--------------------------------------------------------------------------------- -endif -#--------------------------------------------------------------------------------- - -export OFILES_BIN := $(addsuffix .o,$(BINFILES)) -export OFILES_SRC := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o) -export OFILES := $(OFILES_BIN) $(OFILES_SRC) -export HFILES_BIN := $(addsuffix .h,$(subst .,_,$(BINFILES))) - -export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \ - $(foreach dir,$(LIBDIRS),-I$(dir)/include) \ - -I$(CURDIR)/$(BUILD) - -export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) - -ifeq ($(strip $(CONFIG_JSON)),) - jsons := $(wildcard *.json) - ifneq (,$(findstring $(TARGET).json,$(jsons))) - export APP_JSON := $(TOPDIR)/$(TARGET).json - else - ifneq (,$(findstring config.json,$(jsons))) - export APP_JSON := $(TOPDIR)/config.json - endif - endif -else - export APP_JSON := $(TOPDIR)/$(CONFIG_JSON) -endif - -ifeq ($(strip $(ICON)),) - icons := $(wildcard *.jpg) - ifneq (,$(findstring $(TARGET).jpg,$(icons))) - export APP_ICON := $(TOPDIR)/$(TARGET).jpg - else - ifneq (,$(findstring icon.jpg,$(icons))) - export APP_ICON := $(TOPDIR)/icon.jpg - endif - endif -else - export APP_ICON := $(TOPDIR)/$(ICON) -endif - -ifeq ($(strip $(NO_ICON)),) - export NROFLAGS += --icon=$(APP_ICON) -endif - -ifeq ($(strip $(NO_NACP)),) - export NROFLAGS += --nacp=$(CURDIR)/$(TARGET).nacp -endif - -ifneq ($(APP_TITLEID),) - export NACPFLAGS += --titleid=$(APP_TITLEID) -endif - -ifneq ($(ROMFS),) - export NROFLAGS += --romfsdir=$(CURDIR)/$(ROMFS) -endif - -.PHONY: $(BUILD) clean all - -#--------------------------------------------------------------------------------- -all: $(BUILD) - -$(BUILD): - @[ -d $@ ] || mkdir -p $@ - @$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile.switch - -#--------------------------------------------------------------------------------- -clean: - @echo clean ... -ifeq ($(strip $(APP_JSON)),) - @rm -fr $(BUILD) $(TARGET).nro $(TARGET).nacp $(TARGET).elf -else - @rm -fr $(BUILD) $(TARGET).nsp $(TARGET).nso $(TARGET).npdm $(TARGET).elf -endif - - -#--------------------------------------------------------------------------------- -else -.PHONY: all - -DEPENDS := $(OFILES:.o=.d) - -#--------------------------------------------------------------------------------- -# main targets -#--------------------------------------------------------------------------------- -ifeq ($(strip $(APP_JSON)),) - -all : $(OUTPUT).nro - -ifeq ($(strip $(NO_NACP)),) -$(OUTPUT).nro : $(OUTPUT).elf $(OUTPUT).nacp -else -$(OUTPUT).nro : $(OUTPUT).elf -endif - -else - -all : $(OUTPUT).nsp - -$(OUTPUT).nsp : $(OUTPUT).nso $(OUTPUT).npdm - -$(OUTPUT).nso : $(OUTPUT).elf - -endif - -$(OUTPUT).elf : $(OFILES) \ - $(STATIC_LIBS) - -$(OFILES_SRC) : $(HFILES_BIN) - -#--------------------------------------------------------------------------------- -# you need a rule like this for each extension you use as binary data -#--------------------------------------------------------------------------------- -%.bin.o %_bin.h : %.bin -#--------------------------------------------------------------------------------- - @echo $(notdir $<) - @$(bin2o) - --include $(DEPENDS) - -#--------------------------------------------------------------------------------------- -endif -#--------------------------------------------------------------------------------------- \ No newline at end of file diff --git a/soh/include/functions.h b/soh/include/functions.h index b185519f4..0bea29da2 100644 --- a/soh/include/functions.h +++ b/soh/include/functions.h @@ -63,6 +63,9 @@ u32 Locale_IsRegionNative(void); #if !defined(__APPLE__) && !defined(__SWITCH__) void __assert(const char* exp, const char* file, s32 line); #endif +#if defined(__APPLE__) && defined(NDEBUG) +void __assert(const char* exp, const char* file, s32 line); +#endif void isPrintfInit(void); void osSyncPrintfUnused(const char* fmt, ...); //void osSyncPrintf(const char* fmt, ...); @@ -1528,6 +1531,7 @@ s32 func_800C0CB8(GlobalContext* globalCtx); s32 FrameAdvance_IsEnabled(GlobalContext* globalCtx); s32 func_800C0D34(GlobalContext* globalCtx, Actor* actor, s16* yaw); s32 func_800C0DB4(GlobalContext* globalCtx, Vec3f* pos); +void Gameplay_PerformSave(GlobalContext* globalCtx); void PreRender_SetValuesSave(PreRender* this, u32 width, u32 height, void* fbuf, void* zbuf, void* cvg); void PreRender_Init(PreRender* this); void PreRender_SetValues(PreRender* this, u32 width, u32 height, void* fbuf, void* zbuf); diff --git a/soh/include/z64effect.h b/soh/include/z64effect.h index 1b35d46b6..8dce5b6a3 100644 --- a/soh/include/z64effect.h +++ b/soh/include/z64effect.h @@ -25,7 +25,8 @@ typedef struct { /* 0x0C */ Vec3f position; /* 0x18 */ Vec3s unkVelocity; /* 0x1E */ Vec3s unkPosition; -} EffectSparkElement; // size = 0x24 + /* 0x24 */ s32 epoch; +} EffectSparkElement; // size = 0x28 typedef struct { /* 0x000 */ Vec3s position; @@ -117,7 +118,8 @@ typedef struct { /* 0x10 */ f32 startX; /* 0x14 */ s16 yaw; /* 0x16 */ s16 pitch; -} EffectShieldParticleElement; // size = 0x18 + /* 0x18 */ s32 epoch; +} EffectShieldParticleElement; // size = 0x1C typedef struct { /* 0x00 */ u8 numElements; diff --git a/soh/macosx/soh-macos.sh b/soh/macosx/soh-macos.sh new file mode 100755 index 000000000..6ce17f55d --- /dev/null +++ b/soh/macosx/soh-macos.sh @@ -0,0 +1,8 @@ +#!/bin/sh +BUNDLE="`echo "$0" | sed -e 's/\/Contents\/MacOS\/.*//'`" +RESOURCES="$BUNDLE/Contents/Resources" + +export DYLD_FRAMEWORK_PATH=$RESOURCES/Frameworks +export DYLD_LIBRARY_PATH=$RESOURCES/bin + +exec "$RESOURCES/soh-macos" diff --git a/soh/soh.sln b/soh/soh.sln deleted file mode 100644 index 596ab27ee..000000000 --- a/soh/soh.sln +++ /dev/null @@ -1,66 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.31112.23 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "soh", "soh.vcxproj", "{31348AA7-8DC5-4FA7-955F-E80855CADE9E}" - ProjectSection(ProjectDependencies) = postProject - {78424708-1F6E-4D4B-920C-FB6D26847055} = {78424708-1F6E-4D4B-920C-FB6D26847055} - {6DA9B521-65B7-41E2-8F8A-F0451CC18ED8} = {6DA9B521-65B7-41E2-8F8A-F0451CC18ED8} - {A2E01C3E-D647-45D1-9788-043DEBC1A908} = {A2E01C3E-D647-45D1-9788-043DEBC1A908} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libultraship", "..\libultraship\libultraship\libultraship.vcxproj", "{6DA9B521-65B7-41E2-8F8A-F0451CC18ED8}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ZAPDUtils", "..\ZAPDTR\ZAPDUtils\ZAPDUtils.vcxproj", "{A2E01C3E-D647-45D1-9788-043DEBC1A908}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "StormLib", "..\StormLib\StormLib_vs19.vcxproj", "{78424708-1F6E-4D4B-920C-FB6D26847055}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|x64 = Debug|x64 - Debug|x86 = Debug|x86 - Release|x64 = Release|x64 - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {31348AA7-8DC5-4FA7-955F-E80855CADE9E}.Debug|x64.ActiveCfg = Debug|x64 - {31348AA7-8DC5-4FA7-955F-E80855CADE9E}.Debug|x64.Build.0 = Debug|x64 - {31348AA7-8DC5-4FA7-955F-E80855CADE9E}.Debug|x86.ActiveCfg = Debug|Win32 - {31348AA7-8DC5-4FA7-955F-E80855CADE9E}.Debug|x86.Build.0 = Debug|Win32 - {31348AA7-8DC5-4FA7-955F-E80855CADE9E}.Release|x64.ActiveCfg = Release|x64 - {31348AA7-8DC5-4FA7-955F-E80855CADE9E}.Release|x64.Build.0 = Release|x64 - {31348AA7-8DC5-4FA7-955F-E80855CADE9E}.Release|x86.ActiveCfg = Release|Win32 - {31348AA7-8DC5-4FA7-955F-E80855CADE9E}.Release|x86.Build.0 = Release|Win32 - {6DA9B521-65B7-41E2-8F8A-F0451CC18ED8}.Debug|x64.ActiveCfg = Debug|x64 - {6DA9B521-65B7-41E2-8F8A-F0451CC18ED8}.Debug|x64.Build.0 = Debug|x64 - {6DA9B521-65B7-41E2-8F8A-F0451CC18ED8}.Debug|x86.ActiveCfg = Debug|Win32 - {6DA9B521-65B7-41E2-8F8A-F0451CC18ED8}.Debug|x86.Build.0 = Debug|Win32 - {6DA9B521-65B7-41E2-8F8A-F0451CC18ED8}.Release|x64.ActiveCfg = Release|x64 - {6DA9B521-65B7-41E2-8F8A-F0451CC18ED8}.Release|x64.Build.0 = Release|x64 - {6DA9B521-65B7-41E2-8F8A-F0451CC18ED8}.Release|x86.ActiveCfg = Release|Win32 - {6DA9B521-65B7-41E2-8F8A-F0451CC18ED8}.Release|x86.Build.0 = Release|Win32 - {A2E01C3E-D647-45D1-9788-043DEBC1A908}.Debug|x64.ActiveCfg = Debug|x64 - {A2E01C3E-D647-45D1-9788-043DEBC1A908}.Debug|x64.Build.0 = Debug|x64 - {A2E01C3E-D647-45D1-9788-043DEBC1A908}.Debug|x86.ActiveCfg = Debug|Win32 - {A2E01C3E-D647-45D1-9788-043DEBC1A908}.Debug|x86.Build.0 = Debug|Win32 - {A2E01C3E-D647-45D1-9788-043DEBC1A908}.Release|x64.ActiveCfg = Release|x64 - {A2E01C3E-D647-45D1-9788-043DEBC1A908}.Release|x64.Build.0 = Release|x64 - {A2E01C3E-D647-45D1-9788-043DEBC1A908}.Release|x86.ActiveCfg = Release|Win32 - {A2E01C3E-D647-45D1-9788-043DEBC1A908}.Release|x86.Build.0 = Release|Win32 - {78424708-1F6E-4D4B-920C-FB6D26847055}.Debug|x64.ActiveCfg = DebugUS|x64 - {78424708-1F6E-4D4B-920C-FB6D26847055}.Debug|x64.Build.0 = DebugUS|x64 - {78424708-1F6E-4D4B-920C-FB6D26847055}.Debug|x86.ActiveCfg = DebugUS|Win32 - {78424708-1F6E-4D4B-920C-FB6D26847055}.Debug|x86.Build.0 = DebugUS|Win32 - {78424708-1F6E-4D4B-920C-FB6D26847055}.Release|x64.ActiveCfg = ReleaseUS|x64 - {78424708-1F6E-4D4B-920C-FB6D26847055}.Release|x64.Build.0 = ReleaseUS|x64 - {78424708-1F6E-4D4B-920C-FB6D26847055}.Release|x86.ActiveCfg = ReleaseUS|Win32 - {78424708-1F6E-4D4B-920C-FB6D26847055}.Release|x86.Build.0 = ReleaseUS|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {7659B687-4D92-4865-A037-045115E1C783} - EndGlobalSection -EndGlobal diff --git a/soh/soh.vcxproj b/soh/soh.vcxproj deleted file mode 100644 index 072f4c630..000000000 --- a/soh/soh.vcxproj +++ /dev/null @@ -1,1524 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - 16.0 - Win32Proj - {31348aa7-8dc5-4fa7-955f-e80855cade9e} - soh - 10.0 - - - - Application - true - v142 - Unicode - false - - - Application - false - v142 - true - Unicode - false - - - Application - true - v142 - Unicode - false - - - Application - false - v142 - true - Unicode - false - - - - - - - - - - - - - - - - - - - - - $(ProjectDir)assets;$(ProjectDir)build;$(ProjectDir)include;$(ProjectDir)src;$(ProjectDir);$(ProjectDir)..\libultraship\libultraship\Lib\libjpeg\include;$(ProjectDir)..\libultraship\libultraship;$(ProjectDir)..\libultraship\libultraship\Lib\spdlog\include;$(ProjectDir)..\ZAPDTR\ZAPDUtils;$(ProjectDir)..\libultraship\libultraship\Lib\Fast3D\U64;$(ProjectDir)..\libultraship\libultraship\Lib\Fast3D\U64\PR;$(ProjectDir)..\libultraship\libultraship\Lib\SDL;$(IncludePath) - $(OutDir);$(ProjectDir)..\libultraship\libultraship;$(ProjectDir)..\libultraship\libultraship\Lib\SDL\lib\x86;$(ProjectDir)..\libultraship\libultraship\Lib\GLEW\x86;$(ProjectDir)..\libultraship\libultraship\Lib\GLFW;$(ProjectDir)..\StormLib\bin\StormLib\Win32\DebugUS\;$(LibraryPath) - $(Configuration)Obj\ - - - false - $(ProjectDir)assets;$(ProjectDir)build;$(ProjectDir)include;$(ProjectDir)src;$(ProjectDir);$(ProjectDir)..\libultraship\libultraship\Lib\libjpeg\include;$(ProjectDir)..\libultraship\libultraship;$(ProjectDir)..\libultraship\libultraship\Lib\spdlog\include;$(ProjectDir)..\ZAPDTR\ZAPDUtils;$(ProjectDir)..\libultraship\libultraship\Lib\Fast3D\U64;$(ProjectDir)..\libultraship\libultraship\Lib\Fast3D\U64\PR;$(ProjectDir)..\libultraship\libultraship\Lib\SDL;$(IncludePath) - $(OutDir);$(ProjectDir)..\libultraship\libultraship;$(ProjectDir)..\libultraship\libultraship\Lib\SDL\lib\x86;$(ProjectDir)..\libultraship\libultraship\Lib\GLEW\x86;$(ProjectDir)..\libultraship\libultraship\Lib\GLFW;$(ProjectDir)..\StormLib\bin\StormLib\Win32\ReleaseUS\;$(LibraryPath) - $(Configuration)Obj\ - - - true - $(ProjectDir)assets;$(ProjectDir)build;$(ProjectDir)include;$(ProjectDir)src;$(ProjectDir);$(ProjectDir)..\libultraship\libultraship\Lib\libjpeg\include;$(ProjectDir)..\libultraship\libultraship;$(ProjectDir)..\libultraship\libultraship\Lib\spdlog\include;$(ProjectDir)..\ZAPDTR\ZAPDUtils;$(ProjectDir)..\libultraship\libultraship\Lib\Fast3D\U64;$(ProjectDir)..\libultraship\libultraship\Lib\Fast3D\U64\PR;$(ProjectDir)..\libultraship\libultraship\Lib\SDL;$(IncludePath) - $(OutDir);$(ProjectDir)..\libultraship\libultraship;$(ProjectDir)..\libultraship\libultraship\Lib\SDL\lib\x64;$(ProjectDir)..\libultraship\libultraship\Lib\GLEW\x64;$(ProjectDir)..\libultraship\libultraship\Lib\GLFW;$(ProjectDir)..\StormLib\bin\StormLib\x64\DebugUS\;$(LibraryPath) - $(Platform)\$(Configuration)Obj\ - - - false - $(ProjectDir)assets;$(ProjectDir)build;$(ProjectDir)include;$(ProjectDir)src;$(ProjectDir);$(ProjectDir)..\libultraship\libultraship\Lib\libjpeg\include;$(ProjectDir)..\libultraship\libultraship;$(ProjectDir)..\libultraship\libultraship\Lib\spdlog\include;$(ProjectDir)..\ZAPDTR\ZAPDUtils;$(ProjectDir)..\libultraship\libultraship\Lib\Fast3D\U64;$(ProjectDir)..\libultraship\libultraship\Lib\Fast3D\U64\PR;$(ProjectDir)..\libultraship\libultraship\Lib\SDL;$(ProjectDir)..\libultraship\libultraship\Lib\dr_libs;$(IncludePath) - $(OutDir);$(ProjectDir)..\libultraship\libultraship;$(ProjectDir)..\libultraship\libultraship\Lib\SDL\lib\x64;$(ProjectDir)..\libultraship\libultraship\Lib\GLEW\x64;$(ProjectDir)..\libultraship\libultraship\Lib\GLFW;$(ProjectDir)..\StormLib\bin\StormLib\x64\ReleaseUS\;$(LibraryPath) - $(Platform)\$(Configuration)Obj\ - - - - TurnOffAllWarnings - false - NOINCLUDE_GAME_PRINTF;WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;ENABLE_OPENGL;%(PreprocessorDefinitions) - true - stdcpp20 - MultiThreadedDebug - true - Default - - - Console - true - libultraship.lib;ZAPDUtils.lib;opengl32.lib;glu32.lib;SDL2.lib;SDL2main.lib;glew32s.lib;winmm.lib;imm32.lib;version.lib;setupapi.lib;%(AdditionalDependencies) - 8777216 - true - true - - - - - TurnOffAllWarnings - true - true - false - INCLUDE_GAME_PRINTF;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)GLEW_STATIC - true - stdcpp20 - MultiThreaded - MaxSpeed - true - - - Console - true - true - true - libultraship.lib;ZAPDUtils.lib;opengl32.lib;glu32.lib;SDL2.lib;SDL2main.lib;glew32s.lib;winmm.lib;imm32.lib;version.lib;setupapi.lib;%(AdditionalDependencies) - /FORCE:MULTIPLE %(AdditionalOptions) - - - - - TurnOffAllWarnings - false - _DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;ENABLE_DX11;%(PreprocessorDefinitions) - true - stdcpp20 - MultiThreadedDebug - true - Default - - - Console - true - libultraship.lib;ZAPDUtils.lib;opengl32.lib;glu32.lib;SDL2.lib;SDL2main.lib;glew32s.lib;winmm.lib;imm32.lib;version.lib;setupapi.lib;%(AdditionalDependencies) - - - - - - - TurnOffAllWarnings - true - true - false - INCLUDE_GAME_PRINTF;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)GLEW_STATIC - true - true - stdcpp20 - MultiThreaded - - - Console - true - true - true - libultraship.lib;ZAPDUtils.lib;opengl32.lib;glu32.lib;SDL2.lib;SDL2main.lib;glew32s.lib;winmm.lib;imm32.lib;version.lib;setupapi.lib;%(AdditionalDependencies) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/soh/soh.vcxproj.filters b/soh/soh.vcxproj.filters deleted file mode 100644 index 9d30da69d..000000000 --- a/soh/soh.vcxproj.filters +++ /dev/null @@ -1,4106 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - {8d479b58-9306-40c3-9728-2cf5b185f5c4} - - - {8ebc52ba-5b1d-4bb3-9848-ba9ea57fc49f} - - - {54c2fe99-a68e-4ce2-813d-bce0ab1ac24f} - - - {0b91ecc8-6f20-4da1-87ca-6c7263aab3db} - - - {2104d3ab-707c-4ab2-bb1a-5cdce5c3d07d} - - - {022552c8-3bb8-4ba5-904c-e2c3eb28ce10} - - - {3ab8c311-cbfb-4eca-88af-2446ce3c89b0} - - - {8f2da1b8-973e-4be0-a036-c79a63bc3067} - - - {1a584bc2-7081-4251-a953-cdc7b611d62b} - - - {49bb84e4-a0b9-4733-9720-1ea120795083} - - - {d4794b4c-ae5d-4bf0-96f4-077f03807f5e} - - - {981df102-b362-4e2b-8efc-62756c28aa60} - - - {f8b2165f-9b32-4be1-a285-49349e09bef5} - - - {fcaae731-4e17-448b-b6c7-36e4c8413838} - - - {264ed8f8-f42b-475f-82ca-c264225ef56c} - - - {5fde6633-a728-4eea-a616-59d413bec476} - - - {3aeae6ac-1340-4a7b-bf34-cd196667fe37} - - - {fe745190-d4ec-4dc3-a9fd-ea553a971b14} - - - {06ba0ec4-2ee7-4454-93b5-5fd804723b6d} - - - {ffe200b9-a955-4843-a1ce-3603c132e591} - - - {18b9727f-30de-4ab8-a317-916090d4a110} - - - {9a4378ec-e30f-47b6-9ad6-5ce738b4cf99} - - - {04fc1c52-49ff-48e2-ae23-2c00867374f8} - - - {fd63976d-64b1-45ee-b3ab-530c636391c3} - - - {ff94f63c-a792-49af-869b-42557318a32b} - - - {1ba82a8d-b7d9-4f79-b80b-389322e189bc} - - - {9e20d69b-6a26-48ef-9aae-09c149b2c459} - - - {d7b4c12f-3876-40ec-a8ec-db435513156c} - - - {38ae4e39-fade-4f81-bfdb-af83bf641df0} - - - {8f355b3b-15ba-4e0a-be8b-2a6ec0ff4ec7} - - - {34b196e2-95d6-49b1-822d-0297d8114050} - - - - - Source Files\src\boot - - - Source Files\src\boot - - - Source Files\src\boot - - - Source Files\src\boot - - - Source Files\src\boot - - - Source Files\src\boot - - - Source Files\src\boot - - - Source Files\src\boot - - - Source Files\src\boot - - - Source Files\src\boot - - - Source Files\src\boot - - - Source Files\src\boot - - - Source Files\src\buffers - - - Source Files\src\buffers - - - Source Files\src\buffers - - - Source Files\src\overlays\effects - - - Source Files\src\overlays\effects - - - Source Files\src\overlays\effects - - - Source Files\src\overlays\effects - - - Source Files\src\overlays\effects - - - Source Files\src\overlays\effects - - - Source Files\src\overlays\effects - - - Source Files\src\overlays\effects - - - Source Files\src\overlays\effects - - - Source Files\src\overlays\effects - - - Source Files\src\overlays\effects - - - Source Files\src\overlays\effects - - - Source Files\src\overlays\effects - - - Source Files\src\overlays\effects - - - Source Files\src\overlays\effects - - - Source Files\src\overlays\effects - - - Source Files\src\overlays\effects - - - Source Files\src\overlays\effects - - - Source Files\src\overlays\effects - - - Source Files\src\overlays\effects - - - Source Files\src\overlays\effects - - - Source Files\src\overlays\effects - - - Source Files\src\overlays\effects - - - Source Files\src\overlays\effects - - - Source Files\src\overlays\effects - - - Source Files\src\overlays\effects - - - Source Files\src\overlays\effects - - - Source Files\src\overlays\effects - - - Source Files\src\overlays\effects - - - Source Files\src\overlays\effects - - - Source Files\src\overlays\effects - - - Source Files\src\overlays\effects - - - Source Files\src\overlays\effects - - - Source Files\src\overlays\effects - - - Source Files\src\overlays\effects - - - Source Files\src\overlays\effects - - - Source Files\src\overlays\gamestates\ovl_title - - - Source Files\src\overlays\gamestates\ovl_select - - - Source Files\src\overlays\gamestates\ovl_opening - - - Source Files\src\overlays\gamestates\ovl_file_choose - - - Source Files\src\overlays\gamestates\ovl_file_choose - - - Source Files\soh - - - Source Files\soh - - - Source Files\soh - - - Source Files\soh - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\libultra - - - Source Files\src\libultra - - - Source Files\src\libultra - - - Source Files\src\libultra - - - Source Files\src\libultra - - - Source Files\src\libultra - - - Source Files\src\libultra - - - Source Files\src\libultra - - - Source Files\src\libultra - - - Source Files\src\libultra - - - Source Files\src\libultra - - - Source Files\src\overlays\misc\ovl_kaleido_scope - - - Source Files\src\overlays\misc\ovl_kaleido_scope - - - Source Files\src\overlays\misc\ovl_kaleido_scope - - - Source Files\src\overlays\misc\ovl_kaleido_scope - - - Source Files\src\overlays\misc\ovl_kaleido_scope - - - Source Files\src\overlays\misc\ovl_kaleido_scope - - - Source Files\src\overlays\misc\ovl_kaleido_scope - - - Source Files\src\overlays\misc\ovl_kaleido_scope - - - Source Files\src\overlays\misc\ovl_kaleido_scope - - - Source Files\src\overlays\gamestates\ovl_file_choose - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\code - - - Source Files\src\overlays\gamestates\ovl_file_choose - - - Source Files\src\overlays\misc\ovl_map_mark_data - - - Source Files\soh - - - Source Files\soh\Enhancements - - - Source Files\soh\Enhancements - - - Source Files\soh\Enhancements - - - Source Files\soh - - - Source Files\soh - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\soh\Enhancements\debugger - - - Source Files\soh\Enhancements\debugger - - - Source Files\soh - - - Source Files\soh\Enhancements\debugger - - - Source Files\soh\Enhancements\debugger - - - Source Files\soh\Enhancements\debugger - - - Source Files\soh - - - Source Files - - - Source Files\soh\Enhancements - - - Source Files\soh - - - Header Files\include - - - Source Files\soh\Enhancements\randomizer\3drando\hint_list - - - Source Files\soh\Enhancements\randomizer\3drando\hint_list - - - Source Files\soh\Enhancements\randomizer\3drando\hint_list - - - Source Files\soh\Enhancements\randomizer\3drando\location_access - - - Source Files\soh\Enhancements\randomizer\3drando\location_access - - - Source Files\soh\Enhancements\randomizer\3drando\location_access - - - Source Files\soh\Enhancements\randomizer\3drando\location_access - - - Source Files\soh\Enhancements\randomizer\3drando\location_access - - - Source Files\soh\Enhancements\randomizer\3drando\location_access - - - Source Files\soh\Enhancements\randomizer\3drando\location_access - - - Source Files\soh\Enhancements\randomizer\3drando\location_access - - - Source Files\soh\Enhancements\randomizer\3drando\location_access - - - Source Files\soh\Enhancements\randomizer\3drando\location_access - - - Source Files\soh\Enhancements\randomizer\3drando\location_access - - - Source Files\soh\Enhancements\randomizer\3drando\location_access - - - Source Files\soh\Enhancements\randomizer\3drando\location_access - - - Source Files\soh\Enhancements\randomizer\3drando\location_access - - - Source Files\soh\Enhancements\randomizer\3drando\location_access - - - Source Files\soh\Enhancements\randomizer\3drando\location_access - - - Source Files\soh\Enhancements\randomizer\3drando\location_access - - - Source Files\soh\Enhancements\randomizer\3drando\location_access - - - Source Files\soh\Enhancements\randomizer\3drando\location_access - - - Source Files\soh\Enhancements\randomizer\3drando - - - Source Files\soh\Enhancements\randomizer\3drando - - - Source Files\soh\Enhancements\randomizer\3drando - - - Source Files\soh\Enhancements\randomizer\3drando - - - Source Files\soh\Enhancements\randomizer\3drando - - - Source Files\soh\Enhancements\randomizer\3drando - - - Source Files\soh\Enhancements\randomizer\3drando - - - Source Files\soh\Enhancements\randomizer\3drando - - - Source Files\soh\Enhancements\randomizer\3drando - - - Source Files\soh\Enhancements\randomizer\3drando - - - Source Files\soh\Enhancements\randomizer\3drando - - - Source Files\soh\Enhancements\randomizer\3drando - - - Source Files\soh\Enhancements\randomizer\3drando - - - Source Files\soh\Enhancements\randomizer\3drando - - - Source Files\soh\Enhancements\randomizer\3drando - - - Source Files\soh\Enhancements\randomizer\3drando - - - Source Files\soh\Enhancements\randomizer\3drando - - - Source Files\soh\Enhancements\randomizer\3drando - - - Source Files\soh\Enhancements\randomizer\3drando - - - Source Files\soh\Enhancements\randomizer\3drando - - - Source Files\soh\Enhancements\randomizer\3drando - - - Source Files\soh\Enhancements\randomizer\3drando - - - Source Files\soh\Enhancements\randomizer\3drando - - - Source Files\soh\Enhancements\randomizer\3drando - - - Source Files\soh\Enhancements\randomizer\3drando - - - Source Files\soh\Enhancements\randomizer\3drando - - - Source Files\soh\Enhancements\randomizer\3drando - - - Source Files\soh\Enhancements\randomizer\3drando - - - Source Files\soh\Enhancements\randomizer\3drando - - - Source Files\soh\Enhancements\randomizer\3drando - - - Source Files\soh\Enhancements\randomizer - - - Header Files\soh\Enhancements\randomizer - - - Header Files\soh\Enhancements - - - Source Files\soh\Enhancements\randomizer - - - Source Files\soh\Enhancements\custom-message - - - - - Source Files\src\overlays\misc\ovl_kaleido_scope - - - Header Files\include - - - Header Files\include - - - Header Files\include - - - Header Files\include - - - Header Files\include - - - Header Files\include - - - Header Files\include - - - Header Files\include - - - Header Files\include - - - Header Files\include - - - Header Files\include - - - Header Files\include - - - Header Files\include - - - Header Files\include - - - Header Files\include - - - Header Files\include - - - Header Files\include - - - Header Files\include - - - Header Files\include - - - Header Files\include - - - Header Files\include - - - Header Files\include - - - Header Files\include - - - Header Files\include - - - Header Files\include - - - Header Files\include - - - Header Files\include - - - Header Files\include - - - Header Files\include - - - Header Files\include - - - Header Files\include - - - Header Files\include - - - Header Files\include - - - Header Files\include - - - Header Files\include - - - Header Files\include - - - Header Files\include - - - Header Files\include - - - Header Files\include - - - Header Files\include - - - Header Files\include - - - Source Files\src\overlays\effects - - - Source Files\src\overlays\effects - - - Source Files\src\overlays\effects - - - Source Files\src\overlays\effects - - - Source Files\src\overlays\effects - - - Source Files\src\overlays\effects - - - Source Files\src\overlays\effects - - - Source Files\src\overlays\effects - - - Source Files\src\overlays\effects - - - Source Files\src\overlays\effects - - - Source Files\src\overlays\effects - - - Source Files\src\overlays\effects - - - Source Files\src\overlays\effects - - - Source Files\src\overlays\effects - - - Source Files\src\overlays\effects - - - Source Files\src\overlays\effects - - - Source Files\src\overlays\effects - - - Source Files\src\overlays\effects - - - Source Files\src\overlays\effects - - - Source Files\src\overlays\effects - - - Source Files\src\overlays\effects - - - Source Files\src\overlays\effects - - - Source Files\src\overlays\effects - - - Source Files\src\overlays\effects - - - Source Files\src\overlays\effects - - - Source Files\src\overlays\effects - - - Source Files\src\overlays\effects - - - Source Files\src\overlays\effects - - - Source Files\src\overlays\effects - - - Source Files\src\overlays\effects - - - Source Files\src\overlays\effects - - - Source Files\src\overlays\effects - - - Source Files\src\overlays\effects - - - Source Files\src\overlays\effects - - - Source Files\src\overlays\effects - - - Source Files\src\overlays\effects - - - Header Files\include - - - Source Files\soh - - - Source Files\src\overlays\misc\ovl_kaleido_scope - - - Header Files\soh\Enhancements - - - Header Files\soh\Enhancements - - - Header Files\soh\Enhancements - - - Header Files\soh\Enhancements - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Source Files\src\overlays\actors - - - Header Files - - - Header Files\soh\Enhancements\debugger - - - Header Files\soh\Enhancements\debugger - - - Header Files\soh - - - Header Files\soh\Enhancements\debugger - - - Header Files\soh\Enhancements\debugger - - - Header Files\soh\Enhancements\debugger - - - Header Files\soh - - - Source Files\soh\Enhancements - - - Source Files\soh - - - Source Files\soh - - - Header Files\include - - - Header Files\soh\Enhancements\randomizer\3drando - - - Header Files\soh\Enhancements\randomizer\3drando - - - Header Files\soh\Enhancements\randomizer\3drando - - - Header Files\soh\Enhancements\randomizer\3drando - - - Header Files\soh\Enhancements\randomizer\3drando - - - Header Files\soh\Enhancements\randomizer\3drando - - - Header Files\soh\Enhancements\randomizer\3drando - - - Header Files\soh\Enhancements\randomizer\3drando - - - Header Files\soh\Enhancements\randomizer\3drando - - - Header Files\soh\Enhancements\randomizer\3drando - - - Header Files\soh\Enhancements\randomizer\3drando - - - Header Files\soh\Enhancements\randomizer\3drando - - - Header Files\soh\Enhancements\randomizer\3drando - - - Header Files\soh\Enhancements\randomizer\3drando - - - Header Files\soh\Enhancements\randomizer\3drando - - - Header Files\soh\Enhancements\randomizer\3drando - - - Header Files\soh\Enhancements\randomizer\3drando - - - Header Files\soh\Enhancements\randomizer\3drando - - - Header Files\soh\Enhancements\randomizer\3drando - - - Header Files\soh\Enhancements\randomizer\3drando - - - Header Files\soh\Enhancements\randomizer\3drando - - - Header Files\soh\Enhancements\randomizer\3drando - - - Header Files\soh\Enhancements\randomizer\3drando - - - Header Files\soh\Enhancements\randomizer\3drando - - - Header Files\soh\Enhancements\randomizer\3drando - - - Header Files\soh\Enhancements\randomizer\3drando - - - Header Files\soh\Enhancements\randomizer\3drando - - - Header Files\soh\Enhancements\randomizer\3drando - - - Header Files\soh\Enhancements\randomizer\3drando - - - Header Files\soh\Enhancements\randomizer\3drando - - - Header Files\soh\Enhancements\randomizer\3drando - - - Header Files\soh\Enhancements\randomizer\3drando - - - Header Files\soh\Enhancements\randomizer\3drando - - - Header Files\soh\Enhancements\randomizer\3drando - - - Header Files\soh\Enhancements\randomizer\3drando - - - Header Files\soh\Enhancements\randomizer - - - Header Files\soh\Enhancements - - - Header Files\soh\Enhancements\randomizer - - - Header Files\soh\Enhancements\custom-message - - - Source Files\soh\Enhancements\custom-message - - - - - - - - Resource Files - - - - - - \ No newline at end of file diff --git a/soh/soh.vcxproj.user b/soh/soh.vcxproj.user deleted file mode 100644 index 057370db2..000000000 --- a/soh/soh.vcxproj.user +++ /dev/null @@ -1,26 +0,0 @@ - - - - $(TargetDir) - WindowsLocalDebugger - - - - - $(TargetDir) - WindowsLocalDebugger - - - - - $(TargetDir) - WindowsLocalDebugger - - - false - - - $(TargetDir) - WindowsLocalDebugger - - \ No newline at end of file diff --git a/soh/soh/Enhancements/cosmetics/CosmeticsEditor.cpp b/soh/soh/Enhancements/cosmetics/CosmeticsEditor.cpp index 3b1ccb4c0..c565ce52b 100644 --- a/soh/soh/Enhancements/cosmetics/CosmeticsEditor.cpp +++ b/soh/soh/Enhancements/cosmetics/CosmeticsEditor.cpp @@ -1,11 +1,6 @@ #include "CosmeticsEditor.h" -#include "../../util.h" #include "../libultraship/ImGuiImpl.h" -#include "GameSettings.h" -#include -#include -#include #include #include #include diff --git a/soh/soh/Enhancements/debugconsole.cpp b/soh/soh/Enhancements/debugconsole.cpp index 73c54b742..b50c8c9d6 100644 --- a/soh/soh/Enhancements/debugconsole.cpp +++ b/soh/soh/Enhancements/debugconsole.cpp @@ -14,7 +14,6 @@ #define Path _Path #define PATH_HACK #include -#include #include "Window.h" #include "Lib/ImGui/imgui_internal.h" @@ -426,7 +425,7 @@ static bool SetCVarHandler(const std::vector& args) { else CVar_SetS32(args[1].c_str(), std::stoi(args[2])); - DebugConsole_SaveCVars(); + CVar_Save(); //INFO("[SOH] Updated player position to [ %.2f, %.2f, %.2f ]", pos.x, pos.y, pos.z); return CMD_SUCCESS; @@ -463,168 +462,49 @@ void DebugConsole_Init(void) { CMD_REGISTER("kill", { KillPlayerHandler, "Commit suicide." }); CMD_REGISTER("map", { LoadSceneHandler, "Load up kak?" }); CMD_REGISTER("rupee", { RuppeHandler, "Set your rupee counter.", { - {"amount", ArgumentType::NUMBER } + {"amount", Ship::ArgumentType::NUMBER } }}); - CMD_REGISTER("bItem", { BHandler, "Set an item to the B button.", { { "Item ID", ArgumentType::NUMBER } } }); - CMD_REGISTER("health", { SetPlayerHealthHandler, "Set the health of the player.", { - {"health", ArgumentType::NUMBER } + CMD_REGISTER("bItem", { BHandler, "Set an item to the B button.", { { "Item ID", Ship::ArgumentType::NUMBER } } }); + CMD_REGISTER("health", { SetPlayerHealthHandler, "Set the health of the player.", { { "health", Ship::ArgumentType::NUMBER } }}); - CMD_REGISTER("spawn", { ActorSpawnHandler, "Spawn an actor.", { - { "actor_id", ArgumentType::NUMBER }, - { "data", ArgumentType::NUMBER }, - { "x", ArgumentType::PLAYER_POS, true }, - { "y", ArgumentType::PLAYER_POS, true }, - { "z", ArgumentType::PLAYER_POS, true }, - { "rx", ArgumentType::PLAYER_ROT, true }, - { "ry", ArgumentType::PLAYER_ROT, true }, - { "rz", ArgumentType::PLAYER_ROT, true } + CMD_REGISTER("spawn", { ActorSpawnHandler, "Spawn an actor.", { { "actor_id", Ship::ArgumentType::NUMBER }, + { "data", Ship::ArgumentType::NUMBER }, + { "x", Ship::ArgumentType::PLAYER_POS, true }, + { "y", Ship::ArgumentType::PLAYER_POS, true }, + { "z", Ship::ArgumentType::PLAYER_POS, true }, + { "rx", Ship::ArgumentType::PLAYER_ROT, true }, + { "ry", Ship::ArgumentType::PLAYER_ROT, true }, + { "rz", Ship::ArgumentType::PLAYER_ROT, true } }}); - CMD_REGISTER("pos", { SetPosHandler, "Sets the position of the player.", { - { "x", ArgumentType::PLAYER_POS, true }, - { "y", ArgumentType::PLAYER_POS, true }, - { "z", ArgumentType::PLAYER_POS, true } + CMD_REGISTER("pos", { SetPosHandler, "Sets the position of the player.", { { "x", Ship::ArgumentType::PLAYER_POS, true }, + { "y", Ship::ArgumentType::PLAYER_POS, true }, + { "z", Ship::ArgumentType::PLAYER_POS, true } }}); CMD_REGISTER("set", { SetCVarHandler, "Sets a console variable.", - { { "varName", ArgumentType::TEXT }, { "varValue", ArgumentType::TEXT } } }); - CMD_REGISTER("get", { GetCVarHandler, "Gets a console variable.", { { "varName", ArgumentType::TEXT } } }); + { { "varName", Ship::ArgumentType::TEXT }, { "varValue", Ship::ArgumentType::TEXT } } }); + CMD_REGISTER("get", { GetCVarHandler, "Gets a console variable.", { { "varName", Ship::ArgumentType::TEXT } } }); CMD_REGISTER("reset", { ResetHandler, "Resets the game." }); CMD_REGISTER("ammo", { AmmoHandler, "Changes ammo of an item.", - { { "item", ArgumentType::TEXT }, - { "count", ArgumentType::NUMBER } } }); + { { "item", Ship::ArgumentType::TEXT }, { "count", Ship::ArgumentType::NUMBER } } }); CMD_REGISTER("bottle", { BottleHandler, "Changes item in a bottle slot.", - { { "item", ArgumentType::TEXT }, { "slot", ArgumentType::NUMBER } } }); + { { "item", Ship::ArgumentType::TEXT }, { "slot", Ship::ArgumentType::NUMBER } } }); CMD_REGISTER("item", { ItemHandler, "Sets item ID in arg 1 into slot arg 2. No boundary checks. Use with caution.", - { { "slot", ArgumentType::NUMBER }, { "item id", ArgumentType::NUMBER } } }); - CMD_REGISTER("entrance", - { EntranceHandler, "Sends player to the entered entrance (hex)", { { "entrance", ArgumentType::NUMBER } } }); + { { "slot", Ship::ArgumentType::NUMBER }, { "item id", Ship::ArgumentType::NUMBER } } }); + CMD_REGISTER("entrance", { EntranceHandler, + "Sends player to the entered entrance (hex)", + { { "entrance", Ship::ArgumentType::NUMBER } } }); CMD_REGISTER("save_state", { SaveStateHandler, "Save a state." }); CMD_REGISTER("load_state", { LoadStateHandler, "Load a state." }); - CMD_REGISTER("set_slot", { StateSlotSelectHandler, "Selects a SaveState slot", { - { "Slot number", ArgumentType::NUMBER, } + CMD_REGISTER("set_slot", { StateSlotSelectHandler, "Selects a SaveState slot", { { + "Slot number", + Ship::ArgumentType::NUMBER, + } } }); - DebugConsole_LoadCVars(); -} - -template bool is_number(const std::string& s) { - Numeric n; - return ((std::istringstream(s) >> n >> std::ws).eof()); -} - -void DebugConsole_LoadLegacyCVars() { - auto cvarsConfig = Ship::GlobalCtx2::GetPathRelativeToAppDirectory("cvars.cfg"); - if (File::Exists(cvarsConfig)) { - const auto lines = File::ReadAllLines(cvarsConfig); - - for (const std::string& line : lines) { - std::vector cfg = StringHelper::Split(line, " = "); - if (line.empty()) continue; - if (cfg.size() < 2) continue; - - if (cfg[1].find("\"") == std::string::npos && (cfg[1].find("#") != std::string::npos)) - { - std::string value(cfg[1]); - value.erase(std::remove_if(value.begin(), value.end(), [](char c) { return c == '#'; }), value.end()); - auto splitTest = StringHelper::Split(value, "\r")[0]; - - uint32_t val = std::stoul(splitTest, nullptr, 16); - Color_RGBA8 clr; - clr.r = val >> 24; - clr.g = val >> 16; - clr.b = val >> 8; - clr.a = val & 0xFF; - CVar_SetRGBA(cfg[0].c_str(), clr); - } - - if (cfg[1].find("\"") != std::string::npos) { - std::string value(cfg[1]); - value.erase(std::remove(value.begin(), value.end(), '\"'), value.end()); - CVar_SetString(cfg[0].c_str(), ImStrdup(value.c_str())); - } - if (is_number(cfg[1])) { - CVar_SetFloat(cfg[0].c_str(), std::stof(cfg[1])); - } - if (is_number(cfg[1])) { - CVar_SetS32(cfg[0].c_str(), std::stoi(cfg[1])); - } - } - - fs::remove(cvarsConfig); - } -} - -void DebugConsole_LoadCVars() { - - std::shared_ptr pConf = Ship::GlobalCtx2::GetInstance()->GetConfig(); - pConf->reload(); - - for (const auto& item : pConf->rjson["CVars"].items()) { - auto value = item.value(); - switch (value.type()) { - case nlohmann::detail::value_t::array: - break; - case nlohmann::detail::value_t::object: - if (value["Type"].get() == mercuryRGBAObjectType) { - Color_RGBA8 clr; - clr.r = value["R"].get(); - clr.g = value["G"].get(); - clr.b = value["B"].get(); - clr.a = value["A"].get(); - } - - break; - case nlohmann::detail::value_t::string: - CVar_SetString(item.key().c_str(), value.get().c_str()); - break; - case nlohmann::detail::value_t::boolean: - CVar_SetS32(item.key().c_str(), value.get()); - break; - case nlohmann::detail::value_t::number_unsigned: - case nlohmann::detail::value_t::number_integer: - CVar_SetS32(item.key().c_str(), value.get()); - break; - case nlohmann::detail::value_t::number_float: - CVar_SetFloat(item.key().c_str(), value.get()); - break; - default: ; - } - if (item.key() == "gOpenMenuBar") { - int bp = 0; - } - } - - DebugConsole_LoadLegacyCVars(); -} - -void DebugConsole_SaveCVars() -{ - std::shared_ptr pConf = Ship::GlobalCtx2::GetInstance()->GetConfig(); - - for (const auto &cvar : cvars) { - const std::string key = StringHelper::Sprintf("CVars.%s", cvar.first.c_str()); - - if (cvar.second->type == CVarType::String && cvar.second->value.valueStr != nullptr) - pConf->setString(key, std::string(cvar.second->value.valueStr)); - else if (cvar.second->type == CVarType::S32) - pConf->setInt(key, cvar.second->value.valueS32); - else if (cvar.second->type == CVarType::Float) - pConf->setFloat(key, cvar.second->value.valueFloat); - else if (cvar.second->type == CVarType::RGBA) - { - auto keyStr = key.c_str(); - Color_RGBA8 clr = cvar.second->value.valueRGBA; - pConf->setUInt(StringHelper::Sprintf("%s.R", keyStr), clr.r); - pConf->setUInt(StringHelper::Sprintf("%s.G", keyStr), clr.r); - pConf->setUInt(StringHelper::Sprintf("%s.B", keyStr), clr.r); - pConf->setUInt(StringHelper::Sprintf("%s.A", keyStr), clr.r); - pConf->setString(StringHelper::Sprintf("%s.Type", keyStr), mercuryRGBAObjectType); - } - } - - pConf->save(); + CVar_Load(); } diff --git a/soh/soh/Enhancements/debugconsole.h b/soh/soh/Enhancements/debugconsole.h index 581c19acd..ffd0cb0cb 100644 --- a/soh/soh/Enhancements/debugconsole.h +++ b/soh/soh/Enhancements/debugconsole.h @@ -1,5 +1,3 @@ #pragma once void DebugConsole_Init(void); -void DebugConsole_LoadCVars(); -void DebugConsole_SaveCVars(); \ No newline at end of file diff --git a/soh/soh/Enhancements/randomizer/3drando/rando_main.cpp b/soh/soh/Enhancements/randomizer/3drando/rando_main.cpp index 8f46310cf..5fb1b34c5 100644 --- a/soh/soh/Enhancements/randomizer/3drando/rando_main.cpp +++ b/soh/soh/Enhancements/randomizer/3drando/rando_main.cpp @@ -6,7 +6,6 @@ #include "rando_main.hpp" // #include #include -#include #define NOGDI #define WIN32_LEAN_AND_MEAN #include @@ -25,7 +24,7 @@ void RandoMain::GenerateRando(std::unordered_map cvarS std::string fileName = Ship::GlobalCtx2::GetPathRelativeToAppDirectory(GenerateRandomizer(cvarSettings).c_str()); CVar_SetString("gSpoilerLog", fileName.c_str()); - Game::SaveSettings(); - Game::LoadSettings(); + CVar_Save(); + CVar_Load(); CVar_SetS32("gNewSeedGenerated", 1); } \ No newline at end of file diff --git a/soh/soh/Enhancements/randomizer/randomizer.cpp b/soh/soh/Enhancements/randomizer/randomizer.cpp index 396223e28..18e73c230 100644 --- a/soh/soh/Enhancements/randomizer/randomizer.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer.cpp @@ -8,7 +8,6 @@ #include #include #include -#include #include "../libultraship/ImGuiImpl.h" #include #include "3drando/rando_main.hpp" @@ -3168,7 +3167,7 @@ std::thread randoThread; void GenerateRandomizerImgui() { CVar_SetS32("gRandoGenerating", 1); - Game::SaveSettings(); + CVar_Save(); std::unordered_map cvarSettings; cvarSettings[RSK_FOREST] = CVar_GetS32("gRandomizeForest", 1); @@ -3234,9 +3233,8 @@ void GenerateRandomizerImgui() { RandoMain::GenerateRando(cvarSettings); CVar_SetS32("gRandoGenerating", 0); - Game::SaveSettings(); - - Game::LoadSettings(); + CVar_Save(); + CVar_Load(); generated = 1; } diff --git a/soh/soh/OTRAudio.h b/soh/soh/OTRAudio.h index ee0ec46a2..a452fdb29 100644 --- a/soh/soh/OTRAudio.h +++ b/soh/soh/OTRAudio.h @@ -1,8 +1,9 @@ #pragma once static struct { + std::thread thread; std::condition_variable cv_to_thread, cv_from_thread; std::mutex mutex; - bool initialized; + bool running; bool processing; } audio; diff --git a/soh/soh/OTRGlobals.cpp b/soh/soh/OTRGlobals.cpp index 18fc2226a..6470a49b3 100644 --- a/soh/soh/OTRGlobals.cpp +++ b/soh/soh/OTRGlobals.cpp @@ -4,9 +4,7 @@ #include #include #include -#include #include "GlobalCtx2.h" -#include "GameSettings.h" #include "ResourceMgr.h" #include "DisplayList.h" #include "PlayerAnimation.h" @@ -22,11 +20,9 @@ #else #include #endif -#include #include #include #include -#include #include "Lib/stb/stb_image.h" #define DRMP3_IMPLEMENTATION #include "Lib/dr_libs/mp3.h" @@ -39,10 +35,10 @@ #include #include "Enhancements/n64_weird_frame_data.inc" #include "soh/frame_interpolation.h" -#include "Utils/BitConverter.h" #include "variables.h" #include "macros.h" #include +#include "Hooks.h" #include #ifdef __APPLE__ @@ -90,11 +86,73 @@ extern "C" void ResourceMgr_CacheDirectory(const char* resName); extern "C" SequenceData ResourceMgr_LoadSeqByName(const char* path); std::unordered_map ExtensionCache; +void OTRAudio_Thread() { + while (audio.running) { + { + std::unique_lock Lock(audio.mutex); + while (!audio.processing && audio.running) { + audio.cv_to_thread.wait(Lock); + } + + if (!audio.running) { + break; + } + } + std::unique_lock Lock(audio.mutex); + //AudioMgr_ThreadEntry(&gAudioMgr); + // 528 and 544 relate to 60 fps at 32 kHz 32000/60 = 533.333.. + // in an ideal world, one third of the calls should use num_samples=544 and two thirds num_samples=528 + //#define SAMPLES_HIGH 560 + //#define SAMPLES_LOW 528 + // PAL values + //#define SAMPLES_HIGH 656 + //#define SAMPLES_LOW 624 + + // 44KHZ values + #define SAMPLES_HIGH 752 + #define SAMPLES_LOW 720 + + #define AUDIO_FRAMES_PER_UPDATE (R_UPDATE_RATE > 0 ? R_UPDATE_RATE : 1 ) + #define NUM_AUDIO_CHANNELS 2 + + int samples_left = AudioPlayer_Buffered(); + u32 num_audio_samples = samples_left < AudioPlayer_GetDesiredBuffered() ? SAMPLES_HIGH : SAMPLES_LOW; + + // 3 is the maximum authentic frame divisor. + s16 audio_buffer[SAMPLES_HIGH * NUM_AUDIO_CHANNELS * 3]; + for (int i = 0; i < AUDIO_FRAMES_PER_UPDATE; i++) { + AudioMgr_CreateNextAudioBuffer(audio_buffer + i * (num_audio_samples * NUM_AUDIO_CHANNELS), num_audio_samples); + } + + AudioPlayer_Play((u8*)audio_buffer, num_audio_samples * (sizeof(int16_t) * NUM_AUDIO_CHANNELS * AUDIO_FRAMES_PER_UPDATE)); + + audio.processing = false; + audio.cv_from_thread.notify_one(); + } +} + // C->C++ Bridge extern "C" void OTRAudio_Init() { // Precache all our samples, sequences, etc... ResourceMgr_CacheDirectory("audio"); + + if (!audio.running) { + audio.running = true; + audio.thread = std::thread(OTRAudio_Thread); + } +} + +extern "C" void OTRAudio_Exit() { + // Tell the audio thread to stop + { + std::unique_lock Lock(audio.mutex); + audio.running = false; + } + audio.cv_to_thread.notify_all(); + + // Wait until the audio thread quit + audio.thread.join(); } extern "C" void OTRExtScanner() { @@ -136,6 +194,10 @@ extern "C" void InitOTR() { OTRExtScanner(); } +extern "C" void DeinitOTR() { + OTRAudio_Exit(); +} + #ifdef _WIN32 extern "C" uint64_t GetFrequency() { LARGE_INTEGER nFreq; @@ -235,56 +297,10 @@ extern "C" void Graph_StartFrame() { // C->C++ Bridge extern "C" void Graph_ProcessGfxCommands(Gfx* commands) { -#ifndef __SWITCH__ - if (!audio.initialized) { - audio.initialized = true; - std::thread([]() { - for (;;) { - { - std::unique_lock Lock(audio.mutex); - while (!audio.processing) { - audio.cv_to_thread.wait(Lock); - } - } - std::unique_lock Lock(audio.mutex); - //AudioMgr_ThreadEntry(&gAudioMgr); - // 528 and 544 relate to 60 fps at 32 kHz 32000/60 = 533.333.. - // in an ideal world, one third of the calls should use num_samples=544 and two thirds num_samples=528 - //#define SAMPLES_HIGH 560 - //#define SAMPLES_LOW 528 - // PAL values - //#define SAMPLES_HIGH 656 - //#define SAMPLES_LOW 624 - - // 44KHZ values - #define SAMPLES_HIGH 752 - #define SAMPLES_LOW 720 - - #define AUDIO_FRAMES_PER_UPDATE (R_UPDATE_RATE > 0 ? R_UPDATE_RATE : 1 ) - #define NUM_AUDIO_CHANNELS 2 - - int samples_left = AudioPlayer_Buffered(); - u32 num_audio_samples = samples_left < AudioPlayer_GetDesiredBuffered() ? SAMPLES_HIGH : SAMPLES_LOW; - - // 3 is the maximum authentic frame divisor. - s16 audio_buffer[SAMPLES_HIGH * NUM_AUDIO_CHANNELS * 3]; - for (int i = 0; i < AUDIO_FRAMES_PER_UPDATE; i++) { - AudioMgr_CreateNextAudioBuffer(audio_buffer + i * (num_audio_samples * NUM_AUDIO_CHANNELS), num_audio_samples); - } - - AudioPlayer_Play((u8*)audio_buffer, num_audio_samples * (sizeof(int16_t) * NUM_AUDIO_CHANNELS * AUDIO_FRAMES_PER_UPDATE)); - - audio.processing = false; - audio.cv_from_thread.notify_one(); - } - }).detach(); - } - { std::unique_lock Lock(audio.mutex); audio.processing = true; } -#endif audio.cv_to_thread.notify_one(); std::vector> mtx_replacements; @@ -327,14 +343,12 @@ extern "C" void Graph_ProcessGfxCommands(Gfx* commands) { last_fps = fps; last_update_rate = R_UPDATE_RATE; -#ifndef __SWITCH__ { std::unique_lock Lock(audio.mutex); while (audio.processing) { audio.cv_from_thread.wait(Lock); } } -#endif // OTRTODO: FIGURE OUT END FRAME POINT /* if (OTRGlobals::Instance->context->GetWindow()->lastScancode != -1) @@ -1310,10 +1324,11 @@ extern "C" uint32_t OTRGetCurrentHeight() { } extern "C" void OTRControllerCallback(ControllerCallback* controller) { - const auto controllers = Ship::Window::ControllerApi->virtualDevices; + auto controlDeck = Ship::GlobalCtx2::GetInstance()->GetWindow()->GetControlDeck(); - for (int i = 0; i < controllers.size(); ++i) { - Ship::Window::ControllerApi->physicalDevices[controllers[i]]->WriteToSource(i, controller); + for (int i = 0; i < controlDeck->GetNumVirtualDevices(); ++i) { + auto physicalDevice = controlDeck->GetPhysicalDeviceFromVirtualSlot(i); + physicalDevice->WriteToSource(i, controller); } } @@ -1367,11 +1382,11 @@ extern "C" void AudioPlayer_Play(const uint8_t* buf, uint32_t len) { } extern "C" int Controller_ShouldRumble(size_t i) { + auto controlDeck = Ship::GlobalCtx2::GetInstance()->GetWindow()->GetControlDeck(); - const auto controllers = Ship::Window::ControllerApi->virtualDevices; - - for (const auto virtual_entry : controllers) { - if (Ship::Window::ControllerApi->physicalDevices[virtual_entry]->CanRumble()) { + for (int i = 0; i < controlDeck->GetNumVirtualDevices(); ++i) { + auto physicalDevice = controlDeck->GetPhysicalDeviceFromVirtualSlot(i); + if (physicalDevice->CanRumble()) { return 1; } } @@ -1379,6 +1394,10 @@ extern "C" int Controller_ShouldRumble(size_t i) { return 0; } +extern "C" void Hooks_ExecuteAudioInit() { + Ship::ExecuteHooks(); +} + extern "C" void* getN64WeirdFrame(s32 i) { char* weirdFrameBytes = reinterpret_cast(n64WeirdFrames); return &weirdFrameBytes[i + sizeof(n64WeirdFrames)]; @@ -1459,6 +1478,11 @@ extern "C" s32 Randomizer_GetItemIdFromKnownCheck(RandomizerCheck randomizerChec return OTRGlobals::Instance->gRandomizer->GetRandomizedItemIdFromKnownCheck(randomizerCheck, ogId); } +extern "C" bool Randomizer_ObtainedFreestandingIceTrap(RandomizerCheck randomizerCheck, GetItemID ogId, Actor* actor) { + return gSaveContext.n64ddFlag && (actor->parent != NULL) && + Randomizer_GetItemIdFromKnownCheck(randomizerCheck, ogId) == GI_ICE_TRAP; +} + extern "C" bool Randomizer_ItemIsIceTrap(RandomizerCheck randomizerCheck, GetItemID ogId) { return gSaveContext.n64ddFlag && Randomizer_GetItemIdFromKnownCheck(randomizerCheck, ogId) == GI_ICE_TRAP; } diff --git a/soh/soh/OTRGlobals.h b/soh/soh/OTRGlobals.h index 929ba7c08..ae8f799b9 100644 --- a/soh/soh/OTRGlobals.h +++ b/soh/soh/OTRGlobals.h @@ -87,6 +87,7 @@ int AudioPlayer_GetDesiredBuffered(void); void AudioPlayer_Play(const uint8_t* buf, uint32_t len); void AudioMgr_CreateNextAudioBuffer(s16* samples, u32 num_samples); int Controller_ShouldRumble(size_t i); +void Hooks_ExecuteAudioInit(); void* getN64WeirdFrame(s32 i); Sprite* GetSeedTexture(uint8_t index); void Randomizer_LoadSettings(const char* spoilerFileName); @@ -98,6 +99,7 @@ s16 Randomizer_GetItemModelFromId(s16 itemId); s32 Randomizer_GetItemIDFromGetItemID(s32 getItemId); s32 Randomizer_GetRandomizedItemId(GetItemID ogId, s16 actorId, s16 actorParams, s16 sceneNum); s32 Randomizer_GetItemIdFromKnownCheck(RandomizerCheck randomizerCheck, GetItemID ogId); +bool Randomizer_ObtainedFreestandingIceTrap(RandomizerCheck randomizerCheck, GetItemID ogId, Actor* actor); bool Randomizer_ItemIsIceTrap(RandomizerCheck randomizerCheck, GetItemID ogId); int CustomMessage_RetrieveIfExists(GlobalContext* globalCtx); #endif diff --git a/soh/src/boot/build.c b/soh/src/boot/build.c index 84a73076d..f6b3a151f 100644 --- a/soh/src/boot/build.c +++ b/soh/src/boot/build.c @@ -1,4 +1,4 @@ -const char gBuildVersion[] = "RACHAEL ALFA (3.0.0)"; +const char gBuildVersion[] = "ZHORA ALFA (3.1.0)"; const char gBuildTeam[] = "github.com/harbourmasters"; const char gBuildDate[] = __DATE__ " " __TIME__; const char gBuildMakeOption[] = ""; diff --git a/soh/src/code/audioMgr.c b/soh/src/code/audioMgr.c index dc826aa5c..35c21ab95 100644 --- a/soh/src/code/audioMgr.c +++ b/soh/src/code/audioMgr.c @@ -1,6 +1,6 @@ #include "global.h" -#include "Hooks.h" #include +#include "soh/OTRGlobals.h" void func_800C3C80(AudioMgr* audioMgr) { AudioTask* task; @@ -108,7 +108,7 @@ void AudioMgr_Init(AudioMgr* audioMgr, void* stack, OSPri pri, OSId id, SchedCon AudioLoad_SetDmaHandler(DmaMgr_DmaHandler); Audio_InitSound(); osSendMesgPtr(&audioMgr->unk_C8, NULL, OS_MESG_BLOCK); - ModInternal_ExecuteAudioInitHooks(); + Hooks_ExecuteAudioInit(); // Removed due to crash //IrqMgr_AddClient(audioMgr->irqMgr, &irqClient, &audioMgr->unk_74); hasInitialized = true; diff --git a/soh/src/code/graph.c b/soh/src/code/graph.c index cf0a53c76..f4dcf56e8 100644 --- a/soh/src/code/graph.c +++ b/soh/src/code/graph.c @@ -481,22 +481,6 @@ static void RunFrame() uint64_t ticksA, ticksB; ticksA = GetPerfCounter(); -#ifdef __SWITCH__ - #define SAMPLES_HIGH 752 - #define SAMPLES_LOW 720 - - #define AUDIO_FRAMES_PER_UPDATE (R_UPDATE_RATE > 0 ? R_UPDATE_RATE : 1 ) - #define NUM_AUDIO_CHANNELS 2 - int samples_left = AudioPlayer_Buffered(); - u32 num_audio_samples = samples_left < AudioPlayer_GetDesiredBuffered() ? SAMPLES_HIGH : SAMPLES_LOW; - - s16 audio_buffer[SAMPLES_HIGH * NUM_AUDIO_CHANNELS * 3]; - for (int i = 0; i < AUDIO_FRAMES_PER_UPDATE; i++) { - AudioMgr_CreateNextAudioBuffer(audio_buffer + i * (num_audio_samples * NUM_AUDIO_CHANNELS), num_audio_samples); - } - - AudioPlayer_Play((u8*)audio_buffer, num_audio_samples * (sizeof(int16_t) * NUM_AUDIO_CHANNELS * AUDIO_FRAMES_PER_UPDATE)); -#endif Graph_StartFrame(); // TODO: Workaround for rumble being too long. Implement os thread functions. diff --git a/soh/src/code/main.c b/soh/src/code/main.c index fd02b016a..ccfdc2019 100644 --- a/soh/src/code/main.c +++ b/soh/src/code/main.c @@ -36,12 +36,14 @@ void Main_LogSystemHeap(void) { osSyncPrintf(VT_RST); } -void main(int argc, char** argv) +int main(int argc, char** argv) { GameConsole_Init(); InitOTR(); BootCommands_Init(); Main(0); + DeinitOTR(); + return 0; } void Main(void* arg) { diff --git a/soh/src/code/speed_meter.c b/soh/src/code/speed_meter.c index f645c7bb5..800eef0f0 100644 --- a/soh/src/code/speed_meter.c +++ b/soh/src/code/speed_meter.c @@ -55,13 +55,13 @@ void SpeedMeter_DrawTimeEntries(SpeedMeter* this, GraphicsContext* gfxCtx) { uly = this->y; lry = this->y + 2; - OPEN_DISPS(gfxCtx); - /*! @bug if gIrqMgrRetraceTime is 0, CLOSE_DISPS will never be reached */ if (gIrqMgrRetraceTime == 0) { return; } + OPEN_DISPS(gfxCtx); + sSpeedMeterTimeEntryPtr = &sSpeedMeterTimeEntryArray[0]; for (i = 0; i < ARRAY_COUNT(sSpeedMeterTimeEntryArray); i++) { temp = ((f64) * (sSpeedMeterTimeEntryPtr->time) / gIrqMgrRetraceTime) * 64.0; diff --git a/soh/src/code/z_actor.c b/soh/src/code/z_actor.c index fff93a560..b96978620 100644 --- a/soh/src/code/z_actor.c +++ b/soh/src/code/z_actor.c @@ -3957,6 +3957,8 @@ void Actor_DrawDoorLock(GlobalContext* globalCtx, s32 frame, s32 type) { f32 chainsTranslateX; f32 chainsTranslateY; f32 rotZStep; + static s32 epoch = 0; + epoch++; entry = &sDoorLocksInfo[type]; chainRotZ = entry->chainsRotZInit; @@ -3970,6 +3972,7 @@ void Actor_DrawDoorLock(GlobalContext* globalCtx, s32 frame, s32 type) { chainsTranslateY = cosf(entry->chainAngle - chainRotZ) * (10 - frame) * 0.1f * entry->chainLength; for (i = 0; i < 4; i++) { + FrameInterpolation_RecordOpenChild(entry, epoch + i * 25); Matrix_Put(&baseMtxF); Matrix_RotateZ(chainRotZ, MTXMODE_APPLY); Matrix_Translate(chainsTranslateX, chainsTranslateY, 0.0f, MTXMODE_APPLY); @@ -3989,6 +3992,7 @@ void Actor_DrawDoorLock(GlobalContext* globalCtx, s32 frame, s32 type) { } chainRotZ += rotZStep; + FrameInterpolation_RecordCloseChild(); } Matrix_Put(&baseMtxF); diff --git a/soh/src/code/z_eff_shield_particle.c b/soh/src/code/z_eff_shield_particle.c index a5d9ca53f..27032a632 100644 --- a/soh/src/code/z_eff_shield_particle.c +++ b/soh/src/code/z_eff_shield_particle.c @@ -47,6 +47,7 @@ void EffectShieldParticle_Init(void* thisx, void* initParamsx) { elem->endXChange = elem->initialSpeed; elem->yaw = Rand_ZeroOne() * 65534.0f; elem->pitch = Rand_ZeroOne() * 65534.0f; + elem->epoch++; } this->lightDecay = initParams->lightDecay; @@ -156,7 +157,6 @@ void EffectShieldParticle_Draw(void* thisx, GraphicsContext* gfxCtx) { Color_RGBA8 primColor; Color_RGBA8 envColor; - FrameInterpolation_RecordOpenChild(this, 0); OPEN_DISPS(gfxCtx); if (this != NULL) { @@ -182,6 +182,8 @@ void EffectShieldParticle_Draw(void* thisx, GraphicsContext* gfxCtx) { gDPPipeSync(POLY_XLU_DISP++); for (elem = &this->elements[0]; elem < &this->elements[this->numElements]; elem++) { + FrameInterpolation_RecordOpenChild(elem, elem->epoch); + Mtx* mtx; MtxF sp104; MtxF spC4; @@ -212,9 +214,10 @@ void EffectShieldParticle_Draw(void* thisx, GraphicsContext* gfxCtx) { gSPMatrix(POLY_XLU_DISP++, mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPVertex(POLY_XLU_DISP++, sVertices, 4, 0); gSP2Triangles(POLY_XLU_DISP++, 0, 1, 2, 0, 0, 3, 1, 0); + + FrameInterpolation_RecordCloseChild(); } } CLOSE_DISPS(gfxCtx); - FrameInterpolation_RecordCloseChild(); } diff --git a/soh/src/code/z_eff_spark.c b/soh/src/code/z_eff_spark.c index 445fd7fea..5ce627508 100644 --- a/soh/src/code/z_eff_spark.c +++ b/soh/src/code/z_eff_spark.c @@ -89,6 +89,7 @@ void EffectSpark_Init(void* thisx, void* initParamsx) { elem->unkPosition.x = Rand_ZeroOne() * 65534.0f; elem->unkPosition.y = Rand_ZeroOne() * 65534.0f; elem->unkPosition.z = Rand_ZeroOne() * 65534.0f; + elem->epoch++; } this->timer = 0; @@ -210,6 +211,8 @@ void EffectSpark_Draw(void* thisx, GraphicsContext* gfxCtx) { Mtx* mtx; f32 temp; + FrameInterpolation_RecordOpenChild(elem, elem->epoch); + SkinMatrix_SetTranslate(&spEC, elem->position.x, elem->position.y, elem->position.z); temp = ((Rand_ZeroOne() * 2.5f) + 1.5f) / 64.0f; SkinMatrix_SetScale(&spAC, temp, temp, 1.0f); @@ -264,6 +267,7 @@ void EffectSpark_Draw(void* thisx, GraphicsContext* gfxCtx) { mtx = SkinMatrix_MtxFToNewMtx(gfxCtx, &sp12C); if (mtx == NULL) { + FrameInterpolation_RecordCloseChild(); goto end; } @@ -273,6 +277,8 @@ void EffectSpark_Draw(void* thisx, GraphicsContext* gfxCtx) { } gDPPipeSync(POLY_XLU_DISP++); + + FrameInterpolation_RecordCloseChild(); } end: diff --git a/soh/src/code/z_kankyo.c b/soh/src/code/z_kankyo.c index de654dfbb..de8634f32 100644 --- a/soh/src/code/z_kankyo.c +++ b/soh/src/code/z_kankyo.c @@ -3,6 +3,7 @@ #include "vt.h" #include "objects/gameplay_keep/gameplay_keep.h" #include "objects/gameplay_field_keep/gameplay_field_keep.h" +#include "soh/frame_interpolation.h" typedef enum { /* 0 */ LENS_FLARE_CIRCLE0, @@ -950,7 +951,6 @@ void Environment_Update(GlobalContext* globalCtx, EnvironmentContext* envCtx, Li Gfx* prevDisplayList; OPEN_DISPS(globalCtx->state.gfxCtx); - prevDisplayList = POLY_OPA_DISP; displayList = Graph_GfxPlusOne(POLY_OPA_DISP); gSPDisplayList(OVERLAY_DISP++, displayList); @@ -1459,6 +1459,8 @@ void Environment_DrawLensFlare(GlobalContext* globalCtx, EnvironmentContext* env LENS_FLARE_RING, LENS_FLARE_CIRCLE1, LENS_FLARE_CIRCLE1, LENS_FLARE_CIRCLE1, LENS_FLARE_CIRCLE1, LENS_FLARE_CIRCLE1, LENS_FLARE_CIRCLE1, LENS_FLARE_CIRCLE1, LENS_FLARE_CIRCLE1, LENS_FLARE_CIRCLE1, }; + static s32 epoch = 0; + epoch++; OPEN_DISPS(gfxCtx); @@ -1502,9 +1504,7 @@ void Environment_DrawLensFlare(GlobalContext* globalCtx, EnvironmentContext* env unk88Target = cosAngle; } - if (cosAngle < 0.0f) { - - } else { + if (!(cosAngle < 0.0f)) { if (arg9) { u32 shrink = ShrinkWindow_GetCurrentVal(); func_800C016C(globalCtx, &pos, &screenPos); @@ -1517,6 +1517,8 @@ void Environment_DrawLensFlare(GlobalContext* globalCtx, EnvironmentContext* env } for (i = 0; i < ARRAY_COUNT(lensFlareTypes); i++) { + FrameInterpolation_RecordOpenChild("Lens Flare", epoch + i * 25); + Matrix_Translate(pos.x, pos.y, pos.z, MTXMODE_NEW); if (arg9) { @@ -1573,6 +1575,8 @@ void Environment_DrawLensFlare(GlobalContext* globalCtx, EnvironmentContext* env gSPDisplayList(POLY_XLU_DISP++, gLensFlareRingDL); break; } + + FrameInterpolation_RecordCloseChild(); } alphaScale = cosAngle - (1.5f - cosAngle); @@ -1638,6 +1642,8 @@ void Environment_DrawRain(GlobalContext* globalCtx, View* view, GraphicsContext* Vec3f unused = { 0.0f, 0.0f, 0.0f }; Vec3f windDirection = { 0.0f, 0.0f, 0.0f }; Player* player = GET_PLAYER(globalCtx); + static s32 epoch = 0; + epoch++; if (!(globalCtx->cameraPtrs[0]->unk_14C & 0x100) && (globalCtx->envCtx.unk_EE[2] == 0)) { OPEN_DISPS(gfxCtx); @@ -1667,6 +1673,8 @@ void Environment_DrawRain(GlobalContext* globalCtx, View* view, GraphicsContext* // draw rain drops for (i = 0; i < globalCtx->envCtx.unk_EE[1]; i++) { + FrameInterpolation_RecordOpenChild("Rain Drop", epoch + i * 25); + temp2 = Rand_ZeroOne(); temp1 = Rand_ZeroOne(); temp3 = Rand_ZeroOne(); @@ -1692,6 +1700,8 @@ void Environment_DrawRain(GlobalContext* globalCtx, View* view, GraphicsContext* gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gRaindropDL); + + FrameInterpolation_RecordCloseChild(); } // draw droplet rings on the ground @@ -1699,6 +1709,8 @@ void Environment_DrawRain(GlobalContext* globalCtx, View* view, GraphicsContext* u8 firstDone = false; for (i = 0; i < globalCtx->envCtx.unk_EE[1]; i++) { + FrameInterpolation_RecordOpenChild("Droplet Ring", epoch + i * 25); + if (!firstDone) { func_80093D84(gfxCtx); gDPSetEnvColor(POLY_XLU_DISP++, 155, 155, 155, 0); @@ -1719,6 +1731,8 @@ void Environment_DrawRain(GlobalContext* globalCtx, View* view, GraphicsContext* gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gEffShockwaveDL); + + FrameInterpolation_RecordCloseChild(); } } @@ -1911,10 +1925,14 @@ void Environment_DrawLightning(GlobalContext* globalCtx, s32 unused) { s32 pad[2]; Vec3f unused1 = { 0.0f, 0.0f, 0.0f }; Vec3f unused2 = { 0.0f, 0.0f, 0.0f }; + static s32 epoch = 0; + epoch++; OPEN_DISPS(globalCtx->state.gfxCtx); for (i = 0; i < ARRAY_COUNT(sLightningBolts); i++) { + FrameInterpolation_RecordOpenChild("Lightning Bolt", epoch + i * 25); + switch (sLightningBolts[i].state) { case LIGHTNING_BOLT_START: dx = globalCtx->view.lookAt.x - globalCtx->view.eye.x; @@ -1969,6 +1987,8 @@ void Environment_DrawLightning(GlobalContext* globalCtx, s32 unused) { gSPMatrix(POLY_XLU_DISP++, SEG_ADDR(1, 0), G_MTX_NOPUSH | G_MTX_MUL | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gEffLightningDL); } + + FrameInterpolation_RecordCloseChild(); } CLOSE_DISPS(globalCtx->state.gfxCtx); diff --git a/soh/src/code/z_lifemeter.c b/soh/src/code/z_lifemeter.c index e1bafb3d2..400f0a275 100644 --- a/soh/src/code/z_lifemeter.c +++ b/soh/src/code/z_lifemeter.c @@ -1,5 +1,6 @@ #include "global.h" #include "textures/parameter_static/parameter_static.h" +#include "soh/frame_interpolation.h" s16 Top_LM_Margin = 0; s16 Left_LM_Margin = 0; @@ -412,6 +413,8 @@ void HealthMeter_Draw(GlobalContext* globalCtx) { s32 curCombineModeSet = 0; u8* curBgImgLoaded = NULL; s32 ddHeartCountMinusOne = gSaveContext.inventory.defenseHearts - 1; + static s32 epoch = 0; + epoch++; OPEN_DISPS(gfxCtx); @@ -449,6 +452,8 @@ void HealthMeter_Draw(GlobalContext* globalCtx) { } for (i = 0; i < totalHeartCount; i++) { + FrameInterpolation_RecordOpenChild("HealthMeter Heart", epoch + i * 25); + if ((ddHeartCountMinusOne < 0) || (i > ddHeartCountMinusOne)) { if (i < fullHeartCount) { if (curColorSet != 0) { @@ -624,6 +629,8 @@ void HealthMeter_Draw(GlobalContext* globalCtx) { offsetX = PosX_original; } } + + FrameInterpolation_RecordCloseChild(); } CLOSE_DISPS(gfxCtx); diff --git a/soh/src/code/z_message_PAL.c b/soh/src/code/z_message_PAL.c index 006fd2665..42b3a86a2 100644 --- a/soh/src/code/z_message_PAL.c +++ b/soh/src/code/z_message_PAL.c @@ -2675,7 +2675,7 @@ void Message_DrawMain(GlobalContext* globalCtx, Gfx** p) { if (msgCtx->lastPlayedSong < OCARINA_SONG_SARIAS && (msgCtx->ocarinaAction < OCARINA_ACTION_PLAYBACK_MINUET || msgCtx->ocarinaAction >= OCARINA_ACTION_PLAYBACK_SARIA)) { - if (msgCtx->disableWarpSongs || interfaceCtx->restrictions.warpSongs == 3) { + if (msgCtx->disableWarpSongs || (interfaceCtx->restrictions.warpSongs == 3 && !gSaveContext.n64ddFlag)) { Message_StartTextbox(globalCtx, 0x88C, NULL); // "You can't warp here!" globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_04; } else if ((gSaveContext.eventInf[0] & 0xF) != 1) { diff --git a/soh/src/code/z_parameter.c b/soh/src/code/z_parameter.c index 44d529587..24211c590 100644 --- a/soh/src/code/z_parameter.c +++ b/soh/src/code/z_parameter.c @@ -1384,6 +1384,12 @@ void Inventory_SwapAgeEquipment(void) { u16 temp; if (LINK_AGE_IN_YEARS == YEARS_CHILD) { + // When becoming adult, remove swordless flag since we'll get master sword + // Only in rando to keep swordless link bugs in vanilla + if (gSaveContext.n64ddFlag) { + gSaveContext.infTable[29] &= ~1; + } + for (i = 0; i < ARRAY_COUNT(gSaveContext.equips.buttonItems); i++) { if (i != 0) { gSaveContext.childEquips.buttonItems[i] = gSaveContext.equips.buttonItems[i]; @@ -1444,6 +1450,12 @@ void Inventory_SwapAgeEquipment(void) { gSaveContext.equips.equipment = gSaveContext.adultEquips.equipment; } } else { + // When becoming child, set swordless flag if player doesn't have kokiri sword + // Only in rando to keep swordless link bugs in vanilla + if (gSaveContext.n64ddFlag && (1 << 0 & gSaveContext.inventory.equipment) == 0) { + gSaveContext.infTable[29] |= 1; + } + for (i = 0; i < ARRAY_COUNT(gSaveContext.equips.buttonItems); i++) { gSaveContext.adultEquips.buttonItems[i] = gSaveContext.equips.buttonItems[i]; @@ -2176,6 +2188,52 @@ u8 Item_Give(GlobalContext* globalCtx, u8 item) { osSyncPrintf("Item_Register(%d)=%d %d\n", slot, item, temp); INV_CONTENT(item) = item; + // Autosave after getting items by default (cvars are not shown in the UI) + if (CVar_GetS32("gAutosave", 0)) { + if (CVar_GetS32("gAutosaveAllItems", 1)) { + Gameplay_PerformSave(globalCtx); + } + else if (CVar_GetS32("gAutosaveMajorItems", 1)) { + switch (item) { + case ITEM_STICK: + case ITEM_NUT: + case ITEM_BOMB: + case ITEM_BOW: + case ITEM_SEEDS: + case ITEM_FISHING_POLE: + case ITEM_MAGIC_SMALL: + case ITEM_MAGIC_LARGE: + case ITEM_INVALID_4: + case ITEM_INVALID_5: + case ITEM_INVALID_6: + case ITEM_INVALID_7: + case ITEM_HEART: + case ITEM_RUPEE_GREEN: + case ITEM_RUPEE_BLUE: + case ITEM_RUPEE_RED: + case ITEM_RUPEE_PURPLE: + case ITEM_RUPEE_GOLD: + case ITEM_INVALID_8: + case ITEM_STICKS_5: + case ITEM_STICKS_10: + case ITEM_NUTS_5: + case ITEM_NUTS_10: + case ITEM_BOMBS_5: + case ITEM_BOMBS_10: + case ITEM_BOMBS_20: + case ITEM_BOMBS_30: + case ITEM_ARROWS_SMALL: + case ITEM_ARROWS_MEDIUM: + case ITEM_ARROWS_LARGE: + case ITEM_SEEDS_30: + break; + default: + Gameplay_PerformSave(globalCtx); + break; + } + } + } + return temp; } @@ -3352,8 +3410,8 @@ void Interface_DrawItemButtons(GlobalContext* globalCtx) { const s16 C_Right_BTN_Pos_ori[] = { C_RIGHT_BUTTON_X+X_Margins_CR, C_RIGHT_BUTTON_Y+Y_Margins_CR }; const s16 C_Up_BTN_Pos_ori[] = { C_UP_BUTTON_X+X_Margins_CU, C_UP_BUTTON_Y+Y_Margins_CU }; const s16 C_Down_BTN_Pos_ori[] = { C_DOWN_BUTTON_X+X_Margins_CD, C_DOWN_BUTTON_Y+Y_Margins_CD }; - s16 LabelX_Navi=8; - s16 LabelY_Navi=4 - !!CVar_GetS32("gNaviTextFix", 0); + s16 LabelX_Navi=7 + !!CVar_GetS32("gNaviTextFix", 0); + s16 LabelY_Navi=4; s16 C_Left_BTN_Pos[2]; //(X,Y) s16 C_Right_BTN_Pos[2]; s16 C_Up_BTN_Pos[2]; diff --git a/soh/src/code/z_play.c b/soh/src/code/z_play.c index d5bcb5beb..5c3b97da6 100644 --- a/soh/src/code/z_play.c +++ b/soh/src/code/z_play.c @@ -7,6 +7,8 @@ #include "../libultraship/ImGuiImpl.h" #include "soh/frame_interpolation.h" +#include + void* D_8012D1F0 = NULL; //UNK_TYPE D_8012D1F4 = 0; // unused Input* D_8012D1F8 = NULL; @@ -201,7 +203,8 @@ void GivePlayerRandoRewardSongOfTime(GlobalContext* globalCtx, RandomizerCheck c !Flags_GetTreasure(globalCtx, 0x1F) && gSaveContext.nextTransition == 0xFF) { GetItemID getItemId = Randomizer_GetItemIdFromKnownCheck(check, GI_SONG_OF_TIME); GiveItemWithoutActor(globalCtx, getItemId); - Flags_SetTreasure(globalCtx, 0x1F); + player->pendingFlag.flagID = 0x1F; + player->pendingFlag.flagType = FLAG_SCENE_TREASURE; } } @@ -695,6 +698,11 @@ void Gameplay_Update(GlobalContext* globalCtx) { gTrnsnUnkState = 0; R_UPDATE_RATE = 3; } + + // Don't autosave in grottos or cutscenes + if (CVar_GetS32("gAutosave", 0) && (globalCtx->sceneNum != SCENE_YOUSEI_IZUMI_TATE) && (globalCtx->sceneNum != SCENE_KAKUSIANA) && (gSaveContext.cutsceneIndex == 0)) { + Gameplay_PerformSave(globalCtx); + } } globalCtx->sceneLoadFlag = 0; } else { @@ -1444,6 +1452,18 @@ void Gameplay_Draw(GlobalContext* globalCtx) { CLOSE_DISPS(gfxCtx); } +time_t Gameplay_GetRealTime() { + time_t t1, t2; + struct tm* tms; + time(&t1); + tms = localtime(&t1); + tms->tm_hour = 0; + tms->tm_min = 0; + tms->tm_sec = 0; + t2 = mktime(tms); + return t1 - t2; +} + void Gameplay_Main(GameState* thisx) { GlobalContext* globalCtx = (GlobalContext*)thisx; @@ -1487,6 +1507,20 @@ void Gameplay_Main(GameState* thisx) { if (1 && HREG(63)) { LOG_NUM("1", 1); } + + if (CVar_GetS32("gTimeSync", 0)) { + const int maxRealDaySeconds = 86400; + const int maxInGameDayTicks = 65536; + + int secs = (int)Gameplay_GetRealTime(); + float percent = (float)secs / (float)maxRealDaySeconds; + + int newIngameTime = maxInGameDayTicks * percent; + + gSaveContext.dayTime = newIngameTime; + + } + } // original name: "Game_play_demo_mode_check" @@ -1943,3 +1977,19 @@ s32 func_800C0DB4(GlobalContext* globalCtx, Vec3f* pos) { return false; } } + +void Gameplay_PerformSave(GlobalContext* globalCtx) { + Gameplay_SaveSceneFlags(globalCtx); + gSaveContext.savedSceneNum = globalCtx->sceneNum; + if (gSaveContext.temporaryWeapon) { + gSaveContext.equips.buttonItems[0] = ITEM_NONE; + GET_PLAYER(globalCtx)->currentSwordItem = ITEM_NONE; + Inventory_ChangeEquipment(EQUIP_SWORD, PLAYER_SWORD_NONE); + Save_SaveFile(); + gSaveContext.equips.buttonItems[0] = ITEM_SWORD_KOKIRI; + GET_PLAYER(globalCtx)->currentSwordItem = ITEM_SWORD_KOKIRI; + Inventory_ChangeEquipment(EQUIP_SWORD, PLAYER_SWORD_KOKIRI); + } else { + Save_SaveFile(); + } +} diff --git a/soh/src/code/z_sram.c b/soh/src/code/z_sram.c index 7670762c5..080c5ea9d 100644 --- a/soh/src/code/z_sram.c +++ b/soh/src/code/z_sram.c @@ -442,62 +442,65 @@ void Sram_OpenSave() { Save_LoadFile(); - switch (gSaveContext.savedSceneNum) { - case SCENE_YDAN: - case SCENE_DDAN: - case SCENE_BDAN: - case SCENE_BMORI1: - case SCENE_HIDAN: - case SCENE_MIZUSIN: - case SCENE_JYASINZOU: - case SCENE_HAKADAN: - case SCENE_HAKADANCH: - case SCENE_ICE_DOUKUTO: - case SCENE_GANON: - case SCENE_MEN: - case SCENE_GERUDOWAY: - case SCENE_GANONTIKA: - gSaveContext.entranceIndex = dungeonEntrances[gSaveContext.savedSceneNum]; - break; - case SCENE_YDAN_BOSS: - gSaveContext.entranceIndex = 0; - break; - case SCENE_DDAN_BOSS: - gSaveContext.entranceIndex = 4; - break; - case SCENE_BDAN_BOSS: - gSaveContext.entranceIndex = 0x28; - break; - case SCENE_MORIBOSSROOM: - gSaveContext.entranceIndex = 0x169; - break; - case SCENE_FIRE_BS: - gSaveContext.entranceIndex = 0x165; - break; - case SCENE_MIZUSIN_BS: - gSaveContext.entranceIndex = 0x10; - break; - case SCENE_JYASINBOSS: - gSaveContext.entranceIndex = 0x82; - break; - case SCENE_HAKADAN_BS: - gSaveContext.entranceIndex = 0x37; - break; - case SCENE_GANON_SONOGO: - case SCENE_GANONTIKA_SONOGO: - case SCENE_GANON_BOSS: - case SCENE_GANON_FINAL: - case SCENE_GANON_DEMO: - gSaveContext.entranceIndex = 0x41B; - break; + if (!CVar_GetS32("gRememberSaveLocation", 0) || gSaveContext.savedSceneNum == SCENE_YOUSEI_IZUMI_TATE || + gSaveContext.savedSceneNum == SCENE_KAKUSIANA) { + switch (gSaveContext.savedSceneNum) { + case SCENE_YDAN: + case SCENE_DDAN: + case SCENE_BDAN: + case SCENE_BMORI1: + case SCENE_HIDAN: + case SCENE_MIZUSIN: + case SCENE_JYASINZOU: + case SCENE_HAKADAN: + case SCENE_HAKADANCH: + case SCENE_ICE_DOUKUTO: + case SCENE_GANON: + case SCENE_MEN: + case SCENE_GERUDOWAY: + case SCENE_GANONTIKA: + gSaveContext.entranceIndex = dungeonEntrances[gSaveContext.savedSceneNum]; + break; + case SCENE_YDAN_BOSS: + gSaveContext.entranceIndex = 0; + break; + case SCENE_DDAN_BOSS: + gSaveContext.entranceIndex = 4; + break; + case SCENE_BDAN_BOSS: + gSaveContext.entranceIndex = 0x28; + break; + case SCENE_MORIBOSSROOM: + gSaveContext.entranceIndex = 0x169; + break; + case SCENE_FIRE_BS: + gSaveContext.entranceIndex = 0x165; + break; + case SCENE_MIZUSIN_BS: + gSaveContext.entranceIndex = 0x10; + break; + case SCENE_JYASINBOSS: + gSaveContext.entranceIndex = 0x82; + break; + case SCENE_HAKADAN_BS: + gSaveContext.entranceIndex = 0x37; + break; + case SCENE_GANON_SONOGO: + case SCENE_GANONTIKA_SONOGO: + case SCENE_GANON_BOSS: + case SCENE_GANON_FINAL: + case SCENE_GANON_DEMO: + gSaveContext.entranceIndex = 0x41B; + break; - default: - if (gSaveContext.savedSceneNum != SCENE_LINK_HOME) { - gSaveContext.entranceIndex = (LINK_AGE_IN_YEARS == YEARS_CHILD) ? 0xBB : 0x5F4; - } else { - gSaveContext.entranceIndex = 0xBB; - } - break; + default: + if (gSaveContext.savedSceneNum != SCENE_LINK_HOME) { + gSaveContext.entranceIndex = (LINK_AGE_IN_YEARS == YEARS_CHILD) ? 0xBB : 0x5F4; + } else { + gSaveContext.entranceIndex = 0xBB; + } + break; + } } osSyncPrintf("scene_no = %d\n", gSaveContext.entranceIndex); diff --git a/soh/src/overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.c b/soh/src/overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.c index 7be483bd9..0f1713ba8 100644 --- a/soh/src/overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.c +++ b/soh/src/overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.c @@ -10,6 +10,7 @@ #include "overlays/actors/ovl_Demo_Effect/z_demo_effect.h" #include "scenes/indoors/yousei_izumi_yoko/yousei_izumi_yoko_scene.h" #include "scenes/indoors/daiyousei_izumi/daiyousei_izumi_scene.h" +#include "soh/frame_interpolation.h" #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5 | ACTOR_FLAG_25) @@ -960,6 +961,7 @@ void BgDyYoseizo_ParticleInit(BgDyYoseizo* this, Vec3f* initPos, Vec3f* initVelo particle->pitch = 0.0f; particle->yaw = Rand_CenteredFloat(30000.0f); particle->roll = 0.0f; + particle->epoch++; return; } } @@ -1039,6 +1041,8 @@ void BgDyYoseizo_ParticleDraw(BgDyYoseizo* this, GlobalContext* globalCtx) { func_80093D84(globalCtx->state.gfxCtx); for (i = 0; i < 200; i++, particle++) { + FrameInterpolation_RecordOpenChild(particle, particle->epoch); + if (particle->alive == 1) { if (phi_s3 == 0) { gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gGreatFairyParticleAppearDL)); @@ -1060,6 +1064,8 @@ void BgDyYoseizo_ParticleDraw(BgDyYoseizo* this, GlobalContext* globalCtx) { G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gGreatFairyParticleAliveDL)); } + + FrameInterpolation_RecordCloseChild(); } CLOSE_DISPS(gfxCtx); diff --git a/soh/src/overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.h b/soh/src/overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.h index 59abc6065..401eb8b22 100644 --- a/soh/src/overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.h +++ b/soh/src/overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.h @@ -24,7 +24,8 @@ typedef struct { /* 0x36 */ f32 pitch; /* 0x36 */ f32 yaw; /* 0x40 */ f32 roll; -} BgDyYoseizoParticle; // size = 0x44 + /* 0x44 */ s32 epoch; +} BgDyYoseizoParticle; // size = 0x48 typedef struct BgDyYoseizo { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_Bg_Jya_Megami/z_bg_jya_megami.c b/soh/src/overlays/actors/ovl_Bg_Jya_Megami/z_bg_jya_megami.c index 1ac76f25b..4b2bb78c5 100644 --- a/soh/src/overlays/actors/ovl_Bg_Jya_Megami/z_bg_jya_megami.c +++ b/soh/src/overlays/actors/ovl_Bg_Jya_Megami/z_bg_jya_megami.c @@ -1,6 +1,7 @@ #include "z_bg_jya_megami.h" #include "overlays/effects/ovl_Effect_Ss_Kakera/z_eff_ss_kakera.h" #include "objects/object_jya_obj/object_jya_obj.h" +#include "soh/frame_interpolation.h" #define FLAGS 0 @@ -217,6 +218,7 @@ void BgJyaMegami_SetupExplode(BgJyaMegami* this) { for (i = 0; i < ARRAY_COUNT(this->pieces); i++) { Math_Vec3f_Copy(&this->pieces[i].pos, &this->dyna.actor.world.pos); this->pieces[i].vel.x = sPiecesInit[i].velX; + this->pieces[i].epoch++; } this->explosionTimer = 0; } @@ -326,6 +328,9 @@ void BgJyaMegami_DrawExplode(BgJyaMegami* this, GlobalContext* globalCtx) { for (i = 0; i < ARRAY_COUNT(this->pieces); i++) { piece = &this->pieces[i]; + + FrameInterpolation_RecordOpenChild(piece, piece->epoch); + Matrix_Translate(piece->pos.x + sPiecesInit[i].unk_00.x, piece->pos.y + sPiecesInit[i].unk_00.y, piece->pos.z + sPiecesInit[i].unk_00.z, MTXMODE_NEW); Matrix_RotateY(piece->rotVelY * (M_PI / 0x8000), MTXMODE_APPLY); @@ -337,6 +342,8 @@ void BgJyaMegami_DrawExplode(BgJyaMegami* this, GlobalContext* globalCtx) { gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, sDLists[i]); + + FrameInterpolation_RecordCloseChild(); } CLOSE_DISPS(globalCtx->state.gfxCtx); diff --git a/soh/src/overlays/actors/ovl_Bg_Jya_Megami/z_bg_jya_megami.h b/soh/src/overlays/actors/ovl_Bg_Jya_Megami/z_bg_jya_megami.h index f4a859c31..4198781b0 100644 --- a/soh/src/overlays/actors/ovl_Bg_Jya_Megami/z_bg_jya_megami.h +++ b/soh/src/overlays/actors/ovl_Bg_Jya_Megami/z_bg_jya_megami.h @@ -13,7 +13,8 @@ typedef struct { /* 0x0C */ Vec3f vel; /* 0x18 */ s16 rotVelX; /* 0x1A */ s16 rotVelY; -} BgJyaMegamiPiece; // size = 0x1C + /* 0x1C */ s32 epoch; +} BgJyaMegamiPiece; // size = 0x20 typedef struct BgJyaMegami { /* 0x0000 */ DynaPolyActor dyna; diff --git a/soh/src/overlays/actors/ovl_Bg_Spot00_Hanebasi/z_bg_spot00_hanebasi.c b/soh/src/overlays/actors/ovl_Bg_Spot00_Hanebasi/z_bg_spot00_hanebasi.c index 2385ee163..d74a39624 100644 --- a/soh/src/overlays/actors/ovl_Bg_Spot00_Hanebasi/z_bg_spot00_hanebasi.c +++ b/soh/src/overlays/actors/ovl_Bg_Spot00_Hanebasi/z_bg_spot00_hanebasi.c @@ -7,6 +7,7 @@ #include "z_bg_spot00_hanebasi.h" #include "objects/object_spot00_objects/object_spot00_objects.h" #include "objects/gameplay_keep/gameplay_keep.h" +#include "soh/frame_interpolation.h" #define FLAGS ACTOR_FLAG_4 @@ -260,6 +261,8 @@ void BgSpot00Hanebasi_DrawTorches(Actor* thisx, GlobalContext* globalCtx2) { GlobalContext* globalCtx = globalCtx2; f32 angle; s32 i; + static s32 epoch = 0; + epoch++; OPEN_DISPS(globalCtx->state.gfxCtx); @@ -276,6 +279,8 @@ void BgSpot00Hanebasi_DrawTorches(Actor* thisx, GlobalContext* globalCtx2) { gDPSetEnvColor(POLY_XLU_DISP++, 255, 0, 0, 0); for (i = 0; i < 2; i++) { + FrameInterpolation_RecordOpenChild("Hanebasi Torch", epoch + i * 25); + gSPSegment(POLY_XLU_DISP++, 0x08, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 32, 64, 1, 0, ((globalCtx->gameplayFrames + i) * -20) & 0x1FF, 32, 128)); @@ -287,6 +292,8 @@ void BgSpot00Hanebasi_DrawTorches(Actor* thisx, GlobalContext* globalCtx2) { gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gEffFire1DL); + + FrameInterpolation_RecordCloseChild(); } CLOSE_DISPS(globalCtx->state.gfxCtx); diff --git a/soh/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.c b/soh/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.c index 721fcf51c..234ef4a11 100644 --- a/soh/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.c +++ b/soh/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.c @@ -2,6 +2,7 @@ #include "objects/object_kingdodongo/object_kingdodongo.h" #include "overlays/actors/ovl_Door_Warp1/z_door_warp1.h" #include "scenes/dungeons/ddan_boss/ddan_boss_room_1.h" +#include "soh/frame_interpolation.h" #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4 | ACTOR_FLAG_5) @@ -150,6 +151,7 @@ void func_808C17C8(GlobalContext* globalCtx, Vec3f* arg1, Vec3f* arg2, Vec3f* ar for (i = 0; i < arg5; i++, eff++) { if (eff->unk_24 == 0) { + eff->epoch++; eff->unk_24 = 1; eff->unk_00 = *arg1; eff->unk_0C = *arg2; @@ -1703,6 +1705,7 @@ void BossDodongo_DrawEffects(GlobalContext* globalCtx) { #endif for (i = 0; i < 80; i++, eff++) { + FrameInterpolation_RecordOpenChild(eff, eff->epoch); if (eff->unk_24 == 1) { gDPPipeSync(POLY_XLU_DISP++); @@ -1719,6 +1722,7 @@ void BossDodongo_DrawEffects(GlobalContext* globalCtx) { G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, object_kingdodongo_DL_009DD0); } + FrameInterpolation_RecordCloseChild(); } CLOSE_DISPS(gfxCtx); diff --git a/soh/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.h b/soh/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.h index 62aefe8cc..f920b44a6 100644 --- a/soh/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.h +++ b/soh/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.h @@ -17,7 +17,8 @@ typedef struct { /* 0x26 */ Color_RGB8 color; /* 0x2A */ s16 alpha; /* 0x2C */ f32 unk_2C; -} BossDodongoEffect; // Size = 0x30 + /* 0x30 */ s32 epoch; +} BossDodongoEffect; // Size = 0x34 typedef struct BossDodongo { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.c b/soh/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.c index f1620c267..8afb08ba1 100644 --- a/soh/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.c +++ b/soh/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.c @@ -1835,6 +1835,8 @@ void BossFd_DrawBody(GlobalContext* globalCtx, BossFd* this) { s16 i; f32 temp_float; Mtx* tempMat = Graph_Alloc(globalCtx->state.gfxCtx, 18 * sizeof(Mtx)); + static s32 epoch = 0; + epoch++; OPEN_DISPS(globalCtx->state.gfxCtx); if (this->skinSegments != 0) { @@ -1876,6 +1878,8 @@ void BossFd_DrawBody(GlobalContext* globalCtx, BossFd* this) { Matrix_Push(); for (i = 0; i < 18; i++, tempMat++) { + FrameInterpolation_RecordOpenChild(tempMat, epoch + i * 25); + segIndex = (this->work[BFD_LEAD_BODY_SEG] + sBodyIndex[i + 1]) % 100; Matrix_Translate(this->bodySegsPos[segIndex].x, this->bodySegsPos[segIndex].y, this->bodySegsPos[segIndex].z, MTXMODE_NEW); @@ -1938,6 +1942,8 @@ void BossFd_DrawBody(GlobalContext* globalCtx, BossFd* this) { if (i > 0) { Collider_UpdateSpheres(i + 1, &this->collider); } + + FrameInterpolation_RecordCloseChild(); } Matrix_Pop(); osSyncPrintf("BH\n"); diff --git a/soh/src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2.c b/soh/src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2.c index 5a891887e..8915c068f 100644 --- a/soh/src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2.c +++ b/soh/src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2.c @@ -9,6 +9,7 @@ #include "overlays/actors/ovl_Boss_Fd/z_boss_fd.h" #include "overlays/actors/ovl_Door_Warp1/z_door_warp1.h" #include "vt.h" +#include "soh/frame_interpolation.h" #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4 | ACTOR_FLAG_5) @@ -1146,6 +1147,8 @@ void BossFd2_UpdateMane(BossFd2* this, GlobalContext* globalCtx, Vec3f* head, Ve } for (i = 0; i < 9; i++) { + FrameInterpolation_RecordOpenChild(this, this->epoch + i * 25); + Matrix_Translate((pos + i)->x, (pos + i)->y, (pos + i)->z, MTXMODE_NEW); Matrix_RotateY((rot + i)->y, MTXMODE_APPLY); Matrix_RotateX((rot + i)->x, MTXMODE_APPLY); @@ -1155,6 +1158,8 @@ void BossFd2_UpdateMane(BossFd2* this, GlobalContext* globalCtx, Vec3f* head, Ve gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gHoleVolvagiaManeModelDL); + + FrameInterpolation_RecordCloseChild(); } Matrix_Pop(); CLOSE_DISPS(globalCtx->state.gfxCtx); diff --git a/soh/src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2.h b/soh/src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2.h index afafdbba3..3bc77b0b7 100644 --- a/soh/src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2.h +++ b/soh/src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2.h @@ -87,6 +87,7 @@ typedef struct BossFd2 { /* 0x1394 */ BossFd2Cam camData; /* 0x141C */ ColliderJntSph collider; /* 0x143C */ ColliderJntSphElement elements[9]; -} BossFd2; // size = 0x167C + /* 0x167C */ s32 epoch; +} BossFd2; // size = 0x1680 #endif diff --git a/soh/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c b/soh/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c index f7a85fc26..10e118c17 100644 --- a/soh/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c +++ b/soh/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c @@ -3356,6 +3356,8 @@ void BossGanon_DrawShock(BossGanon* this, GlobalContext* globalCtx) { s32 pad; GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; s16 i; + static s32 epoch = 0; + epoch++; OPEN_DISPS(gfxCtx); @@ -3369,6 +3371,8 @@ void BossGanon_DrawShock(BossGanon* this, GlobalContext* globalCtx) { Player* player = GET_PLAYER(globalCtx); for (i = 0; i < ARRAY_COUNT(player->bodyPartsPos); i++) { + FrameInterpolation_RecordOpenChild("Ganondorf Shock 0", epoch + i * 25); + Matrix_Translate(player->bodyPartsPos[i].x, player->bodyPartsPos[i].y, player->bodyPartsPos[i].z, MTXMODE_NEW); Matrix_ReplaceRotation(&globalCtx->billboardMtxF); @@ -3377,9 +3381,13 @@ void BossGanon_DrawShock(BossGanon* this, GlobalContext* globalCtx) { gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gDorfSquareDL); + + FrameInterpolation_RecordCloseChild(); } } else { for (i = 1; i < 15; i++) { + FrameInterpolation_RecordOpenChild("Ganondorf Shock 1", epoch + i * 25); + Matrix_Translate(this->unk_2EC[i].x, this->unk_2EC[i].y, this->unk_2EC[i].z, MTXMODE_NEW); Matrix_ReplaceRotation(&globalCtx->billboardMtxF); Matrix_Scale(this->unk_49C[i], this->unk_49C[i], this->unk_49C[i], MTXMODE_APPLY); @@ -3401,6 +3409,8 @@ void BossGanon_DrawShock(BossGanon* this, GlobalContext* globalCtx) { } else { gSPDisplayList(POLY_XLU_DISP++, gDorfSquareDL); } + + FrameInterpolation_RecordCloseChild(); } } } @@ -3443,9 +3453,9 @@ void BossGanon_DrawHandLightBall(BossGanon* this, GlobalContext* globalCtx) { gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gDorfLightCoreDL); - - CLOSE_DISPS(gfxCtx); } + + CLOSE_DISPS(gfxCtx); } void BossGanon_DrawBigMagicCharge(BossGanon* this, GlobalContext* globalCtx) { @@ -3453,6 +3463,8 @@ void BossGanon_DrawBigMagicCharge(BossGanon* this, GlobalContext* globalCtx) { f32 yRot; GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; s16 i; + static s32 epoch = 0; + epoch++; OPEN_DISPS(gfxCtx); @@ -3513,6 +3525,8 @@ void BossGanon_DrawBigMagicCharge(BossGanon* this, GlobalContext* globalCtx) { yRot = BINANG_TO_RAD(this->actor.yawTowardsPlayer); for (i = 0; i < this->unk_1AC; i++) { + FrameInterpolation_RecordOpenChild("Ganondorf Big Magic", epoch + i * 25); + f32 xzRot = (BossGanon_RandZeroOne() - 0.5f) * M_PI * 1.5f; gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, (s8)this->unk_294[i]); @@ -3527,10 +3541,12 @@ void BossGanon_DrawBigMagicCharge(BossGanon* this, GlobalContext* globalCtx) { gSPDisplayList(POLY_XLU_DISP++, gDorfLightRayTriDL); Matrix_Pop(); - } - CLOSE_DISPS(gfxCtx); + FrameInterpolation_RecordCloseChild(); + } } + + CLOSE_DISPS(gfxCtx); } void BossGanon_DrawTriforce(BossGanon* this, GlobalContext* globalCtx) { @@ -4142,6 +4158,8 @@ void BossGanon_LightBall_Draw(Actor* thisx, GlobalContext* globalCtx) { s16 i; f32 alpha; s32 pad; + static s32 epoch = 0; + epoch++; OPEN_DISPS(globalCtx->state.gfxCtx); @@ -4166,6 +4184,8 @@ void BossGanon_LightBall_Draw(Actor* thisx, GlobalContext* globalCtx) { if (this->unk_1A8 == 1) { for (i = 0; i < 8; i++) { + FrameInterpolation_RecordOpenChild("Ganondorf Light Ball 0", epoch + i * 25); + Matrix_Push(); Matrix_RotateY(i * (M_PI / 8), MTXMODE_APPLY); Matrix_RotateZ(this->fwork[GDF_FWORK_0], MTXMODE_APPLY); @@ -4174,6 +4194,8 @@ void BossGanon_LightBall_Draw(Actor* thisx, GlobalContext* globalCtx) { gSPDisplayList(POLY_XLU_DISP++, gDorfSquareDL); Matrix_Pop(); + + FrameInterpolation_RecordCloseChild(); } } else if (this->unk_1A8 == 0) { Matrix_ReplaceRotation(&globalCtx->billboardMtxF); diff --git a/soh/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c b/soh/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c index 23fa7fcc9..ecc084be3 100644 --- a/soh/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c +++ b/soh/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c @@ -5,6 +5,7 @@ #include "objects/object_ganon2/object_ganon2.h" #include "objects/object_ganon_anime3/object_ganon_anime3.h" #include "objects/object_geff/object_geff.h" +#include "soh/frame_interpolation.h" #include @@ -2463,6 +2464,8 @@ void func_80904340(BossGanon2* this, GlobalContext* globalCtx) { f32 angle; f32 sin; f32 cos; + static s32 epoch = 0; + epoch++; OPEN_DISPS(globalCtx->state.gfxCtx); Matrix_Push(); @@ -2485,6 +2488,7 @@ void func_80904340(BossGanon2* this, GlobalContext* globalCtx) { rand = BossGanon2_RandZeroOne(); for (i = 0; i < 5; i++) { + FrameInterpolation_RecordOpenChild("Ganon 80904340", epoch + i * 25); angle = (i * (2 * M_PI / 5)) + (rand * M_PI); sin = 5000.0f * sinf(angle); cos = 5000.0f * cosf(angle); @@ -2500,6 +2504,7 @@ void func_80904340(BossGanon2* this, GlobalContext* globalCtx) { gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(ovl_Boss_Ganon2_DL_00D798)); + FrameInterpolation_RecordCloseChild(); } } @@ -2632,6 +2637,8 @@ void BossGanon2_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLis void func_80904D88(BossGanon2* this, GlobalContext* globalCtx) { s32 pad; s16 i; + static s32 epoch = 0; + epoch++; OPEN_DISPS(globalCtx->state.gfxCtx); @@ -2647,6 +2654,8 @@ void func_80904D88(BossGanon2* this, GlobalContext* globalCtx) { gSPDisplayList(POLY_XLU_DISP++, ovl_Boss_Ganon2_DL_00B308); for (i = 0; i < 15; i++) { + FrameInterpolation_RecordOpenChild("Ganon 80904D88", epoch + i * 25); + Matrix_Translate(this->unk_234[i].x, this->unk_234[i].y, this->unk_234[i].z, MTXMODE_NEW); Matrix_ReplaceRotation(&globalCtx->billboardMtxF); Matrix_Scale(this->unk_30C, this->unk_30C, this->unk_30C, MTXMODE_APPLY); @@ -2654,6 +2663,8 @@ void func_80904D88(BossGanon2* this, GlobalContext* globalCtx) { gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, ovl_Boss_Ganon2_DL_00B378); + + FrameInterpolation_RecordCloseChild(); } } @@ -2690,6 +2701,8 @@ void func_80904FC8(BossGanon2* this, GlobalContext* globalCtx) { void func_8090523C(BossGanon2* this, GlobalContext* globalCtx) { Player* player; f32 phi_f20; + static s32 epoch = 0; + epoch++; OPEN_DISPS(globalCtx->state.gfxCtx); @@ -2703,6 +2716,8 @@ void func_8090523C(BossGanon2* this, GlobalContext* globalCtx) { gSPDisplayList(POLY_XLU_DISP++, ovl_Boss_Ganon2_DL_00B308); for (i = 0; i < 11; i++) { + FrameInterpolation_RecordOpenChild("Ganon 8090523C", epoch + i * 25); + Matrix_Mult(&player->mf_9E0, MTXMODE_NEW); Matrix_Translate((i * 250.0f) + 900.0f, 350.0f, 0.0f, MTXMODE_APPLY); @@ -2718,6 +2733,8 @@ void func_8090523C(BossGanon2* this, GlobalContext* globalCtx) { gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(ovl_Boss_Ganon2_DL_00B378)); + + FrameInterpolation_RecordCloseChild(); } } @@ -2916,6 +2933,8 @@ void func_809060E8(GlobalContext* globalCtx) { BossGanon2Effect* effect; s16 i; BossGanon2Effect* effects; + static s32 epoch = 0; + epoch++; effects = effect = globalCtx->specialEffects; @@ -2925,6 +2944,8 @@ void func_809060E8(GlobalContext* globalCtx) { for (i = 0; i < 1; i++) { if (effect->type == 1) { + FrameInterpolation_RecordOpenChild("Ganon 809060E8 0", epoch + i * 25); + Vec3f spA0; f32 temp_f0; f32 angle; @@ -2958,6 +2979,8 @@ void func_809060E8(GlobalContext* globalCtx) { gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, ovl_Boss_Ganon2_DL_00F188); + + FrameInterpolation_RecordCloseChild(); } } @@ -2965,6 +2988,8 @@ void func_809060E8(GlobalContext* globalCtx) { for (i = 0; i < ARRAY_COUNT(sBossGanon2Particles); i++, effect++) { if (effect->type == 2) { + FrameInterpolation_RecordOpenChild("Ganon 809060E8 1", epoch + i * 25); + if (!usingObjectGEff) { BossGanon2_SetObjectSegment(NULL, globalCtx, OBJECT_GEFF, true); usingObjectGEff++; @@ -2977,6 +3002,8 @@ void func_809060E8(GlobalContext* globalCtx) { gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gGanonRubbleDL); + + FrameInterpolation_RecordCloseChild(); } } diff --git a/soh/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c b/soh/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c index 7ba83aebf..b7756765a 100644 --- a/soh/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c +++ b/soh/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c @@ -348,6 +348,7 @@ void BossMo_Init(Actor* thisx, GlobalContext* globalCtx2) { globalCtx->specialEffects = sEffects; for (i = 0; i < ARRAY_COUNT(sEffects); i++) { sEffects[i].type = MO_FX_NONE; + sEffects[i].epoch++; } this->actor.world.pos.x = 200.0f; this->actor.world.pos.y = MO_WATER_LEVEL(globalCtx) + 50.0f; @@ -2442,6 +2443,8 @@ void BossMo_DrawTentacle(BossMo* this, GlobalContext* globalCtx) { f32 phi_f20; f32 phi_f22; Vec3f sp110; + static s32 epoch = 0; + epoch++; OPEN_DISPS(globalCtx->state.gfxCtx); @@ -2462,6 +2465,8 @@ void BossMo_DrawTentacle(BossMo* this, GlobalContext* globalCtx) { BossMo_InitRand(1, 29100, 9786); for (i = 0; i < 41; i++, matrix++) { + FrameInterpolation_RecordOpenChild("Morpha Tentacle", epoch + i * 25); + s32 pad; s32 pad2; @@ -2559,6 +2564,8 @@ void BossMo_DrawTentacle(BossMo* this, GlobalContext* globalCtx) { if ((i < 38) && ((i & 1) == 1)) { BossMo_UpdateTentColliders(this, i / 2, &this->tentCollider, &this->tentPos[i]); } + + FrameInterpolation_RecordCloseChild(); } Matrix_Pop(); diff --git a/soh/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c b/soh/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c index 81686f84b..1a1a93b07 100644 --- a/soh/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c +++ b/soh/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c @@ -9,6 +9,7 @@ #include "objects/gameplay_keep/gameplay_keep.h" #include "overlays/actors/ovl_Bg_Sst_Floor/z_bg_sst_floor.h" #include "overlays/actors/ovl_Door_Warp1/z_door_warp1.h" +#include "soh/frame_interpolation.h" #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4 | ACTOR_FLAG_5 | ACTOR_FLAG_10) @@ -2705,6 +2706,8 @@ s32 BossSst_OverrideHandTrailDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** void BossSst_DrawHand(Actor* thisx, GlobalContext* globalCtx) { BossSst* this = (BossSst*)thisx; + static s32 epoch = 0; + epoch++; OPEN_DISPS(globalCtx->state.gfxCtx); @@ -2738,6 +2741,8 @@ void BossSst_DrawHand(Actor* thisx, GlobalContext* globalCtx) { for (i = 0; i < end; i++) { if (Math3D_Vec3fDistSq(&trail2->world.pos, &trail->world.pos) > 900.0f) { + FrameInterpolation_RecordOpenChild(trail, 0); + Matrix_SetTranslateRotateYXZ(trail->world.pos.x, trail->world.pos.y, trail->world.pos.z, &trail->world.rot); Matrix_Scale(0.02f, 0.02f, 0.02f, MTXMODE_APPLY); @@ -2749,6 +2754,8 @@ void BossSst_DrawHand(Actor* thisx, GlobalContext* globalCtx) { POLY_XLU_DISP = SkelAnime_DrawFlex(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, BossSst_OverrideHandTrailDraw, NULL, trail, POLY_XLU_DISP); + + FrameInterpolation_RecordCloseChild(); } idx = (idx + 5) % 7; trail2 = trail; @@ -2955,6 +2962,8 @@ void BossSst_SpawnHeadShadow(BossSst* this) { shadow->scale = 1450; shadow->alpha = 254; shadow->status = 65; + + shadow->epoch++; } this->effects[3].status = -1; @@ -2968,6 +2977,7 @@ void BossSst_SpawnHandShadow(BossSst* this) { this->effects[0].scale = 2300; this->effects[0].alpha = 254; this->effects[0].status = 5; + this->effects[0].epoch++; this->effects[1].status = -1; } @@ -2981,6 +2991,7 @@ void BossSst_SpawnShockwave(BossSst* this) { for (i = 0; i < 3; i++) { BossSstEffect* shockwave = &this->effects[i]; + shockwave->epoch++; Math_Vec3f_Copy(&shockwave->pos, &this->actor.world.pos); shockwave->move = (i + 9) * 2; @@ -3035,6 +3046,8 @@ void BossSst_SpawnIceCrystal(BossSst* this, s32 index) { if ((index % 2) == 0) { Audio_PlayActorSound2(&this->actor, NA_SE_PL_FREEZE_S); } + + ice->epoch++; } void BossSst_SpawnIceShard(BossSst* this) { @@ -3050,6 +3063,7 @@ void BossSst_SpawnIceShard(BossSst* this) { for (i = 0; i < 18; i++) { BossSstEffect* ice = &this->effects[i]; + ice->epoch++; Math_Vec3f_Copy(&ice->pos, &spawnPos); ice->status = 1; @@ -3165,6 +3179,8 @@ void BossSst_DrawEffect(Actor* thisx, GlobalContext* globalCtx) { for (i = 0; i < 18; i++) { effect = &this->effects[i]; + FrameInterpolation_RecordOpenChild(effect, effect->epoch); + if (effect->move) { func_8003435C(&effect->pos, globalCtx); if (this->effects[0].status != 0) { @@ -3182,6 +3198,8 @@ void BossSst_DrawEffect(Actor* thisx, GlobalContext* globalCtx) { G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gBongoIceShardDL); } + + FrameInterpolation_RecordCloseChild(); } } else if (this->effectMode == BONGO_SHOCKWAVE) { f32 scaleY = 0.005f; @@ -3193,6 +3211,7 @@ void BossSst_DrawEffect(Actor* thisx, GlobalContext* globalCtx) { for (i = 0; i < 3; i++, scaleY -= 0.001f) { effect = &this->effects[i]; + FrameInterpolation_RecordOpenChild(effect, effect->epoch); if (effect->move != 0) { Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW); @@ -3205,6 +3224,8 @@ void BossSst_DrawEffect(Actor* thisx, GlobalContext* globalCtx) { G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gEffFireCircleDL); } + + FrameInterpolation_RecordCloseChild(); } } else if (this->effectMode == BONGO_SHADOW) { gDPSetPrimColor(POLY_XLU_DISP++, 0x00, 0x80, 10, 10, 80, 0); @@ -3212,12 +3233,16 @@ void BossSst_DrawEffect(Actor* thisx, GlobalContext* globalCtx) { effect = &this->effects[0]; while (effect->status != -1) { + FrameInterpolation_RecordOpenChild(effect, effect->epoch); + Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW); Matrix_Scale(effect->scale * 0.001f, 1.0f, effect->scale * 0.001f, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, sShadowDList); + + FrameInterpolation_RecordCloseChild(); effect++; } } diff --git a/soh/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.h b/soh/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.h index 8b2b311d6..32c12b7fd 100644 --- a/soh/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.h +++ b/soh/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.h @@ -17,7 +17,8 @@ typedef struct { /* 0x0020 */ s16 move; /* 0x0022 */ s16 status; /* 0x0024 */ u8 alpha; -} BossSstEffect; // size = 0x28 + /* 0x0028 */ s32 epoch; +} BossSstEffect; // size = 0x2C typedef struct { /* 0x0000 */ PosRot world; diff --git a/soh/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c b/soh/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c index 8d19fdd8e..1252df4bf 100644 --- a/soh/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c +++ b/soh/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c @@ -2,6 +2,7 @@ #include "objects/gameplay_keep/gameplay_keep.h" #include "objects/object_tw/object_tw.h" #include "overlays/actors/ovl_Door_Warp1/z_door_warp1.h" +#include "soh/frame_interpolation.h" #include @@ -467,6 +468,7 @@ void BossTw_Init(Actor* thisx, GlobalContext* globalCtx2) { for (i = 0; i < ARRAY_COUNT(sTwEffects); i++) { sTwEffects[i].type = TWEFF_NONE; + sTwEffects[i].epoch++; } } @@ -3327,6 +3329,8 @@ void func_80942180(BossTw* this, GlobalContext* globalCtx) { void func_809426F0(BossTw* this, GlobalContext* globalCtx) { s32 pad; s16 i; + static s32 epoch = 0; + epoch++; OPEN_DISPS(globalCtx->state.gfxCtx); @@ -3360,6 +3364,8 @@ void func_809426F0(BossTw* this, GlobalContext* globalCtx) { } for (i = 0; i < 8; i++) { + FrameInterpolation_RecordOpenChild("Twinrova 809426F0", epoch + i * 25); + Matrix_Push(); Matrix_Translate(0.0f, 0.0f, 5000.0f, MTXMODE_APPLY); Matrix_RotateZ(((i * M_PI) * 2.0f * 0.125f) + this->flameRotation, MTXMODE_APPLY); @@ -3373,6 +3379,8 @@ void func_809426F0(BossTw* this, GlobalContext* globalCtx) { G_MTX_LOAD | G_MTX_MODELVIEW | G_MTX_NOPUSH); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01A430)); Matrix_Pop(); + + FrameInterpolation_RecordCloseChild(); } CLOSE_DISPS(globalCtx->state.gfxCtx); @@ -4410,6 +4418,8 @@ void BossTw_BlastDraw(Actor* thisx, GlobalContext* globalCtx2) { f32 scaleFactor; s16 tailIdx; s16 i; + static s32 epoch = 0; + epoch++; OPEN_DISPS(globalCtx->state.gfxCtx); @@ -4420,6 +4430,8 @@ void BossTw_BlastDraw(Actor* thisx, GlobalContext* globalCtx2) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 200, 20, 0, (s8)this->workf[TAIL_ALPHA]); gDPSetEnvColor(POLY_XLU_DISP++, 255, 215, 255, 128); for (i = 9; i >= 0; i--) { + FrameInterpolation_RecordOpenChild("Twinrova Fire Blast", epoch + i * 25); + gSPSegment(POLY_XLU_DISP++, 8, Gfx_TwoTexScroll( globalCtx->state.gfxCtx, 0, ((this->work[CS_TIMER_1] * 3) + (i * 10)) & 0x7F, @@ -4434,6 +4446,8 @@ void BossTw_BlastDraw(Actor* thisx, GlobalContext* globalCtx2) { gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01A430)); + + FrameInterpolation_RecordCloseChild(); } break; @@ -4444,6 +4458,8 @@ void BossTw_BlastDraw(Actor* thisx, GlobalContext* globalCtx2) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 195, 225, 235, (s8)this->workf[TAIL_ALPHA]); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01A998)); for (i = 9; i >= 0; i--) { + FrameInterpolation_RecordOpenChild("Twinrova Ice Blast", epoch + i * 25); + gSPSegment(POLY_XLU_DISP++, 8, Gfx_TwoTexScroll( globalCtx->state.gfxCtx, 0, ((this->work[CS_TIMER_1] * 3) + (i * 0xA)) & 0x7F, @@ -4458,6 +4474,8 @@ void BossTw_BlastDraw(Actor* thisx, GlobalContext* globalCtx2) { gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01AB00)); + + FrameInterpolation_RecordCloseChild(); } break; @@ -4474,6 +4492,8 @@ void BossTw_DrawDeathBall(Actor* thisx, GlobalContext* globalCtx2) { f32 scaleFactor; s16 tailIdx; s16 i; + static s32 epoch = 0; + epoch++; OPEN_DISPS(globalCtx->state.gfxCtx); @@ -4484,6 +4504,8 @@ void BossTw_DrawDeathBall(Actor* thisx, GlobalContext* globalCtx2) { gDPSetEnvColor(POLY_XLU_DISP++, 255, 215, 255, 128); for (i = 9; i >= 0; i--) { + FrameInterpolation_RecordOpenChild("Twinrova Death Ball 0", epoch + i * 25); + gSPSegment(POLY_XLU_DISP++, 8, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (((this->work[CS_TIMER_1] * 3) + (i * 0xA))) & 0x7F, (u8)((-this->work[CS_TIMER_1] * 0xF) + (i * 50)), 0x20, 0x40, 1, 0, 0, 0x20, @@ -4498,12 +4520,16 @@ void BossTw_DrawDeathBall(Actor* thisx, GlobalContext* globalCtx2) { gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01A430)); + + FrameInterpolation_RecordCloseChild(); } } else { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 195, 225, 235, (s8)this->workf[TAIL_ALPHA]); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01A998)); for (i = 9; i >= 0; i--) { + FrameInterpolation_RecordOpenChild("Twinrova Death Ball 1", epoch + i * 25); + gSPSegment(POLY_XLU_DISP++, 8, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (((this->work[CS_TIMER_1] * 3) + (i * 0xA))) & 0x7F, (u8)((-this->work[CS_TIMER_1] * 0xF) + (i * 50)), 0x20, 0x40, 1, 0, 0, 0x20, @@ -4518,6 +4544,8 @@ void BossTw_DrawDeathBall(Actor* thisx, GlobalContext* globalCtx2) { gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01AB00)); + + FrameInterpolation_RecordCloseChild(); } } @@ -4883,6 +4911,8 @@ void BossTw_DrawEffects(GlobalContext* globalCtx) { for (i = 0; i < ARRAY_COUNT(sTwEffects); i++) { if (currentEffect->type == 1) { + FrameInterpolation_RecordOpenChild(currentEffect, currentEffect->epoch); + if (sp18F == 0) { gSPDisplayList(POLY_XLU_DISP++, object_tw_DL_01A528); sp18F++; @@ -4896,8 +4926,9 @@ void BossTw_DrawEffects(GlobalContext* globalCtx) { gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, object_tw_DL_01A5A8); - } + FrameInterpolation_RecordCloseChild(); + } currentEffect++; } @@ -4906,6 +4937,8 @@ void BossTw_DrawEffects(GlobalContext* globalCtx) { for (i = 0; i < ARRAY_COUNT(sTwEffects); i++) { if (currentEffect->type == 3) { + FrameInterpolation_RecordOpenChild(currentEffect, currentEffect->epoch); + if (sp18F == 0) { gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01A998)); sp18F++; @@ -4921,6 +4954,8 @@ void BossTw_DrawEffects(GlobalContext* globalCtx) { gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01AB00)); + + FrameInterpolation_RecordCloseChild(); } currentEffect++; } @@ -4930,6 +4965,8 @@ void BossTw_DrawEffects(GlobalContext* globalCtx) { for (i = 0; i < ARRAY_COUNT(sTwEffects); i++) { if (currentEffect->type == 2) { + FrameInterpolation_RecordOpenChild(currentEffect, currentEffect->epoch); + if (sp18F == 0) { gDPPipeSync(POLY_XLU_DISP++); gDPSetEnvColor(POLY_XLU_DISP++, 255, 215, 255, 128); @@ -4946,6 +4983,8 @@ void BossTw_DrawEffects(GlobalContext* globalCtx) { gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01A430)); + + FrameInterpolation_RecordCloseChild(); } currentEffect++; @@ -4956,6 +4995,8 @@ void BossTw_DrawEffects(GlobalContext* globalCtx) { for (i = 0; i < ARRAY_COUNT(sTwEffects); i++) { if (currentEffect->type == 4) { + FrameInterpolation_RecordOpenChild(currentEffect, currentEffect->epoch); + if (sp18F == 0) { sp18F++; } @@ -4991,6 +5032,8 @@ void BossTw_DrawEffects(GlobalContext* globalCtx) { gDPSetRenderMode(POLY_XLU_DISP++, G_RM_PASS, G_RM_AA_ZB_XLU_SURF2); gSPClearGeometryMode(POLY_XLU_DISP++, G_CULL_BACK | G_FOG); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01A790)); + + FrameInterpolation_RecordCloseChild(); } currentEffect++; @@ -5004,6 +5047,8 @@ void BossTw_DrawEffects(GlobalContext* globalCtx) { Vec3f off; if (currentEffect->type == TWEFF_PLYR_FRZ) { + FrameInterpolation_RecordOpenChild(currentEffect, currentEffect->epoch); + if (sp18F == 0) { gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01AA50)); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 195, 225, 235, 255); @@ -5037,6 +5082,8 @@ void BossTw_DrawEffects(GlobalContext* globalCtx) { G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01AB00)); } + + FrameInterpolation_RecordCloseChild(); } currentEffect++; @@ -5047,6 +5094,8 @@ void BossTw_DrawEffects(GlobalContext* globalCtx) { for (i = 0; i < ARRAY_COUNT(sTwEffects); i++) { if (currentEffect->type >= 6) { + FrameInterpolation_RecordOpenChild(currentEffect, currentEffect->epoch); + if (currentEffect->work[EFF_ARGS] == 0) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 195, 225, 235, currentEffect->alpha); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01A998)); @@ -5070,6 +5119,8 @@ void BossTw_DrawEffects(GlobalContext* globalCtx) { } else { gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01A430)); } + + FrameInterpolation_RecordCloseChild(); } currentEffect++; diff --git a/soh/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.h b/soh/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.h index 51b664726..1a4a31438 100644 --- a/soh/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.h +++ b/soh/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.h @@ -43,6 +43,7 @@ typedef struct { /* 0x002E */ s16 work[EFF_WORK_MAX]; /* 0x0034 */ f32 workf[EFF_FWORK_MAX]; /* 0x0044 */ Actor* target; + s32 epoch; } BossTwEffect; typedef enum { diff --git a/soh/src/overlays/actors/ovl_Boss_Va/z_boss_va.c b/soh/src/overlays/actors/ovl_Boss_Va/z_boss_va.c index 6f492145b..b4236ef25 100644 --- a/soh/src/overlays/actors/ovl_Boss_Va/z_boss_va.c +++ b/soh/src/overlays/actors/ovl_Boss_Va/z_boss_va.c @@ -4006,6 +4006,8 @@ void BossVa_DrawDoor(GlobalContext* globalCtx, s16 scale) { f32 yScale; f32 segAngle = 0.0f; s32 i; + static s32 epoch = 0; + epoch++; OPEN_DISPS(globalCtx->state.gfxCtx); @@ -4023,6 +4025,8 @@ void BossVa_DrawDoor(GlobalContext* globalCtx, s16 scale) { Matrix_Get(&doorMtx); for (i = 0; i < 8; i++, segAngle -= M_PI / 4) { + FrameInterpolation_RecordOpenChild("Barinade Door", epoch + i * 25); + Matrix_Put(&doorMtx); Matrix_RotateZ(segAngle, MTXMODE_APPLY); Matrix_Translate(0.0f, doorPieceLength[i] * yScale, 0.0f, MTXMODE_APPLY); @@ -4030,6 +4034,8 @@ void BossVa_DrawDoor(GlobalContext* globalCtx, s16 scale) { gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, doorPieceDispList[i]); + + FrameInterpolation_RecordCloseChild(); } CLOSE_DISPS(globalCtx->state.gfxCtx); diff --git a/soh/src/overlays/actors/ovl_Demo_6K/z_demo_6k.c b/soh/src/overlays/actors/ovl_Demo_6K/z_demo_6k.c index 0c0a57317..fd131a244 100644 --- a/soh/src/overlays/actors/ovl_Demo_6K/z_demo_6k.c +++ b/soh/src/overlays/actors/ovl_Demo_6K/z_demo_6k.c @@ -10,6 +10,7 @@ #include "objects/object_demo_6k/object_demo_6k.h" #include "objects/object_gnd_magic/object_gnd_magic.h" #include "overlays/actors/ovl_Eff_Dust/z_eff_dust.h" +#include "soh/frame_interpolation.h" #define FLAGS ACTOR_FLAG_4 @@ -563,9 +564,10 @@ void func_80967FFC(Actor* thisx, GlobalContext* globalCtx) { Demo6K* this = (Demo6K*)thisx; s32 pad; u16 timer1 = this->timer1; + static s32 epoch = 0; + epoch++; OPEN_DISPS(globalCtx->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); Matrix_RotateX(-M_PI / 2, MTXMODE_APPLY); gSPSegment(POLY_XLU_DISP++, 0x08, @@ -584,6 +586,8 @@ void func_80967FFC(Actor* thisx, GlobalContext* globalCtx) { Matrix_RotateZ(-M_PI / 2, MTXMODE_APPLY); for (i = 0; i < 6; i++) { + FrameInterpolation_RecordOpenChild("Demo6K 80967FFC", epoch + i * 25); + Matrix_RotateZ(M_PI / 3, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); @@ -591,6 +595,8 @@ void func_80967FFC(Actor* thisx, GlobalContext* globalCtx) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, colors[i][0].r, colors[i][0].g, colors[i][0].b, 255); gDPSetEnvColor(POLY_XLU_DISP++, colors[i][1].r, colors[i][1].g, colors[i][1].b, 255); gSPDisplayList(POLY_XLU_DISP++, object_demo_6k_DL_0022B0); + + FrameInterpolation_RecordCloseChild(); } // required to avoid optimizing out i @@ -689,6 +695,8 @@ void func_809688C4(Actor* thisx, GlobalContext* globalCtx2) { GlobalContext* globalCtx = globalCtx2; u32 frames = globalCtx->state.frames; s32 i; + static s32 epoch = 0; + epoch++; if ((i = (globalCtx->csCtx.state != CS_STATE_IDLE) && (globalCtx->csCtx.npcActions[1] != NULL)) && (globalCtx->csCtx.npcActions[1]->action != 1)) { @@ -699,6 +707,8 @@ void func_809688C4(Actor* thisx, GlobalContext* globalCtx2) { Matrix_RotateY((s16)(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) + 0x8000) * (M_PI / 0x8000), MTXMODE_APPLY); for (i = 0; i < 16; i++) { + FrameInterpolation_RecordOpenChild("Demo6K 809688C4", epoch + i * 25); + gDPPipeSync(POLY_XLU_DISP++); gDPSetEnvColor(POLY_XLU_DISP++, sEnvColors[this->unk_274[i]].r, sEnvColors[this->unk_274[i]].g, sEnvColors[this->unk_274[i]].b, 255); @@ -712,6 +722,8 @@ void func_809688C4(Actor* thisx, GlobalContext* globalCtx2) { G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gEffFlash1DL); Matrix_Pop(); + + FrameInterpolation_RecordCloseChild(); } gSPDisplayList(POLY_XLU_DISP++, gEffFlash1DL); diff --git a/soh/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c b/soh/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c index b365b3038..6ca6a025b 100644 --- a/soh/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c +++ b/soh/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c @@ -3,6 +3,7 @@ #include "objects/gameplay_keep/gameplay_keep.h" #include "objects/object_efc_star_field/object_efc_star_field.h" #include "objects/object_toki_objects/object_toki_objects.h" +#include "soh/frame_interpolation.h" #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) @@ -521,6 +522,8 @@ void DemoKankyo_DrawRain(Actor* thisx, GlobalContext* globalCtx) { f32 translateY; f32 translateZ; s16 j; + static s32 epoch = 0; + epoch++; OPEN_DISPS(globalCtx->state.gfxCtx); @@ -594,6 +597,8 @@ void DemoKankyo_DrawRain(Actor* thisx, GlobalContext* globalCtx) { Matrix_Scale(sRainScale * 0.001f, sRainScale * 0.001f, sRainScale * 0.001f, MTXMODE_APPLY); for (j = 0; j < 5; j++) { + FrameInterpolation_RecordOpenChild("Kankyo Rain", epoch + i * j * 25); + s32 pad1; if (globalCtx->sceneNum != SCENE_TOKINOMA) { @@ -623,6 +628,8 @@ void DemoKankyo_DrawRain(Actor* thisx, GlobalContext* globalCtx) { G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); POLY_XLU_DISP = Gfx_CallSetupDL(POLY_XLU_DISP, 0x14); gSPDisplayList(POLY_XLU_DISP++, object_efc_star_field_DL_000080); + + FrameInterpolation_RecordCloseChild(); } } CLOSE_DISPS(globalCtx->state.gfxCtx); @@ -656,10 +663,14 @@ void DemoKankyo_DrawClouds(Actor* thisx, GlobalContext* globalCtx) { f32 dx; f32 dy; f32 dz; + static s32 epoch = 0; + epoch++; OPEN_DISPS(globalCtx->state.gfxCtx); for (i = 0; i < 30; i++) { + FrameInterpolation_RecordOpenChild("Kankyo Clouds", epoch + i * 25); + dx = -(Math_SinS(this->unk_150[i].unk_20 - 0x8000) * 120.0f) * (30.0f + (i / 30.0f) * 10.0f); dy = Math_CosS(this->unk_150[i].unk_20 - 0x8000) * 5.0f + 1200.0f; dz = (Math_CosS(this->unk_150[i].unk_20 - 0x8000) * 120.0f) * (30.0f + (i / 30.0f) * 10.0f); @@ -681,6 +692,8 @@ void DemoKankyo_DrawClouds(Actor* thisx, GlobalContext* globalCtx) { gSPMatrix(POLY_XLU_DISP++, SEG_ADDR(1, 0), G_MTX_NOPUSH | G_MTX_MUL | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gEffDustDL); + + FrameInterpolation_RecordCloseChild(); } CLOSE_DISPS(globalCtx->state.gfxCtx); @@ -771,6 +784,8 @@ void DemoKankyo_DrawWarpSparkles(Actor* thisx, GlobalContext* globalCtx) { f32 translateZ; PosRot posRot; u8 linkAge = gSaveContext.linkAge; + static s32 epoch = 0; + epoch++; OPEN_DISPS(globalCtx->state.gfxCtx); @@ -778,6 +793,8 @@ void DemoKankyo_DrawWarpSparkles(Actor* thisx, GlobalContext* globalCtx) { this->sparkleCounter += 2; } for (i = this->sparkleCounter - 1; i >= 0; i--) { + FrameInterpolation_RecordOpenChild("Kankyo Warp Sparkles", epoch + i * 25); + temp_f22 = 1.0f - (i / (f32)this->sparkleCounter); switch (this->unk_150[i].unk_22) { @@ -891,6 +908,8 @@ void DemoKankyo_DrawWarpSparkles(Actor* thisx, GlobalContext* globalCtx) { gSPDisplayList(POLY_XLU_DISP++, disp); this->unk_150[i].unk_24 += 0x190; } + + FrameInterpolation_RecordCloseChild(); } CLOSE_DISPS(globalCtx->state.gfxCtx); @@ -914,6 +933,8 @@ void DemoKankyo_DrawSparkles(Actor* thisx, GlobalContext* globalCtx) { f32 scale; s16 i; PosRot posRot; + static s32 epoch = 0; + epoch++; OPEN_DISPS(globalCtx->state.gfxCtx); @@ -922,6 +943,8 @@ void DemoKankyo_DrawSparkles(Actor* thisx, GlobalContext* globalCtx) { } for (i = this->sparkleCounter - 1; i >= 0; i--) { + FrameInterpolation_RecordOpenChild("Kankyo Sparkles", epoch + i * 25); + temp_f20 = 1.0f - (i / (f32)this->sparkleCounter); switch (this->unk_150[i].unk_22) { @@ -993,6 +1016,8 @@ void DemoKankyo_DrawSparkles(Actor* thisx, GlobalContext* globalCtx) { gSPDisplayList(POLY_XLU_DISP++, gEffFlash1DL); this->unk_150[i].unk_24 += 0x190; } + + FrameInterpolation_RecordCloseChild(); } CLOSE_DISPS(globalCtx->state.gfxCtx); diff --git a/soh/src/overlays/actors/ovl_Efc_Erupc/z_efc_erupc.c b/soh/src/overlays/actors/ovl_Efc_Erupc/z_efc_erupc.c index 08ceebc18..cf0159eed 100644 --- a/soh/src/overlays/actors/ovl_Efc_Erupc/z_efc_erupc.c +++ b/soh/src/overlays/actors/ovl_Efc_Erupc/z_efc_erupc.c @@ -1,5 +1,6 @@ #include "z_efc_erupc.h" #include "objects/object_efc_erupc/object_efc_erupc.h" +#include "soh/frame_interpolation.h" #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) @@ -167,6 +168,8 @@ void EfcErupc_DrawParticles(EfcErupcParticles* particles, GlobalContext* globalC OPEN_DISPS(gfxCtx); for (i = 0; i < EFC_ERUPC_NUM_PARTICLES; i++, particles++) { + FrameInterpolation_RecordOpenChild(particles, particles->epoch); + if (particles->isActive) { func_80093D84(globalCtx->state.gfxCtx); gSPDisplayList(POLY_XLU_DISP++, object_efc_erupc_DL_002760); @@ -181,7 +184,10 @@ void EfcErupc_DrawParticles(EfcErupcParticles* particles, GlobalContext* globalC G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, object_efc_erupc_DL_0027D8); } + + FrameInterpolation_RecordCloseChild(); } + CLOSE_DISPS(gfxCtx); } @@ -249,5 +255,6 @@ void EfcErupc_InitParticles(EfcErupcParticles* particles) { for (i = 0; i < EFC_ERUPC_NUM_PARTICLES; i++, particles++) { particles->isActive = false; + particles->epoch++; } } diff --git a/soh/src/overlays/actors/ovl_Efc_Erupc/z_efc_erupc.h b/soh/src/overlays/actors/ovl_Efc_Erupc/z_efc_erupc.h index 6b201cf5d..6e7fa6693 100644 --- a/soh/src/overlays/actors/ovl_Efc_Erupc/z_efc_erupc.h +++ b/soh/src/overlays/actors/ovl_Efc_Erupc/z_efc_erupc.h @@ -19,7 +19,8 @@ typedef struct { /* 0x30 */ char unk_2C[4]; /* 0x34 */ f32 scale; /* 0x38 */ char unk_34[8]; -} EfcErupcParticles; // size 0x3C + /* 0x3C */ s32 epoch; +} EfcErupcParticles; // size 0x40 #define EFC_ERUPC_NUM_PARTICLES 100 diff --git a/soh/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.c b/soh/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.c index 15704ef2d..e3af7ba4d 100644 --- a/soh/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.c +++ b/soh/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.c @@ -6,6 +6,7 @@ #include "z_eff_dust.h" #include "objects/gameplay_keep/gameplay_keep.h" +#include "soh/frame_interpolation.h" #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) @@ -268,6 +269,8 @@ void EffDust_DrawFunc_8099E4F4(Actor* thisx, GlobalContext* globalCtx2) { f32* distanceTraveled; s32 i; f32 aux; + static s32 epoch = 0; + epoch++; OPEN_DISPS(gfxCtx); @@ -283,6 +286,8 @@ void EffDust_DrawFunc_8099E4F4(Actor* thisx, GlobalContext* globalCtx2) { gSPSegment(POLY_XLU_DISP++, 0x08, sEmptyDL); for (i = 0; i < 64; i++) { + FrameInterpolation_RecordOpenChild("Dust 8099E4F4", epoch + i * 25); + if (*distanceTraveled < 1.0f) { aux = 1.0f - (*distanceTraveled * *distanceTraveled); Matrix_Translate(this->actor.world.pos.x + (initialPositions->x * ((this->dx * aux) + (1.0f - this->dx))), @@ -298,6 +303,8 @@ void EffDust_DrawFunc_8099E4F4(Actor* thisx, GlobalContext* globalCtx2) { gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gEffSparklesDL)); } + FrameInterpolation_RecordCloseChild(); + initialPositions++; distanceTraveled++; } @@ -314,6 +321,8 @@ void EffDust_DrawFunc_8099E784(Actor* thisx, GlobalContext* globalCtx2) { s32 i; f32 aux; Player* player = GET_PLAYER(globalCtx); + static s32 epoch = 0; + epoch++; OPEN_DISPS(gfxCtx); @@ -333,6 +342,8 @@ void EffDust_DrawFunc_8099E784(Actor* thisx, GlobalContext* globalCtx2) { gSPSegment(POLY_XLU_DISP++, 0x08, sEmptyDL); for (i = 0; i < 64; i++) { + FrameInterpolation_RecordOpenChild("Dust 8099E784", epoch + i * 25); + if (*distanceTraveled < 1.0f) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, *distanceTraveled * 255); @@ -357,6 +368,8 @@ void EffDust_DrawFunc_8099E784(Actor* thisx, GlobalContext* globalCtx2) { gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gEffSparklesDL)); } + FrameInterpolation_RecordCloseChild(); + initialPositions++; distanceTraveled++; } diff --git a/soh/src/overlays/actors/ovl_En_Anubice_Fire/z_en_anubice_fire.c b/soh/src/overlays/actors/ovl_En_Anubice_Fire/z_en_anubice_fire.c index 409dc2a3b..e01c093c6 100644 --- a/soh/src/overlays/actors/ovl_En_Anubice_Fire/z_en_anubice_fire.c +++ b/soh/src/overlays/actors/ovl_En_Anubice_Fire/z_en_anubice_fire.c @@ -7,6 +7,7 @@ #include "z_en_anubice_fire.h" #include "objects/gameplay_keep/gameplay_keep.h" #include "objects/object_anubice/object_anubice.h" +#include "soh/frame_interpolation.h" #define FLAGS ACTOR_FLAG_4 @@ -62,6 +63,7 @@ void EnAnubiceFire_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk_15A = 30; this->unk_154 = 2.0f; this->scale = 0.0f; + this->epoch++; for (i = 0; i < 6; i++) { this->unk_160[i] = this->actor.world.pos; @@ -230,6 +232,8 @@ void EnAnubiceFire_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_Push(); for (i = this->unk_15E; i < 6; ++i) { + FrameInterpolation_RecordOpenChild(this, this->epoch + i * 25); + f32 scale = this->actor.scale.x - (i * 0.2f); if (scale < 0.0f) { @@ -248,6 +252,8 @@ void EnAnubiceFire_Draw(Actor* thisx, GlobalContext* globalCtx) { gSPDisplayList(POLY_XLU_DISP++, gAnubiceFireAttackDL); } + FrameInterpolation_RecordCloseChild(); + if (this->scale < 0.1f) { break; } diff --git a/soh/src/overlays/actors/ovl_En_Anubice_Fire/z_en_anubice_fire.h b/soh/src/overlays/actors/ovl_En_Anubice_Fire/z_en_anubice_fire.h index 1ea831ffc..848bcdae9 100644 --- a/soh/src/overlays/actors/ovl_En_Anubice_Fire/z_en_anubice_fire.h +++ b/soh/src/overlays/actors/ovl_En_Anubice_Fire/z_en_anubice_fire.h @@ -19,6 +19,7 @@ typedef struct EnAnubiceFire { /* 0x015E */ s16 unk_15E; /* 0x0178 */ Vec3f unk_160[6]; /* 0x01A8 */ ColliderCylinder cylinder; -} EnAnubiceFire; // size = 0x01F4 + /* 0x01F4 */ s32 epoch; +} EnAnubiceFire; // size = 0x01F8 #endif diff --git a/soh/src/overlays/actors/ovl_En_Ba/z_en_ba.c b/soh/src/overlays/actors/ovl_En_Ba/z_en_ba.c index 6b06c50c4..c2a878288 100644 --- a/soh/src/overlays/actors/ovl_En_Ba/z_en_ba.c +++ b/soh/src/overlays/actors/ovl_En_Ba/z_en_ba.c @@ -6,6 +6,7 @@ #include "z_en_ba.h" #include "objects/object_bxa/object_bxa.h" +#include "soh/frame_interpolation.h" #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4) @@ -107,6 +108,7 @@ void EnBa_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.targetMode = 4; this->upperParams = (thisx->params >> 8) & 0xFF; thisx->params &= 0xFF; + this->epoch++; if (this->actor.params < EN_BA_DEAD_BLOB) { if (Flags_GetSwitch(globalCtx, this->upperParams)) { @@ -489,6 +491,8 @@ void EnBa_Draw(Actor* thisx, GlobalContext* globalCtx) { Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 16, 16, 1, 0, (globalCtx->gameplayFrames * -10) % 128, 32, 32)); for (i = 0; i < 14; i++, mtx++) { + FrameInterpolation_RecordOpenChild(this, this->epoch + i * 25); + Matrix_Translate(this->unk158[i].x, this->unk158[i].y, this->unk158[i].z, MTXMODE_NEW); Matrix_RotateZYX(this->unk2A8[i].x, this->unk2A8[i].y, this->unk2A8[i].z, MTXMODE_APPLY); Matrix_Scale(this->unk200[i].x, this->unk200[i].y, this->unk200[i].z, MTXMODE_APPLY); @@ -504,6 +508,8 @@ void EnBa_Draw(Actor* thisx, GlobalContext* globalCtx) { } } MATRIX_TOMTX(mtx); + + FrameInterpolation_RecordCloseChild(); } Matrix_Pop(); gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), diff --git a/soh/src/overlays/actors/ovl_En_Ba/z_en_ba.h b/soh/src/overlays/actors/ovl_En_Ba/z_en_ba.h index 008ec9597..a43c33e81 100644 --- a/soh/src/overlays/actors/ovl_En_Ba/z_en_ba.h +++ b/soh/src/overlays/actors/ovl_En_Ba/z_en_ba.h @@ -32,6 +32,7 @@ typedef struct EnBa { /* 0x031C */ s16 unk31C; /* 0x0320 */ ColliderJntSph collider; /* 0x0340 */ ColliderJntSphElement colliderItems[2]; -} EnBa; // size = 0x03C0 + /* 0x03C0 */ s32 epoch; +} EnBa; // size = 0x03C4 #endif diff --git a/soh/src/overlays/actors/ovl_En_Bx/z_en_bx.c b/soh/src/overlays/actors/ovl_En_Bx/z_en_bx.c index bd4fc5767..7c9749dd3 100644 --- a/soh/src/overlays/actors/ovl_En_Bx/z_en_bx.c +++ b/soh/src/overlays/actors/ovl_En_Bx/z_en_bx.c @@ -6,6 +6,7 @@ #include "z_en_bx.h" #include "objects/object_bxa/object_bxa.h" +#include "soh/frame_interpolation.h" #define FLAGS ACTOR_FLAG_4 @@ -103,6 +104,7 @@ void EnBx_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_Kill(&this->actor); } thisx->params &= 0xFF; + this->epoch++; } void EnBx_Destroy(Actor* thisx, GlobalContext* globalCtx) { @@ -235,10 +237,14 @@ void EnBx_Draw(Actor* thisx, GlobalContext* globalCtx) { } for (i = 0; i < 4; i++, mtx++) { + FrameInterpolation_RecordOpenChild(this, this->epoch + i * 25); + Matrix_Translate(this->unk_154[i].x, this->unk_154[i].y, this->unk_154[i].z, MTXMODE_NEW); Matrix_RotateZYX(this->unk_1B4[i].x, this->unk_1B4[i].y, this->unk_1B4[i].z, MTXMODE_APPLY); Matrix_Scale(this->unk_184[i].x, this->unk_184[i].y, this->unk_184[i].z, MTXMODE_APPLY); MATRIX_TOMTX(mtx); + + FrameInterpolation_RecordCloseChild(); } gSPDisplayList(POLY_OPA_DISP++, object_bxa_DL_0022F0); diff --git a/soh/src/overlays/actors/ovl_En_Bx/z_en_bx.h b/soh/src/overlays/actors/ovl_En_Bx/z_en_bx.h index 189349a0f..e842ce3a0 100644 --- a/soh/src/overlays/actors/ovl_En_Bx/z_en_bx.h +++ b/soh/src/overlays/actors/ovl_En_Bx/z_en_bx.h @@ -16,6 +16,7 @@ typedef struct EnBx { /* 0x01B4 */ Vec3s unk_1B4[4]; /* 0x01CC */ ColliderCylinder collider; /* 0x0218 */ ColliderQuad colliderQuad; -} EnBx; // size = 0x0298 + /* 0x0298 */ s32 epoch; +} EnBx; // size = 0x029C #endif diff --git a/soh/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.c b/soh/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.c index 90a838ad2..097250ff5 100644 --- a/soh/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.c +++ b/soh/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.c @@ -2,6 +2,8 @@ #include +#include "soh/frame_interpolation.h" + #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4 | ACTOR_FLAG_5) void EnClearTag_Init(Actor* thisx, GlobalContext* globalCtx); @@ -278,6 +280,7 @@ void EnClearTag_Init(Actor* thisx, GlobalContext* globalCtx) { globalCtx->specialEffects = &sClearTagEffects[0]; for (i = 0; i < CLEAR_TAG_EFFECT_MAX_COUNT; i++) { sClearTagEffects[i].type = CLEAR_TAG_EFFECT_AVAILABLE; + sClearTagEffects[i].epoch++; } this->drawMode = CLEAR_TAG_DRAW_MODE_ALL; } @@ -902,6 +905,8 @@ void EnClearTag_DrawEffects(GlobalContext* globalCtx) { // Draw all Debris effects. for (i = 0; i < CLEAR_TAG_EFFECT_MAX_COUNT; i++, effect++) { + FrameInterpolation_RecordOpenChild(effect, effect->epoch); + if (effect->type == CLEAR_TAG_EFFECT_DEBRIS) { // Apply the debris effect material if it has not already been applied. if (!isMaterialApplied) { @@ -918,6 +923,8 @@ void EnClearTag_DrawEffects(GlobalContext* globalCtx) { G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gArwingDebrisEffectDL); } + + FrameInterpolation_RecordCloseChild(); } // Draw all ground flash effects. @@ -925,6 +932,8 @@ void EnClearTag_DrawEffects(GlobalContext* globalCtx) { isMaterialApplied = false; for (i = 0; i < CLEAR_TAG_EFFECT_MAX_COUNT; i++, effect++) { if (effect->type == CLEAR_TAG_EFFECT_FLASH) { + FrameInterpolation_RecordOpenChild(effect, effect->epoch); + // Apply the flash ground effect material if it has not already been applied. if (!isMaterialApplied) { gDPPipeSync(POLY_XLU_DISP++); @@ -941,6 +950,8 @@ void EnClearTag_DrawEffects(GlobalContext* globalCtx) { gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gArwingFlashEffectGroundDL); + + FrameInterpolation_RecordCloseChild(); } } @@ -949,6 +960,8 @@ void EnClearTag_DrawEffects(GlobalContext* globalCtx) { isMaterialApplied = false; for (i = 0; i < CLEAR_TAG_EFFECT_MAX_COUNT; i++, effect++) { if (effect->type == CLEAR_TAG_EFFECT_SMOKE) { + FrameInterpolation_RecordOpenChild(effect, effect->epoch); + // Apply the smoke effect material if it has not already been applied. if (!isMaterialApplied) { gSPDisplayList(POLY_XLU_DISP++, gArwingFireEffectMaterialDL); @@ -970,6 +983,8 @@ void EnClearTag_DrawEffects(GlobalContext* globalCtx) { gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gArwingFireEffectDL); + + FrameInterpolation_RecordCloseChild(); } } @@ -978,6 +993,8 @@ void EnClearTag_DrawEffects(GlobalContext* globalCtx) { isMaterialApplied = false; for (i = 0; i < CLEAR_TAG_EFFECT_MAX_COUNT; i++, effect++) { if (effect->type == CLEAR_TAG_EFFECT_FIRE) { + FrameInterpolation_RecordOpenChild(effect, effect->epoch); + // Apply the fire effect material if it has not already been applied. if (!isMaterialApplied) { gSPDisplayList(POLY_XLU_DISP++, gArwingFireEffectMaterialDL); @@ -996,6 +1013,8 @@ void EnClearTag_DrawEffects(GlobalContext* globalCtx) { gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gArwingFireEffectDL); + + FrameInterpolation_RecordCloseChild(); } } @@ -1004,6 +1023,8 @@ void EnClearTag_DrawEffects(GlobalContext* globalCtx) { isMaterialApplied = false; for (i = 0; i < CLEAR_TAG_EFFECT_MAX_COUNT; i++, effect++) { if (effect->type == CLEAR_TAG_EFFECT_FLASH) { + FrameInterpolation_RecordOpenChild(effect, effect->epoch); + // Apply the flash billboard effect material if it has not already been applied. if (!isMaterialApplied) { gDPPipeSync(POLY_XLU_DISP++); @@ -1019,6 +1040,8 @@ void EnClearTag_DrawEffects(GlobalContext* globalCtx) { gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gArwingFlashEffectDL); + + FrameInterpolation_RecordCloseChild(); } } diff --git a/soh/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.h b/soh/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.h index 707fbb4a5..4c9b92584 100644 --- a/soh/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.h +++ b/soh/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.h @@ -88,7 +88,8 @@ typedef struct EnClearTagEffect { /* 0x0058 */ f32 rotationX; /* 0x005C */ f32 floorHeight; /* 0x0060 */ Vec3f floorTangent; -} EnClearTagEffect; // size = 0x6C + /* 0x006C */ s32 epoch; +} EnClearTagEffect; // size = 0x70 #define CLEAR_TAG_EFFECT_MAX_COUNT 100 diff --git a/soh/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c b/soh/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c index c5d1e649c..4f59f8982 100644 --- a/soh/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c +++ b/soh/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c @@ -2,6 +2,7 @@ #include "overlays/actors/ovl_En_Fire_Rock/z_en_fire_rock.h" #include "vt.h" #include "objects/object_efc_star_field/object_efc_star_field.h" +#include "soh/frame_interpolation.h" #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) @@ -303,6 +304,7 @@ void EnEncount2_ParticleInit(EnEncount2* this, Vec3f* particlePos, f32 scale) { particle->moveDirection.y = -20.0f; particle->moveDirection.z = Rand_CenteredFloat(20.0f); particle->isAlive = 1; + particle->epoch++; break; } } @@ -354,6 +356,8 @@ void EnEncount2_ParticleDraw(Actor* thisx, GlobalContext* globalCtx) { gSPSegment(POLY_OPA_DISP++, 0x06, globalCtx->objectCtx.status[objBankIndex].segment); for (i = 0; i < ARRAY_COUNT(this->particles); particle++, i++) { + FrameInterpolation_RecordOpenChild(particle, particle->epoch); + if (particle->isAlive) { Matrix_Translate(particle->pos.x, particle->pos.y, particle->pos.z, MTXMODE_NEW); Matrix_RotateX(particle->rot.x * (M_PI / 180.0f), MTXMODE_APPLY); @@ -366,6 +370,8 @@ void EnEncount2_ParticleDraw(Actor* thisx, GlobalContext* globalCtx) { G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, object_efc_star_field_DL_000DE0); } + + FrameInterpolation_RecordCloseChild(); } } diff --git a/soh/src/overlays/actors/ovl_En_Encount2/z_en_encount2.h b/soh/src/overlays/actors/ovl_En_Encount2/z_en_encount2.h index 302affd9a..b4c7db491 100644 --- a/soh/src/overlays/actors/ovl_En_Encount2/z_en_encount2.h +++ b/soh/src/overlays/actors/ovl_En_Encount2/z_en_encount2.h @@ -14,7 +14,8 @@ typedef struct { /* 0x0010 */ u8 isAlive; /* 0x0014 */ Vec3f moveDirection; /* 0x0020 */ Vec3f rot; -} EnEncount2Particle; // size = 0x2C + /* 0x002C */ s32 epoch; +} EnEncount2Particle; // size = 0x30 typedef struct EnEncount2 { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Fd/z_en_fd.c b/soh/src/overlays/actors/ovl_En_Fd/z_en_fd.c index cd3bd87e7..0cc83f4e0 100644 --- a/soh/src/overlays/actors/ovl_En_Fd/z_en_fd.c +++ b/soh/src/overlays/actors/ovl_En_Fd/z_en_fd.c @@ -7,6 +7,7 @@ #include "z_en_fd.h" #include "objects/gameplay_keep/gameplay_keep.h" #include "objects/object_fw/object_fw.h" +#include "soh/frame_interpolation.h" #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4 | ACTOR_FLAG_9) @@ -812,6 +813,7 @@ void EnFd_AddEffect(EnFd* this, u8 type, Vec3f* pos, Vec3f* velocity, Vec3f* acc eff->color.a = 255; eff->timer = (s16)(Rand_ZeroOne() * 10.0f); } + eff->epoch++; return; } } @@ -886,6 +888,8 @@ void EnFd_DrawFlames(EnFd* this, GlobalContext* globalCtx) { func_80093D84(globalCtx->state.gfxCtx); for (i = 0; i < ARRAY_COUNT(this->effects); i++, eff++) { if (eff->type == FD_EFFECT_FLAME) { + FrameInterpolation_RecordOpenChild(eff, eff->epoch); + if (!firstDone) { POLY_XLU_DISP = Gfx_CallSetupDL(POLY_XLU_DISP, 0); gSPDisplayList(POLY_XLU_DISP++, gFlareDancerDL_7928); @@ -902,8 +906,11 @@ void EnFd_DrawFlames(EnFd* this, GlobalContext* globalCtx) { idx = eff->timer * (8.0f / eff->initialTimer); gSPSegment(POLY_XLU_DISP++, 0x8, SEGMENTED_TO_VIRTUAL(dustTextures[idx])); gSPDisplayList(POLY_XLU_DISP++, gFlareDancerSquareParticleDL); + + FrameInterpolation_RecordCloseChild(); } } + CLOSE_DISPS(globalCtx->state.gfxCtx); } @@ -919,6 +926,8 @@ void EnFd_DrawDots(EnFd* this, GlobalContext* globalCtx) { for (i = 0; i < ARRAY_COUNT(this->effects); i++, eff++) { if (eff->type == FD_EFFECT_DOT) { + FrameInterpolation_RecordOpenChild(eff, eff->epoch); + if (!firstDone) { func_80093D84(globalCtx->state.gfxCtx); gSPDisplayList(POLY_XLU_DISP++, gFlareDancerDL_79F8); @@ -933,6 +942,8 @@ void EnFd_DrawDots(EnFd* this, GlobalContext* globalCtx) { gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gFlareDancerTriangleParticleDL); + + FrameInterpolation_RecordCloseChild(); } } diff --git a/soh/src/overlays/actors/ovl_En_Fd/z_en_fd.h b/soh/src/overlays/actors/ovl_En_Fd/z_en_fd.h index a00b622c9..7dc990a7e 100644 --- a/soh/src/overlays/actors/ovl_En_Fd/z_en_fd.h +++ b/soh/src/overlays/actors/ovl_En_Fd/z_en_fd.h @@ -25,6 +25,7 @@ typedef struct { /* 0x0014 */ Vec3f pos; /* 0x0020 */ Vec3f velocity; /* 0x002C */ Vec3f accel; + s32 epoch; } EnFdEffect; // size = 0x38 typedef struct EnFd { diff --git a/soh/src/overlays/actors/ovl_En_Fw/z_en_fw.c b/soh/src/overlays/actors/ovl_En_Fw/z_en_fw.c index c0f0a048c..23073ed1a 100644 --- a/soh/src/overlays/actors/ovl_En_Fw/z_en_fw.c +++ b/soh/src/overlays/actors/ovl_En_Fw/z_en_fw.c @@ -8,6 +8,7 @@ #include "objects/object_fw/object_fw.h" #include "overlays/actors/ovl_En_Bom/z_en_bom.h" #include "objects/gameplay_keep/gameplay_keep.h" +#include "soh/frame_interpolation.h" #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4 | ACTOR_FLAG_9) @@ -421,6 +422,7 @@ void EnFw_AddDust(EnFw* this, Vec3f* initialPos, Vec3f* initialSpeed, Vec3f* acc eff->pos = *initialPos; eff->accel = *accel; eff->velocity = *initialSpeed; + eff->epoch++; return; } } @@ -464,6 +466,8 @@ void EnFw_DrawDust(EnFw* this, GlobalContext* globalCtx) { func_80093D84(globalCtx->state.gfxCtx); for (i = 0; i < ARRAY_COUNT(this->effects); i++, eff++) { + FrameInterpolation_RecordOpenChild(eff, eff->epoch); + if (eff->type != 0) { if (!firstDone) { POLY_XLU_DISP = Gfx_CallSetupDL(POLY_XLU_DISP, 0U); @@ -484,6 +488,8 @@ void EnFw_DrawDust(EnFw* this, GlobalContext* globalCtx) { gSPSegment(POLY_XLU_DISP++, 0x8, SEGMENTED_TO_VIRTUAL(dustTextures[idx])); gSPDisplayList(POLY_XLU_DISP++, gFlareDancerSquareParticleDL); } + + FrameInterpolation_RecordCloseChild(); } CLOSE_DISPS(globalCtx->state.gfxCtx); diff --git a/soh/src/overlays/actors/ovl_En_Fw/z_en_fw.h b/soh/src/overlays/actors/ovl_En_Fw/z_en_fw.h index f7d245e5e..0230a2c3d 100644 --- a/soh/src/overlays/actors/ovl_En_Fw/z_en_fw.h +++ b/soh/src/overlays/actors/ovl_En_Fw/z_en_fw.h @@ -19,6 +19,7 @@ typedef struct { /* 0x0014 */ Vec3f pos; /* 0x0020 */ Vec3f velocity; /* 0x002C */ Vec3f accel; + s32 epoch; } EnFwEffect; typedef struct EnFw { diff --git a/soh/src/overlays/actors/ovl_En_Fz/z_en_fz.c b/soh/src/overlays/actors/ovl_En_Fz/z_en_fz.c index 5381efc5b..7ee3412b6 100644 --- a/soh/src/overlays/actors/ovl_En_Fz/z_en_fz.c +++ b/soh/src/overlays/actors/ovl_En_Fz/z_en_fz.c @@ -1,5 +1,6 @@ #include "z_en_fz.h" #include "objects/object_fz/object_fz.h" +#include "soh/frame_interpolation.h" #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4 | ACTOR_FLAG_10) @@ -756,6 +757,7 @@ void EnFz_SpawnIceSmokeNoFreeze(EnFz* this, Vec3f* pos, Vec3f* velocity, Vec3f* iceSmoke->xyScale = xyScale / 1000.0f; iceSmoke->primAlpha = 0; iceSmoke->timer = 0; + iceSmoke->epoch++; break; } @@ -780,6 +782,7 @@ void EnFz_SpawnIceSmokeFreeze(EnFz* this, Vec3f* pos, Vec3f* velocity, Vec3f* ac iceSmoke->primAlpha = primAlpha; iceSmoke->timer = 0; iceSmoke->isTimerMod8 = isTimerMod8; + iceSmoke->epoch++; break; } @@ -864,6 +867,8 @@ void EnFz_DrawIceSmoke(EnFz* this, GlobalContext* globalCtx) { func_80093D84(globalCtx->state.gfxCtx); for (i = 0; i < ARRAY_COUNT(this->iceSmoke); i++) { + FrameInterpolation_RecordOpenChild(iceSmoke, iceSmoke->epoch); + if (iceSmoke->type > 0) { gDPPipeSync(POLY_XLU_DISP++); @@ -884,6 +889,8 @@ void EnFz_DrawIceSmoke(EnFz* this, GlobalContext* globalCtx) { gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gFreezardSteamDL)); } + FrameInterpolation_RecordCloseChild(); + iceSmoke++; } diff --git a/soh/src/overlays/actors/ovl_En_Fz/z_en_fz.h b/soh/src/overlays/actors/ovl_En_Fz/z_en_fz.h index 536d2525f..471a2fce2 100644 --- a/soh/src/overlays/actors/ovl_En_Fz/z_en_fz.h +++ b/soh/src/overlays/actors/ovl_En_Fz/z_en_fz.h @@ -21,6 +21,7 @@ typedef struct { /* 0x0030 */ f32 xyScale; // /* 0x0034 */ f32 xyScaleTarget; /* 0x0038 */ u8 isTimerMod8; // conditional, used to run CollisionCheck_SetAT + s32 epoch; } EnFzEffectSsIceSmoke; // size = 0x3C typedef struct EnFz { diff --git a/soh/src/overlays/actors/ovl_En_G_Switch/z_en_g_switch.c b/soh/src/overlays/actors/ovl_En_G_Switch/z_en_g_switch.c index 93c1061d7..f4740dbb3 100644 --- a/soh/src/overlays/actors/ovl_En_G_Switch/z_en_g_switch.c +++ b/soh/src/overlays/actors/ovl_En_G_Switch/z_en_g_switch.c @@ -12,6 +12,7 @@ #include "objects/gameplay_keep/gameplay_keep.h" #include "objects/object_tsubo/object_tsubo.h" #include "objects/object_gi_rupy/object_gi_rupy.h" +#include "soh/frame_interpolation.h" #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) @@ -533,6 +534,7 @@ void EnGSwitch_SpawnEffects(EnGSwitch* this, Vec3f* pos, s16 scale, s16 colorIdx f32 pitch; f32 yaw; + effect->epoch++; effect->pos = *pos; effect->scale = scale; effect->colorIdx = colorIdx; @@ -590,6 +592,7 @@ void EnGSwitch_DrawEffects(EnGSwitch* this, GlobalContext* globalCtx) { func_80093D18(globalCtx->state.gfxCtx); for (i = 0; i < this->numEffects; i++, effect++) { if (effect->flag) { + FrameInterpolation_RecordOpenChild(effect, effect->epoch); scale = effect->scale / 10000.0f; Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW); Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); @@ -600,6 +603,7 @@ void EnGSwitch_DrawEffects(EnGSwitch* this, GlobalContext* globalCtx) { G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sRupeeTextures[effect->colorIdx])); gSPDisplayList(POLY_OPA_DISP++, gRupeeDL); + FrameInterpolation_RecordCloseChild(); } } CLOSE_DISPS(gfxCtx); diff --git a/soh/src/overlays/actors/ovl_En_G_Switch/z_en_g_switch.h b/soh/src/overlays/actors/ovl_En_G_Switch/z_en_g_switch.h index dba5b09c0..366a7d120 100644 --- a/soh/src/overlays/actors/ovl_En_G_Switch/z_en_g_switch.h +++ b/soh/src/overlays/actors/ovl_En_G_Switch/z_en_g_switch.h @@ -32,6 +32,7 @@ typedef struct { /* 0x12 */ u8 flag; /* 0x14 */ Vec3f velocity; /* 0x20 */ Vec3f rot; + s32 epoch; } EnGSwitchEffect; // size = 0x2C typedef struct EnGSwitch { diff --git a/soh/src/overlays/actors/ovl_En_Gb/z_en_gb.c b/soh/src/overlays/actors/ovl_En_Gb/z_en_gb.c index a92ef3d6d..31fe04e90 100644 --- a/soh/src/overlays/actors/ovl_En_Gb/z_en_gb.c +++ b/soh/src/overlays/actors/ovl_En_Gb/z_en_gb.c @@ -6,6 +6,7 @@ #include "z_en_gb.h" #include "objects/object_ps/object_ps.h" +#include "soh/frame_interpolation.h" #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3) @@ -184,6 +185,7 @@ void EnGb_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionTimer = (s16)Rand_ZeroFloat(100.0f) + 100; for (i = 0; i < ARRAY_COUNT(sCagedSoulPositions); i++) { + this->cagedSouls[i].epoch++; this->cagedSouls[i].infoIdx = (s32)Rand_ZeroFloat(30.0f) % 3; this->cagedSouls[i].unk_14.x = this->cagedSouls[i].translation.x = sCagedSoulPositions[i].x + this->dyna.actor.world.pos.x; @@ -524,6 +526,7 @@ void EnGb_DrawCagedSouls(EnGb* this, GlobalContext* globalCtx) { for (i = 0; i < 4; i++) { s32 idx = this->cagedSouls[i].infoIdx; + FrameInterpolation_RecordOpenChild(&this->cagedSouls[i], this->cagedSouls[i].epoch); gSPSegment(POLY_XLU_DISP++, 0x08, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 32, 64, 1, 0, (u32)(sCagedSoulInfo[idx].timerMultiplier * this->frameTimer) % 512, 32, 128)); @@ -548,6 +551,7 @@ void EnGb_DrawCagedSouls(EnGb* this, GlobalContext* globalCtx) { gSPDisplayList(POLY_XLU_DISP++, gPoeSellerCagedSoulDL); Matrix_Pop(); + FrameInterpolation_RecordCloseChild(); } CLOSE_DISPS(globalCtx->state.gfxCtx); diff --git a/soh/src/overlays/actors/ovl_En_Gb/z_en_gb.h b/soh/src/overlays/actors/ovl_En_Gb/z_en_gb.h index 5de160ff2..48908d7e5 100644 --- a/soh/src/overlays/actors/ovl_En_Gb/z_en_gb.h +++ b/soh/src/overlays/actors/ovl_En_Gb/z_en_gb.h @@ -27,6 +27,7 @@ typedef struct { /* 0x20 */ f32 unk_20; /* 0x24 */ f32 unk_24; /* 0x28 */ f32 unk_28; + s32 epoch; } EnGbCagedSoul; // size = 0x2C typedef struct EnGb { diff --git a/soh/src/overlays/actors/ovl_En_Go/z_en_go.c b/soh/src/overlays/actors/ovl_En_Go/z_en_go.c index 050bfc4d1..e1179fe1b 100644 --- a/soh/src/overlays/actors/ovl_En_Go/z_en_go.c +++ b/soh/src/overlays/actors/ovl_En_Go/z_en_go.c @@ -2,6 +2,7 @@ #include "overlays/actors/ovl_En_Bom/z_en_bom.h" #include "objects/gameplay_keep/gameplay_keep.h" #include "objects/object_oF1d_map/object_oF1d_map.h" +#include "soh/frame_interpolation.h" #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3 | ACTOR_FLAG_4 | ACTOR_FLAG_5) @@ -1133,11 +1134,9 @@ void EnGo_Draw(Actor* thisx, GlobalContext* globalCtx) { if (this->actionFunc == EnGo_CurledUp) { EnGo_DrawCurledUp(this, globalCtx); - return; // needed for match? } else if (this->actionFunc == EnGo_GoronLinkRolling || this->actionFunc == func_80A3FEB4 || this->actionFunc == EnGo_StopRolling || this->actionFunc == func_80A3FEB4) { EnGo_DrawRolling(this, globalCtx); - return; // needed for match? } else { func_800943C8(globalCtx->state.gfxCtx); @@ -1146,9 +1145,9 @@ void EnGo_Draw(Actor* thisx, GlobalContext* globalCtx) { SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnGo_OverrideLimbDraw, EnGo_PostLimbDraw, &this->actor); - CLOSE_DISPS(globalCtx->state.gfxCtx); EnGo_DrawDust(this, globalCtx); } + CLOSE_DISPS(globalCtx->state.gfxCtx); } void EnGo_AddDust(EnGo* this, Vec3f* pos, Vec3f* velocity, Vec3f* accel, u8 initialTimer, f32 scale, f32 scaleStep) { @@ -1158,6 +1157,7 @@ void EnGo_AddDust(EnGo* this, Vec3f* pos, Vec3f* velocity, Vec3f* accel, u8 init for (i = 0; i < ARRAY_COUNT(this->dustEffects); i++, dustEffect++) { if (dustEffect->type != 1) { + dustEffect->epoch++; dustEffect->scale = scale; dustEffect->scaleStep = scaleStep; timer = initialTimer; @@ -1218,6 +1218,7 @@ void EnGo_DrawDust(EnGo* this, GlobalContext* globalCtx) { firstDone = true; } + FrameInterpolation_RecordOpenChild(dustEffect, dustEffect->epoch); alpha = dustEffect->timer * (255.0f / dustEffect->initialTimer); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 170, 130, 90, alpha); gDPPipeSync(POLY_XLU_DISP++); @@ -1230,6 +1231,7 @@ void EnGo_DrawDust(EnGo* this, GlobalContext* globalCtx) { index = dustEffect->timer * (8.0f / dustEffect->initialTimer); gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(dustTex[index])); gSPDisplayList(POLY_XLU_DISP++, gGoronDL_00FD50); + FrameInterpolation_RecordCloseChild(); } } CLOSE_DISPS(globalCtx->state.gfxCtx); diff --git a/soh/src/overlays/actors/ovl_En_Go/z_en_go.h b/soh/src/overlays/actors/ovl_En_Go/z_en_go.h index 2aef4b168..94bad5bab 100644 --- a/soh/src/overlays/actors/ovl_En_Go/z_en_go.h +++ b/soh/src/overlays/actors/ovl_En_Go/z_en_go.h @@ -34,6 +34,7 @@ typedef struct { /* 0x0014 */ Vec3f pos; /* 0x0020 */ Vec3f velocity; /* 0x002C */ Vec3f accel; + s32 epoch; } EnGoEffect; // size = 0x38 typedef struct EnGo { diff --git a/soh/src/overlays/actors/ovl_En_Go2/z_en_go2.c b/soh/src/overlays/actors/ovl_En_Go2/z_en_go2.c index 4ea819f33..22c19f5f0 100644 --- a/soh/src/overlays/actors/ovl_En_Go2/z_en_go2.c +++ b/soh/src/overlays/actors/ovl_En_Go2/z_en_go2.c @@ -2,6 +2,7 @@ #include "overlays/actors/ovl_En_Bom/z_en_bom.h" #include "objects/gameplay_keep/gameplay_keep.h" #include "objects/object_oF1d_map/object_oF1d_map.h" +#include "soh/frame_interpolation.h" #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3 | ACTOR_FLAG_4 | ACTOR_FLAG_5) @@ -140,8 +141,6 @@ typedef enum { /* 10 */ ENGO2_ANIM_10, /* 11 */ ENGO2_ANIM_11, /* 12 */ ENGO2_ANIM_12, - /* 13 */ ENGO2_ANIM_13, // Fixed Goron Wakeup Animation - /* 14 */ ENGO2_ANIM_14 // Fixed Biggoron Wakeup Animation } EnGo2Animation; static AnimationInfo sAnimationInfo[] = { @@ -151,8 +150,7 @@ static AnimationInfo sAnimationInfo[] = { { &gGoronAnim_002D80, 1.0f, 0.0f, -1.0f, 0x02, -8.0f }, { &gGoronAnim_00161C, 1.0f, 0.0f, -1.0f, 0x00, -8.0f }, { &gGoronAnim_001A00, 1.0f, 0.0f, -1.0f, 0x00, -8.0f }, { &gGoronAnim_0021D0, 1.0f, 0.0f, -1.0f, 0x00, -8.0f }, { &gGoronAnim_004930, 0.0f, 0.0f, -1.0f, 0x01, -8.0f }, { &gGoronAnim_000750, 1.0f, 0.0f, -1.0f, 0x00, -8.0f }, - { &gGoronAnim_000D5C, 1.0f, 0.0f, -1.0f, 0x00, -8.0f }, { &gGoronAnim_004930, 0.0f, 0.0f, -1.0f, 0x00, 0.0f }, - { &gGoronAnim_004930, 0.0f, 1.0f, -1.0f, 0x01, 0.0f }, + { &gGoronAnim_000D5C, 1.0f, 0.0f, -1.0f, 0x00, -8.0f }, }; static EnGo2DustEffectData sDustEffectData[2][4] = { @@ -179,6 +177,7 @@ void EnGo2_AddDust(EnGo2* this, Vec3f* pos, Vec3f* velocity, Vec3f* accel, u8 in for (i = 0; i < ARRAY_COUNT(this->dustEffects); i++, dustEffect++) { if (dustEffect->type != 1) { + dustEffect->epoch++; dustEffect->scale = scale; dustEffect->scaleStep = scaleStep; timer = initialTimer; @@ -239,6 +238,7 @@ void EnGo2_DrawDust(EnGo2* this, GlobalContext* globalCtx) { firstDone = true; } + FrameInterpolation_RecordOpenChild(dustEffect, dustEffect->epoch); alpha = dustEffect->timer * (255.0f / dustEffect->initialTimer); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 170, 130, 90, alpha); gDPPipeSync(POLY_XLU_DISP++); @@ -250,6 +250,7 @@ void EnGo2_DrawDust(EnGo2* this, GlobalContext* globalCtx) { index = dustEffect->timer * (8.0f / dustEffect->initialTimer); gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sDustTex[index])); gSPDisplayList(POLY_XLU_DISP++, gGoronDL_00FD50); + FrameInterpolation_RecordCloseChild(); } } @@ -1344,10 +1345,10 @@ void EnGo2_WakeUp(EnGo2* this, GlobalContext* globalCtx) { } if ((this->actor.params & 0x1F) == GORON_DMT_BIGGORON) { OnePointCutscene_Init(globalCtx, 4200, -99, &this->actor, MAIN_CAM); - Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ((CVar_GetS32("gGoronSpeen", 0) == 1) ? ENGO2_ANIM_10 : ENGO2_ANIM_14)); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENGO2_ANIM_10); this->skelAnime.playSpeed = 0.5f; } else { - Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ((CVar_GetS32("gGoronSpeen", 0) == 1) ? ENGO2_ANIM_1 : ENGO2_ANIM_13)); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENGO2_ANIM_1); this->skelAnime.playSpeed = 1.0f; } this->actionFunc = func_80A46B40; diff --git a/soh/src/overlays/actors/ovl_En_Niw/z_en_niw.c b/soh/src/overlays/actors/ovl_En_Niw/z_en_niw.c index 816d485b7..82c52f724 100644 --- a/soh/src/overlays/actors/ovl_En_Niw/z_en_niw.c +++ b/soh/src/overlays/actors/ovl_En_Niw/z_en_niw.c @@ -8,6 +8,7 @@ #include "objects/object_niw/object_niw.h" #include "overlays/actors/ovl_En_Attack_Niw/z_en_attack_niw.h" #include "vt.h" +#include "soh/frame_interpolation.h" #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_23) @@ -1145,6 +1146,7 @@ void EnNiw_FeatherSpawn(EnNiw* this, Vec3f* pos, Vec3f* vel, Vec3f* accel, f32 s for (i = 0; i < ARRAY_COUNT(this->feathers); i++, feather++) { if (feather->type == 0) { + feather->epoch++; feather->type = 1; feather->pos = *pos; feather->vel = *vel; @@ -1202,6 +1204,7 @@ void EnNiw_FeatherDraw(EnNiw* this, GlobalContext* globalCtx) { for (i = 0; i < ARRAY_COUNT(this->feathers); i++, feather++) { if (feather->type == 1) { + FrameInterpolation_RecordOpenChild(feather, feather->epoch); if (!flag) { gSPDisplayList(POLY_XLU_DISP++, gCuccoParticleAppearDL); flag++; @@ -1214,6 +1217,7 @@ void EnNiw_FeatherDraw(EnNiw* this, GlobalContext* globalCtx) { gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gCuccoParticleAliveDL); + FrameInterpolation_RecordCloseChild(); } } diff --git a/soh/src/overlays/actors/ovl_En_Niw/z_en_niw.h b/soh/src/overlays/actors/ovl_En_Niw/z_en_niw.h index d02732496..78d52af33 100644 --- a/soh/src/overlays/actors/ovl_En_Niw/z_en_niw.h +++ b/soh/src/overlays/actors/ovl_En_Niw/z_en_niw.h @@ -18,6 +18,7 @@ typedef struct { /* 0x002C */ f32 scale; /* 0x0030 */ f32 unk_30; /* 0x0034 */ u8 timer; + s32 epoch; } EnNiwFeather; // size = 0x0038 typedef struct EnNiw { diff --git a/soh/src/overlays/actors/ovl_En_Nwc/z_en_nwc.c b/soh/src/overlays/actors/ovl_En_Nwc/z_en_nwc.c index 129e62d5b..b2db1621a 100644 --- a/soh/src/overlays/actors/ovl_En_Nwc/z_en_nwc.c +++ b/soh/src/overlays/actors/ovl_En_Nwc/z_en_nwc.c @@ -6,6 +6,7 @@ #include "z_en_nwc.h" #include "objects/object_nwc/object_nwc.h" +#include "soh/frame_interpolation.h" #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) @@ -170,6 +171,7 @@ void EnNwc_DrawChicks(EnNwc* this, GlobalContext* globalCtx) { if (chick->type != CHICK_NONE) { Mtx* mtx; + FrameInterpolation_RecordOpenChild(chick, chick->epoch); Matrix_SetTranslateRotateYXZ(chick->pos.x, chick->pos.y + chick->height, chick->pos.z, &chick->rot); Matrix_Scale(0.01f, 0.01f, 0.01f, MTXMODE_APPLY); mtx = MATRIX_NEWMTX(globalCtx->state.gfxCtx); @@ -180,6 +182,7 @@ void EnNwc_DrawChicks(EnNwc* this, GlobalContext* globalCtx) { gSPDisplayList(dList2++, gCuccoChickEyesDL); gSPMatrix(dList3++, mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(dList3++, gCuccoChickBeakDL); + FrameInterpolation_RecordCloseChild(); } } @@ -190,6 +193,7 @@ void EnNwc_DrawChicks(EnNwc* this, GlobalContext* globalCtx) { for (i = 0; i < this->count; i++, chick++) { if ((chick->type != CHICK_NONE) && (chick->floorPoly != NULL)) { + FrameInterpolation_RecordOpenChild(chick, chick->epoch * 25); func_80038A28(chick->floorPoly, chick->pos.x, chick->floorY, chick->pos.z, &floorMat); Matrix_Put(&floorMat); Matrix_RotateY(chick->rot.y * (M_PI / 0x8000), MTXMODE_APPLY); @@ -197,6 +201,7 @@ void EnNwc_DrawChicks(EnNwc* this, GlobalContext* globalCtx) { gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gCuccoChickShadowDL); + FrameInterpolation_RecordCloseChild(); } } CLOSE_DISPS(globalCtx->state.gfxCtx); @@ -220,6 +225,7 @@ void EnNwc_Init(Actor* thisx, GlobalContext* globalCtx) { this->count = 16; chick = this->chicks; for (i = 0; i < this->count; i++, chick++) { + chick->epoch++; chick->type = CHICK_NORMAL; chick->pos.x = thisx->world.pos.x + ((Rand_ZeroOne() * 100.0f) - 50.0f); chick->pos.y = thisx->world.pos.y + 20.0f; diff --git a/soh/src/overlays/actors/ovl_En_Nwc/z_en_nwc.h b/soh/src/overlays/actors/ovl_En_Nwc/z_en_nwc.h index 0597ce76c..fa57bb2f3 100644 --- a/soh/src/overlays/actors/ovl_En_Nwc/z_en_nwc.h +++ b/soh/src/overlays/actors/ovl_En_Nwc/z_en_nwc.h @@ -23,6 +23,7 @@ typedef struct EnNwcChick { /* 0x36 */ u16 height; /* 0x38 */ CollisionPoly* floorPoly; /* 0x44 */ char unk_3C[0x20]; + s32 epoch; } EnNwcChick; // size = 0x5C typedef struct EnNwc { diff --git a/soh/src/overlays/actors/ovl_En_Ny/z_en_ny.c b/soh/src/overlays/actors/ovl_En_Ny/z_en_ny.c index 7d81a324a..a5831e3ec 100644 --- a/soh/src/overlays/actors/ovl_En_Ny/z_en_ny.c +++ b/soh/src/overlays/actors/ovl_En_Ny/z_en_ny.c @@ -1,5 +1,6 @@ #include "z_en_ny.h" #include "objects/object_ny/object_ny.h" +#include "soh/frame_interpolation.h" #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2) @@ -107,6 +108,7 @@ static InitChainEntry sInitChain[] = { void EnNy_Init(Actor* thisx, GlobalContext* globalCtx) { EnNy* this = (EnNy*)thisx; + this->epoch++; Actor_ProcessInitChain(&this->actor, sInitChain); this->actor.colChkInfo.damageTable = &sDamageTable; this->actor.colChkInfo.health = 2; @@ -577,6 +579,7 @@ void EnNy_DrawDeathEffect(Actor* thisx, GlobalContext* globalCtx) { gDPPipeSync(POLY_OPA_DISP++); for (i = 0; i < 8; i++) { if (this->timer < (i + 22)) { + FrameInterpolation_RecordOpenChild(this, this->epoch + i * 25); temp = &this->unk_1F8[i]; Matrix_Translate(temp->x, temp->y, temp->z, MTXMODE_NEW); scale = this->actor.scale.x * 0.4f * (1.0f + (i * 0.04f)); @@ -584,6 +587,7 @@ void EnNy_DrawDeathEffect(Actor* thisx, GlobalContext* globalCtx) { gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gEnNyRockBodyDL); + FrameInterpolation_RecordCloseChild(); } } CLOSE_DISPS(globalCtx->state.gfxCtx); diff --git a/soh/src/overlays/actors/ovl_En_Ny/z_en_ny.h b/soh/src/overlays/actors/ovl_En_Ny/z_en_ny.h index fd93efcdb..ebc358254 100644 --- a/soh/src/overlays/actors/ovl_En_Ny/z_en_ny.h +++ b/soh/src/overlays/actors/ovl_En_Ny/z_en_ny.h @@ -30,6 +30,7 @@ typedef struct EnNy { /* 0x01F0 */ f32 unk_1F0; /* 0x01F4 */ f32 unk_1F4; /* 0x01F8 */ Vec3f unk_1F8[16]; + s32 epoch; } EnNy; // size = 0x02B8 #endif diff --git a/soh/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c b/soh/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c index 807292c24..d66cdae6c 100644 --- a/soh/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c +++ b/soh/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c @@ -7,6 +7,7 @@ #include "z_en_po_sisters.h" #include "objects/gameplay_keep/gameplay_keep.h" #include "objects/object_po_sisters/object_po_sisters.h" +#include "soh/frame_interpolation.h" #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4 | ACTOR_FLAG_9 | ACTOR_FLAG_12 | ACTOR_FLAG_14) @@ -179,6 +180,8 @@ void EnPoSisters_Init(Actor* thisx, GlobalContext* globalCtx) { EnPoSisters* this = (EnPoSisters*)thisx; s32 pad; + this->epoch++; + // Skip Poe Intro Cutscene if (gSaveContext.n64ddFlag && thisx->params == 4124) { Flags_SetSwitch(globalCtx, 0x1B); @@ -1186,7 +1189,7 @@ void EnPoSisters_Update(Actor* thisx, GlobalContext* globalCtx) { s32 pad; EnPoSisters* this = (EnPoSisters*)thisx; s16 temp; - + if (this->collider.base.atFlags & AT_HIT) { this->collider.base.atFlags &= ~AT_HIT; func_80AD9568(this); @@ -1413,6 +1416,7 @@ void EnPoSisters_Draw(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc != func_80ADBEE8) { phi_s5 = -i * 31 + 248; } + FrameInterpolation_RecordOpenChild(this, this->epoch + i * 25); gDPPipeSync(POLY_XLU_DISP++); gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, temp_s7->r, temp_s7->g, temp_s7->b, phi_s5); Matrix_Translate(this->unk_234[i].x, this->unk_234[i].y, this->unk_234[i].z, MTXMODE_NEW); @@ -1425,6 +1429,7 @@ void EnPoSisters_Draw(Actor* thisx, GlobalContext* globalCtx) { gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gEffFire1DL); + FrameInterpolation_RecordCloseChild(); } CLOSE_DISPS(globalCtx->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.h b/soh/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.h index 2b3b7446a..cc55a1dc9 100644 --- a/soh/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.h +++ b/soh/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.h @@ -29,6 +29,7 @@ typedef struct EnPoSisters { /* 0x029C */ LightInfo lightInfo; /* 0x02AC */ ColliderCylinder collider; /* 0x02F8 */ MtxF unk_2F8; + s32 epoch; } EnPoSisters; // size = 0x0338 #endif diff --git a/soh/src/overlays/actors/ovl_En_Syateki_Niw/z_en_syateki_niw.c b/soh/src/overlays/actors/ovl_En_Syateki_Niw/z_en_syateki_niw.c index d8e680d90..a21e47ab7 100644 --- a/soh/src/overlays/actors/ovl_En_Syateki_Niw/z_en_syateki_niw.c +++ b/soh/src/overlays/actors/ovl_En_Syateki_Niw/z_en_syateki_niw.c @@ -7,6 +7,7 @@ #include "z_en_syateki_niw.h" #include "objects/object_niw/object_niw.h" #include "vt.h" +#include "soh/frame_interpolation.h" #define FLAGS ACTOR_FLAG_4 @@ -713,6 +714,7 @@ void func_80B131B8(EnSyatekiNiw* this, Vec3f* arg1, Vec3f* arg2, Vec3f* arg3, f3 for (i = 0; i < 5; i++, ptr++) { if (ptr->unk_00 == 0) { + ptr->epoch++; ptr->unk_00 = 1; ptr->unk_04 = *arg1; ptr->unk_10 = *arg2; @@ -773,6 +775,7 @@ void func_80B13464(EnSyatekiNiw* this, GlobalContext* globalCtx) { flag++; } + FrameInterpolation_RecordOpenChild(ptr, ptr->epoch); Matrix_Translate(ptr->unk_04.x, ptr->unk_04.y, ptr->unk_04.z, MTXMODE_NEW); Matrix_ReplaceRotation(&globalCtx->billboardMtxF); Matrix_Scale(ptr->unk_2C, ptr->unk_2C, 1.0f, MTXMODE_APPLY); @@ -782,6 +785,7 @@ void func_80B13464(EnSyatekiNiw* this, GlobalContext* globalCtx) { gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gCuccoParticleAliveDL); + FrameInterpolation_RecordCloseChild(); } } diff --git a/soh/src/overlays/actors/ovl_En_Syateki_Niw/z_en_syateki_niw.h b/soh/src/overlays/actors/ovl_En_Syateki_Niw/z_en_syateki_niw.h index 6a6398a6f..dfa493817 100644 --- a/soh/src/overlays/actors/ovl_En_Syateki_Niw/z_en_syateki_niw.h +++ b/soh/src/overlays/actors/ovl_En_Syateki_Niw/z_en_syateki_niw.h @@ -18,6 +18,7 @@ typedef struct { /* 0x2C */ f32 unk_2C; /* 0x30 */ f32 unk_30; /* 0x34 */ u8 unk_34; + s32 epoch; } EnSyatekiNiw_1; // size = 0x38 typedef struct EnSyatekiNiw { diff --git a/soh/src/overlays/actors/ovl_En_Tk/z_en_tk.c b/soh/src/overlays/actors/ovl_En_Tk/z_en_tk.c index f87e7e666..11530b07e 100644 --- a/soh/src/overlays/actors/ovl_En_Tk/z_en_tk.c +++ b/soh/src/overlays/actors/ovl_En_Tk/z_en_tk.c @@ -7,6 +7,7 @@ #include "z_en_tk.h" #include "objects/gameplay_keep/gameplay_keep.h" #include "objects/object_tk/object_tk.h" +#include "soh/frame_interpolation.h" #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3) #define COLLECTFLAG_GRAVEDIGGING_HEART_PIECE 0x19 @@ -43,6 +44,7 @@ void EnTkEff_Create(EnTk* this, Vec3f* pos, Vec3f* speed, Vec3f* accel, u8 durat for (i = 0; i < ARRAY_COUNT(this->eff); i++) { if (eff->active != 1) { + eff->epoch++; eff->size = size; eff->growth = growth; eff->timeTotal = eff->timeLeft = duration; @@ -107,6 +109,7 @@ void EnTkEff_Draw(EnTk* this, GlobalContext* globalCtx) { gfxSetup = 1; } + FrameInterpolation_RecordOpenChild(eff, eff->epoch); alpha = eff->timeLeft * (255.0f / eff->timeTotal); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 170, 130, 90, alpha); @@ -121,6 +124,7 @@ void EnTkEff_Draw(EnTk* this, GlobalContext* globalCtx) { gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(dustTextures[imageIdx])); gSPDisplayList(POLY_XLU_DISP++, gDampeEff2DL); + FrameInterpolation_RecordCloseChild(); } eff++; } diff --git a/soh/src/overlays/actors/ovl_En_Tk/z_en_tk.h b/soh/src/overlays/actors/ovl_En_Tk/z_en_tk.h index 816a7042c..82fb6eef3 100644 --- a/soh/src/overlays/actors/ovl_En_Tk/z_en_tk.h +++ b/soh/src/overlays/actors/ovl_En_Tk/z_en_tk.h @@ -17,6 +17,7 @@ typedef struct EnTkEff { /* 0x0014 */ Vec3f pos; /* 0x0020 */ Vec3f speed; /* 0x002C */ Vec3f accel; + s32 epoch; } EnTkEff; // size = 0x0038 struct EnTk; diff --git a/soh/src/overlays/actors/ovl_En_Viewer/z_en_viewer.c b/soh/src/overlays/actors/ovl_En_Viewer/z_en_viewer.c index b25a42ad9..bf4956f35 100644 --- a/soh/src/overlays/actors/ovl_En_Viewer/z_en_viewer.c +++ b/soh/src/overlays/actors/ovl_En_Viewer/z_en_viewer.c @@ -14,6 +14,7 @@ #include "objects/object_gndd/object_gndd.h" #include "objects/object_ganon/object_ganon.h" #include "objects/object_opening_demo1/object_opening_demo1.h" +#include "soh/frame_interpolation.h" #define FLAGS ACTOR_FLAG_4 @@ -793,6 +794,7 @@ void EnViewer_InitFireEffect(EnViewer* this, GlobalContext* globalCtx, s16 i) { eff->endPos.y = -420.0f; eff->endPos.z = -400.0f; eff->scale = (Rand_ZeroOne() * 5.0f + 12.0f) * 0.001f; + eff->epoch++; } else { eff = &this->fireEffects[i]; eff->startPos.x = -100.0f; @@ -802,6 +804,7 @@ void EnViewer_InitFireEffect(EnViewer* this, GlobalContext* globalCtx, s16 i) { eff->endPos.y = -420.0f; eff->endPos.z = -400.0f; eff->scale = (Rand_ZeroOne() * 5.0f + 12.0f) * 0.001f; + eff->epoch++; } if (this) {} } @@ -843,6 +846,7 @@ void EnViewer_DrawFireEffects(EnViewer* this2, GlobalContext* globalCtx) { break; } + FrameInterpolation_RecordOpenChild(&this->fireEffects[i], this->fireEffects[i].epoch); func_80093D84(globalCtx->state.gfxCtx); Matrix_Translate(this->fireEffects[i].pos.x, this->fireEffects[i].pos.y, this->fireEffects[i].pos.z, MTXMODE_NEW); @@ -856,6 +860,7 @@ void EnViewer_DrawFireEffects(EnViewer* this2, GlobalContext* globalCtx) { G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPMatrix(POLY_XLU_DISP++, SEG_ADDR(1, 0), G_MTX_NOPUSH | G_MTX_MUL | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gEffFire1DL); + FrameInterpolation_RecordCloseChild(); } CLOSE_DISPS(globalCtx->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_En_Viewer/z_en_viewer.h b/soh/src/overlays/actors/ovl_En_Viewer/z_en_viewer.h index 6d797cb34..d16613fcf 100644 --- a/soh/src/overlays/actors/ovl_En_Viewer/z_en_viewer.h +++ b/soh/src/overlays/actors/ovl_En_Viewer/z_en_viewer.h @@ -56,6 +56,7 @@ typedef struct { /* 0x28 */ f32 scale; /* 0x2C */ f32 lerpFactor; /* 0x30 */ u8 state; + s32 epoch; } EnViewerFireEffect; // size = 0x34 typedef struct EnViewer { diff --git a/soh/src/overlays/actors/ovl_Fishing/z_fishing.c b/soh/src/overlays/actors/ovl_Fishing/z_fishing.c index eb7c0a20a..5f404c4ad 100644 --- a/soh/src/overlays/actors/ovl_Fishing/z_fishing.c +++ b/soh/src/overlays/actors/ovl_Fishing/z_fishing.c @@ -90,6 +90,7 @@ typedef struct { /* 0x32 */ s16 timer; /* 0x34 */ u8 shouldDraw; /* 0x38 */ f32 drawDistance; + s32 epoch; } FishingProp; // size = 0x3C typedef enum { @@ -115,6 +116,7 @@ typedef struct { /* 0x40 */ s16 unk_40; /* 0x42 */ s16 unk_42; /* 0x44 */ u8 shouldDraw; + s32 epoch; } FishingGroupFish; // size = 0x48 #define LINE_SEG_COUNT 200 @@ -764,6 +766,7 @@ void Fishing_InitPondProps(Fishing* this, GlobalContext* globalCtx) { break; } + prop->epoch++; prop->type = sPondPropInits[i].type; prop->pos.x = sPondPropInits[i].pos.x; prop->pos.y = sPondPropInits[i].pos.y; @@ -929,6 +932,8 @@ void Fishing_Init(Actor* thisx, GlobalContext* globalCtx2) { for (i = 0; i < GROUP_FISH_COUNT; i++) { FishingGroupFish* fish = &sGroupFishes[i]; + fish->epoch++; + fish->type = FS_GROUP_FISH_NORMAL; if (i <= 20) { @@ -1761,6 +1766,8 @@ static f32 sSinkingLureSizes[] = { void Fishing_DrawSinkingLure(GlobalContext* globalCtx) { s16 i; f32 scale; + static s32 epoch = 0; + epoch++; OPEN_DISPS(globalCtx->state.gfxCtx); @@ -1773,6 +1780,7 @@ void Fishing_DrawSinkingLure(GlobalContext* globalCtx) { for (i = SINKING_LURE_SEG_COUNT - 1; i >= 0; i--) { if ((i + D_80B7FEA0) < SINKING_LURE_SEG_COUNT) { + FrameInterpolation_RecordOpenChild("Fishing Lures 1", epoch + i * 25); Matrix_Translate(sSinkingLurePos[i].x, sSinkingLurePos[i].y, sSinkingLurePos[i].z, MTXMODE_NEW); scale = sSinkingLureSizes[i + D_80B7FEA0] * 0.04f; Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); @@ -1781,6 +1789,7 @@ void Fishing_DrawSinkingLure(GlobalContext* globalCtx) { gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gFishingSinkingLureSegmentModelDL); + FrameInterpolation_RecordCloseChild(); } } } else { @@ -1790,6 +1799,7 @@ void Fishing_DrawSinkingLure(GlobalContext* globalCtx) { for (i = SINKING_LURE_SEG_COUNT - 1; i >= 0; i--) { if ((i + D_80B7FEA0) < SINKING_LURE_SEG_COUNT) { + FrameInterpolation_RecordOpenChild("Fishing Lures 2", epoch + i * 25); Matrix_Translate(sSinkingLurePos[i].x, sSinkingLurePos[i].y, sSinkingLurePos[i].z, MTXMODE_NEW); scale = sSinkingLureSizes[i + D_80B7FEA0] * 0.04f; Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); @@ -1798,6 +1808,7 @@ void Fishing_DrawSinkingLure(GlobalContext* globalCtx) { gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gFishingSinkingLureSegmentModelDL); + FrameInterpolation_RecordCloseChild(); } } } @@ -4451,7 +4462,7 @@ void Fishing_DrawPondProps(GlobalContext* globalCtx) { } if (prop->shouldDraw) { - FrameInterpolation_RecordOpenChild(prop, 0); + FrameInterpolation_RecordOpenChild(prop, prop->epoch); Matrix_Translate(prop->pos.x, prop->pos.y, prop->pos.z, MTXMODE_NEW); Matrix_Scale(prop->scale, prop->scale, prop->scale, MTXMODE_APPLY); Matrix_RotateY(prop->rotY, MTXMODE_APPLY); @@ -4478,7 +4489,7 @@ void Fishing_DrawPondProps(GlobalContext* globalCtx) { } if (prop->shouldDraw) { - FrameInterpolation_RecordOpenChild(prop, 0); + FrameInterpolation_RecordOpenChild(prop, prop->epoch); Matrix_Translate(prop->pos.x, prop->pos.y, prop->pos.z, MTXMODE_NEW); Matrix_Scale(prop->scale, prop->scale, prop->scale, MTXMODE_APPLY); @@ -4502,7 +4513,7 @@ void Fishing_DrawPondProps(GlobalContext* globalCtx) { } if (prop->shouldDraw) { - FrameInterpolation_RecordOpenChild(prop, 0); + FrameInterpolation_RecordOpenChild(prop, prop->epoch); Matrix_Translate(prop->pos.x, prop->pos.y, prop->pos.z, MTXMODE_NEW); Matrix_Scale(prop->scale, 1.0f, prop->scale, MTXMODE_APPLY); Matrix_RotateY(prop->lilyPadAngle * (M_PI / 32768), MTXMODE_APPLY); @@ -4529,7 +4540,7 @@ void Fishing_DrawPondProps(GlobalContext* globalCtx) { } if (prop->shouldDraw) { - FrameInterpolation_RecordOpenChild(prop, 0); + FrameInterpolation_RecordOpenChild(prop, prop->epoch); Matrix_Translate(prop->pos.x, prop->pos.y, prop->pos.z, MTXMODE_NEW); Matrix_Scale(prop->scale, prop->scale, prop->scale, MTXMODE_APPLY); Matrix_RotateY(prop->rotY, MTXMODE_APPLY); @@ -4759,6 +4770,7 @@ void Fishing_DrawGroupFishes(GlobalContext* globalCtx) { } if (fish->shouldDraw) { + FrameInterpolation_RecordOpenChild(fish, fish->epoch); Matrix_Translate(fish->pos.x, fish->pos.y, fish->pos.z, MTXMODE_NEW); Matrix_RotateY(((f32)fish->unk_3E * M_PI) / 32768.0f, MTXMODE_APPLY); Matrix_RotateX((-(f32)fish->unk_3C * M_PI) / 32768.0f, MTXMODE_APPLY); @@ -4767,6 +4779,7 @@ void Fishing_DrawGroupFishes(GlobalContext* globalCtx) { gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gFishingGroupFishModelDL); + FrameInterpolation_RecordCloseChild(); } } fish++; diff --git a/soh/src/overlays/actors/ovl_Item_Ocarina/z_item_ocarina.c b/soh/src/overlays/actors/ovl_Item_Ocarina/z_item_ocarina.c index 72fc68876..f58b0927a 100644 --- a/soh/src/overlays/actors/ovl_Item_Ocarina/z_item_ocarina.c +++ b/soh/src/overlays/actors/ovl_Item_Ocarina/z_item_ocarina.c @@ -168,7 +168,8 @@ void ItemOcarina_DoNothing(ItemOcarina* this, GlobalContext* globalCtx) { } void ItemOcarina_StartSoTCutscene(ItemOcarina* this, GlobalContext* globalCtx) { - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { + if (Actor_TextboxIsClosing(&this->actor, globalCtx) || + Randomizer_ObtainedFreestandingIceTrap(RC_HF_OCARINA_OF_TIME_ITEM, GI_OCARINA_OOT, &this->actor)) { if (!gSaveContext.n64ddFlag) { globalCtx->csCtx.segment = SEGMENTED_TO_VIRTUAL(gHyruleFieldZeldaSongOfTimeCs); gSaveContext.cutsceneTrigger = 1; diff --git a/soh/src/overlays/actors/ovl_Mir_Ray/z_mir_ray.c b/soh/src/overlays/actors/ovl_Mir_Ray/z_mir_ray.c index 5389e2469..c332590dd 100644 --- a/soh/src/overlays/actors/ovl_Mir_Ray/z_mir_ray.c +++ b/soh/src/overlays/actors/ovl_Mir_Ray/z_mir_ray.c @@ -6,6 +6,7 @@ #include "z_mir_ray.h" #include "objects/object_mir_ray/object_mir_ray.h" +#include "soh/frame_interpolation.h" #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) @@ -481,6 +482,8 @@ void MirRay_Draw(Actor* thisx, GlobalContext* globalCtx) { s32 i; MirRayShieldReflection reflection[6]; s32 temp; + static s32 epoch = 0; + epoch++; this->reflectIntensity = 0.0f; if ((D_80B8E670 == 0) && !this->unLit && Player_HasMirrorShieldSetToDraw(globalCtx)) { @@ -511,6 +514,7 @@ void MirRay_Draw(Actor* thisx, GlobalContext* globalCtx) { } for (i = 0; i < 6; i++) { if (reflection[i].reflectionPoly != NULL) { + FrameInterpolation_RecordOpenChild(&reflection[i], epoch + i * 25); Matrix_Translate(reflection[i].pos.x, reflection[i].pos.y, reflection[i].pos.z, MTXMODE_NEW); Matrix_Scale(0.01f, 0.01f, 0.01f, MTXMODE_APPLY); Matrix_Mult(&reflection[i].mtx, MTXMODE_APPLY); @@ -519,6 +523,7 @@ void MirRay_Draw(Actor* thisx, GlobalContext* globalCtx) { gDPSetRenderMode(POLY_XLU_DISP++, G_RM_FOG_SHADE_A, G_RM_AA_ZB_XLU_DECAL2); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 150, reflection[0].opacity); gSPDisplayList(POLY_XLU_DISP++, gShieldBeamImageDL); + FrameInterpolation_RecordCloseChild(); } } diff --git a/soh/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c b/soh/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c index 01c4aa469..22b796964 100644 --- a/soh/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c +++ b/soh/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c @@ -924,6 +924,7 @@ void ObjectKankyo_DrawBeams(ObjectKankyo* this2, GlobalContext* globalCtx2) { if (this->requiredObjectLoaded) { for (i = 0; i < 6; i++) { if (this->effects[i].size > 0.001f) { + FrameInterpolation_RecordOpenChild(&this->effects[i], this->effects[i].epoch); Matrix_Translate(beamX[i], beamY[i], beamZ[i], MTXMODE_NEW); Matrix_RotateY(DEG_TO_RAD(beamYaw[i]), MTXMODE_APPLY); Matrix_RotateX(DEG_TO_RAD(beamPitch[i]), MTXMODE_APPLY); @@ -940,6 +941,7 @@ void ObjectKankyo_DrawBeams(ObjectKankyo* this2, GlobalContext* globalCtx2) { globalCtx->state.frames * 10, 32, 64, 1, globalCtx->state.frames * 5, globalCtx->state.frames * 10, 32, 64)); gSPDisplayList(POLY_XLU_DISP++, gDemoKekkaiDL_005FF0); + FrameInterpolation_RecordCloseChild(); } } } diff --git a/soh/src/overlays/effects/ovl_Effect_Ss_Bomb2/z_eff_ss_bomb2.c b/soh/src/overlays/effects/ovl_Effect_Ss_Bomb2/z_eff_ss_bomb2.c index 39d374925..34bd3446b 100644 --- a/soh/src/overlays/effects/ovl_Effect_Ss_Bomb2/z_eff_ss_bomb2.c +++ b/soh/src/overlays/effects/ovl_Effect_Ss_Bomb2/z_eff_ss_bomb2.c @@ -6,6 +6,7 @@ #include "z_eff_ss_bomb2.h" #include "objects/gameplay_keep/gameplay_keep.h" +#include "soh/frame_interpolation.h" #define rScale regs[0] #define rTexIdx regs[1] @@ -54,6 +55,7 @@ u32 EffectSsBomb2_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void this->rEnvColorR = 0; this->rEnvColorG = 0; this->rEnvColorB = 200; + this->epoch++; return 1; } @@ -144,6 +146,7 @@ void EffectSsBomb2_DrawLayered(GlobalContext* globalCtx, u32 index, EffectSs* th Matrix_Put(&mtx2F); for (i = 1; i >= 0; i--) { + FrameInterpolation_RecordOpenChild(this, this->epoch + i * 25); Matrix_Translate(0.0f, 0.0f, depth, MTXMODE_APPLY); Matrix_RotateZ((this->life * 0.02f) + 180.0f, MTXMODE_APPLY); Matrix_Scale(layer2Scale, layer2Scale, layer2Scale, MTXMODE_APPLY); @@ -151,6 +154,7 @@ void EffectSsBomb2_DrawLayered(GlobalContext* globalCtx, u32 index, EffectSs* th G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gEffBombExplosion3DL); layer2Scale -= 0.15f; + FrameInterpolation_RecordCloseChild(); } } } diff --git a/soh/src/overlays/effects/ovl_Effect_Ss_Bomb2/z_eff_ss_bomb2.h b/soh/src/overlays/effects/ovl_Effect_Ss_Bomb2/z_eff_ss_bomb2.h index 454303b50..93dc28031 100644 --- a/soh/src/overlays/effects/ovl_Effect_Ss_Bomb2/z_eff_ss_bomb2.h +++ b/soh/src/overlays/effects/ovl_Effect_Ss_Bomb2/z_eff_ss_bomb2.h @@ -11,6 +11,7 @@ typedef struct { /* 0x24 */ s16 scale; /* 0x26 */ s16 scaleStep; /* 0x28 */ u8 drawMode; + /* 0x29 */ s32 epoch; } EffectSsBomb2InitParams; // size = 0x30 #endif diff --git a/soh/src/overlays/gamestates/ovl_title/z_title.c b/soh/src/overlays/gamestates/ovl_title/z_title.c index 699dff626..cfaf9e26d 100644 --- a/soh/src/overlays/gamestates/ovl_title/z_title.c +++ b/soh/src/overlays/gamestates/ovl_title/z_title.c @@ -39,8 +39,10 @@ void Title_PrintBuildInfo(Gfx** gfxp) { GfxPrint_Printf(&printer, "GCC SHIP"); #endif - GfxPrint_SetPos(&printer, 5, 4); + GfxPrint_SetPos(&printer, 1, 4); GfxPrint_Printf(&printer, "Game Version: %s", gameVersionStr); + GfxPrint_SetPos(&printer, 1, 5); + GfxPrint_Printf(&printer, "Release Version: %s", gBuildVersion); GfxPrint_SetColor(&printer, 255, 255, 255, 255); GfxPrint_SetPos(&printer, 2, 22); @@ -49,8 +51,6 @@ void Title_PrintBuildInfo(Gfx** gfxp) { GfxPrint_Printf(&printer, "Build Date:%s", gBuildDate); GfxPrint_SetPos(&printer, 3, 26); GfxPrint_Printf(&printer, "%s", gBuildTeam); - GfxPrint_SetPos(&printer, 3, 28); - GfxPrint_Printf(&printer, "Release Version: %s", gBuildVersion); g = GfxPrint_Close(&printer); GfxPrint_Destroy(&printer); *gfxp = g; diff --git a/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c b/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c index 2735ed9b4..e3e093129 100644 --- a/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c +++ b/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c @@ -12,7 +12,6 @@ #include "textures/map_name_static/map_name_static.h" #include "textures/map_48x85_static/map_48x85_static.h" #include "vt.h" -#include "Hooks.h" #include "soh/frame_interpolation.h" @@ -3228,10 +3227,9 @@ void KaleidoScope_LoadDungeonMap(GlobalContext* globalCtx) { char* firstTextureName = sDungeonMapTexs[R_MAP_TEX_INDEX]; char* secondTextureName = sDungeonMapTexs[R_MAP_TEX_INDEX + 1]; - uint32_t firstTextureSize = ResourceMgr_LoadTexSizeByName(firstTextureName); memcpy(interfaceCtx->mapSegment, ResourceMgr_LoadTexByName(firstTextureName), ResourceMgr_LoadTexSizeByName(firstTextureName)); - memcpy(interfaceCtx->mapSegment + (firstTextureSize / 2), ResourceMgr_LoadTexByName(secondTextureName), ResourceMgr_LoadTexSizeByName(secondTextureName)); + memcpy(interfaceCtx->mapSegment + 0x800, ResourceMgr_LoadTexByName(secondTextureName), ResourceMgr_LoadTexSizeByName(secondTextureName)); } void KaleidoScope_UpdateDungeonMap(GlobalContext* globalCtx) { @@ -3846,19 +3844,7 @@ void KaleidoScope_Update(GlobalContext* globalCtx) } else { Audio_PlaySoundGeneral(NA_SE_SY_PIECE_OF_HEART, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); - Gameplay_SaveSceneFlags(globalCtx); - gSaveContext.savedSceneNum = globalCtx->sceneNum; - if (gSaveContext.temporaryWeapon) { - gSaveContext.equips.buttonItems[0] = ITEM_NONE; - player->currentSwordItem = ITEM_NONE; - Inventory_ChangeEquipment(EQUIP_SWORD, PLAYER_SWORD_NONE); - Save_SaveFile(); - gSaveContext.equips.buttonItems[0] = ITEM_SWORD_KOKIRI; - player->currentSwordItem = ITEM_SWORD_KOKIRI; - Inventory_ChangeEquipment(EQUIP_SWORD, PLAYER_SWORD_KOKIRI); - } else { - Save_SaveFile(); - } + Gameplay_PerformSave(globalCtx); pauseCtx->unk_1EC = 4; D_8082B25C = 3; }