1515
1616using namespace UIWidgets;
1717
18+ static s32 heldInputs = 0 ;
19+
1820BenInputEditorWindow::~BenInputEditorWindow () {
1921}
2022
@@ -447,6 +449,9 @@ void BenInputEditorWindow::DrawButtonLine(const char* buttonName, uint8_t port,
447449 ImVec4 color = CHIP_COLOR_N64_GREY) {
448450 ImGui::NewLine ();
449451 ImGui::SameLine (SCALE_IMGUI_SIZE (32 .0f ));
452+ if (heldInputs & bitmask) {
453+ color.w = 0 .5f ;
454+ }
450455 DrawInputChip (buttonName, color);
451456 ImGui::SameLine (SCALE_IMGUI_SIZE (86 .0f ));
452457 for (auto id : mBitmaskToMappingIds [port][bitmask]) {
@@ -1201,65 +1206,6 @@ void BenInputEditorWindow::DrawGyroSection(uint8_t port) {
12011206 }
12021207}
12031208
1204- void BenInputEditorWindow::DrawModifierButtonsSection (uint8_t port) {
1205- DrawButtonLine (" M1" , port, BTN_CUSTOM_MODIFIER1);
1206- DrawButtonLine (" M2" , port, BTN_CUSTOM_MODIFIER2);
1207-
1208- ImGui::BeginDisabled (CVarGetInteger (" gSettings.DisableChanges" , 0 ));
1209- CVarCheckbox (" Enable Speed Modifiers" , " gSettings.SpeedModifier.Enable" ,
1210- CheckboxOptions ()
1211- .Color (THEME_COLOR)
1212- .Tooltip (" Hold the assigned button to change the maximum walking or swimming speed." ));
1213- if (CVarGetInteger (" gSettings.SpeedModifier.Enable" , 0 )) {
1214- UIWidgets::Spacer (5 );
1215- Ship::GuiWindow::BeginGroupPanel (" Speed Modifier" , ImGui::GetContentRegionAvail ());
1216- CVarCheckbox (" Toggle modifier instead of holding" , " gSettings.SpeedModifier.Toggle" ,
1217- CheckboxOptions ().Color (THEME_COLOR));
1218- Ship::GuiWindow::BeginGroupPanel (" Walk Modifier" , ImGui::GetContentRegionAvail ());
1219- CVarCheckbox (" Enable Walk Speed Modifier" , " gSettings.SpeedModifier.WalkEnable" ,
1220- CheckboxOptions ().Color (THEME_COLOR));
1221- CVarSliderFloat (" Walk Modifier 1: %.0f %%" , " gSettings.SpeedModifier.WalkMapping1" ,
1222- FloatSliderOptions ()
1223- .Color (THEME_COLOR)
1224- .IsPercentage ()
1225- .Min (0 .0f )
1226- .Max (15 .0f )
1227- .DefaultValue (1 .0f )
1228- .ShowAdjustmentButtons (true ));
1229- CVarSliderFloat (" Walk Modifier 2: %.0f %%" , " gSettings.SpeedModifier.WalkMapping2" ,
1230- FloatSliderOptions ()
1231- .Color (THEME_COLOR)
1232- .IsPercentage ()
1233- .Min (0 .0f )
1234- .Max (15 .0f )
1235- .DefaultValue (1 .0f )
1236- .ShowAdjustmentButtons (true ));
1237- Ship::GuiWindow::EndGroupPanel (0 );
1238- Ship::GuiWindow::BeginGroupPanel (" Swim Modifier" , ImGui::GetContentRegionAvail ());
1239- CVarCheckbox (" Enable Swim Speed Modifier" , " gSettings.SpeedModifier.SwimEnable" ,
1240- CheckboxOptions ().Color (THEME_COLOR));
1241- CVarSliderFloat (" Swim Modifier 1: %.0f %%" , " gSettings.SpeedModifier.SwimMapping1" ,
1242- FloatSliderOptions ()
1243- .Color (THEME_COLOR)
1244- .IsPercentage ()
1245- .Min (0 .0f )
1246- .Max (8 .75f )
1247- .DefaultValue (1 .0f )
1248- .ShowAdjustmentButtons (true ));
1249- CVarSliderFloat (" Swim Modifier 2: %.0f %%" , " gSettings.SpeedModifier.SwimMapping2" ,
1250- FloatSliderOptions ()
1251- .Color (THEME_COLOR)
1252- .IsPercentage ()
1253- .Min (0 .0f )
1254- .Max (8 .75f )
1255- .DefaultValue (1 .0f )
1256- .ShowAdjustmentButtons (true ));
1257- Ship::GuiWindow::EndGroupPanel (0 );
1258- Ship::GuiWindow::EndGroupPanel (0 );
1259- }
1260- ImGui::EndDisabled ();
1261- }
1262-
12631209const ImGuiTableFlags PANEL_TABLE_FLAGS = ImGuiTableFlags_BordersH | ImGuiTableFlags_BordersV;
12641210const ImGuiTableColumnFlags PANEL_TABLE_COLUMN_FLAGS =
12651211 ImGuiTableColumnFlags_IndentEnable | ImGuiTableColumnFlags_NoSort;
@@ -1440,6 +1386,13 @@ void BenInputEditorWindow::DrawPortTabContents(uint8_t portIndex) {
14401386 DrawButtonLine (StringHelper::Sprintf (" %s##DPad" , ICON_FA_ARROW_RIGHT).c_str (), portIndex, BTN_DRIGHT);
14411387 }
14421388
1389+ if (ImGui::CollapsingHeader (" Modifier Buttons" , NULL , ImGuiTreeNodeFlags_DefaultOpen)) {
1390+ ImGui::TextWrapped (" These can be bound to physical buttons and be selected for use in various\n enhancements, "
1391+ " but otherwise have no use on their own." );
1392+ DrawButtonLine (" M1" , portIndex, BTN_CUSTOM_MODIFIER1);
1393+ DrawButtonLine (" M2" , portIndex, BTN_CUSTOM_MODIFIER2);
1394+ }
1395+
14431396 if (ImGui::CollapsingHeader (" Analog Stick" , NULL , ImGuiTreeNodeFlags_DefaultOpen)) {
14441397 DrawStickSection (portIndex, Ship::LEFT);
14451398 }
@@ -1460,10 +1413,6 @@ void BenInputEditorWindow::DrawPortTabContents(uint8_t portIndex) {
14601413 DrawLEDSection (portIndex);
14611414 }
14621415
1463- if (ImGui::CollapsingHeader (" Modifier Buttons" )) {
1464- DrawModifierButtonsSection (portIndex);
1465- }
1466-
14671416 ImGui::PopStyleColor ();
14681417 ImGui::PopStyleColor ();
14691418 ImGui::PopStyleColor ();
@@ -1561,3 +1510,12 @@ void BenInputEditorWindow::OffsetMappingPopup() {
15611510 pos.x += HORIZONTAL_OFFSET;
15621511 ImGui::SetNextWindowPos (pos);
15631512}
1513+
1514+ static RegisterShipInitFunc initFunc (
1515+ []() {
1516+ COND_HOOK (OnGameStateMainStart, true , []() {
1517+ Input* input = CONTROLLER1 (gGameState );
1518+ heldInputs = input->cur .button ;
1519+ });
1520+ },
1521+ {});
0 commit comments