mirror of
https://github.com/RPCSX/rpcsx.git
synced 2026-04-04 14:08:37 +00:00
wxFile removed (rFile -> rfile_t)
This commit is contained in:
parent
2cafa84b75
commit
ab405901ee
43 changed files with 814 additions and 973 deletions
|
|
@ -153,11 +153,9 @@ namespace loader
|
|||
|
||||
m_stream->Seek(handler::get_stream_offset() + m_shdrs[m_ehdr.data_le.e_shstrndx].data_le.sh_offset + shdr.data_le.sh_name);
|
||||
std::string name;
|
||||
while (!m_stream->Eof())
|
||||
char c;
|
||||
while (m_stream->SRead(c) && c)
|
||||
{
|
||||
char c;
|
||||
m_stream->Read(&c, 1);
|
||||
if (c == 0) break;
|
||||
name.push_back(c);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
#include "Loader.h"
|
||||
|
||||
struct vfsStream;
|
||||
class rFile;
|
||||
|
||||
namespace loader
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
#include "Loader.h"
|
||||
|
||||
struct vfsStream;
|
||||
class rFile;
|
||||
|
||||
namespace loader
|
||||
{
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
struct vfsFileBase;
|
||||
struct vfsStream;
|
||||
class rFile;
|
||||
|
||||
#ifdef _DEBUG
|
||||
//#define LOADER_DEBUG
|
||||
|
|
|
|||
|
|
@ -5,35 +5,38 @@
|
|||
#include "PKG.h"
|
||||
#include "../Crypto/unpkg.h"
|
||||
|
||||
PKGLoader::PKGLoader(rFile& f) : pkg_f(f)
|
||||
{
|
||||
}
|
||||
|
||||
bool PKGLoader::Install(std::string dest)
|
||||
bool PKGLoader::Install(const rfile_t& pkg_f, std::string dest)
|
||||
{
|
||||
// Initial checks
|
||||
if (!pkg_f.IsOpened())
|
||||
if (!pkg_f)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// TODO: This shouldn't use current dir
|
||||
dest.insert(0, 1, '.');
|
||||
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);
|
||||
pkg_f.seek(48);
|
||||
pkg_f.read(title_id, 48);
|
||||
|
||||
std::string titleID = std::string(title_id).substr(7, 9);
|
||||
|
||||
if (rExists(dest + titleID)) {
|
||||
rMessageDialog d_overwrite(NULL, "Another installation found. Do you want to overwrite it?", "PKG Decrypter / Installer", rYES_NO|rCENTRE);
|
||||
if (d_overwrite.ShowModal() != rID_YES) {
|
||||
if (rExists(dest + titleID))
|
||||
{
|
||||
if (rMessageDialog(NULL, "Another installation found. Do you want to overwrite it?", "PKG Decrypter / Installer", rYES_NO | rCENTRE).ShowModal() != rID_YES)
|
||||
{
|
||||
LOG_ERROR(LOADER, "PKG Loader: Another installation found in: %s", titleID.c_str());
|
||||
return false;
|
||||
}
|
||||
} else if (!rMkdir(dest + titleID)) {
|
||||
}
|
||||
else if (!rMkdir(dest + titleID))
|
||||
{
|
||||
LOG_ERROR(LOADER, "PKG Loader: Could not create the installation directory: %s", titleID.c_str());
|
||||
return false;
|
||||
}
|
||||
|
|
@ -50,8 +53,3 @@ bool PKGLoader::Install(std::string dest)
|
|||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
bool PKGLoader::Close()
|
||||
{
|
||||
return pkg_f.Close();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,13 +1,8 @@
|
|||
#pragma once
|
||||
|
||||
class rFile;
|
||||
struct rfile_t;
|
||||
|
||||
class PKGLoader
|
||||
struct PKGLoader
|
||||
{
|
||||
rFile& pkg_f;
|
||||
|
||||
public:
|
||||
PKGLoader(rFile& f);
|
||||
virtual bool Install(std::string dest);
|
||||
virtual bool Close();
|
||||
static bool Install(const rfile_t& pkg_f, std::string dest);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -102,10 +102,7 @@ bool TROPUSRLoader::Save(const std::string& filepath)
|
|||
if (m_file)
|
||||
Close();
|
||||
|
||||
if (!Emu.GetVFS().ExistsFile(filepath))
|
||||
Emu.GetVFS().CreateFile(filepath);
|
||||
|
||||
m_file = Emu.GetVFS().OpenFile(filepath, vfsWrite);
|
||||
m_file = Emu.GetVFS().OpenFile(filepath, vfsWriteNew);
|
||||
m_file->Write(&m_header, sizeof(TROPUSRHeader));
|
||||
|
||||
for (const TROPUSRTableHeader& tableHeader : m_tableHeaders)
|
||||
|
|
|
|||
|
|
@ -26,12 +26,9 @@ bool TRPLoader::Install(std::string dest, bool show)
|
|||
for (const TRPEntry& entry : m_entries)
|
||||
{
|
||||
char* buffer = new char [(u32)entry.size];
|
||||
Emu.GetVFS().CreateFile(dest+entry.name);
|
||||
vfsFile file(dest+entry.name, vfsWrite);
|
||||
trp_f.Seek(entry.offset);
|
||||
trp_f.Read(buffer, entry.size);
|
||||
file.Write(buffer, entry.size);
|
||||
file.Close();
|
||||
vfsFile(dest + entry.name, vfsWriteNew).Write(buffer, entry.size);
|
||||
delete[] buffer;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue