mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-09-30 00:06:42 +02:00
--re-decrypt runs pspDecryptPRX() over a file and unpacks the KL4E/KL3E stream behind it. This opens up flash0:/kd/resource/*.img, the images the Media Engine actually runs: they are ordinary tagged containers (tag 862648D1, which PrxDecrypter already has a key for) with the ~PSP signature blanked, so the normal module loader never touches them. --re-raw-base analyzes --re-module as a flat code image at a given address rather than as a PRX. The decrypted ME images are raw MIPS with no ELF around them; the address they were linked for is recoverable from their own jal targets (0x08300000 for meimg.img). Also makes PrxDecrypter.h self-contained - PSP_Header is built from _le types, so it needs Common/Swap.h rather than relying on the includer.
49 lines
2.0 KiB
C++
49 lines
2.0 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 <string>
|
|
|
|
#include "Common/CommonTypes.h"
|
|
|
|
struct ReverseEngineerOptions {
|
|
// PRX/ELF to load. A host path, or a PSP path like "flash0:/kd/libmp3.prx" (resolved
|
|
// against the configured NAND directory).
|
|
std::string modulePath;
|
|
// Where to write the report. Created if missing.
|
|
std::string outDir;
|
|
// If set, only this function is disassembled (by name, or "0x08801234").
|
|
std::string funcFilter;
|
|
// Optional .syms file applied before dumping, so names show up in every caller.
|
|
std::string symsFile;
|
|
// If non-zero, modulePath is a flat code image rather than a PRX: it's copied to this
|
|
// address and scanned directly, with no loader, no relocation and no imports/exports.
|
|
u32 rawBase = 0;
|
|
bool verbose = false;
|
|
};
|
|
|
|
// Loads a module standalone (no game), analyzes it, and writes a report. Returns a process
|
|
// exit code.
|
|
int RunReverseEngineer(const ReverseEngineerOptions &opts);
|
|
|
|
// Decrypts one encrypted PSP file and writes the plaintext, without loading anything.
|
|
// Handles any container pspDecryptPRX() knows a tag for - including the ME images in
|
|
// flash0:/kd/resource, which are ordinary tagged containers with the signature blanked, so the
|
|
// normal module loader won't touch them. Returns a process exit code.
|
|
int RunDecryptFile(const std::string &inPath, const std::string &outPath);
|