MCPcopy Create free account
hub / github.com/BernardoGiordano/Checkpoint / update

Method update

switch/source/ScriptScreen.cpp:188–217  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

186}
187
188void ScriptScreen::update(const InputState& input)
189{
190 // Reached only with no overlay up (Screen::doUpdate gives one the input),
191 // so there is no pending request left to go back to: the next dialog opens
192 // in front, not hidden behind a focus the user set two requests ago.
193 sLogFocus = false;
194
195 if (auto result = ScriptRunner::get().takeResult()) {
196 // HOME was blocked for the whole run (picoc cannot be preempted).
197 appletEndBlockingHomeButton();
198 mOutcome = *result;
199 mFinished = true;
200 // The last log line is the run's verdict, so the pane reads as a
201 // transcript that ends where the script did.
202 ScriptConsole::get().log(mOutcome.cancelled ? i18n::t("scripts.aborted", {mOutcome.scriptName})
203 : mOutcome.exitValue == 0 ? i18n::t("scripts.success", {mOutcome.scriptName})
204 : i18n::t("scripts.failed", {mOutcome.scriptName}));
205 }
206
207 if (ScriptRunner::get().active()) {
208 // The hold-B kill switch and the D-Pad log scrolling live in main.cpp:
209 // both must keep working while a script-raised overlay owns update().
210 pumpScriptRequests(ScriptRunner::get().bridge(), *this);
211 return;
212 }
213
214 if (mFinished && (input.kDown & (HidNpadButton_A | HidNpadButton_B | HidNpadButton_Plus))) {
215 g_pendingScreen = mPrevious;
216 }
217}
218
219void ScriptScreen::showMessage(const std::string& prompt)
220{

Callers

nothing calls this directly

Calls 5

getFunction · 0.85
pumpScriptRequestsFunction · 0.85
takeResultMethod · 0.45
logMethod · 0.45
activeMethod · 0.45

Tested by

no test coverage detected