only toggle menu with controller when controller nav enabled (#1043)
This commit is contained in:
parent
9bc6aac81e
commit
0971b9aa78
|
@ -73,12 +73,7 @@ namespace Ship {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ControlDeck::WriteToPad(OSContPad* pad) const {
|
void ControlDeck::WriteToPad(OSContPad* pad) const {
|
||||||
|
|
||||||
#ifdef __SWITCH__
|
|
||||||
bool shouldBlockGameInput = CVar_GetS32("gOpenMenuBar", 0);
|
|
||||||
#else
|
|
||||||
bool shouldBlockGameInput = CVar_GetS32("gOpenMenuBar", 0) && CVar_GetS32("gControlNav", 0);
|
bool shouldBlockGameInput = CVar_GetS32("gOpenMenuBar", 0) && CVar_GetS32("gControlNav", 0);
|
||||||
#endif
|
|
||||||
|
|
||||||
for (size_t i = 0; i < virtualDevices.size(); i++) {
|
for (size_t i = 0; i < virtualDevices.size(); i++) {
|
||||||
const std::shared_ptr<Controller> backend = physicalDevices[virtualDevices[i]];
|
const std::shared_ptr<Controller> backend = physicalDevices[virtualDevices[i]];
|
||||||
|
|
|
@ -484,12 +484,7 @@ namespace SohImGui {
|
||||||
io->ConfigFlags |= ImGuiConfigFlags_ViewportsEnable;
|
io->ConfigFlags |= ImGuiConfigFlags_ViewportsEnable;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __SWITCH__
|
if (CVar_GetS32("gControlNav", 0) && CVar_GetS32("gOpenMenuBar", 0)) {
|
||||||
bool enableControllerNavigation = true;
|
|
||||||
#else
|
|
||||||
bool enableControllerNavigation = CVar_GetS32("gControlNav", 0);
|
|
||||||
#endif
|
|
||||||
if (enableControllerNavigation && CVar_GetS32("gOpenMenuBar", 0)) {
|
|
||||||
io->ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad | ImGuiConfigFlags_NavEnableKeyboard;
|
io->ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad | ImGuiConfigFlags_NavEnableKeyboard;
|
||||||
} else {
|
} else {
|
||||||
io->ConfigFlags &= ~ImGuiConfigFlags_NavEnableGamepad;
|
io->ConfigFlags &= ~ImGuiConfigFlags_NavEnableGamepad;
|
||||||
|
@ -921,19 +916,15 @@ namespace SohImGui {
|
||||||
|
|
||||||
ImGui::DockSpace(dockId, ImVec2(0.0f, 0.0f), ImGuiDockNodeFlags_None | ImGuiDockNodeFlags_NoDockingInCentralNode);
|
ImGui::DockSpace(dockId, ImVec2(0.0f, 0.0f), ImGuiDockNodeFlags_None | ImGuiDockNodeFlags_NoDockingInCentralNode);
|
||||||
|
|
||||||
if (ImGui::IsKeyPressed(TOGGLE_BTN) || ImGui::IsKeyPressed(TOGGLE_PAD_BTN)) {
|
if (ImGui::IsKeyPressed(TOGGLE_BTN) ||
|
||||||
|
(ImGui::IsKeyPressed(TOGGLE_PAD_BTN) && CVar_GetS32("gControlNav", 0))) {
|
||||||
bool menu_bar = CVar_GetS32("gOpenMenuBar", 0);
|
bool menu_bar = CVar_GetS32("gOpenMenuBar", 0);
|
||||||
CVar_SetS32("gOpenMenuBar", !menu_bar);
|
CVar_SetS32("gOpenMenuBar", !menu_bar);
|
||||||
needs_save = true;
|
needs_save = true;
|
||||||
GlobalCtx2::GetInstance()->GetWindow()->SetMenuBar(menu_bar);
|
GlobalCtx2::GetInstance()->GetWindow()->SetMenuBar(menu_bar);
|
||||||
ShowCursor(menu_bar, Dialogues::dMenubar);
|
ShowCursor(menu_bar, Dialogues::dMenubar);
|
||||||
GlobalCtx2::GetInstance()->GetWindow()->GetControlDeck()->SaveControllerSettings();
|
GlobalCtx2::GetInstance()->GetWindow()->GetControlDeck()->SaveControllerSettings();
|
||||||
#ifdef __SWITCH__
|
if (CVar_GetS32("gControlNav", 0) && CVar_GetS32("gOpenMenuBar", 0)) {
|
||||||
bool enableControllerNavigation = true;
|
|
||||||
#else
|
|
||||||
bool enableControllerNavigation = CVar_GetS32("gControlNav", 0);
|
|
||||||
#endif
|
|
||||||
if (enableControllerNavigation && CVar_GetS32("gOpenMenuBar", 0)) {
|
|
||||||
io->ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad | ImGuiConfigFlags_NavEnableKeyboard;
|
io->ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad | ImGuiConfigFlags_NavEnableKeyboard;
|
||||||
} else {
|
} else {
|
||||||
io->ConfigFlags &= ~ImGuiConfigFlags_NavEnableGamepad;
|
io->ConfigFlags &= ~ImGuiConfigFlags_NavEnableGamepad;
|
||||||
|
|
|
@ -25,6 +25,9 @@ void BootCommands_Init()
|
||||||
CVar_RegisterS32("gDebugEnabled", 0);
|
CVar_RegisterS32("gDebugEnabled", 0);
|
||||||
CVar_RegisterS32("gLanguages", 0); //0 = English / 1 = German / 2 = French
|
CVar_RegisterS32("gLanguages", 0); //0 = English / 1 = German / 2 = French
|
||||||
CVar_RegisterS32("gHudColors", 1); //0 = N64 / 1 = NGC / 2 = Custom
|
CVar_RegisterS32("gHudColors", 1); //0 = N64 / 1 = NGC / 2 = Custom
|
||||||
|
#ifdef __SWITCH__
|
||||||
|
CVar_RegisterS32("gControlNav", 1); // always enable controller nav on switch
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
//void BootCommands_ParseBootArgs(char* str)
|
//void BootCommands_ParseBootArgs(char* str)
|
||||||
|
|
Loading…
Reference in New Issue