From f04a0d21199f169efdf0a5853b9a66a0eaa84678 Mon Sep 17 00:00:00 2001 From: TakaRikka Date: Thu, 2 Apr 2026 03:11:58 -0700 Subject: [PATCH] add enhancements menu tab --- extern/aurora | 2 +- files.cmake | 2 + include/d/actor/d_a_alink.h | 7 --- src/d/actor/d_a_alink.cpp | 11 ++--- src/d/actor/d_a_alink_demo.inc | 12 ++++-- src/d/actor/d_a_alink_hvyboots.inc | 6 ++- src/d/d_camera.cpp | 4 +- src/d/d_kankyo.cpp | 2 +- src/dusk/imgui/ImGuiConsole.cpp | 1 + src/dusk/imgui/ImGuiConsole.hpp | 4 +- src/dusk/imgui/ImGuiMenuEnhancements.cpp | 55 ++++++++++++++++++++++++ src/dusk/imgui/ImGuiMenuEnhancements.hpp | 28 ++++++++++++ src/dusk/imgui/ImGuiMenuGame.cpp | 23 ++-------- src/dusk/imgui/ImGuiMenuGame.hpp | 8 +--- src/m_Do/m_Do_graphic.cpp | 2 +- 15 files changed, 116 insertions(+), 51 deletions(-) create mode 100644 src/dusk/imgui/ImGuiMenuEnhancements.cpp create mode 100644 src/dusk/imgui/ImGuiMenuEnhancements.hpp diff --git a/extern/aurora b/extern/aurora index 31ee02fe06..4c56dba0a4 160000 --- a/extern/aurora +++ b/extern/aurora @@ -1 +1 @@ -Subproject commit 31ee02fe0636d56a15fbe147e9e8673b84943a1e +Subproject commit 4c56dba0a401a936c19b3299d3d5545001af5642 diff --git a/files.cmake b/files.cmake index 2339f5cb02..4806722f12 100644 --- a/files.cmake +++ b/files.cmake @@ -1347,6 +1347,8 @@ set(DUSK_FILES src/dusk/imgui/ImGuiMenuGame.hpp src/dusk/imgui/ImGuiMenuTools.cpp src/dusk/imgui/ImGuiMenuTools.hpp + src/dusk/imgui/ImGuiMenuEnhancements.cpp + src/dusk/imgui/ImGuiMenuEnhancements.hpp src/dusk/imgui/ImGuiProcessOverlay.cpp src/dusk/imgui/ImGuiCameraOverlay.cpp src/dusk/imgui/ImGuiHeapOverlay.cpp diff --git a/include/d/actor/d_a_alink.h b/include/d/actor/d_a_alink.h index f2f96487d4..7c70ea54e5 100644 --- a/include/d/actor/d_a_alink.h +++ b/include/d/actor/d_a_alink.h @@ -8425,11 +8425,4 @@ inline daAlink_c* daAlink_getAlinkActorClass() { return (daAlink_c*)dComIfGp_getLinkPlayer(); } -#if TARGET_PC -namespace dusk::tweaks { - extern bool FastIronBoots; - extern bool InvertCameraXAxis; -} -#endif - #endif /* D_A_D_A_ALINK_H */ diff --git a/src/d/actor/d_a_alink.cpp b/src/d/actor/d_a_alink.cpp index fe8e016c7e..2c5bcf46cd 100644 --- a/src/d/actor/d_a_alink.cpp +++ b/src/d/actor/d_a_alink.cpp @@ -54,11 +54,6 @@ #include "res/Object/Alink.h" #include -#if TARGET_PC -bool dusk::tweaks::FastIronBoots = false; -bool dusk::tweaks::InvertCameraXAxis = false; -#endif - static int daAlink_Create(fopAc_ac_c* i_this); static int daAlink_Delete(daAlink_c* i_this); static int daAlink_Execute(daAlink_c* i_this); @@ -7515,7 +7510,7 @@ void daAlink_c::setBlendMoveAnime(f32 i_morf) { BOOL sp24 = checkEventRun(); BOOL sp20 = checkBootsMoveAnime(1); #if TARGET_PC - if (dusk::tweaks::FastIronBoots) { + if (dusk::ImGuiMenuEnhancements::m_enhancements.fastIronBoots) { sp20 = FALSE; } #endif @@ -9480,7 +9475,7 @@ void daAlink_c::setStickData() { mHeavySpeedMultiplier = mpHIO->mItem.mIronBoots.m.mInputFactor; } #if TARGET_PC - if (dusk::tweaks::FastIronBoots) { + if (dusk::ImGuiMenuEnhancements::m_enhancements.fastIronBoots) { mHeavySpeedMultiplier = 1.0f; } #endif @@ -9492,7 +9487,7 @@ void daAlink_c::setStickData() { mHeavySpeedMultiplier = mpHIO->mItem.mIronBoots.m.mWaterInputFactor; } #if TARGET_PC - if (dusk::tweaks::FastIronBoots) { + if (dusk::ImGuiMenuEnhancements::m_enhancements.fastIronBoots) { mHeavySpeedMultiplier = 1.0f; } #endif diff --git a/src/d/actor/d_a_alink_demo.inc b/src/d/actor/d_a_alink_demo.inc index 462c35d4e8..7acccbde13 100644 --- a/src/d/actor/d_a_alink_demo.inc +++ b/src/d/actor/d_a_alink_demo.inc @@ -23,6 +23,8 @@ #include "d/actor/d_a_npc_tkc.h" #include +#include "dusk/imgui/ImGuiMenuEnhancements.hpp" + BOOL daAlink_c::checkEventRun() const { return dComIfGp_event_runCheck() || checkPlayerDemoMode(); } @@ -4290,7 +4292,7 @@ static fopAc_ac_c* daAlink_searchPortal(fopAc_ac_c* i_actor, void* i_data) { } bool daAlink_c::checkAcceptWarp() { - #if VERSION != VERSION_WII_USA_R0 + #if TARGET_PC || VERSION != VERSION_WII_USA_R0 cM3dGPla plane; #endif @@ -4298,7 +4300,9 @@ bool daAlink_c::checkAcceptWarp() { * Fixed in versions above Wii USA Rev 0 by checking FLG0_WATER_IN_MOVE */ if (mLinkAcch.ChkGroundHit() && !checkModeFlg(MODE_PLAYER_FLY) - #if VERSION != VERSION_WII_USA_R0 + #if TARGET_PC + && (dusk::ImGuiMenuEnhancements::m_enhancements.restoreWiiGlitches || !checkNoResetFlg0(FLG0_WATER_IN_MOVE)) + #elif VERSION != VERSION_WII_USA_R0 && !checkNoResetFlg0(FLG0_WATER_IN_MOVE) #endif ) @@ -4307,7 +4311,9 @@ bool daAlink_c::checkAcceptWarp() { * Fixed in versions above Wii USA Rev 0 by checking getSlidePolygon */ if ( - #if VERSION != VERSION_WII_USA_R0 + #if TARGET_PC + (dusk::ImGuiMenuEnhancements::m_enhancements.restoreWiiGlitches || !getSlidePolygon(&plane)) && + #elif VERSION != VERSION_WII_USA_R0 !getSlidePolygon(&plane) && #endif !checkForestOldCentury() diff --git a/src/d/actor/d_a_alink_hvyboots.inc b/src/d/actor/d_a_alink_hvyboots.inc index 0edee19cf2..ed52ffcb36 100644 --- a/src/d/actor/d_a_alink_hvyboots.inc +++ b/src/d/actor/d_a_alink_hvyboots.inc @@ -6,6 +6,8 @@ #include "d/actor/d_a_alink.h" #include "d/actor/d_a_tag_magne.h" +#include "dusk/imgui/ImGuiMenuEnhancements.hpp" + void daAlink_c::concatMagneBootMtx() { if (checkMagneBootsOn()) { mDoMtx_stack_c::concat(mMagneBootMtx); @@ -348,7 +350,9 @@ int daAlink_c::procMagneBootsFly() { * Fixed in GCN and Wii KOR versions by adding a checkEquipHeavyBoots check */ if (dComIfG_Bgsp().ChkPolySafe(mPolyInfo2) - #if PLATFORM_GCN || VERSION == VERSION_WII_KOR + #if TARGET_PC + && (dusk::ImGuiMenuEnhancements::m_enhancements.restoreWiiGlitches || checkEquipHeavyBoots()) + #elif PLATFORM_GCN || VERSION == VERSION_WII_KOR && checkEquipHeavyBoots() #endif ) diff --git a/src/d/d_camera.cpp b/src/d/d_camera.cpp index 6e7e7b8f53..59ed1d2c11 100644 --- a/src/d/d_camera.cpp +++ b/src/d/d_camera.cpp @@ -28,6 +28,8 @@ #include "d/d_debug_camera.h" #endif +#include "dusk/imgui/ImGuiMenuEnhancements.hpp" + namespace { static f32 limitf(f32 value, f32 min, f32 max) { @@ -764,7 +766,7 @@ void dCamera_c::updatePad() { var_f31 = mDoCPd_c::getSubStickX3D(mPadID); #if TARGET_PC - if (dusk::tweaks::InvertCameraXAxis) { + if (dusk::ImGuiMenuEnhancements::m_enhancements.invertCameraXAxis) { var_f31 *= -1.0f; } #endif diff --git a/src/d/d_kankyo.cpp b/src/d/d_kankyo.cpp index e6d076c05f..a61219ffac 100644 --- a/src/d/d_kankyo.cpp +++ b/src/d/d_kankyo.cpp @@ -11381,7 +11381,7 @@ void dKy_bg_MAxx_proc(void* bg_model_p) { C_MTXLightPerspective(sp1D8, dComIfGd_getView()->fovy, camera_p->view.aspect, 1.0f, 1.0f, #if TARGET_PC - dusk::g_imguiConsole.isWaterProjectionOffsetEnabled() ? -0.01f : 0.0f, 0.0f); + dusk::ImGuiMenuEnhancements::m_enhancements.useWaterProjectionOffset ? -0.01f : 0.0f, 0.0f); #else -0.01f, 0.0f); #endif diff --git a/src/dusk/imgui/ImGuiConsole.cpp b/src/dusk/imgui/ImGuiConsole.cpp index 52bbef5f85..917b00b237 100644 --- a/src/dusk/imgui/ImGuiConsole.cpp +++ b/src/dusk/imgui/ImGuiConsole.cpp @@ -181,6 +181,7 @@ namespace dusk { if (ImGui::BeginMainMenuBar()) { m_menuGame.draw(); m_menuTools.draw(); + m_menuEnhancements.draw(); ImGui::SetCursorPosX(ImGui::GetWindowWidth() - 80.0f); ImGuiIO& io = ImGui::GetIO(); diff --git a/src/dusk/imgui/ImGuiConsole.hpp b/src/dusk/imgui/ImGuiConsole.hpp index c67bb2a885..2cb887f904 100644 --- a/src/dusk/imgui/ImGuiConsole.hpp +++ b/src/dusk/imgui/ImGuiConsole.hpp @@ -7,6 +7,7 @@ #include "imgui.h" #include "ImGuiMenuGame.hpp" #include "ImGuiMenuTools.hpp" +#include "ImGuiMenuEnhancements.hpp" namespace dusk { class ImGuiConsole { @@ -14,8 +15,6 @@ namespace dusk { ImGuiConsole(); void draw(); - bool isBloomEnabled() { return m_menuGame.isBloomEnabled(); } - bool isWaterProjectionOffsetEnabled() { return m_menuGame.isWaterProjectionOffsetEnabled(); } ImGuiMenuTools::CollisionViewSettings& getCollisionViewSettings() { return m_menuTools.getCollisionViewSettings(); } static bool CheckMenuViewToggle(ImGuiKey key, bool& active); @@ -25,6 +24,7 @@ namespace dusk { ImGuiMenuGame m_menuGame; ImGuiMenuTools m_menuTools; + ImGuiMenuEnhancements m_menuEnhancements; }; extern ImGuiConsole g_imguiConsole; diff --git a/src/dusk/imgui/ImGuiMenuEnhancements.cpp b/src/dusk/imgui/ImGuiMenuEnhancements.cpp new file mode 100644 index 0000000000..c2fb060f5b --- /dev/null +++ b/src/dusk/imgui/ImGuiMenuEnhancements.cpp @@ -0,0 +1,55 @@ +#include "fmt/format.h" +#include "imgui.h" +#include "aurora/gfx.h" + +#include "ImGuiConsole.hpp" +#include "ImGuiMenuEnhancements.hpp" +#include + +namespace dusk { + EnhancementsSettings ImGuiMenuEnhancements::m_enhancements = { + .fastIronBoots = false, + .invertCameraXAxis = false, + .restoreWiiGlitches = false, + .enableBloom = true, + .useWaterProjectionOffset = false, + }; + + ImGuiMenuEnhancements::ImGuiMenuEnhancements() {} + + void ImGuiMenuEnhancements::draw() { + if (ImGui::BeginMenu("Enhancements")) { + if (ImGui::BeginMenu("Quality of Life")) { + ImGui::Checkbox("Fast Iron Boots", &m_enhancements.fastIronBoots); + ImGui::Checkbox("Invert Camera X Axis", &m_enhancements.invertCameraXAxis); + ImGui::EndMenu(); + } + + if (ImGui::BeginMenu("Graphics")) { + ImGui::Checkbox("Native Bloom", &m_enhancements.enableBloom); + ImGui::Checkbox("Water Projection Offset", &m_enhancements.useWaterProjectionOffset); + if (ImGui::IsItemHovered()) { + ImGui::SetTooltip("Adds GC-specific -0.01 transS offset\n" + "that causes ~6px ghost artifacts in water reflections"); + } + + ImGui::EndMenu(); + } + + if (ImGui::BeginMenu("Restorations")) { + ImGui::Checkbox("Restore Wii 1.0 Glitches", &m_enhancements.restoreWiiGlitches); + if (ImGui::IsItemHovered()) { + ImGui::SetTooltip("Restores patched glitches from Wii USA 1.0, the first released version"); + } + + ImGui::EndMenu(); + } + + if (ImGui::BeginMenu("Cheats")) { + ImGui::EndMenu(); + } + + ImGui::EndMenu(); + } + } +} diff --git a/src/dusk/imgui/ImGuiMenuEnhancements.hpp b/src/dusk/imgui/ImGuiMenuEnhancements.hpp new file mode 100644 index 0000000000..16ef0a1983 --- /dev/null +++ b/src/dusk/imgui/ImGuiMenuEnhancements.hpp @@ -0,0 +1,28 @@ +#ifndef DUSK_IMGUI_MENUENHANCEMENTS_HPP +#define DUSK_IMGUI_MENUENHANCEMENTS_HPP + +#include +#include +#include + +#include "imgui.h" + +namespace dusk { + struct EnhancementsSettings { + bool fastIronBoots; + bool invertCameraXAxis; + bool restoreWiiGlitches; + bool enableBloom; + bool useWaterProjectionOffset; + }; + + class ImGuiMenuEnhancements { + public: + ImGuiMenuEnhancements(); + void draw(); + + static EnhancementsSettings m_enhancements; + }; +} + +#endif // DUSK_IMGUI_MENUENHANCEMENTS_HPP diff --git a/src/dusk/imgui/ImGuiMenuGame.cpp b/src/dusk/imgui/ImGuiMenuGame.cpp index e8f260ba4c..00b287cc41 100644 --- a/src/dusk/imgui/ImGuiMenuGame.cpp +++ b/src/dusk/imgui/ImGuiMenuGame.cpp @@ -25,17 +25,8 @@ namespace dusk { if (ImGui::BeginMenu("Graphics")) { if (ImGui::MenuItem("Toggle Fullscreen", "F11")) { - m_graphicsSettings.m_fullscreen = !m_graphicsSettings.m_fullscreen; - VISetWindowFullscreen(m_graphicsSettings.m_fullscreen); - } - - ImGui::Separator(); - - ImGui::Checkbox("Native Bloom", &m_graphicsSettings.m_enableBloom); - ImGui::Checkbox("Water Projection Offset", &m_graphicsSettings.m_waterProjectionOffset); - if (ImGui::IsItemHovered()) { - ImGui::SetTooltip("Adds GC-specific -0.01 transS offset\n" - "that causes ~6px ghost artifacts in water reflections"); + m_fullscreen = !m_fullscreen; + VISetWindowFullscreen(m_fullscreen); } ImGui::EndMenu(); @@ -76,12 +67,6 @@ namespace dusk { ImGui::EndMenu(); } - if (ImGui::BeginMenu("Tweaks")) { - ImGui::MenuItem("Fast iron boots", nullptr, &tweaks::FastIronBoots); - ImGui::MenuItem("Invert Camera X Axis", nullptr, &tweaks::InvertCameraXAxis); - ImGui::EndMenu(); - } - ImGui::EndMenu(); } @@ -93,8 +78,8 @@ namespace dusk { } if (ImGui::IsKeyPressed(ImGuiKey_F11)) { - m_graphicsSettings.m_fullscreen = !m_graphicsSettings.m_fullscreen; - VISetWindowFullscreen(m_graphicsSettings.m_fullscreen); + m_fullscreen = !m_fullscreen; + VISetWindowFullscreen(m_fullscreen); } } diff --git a/src/dusk/imgui/ImGuiMenuGame.hpp b/src/dusk/imgui/ImGuiMenuGame.hpp index ad6a7140ec..7df0a00973 100644 --- a/src/dusk/imgui/ImGuiMenuGame.hpp +++ b/src/dusk/imgui/ImGuiMenuGame.hpp @@ -12,8 +12,6 @@ namespace dusk { public: ImGuiMenuGame(); void draw(); - bool isBloomEnabled() { return m_graphicsSettings.m_enableBloom; } - bool isWaterProjectionOffsetEnabled() { return m_graphicsSettings.m_waterProjectionOffset; } void windowInputViewer(); void windowControllerConfig(); @@ -35,11 +33,7 @@ namespace dusk { int m_pendingPort = -1; } m_controllerConfig; - struct { - bool m_enableBloom = 1; - bool m_waterProjectionOffset = false; - bool m_fullscreen = false; - } m_graphicsSettings; + bool m_fullscreen = false; bool m_showControllerConfig = false; diff --git a/src/m_Do/m_Do_graphic.cpp b/src/m_Do/m_Do_graphic.cpp index 5c321f207f..8afbddcd2c 100644 --- a/src/m_Do/m_Do_graphic.cpp +++ b/src/m_Do/m_Do_graphic.cpp @@ -1166,7 +1166,7 @@ void mDoGph_gInf_c::bloom_c::remove() { void mDoGph_gInf_c::bloom_c::draw() { #if TARGET_PC - if (!dusk::g_imguiConsole.isBloomEnabled()) { + if (!dusk::ImGuiMenuEnhancements::m_enhancements.enableBloom) { return; } #endif