Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Controllers #3378

Merged
merged 31 commits into from
Nov 20, 2023
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
72637d2
lay some groundwork
briaguya-ai Nov 9, 2023
03bb469
use custom window (which is currently identical to the LUS window)
briaguya-ai Nov 9, 2023
7c08744
start making it shippy
briaguya-ai Nov 10, 2023
e35d96e
start moving stuff out of gamecontroleditor
briaguya-ai Nov 10, 2023
1485ab4
clean up shouldrumble
briaguya-ai Nov 10, 2023
712a872
include the other way
briaguya-ai Nov 10, 2023
97e4ea9
wii u
briaguya-ai Nov 10, 2023
614d464
latest lus main
briaguya-ai Nov 10, 2023
787f1e2
notch snap angle buttons
briaguya-ai Nov 11, 2023
41da4c3
buttons on all the sliders
briaguya-ai Nov 11, 2023
c333746
just use a hidden id
briaguya-ai Nov 11, 2023
144fda8
handle debug for port 2 and rename tabs so everything fits
briaguya-ai Nov 11, 2023
a61a671
button line buttons look better
briaguya-ai Nov 11, 2023
ed10d2b
padding fixed
briaguya-ai Nov 11, 2023
abbc78a
clang format
briaguya-ai Nov 11, 2023
d9dfbbd
bump to latest LUS main
briaguya-ai Nov 11, 2023
f3cee4a
big buttons
briaguya-ai Nov 11, 2023
c7fe584
just default the analog stick options to open for now
briaguya-ai Nov 11, 2023
0838a97
fix wii u build
briaguya-ai Nov 11, 2023
2802098
bonus: make it all scale-aware
briaguya-ai Nov 11, 2023
3cf16c4
clang format
briaguya-ai Nov 11, 2023
f5cd3d7
fix horizontal scrolling
briaguya-ai Nov 12, 2023
ce81a69
fix all +/- buttons
briaguya-ai Nov 12, 2023
df67df3
keyboard set defaults
briaguya-ai Nov 12, 2023
7cae851
axis threshold helper text
briaguya-ai Nov 12, 2023
caf8b25
bonus: test rumble button
briaguya-ai Nov 12, 2023
dea8414
clang format
briaguya-ai Nov 12, 2023
cd7352b
Merge remote-tracking branch 'origin/develop' into controllers
briaguya-ai Nov 15, 2023
d06140b
Merge branch 'develop' into controllers
briaguya-ai Nov 19, 2023
f604082
fix otrexporter submodule
briaguya-ai Nov 19, 2023
9639f82
bump to latest lus main
briaguya-ai Nov 20, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion libultraship
Submodule libultraship updated 133 files
76 changes: 6 additions & 70 deletions soh/soh/Enhancements/controls/GameControlEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
#include <Utils/StringHelper.h>
#include <libultraship/libultraship.h>

#include "macros.h"

#include "../../UIWidgets.hpp"

namespace GameControlEditor {
Expand Down Expand Up @@ -214,16 +216,6 @@ namespace GameControlEditor {
ImGui::EndTable();
}

// CurrentPort is indexed started at 1 here due to the Generic tab, instead of 0 like in InputEditorWindow
// Therefore CurrentPort - 1 must always be used inside this function instead of CurrentPort
void DrawCustomButtons() {
auto inputEditorWindow = std::reinterpret_pointer_cast<LUS::InputEditorWindow>(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetGuiWindow("Input Editor"));
inputEditorWindow->DrawControllerSelect(CurrentPort - 1);

inputEditorWindow->DrawButton("Modifier 1", BTN_MODIFIER1, CurrentPort - 1, &BtnReading);
inputEditorWindow->DrawButton("Modifier 2", BTN_MODIFIER2, CurrentPort - 1, &BtnReading);
}

void DrawCameraControlPanel(GameControlEditorWindow* window) {
if (!ImGui::CollapsingHeader("Camera Controls")) {
return;
Expand Down Expand Up @@ -329,70 +321,14 @@ namespace GameControlEditor {
window->EndGroupPanelPublic(0);
}

void DrawLEDControlPanel(GameControlEditorWindow* window) {
window->BeginGroupPanelPublic("LED Colors", ImGui::GetContentRegionAvail());
static const char* ledSources[] = { "Original Tunic Colors", "Cosmetics Tunic Colors", "Health Colors",
"Original Navi Targeting Colors", "Cosmetics Navi Targeting Colors", "Custom" };
UIWidgets::PaddedText("Source");
UIWidgets::EnhancementCombobox("gLedColorSource", ledSources, LED_SOURCE_TUNIC_ORIGINAL);
DrawHelpIcon("Health\n- Red when health critical (13-20% depending on max health)\n- Yellow when health < 40%. Green otherwise.\n\n" \
"Tunics: colors will mirror currently equipped tunic, whether original or the current values in Cosmetics Editor.\n\n" \
"Custom: single, solid color");
if (CVarGetInteger("gLedColorSource", 1) == LED_SOURCE_CUSTOM) {
UIWidgets::Spacer(3);
auto port1Color = CVarGetColor24("gLedPort1Color", { 255, 255, 255 });
ImVec4 colorVec = { port1Color.r / 255.0f, port1Color.g / 255.0f, port1Color.b / 255.0f, 1.0f };
if (ImGui::ColorEdit3("", (float*)&colorVec, ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_NoLabel)) {
Color_RGB8 color;
color.r = colorVec.x * 255.0;
color.g = colorVec.y * 255.0;
color.b = colorVec.z * 255.0;

CVarSetColor24("gLedPort1Color", color);
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
}
ImGui::SameLine();
ImGui::Text("Custom Color");
}
UIWidgets::PaddedEnhancementSliderFloat("Brightness: %d%%", "##LED_Brightness", "gLedBrightness",
0.0f, 1.0f, "", 1.0f, true, true);
DrawHelpIcon("Sets the brightness of controller LEDs. 0% brightness = LEDs off.");
UIWidgets::PaddedEnhancementCheckbox("Critical Health Override", "gLedCriticalOverride", true, true,
CVarGetInteger("gLedColorSource", LED_SOURCE_TUNIC_ORIGINAL) == LED_SOURCE_HEALTH, "Override redundant for health source.",
UIWidgets::CheckboxGraphics::Cross, true);
DrawHelpIcon("Shows red color when health is critical, otherwise displays according to color source.");
window->EndGroupPanelPublic(0);
}

void GameControlEditorWindow::DrawElement() {
ImGui::SetNextWindowSize(ImVec2(465, 430), ImGuiCond_FirstUseEver);
if (ImGui::Begin("Game Controls Configuration", &mIsVisible)) {
ImGui::BeginTabBar("##CustomControllers");
if (ImGui::BeginTabItem("Generic")) {
CurrentPort = 0;
ImGui::EndTabItem();
}

for (int i = 1; i <= 4; i++) {
if (ImGui::BeginTabItem(StringHelper::Sprintf("Port %d", i).c_str())) {
CurrentPort = i;
ImGui::EndTabItem();
}
}

ImGui::EndTabBar();

if (CurrentPort == 0) {
DrawOcarinaControlPanel(this);
DrawCameraControlPanel(this);
DrawDpadControlPanel(this);
DrawMiscControlPanel(this);
} else {
DrawCustomButtons();
if (CurrentPort == 1 && LUS::Context::GetInstance()->GetControlDeck()->GetDeviceFromPortIndex(0)->CanSetLed()) {
DrawLEDControlPanel(this);
}
}
DrawOcarinaControlPanel(this);
DrawCameraControlPanel(this);
DrawDpadControlPanel(this);
DrawMiscControlPanel(this);
}
ImGui::End();
}
Expand Down
Loading