mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-21 10:19:04 +02:00
"Compress game" in the game screen's ... menu, for ISO, CSO, CHD and PSN EBOOT.PBP games. It opens a list of the CSO presets (and Extract to ISO for anything that's not an ISO already): - Best: libdeflate level 12, 64K blocks - PSP Compatible: zlib level 9, 2K blocks, readable by custom firmware These match maxcso's presets, and the CSOs come out byte-identical to its. The writer, Core/FileSystems/CSOCompress, reads the input through PPSSPP's own block devices, so recompressing is a single pass with no temporary file. The original is deleted when done, unless "Keep the original file" is checked (off by default). When the new name is taken, by a kept original or another file, a number is added to it. The work runs on a thread using every core, with a progress bar and time left at the bottom of the game screen. It keeps going when the screen is left, and the ... menu offers Cancel meanwhile. On the game list the game's icon is covered by "Compressing...", and clicking it opens the game screen instead of playing. When done, recents follow the new file and the game screen and lists refresh. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CCxekYqPnzNr5d8Tp1q7aZ
96 lines
3.0 KiB
C++
96 lines
3.0 KiB
C++
// Copyright (c) 2013- 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 <functional>
|
|
|
|
#include "UI/BaseScreens.h"
|
|
#include "Common/UI/UIScreen.h"
|
|
#include "Common/File/Path.h"
|
|
#include "UI/GameInfoCache.h"
|
|
#include "Core/Util/PkgUnpack.h"
|
|
#include "UI/SimpleDialogScreen.h"
|
|
|
|
|
|
class NoticeView;
|
|
|
|
// Game screen: Allows you to start a game, delete saves, delete the game,
|
|
// set game specific settings, etc.
|
|
|
|
// Uses GameInfoCache heavily to implement the functionality.
|
|
// Should possibly merge this with the PauseScreen.
|
|
|
|
class GameScreen : public UITwoPaneBaseDialogScreen {
|
|
public:
|
|
GameScreen(const Path &gamePath, bool inGame);
|
|
~GameScreen();
|
|
|
|
void update() override;
|
|
|
|
const char *tag() const override { return "Game"; }
|
|
|
|
// The game was deleted or removed from recents, so the screen we return to should refresh.
|
|
bool GameRemoved() const { return gameRemoved_; }
|
|
|
|
protected:
|
|
void CreateContentViews(UI::ViewGroup *parent) override;
|
|
void CreateSettingsViews(UI::ViewGroup *parent) override;
|
|
void CreateContextMenu(UI::ViewGroup *parent) override;
|
|
|
|
std::string_view GetTitle() const override;
|
|
// The progress bar of a pack running in the background.
|
|
void DrawForeground(UIContext &dc) override;
|
|
|
|
private:
|
|
// Event handlers
|
|
void OnGameSettings(UI::EventParams &e);
|
|
void OnDeleteSaveData(UI::EventParams &e);
|
|
void OnDeleteGame(UI::EventParams &e);
|
|
void OnCreateConfig(UI::EventParams &e);
|
|
void OnDeleteConfig(UI::EventParams &e);
|
|
void OnSetBackground(UI::EventParams &e);
|
|
void OnDeleteGameUpdate(UI::EventParams &e);
|
|
|
|
// Checks whether a game update is installed for this game. Both the info pane and the context
|
|
// menu need the answer, and either can be built first.
|
|
void RefreshInstalledUpdate();
|
|
|
|
std::string CRC32string;
|
|
|
|
bool isHomebrew_ = false;
|
|
bool inGame_ = false;
|
|
bool gameRemoved_ = false;
|
|
bool finishRequested_ = false;
|
|
|
|
// Keep track of progressive loading of metadata.
|
|
GameInfoFlags knownFlags_ = GameInfoFlags::EMPTY;
|
|
|
|
bool knownHasCRC_ = false;
|
|
|
|
// GamePacker state the views were made for.
|
|
int packGeneration_ = 0;
|
|
bool packBarShown_ = false;
|
|
|
|
// A game update installed in PSP/GAME/<DISC_ID>, which is what actually runs when there is one.
|
|
InstalledGameUpdate installedUpdate_;
|
|
bool hasInstalledUpdate_ = false;
|
|
|
|
std::shared_ptr<GameInfo> info_;
|
|
mutable std::string titleCache_;
|
|
};
|