| 131 | } |
| 132 | |
| 133 | void menuUpdate(void) |
| 134 | { |
| 135 | menu_s* menu = menuGetCurrent(); |
| 136 | u32 down = hidKeysDown() | (hidKeysDownRepeat() & (KEY_UP|KEY_DOWN|KEY_LEFT|KEY_RIGHT)); |
| 137 | u32 held = hidKeysHeld(); |
| 138 | u32 up = hidKeysUp(); |
| 139 | |
| 140 | // Avoid registering a SELECT press with the Rosalina menu combo |
| 141 | // See https://github.com/mtheall/ftpd/commit/0db916db66ced76b7e4d05a0407189224c070ad0 |
| 142 | bool selectPress = false; |
| 143 | if (down == KEY_SELECT && held == KEY_SELECT) |
| 144 | storedButtons = KEY_SELECT; |
| 145 | else if (up & KEY_SELECT) |
| 146 | { |
| 147 | if (storedButtons == KEY_SELECT) |
| 148 | selectPress = true; |
| 149 | } |
| 150 | else |
| 151 | storedButtons |= held; |
| 152 | |
| 153 | bool pressedSettings = (down & KEY_TOUCH) && g_touchPos.px >= (320-g_imageData[images_settings_idx].width) && g_touchPos.py >= (240-g_imageData[images_settings_idx].height); |
| 154 | if (down & KEY_A) |
| 155 | { |
| 156 | if (menu->nEntries > 0) |
| 157 | { |
| 158 | int i; |
| 159 | menuEntry_s* me; |
| 160 | for (i = 0, me = menu->firstEntry; i != menu->curEntry; i ++, me = me->next); |
| 161 | workerSchedule(launchMenuEntryTask, me); |
| 162 | } |
| 163 | } |
| 164 | else if (down & KEY_B) |
| 165 | { |
| 166 | workerSchedule(changeDirTask, ".."); |
| 167 | } |
| 168 | else if ((down & KEY_START) || pressedSettings) |
| 169 | { |
| 170 | if (loaderHasFlag(LOADER_SHOW_REBOOT)) |
| 171 | uiEnterState(UI_STATE_REBOOT); |
| 172 | else |
| 173 | showingHomeIcon = true; |
| 174 | } |
| 175 | else if (down & KEY_Y) |
| 176 | { |
| 177 | workerSchedule(netloaderTask, NULL); |
| 178 | } |
| 179 | else if (down & KEY_X) |
| 180 | { |
| 181 | int i; |
| 182 | menuEntry_s* me; |
| 183 | for (i = 0, me = menu->firstEntry; i != menu->curEntry; i ++, me = me->next); |
| 184 | if (me->type == ENTRY_TYPE_FILE) |
| 185 | workerSchedule(netsenderTask, me); |
| 186 | } |
| 187 | else if (selectPress && menu->nEntries > 0) |
| 188 | { |
| 189 | int i; |
| 190 | menuEntry_s* me; |
nothing calls this directly
no test coverage detected