mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-06 15:01:28 +12:00
- Removed all scetool dependencies; - Implemented a key vault to manage PS3 keys internally; - Implemented SELF decryption; - Improved PKG handling. Notes: - NPDRM SELF files (EBOOT.BIN) can also be decrypted. A valid matching RAP file must be placed under the dev_usb000 folder. - The source code is considerably commented and several debugging functions were also added in order to aid anyone who wishes to contribute to the engine.
57 lines
No EOL
1.5 KiB
C++
57 lines
No EOL
1.5 KiB
C++
#include "stdafx.h"
|
|
#include "PKG.h"
|
|
#include "../Crypto/unpkg.h"
|
|
|
|
PKGLoader::PKGLoader(wxFile& f) : pkg_f(f)
|
|
{
|
|
}
|
|
|
|
bool PKGLoader::Install(std::string dest)
|
|
{
|
|
// Initial checks
|
|
if (!pkg_f.IsOpened())
|
|
return false;
|
|
|
|
dest = wxGetCwd() + dest;
|
|
if (!dest.empty() && dest.back() != '/')
|
|
dest += '/';
|
|
|
|
// Fetch title ID from the header.
|
|
char title_id[48];
|
|
pkg_f.Seek(48);
|
|
pkg_f.Read(title_id, 48);
|
|
|
|
std::string titleID = std::string(title_id).substr(7, 9);
|
|
|
|
if (wxDirExists(dest+titleID)) {
|
|
wxMessageDialog d_overwrite(NULL, "Another installation was found. Do you want to overwrite it?", "PKG Decrypter / Installer", wxYES_NO|wxCENTRE);
|
|
if (d_overwrite.ShowModal() != wxID_YES) {
|
|
ConLog.Error("PKG Loader: Another installation found in: %s", wxString(titleID).wx_str());
|
|
return false;
|
|
}
|
|
// TODO: Remove the following two lines and remove the folder dest+titleID
|
|
ConLog.Error("PKG Loader: Another installation found in: %s", wxString(titleID).wx_str());
|
|
return false;
|
|
}
|
|
if (!wxMkdir(dest+titleID)) {
|
|
ConLog.Error("PKG Loader: Could not make the installation directory: %s", wxString(titleID).wx_str());
|
|
return false;
|
|
}
|
|
|
|
// Decrypt and unpack the PKG file.
|
|
if (Unpack(pkg_f, titleID, dest) < 0)
|
|
{
|
|
ConLog.Error("PKG Loader: Failed to install package!");
|
|
return false;
|
|
}
|
|
else
|
|
{
|
|
ConLog.Write("PKG Loader: Package successfully installed in: /dev_hdd0/game/%s", wxString(titleID.c_str()).wx_str());
|
|
return true;
|
|
}
|
|
}
|
|
|
|
bool PKGLoader::Close()
|
|
{
|
|
return pkg_f.Close();
|
|
} |