Files
ppsspp/UI/FirmwareScreen.h
T
Henrik RydgårdandClaude Opus 5.5 f6f9a00eb7 UI: Move file I/O off the render thread in a few screens
On Android the render thread runs the UI, and surfaceDestroyed waits for
it, so slow storage (SAF especially) there stutters and can become an ANR.

- Store: only check whether the game is installed when an install or
  uninstall finishes, not every frame.
- Savedata: read the modification time with SIZE on the GameInfo worker.
  The popup asked for it every frame, and each button on first draw.
- FirmwareScreen: scan the NAND, and erase it, on a worker thread. It
  rescanned on every RecreateViews, which is after every popup.
- GameScreen: look up the installed update, plugins and what the firmware
  can play on a worker thread. They ran on every RecreateViews, which
  happens as each piece of game info arrives.
- LaunchFile: wait only for the file type, and for PARAM.SFO just in the
  cases that use it.

Also add --start-screen=firmware.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-30 12:01:36 +01:00

71 lines
2.3 KiB
C++

// Copyright (c) 2026- PPSSPP Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0 or later versions.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official git repository and contact information can be found at
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
#pragma once
#include <atomic>
#include <memory>
#include <string>
#include "Common/File/Path.h"
#include "Common/UI/UIScreen.h"
#include "Common/UI/ViewGroup.h"
#include "Core/Util/PSARUnpack.h"
#include "UI/SimpleDialogScreen.h"
// What's in PSP/NAND - which can be nothing at all, just the fonts we pulled off some game's
// disc, or a full firmware unpacked from an updater. Also the place to launch the XMB from,
// since that's what a full firmware buys you.
class FirmwareScreen : public UITwoPaneBaseDialogScreen {
public:
FirmwareScreen(const Path &gamePath)
: UITwoPaneBaseDialogScreen(gamePath, TwoPaneFlags::SettingsToTheRight | TwoPaneFlags::ContentsCanScroll) {}
const char *tag() const override { return "Firmware"; }
void update() override;
protected:
std::string_view GetTitle() const override;
void BeforeCreateViews() override;
void CreateSettingsViews(UI::ViewGroup *parent) override;
void CreateContentViews(UI::ViewGroup *parent) override;
void dialogFinished(const Screen *dialog, DialogResult result) override;
private:
void LaunchVSH();
void BrowseForUpdater();
void AskToErase();
// Scans (and first erases, if asked) on a worker thread, since the NAND can be on slow storage.
void StartScan(bool eraseFirst);
struct ScanState {
std::atomic<bool> done{};
InstalledFirmwareInfo info;
std::string eraseError;
};
Path nandRoot_;
InstalledFirmwareInfo info_;
std::shared_ptr<ScanState> scan_; // While a scan is running.
bool scanned_ = false;
bool rescanPending_ = false;
bool erasePending_ = false;
};