only toggle menu with controller when controller nav enabled (#1043)

This commit is contained in:
briaguya 2022-08-19 09:46:11 -04:00 committed by GitHub
parent 9bc6aac81e
commit 0971b9aa78
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 18 deletions

View File

@ -73,12 +73,7 @@ namespace Ship {
}
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);
#endif
for (size_t i = 0; i < virtualDevices.size(); i++) {
const std::shared_ptr<Controller> backend = physicalDevices[virtualDevices[i]];

View File

@ -484,12 +484,7 @@ namespace SohImGui {
io->ConfigFlags |= ImGuiConfigFlags_ViewportsEnable;
}
#ifdef __SWITCH__
bool enableControllerNavigation = true;
#else
bool enableControllerNavigation = CVar_GetS32("gControlNav", 0);
#endif
if (enableControllerNavigation && CVar_GetS32("gOpenMenuBar", 0)) {
if (CVar_GetS32("gControlNav", 0) && CVar_GetS32("gOpenMenuBar", 0)) {
io->ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad | ImGuiConfigFlags_NavEnableKeyboard;
} else {
io->ConfigFlags &= ~ImGuiConfigFlags_NavEnableGamepad;
@ -921,19 +916,15 @@ namespace SohImGui {
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);
CVar_SetS32("gOpenMenuBar", !menu_bar);
needs_save = true;
GlobalCtx2::GetInstance()->GetWindow()->SetMenuBar(menu_bar);
ShowCursor(menu_bar, Dialogues::dMenubar);
GlobalCtx2::GetInstance()->GetWindow()->GetControlDeck()->SaveControllerSettings();
#ifdef __SWITCH__
bool enableControllerNavigation = true;
#else
bool enableControllerNavigation = CVar_GetS32("gControlNav", 0);
#endif
if (enableControllerNavigation && CVar_GetS32("gOpenMenuBar", 0)) {
if (CVar_GetS32("gControlNav", 0) && CVar_GetS32("gOpenMenuBar", 0)) {
io->ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad | ImGuiConfigFlags_NavEnableKeyboard;
} else {
io->ConfigFlags &= ~ImGuiConfigFlags_NavEnableGamepad;

View File

@ -25,6 +25,9 @@ void BootCommands_Init()
CVar_RegisterS32("gDebugEnabled", 0);
CVar_RegisterS32("gLanguages", 0); //0 = English / 1 = German / 2 = French
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)