Merge branch 'develop' of github.com:Malkierian/Shipwright into dev-to-rando-5-5

This commit is contained in:
Malkierian 2024-05-05 22:05:10 -07:00
commit e2b0ea5692
339 changed files with 7337 additions and 10809 deletions

View File

@ -1 +1 @@
libusb-dev libusb-1.0-0-dev libsdl2-dev libsdl2-net-dev libpng-dev libglew-dev libzip-dev zipcmp zipmerge ziptool ninja-build libusb-dev libusb-1.0-0-dev libsdl2-dev libsdl2-net-dev libpng-dev libglew-dev libzip-dev zipcmp zipmerge ziptool nlohmann-json3-dev libtinyxml2-dev libspdlog-dev ninja-build

View File

@ -47,6 +47,20 @@ jobs:
make -j 10 make -j 10
sudo make install sudo make install
sudo cp -av /usr/local/lib/libSDL* /lib/x86_64-linux-gnu/ sudo cp -av /usr/local/lib/libSDL* /lib/x86_64-linux-gnu/
- name: Install latest tinyxml2
run: |
sudo apt-get remove libtinyxml2-dev
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
if [ ! -d "tinyxml2-10.0.0" ]; then
wget https://github.com/leethomason/tinyxml2/archive/refs/tags/10.0.0.tar.gz
tar -xzf 10.0.0.tar.gz
fi
cd tinyxml2-10.0.0
mkdir build
cd build
cmake ..
make
sudo make install
- name: Generate soh.otr - name: Generate soh.otr
run: | run: |
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH" export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
@ -92,8 +106,8 @@ jobs:
if [ -d /opt/local/ ]; then if [ -d /opt/local/ ]; then
echo "MacPorts already installed" echo "MacPorts already installed"
else else
wget https://github.com/macports/macports-base/releases/download/v2.9.1/MacPorts-2.9.1-12-Monterey.pkg wget https://github.com/macports/macports-base/releases/download/v2.9.3/MacPorts-2.9.3-12-Monterey.pkg
sudo installer -pkg ./MacPorts-2.9.1-12-Monterey.pkg -target / sudo installer -pkg ./MacPorts-2.9.3-12-Monterey.pkg -target /
fi fi
echo "/opt/local/bin:/opt/local/sbin" >> $GITHUB_PATH echo "/opt/local/bin:/opt/local/sbin" >> $GITHUB_PATH
- name: Install dependencies - name: Install dependencies
@ -190,6 +204,36 @@ jobs:
cmake .. cmake ..
make make
sudo make install sudo make install
- name: Install latest nlohmann
if: ${{ (matrix.os == 'ubuntu-20.04' && !vars.LINUX_COMPATIBILITY_RUNNER) }}
run: |
sudo apt-get remove nlohmann-json3-dev
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
if [ ! -d "json-3.11.3" ]; then
wget https://github.com/nlohmann/json/archive/refs/tags/v3.11.3.tar.gz
tar -xzvf v3.11.3.tar.gz
fi
cd json-3.11.3
mkdir build
cd build
cmake ..
make
sudo make install
- name: Install latest tinyxml2
if: ${{ (matrix.os == 'ubuntu-20.04' && !vars.LINUX_COMPATIBILITY_RUNNER) || (matrix.os == 'ubuntu-22.04' && !vars.LINUX_PERFORMANCE_RUNNER) }}
run: |
sudo apt-get remove libtinyxml2-dev
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
if [ ! -d "tinyxml2-10.0.0" ]; then
wget https://github.com/leethomason/tinyxml2/archive/refs/tags/10.0.0.tar.gz
tar -xzf 10.0.0.tar.gz
fi
cd tinyxml2-10.0.0
mkdir build
cd build
cmake ..
make
sudo make install
- name: Install latest SDL_net - name: Install latest SDL_net
if: ${{ (matrix.os == 'ubuntu-20.04' && !vars.LINUX_COMPATIBILITY_RUNNER) || (matrix.os == 'ubuntu-22.04' && !vars.LINUX_PERFORMANCE_RUNNER) }} if: ${{ (matrix.os == 'ubuntu-20.04' && !vars.LINUX_COMPATIBILITY_RUNNER) || (matrix.os == 'ubuntu-22.04' && !vars.LINUX_PERFORMANCE_RUNNER) }}
run: | run: |
@ -226,114 +270,6 @@ jobs:
path: | path: |
soh.appimage soh.appimage
readme.txt readme.txt
build-switch:
needs: generate-soh-otr
runs-on: ${{ (vars.LINUX_RUNNER && fromJSON(vars.LINUX_RUNNER)) || 'ubuntu-latest' }}
container:
image: devkitpro/devkita64:20240120
steps:
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y ninja-build
sudo apt-get remove -y cmake
wget https://github.com/Kitware/CMake/releases/download/v3.28.3/cmake-3.28.3-linux-x86_64.sh -O /tmp/cmake.sh
sudo sh /tmp/cmake.sh --prefix=/usr/local/ --exclude-subdir
wget https://libzip.org/download/libzip-1.10.1.tar.gz
tar -xzvf libzip-1.10.1.tar.gz
cd libzip-1.10.1
mkdir build
cd build
cmake -H.. -B. -DCMAKE_TOOLCHAIN_FILE=/opt/devkitpro/cmake/Switch.cmake
make
make install
- name: Fix dubious ownership error
if: ${{ vars.LINUX_RUNNER }}
run: git config --global --add safe.directory '*'
- uses: actions/checkout@v3
with:
submodules: true
- name: ccache
uses: hendrikmuhs/ccache-action@v1.2.11
with:
key: ${{ runner.os }}-switch-ccache-${{ github.ref }}-${{ github.sha }}
restore-keys: |
${{ runner.os }}-switch-ccache-${{ github.ref }}
${{ runner.os }}-switch-ccache-
- name: Build SoH
run: |
cmake -H. -Bbuild-switch -GNinja -DCMAKE_TOOLCHAIN_FILE=/opt/devkitpro/cmake/Switch.cmake -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache
cmake --build build-switch --target soh_nro -j3
mv build-switch/soh/*.nro soh.nro
mv README.md readme.txt
- name: Download soh.otr
uses: actions/download-artifact@v4
with:
name: soh.otr
- name: Upload build
uses: actions/upload-artifact@v4
with:
name: soh-switch
path: |
soh.nro
soh.otr
readme.txt
build-wiiu:
needs: generate-soh-otr
runs-on: ${{ (vars.LINUX_RUNNER && fromJSON(vars.LINUX_RUNNER)) || 'ubuntu-latest' }}
container:
image: devkitpro/devkitppc:20230110
steps:
- name: Install dependencies
if: ${{ !vars.LINUX_RUNNER }}
run: |
sudo apt-get install -y ninja-build
sudo apt-get remove -y cmake
wget https://github.com/Kitware/CMake/releases/download/v3.28.3/cmake-3.28.3-linux-x86_64.sh -O /tmp/cmake.sh
sudo sh /tmp/cmake.sh --prefix=/usr/local/ --exclude-subdir
wget https://libzip.org/download/libzip-1.10.1.tar.gz
tar -xzvf libzip-1.10.1.tar.gz
cd libzip-1.10.1
mkdir build
cd build
cmake -H.. -B. -DCMAKE_TOOLCHAIN_FILE=/opt/devkitpro/cmake/WiiU.cmake
make
make install
- uses: actions/checkout@v3
with:
submodules: true
- name: ccache
uses: hendrikmuhs/ccache-action@v1.2.11
with:
key: ${{ runner.os }}-wiiu-ccache-${{ github.ref }}-${{ github.sha }}
restore-keys: |
${{ runner.os }}-wiiu-ccache-${{ github.ref }}
${{ runner.os }}-wiiu-ccache-
- name: Build SoH
run: |
cmake -H. -Bbuild-wiiu -GNinja -DCMAKE_TOOLCHAIN_FILE=/opt/devkitpro/cmake/WiiU.cmake -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache
cmake --build build-wiiu --target soh_wuhb --config Release -j3
mv build-wiiu/soh/*.rpx soh.rpx
mv build-wiiu/soh/*.wuhb soh.wuhb
mv README.md readme.txt
env:
DEVKITPRO: /opt/devkitpro
DEVKITPPC: /opt/devkitpro/devkitPPC
- name: Download soh.otr
uses: actions/download-artifact@v4
with:
name: soh.otr
- name: Upload build
uses: actions/upload-artifact@v4
with:
name: soh-wiiu
path: |
soh.rpx
soh.wuhb
soh.otr
readme.txt
build-windows: build-windows:
needs: generate-soh-otr needs: generate-soh-otr
runs-on: ${{ (vars.WINDOWS_RUNNER && fromJSON(vars.WINDOWS_RUNNER)) || 'windows-latest' }} runs-on: ${{ (vars.WINDOWS_RUNNER && fromJSON(vars.WINDOWS_RUNNER)) || 'windows-latest' }}

View File

@ -1 +1 @@
libsdl2 +universal libsdl2_net +universal libpng +universal glew +universal libzip +universal libsdl2 +universal libsdl2_net +universal libpng +universal glew +universal libzip +universal nlohmann-json +universal tinyxml2 +universal

View File

@ -1,3 +1,8 @@
# todo:
# nlohmann
# tinyxml2
# spdlog
name: test-builds-on-distros name: test-builds-on-distros
on: on:
workflow_dispatch: # by request workflow_dispatch: # by request

2
.gitignore vendored
View File

@ -448,5 +448,5 @@ _packages
*/extract_assets_cmake* */extract_assets_cmake*
/build* /build*
soh/build.c soh/src/boot/build.c
soh/properties.h soh/properties.h

24
CMake/lus-cvars.cmake Normal file
View File

@ -0,0 +1,24 @@
set(CVAR_VSYNC_ENABLED "${CVAR_PREFIX_SETTING}.VsyncEnabled" CACHE STRING "")
set(CVAR_Z_FIGHTING_MODE "${CVAR_PREFIX_SETTING}.ZFightingMode" CACHE STRING "")
set(CVAR_NEW_FILE_DROPPED "${CVAR_PREFIX_GENERAL}.NewFileDropped" CACHE STRING "")
set(CVAR_DROPPED_FILE "${CVAR_PREFIX_GENERAL}.DroppedFile" CACHE STRING "")
set(CVAR_INTERNAL_RESOLUTION "${CVAR_PREFIX_SETTING}.InternalResolution" CACHE STRING "")
set(CVAR_MSAA_VALUE "${CVAR_PREFIX_SETTING}.MSAAValue" CACHE STRING "")
set(CVAR_SDL_WINDOWED_FULLSCREEN "${CVAR_PREFIX_SETTING}.SdlWindowedFullscreen" CACHE STRING "")
set(CVAR_TEXTURE_FILTER "${CVAR_PREFIX_SETTING}.TextureFilter" CACHE STRING "")
set(CVAR_IMGUI_CONTROLLER_NAV "${CVAR_PREFIX_SETTING}.ControlNav" CACHE STRING "")
set(CVAR_CONSOLE_WINDOW_OPEN "${CVAR_PREFIX_WINDOW}.Console" CACHE STRING "")
set(CVAR_CONTROLLER_CONFIGURATION_WINDOW_OPEN "${CVAR_PREFIX_WINDOW}.ControllerConfiguration" CACHE STRING "")
set(CVAR_CONTROLLER_DISCONNECTED_WINDOW_OPEN "${CVAR_PREFIX_WINDOW}.ControllerDisconnected" CACHE STRING "")
set(CVAR_CONTROLLER_REORDERING_WINDOW_OPEN "${CVAR_PREFIX_WINDOW}.ControllerReordering" CACHE STRING "")
set(CVAR_GFX_DEBUGGER_WINDOW_OPEN "${CVAR_PREFIX_WINDOW}.GfxDebugger" CACHE STRING "")
set(CVAR_STATS_WINDOW_OPEN "${CVAR_PREFIX_WINDOW}.Stats" CACHE STRING "")
set(CVAR_ENABLE_MULTI_VIEWPORTS "${CVAR_PREFIX_SETTING}.EnableMultiViewports" CACHE STRING "")
set(CVAR_LOW_RES_MODE "${CVAR_PREFIX_SETTING}.LowResMode" CACHE STRING "")
set(CVAR_SIMULATED_INPUT_LAG "${CVAR_PREFIX_SETTING}.SimulatedInputLag" CACHE STRING "")
set(CVAR_ALT_ASSETS "${CVAR_PREFIX_ENHANCEMENT}.AltAssets" CACHE STRING "")
set(CVAR_GAME_OVERLAY_FONT "${CVAR_PREFIX_SETTING}.OverlayFont" CACHE STRING "")
set(CVAR_MENU_BAR_OPEN "${CVAR_PREFIX_SETTING}.OpenMenuBar" CACHE STRING "")
set(CVAR_PREFIX_CONTROLLERS "${CVAR_PREFIX_SETTING}.Controllers" CACHE STRING "")
set(CVAR_PREFIX_ADVANCED_RESOLUTION "${CVAR_PREFIX_SETTING}.AdvancedResolution" CACHE STRING "")
include("libultraship/cmake/cvars.cmake")

26
CMake/soh-cvars.cmake Normal file
View File

@ -0,0 +1,26 @@
set(CVAR_PREFIX_RANDOMIZER_ENHANCEMENT "gRandoEnhancements")
set(CVAR_PREFIX_RANDOMIZER_SETTING "gRandoSettings")
set(CVAR_PREFIX_COSMETIC "gCosmetics")
set(CVAR_PREFIX_AUDIO "gAudioEditor")
set(CVAR_PREFIX_CHEAT "gCheats")
set(CVAR_PREFIX_ENHANCEMENT "gEnhancements")
set(CVAR_PREFIX_SETTING "gSettings")
set(CVAR_PREFIX_WINDOW "gOpenWindows")
set(CVAR_PREFIX_TRACKER "gTrackers")
set(CVAR_PREFIX_DEVELOPER_TOOLS "gDeveloperTools")
set(CVAR_PREFIX_GENERAL "gGeneral")
set(CVAR_PREFIX_REMOTE "gRemote")
add_compile_definitions(
CVAR_PREFIX_RANDOMIZER_ENHANCEMENT="${CVAR_PREFIX_RANDOMIZER_ENHANCEMENT}"
CVAR_PREFIX_RANDOMIZER_SETTING="${CVAR_PREFIX_RANDOMIZER_SETTING}"
CVAR_PREFIX_COSMETIC="${CVAR_PREFIX_COSMETIC}"
CVAR_PREFIX_AUDIO="${CVAR_PREFIX_AUDIO}"
CVAR_PREFIX_CHEAT="${CVAR_PREFIX_CHEAT}"
CVAR_PREFIX_ENHANCEMENT="${CVAR_PREFIX_ENHANCEMENT}"
CVAR_PREFIX_SETTING="${CVAR_PREFIX_SETTING}"
CVAR_PREFIX_WINDOW="${CVAR_PREFIX_WINDOW}"
CVAR_PREFIX_TRACKER="${CVAR_PREFIX_TRACKER}"
CVAR_PREFIX_DEVELOPER_TOOLS="${CVAR_PREFIX_DEVELOPER_TOOLS}"
CVAR_PREFIX_GENERAL="${CVAR_PREFIX_GENERAL}"
CVAR_PREFIX_REMOTE="${CVAR_PREFIX_REMOTE}"
)

View File

@ -6,6 +6,8 @@ set(CMAKE_CXX_STANDARD 20 CACHE STRING "The C++ standard to use")
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.15" CACHE STRING "Minimum OS X deployment version") set(CMAKE_OSX_DEPLOYMENT_TARGET "10.15" CACHE STRING "Minimum OS X deployment version")
project(Ship VERSION 8.0.5 LANGUAGES C CXX) project(Ship VERSION 8.0.5 LANGUAGES C CXX)
include(CMake/soh-cvars.cmake)
include(CMake/lus-cvars.cmake)
set(PROJECT_BUILD_NAME "MacReady Foxtrot" CACHE STRING "") set(PROJECT_BUILD_NAME "MacReady Foxtrot" CACHE STRING "")
set(PROJECT_TEAM "github.com/harbourmasters" CACHE STRING "") set(PROJECT_TEAM "github.com/harbourmasters" CACHE STRING "")
@ -20,7 +22,7 @@ if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
set(VCPKG_TARGET_TRIPLET x64-windows-static) set(VCPKG_TARGET_TRIPLET x64-windows-static)
vcpkg_bootstrap() vcpkg_bootstrap()
vcpkg_install_packages(zlib bzip2 libzip libpng sdl2 sdl2-net glew glfw3) vcpkg_install_packages(zlib bzip2 libzip libpng sdl2 sdl2-net glew glfw3 nlohmann-json tinyxml2 spdlog)
if (CMAKE_C_COMPILER_LAUNCHER MATCHES "ccache|sccache") if (CMAKE_C_COMPILER_LAUNCHER MATCHES "ccache|sccache")
set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT Embedded) set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT Embedded)

@ -1 +1 @@
Subproject commit e93bd2be062b13106fdb29d98cf4ada4d7ad6827 Subproject commit 3cea9ee7c017d842aa4d9ceeb8d3ffbf29c6effb

2
ZAPDTR

@ -1 +1 @@
Subproject commit 9f9d0be3c914354ecabab3695581f1123c13ac20 Subproject commit f38a9c92eb99368c0607acf356d5651ebdc96f51

@ -1 +1 @@
Subproject commit 493639d5daf75c8fa5d374f96fc95b652714299f Subproject commit 7d71a290657a2d3b09a83e8b33025e807f4fb38e

View File

@ -92,10 +92,6 @@ if (NOT TARGET libultraship)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../libultraship ${CMAKE_BINARY_DIR}/libultraship) add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../libultraship ${CMAKE_BINARY_DIR}/libultraship)
endif() endif()
if (NOT TARGET ZAPDUtils)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../ZAPDTR/ZAPDUtils ${CMAKE_BINARY_DIR}/ZAPDUtils)
endif()
if (NOT TARGET ZAPDLib) if (NOT TARGET ZAPDLib)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../ZAPDTR/ZAPD ${CMAKE_BINARY_DIR}/ZAPD) add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../ZAPDTR/ZAPD ${CMAKE_BINARY_DIR}/ZAPD)
endif() endif()
@ -105,8 +101,8 @@ set(PROJECT_NAME soh)
################################################################################ ################################################################################
# Sources # Sources
################################################################################ ################################################################################
configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/src/boot/build.c.in ${CMAKE_BINARY_DIR}/build.c @ONLY) configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/src/boot/build.c.in ${CMAKE_CURRENT_SOURCE_DIR}/src/boot/build.c @ONLY)
configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/src/boot/properties.h.in ${CMAKE_CURRENT_SOURCE_DIR}/properties.h @ONLY) configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/properties.h.in ${CMAKE_CURRENT_SOURCE_DIR}/properties.h @ONLY)
set(Header_Files "resource.h") set(Header_Files "resource.h")
source_group("headers" FILES ${Header_Files}) source_group("headers" FILES ${Header_Files})
@ -217,8 +213,6 @@ source_group("soh\\resource\\importer\\scenecommand" REGULAR_EXPRESSION "soh/res
# src (decomp) {{{ # src (decomp) {{{
file(GLOB_RECURSE src__ RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "src/*.c" "src/*.h") file(GLOB_RECURSE src__ RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "src/*.c" "src/*.h")
list(APPEND src__ ${CMAKE_BINARY_DIR}/build.c)
list(APPEND src__ ${CMAKE_CURRENT_SOURCE_DIR}/properties.h)
list(APPEND src__ ${CMAKE_CURRENT_SOURCE_DIR}/Resource.rc) list(APPEND src__ ${CMAKE_CURRENT_SOURCE_DIR}/Resource.rc)
list(FILTER src__ EXCLUDE REGEX "src/dmadata/*") list(FILTER src__ EXCLUDE REGEX "src/dmadata/*")
list(FILTER src__ EXCLUDE REGEX "src/elf_message/*") list(FILTER src__ EXCLUDE REGEX "src/elf_message/*")
@ -238,7 +232,6 @@ list(REMOVE_ITEM src__ "src/libultra/gu/sqrtf.c")
list(REMOVE_ITEM src__ "src/libultra/gu/us2dex.c") list(REMOVE_ITEM src__ "src/libultra/gu/us2dex.c")
source_group("src" REGULAR_EXPRESSION "src/*") source_group("src" REGULAR_EXPRESSION "src/*")
source_group("src\\build" FILES ${CMAKE_BINARY_DIR}/build.c ${CMAKE_CURRENT_SOURCE_DIR}/properties.h ${CMAKE_CURRENT_SOURCE_DIR}/Resource.rc)
source_group("src\\boot" REGULAR_EXPRESSION "src/boot/*") source_group("src\\boot" REGULAR_EXPRESSION "src/boot/*")
source_group("src\\buffers" REGULAR_EXPRESSION "src/buffers/*") source_group("src\\buffers" REGULAR_EXPRESSION "src/buffers/*")
source_group("src\\code" REGULAR_EXPRESSION "src/code/*") source_group("src\\code" REGULAR_EXPRESSION "src/code/*")
@ -391,10 +384,8 @@ target_include_directories(${PROJECT_NAME} PRIVATE assets
${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/extern/tinyxml2 ${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/extern/tinyxml2
${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/libultraship/Lib/ ${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/libultraship/Lib/
${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/libultraship/Lib/libjpeg/include/ ${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/libultraship/Lib/libjpeg/include/
${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/libultraship/Lib/spdlog/include/
${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/src/graphic/Fast3D/U64/PR ${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/src/graphic/Fast3D/U64/PR
${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/src/graphic ${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/src/graphic
${CMAKE_CURRENT_SOURCE_DIR}/../ZAPDTR/ZAPDUtils
${CMAKE_CURRENT_SOURCE_DIR}/../ZAPDTR/ZAPD/resource/type ${CMAKE_CURRENT_SOURCE_DIR}/../ZAPDTR/ZAPD/resource/type
${SDL2-INCLUDE} ${SDL2-INCLUDE}
${SDL2-NET-INCLUDE} ${SDL2-NET-INCLUDE}
@ -420,6 +411,7 @@ if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
"_UNICODE" "_UNICODE"
STORMLIB_NO_AUTO_LINK STORMLIB_NO_AUTO_LINK
"_CRT_SECURE_NO_WARNINGS;" "_CRT_SECURE_NO_WARNINGS;"
NOMINMAX
) )
elseif("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "Win32") elseif("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "Win32")
target_compile_definitions(${PROJECT_NAME} PRIVATE target_compile_definitions(${PROJECT_NAME} PRIVATE
@ -437,6 +429,7 @@ if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
"UNICODE;" "UNICODE;"
"_UNICODE" "_UNICODE"
STORMLIB_NO_AUTO_LINK STORMLIB_NO_AUTO_LINK
NOMINMAX
) )
endif() endif()
elseif (CMAKE_SYSTEM_NAME STREQUAL "CafeOS") elseif (CMAKE_SYSTEM_NAME STREQUAL "CafeOS")
@ -650,15 +643,6 @@ endif()
################################################################################ ################################################################################
# Pre build events # Pre build events
################################################################################ ################################################################################
if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
add_custom_command_if(
TARGET ${PROJECT_NAME}
PRE_BUILD
COMMANDS
COMMAND $<CONFIG:Debug> copy /b $<SHELL_PATH:${CMAKE_BINARY_DIR}/>build.c +,,
)
endif()
if(NOT CMAKE_SYSTEM_NAME MATCHES "NintendoSwitch|CafeOS") if(NOT CMAKE_SYSTEM_NAME MATCHES "NintendoSwitch|CafeOS")
add_custom_command( add_custom_command(
TARGET ${PROJECT_NAME} TARGET ${PROJECT_NAME}
@ -677,7 +661,6 @@ endif()
# Dependencies # Dependencies
################################################################################ ################################################################################
add_dependencies(${PROJECT_NAME} add_dependencies(${PROJECT_NAME}
ZAPDUtils
libultraship libultraship
) )
if(NOT CMAKE_SYSTEM_NAME MATCHES "NintendoSwitch|CafeOS") if(NOT CMAKE_SYSTEM_NAME MATCHES "NintendoSwitch|CafeOS")
@ -691,7 +674,6 @@ if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64") if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64")
set(ADDITIONAL_LIBRARY_DEPENDENCIES set(ADDITIONAL_LIBRARY_DEPENDENCIES
"libultraship;" "libultraship;"
"ZAPDUtils;"
"ZAPDLib;" "ZAPDLib;"
"glu32;" "glu32;"
"SDL2::SDL2;" "SDL2::SDL2;"
@ -706,7 +688,6 @@ if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
elseif("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "Win32") elseif("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "Win32")
set(ADDITIONAL_LIBRARY_DEPENDENCIES set(ADDITIONAL_LIBRARY_DEPENDENCIES
"libultraship;" "libultraship;"
"ZAPDUtils;"
"ZAPDLib;" "ZAPDLib;"
"glu32;" "glu32;"
"SDL2::SDL2;" "SDL2::SDL2;"
@ -724,7 +705,6 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "NintendoSwitch")
find_package(Threads REQUIRED) find_package(Threads REQUIRED)
set(ADDITIONAL_LIBRARY_DEPENDENCIES set(ADDITIONAL_LIBRARY_DEPENDENCIES
"libultraship;" "libultraship;"
"ZAPDUtils;"
SDL2::SDL2 SDL2::SDL2
-lglad -lglad
Threads::Threads Threads::Threads
@ -746,7 +726,6 @@ else()
find_package(Threads REQUIRED) find_package(Threads REQUIRED)
set(ADDITIONAL_LIBRARY_DEPENDENCIES set(ADDITIONAL_LIBRARY_DEPENDENCIES
"libultraship;" "libultraship;"
"ZAPDUtils;"
"ZAPDLib;" "ZAPDLib;"
SDL2::SDL2 SDL2::SDL2
"$<$<BOOL:${BUILD_REMOTE_CONTROL}>:SDL2_net::SDL2_net>" "$<$<BOOL:${BUILD_REMOTE_CONTROL}>:SDL2_net::SDL2_net>"

View File

@ -2,9 +2,10 @@
#include "sequence.h" #include "sequence.h"
#include "sfx.h" #include "sfx.h"
#include <vector> #include <vector>
#include <Utils/StringHelper.h> #include <utils/StringHelper.h>
#include <libultraship/bridge.h> #include <libultraship/bridge.h>
#include <libultraship/classes.h> #include <libultraship/classes.h>
#include <soh/OTRGlobals.h>
#include <locale> #include <locale>
#include <filesystem> #include <filesystem>
@ -330,11 +331,13 @@ AudioCollection::AudioCollection() {
} }
std::string AudioCollection::GetCvarKey(std::string sfxKey) { std::string AudioCollection::GetCvarKey(std::string sfxKey) {
return "gAudioEditor.ReplacedSequences." + sfxKey + ".value"; auto prefix = CVAR_AUDIO("ReplacedSequences.");
return prefix + sfxKey + ".value";
} }
std::string AudioCollection::GetCvarLockKey(std::string sfxKey) { std::string AudioCollection::GetCvarLockKey(std::string sfxKey) {
return "gAudioEditor.ReplacedSequences." + sfxKey + ".locked"; auto prefix = std::string(CVAR_AUDIO("ReplacedSequences."));
return prefix + sfxKey + ".locked";
} }
void AudioCollection::AddToCollection(char* otrPath, uint16_t seqNum) { void AudioCollection::AddToCollection(char* otrPath, uint16_t seqNum) {
@ -362,7 +365,7 @@ uint16_t AudioCollection::GetReplacementSequence(uint16_t seqId) {
// for Hyrule Field instead. Otherwise, leave it alone, so that without any sfx editor modifications we will // for Hyrule Field instead. Otherwise, leave it alone, so that without any sfx editor modifications we will
// play the normal track as usual. // play the normal track as usual.
if (seqId == NA_BGM_FIELD_MORNING) { if (seqId == NA_BGM_FIELD_MORNING) {
if (CVarGetInteger("gAudioEditor.ReplacedSequences.NA_BGM_FIELD_LOGIC.value", NA_BGM_FIELD_LOGIC) != NA_BGM_FIELD_LOGIC) { if (CVarGetInteger(CVAR_AUDIO("ReplacedSequences.NA_BGM_FIELD_LOGIC.value"), NA_BGM_FIELD_LOGIC) != NA_BGM_FIELD_LOGIC) {
seqId = NA_BGM_FIELD_LOGIC; seqId = NA_BGM_FIELD_LOGIC;
} }
} }
@ -381,19 +384,19 @@ uint16_t AudioCollection::GetReplacementSequence(uint16_t seqId) {
} }
void AudioCollection::RemoveFromShufflePool(SequenceInfo* seqInfo) { void AudioCollection::RemoveFromShufflePool(SequenceInfo* seqInfo) {
const std::string cvarKey = "gAudioEditor.Excluded." + seqInfo->sfxKey; const std::string cvarKey = std::string(CVAR_AUDIO("Excluded.")) + seqInfo->sfxKey;
excludedSequences.insert(seqInfo); excludedSequences.insert(seqInfo);
includedSequences.erase(seqInfo); includedSequences.erase(seqInfo);
CVarSetInteger(cvarKey.c_str(), 1); CVarSetInteger(cvarKey.c_str(), 1);
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
} }
void AudioCollection::AddToShufflePool(SequenceInfo* seqInfo) { void AudioCollection::AddToShufflePool(SequenceInfo* seqInfo) {
const std::string cvarKey = "gAudioEditor.Excluded." + seqInfo->sfxKey; const std::string cvarKey = std::string(CVAR_AUDIO("Excluded.")) + seqInfo->sfxKey;
includedSequences.insert(seqInfo); includedSequences.insert(seqInfo);
excludedSequences.erase(seqInfo); excludedSequences.erase(seqInfo);
CVarClear(cvarKey.c_str()); CVarClear(cvarKey.c_str());
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
} }
void AudioCollection::InitializeShufflePool() { void AudioCollection::InitializeShufflePool() {
@ -401,7 +404,7 @@ void AudioCollection::InitializeShufflePool() {
for (auto& [seqId, seqInfo] : sequenceMap) { for (auto& [seqId, seqInfo] : sequenceMap) {
if (!seqInfo.canBeUsedAsReplacement) continue; if (!seqInfo.canBeUsedAsReplacement) continue;
const std::string cvarKey = "gAudioEditor.Excluded." + seqInfo.sfxKey; const std::string cvarKey = std::string(CVAR_AUDIO("Excluded.")) + seqInfo.sfxKey;
if (CVarGetInteger(cvarKey.c_str(), 0)) { if (CVarGetInteger(cvarKey.c_str(), 0)) {
excludedSequences.insert(&seqInfo); excludedSequences.insert(&seqInfo);
} else { } else {

View File

@ -1,3 +1,4 @@
#pragma once
#ifdef __cplusplus #ifdef __cplusplus
#include <map> #include <map>
#include <string> #include <string>

View File

@ -9,7 +9,7 @@
#include <functions.h> #include <functions.h>
#include "../randomizer/3drando/random.hpp" #include "../randomizer/3drando/random.hpp"
#include "../../OTRGlobals.h" #include "../../OTRGlobals.h"
#include <Utils/StringHelper.h> #include <utils/StringHelper.h>
#include "../../UIWidgets.hpp" #include "../../UIWidgets.hpp"
#include "AudioCollection.h" #include "AudioCollection.h"
#include "soh/Enhancements/game-interactor/GameInteractor.h" #include "soh/Enhancements/game-interactor/GameInteractor.h"
@ -163,17 +163,17 @@ void DrawPreviewButton(uint16_t sequenceId, std::string sfxKey, SeqType sequence
const std::string stopButton = ICON_FA_STOP + hiddenKey; const std::string stopButton = ICON_FA_STOP + hiddenKey;
const std::string previewButton = ICON_FA_PLAY + hiddenKey; const std::string previewButton = ICON_FA_PLAY + hiddenKey;
if (CVarGetInteger("gAudioEditor.Playing", 0) == sequenceId) { if (CVarGetInteger(CVAR_AUDIO("Playing"), 0) == sequenceId) {
if (ImGui::Button(stopButton.c_str())) { if (ImGui::Button(stopButton.c_str())) {
func_800F5C2C(); func_800F5C2C();
CVarSetInteger("gAudioEditor.Playing", 0); CVarSetInteger(CVAR_AUDIO("Playing"), 0);
} }
UIWidgets::Tooltip("Stop Preview"); UIWidgets::Tooltip("Stop Preview");
} else { } else {
if (ImGui::Button(previewButton.c_str())) { if (ImGui::Button(previewButton.c_str())) {
if (CVarGetInteger("gAudioEditor.Playing", 0) != 0) { if (CVarGetInteger(CVAR_AUDIO("Playing"), 0) != 0) {
func_800F5C2C(); func_800F5C2C();
CVarSetInteger("gAudioEditor.Playing", 0); CVarSetInteger(CVAR_AUDIO("Playing"), 0);
} else { } else {
if (sequenceType == SEQ_SFX || sequenceType == SEQ_VOICE) { if (sequenceType == SEQ_SFX || sequenceType == SEQ_VOICE) {
Audio_PlaySoundGeneral(sequenceId, &pos, 4, &freqScale, &freqScale, &reverbAdd); Audio_PlaySoundGeneral(sequenceId, &pos, 4, &freqScale, &freqScale, &reverbAdd);
@ -183,7 +183,7 @@ void DrawPreviewButton(uint16_t sequenceId, std::string sfxKey, SeqType sequence
} else { } else {
// TODO: Cant do both here, so have to click preview button twice // TODO: Cant do both here, so have to click preview button twice
PreviewSequence(sequenceId); PreviewSequence(sequenceId);
CVarSetInteger("gAudioEditor.Playing", sequenceId); CVarSetInteger(CVAR_AUDIO("Playing"), sequenceId);
} }
} }
} }
@ -203,7 +203,7 @@ void Draw_SfxTab(const std::string& tabId, SeqType type) {
auto currentBGM = func_800FA0B4(SEQ_PLAYER_BGM_MAIN); auto currentBGM = func_800FA0B4(SEQ_PLAYER_BGM_MAIN);
auto prevReplacement = AudioCollection::Instance->GetReplacementSequence(currentBGM); auto prevReplacement = AudioCollection::Instance->GetReplacementSequence(currentBGM);
ResetGroup(map, type); ResetGroup(map, type);
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
auto curReplacement = AudioCollection::Instance->GetReplacementSequence(currentBGM); auto curReplacement = AudioCollection::Instance->GetReplacementSequence(currentBGM);
if (type == SEQ_BGM_WORLD && prevReplacement != curReplacement) { if (type == SEQ_BGM_WORLD && prevReplacement != curReplacement) {
ReplayCurrentBGM(); ReplayCurrentBGM();
@ -214,7 +214,7 @@ void Draw_SfxTab(const std::string& tabId, SeqType type) {
auto currentBGM = func_800FA0B4(SEQ_PLAYER_BGM_MAIN); auto currentBGM = func_800FA0B4(SEQ_PLAYER_BGM_MAIN);
auto prevReplacement = AudioCollection::Instance->GetReplacementSequence(currentBGM); auto prevReplacement = AudioCollection::Instance->GetReplacementSequence(currentBGM);
RandomizeGroup(type); RandomizeGroup(type);
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
auto curReplacement = AudioCollection::Instance->GetReplacementSequence(currentBGM); auto curReplacement = AudioCollection::Instance->GetReplacementSequence(currentBGM);
if (type == SEQ_BGM_WORLD && prevReplacement != curReplacement) { if (type == SEQ_BGM_WORLD && prevReplacement != curReplacement) {
ReplayCurrentBGM(); ReplayCurrentBGM();
@ -225,7 +225,7 @@ void Draw_SfxTab(const std::string& tabId, SeqType type) {
auto currentBGM = func_800FA0B4(SEQ_PLAYER_BGM_MAIN); auto currentBGM = func_800FA0B4(SEQ_PLAYER_BGM_MAIN);
auto prevReplacement = AudioCollection::Instance->GetReplacementSequence(currentBGM); auto prevReplacement = AudioCollection::Instance->GetReplacementSequence(currentBGM);
LockGroup(map, type); LockGroup(map, type);
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
auto curReplacement = AudioCollection::Instance->GetReplacementSequence(currentBGM); auto curReplacement = AudioCollection::Instance->GetReplacementSequence(currentBGM);
if (type == SEQ_BGM_WORLD && prevReplacement != curReplacement) { if (type == SEQ_BGM_WORLD && prevReplacement != curReplacement) {
ReplayCurrentBGM(); ReplayCurrentBGM();
@ -236,7 +236,7 @@ void Draw_SfxTab(const std::string& tabId, SeqType type) {
auto currentBGM = func_800FA0B4(SEQ_PLAYER_BGM_MAIN); auto currentBGM = func_800FA0B4(SEQ_PLAYER_BGM_MAIN);
auto prevReplacement = AudioCollection::Instance->GetReplacementSequence(currentBGM); auto prevReplacement = AudioCollection::Instance->GetReplacementSequence(currentBGM);
UnlockGroup(map, type); UnlockGroup(map, type);
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
auto curReplacement = AudioCollection::Instance->GetReplacementSequence(currentBGM); auto curReplacement = AudioCollection::Instance->GetReplacementSequence(currentBGM);
if (type == SEQ_BGM_WORLD && prevReplacement != curReplacement) { if (type == SEQ_BGM_WORLD && prevReplacement != curReplacement) {
ReplayCurrentBGM(); ReplayCurrentBGM();
@ -281,7 +281,7 @@ void Draw_SfxTab(const std::string& tabId, SeqType type) {
if (ImGui::Selectable(seqData.label.c_str())) { if (ImGui::Selectable(seqData.label.c_str())) {
CVarSetInteger(cvarKey.c_str(), value); CVarSetInteger(cvarKey.c_str(), value);
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
UpdateCurrentBGM(defaultValue, type); UpdateCurrentBGM(defaultValue, type);
} }
@ -301,7 +301,7 @@ void Draw_SfxTab(const std::string& tabId, SeqType type) {
if (ImGui::Button(resetButton.c_str())) { if (ImGui::Button(resetButton.c_str())) {
CVarClear(cvarKey.c_str()); CVarClear(cvarKey.c_str());
CVarClear(cvarLockKey.c_str()); CVarClear(cvarLockKey.c_str());
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
UpdateCurrentBGM(defaultValue, seqData.category); UpdateCurrentBGM(defaultValue, seqData.category);
} }
UIWidgets::Tooltip("Reset to default"); UIWidgets::Tooltip("Reset to default");
@ -322,7 +322,7 @@ void Draw_SfxTab(const std::string& tabId, SeqType type) {
if (locked) { if (locked) {
CVarClear(cvarLockKey.c_str()); CVarClear(cvarLockKey.c_str());
} }
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
UpdateCurrentBGM(defaultValue, type); UpdateCurrentBGM(defaultValue, type);
} }
} }
@ -335,7 +335,7 @@ void Draw_SfxTab(const std::string& tabId, SeqType type) {
} else { } else {
CVarSetInteger(cvarLockKey.c_str(), 1); CVarSetInteger(cvarLockKey.c_str(), 1);
} }
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
} }
UIWidgets::Tooltip(locked ? "Sound locked" : "Sound unlocked"); UIWidgets::Tooltip(locked ? "Sound locked" : "Sound unlocked");
} }
@ -411,7 +411,7 @@ void DrawTypeChip(SeqType type) {
void AudioEditorRegisterOnSceneInitHook() { void AudioEditorRegisterOnSceneInitHook() {
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnSceneInit>([](int16_t sceneNum) { GameInteractor::Instance->RegisterGameHook<GameInteractor::OnSceneInit>([](int16_t sceneNum) {
if (CVarGetInteger("gAudioEditor.RandomizeAllOnNewScene", 0)) { if (CVarGetInteger(CVAR_AUDIO("RandomizeAllOnNewScene"), 0)) {
AudioEditor_RandomizeAll(); AudioEditor_RandomizeAll();
} }
}); });
@ -492,18 +492,18 @@ void AudioEditor::DrawElement() {
ImGui::TableNextColumn(); ImGui::TableNextColumn();
if (ImGui::BeginChild("SfxOptions", ImVec2(0, -8))) { if (ImGui::BeginChild("SfxOptions", ImVec2(0, -8))) {
ImGui::PushItemWidth(-FLT_MIN); ImGui::PushItemWidth(-FLT_MIN);
UIWidgets::EnhancementCheckbox("Disable Enemy Proximity Music", "gEnemyBGMDisable"); UIWidgets::EnhancementCheckbox("Disable Enemy Proximity Music", CVAR_AUDIO("EnemyBGMDisable"));
UIWidgets::InsertHelpHoverText( UIWidgets::InsertHelpHoverText(
"Disables the music change when getting close to enemies. Useful for hearing " "Disables the music change when getting close to enemies. Useful for hearing "
"your custom music for each scene more often."); "your custom music for each scene more often.");
UIWidgets::EnhancementCheckbox("Disable Leading Music in Lost Woods", "gLostWoodsConsistentVolume"); UIWidgets::EnhancementCheckbox("Disable Leading Music in Lost Woods", CVAR_AUDIO("LostWoodsConsistentVolume"));
UIWidgets::InsertHelpHoverText( UIWidgets::InsertHelpHoverText(
"Disables the volume shifting in the Lost Woods. Useful for hearing " "Disables the volume shifting in the Lost Woods. Useful for hearing "
"your custom music in the Lost Woods if you don't need the navigation assitance " "your custom music in the Lost Woods if you don't need the navigation assitance "
"the volume changing provides. If toggling this while in the Lost Woods, reload " "the volume changing provides. If toggling this while in the Lost Woods, reload "
"the area for the effect to kick in." "the area for the effect to kick in."
); );
UIWidgets::EnhancementCheckbox("Display Sequence Name on Overlay", "gSeqNameOverlay"); UIWidgets::EnhancementCheckbox("Display Sequence Name on Overlay", CVAR_AUDIO("SeqNameOverlay"));
UIWidgets::InsertHelpHoverText( UIWidgets::InsertHelpHoverText(
"Displays the name of the current sequence in the corner of the screen whenever a new sequence " "Displays the name of the current sequence in the corner of the screen whenever a new sequence "
"is loaded to the main sequence player (does not apply to fanfares or enemy BGM)." "is loaded to the main sequence player (does not apply to fanfares or enemy BGM)."
@ -511,28 +511,28 @@ void AudioEditor::DrawElement() {
ImGui::SameLine(); ImGui::SameLine();
ImGui::PushItemWidth(ImGui::GetContentRegionAvail().x); ImGui::PushItemWidth(ImGui::GetContentRegionAvail().x);
UIWidgets::EnhancementSliderInt("Overlay Duration: %d seconds", "##SeqNameOverlayDuration", UIWidgets::EnhancementSliderInt("Overlay Duration: %d seconds", "##SeqNameOverlayDuration",
"gSeqNameOverlayDuration", 1, 10, "", 5); CVAR_AUDIO("SeqNameOverlayDuration"), 1, 10, "", 5);
ImGui::PopItemWidth(); ImGui::PopItemWidth();
ImGui::NewLine(); ImGui::NewLine();
ImGui::PopItemWidth(); ImGui::PopItemWidth();
UIWidgets::EnhancementSliderFloat("Link's voice pitch multiplier: %.1f %%", "##linkVoiceFreqMultiplier", UIWidgets::EnhancementSliderFloat("Link's voice pitch multiplier: %.1f %%", "##linkVoiceFreqMultiplier",
"gLinkVoiceFreqMultiplier", 0.4, 2.5, "", 1.0, true, true); CVAR_AUDIO("LinkVoiceFreqMultiplier"), 0.4, 2.5, "", 1.0, true, true);
ImGui::SameLine(); ImGui::SameLine();
const std::string resetButton = "Reset##linkVoiceFreqMultiplier"; const std::string resetButton = "Reset##linkVoiceFreqMultiplier";
if (ImGui::Button(resetButton.c_str())) { if (ImGui::Button(resetButton.c_str())) {
CVarSetFloat("gLinkVoiceFreqMultiplier", 1.0f); CVarSetFloat(CVAR_AUDIO("LinkVoiceFreqMultiplier"), 1.0f);
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
} }
ImGui::NewLine(); ImGui::NewLine();
UIWidgets::EnhancementCheckbox("Randomize All Music and Sound Effects on New Scene", "gAudioEditor.RandomizeAllOnNewScene"); UIWidgets::EnhancementCheckbox("Randomize All Music and Sound Effects on New Scene", CVAR_AUDIO("RandomizeAllOnNewScene"));
UIWidgets::Tooltip("Enables randomizing all unlocked music and sound effects when you enter a new scene."); UIWidgets::Tooltip("Enables randomizing all unlocked music and sound effects when you enter a new scene.");
ImGui::NewLine(); ImGui::NewLine();
ImGui::PushItemWidth(-FLT_MIN); ImGui::PushItemWidth(-FLT_MIN);
UIWidgets::PaddedSeparator(); UIWidgets::PaddedSeparator();
UIWidgets::PaddedText("The following options are experimental and may cause music\nto sound odd or have other undesireable effects."); UIWidgets::PaddedText("The following options are experimental and may cause music\nto sound odd or have other undesireable effects.");
UIWidgets::EnhancementCheckbox("Lower Octaves of Unplayable High Notes", "gExperimentalOctaveDrop"); UIWidgets::EnhancementCheckbox("Lower Octaves of Unplayable High Notes", CVAR_AUDIO("ExperimentalOctaveDrop"));
UIWidgets::InsertHelpHoverText("Some custom sequences may have notes that are too high for the game's audio " UIWidgets::InsertHelpHoverText("Some custom sequences may have notes that are too high for the game's audio "
"engine to play. Enabling this checkbox will cause these notes to drop a " "engine to play. Enabling this checkbox will cause these notes to drop a "
"couple of octaves so they can still harmonize with the other notes of the " "couple of octaves so they can still harmonize with the other notes of the "
@ -710,7 +710,14 @@ void AudioEditor_RandomizeAll() {
RandomizeGroup(type); RandomizeGroup(type);
} }
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
ReplayCurrentBGM();
}
void AudioEditor_RandomizeGroup(SeqType group) {
RandomizeGroup(group);
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
ReplayCurrentBGM(); ReplayCurrentBGM();
} }
@ -719,7 +726,14 @@ void AudioEditor_ResetAll() {
ResetGroup(AudioCollection::Instance->GetAllSequences(), type); ResetGroup(AudioCollection::Instance->GetAllSequences(), type);
} }
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
ReplayCurrentBGM();
}
void AudioEditor_ResetGroup(SeqType group) {
ResetGroup(AudioCollection::Instance->GetAllSequences(), group);
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
ReplayCurrentBGM(); ReplayCurrentBGM();
} }
@ -728,7 +742,7 @@ void AudioEditor_LockAll() {
LockGroup(AudioCollection::Instance->GetAllSequences(), type); LockGroup(AudioCollection::Instance->GetAllSequences(), type);
} }
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
} }
void AudioEditor_UnlockAll() { void AudioEditor_UnlockAll() {
@ -736,5 +750,5 @@ void AudioEditor_UnlockAll() {
UnlockGroup(AudioCollection::Instance->GetAllSequences(), type); UnlockGroup(AudioCollection::Instance->GetAllSequences(), type);
} }
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
} }

View File

@ -7,11 +7,12 @@
#ifndef IMGUI_DEFINE_MATH_OPERATORS #ifndef IMGUI_DEFINE_MATH_OPERATORS
#define IMGUI_DEFINE_MATH_OPERATORS #define IMGUI_DEFINE_MATH_OPERATORS
#endif #endif
#include <ImGui/imgui.h> #include <imgui.h>
#include "AudioCollection.h"
class AudioEditor : public LUS::GuiWindow { class AudioEditor : public Ship::GuiWindow {
public: public:
using LUS::GuiWindow::GuiWindow; using GuiWindow::GuiWindow;
void DrawElement() override; void DrawElement() override;
void InitElement() override; void InitElement() override;
@ -20,7 +21,9 @@ class AudioEditor : public LUS::GuiWindow {
}; };
void AudioEditor_RandomizeAll(); void AudioEditor_RandomizeAll();
void AudioEditor_RandomizeGroup(SeqType group);
void AudioEditor_ResetAll(); void AudioEditor_ResetAll();
void AudioEditor_ResetGroup(SeqType group);
void AudioEditor_LockAll(); void AudioEditor_LockAll();
void AudioEditor_UnlockAll(); void AudioEditor_UnlockAll();

View File

@ -9,6 +9,7 @@
#include <string.h> #include <string.h>
#include <stdarg.h> #include <stdarg.h>
#include <z64.h> #include <z64.h>
#include "soh/OTRGlobals.h"
uint8_t gLoadFileSelect = 0, gSkipLogoTest = 0; uint8_t gLoadFileSelect = 0, gSkipLogoTest = 0;
@ -21,15 +22,15 @@ static BootCommand sCommands[] = { { "--skiplogo", BootCommands_Command_SkipLogo
void BootCommands_Init() void BootCommands_Init()
{ {
// Clears vars to prevent randomizer menu from being disabled // Clears vars to prevent randomizer menu from being disabled
CVarClear("gRandoGenerating"); // Clear when a crash happened during rando seed generation CVarClear(CVAR_GENERAL("RandoGenerating")); // Clear when a crash happened during rando seed generation
CVarClear("gNewSeedGenerated"); CVarClear(CVAR_GENERAL("NewSeedGenerated"));
CVarClear("gOnFileSelectNameEntry"); // Clear when soh is killed on the file name entry page CVarClear(CVAR_GENERAL("OnFileSelectNameEntry")); // Clear when soh is killed on the file name entry page
CVarClear("gBetterDebugWarpScreenMQMode"); CVarClear(CVAR_GENERAL("BetterDebugWarpScreenMQMode"));
CVarClear("gBetterDebugWarpScreenMQModeScene"); CVarClear(CVAR_GENERAL("BetterDebugWarpScreenMQModeScene"));
CVarClear("gCheatEasyPauseBufferLastInputs"); CVarClear(CVAR_GENERAL("CheatEasyPauseBufferLastInputs"));
CVarClear("gCheatEasyPauseBufferTimer"); CVarClear(CVAR_GENERAL("CheatEasyPauseBufferTimer"));
#if defined(__SWITCH__) || defined(__WIIU__) #if defined(__SWITCH__) || defined(__WIIU__)
CVarRegisterInteger("gControlNav", 1); // always enable controller nav on switch/wii u CVarRegisterInteger(CVAR_IMGUI_CONTROLLER_NAV, 1); // always enable controller nav on switch/wii u
#endif #endif
} }

View File

@ -3,10 +3,11 @@
#include "public/bridge/consolevariablebridge.h" #include "public/bridge/consolevariablebridge.h"
#include "libultraship/libultra/controller.h" #include "libultraship/libultra/controller.h"
#include "Context.h" #include "Context.h"
#include "soh/OTRGlobals.h"
#ifndef IMGUI_DEFINE_MATH_OPERATORS #ifndef IMGUI_DEFINE_MATH_OPERATORS
#define IMGUI_DEFINE_MATH_OPERATORS #define IMGUI_DEFINE_MATH_OPERATORS
#endif #endif
#include <ImGui/imgui.h> #include <imgui.h>
#include <spdlog/spdlog.h> #include <spdlog/spdlog.h>
#include <cmath> #include <cmath>
@ -46,77 +47,77 @@ void InputViewer::RenderButton(std::string btnTexture, std::string btnOutlineTex
// Render Outline based on settings // Render Outline based on settings
if (outlineMode == BUTTON_OUTLINE_ALWAYS_SHOWN || (outlineMode == BUTTON_OUTLINE_NOT_PRESSED && !state) || if (outlineMode == BUTTON_OUTLINE_ALWAYS_SHOWN || (outlineMode == BUTTON_OUTLINE_NOT_PRESSED && !state) ||
(outlineMode == BUTTON_OUTLINE_PRESSED && state)) { (outlineMode == BUTTON_OUTLINE_PRESSED && state)) {
ImGui::Image(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(btnOutlineTexture), size, ImGui::Image(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(btnOutlineTexture), size,
ImVec2(0, 0), ImVec2(1.0f, 1.0f), ImVec4(255, 255, 255, 255)); ImVec2(0, 0), ImVec2(1.0f, 1.0f), ImVec4(255, 255, 255, 255));
} }
// Render button if pressed // Render button if pressed
if (state) { if (state) {
ImGui::SetCursorPos(pos); ImGui::SetCursorPos(pos);
ImGui::SetNextItemAllowOverlap(); ImGui::SetNextItemAllowOverlap();
ImGui::Image(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(btnTexture), size, ImGui::Image(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(btnTexture), size,
ImVec2(0, 0), ImVec2(1.0f, 1.0f), ImVec4(255, 255, 255, 255)); ImVec2(0, 0), ImVec2(1.0f, 1.0f), ImVec4(255, 255, 255, 255));
} }
} }
void InputViewer::DrawElement() { void InputViewer::DrawElement() {
if (CVarGetInteger("gOpenWindows.InputViewer", 0)) { if (CVarGetInteger(CVAR_WINDOW("InputViewer"), 0)) {
static bool sButtonTexturesLoaded = false; static bool sButtonTexturesLoaded = false;
if (!sButtonTexturesLoaded) { if (!sButtonTexturesLoaded) {
LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage( Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage(
"Input-Viewer-Background", "textures/buttons/InputViewerBackground.png"); "Input-Viewer-Background", "textures/buttons/InputViewerBackground.png");
LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("A-Btn", "textures/buttons/ABtn.png"); Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("A-Btn", "textures/buttons/ABtn.png");
LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("B-Btn", "textures/buttons/BBtn.png"); Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("B-Btn", "textures/buttons/BBtn.png");
LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("L-Btn", "textures/buttons/LBtn.png"); Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("L-Btn", "textures/buttons/LBtn.png");
LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("R-Btn", "textures/buttons/RBtn.png"); Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("R-Btn", "textures/buttons/RBtn.png");
LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("Z-Btn", "textures/buttons/ZBtn.png"); Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("Z-Btn", "textures/buttons/ZBtn.png");
LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("Start-Btn", Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("Start-Btn",
"textures/buttons/StartBtn.png"); "textures/buttons/StartBtn.png");
LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("C-Left", "textures/buttons/CLeft.png"); Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("C-Left", "textures/buttons/CLeft.png");
LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("C-Right", "textures/buttons/CRight.png"); Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("C-Right", "textures/buttons/CRight.png");
LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("C-Up", "textures/buttons/CUp.png"); Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("C-Up", "textures/buttons/CUp.png");
LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("C-Down", "textures/buttons/CDown.png"); Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("C-Down", "textures/buttons/CDown.png");
LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("Analog-Stick", Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("Analog-Stick",
"textures/buttons/AnalogStick.png"); "textures/buttons/AnalogStick.png");
LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("Dpad-Left", Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("Dpad-Left",
"textures/buttons/DPadLeft.png"); "textures/buttons/DPadLeft.png");
LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("Dpad-Right", Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("Dpad-Right",
"textures/buttons/DPadRight.png"); "textures/buttons/DPadRight.png");
LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("Dpad-Up", "textures/buttons/DPadUp.png"); Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("Dpad-Up", "textures/buttons/DPadUp.png");
LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("Dpad-Down", Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("Dpad-Down",
"textures/buttons/DPadDown.png"); "textures/buttons/DPadDown.png");
LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("Right-Stick", Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("Right-Stick",
"textures/buttons/RightStick.png"); "textures/buttons/RightStick.png");
LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("A-Btn Outline", Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("A-Btn Outline",
"textures/buttons/ABtnOutline.png"); "textures/buttons/ABtnOutline.png");
LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("B-Btn Outline", Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("B-Btn Outline",
"textures/buttons/BBtnOutline.png"); "textures/buttons/BBtnOutline.png");
LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("L-Btn Outline", Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("L-Btn Outline",
"textures/buttons/LBtnOutline.png"); "textures/buttons/LBtnOutline.png");
LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("R-Btn Outline", Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("R-Btn Outline",
"textures/buttons/RBtnOutline.png"); "textures/buttons/RBtnOutline.png");
LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("Z-Btn Outline", Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("Z-Btn Outline",
"textures/buttons/ZBtnOutline.png"); "textures/buttons/ZBtnOutline.png");
LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("Start-Btn Outline", Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("Start-Btn Outline",
"textures/buttons/StartBtnOutline.png"); "textures/buttons/StartBtnOutline.png");
LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("C-Left Outline", Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("C-Left Outline",
"textures/buttons/CLeftOutline.png"); "textures/buttons/CLeftOutline.png");
LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("C-Right Outline", Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("C-Right Outline",
"textures/buttons/CRightOutline.png"); "textures/buttons/CRightOutline.png");
LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("C-Up Outline", Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("C-Up Outline",
"textures/buttons/CUpOutline.png"); "textures/buttons/CUpOutline.png");
LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("C-Down Outline", Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("C-Down Outline",
"textures/buttons/CDownOutline.png"); "textures/buttons/CDownOutline.png");
LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("Analog-Stick Outline", Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("Analog-Stick Outline",
"textures/buttons/AnalogStickOutline.png"); "textures/buttons/AnalogStickOutline.png");
LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("Dpad-Left Outline", Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("Dpad-Left Outline",
"textures/buttons/DPadLeftOutline.png"); "textures/buttons/DPadLeftOutline.png");
LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("Dpad-Right Outline", Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("Dpad-Right Outline",
"textures/buttons/DPadRightOutline.png"); "textures/buttons/DPadRightOutline.png");
LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("Dpad-Up Outline", Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("Dpad-Up Outline",
"textures/buttons/DPadUpOutline.png"); "textures/buttons/DPadUpOutline.png");
LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("Dpad-Down Outline", Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("Dpad-Down Outline",
"textures/buttons/DPadDownOutline.png"); "textures/buttons/DPadDownOutline.png");
LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("Right-Stick Outline", Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("Right-Stick Outline",
"textures/buttons/RightStickOutline.png"); "textures/buttons/RightStickOutline.png");
sButtonTexturesLoaded = true; sButtonTexturesLoaded = true;
} }
@ -125,23 +126,23 @@ void InputViewer::DrawElement() {
ImVec2 size = ImGui::GetContentRegionAvail(); ImVec2 size = ImGui::GetContentRegionAvail();
#ifdef __WIIU__ #ifdef __WIIU__
const float scale = CVarGetFloat("gInputViewer.Scale", 1.0f) * 2.0f; const float scale = CVarGetFloat(CVAR_INPUT_VIEWER("Scale"), 1.0f) * 2.0f;
#else #else
const float scale = CVarGetFloat("gInputViewer.Scale", 1.0f); const float scale = CVarGetFloat(CVAR_INPUT_VIEWER("Scale"), 1.0f);
#endif #endif
const int showAnalogAngles = CVarGetInteger("gInputViewer.AnalogAngles.Enabled", 0); const int showAnalogAngles = CVarGetInteger(CVAR_INPUT_VIEWER("AnalogAngles.Enabled"), 0);
const int buttonOutlineMode = CVarGetInteger("gInputViewer.ButtonOutlineMode", BUTTON_OUTLINE_NOT_PRESSED); const int buttonOutlineMode = CVarGetInteger(CVAR_INPUT_VIEWER("ButtonOutlineMode"), BUTTON_OUTLINE_NOT_PRESSED);
ImVec2 bgSize = LUS::Context::GetInstance()->GetWindow()->GetGui()->GetTextureSize("Input-Viewer-Background"); ImVec2 bgSize = Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureSize("Input-Viewer-Background");
ImVec2 scaledBGSize = ImVec2(bgSize.x * scale, bgSize.y * scale); ImVec2 scaledBGSize = ImVec2(bgSize.x * scale, bgSize.y * scale);
ImGui::SetNextWindowSize(ImVec2( ImGui::SetNextWindowSize(ImVec2(
scaledBGSize.x + 20, scaledBGSize.x + 20,
scaledBGSize.y + scaledBGSize.y +
(showAnalogAngles ? ImGui::CalcTextSize("X").y : 0) * scale * CVarGetFloat("gInputViewer.AnalogAngles.Scale", 1.0f) + 20)); (showAnalogAngles ? ImGui::CalcTextSize("X").y : 0) * scale * CVarGetFloat(CVAR_INPUT_VIEWER("AnalogAngles.Scale"), 1.0f) + 20));
ImGui::SetNextWindowContentSize( ImGui::SetNextWindowContentSize(
ImVec2(scaledBGSize.x, scaledBGSize.y + (showAnalogAngles ? 15 : 0) * scale * ImVec2(scaledBGSize.x, scaledBGSize.y + (showAnalogAngles ? 15 : 0) * scale *
CVarGetFloat("gInputViewer.AnalogAngles.Scale", 1.0f))); CVarGetFloat(CVAR_INPUT_VIEWER("AnalogAngles.Scale"), 1.0f)));
ImGui::SetNextWindowPos( ImGui::SetNextWindowPos(
ImVec2(mainPos.x + size.x - scaledBGSize.x - 30, mainPos.y + size.y - scaledBGSize.y - 30), ImVec2(mainPos.x + size.x - scaledBGSize.x - 30, mainPos.y + size.y - scaledBGSize.y - 30),
ImGuiCond_FirstUseEver); ImGuiCond_FirstUseEver);
@ -149,13 +150,13 @@ void InputViewer::DrawElement() {
ImGui::PushStyleColor(ImGuiCol_WindowBg, ImVec4(0, 0, 0, 0)); ImGui::PushStyleColor(ImGuiCol_WindowBg, ImVec4(0, 0, 0, 0));
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(0.0f, 0.0f)); ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(0.0f, 0.0f));
OSContPad* pads = LUS::Context::GetInstance()->GetControlDeck()->GetPads(); OSContPad* pads = Ship::Context::GetInstance()->GetControlDeck()->GetPads();
ImGuiWindowFlags windowFlags = ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags windowFlags = ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoScrollbar |
ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoBackground | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoBackground |
ImGuiWindowFlags_NoFocusOnAppearing; ImGuiWindowFlags_NoFocusOnAppearing;
if (!CVarGetInteger("gInputViewer.EnableDragging", 1)) { if (!CVarGetInteger(CVAR_INPUT_VIEWER("EnableDragging"), 1)) {
windowFlags |= ImGuiWindowFlags_NoInputs | ImGuiWindowFlags_NoMove; windowFlags |= ImGuiWindowFlags_NoInputs | ImGuiWindowFlags_NoMove;
} }
@ -163,68 +164,68 @@ void InputViewer::DrawElement() {
ImGui::SetCursorPos(ImVec2(10, 10)); ImGui::SetCursorPos(ImVec2(10, 10));
const ImVec2 aPos = ImGui::GetCursorPos(); const ImVec2 aPos = ImGui::GetCursorPos();
if (CVarGetInteger("gInputViewer.ShowBackground", 1)) { if (CVarGetInteger(CVAR_INPUT_VIEWER("ShowBackground"), 1)) {
ImGui::SetNextItemAllowOverlap(); ImGui::SetNextItemAllowOverlap();
// Background // Background
ImGui::Image( ImGui::Image(
LUS::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName("Input-Viewer-Background"), Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName("Input-Viewer-Background"),
scaledBGSize, ImVec2(0, 0), ImVec2(1.0f, 1.0f), ImVec4(255, 255, 255, 255)); scaledBGSize, ImVec2(0, 0), ImVec2(1.0f, 1.0f), ImVec4(255, 255, 255, 255));
} }
// A/B // A/B
if (CVarGetInteger("gInputViewer.BBtn", 1)) { if (CVarGetInteger(CVAR_INPUT_VIEWER("BBtn"), 1)) {
ImGui::SetNextItemAllowOverlap(); ImGui::SetNextItemAllowOverlap();
ImGui::SetCursorPos(aPos); ImGui::SetCursorPos(aPos);
RenderButton("B-Btn", "B-Btn Outline", pads[0].button & BTN_B, scaledBGSize, buttonOutlineMode); RenderButton("B-Btn", "B-Btn Outline", pads[0].button & BTN_B, scaledBGSize, buttonOutlineMode);
} }
if (CVarGetInteger("gInputViewer.ABtn", 1)) { if (CVarGetInteger(CVAR_INPUT_VIEWER("ABtn"), 1)) {
ImGui::SetNextItemAllowOverlap(); ImGui::SetNextItemAllowOverlap();
ImGui::SetCursorPos(aPos); ImGui::SetCursorPos(aPos);
RenderButton("A-Btn", "A-Btn Outline", pads[0].button & BTN_A, scaledBGSize, buttonOutlineMode); RenderButton("A-Btn", "A-Btn Outline", pads[0].button & BTN_A, scaledBGSize, buttonOutlineMode);
} }
// C buttons // C buttons
if (CVarGetInteger("gInputViewer.CUp", 1)) { if (CVarGetInteger(CVAR_INPUT_VIEWER("CUp"), 1)) {
ImGui::SetNextItemAllowOverlap(); ImGui::SetNextItemAllowOverlap();
ImGui::SetCursorPos(aPos); ImGui::SetCursorPos(aPos);
RenderButton("C-Up", "C-Up Outline", pads[0].button & BTN_CUP, scaledBGSize, buttonOutlineMode); RenderButton("C-Up", "C-Up Outline", pads[0].button & BTN_CUP, scaledBGSize, buttonOutlineMode);
} }
if (CVarGetInteger("gInputViewer.CLeft", 1)) { if (CVarGetInteger(CVAR_INPUT_VIEWER("CLeft"), 1)) {
ImGui::SetNextItemAllowOverlap(); ImGui::SetNextItemAllowOverlap();
ImGui::SetCursorPos(aPos); ImGui::SetCursorPos(aPos);
RenderButton("C-Left", "C-Left Outline", pads[0].button & BTN_CLEFT, scaledBGSize, buttonOutlineMode); RenderButton("C-Left", "C-Left Outline", pads[0].button & BTN_CLEFT, scaledBGSize, buttonOutlineMode);
} }
if (CVarGetInteger("gInputViewer.CRight", 1)) { if (CVarGetInteger(CVAR_INPUT_VIEWER("CRight"), 1)) {
ImGui::SetNextItemAllowOverlap(); ImGui::SetNextItemAllowOverlap();
ImGui::SetCursorPos(aPos); ImGui::SetCursorPos(aPos);
RenderButton("C-Right", "C-Right Outline", pads[0].button & BTN_CRIGHT, scaledBGSize, RenderButton("C-Right", "C-Right Outline", pads[0].button & BTN_CRIGHT, scaledBGSize,
buttonOutlineMode); buttonOutlineMode);
} }
if (CVarGetInteger("gInputViewer.CDown", 1)) { if (CVarGetInteger(CVAR_INPUT_VIEWER("CDown"), 1)) {
ImGui::SetNextItemAllowOverlap(); ImGui::SetNextItemAllowOverlap();
ImGui::SetCursorPos(aPos); ImGui::SetCursorPos(aPos);
RenderButton("C-Down", "C-Down Outline", pads[0].button & BTN_CDOWN, scaledBGSize, buttonOutlineMode); RenderButton("C-Down", "C-Down Outline", pads[0].button & BTN_CDOWN, scaledBGSize, buttonOutlineMode);
} }
// L/R/Z // L/R/Z
if (CVarGetInteger("gInputViewer.LBtn", 1)) { if (CVarGetInteger(CVAR_INPUT_VIEWER("LBtn"), 1)) {
ImGui::SetNextItemAllowOverlap(); ImGui::SetNextItemAllowOverlap();
ImGui::SetCursorPos(aPos); ImGui::SetCursorPos(aPos);
RenderButton("L-Btn", "L-Btn Outline", pads[0].button & BTN_L, scaledBGSize, buttonOutlineMode); RenderButton("L-Btn", "L-Btn Outline", pads[0].button & BTN_L, scaledBGSize, buttonOutlineMode);
} }
if (CVarGetInteger("gInputViewer.RBtn", 1)) { if (CVarGetInteger(CVAR_INPUT_VIEWER("RBtn"), 1)) {
ImGui::SetNextItemAllowOverlap(); ImGui::SetNextItemAllowOverlap();
ImGui::SetCursorPos(aPos); ImGui::SetCursorPos(aPos);
RenderButton("R-Btn", "R-Btn Outline", pads[0].button & BTN_R, scaledBGSize, buttonOutlineMode); RenderButton("R-Btn", "R-Btn Outline", pads[0].button & BTN_R, scaledBGSize, buttonOutlineMode);
} }
if (CVarGetInteger("gInputViewer.ZBtn", 1)) { if (CVarGetInteger(CVAR_INPUT_VIEWER("ZBtn"), 1)) {
ImGui::SetNextItemAllowOverlap(); ImGui::SetNextItemAllowOverlap();
ImGui::SetCursorPos(aPos); ImGui::SetCursorPos(aPos);
RenderButton("Z-Btn", "Z-Btn Outline", pads[0].button & BTN_Z, scaledBGSize, buttonOutlineMode); RenderButton("Z-Btn", "Z-Btn Outline", pads[0].button & BTN_Z, scaledBGSize, buttonOutlineMode);
} }
// Start // Start
if (CVarGetInteger("gInputViewer.StartBtn", 1)) { if (CVarGetInteger(CVAR_INPUT_VIEWER("StartBtn"), 1)) {
ImGui::SetNextItemAllowOverlap(); ImGui::SetNextItemAllowOverlap();
ImGui::SetCursorPos(aPos); ImGui::SetCursorPos(aPos);
RenderButton("Start-Btn", "Start-Btn Outline", pads[0].button & BTN_START, scaledBGSize, RenderButton("Start-Btn", "Start-Btn Outline", pads[0].button & BTN_START, scaledBGSize,
@ -232,7 +233,7 @@ void InputViewer::DrawElement() {
} }
// Dpad // Dpad
if (CVarGetInteger("gInputViewer.Dpad", 0)) { if (CVarGetInteger(CVAR_INPUT_VIEWER("Dpad"), 0)) {
ImGui::SetNextItemAllowOverlap(); ImGui::SetNextItemAllowOverlap();
ImGui::SetCursorPos(aPos); ImGui::SetCursorPos(aPos);
RenderButton("Dpad-Left", "Dpad-Left Outline", pads[0].button & BTN_DLEFT, scaledBGSize, RenderButton("Dpad-Left", "Dpad-Left Outline", pads[0].button & BTN_DLEFT, scaledBGSize,
@ -255,84 +256,84 @@ void InputViewer::DrawElement() {
// Analog Stick // Analog Stick
const int analogOutlineMode = const int analogOutlineMode =
CVarGetInteger("gInputViewer.AnalogStick.OutlineMode", STICK_MODE_ALWAYS_SHOWN); CVarGetInteger(CVAR_INPUT_VIEWER("AnalogStick.OutlineMode"), STICK_MODE_ALWAYS_SHOWN);
const float maxStickDistance = CVarGetInteger("gInputViewer.AnalogStick.Movement", 12); const float maxStickDistance = CVarGetInteger(CVAR_INPUT_VIEWER("AnalogStick.Movement"), 12);
if (analogOutlineMode == STICK_MODE_ALWAYS_SHOWN || if (analogOutlineMode == STICK_MODE_ALWAYS_SHOWN ||
(analogOutlineMode == STICK_MODE_HIDDEN_IN_DEADZONE && !analogStickIsInDeadzone)) { (analogOutlineMode == STICK_MODE_HIDDEN_IN_DEADZONE && !analogStickIsInDeadzone)) {
ImGui::SetNextItemAllowOverlap(); ImGui::SetNextItemAllowOverlap();
ImGui::SetCursorPos(aPos); ImGui::SetCursorPos(aPos);
ImGui::Image( ImGui::Image(
LUS::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName("Analog-Stick Outline"), Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName("Analog-Stick Outline"),
scaledBGSize, ImVec2(0, 0), ImVec2(1.0f, 1.0f), ImVec4(255, 255, 255, 255)); scaledBGSize, ImVec2(0, 0), ImVec2(1.0f, 1.0f), ImVec4(255, 255, 255, 255));
} }
const int analogStickMode = const int analogStickMode =
CVarGetInteger("gInputViewer.AnalogStick.VisibilityMode", STICK_MODE_ALWAYS_SHOWN); CVarGetInteger(CVAR_INPUT_VIEWER("AnalogStick.VisibilityMode"), STICK_MODE_ALWAYS_SHOWN);
if (analogStickMode == STICK_MODE_ALWAYS_SHOWN || if (analogStickMode == STICK_MODE_ALWAYS_SHOWN ||
(analogStickMode == STICK_MODE_HIDDEN_IN_DEADZONE && !analogStickIsInDeadzone)) { (analogStickMode == STICK_MODE_HIDDEN_IN_DEADZONE && !analogStickIsInDeadzone)) {
ImGui::SetNextItemAllowOverlap(); ImGui::SetNextItemAllowOverlap();
ImGui::SetCursorPos( ImGui::SetCursorPos(
ImVec2(aPos.x + maxStickDistance * ((float)(pads[0].stick_x) / MAX_AXIS_RANGE) * scale, ImVec2(aPos.x + maxStickDistance * ((float)(pads[0].stick_x) / MAX_AXIS_RANGE) * scale,
aPos.y - maxStickDistance * ((float)(pads[0].stick_y) / MAX_AXIS_RANGE) * scale)); aPos.y - maxStickDistance * ((float)(pads[0].stick_y) / MAX_AXIS_RANGE) * scale));
ImGui::Image(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName("Analog-Stick"), ImGui::Image(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName("Analog-Stick"),
scaledBGSize, ImVec2(0, 0), ImVec2(1.0f, 1.0f), ImVec4(255, 255, 255, 255)); scaledBGSize, ImVec2(0, 0), ImVec2(1.0f, 1.0f), ImVec4(255, 255, 255, 255));
} }
// Right Stick // Right Stick
const float maxRightStickDistance = CVarGetInteger("gInputViewer.RightStick.Movement", 7); const float maxRightStickDistance = CVarGetInteger(CVAR_INPUT_VIEWER("RightStick.Movement"), 7);
const int rightOutlineMode = const int rightOutlineMode =
CVarGetInteger("gInputViewer.RightStick.OutlineMode", STICK_MODE_ALWAYS_HIDDEN); CVarGetInteger(CVAR_INPUT_VIEWER("RightStick.OutlineMode"), STICK_MODE_ALWAYS_HIDDEN);
if (rightOutlineMode == STICK_MODE_ALWAYS_SHOWN || if (rightOutlineMode == STICK_MODE_ALWAYS_SHOWN ||
(rightOutlineMode == STICK_MODE_HIDDEN_IN_DEADZONE && !rightStickIsInDeadzone)) { (rightOutlineMode == STICK_MODE_HIDDEN_IN_DEADZONE && !rightStickIsInDeadzone)) {
ImGui::SetNextItemAllowOverlap(); ImGui::SetNextItemAllowOverlap();
ImGui::SetCursorPos(aPos); ImGui::SetCursorPos(aPos);
ImGui::Image( ImGui::Image(
LUS::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName("Right-Stick Outline"), Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName("Right-Stick Outline"),
scaledBGSize, ImVec2(0, 0), ImVec2(1.0f, 1.0f), ImVec4(255, 255, 255, 255)); scaledBGSize, ImVec2(0, 0), ImVec2(1.0f, 1.0f), ImVec4(255, 255, 255, 255));
} }
const int rightStickMode = const int rightStickMode =
CVarGetInteger("gInputViewer.RightStick.VisibilityMode", STICK_MODE_ALWAYS_HIDDEN); CVarGetInteger(CVAR_INPUT_VIEWER("RightStick.VisibilityMode"), STICK_MODE_ALWAYS_HIDDEN);
if (rightStickMode == STICK_MODE_ALWAYS_SHOWN || if (rightStickMode == STICK_MODE_ALWAYS_SHOWN ||
(rightStickMode == STICK_MODE_HIDDEN_IN_DEADZONE && !rightStickIsInDeadzone)) { (rightStickMode == STICK_MODE_HIDDEN_IN_DEADZONE && !rightStickIsInDeadzone)) {
ImGui::SetNextItemAllowOverlap(); ImGui::SetNextItemAllowOverlap();
ImGui::SetCursorPos( ImGui::SetCursorPos(
ImVec2(aPos.x + maxRightStickDistance * ((float)(pads[0].right_stick_x) / MAX_AXIS_RANGE) * scale, ImVec2(aPos.x + maxRightStickDistance * ((float)(pads[0].right_stick_x) / MAX_AXIS_RANGE) * scale,
aPos.y - maxRightStickDistance * ((float)(pads[0].right_stick_y) / MAX_AXIS_RANGE) * scale)); aPos.y - maxRightStickDistance * ((float)(pads[0].right_stick_y) / MAX_AXIS_RANGE) * scale));
ImGui::Image(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName("Right-Stick"), ImGui::Image(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName("Right-Stick"),
scaledBGSize, ImVec2(0, 0), ImVec2(1.0f, 1.0f), ImVec4(255, 255, 255, 255)); scaledBGSize, ImVec2(0, 0), ImVec2(1.0f, 1.0f), ImVec4(255, 255, 255, 255));
} }
// Analog stick angle text // Analog stick angle text
if (showAnalogAngles) { if (showAnalogAngles) {
ImGui::SetCursorPos(ImVec2(aPos.x + 10 + CVarGetInteger("gInputViewer.AnalogAngles.Offset", 0) * scale, ImGui::SetCursorPos(ImVec2(aPos.x + 10 + CVarGetInteger(CVAR_INPUT_VIEWER("AnalogAngles.Offset"), 0) * scale,
scaledBGSize.y + aPos.y + 10)); scaledBGSize.y + aPos.y + 10));
// Scale font with input viewer scale // Scale font with input viewer scale
float oldFontScale = ImGui::GetFont()->Scale; float oldFontScale = ImGui::GetFont()->Scale;
ImGui::GetFont()->Scale *= scale * CVarGetFloat("gInputViewer.AnalogAngles.Scale", 1.0f); ImGui::GetFont()->Scale *= scale * CVarGetFloat(CVAR_INPUT_VIEWER("AnalogAngles.Scale"), 1.0f);
ImGui::PushFont(ImGui::GetFont()); ImGui::PushFont(ImGui::GetFont());
// Calculate polar R coordinate from X and Y angles, squared to avoid sqrt // Calculate polar R coordinate from X and Y angles, squared to avoid sqrt
const float rSquared = pads[0].stick_x * pads[0].stick_x + pads[0].stick_y * pads[0].stick_y; const float rSquared = pads[0].stick_x * pads[0].stick_x + pads[0].stick_y * pads[0].stick_y;
// ESS range // ESS range
const int range1Min = CVarGetInteger("gInputViewer.AnalogAngles.Range1.Min", 8); const int range1Min = CVarGetInteger(CVAR_INPUT_VIEWER("AnalogAngles.Range1.Min"), 8);
const int range1Max = CVarGetInteger("gInputViewer.AnalogAngles.Range1.Max", 27); const int range1Max = CVarGetInteger(CVAR_INPUT_VIEWER("AnalogAngles.Range1.Max"), 27);
// Walking speed range // Walking speed range
const int range2Min = CVarGetInteger("gInputViewer.AnalogAngles.Range2.Min", 27); const int range2Min = CVarGetInteger(CVAR_INPUT_VIEWER("AnalogAngles.Range2.Min"), 27);
const int range2Max = CVarGetInteger("gInputViewer.AnalogAngles.Range2.Max", 62); const int range2Max = CVarGetInteger(CVAR_INPUT_VIEWER("AnalogAngles.Range2.Max"), 62);
// Push color based on angle ranges // Push color based on angle ranges
if (CVarGetInteger("gInputViewer.AnalogAngles.Range1.Enabled", 0) && if (CVarGetInteger(CVAR_INPUT_VIEWER("AnalogAngles.Range1.Enabled"), 0) &&
(rSquared >= (range1Min * range1Min)) && (rSquared < (range1Max * range1Max))) { (rSquared >= (range1Min * range1Min)) && (rSquared < (range1Max * range1Max))) {
ImGui::PushStyleColor( ImGui::PushStyleColor(
ImGuiCol_Text, ImGuiCol_Text,
color2Vec(CVarGetColor("gInputViewer.AnalogAngles.Range1.Color", vec2Color(range1Color)))); color2Vec(CVarGetColor(CVAR_INPUT_VIEWER("AnalogAngles.Range1.Color"), vec2Color(range1Color))));
} else if (CVarGetInteger("gInputViewer.AnalogAngles.Range2.Enabled", 0) && } else if (CVarGetInteger(CVAR_INPUT_VIEWER("AnalogAngles.Range2.Enabled"), 0) &&
(rSquared >= (range2Min * range2Min)) && (rSquared < (range2Max * range2Max))) { (rSquared >= (range2Min * range2Min)) && (rSquared < (range2Max * range2Max))) {
ImGui::PushStyleColor( ImGui::PushStyleColor(
ImGuiCol_Text, ImGuiCol_Text,
color2Vec(CVarGetColor("gInputViewer.AnalogAngles.Range2.Color", vec2Color(range2Color)))); color2Vec(CVarGetColor(CVAR_INPUT_VIEWER("AnalogAngles.Range2.Color"), vec2Color(range2Color))));
} else { } else {
ImGui::PushStyleColor(ImGuiCol_Text, color2Vec(CVarGetColor("gInputViewer.AnalogAngles.TextColor", ImGui::PushStyleColor(ImGuiCol_Text, color2Vec(CVarGetColor(CVAR_INPUT_VIEWER("AnalogAngles.TextColor"),
vec2Color(textColor)))); vec2Color(textColor))));
} }
@ -363,60 +364,60 @@ void InputViewerSettingsWindow::DrawElement() {
if (ImGui::Begin("Input Viewer Settings", &mIsVisible)) { if (ImGui::Begin("Input Viewer Settings", &mIsVisible)) {
// gInputViewer.Scale // gInputViewer.Scale
UIWidgets::EnhancementSliderFloat("Input Viewer Scale: %.2f", "##Input", "gInputViewer.Scale", 0.1f, 5.0f, "", UIWidgets::EnhancementSliderFloat("Input Viewer Scale: %.2f", "##Input", CVAR_INPUT_VIEWER("Scale"), 0.1f, 5.0f, "",
1.0f, false, true); 1.0f, false, true);
UIWidgets::Tooltip("Sets the on screen size of the input viewer"); UIWidgets::Tooltip("Sets the on screen size of the input viewer");
// gInputViewer.EnableDragging // gInputViewer.EnableDragging
UIWidgets::EnhancementCheckbox("Enable Dragging", "gInputViewer.EnableDragging", false, "", UIWidgets::EnhancementCheckbox("Enable Dragging", CVAR_INPUT_VIEWER("EnableDragging"), false, "",
UIWidgets::CheckboxGraphics::Checkmark, true); UIWidgets::CheckboxGraphics::Checkmark, true);
UIWidgets::PaddedSeparator(true, true); UIWidgets::PaddedSeparator(true, true);
// gInputViewer.ShowBackground // gInputViewer.ShowBackground
UIWidgets::EnhancementCheckbox("Show Background Layer", "gInputViewer.ShowBackground", false, "", UIWidgets::EnhancementCheckbox("Show Background Layer", CVAR_INPUT_VIEWER("ShowBackground"), false, "",
UIWidgets::CheckboxGraphics::Checkmark, true); UIWidgets::CheckboxGraphics::Checkmark, true);
UIWidgets::PaddedSeparator(true, true); UIWidgets::PaddedSeparator(true, true);
if (ImGui::CollapsingHeader("Buttons")) { if (ImGui::CollapsingHeader("Buttons")) {
// gInputViewer.ABtn // gInputViewer.ABtn
UIWidgets::EnhancementCheckbox("Show A-Button Layers", "gInputViewer.ABtn", false, "", UIWidgets::EnhancementCheckbox("Show A-Button Layers", CVAR_INPUT_VIEWER("ABtn"), false, "",
UIWidgets::CheckboxGraphics::Checkmark, true); UIWidgets::CheckboxGraphics::Checkmark, true);
// gInputViewer.BBtn // gInputViewer.BBtn
UIWidgets::EnhancementCheckbox("Show B-Button Layers", "gInputViewer.BBtn", false, "", UIWidgets::EnhancementCheckbox("Show B-Button Layers", CVAR_INPUT_VIEWER("BBtn"), false, "",
UIWidgets::CheckboxGraphics::Checkmark, true); UIWidgets::CheckboxGraphics::Checkmark, true);
// gInputViewer.CUp // gInputViewer.CUp
UIWidgets::EnhancementCheckbox("Show C-Up Layers", "gInputViewer.CUp", false, "", UIWidgets::EnhancementCheckbox("Show C-Up Layers", CVAR_INPUT_VIEWER("CUp"), false, "",
UIWidgets::CheckboxGraphics::Checkmark, true); UIWidgets::CheckboxGraphics::Checkmark, true);
// gInputViewer.CRight // gInputViewer.CRight
UIWidgets::EnhancementCheckbox("Show C-Right Layers", "gInputViewer.CRight", false, "", UIWidgets::EnhancementCheckbox("Show C-Right Layers", CVAR_INPUT_VIEWER("CRight"), false, "",
UIWidgets::CheckboxGraphics::Checkmark, true); UIWidgets::CheckboxGraphics::Checkmark, true);
// gInputViewer.CDown // gInputViewer.CDown
UIWidgets::EnhancementCheckbox("Show C-Down Layers", "gInputViewer.CDown", false, "", UIWidgets::EnhancementCheckbox("Show C-Down Layers", CVAR_INPUT_VIEWER("CDown"), false, "",
UIWidgets::CheckboxGraphics::Checkmark, true); UIWidgets::CheckboxGraphics::Checkmark, true);
// gInputViewer.CLeft // gInputViewer.CLeft
UIWidgets::EnhancementCheckbox("Show C-Left Layers", "gInputViewer.CLeft", false, "", UIWidgets::EnhancementCheckbox("Show C-Left Layers", CVAR_INPUT_VIEWER("CLeft"), false, "",
UIWidgets::CheckboxGraphics::Checkmark, true); UIWidgets::CheckboxGraphics::Checkmark, true);
// gInputViewer.LBtn // gInputViewer.LBtn
UIWidgets::EnhancementCheckbox("Show L-Button Layers", "gInputViewer.LBtn", false, "", UIWidgets::EnhancementCheckbox("Show L-Button Layers", CVAR_INPUT_VIEWER("LBtn"), false, "",
UIWidgets::CheckboxGraphics::Checkmark, true); UIWidgets::CheckboxGraphics::Checkmark, true);
// gInputViewer.RBtn // gInputViewer.RBtn
UIWidgets::EnhancementCheckbox("Show R-Button Layers", "gInputViewer.RBtn", false, "", UIWidgets::EnhancementCheckbox("Show R-Button Layers", CVAR_INPUT_VIEWER("RBtn"), false, "",
UIWidgets::CheckboxGraphics::Checkmark, true); UIWidgets::CheckboxGraphics::Checkmark, true);
// gInputViewer.ZBtn // gInputViewer.ZBtn
UIWidgets::EnhancementCheckbox("Show Z-Button Layers", "gInputViewer.ZBtn", false, "", UIWidgets::EnhancementCheckbox("Show Z-Button Layers", CVAR_INPUT_VIEWER("ZBtn"), false, "",
UIWidgets::CheckboxGraphics::Checkmark, true); UIWidgets::CheckboxGraphics::Checkmark, true);
// gInputViewer.StartBtn // gInputViewer.StartBtn
UIWidgets::EnhancementCheckbox("Show Start Button Layers", "gInputViewer.StartBtn", false, "", UIWidgets::EnhancementCheckbox("Show Start Button Layers", CVAR_INPUT_VIEWER("StartBtn"), false, "",
UIWidgets::CheckboxGraphics::Checkmark, true); UIWidgets::CheckboxGraphics::Checkmark, true);
// gInputViewer.Dpad // gInputViewer.Dpad
UIWidgets::EnhancementCheckbox("Show D-Pad Layers", "gInputViewer.Dpad", false, "", UIWidgets::EnhancementCheckbox("Show D-Pad Layers", CVAR_INPUT_VIEWER("Dpad"), false, "",
UIWidgets::CheckboxGraphics::Checkmark, false); UIWidgets::CheckboxGraphics::Checkmark, false);
// gInputViewer.ButtonOutlineMode // gInputViewer.ButtonOutlineMode
UIWidgets::PaddedText("Button Outlines/Backgrounds", true, false); UIWidgets::PaddedText("Button Outlines/Backgrounds", true, false);
UIWidgets::EnhancementCombobox("gInputViewer.ButtonOutlineMode", buttonOutlineOptions, UIWidgets::EnhancementCombobox(CVAR_INPUT_VIEWER("ButtonOutlineMode"), buttonOutlineOptions,
BUTTON_OUTLINE_NOT_PRESSED); BUTTON_OUTLINE_NOT_PRESSED);
UIWidgets::Tooltip( UIWidgets::Tooltip(
"Sets the desired visibility behavior for the button outline/background layers. Useful for " "Sets the desired visibility behavior for the button outline/background layers. Useful for "
@ -428,21 +429,21 @@ void InputViewerSettingsWindow::DrawElement() {
if (ImGui::CollapsingHeader("Analog Stick")) { if (ImGui::CollapsingHeader("Analog Stick")) {
// gInputViewer.AnalogStick.VisibilityMode // gInputViewer.AnalogStick.VisibilityMode
UIWidgets::PaddedText("Analog Stick Visibility", true, false); UIWidgets::PaddedText("Analog Stick Visibility", true, false);
UIWidgets::EnhancementCombobox("gInputViewer.AnalogStick.VisibilityMode", stickModeOptions, UIWidgets::EnhancementCombobox(CVAR_INPUT_VIEWER("AnalogStick.VisibilityMode"), stickModeOptions,
STICK_MODE_ALWAYS_SHOWN); STICK_MODE_ALWAYS_SHOWN);
UIWidgets::Tooltip( UIWidgets::Tooltip(
"Determines the conditions under which the moving layer of the analog stick texture is visible."); "Determines the conditions under which the moving layer of the analog stick texture is visible.");
// gInputViewer.AnalogStick.OutlineMode // gInputViewer.AnalogStick.OutlineMode
UIWidgets::PaddedText("Analog Stick Outline/Background Visibility", true, false); UIWidgets::PaddedText("Analog Stick Outline/Background Visibility", true, false);
UIWidgets::EnhancementCombobox("gInputViewer.AnalogStick.OutlineMode", stickModeOptions, UIWidgets::EnhancementCombobox(CVAR_INPUT_VIEWER("AnalogStick.OutlineMode"), stickModeOptions,
STICK_MODE_ALWAYS_SHOWN); STICK_MODE_ALWAYS_SHOWN);
UIWidgets::Tooltip( UIWidgets::Tooltip(
"Determines the conditions under which the analog stick outline/background texture is visible."); "Determines the conditions under which the analog stick outline/background texture is visible.");
// gInputViewer.AnalogStick.Movement // gInputViewer.AnalogStick.Movement
UIWidgets::EnhancementSliderInt("Analog Stick Movement: %dpx", "##AnalogMovement", UIWidgets::EnhancementSliderInt("Analog Stick Movement: %dpx", "##AnalogMovement",
"gInputViewer.AnalogStick.Movement", 0, 200, "", 12, true); CVAR_INPUT_VIEWER("AnalogStick.Movement"), 0, 200, "", 12, true);
UIWidgets::Tooltip( UIWidgets::Tooltip(
"Sets the distance to move the analog stick in the input viewer. Useful for custom input viewers."); "Sets the distance to move the analog stick in the input viewer. Useful for custom input viewers.");
UIWidgets::PaddedSeparator(true, true); UIWidgets::PaddedSeparator(true, true);
@ -451,21 +452,21 @@ void InputViewerSettingsWindow::DrawElement() {
if (ImGui::CollapsingHeader("Additional (\"Right\") Stick")) { if (ImGui::CollapsingHeader("Additional (\"Right\") Stick")) {
// gInputViewer.RightStick.VisibilityMode // gInputViewer.RightStick.VisibilityMode
UIWidgets::PaddedText("Right Stick Visibility", true, false); UIWidgets::PaddedText("Right Stick Visibility", true, false);
UIWidgets::EnhancementCombobox("gInputViewer.RightStick.VisibilityMode", stickModeOptions, UIWidgets::EnhancementCombobox(CVAR_INPUT_VIEWER("RightStick.VisibilityMode"), stickModeOptions,
STICK_MODE_HIDDEN_IN_DEADZONE); STICK_MODE_HIDDEN_IN_DEADZONE);
UIWidgets::Tooltip( UIWidgets::Tooltip(
"Determines the conditions under which the moving layer of the right stick texture is visible."); "Determines the conditions under which the moving layer of the right stick texture is visible.");
// gInputViewer.RightStick.OutlineMode // gInputViewer.RightStick.OutlineMode
UIWidgets::PaddedText("Right Stick Outline/Background Visibility", true, false); UIWidgets::PaddedText("Right Stick Outline/Background Visibility", true, false);
UIWidgets::EnhancementCombobox("gInputViewer.RightStick.OutlineMode", stickModeOptions, UIWidgets::EnhancementCombobox(CVAR_INPUT_VIEWER("RightStick.OutlineMode"), stickModeOptions,
STICK_MODE_HIDDEN_IN_DEADZONE); STICK_MODE_HIDDEN_IN_DEADZONE);
UIWidgets::Tooltip( UIWidgets::Tooltip(
"Determines the conditions under which the right stick outline/background texture is visible."); "Determines the conditions under which the right stick outline/background texture is visible.");
// gInputViewer.RightStick.Movement // gInputViewer.RightStick.Movement
UIWidgets::EnhancementSliderInt("Right Stick Movement: %dpx", "##RightMovement", UIWidgets::EnhancementSliderInt("Right Stick Movement: %dpx", "##RightMovement",
"gInputViewer.RightStick.Movement", 0, 200, "", 7, true); CVAR_INPUT_VIEWER("RightStick.Movement"), 0, 200, "", 7, true);
UIWidgets::Tooltip( UIWidgets::Tooltip(
"Sets the distance to move the right stick in the input viewer. Useful for custom input viewers."); "Sets the distance to move the right stick in the input viewer. Useful for custom input viewers.");
UIWidgets::PaddedSeparator(true, true); UIWidgets::PaddedSeparator(true, true);
@ -473,42 +474,42 @@ void InputViewerSettingsWindow::DrawElement() {
if (ImGui::CollapsingHeader("Analog Angle Values")) { if (ImGui::CollapsingHeader("Analog Angle Values")) {
// gAnalogAngles // gAnalogAngles
UIWidgets::EnhancementCheckbox("Show Analog Stick Angle Values", "gInputViewer.AnalogAngles.Enabled"); UIWidgets::EnhancementCheckbox("Show Analog Stick Angle Values", CVAR_INPUT_VIEWER("AnalogAngles.Enabled"));
UIWidgets::Tooltip("Displays analog stick angle values in the input viewer"); UIWidgets::Tooltip("Displays analog stick angle values in the input viewer");
if (CVarGetInteger("gInputViewer.AnalogAngles.Enabled", 0)) { if (CVarGetInteger(CVAR_INPUT_VIEWER("AnalogAngles.Enabled"), 0)) {
// gInputViewer.AnalogAngles.TextColor // gInputViewer.AnalogAngles.TextColor
if (ImGui::ColorEdit4("Text Color", (float*)&textColor)) { if (ImGui::ColorEdit4("Text Color", (float*)&textColor)) {
CVarSetColor("gInputViewer.AnalogAngles.TextColor", vec2Color(textColor)); CVarSetColor(CVAR_INPUT_VIEWER("AnalogAngles.TextColor"), vec2Color(textColor));
} }
// gAnalogAngleScale // gAnalogAngleScale
UIWidgets::EnhancementSliderFloat("Angle Text Scale: %.2f%%", "##AnalogAngleScale", UIWidgets::EnhancementSliderFloat("Angle Text Scale: %.2f%%", "##AnalogAngleScale",
"gInputViewer.AnalogAngles.Scale", 0.1f, 5.0f, "", 1.0f, true, true); CVAR_INPUT_VIEWER("AnalogAngles.Scale"), 0.1f, 5.0f, "", 1.0f, true, true);
// gInputViewer.AnalogAngles.Offset // gInputViewer.AnalogAngles.Offset
UIWidgets::EnhancementSliderInt("Angle Text Offset: %dpx", "##AnalogAngleOffset", UIWidgets::EnhancementSliderInt("Angle Text Offset: %dpx", "##AnalogAngleOffset",
"gInputViewer.AnalogAngles.Offset", 0, 400, "", 0, true); CVAR_INPUT_VIEWER("AnalogAngles.Offset"), 0, 400, "", 0, true);
UIWidgets::PaddedSeparator(true, true); UIWidgets::PaddedSeparator(true, true);
// gInputViewer.AnalogAngles.Range1.Enabled // gInputViewer.AnalogAngles.Range1.Enabled
UIWidgets::EnhancementCheckbox("Highlight ESS Position", "gInputViewer.AnalogAngles.Range1.Enabled"); UIWidgets::EnhancementCheckbox("Highlight ESS Position", CVAR_INPUT_VIEWER("AnalogAngles.Range1.Enabled"));
UIWidgets::Tooltip( UIWidgets::Tooltip(
"Highlights the angle value text when the analog stick is in ESS position (on flat ground)"); "Highlights the angle value text when the analog stick is in ESS position (on flat ground)");
if (CVarGetInteger("gInputViewer.AnalogAngles.Range1.Enabled", 0)) { if (CVarGetInteger(CVAR_INPUT_VIEWER("AnalogAngles.Range1.Enabled"), 0)) {
// gInputViewer.AnalogAngles.Range1.Color // gInputViewer.AnalogAngles.Range1.Color
if (ImGui::ColorEdit4("ESS Color", (float*)&range1Color)) { if (ImGui::ColorEdit4("ESS Color", (float*)&range1Color)) {
CVarSetColor("gInputViewer.AnalogAngles.Range1.Color", vec2Color(range1Color)); CVarSetColor(CVAR_INPUT_VIEWER("AnalogAngles.Range1.Color"), vec2Color(range1Color));
} }
} }
UIWidgets::PaddedSeparator(true, true); UIWidgets::PaddedSeparator(true, true);
// gInputViewer.AnalogAngles.Range2.Enabled // gInputViewer.AnalogAngles.Range2.Enabled
UIWidgets::EnhancementCheckbox("Highlight Walking Speed Angles", UIWidgets::EnhancementCheckbox("Highlight Walking Speed Angles",
"gInputViewer.AnalogAngles.Range2.Enabled"); CVAR_INPUT_VIEWER("AnalogAngles.Range2.Enabled"));
UIWidgets::Tooltip("Highlights the angle value text when the analog stick is at an angle that would " UIWidgets::Tooltip("Highlights the angle value text when the analog stick is at an angle that would "
"produce a walking speed (on flat ground)\n\n" "produce a walking speed (on flat ground)\n\n"
"Useful for 1.0 Empty Jumpslash Quick Put Away"); "Useful for 1.0 Empty Jumpslash Quick Put Away");
if (CVarGetInteger("gInputViewer.AnalogAngles.Range2.Enabled", 0)) { if (CVarGetInteger(CVAR_INPUT_VIEWER("AnalogAngles.Range2.Enabled"), 0)) {
// gInputViewer.AnalogAngles.Range2.Color // gInputViewer.AnalogAngles.Range2.Color
if (ImGui::ColorEdit4("Walking Speed Color", (float*)&range2Color)) { if (ImGui::ColorEdit4("Walking Speed Color", (float*)&range2Color)) {
CVarSetColor("gInputViewer.AnalogAngles.Range2.Color", vec2Color(range2Color)); CVarSetColor(CVAR_INPUT_VIEWER("AnalogAngles.Range2.Color"), vec2Color(range2Color));
} }
} }
} }

View File

@ -2,6 +2,8 @@
#include <libultraship/libultraship.h> #include <libultraship/libultraship.h>
#define CVAR_INPUT_VIEWER(var) "gInputViewer." var
typedef enum { typedef enum {
BUTTON_OUTLINE_ALWAYS_SHOWN, BUTTON_OUTLINE_ALWAYS_SHOWN,
BUTTON_OUTLINE_NOT_PRESSED, BUTTON_OUTLINE_NOT_PRESSED,
@ -15,9 +17,9 @@ typedef enum {
STICK_MODE_ALWAYS_HIDDEN, STICK_MODE_ALWAYS_HIDDEN,
} StickMode; } StickMode;
class InputViewer : public LUS::GuiWindow { class InputViewer : public Ship::GuiWindow {
public: public:
using LUS::GuiWindow::GuiWindow; using GuiWindow::GuiWindow;
void InitElement() override {}; void InitElement() override {};
void DrawElement() override; void DrawElement() override;
@ -32,9 +34,9 @@ public:
void RenderButton(std::string btn, std::string btnOutline, int state, ImVec2 size, int outlineMode); void RenderButton(std::string btn, std::string btnOutline, int state, ImVec2 size, int outlineMode);
}; };
class InputViewerSettingsWindow : public LUS::GuiWindow { class InputViewerSettingsWindow : public Ship::GuiWindow {
public: public:
using LUS::GuiWindow::GuiWindow; using GuiWindow::GuiWindow;
void InitElement() override {}; void InitElement() override {};
void DrawElement() override; void DrawElement() override;

File diff suppressed because it is too large Load Diff

View File

@ -5,7 +5,7 @@
#ifndef IMGUI_DEFINE_MATH_OPERATORS #ifndef IMGUI_DEFINE_MATH_OPERATORS
#define IMGUI_DEFINE_MATH_OPERATORS #define IMGUI_DEFINE_MATH_OPERATORS
#endif #endif
#include <ImGui/imgui.h> #include <imgui.h>
#include <unordered_map> #include <unordered_map>
#include <string> #include <string>
#include <vector> #include <vector>
@ -20,7 +20,7 @@ typedef struct {
N64ButtonMask defaultBtn; N64ButtonMask defaultBtn;
} CustomButtonMap; } CustomButtonMap;
class SohInputEditorWindow : public LUS::GuiWindow { class SohInputEditorWindow : public Ship::GuiWindow {
public: public:
using GuiWindow::GuiWindow; using GuiWindow::GuiWindow;
~SohInputEditorWindow(); ~SohInputEditorWindow();
@ -38,14 +38,14 @@ class SohInputEditorWindow : public LUS::GuiWindow {
void UpdateElement() override; void UpdateElement() override;
private: private:
void DrawStickDirectionLine(const char* axisDirectionName, uint8_t port, uint8_t stick, LUS::Direction direction, void DrawStickDirectionLine(const char* axisDirectionName, uint8_t port, uint8_t stick, Ship::Direction direction,
ImVec4 color); ImVec4 color);
void DrawButtonLine(const char* buttonName, uint8_t port, uint16_t bitmask, ImVec4 color); void DrawButtonLine(const char* buttonName, uint8_t port, uint16_t bitmask, ImVec4 color);
void DrawButtonLineEditMappingButton(uint8_t port, uint16_t bitmask, std::string id); void DrawButtonLineEditMappingButton(uint8_t port, uint16_t bitmask, std::string id);
void DrawButtonLineAddMappingButton(uint8_t port, uint16_t bitmask); void DrawButtonLineAddMappingButton(uint8_t port, uint16_t bitmask);
void DrawStickDirectionLineEditMappingButton(uint8_t port, uint8_t stick, LUS::Direction direction, std::string id); void DrawStickDirectionLineEditMappingButton(uint8_t port, uint8_t stick, Ship::Direction direction, std::string id);
void DrawStickDirectionLineAddMappingButton(uint8_t port, uint8_t stick, LUS::Direction direction); void DrawStickDirectionLineAddMappingButton(uint8_t port, uint8_t stick, Ship::Direction direction);
void DrawStickSection(uint8_t port, uint8_t stick, int32_t id, ImVec4 color); void DrawStickSection(uint8_t port, uint8_t stick, int32_t id, ImVec4 color);
void DrawRumbleSection(uint8_t port); void DrawRumbleSection(uint8_t port);
@ -74,20 +74,20 @@ class SohInputEditorWindow : public LUS::GuiWindow {
int32_t mGameInputBlockTimer; int32_t mGameInputBlockTimer;
int32_t mMappingInputBlockTimer; int32_t mMappingInputBlockTimer;
int32_t mRumbleTimer; int32_t mRumbleTimer;
std::shared_ptr<LUS::ControllerRumbleMapping> mRumbleMappingToTest; std::shared_ptr<Ship::ControllerRumbleMapping> mRumbleMappingToTest;
// mBitmaskToMappingIds[port][bitmask] = { id0, id1, ... } // mBitmaskToMappingIds[port][bitmask] = { id0, id1, ... }
std::unordered_map<uint8_t, std::unordered_map<uint16_t, std::vector<std::string>>> mBitmaskToMappingIds; std::unordered_map<uint8_t, std::unordered_map<uint16_t, std::vector<std::string>>> mBitmaskToMappingIds;
// mStickDirectionToMappingIds[port][stick][direction] = { id0, id1, ... } // mStickDirectionToMappingIds[port][stick][direction] = { id0, id1, ... }
std::unordered_map<uint8_t, std::unordered_map<uint8_t,
std::unordered_map<uint8_t, std::unordered_map<LUS::Direction, std::vector<std::string>>>> std::unordered_map<uint8_t, std::unordered_map<Ship::Direction, std::vector<std::string>>>>
mStickDirectionToMappingIds; mStickDirectionToMappingIds;
void UpdateBitmaskToMappingIds(uint8_t port); void UpdateBitmaskToMappingIds(uint8_t port);
void UpdateStickDirectionToMappingIds(uint8_t port); void UpdateStickDirectionToMappingIds(uint8_t port);
void GetButtonColorsForLUSDeviceIndex(LUS::LUSDeviceIndex lusIndex, ImVec4& buttonColor, void GetButtonColorsForLUSDeviceIndex(Ship::ShipDeviceIndex lusIndex, ImVec4& buttonColor,
ImVec4& buttonHoveredColor); ImVec4& buttonHoveredColor);
void DrawLinkTab(); void DrawLinkTab();
void DrawIvanTab(); void DrawIvanTab();
@ -97,7 +97,7 @@ class SohInputEditorWindow : public LUS::GuiWindow {
std::set<uint16_t> mDpadBitmasks; std::set<uint16_t> mDpadBitmasks;
std::set<uint16_t> mModifierButtonsBitmasks; std::set<uint16_t> mModifierButtonsBitmasks;
void DrawButtonDeviceIcons(uint8_t portIndex, std::set<uint16_t> bitmasks); void DrawButtonDeviceIcons(uint8_t portIndex, std::set<uint16_t> bitmasks);
void DrawAnalogStickDeviceIcons(uint8_t portIndex, LUS::Stick stick); void DrawAnalogStickDeviceIcons(uint8_t portIndex, Ship::Stick stick);
void DrawRumbleDeviceIcons(uint8_t portIndex); void DrawRumbleDeviceIcons(uint8_t portIndex);
void DrawGyroDeviceIcons(uint8_t portIndex); void DrawGyroDeviceIcons(uint8_t portIndex);
void DrawLEDDeviceIcons(uint8_t portIndex); void DrawLEDDeviceIcons(uint8_t portIndex);

File diff suppressed because it is too large Load Diff

View File

@ -8,6 +8,29 @@
ResourceMgr_UnpatchGfxByName(path, name); \ ResourceMgr_UnpatchGfxByName(path, name); \
} }
// Not to be confused with tabs, groups are 1:1 with the boxes shown in the UI, grouping them allows us to reset/randomize
// every item in a group at once. If you are looking for tabs they are rendered manually in ImGui in `DrawCosmeticsEditor`
typedef enum {
COSMETICS_GROUP_LINK,
COSMETICS_GROUP_MIRRORSHIELD,
COSMETICS_GROUP_SWORDS,
COSMETICS_GROUP_GLOVES,
COSMETICS_GROUP_EQUIPMENT,
COSMETICS_GROUP_CONSUMABLE,
COSMETICS_GROUP_HUD,
COSMETICS_GROUP_KALEIDO,
COSMETICS_GROUP_TITLE,
COSMETICS_GROUP_NPC,
COSMETICS_GROUP_WORLD,
COSMETICS_GROUP_MAGIC,
COSMETICS_GROUP_ARROWS,
COSMETICS_GROUP_SPIN_ATTACK,
COSMETICS_GROUP_TRAILS,
COSMETICS_GROUP_NAVI,
COSMETICS_GROUP_IVAN,
COSMETICS_GROUP_MAX
} CosmeticGroup;
typedef struct { typedef struct {
const std::string Name; const std::string Name;
const std::string ToolTip; const std::string ToolTip;
@ -26,10 +49,12 @@ static ImGuiTableColumnFlags FlagsCell = ImGuiTableColumnFlags_WidthStretch | Im
void InitCosmeticsEditor();//Init the menu itself void InitCosmeticsEditor();//Init the menu itself
ImVec4 GetRandomValue(int MaximumPossible); ImVec4 GetRandomValue(int MaximumPossible);
void CosmeticsEditor_RandomizeAll(); void CosmeticsEditor_RandomizeAll();
void CosmeticsEditor_RandomizeGroup(CosmeticGroup group);
void CosmeticsEditor_ResetAll(); void CosmeticsEditor_ResetAll();
void CosmeticsEditor_ResetGroup(CosmeticGroup group);
void ApplyOrResetCustomGfxPatches(bool manualChange = true); void ApplyOrResetCustomGfxPatches(bool manualChange = true);
class CosmeticsEditorWindow : public LUS::GuiWindow { class CosmeticsEditorWindow : public Ship::GuiWindow {
public: public:
using GuiWindow::GuiWindow; using GuiWindow::GuiWindow;

View File

@ -1,5 +1,6 @@
#include <libultraship/bridge.h> #include <libultraship/bridge.h>
#include <string> #include <string>
#include "soh/OTRGlobals.h"
extern "C" { extern "C" {
#include <libultraship/libultra.h> #include <libultraship/libultra.h>
@ -81,7 +82,7 @@ void PatchDekuStickTextureOverflow() {
const char* dlist = gLinkChildLinkDekuStickDL; const char* dlist = gLinkChildLinkDekuStickDL;
int start = 5; int start = 5;
if (!CVarGetInteger("gFixTexturesOOB", 0)) { if (!CVarGetInteger(CVAR_ENHANCEMENT("FixTexturesOOB"), 0)) {
// Unpatch the other texture fix // Unpatch the other texture fix
for (size_t i = 0; i < 7; i++) { for (size_t i = 0; i < 7; i++) {
int instruction = start + (i == 0 ? 0 : i + 1); int instruction = start + (i == 0 ? 0 : i + 1);
@ -121,7 +122,7 @@ void PatchFreezardTextureOverflow() {
char patchNameBuf[24]; char patchNameBuf[24];
// Patch using custom overflowed texture // Patch using custom overflowed texture
if (!CVarGetInteger("gFixTexturesOOB", 0)) { if (!CVarGetInteger(CVAR_ENHANCEMENT("FixTexturesOOB"), 0)) {
// Unpatch the other texture fix // Unpatch the other texture fix
for (size_t i = 0; i < 7; i++) { for (size_t i = 0; i < 7; i++) {
int instruction = start + (i == 0 ? 0 : i + 1); int instruction = start + (i == 0 ? 0 : i + 1);
@ -163,7 +164,7 @@ void PatchIronKnuckleTextureOverflow() {
// Until this is solved, Iron Knuckle will be hardcoded to always display with the "authentic" texture fix // Until this is solved, Iron Knuckle will be hardcoded to always display with the "authentic" texture fix
// Patch using custom overflowed texture // Patch using custom overflowed texture
// if (!CVarGetInteger("gFixTexturesOOB", 0)) { // if (!CVarGetInteger(CVAR_ENHANCEMENT("FixTexturesOOB"), 0)) {
// Unpatch the other texture fix // Unpatch the other texture fix
for (size_t i = 0; i < 7; i++) { for (size_t i = 0; i < 7; i++) {
int instruction = start + (i == 0 ? 0 : i + 1); int instruction = start + (i == 0 ? 0 : i + 1);
@ -222,7 +223,7 @@ void PatchMirroredSoldOutGI() {
G_TX_NOMIRROR | G_TX_CLAMP, 5, 5, G_TX_NOLOD, G_TX_NOLOD), G_TX_NOMIRROR | G_TX_CLAMP, 5, 5, G_TX_NOLOD, G_TX_NOLOD),
}; };
if (CVarGetInteger("gMirroredWorld", 0)) { if (CVarGetInteger(CVAR_ENHANCEMENT("MirroredWorld"), 0)) {
if (mirroredSoldOutVtx == nullptr) { if (mirroredSoldOutVtx == nullptr) {
// Copy the original vertices that we want to modify (4 at the beginning of the resource) // Copy the original vertices that we want to modify (4 at the beginning of the resource)
mirroredSoldOutVtx = (Vtx*)malloc(sizeof(Vtx) * 4); mirroredSoldOutVtx = (Vtx*)malloc(sizeof(Vtx) * 4);
@ -269,7 +270,7 @@ void PatchMirroredSunSongEtching() {
G_TX_NOMIRROR | G_TX_CLAMP, 7, 5, G_TX_NOLOD, G_TX_NOLOD) G_TX_NOMIRROR | G_TX_CLAMP, 7, 5, G_TX_NOLOD, G_TX_NOLOD)
}; };
if (CVarGetInteger("gMirroredWorld", 0)) { if (CVarGetInteger(CVAR_ENHANCEMENT("MirroredWorld"), 0)) {
if (mirroredSunSongVtx == nullptr) { if (mirroredSunSongVtx == nullptr) {
// Copy the original vertices that we want to modify (4 at the beginning of the resource) // Copy the original vertices that we want to modify (4 at the beginning of the resource)
mirroredSunSongVtx = (Vtx*)malloc(sizeof(Vtx) * 4); mirroredSunSongVtx = (Vtx*)malloc(sizeof(Vtx) * 4);

View File

@ -179,7 +179,7 @@ CrowdControl::EffectResult CrowdControl::TranslateGiEnum(GameInteractionEffectQu
CrowdControl::Effect* CrowdControl::ParseMessage(nlohmann::json dataReceived) { CrowdControl::Effect* CrowdControl::ParseMessage(nlohmann::json dataReceived) {
if (!dataReceived.contains("id") || !dataReceived.contains("type")) { if (!dataReceived.contains("id") || !dataReceived.contains("type")) {
SPDLOG_ERROR("[CrowdControl] Invalid payload received:\n{}", dataReceived); SPDLOG_ERROR("[CrowdControl] Invalid payload received:\n{}", dataReceived.dump());
return nullptr; return nullptr;
} }

View File

@ -13,15 +13,15 @@
#define Path _Path #define Path _Path
#define PATH_HACK #define PATH_HACK
#include <Utils/StringHelper.h> #include <utils/StringHelper.h>
#include <Window.h> #include <Window.h>
#include <Context.h> #include <Context.h>
#ifndef IMGUI_DEFINE_MATH_OPERATORS #ifndef IMGUI_DEFINE_MATH_OPERATORS
#define IMGUI_DEFINE_MATH_OPERATORS #define IMGUI_DEFINE_MATH_OPERATORS
#endif #endif
#include <ImGui/imgui.h> #include <imgui.h>
#include <ImGui/imgui_internal.h> #include <imgui_internal.h>
#undef PATH_HACK #undef PATH_HACK
#undef Path #undef Path
@ -36,12 +36,12 @@ extern PlayState* gPlayState;
#include <libultraship/bridge.h> #include <libultraship/bridge.h>
#include <libultraship/libultraship.h> #include <libultraship/libultraship.h>
#define CMD_REGISTER LUS::Context::GetInstance()->GetConsole()->AddCommand #define CMD_REGISTER Ship::Context::GetInstance()->GetConsole()->AddCommand
// TODO: Commands should be using the output passed in. // TODO: Commands should be using the output passed in.
#define ERROR_MESSAGE std::reinterpret_pointer_cast<LUS::ConsoleWindow>(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetGuiWindow("Console"))->SendErrorMessage #define ERROR_MESSAGE std::reinterpret_pointer_cast<Ship::ConsoleWindow>(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetGuiWindow("Console"))->SendErrorMessage
#define INFO_MESSAGE std::reinterpret_pointer_cast<LUS::ConsoleWindow>(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetGuiWindow("Console"))->SendInfoMessage #define INFO_MESSAGE std::reinterpret_pointer_cast<Ship::ConsoleWindow>(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetGuiWindow("Console"))->SendInfoMessage
static bool ActorSpawnHandler(std::shared_ptr<LUS::Console> Console, const std::vector<std::string>& args, std::string* output) { static bool ActorSpawnHandler(std::shared_ptr<Ship::Console> Console, const std::vector<std::string>& args, std::string* output) {
if ((args.size() != 9) && (args.size() != 3) && (args.size() != 6)) { if ((args.size() != 9) && (args.size() != 3) && (args.size() != 6)) {
ERROR_MESSAGE("Not enough arguments passed to actorspawn"); ERROR_MESSAGE("Not enough arguments passed to actorspawn");
return 1; return 1;
@ -101,7 +101,7 @@ static bool ActorSpawnHandler(std::shared_ptr<LUS::Console> Console, const std::
return 0; return 0;
} }
static bool KillPlayerHandler(std::shared_ptr<LUS::Console> Console, const std::vector<std::string>&, std::string* output) { static bool KillPlayerHandler(std::shared_ptr<Ship::Console> Console, const std::vector<std::string>&, std::string* output) {
GameInteractionEffectBase* effect = new GameInteractionEffect::SetPlayerHealth(); GameInteractionEffectBase* effect = new GameInteractionEffect::SetPlayerHealth();
dynamic_cast<ParameterizedGameInteractionEffect*>(effect)->parameters[0] = 0; dynamic_cast<ParameterizedGameInteractionEffect*>(effect)->parameters[0] = 0;
GameInteractionEffectQueryResult result = GameInteractor::ApplyEffect(effect); GameInteractionEffectQueryResult result = GameInteractor::ApplyEffect(effect);
@ -114,7 +114,7 @@ static bool KillPlayerHandler(std::shared_ptr<LUS::Console> Console, const std::
} }
} }
static bool SetPlayerHealthHandler(std::shared_ptr<LUS::Console> Console, const std::vector<std::string>& args, std::string* output) { static bool SetPlayerHealthHandler(std::shared_ptr<Ship::Console> Console, const std::vector<std::string>& args, std::string* output) {
if (args.size() < 2) { if (args.size() < 2) {
ERROR_MESSAGE("[SOH] Unexpected arguments passed"); ERROR_MESSAGE("[SOH] Unexpected arguments passed");
return 1; return 1;
@ -145,7 +145,7 @@ static bool SetPlayerHealthHandler(std::shared_ptr<LUS::Console> Console, const
} }
} }
static bool LoadSceneHandler(std::shared_ptr<LUS::Console> Console, const std::vector<std::string>&, std::string* output) { static bool LoadSceneHandler(std::shared_ptr<Ship::Console> Console, const std::vector<std::string>&, std::string* output) {
gSaveContext.respawnFlag = 0; gSaveContext.respawnFlag = 0;
gSaveContext.seqId = 0xFF; gSaveContext.seqId = 0xFF;
gSaveContext.gameMode = 0; gSaveContext.gameMode = 0;
@ -153,7 +153,7 @@ static bool LoadSceneHandler(std::shared_ptr<LUS::Console> Console, const std::v
return 0; return 0;
} }
static bool RupeeHandler(std::shared_ptr<LUS::Console> Console, const std::vector<std::string>& args, std::string* output) { static bool RupeeHandler(std::shared_ptr<Ship::Console> Console, const std::vector<std::string>& args, std::string* output) {
if (args.size() < 2) { if (args.size() < 2) {
return 1; return 1;
} }
@ -178,7 +178,7 @@ static bool RupeeHandler(std::shared_ptr<LUS::Console> Console, const std::vecto
return 0; return 0;
} }
static bool SetPosHandler(std::shared_ptr<LUS::Console> Console, const std::vector<std::string> args, std::string* output) { static bool SetPosHandler(std::shared_ptr<Ship::Console> Console, const std::vector<std::string> args, std::string* output) {
if (gPlayState == nullptr) { if (gPlayState == nullptr) {
ERROR_MESSAGE("PlayState == nullptr"); ERROR_MESSAGE("PlayState == nullptr");
return 1; return 1;
@ -205,7 +205,7 @@ static bool SetPosHandler(std::shared_ptr<LUS::Console> Console, const std::vect
return 0; return 0;
} }
static bool ResetHandler(std::shared_ptr<LUS::Console> Console, std::vector<std::string> args, std::string* output) { static bool ResetHandler(std::shared_ptr<Ship::Console> Console, std::vector<std::string> args, std::string* output) {
if (gPlayState == nullptr) { if (gPlayState == nullptr) {
ERROR_MESSAGE("PlayState == nullptr"); ERROR_MESSAGE("PlayState == nullptr");
return 1; return 1;
@ -225,7 +225,7 @@ const static std::map<std::string, uint16_t> ammoItems{
{ "beans", ITEM_BEAN } { "beans", ITEM_BEAN }
}; };
static bool AddAmmoHandler(std::shared_ptr<LUS::Console> Console, const std::vector<std::string>& args, std::string* output) { static bool AddAmmoHandler(std::shared_ptr<Ship::Console> Console, const std::vector<std::string>& args, std::string* output) {
if (args.size() < 3) { if (args.size() < 3) {
ERROR_MESSAGE("[SOH] Unexpected arguments passed"); ERROR_MESSAGE("[SOH] Unexpected arguments passed");
return 1; return 1;
@ -264,7 +264,7 @@ static bool AddAmmoHandler(std::shared_ptr<LUS::Console> Console, const std::vec
} }
} }
static bool TakeAmmoHandler(std::shared_ptr<LUS::Console> Console, const std::vector<std::string>& args, std::string* output) { static bool TakeAmmoHandler(std::shared_ptr<Ship::Console> Console, const std::vector<std::string>& args, std::string* output) {
if (args.size() < 3) { if (args.size() < 3) {
ERROR_MESSAGE("[SOH] Unexpected arguments passed"); ERROR_MESSAGE("[SOH] Unexpected arguments passed");
return 1; return 1;
@ -311,7 +311,7 @@ const static std::map<std::string, uint16_t> bottleItems{
{ "big_poe", ITEM_BIG_POE }, { "blue_fire", ITEM_BLUE_FIRE }, { "rutos_letter", ITEM_LETTER_RUTO }, { "big_poe", ITEM_BIG_POE }, { "blue_fire", ITEM_BLUE_FIRE }, { "rutos_letter", ITEM_LETTER_RUTO },
}; };
static bool BottleHandler(std::shared_ptr<LUS::Console> Console, const std::vector<std::string>& args, std::string* output) { static bool BottleHandler(std::shared_ptr<Ship::Console> Console, const std::vector<std::string>& args, std::string* output) {
if (args.size() < 3) { if (args.size() < 3) {
ERROR_MESSAGE("[SOH] Unexpected arguments passed"); ERROR_MESSAGE("[SOH] Unexpected arguments passed");
return 1; return 1;
@ -343,7 +343,7 @@ static bool BottleHandler(std::shared_ptr<LUS::Console> Console, const std::vect
return 0; return 0;
} }
static bool BHandler(std::shared_ptr<LUS::Console> Console, const std::vector<std::string>& args, std::string* output) { static bool BHandler(std::shared_ptr<Ship::Console> Console, const std::vector<std::string>& args, std::string* output) {
if (args.size() < 2) { if (args.size() < 2) {
ERROR_MESSAGE("[SOH] Unexpected arguments passed"); ERROR_MESSAGE("[SOH] Unexpected arguments passed");
return 1; return 1;
@ -353,7 +353,7 @@ static bool BHandler(std::shared_ptr<LUS::Console> Console, const std::vector<st
return 0; return 0;
} }
static bool ItemHandler(std::shared_ptr<LUS::Console> Console, const std::vector<std::string>& args, std::string* output) { static bool ItemHandler(std::shared_ptr<Ship::Console> Console, const std::vector<std::string>& args, std::string* output) {
if (args.size() < 3) { if (args.size() < 3) {
ERROR_MESSAGE("[SOH] Unexpected arguments passed"); ERROR_MESSAGE("[SOH] Unexpected arguments passed");
return 1; return 1;
@ -364,7 +364,7 @@ static bool ItemHandler(std::shared_ptr<LUS::Console> Console, const std::vector
return 0; return 0;
} }
static bool GiveItemHandler(std::shared_ptr<LUS::Console> Console, const std::vector<std::string> args, std::string* output) { static bool GiveItemHandler(std::shared_ptr<Ship::Console> Console, const std::vector<std::string> args, std::string* output) {
if (args.size() < 3) { if (args.size() < 3) {
ERROR_MESSAGE("[SOH] Unexpected arguments passed"); ERROR_MESSAGE("[SOH] Unexpected arguments passed");
return 1; return 1;
@ -385,7 +385,7 @@ static bool GiveItemHandler(std::shared_ptr<LUS::Console> Console, const std::ve
return 0; return 0;
} }
static bool EntranceHandler(std::shared_ptr<LUS::Console> Console, const std::vector<std::string>& args, std::string* output) { static bool EntranceHandler(std::shared_ptr<Ship::Console> Console, const std::vector<std::string>& args, std::string* output) {
if (args.size() < 2) { if (args.size() < 2) {
ERROR_MESSAGE("[SOH] Unexpected arguments passed"); ERROR_MESSAGE("[SOH] Unexpected arguments passed");
return 1; return 1;
@ -406,7 +406,7 @@ static bool EntranceHandler(std::shared_ptr<LUS::Console> Console, const std::ve
gSaveContext.nextTransitionType = TRANS_TYPE_INSTANT; gSaveContext.nextTransitionType = TRANS_TYPE_INSTANT;
} }
static bool VoidHandler(std::shared_ptr<LUS::Console> Console, const std::vector<std::string>& args, std::string* output) { static bool VoidHandler(std::shared_ptr<Ship::Console> Console, const std::vector<std::string>& args, std::string* output) {
if (gPlayState != nullptr) { if (gPlayState != nullptr) {
gSaveContext.respawn[RESPAWN_MODE_DOWN].tempSwchFlags = gPlayState->actorCtx.flags.tempSwch; gSaveContext.respawn[RESPAWN_MODE_DOWN].tempSwchFlags = gPlayState->actorCtx.flags.tempSwch;
gSaveContext.respawn[RESPAWN_MODE_DOWN].tempCollectFlags = gPlayState->actorCtx.flags.tempCollect; gSaveContext.respawn[RESPAWN_MODE_DOWN].tempCollectFlags = gPlayState->actorCtx.flags.tempCollect;
@ -422,7 +422,7 @@ static bool VoidHandler(std::shared_ptr<LUS::Console> Console, const std::vector
return 0; return 0;
} }
static bool ReloadHandler(std::shared_ptr<LUS::Console> Console, const std::vector<std::string>& args, std::string* output) { static bool ReloadHandler(std::shared_ptr<Ship::Console> Console, const std::vector<std::string>& args, std::string* output) {
if (gPlayState != nullptr) { if (gPlayState != nullptr) {
gPlayState->nextEntranceIndex = gSaveContext.entranceIndex; gPlayState->nextEntranceIndex = gSaveContext.entranceIndex;
gPlayState->transitionTrigger = TRANS_TRIGGER_START; gPlayState->transitionTrigger = TRANS_TRIGGER_START;
@ -439,7 +439,7 @@ const static std::map<std::string, uint16_t> fw_options {
{ "clear", 0}, {"warp", 1}, {"backup", 2} { "clear", 0}, {"warp", 1}, {"backup", 2}
}; };
static bool FWHandler(std::shared_ptr<LUS::Console> Console, const std::vector<std::string>& args, std::string* output) { static bool FWHandler(std::shared_ptr<Ship::Console> Console, const std::vector<std::string>& args, std::string* output) {
if (args.size() < 2) { if (args.size() < 2) {
ERROR_MESSAGE("[SOH] Unexpected arguments passed"); ERROR_MESSAGE("[SOH] Unexpected arguments passed");
return 1; return 1;
@ -471,7 +471,7 @@ static bool FWHandler(std::shared_ptr<LUS::Console> Console, const std::vector<s
return 0; return 0;
break; break;
case 2: //backup case 2: //backup
if (CVarGetInteger("gBetterFW", 0)) { if (CVarGetInteger(CVAR_ENHANCEMENT("BetterFarore"), 0)) {
gSaveContext.fw = gSaveContext.backupFW; gSaveContext.fw = gSaveContext.backupFW;
gSaveContext.fw.set = 1; gSaveContext.fw.set = 1;
INFO_MESSAGE("[SOH] Backup FW data copied! Reload scene to take effect."); INFO_MESSAGE("[SOH] Backup FW data copied! Reload scene to take effect.");
@ -491,7 +491,7 @@ static bool FWHandler(std::shared_ptr<LUS::Console> Console, const std::vector<s
return 0; return 0;
} }
static bool FileSelectHandler(std::shared_ptr<LUS::Console> Console, const std::vector<std::string>& args, std::string* output) { static bool FileSelectHandler(std::shared_ptr<Ship::Console> Console, const std::vector<std::string>& args, std::string* output) {
if (gPlayState != nullptr) { if (gPlayState != nullptr) {
SET_NEXT_GAMESTATE(&gPlayState->state, FileChoose_Init, FileChooseContext); SET_NEXT_GAMESTATE(&gPlayState->state, FileChoose_Init, FileChooseContext);
gPlayState->state.running = 0; gPlayState->state.running = 0;
@ -502,12 +502,12 @@ static bool FileSelectHandler(std::shared_ptr<LUS::Console> Console, const std::
return 0; return 0;
} }
static bool QuitHandler(std::shared_ptr<LUS::Console> Console, const std::vector<std::string>& args, std::string* output) { static bool QuitHandler(std::shared_ptr<Ship::Console> Console, const std::vector<std::string>& args, std::string* output) {
LUS::Context::GetInstance()->GetWindow()->Close(); Ship::Context::GetInstance()->GetWindow()->Close();
return 0; return 0;
} }
static bool SaveStateHandler(std::shared_ptr<LUS::Console> Console, const std::vector<std::string>& args, std::string* output) { static bool SaveStateHandler(std::shared_ptr<Ship::Console> Console, const std::vector<std::string>& args, std::string* output) {
unsigned int slot = OTRGlobals::Instance->gSaveStateMgr->GetCurrentSlot(); unsigned int slot = OTRGlobals::Instance->gSaveStateMgr->GetCurrentSlot();
const SaveStateReturn rtn = OTRGlobals::Instance->gSaveStateMgr->AddRequest({ slot, RequestType::SAVE }); const SaveStateReturn rtn = OTRGlobals::Instance->gSaveStateMgr->AddRequest({ slot, RequestType::SAVE });
@ -521,7 +521,7 @@ static bool SaveStateHandler(std::shared_ptr<LUS::Console> Console, const std::v
} }
} }
static bool LoadStateHandler(std::shared_ptr<LUS::Console> Console, const std::vector<std::string>& args, std::string* output) { static bool LoadStateHandler(std::shared_ptr<Ship::Console> Console, const std::vector<std::string>& args, std::string* output) {
unsigned int slot = OTRGlobals::Instance->gSaveStateMgr->GetCurrentSlot(); unsigned int slot = OTRGlobals::Instance->gSaveStateMgr->GetCurrentSlot();
const SaveStateReturn rtn = OTRGlobals::Instance->gSaveStateMgr->AddRequest({ slot, RequestType::LOAD }); const SaveStateReturn rtn = OTRGlobals::Instance->gSaveStateMgr->AddRequest({ slot, RequestType::LOAD });
@ -542,7 +542,7 @@ static bool LoadStateHandler(std::shared_ptr<LUS::Console> Console, const std::v
} }
static bool StateSlotSelectHandler(std::shared_ptr<LUS::Console> Console, const std::vector<std::string>& args, std::string* output) { static bool StateSlotSelectHandler(std::shared_ptr<Ship::Console> Console, const std::vector<std::string>& args, std::string* output) {
if (args.size() < 2) { if (args.size() < 2) {
ERROR_MESSAGE("[SOH] Unexpected arguments passed"); ERROR_MESSAGE("[SOH] Unexpected arguments passed");
return 1; return 1;
@ -567,7 +567,7 @@ static bool StateSlotSelectHandler(std::shared_ptr<LUS::Console> Console, const
return 0; return 0;
} }
static bool InvisibleHandler(std::shared_ptr<LUS::Console> Console, const std::vector<std::string>& args, std::string* output) { static bool InvisibleHandler(std::shared_ptr<Ship::Console> Console, const std::vector<std::string>& args, std::string* output) {
if (args.size() < 2) { if (args.size() < 2) {
ERROR_MESSAGE("[SOH] Unexpected arguments passed"); ERROR_MESSAGE("[SOH] Unexpected arguments passed");
return 1; return 1;
@ -594,7 +594,7 @@ static bool InvisibleHandler(std::shared_ptr<LUS::Console> Console, const std::v
} }
} }
static bool GiantLinkHandler(std::shared_ptr<LUS::Console> Console, const std::vector<std::string>& args, std::string* output) { static bool GiantLinkHandler(std::shared_ptr<Ship::Console> Console, const std::vector<std::string>& args, std::string* output) {
if (args.size() < 2) { if (args.size() < 2) {
ERROR_MESSAGE("[SOH] Unexpected arguments passed"); ERROR_MESSAGE("[SOH] Unexpected arguments passed");
return 1; return 1;
@ -622,7 +622,7 @@ static bool GiantLinkHandler(std::shared_ptr<LUS::Console> Console, const std::v
} }
} }
static bool MinishLinkHandler(std::shared_ptr<LUS::Console> Console, const std::vector<std::string>& args, std::string* output) { static bool MinishLinkHandler(std::shared_ptr<Ship::Console> Console, const std::vector<std::string>& args, std::string* output) {
if (args.size() < 2) { if (args.size() < 2) {
ERROR_MESSAGE("[SOH] Unexpected arguments passed"); ERROR_MESSAGE("[SOH] Unexpected arguments passed");
return 1; return 1;
@ -650,7 +650,7 @@ static bool MinishLinkHandler(std::shared_ptr<LUS::Console> Console, const std::
} }
} }
static bool AddHeartContainerHandler(std::shared_ptr<LUS::Console> Console, const std::vector<std::string>& args, std::string* output) { static bool AddHeartContainerHandler(std::shared_ptr<Ship::Console> Console, const std::vector<std::string>& args, std::string* output) {
if (args.size() < 2) { if (args.size() < 2) {
ERROR_MESSAGE("[SOH] Unexpected arguments passed"); ERROR_MESSAGE("[SOH] Unexpected arguments passed");
return 1; return 1;
@ -681,7 +681,7 @@ static bool AddHeartContainerHandler(std::shared_ptr<LUS::Console> Console, cons
} }
} }
static bool RemoveHeartContainerHandler(std::shared_ptr<LUS::Console> Console, const std::vector<std::string>& args, std::string* output) { static bool RemoveHeartContainerHandler(std::shared_ptr<Ship::Console> Console, const std::vector<std::string>& args, std::string* output) {
if (args.size() < 2) { if (args.size() < 2) {
ERROR_MESSAGE("[SOH] Unexpected arguments passed"); ERROR_MESSAGE("[SOH] Unexpected arguments passed");
return 1; return 1;
@ -712,7 +712,7 @@ static bool RemoveHeartContainerHandler(std::shared_ptr<LUS::Console> Console, c
} }
} }
static bool GravityHandler(std::shared_ptr<LUS::Console> Console, const std::vector<std::string>& args, std::string* output) { static bool GravityHandler(std::shared_ptr<Ship::Console> Console, const std::vector<std::string>& args, std::string* output) {
if (args.size() < 2) { if (args.size() < 2) {
ERROR_MESSAGE("[SOH] Unexpected arguments passed"); ERROR_MESSAGE("[SOH] Unexpected arguments passed");
return 1; return 1;
@ -721,7 +721,7 @@ static bool GravityHandler(std::shared_ptr<LUS::Console> Console, const std::vec
GameInteractionEffectBase* effect = new GameInteractionEffect::ModifyGravity(); GameInteractionEffectBase* effect = new GameInteractionEffect::ModifyGravity();
try { try {
dynamic_cast<ParameterizedGameInteractionEffect*>(effect)->parameters[0] = LUS::Math::clamp(std::stoi(args[1], nullptr, 10), GI_GRAVITY_LEVEL_LIGHT, GI_GRAVITY_LEVEL_HEAVY); dynamic_cast<ParameterizedGameInteractionEffect*>(effect)->parameters[0] = Ship::Math::clamp(std::stoi(args[1], nullptr, 10), GI_GRAVITY_LEVEL_LIGHT, GI_GRAVITY_LEVEL_HEAVY);
} catch (std::invalid_argument const& ex) { } catch (std::invalid_argument const& ex) {
ERROR_MESSAGE("[SOH] Gravity value must be a number."); ERROR_MESSAGE("[SOH] Gravity value must be a number.");
return 1; return 1;
@ -737,7 +737,7 @@ static bool GravityHandler(std::shared_ptr<LUS::Console> Console, const std::vec
} }
} }
static bool NoUIHandler(std::shared_ptr<LUS::Console> Console, const std::vector<std::string>& args, std::string* output) { static bool NoUIHandler(std::shared_ptr<Ship::Console> Console, const std::vector<std::string>& args, std::string* output) {
if (args.size() < 2) { if (args.size() < 2) {
ERROR_MESSAGE("[SOH] Unexpected arguments passed"); ERROR_MESSAGE("[SOH] Unexpected arguments passed");
return 1; return 1;
@ -765,7 +765,7 @@ static bool NoUIHandler(std::shared_ptr<LUS::Console> Console, const std::vector
} }
} }
static bool FreezeHandler(std::shared_ptr<LUS::Console> Console, const std::vector<std::string>& args, std::string* output) { static bool FreezeHandler(std::shared_ptr<Ship::Console> Console, const std::vector<std::string>& args, std::string* output) {
GameInteractionEffectBase* effect = new GameInteractionEffect::FreezePlayer(); GameInteractionEffectBase* effect = new GameInteractionEffect::FreezePlayer();
GameInteractionEffectQueryResult result = GameInteractor::ApplyEffect(effect); GameInteractionEffectQueryResult result = GameInteractor::ApplyEffect(effect);
@ -778,7 +778,7 @@ static bool FreezeHandler(std::shared_ptr<LUS::Console> Console, const std::vect
} }
} }
static bool DefenseModifierHandler(std::shared_ptr<LUS::Console> Console, const std::vector<std::string>& args, std::string* output) { static bool DefenseModifierHandler(std::shared_ptr<Ship::Console> Console, const std::vector<std::string>& args, std::string* output) {
if (args.size() < 2) { if (args.size() < 2) {
ERROR_MESSAGE("[SOH] Unexpected arguments passed"); ERROR_MESSAGE("[SOH] Unexpected arguments passed");
return 1; return 1;
@ -802,7 +802,7 @@ static bool DefenseModifierHandler(std::shared_ptr<LUS::Console> Console, const
} }
} }
static bool DamageHandler(std::shared_ptr<LUS::Console> Console, const std::vector<std::string>& args, std::string* output) { static bool DamageHandler(std::shared_ptr<Ship::Console> Console, const std::vector<std::string>& args, std::string* output) {
if (args.size() < 2) { if (args.size() < 2) {
ERROR_MESSAGE("[SOH] Unexpected arguments passed"); ERROR_MESSAGE("[SOH] Unexpected arguments passed");
return 1; return 1;
@ -832,7 +832,7 @@ static bool DamageHandler(std::shared_ptr<LUS::Console> Console, const std::vect
} }
} }
static bool HealHandler(std::shared_ptr<LUS::Console> Console, const std::vector<std::string>& args, std::string* output) { static bool HealHandler(std::shared_ptr<Ship::Console> Console, const std::vector<std::string>& args, std::string* output) {
if (args.size() < 2) { if (args.size() < 2) {
ERROR_MESSAGE("[SOH] Unexpected arguments passed"); ERROR_MESSAGE("[SOH] Unexpected arguments passed");
return 1; return 1;
@ -862,7 +862,7 @@ static bool HealHandler(std::shared_ptr<LUS::Console> Console, const std::vector
} }
} }
static bool FillMagicHandler(std::shared_ptr<LUS::Console> Console, const std::vector<std::string>& args, std::string* output) { static bool FillMagicHandler(std::shared_ptr<Ship::Console> Console, const std::vector<std::string>& args, std::string* output) {
GameInteractionEffectBase* effect = new GameInteractionEffect::FillMagic(); GameInteractionEffectBase* effect = new GameInteractionEffect::FillMagic();
GameInteractionEffectQueryResult result = GameInteractor::ApplyEffect(effect); GameInteractionEffectQueryResult result = GameInteractor::ApplyEffect(effect);
@ -875,7 +875,7 @@ static bool FillMagicHandler(std::shared_ptr<LUS::Console> Console, const std::v
} }
} }
static bool EmptyMagicHandler(std::shared_ptr<LUS::Console> Console, const std::vector<std::string>& args, std::string* output) { static bool EmptyMagicHandler(std::shared_ptr<Ship::Console> Console, const std::vector<std::string>& args, std::string* output) {
GameInteractionEffectBase* effect = new GameInteractionEffect::EmptyMagic(); GameInteractionEffectBase* effect = new GameInteractionEffect::EmptyMagic();
GameInteractionEffectQueryResult result = GameInteractor::ApplyEffect(effect); GameInteractionEffectQueryResult result = GameInteractor::ApplyEffect(effect);
@ -888,7 +888,7 @@ static bool EmptyMagicHandler(std::shared_ptr<LUS::Console> Console, const std::
} }
} }
static bool NoZHandler(std::shared_ptr<LUS::Console> Console, const std::vector<std::string>& args, std::string* output) { static bool NoZHandler(std::shared_ptr<Ship::Console> Console, const std::vector<std::string>& args, std::string* output) {
if (args.size() < 2) { if (args.size() < 2) {
ERROR_MESSAGE("[SOH] Unexpected arguments passed"); ERROR_MESSAGE("[SOH] Unexpected arguments passed");
return 1; return 1;
@ -916,7 +916,7 @@ static bool NoZHandler(std::shared_ptr<LUS::Console> Console, const std::vector<
} }
} }
static bool OneHitKOHandler(std::shared_ptr<LUS::Console> Console, const std::vector<std::string>& args, std::string* output) { static bool OneHitKOHandler(std::shared_ptr<Ship::Console> Console, const std::vector<std::string>& args, std::string* output) {
if (args.size() < 2) { if (args.size() < 2) {
ERROR_MESSAGE("[SOH] Unexpected arguments passed"); ERROR_MESSAGE("[SOH] Unexpected arguments passed");
return 1; return 1;
@ -944,7 +944,7 @@ static bool OneHitKOHandler(std::shared_ptr<LUS::Console> Console, const std::ve
} }
} }
static bool PacifistHandler(std::shared_ptr<LUS::Console> Console, const std::vector<std::string>& args, std::string* output) { static bool PacifistHandler(std::shared_ptr<Ship::Console> Console, const std::vector<std::string>& args, std::string* output) {
if (args.size() < 2) { if (args.size() < 2) {
ERROR_MESSAGE("[SOH] Unexpected arguments passed"); ERROR_MESSAGE("[SOH] Unexpected arguments passed");
return 1; return 1;
@ -972,7 +972,7 @@ static bool PacifistHandler(std::shared_ptr<LUS::Console> Console, const std::ve
} }
} }
static bool PaperLinkHandler(std::shared_ptr<LUS::Console> Console, const std::vector<std::string>& args, std::string* output) { static bool PaperLinkHandler(std::shared_ptr<Ship::Console> Console, const std::vector<std::string>& args, std::string* output) {
if (args.size() < 2) { if (args.size() < 2) {
ERROR_MESSAGE("[SOH] Unexpected arguments passed"); ERROR_MESSAGE("[SOH] Unexpected arguments passed");
return 1; return 1;
@ -1001,7 +1001,7 @@ static bool PaperLinkHandler(std::shared_ptr<LUS::Console> Console, const std::v
} }
} }
static bool RainstormHandler(std::shared_ptr<LUS::Console> Console, const std::vector<std::string>& args, std::string* output) { static bool RainstormHandler(std::shared_ptr<Ship::Console> Console, const std::vector<std::string>& args, std::string* output) {
if (args.size() < 2) { if (args.size() < 2) {
ERROR_MESSAGE("[SOH] Unexpected arguments passed"); ERROR_MESSAGE("[SOH] Unexpected arguments passed");
return 1; return 1;
@ -1029,7 +1029,7 @@ static bool RainstormHandler(std::shared_ptr<LUS::Console> Console, const std::v
} }
} }
static bool ReverseControlsHandler(std::shared_ptr<LUS::Console> Console, const std::vector<std::string>& args, std::string* output) { static bool ReverseControlsHandler(std::shared_ptr<Ship::Console> Console, const std::vector<std::string>& args, std::string* output) {
if (args.size() < 2) { if (args.size() < 2) {
ERROR_MESSAGE("[SOH] Unexpected arguments passed"); ERROR_MESSAGE("[SOH] Unexpected arguments passed");
return 1; return 1;
@ -1058,7 +1058,7 @@ static bool ReverseControlsHandler(std::shared_ptr<LUS::Console> Console, const
} }
} }
static bool UpdateRupeesHandler(std::shared_ptr<LUS::Console> Console, const std::vector<std::string>& args, std::string* output) { static bool UpdateRupeesHandler(std::shared_ptr<Ship::Console> Console, const std::vector<std::string>& args, std::string* output) {
if (args.size() < 2) { if (args.size() < 2) {
ERROR_MESSAGE("[SOH] Unexpected arguments passed"); ERROR_MESSAGE("[SOH] Unexpected arguments passed");
return 1; return 1;
@ -1082,7 +1082,7 @@ static bool UpdateRupeesHandler(std::shared_ptr<LUS::Console> Console, const std
} }
} }
static bool SpeedModifierHandler(std::shared_ptr<LUS::Console> Console, const std::vector<std::string>& args, std::string* output) { static bool SpeedModifierHandler(std::shared_ptr<Ship::Console> Console, const std::vector<std::string>& args, std::string* output) {
if (args.size() < 2) { if (args.size() < 2) {
ERROR_MESSAGE("[SOH] Unexpected arguments passed"); ERROR_MESSAGE("[SOH] Unexpected arguments passed");
return 1; return 1;
@ -1112,7 +1112,7 @@ const static std::map<std::string, uint16_t> boots {
{ "hover", EQUIP_VALUE_BOOTS_HOVER }, { "hover", EQUIP_VALUE_BOOTS_HOVER },
}; };
static bool BootsHandler(std::shared_ptr<LUS::Console> Console, const std::vector<std::string>& args, std::string* output) { static bool BootsHandler(std::shared_ptr<Ship::Console> Console, const std::vector<std::string>& args, std::string* output) {
if (args.size() < 2) { if (args.size() < 2) {
ERROR_MESSAGE("[SOH] Unexpected arguments passed"); ERROR_MESSAGE("[SOH] Unexpected arguments passed");
return 1; return 1;
@ -1143,7 +1143,7 @@ const static std::map<std::string, uint16_t> shields {
{ "mirror", ITEM_SHIELD_MIRROR }, { "mirror", ITEM_SHIELD_MIRROR },
}; };
static bool GiveShieldHandler(std::shared_ptr<LUS::Console> Console, const std::vector<std::string>& args, std::string* output) { static bool GiveShieldHandler(std::shared_ptr<Ship::Console> Console, const std::vector<std::string>& args, std::string* output) {
if (args.size() < 2) { if (args.size() < 2) {
ERROR_MESSAGE("[SOH] Unexpected arguments passed"); ERROR_MESSAGE("[SOH] Unexpected arguments passed");
return 1; return 1;
@ -1168,7 +1168,7 @@ static bool GiveShieldHandler(std::shared_ptr<LUS::Console> Console, const std::
} }
} }
static bool TakeShieldHandler(std::shared_ptr<LUS::Console> Console, const std::vector<std::string>& args, std::string* output) { static bool TakeShieldHandler(std::shared_ptr<Ship::Console> Console, const std::vector<std::string>& args, std::string* output) {
if (args.size() < 2) { if (args.size() < 2) {
ERROR_MESSAGE("[SOH] Unexpected arguments passed"); ERROR_MESSAGE("[SOH] Unexpected arguments passed");
return 1; return 1;
@ -1193,7 +1193,7 @@ static bool TakeShieldHandler(std::shared_ptr<LUS::Console> Console, const std::
} }
} }
static bool KnockbackHandler(std::shared_ptr<LUS::Console> Console, const std::vector<std::string>& args, std::string* output) { static bool KnockbackHandler(std::shared_ptr<Ship::Console> Console, const std::vector<std::string>& args, std::string* output) {
if (args.size() < 2) { if (args.size() < 2) {
ERROR_MESSAGE("[SOH] Unexpected arguments passed"); ERROR_MESSAGE("[SOH] Unexpected arguments passed");
return 1; return 1;
@ -1223,7 +1223,7 @@ static bool KnockbackHandler(std::shared_ptr<LUS::Console> Console, const std::v
} }
} }
static bool ElectrocuteHandler(std::shared_ptr<LUS::Console> Console, const std::vector<std::string>& args, std::string* output) { static bool ElectrocuteHandler(std::shared_ptr<Ship::Console> Console, const std::vector<std::string>& args, std::string* output) {
GameInteractionEffectBase* effect = new GameInteractionEffect::ElectrocutePlayer(); GameInteractionEffectBase* effect = new GameInteractionEffect::ElectrocutePlayer();
GameInteractionEffectQueryResult result = GameInteractor::ApplyEffect(effect); GameInteractionEffectQueryResult result = GameInteractor::ApplyEffect(effect);
@ -1236,7 +1236,7 @@ static bool ElectrocuteHandler(std::shared_ptr<LUS::Console> Console, const std:
} }
} }
static bool BurnHandler(std::shared_ptr<LUS::Console> Console, const std::vector<std::string>& args, std::string* output) { static bool BurnHandler(std::shared_ptr<Ship::Console> Console, const std::vector<std::string>& args, std::string* output) {
GameInteractionEffectBase* effect = new GameInteractionEffect::BurnPlayer(); GameInteractionEffectBase* effect = new GameInteractionEffect::BurnPlayer();
GameInteractionEffectQueryResult result = GameInteractor::ApplyEffect(effect); GameInteractionEffectQueryResult result = GameInteractor::ApplyEffect(effect);
@ -1249,7 +1249,7 @@ static bool BurnHandler(std::shared_ptr<LUS::Console> Console, const std::vector
} }
} }
static bool CuccoStormHandler(std::shared_ptr<LUS::Console> Console, const std::vector<std::string>& args, std::string* output) { static bool CuccoStormHandler(std::shared_ptr<Ship::Console> Console, const std::vector<std::string>& args, std::string* output) {
GameInteractionEffectQueryResult result = GameInteractor::RawAction::SpawnActor(ACTOR_EN_NIW, 0); GameInteractionEffectQueryResult result = GameInteractor::RawAction::SpawnActor(ACTOR_EN_NIW, 0);
if (result == GameInteractionEffectQueryResult::Possible) { if (result == GameInteractionEffectQueryResult::Possible) {
@ -1261,7 +1261,7 @@ static bool CuccoStormHandler(std::shared_ptr<LUS::Console> Console, const std::
} }
} }
static bool GenerateRandoHandler(std::shared_ptr<LUS::Console> Console, const std::vector<std::string>& args, std::string* output) { static bool GenerateRandoHandler(std::shared_ptr<Ship::Console> Console, const std::vector<std::string>& args, std::string* output) {
if (args.size() == 1) { if (args.size() == 1) {
if (GenerateRandomizer()) { if (GenerateRandomizer()) {
return 0; return 0;
@ -1289,16 +1289,58 @@ static bool GenerateRandoHandler(std::shared_ptr<LUS::Console> Console, const st
return 1; return 1;
} }
static bool CosmeticsHandler(std::shared_ptr<LUS::Console> Console, const std::vector<std::string>& args, std::string* output) { static constexpr std::array<std::pair<const char*, CosmeticGroup>, COSMETICS_GROUP_MAX> cosmetic_groups = {{
{"link", COSMETICS_GROUP_LINK},
{"mirror_shield", COSMETICS_GROUP_MIRRORSHIELD},
{"swords", COSMETICS_GROUP_SWORDS},
{"gloves", COSMETICS_GROUP_GLOVES},
{"equipment", COSMETICS_GROUP_EQUIPMENT},
{"consumable", COSMETICS_GROUP_CONSUMABLE},
{"hud", COSMETICS_GROUP_HUD},
{"kaleido", COSMETICS_GROUP_KALEIDO},
{"title", COSMETICS_GROUP_TITLE},
{"npc", COSMETICS_GROUP_NPC},
{"world", COSMETICS_GROUP_WORLD},
{"magic", COSMETICS_GROUP_MAGIC},
{"arrows", COSMETICS_GROUP_ARROWS},
{"spin_attack", COSMETICS_GROUP_SPIN_ATTACK},
{"trials", COSMETICS_GROUP_TRAILS},
{"navi", COSMETICS_GROUP_NAVI},
{"ivan", COSMETICS_GROUP_IVAN},
}};
static bool CosmeticsHandler(std::shared_ptr<Ship::Console> Console, const std::vector<std::string>& args, std::string* output) {
if (args.size() < 2) { if (args.size() < 2) {
ERROR_MESSAGE("[SOH] Unexpected arguments passed"); ERROR_MESSAGE("[SOH] Unexpected arguments passed");
return 1; return 1;
} }
if (args[1].compare("reset") == 0) { if (args[1].compare("reset") == 0) {
CosmeticsEditor_ResetAll(); if (args.size() == 2) {
CosmeticsEditor_ResetAll();
} else {
for (const auto& [key, value] : cosmetic_groups) {
if (args[2].compare(key) == 0) {
CosmeticsEditor_ResetGroup(value);
return 0;
}
}
ERROR_MESSAGE("[SOH] Invalid argument passed, unrecognized group name");
return 1;
}
} else if (args[1].compare("randomize") == 0) { } else if (args[1].compare("randomize") == 0) {
CosmeticsEditor_RandomizeAll(); if (args.size() == 2) {
CosmeticsEditor_RandomizeAll();
} else {
for (const auto& [key, value] : cosmetic_groups) {
if (args[2].compare(key) == 0) {
CosmeticsEditor_RandomizeGroup(value);
return 0;
}
}
ERROR_MESSAGE("[SOH] Invalid argument passed, unrecognized group name");
return 1;
}
} else { } else {
ERROR_MESSAGE("[SOH] Invalid argument passed, must be 'reset' or 'randomize'"); ERROR_MESSAGE("[SOH] Invalid argument passed, must be 'reset' or 'randomize'");
return 1; return 1;
@ -1307,16 +1349,50 @@ static bool CosmeticsHandler(std::shared_ptr<LUS::Console> Console, const std::v
return 0; return 0;
} }
static bool SfxHandler(std::shared_ptr<LUS::Console> Console, const std::vector<std::string>& args, std::string* output) { static std::map<std::string, SeqType> sfx_groups = {
{"bgm", SEQ_BGM_WORLD},
{"fanfares", SEQ_FANFARE},
{"events", SEQ_BGM_EVENT},
{"battle", SEQ_BGM_BATTLE},
{"ocarina", SEQ_OCARINA},
{"instruments", SEQ_INSTRUMENT},
{"sfx", SEQ_SFX},
{"voices", SEQ_VOICE},
{"custom", SEQ_BGM_CUSTOM},
};
static bool SfxHandler(std::shared_ptr<Ship::Console> Console, const std::vector<std::string>& args, std::string* output) {
if (args.size() < 2) { if (args.size() < 2) {
ERROR_MESSAGE("[SOH] Unexpected arguments passed"); ERROR_MESSAGE("[SOH] Unexpected arguments passed");
return 1; return 1;
} }
if (args[1].compare("reset") == 0) { if (args[1].compare("reset") == 0) {
AudioEditor_ResetAll(); if (args.size() == 2) {
AudioEditor_ResetAll();
} else {
for (const auto& [key, value] : sfx_groups) {
if (args[2].compare(key) == 0) {
AudioEditor_ResetGroup(value);
return 0;
}
}
ERROR_MESSAGE("[SOH] Invalid argument passed, unrecognized group name");
return 1;
}
} else if (args[1].compare("randomize") == 0) { } else if (args[1].compare("randomize") == 0) {
AudioEditor_RandomizeAll(); if (args.size() == 2) {
AudioEditor_RandomizeAll();
} else {
for (const auto& [key, value] : sfx_groups) {
if (args[2].compare(key) == 0) {
AudioEditor_RandomizeGroup(value);
return 0;
}
}
ERROR_MESSAGE("[SOH] Invalid argument passed, unrecognized group name");
return 1;
}
} else { } else {
ERROR_MESSAGE("[SOH] Invalid argument passed, must be 'reset' or 'randomize'"); ERROR_MESSAGE("[SOH] Invalid argument passed, must be 'reset' or 'randomize'");
return 1; return 1;
@ -1335,17 +1411,17 @@ void DebugConsole_Init(void) {
CMD_REGISTER("save_state", {SaveStateHandler, "Save a state."}); CMD_REGISTER("save_state", {SaveStateHandler, "Save a state."});
CMD_REGISTER("load_state", {LoadStateHandler, "Load a state."}); CMD_REGISTER("load_state", {LoadStateHandler, "Load a state."});
CMD_REGISTER("set_slot", {StateSlotSelectHandler, "Selects a SaveState slot", { CMD_REGISTER("set_slot", {StateSlotSelectHandler, "Selects a SaveState slot", {
{"Slot number", LUS::ArgumentType::NUMBER,} {"Slot number", Ship::ArgumentType::NUMBER,}
}}); }});
// Map & Location // Map & Location
CMD_REGISTER("void", {VoidHandler, "Voids out of the current map."}); CMD_REGISTER("void", {VoidHandler, "Voids out of the current map."});
CMD_REGISTER("reload", {ReloadHandler, "Reloads the current map."}); CMD_REGISTER("reload", {ReloadHandler, "Reloads the current map."});
CMD_REGISTER("fw", {FWHandler, "Spawns the player where Farore's Wind is set.", { CMD_REGISTER("fw", {FWHandler, "Spawns the player where Farore's Wind is set.", {
{"clear|warp|backup", LUS::ArgumentType::TEXT} {"clear|warp|backup", Ship::ArgumentType::TEXT}
}}); }});
CMD_REGISTER("entrance", {EntranceHandler, "Sends player to the entered entrance (hex)", { CMD_REGISTER("entrance", {EntranceHandler, "Sends player to the entered entrance (hex)", {
{"entrance", LUS::ArgumentType::NUMBER} {"entrance", Ship::ArgumentType::NUMBER}
}}); }});
// Gameplay // Gameplay
@ -1354,64 +1430,64 @@ void DebugConsole_Init(void) {
CMD_REGISTER("map", {LoadSceneHandler, "Load up kak?"}); CMD_REGISTER("map", {LoadSceneHandler, "Load up kak?"});
CMD_REGISTER("rupee", {RupeeHandler, "Set your rupee counter.", { CMD_REGISTER("rupee", {RupeeHandler, "Set your rupee counter.", {
{"amount", LUS::ArgumentType::NUMBER} {"amount", Ship::ArgumentType::NUMBER}
}}); }});
CMD_REGISTER("bItem", {BHandler, "Set an item to the B button.", { CMD_REGISTER("bItem", {BHandler, "Set an item to the B button.", {
{"Item ID", LUS::ArgumentType::NUMBER} {"Item ID", Ship::ArgumentType::NUMBER}
}}); }});
CMD_REGISTER("spawn", { ActorSpawnHandler, "Spawn an actor.", { { "actor name/id", LUS::ArgumentType::NUMBER }, // TODO there should be an actor_id arg type CMD_REGISTER("spawn", { ActorSpawnHandler, "Spawn an actor.", { { "actor name/id", Ship::ArgumentType::NUMBER }, // TODO there should be an actor_id arg type
{"data", LUS::ArgumentType::NUMBER}, {"data", Ship::ArgumentType::NUMBER},
{"x", LUS::ArgumentType::NUMBER, true}, {"x", Ship::ArgumentType::NUMBER, true},
{"y", LUS::ArgumentType::NUMBER, true}, {"y", Ship::ArgumentType::NUMBER, true},
{"z", LUS::ArgumentType::NUMBER, true}, {"z", Ship::ArgumentType::NUMBER, true},
{"rx", LUS::ArgumentType::NUMBER, true}, {"rx", Ship::ArgumentType::NUMBER, true},
{"ry", LUS::ArgumentType::NUMBER, true}, {"ry", Ship::ArgumentType::NUMBER, true},
{"rz", LUS::ArgumentType::NUMBER, true} {"rz", Ship::ArgumentType::NUMBER, true}
}}); }});
CMD_REGISTER("pos", {SetPosHandler, "Sets the position of the player.", { CMD_REGISTER("pos", {SetPosHandler, "Sets the position of the player.", {
{"x", LUS::ArgumentType::NUMBER, true}, {"x", Ship::ArgumentType::NUMBER, true},
{"y", LUS::ArgumentType::NUMBER, true}, {"y", Ship::ArgumentType::NUMBER, true},
{"z", LUS::ArgumentType::NUMBER, true} {"z", Ship::ArgumentType::NUMBER, true}
}}); }});
CMD_REGISTER("addammo", {AddAmmoHandler, "Adds ammo of an item.", { CMD_REGISTER("addammo", {AddAmmoHandler, "Adds ammo of an item.", {
{"sticks|nuts|bombs|seeds|arrows|bombchus|beans", LUS::ArgumentType::TEXT}, {"sticks|nuts|bombs|seeds|arrows|bombchus|beans", Ship::ArgumentType::TEXT},
{"count", LUS::ArgumentType::NUMBER} {"count", Ship::ArgumentType::NUMBER}
}}); }});
CMD_REGISTER("takeammo", {TakeAmmoHandler, "Removes ammo of an item.", { CMD_REGISTER("takeammo", {TakeAmmoHandler, "Removes ammo of an item.", {
{"sticks|nuts|bombs|seeds|arrows|bombchus|beans", LUS::ArgumentType::TEXT}, {"sticks|nuts|bombs|seeds|arrows|bombchus|beans", Ship::ArgumentType::TEXT},
{"count", LUS::ArgumentType::NUMBER} {"count", Ship::ArgumentType::NUMBER}
}}); }});
CMD_REGISTER("bottle", {BottleHandler, "Changes item in a bottle slot.", { CMD_REGISTER("bottle", {BottleHandler, "Changes item in a bottle slot.", {
{"item", LUS::ArgumentType::TEXT}, {"item", Ship::ArgumentType::TEXT},
{"slot", LUS::ArgumentType::NUMBER} {"slot", Ship::ArgumentType::NUMBER}
}}); }});
CMD_REGISTER("give_item", {GiveItemHandler, "Gives an item to the player as if it was given from an actor", { CMD_REGISTER("give_item", {GiveItemHandler, "Gives an item to the player as if it was given from an actor", {
{"vanilla|randomizer", LUS::ArgumentType::TEXT}, {"vanilla|randomizer", Ship::ArgumentType::TEXT},
{"giveItemID", LUS::ArgumentType::NUMBER} {"giveItemID", Ship::ArgumentType::NUMBER}
}}); }});
CMD_REGISTER("item", {ItemHandler, "Sets item ID in arg 1 into slot arg 2. No boundary checks. Use with caution.", { CMD_REGISTER("item", {ItemHandler, "Sets item ID in arg 1 into slot arg 2. No boundary checks. Use with caution.", {
{"slot", LUS::ArgumentType::NUMBER}, {"slot", Ship::ArgumentType::NUMBER},
{"item id", LUS::ArgumentType::NUMBER} {"item id", Ship::ArgumentType::NUMBER}
}}); }});
CMD_REGISTER("invisible", {InvisibleHandler, "Activate Link's Elvish cloak, making him appear invisible.", { CMD_REGISTER("invisible", {InvisibleHandler, "Activate Link's Elvish cloak, making him appear invisible.", {
{"value", LUS::ArgumentType::NUMBER} {"value", Ship::ArgumentType::NUMBER}
}}); }});
CMD_REGISTER("giant_link", {GiantLinkHandler, "Turn Link into a giant Lonky boi.", { CMD_REGISTER("giant_link", {GiantLinkHandler, "Turn Link into a giant Lonky boi.", {
{"value", LUS::ArgumentType::NUMBER} {"value", Ship::ArgumentType::NUMBER}
}}); }});
CMD_REGISTER("minish_link", {MinishLinkHandler, "Turn Link into a minish boi.", { CMD_REGISTER("minish_link", {MinishLinkHandler, "Turn Link into a minish boi.", {
{"value", LUS::ArgumentType::NUMBER} {"value", Ship::ArgumentType::NUMBER}
}}); }});
CMD_REGISTER("add_heart_container", CMD_REGISTER("add_heart_container",
@ -1421,25 +1497,25 @@ void DebugConsole_Init(void) {
{RemoveHeartContainerHandler, "Remove a heart from Link. The minimal amount of hearts is 3."}); {RemoveHeartContainerHandler, "Remove a heart from Link. The minimal amount of hearts is 3."});
CMD_REGISTER("gravity", {GravityHandler, "Set gravity level.", { CMD_REGISTER("gravity", {GravityHandler, "Set gravity level.", {
{"value", LUS::ArgumentType::NUMBER} {"value", Ship::ArgumentType::NUMBER}
}}); }});
CMD_REGISTER("no_ui", {NoUIHandler, "Disables the UI.", { CMD_REGISTER("no_ui", {NoUIHandler, "Disables the UI.", {
{"value", LUS::ArgumentType::NUMBER} {"value", Ship::ArgumentType::NUMBER}
}}); }});
CMD_REGISTER("freeze", {FreezeHandler, "Freezes Link in place"}); CMD_REGISTER("freeze", {FreezeHandler, "Freezes Link in place"});
CMD_REGISTER("defense_modifier", {DefenseModifierHandler, "Sets the defense modifier.", { CMD_REGISTER("defense_modifier", {DefenseModifierHandler, "Sets the defense modifier.", {
{"value", LUS::ArgumentType::NUMBER} {"value", Ship::ArgumentType::NUMBER}
}}); }});
CMD_REGISTER("damage", {DamageHandler, "Deal damage to Link.", { CMD_REGISTER("damage", {DamageHandler, "Deal damage to Link.", {
{"value", LUS::ArgumentType::NUMBER} {"value", Ship::ArgumentType::NUMBER}
}}); }});
CMD_REGISTER("heal", {HealHandler, "Heals Link.", { CMD_REGISTER("heal", {HealHandler, "Heals Link.", {
{"value", LUS::ArgumentType::NUMBER} {"value", Ship::ArgumentType::NUMBER}
}}); }});
CMD_REGISTER("fill_magic", {FillMagicHandler, "Fills magic."}); CMD_REGISTER("fill_magic", {FillMagicHandler, "Fills magic."});
@ -1447,50 +1523,50 @@ void DebugConsole_Init(void) {
CMD_REGISTER("empty_magic", {EmptyMagicHandler, "Empties magic."}); CMD_REGISTER("empty_magic", {EmptyMagicHandler, "Empties magic."});
CMD_REGISTER("no_z", {NoZHandler, "Disables Z-button presses.", { CMD_REGISTER("no_z", {NoZHandler, "Disables Z-button presses.", {
{"value", LUS::ArgumentType::NUMBER} {"value", Ship::ArgumentType::NUMBER}
}}); }});
CMD_REGISTER("ohko", {OneHitKOHandler, CMD_REGISTER("ohko", {OneHitKOHandler,
"Activates one hit KO. Any damage kills Link and he cannot gain health in this mode.", { "Activates one hit KO. Any damage kills Link and he cannot gain health in this mode.", {
{"value", LUS::ArgumentType::NUMBER} {"value", Ship::ArgumentType::NUMBER}
}}); }});
CMD_REGISTER("pacifist", {PacifistHandler, "Activates pacifist mode. Prevents Link from using his weapon.", { CMD_REGISTER("pacifist", {PacifistHandler, "Activates pacifist mode. Prevents Link from using his weapon.", {
{"value", LUS::ArgumentType::NUMBER} {"value", Ship::ArgumentType::NUMBER}
}}); }});
CMD_REGISTER("paper_link", {PaperLinkHandler, "Link but made out of paper.", { CMD_REGISTER("paper_link", {PaperLinkHandler, "Link but made out of paper.", {
{"value", LUS::ArgumentType::NUMBER} {"value", Ship::ArgumentType::NUMBER}
}}); }});
CMD_REGISTER("rainstorm", {RainstormHandler, "Activates rainstorm."}); CMD_REGISTER("rainstorm", {RainstormHandler, "Activates rainstorm."});
CMD_REGISTER("reverse_controls", {ReverseControlsHandler, "Reverses the controls.", { CMD_REGISTER("reverse_controls", {ReverseControlsHandler, "Reverses the controls.", {
{"value", LUS::ArgumentType::NUMBER} {"value", Ship::ArgumentType::NUMBER}
}}); }});
CMD_REGISTER("update_rupees", {UpdateRupeesHandler, "Adds rupees.", { CMD_REGISTER("update_rupees", {UpdateRupeesHandler, "Adds rupees.", {
{"value", LUS::ArgumentType::NUMBER} {"value", Ship::ArgumentType::NUMBER}
}}); }});
CMD_REGISTER("speed_modifier", {SpeedModifierHandler, "Sets the speed modifier.", { CMD_REGISTER("speed_modifier", {SpeedModifierHandler, "Sets the speed modifier.", {
{"value", LUS::ArgumentType::NUMBER} {"value", Ship::ArgumentType::NUMBER}
}}); }});
CMD_REGISTER("boots", {BootsHandler, "Activates boots.", { CMD_REGISTER("boots", {BootsHandler, "Activates boots.", {
{"kokiri|iron|hover", LUS::ArgumentType::TEXT}, {"kokiri|iron|hover", Ship::ArgumentType::TEXT},
}}); }});
CMD_REGISTER("giveshield", {GiveShieldHandler, "Gives a shield and equips it when Link is the right age for it.", { CMD_REGISTER("giveshield", {GiveShieldHandler, "Gives a shield and equips it when Link is the right age for it.", {
{"deku|hylian|mirror", LUS::ArgumentType::TEXT}, {"deku|hylian|mirror", Ship::ArgumentType::TEXT},
}}); }});
CMD_REGISTER("takeshield", {TakeShieldHandler, "Takes a shield and unequips it if Link is wearing it.", { CMD_REGISTER("takeshield", {TakeShieldHandler, "Takes a shield and unequips it if Link is wearing it.", {
{"deku|hylian|mirror", LUS::ArgumentType::TEXT}, {"deku|hylian|mirror", Ship::ArgumentType::TEXT},
}}); }});
CMD_REGISTER("knockback", {KnockbackHandler, "Knocks Link back.", { CMD_REGISTER("knockback", {KnockbackHandler, "Knocks Link back.", {
{"value", LUS::ArgumentType::NUMBER} {"value", Ship::ArgumentType::NUMBER}
}}); }});
CMD_REGISTER("electrocute", {ElectrocuteHandler, "Electrocutes Link."}); CMD_REGISTER("electrocute", {ElectrocuteHandler, "Electrocutes Link."});
@ -1500,16 +1576,18 @@ void DebugConsole_Init(void) {
CMD_REGISTER("cucco_storm", {CuccoStormHandler, "Cucco Storm"}); CMD_REGISTER("cucco_storm", {CuccoStormHandler, "Cucco Storm"});
CMD_REGISTER("gen_rando", {GenerateRandoHandler, "Generate a randomizer seed", { CMD_REGISTER("gen_rando", {GenerateRandoHandler, "Generate a randomizer seed", {
{"seed|count", LUS::ArgumentType::NUMBER, true}, {"seed|count", Ship::ArgumentType::NUMBER, true},
{"testing", LUS::ArgumentType::NUMBER, true}, {"testing", Ship::ArgumentType::NUMBER, true},
}}); }});
CMD_REGISTER("cosmetics", {CosmeticsHandler, "Change cosmetics.", { CMD_REGISTER("cosmetics", {CosmeticsHandler, "Change cosmetics.", {
{"reset|randomize", LUS::ArgumentType::TEXT}, {"reset|randomize", Ship::ArgumentType::TEXT},
{"group name", Ship::ArgumentType::TEXT, true},
}}); }});
CMD_REGISTER("sfx", {SfxHandler, "Change SFX.", { CMD_REGISTER("sfx", {SfxHandler, "Change SFX.", {
{"reset|randomize", LUS::ArgumentType::TEXT}, {"reset|randomize", Ship::ArgumentType::TEXT},
{"group_name", Ship::ArgumentType::TEXT, true},
}}); }});
CVarSave(); CVarSave();

View File

@ -121,7 +121,7 @@ void FindMessage(PlayState* play, const uint16_t textId, const uint8_t language)
Font* font; Font* font;
u16 bufferId = textId; u16 bufferId = textId;
// Use the better owl message if better owl is enabled // Use the better owl message if better owl is enabled
if (CVarGetInteger("gBetterOwl", 0) != 0 && (bufferId == 0x2066 || bufferId == 0x607B || if (CVarGetInteger(CVAR_ENHANCEMENT("BetterOwl"), 0) != 0 && (bufferId == 0x2066 || bufferId == 0x607B ||
bufferId == 0x10C2 || bufferId == 0x10C6 || bufferId == 0x206A)) bufferId == 0x10C2 || bufferId == 0x10C6 || bufferId == 0x206A))
{ {
bufferId = 0x71B3; bufferId = 0x71B3;

View File

@ -26,7 +26,7 @@ void MessageDebug_DisplayCustomMessage(const char* customMessage);
} }
class MessageViewer : public LUS::GuiWindow { class MessageViewer : public Ship::GuiWindow {
public: public:
static inline const char* TABLE_ID = "MessageViewer"; static inline const char* TABLE_ID = "MessageViewer";
using GuiWindow::GuiWindow; using GuiWindow::GuiWindow;

View File

@ -12,6 +12,7 @@
#include <string> #include <string>
#include <libultraship/bridge.h> #include <libultraship/bridge.h>
#include <libultraship/libultraship.h> #include <libultraship/libultraship.h>
#include "soh/OTRGlobals.h"
extern "C" { extern "C" {
#include <z64.h> #include <z64.h>
@ -887,7 +888,7 @@ std::vector<u16> GetActorsWithDescriptionContainingString(std::string s) {
} }
void ActorViewer_AddTagForActor(Actor* actor) { void ActorViewer_AddTagForActor(Actor* actor) {
int val = CVarGetInteger("gDebugActorViewerNameTags", ACTORVIEWER_NAMETAGS_NONE); int val = CVarGetInteger(CVAR_DEVELOPER_TOOLS("ActorViewer.NameTags"), ACTORVIEWER_NAMETAGS_NONE);
auto entry = ActorDB::Instance->RetrieveEntry(actor->id); auto entry = ActorDB::Instance->RetrieveEntry(actor->id);
std::string tag; std::string tag;
@ -1129,10 +1130,10 @@ void ActorViewerWindow::DrawElement() {
newActor.params = 0; newActor.params = 0;
} }
UIWidgets::EnhancementCheckbox("Advanced mode", "gActorViewerAdvancedParams"); UIWidgets::EnhancementCheckbox("Advanced mode", CVAR_DEVELOPER_TOOLS("ActorViewer.AdvancedParams"));
UIWidgets::InsertHelpHoverText("Changes the actor specific param menus with a direct input"); UIWidgets::InsertHelpHoverText("Changes the actor specific param menus with a direct input");
if (CVarGetInteger("gActorViewerAdvancedParams", 0)) { if (CVarGetInteger(CVAR_DEVELOPER_TOOLS("ActorViewer.AdvancedParams"), 0)) {
ImGui::InputScalar("params", ImGuiDataType_S16, &newActor.params, &one); ImGui::InputScalar("params", ImGuiDataType_S16, &newActor.params, &one);
} else if (std::find(noParamsActors.begin(), noParamsActors.end(), newActor.id) == noParamsActors.end()) { } else if (std::find(noParamsActors.begin(), noParamsActors.end(), newActor.id) == noParamsActors.end()) {
CreateActorSpecificData(); CreateActorSpecificData();
@ -1214,7 +1215,7 @@ void ActorViewerWindow::DrawElement() {
UIWidgets::Spacer(0); UIWidgets::Spacer(0);
ImGui::Text("Actor Name Tags"); ImGui::Text("Actor Name Tags");
if (UIWidgets::EnhancementCombobox("gDebugActorViewerNameTags", nameTagOptions, ACTORVIEWER_NAMETAGS_NONE)) { if (UIWidgets::EnhancementCombobox(CVAR_DEVELOPER_TOOLS("ActorViewer.NameTags"), nameTagOptions, ACTORVIEWER_NAMETAGS_NONE)) {
NameTag_RemoveAllByTag(DEBUG_ACTOR_NAMETAG_TAG); NameTag_RemoveAllByTag(DEBUG_ACTOR_NAMETAG_TAG);
ActorViewer_AddTagForAllActors(); ActorViewer_AddTagForAllActors();
} }

View File

@ -2,7 +2,7 @@
#include <libultraship/libultraship.h> #include <libultraship/libultraship.h>
class ActorViewerWindow : public LUS::GuiWindow { class ActorViewerWindow : public Ship::GuiWindow {
public: public:
using GuiWindow::GuiWindow; using GuiWindow::GuiWindow;

View File

@ -7,6 +7,7 @@
#include <cmath> #include <cmath>
#include <libultraship/bridge.h> #include <libultraship/bridge.h>
#include <libultraship/libultraship.h> #include <libultraship/libultraship.h>
#include "soh/OTRGlobals.h"
extern "C" { extern "C" {
#include <z64.h> #include <z64.h>
@ -57,17 +58,17 @@ void ColViewerWindow::DrawElement() {
ImGui::End(); ImGui::End();
return; return;
} }
UIWidgets::EnhancementCheckbox("Enabled", "gColViewerEnabled"); UIWidgets::EnhancementCheckbox("Enabled", CVAR_DEVELOPER_TOOLS("ColViewer.Enabled"));
UIWidgets::LabeledRightAlignedEnhancementCombobox("Scene", "gColViewerScene", ColRenderSettingNames, COLVIEW_DISABLED); UIWidgets::LabeledRightAlignedEnhancementCombobox("Scene", CVAR_DEVELOPER_TOOLS("ColViewer.Scene"), ColRenderSettingNames, COLVIEW_DISABLED);
UIWidgets::LabeledRightAlignedEnhancementCombobox("Bg Actors", "gColViewerBgActors", ColRenderSettingNames, COLVIEW_DISABLED); UIWidgets::LabeledRightAlignedEnhancementCombobox("Bg Actors", CVAR_DEVELOPER_TOOLS("ColViewer.BGActors"), ColRenderSettingNames, COLVIEW_DISABLED);
UIWidgets::LabeledRightAlignedEnhancementCombobox("Col Check", "gColViewerColCheck", ColRenderSettingNames, COLVIEW_DISABLED); UIWidgets::LabeledRightAlignedEnhancementCombobox("Col Check", CVAR_DEVELOPER_TOOLS("ColViewer.ColCheck"), ColRenderSettingNames, COLVIEW_DISABLED);
UIWidgets::LabeledRightAlignedEnhancementCombobox("Waterbox", "gColViewerWaterbox", ColRenderSettingNames, COLVIEW_DISABLED); UIWidgets::LabeledRightAlignedEnhancementCombobox("Waterbox", CVAR_DEVELOPER_TOOLS("ColViewer.Waterbox"), ColRenderSettingNames, COLVIEW_DISABLED);
UIWidgets::EnhancementCheckbox("Apply as decal", "gColViewerDecal"); UIWidgets::EnhancementCheckbox("Apply as decal", CVAR_DEVELOPER_TOOLS("ColViewer.Decal"));
UIWidgets::InsertHelpHoverText("Applies the collision as a decal display. This can be useful if there is z-fighting occuring " UIWidgets::InsertHelpHoverText("Applies the collision as a decal display. This can be useful if there is z-fighting occuring "
"with the scene geometry, but can cause other artifacts."); "with the scene geometry, but can cause other artifacts.");
UIWidgets::EnhancementCheckbox("Shaded", "gColViewerShaded"); UIWidgets::EnhancementCheckbox("Shaded", CVAR_DEVELOPER_TOOLS("ColViewer.Shaded"));
UIWidgets::InsertHelpHoverText("Applies the scene's shading to the collision display."); UIWidgets::InsertHelpHoverText("Applies the scene's shading to the collision display.");
// This has to be duplicated in both code paths due to the nature of ImGui::IsItemHovered() // This has to be duplicated in both code paths due to the nature of ImGui::IsItemHovered()
@ -75,20 +76,20 @@ void ColViewerWindow::DrawElement() {
if (ImGui::TreeNode("Colors")) { if (ImGui::TreeNode("Colors")) {
UIWidgets::InsertHelpHoverText(colorHelpText); UIWidgets::InsertHelpHoverText(colorHelpText);
UIWidgets::EnhancementColor("Normal", "gColViewerColorNormal", scene_col, ImVec4(255, 255, 255, 255), false); UIWidgets::EnhancementColor("Normal", CVAR_DEVELOPER_TOOLS("ColViewer.ColorNormal"), scene_col, ImVec4(255, 255, 255, 255), false);
UIWidgets::EnhancementColor("Hookshot", "gColViewerColorHookshot", hookshot_col, ImVec4(128, 128, 255, 255), UIWidgets::EnhancementColor("Hookshot", CVAR_DEVELOPER_TOOLS("ColViewer.ColorHookshot"), hookshot_col, ImVec4(128, 128, 255, 255),
false); false);
UIWidgets::EnhancementColor("Entrance", "gColViewerColorEntrance", entrance_col, ImVec4(0, 255, 0, 255), false); UIWidgets::EnhancementColor("Entrance", CVAR_DEVELOPER_TOOLS("ColViewer.ColorEntrance"), entrance_col, ImVec4(0, 255, 0, 255), false);
UIWidgets::EnhancementColor("Special Surface (Grass/Sand/Etc)", "gColViewerColorSpecialSurface", UIWidgets::EnhancementColor("Special Surface (Grass/Sand/Etc)", CVAR_DEVELOPER_TOOLS("ColViewer.ColorSpecialSurface"),
specialSurface_col, ImVec4(192, 255, 192, 255), false); specialSurface_col, ImVec4(192, 255, 192, 255), false);
UIWidgets::EnhancementColor("Interactable (Vines/Crawlspace/Etc)", "gColViewerColorInteractable", UIWidgets::EnhancementColor("Interactable (Vines/Crawlspace/Etc)", CVAR_DEVELOPER_TOOLS("ColViewer.ColorInteractable"),
interactable_col, ImVec4(192, 0, 192, 255), false); interactable_col, ImVec4(192, 0, 192, 255), false);
UIWidgets::EnhancementColor("Slope", "gColViewerColorSlope", slope_col, ImVec4(255, 255, 128, 255), false); UIWidgets::EnhancementColor("Slope", CVAR_DEVELOPER_TOOLS("ColViewer.ColorSlope"), slope_col, ImVec4(255, 255, 128, 255), false);
UIWidgets::EnhancementColor("Void", "gColViewerColorVoid", void_col, ImVec4(255, 0, 0, 255), false); UIWidgets::EnhancementColor("Void", CVAR_DEVELOPER_TOOLS("ColViewer.ColorVoid"), void_col, ImVec4(255, 0, 0, 255), false);
UIWidgets::EnhancementColor("OC", "gColViewerColorOC", oc_col, ImVec4(255, 255, 255, 255), false); UIWidgets::EnhancementColor("OC", CVAR_DEVELOPER_TOOLS("ColViewer.ColorOC"), oc_col, ImVec4(255, 255, 255, 255), false);
UIWidgets::EnhancementColor("AC", "gColViewerColorAC", ac_col, ImVec4(0, 0, 255, 255), false); UIWidgets::EnhancementColor("AC", CVAR_DEVELOPER_TOOLS("ColViewer.ColorAC"), ac_col, ImVec4(0, 0, 255, 255), false);
UIWidgets::EnhancementColor("AT", "gColViewerColorAT", at_col, ImVec4(255, 0, 0, 255), false); UIWidgets::EnhancementColor("AT", CVAR_DEVELOPER_TOOLS("ColViewer.ColorAT"), at_col, ImVec4(255, 0, 0, 255), false);
UIWidgets::EnhancementColor("Waterbox", "gColViewerColorWaterbox", waterbox_col, ImVec4(0, 0, 255, 255), false); UIWidgets::EnhancementColor("Waterbox", CVAR_DEVELOPER_TOOLS("ColViewer.ColorWaterbox"), waterbox_col, ImVec4(0, 0, 255, 255), false);
ImGui::TreePop(); ImGui::TreePop();
} else { } else {
@ -308,7 +309,7 @@ void InitGfx(std::vector<Gfx>& gfx, ColRenderSetting setting) {
alpha = 0xFF; alpha = 0xFF;
} }
if (CVarGetInteger("gColViewerDecal", 0) != 0) { if (CVarGetInteger(CVAR_DEVELOPER_TOOLS("ColViewer.Decal"), 0) != 0) {
rm |= ZMODE_DEC; rm |= ZMODE_DEC;
} else if (setting == ColRenderSetting::Transparent) { } else if (setting == ColRenderSetting::Transparent) {
rm |= ZMODE_XLU; rm |= ZMODE_XLU;
@ -320,7 +321,7 @@ void InitGfx(std::vector<Gfx>& gfx, ColRenderSetting setting) {
gfx.push_back(gsDPSetCycleType(G_CYC_1CYCLE)); gfx.push_back(gsDPSetCycleType(G_CYC_1CYCLE));
gfx.push_back(gsDPSetRenderMode(rm | blc1, rm | blc2)); gfx.push_back(gsDPSetRenderMode(rm | blc1, rm | blc2));
if (CVarGetInteger("gColViewerShaded", 0) != 0) { if (CVarGetInteger(CVAR_DEVELOPER_TOOLS("ColViewer.Shaded"), 0) != 0) {
gfx.push_back(gsDPSetCombineMode(G_CC_MODULATERGB_PRIM_ENVA, G_CC_MODULATERGB_PRIM_ENVA)); gfx.push_back(gsDPSetCombineMode(G_CC_MODULATERGB_PRIM_ENVA, G_CC_MODULATERGB_PRIM_ENVA));
gfx.push_back(gsSPLoadGeometryMode(G_CULL_BACK | G_ZBUFFER | G_LIGHTING)); gfx.push_back(gsSPLoadGeometryMode(G_CULL_BACK | G_ZBUFFER | G_LIGHTING));
} else { } else {
@ -333,16 +334,13 @@ void InitGfx(std::vector<Gfx>& gfx, ColRenderSetting setting) {
// Draws a dynapoly structure (scenes or Bg Actors) // Draws a dynapoly structure (scenes or Bg Actors)
void DrawDynapoly(std::vector<Gfx>& dl, CollisionHeader* col, int32_t bgId) { void DrawDynapoly(std::vector<Gfx>& dl, CollisionHeader* col, int32_t bgId) {
uint32_t colorR = CVarGetInteger("gColViewerColorNormalR", 255); Color_RGBA8 color = {255, 255, 255, 255};
uint32_t colorG = CVarGetInteger("gColViewerColorNormalG", 255);
uint32_t colorB = CVarGetInteger("gColViewerColorNormalB", 255);
uint32_t colorA = 255;
uint32_t lastColorR = colorR; uint32_t lastColorR = color.r;
uint32_t lastColorG = colorG; uint32_t lastColorG = color.g;
uint32_t lastColorB = colorB; uint32_t lastColorB = color.b;
dl.push_back(gsDPSetPrimColor(0, 0, colorR, colorG, colorB, colorA)); dl.push_back(gsDPSetPrimColor(0, 0, color.r, color.g, color.b, 255));
// This keeps track of if we have processed a poly, but not drawn it yet so we can batch them. // This keeps track of if we have processed a poly, but not drawn it yet so we can batch them.
// This saves several hundred commands in larger scenes // This saves several hundred commands in larger scenes
@ -352,49 +350,35 @@ void DrawDynapoly(std::vector<Gfx>& dl, CollisionHeader* col, int32_t bgId) {
CollisionPoly* poly = &col->polyList[i]; CollisionPoly* poly = &col->polyList[i];
if (SurfaceType_IsHookshotSurface(&gPlayState->colCtx, poly, bgId)) { if (SurfaceType_IsHookshotSurface(&gPlayState->colCtx, poly, bgId)) {
colorR = CVarGetInteger("gColViewerColorHookshotR", 128); color = CVarGetColor(CVAR_DEVELOPER_TOOLS("ColViewer.ColorHookshot"), { 128, 128, 255, 255 });
colorG = CVarGetInteger("gColViewerColorHookshotG", 128);
colorB = CVarGetInteger("gColViewerColorHookshotB", 255);
} else if (func_80041D94(&gPlayState->colCtx, poly, bgId) > 0x01) { } else if (func_80041D94(&gPlayState->colCtx, poly, bgId) > 0x01) {
colorR = CVarGetInteger("gColViewerColorInteractableR", 192); color = CVarGetColor(CVAR_DEVELOPER_TOOLS("ColViewer.ColorInteractable"), {192, 0, 192, 255});
colorG = CVarGetInteger("gColViewerColorInteractableG", 0);
colorB = CVarGetInteger("gColViewerColorInteractableB", 192);
} else if (func_80041E80(&gPlayState->colCtx, poly, bgId) == 0x0C) { } else if (func_80041E80(&gPlayState->colCtx, poly, bgId) == 0x0C) {
colorR = CVarGetInteger("gColViewerColorVoidR", 255); color = CVarGetColor(CVAR_DEVELOPER_TOOLS("ColViewer.ColorVoid"), { 255, 0, 0, 255 });
colorG = CVarGetInteger("gColViewerColorVoidG", 0);
colorB = CVarGetInteger("gColViewerColorVoidB", 0);
} else if (SurfaceType_GetSceneExitIndex(&gPlayState->colCtx, poly, bgId) || } else if (SurfaceType_GetSceneExitIndex(&gPlayState->colCtx, poly, bgId) ||
func_80041E80(&gPlayState->colCtx, poly, bgId) == 0x05) { func_80041E80(&gPlayState->colCtx, poly, bgId) == 0x05) {
colorR = CVarGetInteger("gColViewerColorEntranceR", 0); color = CVarGetColor(CVAR_DEVELOPER_TOOLS("ColViewer.ColorEntrance"), { 0, 255, 0, 255 });
colorG = CVarGetInteger("gColViewerColorEntranceG", 255);
colorB = CVarGetInteger("gColViewerColorEntranceB", 0);
} else if (func_80041D4C(&gPlayState->colCtx, poly, bgId) != 0 || } else if (func_80041D4C(&gPlayState->colCtx, poly, bgId) != 0 ||
SurfaceType_IsWallDamage(&gPlayState->colCtx, poly, bgId)) { SurfaceType_IsWallDamage(&gPlayState->colCtx, poly, bgId)) {
colorR = CVarGetInteger("gColViewerColorSpecialSurfaceR", 192); color = CVarGetColor(CVAR_DEVELOPER_TOOLS("ColViewer.ColorSpecialSurface"), { 192, 255, 192, 255 });
colorG = CVarGetInteger("gColViewerColorSpecialSurfaceG", 255);
colorB = CVarGetInteger("gColViewerColorSpecialSurfaceB", 192);
} else if (SurfaceType_GetSlope(&gPlayState->colCtx, poly, bgId) == 0x01) { } else if (SurfaceType_GetSlope(&gPlayState->colCtx, poly, bgId) == 0x01) {
colorR = CVarGetInteger("gColViewerColorSlopeR", 255); color = CVarGetColor(CVAR_DEVELOPER_TOOLS("ColViewer.ColorSlope"), { 255, 255, 128, 255 });
colorG = CVarGetInteger("gColViewerColorSlopeG", 255);
colorB = CVarGetInteger("gColViewerColorSlopeB", 128);
} else { } else {
colorR = CVarGetInteger("gColViewerColorNormalR", 255); color = CVarGetColor(CVAR_DEVELOPER_TOOLS("ColViewer.ColorNormal"), { 255, 255, 255, 255 });
colorG = CVarGetInteger("gColViewerColorNormalG", 255);
colorB = CVarGetInteger("gColViewerColorNormalB", 255);
} }
if (colorR != lastColorR || colorG != lastColorG || colorB != lastColorB) { if (color.r != lastColorR || color.g != lastColorG || color.b != lastColorB) {
// Color changed, flush previous poly // Color changed, flush previous poly
if (previousPoly) { if (previousPoly) {
dl.push_back(gsSPVertex((uintptr_t)&vtxDl.at(vtxDl.size() - 3), 3, 0)); dl.push_back(gsSPVertex((uintptr_t)&vtxDl.at(vtxDl.size() - 3), 3, 0));
dl.push_back(gsSP1Triangle(0, 1, 2, 0)); dl.push_back(gsSP1Triangle(0, 1, 2, 0));
previousPoly = false; previousPoly = false;
} }
dl.push_back(gsDPSetPrimColor(0, 0, colorR, colorG, colorB, colorA)); dl.push_back(gsDPSetPrimColor(0, 0, color.r, color.g, color.b, 255));
} }
lastColorR = colorR; lastColorR = color.r;
lastColorG = colorG; lastColorG = color.g;
lastColorB = colorB; lastColorB = color.b;
Vec3s* va = &col->vtxList[COLPOLY_VTX_INDEX(poly->flags_vIA)]; Vec3s* va = &col->vtxList[COLPOLY_VTX_INDEX(poly->flags_vIA)];
Vec3s* vb = &col->vtxList[COLPOLY_VTX_INDEX(poly->flags_vIB)]; Vec3s* vb = &col->vtxList[COLPOLY_VTX_INDEX(poly->flags_vIB)];
@ -428,9 +412,9 @@ void DrawDynapoly(std::vector<Gfx>& dl, CollisionHeader* col, int32_t bgId) {
// Draws the scene // Draws the scene
void DrawSceneCollision() { void DrawSceneCollision() {
ColRenderSetting showSceneColSetting = (ColRenderSetting)CVarGetInteger("gColViewerScene", COLVIEW_DISABLED); ColRenderSetting showSceneColSetting = (ColRenderSetting)CVarGetInteger(CVAR_DEVELOPER_TOOLS("ColViewer.Scene"), COLVIEW_DISABLED);
if (showSceneColSetting == ColRenderSetting::Disabled || !CVarGetInteger("gColViewerEnabled", 0)) { if (showSceneColSetting == ColRenderSetting::Disabled || !CVarGetInteger(CVAR_DEVELOPER_TOOLS("ColViewer.Enabled"), 0)) {
return; return;
} }
@ -443,8 +427,8 @@ void DrawSceneCollision() {
// Draws all Bg Actors // Draws all Bg Actors
void DrawBgActorCollision() { void DrawBgActorCollision() {
ColRenderSetting showBgActorSetting = (ColRenderSetting)CVarGetInteger("gColViewerBgActors", COLVIEW_DISABLED); ColRenderSetting showBgActorSetting = (ColRenderSetting)CVarGetInteger(CVAR_DEVELOPER_TOOLS("ColViewer.BGActors"), COLVIEW_DISABLED);
if (showBgActorSetting == ColRenderSetting::Disabled || !CVarGetInteger("gColViewerEnabled", 0)) { if (showBgActorSetting == ColRenderSetting::Disabled || !CVarGetInteger(CVAR_DEVELOPER_TOOLS("ColViewer.Enabled"), 0)) {
return; return;
} }
@ -568,8 +552,8 @@ void DrawColCheckList(std::vector<Gfx>& dl, Collider** objects, int32_t count) {
// Draws all Col Check objects // Draws all Col Check objects
void DrawColCheckCollision() { void DrawColCheckCollision() {
ColRenderSetting showColCheckSetting = (ColRenderSetting)CVarGetInteger("gColViewerColCheck", COLVIEW_DISABLED); ColRenderSetting showColCheckSetting = (ColRenderSetting)CVarGetInteger(CVAR_DEVELOPER_TOOLS("ColViewer.ColCheck"), COLVIEW_DISABLED);
if (showColCheckSetting == ColRenderSetting::Disabled || !CVarGetInteger("gColViewerEnabled", 0)) { if (showColCheckSetting == ColRenderSetting::Disabled || !CVarGetInteger(CVAR_DEVELOPER_TOOLS("ColViewer.Enabled"), 0)) {
return; return;
} }
@ -578,15 +562,14 @@ void DrawColCheckCollision() {
dl.push_back(gsSPMatrix(&gMtxClear, G_MTX_MODELVIEW | G_MTX_LOAD | G_MTX_NOPUSH)); dl.push_back(gsSPMatrix(&gMtxClear, G_MTX_MODELVIEW | G_MTX_LOAD | G_MTX_NOPUSH));
CollisionCheckContext& col = gPlayState->colChkCtx; CollisionCheckContext& col = gPlayState->colChkCtx;
Color_RGBA8 color = CVarGetColor(CVAR_DEVELOPER_TOOLS("ColViewer.ColorOC"), { 255, 255, 255, 255 });
dl.push_back(gsDPSetPrimColor(0, 0, CVarGetInteger("gColViewerColorOCR", 255), CVarGetInteger("gColViewerColorOCG", 255), dl.push_back(gsDPSetPrimColor(0, 0, color.r, color.g, color.b, 255));
CVarGetInteger("gColViewerColorOCB", 255), 255));
DrawColCheckList(dl, col.colOC, col.colOCCount); DrawColCheckList(dl, col.colOC, col.colOCCount);
dl.push_back(gsDPSetPrimColor(0, 0, CVarGetInteger("gColViewerColorACR", 0), CVarGetInteger("gColViewerColorACG", 0), color = CVarGetColor(CVAR_DEVELOPER_TOOLS("ColViewer.ColorAC"), { 0, 0, 255, 255 });
CVarGetInteger("gColViewerColorACB", 255), 255)); dl.push_back(gsDPSetPrimColor(0, 0, color.r, color.g, color.b, 255));
DrawColCheckList(dl, col.colAC, col.colACCount); DrawColCheckList(dl, col.colAC, col.colACCount);
dl.push_back(gsDPSetPrimColor(0, 0, CVarGetInteger("gColViewerColorATR", 255), CVarGetInteger("gColViewerColorATG", 0), color = CVarGetColor(CVAR_DEVELOPER_TOOLS("ColViewer.ColorAT"), { 0, 0, 255, 255 });
CVarGetInteger("gColViewerColorATB", 0), 255)); dl.push_back(gsDPSetPrimColor(0, 0, color.r, color.g, color.b, 255));
DrawColCheckList(dl, col.colAT, col.colATCount); DrawColCheckList(dl, col.colAT, col.colATCount);
} }
@ -621,8 +604,8 @@ extern "C" f32 zdWaterBoxMinY;
// Draws all waterboxes // Draws all waterboxes
void DrawWaterboxList() { void DrawWaterboxList() {
ColRenderSetting showWaterboxSetting = (ColRenderSetting)CVarGetInteger("gColViewerWaterbox", COLVIEW_DISABLED); ColRenderSetting showWaterboxSetting = (ColRenderSetting)CVarGetInteger(CVAR_DEVELOPER_TOOLS("ColViewer.Waterbox"), COLVIEW_DISABLED);
if (showWaterboxSetting == ColRenderSetting::Disabled || !CVarGetInteger("gColViewerEnabled", 0)) { if (showWaterboxSetting == ColRenderSetting::Disabled || !CVarGetInteger(CVAR_DEVELOPER_TOOLS("ColViewer.Enabled"), 0)) {
return; return;
} }
@ -630,9 +613,9 @@ void DrawWaterboxList() {
InitGfx(dl, showWaterboxSetting); InitGfx(dl, showWaterboxSetting);
dl.push_back(gsSPMatrix(&gMtxClear, G_MTX_MODELVIEW | G_MTX_LOAD | G_MTX_NOPUSH)); dl.push_back(gsSPMatrix(&gMtxClear, G_MTX_MODELVIEW | G_MTX_LOAD | G_MTX_NOPUSH));
dl.push_back(gsDPSetPrimColor(0, 0, CVarGetInteger("gColViewerColorWaterboxR", 0), Color_RGBA8 color = CVarGetColor(CVAR_DEVELOPER_TOOLS("ColViewer.ColorWaterbox"), { 0, 0, 255, 255 });
CVarGetInteger("gColViewerColorWaterboxG", 0),
CVarGetInteger("gColViewerColorWaterboxB", 255), 255)); dl.push_back(gsDPSetPrimColor(0, 0, color.r, color.g, color.b, 255));
CollisionHeader* col = gPlayState->colCtx.colHeader; CollisionHeader* col = gPlayState->colCtx.colHeader;
for (int32_t waterboxIndex = 0; waterboxIndex < col->numWaterBoxes; waterboxIndex++) { for (int32_t waterboxIndex = 0; waterboxIndex < col->numWaterBoxes; waterboxIndex++) {
@ -693,7 +676,7 @@ extern "C" void DrawColViewer() {
OPEN_DISPS(gPlayState->state.gfxCtx); OPEN_DISPS(gPlayState->state.gfxCtx);
uint8_t mirroredWorld = CVarGetInteger("gMirroredWorld", 0); uint8_t mirroredWorld = CVarGetInteger(CVAR_ENHANCEMENT("MirroredWorld"), 0);
// Col viewer needs inverted culling in mirror mode for both OPA and XLU buffers // Col viewer needs inverted culling in mirror mode for both OPA and XLU buffers
if (mirroredWorld) { if (mirroredWorld) {
gSPSetExtraGeometryMode(POLY_OPA_DISP++, G_EX_INVERT_CULLING); gSPSetExtraGeometryMode(POLY_OPA_DISP++, G_EX_INVERT_CULLING);

View File

@ -14,7 +14,7 @@ typedef enum {
} ColViewerRenderSetting; } ColViewerRenderSetting;
#ifdef __cplusplus #ifdef __cplusplus
class ColViewerWindow : public LUS::GuiWindow { class ColViewerWindow : public Ship::GuiWindow {
public: public:
using GuiWindow::GuiWindow; using GuiWindow::GuiWindow;

View File

@ -614,7 +614,7 @@ void DrawInfoTab() {
void DrawBGSItemFlag(uint8_t itemID) { void DrawBGSItemFlag(uint8_t itemID) {
const ItemMapEntry& slotEntry = itemMapping[itemID]; const ItemMapEntry& slotEntry = itemMapping[itemID];
ImGui::Image(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(slotEntry.name), ImVec2(32.0f, 32.0f), ImVec2(0, 0), ImVec2(1, 1)); ImGui::Image(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(slotEntry.name), ImVec2(32.0f, 32.0f), ImVec2(0, 0), ImVec2(1, 1));
ImGui::SameLine(); ImGui::SameLine();
int tradeIndex = itemID - ITEM_POCKET_EGG; int tradeIndex = itemID - ITEM_POCKET_EGG;
bool hasItem = (gSaveContext.adultTradeItems & (1 << tradeIndex)) != 0; bool hasItem = (gSaveContext.adultTradeItems & (1 << tradeIndex)) != 0;
@ -656,7 +656,7 @@ void DrawInventoryTab() {
uint8_t item = gSaveContext.inventory.items[index]; uint8_t item = gSaveContext.inventory.items[index];
if (item != ITEM_NONE) { if (item != ITEM_NONE) {
const ItemMapEntry& slotEntry = itemMapping.find(item)->second; const ItemMapEntry& slotEntry = itemMapping.find(item)->second;
if (ImGui::ImageButton(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(slotEntry.name), ImVec2(32.0f, 32.0f), ImVec2(0, 0), if (ImGui::ImageButton(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(slotEntry.name), ImVec2(32.0f, 32.0f), ImVec2(0, 0),
ImVec2(1, 1), 0)) { ImVec2(1, 1), 0)) {
selectedIndex = index; selectedIndex = index;
ImGui::OpenPopup(itemPopupPicker); ImGui::OpenPopup(itemPopupPicker);
@ -704,7 +704,7 @@ void DrawInventoryTab() {
ImGui::SameLine(); ImGui::SameLine();
} }
const ItemMapEntry& slotEntry = possibleItems[pickerIndex]; const ItemMapEntry& slotEntry = possibleItems[pickerIndex];
if (ImGui::ImageButton(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(slotEntry.name), ImVec2(32.0f, 32.0f), if (ImGui::ImageButton(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(slotEntry.name), ImVec2(32.0f, 32.0f),
ImVec2(0, 0), ImVec2(1, 1), 0)) { ImVec2(0, 0), ImVec2(1, 1), 0)) {
gSaveContext.inventory.items[selectedIndex] = slotEntry.id; gSaveContext.inventory.items[selectedIndex] = slotEntry.id;
// Set adult trade item flag if you're playing adult trade shuffle in rando // Set adult trade item flag if you're playing adult trade shuffle in rando
@ -742,7 +742,7 @@ void DrawInventoryTab() {
ImGui::PushItemWidth(32.0f); ImGui::PushItemWidth(32.0f);
ImGui::BeginGroup(); ImGui::BeginGroup();
ImGui::Image(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(itemMapping[item].name), ImVec2(32.0f, 32.0f)); ImGui::Image(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(itemMapping[item].name), ImVec2(32.0f, 32.0f));
ImGui::InputScalar("##ammoInput", ImGuiDataType_S8, &AMMO(item)); ImGui::InputScalar("##ammoInput", ImGuiDataType_S8, &AMMO(item));
ImGui::EndGroup(); ImGui::EndGroup();
@ -1187,7 +1187,7 @@ void DrawUpgradeIcon(const std::string& categoryName, int32_t categoryId, const
uint8_t item = items[CUR_UPG_VALUE(categoryId)]; uint8_t item = items[CUR_UPG_VALUE(categoryId)];
if (item != ITEM_NONE) { if (item != ITEM_NONE) {
const ItemMapEntry& slotEntry = itemMapping[item]; const ItemMapEntry& slotEntry = itemMapping[item];
if (ImGui::ImageButton(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(slotEntry.name), ImVec2(32.0f, 32.0f), ImVec2(0, 0), if (ImGui::ImageButton(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(slotEntry.name), ImVec2(32.0f, 32.0f), ImVec2(0, 0),
ImVec2(1, 1), 0)) { ImVec2(1, 1), 0)) {
ImGui::OpenPopup(upgradePopupPicker); ImGui::OpenPopup(upgradePopupPicker);
} }
@ -1215,7 +1215,7 @@ void DrawUpgradeIcon(const std::string& categoryName, int32_t categoryId, const
UIWidgets::SetLastItemHoverText("None"); UIWidgets::SetLastItemHoverText("None");
} else { } else {
const ItemMapEntry& slotEntry = itemMapping[items[pickerIndex]]; const ItemMapEntry& slotEntry = itemMapping[items[pickerIndex]];
if (ImGui::ImageButton(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(slotEntry.name), ImVec2(32.0f, 32.0f), ImVec2(0, 0), if (ImGui::ImageButton(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(slotEntry.name), ImVec2(32.0f, 32.0f), ImVec2(0, 0),
ImVec2(1, 1), 0)) { ImVec2(1, 1), 0)) {
Inventory_ChangeUpgrade(categoryId, pickerIndex); Inventory_ChangeUpgrade(categoryId, pickerIndex);
ImGui::CloseCurrentPopup(); ImGui::CloseCurrentPopup();
@ -1252,7 +1252,7 @@ void DrawEquipmentTab() {
bool hasEquip = (bitMask & gSaveContext.inventory.equipment) != 0; bool hasEquip = (bitMask & gSaveContext.inventory.equipment) != 0;
const ItemMapEntry& entry = itemMapping[equipmentValues[i]]; const ItemMapEntry& entry = itemMapping[equipmentValues[i]];
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0, 0, 0, 0)); ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0, 0, 0, 0));
if (ImGui::ImageButton(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(hasEquip ? entry.name : entry.nameFaded), if (ImGui::ImageButton(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(hasEquip ? entry.name : entry.nameFaded),
ImVec2(32.0f, 32.0f), ImVec2(0, 0), ImVec2(1, 1), 0)) { ImVec2(32.0f, 32.0f), ImVec2(0, 0), ImVec2(1, 1), 0)) {
if (hasEquip) { if (hasEquip) {
gSaveContext.inventory.equipment &= ~bitMask; gSaveContext.inventory.equipment &= ~bitMask;
@ -1351,7 +1351,7 @@ void DrawQuestItemButton(uint32_t item) {
uint32_t bitMask = 1 << entry.id; uint32_t bitMask = 1 << entry.id;
bool hasQuestItem = (bitMask & gSaveContext.inventory.questItems) != 0; bool hasQuestItem = (bitMask & gSaveContext.inventory.questItems) != 0;
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0, 0, 0, 0)); ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0, 0, 0, 0));
if (ImGui::ImageButton(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(hasQuestItem ? entry.name : entry.nameFaded), if (ImGui::ImageButton(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(hasQuestItem ? entry.name : entry.nameFaded),
ImVec2(32.0f, 32.0f), ImVec2(0, 0), ImVec2(1, 1), 0)) { ImVec2(32.0f, 32.0f), ImVec2(0, 0), ImVec2(1, 1), 0)) {
if (hasQuestItem) { if (hasQuestItem) {
gSaveContext.inventory.questItems &= ~bitMask; gSaveContext.inventory.questItems &= ~bitMask;
@ -1369,7 +1369,7 @@ void DrawDungeonItemButton(uint32_t item, uint32_t scene) {
uint32_t bitMask = 1 << (entry.id - ITEM_KEY_BOSS); // Bitset starts at ITEM_KEY_BOSS == 0. the rest are sequential uint32_t bitMask = 1 << (entry.id - ITEM_KEY_BOSS); // Bitset starts at ITEM_KEY_BOSS == 0. the rest are sequential
bool hasItem = (bitMask & gSaveContext.inventory.dungeonItems[scene]) != 0; bool hasItem = (bitMask & gSaveContext.inventory.dungeonItems[scene]) != 0;
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0, 0, 0, 0)); ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0, 0, 0, 0));
if (ImGui::ImageButton(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(hasItem ? entry.name : entry.nameFaded), if (ImGui::ImageButton(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(hasItem ? entry.name : entry.nameFaded),
ImVec2(32.0f, 32.0f), ImVec2(0, 0), ImVec2(1, 1), 0)) { ImVec2(32.0f, 32.0f), ImVec2(0, 0), ImVec2(1, 1), 0)) {
if (hasItem) { if (hasItem) {
gSaveContext.inventory.dungeonItems[scene] &= ~bitMask; gSaveContext.inventory.dungeonItems[scene] &= ~bitMask;
@ -1416,7 +1416,7 @@ void DrawQuestStatusTab() {
uint32_t bitMask = 1 << entry.id; uint32_t bitMask = 1 << entry.id;
bool hasQuestItem = (bitMask & gSaveContext.inventory.questItems) != 0; bool hasQuestItem = (bitMask & gSaveContext.inventory.questItems) != 0;
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0, 0, 0, 0)); ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0, 0, 0, 0));
if (ImGui::ImageButton(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(hasQuestItem ? entry.name : entry.nameFaded), if (ImGui::ImageButton(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(hasQuestItem ? entry.name : entry.nameFaded),
ImVec2(16.0f, 24.0f), ImVec2(0, 0), ImVec2(1, 1), 0)) { ImVec2(16.0f, 24.0f), ImVec2(0, 0), ImVec2(1, 1), 0)) {
if (hasQuestItem) { if (hasQuestItem) {
gSaveContext.inventory.questItems &= ~bitMask; gSaveContext.inventory.questItems &= ~bitMask;
@ -1479,7 +1479,7 @@ void DrawQuestStatusTab() {
if (dungeonItemsScene != SCENE_JABU_JABU_BOSS) { if (dungeonItemsScene != SCENE_JABU_JABU_BOSS) {
float lineHeight = ImGui::GetTextLineHeightWithSpacing(); float lineHeight = ImGui::GetTextLineHeightWithSpacing();
ImGui::Image(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(itemMapping[ITEM_KEY_SMALL].name), ImVec2(lineHeight, lineHeight)); ImGui::Image(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(itemMapping[ITEM_KEY_SMALL].name), ImVec2(lineHeight, lineHeight));
ImGui::SameLine(); ImGui::SameLine();
if (ImGui::InputScalar("##Keys", ImGuiDataType_S8, gSaveContext.inventory.dungeonKeys + dungeonItemsScene)) { if (ImGui::InputScalar("##Keys", ImGuiDataType_S8, gSaveContext.inventory.dungeonKeys + dungeonItemsScene)) {
gSaveContext.sohStats.dungeonKeys[dungeonItemsScene] = gSaveContext.inventory.dungeonKeys[dungeonItemsScene]; gSaveContext.sohStats.dungeonKeys[dungeonItemsScene] = gSaveContext.inventory.dungeonKeys[dungeonItemsScene];
@ -1735,7 +1735,7 @@ void DrawPlayerTab() {
ImGui::SameLine(); ImGui::SameLine();
ImGui::InputScalar("C Right", ImGuiDataType_U8, &gSaveContext.equips.buttonItems[3], &one, NULL); ImGui::InputScalar("C Right", ImGuiDataType_U8, &gSaveContext.equips.buttonItems[3], &one, NULL);
if (CVarGetInteger("gDpadEquips", 0)) { if (CVarGetInteger(CVAR_SETTING("DpadEquips"), 0)) {
ImGui::NewLine(); ImGui::NewLine();
ImGui::Text("Current D-pad Equips"); ImGui::Text("Current D-pad Equips");
ImGui::InputScalar("D-pad Up ", ImGuiDataType_U8, &gSaveContext.equips.buttonItems[4], &one, NULL); // Two spaces at the end for aligning, not elegant but it's working ImGui::InputScalar("D-pad Up ", ImGuiDataType_U8, &gSaveContext.equips.buttonItems[4], &one, NULL); // Two spaces at the end for aligning, not elegant but it's working
@ -1823,34 +1823,34 @@ void SaveEditorWindow::DrawElement() {
void SaveEditorWindow::InitElement() { void SaveEditorWindow::InitElement() {
// Load item icons into ImGui // Load item icons into ImGui
for (const auto& entry : itemMapping) { for (const auto& entry : itemMapping) {
LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadGuiTexture(entry.second.name, entry.second.texturePath, ImVec4(1, 1, 1, 1)); Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadGuiTexture(entry.second.name, entry.second.texturePath, ImVec4(1, 1, 1, 1));
LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadGuiTexture(entry.second.nameFaded, entry.second.texturePath, ImVec4(1, 1, 1, 0.3f)); Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadGuiTexture(entry.second.nameFaded, entry.second.texturePath, ImVec4(1, 1, 1, 0.3f));
} }
for (const auto& entry : gregMapping) { for (const auto& entry : gregMapping) {
ImVec4 gregGreen = ImVec4(42.0f / 255.0f, 169.0f / 255.0f, 40.0f / 255.0f, 1.0f); ImVec4 gregGreen = ImVec4(42.0f / 255.0f, 169.0f / 255.0f, 40.0f / 255.0f, 1.0f);
ImVec4 gregFadedGreen = gregGreen; ImVec4 gregFadedGreen = gregGreen;
gregFadedGreen.w = 0.3f; gregFadedGreen.w = 0.3f;
LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadGuiTexture(entry.second.name, entry.second.texturePath, gregGreen); Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadGuiTexture(entry.second.name, entry.second.texturePath, gregGreen);
LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadGuiTexture(entry.second.nameFaded, entry.second.texturePath, gregFadedGreen); Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadGuiTexture(entry.second.nameFaded, entry.second.texturePath, gregFadedGreen);
} }
for (const auto& entry : triforcePieceMapping) { for (const auto& entry : triforcePieceMapping) {
LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadGuiTexture(entry.second.name, entry.second.texturePath, ImVec4(1, 1, 1, 1)); Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadGuiTexture(entry.second.name, entry.second.texturePath, ImVec4(1, 1, 1, 1));
LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadGuiTexture(entry.second.nameFaded, entry.second.texturePath, ImVec4(1, 1, 1, 0.3f)); Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadGuiTexture(entry.second.nameFaded, entry.second.texturePath, ImVec4(1, 1, 1, 0.3f));
} }
for (const auto& entry : questMapping) { for (const auto& entry : questMapping) {
LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadGuiTexture(entry.second.name, entry.second.texturePath, ImVec4(1, 1, 1, 1)); Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadGuiTexture(entry.second.name, entry.second.texturePath, ImVec4(1, 1, 1, 1));
LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadGuiTexture(entry.second.nameFaded, entry.second.texturePath, ImVec4(1, 1, 1, 0.3f)); Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadGuiTexture(entry.second.nameFaded, entry.second.texturePath, ImVec4(1, 1, 1, 0.3f));
} }
for (const auto& entry : songMapping) { for (const auto& entry : songMapping) {
LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadGuiTexture(entry.name, gSongNoteTex, entry.color); Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadGuiTexture(entry.name, gSongNoteTex, entry.color);
ImVec4 fadedCol = entry.color; ImVec4 fadedCol = entry.color;
fadedCol.w = 0.3f; fadedCol.w = 0.3f;
LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadGuiTexture(entry.nameFaded, gSongNoteTex, fadedCol); Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadGuiTexture(entry.nameFaded, gSongNoteTex, fadedCol);
} }
for (const auto& entry : vanillaSongMapping) { for (const auto& entry : vanillaSongMapping) {
LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadGuiTexture(entry.name, gSongNoteTex, entry.color); Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadGuiTexture(entry.name, gSongNoteTex, entry.color);
ImVec4 fadedCol = entry.color; ImVec4 fadedCol = entry.color;
fadedCol.w = 0.3f; fadedCol.w = 0.3f;
LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadGuiTexture(entry.nameFaded, gSongNoteTex, fadedCol); Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadGuiTexture(entry.nameFaded, gSongNoteTex, fadedCol);
} }
} }

View File

@ -691,7 +691,7 @@ const std::vector<std::string> state3 = {
"Travelling to Hook Target" "Travelling to Hook Target"
}; };
class SaveEditorWindow : public LUS::GuiWindow { class SaveEditorWindow : public Ship::GuiWindow {
public: public:
using GuiWindow::GuiWindow; using GuiWindow::GuiWindow;

View File

@ -65,7 +65,7 @@ std::map<int, std::string> cmdMap = {
}; };
void PerformDisplayListSearch() { void PerformDisplayListSearch() {
auto result = LUS::Context::GetInstance()->GetResourceManager()->GetArchiveManager()->ListFiles("*" + std::string(searchString) + "*DL*"); auto result = Ship::Context::GetInstance()->GetResourceManager()->GetArchiveManager()->ListFiles("*" + std::string(searchString) + "*DL*");
displayListSearchResults.clear(); displayListSearchResults.clear();
@ -127,7 +127,7 @@ void DLViewerWindow::DrawElement() {
} }
try { try {
auto res = std::static_pointer_cast<LUS::DisplayList>(LUS::Context::GetInstance()->GetResourceManager()->LoadResource(activeDisplayList)); auto res = std::static_pointer_cast<LUS::DisplayList>(Ship::Context::GetInstance()->GetResourceManager()->LoadResource(activeDisplayList));
if (res->GetInitData()->Type != static_cast<uint32_t>(LUS::ResourceType::DisplayList)) { if (res->GetInitData()->Type != static_cast<uint32_t>(LUS::ResourceType::DisplayList)) {
ImGui::Text("Resource type is not a Display List. Please choose another."); ImGui::Text("Resource type is not a Display List. Please choose another.");

View File

@ -2,7 +2,7 @@
#include <libultraship/libultraship.h> #include <libultraship/libultraship.h>
class DLViewerWindow : public LUS::GuiWindow { class DLViewerWindow : public Ship::GuiWindow {
public: public:
using GuiWindow::GuiWindow; using GuiWindow::GuiWindow;

View File

@ -1,5 +1,6 @@
#include "valueViewer.h" #include "valueViewer.h"
#include "../../UIWidgets.hpp" #include "../../UIWidgets.hpp"
#include "soh/OTRGlobals.h"
extern "C" { extern "C" {
#include <z64.h> #include <z64.h>
@ -109,7 +110,7 @@ void ValueViewerWindow::DrawElement() {
return; return;
} }
UIWidgets::PaddedEnhancementCheckbox("Enable Printing", "gValueViewer.EnablePrinting"); UIWidgets::PaddedEnhancementCheckbox("Enable Printing", CVAR_DEVELOPER_TOOLS("ValueViewerEnablePrinting"));
ImGui::BeginGroup(); ImGui::BeginGroup();
static int selectedElement = -1; static int selectedElement = -1;
@ -189,7 +190,7 @@ void ValueViewerWindow::DrawElement() {
} }
ImGui::BeginGroup(); ImGui::BeginGroup();
if (CVarGetInteger("gValueViewer.EnablePrinting", 0)) { if (CVarGetInteger(CVAR_DEVELOPER_TOOLS("ValueViewerEnablePrinting"), 0)) {
ImGui::Checkbox(("Print##" + std::string(element.name)).c_str(), &element.isPrinted); ImGui::Checkbox(("Print##" + std::string(element.name)).c_str(), &element.isPrinted);
if (element.isPrinted) { if (element.isPrinted) {
char* prefix = (char*)element.prefix.c_str(); char* prefix = (char*)element.prefix.c_str();

View File

@ -33,7 +33,7 @@ typedef struct {
uint32_t y; uint32_t y;
} ValueTableElement; } ValueTableElement;
class ValueViewerWindow : public LUS::GuiWindow { class ValueViewerWindow : public Ship::GuiWindow {
public: public:
using GuiWindow::GuiWindow; using GuiWindow::GuiWindow;

View File

@ -5,6 +5,7 @@
#include "soh/Enhancements/randomizer/context.h" #include "soh/Enhancements/randomizer/context.h"
#include "soh/Enhancements/enhancementTypes.h" #include "soh/Enhancements/enhancementTypes.h"
#include "variables.h" #include "variables.h"
#include "soh/OTRGlobals.h"
extern "C" { extern "C" {
#include <z64.h> #include <z64.h>
@ -234,7 +235,7 @@ extern "C" uint8_t GetRandomizedEnemy(PlayState* play, int16_t *actorId, f32 *po
} }
EnemyEntry GetRandomizedEnemyEntry(uint32_t seed) { EnemyEntry GetRandomizedEnemyEntry(uint32_t seed) {
if (CVarGetInteger("gRandomizedEnemies", ENEMY_RANDOMIZER_OFF) == ENEMY_RANDOMIZER_RANDOM_SEEDED) { if (CVarGetInteger(CVAR_ENHANCEMENT("RandomizedEnemies"), ENEMY_RANDOMIZER_OFF) == ENEMY_RANDOMIZER_RANDOM_SEEDED) {
uint32_t finalSeed = seed + (IS_RANDO ? Rando::Context::GetInstance()->GetSettings()->GetSeed() : gSaveContext.sohStats.fileCreatedAt); uint32_t finalSeed = seed + (IS_RANDO ? Rando::Context::GetInstance()->GetSettings()->GetSeed() : gSaveContext.sohStats.fileCreatedAt);
Random_Init(finalSeed); Random_Init(finalSeed);
} }

View File

@ -353,19 +353,19 @@ void GameInteractor::RawAction::SetTimeOfDay(uint32_t time) {
} }
void GameInteractor::RawAction::SetCollisionViewer(bool active) { void GameInteractor::RawAction::SetCollisionViewer(bool active) {
CVarSetInteger("gColViewerEnabled", active); CVarSetInteger(CVAR_DEVELOPER_TOOLS("ColViewer.Enabled"), active);
CVarSetInteger("gColViewerDecal", active); CVarSetInteger(CVAR_DEVELOPER_TOOLS("ColViewer.Decal"), active);
if (active) { if (active) {
CVarSetInteger("gColViewerScene", COLVIEW_TRANSPARENT); CVarSetInteger(CVAR_DEVELOPER_TOOLS("ColViewer.Scene"), COLVIEW_TRANSPARENT);
CVarSetInteger("gColViewerBgActors", COLVIEW_TRANSPARENT); CVarSetInteger(CVAR_DEVELOPER_TOOLS("ColViewer.BGActors"), COLVIEW_TRANSPARENT);
CVarSetInteger("gColViewerColCheck", COLVIEW_TRANSPARENT); CVarSetInteger(CVAR_DEVELOPER_TOOLS("ColViewer.ColCheck"), COLVIEW_TRANSPARENT);
CVarSetInteger("gColViewerWaterbox", COLVIEW_TRANSPARENT); CVarSetInteger(CVAR_DEVELOPER_TOOLS("ColViewer.Waterbox"), COLVIEW_TRANSPARENT);
} else { } else {
CVarSetInteger("gColViewerScene", COLVIEW_DISABLED); CVarSetInteger(CVAR_DEVELOPER_TOOLS("ColViewer.Scene"), COLVIEW_DISABLED);
CVarSetInteger("gColViewerBgActors", COLVIEW_DISABLED); CVarSetInteger(CVAR_DEVELOPER_TOOLS("ColViewer.BGActors"), COLVIEW_DISABLED);
CVarSetInteger("gColViewerColCheck", COLVIEW_DISABLED); CVarSetInteger(CVAR_DEVELOPER_TOOLS("ColViewer.ColCheck"), COLVIEW_DISABLED);
CVarSetInteger("gColViewerWaterbox", COLVIEW_DISABLED); CVarSetInteger(CVAR_DEVELOPER_TOOLS("ColViewer.Waterbox"), COLVIEW_DISABLED);
} }
} }
@ -428,55 +428,55 @@ void GameInteractor::RawAction::SetCosmeticsColor(uint8_t cosmeticCategory, uint
switch (cosmeticCategory) { switch (cosmeticCategory) {
case GI_COSMETICS_TUNICS: case GI_COSMETICS_TUNICS:
CVarSetColor("gCosmetics.Link_KokiriTunic.Value", newColor); CVarSetColor(CVAR_COSMETIC("Link.KokiriTunic.Value"), newColor);
CVarSetInteger("gCosmetics.Link_KokiriTunic.Changed", 1); CVarSetInteger(CVAR_COSMETIC("Link.KokiriTunic.Changed"), 1);
CVarSetColor("gCosmetics.Link_GoronTunic.Value", newColor); CVarSetColor(CVAR_COSMETIC("Link.GoronTunic.Value"), newColor);
CVarSetInteger("gCosmetics.Link_GoronTunic.Changed", 1); CVarSetInteger(CVAR_COSMETIC("Link.GoronTunic.Changed"), 1);
CVarSetColor("gCosmetics.Link_ZoraTunic.Value", newColor); CVarSetColor(CVAR_COSMETIC("Link.ZoraTunic.Value"), newColor);
CVarSetInteger("gCosmetics.Link_ZoraTunic.Changed", 1); CVarSetInteger(CVAR_COSMETIC("Link.ZoraTunic.Changed"), 1);
break; break;
case GI_COSMETICS_NAVI: case GI_COSMETICS_NAVI:
CVarSetColor("gCosmetics.Navi_EnemyPrimary.Value", newColor); CVarSetColor(CVAR_COSMETIC("Navi.EnemyPrimary.Value"), newColor);
CVarSetInteger("gCosmetics.Navi_EnemyPrimary.Changed", 1); CVarSetInteger(CVAR_COSMETIC("Navi.EnemyPrimary.Changed"), 1);
CVarSetColor("gCosmetics.Navi_EnemySecondary.Value", newColor); CVarSetColor(CVAR_COSMETIC("Navi.EnemySecondary.Value"), newColor);
CVarSetInteger("gCosmetics.Navi_EnemySecondary.Changed", 1); CVarSetInteger(CVAR_COSMETIC("Navi.EnemySecondary.Changed"), 1);
CVarSetColor("gCosmetics.Navi_IdlePrimary.Value", newColor); CVarSetColor(CVAR_COSMETIC("Navi.IdlePrimary.Value"), newColor);
CVarSetInteger("gCosmetics.Navi_IdlePrimary.Changed", 1); CVarSetInteger(CVAR_COSMETIC("Navi.IdlePrimary.Changed"), 1);
CVarSetColor("gCosmetics.Navi_IdleSecondary.Value", newColor); CVarSetColor(CVAR_COSMETIC("Navi.IdleSecondary.Value"), newColor);
CVarSetInteger("gCosmetics.Navi_IdleSecondary.Changed", 1); CVarSetInteger(CVAR_COSMETIC("Navi.IdleSecondary.Changed"), 1);
CVarSetColor("gCosmetics.Navi_NPCPrimary.Value", newColor); CVarSetColor(CVAR_COSMETIC("Navi.NPCPrimary.Value"), newColor);
CVarSetInteger("gCosmetics.Navi_NPCPrimary.Changed", 1); CVarSetInteger(CVAR_COSMETIC("Navi.NPCPrimary.Changed"), 1);
CVarSetColor("gCosmetics.Navi_NPCSecondary.Value", newColor); CVarSetColor(CVAR_COSMETIC("Navi.NPCSecondary.Value"), newColor);
CVarSetInteger("gCosmetics.Navi_NPCSecondary.Changed", 1); CVarSetInteger(CVAR_COSMETIC("Navi.NPCSecondary.Changed"), 1);
CVarSetColor("gCosmetics.Navi_PropsPrimary.Value", newColor); CVarSetColor(CVAR_COSMETIC("Navi.PropsPrimary.Value"), newColor);
CVarSetInteger("gCosmetics.Navi_PropsPrimary.Changed", 1); CVarSetInteger(CVAR_COSMETIC("Navi.PropsPrimary.Changed"), 1);
CVarSetColor("gCosmetics.Navi_PropsSecondary.Value", newColor); CVarSetColor(CVAR_COSMETIC("Navi.PropsSecondary.Value"), newColor);
CVarSetInteger("gCosmetics.Navi_PropsSecondary.Changed", 1); CVarSetInteger(CVAR_COSMETIC("Navi.PropsSecondary.Changed"), 1);
break; break;
case GI_COSMETICS_HAIR: case GI_COSMETICS_HAIR:
CVarSetColor("gCosmetics.Link_Hair.Value", newColor); CVarSetColor(CVAR_COSMETIC("Link.Hair.Value"), newColor);
CVarSetInteger("gCosmetics.Link_Hair.Changed", 1); CVarSetInteger(CVAR_COSMETIC("Link.Hair.Changed"), 1);
break; break;
} }
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
ApplyOrResetCustomGfxPatches(); ApplyOrResetCustomGfxPatches();
} }
void GameInteractor::RawAction::RandomizeCosmeticsColors(bool excludeBiddingWarColors) { void GameInteractor::RawAction::RandomizeCosmeticsColors(bool excludeBiddingWarColors) {
const char* cvarsToLock[12] = { const char* cvarsToLock[12] = {
"gCosmetics.Link_KokiriTunic.Locked", CVAR_COSMETIC("Link.KokiriTunic.Locked"),
"gCosmetics.Link_GoronTunic.Locked", CVAR_COSMETIC("Link.GoronTunic.Locked"),
"gCosmetics.Link_ZoraTunic.Locked", CVAR_COSMETIC("Link.ZoraTunic.Locked"),
"gCosmetics.Navi_EnemyPrimary.Locked", CVAR_COSMETIC("Navi.EnemyPrimary.Locked"),
"gCosmetics.Navi_EnemySecondary.Locked", CVAR_COSMETIC("Navi.EnemySecondary.Locked"),
"gCosmetics.Navi_IdlePrimary.Locked", CVAR_COSMETIC("Navi.IdlePrimary.Locked"),
"gCosmetics.Navi_IdleSecondary.Locked", CVAR_COSMETIC("Navi.IdleSecondary.Locked"),
"gCosmetics.Navi_NPCPrimary.Locked", CVAR_COSMETIC("Navi.NPCPrimary.Locked"),
"gCosmetics.Navi_NPCSecondary.Locked", CVAR_COSMETIC("Navi.NPCSecondary.Locked"),
"gCosmetics.Navi_PropsPrimary.Locked", CVAR_COSMETIC("Navi.PropsPrimary.Locked"),
"gCosmetics.Navi_PropsSecondary.Locked", CVAR_COSMETIC("Navi.PropsSecondary.Locked"),
"gCosmetics.Link_Hair.Locked" CVAR_COSMETIC("Link.Hair.Locked")
}; };
if (excludeBiddingWarColors) { if (excludeBiddingWarColors) {

View File

@ -2,12 +2,13 @@
#include "GameInteractor.h" #include "GameInteractor.h"
#include <spdlog/spdlog.h> #include <spdlog/spdlog.h>
#include <ImGui/imgui.h> #include <imgui.h>
#include <ImGui/imgui_internal.h> #include <imgui_internal.h>
#include <unordered_map> #include <unordered_map>
#include <tuple> #include <tuple>
#include <type_traits> #include <type_traits>
#include <libultraship/libultraship.h> #include <libultraship/libultraship.h>
#include "soh/OTRGlobals.h"
// MARK: - Remote // MARK: - Remote
@ -16,7 +17,7 @@ void GameInteractor::EnableRemoteInteractor() {
return; return;
} }
if (SDLNet_ResolveHost(&remoteIP, CVarGetString("gRemote.IP", "127.0.0.1"), CVarGetInteger("gRemote.Port", 43384)) == -1) { if (SDLNet_ResolveHost(&remoteIP, CVarGetString(CVAR_REMOTE("IP"), "127.0.0.1"), CVarGetInteger(CVAR_REMOTE("Port"), 43384)) == -1) {
SPDLOG_ERROR("[GameInteractor] SDLNet_ResolveHost: {}", SDLNet_GetError()); SPDLOG_ERROR("[GameInteractor] SDLNet_ResolveHost: {}", SDLNet_GetError());
} }

View File

@ -66,7 +66,7 @@ void GameInteractorSail::HandleRemoteJson(nlohmann::json payload) {
} }
std::string command = payload["command"].get<std::string>(); std::string command = payload["command"].get<std::string>();
std::reinterpret_pointer_cast<LUS::ConsoleWindow>(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetGuiWindow("Console"))->Dispatch(command); std::reinterpret_pointer_cast<Ship::ConsoleWindow>(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetGuiWindow("Console"))->Dispatch(command);
responsePayload["status"] = "success"; responsePayload["status"] = "success";
GameInteractor::Instance->TransmitJsonToRemote(responsePayload); GameInteractor::Instance->TransmitJsonToRemote(responsePayload);
return; return;
@ -88,7 +88,7 @@ void GameInteractorSail::HandleRemoteJson(nlohmann::json payload) {
} }
std::string command = payload["effect"]["command"].get<std::string>(); std::string command = payload["effect"]["command"].get<std::string>();
std::reinterpret_pointer_cast<LUS::ConsoleWindow>(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetGuiWindow("Console"))->Dispatch(command); std::reinterpret_pointer_cast<Ship::ConsoleWindow>(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetGuiWindow("Console"))->Dispatch(command);
responsePayload["status"] = "success"; responsePayload["status"] = "success";
GameInteractor::Instance->TransmitJsonToRemote(responsePayload); GameInteractor::Instance->TransmitJsonToRemote(responsePayload);
return; return;

View File

@ -14,6 +14,7 @@ extern "C" {
#include <libultraship/bridge.h> #include <libultraship/bridge.h>
#include <libultraship/libultraship.h> #include <libultraship/libultraship.h>
#include "soh/Enhancements/enhancementTypes.h" #include "soh/Enhancements/enhancementTypes.h"
#include "soh/OTRGlobals.h"
extern "C" { extern "C" {
#include <z64.h> #include <z64.h>
@ -387,7 +388,7 @@ void GameplayStatsRow(const char* label, const std::string& value, ImVec4 color
} }
bool compareTimestampInfoByTime(const TimestampInfo& a, const TimestampInfo& b) { bool compareTimestampInfoByTime(const TimestampInfo& a, const TimestampInfo& b) {
return CVarGetInteger("gGameplayStats.TimestampsReverse", 0) ? a.time > b.time : a.time < b.time; return CVarGetInteger(CVAR_ENHANCEMENT("GameplayStats.ReverseTimestamps"), 0) ? a.time > b.time : a.time < b.time;
} }
const char* ResolveSceneID(int sceneID, int roomID){ const char* ResolveSceneID(int sceneID, int roomID){
@ -442,13 +443,13 @@ void DrawGameplayStatsHeader() {
} else { } else {
GameplayStatsRow("Total Game Time:", formatTimestampGameplayStat(GAMEPLAYSTAT_TOTAL_TIME), gSaveContext.sohStats.gameComplete ? COLOR_GREEN : COLOR_WHITE); GameplayStatsRow("Total Game Time:", formatTimestampGameplayStat(GAMEPLAYSTAT_TOTAL_TIME), gSaveContext.sohStats.gameComplete ? COLOR_GREEN : COLOR_WHITE);
} }
if (CVarGetInteger("gGameplayStats.ShowAdditionalTimers", 0)) { // !Only display total game time if (CVarGetInteger(CVAR_ENHANCEMENT("GameplayStats.ShowAdditionalTimers"), 0)) { // !Only display total game time
GameplayStatsRow("Gameplay Time:", formatTimestampGameplayStat(gSaveContext.sohStats.playTimer / 2), COLOR_GREY); GameplayStatsRow("Gameplay Time:", formatTimestampGameplayStat(gSaveContext.sohStats.playTimer / 2), COLOR_GREY);
GameplayStatsRow("Pause Menu Time:", formatTimestampGameplayStat(gSaveContext.sohStats.pauseTimer / 3), COLOR_GREY); GameplayStatsRow("Pause Menu Time:", formatTimestampGameplayStat(gSaveContext.sohStats.pauseTimer / 3), COLOR_GREY);
GameplayStatsRow("Time in scene:", formatTimestampGameplayStat(gSaveContext.sohStats.sceneTimer / 2), COLOR_LIGHT_BLUE); GameplayStatsRow("Time in scene:", formatTimestampGameplayStat(gSaveContext.sohStats.sceneTimer / 2), COLOR_LIGHT_BLUE);
GameplayStatsRow("Time in room:", formatTimestampGameplayStat(gSaveContext.sohStats.roomTimer / 2), COLOR_LIGHT_BLUE); GameplayStatsRow("Time in room:", formatTimestampGameplayStat(gSaveContext.sohStats.roomTimer / 2), COLOR_LIGHT_BLUE);
} }
if (gPlayState != NULL && CVarGetInteger("gGameplayStats.ShowDebugInfo", 0)) { // && display debug info if (gPlayState != NULL && CVarGetInteger(CVAR_ENHANCEMENT("GameplayStats.ShowDebugInfo"), 0)) { // && display debug info
GameplayStatsRow("play->sceneNum:", formatHexGameplayStat(gPlayState->sceneNum), COLOR_YELLOW); GameplayStatsRow("play->sceneNum:", formatHexGameplayStat(gPlayState->sceneNum), COLOR_YELLOW);
GameplayStatsRow("gSaveContext.entranceIndex:", formatHexGameplayStat(gSaveContext.entranceIndex), COLOR_YELLOW); GameplayStatsRow("gSaveContext.entranceIndex:", formatHexGameplayStat(gSaveContext.entranceIndex), COLOR_YELLOW);
GameplayStatsRow("gSaveContext.cutsceneIndex:", formatHexOnlyGameplayStat(gSaveContext.cutsceneIndex), COLOR_YELLOW); GameplayStatsRow("gSaveContext.cutsceneIndex:", formatHexOnlyGameplayStat(gSaveContext.cutsceneIndex), COLOR_YELLOW);
@ -538,7 +539,7 @@ void DrawGameplayStatsCountsTab() {
GameplayStatsRow("Sword Swings:", formatIntGameplayStat(gSaveContext.sohStats.count[COUNT_SWORD_SWINGS])); GameplayStatsRow("Sword Swings:", formatIntGameplayStat(gSaveContext.sohStats.count[COUNT_SWORD_SWINGS]));
GameplayStatsRow("Steps Taken:", formatIntGameplayStat(gSaveContext.sohStats.count[COUNT_STEPS])); GameplayStatsRow("Steps Taken:", formatIntGameplayStat(gSaveContext.sohStats.count[COUNT_STEPS]));
// If using MM Bunny Hood enhancement, show how long it's been equipped (not counting pause time) // If using MM Bunny Hood enhancement, show how long it's been equipped (not counting pause time)
if (CVarGetInteger("gMMBunnyHood", BUNNY_HOOD_VANILLA) != BUNNY_HOOD_VANILLA || gSaveContext.sohStats.count[COUNT_TIME_BUNNY_HOOD] > 0) { if (CVarGetInteger(CVAR_ENHANCEMENT("MMBunnyHood"), BUNNY_HOOD_VANILLA) != BUNNY_HOOD_VANILLA || gSaveContext.sohStats.count[COUNT_TIME_BUNNY_HOOD] > 0) {
GameplayStatsRow("Bunny Hood Time:", formatTimestampGameplayStat(gSaveContext.sohStats.count[COUNT_TIME_BUNNY_HOOD] / 2)); GameplayStatsRow("Bunny Hood Time:", formatTimestampGameplayStat(gSaveContext.sohStats.count[COUNT_TIME_BUNNY_HOOD] / 2));
} }
GameplayStatsRow("Rolls:", formatIntGameplayStat(gSaveContext.sohStats.count[COUNT_ROLLS])); GameplayStatsRow("Rolls:", formatIntGameplayStat(gSaveContext.sohStats.count[COUNT_ROLLS]));
@ -566,13 +567,13 @@ void DrawGameplayStatsBreakdownTab() {
for (int i = 0; i < gSaveContext.sohStats.tsIdx; i++) { for (int i = 0; i < gSaveContext.sohStats.tsIdx; i++) {
std::string sceneName = ResolveSceneID(gSaveContext.sohStats.sceneTimestamps[i].scene, gSaveContext.sohStats.sceneTimestamps[i].room); std::string sceneName = ResolveSceneID(gSaveContext.sohStats.sceneTimestamps[i].scene, gSaveContext.sohStats.sceneTimestamps[i].room);
std::string name; std::string name;
if (CVarGetInteger("gGameplayStats.RoomBreakdown", 0) && gSaveContext.sohStats.sceneTimestamps[i].scene != SCENE_GROTTOS) { if (CVarGetInteger(CVAR_ENHANCEMENT("GameplayStats.RoomBreakdown"), 0) && gSaveContext.sohStats.sceneTimestamps[i].scene != SCENE_GROTTOS) {
name = fmt::format("{:s} Room {:d}", sceneName, gSaveContext.sohStats.sceneTimestamps[i].room); name = fmt::format("{:s} Room {:d}", sceneName, gSaveContext.sohStats.sceneTimestamps[i].room);
} else { } else {
name = sceneName; name = sceneName;
} }
strcpy(sceneTimestampDisplay[i].name, name.c_str()); strcpy(sceneTimestampDisplay[i].name, name.c_str());
sceneTimestampDisplay[i].time = CVarGetInteger("gGameplayStats.RoomBreakdown", 0) ? sceneTimestampDisplay[i].time = CVarGetInteger(CVAR_ENHANCEMENT("GameplayStats.RoomBreakdown"), 0) ?
gSaveContext.sohStats.sceneTimestamps[i].roomTime : gSaveContext.sohStats.sceneTimestamps[i].sceneTime; gSaveContext.sohStats.sceneTimestamps[i].roomTime : gSaveContext.sohStats.sceneTimestamps[i].sceneTime;
sceneTimestampDisplay[i].color = COLOR_GREY; sceneTimestampDisplay[i].color = COLOR_GREY;
sceneTimestampDisplay[i].isRoom = gSaveContext.sohStats.sceneTimestamps[i].isRoom; sceneTimestampDisplay[i].isRoom = gSaveContext.sohStats.sceneTimestamps[i].isRoom;
@ -583,13 +584,13 @@ void DrawGameplayStatsBreakdownTab() {
ImGui::TableSetupColumn("stat", ImGuiTableColumnFlags_WidthStretch); ImGui::TableSetupColumn("stat", ImGuiTableColumnFlags_WidthStretch);
for (int i = 0; i < gSaveContext.sohStats.tsIdx; i++) { for (int i = 0; i < gSaveContext.sohStats.tsIdx; i++) {
TimestampInfo tsInfo = sceneTimestampDisplay[i]; TimestampInfo tsInfo = sceneTimestampDisplay[i];
bool canShow = !tsInfo.isRoom || CVarGetInteger("gGameplayStats.RoomBreakdown", 0); bool canShow = !tsInfo.isRoom || CVarGetInteger(CVAR_ENHANCEMENT("GameplayStats.RoomBreakdown"), 0);
if (tsInfo.time > 0 && strnlen(tsInfo.name, 40) > 1 && canShow) { if (tsInfo.time > 0 && strnlen(tsInfo.name, 40) > 1 && canShow) {
GameplayStatsRow(tsInfo.name, formatTimestampGameplayStat(tsInfo.time), tsInfo.color); GameplayStatsRow(tsInfo.name, formatTimestampGameplayStat(tsInfo.time), tsInfo.color);
} }
} }
std::string toPass; std::string toPass;
if (CVarGetInteger("gGameplayStats.RoomBreakdown", 0) && gSaveContext.sohStats.sceneNum != SCENE_GROTTOS) { if (CVarGetInteger(CVAR_ENHANCEMENT("GameplayStats.RoomBreakdown"), 0) && gSaveContext.sohStats.sceneNum != SCENE_GROTTOS) {
toPass = fmt::format("{:s} Room {:d}", ResolveSceneID(gSaveContext.sohStats.sceneNum, gSaveContext.sohStats.roomNum), gSaveContext.sohStats.roomNum); toPass = fmt::format("{:s} Room {:d}", ResolveSceneID(gSaveContext.sohStats.sceneNum, gSaveContext.sohStats.roomNum), gSaveContext.sohStats.roomNum);
} else { } else {
toPass = ResolveSceneID(gSaveContext.sohStats.sceneNum, gSaveContext.sohStats.roomNum); toPass = ResolveSceneID(gSaveContext.sohStats.sceneNum, gSaveContext.sohStats.roomNum);
@ -600,21 +601,21 @@ void DrawGameplayStatsBreakdownTab() {
} }
void DrawGameplayStatsOptionsTab() { void DrawGameplayStatsOptionsTab() {
UIWidgets::PaddedEnhancementCheckbox("Show in-game total timer", "gGameplayStats.ShowIngameTimer", true, false); UIWidgets::PaddedEnhancementCheckbox("Show in-game total timer", CVAR_ENHANCEMENT("GameplayStats.ShowIngameTimer"), true, false);
UIWidgets::InsertHelpHoverText("Keep track of the timer as an in-game HUD element. The position of the timer can be changed in the Cosmetics Editor."); UIWidgets::InsertHelpHoverText("Keep track of the timer as an in-game HUD element. The position of the timer can be changed in the Cosmetics Editor.");
UIWidgets::PaddedEnhancementCheckbox("Show latest timestamps on top", "gGameplayStats.TimestampsReverse", true, false); UIWidgets::PaddedEnhancementCheckbox("Show latest timestamps on top", CVAR_ENHANCEMENT("GameplayStats.ReverseTimestamps"), true, false);
UIWidgets::PaddedEnhancementCheckbox("Room Breakdown", "gGameplayStats.RoomBreakdown", true, false); UIWidgets::PaddedEnhancementCheckbox("Room Breakdown", CVAR_ENHANCEMENT("GameplayStats.RoomBreakdown"), true, false);
ImGui::SameLine(); ImGui::SameLine();
UIWidgets::InsertHelpHoverText("Allows a more in-depth perspective of time spent in a certain map."); UIWidgets::InsertHelpHoverText("Allows a more in-depth perspective of time spent in a certain map.");
UIWidgets::PaddedEnhancementCheckbox("RTA Timing on new files", "gGameplayStats.RTATiming", true, false); UIWidgets::PaddedEnhancementCheckbox("RTA Timing on new files", CVAR_ENHANCEMENT("GameplayStats.RTATiming"), true, false);
ImGui::SameLine(); ImGui::SameLine();
UIWidgets::InsertHelpHoverText( UIWidgets::InsertHelpHoverText(
"Timestamps are relative to starting timestamp rather than in game time, usually necessary for races/speedruns.\n\n" "Timestamps are relative to starting timestamp rather than in game time, usually necessary for races/speedruns.\n\n"
"Starting timestamp is on first non-c-up input after intro cutscene.\n\n" "Starting timestamp is on first non-c-up input after intro cutscene.\n\n"
"NOTE: THIS NEEDS TO BE SET BEFORE CREATING A FILE TO TAKE EFFECT" "NOTE: THIS NEEDS TO BE SET BEFORE CREATING A FILE TO TAKE EFFECT"
); );
UIWidgets::PaddedEnhancementCheckbox("Show additional detail timers", "gGameplayStats.ShowAdditionalTimers", true, false); UIWidgets::PaddedEnhancementCheckbox("Show additional detail timers", CVAR_ENHANCEMENT("GameplayStats.ShowAdditionalTimers"), true, false);
UIWidgets::PaddedEnhancementCheckbox("Show Debug Info", "gGameplayStats.ShowDebugInfo"); UIWidgets::PaddedEnhancementCheckbox("Show Debug Info", CVAR_ENHANCEMENT("GameplayStats.ShowDebugInfo"));
} }
void GameplayStatsWindow::DrawElement() { void GameplayStatsWindow::DrawElement() {
@ -656,7 +657,7 @@ void InitStats(bool isDebug) {
for (int dungeon = 0; dungeon < ARRAY_COUNT(gSaveContext.sohStats.dungeonKeys); dungeon++) { for (int dungeon = 0; dungeon < ARRAY_COUNT(gSaveContext.sohStats.dungeonKeys); dungeon++) {
gSaveContext.sohStats.dungeonKeys[dungeon] = isDebug ? 8 : 0; gSaveContext.sohStats.dungeonKeys[dungeon] = isDebug ? 8 : 0;
} }
gSaveContext.sohStats.rtaTiming = CVarGetInteger("gGameplayStats.RTATiming", 0); gSaveContext.sohStats.rtaTiming = CVarGetInteger(CVAR_ENHANCEMENT("GameplayStats.RTATiming"), 0);
gSaveContext.sohStats.fileCreatedAt = 0; gSaveContext.sohStats.fileCreatedAt = 0;
gSaveContext.sohStats.playTimer = 0; gSaveContext.sohStats.playTimer = 0;
gSaveContext.sohStats.pauseTimer = 0; gSaveContext.sohStats.pauseTimer = 0;

View File

@ -12,7 +12,7 @@
(!gSaveContext.sohStats.fileCreatedAt ? 0 : ((GetUnixTimestamp() - gSaveContext.sohStats.fileCreatedAt) / 100)) :\ (!gSaveContext.sohStats.fileCreatedAt ? 0 : ((GetUnixTimestamp() - gSaveContext.sohStats.fileCreatedAt) / 100)) :\
(gSaveContext.sohStats.itemTimestamp[TIMESTAMP_DEFEAT_GANON])) :\ (gSaveContext.sohStats.itemTimestamp[TIMESTAMP_DEFEAT_GANON])) :\
(gSaveContext.sohStats.playTimer / 2 + gSaveContext.sohStats.pauseTimer / 3)) (gSaveContext.sohStats.playTimer / 2 + gSaveContext.sohStats.pauseTimer / 3))
#define CURRENT_MODE_TIMER (CVarGetInteger("gGameplayStats.RoomBreakdown", 0) ?\ #define CURRENT_MODE_TIMER (CVarGetInteger(CVAR_ENHANCEMENT("GameplayStats.RoomBreakdown"), 0) ?\
gSaveContext.sohStats.roomTimer :\ gSaveContext.sohStats.roomTimer :\
gSaveContext.sohStats.sceneTimer) gSaveContext.sohStats.sceneTimer)

View File

@ -1,7 +1,7 @@
#include <libultraship/libultraship.h> #include <libultraship/libultraship.h>
#include "gameplaystats.h" #include "gameplaystats.h"
class GameplayStatsWindow : public LUS::GuiWindow { class GameplayStatsWindow : public Ship::GuiWindow {
public: public:
using GuiWindow::GuiWindow; using GuiWindow::GuiWindow;

View File

@ -72,7 +72,7 @@ void ReloadSceneTogglingLinkAge() {
void RegisterInfiniteMoney() { void RegisterInfiniteMoney() {
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnGameFrameUpdate>([]() { GameInteractor::Instance->RegisterGameHook<GameInteractor::OnGameFrameUpdate>([]() {
if (!GameInteractor::IsSaveLoaded(true)) return; if (!GameInteractor::IsSaveLoaded(true)) return;
if (CVarGetInteger("gInfiniteMoney", 0) != 0 && (!IS_RANDO || Flags_GetRandomizerInf(RAND_INF_HAS_WALLET))) { if (CVarGetInteger(CVAR_CHEAT("InfiniteMoney"), 0) != 0 && (!IS_RANDO || Flags_GetRandomizerInf(RAND_INF_HAS_WALLET))) {
if (gSaveContext.rupees < CUR_CAPACITY(UPG_WALLET)) { if (gSaveContext.rupees < CUR_CAPACITY(UPG_WALLET)) {
gSaveContext.rupees = CUR_CAPACITY(UPG_WALLET); gSaveContext.rupees = CUR_CAPACITY(UPG_WALLET);
} }
@ -83,7 +83,7 @@ void RegisterInfiniteMoney() {
void RegisterInfiniteHealth() { void RegisterInfiniteHealth() {
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnGameFrameUpdate>([]() { GameInteractor::Instance->RegisterGameHook<GameInteractor::OnGameFrameUpdate>([]() {
if (!GameInteractor::IsSaveLoaded(true)) return; if (!GameInteractor::IsSaveLoaded(true)) return;
if (CVarGetInteger("gInfiniteHealth", 0) != 0) { if (CVarGetInteger(CVAR_CHEAT("InfiniteHealth"), 0) != 0) {
if (gSaveContext.health < gSaveContext.healthCapacity) { if (gSaveContext.health < gSaveContext.healthCapacity) {
gSaveContext.health = gSaveContext.healthCapacity; gSaveContext.health = gSaveContext.healthCapacity;
} }
@ -94,7 +94,7 @@ void RegisterInfiniteHealth() {
void RegisterInfiniteAmmo() { void RegisterInfiniteAmmo() {
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnGameFrameUpdate>([]() { GameInteractor::Instance->RegisterGameHook<GameInteractor::OnGameFrameUpdate>([]() {
if (!GameInteractor::IsSaveLoaded(true)) return; if (!GameInteractor::IsSaveLoaded(true)) return;
if (CVarGetInteger("gInfiniteAmmo", 0) != 0) { if (CVarGetInteger(CVAR_CHEAT("InfiniteAmmo"), 0) != 0) {
// Deku Sticks // Deku Sticks
if (AMMO(ITEM_STICK) < CUR_CAPACITY(UPG_STICKS)) { if (AMMO(ITEM_STICK) < CUR_CAPACITY(UPG_STICKS)) {
AMMO(ITEM_STICK) = CUR_CAPACITY(UPG_STICKS); AMMO(ITEM_STICK) = CUR_CAPACITY(UPG_STICKS);
@ -131,7 +131,7 @@ void RegisterInfiniteAmmo() {
void RegisterInfiniteMagic() { void RegisterInfiniteMagic() {
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnGameFrameUpdate>([]() { GameInteractor::Instance->RegisterGameHook<GameInteractor::OnGameFrameUpdate>([]() {
if (!GameInteractor::IsSaveLoaded(true)) return; if (!GameInteractor::IsSaveLoaded(true)) return;
if (CVarGetInteger("gInfiniteMagic", 0) != 0) { if (CVarGetInteger(CVAR_CHEAT("InfiniteMagic"), 0) != 0) {
if (gSaveContext.isMagicAcquired && gSaveContext.magic != (gSaveContext.isDoubleMagicAcquired + 1) * 0x30) { if (gSaveContext.isMagicAcquired && gSaveContext.magic != (gSaveContext.isDoubleMagicAcquired + 1) * 0x30) {
gSaveContext.magic = (gSaveContext.isDoubleMagicAcquired + 1) * 0x30; gSaveContext.magic = (gSaveContext.isDoubleMagicAcquired + 1) * 0x30;
} }
@ -142,7 +142,7 @@ void RegisterInfiniteMagic() {
void RegisterInfiniteNayrusLove() { void RegisterInfiniteNayrusLove() {
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnGameFrameUpdate>([]() { GameInteractor::Instance->RegisterGameHook<GameInteractor::OnGameFrameUpdate>([]() {
if (!GameInteractor::IsSaveLoaded(true)) return; if (!GameInteractor::IsSaveLoaded(true)) return;
if (CVarGetInteger("gInfiniteNayru", 0) != 0) { if (CVarGetInteger(CVAR_CHEAT("InfiniteNayru"), 0) != 0) {
gSaveContext.nayrusLoveTimer = 0x44B; gSaveContext.nayrusLoveTimer = 0x44B;
} }
}); });
@ -152,7 +152,7 @@ void RegisterMoonJumpOnL() {
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnGameFrameUpdate>([]() { GameInteractor::Instance->RegisterGameHook<GameInteractor::OnGameFrameUpdate>([]() {
if (!GameInteractor::IsSaveLoaded(true)) return; if (!GameInteractor::IsSaveLoaded(true)) return;
if (CVarGetInteger("gMoonJumpOnL", 0) != 0) { if (CVarGetInteger(CVAR_CHEAT("MoonJumpOnL"), 0) != 0) {
Player* player = GET_PLAYER(gPlayState); Player* player = GET_PLAYER(gPlayState);
if (CHECK_BTN_ANY(gPlayState->state.input[0].cur.button, BTN_L)) { if (CHECK_BTN_ANY(gPlayState->state.input[0].cur.button, BTN_L)) {
@ -167,7 +167,7 @@ void RegisterInfiniteISG() {
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnGameFrameUpdate>([]() { GameInteractor::Instance->RegisterGameHook<GameInteractor::OnGameFrameUpdate>([]() {
if (!GameInteractor::IsSaveLoaded(true)) return; if (!GameInteractor::IsSaveLoaded(true)) return;
if (CVarGetInteger("gEzISG", 0) != 0) { if (CVarGetInteger(CVAR_CHEAT("EasyISG"), 0) != 0) {
Player* player = GET_PLAYER(gPlayState); Player* player = GET_PLAYER(gPlayState);
player->meleeWeaponState = 1; player->meleeWeaponState = 1;
} }
@ -179,7 +179,7 @@ void RegisterEzQPA() {
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnGameFrameUpdate>([]() { GameInteractor::Instance->RegisterGameHook<GameInteractor::OnGameFrameUpdate>([]() {
if (!GameInteractor::IsSaveLoaded(true)) return; if (!GameInteractor::IsSaveLoaded(true)) return;
if (CVarGetInteger("gEzQPA", 0) != 0) { if (CVarGetInteger(CVAR_CHEAT("EasyQPA"), 0) != 0) {
Player* player = GET_PLAYER(gPlayState); Player* player = GET_PLAYER(gPlayState);
player->meleeWeaponQuads[0].info.toucher.dmgFlags = 0x16171617; player->meleeWeaponQuads[0].info.toucher.dmgFlags = 0x16171617;
player->meleeWeaponQuads[1].info.toucher.dmgFlags = 0x16171617; player->meleeWeaponQuads[1].info.toucher.dmgFlags = 0x16171617;
@ -191,7 +191,7 @@ void RegisterUnrestrictedItems() {
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnGameFrameUpdate>([]() { GameInteractor::Instance->RegisterGameHook<GameInteractor::OnGameFrameUpdate>([]() {
if (!GameInteractor::IsSaveLoaded(true)) return; if (!GameInteractor::IsSaveLoaded(true)) return;
if (CVarGetInteger("gNoRestrictItems", 0) != 0) { if (CVarGetInteger(CVAR_CHEAT("NoRestrictItems"), 0) != 0) {
u8 sunsBackup = gPlayState->interfaceCtx.restrictions.sunsSong; u8 sunsBackup = gPlayState->interfaceCtx.restrictions.sunsSong;
memset(&gPlayState->interfaceCtx.restrictions, 0, sizeof(gPlayState->interfaceCtx.restrictions)); memset(&gPlayState->interfaceCtx.restrictions, 0, sizeof(gPlayState->interfaceCtx.restrictions));
gPlayState->interfaceCtx.restrictions.sunsSong = sunsBackup; gPlayState->interfaceCtx.restrictions.sunsSong = sunsBackup;
@ -201,15 +201,15 @@ void RegisterUnrestrictedItems() {
void RegisterFreezeTime() { void RegisterFreezeTime() {
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnGameFrameUpdate>([]() { GameInteractor::Instance->RegisterGameHook<GameInteractor::OnGameFrameUpdate>([]() {
if (CVarGetInteger("gFreezeTime", 0) != 0) { if (CVarGetInteger(CVAR_CHEAT("FreezeTime"), 0) != 0) {
if (CVarGetInteger("gPrevTime", -1) == -1) { if (CVarGetInteger(CVAR_GENERAL("PrevTime"), -1) == -1) {
CVarSetInteger("gPrevTime", gSaveContext.dayTime); CVarSetInteger(CVAR_GENERAL("PrevTime"), gSaveContext.dayTime);
} }
int32_t prevTime = CVarGetInteger("gPrevTime", gSaveContext.dayTime); int32_t prevTime = CVarGetInteger(CVAR_GENERAL("PrevTime"), gSaveContext.dayTime);
gSaveContext.dayTime = prevTime; gSaveContext.dayTime = prevTime;
} else { } else {
CVarClear("gPrevTime"); CVarClear(CVAR_GENERAL("PrevTime"));
} }
}); });
} }
@ -220,7 +220,7 @@ void RegisterSwitchAge() {
static bool warped = false; static bool warped = false;
if (!GameInteractor::IsSaveLoaded(true)) { if (!GameInteractor::IsSaveLoaded(true)) {
CVarClear("gSwitchAge"); CVarClear(CVAR_GENERAL("SwitchAge"));
warped = false; warped = false;
return; return;
} }
@ -230,7 +230,7 @@ void RegisterSwitchAge() {
static RoomContext* roomCtx; static RoomContext* roomCtx;
static s32 roomNum; static s32 roomNum;
if (CVarGetInteger("gSwitchAge", 0) && !warped) { if (CVarGetInteger(CVAR_GENERAL("SwitchAge"), 0) && !warped) {
playerPos = GET_PLAYER(gPlayState)->actor.world.pos; playerPos = GET_PLAYER(gPlayState)->actor.world.pos;
playerYaw = GET_PLAYER(gPlayState)->actor.shape.rot.y; playerYaw = GET_PLAYER(gPlayState)->actor.shape.rot.y;
roomCtx = &gPlayState->roomCtx; roomCtx = &gPlayState->roomCtx;
@ -249,7 +249,7 @@ void RegisterSwitchAge() {
func_80097534(gPlayState, roomCtx); // load map for new room (unloading the previous room) func_80097534(gPlayState, roomCtx); // load map for new room (unloading the previous room)
} }
warped = false; warped = false;
CVarClear("gSwitchAge"); CVarClear(CVAR_GENERAL("SwitchAge"));
} }
}); });
} }
@ -259,7 +259,7 @@ void RegisterOcarinaTimeTravel() {
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnOcarinaSongAction>([]() { GameInteractor::Instance->RegisterGameHook<GameInteractor::OnOcarinaSongAction>([]() {
if (!GameInteractor::IsSaveLoaded(true)) { if (!GameInteractor::IsSaveLoaded(true)) {
CVarClear("gTimeTravel"); CVarClear(CVAR_ENHANCEMENT("TimeTravel"));
return; return;
} }
@ -273,16 +273,16 @@ void RegisterOcarinaTimeTravel() {
uint8_t hasOcarinaOfTime = (INV_CONTENT(ITEM_OCARINA_TIME) == ITEM_OCARINA_TIME); uint8_t hasOcarinaOfTime = (INV_CONTENT(ITEM_OCARINA_TIME) == ITEM_OCARINA_TIME);
// If TimeTravel + Player have the Ocarina of Time + Have Master Sword + is in proper range // If TimeTravel + Player have the Ocarina of Time + Have Master Sword + is in proper range
// TODO: Once Swordless Adult is fixed: Remove the Master Sword check // TODO: Once Swordless Adult is fixed: Remove the Master Sword check
if (((CVarGetInteger("gTimeTravel", 0) == 1 && hasOcarinaOfTime) || CVarGetInteger("gTimeTravel", 0) == 2) && hasMasterSword && if (((CVarGetInteger(CVAR_ENHANCEMENT("TimeTravel"), 0) == 1 && hasOcarinaOfTime) || CVarGetInteger(CVAR_ENHANCEMENT("TimeTravel"), 0) == 2) && hasMasterSword &&
gPlayState->msgCtx.lastPlayedSong == OCARINA_SONG_TIME && !nearbyTimeBlockEmpty && !nearbyTimeBlock && gPlayState->msgCtx.lastPlayedSong == OCARINA_SONG_TIME && !nearbyTimeBlockEmpty && !nearbyTimeBlock &&
!nearbyOcarinaSpot && !nearbyFrogs) { !nearbyOcarinaSpot && !nearbyFrogs) {
if (IS_RANDO) { if (IS_RANDO) {
CVarSetInteger("gSwitchTimeline", 1); CVarSetInteger(CVAR_GENERAL("SwitchTimeline"), 1);
} else if (!IS_RANDO && !nearbyDoorOfTime) { } else if (!IS_RANDO && !nearbyDoorOfTime) {
// This check is made for when Link is learning the Song Of Time in a vanilla save file that load a // This check is made for when Link is learning the Song Of Time in a vanilla save file that load a
// Temple of Time scene where the only object present is the Door of Time // Temple of Time scene where the only object present is the Door of Time
CVarSetInteger("gSwitchTimeline", 1); CVarSetInteger(CVAR_GENERAL("SwitchTimeline"), 1);
} }
ReloadSceneTogglingLinkAge(); ReloadSceneTogglingLinkAge();
} }
@ -295,13 +295,13 @@ void AutoSave(GetItemEntry itemEntry) {
// Don't autosave immediately after buying items from shops to prevent getting them for free! // Don't autosave immediately after buying items from shops to prevent getting them for free!
// Don't autosave in the Chamber of Sages since resuming from that map breaks the game // Don't autosave in the Chamber of Sages since resuming from that map breaks the game
// Don't autosave during the Ganon fight when picking up the Master Sword // Don't autosave during the Ganon fight when picking up the Master Sword
if ((CVarGetInteger("gAutosave", AUTOSAVE_OFF) != AUTOSAVE_OFF) && (gPlayState != NULL) && (gSaveContext.pendingSale == ITEM_NONE) && if ((CVarGetInteger(CVAR_ENHANCEMENT("Autosave"), AUTOSAVE_OFF) != AUTOSAVE_OFF) && (gPlayState != NULL) && (gSaveContext.pendingSale == ITEM_NONE) &&
(gPlayState->gameplayFrames > 60 && gSaveContext.cutsceneIndex < 0xFFF0) && (gPlayState->sceneNum != SCENE_GANON_BOSS) && (gPlayState->sceneNum != SCENE_CHAMBER_OF_THE_SAGES)) { (gPlayState->gameplayFrames > 60 && gSaveContext.cutsceneIndex < 0xFFF0) && (gPlayState->sceneNum != SCENE_GANON_BOSS) && (gPlayState->sceneNum != SCENE_CHAMBER_OF_THE_SAGES)) {
if (((CVarGetInteger("gAutosave", AUTOSAVE_OFF) == AUTOSAVE_LOCATION_AND_ALL_ITEMS) || (CVarGetInteger("gAutosave", AUTOSAVE_OFF) == AUTOSAVE_ALL_ITEMS)) && (item != ITEM_NONE)) { if (((CVarGetInteger(CVAR_ENHANCEMENT("Autosave"), AUTOSAVE_OFF) == AUTOSAVE_LOCATION_AND_ALL_ITEMS) || (CVarGetInteger(CVAR_ENHANCEMENT("Autosave"), AUTOSAVE_OFF) == AUTOSAVE_ALL_ITEMS)) && (item != ITEM_NONE)) {
// Autosave for all items // Autosave for all items
performSave = true; performSave = true;
} else if (((CVarGetInteger("gAutosave", AUTOSAVE_OFF) == AUTOSAVE_LOCATION_AND_MAJOR_ITEMS) || (CVarGetInteger("gAutosave", AUTOSAVE_OFF) == AUTOSAVE_MAJOR_ITEMS)) && (item != ITEM_NONE)) { } else if (((CVarGetInteger(CVAR_ENHANCEMENT("Autosave"), AUTOSAVE_OFF) == AUTOSAVE_LOCATION_AND_MAJOR_ITEMS) || (CVarGetInteger(CVAR_ENHANCEMENT("Autosave"), AUTOSAVE_OFF) == AUTOSAVE_MAJOR_ITEMS)) && (item != ITEM_NONE)) {
// Autosave for major items // Autosave for major items
if (itemEntry.modIndex == 0) { if (itemEntry.modIndex == 0) {
switch (item) { switch (item) {
@ -341,7 +341,7 @@ void AutoSave(GetItemEntry itemEntry) {
case ITEM_BOMBCHU: case ITEM_BOMBCHU:
case ITEM_BOMBCHUS_5: case ITEM_BOMBCHUS_5:
case ITEM_BOMBCHUS_20: case ITEM_BOMBCHUS_20:
if (!CVarGetInteger("gBombchuDrops", 0)) { if (!CVarGetInteger(CVAR_ENHANCEMENT("BombchuDrops"), 0)) {
performSave = true; performSave = true;
} }
break; break;
@ -352,9 +352,9 @@ void AutoSave(GetItemEntry itemEntry) {
} else if (itemEntry.modIndex == 1 && item != RG_ICE_TRAP) { } else if (itemEntry.modIndex == 1 && item != RG_ICE_TRAP) {
performSave = true; performSave = true;
} }
} else if (CVarGetInteger("gAutosave", AUTOSAVE_OFF) == AUTOSAVE_LOCATION_AND_MAJOR_ITEMS || } else if (CVarGetInteger(CVAR_ENHANCEMENT("Autosave"), AUTOSAVE_OFF) == AUTOSAVE_LOCATION_AND_MAJOR_ITEMS ||
CVarGetInteger("gAutosave", AUTOSAVE_OFF) == AUTOSAVE_LOCATION_AND_ALL_ITEMS || CVarGetInteger(CVAR_ENHANCEMENT("Autosave"), AUTOSAVE_OFF) == AUTOSAVE_LOCATION_AND_ALL_ITEMS ||
CVarGetInteger("gAutosave", AUTOSAVE_OFF) == AUTOSAVE_LOCATION) { CVarGetInteger(CVAR_ENHANCEMENT("Autosave"), AUTOSAVE_OFF) == AUTOSAVE_LOCATION) {
performSave = true; performSave = true;
} }
if (performSave) { if (performSave) {
@ -372,13 +372,13 @@ void RegisterAutoSave() {
void RegisterRupeeDash() { void RegisterRupeeDash() {
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnPlayerUpdate>([]() { GameInteractor::Instance->RegisterGameHook<GameInteractor::OnPlayerUpdate>([]() {
if (!CVarGetInteger("gRupeeDash", 0)) { if (!CVarGetInteger(CVAR_ENHANCEMENT("RupeeDash"), 0)) {
return; return;
} }
// Initialize Timer // Initialize Timer
static uint16_t rupeeDashTimer = 0; static uint16_t rupeeDashTimer = 0;
uint16_t rdmTime = CVarGetInteger("gDashInterval", 5) * 20; uint16_t rdmTime = CVarGetInteger(CVAR_ENHANCEMENT("RupeeDashInterval"), 5) * 20;
// Did time change by DashInterval? // Did time change by DashInterval?
if (rupeeDashTimer >= rdmTime) { if (rupeeDashTimer >= rdmTime) {
@ -400,7 +400,7 @@ void RegisterShadowTag() {
static uint16_t delayTimer = 60; static uint16_t delayTimer = 60;
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnPlayerUpdate>([]() { GameInteractor::Instance->RegisterGameHook<GameInteractor::OnPlayerUpdate>([]() {
if (!CVarGetInteger("gShadowTag", 0)) { if (!CVarGetInteger(CVAR_ENHANCEMENT("ShadowTag"), 0)) {
return; return;
} }
if (gPlayState->sceneNum == SCENE_FOREST_TEMPLE && // Forest Temple Scene if (gPlayState->sceneNum == SCENE_FOREST_TEMPLE && // Forest Temple Scene
@ -431,7 +431,7 @@ static bool hasAffectedHealth = false;
void UpdatePermanentHeartLossState() { void UpdatePermanentHeartLossState() {
if (!GameInteractor::IsSaveLoaded()) return; if (!GameInteractor::IsSaveLoaded()) return;
if (!CVarGetInteger("gPermanentHeartLoss", 0) && hasAffectedHealth) { if (!CVarGetInteger(CVAR_ENHANCEMENT("PermanentHeartLoss"), 0) && hasAffectedHealth) {
uint8_t heartContainers = gSaveContext.sohStats.heartContainers; // each worth 16 health uint8_t heartContainers = gSaveContext.sohStats.heartContainers; // each worth 16 health
uint8_t heartPieces = gSaveContext.sohStats.heartPieces; // each worth 4 health, but only in groups of 4 uint8_t heartPieces = gSaveContext.sohStats.heartPieces; // each worth 4 health, but only in groups of 4
uint8_t startingHealth = 16 * 3; uint8_t startingHealth = 16 * 3;
@ -451,7 +451,7 @@ void RegisterPermanentHeartLoss() {
}); });
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnPlayerUpdate>([]() { GameInteractor::Instance->RegisterGameHook<GameInteractor::OnPlayerUpdate>([]() {
if (!CVarGetInteger("gPermanentHeartLoss", 0) || !GameInteractor::IsSaveLoaded()) return; if (!CVarGetInteger(CVAR_ENHANCEMENT("PermanentHeartLoss"), 0) || !GameInteractor::IsSaveLoaded()) return;
if (gSaveContext.healthCapacity > 16 && gSaveContext.healthCapacity - gSaveContext.health >= 16) { if (gSaveContext.healthCapacity > 16 && gSaveContext.healthCapacity - gSaveContext.health >= 16) {
gSaveContext.healthCapacity -= 16; gSaveContext.healthCapacity -= 16;
@ -463,12 +463,12 @@ void RegisterPermanentHeartLoss() {
void RegisterDeleteFileOnDeath() { void RegisterDeleteFileOnDeath() {
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnGameFrameUpdate>([]() { GameInteractor::Instance->RegisterGameHook<GameInteractor::OnGameFrameUpdate>([]() {
if (!CVarGetInteger("gDeleteFileOnDeath", 0) || !GameInteractor::IsSaveLoaded() || &gPlayState->gameOverCtx == NULL || &gPlayState->pauseCtx == NULL) return; if (!CVarGetInteger(CVAR_ENHANCEMENT("DeleteFileOnDeath"), 0) || !GameInteractor::IsSaveLoaded() || &gPlayState->gameOverCtx == NULL || &gPlayState->pauseCtx == NULL) return;
if (gPlayState->gameOverCtx.state == GAMEOVER_DEATH_MENU && gPlayState->pauseCtx.state == 9) { if (gPlayState->gameOverCtx.state == GAMEOVER_DEATH_MENU && gPlayState->pauseCtx.state == 9) {
SaveManager::Instance->DeleteZeldaFile(gSaveContext.fileNum); SaveManager::Instance->DeleteZeldaFile(gSaveContext.fileNum);
hasAffectedHealth = false; hasAffectedHealth = false;
std::reinterpret_pointer_cast<LUS::ConsoleWindow>(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetGuiWindow("Console"))->Dispatch("reset"); std::reinterpret_pointer_cast<Ship::ConsoleWindow>(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetGuiWindow("Console"))->Dispatch("reset");
} }
}); });
} }
@ -484,7 +484,7 @@ using DayTimeGoldSkulltulasList = std::vector<DayTimeGoldSkulltulas>;
void RegisterDaytimeGoldSkultullas() { void RegisterDaytimeGoldSkultullas() {
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnSceneSpawnActors>([]() { GameInteractor::Instance->RegisterGameHook<GameInteractor::OnSceneSpawnActors>([]() {
if (!CVarGetInteger("gNightGSAlwaysSpawn", 0)) { if (!CVarGetInteger(CVAR_ENHANCEMENT("NightGSAlwaysSpawn"), 0)) {
return; return;
} }
@ -530,7 +530,7 @@ void RegisterDaytimeGoldSkultullas() {
} }
bool IsHyperBossesActive() { bool IsHyperBossesActive() {
return CVarGetInteger("gHyperBosses", 0) || return CVarGetInteger(CVAR_ENHANCEMENT("HyperBosses"), 0) ||
(IS_BOSS_RUSH && gSaveContext.bossRushOptions[BR_OPTIONS_HYPERBOSSES] == BR_CHOICE_HYPERBOSSES_YES); (IS_BOSS_RUSH && gSaveContext.bossRushOptions[BR_OPTIONS_HYPERBOSSES] == BR_CHOICE_HYPERBOSSES_YES);
} }
@ -598,7 +598,7 @@ void UpdateHyperEnemiesState() {
actorUpdateHookId = 0; actorUpdateHookId = 0;
} }
if (CVarGetInteger("gHyperEnemies", 0)) { if (CVarGetInteger(CVAR_ENHANCEMENT("HyperEnemies"), 0)) {
actorUpdateHookId = GameInteractor::Instance->RegisterGameHook<GameInteractor::OnActorUpdate>([](void* refActor) { actorUpdateHookId = GameInteractor::Instance->RegisterGameHook<GameInteractor::OnActorUpdate>([](void* refActor) {
// Run the update function a second time to make enemies and minibosses move and act twice as fast. // Run the update function a second time to make enemies and minibosses move and act twice as fast.
@ -610,7 +610,7 @@ void UpdateHyperEnemiesState() {
bool isExcludedEnemy = actor->id == ACTOR_EN_FIRE_ROCK || actor->id == ACTOR_EN_ENCOUNT2; bool isExcludedEnemy = actor->id == ACTOR_EN_FIRE_ROCK || actor->id == ACTOR_EN_ENCOUNT2;
// Don't apply during cutscenes because it causes weird behaviour and/or crashes on some cutscenes. // Don't apply during cutscenes because it causes weird behaviour and/or crashes on some cutscenes.
if (CVarGetInteger("gHyperEnemies", 0) && isEnemy && !isExcludedEnemy && if (CVarGetInteger(CVAR_ENHANCEMENT("HyperEnemies"), 0) && isEnemy && !isExcludedEnemy &&
!Player_InBlockingCsMode(gPlayState, player)) { !Player_InBlockingCsMode(gPlayState, player)) {
GameInteractor::RawAction::UpdateActor(actor); GameInteractor::RawAction::UpdateActor(actor);
} }
@ -620,7 +620,7 @@ void UpdateHyperEnemiesState() {
void RegisterBonkDamage() { void RegisterBonkDamage() {
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnPlayerBonk>([]() { GameInteractor::Instance->RegisterGameHook<GameInteractor::OnPlayerBonk>([]() {
uint8_t bonkOption = CVarGetInteger("gBonkDamageMul", BONK_DAMAGE_NONE); uint8_t bonkOption = CVarGetInteger(CVAR_ENHANCEMENT("BonkDamageMult"), BONK_DAMAGE_NONE);
if (bonkOption == BONK_DAMAGE_NONE) { if (bonkOption == BONK_DAMAGE_NONE) {
return; return;
} }
@ -666,10 +666,10 @@ void UpdateDirtPathFixState(int32_t sceneNum) {
case SCENE_HYRULE_FIELD: case SCENE_HYRULE_FIELD:
case SCENE_KOKIRI_FOREST: case SCENE_KOKIRI_FOREST:
case SCENE_HYRULE_CASTLE: case SCENE_HYRULE_CASTLE:
CVarSetInteger("gZFightingMode", CVarGetInteger("gSceneSpecificDirtPathFix", ZFIGHT_FIX_DISABLED)); CVarSetInteger(CVAR_Z_FIGHTING_MODE, CVarGetInteger(CVAR_ENHANCEMENT("SceneSpecificDirtPathFix"), ZFIGHT_FIX_DISABLED));
return; return;
default: default:
CVarClear("gZFightingMode"); CVarClear(CVAR_Z_FIGHTING_MODE);
} }
} }
@ -683,7 +683,7 @@ void UpdateMirrorModeState(int32_t sceneNum) {
static bool prevMirroredWorld = false; static bool prevMirroredWorld = false;
bool nextMirroredWorld = false; bool nextMirroredWorld = false;
int16_t mirroredMode = CVarGetInteger("gMirroredWorldMode", MIRRORED_WORLD_OFF); int16_t mirroredMode = CVarGetInteger(CVAR_ENHANCEMENT("MirroredWorldMode"), MIRRORED_WORLD_OFF);
int16_t inDungeon = (sceneNum >= SCENE_DEKU_TREE && sceneNum <= SCENE_INSIDE_GANONS_CASTLE_COLLAPSE && sceneNum != SCENE_THIEVES_HIDEOUT) || int16_t inDungeon = (sceneNum >= SCENE_DEKU_TREE && sceneNum <= SCENE_INSIDE_GANONS_CASTLE_COLLAPSE && sceneNum != SCENE_THIEVES_HIDEOUT) ||
(sceneNum >= SCENE_DEKU_TREE_BOSS && sceneNum <= SCENE_GANONS_TOWER_COLLAPSE_EXTERIOR) || (sceneNum >= SCENE_DEKU_TREE_BOSS && sceneNum <= SCENE_GANONS_TOWER_COLLAPSE_EXTERIOR) ||
(sceneNum == SCENE_GANON_BOSS); (sceneNum == SCENE_GANON_BOSS);
@ -706,10 +706,10 @@ void UpdateMirrorModeState(int32_t sceneNum) {
((mirroredMode == MIRRORED_WORLD_DUNGEONS_RANDOM || mirroredMode == MIRRORED_WORLD_DUNGEONS_RANDOM_SEEDED) && randomMirror))) ((mirroredMode == MIRRORED_WORLD_DUNGEONS_RANDOM || mirroredMode == MIRRORED_WORLD_DUNGEONS_RANDOM_SEEDED) && randomMirror)))
) { ) {
nextMirroredWorld = true; nextMirroredWorld = true;
CVarSetInteger("gMirroredWorld", 1); CVarSetInteger(CVAR_ENHANCEMENT("MirroredWorld"), 1);
} else { } else {
nextMirroredWorld = false; nextMirroredWorld = false;
CVarClear("gMirroredWorld"); CVarClear(CVAR_ENHANCEMENT("MirroredWorld"));
} }
if (prevMirroredWorld != nextMirroredWorld) { if (prevMirroredWorld != nextMirroredWorld) {
@ -725,7 +725,7 @@ void RegisterMirrorModeHandler() {
} }
void UpdatePatchHand() { void UpdatePatchHand() {
if ((CVarGetInteger("gEnhancements.EquimentAlwaysVisible", 0)) && LINK_IS_CHILD) { if ((CVarGetInteger(CVAR_ENHANCEMENT("EquimentAlwaysVisible"), 0)) && LINK_IS_CHILD) {
ResourceMgr_PatchGfxByName(gLinkAdultLeftHandHoldingHammerNearDL, "childHammer1", 92, gsSPDisplayListOTRFilePath(gLinkChildLeftFistNearDL)); ResourceMgr_PatchGfxByName(gLinkAdultLeftHandHoldingHammerNearDL, "childHammer1", 92, gsSPDisplayListOTRFilePath(gLinkChildLeftFistNearDL));
ResourceMgr_PatchGfxByName(gLinkAdultLeftHandHoldingHammerNearDL, "childHammer2", 93, gsSPEndDisplayList()); ResourceMgr_PatchGfxByName(gLinkAdultLeftHandHoldingHammerNearDL, "childHammer2", 93, gsSPEndDisplayList());
ResourceMgr_PatchGfxByName(gLinkAdultRightHandHoldingHookshotNearDL, "childHookshot1", 84, gsSPDisplayListOTRFilePath(gLinkChildRightHandClosedNearDL)); ResourceMgr_PatchGfxByName(gLinkAdultRightHandHoldingHookshotNearDL, "childHookshot1", 84, gsSPDisplayListOTRFilePath(gLinkChildRightHandClosedNearDL));
@ -753,7 +753,7 @@ void UpdatePatchHand() {
ResourceMgr_UnpatchGfxByName(gLinkAdultHandHoldingBrokenGiantsKnifeDL, "childBrokenGiantsKnife1"); ResourceMgr_UnpatchGfxByName(gLinkAdultHandHoldingBrokenGiantsKnifeDL, "childBrokenGiantsKnife1");
ResourceMgr_UnpatchGfxByName(gLinkAdultHandHoldingBrokenGiantsKnifeDL, "childBrokenGiantsKnife2"); ResourceMgr_UnpatchGfxByName(gLinkAdultHandHoldingBrokenGiantsKnifeDL, "childBrokenGiantsKnife2");
} }
if ((CVarGetInteger("gEnhancements.EquimentAlwaysVisible", 0)) && LINK_IS_ADULT) { if ((CVarGetInteger(CVAR_ENHANCEMENT("EquimentAlwaysVisible"), 0)) && LINK_IS_ADULT) {
ResourceMgr_PatchGfxByName(gLinkChildLeftFistAndKokiriSwordNearDL, "adultKokiriSword", 13, gsSPDisplayListOTRFilePath(gLinkAdultLeftHandClosedNearDL)); ResourceMgr_PatchGfxByName(gLinkChildLeftFistAndKokiriSwordNearDL, "adultKokiriSword", 13, gsSPDisplayListOTRFilePath(gLinkAdultLeftHandClosedNearDL));
ResourceMgr_PatchGfxByName(gLinkChildRightHandHoldingSlingshotNearDL, "adultSlingshot", 13, gsSPDisplayListOTRFilePath(gLinkAdultRightHandClosedNearDL)); ResourceMgr_PatchGfxByName(gLinkChildRightHandHoldingSlingshotNearDL, "adultSlingshot", 13, gsSPDisplayListOTRFilePath(gLinkAdultRightHandClosedNearDL));
ResourceMgr_PatchGfxByName(gLinkChildLeftFistAndBoomerangNearDL, "adultBoomerang", 50, gsSPDisplayListOTRFilePath(gLinkAdultLeftHandClosedNearDL)); ResourceMgr_PatchGfxByName(gLinkChildLeftFistAndBoomerangNearDL, "adultBoomerang", 50, gsSPDisplayListOTRFilePath(gLinkAdultLeftHandClosedNearDL));
@ -774,7 +774,7 @@ void RegisterPatchHandHandler() {
void RegisterResetNaviTimer() { void RegisterResetNaviTimer() {
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnSceneInit>([](int32_t sceneNum) { GameInteractor::Instance->RegisterGameHook<GameInteractor::OnSceneInit>([](int32_t sceneNum) {
if (CVarGetInteger("gEnhancements.ResetNaviTimer", 0)) { if (CVarGetInteger(CVAR_ENHANCEMENT("ResetNaviTimer"), 0)) {
gSaveContext.naviTimer = 0; gSaveContext.naviTimer = 0;
} }
}); });
@ -1028,16 +1028,16 @@ typedef enum {
} AltTrapType; } AltTrapType;
const char* altTrapTypeCvars[] = { const char* altTrapTypeCvars[] = {
"gAddTraps.Ice", CVAR_ENHANCEMENT("ExtraTraps.Ice"),
"gAddTraps.Burn", CVAR_ENHANCEMENT("ExtraTraps.Burn"),
"gAddTraps.Shock", CVAR_ENHANCEMENT("ExtraTraps.Shock"),
"gAddTraps.Knock", CVAR_ENHANCEMENT("ExtraTraps.Knockback"),
"gAddTraps.Speed", CVAR_ENHANCEMENT("ExtraTraps.Speed"),
"gAddTraps.Bomb", CVAR_ENHANCEMENT("ExtraTraps.Bomb"),
"gAddTraps.Void", CVAR_ENHANCEMENT("ExtraTraps.Void"),
"gAddTraps.Ammo", CVAR_ENHANCEMENT("ExtraTraps.Ammo"),
"gAddTraps.Kill", CVAR_ENHANCEMENT("ExtraTraps.Kill"),
"gAddTraps.Tele" CVAR_ENHANCEMENT("ExtraTraps.Teleport")
}; };
std::vector<AltTrapType> getEnabledAddTraps () { std::vector<AltTrapType> getEnabledAddTraps () {
@ -1059,7 +1059,7 @@ void RegisterAltTrapTypes() {
static int eventTimer = -1; static int eventTimer = -1;
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnItemReceive>([](GetItemEntry itemEntry) { GameInteractor::Instance->RegisterGameHook<GameInteractor::OnItemReceive>([](GetItemEntry itemEntry) {
if (!CVarGetInteger("gAddTraps.enabled", 0) || itemEntry.modIndex != MOD_RANDOMIZER || itemEntry.getItemId != RG_ICE_TRAP) { if (!CVarGetInteger(CVAR_ENHANCEMENT("ExtraTraps.Enabled"), 0) || itemEntry.modIndex != MOD_RANDOMIZER || itemEntry.getItemId != RG_ICE_TRAP) {
return; return;
} }
roll = RandomElement(getEnabledAddTraps()); roll = RandomElement(getEnabledAddTraps());
@ -1257,7 +1257,7 @@ void UpdateHurtContainerModeState(bool newState) {
void RegisterHurtContainerModeHandler() { void RegisterHurtContainerModeHandler() {
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnLoadGame>([](int32_t fileNum) { GameInteractor::Instance->RegisterGameHook<GameInteractor::OnLoadGame>([](int32_t fileNum) {
UpdateHurtContainerModeState(CVarGetInteger("gHurtContainer", 0)); UpdateHurtContainerModeState(CVarGetInteger(CVAR_ENHANCEMENT("HurtContainer"), 0));
}); });
} }
@ -1276,7 +1276,7 @@ void RegisterRandomizedEnemySizes() {
actor->id == ACTOR_BOSS_FD2 || actor->id == ACTOR_EN_DH; actor->id == ACTOR_BOSS_FD2 || actor->id == ACTOR_EN_DH;
// Only apply to enemies and bosses. // Only apply to enemies and bosses.
if (!CVarGetInteger("gRandomizedEnemySizes", 0) || (actor->category != ACTORCAT_ENEMY && actor->category != ACTORCAT_BOSS) || excludedEnemy) { if (!CVarGetInteger(CVAR_ENHANCEMENT("RandomizedEnemySizes"), 0) || (actor->category != ACTORCAT_ENEMY && actor->category != ACTORCAT_BOSS) || excludedEnemy) {
return; return;
} }
@ -1299,7 +1299,7 @@ void RegisterRandomizedEnemySizes() {
Actor_SetScale(actor, actor->scale.z * randomScale); Actor_SetScale(actor, actor->scale.z * randomScale);
if (CVarGetInteger("gEnemySizeScalesHealth", 0) && (actor->category == ACTORCAT_ENEMY)) { if (CVarGetInteger(CVAR_ENHANCEMENT("EnemySizeScalesHealth"), 0) && (actor->category == ACTORCAT_ENEMY)) {
// Scale the health based on a smaller factor than randomScale // Scale the health based on a smaller factor than randomScale
float healthScalingFactor = 0.8f; // Adjust this factor as needed float healthScalingFactor = 0.8f; // Adjust this factor as needed
float scaledHealth = actor->colChkInfo.health * (randomScale * healthScalingFactor); float scaledHealth = actor->colChkInfo.health * (randomScale * healthScalingFactor);
@ -1316,7 +1316,7 @@ void RegisterOpenAllHours() {
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnActorInit>([](void* refActor) { GameInteractor::Instance->RegisterGameHook<GameInteractor::OnActorInit>([](void* refActor) {
Actor* actor = static_cast<Actor*>(refActor); Actor* actor = static_cast<Actor*>(refActor);
if (CVarGetInteger("gEnhancements.OpenAllHours", 0) && (actor->id == ACTOR_EN_DOOR)) { if (CVarGetInteger(CVAR_ENHANCEMENT("OpenAllHours"), 0) && (actor->id == ACTOR_EN_DOOR)) {
switch (actor->params) { switch (actor->params) {
case 4753: // Night Market Bazaar case 4753: // Night Market Bazaar
case 1678: // Night Potion Shop case 1678: // Night Potion Shop
@ -1343,7 +1343,7 @@ void RegisterOpenAllHours() {
void PatchToTMedallions() { void PatchToTMedallions() {
// TODO: Refactor the DemoEffect_UpdateJewelAdult and DemoEffect_UpdateJewelChild from z_demo_effect // TODO: Refactor the DemoEffect_UpdateJewelAdult and DemoEffect_UpdateJewelChild from z_demo_effect
// effects to take effect in there // effects to take effect in there
if (CVarGetInteger("gToTMedallionsColors", 0)) { if (CVarGetInteger(CVAR_ENHANCEMENT("ToTMedallionsColors"), 0)) {
ResourceMgr_PatchGfxByName(tokinoma_room_0DL_007A70, "ToTMedallions_StartGrayscale", 7, gsSPGrayscale(true)); ResourceMgr_PatchGfxByName(tokinoma_room_0DL_007A70, "ToTMedallions_StartGrayscale", 7, gsSPGrayscale(true));
ResourceMgr_PatchGfxByName(tokinoma_room_0DL_007FD0, "ToTMedallions_2_StartGrayscale", 7, gsSPGrayscale(true)); ResourceMgr_PatchGfxByName(tokinoma_room_0DL_007FD0, "ToTMedallions_2_StartGrayscale", 7, gsSPGrayscale(true));
@ -1409,13 +1409,13 @@ void PatchToTMedallions() {
void RegisterToTMedallions() { void RegisterToTMedallions() {
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnItemReceive>([](GetItemEntry _unused) { GameInteractor::Instance->RegisterGameHook<GameInteractor::OnItemReceive>([](GetItemEntry _unused) {
if (!CVarGetInteger("gToTMedallionsColors", 0) || !gPlayState || gPlayState->sceneNum != SCENE_TEMPLE_OF_TIME) { if (!CVarGetInteger(CVAR_ENHANCEMENT("ToTMedallionsColors"), 0) || !gPlayState || gPlayState->sceneNum != SCENE_TEMPLE_OF_TIME) {
return; return;
} }
PatchToTMedallions(); PatchToTMedallions();
}); });
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnSceneInit>([](int16_t sceneNum) { GameInteractor::Instance->RegisterGameHook<GameInteractor::OnSceneInit>([](int16_t sceneNum) {
if (!CVarGetInteger("gToTMedallionsColors", 0) || sceneNum != SCENE_TEMPLE_OF_TIME) { if (!CVarGetInteger(CVAR_ENHANCEMENT("ToTMedallionsColors"), 0) || sceneNum != SCENE_TEMPLE_OF_TIME) {
return; return;
} }
PatchToTMedallions(); PatchToTMedallions();
@ -1426,7 +1426,7 @@ void RegisterToTMedallions() {
void RegisterFloorSwitchesHook() { void RegisterFloorSwitchesHook() {
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnActorInit>([](void* refActor) { GameInteractor::Instance->RegisterGameHook<GameInteractor::OnActorInit>([](void* refActor) {
Actor* actor = static_cast<Actor*>(refActor); Actor* actor = static_cast<Actor*>(refActor);
if (actor->id != ACTOR_OBJ_SWITCH || !CVarGetInteger("gEnhancements.FixFloorSwitches", 0)) { if (actor->id != ACTOR_OBJ_SWITCH || !CVarGetInteger(CVAR_ENHANCEMENT("FixFloorSwitches"), 0)) {
return; return;
} }
@ -1442,7 +1442,7 @@ void RegisterFloorSwitchesHook() {
void RegisterPauseMenuHooks() { void RegisterPauseMenuHooks() {
static bool pauseWarpHooksRegistered = false; static bool pauseWarpHooksRegistered = false;
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnGameFrameUpdate>([&]() { GameInteractor::Instance->RegisterGameHook<GameInteractor::OnGameFrameUpdate>([&]() {
if (!GameInteractor::IsSaveLoaded() || !CVarGetInteger("gPauseWarp", 0)) { if (!GameInteractor::IsSaveLoaded() || !CVarGetInteger(CVAR_ENHANCEMENT("PauseWarp"), 0)) {
pauseWarpHooksRegistered = false; pauseWarpHooksRegistered = false;
return; return;
} }

View File

@ -5,6 +5,7 @@
#include "soh/frame_interpolation.h" #include "soh/frame_interpolation.h"
#include "soh/Enhancements/custom-message/CustomMessageInterfaceAddon.h" #include "soh/Enhancements/custom-message/CustomMessageInterfaceAddon.h"
#include "soh/Enhancements/game-interactor/GameInteractor.h" #include "soh/Enhancements/game-interactor/GameInteractor.h"
#include "soh/OTRGlobals.h"
extern "C" { extern "C" {
#include "z64.h" #include "z64.h"
@ -70,11 +71,11 @@ void DrawNameTag(PlayState* play, const NameTag* nameTag) {
Color_RGBA8 textboxColor = { 0, 0, 0, 80}; Color_RGBA8 textboxColor = { 0, 0, 0, 80};
Color_RGBA8 textColor = { 255, 255, 255, 255 }; Color_RGBA8 textColor = { 255, 255, 255, 255 };
if (CVarGetInteger("gCosmetics.Hud_NameTagActorBackground.Changed", 0)) { if (CVarGetInteger(CVAR_COSMETIC("HUD.NameTagActorBackground.Changed"), 0)) {
textboxColor = CVarGetColor("gCosmetics.Hud_NameTagActorBackground.Value", textboxColor); textboxColor = CVarGetColor(CVAR_COSMETIC("HUD.NameTagActorBackground.Value"), textboxColor);
} }
if (CVarGetInteger("gCosmetics.Hud_NameTagActorText.Changed", 0)) { if (CVarGetInteger(CVAR_COSMETIC("HUD.NameTagActorText.Changed"), 0)) {
textColor = CVarGetColor("gCosmetics.Hud_NameTagActorText.Value", textColor); textColor = CVarGetColor(CVAR_COSMETIC("HUD.NameTagActorText.Value"), textColor);
} }
FrameInterpolation_RecordOpenChild(nameTag->actor, 10); FrameInterpolation_RecordOpenChild(nameTag->actor, 10);
@ -90,7 +91,7 @@ void DrawNameTag(PlayState* play, const NameTag* nameTag) {
// Set position, billboard effect, scale (with mirror mode), then center nametag // Set position, billboard effect, scale (with mirror mode), then center nametag
Matrix_Translate(nameTag->actor->world.pos.x, posY, nameTag->actor->world.pos.z, MTXMODE_NEW); Matrix_Translate(nameTag->actor->world.pos.x, posY, nameTag->actor->world.pos.z, MTXMODE_NEW);
Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_ReplaceRotation(&play->billboardMtxF);
Matrix_Scale(scale * (CVarGetInteger("gMirroredWorld", 0) ? -1 : 1), -scale, 1.0f, MTXMODE_APPLY); Matrix_Scale(scale * (CVarGetInteger(CVAR_ENHANCEMENT("MirroredWorld"), 0) ? -1 : 1), -scale, 1.0f, MTXMODE_APPLY);
Matrix_Translate(-(float)nameTag->width / 2, -nameTag->height, 0, MTXMODE_APPLY); Matrix_Translate(-(float)nameTag->width / 2, -nameTag->height, 0, MTXMODE_APPLY);
Matrix_ToMtx(nameTag->mtx, (char*)__FILE__, __LINE__); Matrix_ToMtx(nameTag->mtx, (char*)__FILE__, __LINE__);

View File

@ -85,7 +85,8 @@ void PauseWarp_HandleSelection() {
if (gSaveContext.inventory.items[SLOT_OCARINA] != ITEM_NONE) { if (gSaveContext.inventory.items[SLOT_OCARINA] != ITEM_NONE) {
int aButtonPressed = CHECK_BTN_ALL(gPlayState->state.input->press.button, BTN_A); int aButtonPressed = CHECK_BTN_ALL(gPlayState->state.input->press.button, BTN_A);
int song = gPlayState->pauseCtx.cursorPoint[PAUSE_QUEST]; int song = gPlayState->pauseCtx.cursorPoint[PAUSE_QUEST];
if (aButtonPressed && CHECK_QUEST_ITEM(song) && song >= QUEST_SONG_MINUET && song <= QUEST_SONG_PRELUDE) { if (aButtonPressed && CHECK_QUEST_ITEM(song) && song >= QUEST_SONG_MINUET && song <= QUEST_SONG_PRELUDE &&
gPlayState->pauseCtx.pageIndex == PAUSE_QUEST && gPlayState->pauseCtx.state == 6) {
ActivateWarp(&gPlayState->pauseCtx, song); ActivateWarp(&gPlayState->pauseCtx, song);
} }
} }

View File

@ -40,7 +40,7 @@ void applyPreset(std::vector<PresetEntry> entries) {
} }
void DrawPresetSelector(PresetType presetTypeId) { void DrawPresetSelector(PresetType presetTypeId) {
const std::string presetTypeCvar = "gPreset" + std::to_string(presetTypeId); const std::string presetTypeCvar = CVAR_GENERAL("SelectedPresets.") + std::to_string(presetTypeId);
const PresetTypeDefinition presetTypeDef = presetTypes.at(presetTypeId); const PresetTypeDefinition presetTypeDef = presetTypes.at(presetTypeId);
const uint16_t selectedPresetId = CVarGetInteger(presetTypeCvar.c_str(), 0); const uint16_t selectedPresetId = CVarGetInteger(presetTypeCvar.c_str(), 0);
const PresetDefinition selectedPresetDef = presetTypeDef.presets.at(selectedPresetId); const PresetDefinition selectedPresetDef = presetTypeDef.presets.at(selectedPresetId);
@ -70,7 +70,7 @@ void DrawPresetSelector(PresetType presetTypeId) {
if (selectedPresetId != 0) { if (selectedPresetId != 0) {
applyPreset(selectedPresetDef.entries); applyPreset(selectedPresetDef.entries);
} }
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
} }
ImGui::PopStyleVar(1); ImGui::PopStyleVar(1);
} }

File diff suppressed because it is too large Load Diff

View File

@ -8,7 +8,8 @@
#include "random.hpp" #include "random.hpp"
#include "spoiler_log.hpp" #include "spoiler_log.hpp"
#include "soh/Enhancements/randomizer/randomizerTypes.h" #include "soh/Enhancements/randomizer/randomizerTypes.h"
#include <variables.h> #include "variables.h"
#include "soh/OTRGlobals.h"
#include "../option.h" #include "../option.h"
namespace Playthrough { namespace Playthrough {
@ -44,7 +45,7 @@ int Playthrough_Init(uint32_t seed, std::set<RandomizerCheck> excludedLocations,
} }
} }
if (CVarGetInteger("gRandomizerDontGenerateSpoiler", 0)) { if (CVarGetInteger(CVAR_RANDOMIZER_SETTING("DontGenerateSpoiler"), 0)) {
settingsStr += (char*)gBuildVersion; settingsStr += (char*)gBuildVersion;
} }

View File

@ -8,12 +8,13 @@
#include <libultraship/bridge.h> #include <libultraship/bridge.h>
#include <Context.h> #include <Context.h>
#include <libultraship/libultra/types.h> #include <libultraship/libultra/types.h>
#include "soh/OTRGlobals.h"
void RandoMain::GenerateRando(std::set<RandomizerCheck> excludedLocations, std::set<RandomizerTrick> enabledTricks, void RandoMain::GenerateRando(std::set<RandomizerCheck> excludedLocations, std::set<RandomizerTrick> enabledTricks,
std::string seedString) { std::string seedString) {
// std::string settingsFileName = "./randomizer/latest_settings.json"; // std::string settingsFileName = "./randomizer/latest_settings.json";
// CVarSetString("gLoadedPreset", settingsFileName.c_str()); // CVarSetString(CVAR_RANDOMIZER_SETTING("LoadedPreset"), settingsFileName.c_str());
Rando::Context::GetInstance()->SetSeedGenerated(GenerateRandomizer(excludedLocations, enabledTricks, seedString)); Rando::Context::GetInstance()->SetSeedGenerated(GenerateRandomizer(excludedLocations, enabledTricks, seedString));

View File

@ -638,8 +638,8 @@ const char* SpoilerLog_Write() {
WriteShuffledEntrances(); WriteShuffledEntrances();
WriteAllLocations(); WriteAllLocations();
if (!std::filesystem::exists(LUS::Context::GetPathRelativeToAppDirectory("Randomizer"))) { if (!std::filesystem::exists(Ship::Context::GetPathRelativeToAppDirectory("Randomizer"))) {
std::filesystem::create_directory(LUS::Context::GetPathRelativeToAppDirectory("Randomizer")); std::filesystem::create_directory(Ship::Context::GetPathRelativeToAppDirectory("Randomizer"));
} }
std::string jsonString = jsonData.dump(4); std::string jsonString = jsonData.dump(4);
@ -654,7 +654,7 @@ const char* SpoilerLog_Write() {
fileNameStream << std::to_string(ctx->hashIconIndexes[i]); fileNameStream << std::to_string(ctx->hashIconIndexes[i]);
} }
std::string fileName = fileNameStream.str(); std::string fileName = fileNameStream.str();
std::ofstream jsonFile(LUS::Context::GetPathRelativeToAppDirectory( std::ofstream jsonFile(Ship::Context::GetPathRelativeToAppDirectory(
(std::string("Randomizer/") + fileName + std::string(".json")).c_str())); (std::string("Randomizer/") + fileName + std::string(".json")).c_str()));
jsonFile << std::setw(4) << jsonString << std::endl; jsonFile << std::setw(4) << jsonString << std::endl;
jsonFile.close(); jsonFile.close();

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -29,7 +29,7 @@ extern "C" void Randomizer_DrawSmallKey(PlayState* play, GetItemEntry* getItemEn
s8 keysCanBeOutsideDungeon = getItemEntry->getItemId == RG_GERUDO_FORTRESS_SMALL_KEY ? s8 keysCanBeOutsideDungeon = getItemEntry->getItemId == RG_GERUDO_FORTRESS_SMALL_KEY ?
Randomizer_GetSettingValue(RSK_GERUDO_KEYS) != RO_GERUDO_KEYS_VANILLA : Randomizer_GetSettingValue(RSK_GERUDO_KEYS) != RO_GERUDO_KEYS_VANILLA :
DUNGEON_ITEMS_CAN_BE_OUTSIDE_DUNGEON(RSK_KEYSANITY); DUNGEON_ITEMS_CAN_BE_OUTSIDE_DUNGEON(RSK_KEYSANITY);
s8 isColoredKeysEnabled = keysCanBeOutsideDungeon && CVarGetInteger("gRandoMatchKeyColors", 1); s8 isColoredKeysEnabled = keysCanBeOutsideDungeon && CVarGetInteger(CVAR_RANDOMIZER_ENHANCEMENT("MatchKeyColors"), 1);
s16 color_slot = getItemEntry->getItemId - RG_FOREST_TEMPLE_SMALL_KEY; s16 color_slot = getItemEntry->getItemId - RG_FOREST_TEMPLE_SMALL_KEY;
s16 colors[9][3] = { s16 colors[9][3] = {
{ 4, 195, 46 }, // Forest Temple { 4, 195, 46 }, // Forest Temple
@ -111,7 +111,7 @@ extern "C" void Randomizer_DrawBossKey(PlayState* play, GetItemEntry* getItemEnt
s8 keysCanBeOutsideDungeon = getItemEntry->getItemId == RG_GANONS_CASTLE_BOSS_KEY ? s8 keysCanBeOutsideDungeon = getItemEntry->getItemId == RG_GANONS_CASTLE_BOSS_KEY ?
DUNGEON_ITEMS_CAN_BE_OUTSIDE_DUNGEON(RSK_GANONS_BOSS_KEY) : DUNGEON_ITEMS_CAN_BE_OUTSIDE_DUNGEON(RSK_GANONS_BOSS_KEY) :
DUNGEON_ITEMS_CAN_BE_OUTSIDE_DUNGEON(RSK_BOSS_KEYSANITY); DUNGEON_ITEMS_CAN_BE_OUTSIDE_DUNGEON(RSK_BOSS_KEYSANITY);
s8 isColoredKeysEnabled = keysCanBeOutsideDungeon && CVarGetInteger("gRandoMatchKeyColors", 1); s8 isColoredKeysEnabled = keysCanBeOutsideDungeon && CVarGetInteger(CVAR_RANDOMIZER_ENHANCEMENT("MatchKeyColors"), 1);
s16 color_slot; s16 color_slot;
color_slot = getItemEntry->getItemId - RG_FOREST_TEMPLE_BOSS_KEY; color_slot = getItemEntry->getItemId - RG_FOREST_TEMPLE_BOSS_KEY;
s16 colors[6][3] = { s16 colors[6][3] = {

View File

@ -15,8 +15,9 @@
#ifndef IMGUI_DEFINE_MATH_OPERATORS #ifndef IMGUI_DEFINE_MATH_OPERATORS
#define IMGUI_DEFINE_MATH_OPERATORS #define IMGUI_DEFINE_MATH_OPERATORS
#endif #endif
#include <ImGui/imgui.h> #include <imgui.h>
#include <ImGui/imgui_internal.h> #include <imgui_internal.h>
#include "../custom-message/CustomMessageTypes.h"
#include "../item-tables/ItemTableManager.h" #include "../item-tables/ItemTableManager.h"
#include "../presets.h" #include "../presets.h"
#include "../../../src/overlays/actors/ovl_En_GirlA/z_en_girla.h" #include "../../../src/overlays/actors/ovl_En_GirlA/z_en_girla.h"
@ -1680,7 +1681,7 @@ RandomizerCheck Randomizer::GetCheckFromRandomizerInf(RandomizerInf randomizerIn
std::thread randoThread; std::thread randoThread;
void GenerateRandomizerImgui(std::string seed = "") { void GenerateRandomizerImgui(std::string seed = "") {
CVarSetInteger("gRandoGenerating", 1); CVarSetInteger(CVAR_GENERAL("RandoGenerating"), 1);
CVarSave(); CVarSave();
auto ctx = Rando::Context::GetInstance(); auto ctx = Rando::Context::GetInstance();
if (!ctx->IsSpoilerLoaded()) { if (!ctx->IsSpoilerLoaded()) {
@ -1689,7 +1690,7 @@ void GenerateRandomizerImgui(std::string seed = "") {
} }
// todo: this efficently when we build out cvar array support // todo: this efficently when we build out cvar array support
std::set<RandomizerCheck> excludedLocations; std::set<RandomizerCheck> excludedLocations;
std::stringstream excludedLocationStringStream(CVarGetString("gRandomizeExcludedLocations", "")); std::stringstream excludedLocationStringStream(CVarGetString(CVAR_RANDOMIZER_SETTING("ExcludedLocations"), ""));
std::string excludedLocationString; std::string excludedLocationString;
while (getline(excludedLocationStringStream, excludedLocationString, ',')) { while (getline(excludedLocationStringStream, excludedLocationString, ',')) {
excludedLocations.insert((RandomizerCheck)std::stoi(excludedLocationString)); excludedLocations.insert((RandomizerCheck)std::stoi(excludedLocationString));
@ -1698,7 +1699,7 @@ void GenerateRandomizerImgui(std::string seed = "") {
// todo: better way to sort out linking tricks rather than name // todo: better way to sort out linking tricks rather than name
std::set<RandomizerTrick> enabledTricks; std::set<RandomizerTrick> enabledTricks;
std::stringstream enabledTrickStringStream(CVarGetString("gRandomizeEnabledTricks", "")); std::stringstream enabledTrickStringStream(CVarGetString(CVAR_RANDOMIZER_SETTING("EnabledTricks"), ""));
std::string enabledTrickString; std::string enabledTrickString;
while (getline(enabledTrickStringStream, enabledTrickString, ',')) { while (getline(enabledTrickStringStream, enabledTrickString, ',')) {
enabledTricks.insert((RandomizerTrick)std::stoi(enabledTrickString)); enabledTricks.insert((RandomizerTrick)std::stoi(enabledTrickString));
@ -1718,7 +1719,7 @@ void GenerateRandomizerImgui(std::string seed = "") {
RandoMain::GenerateRando(excludedLocations, enabledTricks, seed); RandoMain::GenerateRando(excludedLocations, enabledTricks, seed);
CVarSetInteger("gRandoGenerating", 0); CVarSetInteger(CVAR_GENERAL("RandoGenerating"), 0);
CVarSave(); CVarSave();
CVarLoad(); CVarLoad();
@ -1730,7 +1731,7 @@ bool GenerateRandomizer(std::string seed /*= ""*/) {
generated = 0; generated = 0;
randoThread.join(); randoThread.join();
} }
if (CVarGetInteger("gRandoGenerating", 0) == 0) { if (CVarGetInteger(CVAR_GENERAL("RandoGenerating"), 0) == 0) {
randoThread = std::thread(&GenerateRandomizerImgui, seed); randoThread = std::thread(&GenerateRandomizerImgui, seed);
return true; return true;
} }
@ -1750,18 +1751,18 @@ void RandomizerSettingsWindow::DrawElement() {
return; return;
} }
bool disableEditingRandoSettings = CVarGetInteger("gRandoGenerating", 0) || CVarGetInteger("gOnFileSelectNameEntry", 0); bool disableEditingRandoSettings = CVarGetInteger(CVAR_GENERAL("RandoGenerating"), 0) || CVarGetInteger(CVAR_GENERAL("OnFileSelectNameEntry"), 0);
if (disableEditingRandoSettings) { if (disableEditingRandoSettings) {
UIWidgets::DisableComponent(ImGui::GetStyle().Alpha * 0.5f); UIWidgets::DisableComponent(ImGui::GetStyle().Alpha * 0.5f);
} }
ImGui::BeginDisabled(CVarGetInteger("gDisableChangingSettings", 0)); ImGui::BeginDisabled(CVarGetInteger(CVAR_SETTING("DisableChanges"), 0));
DrawPresetSelector(PRESET_TYPE_RANDOMIZER); DrawPresetSelector(PRESET_TYPE_RANDOMIZER);
ImGui::EndDisabled(); ImGui::EndDisabled();
UIWidgets::Spacer(0); UIWidgets::Spacer(0);
UIWidgets::EnhancementCheckbox("Manual seed entry", "gRandoManualSeedEntry", false, ""); UIWidgets::EnhancementCheckbox("Manual seed entry", CVAR_RANDOMIZER_SETTING("ManualSeedEntry"), false, "");
if (CVarGetInteger("gRandoManualSeedEntry", 0)) { if (CVarGetInteger(CVAR_RANDOMIZER_SETTING("ManualSeedEntry"), 0)) {
ImGui::Text("Seed"); ImGui::Text("Seed");
ImGui::InputText("##RandomizerSeed", seedString, MAX_SEED_STRING_SIZE, ImGuiInputTextFlags_CallbackCharFilter, UIWidgets::TextFilters::FilterAlphaNum); ImGui::InputText("##RandomizerSeed", seedString, MAX_SEED_STRING_SIZE, ImGuiInputTextFlags_CallbackCharFilter, UIWidgets::TextFilters::FilterAlphaNum);
UIWidgets::Tooltip( UIWidgets::Tooltip(
@ -1780,27 +1781,27 @@ void RandomizerSettingsWindow::DrawElement() {
} }
UIWidgets::Spacer(0); UIWidgets::Spacer(0);
ImGui::BeginDisabled(CVarGetInteger("gRandomizerDontGenerateSpoiler", 0) && gSaveContext.gameMode != GAMEMODE_FILE_SELECT); ImGui::BeginDisabled(CVarGetInteger(CVAR_RANDOMIZER_SETTING("DontGenerateSpoiler"), 0) && gSaveContext.gameMode != GAMEMODE_FILE_SELECT);
if (ImGui::Button("Generate Randomizer")) { if (ImGui::Button("Generate Randomizer")) {
ctx->SetSpoilerLoaded(false); ctx->SetSpoilerLoaded(false);
GenerateRandomizer(CVarGetInteger("gRandoManualSeedEntry", 0) ? seedString : ""); GenerateRandomizer(CVarGetInteger(CVAR_RANDOMIZER_SETTING("ManualSeedEntry"), 0) ? seedString : "");
} }
UIWidgets::Tooltip("You can also press L on the Quest Select screen to generate a new seed"); UIWidgets::Tooltip("You can also press L on the Quest Select screen to generate a new seed");
ImGui::EndDisabled(); ImGui::EndDisabled();
UIWidgets::Spacer(0); UIWidgets::Spacer(0);
if (!CVarGetInteger("gRandomizerDontGenerateSpoiler", 0)) { if (!CVarGetInteger(CVAR_RANDOMIZER_SETTING("DontGenerateSpoiler"), 0)) {
std::string spoilerfilepath = CVarGetString("gSpoilerLog", ""); std::string spoilerfilepath = CVarGetString(CVAR_GENERAL("SpoilerLog"), "");
ImGui::Text("Spoiler File: %s", spoilerfilepath.c_str()); ImGui::Text("Spoiler File: %s", spoilerfilepath.c_str());
} }
// RANDOTODO settings presets // RANDOTODO settings presets
// std::string presetfilepath = CVarGetString("gLoadedPreset", ""); // std::string presetfilepath = CVarGetString(CVAR_RANDOMIZER_SETTING("LoadedPreset"), "");
// ImGui::Text("Settings File: %s", presetfilepath.c_str()); // ImGui::Text("Settings File: %s", presetfilepath.c_str());
UIWidgets::PaddedSeparator(); UIWidgets::PaddedSeparator();
ImGui::BeginDisabled(CVarGetInteger("gDisableChangingSettings", 0)); ImGui::BeginDisabled(CVarGetInteger(CVAR_SETTING("DisableChanges"), 0));
ImGuiWindow* window = ImGui::GetCurrentWindow(); ImGuiWindow* window = ImGui::GetCurrentWindow();
static ImVec2 cellPadding(8.0f, 8.0f); static ImVec2 cellPadding(8.0f, 8.0f);
@ -1815,7 +1816,7 @@ void RandomizerSettingsWindow::DrawElement() {
ImGui::EndTabItem(); ImGui::EndTabItem();
} }
ImGui::BeginDisabled(CVarGetInteger("gRandomizeLogicRules", RO_LOGIC_GLITCHLESS) == RO_LOGIC_VANILLA); ImGui::BeginDisabled(CVarGetInteger(CVAR_RANDOMIZER_SETTING("LogicRules"), RO_LOGIC_GLITCHLESS) == RO_LOGIC_VANILLA);
if (ImGui::BeginTabItem("Items")) { if (ImGui::BeginTabItem("Items")) {
ImGui::PushStyleVar(ImGuiStyleVar_CellPadding, cellPadding); ImGui::PushStyleVar(ImGuiStyleVar_CellPadding, cellPadding);
ImGui::BeginDisabled(CVarGetInteger("gRandomizeLogicRules", RO_LOGIC_GLITCHLESS) == RO_LOGIC_VANILLA); ImGui::BeginDisabled(CVarGetInteger("gRandomizeLogicRules", RO_LOGIC_GLITCHLESS) == RO_LOGIC_VANILLA);
@ -1828,7 +1829,7 @@ void RandomizerSettingsWindow::DrawElement() {
} }
ImGui::EndDisabled(); ImGui::EndDisabled();
ImGui::BeginDisabled(CVarGetInteger("gRandomizeLogicRules", RO_LOGIC_GLITCHLESS) == RO_LOGIC_VANILLA); ImGui::BeginDisabled(CVarGetInteger(CVAR_RANDOMIZER_SETTING("LogicRules"), RO_LOGIC_GLITCHLESS) == RO_LOGIC_VANILLA);
if (ImGui::BeginTabItem("Gameplay")) { if (ImGui::BeginTabItem("Gameplay")) {
ImGui::PushStyleVar(ImGuiStyleVar_CellPadding, cellPadding); ImGui::PushStyleVar(ImGuiStyleVar_CellPadding, cellPadding);
if (mSettings->GetOptionGroup(RSG_GAMEPLAY_IMGUI_TABLE).RenderImGui()) { if (mSettings->GetOptionGroup(RSG_GAMEPLAY_IMGUI_TABLE).RenderImGui()) {
@ -1839,7 +1840,7 @@ void RandomizerSettingsWindow::DrawElement() {
} }
ImGui::EndDisabled(); ImGui::EndDisabled();
ImGui::BeginDisabled(CVarGetInteger("gRandomizeLogicRules", RO_LOGIC_GLITCHLESS) == RO_LOGIC_VANILLA); ImGui::BeginDisabled(CVarGetInteger(CVAR_RANDOMIZER_SETTING("LogicRules"), RO_LOGIC_GLITCHLESS) == RO_LOGIC_VANILLA);
static bool locationsTabOpen = false; static bool locationsTabOpen = false;
if (ImGui::BeginTabItem("Locations")) { if (ImGui::BeginTabItem("Locations")) {
ImGui::PushStyleVar(ImGuiStyleVar_CellPadding, cellPadding); ImGui::PushStyleVar(ImGuiStyleVar_CellPadding, cellPadding);
@ -1847,7 +1848,7 @@ void RandomizerSettingsWindow::DrawElement() {
locationsTabOpen = true; locationsTabOpen = true;
RandomizerCheckObjects::UpdateImGuiVisibility(); RandomizerCheckObjects::UpdateImGuiVisibility();
// todo: this efficently when we build out cvar array support // todo: this efficently when we build out cvar array support
std::stringstream excludedLocationStringStream(CVarGetString("gRandomizeExcludedLocations", "")); std::stringstream excludedLocationStringStream(CVarGetString(CVAR_RANDOMIZER_SETTING("ExcludedLocations"), ""));
std::string excludedLocationString; std::string excludedLocationString;
excludedLocations.clear(); excludedLocations.clear();
while (getline(excludedLocationStringStream, excludedLocationString, ',')) { while (getline(excludedLocationStringStream, excludedLocationString, ',')) {
@ -1897,8 +1898,8 @@ void RandomizerSettingsWindow::DrawElement() {
excludedLocationString += std::to_string(excludedLocationIt); excludedLocationString += std::to_string(excludedLocationIt);
excludedLocationString += ","; excludedLocationString += ",";
} }
CVarSetString("gRandomizeExcludedLocations", excludedLocationString.c_str()); CVarSetString(CVAR_RANDOMIZER_SETTING("ExcludedLocations"), excludedLocationString.c_str());
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
} }
ImGui::SameLine(); ImGui::SameLine();
ImGui::Text("%s", Rando::StaticData::GetLocation(location)->GetShortName().c_str()); ImGui::Text("%s", Rando::StaticData::GetLocation(location)->GetShortName().c_str());
@ -1939,11 +1940,11 @@ void RandomizerSettingsWindow::DrawElement() {
excludedLocationString += ","; excludedLocationString += ",";
} }
if (excludedLocationString == "") { if (excludedLocationString == "") {
CVarClear("gRandomizeExcludedLocations"); CVarClear(CVAR_RANDOMIZER_SETTING("ExcludedLocations"));
} else { } else {
CVarSetString("gRandomizeExcludedLocations", excludedLocationString.c_str()); CVarSetString(CVAR_RANDOMIZER_SETTING("ExcludedLocations"), excludedLocationString.c_str());
} }
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
} }
ImGui::SameLine(); ImGui::SameLine();
ImGui::Text("%s", Rando::StaticData::GetLocation(location)->GetShortName().c_str()); ImGui::Text("%s", Rando::StaticData::GetLocation(location)->GetShortName().c_str());
@ -1970,13 +1971,13 @@ void RandomizerSettingsWindow::DrawElement() {
tricksTabOpen = true; tricksTabOpen = true;
//RandomizerTricks::UpdateImGuiVisibility(); //RandomizerTricks::UpdateImGuiVisibility();
// todo: this efficently when we build out cvar array support // todo: this efficently when we build out cvar array support
std::stringstream enabledTrickStringStream(CVarGetString("gRandomizeEnabledTricks", "")); std::stringstream enabledTrickStringStream(CVarGetString(CVAR_RANDOMIZER_SETTING("EnabledTricks"), ""));
std::string enabledTrickString; std::string enabledTrickString;
enabledTricks.clear(); enabledTricks.clear();
while (getline(enabledTrickStringStream, enabledTrickString, ',')) { while (getline(enabledTrickStringStream, enabledTrickString, ',')) {
enabledTricks.insert((RandomizerTrick)std::stoi(enabledTrickString)); enabledTricks.insert((RandomizerTrick)std::stoi(enabledTrickString));
} }
std::stringstream enabledGlitchStringStream(CVarGetString("gRandomizeEnabledGlitches", "")); std::stringstream enabledGlitchStringStream(CVarGetString(CVAR_RANDOMIZER_SETTING("EnabledGlitches"), ""));
std::string enabledGlitchString; std::string enabledGlitchString;
enabledGlitches.clear(); enabledGlitches.clear();
while (getline(enabledGlitchStringStream, enabledGlitchString, ',')) { while (getline(enabledGlitchStringStream, enabledGlitchString, ',')) {
@ -1994,13 +1995,13 @@ void RandomizerSettingsWindow::DrawElement() {
mNeedsUpdate = true; mNeedsUpdate = true;
} }
// RANDOTODO: Implement Disalbling of Options for Vanilla Logic // RANDOTODO: Implement Disalbling of Options for Vanilla Logic
if (CVarGetInteger("gRandomizeLogicRules", RO_LOGIC_GLITCHLESS) == RO_LOGIC_GLITCHLESS) { if (CVarGetInteger(CVAR_RANDOMIZER_SETTING("LogicRules"), RO_LOGIC_GLITCHLESS) == RO_LOGIC_GLITCHLESS) {
ImGui::SameLine(); ImGui::SameLine();
if (mSettings->GetOption(RSK_ALL_LOCATIONS_REACHABLE).RenderImGui()) { if (mSettings->GetOption(RSK_ALL_LOCATIONS_REACHABLE).RenderImGui()) {
mNeedsUpdate = true; mNeedsUpdate = true;
} }
} }
if (CVarGetInteger("gRandomizeLogicRules", RO_LOGIC_GLITCHLESS) == RO_LOGIC_VANILLA) { if (CVarGetInteger(CVAR_RANDOMIZER_SETTING("LogicRules"), RO_LOGIC_GLITCHLESS) == RO_LOGIC_VANILLA) {
ImGui::SameLine(); ImGui::SameLine();
ImGui::TextColored(ImVec4(1.0f, 0.0f, 0.0f, 1.0f), "Heads up! This will disable all rando settings except for entrance shuffle and starter items"); ImGui::TextColored(ImVec4(1.0f, 0.0f, 0.0f, 1.0f), "Heads up! This will disable all rando settings except for entrance shuffle and starter items");
} }
@ -2015,7 +2016,7 @@ void RandomizerSettingsWindow::DrawElement() {
ImGui::EndTable(); ImGui::EndTable();
} }
ImGui::BeginDisabled(CVarGetInteger("gRandomizeLogicRules", RO_LOGIC_GLITCHLESS) == RO_LOGIC_VANILLA); ImGui::BeginDisabled(CVarGetInteger(CVAR_RANDOMIZER_SETTING("LogicRules"), RO_LOGIC_GLITCHLESS) == RO_LOGIC_VANILLA);
// Tricks // Tricks
static std::unordered_map<RandomizerArea, bool> areaTreeDisabled { static std::unordered_map<RandomizerArea, bool> areaTreeDisabled {
@ -2098,7 +2099,7 @@ void RandomizerSettingsWindow::DrawElement() {
}; };
static ImGuiTextFilter trickSearch; static ImGuiTextFilter trickSearch;
trickSearch.Draw("Filter (inc,-exc)", 490.0f); trickSearch.Draw("Filter (inc,-exc)", 490.0f);
if (CVarGetInteger("gRandomizeLogicRules", RO_LOGIC_GLITCHLESS) != RO_LOGIC_NO_LOGIC) { if (CVarGetInteger(CVAR_RANDOMIZER_SETTING("LogicRules"), RO_LOGIC_GLITCHLESS) != RO_LOGIC_NO_LOGIC) {
ImGui::SameLine(); ImGui::SameLine();
if (ImGui::Button("Disable All")) { if (ImGui::Button("Disable All")) {
for (int i = 0; i < RT_MAX; i++) { for (int i = 0; i < RT_MAX; i++) {
@ -2112,8 +2113,8 @@ void RandomizerSettingsWindow::DrawElement() {
enabledTrickString += std::to_string(enabledTrickIt); enabledTrickString += std::to_string(enabledTrickIt);
enabledTrickString += ","; enabledTrickString += ",";
} }
CVarClear("gRandomizeEnabledTricks"); CVarClear(CVAR_RANDOMIZER_SETTING("EnabledTricks"));
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
} }
ImGui::SameLine(); ImGui::SameLine();
if (ImGui::Button("Enable All")) { if (ImGui::Button("Enable All")) {
@ -2127,8 +2128,8 @@ void RandomizerSettingsWindow::DrawElement() {
enabledTrickString += std::to_string(enabledTrickIt); enabledTrickString += std::to_string(enabledTrickIt);
enabledTrickString += ","; enabledTrickString += ",";
} }
CVarSetString("gRandomizeEnabledTricks", enabledTrickString.c_str()); CVarSetString(CVAR_RANDOMIZER_SETTING("EnabledTricks"), enabledTrickString.c_str());
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
} }
} }
if (ImGui::BeginTable("trickTags", showTag.size(), ImGuiTableFlags_Resizable | ImGuiTableFlags_NoSavedSettings | ImGuiTableFlags_Borders)) { if (ImGui::BeginTable("trickTags", showTag.size(), ImGuiTableFlags_Resizable | ImGuiTableFlags_NoSavedSettings | ImGuiTableFlags_Borders)) {
@ -2149,7 +2150,7 @@ void RandomizerSettingsWindow::DrawElement() {
ImGui::PopItemFlag(); ImGui::PopItemFlag();
ImGui::TableNextRow(); ImGui::TableNextRow();
if (CVarGetInteger("gRandomizeLogicRules", RO_LOGIC_GLITCHLESS) != RO_LOGIC_NO_LOGIC) { if (CVarGetInteger(CVAR_RANDOMIZER_SETTING("LogicRules"), RO_LOGIC_GLITCHLESS) != RO_LOGIC_NO_LOGIC) {
// COLUMN 1 - DISABLED TRICKS // COLUMN 1 - DISABLED TRICKS
ImGui::TableNextColumn(); ImGui::TableNextColumn();
@ -2190,8 +2191,8 @@ void RandomizerSettingsWindow::DrawElement() {
enabledTrickString += std::to_string(enabledTrickIt); enabledTrickString += std::to_string(enabledTrickIt);
enabledTrickString += ","; enabledTrickString += ",";
} }
CVarSetString("gRandomizeEnabledTricks", enabledTrickString.c_str()); CVarSetString(CVAR_RANDOMIZER_SETTING("EnabledTricks"), enabledTrickString.c_str());
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
} }
ImGui::BeginChild("ChildTricksDisabled", ImVec2(0, -8), false, ImGuiWindowFlags_HorizontalScrollbar); ImGui::BeginChild("ChildTricksDisabled", ImVec2(0, -8), false, ImGuiWindowFlags_HorizontalScrollbar);
@ -2225,8 +2226,8 @@ void RandomizerSettingsWindow::DrawElement() {
enabledTrickString += std::to_string(enabledTrickIt); enabledTrickString += std::to_string(enabledTrickIt);
enabledTrickString += ","; enabledTrickString += ",";
} }
CVarSetString("gRandomizeEnabledTricks", enabledTrickString.c_str()); CVarSetString(CVAR_RANDOMIZER_SETTING("EnabledTricks"), enabledTrickString.c_str());
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
} }
Rando::Tricks::DrawTagChips(option.GetTags()); Rando::Tricks::DrawTagChips(option.GetTags());
ImGui::SameLine(); ImGui::SameLine();
@ -2284,8 +2285,8 @@ void RandomizerSettingsWindow::DrawElement() {
enabledTrickString += std::to_string(enabledTrickIt); enabledTrickString += std::to_string(enabledTrickIt);
enabledTrickString += ","; enabledTrickString += ",";
} }
CVarClear("gRandomizeEnabledTricks"); CVarClear(CVAR_RANDOMIZER_SETTING("EnabledTricks"));
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
} }
ImGui::BeginChild("ChildTricksEnabled", ImVec2(0, -8), false, ImGuiWindowFlags_HorizontalScrollbar); ImGui::BeginChild("ChildTricksEnabled", ImVec2(0, -8), false, ImGuiWindowFlags_HorizontalScrollbar);
@ -2320,9 +2321,9 @@ void RandomizerSettingsWindow::DrawElement() {
enabledTrickString += ","; enabledTrickString += ",";
} }
if (enabledTrickString == "") { if (enabledTrickString == "") {
CVarClear("gRandomizeEnabledTricks"); CVarClear(CVarClear(CVAR_RANDOMIZER_SETTING("EnabledTricks"));
} else { } else {
CVarSetString("gRandomizeEnabledTricks", enabledTrickString.c_str()); CVarSetString(CVarSetString(CVAR_RANDOMIZER_SETTING("EnabledTricks"), enabledTrickString.c_str());
} }
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
} }

View File

@ -5,6 +5,7 @@
#include <string> #include <string>
#include <libultraship/bridge.h> #include <libultraship/bridge.h>
#include "z64.h" #include "z64.h"
#include "soh/OTRGlobals.h"
#include "fishsanity.h" #include "fishsanity.h"
std::map<RandomizerCheckArea, std::string> rcAreaNames = { std::map<RandomizerCheckArea, std::string> rcAreaNames = {
@ -111,36 +112,36 @@ void RandomizerCheckObjects::UpdateImGuiVisibility() {
(location.GetRandomizerCheck() != RC_UNKNOWN_CHECK) && (location.GetRandomizerCheck() != RC_UNKNOWN_CHECK) &&
(!RandomizerCheckObjects::AreaIsDungeon(location.GetArea()) || location.GetQuest() == RCQUEST_BOTH || (!RandomizerCheckObjects::AreaIsDungeon(location.GetArea()) || location.GetQuest() == RCQUEST_BOTH ||
location.GetQuest() == RCQUEST_MQ && location.GetQuest() == RCQUEST_MQ &&
((CVarGetInteger("gRandomizeMqDungeons", RO_MQ_DUNGEONS_NONE) == RO_MQ_DUNGEONS_SET_NUMBER && ((CVarGetInteger(CVAR_RANDOMIZER_SETTING("MqDungeons"), RO_MQ_DUNGEONS_NONE) == RO_MQ_DUNGEONS_SET_NUMBER &&
(CVarGetInteger("gRandomizeMqDungeonCount", 12) > 0) || // at least one MQ dungeon (CVarGetInteger(CVAR_RANDOMIZER_SETTING("MqDungeonCount"), 12) > 0) || // at least one MQ dungeon
CVarGetInteger("gRandomizeMqDungeons", RO_MQ_DUNGEONS_NONE) == RO_MQ_DUNGEONS_RANDOM_NUMBER)) || CVarGetInteger(CVAR_RANDOMIZER_SETTING("MqDungeons"), RO_MQ_DUNGEONS_NONE) == RO_MQ_DUNGEONS_RANDOM_NUMBER)) ||
location.GetQuest() == RCQUEST_VANILLA && location.GetQuest() == RCQUEST_VANILLA &&
(CVarGetInteger("gRandomizeMqDungeons", RO_MQ_DUNGEONS_NONE) != RO_MQ_DUNGEONS_SET_NUMBER || (CVarGetInteger(CVAR_RANDOMIZER_SETTING("MqDungeons"), RO_MQ_DUNGEONS_NONE) != RO_MQ_DUNGEONS_SET_NUMBER ||
CVarGetInteger("gRandomizeMqDungeonCount", 12) < 12) // at least one vanilla dungeon CVarGetInteger(CVAR_RANDOMIZER_SETTING("MqDungeonCount"), 12) < 12) // at least one vanilla dungeon
) && ) &&
(location.GetRCType() != RCTYPE_SHOP || (location.GetRCType() != RCTYPE_SHOP ||
CVarGetInteger("gRandomizeShopsanity", RO_SHOPSANITY_OFF) > RO_SHOPSANITY_ZERO_ITEMS) && CVarGetInteger(CVAR_RANDOMIZER_SETTING("Shopsanity"), RO_SHOPSANITY_OFF) > RO_SHOPSANITY_ZERO_ITEMS) &&
(location.GetRCType() != RCTYPE_SCRUB || (location.GetRCType() != RCTYPE_SCRUB ||
CVarGetInteger("gRandomizeShuffleScrubs", RO_SCRUBS_OFF) != RO_SCRUBS_OFF || CVarGetInteger(CVAR_RANDOMIZER_SETTING("ShuffleScrubs"), RO_SCRUBS_OFF) != RO_SCRUBS_OFF ||
location.GetRandomizerCheck() == RC_HF_DEKU_SCRUB_GROTTO || location.GetRandomizerCheck() == RC_HF_DEKU_SCRUB_GROTTO ||
location.GetRandomizerCheck() == RC_LW_DEKU_SCRUB_GROTTO_FRONT || location.GetRandomizerCheck() == RC_LW_DEKU_SCRUB_GROTTO_FRONT ||
location.GetRandomizerCheck() == location.GetRandomizerCheck() ==
RC_LW_DEKU_SCRUB_NEAR_BRIDGE) && // The 3 scrubs that are always randomized RC_LW_DEKU_SCRUB_NEAR_BRIDGE) && // The 3 scrubs that are always randomized
(location.GetRCType() != RCTYPE_MERCHANT || (location.GetRCType() != RCTYPE_MERCHANT ||
CVarGetInteger("gRandomizeShuffleMerchants", RO_SHUFFLE_MERCHANTS_OFF) != RO_SHUFFLE_MERCHANTS_OFF) && CVarGetInteger(CVAR_RANDOMIZER_SETTING("ShuffleMerchants"), RO_SHUFFLE_MERCHANTS_OFF) != RO_SHUFFLE_MERCHANTS_OFF) &&
(location.GetRCType() != RCTYPE_SONG_LOCATION || (location.GetRCType() != RCTYPE_SONG_LOCATION ||
CVarGetInteger("gRandomizeShuffleSongs", RO_SONG_SHUFFLE_SONG_LOCATIONS) != CVarGetInteger(CVAR_RANDOMIZER_SETTING("ShuffleSongs"), RO_SONG_SHUFFLE_SONG_LOCATIONS) !=
RO_SONG_SHUFFLE_SONG_LOCATIONS) && // song locations RO_SONG_SHUFFLE_SONG_LOCATIONS) && // song locations
((location.GetRCType() != RCTYPE_BOSS_HEART_OR_OTHER_REWARD && ((location.GetRCType() != RCTYPE_BOSS_HEART_OR_OTHER_REWARD &&
location.GetRandomizerCheck() != RC_SONG_FROM_IMPA && location.GetRandomizerCheck() != RC_SONG_FROM_IMPA &&
location.GetRandomizerCheck() != RC_SHEIK_IN_ICE_CAVERN) || location.GetRandomizerCheck() != RC_SHEIK_IN_ICE_CAVERN) ||
CVarGetInteger("gRandomizeShuffleSongs", RO_SONG_SHUFFLE_SONG_LOCATIONS) != CVarGetInteger(CVAR_RANDOMIZER_SETTING("ShuffleSongs"), RO_SONG_SHUFFLE_SONG_LOCATIONS) !=
RO_SONG_SHUFFLE_DUNGEON_REWARDS) && // song dungeon rewards RO_SONG_SHUFFLE_DUNGEON_REWARDS) && // song dungeon rewards
(location.GetRCType() != RCTYPE_DUNGEON_REWARD || (location.GetRCType() != RCTYPE_DUNGEON_REWARD ||
CVarGetInteger("gRandomizeShuffleDungeonReward", RO_DUNGEON_REWARDS_END_OF_DUNGEON) != CVarGetInteger(CVAR_RANDOMIZER_SETTING("ShuffleDungeonReward"), RO_DUNGEON_REWARDS_END_OF_DUNGEON) !=
RO_DUNGEON_REWARDS_END_OF_DUNGEON) && // dungeon rewards end of dungeons RO_DUNGEON_REWARDS_END_OF_DUNGEON) && // dungeon rewards end of dungeons
(location.GetRCType() != RCTYPE_OCARINA || (location.GetRCType() != RCTYPE_OCARINA ||
CVarGetInteger("gRandomizeShuffleOcarinas", RO_GENERIC_NO)) && // ocarina locations CVarGetInteger(CVAR_RANDOMIZER_SETTING("ShuffleOcarinas"), RO_GENERIC_NO)) && // ocarina locations
(location.GetRandomizerCheck() != RC_HC_ZELDAS_LETTER) && // don't show until we support shuffling letter (location.GetRandomizerCheck() != RC_HC_ZELDAS_LETTER) && // don't show until we support shuffling letter
(location.GetRCType() != (location.GetRCType() !=
RCTYPE_GOSSIP_STONE) && // don't show gossip stones (maybe gossipsanity will be a thing eventually?) RCTYPE_GOSSIP_STONE) && // don't show gossip stones (maybe gossipsanity will be a thing eventually?)
@ -148,63 +149,63 @@ void RandomizerCheckObjects::UpdateImGuiVisibility() {
(location.GetRCType() != (location.GetRCType() !=
RCTYPE_CHEST_GAME) && // don't show non final reward chest game checks until we support shuffling them RCTYPE_CHEST_GAME) && // don't show non final reward chest game checks until we support shuffling them
(location.GetRCType() != RCTYPE_SKULL_TOKEN || (location.GetRCType() != RCTYPE_SKULL_TOKEN ||
(CVarGetInteger("gRandomizeShuffleTokens", RO_TOKENSANITY_OFF) == RO_TOKENSANITY_ALL) || (CVarGetInteger(CVAR_RANDOMIZER_SETTING("ShuffleTokens"), RO_TOKENSANITY_OFF) == RO_TOKENSANITY_ALL) ||
((CVarGetInteger("gRandomizeShuffleTokens", RO_TOKENSANITY_OFF) == RO_TOKENSANITY_OVERWORLD) && ((CVarGetInteger(CVAR_RANDOMIZER_SETTING("ShuffleTokens"), RO_TOKENSANITY_OFF) == RO_TOKENSANITY_OVERWORLD) &&
RandomizerCheckObjects::AreaIsOverworld(location.GetArea())) || RandomizerCheckObjects::AreaIsOverworld(location.GetArea())) ||
((CVarGetInteger("gRandomizeShuffleTokens", RO_TOKENSANITY_OFF) == RO_TOKENSANITY_DUNGEONS) && ((CVarGetInteger(CVAR_RANDOMIZER_SETTING("ShuffleTokens"), RO_TOKENSANITY_OFF) == RO_TOKENSANITY_DUNGEONS) &&
RandomizerCheckObjects::AreaIsDungeon(location.GetArea()))) && RandomizerCheckObjects::AreaIsDungeon(location.GetArea()))) &&
(location.GetRCType() != RCTYPE_BEEHIVE || CVarGetInteger("gRandomizeShuffleBeehives", RO_GENERIC_NO)) && (location.GetRCType() != RCTYPE_BEEHIVE || CVarGetInteger(CVAR_RANDOMIZER_SETTING("ShuffleBeehives"), RO_GENERIC_NO)) &&
(location.GetRCType() != RCTYPE_COW || CVarGetInteger("gRandomizeShuffleCows", RO_GENERIC_NO)) && (location.GetRCType() != RCTYPE_COW || CVarGetInteger(CVAR_RANDOMIZER_SETTING("ShuffleCows"), RO_GENERIC_NO)) &&
(location.GetRCType() != RCTYPE_FISH || ctx->GetFishsanity()->GetFishLocationIncluded(&location, FSO_SOURCE_CVARS)) && (location.GetRCType() != RCTYPE_FISH || ctx->GetFishsanity()->GetFishLocationIncluded(&location, FSO_SOURCE_CVARS)) &&
(location.GetRCType() != RCTYPE_ADULT_TRADE || (location.GetRCType() != RCTYPE_ADULT_TRADE ||
CVarGetInteger("gRandomizeShuffleAdultTrade", RO_GENERIC_NO)) && CVarGetInteger(CVAR_RANDOMIZER_SETTING("ShuffleAdultTrade"), RO_GENERIC_NO)) &&
(location.GetRandomizerCheck() != RC_KF_KOKIRI_SWORD_CHEST || (location.GetRandomizerCheck() != RC_KF_KOKIRI_SWORD_CHEST ||
CVarGetInteger("gRandomizeShuffleKokiriSword", RO_GENERIC_NO)) && CVarGetInteger(CVAR_RANDOMIZER_SETTING("ShuffleKokiriSword"), RO_GENERIC_NO)) &&
(location.GetRandomizerCheck() != RC_ZR_MAGIC_BEAN_SALESMAN || (location.GetRandomizerCheck() != RC_ZR_MAGIC_BEAN_SALESMAN ||
CVarGetInteger("gRandomizeShuffleBeans", RO_GENERIC_NO)) && CVarGetInteger(CVAR_RANDOMIZER_SETTING("ShuffleBeans"), RO_GENERIC_NO)) &&
(location.GetRandomizerCheck() != RC_HC_MALON_EGG || (location.GetRandomizerCheck() != RC_HC_MALON_EGG ||
CVarGetInteger("gRandomizeShuffleWeirdEgg", RO_GENERIC_NO)) && CVarGetInteger(CVAR_RANDOMIZER_SETTING("ShuffleWeirdEgg"), RO_GENERIC_NO)) &&
(location.GetRCType() != RCTYPE_FROG_SONG || (location.GetRCType() != RCTYPE_FROG_SONG ||
CVarGetInteger("gRandomizeShuffleFrogSongRupees", RO_GENERIC_NO)) && CVarGetInteger(CVAR_RANDOMIZER_SETTING("ShuffleFrogSongRupees"), RO_GENERIC_NO)) &&
(location.GetRCType() != RCTYPE_MAP_COMPASS || (location.GetRCType() != RCTYPE_MAP_COMPASS ||
CVarGetInteger("gRandomizeStartingMapsCompasses", RO_DUNGEON_ITEM_LOC_OWN_DUNGEON) != CVarGetInteger(CVAR_RANDOMIZER_SETTING("StartingMapsCompasses"), RO_DUNGEON_ITEM_LOC_OWN_DUNGEON) !=
RO_DUNGEON_ITEM_LOC_VANILLA) && RO_DUNGEON_ITEM_LOC_VANILLA) &&
(location.GetRCType() != RCTYPE_SMALL_KEY || (location.GetRCType() != RCTYPE_SMALL_KEY ||
CVarGetInteger("gRandomizeKeysanity", RO_DUNGEON_ITEM_LOC_OWN_DUNGEON) != RO_DUNGEON_ITEM_LOC_VANILLA) && CVarGetInteger(CVAR_RANDOMIZER_SETTING("Keysanity"), RO_DUNGEON_ITEM_LOC_OWN_DUNGEON) != RO_DUNGEON_ITEM_LOC_VANILLA) &&
(location.GetRCType() != RCTYPE_BOSS_KEY || (location.GetRCType() != RCTYPE_BOSS_KEY ||
CVarGetInteger("gRandomizeBossKeysanity", RO_DUNGEON_ITEM_LOC_OWN_DUNGEON) != CVarGetInteger(CVAR_RANDOMIZER_SETTING("BossKeysanity"), RO_DUNGEON_ITEM_LOC_OWN_DUNGEON) !=
RO_DUNGEON_ITEM_LOC_VANILLA) && RO_DUNGEON_ITEM_LOC_VANILLA) &&
(location.GetRCType() != RCTYPE_GANON_BOSS_KEY || (location.GetRCType() != RCTYPE_GANON_BOSS_KEY ||
CVarGetInteger("gRandomizeShuffleGanonBossKey", RO_GANON_BOSS_KEY_VANILLA) != CVarGetInteger(CVAR_RANDOMIZER_SETTING("ShuffleGanonBossKey"), RO_GANON_BOSS_KEY_VANILLA) !=
RO_GANON_BOSS_KEY_VANILLA) && // vanilla ganon boss key RO_GANON_BOSS_KEY_VANILLA) && // vanilla ganon boss key
(location.GetRandomizerCheck() != RC_TOT_LIGHT_ARROWS_CUTSCENE || (location.GetRandomizerCheck() != RC_TOT_LIGHT_ARROWS_CUTSCENE ||
(CVarGetInteger("gRandomizeShuffleGanonBossKey", RO_GANON_BOSS_KEY_VANILLA) != (CVarGetInteger(CVAR_RANDOMIZER_SETTING("ShuffleGanonBossKey"), RO_GANON_BOSS_KEY_VANILLA) !=
RO_GANON_BOSS_KEY_LACS_DUNGEONS && RO_GANON_BOSS_KEY_LACS_DUNGEONS &&
CVarGetInteger("gRandomizeShuffleGanonBossKey", RO_GANON_BOSS_KEY_VANILLA) != CVarGetInteger(CVAR_RANDOMIZER_SETTING("ShuffleGanonBossKey"), RO_GANON_BOSS_KEY_VANILLA) !=
RO_GANON_BOSS_KEY_LACS_MEDALLIONS && RO_GANON_BOSS_KEY_LACS_MEDALLIONS &&
CVarGetInteger("gRandomizeShuffleGanonBossKey", RO_GANON_BOSS_KEY_VANILLA) != CVarGetInteger(CVAR_RANDOMIZER_SETTING("ShuffleGanonBossKey"), RO_GANON_BOSS_KEY_VANILLA) !=
RO_GANON_BOSS_KEY_LACS_REWARDS && RO_GANON_BOSS_KEY_LACS_REWARDS &&
CVarGetInteger("gRandomizeShuffleGanonBossKey", RO_GANON_BOSS_KEY_VANILLA) != CVarGetInteger(CVAR_RANDOMIZER_SETTING("ShuffleGanonBossKey"), RO_GANON_BOSS_KEY_VANILLA) !=
RO_GANON_BOSS_KEY_LACS_STONES && RO_GANON_BOSS_KEY_LACS_STONES &&
CVarGetInteger("gRandomizeShuffleGanonBossKey", RO_GANON_BOSS_KEY_VANILLA) != CVarGetInteger(CVAR_RANDOMIZER_SETTING("ShuffleGanonBossKey"), RO_GANON_BOSS_KEY_VANILLA) !=
RO_GANON_BOSS_KEY_LACS_TOKENS && RO_GANON_BOSS_KEY_LACS_TOKENS &&
CVarGetInteger("gRandomizeShuffleGanonBossKey", RO_GANON_BOSS_KEY_VANILLA) != CVarGetInteger(CVAR_RANDOMIZER_SETTING("ShuffleGanonBossKey"), RO_GANON_BOSS_KEY_VANILLA) !=
RO_GANON_BOSS_KEY_LACS_VANILLA)) && // LACS ganon boss key RO_GANON_BOSS_KEY_LACS_VANILLA)) && // LACS ganon boss key
(location.GetRandomizerCheck() != RC_KAK_100_GOLD_SKULLTULA_REWARD || (location.GetRandomizerCheck() != RC_KAK_100_GOLD_SKULLTULA_REWARD ||
CVarGetInteger("gRandomizeShuffleGanonBossKey", RO_GANON_BOSS_KEY_VANILLA) != CVarGetInteger(CVAR_RANDOMIZER_SETTING("ShuffleGanonBossKey"), RO_GANON_BOSS_KEY_VANILLA) !=
RO_GANON_BOSS_KEY_KAK_TOKENS) && // 100 skull reward ganon boss key RO_GANON_BOSS_KEY_KAK_TOKENS) && // 100 skull reward ganon boss key
(location.GetRCType() != RCTYPE_GF_KEY && location.GetRandomizerCheck() != RC_GF_GERUDO_MEMBERSHIP_CARD || (location.GetRCType() != RCTYPE_GF_KEY && location.GetRandomizerCheck() != RC_GF_GERUDO_MEMBERSHIP_CARD ||
(CVarGetInteger("gRandomizeGerudoFortress", RO_GF_NORMAL) == RO_GF_OPEN && (CVarGetInteger(CVAR_RANDOMIZER_SETTING("GerudoFortress"), RO_GF_NORMAL) == RO_GF_OPEN &&
location.GetRCType() != RCTYPE_GF_KEY && location.GetRandomizerCheck() != RC_GF_GERUDO_MEMBERSHIP_CARD) || location.GetRCType() != RCTYPE_GF_KEY && location.GetRandomizerCheck() != RC_GF_GERUDO_MEMBERSHIP_CARD) ||
(CVarGetInteger("gRandomizeGerudoFortress", RO_GF_NORMAL) == RO_GF_FAST && (CVarGetInteger(CVAR_RANDOMIZER_SETTING("GerudoFortress"), RO_GF_NORMAL) == RO_GF_FAST &&
((location.GetRandomizerCheck() == RC_GF_GERUDO_MEMBERSHIP_CARD && ((location.GetRandomizerCheck() == RC_GF_GERUDO_MEMBERSHIP_CARD &&
CVarGetInteger("gRandomizeShuffleGerudoToken", RO_GENERIC_NO) == RO_GENERIC_YES) || CVarGetInteger(CVAR_RANDOMIZER_SETTING("ShuffleGerudoToken"), RO_GENERIC_NO) == RO_GENERIC_YES) ||
(location.GetRandomizerCheck() == RC_GF_NORTH_F1_CARPENTER && (location.GetRandomizerCheck() == RC_GF_NORTH_F1_CARPENTER &&
CVarGetInteger("gRandomizeGerudoKeys", RO_GERUDO_KEYS_VANILLA) != RO_GERUDO_KEYS_VANILLA))) || CVarGetInteger(CVAR_RANDOMIZER_SETTING("GerudoKeys"), RO_GERUDO_KEYS_VANILLA) != RO_GERUDO_KEYS_VANILLA))) ||
(CVarGetInteger("gRandomizeGerudoFortress", RO_GF_NORMAL) == RO_GF_NORMAL && (CVarGetInteger(CVAR_RANDOMIZER_SETTING("GerudoFortress"), RO_GF_NORMAL) == RO_GF_NORMAL &&
((location.GetRandomizerCheck() == RC_GF_GERUDO_MEMBERSHIP_CARD && ((location.GetRandomizerCheck() == RC_GF_GERUDO_MEMBERSHIP_CARD &&
CVarGetInteger("gRandomizeShuffleGerudoToken", RO_GENERIC_NO) == RO_GENERIC_YES) || CVarGetInteger(CVAR_RANDOMIZER_SETTING("ShuffleGerudoToken"), RO_GENERIC_NO) == RO_GENERIC_YES) ||
(location.GetRCType() == RCTYPE_GF_KEY && (location.GetRCType() == RCTYPE_GF_KEY &&
CVarGetInteger("gRandomizeGerudoKeys", RO_GERUDO_KEYS_VANILLA) != RO_GERUDO_KEYS_VANILLA))))); CVarGetInteger(CVAR_RANDOMIZER_SETTING("GerudoKeys"), RO_GERUDO_KEYS_VANILLA) != RO_GERUDO_KEYS_VANILLA)))));
} }
} }

View File

@ -37,9 +37,9 @@ using json = nlohmann::json;
void to_json(json& j, const RandomizerCheckTrackerData& rctd) { void to_json(json& j, const RandomizerCheckTrackerData& rctd) {
j = json { j = json {
{ "status", rctd.status == RCSHOW_COLLECTED ? RCSHOW_SAVED : rctd.status }, { "status", rctd.status == RCSHOW_COLLECTED ? RCSHOW_SAVED : rctd.status },
{ "skipped", rctd.skipped }, { "skipped", rctd.skipped },
{ "price", rctd.price }, { "price", rctd.price },
{ "hintItem", rctd.hintItem }}; { "hintItem", rctd.hintItem }};
} }
@ -144,6 +144,8 @@ RandomizerCheckArea currentArea = RCAREA_INVALID;
OSContPad* trackerButtonsPressed; OSContPad* trackerButtonsPressed;
std::unordered_map<RandomizerCheck, std::string> checkNameOverrides; std::unordered_map<RandomizerCheck, std::string> checkNameOverrides;
bool passesTextFilter(ImGuiTextFilter& checkSearch, const RandomizerCheckObject rcObject);
bool shouldHideArea(ImGuiTextFilter& checkSearch, std::map<RandomizerCheckArea, std::vector<RandomizerCheckObject>> checksByArea, const RandomizerCheckArea rcArea);
void BeginFloatWindows(std::string UniqueName, bool& open, ImGuiWindowFlags flags = 0); void BeginFloatWindows(std::string UniqueName, bool& open, ImGuiWindowFlags flags = 0);
bool CompareChecks(RandomizerCheck, RandomizerCheck); bool CompareChecks(RandomizerCheck, RandomizerCheck);
bool CheckByArea(RandomizerCheckArea); bool CheckByArea(RandomizerCheckArea);
@ -458,7 +460,7 @@ bool HasItemBeenCollected(RandomizerCheck rc) {
case SpoilerCollectionCheckType::SPOILER_CHK_GRAVEDIGGER: case SpoilerCollectionCheckType::SPOILER_CHK_GRAVEDIGGER:
// Gravedigger has a fix in place that means one of two save locations. Check both. // Gravedigger has a fix in place that means one of two save locations. Check both.
return (gSaveContext.itemGetInf[1] & 0x1000) || // vanilla flag return (gSaveContext.itemGetInf[1] & 0x1000) || // vanilla flag
((IS_RANDO || CVarGetInteger("gGravediggingTourFix", 0)) && ((IS_RANDO || CVarGetInteger(CVAR_ENHANCEMENT("GravediggingTourFix"), 0)) &&
gSaveContext.sceneFlags[scene].collect & (1 << flag) || (gPlayState->actorCtx.flags.collect & (1 << flag))); // rando/fix flag gSaveContext.sceneFlags[scene].collect & (1 << flag) || (gPlayState->actorCtx.flags.collect & (1 << flag))); // rando/fix flag
default: default:
return false; return false;
@ -864,12 +866,12 @@ void SetAreaSpoiled(RandomizerCheckArea rcArea) {
void UpdateCheck(uint32_t check, RandomizerCheckTrackerData data) { void UpdateCheck(uint32_t check, RandomizerCheckTrackerData data) {
auto area = Rando::StaticData::GetLocation(static_cast<RandomizerCheck>(check))->GetArea(); auto area = Rando::StaticData::GetLocation(static_cast<RandomizerCheck>(check))->GetArea();
if ((!gSaveContext.checkTrackerData[check].skipped && data.skipped) || if ((!gSaveContext.checkTrackerData[check].skipped && data.skipped) ||
((gSaveContext.checkTrackerData[check].status != RCSHOW_COLLECTED && gSaveContext.checkTrackerData[check].status != RCSHOW_SAVED) && ((gSaveContext.checkTrackerData[check].status != RCSHOW_COLLECTED && gSaveContext.checkTrackerData[check].status != RCSHOW_SAVED) &&
(data.status == RCSHOW_COLLECTED || data.status == RCSHOW_SAVED))) { (data.status == RCSHOW_COLLECTED || data.status == RCSHOW_SAVED))) {
areaChecksGotten[area]++; areaChecksGotten[area]++;
} else if ((gSaveContext.checkTrackerData[check].skipped && !data.skipped) || } else if ((gSaveContext.checkTrackerData[check].skipped && !data.skipped) ||
((gSaveContext.checkTrackerData[check].status == RCSHOW_COLLECTED || gSaveContext.checkTrackerData[check].status == RCSHOW_SAVED) && ((gSaveContext.checkTrackerData[check].status == RCSHOW_COLLECTED || gSaveContext.checkTrackerData[check].status == RCSHOW_SAVED) &&
(data.status != RCSHOW_COLLECTED && data.status != RCSHOW_SAVED))) { (data.status != RCSHOW_COLLECTED && data.status != RCSHOW_SAVED))) {
areaChecksGotten[area]--; areaChecksGotten[area]--;
} }
@ -880,15 +882,15 @@ void UpdateCheck(uint32_t check, RandomizerCheckTrackerData data) {
void CheckTrackerWindow::DrawElement() { void CheckTrackerWindow::DrawElement() {
ImGui::SetNextWindowSize(ImVec2(400, 540), ImGuiCond_FirstUseEver); ImGui::SetNextWindowSize(ImVec2(400, 540), ImGuiCond_FirstUseEver);
if (CVarGetInteger("gCheckTrackerWindowType", TRACKER_WINDOW_WINDOW) == TRACKER_WINDOW_FLOATING) { if (CVarGetInteger(CVAR_TRACKER_CHECK("WindowType"), TRACKER_WINDOW_WINDOW) == TRACKER_WINDOW_FLOATING) {
if (CVarGetInteger("gCheckTrackerShowOnlyPaused", 0) && (gPlayState == nullptr || gPlayState->pauseCtx.state == 0)) { if (CVarGetInteger(CVAR_TRACKER_CHECK("ShowOnlyPaused"), 0) && (gPlayState == nullptr || gPlayState->pauseCtx.state == 0)) {
return; return;
} }
if (CVarGetInteger("gCheckTrackerDisplayType", TRACKER_DISPLAY_ALWAYS) == TRACKER_DISPLAY_COMBO_BUTTON) { if (CVarGetInteger(CVAR_TRACKER_CHECK("DisplayType"), TRACKER_DISPLAY_ALWAYS) == TRACKER_DISPLAY_COMBO_BUTTON) {
int comboButton1Mask = buttons[CVarGetInteger("gCheckTrackerComboButton1", TRACKER_COMBO_BUTTON_L)]; int comboButton1Mask = buttons[CVarGetInteger(CVAR_TRACKER_CHECK("ComboButton1"), TRACKER_COMBO_BUTTON_L)];
int comboButton2Mask = buttons[CVarGetInteger("gCheckTrackerComboButton2", TRACKER_COMBO_BUTTON_R)]; int comboButton2Mask = buttons[CVarGetInteger(CVAR_TRACKER_CHECK("ComboButton2"), TRACKER_COMBO_BUTTON_R)];
OSContPad* trackerButtonsPressed = LUS::Context::GetInstance()->GetControlDeck()->GetPads(); OSContPad* trackerButtonsPressed = Ship::Context::GetInstance()->GetControlDeck()->GetPads();
bool comboButtonsHeld = trackerButtonsPressed != nullptr && bool comboButtonsHeld = trackerButtonsPressed != nullptr &&
trackerButtonsPressed[0].button & comboButton1Mask && trackerButtonsPressed[0].button & comboButton1Mask &&
trackerButtonsPressed[0].button & comboButton2Mask; trackerButtonsPressed[0].button & comboButton2Mask;
@ -927,7 +929,7 @@ void CheckTrackerWindow::DrawElement() {
ImGui::TableNextRow(0, headerHeight); ImGui::TableNextRow(0, headerHeight);
ImGui::TableNextColumn(); ImGui::TableNextColumn();
UIWidgets::EnhancementCheckbox( UIWidgets::EnhancementCheckbox(
"Show Hidden Items", "gCheckTrackerOptionShowHidden", false, "Show Hidden Items", CVAR_TRACKER_CHECK("ShowHidden"), false,
"When active, items will show hidden checks by default when updated to this state."); "When active, items will show hidden checks by default when updated to this state.");
UIWidgets::PaddedSeparator(); UIWidgets::PaddedSeparator();
if (ImGui::Button("Expand All")) { if (ImGui::Button("Expand All")) {
@ -940,6 +942,14 @@ void CheckTrackerWindow::DrawElement() {
optExpandAll = false; optExpandAll = false;
optCollapseAll = true; optCollapseAll = true;
} }
ImGui::SameLine();
static ImGuiTextFilter checkSearch;
if (ImGui::Button("Clear")) {
checkSearch.Clear();
}
UIWidgets::Tooltip("Clear the search field");
checkSearch.Draw();
UIWidgets::PaddedSeparator(); UIWidgets::PaddedSeparator();
//Checks Section Lead-in //Checks Section Lead-in
@ -958,17 +968,17 @@ void CheckTrackerWindow::DrawElement() {
RainbowTick(); RainbowTick();
bool doDraw = false; bool doDraw = false;
bool thisAreaFullyChecked = false; bool thisAreaFullyChecked = false;
bool showHidden = CVarGetInteger("gCheckTrackerOptionShowHidden", 0); bool showHidden = CVarGetInteger(CVAR_TRACKER_CHECK("ShowHidden"), 0);
bool hideIncomplete = CVarGetInteger("gCheckTrackerAreaIncompleteHide", 0); bool hideIncomplete = CVarGetInteger(CVAR_TRACKER_CHECK("AreaIncomplete.Hide"), 0);
bool hideComplete = CVarGetInteger("gCheckTrackerAreaCompleteHide", 0); bool hideComplete = CVarGetInteger(CVAR_TRACKER_CHECK("AreaComplete.Hide"), 0);
bool collapseLogic; bool collapseLogic;
bool doingCollapseOrExpand = optExpandAll || optCollapseAll; bool doingCollapseOrExpand = optExpandAll || optCollapseAll;
bool isThisAreaSpoiled; bool isThisAreaSpoiled;
RandomizerCheckArea lastArea = RCAREA_INVALID; RandomizerCheckArea lastArea = RCAREA_INVALID;
Color_RGBA8 areaCompleteColor = CVarGetColor("gCheckTrackerAreaMainCompleteColor", Color_Main_Default); Color_RGBA8 areaCompleteColor = CVarGetColor(CVAR_TRACKER_CHECK("AreaComplete.MainColor"), Color_Main_Default);
Color_RGBA8 areaIncompleteColor = CVarGetColor("gCheckTrackerAreaMainIncompleteColor", Color_Main_Default); Color_RGBA8 areaIncompleteColor = CVarGetColor(CVAR_TRACKER_CHECK("AreaIncomplete.MainColor"), Color_Main_Default);
Color_RGBA8 extraCompleteColor = CVarGetColor("gCheckTrackerAreaExtraCompleteColor", Color_Area_Complete_Extra_Default); Color_RGBA8 extraCompleteColor = CVarGetColor(CVAR_TRACKER_CHECK("AreaComplete.ExtraColor"), Color_Area_Complete_Extra_Default);
Color_RGBA8 extraIncompleteColor = CVarGetColor("gCheckTrackerAreaExtraIncompleteColor", Color_Area_Incomplete_Extra_Default); Color_RGBA8 extraIncompleteColor = CVarGetColor(CVAR_TRACKER_CHECK("AreaIncomplete.ExtraColor"), Color_Area_Incomplete_Extra_Default);
Color_RGBA8 mainColor; Color_RGBA8 mainColor;
Color_RGBA8 extraColor; Color_RGBA8 extraColor;
std::string stemp; std::string stemp;
@ -986,10 +996,9 @@ void CheckTrackerWindow::DrawElement() {
previousShowHidden = showHidden; previousShowHidden = showHidden;
doAreaScroll = true; doAreaScroll = true;
} }
if (!showHidden && ( if (shouldHideArea(checkSearch, checksByArea, rcArea) ||
hideComplete && thisAreaFullyChecked || (!showHidden && ((hideComplete && thisAreaFullyChecked) || (hideIncomplete && !thisAreaFullyChecked)))
hideIncomplete && !thisAreaFullyChecked ) {
)) {
doDraw = false; doDraw = false;
} else { } else {
//Get the colour for the area //Get the colour for the area
@ -1024,7 +1033,7 @@ void CheckTrackerWindow::DrawElement() {
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(extraColor.r / 255.0f, extraColor.g / 255.0f, ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(extraColor.r / 255.0f, extraColor.g / 255.0f,
extraColor.b / 255.0f, extraColor.a / 255.0f)); extraColor.b / 255.0f, extraColor.a / 255.0f));
isThisAreaSpoiled = IsAreaSpoiled(rcArea) || CVarGetInteger("gCheckTrackerOptionMQSpoilers", 0); isThisAreaSpoiled = IsAreaSpoiled(rcArea) || CVarGetInteger(CVAR_TRACKER_CHECK("MQSpoilers"), 0);
if (isThisAreaSpoiled) { if (isThisAreaSpoiled) {
if (showVOrMQ && RandomizerCheckObjects::AreaIsDungeon(rcArea)) { if (showVOrMQ && RandomizerCheckObjects::AreaIsDungeon(rcArea)) {
@ -1047,10 +1056,11 @@ void CheckTrackerWindow::DrawElement() {
doAreaScroll = false; doAreaScroll = false;
} }
for (auto rc : checks) { for (auto rc : checks) {
if (doDraw && isThisAreaSpoiled && IsVisibleInCheckTracker(rc)) { if (doDraw && isThisAreaSpoiled && IsVisibleInCheckTracker(rc) && passesTextFilter(checkSearch, rcObject)) {
DrawLocation(rc); DrawLocation(rc);
} }
} }
if (doDraw) { if (doDraw) {
ImGui::TreePop(); ImGui::TreePop();
} }
@ -1066,6 +1076,28 @@ void CheckTrackerWindow::DrawElement() {
} }
} }
bool shouldHideArea(ImGuiTextFilter& checkSearch, std::map<RandomizerCheckArea, std::vector<RandomizerCheckObject>> checksByArea, RandomizerCheckArea rcArea) {
bool shouldHideFilteredAreas = CVarGetInteger(CVAR_TRACKER_CHECK("HideFilteredAreas"), 1);
if (!shouldHideFilteredAreas) {
return false;
}
for (auto check : checksByArea[rcArea]) {
if (IsVisibleInCheckTracker(check) && passesTextFilter(checkSearch, check)) {
return false;
}
}
return true;
}
bool passesTextFilter(ImGuiTextFilter& checkSearch, RandomizerCheckObject check) {
return (
checkSearch.PassFilter(RandomizerCheckObjects::GetRCAreaName(check.rcArea).c_str()) ||
checkSearch.PassFilter(check.rcShortName.c_str())
);
}
// Windowing stuff // Windowing stuff
void BeginFloatWindows(std::string UniqueName, bool& open, ImGuiWindowFlags flags) { void BeginFloatWindows(std::string UniqueName, bool& open, ImGuiWindowFlags flags) {
ImGuiWindowFlags windowFlags = flags; ImGuiWindowFlags windowFlags = flags;
@ -1075,12 +1107,12 @@ void BeginFloatWindows(std::string UniqueName, bool& open, ImGuiWindowFlags flag
ImGuiWindowFlags_AlwaysVerticalScrollbar | ImGuiWindowFlags_NoFocusOnAppearing; ImGuiWindowFlags_AlwaysVerticalScrollbar | ImGuiWindowFlags_NoFocusOnAppearing;
} }
if (CVarGetInteger("gCheckTrackerWindowType", TRACKER_WINDOW_WINDOW) == TRACKER_WINDOW_FLOATING) { if (CVarGetInteger(CVAR_TRACKER_CHECK("WindowType"), TRACKER_WINDOW_WINDOW) == TRACKER_WINDOW_FLOATING) {
ImGui::SetNextWindowViewport(ImGui::GetMainViewport()->ID); ImGui::SetNextWindowViewport(ImGui::GetMainViewport()->ID);
windowFlags |= ImGuiWindowFlags_NoDocking | ImGuiWindowFlags_NoNav | ImGuiWindowFlags_NoTitleBar | windowFlags |= ImGuiWindowFlags_NoDocking | ImGuiWindowFlags_NoNav | ImGuiWindowFlags_NoTitleBar |
ImGuiWindowFlags_NoScrollWithMouse | ImGuiWindowFlags_NoScrollbar; ImGuiWindowFlags_NoScrollWithMouse | ImGuiWindowFlags_NoScrollbar;
if (!CVarGetInteger("gCheckTrackerHudEditMode", 0)) { if (!CVarGetInteger(CVAR_TRACKER_CHECK("Draggable"), 0)) {
windowFlags |= ImGuiWindowFlags_NoInputs | ImGuiWindowFlags_NoMove; windowFlags |= ImGuiWindowFlags_NoInputs | ImGuiWindowFlags_NoMove;
} }
} }
@ -1354,10 +1386,10 @@ bool IsHeartPiece(GetItemID giid) {
} }
void DrawLocation(RandomizerCheck rc) { void DrawLocation(RandomizerCheck rc) {
Color_RGBA8 mainColor; Color_RGBA8 mainColor;
Color_RGBA8 extraColor; Color_RGBA8 extraColor;
std::string txt; std::string txt;
bool showHidden = CVarGetInteger("gCheckTrackerOptionShowHidden", 0); bool showHidden = CVarGetInteger(CVAR_TRACKER_CHECK("ShowHidden"), 0);
Rando::Location* loc = Rando::StaticData::GetLocation(rc); Rando::Location* loc = Rando::StaticData::GetLocation(rc);
Rando::ItemLocation* itemLoc = OTRGlobals::Instance->gRandoContext->GetItemLocation(rc); Rando::ItemLocation* itemLoc = OTRGlobals::Instance->gRandoContext->GetItemLocation(rc);
RandomizerCheckTrackerData checkData = gSaveContext.checkTrackerData[rc]; RandomizerCheckTrackerData checkData = gSaveContext.checkTrackerData[rc];
@ -1369,61 +1401,61 @@ void DrawLocation(RandomizerCheck rc) {
bool skipped = checkData.skipped; bool skipped = checkData.skipped;
if (status == RCSHOW_COLLECTED) { if (status == RCSHOW_COLLECTED) {
if (!showHidden && CVarGetInteger("gCheckTrackerCollectedHide", 0)) { if (!showHidden && CVarGetInteger(CVAR_TRACKER_CHECK("Collected.Hide"), 0)) {
return; return;
} }
mainColor = mainColor =
!IsHeartPiece((GetItemID)Rando::StaticData::RetrieveItem(loc->GetVanillaItem()).GetItemID()) && !IS_RANDO !IsHeartPiece((GetItemID)Rando::StaticData::RetrieveItem(loc->GetVanillaItem()).GetItemID()) && !IS_RANDO
? CVarGetColor("gCheckTrackerCollectedExtraColor", Color_Collected_Extra_Default) ? CVarGetColor(CVAR_TRACKER_CHECK("Collected.ExtraColor"), Color_Collected_Extra_Default)
: CVarGetColor("gCheckTrackerCollectedMainColor", Color_Main_Default); : CVarGetColor(CVAR_TRACKER_CHECK("Collected.MainColor"), Color_Main_Default);
extraColor = CVarGetColor("gCheckTrackerCollectedExtraColor", Color_Collected_Extra_Default); extraColor = CVarGetColor(CVAR_TRACKER_CHECK("Collected.ExtraColor"), Color_Collected_Extra_Default);
} else if (status == RCSHOW_SAVED) { } else if (status == RCSHOW_SAVED) {
if (!showHidden && CVarGetInteger("gCheckTrackerSavedHide", 0)) { if (!showHidden && CVarGetInteger(CVAR_TRACKER_CHECK("Saved.Hide"), 0)) {
return; return;
} }
mainColor = mainColor =
!IsHeartPiece((GetItemID)Rando::StaticData::RetrieveItem(loc->GetVanillaItem()).GetItemID()) && !IS_RANDO !IsHeartPiece((GetItemID)Rando::StaticData::RetrieveItem(loc->GetVanillaItem()).GetItemID()) && !IS_RANDO
? CVarGetColor("gCheckTrackerSavedExtraColor", Color_Saved_Extra_Default) ? CVarGetColor(CVAR_TRACKER_CHECK("Saved.ExtraColor"), Color_Saved_Extra_Default)
: CVarGetColor("gCheckTrackerSavedMainColor", Color_Main_Default); : CVarGetColor(CVAR_TRACKER_CHECK("Saved.MainColor"), Color_Main_Default);
extraColor = CVarGetColor("gCheckTrackerSavedExtraColor", Color_Saved_Extra_Default); extraColor = CVarGetColor(CVAR_TRACKER_CHECK("Saved.ExtraColor"), Color_Saved_Extra_Default);
} else if (skipped) { } else if (skipped) {
if (!showHidden && CVarGetInteger("gCheckTrackerSkippedHide", 0)) { if (!showHidden && CVarGetInteger(CVAR_TRACKER_CHECK("Skipped.Hide"), 0)) {
return; return;
} }
mainColor = mainColor =
!IsHeartPiece((GetItemID)Rando::StaticData::RetrieveItem(loc->GetVanillaItem()).GetItemID()) && !IS_RANDO !IsHeartPiece((GetItemID)Rando::StaticData::RetrieveItem(loc->GetVanillaItem()).GetItemID()) && !IS_RANDO
? CVarGetColor("gCheckTrackerSkippedExtraColor", Color_Skipped_Extra_Default) ? CVarGetColor(CVAR_TRACKER_CHECK("Skipped.ExtraColor"), Color_Skipped_Extra_Default)
: CVarGetColor("gCheckTrackerSkippedMainColor", Color_Main_Default); : CVarGetColor(CVAR_TRACKER_CHECK("Skipped.MainColor", Color_Main_Default);
extraColor = CVarGetColor("gCheckTrackerSkippedExtraColor", Color_Skipped_Extra_Default); extraColor = CVarGetColor(CVAR_TRACKER_CHECK("Skipped.ExtraColor"), Color_Skipped_Extra_Default);
} else if (status == RCSHOW_SEEN || status == RCSHOW_IDENTIFIED) { } else if (status == RCSHOW_SEEN || status == RCSHOW_IDENTIFIED) {
if (!showHidden && CVarGetInteger("gCheckTrackerSeenHide", 0)) { if (!showHidden && CVarGetInteger(CVAR_TRACKER_CHECK("Seen.Hide"), 0)) {
return; return;
} }
mainColor = mainColor =
!IsHeartPiece((GetItemID)Rando::StaticData::RetrieveItem(loc->GetVanillaItem()).GetItemID()) && !IS_RANDO !IsHeartPiece((GetItemID)Rando::StaticData::RetrieveItem(loc->GetVanillaItem()).GetItemID()) && !IS_RANDO
? CVarGetColor("gCheckTrackerSeenExtraColor", Color_Seen_Extra_Default) ? CVarGetColor(CVAR_TRACKER_CHECK("Seen.ExtraColor"), Color_Seen_Extra_Default)
: CVarGetColor("gCheckTrackerSeenMainColor", Color_Main_Default); : CVarGetColor(CVAR_TRACKER_CHECK("Seen.MainColor"), Color_Main_Default);
extraColor = CVarGetColor("gCheckTrackerSeenExtraColor", Color_Seen_Extra_Default); extraColor = CVarGetColor(CVAR_TRACKER_CHECK("Seen.ExtraColor"), Color_Seen_Extra_Default);
} else if (status == RCSHOW_SCUMMED) { } else if (status == RCSHOW_SCUMMED) {
if (!showHidden && CVarGetInteger("gCheckTrackerScummedHide", 0)) { if (!showHidden && CVarGetInteger(CVAR_TRACKER_CHECK("Scummed.Hide"), 0)) {
return; return;
} }
mainColor = mainColor =
!IsHeartPiece((GetItemID)Rando::StaticData::RetrieveItem(loc->GetVanillaItem()).GetItemID()) && !IS_RANDO !IsHeartPiece((GetItemID)Rando::StaticData::RetrieveItem(loc->GetVanillaItem()).GetItemID()) && !IS_RANDO
? CVarGetColor("gCheckTrackerScummedExtraColor", Color_Scummed_Extra_Default) ? CVarGetColor(CVAR_TRACKER_CHECK("Scummed.ExtraColor"), Color_Scummed_Extra_Default)
: CVarGetColor("gCheckTrackerScummedMainColor", Color_Main_Default); : CVarGetColor(CVAR_TRACKER_CHECK("Scummed.MainColor"), Color_Main_Default);
extraColor = CVarGetColor("gCheckTrackerScummedExtraColor", Color_Scummed_Extra_Default); extraColor = CVarGetColor(CVAR_TRACKER_CHECK("Scummed.ExtraColor"), Color_Scummed_Extra_Default);
} else if (status == RCSHOW_UNCHECKED) { } else if (status == RCSHOW_UNCHECKED) {
if (!showHidden && CVarGetInteger("gCheckTrackerUncheckedHide", 0)) { if (!showHidden && CVarGetInteger(CVAR_TRACKER_CHECK("Unchecked.Hide"), 0)) {
return; return;
} }
mainColor = mainColor =
!IsHeartPiece((GetItemID)Rando::StaticData::RetrieveItem(loc->GetVanillaItem()).GetItemID()) && !IS_RANDO !IsHeartPiece((GetItemID)Rando::StaticData::RetrieveItem(loc->GetVanillaItem()).GetItemID()) && !IS_RANDO
? CVarGetColor("gCheckTrackerUncheckedExtraColor", Color_Unchecked_Extra_Default) ? CVarGetColor(CVAR_TRACKER_CHECK("Unchecked.ExtraColor"), Color_Unchecked_Extra_Default)
: CVarGetColor("gCheckTrackerUncheckedMainColor", Color_Main_Default); : CVarGetColor(CVAR_TRACKER_CHECK("Unchecked.MainColor"), Color_Main_Default);
extraColor = CVarGetColor("gCheckTrackerUncheckedExtraColor", Color_Unchecked_Extra_Default); extraColor = CVarGetColor(CVAR_TRACKER_CHECK("Unchecked.ExtraColor"), Color_Unchecked_Extra_Default);
} }
//Main Text //Main Text
if (checkNameOverrides.contains(loc->GetRandomizerCheck())) { if (checkNameOverrides.contains(loc->GetRandomizerCheck())) {
txt = checkNameOverrides[loc->GetRandomizerCheck()]; txt = checkNameOverrides[loc->GetRandomizerCheck()];
@ -1434,7 +1466,7 @@ void DrawLocation(RandomizerCheck rc) {
if (lastLocationChecked == loc->GetRandomizerCheck()) { if (lastLocationChecked == loc->GetRandomizerCheck()) {
txt = "* " + txt; txt = "* " + txt;
} }
// Draw button - for Skipped/Seen/Scummed/Unchecked only // Draw button - for Skipped/Seen/Scummed/Unchecked only
if (status == RCSHOW_UNCHECKED || status == RCSHOW_SEEN || status == RCSHOW_IDENTIFIED || status == RCSHOW_SCUMMED || skipped) { if (status == RCSHOW_UNCHECKED || status == RCSHOW_SEEN || status == RCSHOW_IDENTIFIED || status == RCSHOW_SCUMMED || skipped) {
if (UIWidgets::StateButton(std::to_string(rc).c_str(), skipped ? ICON_FA_PLUS : ICON_FA_TIMES)) { if (UIWidgets::StateButton(std::to_string(rc).c_str(), skipped ? ICON_FA_PLUS : ICON_FA_TIMES)) {
@ -1521,31 +1553,31 @@ void DrawLocation(RandomizerCheck rc) {
} }
static std::set<std::string> rainbowCVars = { static std::set<std::string> rainbowCVars = {
"gCheckTrackerAreaMainIncompleteColor", "gCheckTrackerAreaExtraIncompleteColor", CVAR_TRACKER_CHECK("AreaIncomplete.MainColor"), CVAR_TRACKER_CHECK("AreaIncomplete.ExtraColor"),
"gCheckTrackerAreaMainCompleteColor", "gCheckTrackerAreaExtraCompleteColor", CVAR_TRACKER_CHECK("AreaComplete.MainColor"), CVAR_TRACKER_CHECK("AreaComplete.ExtraColor"),
"gCheckTrackerUncheckedMainColor", "gCheckTrackerUncheckedExtraColor", CVAR_TRACKER_CHECK("Unchecked.MainColor"), CVAR_TRACKER_CHECK("Unchecked.ExtraColor"),
"gCheckTrackerSkippedMainColor", "gCheckTrackerSkippedExtraColor", CVAR_TRACKER_CHECK("Skipped.MainColor"), CVAR_TRACKER_CHECK("Skipped.ExtraColor"),
"gCheckTrackerSeenMainColor", "gCheckTrackerSeenExtraColor", CVAR_TRACKER_CHECK("Seen.MainColor"), CVAR_TRACKER_CHECK("Seen.ExtraColor"),
"gCheckTrackerHintedMainColor", "gCheckTrackerHintedExtraColor", CVAR_TRACKER_CHECK("Hinted.MainColor"), CVAR_TRACKER_CHECK("Hinted.ExtraColor"),
"gCheckTrackerCollectedMainColor", "gCheckTrackerCollectedExtraColor", CVAR_TRACKER_CHECK("Collected.MainColor"), CVAR_TRACKER_CHECK("Collected.ExtraColor"),
"gCheckTrackerScummedMainColor", "gCheckTrackerScummedExtraColor", CVAR_TRACKER_CHECK("Scummed.MainColor"), CVAR_TRACKER_CHECK("Scummed.ExtraColor"),
"gCheckTrackerSavedMainColor", "gCheckTrackerSavedExtraColor", CVAR_TRACKER_CHECK("Saved.MainColor"), CVAR_TRACKER_CHECK("Saved.ExtraColor"),
}; };
int hue = 0; int hue = 0;
void RainbowTick() { void RainbowTick() {
float freqHue = hue * 2 * M_PI / (360 * CVarGetFloat("gCosmetics.RainbowSpeed", 0.6f)); float freqHue = hue * 2 * M_PI / (360 * CVarGetFloat(CVAR_COSMETIC("RainbowSpeed"), 0.6f));
for (auto& cvar : rainbowCVars) { for (auto& cvar : rainbowCVars) {
if (CVarGetInteger((cvar + "RBM").c_str(), 0) == 0) { if (CVarGetInteger((cvar + "RBM").c_str(), 0) == 0) {
continue; continue;
} }
Color_RGBA8 newColor; Color_RGBA8 newColor;
newColor.r = sin(freqHue + 0) * 127 + 128; newColor.r = sin(freqHue + 0) * 127 + 128;
newColor.g = sin(freqHue + (2 * M_PI / 3)) * 127 + 128; newColor.g = sin(freqHue + (2 * M_PI / 3)) * 127 + 128;
newColor.b = sin(freqHue + (4 * M_PI / 3)) * 127 + 128; newColor.b = sin(freqHue + (4 * M_PI / 3)) * 127 + 128;
newColor.a = 255; newColor.a = 255;
CVarSetColor(cvar.c_str(), newColor); CVarSetColor(cvar.c_str(), newColor);
} }
@ -1582,7 +1614,7 @@ void ImGuiDrawTwoColorPickerSection(const char* text, const char* cvarMainName,
main_color = CVarGetColor(cvarMainName, main_default_color); main_color = CVarGetColor(cvarMainName, main_default_color);
}; };
ImGui::PopItemWidth(); ImGui::PopItemWidth();
ImGui::TableNextColumn(); ImGui::TableNextColumn();
ImGui::AlignTextToFramePadding(); ImGui::AlignTextToFramePadding();
ImGui::PushItemWidth(ImGui::GetContentRegionAvail().x); ImGui::PushItemWidth(ImGui::GetContentRegionAvail().x);
@ -1624,49 +1656,54 @@ void CheckTrackerSettingsWindow::DrawElement() {
ImGui::TableNextRow(); ImGui::TableNextRow();
ImGui::TableNextColumn(); ImGui::TableNextColumn();
ImGui::PushItemWidth(ImGui::GetContentRegionAvail().x); ImGui::PushItemWidth(ImGui::GetContentRegionAvail().x);
if (UIWidgets::EnhancementColor("BG Color", "gCheckTrackerBgColor", if (UIWidgets::EnhancementColor("BG Color", CVAR_TRACKER_CHECK("BgColor"),
ImVec4(Color_Background.r, Color_Background.g, Color_Background.b, Color_Background.a), ImVec4(Color_Background.r, Color_Background.g, Color_Background.b, Color_Background.a),
ImVec4(Color_Bg_Default.r, Color_Bg_Default.g, Color_Bg_Default.b, Color_Bg_Default.a), ImVec4(Color_Bg_Default.r, Color_Bg_Default.g, Color_Bg_Default.b, Color_Bg_Default.a),
false, true)) false, true))
{ {
Color_Background = CVarGetColor("gCheckTrackerBgColor", Color_Bg_Default); Color_Background = CVarGetColor(CVAR_TRACKER_CHECK("BgColor"), Color_Bg_Default);
} }
ImGui::PopItemWidth(); ImGui::PopItemWidth();
UIWidgets::LabeledRightAlignedEnhancementCombobox("Window Type", "gCheckTrackerWindowType", windowType, TRACKER_WINDOW_WINDOW); UIWidgets::LabeledRightAlignedEnhancementCombobox("Window Type", CVAR_TRACKER_CHECK("WindowType"), windowType, TRACKER_WINDOW_WINDOW);
if (CVarGetInteger("gCheckTrackerWindowType", TRACKER_WINDOW_WINDOW) == TRACKER_WINDOW_FLOATING) { if (CVarGetInteger(CVAR_TRACKER_CHECK("WindowType"), TRACKER_WINDOW_WINDOW) == TRACKER_WINDOW_FLOATING) {
UIWidgets::EnhancementCheckbox("Enable Dragging", "gCheckTrackerHudEditMode"); UIWidgets::EnhancementCheckbox("Enable Dragging", CVAR_TRACKER_CHECK("Draggable"));
UIWidgets::EnhancementCheckbox("Only enable while paused", "gCheckTrackerShowOnlyPaused"); UIWidgets::EnhancementCheckbox("Only enable while paused", CVAR_TRACKER_CHECK("ShowOnlyPaused"));
UIWidgets::LabeledRightAlignedEnhancementCombobox("Display Mode", "gCheckTrackerDisplayType", displayType, 0); UIWidgets::LabeledRightAlignedEnhancementCombobox("Display Mode", CVAR_TRACKER_CHECK("DisplayType"), displayType, 0);
if (CVarGetInteger("gCheckTrackerDisplayType", TRACKER_DISPLAY_ALWAYS) == TRACKER_DISPLAY_COMBO_BUTTON) { if (CVarGetInteger(CVAR_TRACKER_CHECK("DisplayType"), TRACKER_DISPLAY_ALWAYS) == TRACKER_DISPLAY_COMBO_BUTTON) {
UIWidgets::LabeledRightAlignedEnhancementCombobox("Combo Button 1", "gCheckTrackerComboButton1", buttonStrings, TRACKER_COMBO_BUTTON_L); UIWidgets::LabeledRightAlignedEnhancementCombobox("Combo Button 1", CVAR_TRACKER_CHECK("ComboButton1"), buttonStrings, TRACKER_COMBO_BUTTON_L);
UIWidgets::LabeledRightAlignedEnhancementCombobox("Combo Button 2", "gCheckTrackerComboButton2", buttonStrings, TRACKER_COMBO_BUTTON_R); UIWidgets::LabeledRightAlignedEnhancementCombobox("Combo Button 2", CVAR_TRACKER_CHECK("ComboButton2"), buttonStrings, TRACKER_COMBO_BUTTON_R);
} }
} }
UIWidgets::EnhancementCheckbox("Vanilla/MQ Dungeon Spoilers", "gCheckTrackerOptionMQSpoilers"); UIWidgets::EnhancementCheckbox("Vanilla/MQ Dungeon Spoilers", CVAR_TRACKER_CHECK("MQSpoilers"));
UIWidgets::Tooltip("If enabled, Vanilla/MQ dungeons will show on the tracker immediately. Otherwise, Vanilla/MQ dungeon locations must be unlocked."); UIWidgets::Tooltip("If enabled, Vanilla/MQ dungeons will show on the tracker immediately. Otherwise, Vanilla/MQ dungeon locations must be unlocked.");
if (UIWidgets::EnhancementCheckbox("Hide right-side shop item checks", "gCheckTrackerOptionHideRightShopChecks", false, "", UIWidgets::CheckboxGraphics::Cross, true)) { if (UIWidgets::EnhancementCheckbox("Hide right-side shop item checks", CVAR_TRACKER_CHECK("HideRightShopChecks"), false, "", UIWidgets::CheckboxGraphics::Cross, true)) {
hideShopRightChecks = !hideShopRightChecks; hideShopRightChecks = !hideShopRightChecks;
RecalculateAreaTotals(); RecalculateAreaTotals();
} }
UIWidgets::Tooltip("If enabled, will prevent the tracker from displaying slots 1-4 in all shops."); UIWidgets::Tooltip("If enabled, will prevent the tracker from displaying slots 1-4 in all shops.");
if (UIWidgets::EnhancementCheckbox("Always show gold skulltulas", "gCheckTrackerOptionAlwaysShowGSLocs", false, "")) { if (UIWidgets::EnhancementCheckbox("Always show gold skulltulas", CVAR_TRACKER_CHECK("AlwaysShowGSLocs"), false, "")) {
alwaysShowGS = !alwaysShowGS; alwaysShowGS = !alwaysShowGS;
RecalculateAreaTotals(); RecalculateAreaTotals();
} }
UIWidgets::Tooltip("If enabled, will show GS locations in the tracker regardless of tokensanity settings."); UIWidgets::Tooltip("If enabled, will show GS locations in the tracker regardless of tokensanity settings.");
// Filtering settings
UIWidgets::PaddedSeparator();
UIWidgets::EnhancementCheckbox("Filter Empty Areas", CVAR_TRACKER_CHECK("HideFilteredAreas"), false, "", UIWidgets::CheckboxGraphics::Checkmark, true);
UIWidgets::Tooltip("If enabled, will hide area headers that have no locations matching filter");
ImGui::TableNextColumn(); ImGui::TableNextColumn();
CheckTracker::ImGuiDrawTwoColorPickerSection("Area Incomplete", "gCheckTrackerAreaMainIncompleteColor", "gCheckTrackerAreaExtraIncompleteColor", Color_Area_Incomplete_Main, Color_Area_Incomplete_Extra, Color_Main_Default, Color_Area_Incomplete_Extra_Default, "gCheckTrackerAreaIncompleteHide", ""); CheckTracker::ImGuiDrawTwoColorPickerSection("Area Incomplete", CVAR_TRACKER_CHECK("AreaIncomplete.MainColor"), CVAR_TRACKER_CHECK("AreaIncomplete.ExtraColor"), Color_Area_Incomplete_Main, Color_Area_Incomplete_Extra, Color_Main_Default, Color_Area_Incomplete_Extra_Default, CVAR_TRACKER_CHECK("AreaIncomplete.Hide"), "");
CheckTracker::ImGuiDrawTwoColorPickerSection("Area Complete", "gCheckTrackerAreaMainCompleteColor", "gCheckTrackerAreaExtraCompleteColor", Color_Area_Complete_Main, Color_Area_Complete_Extra, Color_Main_Default, Color_Area_Complete_Extra_Default, "gCheckTrackerAreaCompleteHide", ""); CheckTracker::ImGuiDrawTwoColorPickerSection("Area Complete", CVAR_TRACKER_CHECK("AreaComplete.MainColor"), CVAR_TRACKER_CHECK("AreaComplete.ExtraColor"), Color_Area_Complete_Main, Color_Area_Complete_Extra, Color_Main_Default, Color_Area_Complete_Extra_Default, CVAR_TRACKER_CHECK("AreaComplete.Hide"), "");
CheckTracker::ImGuiDrawTwoColorPickerSection("Unchecked", "gCheckTrackerUncheckedMainColor", "gCheckTrackerUncheckedExtraColor", Color_Unchecked_Main, Color_Unchecked_Extra, Color_Main_Default, Color_Unchecked_Extra_Default, "gCheckTrackerUncheckedHide", "Checks you have not interacted with at all."); CheckTracker::ImGuiDrawTwoColorPickerSection("Unchecked", CVAR_TRACKER_CHECK("Unchecked.MainColor"), CVAR_TRACKER_CHECK("Unchecked.ExtraColor"), Color_Unchecked_Main, Color_Unchecked_Extra, Color_Main_Default, Color_Unchecked_Extra_Default, CVAR_TRACKER_CHECK("Unchecked.Hide"), "Checks you have not interacted with at all.");
CheckTracker::ImGuiDrawTwoColorPickerSection("Skipped", "gCheckTrackerSkippedMainColor", "gCheckTrackerSkippedExtraColor", Color_Skipped_Main, Color_Skipped_Extra, Color_Main_Default, Color_Skipped_Extra_Default, "gCheckTrackerSkippedHide", ""); CheckTracker::ImGuiDrawTwoColorPickerSection("Skipped", CVAR_TRACKER_CHECK("Skipped.MainColor"), CVAR_TRACKER_CHECK("Skipped.ExtraColor"), Color_Skipped_Main, Color_Skipped_Extra, Color_Main_Default, Color_Skipped_Extra_Default, CVAR_TRACKER_CHECK("Skipped.Hide"), "");
CheckTracker::ImGuiDrawTwoColorPickerSection("Seen", "gCheckTrackerSeenMainColor", "gCheckTrackerSeenExtraColor", Color_Seen_Main, Color_Seen_Extra, Color_Main_Default, Color_Seen_Extra_Default, "gCheckTrackerSeenHide", "Used for shops. Shows item names for shop slots when walking in, and prices when highlighting them in buy mode."); CheckTracker::ImGuiDrawTwoColorPickerSection("Seen", CVAR_TRACKER_CHECK("Seen.MainColor"), CVAR_TRACKER_CHECK("Seen.ExtraColor"), Color_Seen_Main, Color_Seen_Extra, Color_Main_Default, Color_Seen_Extra_Default, CVAR_TRACKER_CHECK("Seen.Hide"), "Used for shops. Shows item names for shop slots when walking in, and prices when highlighting them in buy mode.");
CheckTracker::ImGuiDrawTwoColorPickerSection("Scummed", "gCheckTrackerScummedMainColor", "gCheckTrackerScummedExtraColor", Color_Scummed_Main, Color_Scummed_Extra, Color_Main_Default, Color_Scummed_Extra_Default, "gCheckTrackerScummedHide", "Checks you collect, but then reload before saving so you no longer have them."); CheckTracker::ImGuiDrawTwoColorPickerSection("Scummed", CVAR_TRACKER_CHECK("Scummed.MainColor"), CVAR_TRACKER_CHECK("Scummed.ExtraColor"), Color_Scummed_Main, Color_Scummed_Extra, Color_Main_Default, Color_Scummed_Extra_Default, CVAR_TRACKER_CHECK("Scummed.Hide"), "Checks you collect, but then reload before saving so you no longer have them.");
//CheckTracker::ImGuiDrawTwoColorPickerSection("Hinted (WIP)", "gCheckTrackerHintedMainColor", "gCheckTrackerHintedExtraColor", Color_Hinted_Main, Color_Hinted_Extra, Color_Main_Default, Color_Hinted_Extra_Default, "gCheckTrackerHintedHide", ""); //CheckTracker::ImGuiDrawTwoColorPickerSection("Hinted (WIP)", CVAR_TRACKER_CHECK("Hinted.MainColor"), CVAR_TRACKER_CHECK("Hinted.ExtraColor"), Color_Hinted_Main, Color_Hinted_Extra, Color_Main_Default, Color_Hinted_Extra_Default, CVAR_TRACKER_CHECK("Hinted.Hide"), "");
CheckTracker::ImGuiDrawTwoColorPickerSection("Collected", "gCheckTrackerCollectedMainColor", "gCheckTrackerCollectedExtraColor", Color_Collected_Main, Color_Collected_Extra, Color_Main_Default, Color_Collected_Extra_Default, "gCheckTrackerCollectedHide", "Checks you have collected without saving or reloading yet."); CheckTracker::ImGuiDrawTwoColorPickerSection("Collected", CVAR_TRACKER_CHECK("Collected.MainColor"), CVAR_TRACKER_CHECK("Collected.ExtraColor"), Color_Collected_Main, Color_Collected_Extra, Color_Main_Default, Color_Collected_Extra_Default, CVAR_TRACKER_CHECK("Collected.Hide"), "Checks you have collected without saving or reloading yet.");
CheckTracker::ImGuiDrawTwoColorPickerSection("Saved", "gCheckTrackerSavedMainColor", "gCheckTrackerSavedExtraColor", Color_Saved_Main, Color_Saved_Extra, Color_Main_Default, Color_Saved_Extra_Default, "gCheckTrackerSavedHide", "Checks that you saved the game while having collected."); CheckTracker::ImGuiDrawTwoColorPickerSection("Saved", CVAR_TRACKER_CHECK("Saved.MainColor"), CVAR_TRACKER_CHECK("Saved.ExtraColor"), Color_Saved_Main, Color_Saved_Extra, Color_Main_Default, Color_Saved_Extra_Default, CVAR_TRACKER_CHECK("Saved.Hide"), "Checks that you saved the game while having collected.");
ImGui::PopStyleVar(1); ImGui::PopStyleVar(1);
ImGui::EndTable(); ImGui::EndTable();
@ -1674,25 +1711,25 @@ void CheckTrackerSettingsWindow::DrawElement() {
} }
void CheckTrackerWindow::InitElement() { void CheckTrackerWindow::InitElement() {
Color_Background = CVarGetColor("gCheckTrackerBgColor", Color_Bg_Default); Color_Background = CVarGetColor(CVAR_TRACKER_CHECK("BgColor"), Color_Bg_Default);
Color_Area_Incomplete_Main = CVarGetColor("gCheckTrackerAreaMainIncompleteColor", Color_Main_Default); Color_Area_Incomplete_Main = CVarGetColor(CVAR_TRACKER_CHECK("AreaIncomplete.MainColor"), Color_Main_Default);
Color_Area_Incomplete_Extra = CVarGetColor("gCheckTrackerAreaExtraIncompleteColor", Color_Area_Incomplete_Extra_Default); Color_Area_Incomplete_Extra = CVarGetColor(CVAR_TRACKER_CHECK("AreaIncomplete.ExtraColor"), Color_Area_Incomplete_Extra_Default);
Color_Area_Complete_Main = CVarGetColor("gCheckTrackerAreaMainCompleteColor", Color_Main_Default); Color_Area_Complete_Main = CVarGetColor(CVAR_TRACKER_CHECK("AreaComplete.MainColor"), Color_Main_Default);
Color_Area_Complete_Extra = CVarGetColor("gCheckTrackerAreaExtraCompleteColor", Color_Area_Complete_Extra_Default); Color_Area_Complete_Extra = CVarGetColor(CVAR_TRACKER_CHECK("AreaComplete.ExtraColor"), Color_Area_Complete_Extra_Default);
Color_Unchecked_Main = CVarGetColor("gCheckTrackerUncheckedMainColor", Color_Main_Default); Color_Unchecked_Main = CVarGetColor(CVAR_TRACKER_CHECK("Unchecked.MainColor"), Color_Main_Default);
Color_Unchecked_Extra = CVarGetColor("gCheckTrackerUncheckedExtraColor", Color_Unchecked_Extra_Default); Color_Unchecked_Extra = CVarGetColor(CVAR_TRACKER_CHECK("Unchecked.ExtraColor"), Color_Unchecked_Extra_Default);
Color_Skipped_Main = CVarGetColor("gCheckTrackerSkippedMainColor", Color_Main_Default); Color_Skipped_Main = CVarGetColor(CVAR_TRACKER_CHECK("Skipped.MainColor"), Color_Main_Default);
Color_Skipped_Extra = CVarGetColor("gCheckTrackerSkippedExtraColor", Color_Skipped_Extra_Default); Color_Skipped_Extra = CVarGetColor(CVAR_TRACKER_CHECK("Skipped.ExtraColor"), Color_Skipped_Extra_Default);
Color_Seen_Main = CVarGetColor("gCheckTrackerSeenMainColor", Color_Main_Default); Color_Seen_Main = CVarGetColor(CVAR_TRACKER_CHECK("Seen.MainColor"), Color_Main_Default);
Color_Seen_Extra = CVarGetColor("gCheckTrackerSeenExtraColor", Color_Seen_Extra_Default); Color_Seen_Extra = CVarGetColor(CVAR_TRACKER_CHECK("Seen.ExtraColor"), Color_Seen_Extra_Default);
Color_Hinted_Main = CVarGetColor("gCheckTrackerHintedMainColor", Color_Main_Default); Color_Hinted_Main = CVarGetColor(CVAR_TRACKER_CHECK("Hinted.MainColor"), Color_Main_Default);
Color_Hinted_Extra = CVarGetColor("gCheckTrackerHintedExtraColor", Color_Hinted_Extra_Default); Color_Hinted_Extra = CVarGetColor(CVAR_TRACKER_CHECK("Hinted.ExtraColor"), Color_Hinted_Extra_Default);
Color_Collected_Main = CVarGetColor("gCheckTrackerCollectedMainColor", Color_Main_Default); Color_Collected_Main = CVarGetColor(CVAR_TRACKER_CHECK("Collected.MainColor"), Color_Main_Default);
Color_Collected_Extra = CVarGetColor("gCheckTrackerCollectedExtraColor", Color_Collected_Extra_Default); Color_Collected_Extra = CVarGetColor(CVAR_TRACKER_CHECK("Collected.ExtraColor"), Color_Collected_Extra_Default);
Color_Scummed_Main = CVarGetColor("gCheckTrackerScummedMainColor", Color_Main_Default); Color_Scummed_Main = CVarGetColor(CVAR_TRACKER_CHECK("Scummed.MainColor"), Color_Main_Default);
Color_Scummed_Extra = CVarGetColor("gCheckTrackerScummedExtraColor", Color_Scummed_Extra_Default); Color_Scummed_Extra = CVarGetColor(CVAR_TRACKER_CHECK("Scummed.ExtraColor"), Color_Scummed_Extra_Default);
Color_Saved_Main = CVarGetColor("gCheckTrackerSavedMainColor", Color_Main_Default); Color_Saved_Main = CVarGetColor(CVAR_TRACKER_CHECK("Saved.MainColor"), Color_Main_Default);
Color_Saved_Extra = CVarGetColor("gCheckTrackerSavedExtraColor", Color_Saved_Extra_Default); Color_Saved_Extra = CVarGetColor(CVAR_TRACKER_CHECK("Saved.ExtraColor"), Color_Saved_Extra_Default);
SaveManager::Instance->AddInitFunction(InitTrackerData); SaveManager::Instance->AddInitFunction(InitTrackerData);
sectionId = SaveManager::Instance->AddSaveFunction("trackerData", 1, SaveFile, true, -1); sectionId = SaveManager::Instance->AddSaveFunction("trackerData", 1, SaveFile, true, -1);
@ -1708,8 +1745,8 @@ void CheckTrackerWindow::InitElement() {
// GameInteractor::Instance->RegisterGameHook<GameInteractor::OnSceneFlagSet>(CheckTrackerSceneFlagSet); // GameInteractor::Instance->RegisterGameHook<GameInteractor::OnSceneFlagSet>(CheckTrackerSceneFlagSet);
// GameInteractor::Instance->RegisterGameHook<GameInteractor::OnFlagSet>(CheckTrackerFlagSet); // GameInteractor::Instance->RegisterGameHook<GameInteractor::OnFlagSet>(CheckTrackerFlagSet);
hideShopRightChecks = CVarGetInteger("gCheckTrackerOptionHideRightShopChecks", 1); hideShopRightChecks = CVarGetInteger(CVAR_TRACKER_CHECK("HideRightShopChecks"), 1);
alwaysShowGS = CVarGetInteger("gCheckTrackerOptionAlwaysShowGSLocs", 0); alwaysShowGS = CVarGetInteger(CVAR_TRACKER_CHECK("AlwaysShowGSLocs"), 0);
//LocationTable_Init(); //LocationTable_Init();
} }

View File

@ -7,9 +7,9 @@
namespace CheckTracker { namespace CheckTracker {
class CheckTrackerSettingsWindow : public LUS::GuiWindow { class CheckTrackerSettingsWindow : public Ship::GuiWindow {
public: public:
using LUS::GuiWindow::GuiWindow; using GuiWindow::GuiWindow;
~CheckTrackerSettingsWindow() {}; ~CheckTrackerSettingsWindow() {};
protected: protected:
@ -18,9 +18,9 @@ class CheckTrackerSettingsWindow : public LUS::GuiWindow {
void UpdateElement() override {}; void UpdateElement() override {};
}; };
class CheckTrackerWindow : public LUS::GuiWindow { class CheckTrackerWindow : public Ship::GuiWindow {
public: public:
using LUS::GuiWindow::GuiWindow; using GuiWindow::GuiWindow;
~CheckTrackerWindow() {}; ~CheckTrackerWindow() {};
protected: protected:

View File

@ -396,7 +396,7 @@ void Entrance_SetSavewarpEntrance(void) {
gSaveContext.entranceIndex = ENTR_THIEVES_HIDEOUT_0; // Gerudo Fortress -> Thieve's Hideout spawn 0 gSaveContext.entranceIndex = ENTR_THIEVES_HIDEOUT_0; // Gerudo Fortress -> Thieve's Hideout spawn 0
} else if (scene == SCENE_LINKS_HOUSE) { } else if (scene == SCENE_LINKS_HOUSE) {
gSaveContext.entranceIndex = Entrance_OverrideNextIndex(ENTR_LINKS_HOUSE_0); gSaveContext.entranceIndex = Entrance_OverrideNextIndex(ENTR_LINKS_HOUSE_0);
} else if (CVarGetInteger("gRememberSaveLocation", 0) && scene != SCENE_FAIRYS_FOUNTAIN && scene != SCENE_GROTTOS && } else if (CVarGetInteger(CVAR_ENHANCEMENT("RememberSaveLocation"), 0) && scene != SCENE_FAIRYS_FOUNTAIN && scene != SCENE_GROTTOS &&
gSaveContext.entranceIndex != ENTR_LOAD_OPENING) { gSaveContext.entranceIndex != ENTR_LOAD_OPENING) {
// Use the saved entrance value with remember save location, except when in grottos/fairy fountains or if // Use the saved entrance value with remember save location, except when in grottos/fairy fountains or if
// the entrance index is -1 (new save) // the entrance index is -1 (new save)

View File

@ -668,25 +668,25 @@ void EntranceTrackerWindow::DrawElement() {
ImGui::TableNextColumn(); ImGui::TableNextColumn();
ImGui::Text("Sort By"); ImGui::Text("Sort By");
UIWidgets::EnhancementRadioButton("To", "gEntranceTrackerSortBy", 0); UIWidgets::EnhancementRadioButton("To", CVAR_TRACKER_ENTRANCE("SortBy"), 0);
UIWidgets::Tooltip("Sort entrances by the original source entrance"); UIWidgets::Tooltip("Sort entrances by the original source entrance");
UIWidgets::EnhancementRadioButton("From", "gEntranceTrackerSortBy", 1); UIWidgets::EnhancementRadioButton("From", CVAR_TRACKER_ENTRANCE("SortBy"), 1);
UIWidgets::Tooltip("Sort entrances by the overrided destination"); UIWidgets::Tooltip("Sort entrances by the overrided destination");
UIWidgets::Spacer(2.0f); UIWidgets::Spacer(2.0f);
ImGui::Text("List Items"); ImGui::Text("List Items");
UIWidgets::PaddedEnhancementCheckbox("Auto scroll", "gEntranceTrackerAutoScroll", true, false); UIWidgets::PaddedEnhancementCheckbox("Auto scroll", CVAR_TRACKER_ENTRANCE("AutoScroll"), true, false);
UIWidgets::Tooltip("Automatically scroll to the first aviable entrance in the current scene"); UIWidgets::Tooltip("Automatically scroll to the first aviable entrance in the current scene");
UIWidgets::PaddedEnhancementCheckbox("Highlight previous", "gEntranceTrackerHighlightPrevious", true, false); UIWidgets::PaddedEnhancementCheckbox("Highlight previous", CVAR_TRACKER_ENTRANCE("HighlightPrevious"), true, false);
UIWidgets::Tooltip("Highlight the previous entrance that Link came from"); UIWidgets::Tooltip("Highlight the previous entrance that Link came from");
UIWidgets::PaddedEnhancementCheckbox("Highlight available", "gEntranceTrackerHighlightAvailable", true, false); UIWidgets::PaddedEnhancementCheckbox("Highlight available", CVAR_TRACKER_ENTRANCE("HighlightAvailable"), true, false);
UIWidgets::Tooltip("Highlight available entrances in the current scene"); UIWidgets::Tooltip("Highlight available entrances in the current scene");
UIWidgets::PaddedEnhancementCheckbox("Hide undiscovered", "gEntranceTrackerCollapseUndiscovered", true, false); UIWidgets::PaddedEnhancementCheckbox("Hide undiscovered", CVAR_TRACKER_ENTRANCE("CollapseUndiscovered"), true, false);
UIWidgets::Tooltip("Collapse undiscovered entrances towards the bottom of each group"); UIWidgets::Tooltip("Collapse undiscovered entrances towards the bottom of each group");
bool disableHideReverseEntrances = OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_DECOUPLED_ENTRANCES) == RO_GENERIC_ON; bool disableHideReverseEntrances = OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_DECOUPLED_ENTRANCES) == RO_GENERIC_ON;
static const char* disableHideReverseEntrancesText = "This option is disabled because \"Decouple Entrances\" is enabled."; static const char* disableHideReverseEntrancesText = "This option is disabled because \"Decouple Entrances\" is enabled.";
UIWidgets::PaddedEnhancementCheckbox("Hide reverse", "gEntranceTrackerHideReverseEntrances", true, false, UIWidgets::PaddedEnhancementCheckbox("Hide reverse", CVAR_TRACKER_ENTRANCE("HideReverseEntrances"), true, false,
disableHideReverseEntrances, disableHideReverseEntrancesText, UIWidgets::CheckboxGraphics::Cross, true); disableHideReverseEntrances, disableHideReverseEntrancesText, UIWidgets::CheckboxGraphics::Cross, true);
UIWidgets::Tooltip("Hide reverse entrance transitions when Decouple Entrances is off"); UIWidgets::Tooltip("Hide reverse entrance transitions when Decouple Entrances is off");
UIWidgets::Spacer(0); UIWidgets::Spacer(0);
@ -694,17 +694,17 @@ void EntranceTrackerWindow::DrawElement() {
ImGui::TableNextColumn(); ImGui::TableNextColumn();
ImGui::Text("Group By"); ImGui::Text("Group By");
UIWidgets::EnhancementRadioButton("Area", "gEntranceTrackerGroupBy", 0); UIWidgets::EnhancementRadioButton("Area", CVAR_TRACKER_ENTRANCE("GroupBy"), 0);
UIWidgets::Tooltip("Group entrances by their area"); UIWidgets::Tooltip("Group entrances by their area");
UIWidgets::EnhancementRadioButton("Type", "gEntranceTrackerGroupBy", 1); UIWidgets::EnhancementRadioButton("Type", CVAR_TRACKER_ENTRANCE("GroupBy"), 1);
UIWidgets::Tooltip("Group entrances by their entrance type"); UIWidgets::Tooltip("Group entrances by their entrance type");
UIWidgets::Spacer(2.0f); UIWidgets::Spacer(2.0f);
ImGui::Text("Spoiler Reveal"); ImGui::Text("Spoiler Reveal");
UIWidgets::PaddedEnhancementCheckbox("Show \"To\"", "gEntranceTrackerShowTo", true, false); UIWidgets::PaddedEnhancementCheckbox("Show \"To\"", CVAR_TRACKER_ENTRANCE("ShowTo"), true, false);
UIWidgets::Tooltip("Reveal the \"To\" entrance for undiscovered entrances"); UIWidgets::Tooltip("Reveal the \"To\" entrance for undiscovered entrances");
UIWidgets::PaddedEnhancementCheckbox("Show \"From\"", "gEntranceTrackerShowFrom", true, false); UIWidgets::PaddedEnhancementCheckbox("Show \"From\"", CVAR_TRACKER_ENTRANCE("ShowFrom"), true, false);
UIWidgets::Tooltip("Reveal the \"From\" entrance for undiscovered entrances"); UIWidgets::Tooltip("Reveal the \"From\" entrance for undiscovered entrances");
ImGui::EndTable(); ImGui::EndTable();
@ -752,8 +752,8 @@ void EntranceTrackerWindow::DrawElement() {
nextTreeState = 2; nextTreeState = 2;
} }
uint8_t destToggle = CVarGetInteger("gEntranceTrackerSortBy", 0); uint8_t destToggle = CVarGetInteger(CVAR_TRACKER_ENTRANCE("SortBy"), 0);
uint8_t groupToggle = CVarGetInteger("gEntranceTrackerGroupBy", 0); uint8_t groupToggle = CVarGetInteger(CVAR_TRACKER_ENTRANCE("GroupBy"), 0);
// Combine destToggle and groupToggle to get a range of 0-3 // Combine destToggle and groupToggle to get a range of 0-3
uint8_t groupType = destToggle + (groupToggle * 2); uint8_t groupType = destToggle + (groupToggle * 2);
@ -804,7 +804,7 @@ void EntranceTrackerWindow::DrawElement() {
// However, if entrances are decoupled, then all transitions need to be displayed, so we proceed with the filtering // However, if entrances are decoupled, then all transitions need to be displayed, so we proceed with the filtering
if ((original->type == ENTRANCE_TYPE_DUNGEON || original->type == ENTRANCE_TYPE_GROTTO || original->type == ENTRANCE_TYPE_INTERIOR) && if ((original->type == ENTRANCE_TYPE_DUNGEON || original->type == ENTRANCE_TYPE_GROTTO || original->type == ENTRANCE_TYPE_INTERIOR) &&
(original->oneExit != 1 && OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_DECOUPLED_ENTRANCES) == RO_GENERIC_OFF) && (original->oneExit != 1 && OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_DECOUPLED_ENTRANCES) == RO_GENERIC_OFF) &&
CVarGetInteger("gEntranceTrackerHideReverseEntrances", 1) == 1) { CVarGetInteger(CVAR_TRACKER_ENTRANCE("HideReverseEntrances"), 1) == 1) {
continue; continue;
} }
@ -815,8 +815,8 @@ void EntranceTrackerWindow::DrawElement() {
bool isDiscovered = IsEntranceDiscovered(entrance.index); bool isDiscovered = IsEntranceDiscovered(entrance.index);
bool showOriginal = (!destToggle ? CVarGetInteger("gEntranceTrackerShowTo", 0) : CVarGetInteger("gEntranceTrackerShowFrom", 0)) || isDiscovered; bool showOriginal = (!destToggle ? CVarGetInteger(CVAR_TRACKER_ENTRANCE("ShowTo"), 0) : CVarGetInteger(CVAR_TRACKER_ENTRANCE("ShowFrom"), 0)) || isDiscovered;
bool showOverride = (!destToggle ? CVarGetInteger("gEntranceTrackerShowFrom", 0) : CVarGetInteger("gEntranceTrackerShowTo", 0)) || isDiscovered; bool showOverride = (!destToggle ? CVarGetInteger(CVAR_TRACKER_ENTRANCE("ShowFrom"), 0) : CVarGetInteger(CVAR_TRACKER_ENTRANCE("ShowTo"), 0)) || isDiscovered;
const char* origSrcAreaName = spoilerEntranceGroupNames[original->srcGroup].c_str(); const char* origSrcAreaName = spoilerEntranceGroupNames[original->srcGroup].c_str();
const char* origTypeName = groupTypeNames[original->type].c_str(); const char* origTypeName = groupTypeNames[original->type].c_str();
@ -829,7 +829,7 @@ void EntranceTrackerWindow::DrawElement() {
const char* rplcDstName = showOverride ? override->destination.c_str() : ""; const char* rplcDstName = showOverride ? override->destination.c_str() : "";
// Filter for entrances by group name, type, source/destination names, and meta tags // Filter for entrances by group name, type, source/destination names, and meta tags
if ((!locationSearch.IsActive() && (showOriginal || showOverride || !CVarGetInteger("gEntranceTrackerCollapseUndiscovered", 0))) || if ((!locationSearch.IsActive() && (showOriginal || showOverride || !CVarGetInteger(CVAR_TRACKER_ENTRANCE("CollapseUndiscovered"), 0))) ||
((showOriginal && (locationSearch.PassFilter(origSrcName) || ((showOriginal && (locationSearch.PassFilter(origSrcName) ||
locationSearch.PassFilter(origDstName) || locationSearch.PassFilter(origSrcAreaName) || locationSearch.PassFilter(origDstName) || locationSearch.PassFilter(origSrcAreaName) ||
locationSearch.PassFilter(origTypeName) || locationSearch.PassFilter(original->metaTag.c_str()))) || locationSearch.PassFilter(origTypeName) || locationSearch.PassFilter(original->metaTag.c_str()))) ||
@ -867,8 +867,8 @@ void EntranceTrackerWindow::DrawElement() {
bool isDiscovered = IsEntranceDiscovered(entrance.index); bool isDiscovered = IsEntranceDiscovered(entrance.index);
bool showOriginal = (!destToggle ? CVarGetInteger("gEntranceTrackerShowTo", 0) : CVarGetInteger("gEntranceTrackerShowFrom", 0)) || isDiscovered; bool showOriginal = (!destToggle ? CVarGetInteger(CVAR_TRACKER_ENTRANCE("ShowTo"), 0) : CVarGetInteger(CVAR_TRACKER_ENTRANCE("ShowFrom"), 0)) || isDiscovered;
bool showOverride = (!destToggle ? CVarGetInteger("gEntranceTrackerShowFrom", 0) : CVarGetInteger("gEntranceTrackerShowTo", 0)) || isDiscovered; bool showOverride = (!destToggle ? CVarGetInteger(CVAR_TRACKER_ENTRANCE("ShowFrom"), 0) : CVarGetInteger(CVAR_TRACKER_ENTRANCE("ShowTo"), 0)) || isDiscovered;
const char* unknown = "???"; const char* unknown = "???";
@ -882,16 +882,16 @@ void EntranceTrackerWindow::DrawElement() {
// Handle highlighting and auto scroll // Handle highlighting and auto scroll
if ((original->index == lastEntranceIndex || if ((original->index == lastEntranceIndex ||
(override->reverseIndex == lastEntranceIndex && OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_DECOUPLED_ENTRANCES) == RO_GENERIC_OFF)) && (override->reverseIndex == lastEntranceIndex && OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_DECOUPLED_ENTRANCES) == RO_GENERIC_OFF)) &&
CVarGetInteger("gEntranceTrackerHighlightPrevious", 0)) { CVarGetInteger(CVAR_TRACKER_ENTRANCE("HighlightPrevious"), 0)) {
color = COLOR_ORANGE; color = COLOR_ORANGE;
} else if (LinkIsInArea(original) != -1) { } else if (LinkIsInArea(original) != -1) {
if (CVarGetInteger("gEntranceTrackerHighlightAvailable", 0)) { if (CVarGetInteger(CVAR_TRACKER_ENTRANCE("HighlightAvailable"), 0)) {
color = COLOR_GREEN; color = COLOR_GREEN;
} }
if (doAreaScroll) { if (doAreaScroll) {
doAreaScroll = false; doAreaScroll = false;
if (CVarGetInteger("gEntranceTrackerAutoScroll", 0)) { if (CVarGetInteger(CVAR_TRACKER_ENTRANCE("AutoScroll"), 0)) {
ImGui::SetScrollHereY(0.0f); ImGui::SetScrollHereY(0.0f);
} }
} }

View File

@ -85,7 +85,7 @@ s16 GetLastEntranceOverride();
s16 GetCurrentGrottoId(); s16 GetCurrentGrottoId();
const EntranceData* GetEntranceData(s16); const EntranceData* GetEntranceData(s16);
class EntranceTrackerWindow : public LUS::GuiWindow { class EntranceTrackerWindow : public Ship::GuiWindow {
public: public:
using GuiWindow::GuiWindow; using GuiWindow::GuiWindow;

View File

@ -461,17 +461,17 @@ void DrawItemCount(ItemTrackerItem item, bool hideMax) {
if (!GameInteractor::IsSaveLoaded()) { if (!GameInteractor::IsSaveLoaded()) {
return; return;
} }
int iconSize = CVarGetInteger("gItemTrackerIconSize", 36); int iconSize = CVarGetInteger(CVAR_TRACKER_ITEM("IconSize"), 36);
int textSize = CVarGetInteger("gTrackers.ItemTracker.ItemTrackerTextSize", 13); int textSize = CVarGetInteger(CVAR_TRACKER_ITEM("TextSize"), 13);
ItemTrackerNumbers currentAndMax = GetItemCurrentAndMax(item); ItemTrackerNumbers currentAndMax = GetItemCurrentAndMax(item);
ImVec2 p = ImGui::GetCursorScreenPos(); ImVec2 p = ImGui::GetCursorScreenPos();
int32_t trackerNumberDisplayMode = CVarGetInteger("gItemTrackerCapacityTrack", ITEM_TRACKER_NUMBER_CURRENT_CAPACITY_ONLY); int32_t trackerNumberDisplayMode = CVarGetInteger(CVAR_TRACKER_ITEM("ItemCountType"), ITEM_TRACKER_NUMBER_CURRENT_CAPACITY_ONLY);
int32_t trackerKeyNumberDisplayMode = CVarGetInteger("gItemTrackerKeyTrack", KEYS_COLLECTED_MAX); int32_t trackerKeyNumberDisplayMode = CVarGetInteger(CVAR_TRACKER_ITEM("KeyCounts"), KEYS_COLLECTED_MAX);
float textScalingFactor = static_cast<float>(iconSize) / 36.0f; float textScalingFactor = static_cast<float>(iconSize) / 36.0f;
uint32_t actualItemId = INV_CONTENT(item.id); uint32_t actualItemId = INV_CONTENT(item.id);
bool hasItem = actualItemId != ITEM_NONE; bool hasItem = actualItemId != ITEM_NONE;
if (CVarGetInteger("gTrackers.ItemTracker.HookshotIdentifier", 0)) { if (CVarGetInteger(CVAR_TRACKER_ITEM("HookshotIdentifier"), 0)) {
if ((actualItemId == ITEM_HOOKSHOT || actualItemId == ITEM_LONGSHOT) && hasItem) { if ((actualItemId == ITEM_HOOKSHOT || actualItemId == ITEM_LONGSHOT) && hasItem) {
// Calculate the scaled position for the text // Calculate the scaled position for the text
@ -517,7 +517,7 @@ void DrawItemCount(ItemTrackerItem item, bool hideMax) {
ImU32 currentColor = IM_COL_WHITE; ImU32 currentColor = IM_COL_WHITE;
ImU32 maxColor = item.id == QUEST_SKULL_TOKEN ? IM_COL_RED : IM_COL_GREEN; ImU32 maxColor = item.id == QUEST_SKULL_TOKEN ? IM_COL_RED : IM_COL_GREEN;
bool shouldAlignToLeft = CVarGetInteger("gItemTrackerCurrentOnLeft", 0) && bool shouldAlignToLeft = CVarGetInteger(CVAR_TRACKER_ITEM("ItemCountAlignLeft"), 0) &&
trackerNumberDisplayMode != ITEM_TRACKER_NUMBER_CAPACITY && trackerNumberDisplayMode != ITEM_TRACKER_NUMBER_CAPACITY &&
trackerNumberDisplayMode != ITEM_TRACKER_NUMBER_AMMO; trackerNumberDisplayMode != ITEM_TRACKER_NUMBER_AMMO;
@ -577,7 +577,7 @@ void DrawItemCount(ItemTrackerItem item, bool hideMax) {
uint8_t piecesTotal = (OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_TRIFORCE_HUNT_PIECES_TOTAL) + 1); uint8_t piecesTotal = (OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_TRIFORCE_HUNT_PIECES_TOTAL) + 1);
ImU32 currentColor = gSaveContext.triforcePiecesCollected >= piecesRequired ? IM_COL_GREEN : IM_COL_WHITE; ImU32 currentColor = gSaveContext.triforcePiecesCollected >= piecesRequired ? IM_COL_GREEN : IM_COL_WHITE;
ImU32 maxColor = IM_COL_GREEN; ImU32 maxColor = IM_COL_GREEN;
int32_t trackerTriforcePieceNumberDisplayMode = CVarGetInteger("gItemTrackerTriforcePieceTrack", TRIFORCE_PIECE_COLLECTED_REQUIRED_MAX); int32_t trackerTriforcePieceNumberDisplayMode = CVarGetInteger(CVAR_TRACKER_ITEM("TriforcePieceCounts"), TRIFORCE_PIECE_COLLECTED_REQUIRED_MAX);
currentString += std::to_string(gSaveContext.triforcePiecesCollected); currentString += std::to_string(gSaveContext.triforcePiecesCollected);
currentString += "/"; currentString += "/";
@ -607,8 +607,8 @@ void DrawItemCount(ItemTrackerItem item, bool hideMax) {
void DrawEquip(ItemTrackerItem item) { void DrawEquip(ItemTrackerItem item) {
bool hasEquip = HasEquipment(item); bool hasEquip = HasEquipment(item);
int iconSize = CVarGetInteger("gItemTrackerIconSize", 36); int iconSize = CVarGetInteger(CVAR_TRACKER_ITEM("IconSize"), 36);
ImGui::Image(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(hasEquip && IsValidSaveFile() ? item.name : item.nameFaded), ImGui::Image(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(hasEquip && IsValidSaveFile() ? item.name : item.nameFaded),
ImVec2(iconSize, iconSize), ImVec2(0, 0), ImVec2(1, 1)); ImVec2(iconSize, iconSize), ImVec2(0, 0), ImVec2(1, 1));
UIWidgets::SetLastItemHoverText(SohUtils::GetItemName(item.id)); UIWidgets::SetLastItemHoverText(SohUtils::GetItemName(item.id));
@ -616,9 +616,9 @@ void DrawEquip(ItemTrackerItem item) {
void DrawQuest(ItemTrackerItem item) { void DrawQuest(ItemTrackerItem item) {
bool hasQuestItem = HasQuestItem(item); bool hasQuestItem = HasQuestItem(item);
int iconSize = CVarGetInteger("gItemTrackerIconSize", 36); int iconSize = CVarGetInteger(CVAR_TRACKER_ITEM("IconSize"), 36);
ImGui::BeginGroup(); ImGui::BeginGroup();
ImGui::Image(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(hasQuestItem && IsValidSaveFile() ? item.name : item.nameFaded), ImGui::Image(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(hasQuestItem && IsValidSaveFile() ? item.name : item.nameFaded),
ImVec2(iconSize, iconSize), ImVec2(0, 0), ImVec2(1, 1)); ImVec2(iconSize, iconSize), ImVec2(0, 0), ImVec2(1, 1));
if (item.id == QUEST_SKULL_TOKEN) { if (item.id == QUEST_SKULL_TOKEN) {
@ -633,7 +633,7 @@ void DrawQuest(ItemTrackerItem item) {
void DrawItem(ItemTrackerItem item) { void DrawItem(ItemTrackerItem item) {
uint32_t actualItemId = GameInteractor::IsSaveLoaded() ? INV_CONTENT(item.id) : ITEM_NONE; uint32_t actualItemId = GameInteractor::IsSaveLoaded() ? INV_CONTENT(item.id) : ITEM_NONE;
int iconSize = CVarGetInteger("gItemTrackerIconSize", 36); int iconSize = CVarGetInteger(CVAR_TRACKER_ITEM("IconSize"), 36);
bool hasItem = actualItemId != ITEM_NONE; bool hasItem = actualItemId != ITEM_NONE;
std::string itemName = ""; std::string itemName = "";
@ -766,7 +766,7 @@ void DrawItem(ItemTrackerItem item) {
ImGui::BeginGroup(); ImGui::BeginGroup();
ImGui::Image(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(hasItem && IsValidSaveFile() ? item.name : item.nameFaded), ImGui::Image(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(hasItem && IsValidSaveFile() ? item.name : item.nameFaded),
ImVec2(iconSize, iconSize), ImVec2(0, 0), ImVec2(1, 1)); ImVec2(iconSize, iconSize), ImVec2(0, 0), ImVec2(1, 1));
DrawItemCount(item, false); DrawItemCount(item, false);
@ -806,8 +806,8 @@ void DrawBottle(ItemTrackerItem item) {
item = actualItemTrackerItemMap[actualItemId]; item = actualItemTrackerItemMap[actualItemId];
} }
int iconSize = CVarGetInteger("gItemTrackerIconSize", 36); int iconSize = CVarGetInteger(CVAR_TRACKER_ITEM("IconSize"), 36);
ImGui::Image(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(hasItem && IsValidSaveFile() ? item.name : item.nameFaded), ImGui::Image(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(hasItem && IsValidSaveFile() ? item.name : item.nameFaded),
ImVec2(iconSize, iconSize), ImVec2(0, 0), ImVec2(1, 1)); ImVec2(iconSize, iconSize), ImVec2(0, 0), ImVec2(1, 1));
UIWidgets::SetLastItemHoverText(SohUtils::GetItemName(item.id)); UIWidgets::SetLastItemHoverText(SohUtils::GetItemName(item.id));
@ -817,16 +817,16 @@ void DrawDungeonItem(ItemTrackerItem item) {
uint32_t itemId = item.id; uint32_t itemId = item.id;
ImU32 dungeonColor = IM_COL_WHITE; ImU32 dungeonColor = IM_COL_WHITE;
uint32_t bitMask = 1 << (item.id - ITEM_KEY_BOSS); // Bitset starts at ITEM_KEY_BOSS == 0. the rest are sequential uint32_t bitMask = 1 << (item.id - ITEM_KEY_BOSS); // Bitset starts at ITEM_KEY_BOSS == 0. the rest are sequential
int iconSize = CVarGetInteger("gItemTrackerIconSize", 36); int iconSize = CVarGetInteger(CVAR_TRACKER_ITEM("IconSize"), 36);
bool hasItem = GameInteractor::IsSaveLoaded() ? (bitMask & gSaveContext.inventory.dungeonItems[item.data]) : false; bool hasItem = GameInteractor::IsSaveLoaded() ? (bitMask & gSaveContext.inventory.dungeonItems[item.data]) : false;
bool hasSmallKey = GameInteractor::IsSaveLoaded() ? ((gSaveContext.inventory.dungeonKeys[item.data]) >= 0) : false; bool hasSmallKey = GameInteractor::IsSaveLoaded() ? ((gSaveContext.inventory.dungeonKeys[item.data]) >= 0) : false;
ImGui::BeginGroup(); ImGui::BeginGroup();
if (itemId == ITEM_KEY_SMALL) { if (itemId == ITEM_KEY_SMALL) {
ImGui::Image(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(hasSmallKey && IsValidSaveFile() ? item.name : item.nameFaded), ImGui::Image(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(hasSmallKey && IsValidSaveFile() ? item.name : item.nameFaded),
ImVec2(iconSize, iconSize), ImVec2(0, 0), ImVec2(1, 1)); ImVec2(iconSize, iconSize), ImVec2(0, 0), ImVec2(1, 1));
} }
else { else {
ImGui::Image(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(hasItem && IsValidSaveFile() ? item.name : item.nameFaded), ImGui::Image(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(hasItem && IsValidSaveFile() ? item.name : item.nameFaded),
ImVec2(iconSize, iconSize), ImVec2(0, 0), ImVec2(1, 1)); ImVec2(iconSize, iconSize), ImVec2(0, 0), ImVec2(1, 1));
} }
@ -863,19 +863,19 @@ void DrawDungeonItem(ItemTrackerItem item) {
} }
void DrawSong(ItemTrackerItem item) { void DrawSong(ItemTrackerItem item) {
int iconSize = CVarGetInteger("gItemTrackerIconSize", 36); int iconSize = CVarGetInteger(CVAR_TRACKER_ITEM("IconSize"), 36);
ImVec2 p = ImGui::GetCursorScreenPos(); ImVec2 p = ImGui::GetCursorScreenPos();
bool hasSong = HasSong(item); bool hasSong = HasSong(item);
ImGui::SetCursorScreenPos(ImVec2(p.x + 6, p.y)); ImGui::SetCursorScreenPos(ImVec2(p.x + 6, p.y));
ImGui::Image(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(hasSong && IsValidSaveFile() ? item.name : item.nameFaded), ImGui::Image(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(hasSong && IsValidSaveFile() ? item.name : item.nameFaded),
ImVec2(iconSize / 1.5, iconSize), ImVec2(0, 0), ImVec2(1, 1)); ImVec2(iconSize / 1.5, iconSize), ImVec2(0, 0), ImVec2(1, 1));
UIWidgets::SetLastItemHoverText(SohUtils::GetQuestItemName(item.id)); UIWidgets::SetLastItemHoverText(SohUtils::GetQuestItemName(item.id));
} }
void DrawNotes(bool resizeable = false) { void DrawNotes(bool resizeable = false) {
ImGui::BeginGroup(); ImGui::BeginGroup();
int iconSize = CVarGetInteger("gItemTrackerIconSize", 36); int iconSize = CVarGetInteger(CVAR_TRACKER_ITEM("IconSize"), 36);
int iconSpacing = CVarGetInteger("gItemTrackerIconSpacing", 12); int iconSpacing = CVarGetInteger(CVAR_TRACKER_ITEM("IconSpacing"), 12);
struct ItemTrackerNotes { struct ItemTrackerNotes {
static int TrackerNotesResizeCallback(ImGuiInputTextCallbackData* data) { static int TrackerNotesResizeCallback(ImGuiInputTextCallbackData* data) {
@ -920,11 +920,11 @@ void BeginFloatingWindows(std::string UniqueName, ImGuiWindowFlags flags = 0) {
windowFlags |= ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoFocusOnAppearing | ImGuiWindowFlags_NoResize; windowFlags |= ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoFocusOnAppearing | ImGuiWindowFlags_NoResize;
} }
if (CVarGetInteger("gItemTrackerWindowType", TRACKER_WINDOW_FLOATING) == TRACKER_WINDOW_FLOATING) { if (CVarGetInteger(CVAR_TRACKER_ITEM("WindowType"), TRACKER_WINDOW_FLOATING) == TRACKER_WINDOW_FLOATING) {
ImGui::SetNextWindowViewport(ImGui::GetMainViewport()->ID); ImGui::SetNextWindowViewport(ImGui::GetMainViewport()->ID);
windowFlags |= ImGuiWindowFlags_NoDocking | ImGuiWindowFlags_NoNav | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoScrollWithMouse | ImGuiWindowFlags_NoScrollbar; windowFlags |= ImGuiWindowFlags_NoDocking | ImGuiWindowFlags_NoNav | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoScrollWithMouse | ImGuiWindowFlags_NoScrollbar;
if (!CVarGetInteger("gItemTrackerHudEditMode", 0)) { if (!CVarGetInteger(CVAR_TRACKER_ITEM("Draggable"), 0)) {
windowFlags |= ImGuiWindowFlags_NoInputs | ImGuiWindowFlags_NoMove; windowFlags |= ImGuiWindowFlags_NoInputs | ImGuiWindowFlags_NoMove;
} }
} }
@ -945,9 +945,9 @@ void EndFloatingWindows() {
* Takes in a vector of ItemTrackerItem and draws them in rows of N items * Takes in a vector of ItemTrackerItem and draws them in rows of N items
*/ */
void DrawItemsInRows(std::vector<ItemTrackerItem> items, int columns = 6) { void DrawItemsInRows(std::vector<ItemTrackerItem> items, int columns = 6) {
int iconSize = CVarGetInteger("gItemTrackerIconSize", 36); int iconSize = CVarGetInteger(CVAR_TRACKER_ITEM("IconSize"), 36);
int iconSpacing = CVarGetInteger("gItemTrackerIconSpacing", 12); int iconSpacing = CVarGetInteger(CVAR_TRACKER_ITEM("IconSpacing"), 12);
int topPadding = (CVarGetInteger("gItemTrackerWindowType", TRACKER_WINDOW_FLOATING) == TRACKER_WINDOW_WINDOW) ? 20 : 0; int topPadding = (CVarGetInteger(CVAR_TRACKER_ITEM("WindowType"), TRACKER_WINDOW_FLOATING) == TRACKER_WINDOW_WINDOW) ? 20 : 0;
for (int i = 0; i < items.size(); i++) { for (int i = 0; i < items.size(); i++) {
int row = i / columns; int row = i / columns;
@ -962,8 +962,8 @@ void DrawItemsInRows(std::vector<ItemTrackerItem> items, int columns = 6) {
* Takes in a vector of ItemTrackerItem and draws them evenly spread across a circle * Takes in a vector of ItemTrackerItem and draws them evenly spread across a circle
*/ */
void DrawItemsInACircle(std::vector<ItemTrackerItem> items) { void DrawItemsInACircle(std::vector<ItemTrackerItem> items) {
int iconSize = CVarGetInteger("gItemTrackerIconSize", 36); int iconSize = CVarGetInteger(CVAR_TRACKER_ITEM("IconSize"), 36);
int iconSpacing = CVarGetInteger("gItemTrackerIconSpacing", 12); int iconSpacing = CVarGetInteger(CVAR_TRACKER_ITEM("IconSpacing"), 12);
ImVec2 max = ImGui::GetWindowContentRegionMax(); ImVec2 max = ImGui::GetWindowContentRegionMax();
float radius = (iconSize + iconSpacing) * 2; float radius = (iconSize + iconSpacing) * 2;
@ -972,7 +972,7 @@ void DrawItemsInACircle(std::vector<ItemTrackerItem> items) {
float angle = (float)i / items.size() * 2.0f * M_PI; float angle = (float)i / items.size() * 2.0f * M_PI;
float x = (radius / 2.0f) * cos(angle) + max.x / 2.0f; float x = (radius / 2.0f) * cos(angle) + max.x / 2.0f;
float y = (radius / 2.0f) * sin(angle) + max.y / 2.0f; float y = (radius / 2.0f) * sin(angle) + max.y / 2.0f;
ImGui::SetCursorPos(ImVec2(x - (CVarGetInteger("gItemTrackerIconSize", 36) - 8) / 2.0f, y + 4)); ImGui::SetCursorPos(ImVec2(x - (CVarGetInteger(CVAR_TRACKER_ITEM("IconSize"), 36) - 8) / 2.0f, y + 4));
items[i].drawFunc(items[i]); items[i].drawFunc(items[i]);
} }
} }
@ -983,8 +983,8 @@ void DrawItemsInACircle(std::vector<ItemTrackerItem> items) {
* to then call DrawItemsInRows * to then call DrawItemsInRows
*/ */
std::vector<ItemTrackerItem> GetDungeonItemsVector(std::vector<ItemTrackerDungeon> dungeons, int columns = 6) { std::vector<ItemTrackerItem> GetDungeonItemsVector(std::vector<ItemTrackerDungeon> dungeons, int columns = 6) {
int iconSize = CVarGetInteger("gItemTrackerIconSize", 36); int iconSize = CVarGetInteger(CVAR_TRACKER_ITEM("IconSize"), 36);
int iconSpacing = CVarGetInteger("gItemTrackerIconSpacing", 12); int iconSpacing = CVarGetInteger(CVAR_TRACKER_ITEM("IconSpacing"), 12);
std::vector<ItemTrackerItem> dungeonItems = {}; std::vector<ItemTrackerItem> dungeonItems = {};
int rowCount = 0; int rowCount = 0;
@ -1039,8 +1039,8 @@ void UpdateVectors() {
dungeonRewards.insert(dungeonRewards.end(), dungeonRewardMedallions.begin(), dungeonRewardMedallions.end()); dungeonRewards.insert(dungeonRewards.end(), dungeonRewardMedallions.begin(), dungeonRewardMedallions.end());
dungeonItems.clear(); dungeonItems.clear();
if (CVarGetInteger("gItemTrackerDisplayDungeonItemsHorizontal", 1) && CVarGetInteger("gItemTrackerDungeonItemsDisplayType", SECTION_DISPLAY_HIDDEN) == SECTION_DISPLAY_SEPARATE) { if (CVarGetInteger(CVAR_TRACKER_ITEM("DungeonItems.Layout"), 1) && CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.DungeonItems"), SECTION_DISPLAY_HIDDEN) == SECTION_DISPLAY_SEPARATE) {
if (CVarGetInteger("gItemTrackerDisplayDungeonItemsMaps", 1)) { if (CVarGetInteger(CVAR_TRACKER_ITEM("DungeonItems.DisplayMaps"), 1)) {
dungeonItems = GetDungeonItemsVector(itemTrackerDungeonsWithMapsHorizontal, 12); dungeonItems = GetDungeonItemsVector(itemTrackerDungeonsWithMapsHorizontal, 12);
// Manually adding Thieves Hideout to an open spot so we don't get an additional row for one item // Manually adding Thieves Hideout to an open spot so we don't get an additional row for one item
dungeonItems[23] = ITEM_TRACKER_ITEM(ITEM_KEY_SMALL, SCENE_THIEVES_HIDEOUT, DrawDungeonItem); dungeonItems[23] = ITEM_TRACKER_ITEM(ITEM_KEY_SMALL, SCENE_THIEVES_HIDEOUT, DrawDungeonItem);
@ -1050,7 +1050,7 @@ void UpdateVectors() {
dungeonItems[15] = ITEM_TRACKER_ITEM(ITEM_KEY_SMALL, SCENE_THIEVES_HIDEOUT, DrawDungeonItem); dungeonItems[15] = ITEM_TRACKER_ITEM(ITEM_KEY_SMALL, SCENE_THIEVES_HIDEOUT, DrawDungeonItem);
} }
} else { } else {
if (CVarGetInteger("gItemTrackerDisplayDungeonItemsMaps", 1)) { if (CVarGetInteger(CVAR_TRACKER_ITEM("DungeonItems.DisplayMaps"), 1)) {
dungeonItems = GetDungeonItemsVector(itemTrackerDungeonsWithMapsCompact); dungeonItems = GetDungeonItemsVector(itemTrackerDungeonsWithMapsCompact);
// Manually adding Thieves Hideout to an open spot so we don't get an additional row for one item // Manually adding Thieves Hideout to an open spot so we don't get an additional row for one item
dungeonItems[35] = ITEM_TRACKER_ITEM(ITEM_KEY_SMALL, SCENE_THIEVES_HIDEOUT, DrawDungeonItem); dungeonItems[35] = ITEM_TRACKER_ITEM(ITEM_KEY_SMALL, SCENE_THIEVES_HIDEOUT, DrawDungeonItem);
@ -1060,37 +1060,37 @@ void UpdateVectors() {
} }
mainWindowItems.clear(); mainWindowItems.clear();
if (CVarGetInteger("gItemTrackerInventoryItemsDisplayType", SECTION_DISPLAY_MAIN_WINDOW) == SECTION_DISPLAY_MAIN_WINDOW) { if (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.Inventory"), SECTION_DISPLAY_MAIN_WINDOW) == SECTION_DISPLAY_MAIN_WINDOW) {
mainWindowItems.insert(mainWindowItems.end(), inventoryItems.begin(), inventoryItems.end()); mainWindowItems.insert(mainWindowItems.end(), inventoryItems.begin(), inventoryItems.end());
} }
if (CVarGetInteger("gItemTrackerEquipmentItemsDisplayType", SECTION_DISPLAY_MAIN_WINDOW) == SECTION_DISPLAY_MAIN_WINDOW) { if (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.Equipment"), SECTION_DISPLAY_MAIN_WINDOW) == SECTION_DISPLAY_MAIN_WINDOW) {
mainWindowItems.insert(mainWindowItems.end(), equipmentItems.begin(), equipmentItems.end()); mainWindowItems.insert(mainWindowItems.end(), equipmentItems.begin(), equipmentItems.end());
} }
if (CVarGetInteger("gItemTrackerMiscItemsDisplayType", SECTION_DISPLAY_MAIN_WINDOW) == SECTION_DISPLAY_MAIN_WINDOW) { if (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.Misc"), SECTION_DISPLAY_MAIN_WINDOW) == SECTION_DISPLAY_MAIN_WINDOW) {
mainWindowItems.insert(mainWindowItems.end(), miscItems.begin(), miscItems.end()); mainWindowItems.insert(mainWindowItems.end(), miscItems.begin(), miscItems.end());
} }
if (CVarGetInteger("gItemTrackerDungeonRewardsDisplayType", SECTION_DISPLAY_MAIN_WINDOW) == SECTION_DISPLAY_MAIN_WINDOW) { if (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.DungeonRewards"), SECTION_DISPLAY_MAIN_WINDOW) == SECTION_DISPLAY_MAIN_WINDOW) {
mainWindowItems.insert(mainWindowItems.end(), dungeonRewardStones.begin(), dungeonRewardStones.end()); mainWindowItems.insert(mainWindowItems.end(), dungeonRewardStones.begin(), dungeonRewardStones.end());
mainWindowItems.insert(mainWindowItems.end(), dungeonRewardMedallions.begin(), dungeonRewardMedallions.end()); mainWindowItems.insert(mainWindowItems.end(), dungeonRewardMedallions.begin(), dungeonRewardMedallions.end());
} }
if (CVarGetInteger("gItemTrackerSongsDisplayType", SECTION_DISPLAY_MAIN_WINDOW) == SECTION_DISPLAY_MAIN_WINDOW) { if (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.Songs"), SECTION_DISPLAY_MAIN_WINDOW) == SECTION_DISPLAY_MAIN_WINDOW) {
if (CVarGetInteger("gItemTrackerMiscItemsDisplayType", SECTION_DISPLAY_MAIN_WINDOW) == SECTION_DISPLAY_MAIN_WINDOW && if (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.Misc"), SECTION_DISPLAY_MAIN_WINDOW) == SECTION_DISPLAY_MAIN_WINDOW &&
CVarGetInteger("gItemTrackerDungeonRewardsDisplayType", SECTION_DISPLAY_MAIN_WINDOW) != SECTION_DISPLAY_MAIN_WINDOW) { CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.DungeonRewards"), SECTION_DISPLAY_MAIN_WINDOW) != SECTION_DISPLAY_MAIN_WINDOW) {
mainWindowItems.push_back(ITEM_TRACKER_ITEM(ITEM_NONE, 0, DrawItem)); mainWindowItems.push_back(ITEM_TRACKER_ITEM(ITEM_NONE, 0, DrawItem));
mainWindowItems.push_back(ITEM_TRACKER_ITEM(ITEM_NONE, 0, DrawItem)); mainWindowItems.push_back(ITEM_TRACKER_ITEM(ITEM_NONE, 0, DrawItem));
mainWindowItems.push_back(ITEM_TRACKER_ITEM(ITEM_NONE, 0, DrawItem)); mainWindowItems.push_back(ITEM_TRACKER_ITEM(ITEM_NONE, 0, DrawItem));
} }
mainWindowItems.insert(mainWindowItems.end(), songItems.begin(), songItems.end()); mainWindowItems.insert(mainWindowItems.end(), songItems.begin(), songItems.end());
} }
if (CVarGetInteger("gItemTrackerDungeonItemsDisplayType", SECTION_DISPLAY_HIDDEN) == SECTION_DISPLAY_MAIN_WINDOW) { if (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.DungeonItems"), SECTION_DISPLAY_HIDDEN) == SECTION_DISPLAY_MAIN_WINDOW) {
mainWindowItems.insert(mainWindowItems.end(), dungeonItems.begin(), dungeonItems.end()); mainWindowItems.insert(mainWindowItems.end(), dungeonItems.begin(), dungeonItems.end());
} }
// if we're adding greg to the misc window, // if we're adding greg to the misc window,
// and misc isn't on the main window, // and misc isn't on the main window,
// and it doesn't already have greg, add him // and it doesn't already have greg, add him
if (CVarGetInteger("gItemTrackerGregDisplayType", SECTION_DISPLAY_EXTENDED_HIDDEN) == SECTION_DISPLAY_EXTENDED_MISC_WINDOW && if (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.Greg"), SECTION_DISPLAY_EXTENDED_HIDDEN) == SECTION_DISPLAY_EXTENDED_MISC_WINDOW &&
CVarGetInteger("gItemTrackerMiscItemsDisplayType", SECTION_DISPLAY_MAIN_WINDOW) != SECTION_DISPLAY_MAIN_WINDOW) { CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.Misc"), SECTION_DISPLAY_MAIN_WINDOW) != SECTION_DISPLAY_MAIN_WINDOW) {
if (std::none_of(miscItems.begin(), miscItems.end(), [](ItemTrackerItem item) { return item.id == ITEM_RUPEE_GREEN; })) if (std::none_of(miscItems.begin(), miscItems.end(), [](ItemTrackerItem item) { return item.id == ITEM_RUPEE_GREEN; }))
miscItems.insert(miscItems.end(), gregItems.begin(), gregItems.end()); miscItems.insert(miscItems.end(), gregItems.begin(), gregItems.end());
} else { } else {
@ -1099,7 +1099,7 @@ void UpdateVectors() {
bool newRowAdded = false; bool newRowAdded = false;
// if we're adding greg to the main window // if we're adding greg to the main window
if (CVarGetInteger("gItemTrackerGregDisplayType", SECTION_DISPLAY_EXTENDED_HIDDEN) == SECTION_DISPLAY_EXTENDED_MAIN_WINDOW) { if (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.Greg"), SECTION_DISPLAY_EXTENDED_HIDDEN) == SECTION_DISPLAY_EXTENDED_MAIN_WINDOW) {
if (!newRowAdded) { if (!newRowAdded) {
// insert empty items until we're on a new row for greg // insert empty items until we're on a new row for greg
while (mainWindowItems.size() % 6) { while (mainWindowItems.size() % 6) {
@ -1113,7 +1113,7 @@ void UpdateVectors() {
} }
// If we're adding triforce pieces to the main window // If we're adding triforce pieces to the main window
if (CVarGetInteger("gItemTrackerTriforcePiecesDisplayType", SECTION_DISPLAY_HIDDEN) == SECTION_DISPLAY_MAIN_WINDOW) { if (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.TriforcePieces"), SECTION_DISPLAY_HIDDEN) == SECTION_DISPLAY_MAIN_WINDOW) {
// If Greg isn't on the main window, add empty items to place the triforce pieces on a new row. // If Greg isn't on the main window, add empty items to place the triforce pieces on a new row.
if (!newRowAdded) { if (!newRowAdded) {
while (mainWindowItems.size() % 6) { while (mainWindowItems.size() % 6) {
@ -1194,57 +1194,57 @@ void ItemTrackerLoadFile() {
void ItemTrackerWindow::DrawElement() { void ItemTrackerWindow::DrawElement() {
UpdateVectors(); UpdateVectors();
int iconSize = CVarGetInteger("gItemTrackerIconSize", 36); int iconSize = CVarGetInteger(CVAR_TRACKER_ITEM("IconSize"), 36);
int iconSpacing = CVarGetInteger("gItemTrackerIconSpacing", 12); int iconSpacing = CVarGetInteger(CVAR_TRACKER_ITEM("IconSpacing"), 12);
int comboButton1Mask = buttonMap[CVarGetInteger("gItemTrackerComboButton1", TRACKER_COMBO_BUTTON_L)]; int comboButton1Mask = buttonMap[CVarGetInteger(CVAR_TRACKER_ITEM("ComboButton1"), TRACKER_COMBO_BUTTON_L)];
int comboButton2Mask = buttonMap[CVarGetInteger("gItemTrackerComboButton2", TRACKER_COMBO_BUTTON_R)]; int comboButton2Mask = buttonMap[CVarGetInteger(CVAR_TRACKER_ITEM("ComboButton2"), TRACKER_COMBO_BUTTON_R)];
OSContPad* buttonsPressed = LUS::Context::GetInstance()->GetControlDeck()->GetPads(); OSContPad* buttonsPressed = Ship::Context::GetInstance()->GetControlDeck()->GetPads();
bool comboButtonsHeld = buttonsPressed != nullptr && buttonsPressed[0].button & comboButton1Mask && buttonsPressed[0].button & comboButton2Mask; bool comboButtonsHeld = buttonsPressed != nullptr && buttonsPressed[0].button & comboButton1Mask && buttonsPressed[0].button & comboButton2Mask;
bool isPaused = CVarGetInteger("gItemTrackerShowOnlyPaused", 0) == 0 || gPlayState != nullptr && gPlayState->pauseCtx.state > 0; bool isPaused = CVarGetInteger(CVAR_TRACKER_ITEM("ShowOnlyPaused"), 0) == 0 || gPlayState != nullptr && gPlayState->pauseCtx.state > 0;
if (CVarGetInteger("gItemTrackerWindowType", TRACKER_WINDOW_FLOATING) == TRACKER_WINDOW_WINDOW || isPaused && (CVarGetInteger("gItemTrackerDisplayType", TRACKER_DISPLAY_ALWAYS) == TRACKER_DISPLAY_ALWAYS ? CVarGetInteger("gItemTrackerEnabled", 0) : comboButtonsHeld)) { if (CVarGetInteger(CVAR_TRACKER_ITEM("WindowType"), TRACKER_WINDOW_FLOATING) == TRACKER_WINDOW_WINDOW || isPaused && (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.Main"), TRACKER_DISPLAY_ALWAYS) == TRACKER_DISPLAY_ALWAYS ? CVarGetInteger(CVAR_WINDOW("ItemTracker"), 0) : comboButtonsHeld)) {
if ( if (
(CVarGetInteger("gItemTrackerInventoryItemsDisplayType", SECTION_DISPLAY_MAIN_WINDOW) == SECTION_DISPLAY_MAIN_WINDOW) || (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.Inventory"), SECTION_DISPLAY_MAIN_WINDOW) == SECTION_DISPLAY_MAIN_WINDOW) ||
(CVarGetInteger("gItemTrackerEquipmentItemsDisplayType", SECTION_DISPLAY_MAIN_WINDOW) == SECTION_DISPLAY_MAIN_WINDOW) || (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.Equipment"), SECTION_DISPLAY_MAIN_WINDOW) == SECTION_DISPLAY_MAIN_WINDOW) ||
(CVarGetInteger("gItemTrackerMiscItemsDisplayType", SECTION_DISPLAY_MAIN_WINDOW) == SECTION_DISPLAY_MAIN_WINDOW) || (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.Misc"), SECTION_DISPLAY_MAIN_WINDOW) == SECTION_DISPLAY_MAIN_WINDOW) ||
(CVarGetInteger("gItemTrackerDungeonRewardsDisplayType", SECTION_DISPLAY_MAIN_WINDOW) == SECTION_DISPLAY_MAIN_WINDOW) || (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.DungeonRewards"), SECTION_DISPLAY_MAIN_WINDOW) == SECTION_DISPLAY_MAIN_WINDOW) ||
(CVarGetInteger("gItemTrackerSongsDisplayType", SECTION_DISPLAY_MAIN_WINDOW) == SECTION_DISPLAY_MAIN_WINDOW) || (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.Songs"), SECTION_DISPLAY_MAIN_WINDOW) == SECTION_DISPLAY_MAIN_WINDOW) ||
(CVarGetInteger("gItemTrackerDungeonItemsDisplayType", SECTION_DISPLAY_HIDDEN) == SECTION_DISPLAY_MAIN_WINDOW) || (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.DungeonItems"), SECTION_DISPLAY_HIDDEN) == SECTION_DISPLAY_MAIN_WINDOW) ||
(CVarGetInteger("gItemTrackerGregDisplayType", SECTION_DISPLAY_EXTENDED_HIDDEN) == SECTION_DISPLAY_EXTENDED_MAIN_WINDOW) || (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.Greg"), SECTION_DISPLAY_EXTENDED_HIDDEN) == SECTION_DISPLAY_EXTENDED_MAIN_WINDOW) ||
(CVarGetInteger("gItemTrackerTriforcePiecesDisplayType", SECTION_DISPLAY_HIDDEN) == SECTION_DISPLAY_MAIN_WINDOW) || (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.TriforcePieces"), SECTION_DISPLAY_HIDDEN) == SECTION_DISPLAY_MAIN_WINDOW) ||
(CVarGetInteger("gItemTrackerFishingPoleDisplayType", SECTION_DISPLAY_EXTENDED_HIDDEN) == SECTION_DISPLAY_EXTENDED_MAIN_WINDOW) || (CVarGetInteger("gItemTrackerFishingPoleDisplayType", SECTION_DISPLAY_EXTENDED_HIDDEN) == SECTION_DISPLAY_EXTENDED_MAIN_WINDOW) ||
(CVarGetInteger("gItemTrackerNotesDisplayType", SECTION_DISPLAY_HIDDEN) == SECTION_DISPLAY_MAIN_WINDOW) (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.Notes"), SECTION_DISPLAY_HIDDEN) == SECTION_DISPLAY_MAIN_WINDOW)
) { ) {
BeginFloatingWindows("Item Tracker##main window"); BeginFloatingWindows("Item Tracker##main window");
DrawItemsInRows(mainWindowItems, 6); DrawItemsInRows(mainWindowItems, 6);
if (CVarGetInteger("gItemTrackerNotesDisplayType", SECTION_DISPLAY_HIDDEN) == SECTION_DISPLAY_MAIN_WINDOW && CVarGetInteger("gItemTrackerDisplayType", TRACKER_DISPLAY_ALWAYS) == TRACKER_DISPLAY_ALWAYS) { if (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.Notes"), SECTION_DISPLAY_HIDDEN) == SECTION_DISPLAY_MAIN_WINDOW && CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.Main"), TRACKER_DISPLAY_ALWAYS) == TRACKER_DISPLAY_ALWAYS) {
DrawNotes(); DrawNotes();
} }
EndFloatingWindows(); EndFloatingWindows();
} }
if (CVarGetInteger("gItemTrackerInventoryItemsDisplayType", SECTION_DISPLAY_MAIN_WINDOW) == SECTION_DISPLAY_SEPARATE) { if (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.Inventory"), SECTION_DISPLAY_MAIN_WINDOW) == SECTION_DISPLAY_SEPARATE) {
BeginFloatingWindows("Inventory Items Tracker"); BeginFloatingWindows("Inventory Items Tracker");
DrawItemsInRows(inventoryItems); DrawItemsInRows(inventoryItems);
EndFloatingWindows(); EndFloatingWindows();
} }
if (CVarGetInteger("gItemTrackerEquipmentItemsDisplayType", SECTION_DISPLAY_MAIN_WINDOW) == SECTION_DISPLAY_SEPARATE) { if (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.Equipment"), SECTION_DISPLAY_MAIN_WINDOW) == SECTION_DISPLAY_SEPARATE) {
BeginFloatingWindows("Equipment Items Tracker"); BeginFloatingWindows("Equipment Items Tracker");
DrawItemsInRows(equipmentItems, 3); DrawItemsInRows(equipmentItems, 3);
EndFloatingWindows(); EndFloatingWindows();
} }
if (CVarGetInteger("gItemTrackerMiscItemsDisplayType", SECTION_DISPLAY_MAIN_WINDOW) == SECTION_DISPLAY_SEPARATE) { if (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.Misc"), SECTION_DISPLAY_MAIN_WINDOW) == SECTION_DISPLAY_SEPARATE) {
BeginFloatingWindows("Misc Items Tracker"); BeginFloatingWindows("Misc Items Tracker");
DrawItemsInRows(miscItems, 4); DrawItemsInRows(miscItems, 4);
EndFloatingWindows(); EndFloatingWindows();
} }
if (CVarGetInteger("gItemTrackerDungeonRewardsDisplayType", SECTION_DISPLAY_MAIN_WINDOW) == SECTION_DISPLAY_SEPARATE) { if (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.DungeonRewards"), SECTION_DISPLAY_MAIN_WINDOW) == SECTION_DISPLAY_SEPARATE) {
BeginFloatingWindows("Dungeon Rewards Tracker"); BeginFloatingWindows("Dungeon Rewards Tracker");
if (CVarGetInteger("gItemTrackerDungeonRewardsCircle", 0)) { if (CVarGetInteger(CVAR_TRACKER_ITEM("DungeonRewardsLayout"), 0)) {
ImGui::BeginGroup(); ImGui::BeginGroup();
DrawItemsInACircle(dungeonRewardMedallions); DrawItemsInACircle(dungeonRewardMedallions);
ImGui::EndGroup(); ImGui::EndGroup();
@ -1257,16 +1257,16 @@ void ItemTrackerWindow::DrawElement() {
EndFloatingWindows(); EndFloatingWindows();
} }
if (CVarGetInteger("gItemTrackerSongsDisplayType", SECTION_DISPLAY_MAIN_WINDOW) == SECTION_DISPLAY_SEPARATE) { if (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.Songs"), SECTION_DISPLAY_MAIN_WINDOW) == SECTION_DISPLAY_SEPARATE) {
BeginFloatingWindows("Songs Tracker"); BeginFloatingWindows("Songs Tracker");
DrawItemsInRows(songItems); DrawItemsInRows(songItems);
EndFloatingWindows(); EndFloatingWindows();
} }
if (CVarGetInteger("gItemTrackerDungeonItemsDisplayType", SECTION_DISPLAY_HIDDEN) == SECTION_DISPLAY_SEPARATE) { if (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.DungeonItems"), SECTION_DISPLAY_HIDDEN) == SECTION_DISPLAY_SEPARATE) {
BeginFloatingWindows("Dungeon Items Tracker"); BeginFloatingWindows("Dungeon Items Tracker");
if (CVarGetInteger("gItemTrackerDisplayDungeonItemsHorizontal", 1)) { if (CVarGetInteger(CVAR_TRACKER_ITEM("DungeonItems.Layout"), 1)) {
if (CVarGetInteger("gItemTrackerDisplayDungeonItemsMaps", 1)) { if (CVarGetInteger(CVAR_TRACKER_ITEM("DungeonItems.DisplayMaps"), 1)) {
DrawItemsInRows(dungeonItems, 12); DrawItemsInRows(dungeonItems, 12);
} else { } else {
DrawItemsInRows(dungeonItems, 8); DrawItemsInRows(dungeonItems, 8);
@ -1277,13 +1277,13 @@ void ItemTrackerWindow::DrawElement() {
EndFloatingWindows(); EndFloatingWindows();
} }
if (CVarGetInteger("gItemTrackerGregDisplayType", SECTION_DISPLAY_EXTENDED_HIDDEN) == SECTION_DISPLAY_EXTENDED_SEPARATE) { if (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.Greg"), SECTION_DISPLAY_EXTENDED_HIDDEN) == SECTION_DISPLAY_EXTENDED_SEPARATE) {
BeginFloatingWindows("Greg Tracker"); BeginFloatingWindows("Greg Tracker");
DrawItemsInRows(gregItems); DrawItemsInRows(gregItems);
EndFloatingWindows(); EndFloatingWindows();
} }
if (CVarGetInteger("gItemTrackerTriforcePiecesDisplayType", SECTION_DISPLAY_HIDDEN) == SECTION_DISPLAY_SEPARATE) { if (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.TriforcePieces"), SECTION_DISPLAY_HIDDEN) == SECTION_DISPLAY_SEPARATE) {
BeginFloatingWindows("Triforce Piece Tracker"); BeginFloatingWindows("Triforce Piece Tracker");
DrawItemsInRows(triforcePieces); DrawItemsInRows(triforcePieces);
EndFloatingWindows(); EndFloatingWindows();
@ -1307,7 +1307,7 @@ void ItemTrackerWindow::DrawElement() {
EndFloatingWindows(); EndFloatingWindows();
} }
if (CVarGetInteger("gItemTrackerNotesDisplayType", SECTION_DISPLAY_HIDDEN) == SECTION_DISPLAY_SEPARATE && CVarGetInteger("gItemTrackerDisplayType", TRACKER_DISPLAY_ALWAYS) == TRACKER_DISPLAY_ALWAYS) { if (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.Notes"), SECTION_DISPLAY_HIDDEN) == SECTION_DISPLAY_SEPARATE && CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.Main"), TRACKER_DISPLAY_ALWAYS) == TRACKER_DISPLAY_ALWAYS) {
ImGui::SetNextWindowSize(ImVec2(400,300), ImGuiCond_FirstUseEver); ImGui::SetNextWindowSize(ImVec2(400,300), ImGuiCond_FirstUseEver);
BeginFloatingWindows("Personal Notes", ImGuiWindowFlags_NoFocusOnAppearing); BeginFloatingWindows("Personal Notes", ImGuiWindowFlags_NoFocusOnAppearing);
DrawNotes(true); DrawNotes(true);
@ -1344,50 +1344,50 @@ void ItemTrackerSettingsWindow::DrawElement() {
ImGui::SameLine(); ImGui::SameLine();
ImGui::PushItemWidth(ImGui::GetContentRegionAvail().x); ImGui::PushItemWidth(ImGui::GetContentRegionAvail().x);
if (ImGui::ColorEdit4("BG Color##gItemTrackerBgColor", (float*)&ChromaKeyBackground, ImGuiColorEditFlags_AlphaPreview | ImGuiColorEditFlags_AlphaBar | ImGuiColorEditFlags_NoLabel)) { if (ImGui::ColorEdit4("BG Color##gItemTrackerBgColor", (float*)&ChromaKeyBackground, ImGuiColorEditFlags_AlphaPreview | ImGuiColorEditFlags_AlphaBar | ImGuiColorEditFlags_NoLabel)) {
CVarSetFloat("gItemTrackerBgColorR", ChromaKeyBackground.x); CVarSetFloat(CVAR_TRACKER_ITEM("BgColorR"), ChromaKeyBackground.x);
CVarSetFloat("gItemTrackerBgColorG", ChromaKeyBackground.y); CVarSetFloat(CVAR_TRACKER_ITEM("BgColorG"), ChromaKeyBackground.y);
CVarSetFloat("gItemTrackerBgColorB", ChromaKeyBackground.z); CVarSetFloat(CVAR_TRACKER_ITEM("BgColorB"), ChromaKeyBackground.z);
CVarSetFloat("gItemTrackerBgColorA", ChromaKeyBackground.w); CVarSetFloat(CVAR_TRACKER_ITEM("BgColorA"), ChromaKeyBackground.w);
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
} }
ImGui::PopItemWidth(); ImGui::PopItemWidth();
if (UIWidgets::LabeledRightAlignedEnhancementCombobox("Window Type", "gItemTrackerWindowType", windowTypes, TRACKER_WINDOW_FLOATING)) { if (UIWidgets::LabeledRightAlignedEnhancementCombobox("Window Type", CVAR_TRACKER_ITEM("WindowType"), windowTypes, TRACKER_WINDOW_FLOATING)) {
shouldUpdateVectors = true; shouldUpdateVectors = true;
} }
if (CVarGetInteger("gItemTrackerWindowType", TRACKER_WINDOW_FLOATING) == TRACKER_WINDOW_FLOATING) { if (CVarGetInteger(CVAR_TRACKER_ITEM("WindowType"), TRACKER_WINDOW_FLOATING) == TRACKER_WINDOW_FLOATING) {
if (UIWidgets::PaddedEnhancementCheckbox("Enable Dragging", "gItemTrackerHudEditMode")) { if (UIWidgets::PaddedEnhancementCheckbox("Enable Dragging", CVAR_TRACKER_ITEM("Draggable"))) {
shouldUpdateVectors = true; shouldUpdateVectors = true;
} }
if (UIWidgets::PaddedEnhancementCheckbox("Only enable while paused", "gItemTrackerShowOnlyPaused")) { if (UIWidgets::PaddedEnhancementCheckbox("Only enable while paused", CVAR_TRACKER_ITEM("ShowOnlyPaused"))) {
shouldUpdateVectors = true; shouldUpdateVectors = true;
} }
if (UIWidgets::LabeledRightAlignedEnhancementCombobox("Display Mode", "gItemTrackerDisplayType", displayModes, TRACKER_DISPLAY_ALWAYS)) { if (UIWidgets::LabeledRightAlignedEnhancementCombobox("Display Mode", CVAR_TRACKER_ITEM("DisplayType.Main"), displayModes, TRACKER_DISPLAY_ALWAYS)) {
shouldUpdateVectors = true; shouldUpdateVectors = true;
} }
if (CVarGetInteger("gItemTrackerDisplayType", TRACKER_DISPLAY_ALWAYS) == TRACKER_DISPLAY_COMBO_BUTTON) { if (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.Main"), TRACKER_DISPLAY_ALWAYS) == TRACKER_DISPLAY_COMBO_BUTTON) {
if (UIWidgets::LabeledRightAlignedEnhancementCombobox("Combo Button 1", "gItemTrackerComboButton1", buttons, TRACKER_COMBO_BUTTON_L)) { if (UIWidgets::LabeledRightAlignedEnhancementCombobox("Combo Button 1", CVAR_TRACKER_ITEM("ComboButton1"), buttons, TRACKER_COMBO_BUTTON_L)) {
shouldUpdateVectors = true; shouldUpdateVectors = true;
} }
if (UIWidgets::LabeledRightAlignedEnhancementCombobox("Combo Button 2", "gItemTrackerComboButton2", buttons, TRACKER_COMBO_BUTTON_R)) { if (UIWidgets::LabeledRightAlignedEnhancementCombobox("Combo Button 2", CVAR_TRACKER_ITEM("ComboButton2"), buttons, TRACKER_COMBO_BUTTON_R)) {
shouldUpdateVectors = true; shouldUpdateVectors = true;
} }
} }
} }
UIWidgets::PaddedSeparator(); UIWidgets::PaddedSeparator();
UIWidgets::EnhancementSliderInt("Icon size : %dpx", "##ITEMTRACKERICONSIZE", "gItemTrackerIconSize", 25, 128, "", 36); UIWidgets::EnhancementSliderInt("Icon size : %dpx", "##ITEMTRACKERICONSIZE", CVAR_TRACKER_ITEM("IconSize"), 25, 128, "", 36);
UIWidgets::EnhancementSliderInt("Icon margins : %dpx", "##ITEMTRACKERSPACING", "gItemTrackerIconSpacing", -5, 50, "", 12); UIWidgets::EnhancementSliderInt("Icon margins : %dpx", "##ITEMTRACKERSPACING", CVAR_TRACKER_ITEM("IconSpacing"), -5, 50, "", 12);
UIWidgets::EnhancementSliderInt("Text size : %dpx", "##ITEMTRACKERTEXTSIZE", "gTrackers.ItemTracker.ItemTrackerTextSize", 1, 30, "", 13); UIWidgets::EnhancementSliderInt("Text size : %dpx", "##ITEMTRACKERTEXTSIZE", CVAR_TRACKER_ITEM("TextSize"), 1, 30, "", 13);
UIWidgets::Spacer(0); UIWidgets::Spacer(0);
ImGui::Text("Ammo/Capacity Tracking"); ImGui::Text("Ammo/Capacity Tracking");
UIWidgets::EnhancementCombobox("gItemTrackerCapacityTrack", itemTrackerCapacityTrackOptions, ITEM_TRACKER_NUMBER_CURRENT_CAPACITY_ONLY); UIWidgets::EnhancementCombobox(CVAR_TRACKER_ITEM("ItemCountType"), itemTrackerCapacityTrackOptions, ITEM_TRACKER_NUMBER_CURRENT_CAPACITY_ONLY);
UIWidgets::InsertHelpHoverText("Customize what the numbers under each item are tracking." UIWidgets::InsertHelpHoverText("Customize what the numbers under each item are tracking."
"\n\nNote: items without capacity upgrades will track ammo even in capacity mode"); "\n\nNote: items without capacity upgrades will track ammo even in capacity mode");
if (CVarGetInteger("gItemTrackerCapacityTrack", ITEM_TRACKER_NUMBER_CURRENT_CAPACITY_ONLY) == ITEM_TRACKER_NUMBER_CURRENT_CAPACITY_ONLY || CVarGetInteger("gItemTrackerCapacityTrack", ITEM_TRACKER_NUMBER_CURRENT_CAPACITY_ONLY) == ITEM_TRACKER_NUMBER_CURRENT_AMMO_ONLY) { if (CVarGetInteger(CVAR_TRACKER_ITEM("ItemCountType"), ITEM_TRACKER_NUMBER_CURRENT_CAPACITY_ONLY) == ITEM_TRACKER_NUMBER_CURRENT_CAPACITY_ONLY || CVarGetInteger(CVAR_TRACKER_ITEM("ItemCountType"), ITEM_TRACKER_NUMBER_CURRENT_CAPACITY_ONLY) == ITEM_TRACKER_NUMBER_CURRENT_AMMO_ONLY) {
if (UIWidgets::PaddedEnhancementCheckbox("Align count to left side", "gItemTrackerCurrentOnLeft")) { if (UIWidgets::PaddedEnhancementCheckbox("Align count to left side", CVAR_TRACKER_ITEM("ItemCountAlignLeft"))) {
shouldUpdateVectors = true; shouldUpdateVectors = true;
} }
} }
@ -1395,51 +1395,51 @@ void ItemTrackerSettingsWindow::DrawElement() {
UIWidgets::Spacer(0); UIWidgets::Spacer(0);
ImGui::Text("Key Count Tracking"); ImGui::Text("Key Count Tracking");
UIWidgets::EnhancementCombobox("gItemTrackerKeyTrack", itemTrackerKeyTrackOptions, KEYS_COLLECTED_MAX); UIWidgets::EnhancementCombobox(CVAR_TRACKER_ITEM("KeyCounts"), itemTrackerKeyTrackOptions, KEYS_COLLECTED_MAX);
UIWidgets::InsertHelpHoverText("Customize what numbers are shown for key tracking."); UIWidgets::InsertHelpHoverText("Customize what numbers are shown for key tracking.");
UIWidgets::Spacer(0); UIWidgets::Spacer(0);
ImGui::Text("Triforce Piece Count Tracking"); ImGui::Text("Triforce Piece Count Tracking");
UIWidgets::EnhancementCombobox("gItemTrackerTriforcePieceTrack", itemTrackerTriforcePieceTrackOptions, TRIFORCE_PIECE_COLLECTED_REQUIRED_MAX); UIWidgets::EnhancementCombobox(CVAR_TRACKER_ITEM("TriforcePieceCounts"), itemTrackerTriforcePieceTrackOptions, TRIFORCE_PIECE_COLLECTED_REQUIRED_MAX);
UIWidgets::InsertHelpHoverText("Customize what numbers are shown for triforce piece tracking."); UIWidgets::InsertHelpHoverText("Customize what numbers are shown for triforce piece tracking.");
ImGui::TableNextColumn(); ImGui::TableNextColumn();
if (UIWidgets::LabeledRightAlignedEnhancementCombobox("Inventory", "gItemTrackerInventoryItemsDisplayType", displayTypes, SECTION_DISPLAY_MAIN_WINDOW)) { if (UIWidgets::LabeledRightAlignedEnhancementCombobox("Inventory", CVAR_TRACKER_ITEM("DisplayType.Inventory"), displayTypes, SECTION_DISPLAY_MAIN_WINDOW)) {
shouldUpdateVectors = true; shouldUpdateVectors = true;
} }
if (UIWidgets::LabeledRightAlignedEnhancementCombobox("Equipment", "gItemTrackerEquipmentItemsDisplayType", displayTypes, SECTION_DISPLAY_MAIN_WINDOW)) { if (UIWidgets::LabeledRightAlignedEnhancementCombobox("Equipment", CVAR_TRACKER_ITEM("DisplayType.Equipment"), displayTypes, SECTION_DISPLAY_MAIN_WINDOW)) {
shouldUpdateVectors = true; shouldUpdateVectors = true;
} }
if (UIWidgets::LabeledRightAlignedEnhancementCombobox("Misc", "gItemTrackerMiscItemsDisplayType", displayTypes, SECTION_DISPLAY_MAIN_WINDOW)) { if (UIWidgets::LabeledRightAlignedEnhancementCombobox("Misc", CVAR_TRACKER_ITEM("DisplayType.Misc"), displayTypes, SECTION_DISPLAY_MAIN_WINDOW)) {
shouldUpdateVectors = true; shouldUpdateVectors = true;
} }
if (UIWidgets::LabeledRightAlignedEnhancementCombobox("Dungeon Rewards", "gItemTrackerDungeonRewardsDisplayType", displayTypes, SECTION_DISPLAY_MAIN_WINDOW)) { if (UIWidgets::LabeledRightAlignedEnhancementCombobox("Dungeon Rewards", CVAR_TRACKER_ITEM("DisplayType.DungeonRewards"), displayTypes, SECTION_DISPLAY_MAIN_WINDOW)) {
shouldUpdateVectors = true; shouldUpdateVectors = true;
} }
if (CVarGetInteger("gItemTrackerDungeonRewardsDisplayType", SECTION_DISPLAY_MAIN_WINDOW) == SECTION_DISPLAY_SEPARATE) { if (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.DungeonRewards"), SECTION_DISPLAY_MAIN_WINDOW) == SECTION_DISPLAY_SEPARATE) {
if (UIWidgets::PaddedEnhancementCheckbox("Circle display", "gItemTrackerDungeonRewardsCircle", true, true, false, "", UIWidgets::CheckboxGraphics::Cross, false)) { if (UIWidgets::PaddedEnhancementCheckbox("Circle display", CVAR_TRACKER_ITEM("DungeonRewardsLayout"), true, true, false, "", UIWidgets::CheckboxGraphics::Cross, false)) {
shouldUpdateVectors = true; shouldUpdateVectors = true;
} }
} }
if (UIWidgets::LabeledRightAlignedEnhancementCombobox("Songs", "gItemTrackerSongsDisplayType", displayTypes, SECTION_DISPLAY_MAIN_WINDOW)) { if (UIWidgets::LabeledRightAlignedEnhancementCombobox("Songs", CVAR_TRACKER_ITEM("DisplayType.Songs"), displayTypes, SECTION_DISPLAY_MAIN_WINDOW)) {
shouldUpdateVectors = true; shouldUpdateVectors = true;
} }
if (UIWidgets::LabeledRightAlignedEnhancementCombobox("Dungeon Items", "gItemTrackerDungeonItemsDisplayType", displayTypes, SECTION_DISPLAY_HIDDEN)) { if (UIWidgets::LabeledRightAlignedEnhancementCombobox("Dungeon Items", CVAR_TRACKER_ITEM("DisplayType.DungeonItems"), displayTypes, SECTION_DISPLAY_HIDDEN)) {
shouldUpdateVectors = true; shouldUpdateVectors = true;
} }
if (CVarGetInteger("gItemTrackerDungeonItemsDisplayType", SECTION_DISPLAY_HIDDEN) != SECTION_DISPLAY_HIDDEN) { if (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.DungeonItems"), SECTION_DISPLAY_HIDDEN) != SECTION_DISPLAY_HIDDEN) {
if (CVarGetInteger("gItemTrackerDungeonItemsDisplayType", SECTION_DISPLAY_HIDDEN) == SECTION_DISPLAY_SEPARATE) { if (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.DungeonItems"), SECTION_DISPLAY_HIDDEN) == SECTION_DISPLAY_SEPARATE) {
if (UIWidgets::PaddedEnhancementCheckbox("Horizontal display", "gItemTrackerDisplayDungeonItemsHorizontal", true, true, false, "", UIWidgets::CheckboxGraphics::Cross, true)) { if (UIWidgets::PaddedEnhancementCheckbox("Horizontal display", CVAR_TRACKER_ITEM("DungeonItems.Layout"), true, true, false, "", UIWidgets::CheckboxGraphics::Cross, true)) {
shouldUpdateVectors = true; shouldUpdateVectors = true;
} }
} }
if (UIWidgets::PaddedEnhancementCheckbox("Maps and compasses", "gItemTrackerDisplayDungeonItemsMaps", true, true, false, "", UIWidgets::CheckboxGraphics::Cross, true)) { if (UIWidgets::PaddedEnhancementCheckbox("Maps and compasses", CVAR_TRACKER_ITEM("DungeonItems.DisplayMaps"), true, true, false, "", UIWidgets::CheckboxGraphics::Cross, true)) {
shouldUpdateVectors = true; shouldUpdateVectors = true;
} }
} }
if (UIWidgets::LabeledRightAlignedEnhancementCombobox("Greg", "gItemTrackerGregDisplayType", extendedDisplayTypes, SECTION_DISPLAY_EXTENDED_HIDDEN)) { if (UIWidgets::LabeledRightAlignedEnhancementCombobox("Greg", CVAR_TRACKER_ITEM("DisplayType.Greg"), extendedDisplayTypes, SECTION_DISPLAY_EXTENDED_HIDDEN)) {
shouldUpdateVectors = true; shouldUpdateVectors = true;
} }
@ -1459,12 +1459,12 @@ void ItemTrackerSettingsWindow::DrawElement() {
shouldUpdateVectors = true; shouldUpdateVectors = true;
} }
if (CVarGetInteger("gItemTrackerDisplayType", TRACKER_DISPLAY_ALWAYS) == TRACKER_DISPLAY_ALWAYS) { if (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.Main"), TRACKER_DISPLAY_ALWAYS) == TRACKER_DISPLAY_ALWAYS) {
if (UIWidgets::LabeledRightAlignedEnhancementCombobox("Personal notes", "gItemTrackerNotesDisplayType", displayTypes, SECTION_DISPLAY_HIDDEN)) { if (UIWidgets::LabeledRightAlignedEnhancementCombobox("Personal notes", CVAR_TRACKER_ITEM("DisplayType.Notes"), displayTypes, SECTION_DISPLAY_HIDDEN)) {
shouldUpdateVectors = true; shouldUpdateVectors = true;
} }
} }
UIWidgets::EnhancementCheckbox("Show Hookshot Identifiers", "gTrackers.ItemTracker.HookshotIdentifier"); UIWidgets::EnhancementCheckbox("Show Hookshot Identifiers", CVAR_TRACKER_ITEM("HookshotIdentifier"));
UIWidgets::InsertHelpHoverText("Shows an 'H' or an 'L' to more easiely distinguish between Hookshot and Longshot."); UIWidgets::InsertHelpHoverText("Shows an 'H' or an 'L' to more easiely distinguish between Hookshot and Longshot.");
UIWidgets::Spacer(0); UIWidgets::Spacer(0);
@ -1476,10 +1476,10 @@ void ItemTrackerSettingsWindow::DrawElement() {
} }
void ItemTrackerWindow::InitElement() { void ItemTrackerWindow::InitElement() {
float trackerBgR = CVarGetFloat("gItemTrackerBgColorR", 0); float trackerBgR = CVarGetFloat(CVAR_TRACKER_ITEM("BgColorR"), 0);
float trackerBgG = CVarGetFloat("gItemTrackerBgColorG", 0); float trackerBgG = CVarGetFloat(CVAR_TRACKER_ITEM("BgColorG"), 0);
float trackerBgB = CVarGetFloat("gItemTrackerBgColorB", 0); float trackerBgB = CVarGetFloat(CVAR_TRACKER_ITEM("BgColorB"), 0);
float trackerBgA = CVarGetFloat("gItemTrackerBgColorA", 1); float trackerBgA = CVarGetFloat(CVAR_TRACKER_ITEM("BgColorA"), 1);
ChromaKeyBackground = { ChromaKeyBackground = {
trackerBgR, trackerBgR,
trackerBgG, trackerBgG,

View File

@ -34,7 +34,7 @@ typedef struct ItemTrackerDungeon {
std::vector<uint32_t> items; std::vector<uint32_t> items;
} ItemTrackerDungeon; } ItemTrackerDungeon;
class ItemTrackerSettingsWindow : public LUS::GuiWindow { class ItemTrackerSettingsWindow : public Ship::GuiWindow {
public: public:
using GuiWindow::GuiWindow; using GuiWindow::GuiWindow;
@ -44,7 +44,7 @@ class ItemTrackerSettingsWindow : public LUS::GuiWindow {
void UpdateElement() override {}; void UpdateElement() override {};
}; };
class ItemTrackerWindow : public LUS::GuiWindow { class ItemTrackerWindow : public Ship::GuiWindow {
public: public:
using GuiWindow::GuiWindow; using GuiWindow::GuiWindow;

View File

@ -4,7 +4,7 @@ namespace Rando {
class Settings; class Settings;
} }
class RandomizerSettingsWindow : public LUS::GuiWindow { class RandomizerSettingsWindow : public Ship::GuiWindow {
public: public:
using GuiWindow::GuiWindow; using GuiWindow::GuiWindow;

View File

@ -1,11 +1,12 @@
#include "ResolutionEditor.h" #include "ResolutionEditor.h"
#include <ImGui/imgui.h> #include <imgui.h>
#include <libultraship/libultraship.h> #include <libultraship/libultraship.h>
#include <soh/UIWidgets.hpp> #include <soh/UIWidgets.hpp>
#include <graphic/Fast3D/gfx_pc.h> #include <graphic/Fast3D/gfx_pc.h>
#include "soh/OTRGlobals.h"
/* Console Variables are grouped under gAdvancedResolution. (e.g. "gAdvancedResolution.Enabled") /* Console Variables are grouped under gAdvancedResolution. (e.g. CVAR_PREFIX_ADVANCED_RESOLUTION ".Enabled")
The following cvars are used in Libultraship and can be edited here: The following cvars are used in Libultraship and can be edited here:
- Enabled - Turns Advanced Resolution Mode on. - Enabled - Turns Advanced Resolution Mode on.
@ -83,25 +84,25 @@ void AdvancedResolutionSettingsWindow::DrawElement() {
// Letting it go below 1 in this Editor will even allow for checking if screen bounds are being exceeded. // Letting it go below 1 in this Editor will even allow for checking if screen bounds are being exceeded.
if (default_maxIntegerScaleFactor < integerScale_maximumBounds) { if (default_maxIntegerScaleFactor < integerScale_maximumBounds) {
max_integerScaleFactor = max_integerScaleFactor =
integerScale_maximumBounds + CVarGetInteger("gAdvancedResolution.IntegerScale.ExceedBoundsBy", 0); integerScale_maximumBounds + CVarGetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".IntegerScale.ExceedBoundsBy", 0);
} }
// Combo List defaults // Combo List defaults
static int item_aspectRatio = CVarGetInteger("gAdvancedResolution.UIComboItem.AspectRatio", 3); static int item_aspectRatio = CVarGetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".UIComboItem.AspectRatio", 3);
static int item_pixelCount = CVarGetInteger("gAdvancedResolution.UIComboItem.PixelCount", default_pixelCount); static int item_pixelCount = CVarGetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".UIComboItem.PixelCount", default_pixelCount);
// Stored Values for non-UIWidgets elements // Stored Values for non-UIWidgets elements
static float aspectRatioX = static float aspectRatioX =
CVarGetFloat("gAdvancedResolution.AspectRatioX", aspectRatioPresetsX[item_aspectRatio]); CVarGetFloat(CVAR_PREFIX_ADVANCED_RESOLUTION ".AspectRatioX", aspectRatioPresetsX[item_aspectRatio]);
static float aspectRatioY = static float aspectRatioY =
CVarGetFloat("gAdvancedResolution.AspectRatioY", aspectRatioPresetsY[item_aspectRatio]); CVarGetFloat(CVAR_PREFIX_ADVANCED_RESOLUTION ".AspectRatioY", aspectRatioPresetsY[item_aspectRatio]);
static int verticalPixelCount = static int verticalPixelCount =
CVarGetInteger("gAdvancedResolution.VerticalPixelCount", pixelCountPresets[item_pixelCount]); CVarGetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".VerticalPixelCount", pixelCountPresets[item_pixelCount]);
// Additional settings // Additional settings
static bool showHorizontalResField = false; static bool showHorizontalResField = false;
static int horizontalPixelCount = (verticalPixelCount / aspectRatioY) * aspectRatioX; static int horizontalPixelCount = (verticalPixelCount / aspectRatioY) * aspectRatioX;
// Disabling flags // Disabling flags
const bool disabled_everything = !CVarGetInteger("gAdvancedResolution.Enabled", 0); const bool disabled_everything = !CVarGetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".Enabled", 0);
const bool disabled_pixelCount = !CVarGetInteger("gAdvancedResolution.VerticalResolutionToggle", 0); const bool disabled_pixelCount = !CVarGetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".VerticalResolutionToggle", 0);
#ifdef __APPLE__ #ifdef __APPLE__
// Display HiDPI warning. (Remove this once we can definitively say it's fixed.) // Display HiDPI warning. (Remove this once we can definitively say it's fixed.)
@ -112,21 +113,21 @@ void AdvancedResolutionSettingsWindow::DrawElement() {
if (ImGui::CollapsingHeader("Original Settings", ImGuiTreeNodeFlags_DefaultOpen)) { if (ImGui::CollapsingHeader("Original Settings", ImGuiTreeNodeFlags_DefaultOpen)) {
// The original resolution slider (for convenience) // The original resolution slider (for convenience)
const bool disabled_resolutionSlider = (CVarGetInteger("gAdvancedResolution.VerticalResolutionToggle", 0) && const bool disabled_resolutionSlider = (CVarGetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".VerticalResolutionToggle", 0) &&
CVarGetInteger("gAdvancedResolution.Enabled", 0)) || CVarGetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".Enabled", 0)) ||
CVarGetInteger("gLowResMode", 0); CVarGetInteger(CVAR_LOW_RES_MODE, 0);
if (UIWidgets::EnhancementSliderFloat("Internal Resolution: %.1f%%", "##IMul", "gInternalResolution", 0.5f, if (UIWidgets::EnhancementSliderFloat("Internal Resolution: %.1f%%", "##IMul", CVAR_INTERNAL_RESOLUTION, 0.5f,
2.0f, "", 1.0f, true, true, disabled_resolutionSlider)) { 2.0f, "", 1.0f, true, true, disabled_resolutionSlider)) {
LUS::Context::GetInstance()->GetWindow()->SetResolutionMultiplier( Ship::Context::GetInstance()->GetWindow()->SetResolutionMultiplier(
CVarGetFloat("gInternalResolution", 1)); CVarGetFloat(CVAR_INTERNAL_RESOLUTION, 1));
} }
UIWidgets::Tooltip("Multiplies your output resolution by the value entered."); UIWidgets::Tooltip("Multiplies your output resolution by the value entered.");
// The original MSAA slider (also for convenience) // The original MSAA slider (also for convenience)
#ifndef __WIIU__ #ifndef __WIIU__
if (UIWidgets::PaddedEnhancementSliderInt("MSAA: %d", "##IMSAA", "gMSAAValue", 1, 8, "", 1, true, true, if (UIWidgets::PaddedEnhancementSliderInt("MSAA: %d", "##IMSAA", CVAR_MSAA_VALUE, 1, 8, "", 1, true, true,
false)) { false)) {
LUS::Context::GetInstance()->GetWindow()->SetMsaaLevel(CVarGetInteger("gMSAAValue", 1)); Ship::Context::GetInstance()->GetWindow()->SetMsaaLevel(CVarGetInteger(CVAR_MSAA_VALUE, 1));
}; };
UIWidgets::Tooltip( UIWidgets::Tooltip(
"Activates multi-sample anti-aliasing when above 1x, up to 8x for 8 samples for every pixel.\n\n" "Activates multi-sample anti-aliasing when above 1x, up to 8x for 8 samples for every pixel.\n\n"
@ -135,15 +136,15 @@ void AdvancedResolutionSettingsWindow::DrawElement() {
#endif #endif
// N64 Mode toggle (again for convenience) // N64 Mode toggle (again for convenience)
// UIWidgets::PaddedEnhancementCheckbox("(Enhancements>Graphics) N64 Mode", "gLowResMode", false, false, false, "", UIWidgets::CheckboxGraphics::Cross, false); // UIWidgets::PaddedEnhancementCheckbox("(Enhancements>Graphics) N64 Mode", CVAR_LOW_RES_MODE, false, false, false, "", UIWidgets::CheckboxGraphics::Cross, false);
} }
UIWidgets::PaddedSeparator(true, true, 3.0f, 3.0f); UIWidgets::PaddedSeparator(true, true, 3.0f, 3.0f);
// Activator // Activator
UIWidgets::PaddedEnhancementCheckbox("Enable advanced settings.", "gAdvancedResolution.Enabled", false, false, UIWidgets::PaddedEnhancementCheckbox("Enable advanced settings.", CVAR_PREFIX_ADVANCED_RESOLUTION ".Enabled", false, false,
false, "", UIWidgets::CheckboxGraphics::Cross, false); false, "", UIWidgets::CheckboxGraphics::Cross, false);
// Error/Warning display // Error/Warning display
if (!CVarGetInteger("gLowResMode", 0)) { if (!CVarGetInteger(CVAR_LOW_RES_MODE, 0)) {
if (IsDroppingFrames()) { // Significant frame drop warning if (IsDroppingFrames()) { // Significant frame drop warning
ImGui::TextColored(messageColor[MESSAGE_WARNING], ImGui::TextColored(messageColor[MESSAGE_WARNING],
ICON_FA_EXCLAMATION_TRIANGLE " Significant frame rate (FPS) drops may be occuring."); ICON_FA_EXCLAMATION_TRIANGLE " Significant frame rate (FPS) drops may be occuring.");
@ -156,7 +157,7 @@ void AdvancedResolutionSettingsWindow::DrawElement() {
ICON_FA_QUESTION_CIRCLE " \"N64 Mode\" is overriding these settings."); ICON_FA_QUESTION_CIRCLE " \"N64 Mode\" is overriding these settings.");
ImGui::SameLine(); ImGui::SameLine();
if (ImGui::Button("Click to disable")) { if (ImGui::Button("Click to disable")) {
CVarSetInteger("gLowResMode", 0); CVarSetInteger(CVAR_LOW_RES_MODE, 0);
CVarSave(); CVarSave();
} }
} }
@ -185,9 +186,9 @@ void AdvancedResolutionSettingsWindow::DrawElement() {
horizontalPixelCount = (verticalPixelCount / aspectRatioY) * aspectRatioX; horizontalPixelCount = (verticalPixelCount / aspectRatioY) * aspectRatioX;
} }
CVarSetFloat("gAdvancedResolution.AspectRatioX", aspectRatioX); CVarSetFloat(CVAR_PREFIX_ADVANCED_RESOLUTION ".AspectRatioX", aspectRatioX);
CVarSetFloat("gAdvancedResolution.AspectRatioY", aspectRatioY); CVarSetFloat(CVAR_PREFIX_ADVANCED_RESOLUTION ".AspectRatioY", aspectRatioY);
CVarSetInteger("gAdvancedResolution.UIComboItem.AspectRatio", item_aspectRatio); CVarSetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".UIComboItem.AspectRatio", item_aspectRatio);
CVarSave(); CVarSave();
} }
// Hide aspect ratio input fields if using one of the presets. // Hide aspect ratio input fields if using one of the presets.
@ -217,7 +218,7 @@ void AdvancedResolutionSettingsWindow::DrawElement() {
// Vertical Resolution // Vertical Resolution
UIWidgets::PaddedEnhancementCheckbox("Set fixed vertical resolution (disables Resolution slider)", UIWidgets::PaddedEnhancementCheckbox("Set fixed vertical resolution (disables Resolution slider)",
"gAdvancedResolution.VerticalResolutionToggle", true, false, CVAR_PREFIX_ADVANCED_RESOLUTION ".VerticalResolutionToggle", true, false,
disabled_everything, "", UIWidgets::CheckboxGraphics::Cross, false); disabled_everything, "", UIWidgets::CheckboxGraphics::Cross, false);
UIWidgets::Tooltip( UIWidgets::Tooltip(
"Override the resolution scale slider and use the settings below, irrespective of window size."); "Override the resolution scale slider and use the settings below, irrespective of window size.");
@ -233,8 +234,8 @@ void AdvancedResolutionSettingsWindow::DrawElement() {
horizontalPixelCount = (verticalPixelCount / aspectRatioY) * aspectRatioX; horizontalPixelCount = (verticalPixelCount / aspectRatioY) * aspectRatioX;
} }
CVarSetInteger("gAdvancedResolution.VerticalPixelCount", verticalPixelCount); CVarSetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".VerticalPixelCount", verticalPixelCount);
CVarSetInteger("gAdvancedResolution.UIComboItem.PixelCount", item_pixelCount); CVarSetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".UIComboItem.PixelCount", item_pixelCount);
CVarSave(); CVarSave();
} }
// Horizontal Resolution, if visibility is enabled for it. // Horizontal Resolution, if visibility is enabled for it.
@ -290,43 +291,43 @@ void AdvancedResolutionSettingsWindow::DrawElement() {
// Integer scaling settings group (Pixel-perfect Mode) // Integer scaling settings group (Pixel-perfect Mode)
static const ImGuiTreeNodeFlags IntegerScalingResolvedImGuiFlag = static const ImGuiTreeNodeFlags IntegerScalingResolvedImGuiFlag =
CVarGetInteger("gAdvancedResolution.PixelPerfectMode", 0) ? ImGuiTreeNodeFlags_DefaultOpen CVarGetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".PixelPerfectMode", 0) ? ImGuiTreeNodeFlags_DefaultOpen
: ImGuiTreeNodeFlags_None; : ImGuiTreeNodeFlags_None;
if (ImGui::CollapsingHeader("Integer Scaling Settings", IntegerScalingResolvedImGuiFlag)) { if (ImGui::CollapsingHeader("Integer Scaling Settings", IntegerScalingResolvedImGuiFlag)) {
const bool disabled_pixelPerfectMode = const bool disabled_pixelPerfectMode =
!CVarGetInteger("gAdvancedResolution.PixelPerfectMode", 0) || disabled_everything; !CVarGetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".PixelPerfectMode", 0) || disabled_everything;
// Pixel-perfect Mode // Pixel-perfect Mode
UIWidgets::PaddedEnhancementCheckbox("Pixel-perfect Mode", "gAdvancedResolution.PixelPerfectMode", true, UIWidgets::PaddedEnhancementCheckbox("Pixel-perfect Mode", CVAR_PREFIX_ADVANCED_RESOLUTION ".PixelPerfectMode", true,
true, disabled_pixelCount || disabled_everything, "", true, disabled_pixelCount || disabled_everything, "",
UIWidgets::CheckboxGraphics::Cross, false); UIWidgets::CheckboxGraphics::Cross, false);
UIWidgets::Tooltip("Don't scale image to fill window."); UIWidgets::Tooltip("Don't scale image to fill window.");
if (disabled_pixelCount && CVarGetInteger("gAdvancedResolution.PixelPerfectMode", 0)) { if (disabled_pixelCount && CVarGetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".PixelPerfectMode", 0)) {
CVarSetInteger("gAdvancedResolution.PixelPerfectMode", 0); CVarSetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".PixelPerfectMode", 0);
CVarSave(); CVarSave();
} }
// Integer Scaling // Integer Scaling
UIWidgets::EnhancementSliderInt( UIWidgets::EnhancementSliderInt(
"Integer scale factor: %d", "##ARSIntScale", "gAdvancedResolution.IntegerScale.Factor", 1, "Integer scale factor: %d", "##ARSIntScale", CVAR_PREFIX_ADVANCED_RESOLUTION ".IntegerScale.Factor", 1,
max_integerScaleFactor, "%d", 1, true, max_integerScaleFactor, "%d", 1, true,
disabled_pixelPerfectMode || CVarGetInteger("gAdvancedResolution.IntegerScale.FitAutomatically", 0)); disabled_pixelPerfectMode || CVarGetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".IntegerScale.FitAutomatically", 0));
UIWidgets::Tooltip("Integer scales the image. Only available in pixel-perfect mode."); UIWidgets::Tooltip("Integer scales the image. Only available in pixel-perfect mode.");
// Display warning if size is being clamped or if framebuffer is larger than viewport. // Display warning if size is being clamped or if framebuffer is larger than viewport.
if (!disabled_pixelPerfectMode && if (!disabled_pixelPerfectMode &&
(CVarGetInteger("gAdvancedResolution.IntegerScale.NeverExceedBounds", 1) && (CVarGetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".IntegerScale.NeverExceedBounds", 1) &&
CVarGetInteger("gAdvancedResolution.IntegerScale.Factor", 1) > integerScale_maximumBounds)) { CVarGetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".IntegerScale.Factor", 1) > integerScale_maximumBounds)) {
ImGui::SameLine(); ImGui::SameLine();
ImGui::TextColored(messageColor[MESSAGE_WARNING], ICON_FA_EXCLAMATION_TRIANGLE " Window exceeded."); ImGui::TextColored(messageColor[MESSAGE_WARNING], ICON_FA_EXCLAMATION_TRIANGLE " Window exceeded.");
} }
UIWidgets::PaddedEnhancementCheckbox( UIWidgets::PaddedEnhancementCheckbox(
"Automatically scale image to fit viewport", "gAdvancedResolution.IntegerScale.FitAutomatically", true, "Automatically scale image to fit viewport", CVAR_PREFIX_ADVANCED_RESOLUTION ".IntegerScale.FitAutomatically", true,
true, disabled_pixelPerfectMode, "", UIWidgets::CheckboxGraphics::Cross, false); true, disabled_pixelPerfectMode, "", UIWidgets::CheckboxGraphics::Cross, false);
UIWidgets::Tooltip("Automatically sets scale factor to fit window. Only available in pixel-perfect mode."); UIWidgets::Tooltip("Automatically sets scale factor to fit window. Only available in pixel-perfect mode.");
if (CVarGetInteger("gAdvancedResolution.IntegerScale.FitAutomatically", 0)) { if (CVarGetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".IntegerScale.FitAutomatically", 0)) {
// This is just here to update the value shown on the slider. // This is just here to update the value shown on the slider.
// The function in LUS to handle this setting will ignore IntegerScaleFactor while active. // The function in LUS to handle this setting will ignore IntegerScaleFactor while active.
CVarSetInteger("gAdvancedResolution.IntegerScale.Factor", integerScale_maximumBounds); CVarSetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".IntegerScale.Factor", integerScale_maximumBounds);
// CVarSave(); // CVarSave();
} }
} // End of integer scaling settings } // End of integer scaling settings
@ -344,19 +345,19 @@ void AdvancedResolutionSettingsWindow::DrawElement() {
UIWidgets::PaddedEnhancementCheckbox("Disable aspect correction and stretch the output image.\n" UIWidgets::PaddedEnhancementCheckbox("Disable aspect correction and stretch the output image.\n"
"(Might be useful for 4:3 televisions!)\n" "(Might be useful for 4:3 televisions!)\n"
"Not available in Pixel Perfect Mode.", "Not available in Pixel Perfect Mode.",
"gAdvancedResolution.IgnoreAspectCorrection", false, true, CVAR_PREFIX_ADVANCED_RESOLUTION ".IgnoreAspectCorrection", false, true,
CVarGetInteger("gAdvancedResolution.PixelPerfectMode", 0) || CVarGetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".PixelPerfectMode", 0) ||
disabled_everything, disabled_everything,
"", UIWidgets::CheckboxGraphics::Cross, false); "", UIWidgets::CheckboxGraphics::Cross, false);
#else #else
if (CVarGetInteger("gAdvancedResolution.IgnoreAspectCorrection", 0)) { if (CVarGetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".IgnoreAspectCorrection", 0)) {
// This setting is intentionally not exposed on PC platforms, // This setting is intentionally not exposed on PC platforms,
// but may be accidentally activated for varying reasons. // but may be accidentally activated for varying reasons.
// Having this button should hopefully prevent support headaches. // Having this button should hopefully prevent support headaches.
ImGui::TextColored(messageColor[MESSAGE_QUESTION], ICON_FA_QUESTION_CIRCLE ImGui::TextColored(messageColor[MESSAGE_QUESTION], ICON_FA_QUESTION_CIRCLE
" If the image is stretched and you don't know why, click this."); " If the image is stretched and you don't know why, click this.");
if (ImGui::Button("Click to reenable aspect correction.")) { if (ImGui::Button("Click to reenable aspect correction.")) {
CVarSetInteger("gAdvancedResolution.IgnoreAspectCorrection", 0); CVarSetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".IgnoreAspectCorrection", 0);
CVarSave(); CVarSave();
} }
UIWidgets::Spacer(2); UIWidgets::Spacer(2);
@ -386,12 +387,12 @@ void AdvancedResolutionSettingsWindow::DrawElement() {
// Integer Scaling - Never Exceed Bounds. // Integer Scaling - Never Exceed Bounds.
const bool disabled_neverExceedBounds = const bool disabled_neverExceedBounds =
!CVarGetInteger("gAdvancedResolution.PixelPerfectMode", 0) || !CVarGetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".PixelPerfectMode", 0) ||
CVarGetInteger("gAdvancedResolution.IntegerScale.FitAutomatically", 0) || disabled_everything; CVarGetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".IntegerScale.FitAutomatically", 0) || disabled_everything;
const bool checkbox_neverExceedBounds = const bool checkbox_neverExceedBounds =
UIWidgets::PaddedEnhancementCheckbox("Prevent integer scaling from exceeding screen bounds.\n" UIWidgets::PaddedEnhancementCheckbox("Prevent integer scaling from exceeding screen bounds.\n"
"(Makes screen bounds take priority over specified factor.)", "(Makes screen bounds take priority over specified factor.)",
"gAdvancedResolution.IntegerScale.NeverExceedBounds", CVAR_PREFIX_ADVANCED_RESOLUTION ".IntegerScale.NeverExceedBounds",
true, false, disabled_neverExceedBounds, "", true, false, disabled_neverExceedBounds, "",
UIWidgets::CheckboxGraphics::Cross, true); UIWidgets::CheckboxGraphics::Cross, true);
UIWidgets::Tooltip( UIWidgets::Tooltip(
@ -403,22 +404,22 @@ void AdvancedResolutionSettingsWindow::DrawElement() {
// Initialise the (currently unused) "Exceed Bounds By" cvar if it's been changed. // Initialise the (currently unused) "Exceed Bounds By" cvar if it's been changed.
if (checkbox_neverExceedBounds && if (checkbox_neverExceedBounds &&
CVarGetInteger("gAdvancedResolution.IntegerScale.ExceedBoundsBy", 0)) { CVarGetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".IntegerScale.ExceedBoundsBy", 0)) {
CVarSetInteger("gAdvancedResolution.IntegerScale.ExceedBoundsBy", 0); CVarSetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".IntegerScale.ExceedBoundsBy", 0);
CVarSave(); CVarSave();
} }
// Integer Scaling - Exceed Bounds By 1x/Offset. // Integer Scaling - Exceed Bounds By 1x/Offset.
// A popular feature in some retro frontends/upscalers, sometimes called "crop overscan" or "1080p 5x". // A popular feature in some retro frontends/upscalers, sometimes called "crop overscan" or "1080p 5x".
/* /*
UIWidgets::PaddedEnhancementCheckbox("Allow integer scale factor to go +1 above maximum screen bounds.", "gAdvancedResolution.IntegerScale.ExceedBoundsBy", false, false, !CVarGetInteger("gAdvancedResolution.PixelPerfectMode", 0) || disabled_everything, "", UIWidgets::CheckboxGraphics::Cross, false); UIWidgets::PaddedEnhancementCheckbox("Allow integer scale factor to go +1 above maximum screen bounds.", CVAR_PREFIX_ADVANCED_RESOLUTION ".IntegerScale.ExceedBoundsBy", false, false, !CVarGetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".PixelPerfectMode", 0) || disabled_everything, "", UIWidgets::CheckboxGraphics::Cross, false);
*/ */
// It does actually function as expected, but exceeding the bottom of the screen shows a scroll bar. // It does actually function as expected, but exceeding the bottom of the screen shows a scroll bar.
// I've ended up commenting this one out because of the scroll bar, and for simplicity. // I've ended up commenting this one out because of the scroll bar, and for simplicity.
// Display an info message about the scroll bar. // Display an info message about the scroll bar.
if (!CVarGetInteger("gAdvancedResolution.IntegerScale.NeverExceedBounds", 1) || if (!CVarGetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".IntegerScale.NeverExceedBounds", 1) ||
CVarGetInteger("gAdvancedResolution.IntegerScale.ExceedBoundsBy", 0)) { CVarGetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".IntegerScale.ExceedBoundsBy", 0)) {
if (disabled_neverExceedBounds) { // Dim this help text accordingly if (disabled_neverExceedBounds) { // Dim this help text accordingly
UIWidgets::DisableComponent(ImGui::GetStyle().Alpha * 0.5f); UIWidgets::DisableComponent(ImGui::GetStyle().Alpha * 0.5f);
} }
@ -431,9 +432,9 @@ void AdvancedResolutionSettingsWindow::DrawElement() {
// Another support helper button, to disable the unused "Exceed Bounds By" cvar. // Another support helper button, to disable the unused "Exceed Bounds By" cvar.
// (Remove this button if uncommenting the checkbox.) // (Remove this button if uncommenting the checkbox.)
if (CVarGetInteger("gAdvancedResolution.IntegerScale.ExceedBoundsBy", 0)) { if (CVarGetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".IntegerScale.ExceedBoundsBy", 0)) {
if (ImGui::Button("Click to reset a console variable that may be causing this.")) { if (ImGui::Button("Click to reset a console variable that may be causing this.")) {
CVarSetInteger("gAdvancedResolution.IntegerScale.ExceedBoundsBy", 0); CVarSetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".IntegerScale.ExceedBoundsBy", 0);
CVarSave(); CVarSave();
} }
} }
@ -451,13 +452,13 @@ void AdvancedResolutionSettingsWindow::DrawElement() {
if (aspectRatioX < 0.0f) { if (aspectRatioX < 0.0f) {
aspectRatioX = 0.0f; aspectRatioX = 0.0f;
} }
CVarSetFloat("gAdvancedResolution.AspectRatioX", aspectRatioX); CVarSetFloat(CVAR_PREFIX_ADVANCED_RESOLUTION ".AspectRatioX", aspectRatioX);
} }
if (update[UPDATE_aspectRatioY]) { if (update[UPDATE_aspectRatioY]) {
if (aspectRatioY < 0.0f) { if (aspectRatioY < 0.0f) {
aspectRatioY = 0.0f; aspectRatioY = 0.0f;
} }
CVarSetFloat("gAdvancedResolution.AspectRatioY", aspectRatioY); CVarSetFloat(CVAR_PREFIX_ADVANCED_RESOLUTION ".AspectRatioY", aspectRatioY);
} }
if (update[UPDATE_verticalPixelCount]) { if (update[UPDATE_verticalPixelCount]) {
// There's a upper and lower clamp on the Libultraship side too, // There's a upper and lower clamp on the Libultraship side too,
@ -468,10 +469,10 @@ void AdvancedResolutionSettingsWindow::DrawElement() {
if (verticalPixelCount > maxVerticalPixelCount) { if (verticalPixelCount > maxVerticalPixelCount) {
verticalPixelCount = maxVerticalPixelCount; verticalPixelCount = maxVerticalPixelCount;
} }
CVarSetInteger("gAdvancedResolution.VerticalPixelCount", verticalPixelCount); CVarSetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".VerticalPixelCount", verticalPixelCount);
} }
CVarSetInteger("gAdvancedResolution.UIComboItem.AspectRatio", item_aspectRatio); CVarSetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".UIComboItem.AspectRatio", item_aspectRatio);
CVarSetInteger("gAdvancedResolution.UIComboItem.PixelCount", item_pixelCount); CVarSetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".UIComboItem.PixelCount", item_pixelCount);
CVarSave(); CVarSave();
} }
} }
@ -484,7 +485,7 @@ void AdvancedResolutionSettingsWindow::UpdateElement() {
bool AdvancedResolutionSettingsWindow::IsDroppingFrames() { bool AdvancedResolutionSettingsWindow::IsDroppingFrames() {
// a rather imprecise way of checking for frame drops. // a rather imprecise way of checking for frame drops.
// but it's mostly there to inform the player of large drops. // but it's mostly there to inform the player of large drops.
const short targetFPS = CVarGetInteger("gInterpolationFPS", 20); const short targetFPS = CVarGetInteger(CVAR_SETTING("InterpolationFPS"), 20);
const float threshold = targetFPS / 20.0f + 4.1f; const float threshold = targetFPS / 20.0f + 4.1f;
return ImGui::GetIO().Framerate < targetFPS - threshold; return ImGui::GetIO().Framerate < targetFPS - threshold;
} }

View File

@ -2,12 +2,12 @@
#include <libultraship/libultraship.h> #include <libultraship/libultraship.h>
namespace AdvancedResolutionSettings { namespace AdvancedResolutionSettings {
class AdvancedResolutionSettingsWindow : public LUS::GuiWindow { class AdvancedResolutionSettingsWindow : public Ship::GuiWindow {
private: private:
bool IsDroppingFrames(); bool IsDroppingFrames();
public: public:
using LUS::GuiWindow::GuiWindow; using GuiWindow::GuiWindow;
void InitElement() override; void InitElement() override;
void DrawElement() override; void DrawElement() override;

View File

@ -837,7 +837,7 @@ extern "C" void ProcessSaveStateRequests(void) {
} }
void SaveStateMgr::SetCurrentSlot(unsigned int slot) { void SaveStateMgr::SetCurrentSlot(unsigned int slot) {
LUS::Context::GetInstance()->GetWindow()->GetGui()->GetGameOverlay()->TextDrawNotification(1.0f, true, "slot %u set", slot); Ship::Context::GetInstance()->GetWindow()->GetGui()->GetGameOverlay()->TextDrawNotification(1.0f, true, "slot %u set", slot);
this->currentSlot = slot; this->currentSlot = slot;
} }
@ -855,12 +855,12 @@ void SaveStateMgr::ProcessSaveStateRequests(void) {
this->states[request.slot] = std::make_shared<SaveState>(OTRGlobals::Instance->gSaveStateMgr, request.slot); this->states[request.slot] = std::make_shared<SaveState>(OTRGlobals::Instance->gSaveStateMgr, request.slot);
} }
this->states[request.slot]->Save(); this->states[request.slot]->Save();
LUS::Context::GetInstance()->GetWindow()->GetGui()->GetGameOverlay()->TextDrawNotification(1.0f, true, "saved state %u", request.slot); Ship::Context::GetInstance()->GetWindow()->GetGui()->GetGameOverlay()->TextDrawNotification(1.0f, true, "saved state %u", request.slot);
break; break;
case RequestType::LOAD: case RequestType::LOAD:
if (this->states.contains(request.slot)) { if (this->states.contains(request.slot)) {
this->states[request.slot]->Load(); this->states[request.slot]->Load();
LUS::Context::GetInstance()->GetWindow()->GetGui()->GetGameOverlay()->TextDrawNotification(1.0f, true, "loaded state %u", request.slot); Ship::Context::GetInstance()->GetWindow()->GetGui()->GetGameOverlay()->TextDrawNotification(1.0f, true, "loaded state %u", request.slot);
} else { } else {
SPDLOG_ERROR("Invalid SaveState slot: {}", request.type); SPDLOG_ERROR("Invalid SaveState slot: {}", request.type);
} }
@ -876,7 +876,7 @@ void SaveStateMgr::ProcessSaveStateRequests(void) {
SaveStateReturn SaveStateMgr::AddRequest(const SaveStateRequest request) { SaveStateReturn SaveStateMgr::AddRequest(const SaveStateRequest request) {
if (gPlayState == nullptr) { if (gPlayState == nullptr) {
SPDLOG_ERROR("[SOH] Can not save or load a state outside of \"GamePlay\""); SPDLOG_ERROR("[SOH] Can not save or load a state outside of \"GamePlay\"");
LUS::Context::GetInstance()->GetWindow()->GetGui()->GetGameOverlay()->TextDrawNotification(1.0f, true, "states not available here", request.slot); Ship::Context::GetInstance()->GetWindow()->GetGui()->GetGameOverlay()->TextDrawNotification(1.0f, true, "states not available here", request.slot);
return SaveStateReturn::FAIL_WRONG_GAMESTATE; return SaveStateReturn::FAIL_WRONG_GAMESTATE;
} }
@ -890,7 +890,7 @@ SaveStateReturn SaveStateMgr::AddRequest(const SaveStateRequest request) {
return SaveStateReturn::SUCCESS; return SaveStateReturn::SUCCESS;
} else { } else {
SPDLOG_ERROR("Invalid SaveState slot: {}", request.type); SPDLOG_ERROR("Invalid SaveState slot: {}", request.type);
LUS::Context::GetInstance()->GetWindow()->GetGui()->GetGameOverlay()->TextDrawNotification(1.0f, true, "state slot %u empty", request.slot); Ship::Context::GetInstance()->GetWindow()->GetGui()->GetGameOverlay()->TextDrawNotification(1.0f, true, "state slot %u empty", request.slot);
return SaveStateReturn::FAIL_INVALID_SLOT; return SaveStateReturn::FAIL_INVALID_SLOT;
} }
[[unlikely]] default: [[unlikely]] default:

View File

@ -92,7 +92,7 @@ std::string GetParameritizedText(std::string key, TextBank bank, const char* arg
} }
const char* GetLanguageCode() { const char* GetLanguageCode() {
switch (CVarGetInteger("gLanguages", 0)) { switch (CVarGetInteger(CVAR_SETTING("Languages"), 0)) {
case LANGUAGE_FRA: case LANGUAGE_FRA:
return "fr-FR"; return "fr-FR";
break; break;
@ -116,7 +116,7 @@ static std::string titleCardText;
void RegisterOnSceneInitHook() { void RegisterOnSceneInitHook() {
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnSceneInit>([](int16_t sceneNum) { GameInteractor::Instance->RegisterGameHook<GameInteractor::OnSceneInit>([](int16_t sceneNum) {
if (!CVarGetInteger("gA11yTTS", 0)) return; if (!CVarGetInteger(CVAR_SETTING("A11yTTS"), 0)) return;
titleCardText = NameForSceneId(sceneNum); titleCardText = NameForSceneId(sceneNum);
}); });
@ -124,7 +124,7 @@ void RegisterOnSceneInitHook() {
void RegisterOnPresentTitleCardHook() { void RegisterOnPresentTitleCardHook() {
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnPresentTitleCard>([]() { GameInteractor::Instance->RegisterGameHook<GameInteractor::OnPresentTitleCard>([]() {
if (!CVarGetInteger("gA11yTTS", 0)) return; if (!CVarGetInteger(CVAR_SETTING("A11yTTS"), 0)) return;
SpeechSynthesizer::Instance->Speak(titleCardText.c_str(), GetLanguageCode()); SpeechSynthesizer::Instance->Speak(titleCardText.c_str(), GetLanguageCode());
}); });
@ -134,7 +134,7 @@ void RegisterOnPresentTitleCardHook() {
void RegisterOnInterfaceUpdateHook() { void RegisterOnInterfaceUpdateHook() {
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnInterfaceUpdate>([]() { GameInteractor::Instance->RegisterGameHook<GameInteractor::OnInterfaceUpdate>([]() {
if (!CVarGetInteger("gA11yTTS", 0)) return; if (!CVarGetInteger(CVAR_SETTING("A11yTTS"), 0)) return;
static uint32_t prevTimer = 0; static uint32_t prevTimer = 0;
static char ttsAnnounceBuf[32]; static char ttsAnnounceBuf[32];
@ -193,7 +193,7 @@ void RegisterOnInterfaceUpdateHook() {
void RegisterOnKaleidoscopeUpdateHook() { void RegisterOnKaleidoscopeUpdateHook() {
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnKaleidoscopeUpdate>([](int16_t inDungeonScene) { GameInteractor::Instance->RegisterGameHook<GameInteractor::OnKaleidoscopeUpdate>([](int16_t inDungeonScene) {
if (!CVarGetInteger("gA11yTTS", 0)) return; if (!CVarGetInteger(CVAR_SETTING("A11yTTS"), 0)) return;
static int16_t prevCursorIndex = 0; static int16_t prevCursorIndex = 0;
static uint16_t prevCursorSpecialPos = 0; static uint16_t prevCursorSpecialPos = 0;
@ -550,14 +550,14 @@ void RegisterOnKaleidoscopeUpdateHook() {
void RegisterOnUpdateMainMenuSelection() { void RegisterOnUpdateMainMenuSelection() {
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnPresentFileSelect>([]() { GameInteractor::Instance->RegisterGameHook<GameInteractor::OnPresentFileSelect>([]() {
if (!CVarGetInteger("gA11yTTS", 0)) return; if (!CVarGetInteger(CVAR_SETTING("A11yTTS"), 0)) return;
auto translation = GetParameritizedText("file1", TEXT_BANK_FILECHOOSE, nullptr); auto translation = GetParameritizedText("file1", TEXT_BANK_FILECHOOSE, nullptr);
SpeechSynthesizer::Instance->Speak(translation.c_str(), GetLanguageCode()); SpeechSynthesizer::Instance->Speak(translation.c_str(), GetLanguageCode());
}); });
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnUpdateFileSelectSelection>([](uint16_t optionIndex) { GameInteractor::Instance->RegisterGameHook<GameInteractor::OnUpdateFileSelectSelection>([](uint16_t optionIndex) {
if (!CVarGetInteger("gA11yTTS", 0)) return; if (!CVarGetInteger(CVAR_SETTING("A11yTTS"), 0)) return;
switch (optionIndex) { switch (optionIndex) {
case FS_BTN_MAIN_FILE_1: { case FS_BTN_MAIN_FILE_1: {
@ -596,7 +596,7 @@ void RegisterOnUpdateMainMenuSelection() {
}); });
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnUpdateFileSelectConfirmationSelection>([](uint16_t optionIndex) { GameInteractor::Instance->RegisterGameHook<GameInteractor::OnUpdateFileSelectConfirmationSelection>([](uint16_t optionIndex) {
if (!CVarGetInteger("gA11yTTS", 0)) return; if (!CVarGetInteger(CVAR_SETTING("A11yTTS"), 0)) return;
switch (optionIndex) { switch (optionIndex) {
case FS_BTN_CONFIRM_YES: { case FS_BTN_CONFIRM_YES: {
@ -615,7 +615,7 @@ void RegisterOnUpdateMainMenuSelection() {
}); });
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnUpdateFileCopySelection>([](uint16_t optionIndex) { GameInteractor::Instance->RegisterGameHook<GameInteractor::OnUpdateFileCopySelection>([](uint16_t optionIndex) {
if (!CVarGetInteger("gA11yTTS", 0)) return; if (!CVarGetInteger(CVAR_SETTING("A11yTTS"), 0)) return;
switch (optionIndex) { switch (optionIndex) {
case FS_BTN_COPY_FILE_1: { case FS_BTN_COPY_FILE_1: {
@ -644,7 +644,7 @@ void RegisterOnUpdateMainMenuSelection() {
}); });
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnUpdateFileCopyConfirmationSelection>([](uint16_t optionIndex) { GameInteractor::Instance->RegisterGameHook<GameInteractor::OnUpdateFileCopyConfirmationSelection>([](uint16_t optionIndex) {
if (!CVarGetInteger("gA11yTTS", 0)) return; if (!CVarGetInteger(CVAR_SETTING("A11yTTS"), 0)) return;
switch (optionIndex) { switch (optionIndex) {
case FS_BTN_CONFIRM_YES: { case FS_BTN_CONFIRM_YES: {
@ -663,7 +663,7 @@ void RegisterOnUpdateMainMenuSelection() {
}); });
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnUpdateFileEraseSelection>([](uint16_t optionIndex) { GameInteractor::Instance->RegisterGameHook<GameInteractor::OnUpdateFileEraseSelection>([](uint16_t optionIndex) {
if (!CVarGetInteger("gA11yTTS", 0)) return; if (!CVarGetInteger(CVAR_SETTING("A11yTTS"), 0)) return;
switch (optionIndex) { switch (optionIndex) {
case FS_BTN_ERASE_FILE_1: { case FS_BTN_ERASE_FILE_1: {
@ -692,7 +692,7 @@ void RegisterOnUpdateMainMenuSelection() {
}); });
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnUpdateFileEraseConfirmationSelection>([](uint16_t optionIndex) { GameInteractor::Instance->RegisterGameHook<GameInteractor::OnUpdateFileEraseConfirmationSelection>([](uint16_t optionIndex) {
if (!CVarGetInteger("gA11yTTS", 0)) return; if (!CVarGetInteger(CVAR_SETTING("A11yTTS"), 0)) return;
switch (optionIndex) { switch (optionIndex) {
case FS_BTN_CONFIRM_YES: { case FS_BTN_CONFIRM_YES: {
@ -711,7 +711,7 @@ void RegisterOnUpdateMainMenuSelection() {
}); });
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnUpdateFileAudioSelection>([](uint8_t optionIndex) { GameInteractor::Instance->RegisterGameHook<GameInteractor::OnUpdateFileAudioSelection>([](uint8_t optionIndex) {
if (!CVarGetInteger("gA11yTTS", 0)) return; if (!CVarGetInteger(CVAR_SETTING("A11yTTS"), 0)) return;
switch (optionIndex) { switch (optionIndex) {
case FS_AUDIO_STEREO: { case FS_AUDIO_STEREO: {
@ -740,7 +740,7 @@ void RegisterOnUpdateMainMenuSelection() {
}); });
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnUpdateFileTargetSelection>([](uint8_t optionIndex) { GameInteractor::Instance->RegisterGameHook<GameInteractor::OnUpdateFileTargetSelection>([](uint8_t optionIndex) {
if (!CVarGetInteger("gA11yTTS", 0)) return; if (!CVarGetInteger(CVAR_SETTING("A11yTTS"), 0)) return;
switch (optionIndex) { switch (optionIndex) {
case FS_TARGET_SWITCH: { case FS_TARGET_SWITCH: {
@ -759,7 +759,7 @@ void RegisterOnUpdateMainMenuSelection() {
}); });
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnUpdateFileLanguageSelection>([](uint8_t optionIndex) { GameInteractor::Instance->RegisterGameHook<GameInteractor::OnUpdateFileLanguageSelection>([](uint8_t optionIndex) {
if (!CVarGetInteger("gA11yTTS", 0)) return; if (!CVarGetInteger(CVAR_SETTING("A11yTTS"), 0)) return;
switch (optionIndex) { switch (optionIndex) {
case LANGUAGE_ENG: { case LANGUAGE_ENG: {
@ -783,7 +783,7 @@ void RegisterOnUpdateMainMenuSelection() {
}); });
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnUpdateFileQuestSelection>([](uint8_t questIndex) { GameInteractor::Instance->RegisterGameHook<GameInteractor::OnUpdateFileQuestSelection>([](uint8_t questIndex) {
if (!CVarGetInteger("gA11yTTS", 0)) return; if (!CVarGetInteger(CVAR_SETTING("A11yTTS"), 0)) return;
switch (questIndex) { switch (questIndex) {
case QUEST_NORMAL: { case QUEST_NORMAL: {
@ -812,7 +812,7 @@ void RegisterOnUpdateMainMenuSelection() {
}); });
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnUpdateFileBossRushOptionSelection>([](uint8_t optionIndex, uint8_t optionValue) { GameInteractor::Instance->RegisterGameHook<GameInteractor::OnUpdateFileBossRushOptionSelection>([](uint8_t optionIndex, uint8_t optionValue) {
if (!CVarGetInteger("gA11yTTS", 0)) return; if (!CVarGetInteger(CVAR_SETTING("A11yTTS"), 0)) return;
auto optionName = BossRush_GetSettingName(optionIndex, gSaveContext.language); auto optionName = BossRush_GetSettingName(optionIndex, gSaveContext.language);
auto optionValueName = BossRush_GetSettingChoiceName(optionIndex, optionValue, gSaveContext.language); auto optionValueName = BossRush_GetSettingChoiceName(optionIndex, optionValue, gSaveContext.language);
@ -821,7 +821,7 @@ void RegisterOnUpdateMainMenuSelection() {
}); });
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnUpdateFileNameSelection>([](int16_t charCode) { GameInteractor::Instance->RegisterGameHook<GameInteractor::OnUpdateFileNameSelection>([](int16_t charCode) {
if (!CVarGetInteger("gA11yTTS", 0)) return; if (!CVarGetInteger(CVAR_SETTING("A11yTTS"), 0)) return;
char charVal[2]; char charVal[2];
std::string translation; std::string translation;
@ -958,7 +958,7 @@ std::string Message_TTS_Decode(uint8_t* sourceBuf, uint16_t startOfset, uint16_t
void RegisterOnDialogMessageHook() { void RegisterOnDialogMessageHook() {
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnDialogMessage>([]() { GameInteractor::Instance->RegisterGameHook<GameInteractor::OnDialogMessage>([]() {
if (!CVarGetInteger("gA11yTTS", 0)) return; if (!CVarGetInteger(CVAR_SETTING("A11yTTS"), 0)) return;
MessageContext *msgCtx = &gPlayState->msgCtx; MessageContext *msgCtx = &gPlayState->msgCtx;
@ -1030,7 +1030,7 @@ void RegisterOnDialogMessageHook() {
void InitTTSBank() { void InitTTSBank() {
std::string languageSuffix = "_eng.json"; std::string languageSuffix = "_eng.json";
switch (CVarGetInteger("gLanguages", 0)) { switch (CVarGetInteger(CVAR_SETTING("Languages"), 0)) {
case LANGUAGE_FRA: case LANGUAGE_FRA:
languageSuffix = "_fra.json"; languageSuffix = "_fra.json";
break; break;
@ -1039,22 +1039,22 @@ void InitTTSBank() {
break; break;
} }
auto initData = std::make_shared<LUS::ResourceInitData>(); auto initData = std::make_shared<Ship::ResourceInitData>();
initData->Format = RESOURCE_FORMAT_BINARY; initData->Format = RESOURCE_FORMAT_BINARY;
initData->Type = static_cast<uint32_t>(LUS::ResourceType::Json); initData->Type = static_cast<uint32_t>(Ship::ResourceType::Json);
initData->ResourceVersion = 0; initData->ResourceVersion = 0;
sceneMap = std::static_pointer_cast<LUS::Json>( sceneMap = std::static_pointer_cast<Ship::Json>(
LUS::Context::GetInstance()->GetResourceManager()->LoadResource("accessibility/texts/scenes" + languageSuffix, true, initData))->Data; Ship::Context::GetInstance()->GetResourceManager()->LoadResource("accessibility/texts/scenes" + languageSuffix, true, initData))->Data;
miscMap = std::static_pointer_cast<LUS::Json>( miscMap = std::static_pointer_cast<Ship::Json>(
LUS::Context::GetInstance()->GetResourceManager()->LoadResource("accessibility/texts/misc" + languageSuffix, true, initData))->Data; Ship::Context::GetInstance()->GetResourceManager()->LoadResource("accessibility/texts/misc" + languageSuffix, true, initData))->Data;
kaleidoMap = std::static_pointer_cast<LUS::Json>( kaleidoMap = std::static_pointer_cast<Ship::Json>(
LUS::Context::GetInstance()->GetResourceManager()->LoadResource("accessibility/texts/kaleidoscope" + languageSuffix, true, initData))->Data; Ship::Context::GetInstance()->GetResourceManager()->LoadResource("accessibility/texts/kaleidoscope" + languageSuffix, true, initData))->Data;
fileChooseMap = std::static_pointer_cast<LUS::Json>( fileChooseMap = std::static_pointer_cast<Ship::Json>(
LUS::Context::GetInstance()->GetResourceManager()->LoadResource("accessibility/texts/filechoose" + languageSuffix, true, initData))->Data; Ship::Context::GetInstance()->GetResourceManager()->LoadResource("accessibility/texts/filechoose" + languageSuffix, true, initData))->Data;
} }
void RegisterOnSetGameLanguageHook() { void RegisterOnSetGameLanguageHook() {

View File

@ -6,7 +6,7 @@
#endif #endif
#include "Extract.h" #include "Extract.h"
#include "portable-file-dialogs.h" #include "portable-file-dialogs.h"
#include <Utils/BitConverter.h> #include <utils/binarytools/BitConverter.h>
#include "variables.h" #include "variables.h"
#ifdef unix #ifdef unix

View File

@ -22,11 +22,6 @@
#include <time.h> #include <time.h>
#endif #endif
#include <Array.h> #include <Array.h>
#include <stb/stb_image.h>
#define DRMP3_IMPLEMENTATION
#include <dr_libs/mp3.h>
#define DRWAV_IMPLEMENTATION
#include <dr_libs/wav.h>
#include <AudioPlayer.h> #include <AudioPlayer.h>
#include "Enhancements/speechsynthesizer/SpeechSynthesizer.h" #include "Enhancements/speechsynthesizer/SpeechSynthesizer.h"
#include "Enhancements/controls/SohInputEditorWindow.h" #include "Enhancements/controls/SohInputEditorWindow.h"
@ -49,7 +44,7 @@
#include "z64.h" #include "z64.h"
#include "macros.h" #include "macros.h"
#include "Fonts.h" #include "Fonts.h"
#include <Utils/StringHelper.h> #include <utils/StringHelper.h>
#include "Enhancements/custom-message/CustomMessageManager.h" #include "Enhancements/custom-message/CustomMessageManager.h"
#include "Enhancements/presets.h" #include "Enhancements/presets.h"
#include "util.h" #include "util.h"
@ -94,6 +89,12 @@ GameInteractorSail* GameInteractorSail::Instance;
#include <libultraship/libultraship.h> #include <libultraship/libultraship.h>
// Resource Types/Factories // Resource Types/Factories
#include "resource/type/Array.h"
#include "resource/type/Blob.h"
#include "resource/type/DisplayList.h"
#include "resource/type/Matrix.h"
#include "resource/type/Texture.h"
#include "resource/type/Vertex.h"
#include "soh/resource/type/SohResourceType.h" #include "soh/resource/type/SohResourceType.h"
#include "soh/resource/type/Animation.h" #include "soh/resource/type/Animation.h"
#include "soh/resource/type/AudioSample.h" #include "soh/resource/type/AudioSample.h"
@ -107,6 +108,12 @@ GameInteractorSail* GameInteractorSail::Instance;
#include "soh/resource/type/Skeleton.h" #include "soh/resource/type/Skeleton.h"
#include "soh/resource/type/SkeletonLimb.h" #include "soh/resource/type/SkeletonLimb.h"
#include "soh/resource/type/Text.h" #include "soh/resource/type/Text.h"
#include "resource/factory/ArrayFactory.h"
#include "resource/factory/BlobFactory.h"
#include "resource/factory/DisplayListFactory.h"
#include "resource/factory/MatrixFactory.h"
#include "resource/factory/TextureFactory.h"
#include "resource/factory/VertexFactory.h"
#include "soh/resource/importer/AnimationFactory.h" #include "soh/resource/importer/AnimationFactory.h"
#include "soh/resource/importer/AudioSampleFactory.h" #include "soh/resource/importer/AudioSampleFactory.h"
#include "soh/resource/importer/AudioSequenceFactory.h" #include "soh/resource/importer/AudioSequenceFactory.h"
@ -254,19 +261,19 @@ const char* constCameraStrings[] = {
OTRGlobals::OTRGlobals() { OTRGlobals::OTRGlobals() {
std::vector<std::string> OTRFiles; std::vector<std::string> OTRFiles;
std::string mqPath = LUS::Context::LocateFileAcrossAppDirs("oot-mq.otr", appShortName); std::string mqPath = Ship::Context::LocateFileAcrossAppDirs("oot-mq.otr", appShortName);
if (std::filesystem::exists(mqPath)) { if (std::filesystem::exists(mqPath)) {
OTRFiles.push_back(mqPath); OTRFiles.push_back(mqPath);
} }
std::string ootPath = LUS::Context::LocateFileAcrossAppDirs("oot.otr", appShortName); std::string ootPath = Ship::Context::LocateFileAcrossAppDirs("oot.otr", appShortName);
if (std::filesystem::exists(ootPath)) { if (std::filesystem::exists(ootPath)) {
OTRFiles.push_back(ootPath); OTRFiles.push_back(ootPath);
} }
std::string sohOtrPath = LUS::Context::GetPathRelativeToAppBundle("soh.otr"); std::string sohOtrPath = Ship::Context::GetPathRelativeToAppBundle("soh.otr");
if (std::filesystem::exists(sohOtrPath)) { if (std::filesystem::exists(sohOtrPath)) {
OTRFiles.push_back(sohOtrPath); OTRFiles.push_back(sohOtrPath);
} }
std::string patchesPath = LUS::Context::LocateFileAcrossAppDirs("mods", appShortName); std::string patchesPath = Ship::Context::LocateFileAcrossAppDirs("mods", appShortName);
std::vector<std::string> patchOTRs = {}; std::vector<std::string> patchOTRs = {};
if (patchesPath.length() > 0 && std::filesystem::exists(patchesPath)) { if (patchesPath.length() > 0 && std::filesystem::exists(patchesPath)) {
if (std::filesystem::is_directory(patchesPath)) { if (std::filesystem::is_directory(patchesPath)) {
@ -308,7 +315,7 @@ OTRGlobals::OTRGlobals() {
OOT_PAL_GC_DBG2 OOT_PAL_GC_DBG2
}; };
context = LUS::Context::CreateUninitializedInstance("Ship of Harkinian", appShortName, "shipofharkinian.json"); context = Ship::Context::CreateUninitializedInstance("Ship of Harkinian", appShortName, "shipofharkinian.json");
context->InitLogging(); context->InitLogging();
context->InitGfxDebugger(); context->InitGfxDebugger();
@ -324,16 +331,32 @@ OTRGlobals::OTRGlobals() {
context->InitCrashHandler(); context->InitCrashHandler();
context->InitConsole(); context->InitConsole();
auto sohInputEditorWindow = std::make_shared<SohInputEditorWindow>("gControllerConfigurationEnabled", "Input Editor"); auto sohInputEditorWindow = std::make_shared<SohInputEditorWindow>(CVAR_CONTROLLER_CONFIGURATION_WINDOW_OPEN, "Input Editor");
context->InitWindow(sohInputEditorWindow); context->InitWindow({ sohInputEditorWindow });
auto overlay = context->GetInstance()->GetWindow()->GetGui()->GetGameOverlay();
overlay->LoadFont("Press Start 2P", "fonts/PressStart2P-Regular.ttf", 12.0f);
overlay->LoadFont("Fipps", "fonts/Fipps-Regular.otf", 32.0f);
overlay->SetCurrentFont(CVarGetString(CVAR_GAME_OVERLAY_FONT, "Press Start 2P"));
context->InitAudio(); context->InitAudio();
SPDLOG_INFO("Starting Ship of Harkinian version {}", (char*)gBuildVersion); SPDLOG_INFO("Starting Ship of Harkinian version {}", (char*)gBuildVersion);
auto loader = context->GetResourceManager()->GetResourceLoader(); auto loader = context->GetResourceManager()->GetResourceLoader();
loader->RegisterResourceFactory(std::make_shared<LUS::ResourceFactoryBinaryTextureV0>(), RESOURCE_FORMAT_BINARY, "Texture", static_cast<uint32_t>(LUS::ResourceType::Texture), 0);
loader->RegisterResourceFactory(std::make_shared<LUS::ResourceFactoryBinaryTextureV1>(), RESOURCE_FORMAT_BINARY, "Texture", static_cast<uint32_t>(LUS::ResourceType::Texture), 1);
loader->RegisterResourceFactory(std::make_shared<LUS::ResourceFactoryBinaryVertexV0>(), RESOURCE_FORMAT_BINARY, "Vertex", static_cast<uint32_t>(LUS::ResourceType::Vertex), 0);
loader->RegisterResourceFactory(std::make_shared<LUS::ResourceFactoryXMLVertexV0>(), RESOURCE_FORMAT_XML, "Vertex", static_cast<uint32_t>(LUS::ResourceType::Vertex), 0);
loader->RegisterResourceFactory(std::make_shared<LUS::ResourceFactoryBinaryDisplayListV0>(), RESOURCE_FORMAT_BINARY, "DisplayList", static_cast<uint32_t>(LUS::ResourceType::DisplayList), 0);
loader->RegisterResourceFactory(std::make_shared<LUS::ResourceFactoryXMLDisplayListV0>(), RESOURCE_FORMAT_XML, "DisplayList", static_cast<uint32_t>(LUS::ResourceType::DisplayList), 0);
loader->RegisterResourceFactory(std::make_shared<LUS::ResourceFactoryBinaryMatrixV0>(), RESOURCE_FORMAT_BINARY, "Matrix", static_cast<uint32_t>(LUS::ResourceType::Matrix), 0);
loader->RegisterResourceFactory(std::make_shared<LUS::ResourceFactoryBinaryArrayV0>(), RESOURCE_FORMAT_BINARY, "Array", static_cast<uint32_t>(LUS::ResourceType::Array), 0);
loader->RegisterResourceFactory(std::make_shared<LUS::ResourceFactoryBinaryBlobV0>(), RESOURCE_FORMAT_BINARY, "Blob", static_cast<uint32_t>(LUS::ResourceType::Blob), 0);
loader->RegisterResourceFactory(std::make_shared<SOH::ResourceFactoryBinaryAnimationV0>(), RESOURCE_FORMAT_BINARY, "Animation", static_cast<uint32_t>(SOH::ResourceType::SOH_Animation), 0); loader->RegisterResourceFactory(std::make_shared<SOH::ResourceFactoryBinaryAnimationV0>(), RESOURCE_FORMAT_BINARY, "Animation", static_cast<uint32_t>(SOH::ResourceType::SOH_Animation), 0);
loader->RegisterResourceFactory(std::make_shared<SOH::ResourceFactoryBinaryPlayerAnimationV0>(), RESOURCE_FORMAT_BINARY, "PlayerAnimation", static_cast<uint32_t>(SOH::ResourceType::SOH_PlayerAnimation), 0); loader->RegisterResourceFactory(std::make_shared<SOH::ResourceFactoryBinaryPlayerAnimationV0>(), RESOURCE_FORMAT_BINARY, "PlayerAnimation", static_cast<uint32_t>(SOH::ResourceType::SOH_PlayerAnimation), 0);
loader->RegisterResourceFactory(std::make_shared<SOH::ResourceFactoryBinarySceneV0>(), RESOURCE_FORMAT_BINARY, "Room", static_cast<uint32_t>(SOH::ResourceType::SOH_Room), 0); // Is room scene? maybe? loader->RegisterResourceFactory(std::make_shared<SOH::ResourceFactoryBinarySceneV0>(), RESOURCE_FORMAT_BINARY, "Room", static_cast<uint32_t>(SOH::ResourceType::SOH_Room), 0); // Is room scene? maybe?
loader->RegisterResourceFactory(std::make_shared<SOH::ResourceFactoryXMLSceneV0>(), RESOURCE_FORMAT_XML, "Room", static_cast<uint32_t>(SOH::ResourceType::SOH_Room), 0); // Is room scene? maybe?
loader->RegisterResourceFactory(std::make_shared<SOH::ResourceFactoryBinaryCollisionHeaderV0>(), RESOURCE_FORMAT_BINARY, "CollisionHeader", static_cast<uint32_t>(SOH::ResourceType::SOH_CollisionHeader), 0); loader->RegisterResourceFactory(std::make_shared<SOH::ResourceFactoryBinaryCollisionHeaderV0>(), RESOURCE_FORMAT_BINARY, "CollisionHeader", static_cast<uint32_t>(SOH::ResourceType::SOH_CollisionHeader), 0);
loader->RegisterResourceFactory(std::make_shared<SOH::ResourceFactoryXMLCollisionHeaderV0>(), RESOURCE_FORMAT_XML, "CollisionHeader", static_cast<uint32_t>(SOH::ResourceType::SOH_CollisionHeader), 0); loader->RegisterResourceFactory(std::make_shared<SOH::ResourceFactoryXMLCollisionHeaderV0>(), RESOURCE_FORMAT_XML, "CollisionHeader", static_cast<uint32_t>(SOH::ResourceType::SOH_CollisionHeader), 0);
loader->RegisterResourceFactory(std::make_shared<SOH::ResourceFactoryBinarySkeletonV0>(), RESOURCE_FORMAT_BINARY, "Skeleton", static_cast<uint32_t>(SOH::ResourceType::SOH_Skeleton), 0); loader->RegisterResourceFactory(std::make_shared<SOH::ResourceFactoryBinarySkeletonV0>(), RESOURCE_FORMAT_BINARY, "Skeleton", static_cast<uint32_t>(SOH::ResourceType::SOH_Skeleton), 0);
@ -382,7 +405,7 @@ OTRGlobals::OTRGlobals() {
#if defined(__SWITCH__) #if defined(__SWITCH__)
SPDLOG_ERROR("Invalid OTR File!"); SPDLOG_ERROR("Invalid OTR File!");
#elif defined(__WIIU__) #elif defined(__WIIU__)
LUS::WiiU::ThrowInvalidOTR(); Ship::WiiU::ThrowInvalidOTR();
#else #else
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Invalid OTR File", SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Invalid OTR File",
"Attempted to load an invalid OTR file. Try regenerating.", nullptr); "Attempted to load an invalid OTR file. Try regenerating.", nullptr);
@ -420,7 +443,7 @@ OTRGlobals::~OTRGlobals() {
} }
void OTRGlobals::ScaleImGui() { void OTRGlobals::ScaleImGui() {
float scale = imguiScaleOptionToValue[CVarGetInteger("gImGuiScale", defaultImGuiScale)]; float scale = imguiScaleOptionToValue[CVarGetInteger(CVAR_SETTING("ImGuiScale"), defaultImGuiScale)];
float newScale = scale / previousImGuiScale; float newScale = scale / previousImGuiScale;
ImGui::GetStyle().ScaleAllSizes(newScale); ImGui::GetStyle().ScaleAllSizes(newScale);
ImGui::GetIO().FontGlobalScale = scale; ImGui::GetIO().FontGlobalScale = scale;
@ -454,15 +477,15 @@ bool OTRGlobals::HasOriginal() {
} }
uint32_t OTRGlobals::GetInterpolationFPS() { uint32_t OTRGlobals::GetInterpolationFPS() {
if (LUS::Context::GetInstance()->GetWindow()->GetWindowBackend() == LUS::WindowBackend::DX11) { if (Ship::Context::GetInstance()->GetWindow()->GetWindowBackend() == Ship::WindowBackend::DX11) {
return CVarGetInteger("gInterpolationFPS", 20); return CVarGetInteger(CVAR_SETTING("InterpolationFPS"), 20);
} }
if (CVarGetInteger("gMatchRefreshRate", 0)) { if (CVarGetInteger(CVAR_SETTING("MatchRefreshRate"), 0)) {
return LUS::Context::GetInstance()->GetWindow()->GetCurrentRefreshRate(); return Ship::Context::GetInstance()->GetWindow()->GetCurrentRefreshRate();
} }
return std::min<uint32_t>(LUS::Context::GetInstance()->GetWindow()->GetCurrentRefreshRate(), CVarGetInteger("gInterpolationFPS", 20)); return std::min<uint32_t>(Ship::Context::GetInstance()->GetWindow()->GetCurrentRefreshRate(), CVarGetInteger(CVAR_SETTING("InterpolationFPS"), 20));
} }
struct ExtensionEntry { struct ExtensionEntry {
@ -857,7 +880,7 @@ extern "C" RandomizerGet RetrieveRandomizerGetFromItemID(ItemID itemID) {
} }
extern "C" void OTRExtScanner() { extern "C" void OTRExtScanner() {
auto lst = *LUS::Context::GetInstance()->GetResourceManager()->GetArchiveManager()->ListFiles().get(); auto lst = *Ship::Context::GetInstance()->GetResourceManager()->GetArchiveManager()->ListFiles().get();
for (auto& rPath : lst) { for (auto& rPath : lst) {
std::vector<std::string> raw = StringHelper::Split(rPath, "."); std::vector<std::string> raw = StringHelper::Split(rPath, ".");
@ -880,13 +903,13 @@ OTRVersion ReadPortVersionFromOTR(std::string otrPath) {
OTRVersion version = {}; OTRVersion version = {};
// Use a temporary archive instance to load the otr and read the version file // Use a temporary archive instance to load the otr and read the version file
auto archive = LUS::OtrArchive(otrPath); auto archive = Ship::OtrArchive(otrPath);
if (archive.Open()) { if (archive.Open()) {
auto t = archive.LoadFile("portVersion", std::make_shared<LUS::ResourceInitData>()); auto t = archive.LoadFile("portVersion", std::make_shared<Ship::ResourceInitData>());
if (t != nullptr && t->IsLoaded) { if (t != nullptr && t->IsLoaded) {
auto stream = std::make_shared<LUS::MemoryStream>(t->Buffer->data(), t->Buffer->size()); auto stream = std::make_shared<Ship::MemoryStream>(t->Buffer->data(), t->Buffer->size());
auto reader = std::make_shared<LUS::BinaryReader>(stream); auto reader = std::make_shared<Ship::BinaryReader>(stream);
LUS::Endianness endianness = (LUS::Endianness)reader->ReadUByte(); Ship::Endianness endianness = (Ship::Endianness)reader->ReadUByte();
reader->SetEndianness(endianness); reader->SetEndianness(endianness);
version.major = reader->ReadUInt16(); version.major = reader->ReadUInt16();
version.minor = reader->ReadUInt16(); version.minor = reader->ReadUInt16();
@ -917,7 +940,7 @@ void CheckSoHOTRVersion(std::string otrPath) {
Extractor::ShowErrorBox("soh.otr file is missing", msg.c_str()); Extractor::ShowErrorBox("soh.otr file is missing", msg.c_str());
exit(1); exit(1);
#elif defined(__SWITCH__) #elif defined(__SWITCH__)
LUS::Switch::PrintErrorMessageToScreen(("\x1b[2;2HYou are missing the soh.otr file." + msg).c_str()); Ship::Switch::PrintErrorMessageToScreen(("\x1b[2;2HYou are missing the soh.otr file." + msg).c_str());
#elif defined(__WIIU__) #elif defined(__WIIU__)
OSFatal(("You are missing the soh.otr file\n\n" + msg).c_str()); OSFatal(("You are missing the soh.otr file\n\n" + msg).c_str());
#endif #endif
@ -930,7 +953,7 @@ void CheckSoHOTRVersion(std::string otrPath) {
Extractor::ShowErrorBox("soh.otr file version does not match", msg.c_str()); Extractor::ShowErrorBox("soh.otr file version does not match", msg.c_str());
exit(1); exit(1);
#elif defined(__SWITCH__) #elif defined(__SWITCH__)
LUS::Switch::PrintErrorMessageToScreen(("\x1b[2;2HYou have an old soh.otr file." + msg).c_str()); Ship::Switch::PrintErrorMessageToScreen(("\x1b[2;2HYou have an old soh.otr file." + msg).c_str());
#elif defined(__WIIU__) #elif defined(__WIIU__)
OSFatal(("You have an old soh.otr file\n\n" + msg).c_str()); OSFatal(("You have an old soh.otr file\n\n" + msg).c_str());
#endif #endif
@ -941,7 +964,7 @@ void CheckSoHOTRVersion(std::string otrPath) {
// For Windows/Mac/Linux if the version doesn't match, offer to // For Windows/Mac/Linux if the version doesn't match, offer to
void DetectOTRVersion(std::string fileName, bool isMQ) { void DetectOTRVersion(std::string fileName, bool isMQ) {
bool isOtrOld = false; bool isOtrOld = false;
std::string otrPath = LUS::Context::LocateFileAcrossAppDirs(fileName, appShortName); std::string otrPath = Ship::Context::LocateFileAcrossAppDirs(fileName, appShortName);
// Doesn't exist so nothing to do here // Doesn't exist so nothing to do here
if (!std::filesystem::exists(otrPath)) { if (!std::filesystem::exists(otrPath)) {
@ -971,7 +994,7 @@ void DetectOTRVersion(std::string fileName, bool isMQ) {
fileName.c_str(), version); fileName.c_str(), version);
if (Extractor::ShowYesNoBox("Old OTR File Found", msgBuf) == IDYES) { if (Extractor::ShowYesNoBox("Old OTR File Found", msgBuf) == IDYES) {
std::string installPath = LUS::Context::GetAppBundlePath(); std::string installPath = Ship::Context::GetAppBundlePath();
if (!std::filesystem::exists(installPath + "/assets/extractor")) { if (!std::filesystem::exists(installPath + "/assets/extractor")) {
Extractor::ShowErrorBox("Extractor assets not found", Extractor::ShowErrorBox("Extractor assets not found",
"Unable to regenerate. Missing assets/extractor folder needed to generate OTR file.\n\nExiting..."); "Unable to regenerate. Missing assets/extractor folder needed to generate OTR file.\n\nExiting...");
@ -979,17 +1002,17 @@ void DetectOTRVersion(std::string fileName, bool isMQ) {
} }
Extractor extract; Extractor extract;
if (!extract.Run(LUS::Context::GetAppDirectoryPath(appShortName), isMQ ? RomSearchMode::MQ : RomSearchMode::Vanilla)) { if (!extract.Run(Ship::Context::GetAppDirectoryPath(appShortName), isMQ ? RomSearchMode::MQ : RomSearchMode::Vanilla)) {
Extractor::ShowErrorBox("Error", "An error occured, no OTR file was generated.\n\nExiting..."); Extractor::ShowErrorBox("Error", "An error occured, no OTR file was generated.\n\nExiting...");
exit(1); exit(1);
} }
extract.CallZapd(installPath, LUS::Context::GetAppDirectoryPath(appShortName)); extract.CallZapd(installPath, Ship::Context::GetAppDirectoryPath(appShortName));
} else { } else {
exit(1); exit(1);
} }
#elif defined(__SWITCH__) #elif defined(__SWITCH__)
LUS::Switch::PrintErrorMessageToScreen("\x1b[2;2HYou've launched the Ship with an old game OTR file." Ship::Switch::PrintErrorMessageToScreen("\x1b[2;2HYou've launched the Ship with an old game OTR file."
"\x1b[4;2HPlease regenerate a new game OTR and relaunch." "\x1b[4;2HPlease regenerate a new game OTR and relaunch."
"\x1b[6;2HPress the Home button to exit..."); "\x1b[6;2HPress the Home button to exit...");
#elif defined(__WIIU__) #elif defined(__WIIU__)
@ -1017,9 +1040,9 @@ bool PathTestCleanup(FILE* tfile) {
extern "C" void InitOTR() { extern "C" void InitOTR() {
#ifdef __SWITCH__ #ifdef __SWITCH__
LUS::Switch::Init(LUS::PreInitPhase); Ship::Switch::Init(Ship::PreInitPhase);
#elif defined(__WIIU__) #elif defined(__WIIU__)
LUS::WiiU::Init(appShortName); Ship::WiiU::Init(appShortName);
#endif #endif
#ifdef _WIN32 #ifdef _WIN32
@ -1059,13 +1082,13 @@ extern "C" void InitOTR() {
} }
#endif #endif
CheckSoHOTRVersion(LUS::Context::GetPathRelativeToAppBundle("soh.otr")); CheckSoHOTRVersion(Ship::Context::GetPathRelativeToAppBundle("soh.otr"));
if (!std::filesystem::exists(LUS::Context::LocateFileAcrossAppDirs("oot-mq.otr", appShortName)) && if (!std::filesystem::exists(Ship::Context::LocateFileAcrossAppDirs("oot-mq.otr", appShortName)) &&
!std::filesystem::exists(LUS::Context::LocateFileAcrossAppDirs("oot.otr", appShortName))){ !std::filesystem::exists(Ship::Context::LocateFileAcrossAppDirs("oot.otr", appShortName))){
#if not defined(__SWITCH__) && not defined(__WIIU__) #if not defined(__SWITCH__) && not defined(__WIIU__)
std::string installPath = LUS::Context::GetAppBundlePath(); std::string installPath = Ship::Context::GetAppBundlePath();
if (!std::filesystem::exists(installPath + "/assets/extractor")) { if (!std::filesystem::exists(installPath + "/assets/extractor")) {
Extractor::ShowErrorBox("Extractor assets not found", Extractor::ShowErrorBox("Extractor assets not found",
"No OTR files found. Missing assets/extractor folder needed to generate OTR file.\n\nExiting..."); "No OTR files found. Missing assets/extractor folder needed to generate OTR file.\n\nExiting...");
@ -1075,26 +1098,26 @@ extern "C" void InitOTR() {
bool generatedOtrIsMQ = false; bool generatedOtrIsMQ = false;
if (Extractor::ShowYesNoBox("No OTR Files", "No OTR files found. Generate one now?") == IDYES) { if (Extractor::ShowYesNoBox("No OTR Files", "No OTR files found. Generate one now?") == IDYES) {
Extractor extract; Extractor extract;
if (!extract.Run(LUS::Context::GetAppDirectoryPath(appShortName))) { if (!extract.Run(Ship::Context::GetAppDirectoryPath(appShortName))) {
Extractor::ShowErrorBox("Error", "An error occured, no OTR file was generated.\n\nExiting..."); Extractor::ShowErrorBox("Error", "An error occured, no OTR file was generated.\n\nExiting...");
exit(1); exit(1);
} }
extract.CallZapd(installPath, LUS::Context::GetAppDirectoryPath(appShortName)); extract.CallZapd(installPath, Ship::Context::GetAppDirectoryPath(appShortName));
generatedOtrIsMQ = extract.IsMasterQuest(); generatedOtrIsMQ = extract.IsMasterQuest();
} else { } else {
exit(1); exit(1);
} }
if (Extractor::ShowYesNoBox("Extraction Complete", "ROM Extracted. Extract another?") == IDYES) { if (Extractor::ShowYesNoBox("Extraction Complete", "ROM Extracted. Extract another?") == IDYES) {
Extractor extract; Extractor extract;
if (!extract.Run(LUS::Context::GetAppDirectoryPath(appShortName), generatedOtrIsMQ ? RomSearchMode::Vanilla : RomSearchMode::MQ)) { if (!extract.Run(Ship::Context::GetAppDirectoryPath(appShortName), generatedOtrIsMQ ? RomSearchMode::Vanilla : RomSearchMode::MQ)) {
Extractor::ShowErrorBox("Error", "An error occured, an OTR file may have been generated by a different step.\n\nContinuing..."); Extractor::ShowErrorBox("Error", "An error occured, an OTR file may have been generated by a different step.\n\nContinuing...");
} else { } else {
extract.CallZapd(installPath, LUS::Context::GetAppDirectoryPath(appShortName)); extract.CallZapd(installPath, Ship::Context::GetAppDirectoryPath(appShortName));
} }
} }
#elif defined(__SWITCH__) #elif defined(__SWITCH__)
LUS::Switch::PrintErrorMessageToScreen("\x1b[2;2HYou've launched the Ship without a game OTR file." Ship::Switch::PrintErrorMessageToScreen("\x1b[2;2HYou've launched the Ship without a game OTR file."
"\x1b[4;2HPlease generate a game OTR and relaunch." "\x1b[4;2HPlease generate a game OTR and relaunch."
"\x1b[6;2HPress the Home button to exit..."); "\x1b[6;2HPress the Home button to exit...");
#elif defined(__WIIU__) #elif defined(__WIIU__)
@ -1141,24 +1164,24 @@ extern "C" void InitOTR() {
InitMods(); InitMods();
ActorDB::AddBuiltInCustomActors(); ActorDB::AddBuiltInCustomActors();
// #region SOH [Randomizer] TODO: Remove these and refactor spoiler file handling for randomizer // #region SOH [Randomizer] TODO: Remove these and refactor spoiler file handling for randomizer
CVarClear("gRandomizerNewFileDropped"); CVarClear(CVAR_GENERAL("RandomizerNewFileDropped"));
CVarClear("gRandomizerDroppedFile"); CVarClear(CVAR_GENERAL("RandomizerDroppedFile"));
// #endregion // #endregion
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnFileDropped>(SoH_ProcessDroppedFiles); GameInteractor::Instance->RegisterGameHook<GameInteractor::OnFileDropped>(SoH_ProcessDroppedFiles);
time_t now = time(NULL); time_t now = time(NULL);
tm *tm_now = localtime(&now); tm *tm_now = localtime(&now);
if (tm_now->tm_mon == 11 && tm_now->tm_mday >= 24 && tm_now->tm_mday <= 25) { if (tm_now->tm_mon == 11 && tm_now->tm_mday >= 24 && tm_now->tm_mday <= 25) {
CVarRegisterInteger("gLetItSnow", 1); CVarRegisterInteger(CVAR_GENERAL("LetItSnow"), 1);
} else { } else {
CVarClear("gLetItSnow"); CVarClear(CVAR_GENERAL("LetItSnow"));
} }
srand(now); srand(now);
#ifdef ENABLE_REMOTE_CONTROL #ifdef ENABLE_REMOTE_CONTROL
SDLNet_Init(); SDLNet_Init();
if (CVarGetInteger("gRemote.Enabled", 0)) { if (CVarGetInteger(CVAR_REMOTE("Enabled"), 0)) {
switch (CVarGetInteger("gRemote.Scheme", GI_SCHEME_SAIL)) { switch (CVarGetInteger(CVAR_REMOTE("Scheme"), GI_SCHEME_SAIL)) {
case GI_SCHEME_SAIL: case GI_SCHEME_SAIL:
GameInteractorSail::Instance->Enable(); GameInteractorSail::Instance->Enable();
break; break;
@ -1169,9 +1192,9 @@ extern "C" void InitOTR() {
} }
#endif #endif
std::shared_ptr<LUS::Config> conf = OTRGlobals::Instance->context->GetConfig(); std::shared_ptr<Ship::Config> conf = OTRGlobals::Instance->context->GetConfig();
conf->RegisterConfigVersionUpdater(std::make_shared<LUS::ConfigVersion1Updater>()); conf->RegisterConfigVersionUpdater(std::make_shared<SOH::ConfigVersion1Updater>());
conf->RegisterConfigVersionUpdater(std::make_shared<LUS::ConfigVersion2Updater>()); conf->RegisterConfigVersionUpdater(std::make_shared<SOH::ConfigVersion2Updater>());
conf->RunVersionUpdates(); conf->RunVersionUpdates();
} }
@ -1183,8 +1206,8 @@ extern "C" void DeinitOTR() {
SaveManager_ThreadPoolWait(); SaveManager_ThreadPoolWait();
OTRAudio_Exit(); OTRAudio_Exit();
#ifdef ENABLE_REMOTE_CONTROL #ifdef ENABLE_REMOTE_CONTROL
if (CVarGetInteger("gRemote.Enabled", 0)) { if (CVarGetInteger(CVAR_REMOTE("Enabled"), 0)) {
switch (CVarGetInteger("gRemote.Scheme", GI_SCHEME_SAIL)) { switch (CVarGetInteger(CVAR_REMOTE("Scheme"), GI_SCHEME_SAIL)) {
case GI_SCHEME_SAIL: case GI_SCHEME_SAIL:
GameInteractorSail::Instance->Disable(); GameInteractorSail::Instance->Disable();
break; break;
@ -1249,14 +1272,14 @@ extern bool ToggleAltAssetsAtEndOfFrame;
extern "C" void Graph_StartFrame() { extern "C" void Graph_StartFrame() {
#ifndef __WIIU__ #ifndef __WIIU__
using LUS::KbScancode; using Ship::KbScancode;
int32_t dwScancode = OTRGlobals::Instance->context->GetWindow()->GetLastScancode(); int32_t dwScancode = OTRGlobals::Instance->context->GetWindow()->GetLastScancode();
OTRGlobals::Instance->context->GetWindow()->SetLastScancode(-1); OTRGlobals::Instance->context->GetWindow()->SetLastScancode(-1);
switch (dwScancode) { switch (dwScancode) {
case KbScancode::LUS_KB_F5: { case KbScancode::LUS_KB_F5: {
if (CVarGetInteger("gSaveStatesEnabled", 0) == 0) { if (CVarGetInteger(CVAR_CHEAT("SaveStatesEnabled"), 0) == 0) {
LUS::Context::GetInstance()->GetWindow()->GetGui()->GetGameOverlay()-> Ship::Context::GetInstance()->GetWindow()->GetGui()->GetGameOverlay()->
TextDrawNotification(6.0f, true, "Save states not enabled. Check Cheats Menu."); TextDrawNotification(6.0f, true, "Save states not enabled. Check Cheats Menu.");
return; return;
} }
@ -1277,8 +1300,8 @@ extern "C" void Graph_StartFrame() {
break; break;
} }
case KbScancode::LUS_KB_F6: { case KbScancode::LUS_KB_F6: {
if (CVarGetInteger("gSaveStatesEnabled", 0) == 0) { if (CVarGetInteger(CVAR_CHEAT("SaveStatesEnabled"), 0) == 0) {
LUS::Context::GetInstance()->GetWindow()->GetGui()->GetGameOverlay()-> Ship::Context::GetInstance()->GetWindow()->GetGui()->GetGameOverlay()->
TextDrawNotification(6.0f, true, "Save states not enabled. Check Cheats Menu."); TextDrawNotification(6.0f, true, "Save states not enabled. Check Cheats Menu.");
return; return;
} }
@ -1292,8 +1315,8 @@ extern "C" void Graph_StartFrame() {
break; break;
} }
case KbScancode::LUS_KB_F7: { case KbScancode::LUS_KB_F7: {
if (CVarGetInteger("gSaveStatesEnabled", 0) == 0) { if (CVarGetInteger(CVAR_CHEAT("SaveStatesEnabled"), 0) == 0) {
LUS::Context::GetInstance()->GetWindow()->GetGui()->GetGameOverlay()-> Ship::Context::GetInstance()->GetWindow()->GetGui()->GetGameOverlay()->
TextDrawNotification(6.0f, true, "Save states not enabled. Check Cheats Menu."); TextDrawNotification(6.0f, true, "Save states not enabled. Check Cheats Menu.");
return; return;
} }
@ -1323,7 +1346,7 @@ extern "C" void Graph_StartFrame() {
#if defined(_WIN32) || defined(__APPLE__) #if defined(_WIN32) || defined(__APPLE__)
case KbScancode::LUS_KB_F9: { case KbScancode::LUS_KB_F9: {
// Toggle TTS // Toggle TTS
CVarSetInteger("gA11yTTS", !CVarGetInteger("gA11yTTS", 0)); CVarSetInteger(CVAR_SETTING("A11yTTS"), !CVarGetInteger(CVAR_SETTING("A11yTTS"), 0));
break; break;
} }
#endif #endif
@ -1334,13 +1357,13 @@ extern "C" void Graph_StartFrame() {
} }
#endif #endif
if (CVarGetInteger("gNewFileDropped", 0)) { if (CVarGetInteger(CVAR_NEW_FILE_DROPPED, 0)) {
std::string filePath = SohUtils::Sanitize(CVarGetString("gDroppedFile", "")); std::string filePath = SohUtils::Sanitize(CVarGetString(CVAR_DROPPED_FILE, ""));
if (!filePath.empty()) { if (!filePath.empty()) {
GameInteractor::Instance->ExecuteHooks<GameInteractor::OnFileDropped>(filePath); GameInteractor::Instance->ExecuteHooks<GameInteractor::OnFileDropped>(filePath);
} }
CVarClear("gNewFileDropped"); CVarClear(CVAR_NEW_FILE_DROPPED);
CVarClear("gDroppedFile"); CVarClear(CVAR_DROPPED_FILE);
} }
OTRGlobals::Instance->context->GetWindow()->StartFrame(); OTRGlobals::Instance->context->GetWindow()->StartFrame();
@ -1393,7 +1416,7 @@ extern "C" void Graph_ProcessGfxCommands(Gfx* commands) {
OTRGlobals::Instance->context->GetWindow()->SetTargetFps(fps); OTRGlobals::Instance->context->GetWindow()->SetTargetFps(fps);
int threshold = CVarGetInteger("gExtraLatencyThreshold", 80); int threshold = CVarGetInteger(CVAR_SETTING("ExtraLatencyThreshold"), 80);
OTRGlobals::Instance->context->GetWindow()->SetMaximumFrameLatency(threshold > 0 && target_fps >= threshold ? 2 : 1); OTRGlobals::Instance->context->GetWindow()->SetMaximumFrameLatency(threshold > 0 && target_fps >= threshold ? 2 : 1);
RunCommands(commands, mtx_replacements); RunCommands(commands, mtx_replacements);
@ -1412,7 +1435,7 @@ extern "C" void Graph_ProcessGfxCommands(Gfx* commands) {
ToggleAltAssetsAtEndOfFrame = false; ToggleAltAssetsAtEndOfFrame = false;
// Actually update the CVar now before runing the alt asset update listeners // Actually update the CVar now before runing the alt asset update listeners
CVarSetInteger("gAltAssets", !CVarGetInteger("gAltAssets", 0)); CVarSetInteger(CVAR_ALT_ASSETS, !CVarGetInteger(CVAR_ALT_ASSETS, 0));
gfx_texture_cache_clear(); gfx_texture_cache_clear();
SOH::SkeletonPatcher::UpdateSkeletons(); SOH::SkeletonPatcher::UpdateSkeletons();
GameInteractor::Instance->ExecuteHooks<GameInteractor::OnAssetAltChange>(); GameInteractor::Instance->ExecuteHooks<GameInteractor::OnAssetAltChange>();
@ -1435,15 +1458,15 @@ extern "C" uint16_t OTRGetPixelDepth(float x, float y) {
} }
extern "C" uint32_t ResourceMgr_GetNumGameVersions() { extern "C" uint32_t ResourceMgr_GetNumGameVersions() {
return LUS::Context::GetInstance()->GetResourceManager()->GetArchiveManager()->GetGameVersions().size(); return Ship::Context::GetInstance()->GetResourceManager()->GetArchiveManager()->GetGameVersions().size();
} }
extern "C" uint32_t ResourceMgr_GetGameVersion(int index) { extern "C" uint32_t ResourceMgr_GetGameVersion(int index) {
return LUS::Context::GetInstance()->GetResourceManager()->GetArchiveManager()->GetGameVersions()[index]; return Ship::Context::GetInstance()->GetResourceManager()->GetArchiveManager()->GetGameVersions()[index];
} }
extern "C" uint32_t ResourceMgr_GetGamePlatform(int index) { extern "C" uint32_t ResourceMgr_GetGamePlatform(int index) {
uint32_t version = LUS::Context::GetInstance()->GetResourceManager()->GetArchiveManager()->GetGameVersions()[index]; uint32_t version = Ship::Context::GetInstance()->GetResourceManager()->GetArchiveManager()->GetGameVersions()[index];
switch (version) { switch (version) {
case OOT_NTSC_US_10: case OOT_NTSC_US_10:
@ -1466,7 +1489,7 @@ extern "C" uint32_t ResourceMgr_GetGamePlatform(int index) {
} }
extern "C" uint32_t ResourceMgr_GetGameRegion(int index) { extern "C" uint32_t ResourceMgr_GetGameRegion(int index) {
uint32_t version = LUS::Context::GetInstance()->GetResourceManager()->GetArchiveManager()->GetGameVersions()[index]; uint32_t version = Ship::Context::GetInstance()->GetResourceManager()->GetArchiveManager()->GetGameVersions()[index];
switch (version) { switch (version) {
case OOT_NTSC_US_10: case OOT_NTSC_US_10:
@ -1490,7 +1513,7 @@ extern "C" uint32_t ResourceMgr_GetGameRegion(int index) {
uint32_t IsSceneMasterQuest(s16 sceneNum) { uint32_t IsSceneMasterQuest(s16 sceneNum) {
uint32_t value = 0; uint32_t value = 0;
uint8_t mqMode = CVarGetInteger("gBetterDebugWarpScreenMQMode", WARP_MODE_OVERRIDE_OFF); uint8_t mqMode = CVarGetInteger(CVAR_GENERAL("BetterDebugWarpScreenMQMode"), WARP_MODE_OVERRIDE_OFF);
if (mqMode == WARP_MODE_OVERRIDE_MQ_AS_VANILLA) { if (mqMode == WARP_MODE_OVERRIDE_MQ_AS_VANILLA) {
return 1; return 1;
} else if (mqMode == WARP_MODE_OVERRIDE_VANILLA_AS_MQ) { } else if (mqMode == WARP_MODE_OVERRIDE_VANILLA_AS_MQ) {
@ -1536,10 +1559,10 @@ extern "C" uint32_t ResourceMgr_IsGameMasterQuest() {
} }
extern "C" void ResourceMgr_LoadDirectory(const char* resName) { extern "C" void ResourceMgr_LoadDirectory(const char* resName) {
LUS::Context::GetInstance()->GetResourceManager()->LoadDirectory(resName); Ship::Context::GetInstance()->GetResourceManager()->LoadDirectory(resName);
} }
extern "C" void ResourceMgr_DirtyDirectory(const char* resName) { extern "C" void ResourceMgr_DirtyDirectory(const char* resName) {
LUS::Context::GetInstance()->GetResourceManager()->DirtyDirectory(resName); Ship::Context::GetInstance()->GetResourceManager()->DirtyDirectory(resName);
} }
extern "C" void ResourceMgr_UnloadResource(const char* resName) { extern "C" void ResourceMgr_UnloadResource(const char* resName) {
@ -1547,13 +1570,13 @@ extern "C" void ResourceMgr_UnloadResource(const char* resName) {
if (path.substr(0, 7) == "__OTR__") { if (path.substr(0, 7) == "__OTR__") {
path = path.substr(7); path = path.substr(7);
} }
auto res = LUS::Context::GetInstance()->GetResourceManager()->UnloadResource(path); auto res = Ship::Context::GetInstance()->GetResourceManager()->UnloadResource(path);
} }
// OTRTODO: There is probably a more elegant way to go about this... // OTRTODO: There is probably a more elegant way to go about this...
// Kenix: This is definitely leaking memory when it's called. // Kenix: This is definitely leaking memory when it's called.
extern "C" char** ResourceMgr_ListFiles(const char* searchMask, int* resultSize) { extern "C" char** ResourceMgr_ListFiles(const char* searchMask, int* resultSize) {
auto lst = LUS::Context::GetInstance()->GetResourceManager()->GetArchiveManager()->ListFiles(searchMask); auto lst = Ship::Context::GetInstance()->GetResourceManager()->GetArchiveManager()->ListFiles(searchMask);
char** result = (char**)malloc(lst->size() * sizeof(char*)); char** result = (char**)malloc(lst->size() * sizeof(char*));
for (size_t i = 0; i < lst->size(); i++) { for (size_t i = 0; i < lst->size(); i++) {
@ -1592,12 +1615,12 @@ extern "C" uint8_t ResourceMgr_FileAltExists(const char* filePath) {
// Unloads a resource if an alternate version exists when alt assets are enabled // Unloads a resource if an alternate version exists when alt assets are enabled
// The resource is only removed from the internal cache to prevent it from used in the next resource lookup // The resource is only removed from the internal cache to prevent it from used in the next resource lookup
extern "C" void ResourceMgr_UnloadOriginalWhenAltExists(const char* resName) { extern "C" void ResourceMgr_UnloadOriginalWhenAltExists(const char* resName) {
if (CVarGetInteger("gAltAssets", 0) && ResourceMgr_FileAltExists((char*) resName)) { if (CVarGetInteger(CVAR_ALT_ASSETS, 0) && ResourceMgr_FileAltExists((char*) resName)) {
ResourceMgr_UnloadResource((char*) resName); ResourceMgr_UnloadResource((char*) resName);
} }
} }
std::shared_ptr<LUS::IResource> GetResourceByNameHandlingMQ(const char* path) { std::shared_ptr<Ship::IResource> GetResourceByNameHandlingMQ(const char* path) {
std::string Path = path; std::string Path = path;
if (ResourceMgr_IsGameMasterQuest()) { if (ResourceMgr_IsGameMasterQuest()) {
size_t pos = 0; size_t pos = 0;
@ -1605,7 +1628,7 @@ std::shared_ptr<LUS::IResource> GetResourceByNameHandlingMQ(const char* path) {
Path.replace(pos, 7, "/mq/"); Path.replace(pos, 7, "/mq/");
} }
} }
return LUS::Context::GetInstance()->GetResourceManager()->LoadResource(Path.c_str()); return Ship::Context::GetInstance()->GetResourceManager()->LoadResource(Path.c_str());
} }
extern "C" char* GetResourceDataByNameHandlingMQ(const char* path) { extern "C" char* GetResourceDataByNameHandlingMQ(const char* path) {
@ -1738,7 +1761,7 @@ std::unordered_map<std::string, std::unordered_map<std::string, GfxPatch>> origi
// instead (When that is available). Index can be found using the commented out section below. // instead (When that is available). Index can be found using the commented out section below.
extern "C" void ResourceMgr_PatchGfxByName(const char* path, const char* patchName, int index, Gfx instruction) { extern "C" void ResourceMgr_PatchGfxByName(const char* path, const char* patchName, int index, Gfx instruction) {
auto res = std::static_pointer_cast<LUS::DisplayList>( auto res = std::static_pointer_cast<LUS::DisplayList>(
LUS::Context::GetInstance()->GetResourceManager()->LoadResource(path)); Ship::Context::GetInstance()->GetResourceManager()->LoadResource(path));
// Leaving this here for people attempting to find the correct Dlist index to patch // Leaving this here for people attempting to find the correct Dlist index to patch
/*if (strcmp("__OTR__objects/object_gi_longsword/gGiBiggoronSwordDL", path) == 0) { /*if (strcmp("__OTR__objects/object_gi_longsword/gGiBiggoronSwordDL", path) == 0) {
@ -1777,7 +1800,7 @@ extern "C" void ResourceMgr_PatchGfxByName(const char* path, const char* patchNa
extern "C" void ResourceMgr_PatchGfxCopyCommandByName(const char* path, const char* patchName, int destinationIndex, int sourceIndex) { extern "C" void ResourceMgr_PatchGfxCopyCommandByName(const char* path, const char* patchName, int destinationIndex, int sourceIndex) {
auto res = std::static_pointer_cast<LUS::DisplayList>( auto res = std::static_pointer_cast<LUS::DisplayList>(
LUS::Context::GetInstance()->GetResourceManager()->LoadResource(path)); Ship::Context::GetInstance()->GetResourceManager()->LoadResource(path));
// Do not patch custom assets as they most likely do not have the same instructions as authentic assets // Do not patch custom assets as they most likely do not have the same instructions as authentic assets
if (res->GetInitData()->IsCustom) { if (res->GetInitData()->IsCustom) {
@ -1800,7 +1823,7 @@ extern "C" void ResourceMgr_PatchGfxCopyCommandByName(const char* path, const ch
extern "C" void ResourceMgr_UnpatchGfxByName(const char* path, const char* patchName) { extern "C" void ResourceMgr_UnpatchGfxByName(const char* path, const char* patchName) {
if (originalGfx.contains(path) && originalGfx[path].contains(patchName)) { if (originalGfx.contains(path) && originalGfx[path].contains(patchName)) {
auto res = std::static_pointer_cast<LUS::DisplayList>( auto res = std::static_pointer_cast<LUS::DisplayList>(
LUS::Context::GetInstance()->GetResourceManager()->LoadResource(path)); Ship::Context::GetInstance()->GetResourceManager()->LoadResource(path));
Gfx* gfx = (Gfx*)&res->Instructions[originalGfx[path][patchName].index]; Gfx* gfx = (Gfx*)&res->Instructions[originalGfx[path][patchName].index];
*gfx = originalGfx[path][patchName].instruction; *gfx = originalGfx[path][patchName].instruction;
@ -1860,7 +1883,7 @@ extern "C" SoundFontSample* ReadCustomSample(const char* path) {
ExtensionEntry entry = ExtensionCache[path]; ExtensionEntry entry = ExtensionCache[path];
auto sampleRaw = LUS::Context::GetInstance()->GetResourceManager()->LoadFile(entry.path); auto sampleRaw = Ship::Context::GetInstance()->GetResourceManager()->LoadFile(entry.path);
uint32_t* strem = (uint32_t*)sampleRaw->Buffer.get(); uint32_t* strem = (uint32_t*)sampleRaw->Buffer.get();
uint8_t* strem2 = (uint8_t*)strem; uint8_t* strem2 = (uint8_t*)strem;
@ -1948,10 +1971,10 @@ extern "C" SkeletonHeader* ResourceMgr_LoadSkeletonByName(const char* path, Skel
pathStr = pathStr.substr(sOtr.length()); pathStr = pathStr.substr(sOtr.length());
} }
bool isAlt = CVarGetInteger("gAltAssets", 0); bool isAlt = CVarGetInteger(CVAR_ALT_ASSETS, 0);
if (isAlt) { if (isAlt) {
pathStr = LUS::IResource::gAltAssetPrefix + pathStr; pathStr = Ship::IResource::gAltAssetPrefix + pathStr;
} }
SkeletonHeader* skelHeader = (SkeletonHeader*) ResourceGetDataByName(pathStr.c_str()); SkeletonHeader* skelHeader = (SkeletonHeader*) ResourceGetDataByName(pathStr.c_str());
@ -1985,8 +2008,8 @@ extern "C" s32* ResourceMgr_LoadCSByName(const char* path) {
return (s32*)GetResourceDataByNameHandlingMQ(path); return (s32*)GetResourceDataByNameHandlingMQ(path);
} }
std::filesystem::path GetSaveFile(std::shared_ptr<LUS::Config> Conf) { std::filesystem::path GetSaveFile(std::shared_ptr<Ship::Config> Conf) {
const std::string fileName = Conf->GetString("Game.SaveName", LUS::Context::GetPathRelativeToAppDirectory("oot_save.sav")); const std::string fileName = Conf->GetString("Game.SaveName", Ship::Context::GetPathRelativeToAppDirectory("oot_save.sav"));
std::filesystem::path saveFile = std::filesystem::absolute(fileName); std::filesystem::path saveFile = std::filesystem::absolute(fileName);
if (!exists(saveFile.parent_path())) { if (!exists(saveFile.parent_path())) {
@ -1997,13 +2020,13 @@ std::filesystem::path GetSaveFile(std::shared_ptr<LUS::Config> Conf) {
} }
std::filesystem::path GetSaveFile() { std::filesystem::path GetSaveFile() {
const std::shared_ptr<LUS::Config> pConf = OTRGlobals::Instance->context->GetConfig(); const std::shared_ptr<Ship::Config> pConf = OTRGlobals::Instance->context->GetConfig();
return GetSaveFile(pConf); return GetSaveFile(pConf);
} }
void OTRGlobals::CheckSaveFile(size_t sramSize) const { void OTRGlobals::CheckSaveFile(size_t sramSize) const {
const std::shared_ptr<LUS::Config> pConf = Instance->context->GetConfig(); const std::shared_ptr<Ship::Config> pConf = Instance->context->GetConfig();
std::filesystem::path savePath = GetSaveFile(pConf); std::filesystem::path savePath = GetSaveFile(pConf);
std::fstream saveFile(savePath, std::fstream::in | std::fstream::out | std::fstream::binary); std::fstream saveFile(savePath, std::fstream::in | std::fstream::out | std::fstream::binary);
@ -2125,26 +2148,26 @@ extern "C" uint32_t OTRGetCurrentHeight() {
} }
Color_RGB8 GetColorForControllerLED() { Color_RGB8 GetColorForControllerLED() {
auto brightness = CVarGetFloat("gLedBrightness", 1.0f) / 1.0f; auto brightness = CVarGetFloat(CVAR_SETTING("LEDBrightness"), 1.0f) / 1.0f;
Color_RGB8 color = { 0, 0, 0 }; Color_RGB8 color = { 0, 0, 0 };
if (brightness > 0.0f) { if (brightness > 0.0f) {
LEDColorSource source = static_cast<LEDColorSource>(CVarGetInteger("gLedColorSource", LED_SOURCE_TUNIC_ORIGINAL)); LEDColorSource source = static_cast<LEDColorSource>(CVarGetInteger(CVAR_SETTING("LEDColorSource"), LED_SOURCE_TUNIC_ORIGINAL));
bool criticalOverride = CVarGetInteger("gLedCriticalOverride", 1); bool criticalOverride = CVarGetInteger(CVAR_SETTING("LEDCriticalOverride"), 1);
if (gPlayState && (source == LED_SOURCE_TUNIC_ORIGINAL || source == LED_SOURCE_TUNIC_COSMETICS)) { if (gPlayState && (source == LED_SOURCE_TUNIC_ORIGINAL || source == LED_SOURCE_TUNIC_COSMETICS)) {
switch (CUR_EQUIP_VALUE(EQUIP_TYPE_TUNIC)) { switch (CUR_EQUIP_VALUE(EQUIP_TYPE_TUNIC)) {
case EQUIP_VALUE_TUNIC_KOKIRI: case EQUIP_VALUE_TUNIC_KOKIRI:
color = source == LED_SOURCE_TUNIC_COSMETICS color = source == LED_SOURCE_TUNIC_COSMETICS
? CVarGetColor24("gCosmetics.Link_KokiriTunic.Value", kokiriColor) ? CVarGetColor24(CVAR_COSMETIC("Link.KokiriTunic.Value"), kokiriColor)
: kokiriColor; : kokiriColor;
break; break;
case EQUIP_VALUE_TUNIC_GORON: case EQUIP_VALUE_TUNIC_GORON:
color = source == LED_SOURCE_TUNIC_COSMETICS color = source == LED_SOURCE_TUNIC_COSMETICS
? CVarGetColor24("gCosmetics.Link_GoronTunic.Value", goronColor) ? CVarGetColor24(CVAR_COSMETIC("Link.GoronTunic.Value"), goronColor)
: goronColor; : goronColor;
break; break;
case EQUIP_VALUE_TUNIC_ZORA: case EQUIP_VALUE_TUNIC_ZORA:
color = source == LED_SOURCE_TUNIC_COSMETICS color = source == LED_SOURCE_TUNIC_COSMETICS
? CVarGetColor24("gCosmetics.Link_ZoraTunic.Value", zoraColor) ? CVarGetColor24(CVAR_COSMETIC("Link.ZoraTunic.Value"), zoraColor)
: zoraColor; : zoraColor;
break; break;
} }
@ -2156,16 +2179,16 @@ Color_RGB8 GetColorForControllerLED() {
switch (category) { switch (category) {
case ACTORCAT_PLAYER: case ACTORCAT_PLAYER:
if (source == LED_SOURCE_NAVI_COSMETICS && if (source == LED_SOURCE_NAVI_COSMETICS &&
CVarGetInteger("gCosmetics.Navi_IdlePrimary.Changed", 0)) { CVarGetInteger(CVAR_COSMETIC("Navi.IdlePrimary.Changed"), 0)) {
color = CVarGetColor24("gCosmetics.Navi_IdlePrimary.Value", defaultIdleColor.inner); color = CVarGetColor24(CVAR_COSMETIC("Navi.IdlePrimary.Value"), defaultIdleColor.inner);
break; break;
} }
color = LEDColorDefaultNaviColorList[category].inner; color = LEDColorDefaultNaviColorList[category].inner;
break; break;
case ACTORCAT_NPC: case ACTORCAT_NPC:
if (source == LED_SOURCE_NAVI_COSMETICS && if (source == LED_SOURCE_NAVI_COSMETICS &&
CVarGetInteger("gCosmetics.Navi_NPCPrimary.Changed", 0)) { CVarGetInteger(CVAR_COSMETIC("Navi.NPCPrimary.Changed"), 0)) {
color = CVarGetColor24("gCosmetics.Navi_NPCPrimary.Value", defaultNPCColor.inner); color = CVarGetColor24(CVAR_COSMETIC("Navi.NPCPrimary.Value"), defaultNPCColor.inner);
break; break;
} }
color = LEDColorDefaultNaviColorList[category].inner; color = LEDColorDefaultNaviColorList[category].inner;
@ -2173,30 +2196,30 @@ Color_RGB8 GetColorForControllerLED() {
case ACTORCAT_ENEMY: case ACTORCAT_ENEMY:
case ACTORCAT_BOSS: case ACTORCAT_BOSS:
if (source == LED_SOURCE_NAVI_COSMETICS && if (source == LED_SOURCE_NAVI_COSMETICS &&
CVarGetInteger("gCosmetics.Navi_EnemyPrimary.Changed", 0)) { CVarGetInteger(CVAR_COSMETIC("Navi.EnemyPrimary.Changed"), 0)) {
color = CVarGetColor24("gCosmetics.Navi_EnemyPrimary.Value", defaultEnemyColor.inner); color = CVarGetColor24(CVAR_COSMETIC("Navi.EnemyPrimary.Value"), defaultEnemyColor.inner);
break; break;
} }
color = LEDColorDefaultNaviColorList[category].inner; color = LEDColorDefaultNaviColorList[category].inner;
break; break;
default: default:
if (source == LED_SOURCE_NAVI_COSMETICS && if (source == LED_SOURCE_NAVI_COSMETICS &&
CVarGetInteger("gCosmetics.Navi_PropsPrimary.Changed", 0)) { CVarGetInteger(CVAR_COSMETIC("Navi.PropsPrimary.Changed"), 0)) {
color = CVarGetColor24("gCosmetics.Navi_PropsPrimary.Value", defaultPropsColor.inner); color = CVarGetColor24(CVAR_COSMETIC("Navi.PropsPrimary.Value"), defaultPropsColor.inner);
break; break;
} }
color = LEDColorDefaultNaviColorList[category].inner; color = LEDColorDefaultNaviColorList[category].inner;
} }
} else { // No target actor. } else { // No target actor.
if (source == LED_SOURCE_NAVI_COSMETICS && CVarGetInteger("gCosmetics.Navi_IdlePrimary.Changed", 0)) { if (source == LED_SOURCE_NAVI_COSMETICS && CVarGetInteger(CVAR_COSMETIC("Navi.IdlePrimary.Changed"), 0)) {
color = CVarGetColor24("gCosmetics.Navi_IdlePrimary.Value", defaultIdleColor.inner); color = CVarGetColor24(CVAR_COSMETIC("Navi.IdlePrimary.Value"), defaultIdleColor.inner);
} else { } else {
color = LEDColorDefaultNaviColorList[ACTORCAT_PLAYER].inner; color = LEDColorDefaultNaviColorList[ACTORCAT_PLAYER].inner;
} }
} }
} }
if (source == LED_SOURCE_CUSTOM) { if (source == LED_SOURCE_CUSTOM) {
color = CVarGetColor24("gLedPort1Color", { 255, 255, 255 }); color = CVarGetColor24(CVAR_SETTING("LEDPort1Color"), { 255, 255, 255 });
} }
if (gPlayState && (criticalOverride || source == LED_SOURCE_HEALTH)) { if (gPlayState && (criticalOverride || source == LED_SOURCE_HEALTH)) {
if (HealthMeter_IsCritical()) { if (HealthMeter_IsCritical()) {
@ -2220,19 +2243,19 @@ Color_RGB8 GetColorForControllerLED() {
extern "C" void OTRControllerCallback(uint8_t rumble) { extern "C" void OTRControllerCallback(uint8_t rumble) {
// We call this every tick, SDL accounts for this use and prevents driver spam // We call this every tick, SDL accounts for this use and prevents driver spam
// https://github.com/libsdl-org/SDL/blob/f17058b562c8a1090c0c996b42982721ace90903/src/joystick/SDL_joystick.c#L1114-L1144 // https://github.com/libsdl-org/SDL/blob/f17058b562c8a1090c0c996b42982721ace90903/src/joystick/SDL_joystick.c#L1114-L1144
LUS::Context::GetInstance()->GetControlDeck()->GetControllerByPort(0)->GetLED()->SetLEDColor(GetColorForControllerLED()); Ship::Context::GetInstance()->GetControlDeck()->GetControllerByPort(0)->GetLED()->SetLEDColor(GetColorForControllerLED());
static std::shared_ptr<SohInputEditorWindow> controllerConfigWindow = nullptr; static std::shared_ptr<SohInputEditorWindow> controllerConfigWindow = nullptr;
if (controllerConfigWindow == nullptr) { if (controllerConfigWindow == nullptr) {
controllerConfigWindow = std::dynamic_pointer_cast<SohInputEditorWindow>(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetGuiWindow("Input Editor")); controllerConfigWindow = std::dynamic_pointer_cast<SohInputEditorWindow>(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetGuiWindow("Input Editor"));
} else if (controllerConfigWindow->TestingRumble()) { } else if (controllerConfigWindow->TestingRumble()) {
return; return;
} }
if (rumble) { if (rumble) {
LUS::Context::GetInstance()->GetControlDeck()->GetControllerByPort(0)->GetRumble()->StartRumble(); Ship::Context::GetInstance()->GetControlDeck()->GetControllerByPort(0)->GetRumble()->StartRumble();
} else { } else {
LUS::Context::GetInstance()->GetControlDeck()->GetControllerByPort(0)->GetRumble()->StopRumble(); Ship::Context::GetInstance()->GetControlDeck()->GetControllerByPort(0)->GetRumble()->StopRumble();
} }
} }
@ -2272,7 +2295,7 @@ extern "C" void AudioPlayer_Play(const uint8_t* buf, uint32_t len) {
} }
extern "C" int Controller_ShouldRumble(size_t slot) { extern "C" int Controller_ShouldRumble(size_t slot) {
for (auto [id, mapping] : LUS::Context::GetInstance() for (auto [id, mapping] : Ship::Context::GetInstance()
->GetControlDeck() ->GetControlDeck()
->GetControllerByPort(static_cast<uint8_t>(slot)) ->GetControllerByPort(static_cast<uint8_t>(slot))
->GetRumble() ->GetRumble()
@ -2479,7 +2502,7 @@ extern "C" int CustomMessage_RetrieveIfExists(PlayState* play) {
if (player->getItemEntry.getItemId == RG_ICE_TRAP) { if (player->getItemEntry.getItemId == RG_ICE_TRAP) {
u16 iceTrapTextId = Random(0, NUM_ICE_TRAP_MESSAGES); u16 iceTrapTextId = Random(0, NUM_ICE_TRAP_MESSAGES);
messageEntry = CustomMessageManager::Instance->RetrieveMessage(Randomizer::IceTrapRandoMessageTableID, iceTrapTextId); messageEntry = CustomMessageManager::Instance->RetrieveMessage(Randomizer::IceTrapRandoMessageTableID, iceTrapTextId);
if (CVarGetInteger("gLetItSnow", 0)) { if (CVarGetInteger(CVAR_GENERAL("LetItSnow"), 0)) {
messageEntry = CustomMessageManager::Instance->RetrieveMessage(Randomizer::IceTrapRandoMessageTableID, NUM_ICE_TRAP_MESSAGES + 1); messageEntry = CustomMessageManager::Instance->RetrieveMessage(Randomizer::IceTrapRandoMessageTableID, NUM_ICE_TRAP_MESSAGES + 1);
} }
} else if (player->getItemEntry.getItemId == RG_TRIFORCE_PIECE) { } else if (player->getItemEntry.getItemId == RG_TRIFORCE_PIECE) {
@ -2579,12 +2602,12 @@ extern "C" int CustomMessage_RetrieveIfExists(PlayState* play) {
RandomizerInf randoInf = (RandomizerInf)((textId - (TEXT_SHOP_ITEM_RANDOM + NUM_SHOP_ITEMS)) + RAND_INF_SHOP_ITEMS_KF_SHOP_ITEM_1); RandomizerInf randoInf = (RandomizerInf)((textId - (TEXT_SHOP_ITEM_RANDOM + NUM_SHOP_ITEMS)) + RAND_INF_SHOP_ITEMS_KF_SHOP_ITEM_1);
messageEntry = OTRGlobals::Instance->gRandomizer->GetMerchantMessage(randoInf, TEXT_SHOP_ITEM_RANDOM_CONFIRM); messageEntry = OTRGlobals::Instance->gRandomizer->GetMerchantMessage(randoInf, TEXT_SHOP_ITEM_RANDOM_CONFIRM);
} }
} else if (CVarGetInteger("gRandomizeRupeeNames", 1) && } else if (CVarGetInteger(CVAR_RANDOMIZER_ENHANCEMENT("RandomizeRupeeNames"), 1) &&
(textId == TEXT_BLUE_RUPEE || textId == TEXT_RED_RUPEE || textId == TEXT_PURPLE_RUPEE || (textId == TEXT_BLUE_RUPEE || textId == TEXT_RED_RUPEE || textId == TEXT_PURPLE_RUPEE ||
textId == TEXT_HUGE_RUPEE)) { textId == TEXT_HUGE_RUPEE)) {
messageEntry = Randomizer::GetRupeeMessage(textId); messageEntry = Randomizer::GetRupeeMessage(textId);
// In rando, replace Navi's general overworld hints with rando-related gameplay tips // In rando, replace Navi's general overworld hints with rando-related gameplay tips
} else if (CVarGetInteger("gRandoRelevantNavi", 1) && textId >= TEXT_NAVI_DEKU_TREE_SUMMONS && textId <= TEXT_NAVI_TRY_TO_KEEP_MOVING) { } else if (CVarGetInteger(CVAR_RANDOMIZER_ENHANCEMENT("RandoRelevantNavi"), 1) && textId >= TEXT_NAVI_DEKU_TREE_SUMMONS && textId <= TEXT_NAVI_TRY_TO_KEEP_MOVING) {
u16 naviTextId = Random(0, NUM_NAVI_MESSAGES); u16 naviTextId = Random(0, NUM_NAVI_MESSAGES);
messageEntry = CustomMessageManager::Instance->RetrieveMessage(Randomizer::NaviRandoMessageTableID, naviTextId); messageEntry = CustomMessageManager::Instance->RetrieveMessage(Randomizer::NaviRandoMessageTableID, naviTextId);
} }
@ -2715,7 +2738,7 @@ extern "C" int CustomMessage_RetrieveIfExists(PlayState* play) {
} }
} }
if (textId == TEXT_GS_NO_FREEZE || textId == TEXT_GS_FREEZE) { if (textId == TEXT_GS_NO_FREEZE || textId == TEXT_GS_FREEZE) {
if (CVarGetInteger("gInjectItemCounts", 0) != 0) { if (CVarGetInteger(CVAR_ENHANCEMENT("InjectItemCounts"), 0) != 0) {
// The freeze text cannot be manually dismissed and must be auto-dismissed. // The freeze text cannot be manually dismissed and must be auto-dismissed.
// This is fine and even wanted when skull tokens are not shuffled, but when // This is fine and even wanted when skull tokens are not shuffled, but when
// when they are shuffled we don't want to be able to manually dismiss the box. // when they are shuffled we don't want to be able to manually dismiss the box.
@ -2723,7 +2746,7 @@ extern "C" int CustomMessage_RetrieveIfExists(PlayState* play) {
// animation until the text box auto-dismisses. // animation until the text box auto-dismisses.
// RANDOTODO: Implement a way to determine if an item came from a skulltula and // RANDOTODO: Implement a way to determine if an item came from a skulltula and
// inject the auto-dismiss control code if it did. // inject the auto-dismiss control code if it did.
if (CVarGetInteger("gSkulltulaFreeze", 0) != 0 && if (CVarGetInteger(CVAR_ENHANCEMENT("SkulltulaFreeze"), 0) != 0 &&
!(IS_RANDO && Randomizer_GetSettingValue(RSK_SHUFFLE_TOKENS) != RO_TOKENSANITY_OFF)) { !(IS_RANDO && Randomizer_GetSettingValue(RSK_SHUFFLE_TOKENS) != RO_TOKENSANITY_OFF)) {
textId = TEXT_GS_NO_FREEZE; textId = TEXT_GS_NO_FREEZE;
} else { } else {
@ -2736,18 +2759,18 @@ extern "C" int CustomMessage_RetrieveIfExists(PlayState* play) {
messageEntry.Replace("[[gsCount]]", std::to_string(gsCount)); messageEntry.Replace("[[gsCount]]", std::to_string(gsCount));
} }
} }
if (textId == TEXT_HEART_CONTAINER && CVarGetInteger("gInjectItemCounts", 0)) { if (textId == TEXT_HEART_CONTAINER && CVarGetInteger(CVAR_ENHANCEMENT("InjectItemCounts"), 0)) {
messageEntry = CustomMessageManager::Instance->RetrieveMessage(customMessageTableID, TEXT_HEART_CONTAINER); messageEntry = CustomMessageManager::Instance->RetrieveMessage(customMessageTableID, TEXT_HEART_CONTAINER);
messageEntry.Replace("[[heartContainerCount]]", std::to_string(gSaveContext.sohStats.heartContainers + 1)); messageEntry.Replace("[[heartContainerCount]]", std::to_string(gSaveContext.sohStats.heartContainers + 1));
} }
if (textId == TEXT_HEART_PIECE && CVarGetInteger("gInjectItemCounts", 0)) { if (textId == TEXT_HEART_PIECE && CVarGetInteger(CVAR_ENHANCEMENT("InjectItemCounts"), 0)) {
messageEntry = CustomMessageManager::Instance->RetrieveMessage(customMessageTableID, TEXT_HEART_PIECE); messageEntry = CustomMessageManager::Instance->RetrieveMessage(customMessageTableID, TEXT_HEART_PIECE);
messageEntry.Replace("[[heartPieceCount]]", std::to_string(gSaveContext.sohStats.heartPieces + 1)); messageEntry.Replace("[[heartPieceCount]]", std::to_string(gSaveContext.sohStats.heartPieces + 1));
} }
if (textId == TEXT_MARKET_GUARD_NIGHT && CVarGetInteger("gMarketSneak", 0) && play->sceneNum == SCENE_MARKET_ENTRANCE_NIGHT) { if (textId == TEXT_MARKET_GUARD_NIGHT && CVarGetInteger(CVAR_ENHANCEMENT("MarketSneak"), 0) && play->sceneNum == SCENE_MARKET_ENTRANCE_NIGHT) {
messageEntry = CustomMessageManager::Instance->RetrieveMessage(customMessageTableID, TEXT_MARKET_GUARD_NIGHT); messageEntry = CustomMessageManager::Instance->RetrieveMessage(customMessageTableID, TEXT_MARKET_GUARD_NIGHT);
} }
if (textId == TEXT_FISHERMAN_LEAVE && CVarGetInteger("gQuitFishingAtDoor", 0)) { if (textId == TEXT_FISHERMAN_LEAVE && CVarGetInteger(CVAR_ENHANCEMENT("QuitFishingAtDoor"), 0)) {
messageEntry = CustomMessageManager::Instance->RetrieveMessage(customMessageTableID, TEXT_FISHERMAN_LEAVE); messageEntry = CustomMessageManager::Instance->RetrieveMessage(customMessageTableID, TEXT_FISHERMAN_LEAVE);
} }
font->charTexBuf[0] = (messageEntry.GetTextBoxType() << 4) | messageEntry.GetTextBoxPosition(); font->charTexBuf[0] = (messageEntry.GetTextBoxType() << 4) | messageEntry.GetTextBoxPosition();
@ -2767,12 +2790,12 @@ extern "C" int CustomMessage_RetrieveIfExists(PlayState* play) {
} }
extern "C" void Overlay_DisplayText(float duration, const char* text) { extern "C" void Overlay_DisplayText(float duration, const char* text) {
LUS::Context::GetInstance()->GetWindow()->GetGui()->GetGameOverlay()->TextDrawNotification(duration, true, text); Ship::Context::GetInstance()->GetWindow()->GetGui()->GetGameOverlay()->TextDrawNotification(duration, true, text);
} }
extern "C" void Overlay_DisplayText_Seconds(int seconds, const char* text) { extern "C" void Overlay_DisplayText_Seconds(int seconds, const char* text) {
float duration = seconds * OTRGlobals::Instance->GetInterpolationFPS() * 0.05; float duration = seconds * OTRGlobals::Instance->GetInterpolationFPS() * 0.05;
LUS::Context::GetInstance()->GetWindow()->GetGui()->GetGameOverlay()->TextDrawNotification(duration, true, text); Ship::Context::GetInstance()->GetWindow()->GetGui()->GetGameOverlay()->TextDrawNotification(duration, true, text);
} }
extern "C" void Entrance_ClearEntranceTrackingData(void) { extern "C" void Entrance_ClearEntranceTrackingData(void) {
@ -2825,8 +2848,8 @@ void SoH_ProcessDroppedFiles(std::string filePath) {
// #region SOH [Randomizer] TODO: Refactor spoiler file handling for randomizer // #region SOH [Randomizer] TODO: Refactor spoiler file handling for randomizer
if (configJson.contains("version") && configJson.contains("finalSeed")) { if (configJson.contains("version") && configJson.contains("finalSeed")) {
CVarSetString("gRandomizerDroppedFile", filePath.c_str()); CVarSetString(CVAR_GENERAL("RandomizerDroppedFile"), filePath.c_str());
CVarSetInteger("gRandomizerNewFileDropped", 1); CVarSetInteger(CVAR_GENERAL("RandomizerNewFileDropped"), 1);
return; return;
} }
// #endregion // #endregion
@ -2858,14 +2881,14 @@ void SoH_ProcessDroppedFiles(std::string filePath) {
} }
} }
auto gui = LUS::Context::GetInstance()->GetWindow()->GetGui(); auto gui = Ship::Context::GetInstance()->GetWindow()->GetGui();
gui->GetGuiWindow("Console")->Hide(); gui->GetGuiWindow("Console")->Hide();
gui->GetGuiWindow("Actor Viewer")->Hide(); gui->GetGuiWindow("Actor Viewer")->Hide();
gui->GetGuiWindow("Collision Viewer")->Hide(); gui->GetGuiWindow("Collision Viewer")->Hide();
gui->GetGuiWindow("Save Editor")->Hide(); gui->GetGuiWindow("Save Editor")->Hide();
gui->GetGuiWindow("Display List Viewer")->Hide(); gui->GetGuiWindow("Display List Viewer")->Hide();
gui->GetGuiWindow("Stats")->Hide(); gui->GetGuiWindow("Stats")->Hide();
std::dynamic_pointer_cast<LUS::ConsoleWindow>(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetGuiWindow("Console"))->ClearBindings(); std::dynamic_pointer_cast<Ship::ConsoleWindow>(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetGuiWindow("Console"))->ClearBindings();
gui->SaveConsoleVariablesOnNextTick(); gui->SaveConsoleVariablesOnNextTick();
@ -2873,12 +2896,12 @@ void SoH_ProcessDroppedFiles(std::string filePath) {
gui->GetGameOverlay()->TextDrawNotification(30.0f, true, "Configuration Loaded. Hash: %d", finalHash); gui->GetGameOverlay()->TextDrawNotification(30.0f, true, "Configuration Loaded. Hash: %d", finalHash);
} catch (std::exception& e) { } catch (std::exception& e) {
SPDLOG_ERROR("Failed to load config file: {}", e.what()); SPDLOG_ERROR("Failed to load config file: {}", e.what());
auto gui = LUS::Context::GetInstance()->GetWindow()->GetGui(); auto gui = Ship::Context::GetInstance()->GetWindow()->GetGui();
gui->GetGameOverlay()->TextDrawNotification(30.0f, true, "Failed to load config file"); gui->GetGameOverlay()->TextDrawNotification(30.0f, true, "Failed to load config file");
return; return;
} catch (...) { } catch (...) {
SPDLOG_ERROR("Failed to load config file"); SPDLOG_ERROR("Failed to load config file");
auto gui = LUS::Context::GetInstance()->GetWindow()->GetGui(); auto gui = Ship::Context::GetInstance()->GetWindow()->GetGui();
gui->GetGameOverlay()->TextDrawNotification(30.0f, true, "Failed to load config file"); gui->GetGameOverlay()->TextDrawNotification(30.0f, true, "Failed to load config file");
return; return;
} }

View File

@ -38,7 +38,7 @@ class OTRGlobals
public: public:
static OTRGlobals* Instance; static OTRGlobals* Instance;
std::shared_ptr<LUS::Context> context; std::shared_ptr<Ship::Context> context;
std::shared_ptr<SaveStateMgr> gSaveStateMgr; std::shared_ptr<SaveStateMgr> gSaveStateMgr;
std::shared_ptr<Randomizer> gRandomizer; std::shared_ptr<Randomizer> gRandomizer;
std::shared_ptr<Rando::Context> gRandoContext; std::shared_ptr<Rando::Context> gRandoContext;
@ -67,6 +67,22 @@ private:
uint32_t IsGameMasterQuest(); uint32_t IsGameMasterQuest();
#endif #endif
#define CVAR_RANDOMIZER_ENHANCEMENT(var) CVAR_PREFIX_RANDOMIZER_ENHANCEMENT "." var
#define CVAR_RANDOMIZER_SETTING(var) CVAR_PREFIX_RANDOMIZER_SETTING "." var
#define CVAR_COSMETIC(var) CVAR_PREFIX_COSMETIC "." var
#define CVAR_AUDIO(var) CVAR_PREFIX_AUDIO "." var
#define CVAR_CHEAT(var) CVAR_PREFIX_CHEAT "." var
#define CVAR_ENHANCEMENT(var) CVAR_PREFIX_ENHANCEMENT "." var
#define CVAR_SETTING(var) CVAR_PREFIX_SETTING "." var
#define CVAR_WINDOW(var) CVAR_PREFIX_WINDOW "." var
#define CVAR_TRACKER(var) CVAR_PREFIX_TRACKER "." var
#define CVAR_TRACKER_ITEM(var) CVAR_TRACKER(".ItemTracker." var)
#define CVAR_TRACKER_CHECK(var) CVAR_TRACKER(".CheckTracker." var)
#define CVAR_TRACKER_ENTRANCE(var) CVAR_TRACKER(".EntranceTracker." var)
#define CVAR_DEVELOPER_TOOLS(var) CVAR_PREFIX_DEVELOPER_TOOLS "." var
#define CVAR_GENERAL(var) CVAR_PREFIX_GENERAL "." var
#define CVAR_REMOTE(var) CVAR_PREFIX_REMOTE "." var
#ifndef __cplusplus #ifndef __cplusplus
void InitOTR(void); void InitOTR(void);
void DeinitOTR(void); void DeinitOTR(void);

View File

@ -50,12 +50,12 @@ void SaveManager::ReadSaveFile(std::filesystem::path savePath, uintptr_t addr, v
} }
std::filesystem::path SaveManager::GetFileName(int fileNum) { std::filesystem::path SaveManager::GetFileName(int fileNum) {
const std::filesystem::path sSavePath(LUS::Context::GetPathRelativeToAppDirectory("Save")); const std::filesystem::path sSavePath(Ship::Context::GetPathRelativeToAppDirectory("Save"));
return sSavePath / ("file" + std::to_string(fileNum + 1) + ".sav"); return sSavePath / ("file" + std::to_string(fileNum + 1) + ".sav");
} }
std::filesystem::path SaveManager::GetFileTempName(int fileNum) { std::filesystem::path SaveManager::GetFileTempName(int fileNum) {
const std::filesystem::path sSavePath(LUS::Context::GetPathRelativeToAppDirectory("Save")); const std::filesystem::path sSavePath(Ship::Context::GetPathRelativeToAppDirectory("Save"));
return sSavePath / ("file" + std::to_string(fileNum + 1) + ".temp"); return sSavePath / ("file" + std::to_string(fileNum + 1) + ".temp");
} }
@ -615,10 +615,10 @@ void SaveManager::SaveRandomizer(SaveContext* saveContext, int sectionID, bool f
void SaveManager::Init() { void SaveManager::Init() {
// Wait on saves that snuck through the Wait in OnExitGame // Wait on saves that snuck through the Wait in OnExitGame
ThreadPoolWait(); ThreadPoolWait();
const std::filesystem::path sSavePath(LUS::Context::GetPathRelativeToAppDirectory("Save")); const std::filesystem::path sSavePath(Ship::Context::GetPathRelativeToAppDirectory("Save"));
const std::filesystem::path sGlobalPath = sSavePath / std::string("global.sav"); const std::filesystem::path sGlobalPath = sSavePath / std::string("global.sav");
auto sOldSavePath = LUS::Context::GetPathRelativeToAppDirectory("oot_save.sav"); auto sOldSavePath = Ship::Context::GetPathRelativeToAppDirectory("oot_save.sav");
auto sOldBackupSavePath = LUS::Context::GetPathRelativeToAppDirectory("oot_save.bak"); auto sOldBackupSavePath = Ship::Context::GetPathRelativeToAppDirectory("oot_save.bak");
// If the save directory does not exist, create it // If the save directory does not exist, create it
if (!std::filesystem::exists(sSavePath)) { if (!std::filesystem::exists(sSavePath)) {
@ -877,10 +877,10 @@ void SaveManager::InitFileDebug() {
//don't apply gDebugSaveFileMode on the title screen //don't apply gDebugSaveFileMode on the title screen
if (gSaveContext.fileNum != 0xFF) { if (gSaveContext.fileNum != 0xFF) {
if (CVarGetInteger("gDebugSaveFileMode", 1) == 2) { if (CVarGetInteger(CVAR_DEVELOPER_TOOLS("DebugSaveFileMode"), 1) == 2) {
InitFileMaxed(); InitFileMaxed();
return; return;
} else if (CVarGetInteger("gDebugSaveFileMode", 1) == 0) { } else if (CVarGetInteger(CVAR_DEVELOPER_TOOLS("DebugSaveFileMode"), 1) == 0) {
return; return;
} }
} }
@ -1266,7 +1266,7 @@ void SaveManager::SaveGlobal() {
globalBlock["zTargetSetting"] = gSaveContext.zTargetSetting; globalBlock["zTargetSetting"] = gSaveContext.zTargetSetting;
globalBlock["language"] = gSaveContext.language; globalBlock["language"] = gSaveContext.language;
const std::filesystem::path sSavePath(LUS::Context::GetPathRelativeToAppDirectory("Save")); const std::filesystem::path sSavePath(Ship::Context::GetPathRelativeToAppDirectory("Save"));
const std::filesystem::path sGlobalPath = sSavePath / std::string("global.sav"); const std::filesystem::path sGlobalPath = sSavePath / std::string("global.sav");
std::ofstream output(sGlobalPath); std::ofstream output(sGlobalPath);
@ -1325,7 +1325,7 @@ void SaveManager::LoadFile(int fileNum) {
GameInteractor::Instance->ExecuteHooks<GameInteractor::OnLoadFile>(fileNum); GameInteractor::Instance->ExecuteHooks<GameInteractor::OnLoadFile>(fileNum);
} catch (const std::exception& e) { } catch (const std::exception& e) {
input.close(); input.close();
std::filesystem::path newFile(LUS::Context::GetPathRelativeToAppDirectory("Save") + ("/file" + std::to_string(fileNum + 1) + "-" + std::to_string(GetUnixTimestamp()) + ".bak")); std::filesystem::path newFile(Ship::Context::GetPathRelativeToAppDirectory("Save") + ("/file" + std::to_string(fileNum + 1) + "-" + std::to_string(GetUnixTimestamp()) + ".bak"));
#if defined(__SWITCH__) || defined(__WIIU__) #if defined(__SWITCH__) || defined(__WIIU__)
copy_file(fileName.c_str(), newFile.c_str()); copy_file(fileName.c_str(), newFile.c_str());
#else #else
@ -1415,7 +1415,7 @@ int SaveManager::GetSaveSectionID(std::string& sectionName) {
void SaveManager::CreateDefaultGlobal() { void SaveManager::CreateDefaultGlobal() {
gSaveContext.audioSetting = 0; gSaveContext.audioSetting = 0;
gSaveContext.zTargetSetting = 0; gSaveContext.zTargetSetting = 0;
gSaveContext.language = CVarGetInteger("gLanguages", LANGUAGE_ENG); gSaveContext.language = CVarGetInteger(CVAR_SETTING("Languages"), LANGUAGE_ENG);
SaveGlobal(); SaveGlobal();
} }
@ -2795,7 +2795,7 @@ void SaveManager::ConvertFromUnversioned() {
gSaveContext.zTargetSetting = data[SRAM_HEADER_ZTARGET] & 1; gSaveContext.zTargetSetting = data[SRAM_HEADER_ZTARGET] & 1;
gSaveContext.language = data[SRAM_HEADER_LANGUAGE]; gSaveContext.language = data[SRAM_HEADER_LANGUAGE];
if (gSaveContext.language >= LANGUAGE_MAX) { if (gSaveContext.language >= LANGUAGE_MAX) {
gSaveContext.language = CVarGetInteger("gLanguages", LANGUAGE_ENG); gSaveContext.language = CVarGetInteger(CVAR_SETTING("Languages"), LANGUAGE_ENG);
} }
SaveGlobal(); SaveGlobal();

View File

@ -11,8 +11,8 @@
#ifndef IMGUI_DEFINE_MATH_OPERATORS #ifndef IMGUI_DEFINE_MATH_OPERATORS
#define IMGUI_DEFINE_MATH_OPERATORS #define IMGUI_DEFINE_MATH_OPERATORS
#endif #endif
#include <ImGui/imgui.h> #include <imgui.h>
#include <ImGui/imgui_internal.h> #include <imgui_internal.h>
#include <libultraship/libultraship.h> #include <libultraship/libultraship.h>
#include <Fast3D/gfx_pc.h> #include <Fast3D/gfx_pc.h>
@ -112,9 +112,9 @@ namespace SohGui {
std::shared_ptr<SohMenuBar> mSohMenuBar; std::shared_ptr<SohMenuBar> mSohMenuBar;
std::shared_ptr<LUS::GuiWindow> mConsoleWindow; std::shared_ptr<Ship::GuiWindow> mConsoleWindow;
std::shared_ptr<LUS::GuiWindow> mStatsWindow; std::shared_ptr<Ship::GuiWindow> mStatsWindow;
std::shared_ptr<LUS::GuiWindow> mInputEditorWindow; std::shared_ptr<Ship::GuiWindow> mInputEditorWindow;
std::shared_ptr<AudioEditor> mAudioEditorWindow; std::shared_ptr<AudioEditor> mAudioEditorWindow;
std::shared_ptr<InputViewer> mInputViewer; std::shared_ptr<InputViewer> mInputViewer;
@ -137,10 +137,10 @@ namespace SohGui {
std::shared_ptr<SohModalWindow> mModalWindow; std::shared_ptr<SohModalWindow> mModalWindow;
void SetupGuiElements() { void SetupGuiElements() {
auto gui = LUS::Context::GetInstance()->GetWindow()->GetGui(); auto gui = Ship::Context::GetInstance()->GetWindow()->GetGui();
mSohMenuBar = std::make_shared<SohMenuBar>("gOpenMenuBar", CVarGetInteger("gOpenMenuBar", 0)); mSohMenuBar = std::make_shared<SohMenuBar>(CVAR_MENU_BAR_OPEN, CVarGetInteger(CVAR_MENU_BAR_OPEN, 0));
gui->SetMenuBar(std::reinterpret_pointer_cast<LUS::GuiMenuBar>(mSohMenuBar)); gui->SetMenuBar(std::reinterpret_pointer_cast<Ship::GuiMenuBar>(mSohMenuBar));
if (gui->GetMenuBar() && !gui->GetMenuBar()->IsVisible()) { if (gui->GetMenuBar() && !gui->GetMenuBar()->IsVisible()) {
#if defined(__SWITCH__) || defined(__WIIU__) #if defined(__SWITCH__) || defined(__WIIU__)
@ -165,43 +165,43 @@ namespace SohGui {
SPDLOG_ERROR("Could not find input editor window"); SPDLOG_ERROR("Could not find input editor window");
} }
mAudioEditorWindow = std::make_shared<AudioEditor>("gAudioEditor.WindowOpen", "Audio Editor"); mAudioEditorWindow = std::make_shared<AudioEditor>(CVAR_WINDOW("AudioEditor"), "Audio Editor");
gui->AddGuiWindow(mAudioEditorWindow); gui->AddGuiWindow(mAudioEditorWindow);
mInputViewer = std::make_shared<InputViewer>("gOpenWindows.InputViewer", "Input Viewer"); mInputViewer = std::make_shared<InputViewer>(CVAR_WINDOW("InputViewer"), "Input Viewer");
gui->AddGuiWindow(mInputViewer); gui->AddGuiWindow(mInputViewer);
mInputViewerSettings = std::make_shared<InputViewerSettingsWindow>("gOpenWindows.InputViewerSettings", "Input Viewer Settings"); mInputViewerSettings = std::make_shared<InputViewerSettingsWindow>(CVAR_WINDOW("InputViewerSettings"), "Input Viewer Settings");
gui->AddGuiWindow(mInputViewerSettings); gui->AddGuiWindow(mInputViewerSettings);
mCosmeticsEditorWindow = std::make_shared<CosmeticsEditorWindow>("gCosmeticsEditorEnabled", "Cosmetics Editor"); mCosmeticsEditorWindow = std::make_shared<CosmeticsEditorWindow>(CVAR_WINDOW("CosmeticsEditor"), "Cosmetics Editor");
gui->AddGuiWindow(mCosmeticsEditorWindow); gui->AddGuiWindow(mCosmeticsEditorWindow);
mActorViewerWindow = std::make_shared<ActorViewerWindow>("gActorViewerEnabled", "Actor Viewer"); mActorViewerWindow = std::make_shared<ActorViewerWindow>(CVAR_WINDOW("ActorViewer"), "Actor Viewer");
gui->AddGuiWindow(mActorViewerWindow); gui->AddGuiWindow(mActorViewerWindow);
mColViewerWindow = std::make_shared<ColViewerWindow>("gCollisionViewerEnabled", "Collision Viewer"); mColViewerWindow = std::make_shared<ColViewerWindow>(CVAR_WINDOW("CollisionViewer"), "Collision Viewer");
gui->AddGuiWindow(mColViewerWindow); gui->AddGuiWindow(mColViewerWindow);
mSaveEditorWindow = std::make_shared<SaveEditorWindow>("gSaveEditorEnabled", "Save Editor"); mSaveEditorWindow = std::make_shared<SaveEditorWindow>(CVAR_WINDOW("SaveEditor"), "Save Editor");
gui->AddGuiWindow(mSaveEditorWindow); gui->AddGuiWindow(mSaveEditorWindow);
mDLViewerWindow = std::make_shared<DLViewerWindow>("gDLViewerEnabled", "Display List Viewer"); mDLViewerWindow = std::make_shared<DLViewerWindow>(CVAR_WINDOW("DLViewer"), "Display List Viewer");
gui->AddGuiWindow(mDLViewerWindow); gui->AddGuiWindow(mDLViewerWindow);
mValueViewerWindow = std::make_shared<ValueViewerWindow>("gValueViewer.WindowOpen", "Value Viewer"); mValueViewerWindow = std::make_shared<ValueViewerWindow>(CVAR_WINDOW("ValueViewer"), "Value Viewer");
gui->AddGuiWindow(mValueViewerWindow); gui->AddGuiWindow(mValueViewerWindow);
mMessageViewerWindow = std::make_shared<MessageViewer>("gMessageViewerEnabled", "Message Viewer"); mMessageViewerWindow = std::make_shared<MessageViewer>(CVAR_WINDOW("MessageViewer"), "Message Viewer");
gui->AddGuiWindow(mMessageViewerWindow); gui->AddGuiWindow(mMessageViewerWindow);
mGameplayStatsWindow = std::make_shared<GameplayStatsWindow>("gGameplayStatsEnabled", "Gameplay Stats"); mGameplayStatsWindow = std::make_shared<GameplayStatsWindow>(CVAR_WINDOW("GameplayStats"), "Gameplay Stats");
gui->AddGuiWindow(mGameplayStatsWindow); gui->AddGuiWindow(mGameplayStatsWindow);
mCheckTrackerWindow = std::make_shared<CheckTracker::CheckTrackerWindow>("gCheckTrackerEnabled", "Check Tracker"); mCheckTrackerWindow = std::make_shared<CheckTracker::CheckTrackerWindow>(CVAR_WINDOW("CheckTracker"), "Check Tracker");
gui->AddGuiWindow(mCheckTrackerWindow); gui->AddGuiWindow(mCheckTrackerWindow);
mCheckTrackerSettingsWindow = std::make_shared<CheckTracker::CheckTrackerSettingsWindow>("gCheckTrackerSettingsEnabled", "Check Tracker Settings"); mCheckTrackerSettingsWindow = std::make_shared<CheckTracker::CheckTrackerSettingsWindow>(CVAR_WINDOW("CheckTrackerSettings"), "Check Tracker Settings");
gui->AddGuiWindow(mCheckTrackerSettingsWindow); gui->AddGuiWindow(mCheckTrackerSettingsWindow);
mEntranceTrackerWindow = std::make_shared<EntranceTrackerWindow>("gEntranceTrackerEnabled","Entrance Tracker"); mEntranceTrackerWindow = std::make_shared<EntranceTrackerWindow>(CVAR_WINDOW("EntranceTracker"),"Entrance Tracker");
gui->AddGuiWindow(mEntranceTrackerWindow); gui->AddGuiWindow(mEntranceTrackerWindow);
mItemTrackerWindow = std::make_shared<ItemTrackerWindow>("gItemTrackerEnabled", "Item Tracker"); mItemTrackerWindow = std::make_shared<ItemTrackerWindow>(CVAR_WINDOW("ItemTracker"), "Item Tracker");
gui->AddGuiWindow(mItemTrackerWindow); gui->AddGuiWindow(mItemTrackerWindow);
mItemTrackerSettingsWindow = std::make_shared<ItemTrackerSettingsWindow>("gItemTrackerSettingsEnabled", "Item Tracker Settings"); mItemTrackerSettingsWindow = std::make_shared<ItemTrackerSettingsWindow>(CVAR_WINDOW("ItemTrackerSettings"), "Item Tracker Settings");
gui->AddGuiWindow(mItemTrackerSettingsWindow); gui->AddGuiWindow(mItemTrackerSettingsWindow);
mRandomizerSettingsWindow = std::make_shared<RandomizerSettingsWindow>("gRandomizerSettingsEnabled", "Randomizer Settings"); mRandomizerSettingsWindow = std::make_shared<RandomizerSettingsWindow>(CVAR_WINDOW("RandomizerSettings"), "Randomizer Settings");
gui->AddGuiWindow(mRandomizerSettingsWindow); gui->AddGuiWindow(mRandomizerSettingsWindow);
mAdvancedResolutionSettingsWindow = std::make_shared<AdvancedResolutionSettings::AdvancedResolutionSettingsWindow>("gAdvancedResolutionEditorEnabled", "Advanced Resolution Settings"); mAdvancedResolutionSettingsWindow = std::make_shared<AdvancedResolutionSettings::AdvancedResolutionSettingsWindow>(CVAR_WINDOW("AdvancedResolutionEditor"), "Advanced Resolution Settings");
gui->AddGuiWindow(mAdvancedResolutionSettingsWindow); gui->AddGuiWindow(mAdvancedResolutionSettingsWindow);
mModalWindow = std::make_shared<SohModalWindow>("gOpenWindows.modalWindowEnabled", "Modal Window"); mModalWindow = std::make_shared<SohModalWindow>(CVAR_WINDOW("ModalWindow"), "Modal Window");
gui->AddGuiWindow(mModalWindow); gui->AddGuiWindow(mModalWindow);
mModalWindow->Show(); mModalWindow->Show();
} }

File diff suppressed because it is too large Load Diff

View File

@ -5,9 +5,9 @@
#include "window/gui/GuiElement.h" #include "window/gui/GuiElement.h"
namespace SohGui { namespace SohGui {
class SohMenuBar : public LUS::GuiMenuBar { class SohMenuBar : public Ship::GuiMenuBar {
public: public:
using LUS::GuiMenuBar::GuiMenuBar; using Ship::GuiMenuBar::GuiMenuBar;
protected: protected:
void DrawElement() override; void DrawElement() override;
void InitElement() override {}; void InitElement() override {};

View File

@ -1,5 +1,5 @@
#include "SohModals.h" #include "SohModals.h"
#include "ImGui/imgui.h" #include <imgui.h>
#include <vector> #include <vector>
#include <string> #include <string>
#include <libultraship/bridge.h> #include <libultraship/bridge.h>

View File

@ -4,9 +4,9 @@
#include "window/gui/GuiMenuBar.h" #include "window/gui/GuiMenuBar.h"
#include "window/gui/GuiElement.h" #include "window/gui/GuiElement.h"
class SohModalWindow : public LUS::GuiWindow { class SohModalWindow : public Ship::GuiWindow {
public: public:
using LUS::GuiWindow::GuiWindow; using GuiWindow::GuiWindow;
void InitElement() override {}; void InitElement() override {};
void DrawElement() override; void DrawElement() override;

View File

@ -10,8 +10,8 @@
#ifndef IMGUI_DEFINE_MATH_OPERATORS #ifndef IMGUI_DEFINE_MATH_OPERATORS
#define IMGUI_DEFINE_MATH_OPERATORS #define IMGUI_DEFINE_MATH_OPERATORS
#endif #endif
#include <ImGui/imgui.h> #include <imgui.h>
#include <ImGui/imgui_internal.h> #include <imgui_internal.h>
#include <libultraship/libultraship.h> #include <libultraship/libultraship.h>
#include <libultraship/libultra/types.h> #include <libultraship/libultra/types.h>
@ -208,7 +208,7 @@ namespace UIWidgets {
bool val = (bool)CVarGetInteger(cvarName, defaultValue); bool val = (bool)CVarGetInteger(cvarName, defaultValue);
if (CustomCheckbox(text, &val, disabled, disabledGraphic)) { if (CustomCheckbox(text, &val, disabled, disabledGraphic)) {
CVarSetInteger(cvarName, val); CVarSetInteger(cvarName, val);
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
changed = true; changed = true;
} }
@ -248,7 +248,7 @@ namespace UIWidgets {
CVarSetInteger(cvarName, i); CVarSetInteger(cvarName, i);
selected = i; selected = i;
changed = true; changed = true;
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
} }
} }
} }
@ -261,7 +261,7 @@ namespace UIWidgets {
if (disabledValue >= 0 && selected != disabledValue) { if (disabledValue >= 0 && selected != disabledValue) {
CVarSetInteger(cvarName, disabledValue); CVarSetInteger(cvarName, disabledValue);
changed = true; changed = true;
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
} }
} }
@ -351,7 +351,7 @@ namespace UIWidgets {
if (changed && (oldVal != val)) { if (changed && (oldVal != val)) {
CVarSetInteger(cvarName, val); CVarSetInteger(cvarName, val);
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
} else { } else {
changed = false; changed = false;
} }
@ -452,7 +452,7 @@ namespace UIWidgets {
ss << std::setprecision(ticks + 1) << std::setiosflags(std::ios_base::fixed) << val; ss << std::setprecision(ticks + 1) << std::setiosflags(std::ios_base::fixed) << val;
val = std::stof(ss.str()); val = std::stof(ss.str());
CVarSetFloat(cvarName, val); CVarSetFloat(cvarName, val);
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
} else { } else {
changed = false; changed = false;
} }
@ -486,14 +486,14 @@ namespace UIWidgets {
bool EnhancementRadioButton(const char* text, const char* cvarName, int id) { bool EnhancementRadioButton(const char* text, const char* cvarName, int id) {
/*Usage : /*Usage :
EnhancementRadioButton("My Visible Name","gMyCVarName", MyID); EnhancementRadioButton("My Visible Name",CVAR_GROUP("MyCVarName"), MyID);
First arg is the visible name of the Radio button First arg is the visible name of the Radio button
Second is the cvar name where MyID will be saved. Second is the cvar name where MyID will be saved.
Note: the CVar name should be the same to each Buddies. Note: the CVar name should be the same to each Buddies.
Example : Example :
EnhancementRadioButton("English", "gLanguages", LANGUAGE_ENG); EnhancementRadioButton("English", CVAR_SETTING("Languages"), LANGUAGE_ENG);
EnhancementRadioButton("German", "gLanguages", LANGUAGE_GER); EnhancementRadioButton("German", CVAR_SETTING("Languages"), LANGUAGE_GER);
EnhancementRadioButton("French", "gLanguages", LANGUAGE_FRA); EnhancementRadioButton("French", CVAR_SETTING("Languages"), LANGUAGE_FRA);
*/ */
std::string make_invisible = "##" + std::string(text) + std::string(cvarName); std::string make_invisible = "##" + std::string(text) + std::string(cvarName);
@ -501,7 +501,7 @@ namespace UIWidgets {
int val = CVarGetInteger(cvarName, 0); int val = CVarGetInteger(cvarName, 0);
if (ImGui::RadioButton(make_invisible.c_str(), id == val)) { if (ImGui::RadioButton(make_invisible.c_str(), id == val)) {
CVarSetInteger(cvarName, id); CVarSetInteger(cvarName, id);
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
ret = true; ret = true;
} }
ImGui::SameLine(); ImGui::SameLine();
@ -528,7 +528,7 @@ namespace UIWidgets {
CVarSetColor(cvarName, colorsRGBA); CVarSetColor(cvarName, colorsRGBA);
CVarSetInteger(Cvar_RBM.c_str(), 0); //On click disable rainbow mode. CVarSetInteger(Cvar_RBM.c_str(), 0); //On click disable rainbow mode.
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
changed = true; changed = true;
} }
Tooltip("Revert colors to the game's original colors (GameCube version)\nOverwrites previously chosen color"); Tooltip("Revert colors to the game's original colors (GameCube version)\nOverwrites previously chosen color");
@ -553,7 +553,7 @@ namespace UIWidgets {
NewColors.b = fmin(fmax(colors->z * 255, 0), 255); NewColors.b = fmin(fmax(colors->z * 255, 0), 255);
CVarSetColor(cvarName, NewColors); CVarSetColor(cvarName, NewColors);
CVarSetInteger(Cvar_RBM.c_str(), 0); // On click disable rainbow mode. CVarSetInteger(Cvar_RBM.c_str(), 0); // On click disable rainbow mode.
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
changed = true; changed = true;
} }
Tooltip("Chooses a random color\nOverwrites previously chosen color"); Tooltip("Chooses a random color\nOverwrites previously chosen color");
@ -614,7 +614,7 @@ namespace UIWidgets {
colors.a = 255.0; colors.a = 255.0;
CVarSetColor(cvarName, colors); CVarSetColor(cvarName, colors);
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
changed = true; changed = true;
} }
} }
@ -630,7 +630,7 @@ namespace UIWidgets {
colors.a = ColorRGBA.w * 255.0; colors.a = ColorRGBA.w * 255.0;
CVarSetColor(cvarName, colors); CVarSetColor(cvarName, colors);
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
changed = true; changed = true;
} }
} }

View File

@ -16,7 +16,7 @@
#ifndef IMGUI_DEFINE_MATH_OPERATORS #ifndef IMGUI_DEFINE_MATH_OPERATORS
#define IMGUI_DEFINE_MATH_OPERATORS #define IMGUI_DEFINE_MATH_OPERATORS
#endif #endif
#include <ImGui/imgui.h> #include <imgui.h>
namespace UIWidgets { namespace UIWidgets {

View File

@ -1,11 +1,11 @@
#include "ConfigUpdaters.h" #include "ConfigUpdaters.h"
#include "soh/Enhancements/audio/AudioCollection.h" #include "soh/Enhancements/audio/AudioCollection.h"
namespace LUS { namespace SOH {
ConfigVersion1Updater::ConfigVersion1Updater() : ConfigVersionUpdater(1) {} ConfigVersion1Updater::ConfigVersion1Updater() : ConfigVersionUpdater(1) {}
ConfigVersion2Updater::ConfigVersion2Updater() : ConfigVersionUpdater(2) {} ConfigVersion2Updater::ConfigVersion2Updater() : ConfigVersionUpdater(2) {}
void ConfigVersion1Updater::Update(Config* conf) { void ConfigVersion1Updater::Update(Ship::Config* conf) {
if (conf->GetInt("Window.Width", 640) == 640) { if (conf->GetInt("Window.Width", 640) == 640) {
conf->Erase("Window.Width"); conf->Erase("Window.Width");
} }
@ -36,10 +36,10 @@ namespace LUS {
if (conf->GetInt("Window.Fullscreen.Height", 1080) == 1080) { if (conf->GetInt("Window.Fullscreen.Height", 1080) == 1080) {
conf->Erase("Window.Fullscreen.Height"); conf->Erase("Window.Fullscreen.Height");
} }
if (conf->GetInt("Shortcuts.Fullscreen", KbScancode::LUS_KB_F11) == KbScancode::LUS_KB_F10) { if (conf->GetInt("Shortcuts.Fullscreen", Ship::KbScancode::LUS_KB_F11) == Ship::KbScancode::LUS_KB_F10) {
conf->Erase("Shortcuts.Fullscreen"); conf->Erase("Shortcuts.Fullscreen");
} }
if (conf->GetInt("Shortcuts.Console", KbScancode::LUS_KB_OEM_3) == KbScancode::LUS_KB_OEM_3) { if (conf->GetInt("Shortcuts.Console", Ship::KbScancode::LUS_KB_OEM_3) == Ship::KbScancode::LUS_KB_OEM_3) {
conf->Erase("Shortcuts.Console"); conf->Erase("Shortcuts.Console");
} }
if (conf->GetString("Game.SaveName", "") == "") { if (conf->GetString("Game.SaveName", "") == "") {
@ -52,7 +52,7 @@ namespace LUS {
conf->Erase("Game.Patches Archive"); conf->Erase("Game.Patches Archive");
} }
if (CVarGetInteger("gDirtPathFix", 0) != 0) { if (CVarGetInteger("gDirtPathFix", 0) != 0) {
CVarSetInteger("gZFightingMode", CVarGetInteger("gDirtPathFix", 0)); CVarSetInteger(CVAR_Z_FIGHTING_MODE, CVarGetInteger("gDirtPathFix", 0));
CVarClear("gDirtPathFix"); CVarClear("gDirtPathFix");
} }
if (CVarGetInteger("gRandomizedEnemies", 0) != 0) { if (CVarGetInteger("gRandomizedEnemies", 0) != 0) {
@ -63,7 +63,7 @@ namespace LUS {
CVarClear("gSeededRandomizedEnemies"); CVarClear("gSeededRandomizedEnemies");
} }
void ConfigVersion2Updater::Update(Config* conf) { void ConfigVersion2Updater::Update(Ship::Config* conf) {
for (auto seq : AudioCollection::Instance->GetAllSequences()) { for (auto seq : AudioCollection::Instance->GetAllSequences()) {
CVarClear(std::string("gAudioEditor.ReplacedSequences." + seq.second.sfxKey).c_str()); CVarClear(std::string("gAudioEditor.ReplacedSequences." + seq.second.sfxKey).c_str());
} }

View File

@ -1,15 +1,15 @@
#include "libultraship/libultraship.h" #include "libultraship/libultraship.h"
namespace LUS { namespace SOH {
class ConfigVersion1Updater : public ConfigVersionUpdater { class ConfigVersion1Updater : public Ship::ConfigVersionUpdater {
public: public:
ConfigVersion1Updater(); ConfigVersion1Updater();
void Update(Config* conf); void Update(Ship::Config* conf);
}; };
class ConfigVersion2Updater : public ConfigVersionUpdater { class ConfigVersion2Updater : public Ship::ConfigVersionUpdater {
public: public:
ConfigVersion2Updater(); ConfigVersion2Updater();
void Update(Config* conf); void Update(Ship::Config* conf);
}; };
} }

View File

@ -3,13 +3,13 @@
#include "spdlog/spdlog.h" #include "spdlog/spdlog.h"
namespace SOH { namespace SOH {
std::shared_ptr<LUS::IResource> ResourceFactoryBinaryAnimationV0::ReadResource(std::shared_ptr<LUS::File> file) { std::shared_ptr<Ship::IResource> ResourceFactoryBinaryAnimationV0::ReadResource(std::shared_ptr<Ship::File> file) {
if (!FileHasValidFormatAndReader(file)) { if (!FileHasValidFormatAndReader(file)) {
return nullptr; return nullptr;
} }
auto animation = std::make_shared<Animation>(file->InitData); auto animation = std::make_shared<Animation>(file->InitData);
auto reader = std::get<std::shared_ptr<LUS::BinaryReader>>(file->Reader); auto reader = std::get<std::shared_ptr<Ship::BinaryReader>>(file->Reader);
AnimationType animType = (AnimationType)reader->ReadUInt32(); AnimationType animType = (AnimationType)reader->ReadUInt32();
animation->type = animType; animation->type = animType;

View File

@ -4,8 +4,8 @@
#include "ResourceFactoryBinary.h" #include "ResourceFactoryBinary.h"
namespace SOH { namespace SOH {
class ResourceFactoryBinaryAnimationV0 : public LUS::ResourceFactoryBinary { class ResourceFactoryBinaryAnimationV0 : public Ship::ResourceFactoryBinary {
public: public:
std::shared_ptr<LUS::IResource> ReadResource(std::shared_ptr<LUS::File> file) override; std::shared_ptr<Ship::IResource> ReadResource(std::shared_ptr<Ship::File> file) override;
}; };
} // namespace SOH } // namespace SOH

View File

@ -3,13 +3,13 @@
#include "spdlog/spdlog.h" #include "spdlog/spdlog.h"
namespace SOH { namespace SOH {
std::shared_ptr<LUS::IResource> ResourceFactoryBinaryAudioSampleV2::ReadResource(std::shared_ptr<LUS::File> file) { std::shared_ptr<Ship::IResource> ResourceFactoryBinaryAudioSampleV2::ReadResource(std::shared_ptr<Ship::File> file) {
if (!FileHasValidFormatAndReader(file)) { if (!FileHasValidFormatAndReader(file)) {
return nullptr; return nullptr;
} }
auto audioSample = std::make_shared<AudioSample>(file->InitData); auto audioSample = std::make_shared<AudioSample>(file->InitData);
auto reader = std::get<std::shared_ptr<LUS::BinaryReader>>(file->Reader); auto reader = std::get<std::shared_ptr<Ship::BinaryReader>>(file->Reader);
audioSample->sample.codec = reader->ReadUByte(); audioSample->sample.codec = reader->ReadUByte();
audioSample->sample.medium = reader->ReadUByte(); audioSample->sample.medium = reader->ReadUByte();
@ -71,7 +71,7 @@ extern "C" SoundFontSample* ReadCustomSample(const char* path) {
ExtensionEntry entry = ExtensionCache[path]; ExtensionEntry entry = ExtensionCache[path];
auto sampleRaw = LUS::Context::GetInstance()->GetResourceManager()->LoadFile(entry.path); auto sampleRaw = Ship::Context::GetInstance()->GetResourceManager()->LoadFile(entry.path);
uint32_t* strem = (uint32_t*)sampleRaw->Buffer.get(); uint32_t* strem = (uint32_t*)sampleRaw->Buffer.get();
uint8_t* strem2 = (uint8_t*)strem; uint8_t* strem2 = (uint8_t*)strem;

View File

@ -4,8 +4,8 @@
#include "ResourceFactoryBinary.h" #include "ResourceFactoryBinary.h"
namespace SOH { namespace SOH {
class ResourceFactoryBinaryAudioSampleV2 : public LUS::ResourceFactoryBinary { class ResourceFactoryBinaryAudioSampleV2 : public Ship::ResourceFactoryBinary {
public: public:
std::shared_ptr<LUS::IResource> ReadResource(std::shared_ptr<LUS::File> file) override; std::shared_ptr<Ship::IResource> ReadResource(std::shared_ptr<Ship::File> file) override;
}; };
} // namespace SOH } // namespace SOH

View File

@ -3,13 +3,13 @@
#include "spdlog/spdlog.h" #include "spdlog/spdlog.h"
namespace SOH { namespace SOH {
std::shared_ptr<LUS::IResource> ResourceFactoryBinaryAudioSequenceV2::ReadResource(std::shared_ptr<LUS::File> file) { std::shared_ptr<Ship::IResource> ResourceFactoryBinaryAudioSequenceV2::ReadResource(std::shared_ptr<Ship::File> file) {
if (!FileHasValidFormatAndReader(file)) { if (!FileHasValidFormatAndReader(file)) {
return nullptr; return nullptr;
} }
auto audioSequence = std::make_shared<AudioSequence>(file->InitData); auto audioSequence = std::make_shared<AudioSequence>(file->InitData);
auto reader = std::get<std::shared_ptr<LUS::BinaryReader>>(file->Reader); auto reader = std::get<std::shared_ptr<Ship::BinaryReader>>(file->Reader);
audioSequence->sequence.seqDataSize = reader->ReadInt32(); audioSequence->sequence.seqDataSize = reader->ReadInt32();
audioSequence->sequenceData.reserve(audioSequence->sequence.seqDataSize); audioSequence->sequenceData.reserve(audioSequence->sequence.seqDataSize);

View File

@ -4,8 +4,8 @@
#include "ResourceFactoryBinary.h" #include "ResourceFactoryBinary.h"
namespace SOH { namespace SOH {
class ResourceFactoryBinaryAudioSequenceV2 : public LUS::ResourceFactoryBinary { class ResourceFactoryBinaryAudioSequenceV2 : public Ship::ResourceFactoryBinary {
public: public:
std::shared_ptr<LUS::IResource> ReadResource(std::shared_ptr<LUS::File> file) override; std::shared_ptr<Ship::IResource> ReadResource(std::shared_ptr<Ship::File> file) override;
}; };
} // namespace SOH } // namespace SOH

View File

@ -4,13 +4,13 @@
#include "libultraship/libultraship.h" #include "libultraship/libultraship.h"
namespace SOH { namespace SOH {
std::shared_ptr<LUS::IResource> ResourceFactoryBinaryAudioSoundFontV2::ReadResource(std::shared_ptr<LUS::File> file) { std::shared_ptr<Ship::IResource> ResourceFactoryBinaryAudioSoundFontV2::ReadResource(std::shared_ptr<Ship::File> file) {
if (!FileHasValidFormatAndReader(file)) { if (!FileHasValidFormatAndReader(file)) {
return nullptr; return nullptr;
} }
auto audioSoundFont = std::make_shared<AudioSoundFont>(file->InitData); auto audioSoundFont = std::make_shared<AudioSoundFont>(file->InitData);
auto reader = std::get<std::shared_ptr<LUS::BinaryReader>>(file->Reader); auto reader = std::get<std::shared_ptr<Ship::BinaryReader>>(file->Reader);
audioSoundFont->soundFont.fntIndex = reader->ReadInt32(); audioSoundFont->soundFont.fntIndex = reader->ReadInt32();
audioSoundFont->medium = reader->ReadInt8(); audioSoundFont->medium = reader->ReadInt8();
@ -67,7 +67,7 @@ std::shared_ptr<LUS::IResource> ResourceFactoryBinaryAudioSoundFontV2::ReadResou
if (sampleFileName.empty()) { if (sampleFileName.empty()) {
drum.sound.sample = nullptr; drum.sound.sample = nullptr;
} else { } else {
auto res = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(sampleFileName.c_str()); auto res = Ship::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(sampleFileName.c_str());
drum.sound.sample = static_cast<Sample*>(res ? res->GetRawPointer() : nullptr); drum.sound.sample = static_cast<Sample*>(res ? res->GetRawPointer() : nullptr);
} }
@ -111,7 +111,7 @@ std::shared_ptr<LUS::IResource> ResourceFactoryBinaryAudioSoundFontV2::ReadResou
bool hasSampleRef = reader->ReadInt8(); bool hasSampleRef = reader->ReadInt8();
std::string sampleFileName = reader->ReadString(); std::string sampleFileName = reader->ReadString();
instrument.lowNotesSound.tuning = reader->ReadFloat(); instrument.lowNotesSound.tuning = reader->ReadFloat();
auto res = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(sampleFileName.c_str()); auto res = Ship::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(sampleFileName.c_str());
instrument.lowNotesSound.sample = static_cast<Sample*>(res ? res->GetRawPointer() : nullptr); instrument.lowNotesSound.sample = static_cast<Sample*>(res ? res->GetRawPointer() : nullptr);
} else { } else {
instrument.lowNotesSound.sample = nullptr; instrument.lowNotesSound.sample = nullptr;
@ -123,7 +123,7 @@ std::shared_ptr<LUS::IResource> ResourceFactoryBinaryAudioSoundFontV2::ReadResou
bool hasSampleRef = reader->ReadInt8(); bool hasSampleRef = reader->ReadInt8();
std::string sampleFileName = reader->ReadString(); std::string sampleFileName = reader->ReadString();
instrument.normalNotesSound.tuning = reader->ReadFloat(); instrument.normalNotesSound.tuning = reader->ReadFloat();
auto res = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(sampleFileName.c_str()); auto res = Ship::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(sampleFileName.c_str());
instrument.normalNotesSound.sample = static_cast<Sample*>(res ? res->GetRawPointer() : nullptr); instrument.normalNotesSound.sample = static_cast<Sample*>(res ? res->GetRawPointer() : nullptr);
} else { } else {
instrument.normalNotesSound.sample = nullptr; instrument.normalNotesSound.sample = nullptr;
@ -135,7 +135,7 @@ std::shared_ptr<LUS::IResource> ResourceFactoryBinaryAudioSoundFontV2::ReadResou
bool hasSampleRef = reader->ReadInt8(); bool hasSampleRef = reader->ReadInt8();
std::string sampleFileName = reader->ReadString(); std::string sampleFileName = reader->ReadString();
instrument.highNotesSound.tuning = reader->ReadFloat(); instrument.highNotesSound.tuning = reader->ReadFloat();
auto res = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(sampleFileName.c_str()); auto res = Ship::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(sampleFileName.c_str());
instrument.highNotesSound.sample = static_cast<Sample*>(res ? res->GetRawPointer() : nullptr); instrument.highNotesSound.sample = static_cast<Sample*>(res ? res->GetRawPointer() : nullptr);
} else { } else {
instrument.highNotesSound.sample = nullptr; instrument.highNotesSound.sample = nullptr;
@ -160,7 +160,7 @@ std::shared_ptr<LUS::IResource> ResourceFactoryBinaryAudioSoundFontV2::ReadResou
bool hasSampleRef = reader->ReadInt8(); bool hasSampleRef = reader->ReadInt8();
std::string sampleFileName = reader->ReadString(); std::string sampleFileName = reader->ReadString();
soundEffect.tuning = reader->ReadFloat(); soundEffect.tuning = reader->ReadFloat();
auto res = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(sampleFileName.c_str()); auto res = Ship::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(sampleFileName.c_str());
soundEffect.sample = static_cast<Sample*>(res ? res->GetRawPointer() : nullptr); soundEffect.sample = static_cast<Sample*>(res ? res->GetRawPointer() : nullptr);
} }

View File

@ -4,8 +4,8 @@
#include "ResourceFactoryBinary.h" #include "ResourceFactoryBinary.h"
namespace SOH { namespace SOH {
class ResourceFactoryBinaryAudioSoundFontV2 : public LUS::ResourceFactoryBinary { class ResourceFactoryBinaryAudioSoundFontV2 : public Ship::ResourceFactoryBinary {
public: public:
std::shared_ptr<LUS::IResource> ReadResource(std::shared_ptr<LUS::File> file) override; std::shared_ptr<Ship::IResource> ReadResource(std::shared_ptr<Ship::File> file) override;
}; };
} // namespace SOH } // namespace SOH

View File

@ -3,13 +3,13 @@
#include "spdlog/spdlog.h" #include "spdlog/spdlog.h"
namespace SOH { namespace SOH {
std::shared_ptr<LUS::IResource> ResourceFactoryBinaryBackgroundV0::ReadResource(std::shared_ptr<LUS::File> file) { std::shared_ptr<Ship::IResource> ResourceFactoryBinaryBackgroundV0::ReadResource(std::shared_ptr<Ship::File> file) {
if (!FileHasValidFormatAndReader(file)) { if (!FileHasValidFormatAndReader(file)) {
return nullptr; return nullptr;
} }
auto background = std::make_shared<Background>(file->InitData); auto background = std::make_shared<Background>(file->InitData);
auto reader = std::get<std::shared_ptr<LUS::BinaryReader>>(file->Reader); auto reader = std::get<std::shared_ptr<Ship::BinaryReader>>(file->Reader);
uint32_t dataSize = reader->ReadUInt32(); uint32_t dataSize = reader->ReadUInt32();

View File

@ -4,8 +4,8 @@
#include "resource/ResourceFactoryBinary.h" #include "resource/ResourceFactoryBinary.h"
namespace SOH { namespace SOH {
class ResourceFactoryBinaryBackgroundV0 : public LUS::ResourceFactoryBinary { class ResourceFactoryBinaryBackgroundV0 : public Ship::ResourceFactoryBinary {
public: public:
std::shared_ptr<LUS::IResource> ReadResource(std::shared_ptr<LUS::File> file) override; std::shared_ptr<Ship::IResource> ReadResource(std::shared_ptr<Ship::File> file) override;
}; };
} // namespace SOH } // namespace SOH

View File

@ -3,13 +3,13 @@
#include "spdlog/spdlog.h" #include "spdlog/spdlog.h"
namespace SOH { namespace SOH {
std::shared_ptr<LUS::IResource> ResourceFactoryBinaryCollisionHeaderV0::ReadResource(std::shared_ptr<LUS::File> file) { std::shared_ptr<Ship::IResource> ResourceFactoryBinaryCollisionHeaderV0::ReadResource(std::shared_ptr<Ship::File> file) {
if (!FileHasValidFormatAndReader(file)) { if (!FileHasValidFormatAndReader(file)) {
return nullptr; return nullptr;
} }
auto collisionHeader = std::make_shared<CollisionHeader>(file->InitData); auto collisionHeader = std::make_shared<CollisionHeader>(file->InitData);
auto reader = std::get<std::shared_ptr<LUS::BinaryReader>>(file->Reader); auto reader = std::get<std::shared_ptr<Ship::BinaryReader>>(file->Reader);
collisionHeader->collisionHeaderData.minBounds.x = reader->ReadInt16(); collisionHeader->collisionHeaderData.minBounds.x = reader->ReadInt16();
collisionHeader->collisionHeaderData.minBounds.y = reader->ReadInt16(); collisionHeader->collisionHeaderData.minBounds.y = reader->ReadInt16();
@ -123,7 +123,7 @@ std::shared_ptr<LUS::IResource> ResourceFactoryBinaryCollisionHeaderV0::ReadReso
return collisionHeader; return collisionHeader;
} }
std::shared_ptr<LUS::IResource> ResourceFactoryXMLCollisionHeaderV0::ReadResource(std::shared_ptr<LUS::File> file) { std::shared_ptr<Ship::IResource> ResourceFactoryXMLCollisionHeaderV0::ReadResource(std::shared_ptr<Ship::File> file) {
if (!FileHasValidFormatAndReader(file)) { if (!FileHasValidFormatAndReader(file)) {
return nullptr; return nullptr;
} }

View File

@ -5,13 +5,13 @@
#include "ResourceFactoryXML.h" #include "ResourceFactoryXML.h"
namespace SOH { namespace SOH {
class ResourceFactoryBinaryCollisionHeaderV0 : public LUS::ResourceFactoryBinary { class ResourceFactoryBinaryCollisionHeaderV0 : public Ship::ResourceFactoryBinary {
public: public:
std::shared_ptr<LUS::IResource> ReadResource(std::shared_ptr<LUS::File> file) override; std::shared_ptr<Ship::IResource> ReadResource(std::shared_ptr<Ship::File> file) override;
}; };
class ResourceFactoryXMLCollisionHeaderV0 : public LUS::ResourceFactoryXML { class ResourceFactoryXMLCollisionHeaderV0 : public Ship::ResourceFactoryXML {
public: public:
std::shared_ptr<LUS::IResource> ReadResource(std::shared_ptr<LUS::File> file) override; std::shared_ptr<Ship::IResource> ReadResource(std::shared_ptr<Ship::File> file) override;
}; };
} // namespace SOH } // namespace SOH

View File

@ -2,19 +2,19 @@
#include "soh/resource/type/Cutscene.h" #include "soh/resource/type/Cutscene.h"
#include "spdlog/spdlog.h" #include "spdlog/spdlog.h"
static inline uint32_t read_CMD_BBBB(std::shared_ptr<LUS::BinaryReader> reader) { static inline uint32_t read_CMD_BBBB(std::shared_ptr<Ship::BinaryReader> reader) {
uint32_t v; uint32_t v;
reader->Read((char*)&v, sizeof(uint32_t)); reader->Read((char*)&v, sizeof(uint32_t));
return v; return v;
} }
static inline uint32_t read_CMD_BBH(std::shared_ptr<LUS::BinaryReader> reader) { static inline uint32_t read_CMD_BBH(std::shared_ptr<Ship::BinaryReader> reader) {
uint32_t v; uint32_t v;
reader->Read((char*)&v, sizeof(uint32_t)); reader->Read((char*)&v, sizeof(uint32_t));
// swap the half word to match endianness // swap the half word to match endianness
if (reader->GetEndianness() != LUS::Endianness::Native) { if (reader->GetEndianness() != Ship::Endianness::Native) {
uint8_t* b = (uint8_t*)&v; uint8_t* b = (uint8_t*)&v;
uint8_t tmp = b[2]; uint8_t tmp = b[2];
b[2] = b[3]; b[2] = b[3];
@ -24,12 +24,12 @@ static inline uint32_t read_CMD_BBH(std::shared_ptr<LUS::BinaryReader> reader) {
return v; return v;
} }
static inline uint32_t read_CMD_HBB(std::shared_ptr<LUS::BinaryReader> reader) { static inline uint32_t read_CMD_HBB(std::shared_ptr<Ship::BinaryReader> reader) {
uint32_t v; uint32_t v;
reader->Read((char*)&v, sizeof(uint32_t)); reader->Read((char*)&v, sizeof(uint32_t));
// swap the half word to match endianness // swap the half word to match endianness
if (reader->GetEndianness() != LUS::Endianness::Native) { if (reader->GetEndianness() != Ship::Endianness::Native) {
uint8_t* b = (uint8_t*)&v; uint8_t* b = (uint8_t*)&v;
uint8_t tmp = b[0]; uint8_t tmp = b[0];
b[0] = b[1]; b[0] = b[1];
@ -39,12 +39,12 @@ static inline uint32_t read_CMD_HBB(std::shared_ptr<LUS::BinaryReader> reader) {
return v; return v;
} }
static inline uint32_t read_CMD_HH(std::shared_ptr<LUS::BinaryReader> reader) { static inline uint32_t read_CMD_HH(std::shared_ptr<Ship::BinaryReader> reader) {
uint32_t v; uint32_t v;
reader->Read((char*)&v, sizeof(uint32_t)); reader->Read((char*)&v, sizeof(uint32_t));
// swap the half words to match endianness // swap the half words to match endianness
if (reader->GetEndianness() != LUS::Endianness::Native) { if (reader->GetEndianness() != Ship::Endianness::Native) {
uint8_t* b = (uint8_t*)&v; uint8_t* b = (uint8_t*)&v;
uint8_t tmp = b[0]; uint8_t tmp = b[0];
b[0] = b[1]; b[0] = b[1];
@ -58,13 +58,13 @@ static inline uint32_t read_CMD_HH(std::shared_ptr<LUS::BinaryReader> reader) {
} }
namespace SOH { namespace SOH {
std::shared_ptr<LUS::IResource> ResourceFactoryBinaryCutsceneV0::ReadResource(std::shared_ptr<LUS::File> file) { std::shared_ptr<Ship::IResource> ResourceFactoryBinaryCutsceneV0::ReadResource(std::shared_ptr<Ship::File> file) {
if (!FileHasValidFormatAndReader(file)) { if (!FileHasValidFormatAndReader(file)) {
return nullptr; return nullptr;
} }
auto cutscene = std::make_shared<Cutscene>(file->InitData); auto cutscene = std::make_shared<Cutscene>(file->InitData);
auto reader = std::get<std::shared_ptr<LUS::BinaryReader>>(file->Reader); auto reader = std::get<std::shared_ptr<Ship::BinaryReader>>(file->Reader);
uint32_t numEntries = reader->ReadUInt32(); uint32_t numEntries = reader->ReadUInt32();
cutscene->commands.reserve(numEntries); cutscene->commands.reserve(numEntries);

View File

@ -4,8 +4,8 @@
#include "ResourceFactoryBinary.h" #include "ResourceFactoryBinary.h"
namespace SOH { namespace SOH {
class ResourceFactoryBinaryCutsceneV0 : public LUS::ResourceFactoryBinary { class ResourceFactoryBinaryCutsceneV0 : public Ship::ResourceFactoryBinary {
public: public:
std::shared_ptr<LUS::IResource> ReadResource(std::shared_ptr<LUS::File> file) override; std::shared_ptr<Ship::IResource> ReadResource(std::shared_ptr<Ship::File> file) override;
}; };
} // namespace SOH } // namespace SOH

View File

@ -3,13 +3,13 @@
#include "spdlog/spdlog.h" #include "spdlog/spdlog.h"
namespace SOH { namespace SOH {
std::shared_ptr<LUS::IResource> ResourceFactoryBinaryPathV0::ReadResource(std::shared_ptr<LUS::File> file) { std::shared_ptr<Ship::IResource> ResourceFactoryBinaryPathV0::ReadResource(std::shared_ptr<Ship::File> file) {
if (!FileHasValidFormatAndReader(file)) { if (!FileHasValidFormatAndReader(file)) {
return nullptr; return nullptr;
} }
auto path = std::make_shared<Path>(file->InitData); auto path = std::make_shared<Path>(file->InitData);
auto reader = std::get<std::shared_ptr<LUS::BinaryReader>>(file->Reader); auto reader = std::get<std::shared_ptr<Ship::BinaryReader>>(file->Reader);
path->numPaths = reader->ReadUInt32(); path->numPaths = reader->ReadUInt32();
path->paths.reserve(path->numPaths); path->paths.reserve(path->numPaths);

View File

@ -4,8 +4,8 @@
#include "ResourceFactoryBinary.h" #include "ResourceFactoryBinary.h"
namespace SOH { namespace SOH {
class ResourceFactoryBinaryPathV0 : public LUS::ResourceFactoryBinary { class ResourceFactoryBinaryPathV0 : public Ship::ResourceFactoryBinary {
public: public:
std::shared_ptr<LUS::IResource> ReadResource(std::shared_ptr<LUS::File> file) override; std::shared_ptr<Ship::IResource> ReadResource(std::shared_ptr<Ship::File> file) override;
}; };
} // namespace SOH } // namespace SOH

Some files were not shown because too many files have changed in this diff Show More