mirror of
https://github.com/RPCSX/rpcsx.git
synced 2025-12-06 07:12:14 +01:00
move module initialization into a module manager, still has some issues like stopping not working and debug crashing add #idef 0 to modules that aren't in the windows project don't double initialize and don't de-initialize for now, since many modules don't expect it and it leads to many errors remove duplicate module lists for empty modules and implemented ones, make Module non-copyable but movable add secondary project, no real use for it now add some memleak config to the emucore and add asmjit path to rpcs3 small rebase error fixed to get it to compile again add filters for emucore re-add the module manager and static file WIP commit, linker errors abound some more abstraction layer stuff fix the remaining linker errors, re-enable platform specific mouse, pad and keyboard handlers rebasing fix memset undefined and re() usage of se_t before declaration Add wxGUI define by default for cmake builds fix copy constructors of Datetime header fix copy constructors of other wx interface classes remove static declarations of global variables make wxGLCanvas constructor non-ambiguous even with wx2.8. compat mode, fix wrong std::exception constructor calls remove duplicate definition for FromUTF8 and ToUTF8 temp changes
58 lines
1.4 KiB
C++
58 lines
1.4 KiB
C++
#include "stdafx.h"
|
|
#include "Emu/ConLog.h"
|
|
#include "PKG.h"
|
|
#include "../Crypto/unpkg.h"
|
|
|
|
PKGLoader::PKGLoader(rFile& f) : pkg_f(f)
|
|
{
|
|
}
|
|
|
|
bool PKGLoader::Install(std::string dest)
|
|
{
|
|
// Initial checks
|
|
if (!pkg_f.IsOpened())
|
|
return false;
|
|
|
|
dest = rGetCwd() + 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 (rDirExists(dest+titleID)) {
|
|
rMessageDialog d_overwrite(NULL, "Another installation was found. Do you want to overwrite it?", "PKG Decrypter / Installer", rYES_NO|rCENTRE);
|
|
if (d_overwrite.ShowModal() != rID_YES) {
|
|
ConLog.Error("PKG Loader: Another installation found in: %s", titleID.c_str());
|
|
return false;
|
|
}
|
|
// TODO: Remove the following two lines and remove the folder dest+titleID
|
|
ConLog.Error("PKG Loader: Another installation found in: %s", titleID.c_str());
|
|
return false;
|
|
}
|
|
if (!rMkdir(dest+titleID)) {
|
|
ConLog.Error("PKG Loader: Could not make the installation directory: %s", titleID.c_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", titleID.c_str());
|
|
return true;
|
|
}
|
|
}
|
|
|
|
bool PKGLoader::Close()
|
|
{
|
|
return pkg_f.Close();
|
|
} |