| 192 | } |
| 193 | |
| 194 | void ScriptScreen::update(const InputState& input) |
| 195 | { |
| 196 | (void)input; |
| 197 | |
| 198 | if (auto result = ScriptRunner::get().takeResult()) { |
| 199 | // HOME was blocked for the whole run (picoc cannot be preempted). |
| 200 | aptSetHomeAllowed(true); |
| 201 | mOutcome = *result; |
| 202 | mFinished = true; |
| 203 | // The last log line is the run's verdict, so the pane reads as a |
| 204 | // transcript that ends where the script did. |
| 205 | ScriptConsole::get().log(mOutcome.cancelled ? i18n::t("scripts.aborted", {mOutcome.scriptName}) |
| 206 | : mOutcome.exitValue == 0 ? i18n::t("scripts.success", {mOutcome.scriptName}) |
| 207 | : i18n::t("scripts.failed", {mOutcome.scriptName})); |
| 208 | } |
| 209 | |
| 210 | if (ScriptRunner::get().active()) { |
| 211 | // The hold-B kill switch and the log scrolling live in main.cpp: |
| 212 | // both must keep working while a script-raised overlay owns update(). |
| 213 | pumpScriptRequests(ScriptRunner::get().bridge(), *this); |
| 214 | return; |
| 215 | } |
| 216 | |
| 217 | if (mFinished && (hidKeysDown() & (KEY_A | KEY_B | KEY_START))) { |
| 218 | g_pendingScreen = mPrevious; |
| 219 | } |
| 220 | } |
| 221 | |
| 222 | void ScriptScreen::showMessage(const std::string& prompt) |
| 223 | { |
nothing calls this directly
no test coverage detected