add ability to use L2 button to navigate back to previous directory

This commit is contained in:
Chee Yee
2024-07-13 19:40:20 -07:00
parent 4ff119b34d
commit 294455c735
2 changed files with 28 additions and 2 deletions
+9
View File
@@ -84,6 +84,8 @@
#define BUTTON_RIGHT 0x00000020
#define BUTTON_UP 0x00000040
#define BUTTON_DOWN 0x00000080
#define BUTTON_C 0x00000100
#define BUTTON_D 0x00000200
static uint32_t previous_down = 0;
static int repeat_count = 0;
@@ -531,8 +533,15 @@ static void ImGui_ImplSDL2_UpdateGamepads()
down |= BUTTON_DOWN;
else if (SDL_GameControllerGetAxis(game_controller, SDL_CONTROLLER_AXIS_LEFTY) < -ANALOG_THRESHOLD)
down |= BUTTON_UP;
else if (SDL_GameControllerGetAxis(game_controller, SDL_CONTROLLER_AXIS_TRIGGERLEFT) > ANALOG_THRESHOLD)
down |= BUTTON_C;
else if (SDL_GameControllerGetAxis(game_controller, SDL_CONTROLLER_AXIS_TRIGGERRIGHT) > ANALOG_THRESHOLD)
down |= BUTTON_D;
uint32_t pressed = down & ~previous_down;
io.AddKeyEvent(ImGuiKey_C, (pressed & BUTTON_C) != 0);
io.AddKeyEvent(ImGuiKey_D, (pressed & BUTTON_D) != 0);
if (previous_down == down)
{
uint64_t delay = 300;
+19 -2
View File
@@ -467,9 +467,9 @@ namespace Windows
}
if (ImGui::IsItemHovered())
{
ImGui::SetNextWindowSize(ImVec2(450, 70));
ImGui::SetNextWindowSize(ImVec2(550, 85));
ImGui::BeginTooltip();
ImGui::PushTextWrapPos(ImGui::GetCursorPos().x + 440);
ImGui::PushTextWrapPos(ImGui::GetCursorPos().x + 540);
ImGui::Text("%s", lang_strings[STR_ENABLE_DISC_CACHE_MSG]);
ImGui::PopTextWrapPos();
ImGui::EndTooltip();
@@ -876,6 +876,23 @@ namespace Windows
ImGui::Columns(1);
ImGui::EndChild();
EndGroupPanel();
if (ImGui::IsKeyPressed(ImGuiKey_C) && !paused)
{
if (selected_browser & LOCAL_BROWSER)
{
selected_local_file = local_files[0];
selected_action = ACTION_CHANGE_LOCAL_DIRECTORY;
}
else if (selected_browser & REMOTE_BROWSER)
{
if (remoteclient != nullptr && remote_files.size() > 0)
{
selected_remote_file = remote_files[0];
selected_action = ACTION_CHANGE_REMOTE_DIRECTORY;
}
}
}
}
void StatusPanel()