PKG Loader rewritten

* Rewritten unpkg.c -> Loader/PKG.cpp
* MainFrame::InstallPkg now *only* installs the PKG.
* Fixed crash when unpacking big debug PKG files.
* Debug PKGs are no longer recrypted.
* 'About...' dialog updated to remove PKG-related notice.
* Unpkg removed.

NOTE: The class PKGLoader is using wxWidgets functions to access the
files. I think VFS would be better, but the Emulator isn't necessarily
running when installing the PKG. In the other hand, initializing VFS
with RPCS3 may be somewhat risky... Any alternatives?

TODO: Get rid of the decrypted "*.dec" files, and try to decrypt and
read contents of the PKG on the fly using the information stored in
m_entries.
This commit is contained in:
Alexandro Sánchez Bach 2014-02-21 02:35:33 +01:00
parent 83a7c83761
commit 5f9e60c45f
11 changed files with 335 additions and 784 deletions

View file

@ -12,7 +12,7 @@
#include "Gui/AboutDialog.h"
#include <wx/dynlib.h>
#include "unpkg/unpkg.c"
#include "Loader/PKG.h"
BEGIN_EVENT_TABLE(MainFrame, FrameBase)
EVT_CLOSE(MainFrame::OnQuit)
@ -225,43 +225,21 @@ void MainFrame::InstallPkg(wxCommandEvent& WXUNUSED(event))
return;
}
ConLog.Write("PKG: extracting...");
Emu.Stop();
wxString fileName = ctrl.GetPath();
if (!pkg_unpack(static_cast<const char*>(fileName)))
ConLog.Error("Could not unpack PKG!");
else ConLog.Success("PKG: extract done.");
if (!wxRemoveFile(ctrl.GetPath()+".dec"))
ConLog.Warning("Could not delete the decoded DEC file");
pkg_header *header;
pkg_info(static_cast<const char*>(fileName), &header);
wxString titleID_full (header->title_id);
wxString titleID = titleID_full.SubString(7, 15);
wxString mainDir = wxGetCwd();
wxString gamePath = "\\dev_hdd0\\game\\";
wxString pkgDir = mainDir + gamePath + titleID;
// Save the title ID.
Emu.SetTitleID(titleID);
//Refresh game list
m_game_viewer->Refresh();
if(Emu.BootGame(pkgDir.ToStdString()))
// Open and install PKG file
std::string filePath = ctrl.GetPath();
wxFile pkg_f(filePath, wxFile::read); // TODO: Use VFS to install PKG files
if (pkg_f.IsOpened())
{
ConLog.Success("Game: boot done.");
}
else
{
ConLog.Error("Ps3 executable not found in folder (%s)", pkgDir.wx_str());
PKGLoader pkg(pkg_f);
pkg.Install("/dev_hdd0/game/");
pkg.Close();
}
// Refresh game list
m_game_viewer->Refresh();
}
void MainFrame::BootElf(wxCommandEvent& WXUNUSED(event))