summaryrefslogtreecommitdiff
path: root/mm/2s2h/BenGui/InputViewer.cpp
diff options
context:
space:
mode:
authorJameriquiah <42100286+Jameriquiah@users.noreply.github.com>2026-07-21 22:22:35 -0400
committerGitHub <noreply@github.com>2026-07-21 22:22:35 -0400
commit65fb1b6e3cc49780057208f4050a160d1a4bdfc7 (patch)
treec0f2434ea2ee47c51cbb47ede559d4d5b318ec23 /mm/2s2h/BenGui/InputViewer.cpp
parentf86e04b4d5492906718aa7bacf5b92d55756006c (diff)
Bump LUS to port-maintenance (#1801)
* bump lus to port-maintenance * clang * remove redundant cast * clang again * update lus commit
Diffstat (limited to 'mm/2s2h/BenGui/InputViewer.cpp')
-rw-r--r--mm/2s2h/BenGui/InputViewer.cpp187
1 files changed, 100 insertions, 87 deletions
diff --git a/mm/2s2h/BenGui/InputViewer.cpp b/mm/2s2h/BenGui/InputViewer.cpp
index c77157f53..7db978c3b 100644
--- a/mm/2s2h/BenGui/InputViewer.cpp
+++ b/mm/2s2h/BenGui/InputViewer.cpp
@@ -11,6 +11,8 @@
#include "2s2h/BenGui/UIWidgets.hpp"
#include "2s2h/BenGui/BenGui.hpp"
+#include <fast/Fast3dGui.h>
+
using namespace UIWidgets;
// Text colors
@@ -42,15 +44,17 @@ void InputViewer::RenderButton(std::string btnTexture, std::string btnOutlineTex
// Render Outline based on settings
if (outlineMode == BUTTON_OUTLINE_ALWAYS_SHOWN || (outlineMode == BUTTON_OUTLINE_NOT_PRESSED && !state) ||
(outlineMode == BUTTON_OUTLINE_PRESSED && state)) {
- ImGui::Image(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(btnOutlineTexture), size,
- ImVec2(0, 0), ImVec2(1.0f, 1.0f));
+ ImGui::Image(std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->GetTextureByName(btnOutlineTexture),
+ size, ImVec2(0, 0), ImVec2(1.0f, 1.0f));
}
// Render button if pressed
if (state) {
ImGui::SetCursorPos(pos);
ImGui::SetNextItemAllowOverlap();
- ImGui::Image(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(btnTexture), size,
- ImVec2(0, 0), ImVec2(1.0f, 1.0f));
+ ImGui::Image(std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->GetTextureByName(btnTexture),
+ size, ImVec2(0, 0), ImVec2(1.0f, 1.0f));
}
}
@@ -67,80 +71,80 @@ void InputViewer::DrawElement() {
if (CVarGetInteger("gWindows.InputViewer", 0)) {
static bool sButtonTexturesLoaded = false;
if (!sButtonTexturesLoaded) {
- Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage(
- "Input-Viewer-Background", "textures/buttons/InputViewerBackground.png");
- Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("A-Btn",
- "textures/buttons/ABtn.png");
- Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("B-Btn",
- "textures/buttons/BBtn.png");
- Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("L-Btn",
- "textures/buttons/LBtn.png");
- Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("R-Btn",
- "textures/buttons/RBtn.png");
- Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("Z-Btn",
- "textures/buttons/ZBtn.png");
- Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage(
- "Start-Btn", "textures/buttons/StartBtn.png");
- Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("C-Left",
- "textures/buttons/CLeft.png");
- Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("C-Right",
- "textures/buttons/CRight.png");
- Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("C-Up",
- "textures/buttons/CUp.png");
- Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("C-Down",
- "textures/buttons/CDown.png");
- Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage(
- "Analog-Stick", "textures/buttons/AnalogStick.png");
- Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage(
- "Dpad-Left", "textures/buttons/DPadLeft.png");
- Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage(
- "Dpad-Right", "textures/buttons/DPadRight.png");
- Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("Dpad-Up",
- "textures/buttons/DPadUp.png");
- Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage(
- "Dpad-Down", "textures/buttons/DPadDown.png");
- Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("Modifier-1",
- "textures/buttons/Mod1.png");
- Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("Modifier-2",
- "textures/buttons/Mod2.png");
- Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage(
- "Right-Stick", "textures/buttons/RightStick.png");
- Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage(
- "A-Btn Outline", "textures/buttons/ABtnOutline.png");
- Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage(
- "B-Btn Outline", "textures/buttons/BBtnOutline.png");
- Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage(
- "L-Btn Outline", "textures/buttons/LBtnOutline.png");
- Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage(
- "R-Btn Outline", "textures/buttons/RBtnOutline.png");
- Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage(
- "Z-Btn Outline", "textures/buttons/ZBtnOutline.png");
- Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage(
- "Start-Btn Outline", "textures/buttons/StartBtnOutline.png");
- Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage(
- "C-Left Outline", "textures/buttons/CLeftOutline.png");
- Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage(
- "C-Right Outline", "textures/buttons/CRightOutline.png");
- Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage(
- "C-Up Outline", "textures/buttons/CUpOutline.png");
- Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage(
- "C-Down Outline", "textures/buttons/CDownOutline.png");
- Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage(
- "Analog-Stick Outline", "textures/buttons/AnalogStickOutline.png");
- Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage(
- "Dpad-Left Outline", "textures/buttons/DPadLeftOutline.png");
- Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage(
- "Dpad-Right Outline", "textures/buttons/DPadRightOutline.png");
- Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage(
- "Dpad-Up Outline", "textures/buttons/DPadUpOutline.png");
- Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage(
- "Dpad-Down Outline", "textures/buttons/DPadDownOutline.png");
- Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage(
- "Modifier-1 Outline", "textures/buttons/Mod1Outline.png");
- Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage(
- "Modifier-2 Outline", "textures/buttons/Mod2Outline.png");
- Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage(
- "Right-Stick Outline", "textures/buttons/RightStickOutline.png");
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->LoadTextureFromRawImage("Input-Viewer-Background", "textures/buttons/InputViewerBackground.png");
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->LoadTextureFromRawImage("A-Btn", "textures/buttons/ABtn.png");
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->LoadTextureFromRawImage("B-Btn", "textures/buttons/BBtn.png");
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->LoadTextureFromRawImage("L-Btn", "textures/buttons/LBtn.png");
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->LoadTextureFromRawImage("R-Btn", "textures/buttons/RBtn.png");
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->LoadTextureFromRawImage("Z-Btn", "textures/buttons/ZBtn.png");
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->LoadTextureFromRawImage("Start-Btn", "textures/buttons/StartBtn.png");
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->LoadTextureFromRawImage("C-Left", "textures/buttons/CLeft.png");
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->LoadTextureFromRawImage("C-Right", "textures/buttons/CRight.png");
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->LoadTextureFromRawImage("C-Up", "textures/buttons/CUp.png");
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->LoadTextureFromRawImage("C-Down", "textures/buttons/CDown.png");
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->LoadTextureFromRawImage("Analog-Stick", "textures/buttons/AnalogStick.png");
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->LoadTextureFromRawImage("Dpad-Left", "textures/buttons/DPadLeft.png");
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->LoadTextureFromRawImage("Dpad-Right", "textures/buttons/DPadRight.png");
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->LoadTextureFromRawImage("Dpad-Up", "textures/buttons/DPadUp.png");
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->LoadTextureFromRawImage("Dpad-Down", "textures/buttons/DPadDown.png");
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->LoadTextureFromRawImage("Modifier-1", "textures/buttons/Mod1.png");
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->LoadTextureFromRawImage("Modifier-2", "textures/buttons/Mod2.png");
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->LoadTextureFromRawImage("Right-Stick", "textures/buttons/RightStick.png");
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->LoadTextureFromRawImage("A-Btn Outline", "textures/buttons/ABtnOutline.png");
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->LoadTextureFromRawImage("B-Btn Outline", "textures/buttons/BBtnOutline.png");
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->LoadTextureFromRawImage("L-Btn Outline", "textures/buttons/LBtnOutline.png");
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->LoadTextureFromRawImage("R-Btn Outline", "textures/buttons/RBtnOutline.png");
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->LoadTextureFromRawImage("Z-Btn Outline", "textures/buttons/ZBtnOutline.png");
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->LoadTextureFromRawImage("Start-Btn Outline", "textures/buttons/StartBtnOutline.png");
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->LoadTextureFromRawImage("C-Left Outline", "textures/buttons/CLeftOutline.png");
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->LoadTextureFromRawImage("C-Right Outline", "textures/buttons/CRightOutline.png");
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->LoadTextureFromRawImage("C-Up Outline", "textures/buttons/CUpOutline.png");
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->LoadTextureFromRawImage("C-Down Outline", "textures/buttons/CDownOutline.png");
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->LoadTextureFromRawImage("Analog-Stick Outline", "textures/buttons/AnalogStickOutline.png");
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->LoadTextureFromRawImage("Dpad-Left Outline", "textures/buttons/DPadLeftOutline.png");
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->LoadTextureFromRawImage("Dpad-Right Outline", "textures/buttons/DPadRightOutline.png");
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->LoadTextureFromRawImage("Dpad-Up Outline", "textures/buttons/DPadUpOutline.png");
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->LoadTextureFromRawImage("Dpad-Down Outline", "textures/buttons/DPadDownOutline.png");
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->LoadTextureFromRawImage("Modifier-1 Outline", "textures/buttons/Mod1Outline.png");
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->LoadTextureFromRawImage("Modifier-2 Outline", "textures/buttons/Mod2Outline.png");
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->LoadTextureFromRawImage("Right-Stick Outline", "textures/buttons/RightStickOutline.png");
sButtonTexturesLoaded = true;
}
@@ -158,7 +162,9 @@ void InputViewer::DrawElement() {
CVarGetInteger(CVAR_INPUT_VIEWER("ButtonOutlineMode"), BUTTON_OUTLINE_NOT_PRESSED);
const bool useGlobalOutlineMode = CVarGetInteger(CVAR_INPUT_VIEWER("UseGlobalButtonOutlineMode"), 1);
- ImVec2 bgSize = Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureSize("Input-Viewer-Background");
+ ImVec2 bgSize =
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->GetTextureSize("Input-Viewer-Background");
ImVec2 scaledBGSize = ImVec2(bgSize.x * scale, bgSize.y * scale);
float maxScale = std::max(CVarGetFloat(CVAR_INPUT_VIEWER("LeftAnalogAngles.Scale"), 1.0f),
@@ -192,7 +198,7 @@ void InputViewer::DrawElement() {
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(0.0f, 0.0f));
OSContPad* pads =
- std::dynamic_pointer_cast<LUS::ControlDeck>(Ship::Context::GetInstance()->GetControlDeck())->GetPads();
+ std::dynamic_pointer_cast<LUS::ControlDeck>(Ship::Context::GetRawInstance()->GetControlDeck())->GetPads();
OSContPad pad = pads[0];
@@ -212,7 +218,8 @@ void InputViewer::DrawElement() {
ImGui::SetNextItemAllowOverlap();
// Background
ImGui::Image(
- Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName("Input-Viewer-Background"),
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->GetTextureByName("Input-Viewer-Background"),
scaledBGSize, ImVec2(0, 0), ImVec2(1.0f, 1.0f));
}
@@ -363,7 +370,8 @@ void InputViewer::DrawElement() {
ImGui::SetNextItemAllowOverlap();
ImGui::SetCursorPos(aPos);
ImGui::Image(
- Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName("Analog-Stick Outline"),
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->GetTextureByName("Analog-Stick Outline"),
scaledBGSize, ImVec2(0, 0), ImVec2(1.0f, 1.0f));
}
const int analogStickMode =
@@ -374,8 +382,10 @@ void InputViewer::DrawElement() {
ImGui::SetCursorPos(
ImVec2(aPos.x + maxStickDistance * ((float)(pad.stick_x) / MAX_AXIS_RANGE) * scale,
aPos.y - maxStickDistance * ((float)(pad.stick_y) / MAX_AXIS_RANGE) * scale));
- ImGui::Image(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName("Analog-Stick"),
- scaledBGSize, ImVec2(0, 0), ImVec2(1.0f, 1.0f));
+ ImGui::Image(
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->GetTextureByName("Analog-Stick"),
+ scaledBGSize, ImVec2(0, 0), ImVec2(1.0f, 1.0f));
}
// Right Stick
@@ -387,7 +397,8 @@ void InputViewer::DrawElement() {
ImGui::SetNextItemAllowOverlap();
ImGui::SetCursorPos(aPos);
ImGui::Image(
- Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName("Right-Stick Outline"),
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->GetTextureByName("Right-Stick Outline"),
scaledBGSize, ImVec2(0, 0), ImVec2(1.0f, 1.0f));
}
const int rightStickMode =
@@ -398,8 +409,10 @@ void InputViewer::DrawElement() {
ImGui::SetCursorPos(
ImVec2(aPos.x + maxRightStickDistance * ((float)(pad.right_stick_x) / MAX_AXIS_RANGE) * scale,
aPos.y - maxRightStickDistance * ((float)(pad.right_stick_y) / MAX_AXIS_RANGE) * scale));
- ImGui::Image(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName("Right-Stick"),
- scaledBGSize, ImVec2(0, 0), ImVec2(1.0f, 1.0f));
+ ImGui::Image(
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->GetTextureByName("Right-Stick"),
+ scaledBGSize, ImVec2(0, 0), ImVec2(1.0f, 1.0f));
}
// Left Analog stick angle text