| 905 | } |
| 906 | |
| 907 | void MainScreen::handleEvents(const InputState& input) |
| 908 | { |
| 909 | const u64 kheld = input.kHeld; |
| 910 | const u64 kdown = input.kDown; |
| 911 | |
| 912 | // handle rail save-kind button touches |
| 913 | for (int k = 0; k < 4; k++) { |
| 914 | if (filterButtons[k]->released()) { |
| 915 | setSaveTypeFilter(static_cast<saveTypeFilter_t>(k)); |
| 916 | sidebarFocused = false; |
| 917 | break; |
| 918 | } |
| 919 | } |
| 920 | |
| 921 | // Minus opens the tools menu (Scripts / Settings). Guarded so you can't |
| 922 | // navigate away mid-copy. |
| 923 | if ((kdown & HidNpadButton_Minus) && !TransferJob::get().active()) { |
| 924 | std::vector<MenuOverlay::Item> items = { |
| 925 | {i18n::t("main.scripts"), [this]() { startScriptPicker(); }}, |
| 926 | {i18n::t("settings.title"), []() { g_pendingScreen = std::make_shared<SettingsScreen>(g_screen); }}, |
| 927 | }; |
| 928 | currentOverlay = std::make_shared<MenuOverlay>(*this, i18n::t("menu.title"), std::move(items)); |
| 929 | return; |
| 930 | } |
| 931 | |
| 932 | // The rail scripts glyph opens the picker straight away, mirroring the gear. |
| 933 | if (scriptButton->released() && !TransferJob::get().active()) { |
| 934 | startScriptPicker(); |
| 935 | return; |
| 936 | } |
| 937 | |
| 938 | // The rail gear is an unambiguous Settings icon, so it still jumps straight |
| 939 | // there; the swap itself is deferred to main() via g_pendingScreen. |
| 940 | if (settingsButton->released() && !TransferJob::get().active()) { |
| 941 | g_pendingScreen = std::make_shared<SettingsScreen>(g_screen); |
| 942 | return; |
| 943 | } |
| 944 | |
| 945 | // handle sidebar D-pad navigation. Cursor 0..3 = save-kind buttons, 4 = |
| 946 | // scripts glyph, 5 = settings gear (so Down from SYSTEM reaches them, Up from |
| 947 | // USER wraps to the gear). |
| 948 | if (sidebarFocused) { |
| 949 | if (kdown & HidNpadButton_Up) { |
| 950 | sidebarCursor = sidebarCursor > 0 ? sidebarCursor - 1 : 5; |
| 951 | } |
| 952 | else if (kdown & HidNpadButton_Down) { |
| 953 | sidebarCursor = sidebarCursor < 5 ? sidebarCursor + 1 : 0; |
| 954 | } |
| 955 | if (kdown & HidNpadButton_A) { |
| 956 | if (sidebarCursor == 5) { |
| 957 | if (!TransferJob::get().active()) { |
| 958 | g_pendingScreen = std::make_shared<SettingsScreen>(g_screen); |
| 959 | } |
| 960 | } |
| 961 | else if (sidebarCursor == 4) { |
| 962 | if (!TransferJob::get().active()) { |
| 963 | startScriptPicker(); |
| 964 | } |
nothing calls this directly
no test coverage detected