1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-22 02:32:36 +01:00

rFileName removed

This commit is contained in:
Nekotekina 2015-04-23 19:58:37 +03:00
parent 743421881e
commit fbc268e993
12 changed files with 60 additions and 89 deletions

View File

@ -1,5 +1,9 @@
#include "stdafx.h"
#pragma warning(push)
#pragma message("TODO: remove wx dependency: <wx/string.h>")
#pragma warning(disable : 4996)
#include <wx/string.h>
#pragma warning(pop)
std::string u128::to_hex() const
{

View File

@ -1,8 +1,10 @@
#include "stdafx.h"
#include "Log.h"
#pragma warning(push)
#pragma message("TODO: remove wx dependency: <wx/dir.h>")
#pragma warning(disable : 4996)
#include <wx/dir.h>
#include <wx/filename.h>
#pragma warning(pop)
#include "rFile.h"
#ifdef _WIN32
@ -662,49 +664,3 @@ bool rDir::GetNext(std::string *filename) const
*filename = str.ToStdString();
return res;
}
rFileName::rFileName()
{
handle = reinterpret_cast<void*>(new wxFileName());
}
rFileName::~rFileName()
{
delete reinterpret_cast<wxFileName*>(handle);
}
rFileName::rFileName(const rFileName& filename)
{
handle = reinterpret_cast<void*>(new wxFileName(*reinterpret_cast<wxFileName*>(filename.handle)));
}
rFileName::rFileName(const std::string& name)
{
handle = reinterpret_cast<void*>(new wxFileName(fmt::FromUTF8(name)));
}
std::string rFileName::GetFullPath()
{
return fmt::ToUTF8(reinterpret_cast<wxFileName*>(handle)->GetFullPath());
}
std::string rFileName::GetPath()
{
return fmt::ToUTF8(reinterpret_cast<wxFileName*>(handle)->GetPath());
}
std::string rFileName::GetName()
{
return fmt::ToUTF8(reinterpret_cast<wxFileName*>(handle)->GetName());
}
std::string rFileName::GetFullName()
{
return fmt::ToUTF8(reinterpret_cast<wxFileName*>(handle)->GetFullName());
}
bool rFileName::Normalize()
{
return reinterpret_cast<wxFileName*>(handle)->Normalize();
}

View File

@ -44,16 +44,12 @@ struct rfile_t final
#ifdef _WIN32
using handle_type = void*;
#else
using handle_type = int;
using handle_type = intptr_t;
#endif
private:
handle_type fd;
#ifndef _WIN32
handle_type pad;
#endif
public:
rfile_t();
~rfile_t();
@ -95,17 +91,3 @@ struct rDir
void *handle;
};
struct rFileName
{
rFileName();
rFileName(const rFileName& other);
~rFileName();
rFileName(const std::string& name);
std::string GetFullPath();
std::string GetPath();
std::string GetName();
std::string GetFullName();
bool Normalize();
void *handle;
};

View File

@ -1,7 +1,10 @@
#include "stdafx.h"
#include "restore_new.h"
#pragma warning(push)
#pragma message("TODO: remove wx dependency: <wx/msgdlg.h>")
#pragma warning(disable : 4996)
#include <wx/msgdlg.h>
#pragma warning(pop)
#include "define_new_memleakdetect.h"
#include "rMsgBox.h"

View File

@ -1,7 +1,10 @@
#include "stdafx.h"
#include "restore_new.h"
#pragma warning(push)
#pragma message("TODO: remove wx dependency: <wx/image.h>")
#pragma warning(disable : 4996)
#include <wx/image.h>
#pragma warning(pop)
#include "define_new_memleakdetect.h"
#ifndef _WIN32

View File

@ -1,7 +1,10 @@
#include "stdafx.h"
#include "rTime.h"
#pragma warning(push)
#pragma message("TODO: remove wx dependency: <wx/datetime.h>")
#pragma warning(disable : 4996)
#include <wx/datetime.h>
#pragma warning(pop)
std::string rDefaultDateTimeFormat = "%c";

View File

@ -1,6 +1,10 @@
#include "stdafx.h"
#include "Utilities/rXml.h"
#pragma warning(push)
#pragma message("TODO: remove wx dependency: <wx/xml/xml.h>")
#pragma warning(disable : 4996)
#include <wx/xml/xml.h>
#pragma warning(pop)
rXmlNode::rXmlNode()
{

View File

@ -1,17 +1,19 @@
#include "stdafx.h"
#include "Utilities/Log.h"
#include "Utilities/rFile.h"
#include "utils.h"
#include "aes.h"
#include "sha1.h"
#include "key_vault.h"
#include "unpkg.h"
#include "restore_new.h"
#pragma warning(push)
#pragma message("TODO: remove wx dependency: <wx/progdlg.h>")
#pragma warning(disable : 4996)
#include <wx/progdlg.h>
#pragma warning(pop)
#include "define_new_memleakdetect.h"
#include "Utilities/Log.h"
#include "Utilities/rFile.h"
// Decryption.
bool CheckHeader(const rfile_t& pkg_f, PKGHeader* m_header)
{

View File

@ -6,9 +6,12 @@
#include "utils.h"
#include "Emu/FS/vfsLocalFile.h"
#include "unself.h"
#pragma warning(push)
#pragma message("TODO: remove wx dependencies: <wx/mstream.h> <wx/zstream.h>")
#pragma warning(disable : 4996)
#include <wx/mstream.h>
#include <wx/zstream.h>
#pragma warning(pop)
__forceinline u8 Read8(vfsStream& f)
{

View File

@ -1,6 +1,5 @@
#include "stdafx.h"
#include "vfsDevice.h"
#include "Utilities/rFile.h"
vfsDevice::vfsDevice(const std::string& ps3_path, const std::string& local_path)
: m_ps3_path(ps3_path)
@ -46,16 +45,13 @@ u32 vfsDevice::CmpLocalPath(const std::string& local_path)
if(local_path.length() < m_local_path.length())
return 0;
rFileName path0(m_local_path);
path0.Normalize();
#ifdef _WIN32
#define DL "\\"
#else
#define DL "/"
#endif
std::vector<std::string> arr0 = fmt::rSplit(path0.GetFullPath(), DL);
std::vector<std::string> arr0 = fmt::rSplit(m_local_path, DL);
std::vector<std::string> arr1 = fmt::rSplit(local_path, DL);
const u32 lim = (u32)std::min(arr0.size(), arr1.size());
@ -188,9 +184,7 @@ std::string vfsDevice::GetWinPath(const std::string& p, bool is_dir)
if(is_dir && ret[ret.length() - 1] != '/' && ret[ret.length() - 1] != '\\') ret += '/'; // ???
rFileName res(ret);
res.Normalize();
return res.GetFullPath();
return ret;
}
std::string vfsDevice::GetWinPath(const std::string& l, const std::string& r)

View File

@ -44,7 +44,8 @@ bool vfsFile::Remove(const std::string& path)
bool vfsFile::Close()
{
m_stream.reset();
return vfsFileBase::Close();
return true;
}
u64 vfsFile::GetSize() const
@ -74,5 +75,5 @@ u64 vfsFile::Tell() const
bool vfsFile::IsOpened() const
{
return m_stream && m_stream->IsOpened() /*&& vfsFileBase::IsOpened()*/;
return m_stream && m_stream->IsOpened();
}

View File

@ -32,7 +32,6 @@
#include "Loader/ELF32.h"
#include "../Crypto/unself.h"
#include <cstdlib>
#include <fstream>
using namespace PPU_instr;
@ -184,28 +183,44 @@ void Emulator::Load()
if (!rIsFile(m_path)) return;
const std::string elf_dir = m_path.substr(0, m_path.find_last_of("/\\", std::string::npos, 2) + 1);
if (IsSelf(m_path))
{
std::string elf_path = rFileName(m_path).GetPath();
const std::string full_name = m_path.substr(elf_dir.length());
if (fmt::CmpNoCase(rFileName(m_path).GetFullName(),"EBOOT.BIN") == 0)
const std::string base_name = full_name.substr(0, full_name.find_last_of('.', std::string::npos));
const std::string ext = full_name.substr(base_name.length());
if (fmt::toupper(full_name) == "EBOOT.BIN")
{
elf_path += "/BOOT.BIN";
m_path = elf_dir + "BOOT.BIN";
}
else if (fmt::toupper(ext) == ".SELF")
{
m_path = elf_dir + base_name + ".elf";
}
else if (fmt::toupper(ext) == ".SPRX")
{
m_path = elf_dir + base_name + ".prx";
}
else
{
elf_path += "/" + rFileName(m_path).GetName() + ".elf";
m_path = elf_dir + base_name + ".decrypted" + ext;
}
if (!DecryptSelf(elf_path, m_path))
return;
LOG_NOTICE(LOADER, "Decrypting '%s%s'...", elf_dir, full_name);
m_path = elf_path;
if (!DecryptSelf(m_path, elf_dir + full_name))
{
return;
}
}
LOG_NOTICE(LOADER, "Loading '%s'...", m_path.c_str());
GetInfo().Reset();
GetVFS().Init(rFileName(m_path).GetPath());
GetVFS().Init(elf_dir);
LOG_NOTICE(LOADER, " "); //used to be skip_line
LOG_NOTICE(LOADER, "Mount info:");
@ -242,13 +257,14 @@ void Emulator::Load()
if (m_elf_path.empty())
{
GetVFS().GetDeviceLocal(m_path, m_elf_path);
LOG_NOTICE(LOADER, "Elf path: %s", m_elf_path);
}
f.Open(m_elf_path);
if (!f.IsOpened())
{
LOG_ERROR(LOADER, "Elf not found! (%s - %s)", m_path.c_str(), m_elf_path.c_str());
LOG_ERROR(LOADER, "Opening '%s' failed", m_path.c_str());
return;
}