Files
ppsspp/UI/InstallPkgScreen.h
T
Henrik RydgårdandClaude Opus 5 3a70c6b149 Install PKG game updates, and boot them
Opening a .pkg now offers to install it, the way a .zip does - see the new
InstallPkgScreen, which shows what the update patches, what it'll take up
on disk (exact, since package contents aren't compressed) and where it's
going. The package's PS3-style USRDIR/CONTENT wrapping is stripped so the
files land where the PSP expects them, in PSP/GAME/<DISC_ID>.

Booting a disc then looks for PSP/GAME/<DISC_ID>/PBOOT.PBP and boots that
instead of the disc's own EBOOT, leaving the disc mounted - so the update
overrides the files it ships and the disc supplies the rest. The update's
DISC_ID has to match; a DISC_VERSION mismatch only warns, since updates do
get used with slightly different dumps in practice.

Verified against the whole corpus: every one installs, and the
digital NP* update/base-image pairs that could be assembled all boot the
patch rather than the disc's executable. That includes Super Robot Taisen
Operation Extend from a real NPUMDIMG EBOOT.PBP, which settles that
ISO.BIN.EDAT does not re-key the PBOOT - a digital title's patched EBOOT is
encrypted exactly like a UMD one. On the UMD side, the patched
LittleBigPlanet reads PATCH.ARC out of the install alongside the disc's own
archive.

The DISC_VERSION warning turns out to be load-bearing: many of the pairs
mismatch, because the dumps in circulation are later disc revisions than the
updates were built against. docs/pkg_notes.md has the numbers, and the one
thing that doesn't work - PGD-wrapped .sprx modules, which
sceKernelLoadModuleNpDrm can't load.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-08 11:15:15 -06:00

67 lines
2.1 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 "Common/File/Path.h"
#include "Common/UI/Notice.h"
#include "Common/UI/UIScreen.h"
#include "Common/UI/View.h"
#include "Core/Util/PkgUnpack.h"
#include "UI/BaseScreens.h"
#include "UI/SimpleDialogScreen.h"
// Offers to install a PSP game update from a .pkg file, the way InstallZipScreen does for zips.
// The package goes into PSP/GAME/<DISC_ID>, and from then on booting that disc runs the update -
// see FindGameUpdatePBOOT() in Core/PSPLoaders.cpp.
class InstallPkgScreen : public UITwoPaneBaseDialogScreen {
public:
InstallPkgScreen(const Path &pkgPath);
void update() override;
bool key(const KeyInput &key) override;
const char *tag() const override { return "InstallPkg"; }
protected:
void CreateSettingsViews(UI::ViewGroup *parent) override;
void CreateContentViews(UI::ViewGroup *parent) override;
std::string_view GetTitle() const override;
ViewLayoutMode LayoutMode() const override {
return ViewLayoutMode::ApplyInsets;
}
private:
void OnInstall(UI::EventParams &params);
Path pkgPath_;
Path destination_;
PkgInfo pkgInfo_;
std::string pkgError_; // Why the package can't be installed, if it can't.
bool canInstall_ = false;
u64 installSize_ = 0;
s64 freeSpace_ = -1; // Negative if we couldn't find out.
bool alreadyInstalled_ = false;
UI::Choice *installChoice_ = nullptr;
NoticeView *doneView_ = nullptr;
bool installStarted_ = false;
bool deletePkgFile_ = false;
};