mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-04-20 03:25:16 +00:00
replace all instances of wxString with std::string in all cases not
directly involved in either the GUI or other wxWidget classes like wxFile
This commit is contained in:
parent
b1894ac6cb
commit
8ac226ae69
124 changed files with 1716 additions and 1502 deletions
63
Utilities/StrFmt.cpp
Normal file
63
Utilities/StrFmt.cpp
Normal file
|
@ -0,0 +1,63 @@
|
|||
#include "stdafx.h"
|
||||
#include "StrFmt.h"
|
||||
|
||||
//wrapper to deal with advance sprintf formating options with automatic length finding
|
||||
//can't take strings by reference because of "va_start", so overload it with char *
|
||||
std::string fmt::FormatV(const char *fmt, va_list args)
|
||||
{
|
||||
int length = 256;
|
||||
std::string str;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
std::vector<char> buffptr(length);
|
||||
size_t printlen = vsnprintf(buffptr.data(), length, fmt, args);
|
||||
if (printlen >= 0 && printlen < length)
|
||||
{
|
||||
str = std::string(buffptr.data(), printlen);
|
||||
break;
|
||||
}
|
||||
length *= 2;
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
std::string fmt::FormatV(std::string fmt, va_list args)
|
||||
{
|
||||
std::string str = FormatV(fmt.c_str(), args);
|
||||
return str;
|
||||
}
|
||||
|
||||
//convert a wxString to a std::string encoded in utf8
|
||||
//CAUTION, only use this to interface with wxWidgets classes
|
||||
std::string fmt::ToUTF8(const wxString& right)
|
||||
{
|
||||
auto ret = std::string(((const char *) right.utf8_str()));
|
||||
return ret;
|
||||
}
|
||||
|
||||
//convert a std::string encoded in utf8 to a wxString
|
||||
//CAUTION, only use this to interface with wxWidgets classes
|
||||
wxString fmt::FromUTF8(const std::string& right)
|
||||
{
|
||||
auto ret = wxString::FromUTF8(right.c_str());
|
||||
return ret;
|
||||
}
|
||||
|
||||
//TODO: remove this after every snippet that uses it is gone
|
||||
//WARNING: not fully compatible with CmpNoCase from wxString
|
||||
int fmt::CmpNoCase(const std::string& a, const std::string& b)
|
||||
{
|
||||
if (a.length() != b.length())
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return std::equal(a.begin(),
|
||||
a.end(),
|
||||
b.begin(),
|
||||
[](const char& a, const char& b){return tolower(a) == tolower(b); })
|
||||
? 0 : -1;
|
||||
}
|
||||
}
|
117
Utilities/StrFmt.h
Normal file
117
Utilities/StrFmt.h
Normal file
|
@ -0,0 +1,117 @@
|
|||
#pragma once
|
||||
#include <string>
|
||||
#include <ostream>
|
||||
#include <sstream>
|
||||
#include <cstdio>
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#define snprintf _snprintf
|
||||
#endif
|
||||
|
||||
namespace fmt{
|
||||
using std::string;
|
||||
using std::ostream;
|
||||
using std::ostringstream;
|
||||
|
||||
struct empty_t{};
|
||||
|
||||
//static const string placeholder = "???";
|
||||
|
||||
// write `fmt` from `pos` to the first occurence of `fmt::placeholder` to
|
||||
// the stream `os`. Then write `arg` to to the stream. If there's no
|
||||
// `fmt::placeholder` after `pos` everything in `fmt` after pos is written
|
||||
// to `os`. Then `arg` is written to `os` after appending a space character
|
||||
template<typename T>
|
||||
empty_t write(const string &fmt, ostream &os, string::size_type &pos, T &&arg)
|
||||
{
|
||||
string::size_type ins = fmt.find(/*placeholder*/"???", pos);
|
||||
|
||||
if (ins == string::npos)
|
||||
{
|
||||
os.write(fmt.data() + pos, fmt.size() - pos);
|
||||
os << ' ' << arg;
|
||||
|
||||
pos = fmt.size();
|
||||
}
|
||||
else
|
||||
{
|
||||
os.write(fmt.data() + pos, ins - pos);
|
||||
os << arg;
|
||||
|
||||
pos = ins + placeholder.size();
|
||||
}
|
||||
return{};
|
||||
}
|
||||
|
||||
// typesafe version of a sprintf-like function. Returns the printed to
|
||||
// string. To mark positions where the arguments are supposed to be
|
||||
// inserted use `fmt::placeholder`. If there's not enough placeholders
|
||||
// the rest of the arguments are appended at the end, seperated by spaces
|
||||
template<typename ... Args>
|
||||
string SFormat(const string &fmt, Args&& ... parameters)
|
||||
{
|
||||
ostringstream os;
|
||||
string::size_type pos = 0;
|
||||
std::initializer_list<empty_t> { write(fmt, os, pos, parameters)... };
|
||||
|
||||
if (!fmt.empty())
|
||||
{
|
||||
os.write(fmt.data() + pos, fmt.size() - pos);
|
||||
}
|
||||
|
||||
string result = os.str();
|
||||
return result;
|
||||
}
|
||||
|
||||
//small wrapper used to deal with bitfields
|
||||
template<typename T>
|
||||
T by_value(T x) { return x; }
|
||||
|
||||
//wrapper to deal with advance sprintf formating options with automatic length finding
|
||||
//can't take strings by reference because of "va_start", so overload it with char *
|
||||
string FormatV(const char *fmt, va_list args);
|
||||
|
||||
string FormatV(string fmt, va_list args);
|
||||
|
||||
//wrapper to deal with advance sprintf formating options with automatic length finding
|
||||
template<typename ... Args>
|
||||
string Format(const string &fmt, Args&& ... parameters)
|
||||
{
|
||||
int length = 256;
|
||||
string str;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
std::vector<char> buffptr(length);
|
||||
size_t printlen = snprintf(buffptr.data(), length, fmt.c_str(), std::forward<Args>(parameters)...);
|
||||
if (printlen >= 0 && printlen < length)
|
||||
{
|
||||
str = string(buffptr.data(), printlen);
|
||||
break;
|
||||
}
|
||||
length *= 2;
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
//TODO:remove
|
||||
//fmt alias for FormatV unused at the moment
|
||||
template <typename... Args>
|
||||
auto fmt(Args&&... args) -> decltype(FormatV(std::forward<Args>(parameters)...))
|
||||
{
|
||||
return FormatV(std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
//convert a wxString to a std::string encoded in utf8
|
||||
//CAUTION, only use this to interface with wxWidgets classes
|
||||
std::string ToUTF8(const wxString& right);
|
||||
|
||||
//convert a std::string encoded in utf8 to a wxString
|
||||
//CAUTION, only use this to interface with wxWidgets classes
|
||||
wxString FromUTF8(const string& right);
|
||||
|
||||
//TODO: remove this after every snippet that uses it is gone
|
||||
//WARNING: not fully compatible with CmpNoCase from wxString
|
||||
int CmpNoCase(const std::string& a, const std::string& b);
|
||||
|
||||
}
|
|
@ -22,7 +22,7 @@ struct SELF_KEY {
|
|||
u8 priv[0x15];
|
||||
u32 curve_type;
|
||||
|
||||
SELF_KEY(u64 ver, u16 rev, u32 type, wxString e, wxString r, wxString pb, wxString pr, u32 ct)
|
||||
SELF_KEY(u64 ver, u16 rev, u32 type, const std::string& e, const std::string& r, const std::string& pb, const std::string& pr, u32 ct)
|
||||
{
|
||||
version = ver;
|
||||
revision = rev;
|
||||
|
|
|
@ -396,7 +396,7 @@ bool SELFDecrypter::MakeElf(const std::string& elf, bool isElf32)
|
|||
wxFile e(elf.c_str(), wxFile::write);
|
||||
if(!e.IsOpened())
|
||||
{
|
||||
ConLog.Error("Could not create ELF file! (%s)", wxString(elf).wx_str());
|
||||
ConLog.Error("Could not create ELF file! (%s)", elf.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -508,18 +508,18 @@ bool SELFDecrypter::GetKeyFromRap(u8 *content_id, u8 *npdrm_key)
|
|||
memset(rap_key, 0, 0x10);
|
||||
|
||||
// Try to find a matching RAP file under dev_usb000.
|
||||
wxString ci_str(content_id);
|
||||
wxString rap_path(wxGetCwd() + "/dev_usb000/" + ci_str + ".rap");
|
||||
std::string ci_str((const char *)content_id);
|
||||
std::string rap_path(fmt::ToUTF8(wxGetCwd()) + "/dev_usb000/" + ci_str + ".rap");
|
||||
|
||||
// Check if we have a valid RAP file.
|
||||
if (!wxFile::Exists(rap_path))
|
||||
if (!wxFile::Exists(fmt::FromUTF8(rap_path)))
|
||||
{
|
||||
ConLog.Error("This application requires a valid RAP file for decryption!");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Open the RAP file and read the key.
|
||||
wxFile rap_file(rap_path, wxFile::read);
|
||||
wxFile rap_file(fmt::FromUTF8(rap_path), wxFile::read);
|
||||
|
||||
if (!rap_file.IsOpened())
|
||||
{
|
||||
|
@ -527,7 +527,7 @@ bool SELFDecrypter::GetKeyFromRap(u8 *content_id, u8 *npdrm_key)
|
|||
return false;
|
||||
}
|
||||
|
||||
ConLog.Write("Loading RAP file %s", ci_str.wc_str() + wchar_t(".rap"));
|
||||
ConLog.Write("Loading RAP file %s", (ci_str + ".rap").c_str());
|
||||
rap_file.Read(rap_key, 0x10);
|
||||
rap_file.Close();
|
||||
|
||||
|
@ -573,11 +573,11 @@ bool IsSelfElf32(const std::string& path)
|
|||
bool CheckDebugSelf(const std::string& self, const std::string& elf)
|
||||
{
|
||||
// Open the SELF file.
|
||||
wxFile s(self.c_str());
|
||||
wxFile s(fmt::FromUTF8(self));
|
||||
|
||||
if(!s.IsOpened())
|
||||
{
|
||||
ConLog.Error("Could not open SELF file! (%s)", wxString(self).wx_str());
|
||||
ConLog.Error("Could not open SELF file! (%s)", self.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -601,10 +601,10 @@ bool CheckDebugSelf(const std::string& self, const std::string& elf)
|
|||
s.Seek(elf_offset);
|
||||
|
||||
// Write the real ELF file back.
|
||||
wxFile e(elf.c_str(), wxFile::write);
|
||||
wxFile e(fmt::FromUTF8(elf), wxFile::write);
|
||||
if(!e.IsOpened())
|
||||
{
|
||||
ConLog.Error("Could not create ELF file! (%s)", wxString(elf).wx_str());
|
||||
ConLog.Error("Could not create ELF file! (%s)", elf.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -200,51 +200,51 @@ struct ControlInfo
|
|||
{
|
||||
if (size == 0x30)
|
||||
{
|
||||
wxString digest_str;
|
||||
std::string digest_str;
|
||||
for (int i = 0; i < 20; i++)
|
||||
digest_str += wxString::Format("%02x", file_digest_30.digest[i]);
|
||||
digest_str += fmt::Format("%02x", file_digest_30.digest[i]);
|
||||
|
||||
ConLog.Write("Digest: %s", digest_str.wc_str());
|
||||
ConLog.Write("Digest: %s", digest_str.c_str());
|
||||
ConLog.Write("Unknown: 0x%llx", file_digest_30.unknown);
|
||||
}
|
||||
else if (size == 0x40)
|
||||
{
|
||||
wxString digest_str1;
|
||||
wxString digest_str2;
|
||||
std::string digest_str1;
|
||||
std::string digest_str2;
|
||||
for (int i = 0; i < 20; i++)
|
||||
{
|
||||
digest_str1 += wxString::Format("%02x", file_digest_40.digest1[i]);
|
||||
digest_str2 += wxString::Format("%02x", file_digest_40.digest2[i]);
|
||||
digest_str1 += fmt::Format("%02x", file_digest_40.digest1[i]);
|
||||
digest_str2 += fmt::Format("%02x", file_digest_40.digest2[i]);
|
||||
}
|
||||
|
||||
ConLog.Write("Digest1: %s", digest_str1.wc_str());
|
||||
ConLog.Write("Digest2: %s", digest_str2.wc_str());
|
||||
ConLog.Write("Digest1: %s", digest_str1.c_str());
|
||||
ConLog.Write("Digest2: %s", digest_str2.c_str());
|
||||
ConLog.Write("Unknown: 0x%llx", file_digest_40.unknown);
|
||||
}
|
||||
}
|
||||
else if (type == 3)
|
||||
{
|
||||
wxString contentid_str;
|
||||
wxString digest_str;
|
||||
wxString invdigest_str;
|
||||
wxString xordigest_str;
|
||||
std::string contentid_str;
|
||||
std::string digest_str;
|
||||
std::string invdigest_str;
|
||||
std::string xordigest_str;
|
||||
for (int i = 0; i < 48; i++)
|
||||
contentid_str += wxString::Format("%02x", npdrm.content_id[i]);
|
||||
contentid_str += fmt::Format("%02x", npdrm.content_id[i]);
|
||||
for (int i = 0; i < 16; i++)
|
||||
{
|
||||
digest_str += wxString::Format("%02x", npdrm.digest[i]);
|
||||
invdigest_str += wxString::Format("%02x", npdrm.invdigest[i]);
|
||||
xordigest_str += wxString::Format("%02x", npdrm.xordigest[i]);
|
||||
digest_str += fmt::Format("%02x", npdrm.digest[i]);
|
||||
invdigest_str += fmt::Format("%02x", npdrm.invdigest[i]);
|
||||
xordigest_str += fmt::Format("%02x", npdrm.xordigest[i]);
|
||||
}
|
||||
|
||||
ConLog.Write("Magic: 0x%08x", npdrm.magic);
|
||||
ConLog.Write("Unknown1: 0x%08x", npdrm.unknown1);
|
||||
ConLog.Write("License: 0x%08x", npdrm.license);
|
||||
ConLog.Write("Type: 0x%08x", npdrm.type);
|
||||
ConLog.Write("ContentID: %s", contentid_str.wc_str());
|
||||
ConLog.Write("Digest: %s", digest_str.wc_str());
|
||||
ConLog.Write("Inverse digest: %s", invdigest_str.wc_str());
|
||||
ConLog.Write("XOR digest: %s", xordigest_str.wc_str());
|
||||
ConLog.Write("ContentID: %s", contentid_str.c_str());
|
||||
ConLog.Write("Digest: %s", digest_str.c_str());
|
||||
ConLog.Write("Inverse digest: %s", invdigest_str.c_str());
|
||||
ConLog.Write("XOR digest: %s", xordigest_str.c_str());
|
||||
ConLog.Write("Unknown2: 0x%llx", npdrm.unknown2);
|
||||
ConLog.Write("Unknown3: 0x%llx", npdrm.unknown3);
|
||||
}
|
||||
|
@ -269,22 +269,22 @@ struct MetadataInfo
|
|||
|
||||
void Show()
|
||||
{
|
||||
wxString key_str;
|
||||
wxString key_pad_str;
|
||||
wxString iv_str;
|
||||
wxString iv_pad_str;
|
||||
std::string key_str;
|
||||
std::string key_pad_str;
|
||||
std::string iv_str;
|
||||
std::string iv_pad_str;
|
||||
for (int i = 0; i < 0x10; i++)
|
||||
{
|
||||
key_str += wxString::Format("%02x", key[i]);
|
||||
key_pad_str += wxString::Format("%02x", key_pad[i]);
|
||||
iv_str += wxString::Format("%02x", iv[i]);
|
||||
iv_pad_str += wxString::Format("%02x", iv_pad[i]);
|
||||
key_str += fmt::Format("%02x", key[i]);
|
||||
key_pad_str += fmt::Format("%02x", key_pad[i]);
|
||||
iv_str += fmt::Format("%02x", iv[i]);
|
||||
iv_pad_str += fmt::Format("%02x", iv_pad[i]);
|
||||
}
|
||||
|
||||
ConLog.Write("Key: %s", key_str.wc_str());
|
||||
ConLog.Write("Key pad: %s", key_pad_str.wc_str());
|
||||
ConLog.Write("IV: %s", iv_str.wc_str());
|
||||
ConLog.Write("IV pad: %s", iv_pad_str.wc_str());
|
||||
ConLog.Write("Key: %s", key_str.c_str());
|
||||
ConLog.Write("Key pad: %s", key_pad_str.c_str());
|
||||
ConLog.Write("IV: %s", iv_str.c_str());
|
||||
ConLog.Write("IV pad: %s", iv_pad_str.c_str());
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -27,15 +27,15 @@ protected:
|
|||
return dump_pc + imm;
|
||||
}
|
||||
|
||||
wxString GetRegsListString(u16 regs_list)
|
||||
std::string GetRegsListString(u16 regs_list)
|
||||
{
|
||||
wxString regs_str;
|
||||
std::string regs_str;
|
||||
|
||||
for(u16 mask=0x1, i=0; mask; mask <<= 1, i++)
|
||||
{
|
||||
if(regs_list & mask)
|
||||
{
|
||||
if(!regs_str.IsEmpty())
|
||||
if(!regs_str.empty())
|
||||
{
|
||||
regs_str += ", ";
|
||||
}
|
||||
|
@ -54,12 +54,12 @@ protected:
|
|||
|
||||
void PUSH(u16 regs_list)
|
||||
{
|
||||
Write(wxString::Format("push {%s}", GetRegsListString(regs_list).mb_str()));
|
||||
Write(fmt::Format("push {%s}", GetRegsListString(regs_list).c_str()));
|
||||
}
|
||||
|
||||
void POP(u16 regs_list)
|
||||
{
|
||||
Write(wxString::Format("pop {%s}", GetRegsListString(regs_list).mb_str()));
|
||||
Write(fmt::Format("pop {%s}", GetRegsListString(regs_list).c_str()));
|
||||
}
|
||||
|
||||
void NOP()
|
||||
|
@ -71,26 +71,26 @@ protected:
|
|||
{
|
||||
if((cond & 0xe) == 0xe)
|
||||
{
|
||||
Write(wxString::Format("b 0x%x", DisAsmBranchTarget(imm) + intstr_size));
|
||||
Write(fmt::Format("b 0x%x", DisAsmBranchTarget(imm) + intstr_size));
|
||||
}
|
||||
else
|
||||
{
|
||||
Write(wxString::Format("b[%s] 0x%x", g_arm_cond_name[cond], DisAsmBranchTarget(imm) + intstr_size));
|
||||
Write(fmt::Format("b[%s] 0x%x", g_arm_cond_name[cond], DisAsmBranchTarget(imm) + intstr_size));
|
||||
}
|
||||
}
|
||||
|
||||
virtual void CBZ(u8 op, u32 imm, u8 rn, u8 intstr_size)
|
||||
{
|
||||
Write(wxString::Format("cb%sz 0x%x,%s", (op ? "n" : ""), DisAsmBranchTarget(imm) + intstr_size, g_arm_reg_name[rn]));
|
||||
Write(fmt::Format("cb%sz 0x%x,%s", (op ? "n" : ""), DisAsmBranchTarget(imm) + intstr_size, g_arm_reg_name[rn]));
|
||||
}
|
||||
|
||||
void BL(u32 imm, u8 intstr_size)
|
||||
{
|
||||
Write(wxString::Format("bl 0x%x", DisAsmBranchTarget(imm) + intstr_size));
|
||||
Write(fmt::Format("bl 0x%x", DisAsmBranchTarget(imm) + intstr_size));
|
||||
}
|
||||
|
||||
void UNK(const u16 code0, const u16 code1)
|
||||
{
|
||||
Write(wxString::Format("Unknown/Illegal opcode! (0x%04x : 0x%04x)", code0, code1));
|
||||
Write(fmt::Format("Unknown/Illegal opcode! (0x%04x : 0x%04x)", code0, code1));
|
||||
}
|
||||
};
|
||||
|
|
|
@ -37,25 +37,31 @@ void ARMv7Thread::SetArg(const uint pos, const u64 arg)
|
|||
assert(0);
|
||||
}
|
||||
|
||||
wxString ARMv7Thread::RegsToString()
|
||||
std::string ARMv7Thread::RegsToString()
|
||||
{
|
||||
wxString result = "Registers:\n=========\n";
|
||||
std::string result = "Registers:\n=========\n";
|
||||
for(int i=0; i<15; ++i)
|
||||
{
|
||||
result += wxString::Format("%s\t= 0x%08x\n", wxString(g_arm_reg_name[i]).wx_str(), GPR[i]);
|
||||
result += fmt::Format("%s\t= 0x%08x\n", g_arm_reg_name[i], GPR[i]);
|
||||
}
|
||||
|
||||
result += wxString::Format("APSR\t= 0x%08x [N: %d, Z: %d, C: %d, V: %d, Q: %d]\n", APSR.APSR, APSR.N, APSR.Z, APSR.C, APSR.V, APSR.Q);
|
||||
result += fmt::Format("APSR\t= 0x%08x [N: %d, Z: %d, C: %d, V: %d, Q: %d]\n",
|
||||
APSR.APSR,
|
||||
fmt::by_value(APSR.N),
|
||||
fmt::by_value(APSR.Z),
|
||||
fmt::by_value(APSR.C),
|
||||
fmt::by_value(APSR.V),
|
||||
fmt::by_value(APSR.Q));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
wxString ARMv7Thread::ReadRegString(wxString reg)
|
||||
std::string ARMv7Thread::ReadRegString(const std::string& reg)
|
||||
{
|
||||
return wxEmptyString;
|
||||
return "";
|
||||
}
|
||||
|
||||
bool ARMv7Thread::WriteRegString(wxString reg, wxString value)
|
||||
bool ARMv7Thread::WriteRegString(const std::string& reg, std::string value)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -84,9 +84,9 @@ public:
|
|||
virtual void SetArg(const uint pos, const u64 arg);
|
||||
|
||||
public:
|
||||
virtual wxString RegsToString();
|
||||
virtual wxString ReadRegString(wxString reg);
|
||||
virtual bool WriteRegString(wxString reg, wxString value);
|
||||
virtual std::string RegsToString();
|
||||
virtual std::string ReadRegString(const std::string& reg);
|
||||
virtual bool WriteRegString(const std::string& reg, std::string value);
|
||||
|
||||
protected:
|
||||
virtual void DoReset();
|
||||
|
|
|
@ -11,7 +11,7 @@ void printAlError(ALenum err, const char* situation)
|
|||
{
|
||||
if(err != AL_NO_ERROR)
|
||||
{
|
||||
ConLog.Error("%s: OpenAL error 0x%04x", wxString(situation).wx_str(), err);
|
||||
ConLog.Error("%s: OpenAL error 0x%04x", situation, err);
|
||||
Emu.Pause();
|
||||
}
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ void printAlcError(ALCenum err, const char* situation)
|
|||
{
|
||||
if(err != ALC_NO_ERROR)
|
||||
{
|
||||
ConLog.Error("%s: OpenALC error 0x%04x", wxString(situation).wx_str(), err);
|
||||
ConLog.Error("%s: OpenALC error 0x%04x", situation, err);
|
||||
Emu.Pause();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,24 +15,24 @@ class CPUDisAsm
|
|||
protected:
|
||||
const CPUDisAsmMode m_mode;
|
||||
|
||||
virtual void Write(const wxString& value)
|
||||
virtual void Write(const std::string& value)
|
||||
{
|
||||
switch(m_mode)
|
||||
{
|
||||
case CPUDisAsm_DumpMode:
|
||||
last_opcode = wxString::Format("\t%08llx:\t%02x %02x %02x %02x\t%s\n", dump_pc,
|
||||
last_opcode = fmt::Format("\t%08llx:\t%02x %02x %02x %02x\t%s\n", dump_pc,
|
||||
Memory.Read8(offset + dump_pc),
|
||||
Memory.Read8(offset + dump_pc + 1),
|
||||
Memory.Read8(offset + dump_pc + 2),
|
||||
Memory.Read8(offset + dump_pc + 3), value.wx_str());
|
||||
Memory.Read8(offset + dump_pc + 3), value.c_str());
|
||||
break;
|
||||
|
||||
case CPUDisAsm_InterpreterMode:
|
||||
last_opcode = wxString::Format("[%08llx] %02x %02x %02x %02x: %s", dump_pc,
|
||||
last_opcode = fmt::Format("[%08llx] %02x %02x %02x %02x: %s", dump_pc,
|
||||
Memory.Read8(offset + dump_pc),
|
||||
Memory.Read8(offset + dump_pc + 1),
|
||||
Memory.Read8(offset + dump_pc + 2),
|
||||
Memory.Read8(offset + dump_pc + 3), value.wx_str());
|
||||
Memory.Read8(offset + dump_pc + 3), value.c_str());
|
||||
break;
|
||||
|
||||
case CPUDisAsm_CompilerElfMode:
|
||||
|
@ -42,7 +42,7 @@ protected:
|
|||
}
|
||||
|
||||
public:
|
||||
wxString last_opcode;
|
||||
std::string last_opcode;
|
||||
u64 dump_pc;
|
||||
u64 offset;
|
||||
|
||||
|
@ -55,9 +55,9 @@ protected:
|
|||
|
||||
virtual u32 DisAsmBranchTarget(const s32 imm)=0;
|
||||
|
||||
wxString FixOp(wxString op)
|
||||
std::string FixOp(std::string op)
|
||||
{
|
||||
op.Append(' ', max<int>(8 - op.Len(), 0));
|
||||
op.append(max<int>(10 - (int)op.length(), 0),' ');
|
||||
return op;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -142,7 +142,7 @@ void CPUThread::SetBranch(const u64 pc, bool record_branch)
|
|||
{
|
||||
if(!Memory.IsGoodAddr(m_offset + pc))
|
||||
{
|
||||
ConLog.Error("%s branch error: bad address 0x%llx #pc: 0x%llx", GetFName().wx_str(), m_offset + pc, m_offset + PC);
|
||||
ConLog.Error("%s branch error: bad address 0x%llx #pc: 0x%llx", GetFName().c_str(), m_offset + pc, m_offset + PC);
|
||||
Emu.Pause();
|
||||
}
|
||||
|
||||
|
@ -296,7 +296,7 @@ void CPUThread::ExecOnce()
|
|||
|
||||
void CPUThread::Task()
|
||||
{
|
||||
if (Ini.HLELogging.GetValue()) ConLog.Write("%s enter", CPUThread::GetFName().wx_str());
|
||||
if (Ini.HLELogging.GetValue()) ConLog.Write("%s enter", CPUThread::GetFName().c_str());
|
||||
|
||||
const Array<u64>& bp = Emu.GetBreakPoints();
|
||||
|
||||
|
@ -345,20 +345,20 @@ void CPUThread::Task()
|
|||
}
|
||||
}
|
||||
}
|
||||
catch(const wxString& e)
|
||||
catch(const std::string& e)
|
||||
{
|
||||
ConLog.Error("Exception: %s", e.wx_str());
|
||||
ConLog.Error("Exception: %s", e.c_str());
|
||||
}
|
||||
catch(const char* e)
|
||||
{
|
||||
ConLog.Error("Exception: %s", wxString(e).wx_str());
|
||||
ConLog.Error("Exception: %s", e);
|
||||
}
|
||||
catch(int exitcode)
|
||||
{
|
||||
ConLog.Success("Exit Code: %d", exitcode);
|
||||
}
|
||||
|
||||
if (Ini.HLELogging.GetValue()) ConLog.Write("%s leave", CPUThread::GetFName().wx_str());
|
||||
if (Ini.HLELogging.GetValue()) ConLog.Write("%s leave", CPUThread::GetFName().c_str());
|
||||
}
|
||||
|
||||
s64 CPUThread::ExecAsCallback(u64 pc, bool wait, u64 a1, u64 a2, u64 a3, u64 a4) // not multithread-safe
|
||||
|
@ -393,7 +393,7 @@ s64 CPUThread::ExecAsCallback(u64 pc, bool wait, u64 a1, u64 a2, u64 a3, u64 a4)
|
|||
{
|
||||
if (Emu.IsStopped())
|
||||
{
|
||||
ConLog.Warning("ExecAsCallback(wait=%s) aborted", wxString(wait ? "true" : "false").wx_str());
|
||||
ConLog.Warning("ExecAsCallback(wait=%s) aborted", std::string(wait ? "true" : "false").c_str());
|
||||
return CELL_EABORT; // doesn't mean anything
|
||||
}
|
||||
Sleep(1);
|
||||
|
|
|
@ -87,17 +87,17 @@ public:
|
|||
u64 GetPrio() const { return m_prio; }
|
||||
|
||||
std::string GetName() const { return NamedThreadBase::GetThreadName(); }
|
||||
wxString GetFName() const
|
||||
std::string GetFName() const
|
||||
{
|
||||
return
|
||||
wxString::Format("%s[%d] Thread%s",
|
||||
GetTypeString().wx_str(),
|
||||
fmt::Format("%s[%d] Thread%s",
|
||||
GetTypeString().c_str(),
|
||||
m_id,
|
||||
wxString(GetName().empty() ? "" : wxString::Format(" (%s)", + wxString(GetName()).wx_str())).wx_str()
|
||||
(GetName().empty() ? std::string("") : fmt::Format(" (%s)", GetName().c_str())).c_str()
|
||||
);
|
||||
}
|
||||
|
||||
static wxString CPUThreadTypeToString(CPUThreadType type)
|
||||
static std::string CPUThreadTypeToString(CPUThreadType type)
|
||||
{
|
||||
switch(type)
|
||||
{
|
||||
|
@ -110,12 +110,12 @@ public:
|
|||
return "Unknown";
|
||||
}
|
||||
|
||||
wxString GetTypeString() const { return CPUThreadTypeToString(m_type); }
|
||||
std::string GetTypeString() const { return CPUThreadTypeToString(m_type); }
|
||||
|
||||
virtual std::string GetThreadName() const
|
||||
{
|
||||
wxString temp = (GetFName() + wxString::Format("[0x%08llx]", PC));
|
||||
return std::string(temp.mb_str());
|
||||
std::string temp = (GetFName() + fmt::Format("[0x%08llx]", PC));
|
||||
return temp;
|
||||
}
|
||||
|
||||
public:
|
||||
|
@ -181,11 +181,11 @@ public:
|
|||
void Resume();
|
||||
void Stop();
|
||||
|
||||
virtual void AddArgv(const wxString& arg) {}
|
||||
virtual void AddArgv(const std::string& arg) {}
|
||||
|
||||
virtual wxString RegsToString() = 0;
|
||||
virtual wxString ReadRegString(wxString reg) = 0;
|
||||
virtual bool WriteRegString(wxString reg, wxString value) = 0;
|
||||
virtual std::string RegsToString() = 0;
|
||||
virtual std::string ReadRegString(const std::string& reg) = 0;
|
||||
virtual bool WriteRegString(const std::string& reg, std::string value) = 0;
|
||||
|
||||
virtual void Exec();
|
||||
void ExecOnce();
|
||||
|
@ -198,13 +198,13 @@ public:
|
|||
|
||||
Stack<CallStackItem> m_call_stack;
|
||||
|
||||
wxString CallStackToString()
|
||||
std::string CallStackToString()
|
||||
{
|
||||
wxString ret = "Call Stack:\n==========\n";
|
||||
std::string ret = "Call Stack:\n==========\n";
|
||||
|
||||
for(uint i=0; i<m_call_stack.GetCount(); ++i)
|
||||
{
|
||||
ret += wxString::Format("0x%llx -> 0x%llx\n", m_call_stack[i].pc, m_call_stack[i].branch_pc);
|
||||
ret += fmt::Format("0x%llx -> 0x%llx\n", m_call_stack[i].pc, m_call_stack[i].branch_pc);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
|
|
@ -36,7 +36,7 @@ CPUThread& CPUThreadManager::AddThread(CPUThreadType type)
|
|||
default: assert(0);
|
||||
}
|
||||
|
||||
new_thread->SetId(Emu.GetIdManager().GetNewID(wxString::Format("%s Thread", new_thread->GetTypeString().wx_str()).ToStdString(), new_thread));
|
||||
new_thread->SetId(Emu.GetIdManager().GetNewID(fmt::Format("%s Thread", new_thread->GetTypeString().c_str()), new_thread));
|
||||
|
||||
m_threads.Add(new_thread);
|
||||
#ifndef QT_UI
|
||||
|
|
|
@ -13,226 +13,226 @@ protected:
|
|||
|
||||
virtual u32 DisAsmBranchTarget(const s32 imm)=0;
|
||||
|
||||
void DisAsm_V4(const wxString& op, u32 v0, u32 v1, u32 v2, u32 v3)
|
||||
void DisAsm_V4(const std::string& op, u32 v0, u32 v1, u32 v2, u32 v3)
|
||||
{
|
||||
Write(wxString::Format("%s v%d,v%d,v%d,v%d", FixOp(op).wx_str(), v0, v1, v2, v3));
|
||||
Write(fmt::Format("%s v%d,v%d,v%d,v%d", FixOp(op).c_str(), v0, v1, v2, v3));
|
||||
}
|
||||
void DisAsm_V3_UIMM(const wxString& op, u32 v0, u32 v1, u32 v2, u32 uimm)
|
||||
void DisAsm_V3_UIMM(const std::string& op, u32 v0, u32 v1, u32 v2, u32 uimm)
|
||||
{
|
||||
Write(wxString::Format("%s v%d,v%d,v%d,%u #%x", FixOp(op).wx_str(), v0, v1, v2, uimm, uimm));
|
||||
Write(fmt::Format("%s v%d,v%d,v%d,%u #%x", FixOp(op).c_str(), v0, v1, v2, uimm, uimm));
|
||||
}
|
||||
void DisAsm_V3(const wxString& op, u32 v0, u32 v1, u32 v2)
|
||||
void DisAsm_V3(const std::string& op, u32 v0, u32 v1, u32 v2)
|
||||
{
|
||||
Write(wxString::Format("%s v%d,v%d,v%d", FixOp(op).wx_str(), v0, v1, v2));
|
||||
Write(fmt::Format("%s v%d,v%d,v%d", FixOp(op).c_str(), v0, v1, v2));
|
||||
}
|
||||
void DisAsm_V2_UIMM(const wxString& op, u32 v0, u32 v1, u32 uimm)
|
||||
void DisAsm_V2_UIMM(const std::string& op, u32 v0, u32 v1, u32 uimm)
|
||||
{
|
||||
Write(wxString::Format("%s v%d,v%d,%u #%x", FixOp(op).wx_str(), v0, v1, uimm, uimm));
|
||||
Write(fmt::Format("%s v%d,v%d,%u #%x", FixOp(op).c_str(), v0, v1, uimm, uimm));
|
||||
}
|
||||
void DisAsm_V2(const wxString& op, u32 v0, u32 v1)
|
||||
void DisAsm_V2(const std::string& op, u32 v0, u32 v1)
|
||||
{
|
||||
Write(wxString::Format("%s v%d,v%d", FixOp(op).wx_str(), v0, v1));
|
||||
Write(fmt::Format("%s v%d,v%d", FixOp(op).c_str(), v0, v1));
|
||||
}
|
||||
void DisAsm_V1_SIMM(const wxString& op, u32 v0, s32 simm)
|
||||
void DisAsm_V1_SIMM(const std::string& op, u32 v0, s32 simm)
|
||||
{
|
||||
Write(wxString::Format("%s v%d,%d #%x", FixOp(op).wx_str(), v0, simm, simm));
|
||||
Write(fmt::Format("%s v%d,%d #%x", FixOp(op).c_str(), v0, simm, simm));
|
||||
}
|
||||
void DisAsm_V1(const wxString& op, u32 v0)
|
||||
void DisAsm_V1(const std::string& op, u32 v0)
|
||||
{
|
||||
Write(wxString::Format("%s v%d", FixOp(op).wx_str(), v0));
|
||||
Write(fmt::Format("%s v%d", FixOp(op).c_str(), v0));
|
||||
}
|
||||
void DisAsm_V1_R2(const wxString& op, u32 v0, u32 r1, u32 r2)
|
||||
void DisAsm_V1_R2(const std::string& op, u32 v0, u32 r1, u32 r2)
|
||||
{
|
||||
Write(wxString::Format("%s v%d,r%d,r%d", FixOp(op).wx_str(), v0, r1, r2));
|
||||
Write(fmt::Format("%s v%d,r%d,r%d", FixOp(op).c_str(), v0, r1, r2));
|
||||
}
|
||||
void DisAsm_CR1_F2_RC(const wxString& op, u32 cr0, u32 f0, u32 f1, bool rc)
|
||||
void DisAsm_CR1_F2_RC(const std::string& op, u32 cr0, u32 f0, u32 f1, bool rc)
|
||||
{
|
||||
Write(wxString::Format("%s%s cr%d,f%d,f%d", FixOp(op).wx_str(), wxString(rc ? "." : "").wx_str(), cr0, f0, f1));
|
||||
Write(fmt::Format("%s%s cr%d,f%d,f%d", FixOp(op).c_str(), (rc ? "." : ""), cr0, f0, f1));
|
||||
}
|
||||
void DisAsm_CR1_F2(const wxString& op, u32 cr0, u32 f0, u32 f1)
|
||||
void DisAsm_CR1_F2(const std::string& op, u32 cr0, u32 f0, u32 f1)
|
||||
{
|
||||
DisAsm_CR1_F2_RC(op, cr0, f0, f1, false);
|
||||
}
|
||||
void DisAsm_INT1_R2(const wxString& op, u32 i0, u32 r0, u32 r1)
|
||||
void DisAsm_INT1_R2(const std::string& op, u32 i0, u32 r0, u32 r1)
|
||||
{
|
||||
Write(wxString::Format("%s %d,r%d,r%d", FixOp(op).wx_str(), i0, r0, r1));
|
||||
Write(fmt::Format("%s %d,r%d,r%d", FixOp(op).c_str(), i0, r0, r1));
|
||||
}
|
||||
void DisAsm_INT1_R1_IMM(const wxString& op, u32 i0, u32 r0, s32 imm0)
|
||||
void DisAsm_INT1_R1_IMM(const std::string& op, u32 i0, u32 r0, s32 imm0)
|
||||
{
|
||||
Write(wxString::Format("%s %d,r%d,%d #%x", FixOp(op).wx_str(), i0, r0, imm0, imm0));
|
||||
Write(fmt::Format("%s %d,r%d,%d #%x", FixOp(op).c_str(), i0, r0, imm0, imm0));
|
||||
}
|
||||
void DisAsm_INT1_R1_RC(const wxString& op, u32 i0, u32 r0, bool rc)
|
||||
void DisAsm_INT1_R1_RC(const std::string& op, u32 i0, u32 r0, bool rc)
|
||||
{
|
||||
Write(wxString::Format("%s%s %d,r%d", FixOp(op).wx_str(), wxString(rc ? "." : "").wx_str(), i0, r0));
|
||||
Write(fmt::Format("%s%s %d,r%d", FixOp(op).c_str(), (rc ? "." : ""), i0, r0));
|
||||
}
|
||||
void DisAsm_INT1_R1(const wxString& op, u32 i0, u32 r0)
|
||||
void DisAsm_INT1_R1(const std::string& op, u32 i0, u32 r0)
|
||||
{
|
||||
DisAsm_INT1_R1_RC(op, i0, r0, false);
|
||||
}
|
||||
void DisAsm_F4_RC(const wxString& op, u32 f0, u32 f1, u32 f2, u32 f3, bool rc)
|
||||
void DisAsm_F4_RC(const std::string& op, u32 f0, u32 f1, u32 f2, u32 f3, bool rc)
|
||||
{
|
||||
Write(wxString::Format("%s%s f%d,f%d,f%d,f%d", FixOp(op).wx_str(), wxString(rc ? "." : "").wx_str(), f0, f1, f2, f3));
|
||||
Write(fmt::Format("%s%s f%d,f%d,f%d,f%d", FixOp(op).c_str(), (rc ? "." : ""), f0, f1, f2, f3));
|
||||
}
|
||||
void DisAsm_F3_RC(const wxString& op, u32 f0, u32 f1, u32 f2, bool rc)
|
||||
void DisAsm_F3_RC(const std::string& op, u32 f0, u32 f1, u32 f2, bool rc)
|
||||
{
|
||||
Write(wxString::Format("%s%s f%d,f%d,f%d", FixOp(op).wx_str(), wxString(rc ? "." : "").wx_str(), f0, f1, f2));
|
||||
Write(fmt::Format("%s%s f%d,f%d,f%d", FixOp(op).c_str(), (rc ? "." : ""), f0, f1, f2));
|
||||
}
|
||||
void DisAsm_F3(const wxString& op, u32 f0, u32 f1, u32 f2)
|
||||
void DisAsm_F3(const std::string& op, u32 f0, u32 f1, u32 f2)
|
||||
{
|
||||
DisAsm_F3_RC(op, f0, f1, f2, false);
|
||||
}
|
||||
void DisAsm_F2_RC(const wxString& op, u32 f0, u32 f1, bool rc)
|
||||
void DisAsm_F2_RC(const std::string& op, u32 f0, u32 f1, bool rc)
|
||||
{
|
||||
Write(wxString::Format("%s%s f%d,f%d", FixOp(op).wx_str(), wxString(rc ? "." : "").wx_str(), f0, f1));
|
||||
Write(fmt::Format("%s%s f%d,f%d", FixOp(op).c_str(), (rc ? "." : ""), f0, f1));
|
||||
}
|
||||
void DisAsm_F2(const wxString& op, u32 f0, u32 f1)
|
||||
void DisAsm_F2(const std::string& op, u32 f0, u32 f1)
|
||||
{
|
||||
DisAsm_F2_RC(op, f0, f1, false);
|
||||
}
|
||||
void DisAsm_F1_R2(const wxString& op, u32 f0, u32 r0, u32 r1)
|
||||
void DisAsm_F1_R2(const std::string& op, u32 f0, u32 r0, u32 r1)
|
||||
{
|
||||
if(m_mode == CPUDisAsm_CompilerElfMode)
|
||||
{
|
||||
Write(wxString::Format("%s f%d,r%d,r%d", FixOp(op).wx_str(), f0, r0, r1));
|
||||
Write(fmt::Format("%s f%d,r%d,r%d", FixOp(op).c_str(), f0, r0, r1));
|
||||
return;
|
||||
}
|
||||
|
||||
Write(wxString::Format("%s f%d,r%d(r%d)", FixOp(op).wx_str(), f0, r0, r1));
|
||||
Write(fmt::Format("%s f%d,r%d(r%d)", FixOp(op).c_str(), f0, r0, r1));
|
||||
}
|
||||
void DisAsm_F1_IMM_R1_RC(const wxString& op, u32 f0, s32 imm0, u32 r0, bool rc)
|
||||
void DisAsm_F1_IMM_R1_RC(const std::string& op, u32 f0, s32 imm0, u32 r0, bool rc)
|
||||
{
|
||||
if(m_mode == CPUDisAsm_CompilerElfMode)
|
||||
{
|
||||
Write(wxString::Format("%s%s f%d,r%d,%d #%x", FixOp(op).wx_str(), wxString(rc ? "." : "").wx_str(), f0, r0, imm0, imm0));
|
||||
Write(fmt::Format("%s%s f%d,r%d,%d #%x", FixOp(op).c_str(), (rc ? "." : ""), f0, r0, imm0, imm0));
|
||||
return;
|
||||
}
|
||||
|
||||
Write(wxString::Format("%s%s f%d,%d(r%d) #%x", FixOp(op).wx_str(), wxString(rc ? "." : "").wx_str(), f0, imm0, r0, imm0));
|
||||
Write(fmt::Format("%s%s f%d,%d(r%d) #%x", FixOp(op).c_str(), (rc ? "." : ""), f0, imm0, r0, imm0));
|
||||
}
|
||||
void DisAsm_F1_IMM_R1(const wxString& op, u32 f0, s32 imm0, u32 r0)
|
||||
void DisAsm_F1_IMM_R1(const std::string& op, u32 f0, s32 imm0, u32 r0)
|
||||
{
|
||||
DisAsm_F1_IMM_R1_RC(op, f0, imm0, r0, false);
|
||||
}
|
||||
void DisAsm_F1_RC(const wxString& op, u32 f0, bool rc)
|
||||
void DisAsm_F1_RC(const std::string& op, u32 f0, bool rc)
|
||||
{
|
||||
Write(wxString::Format("%s%s f%d", FixOp(op).wx_str(), wxString(rc ? "." : "").wx_str(), f0));
|
||||
Write(fmt::Format("%s%s f%d", FixOp(op).c_str(), (rc ? "." : ""), f0));
|
||||
}
|
||||
void DisAsm_R1_RC(const wxString& op, u32 r0, bool rc)
|
||||
void DisAsm_R1_RC(const std::string& op, u32 r0, bool rc)
|
||||
{
|
||||
Write(wxString::Format("%s%s r%d", FixOp(op).wx_str(), wxString(rc ? "." : "").wx_str(), r0));
|
||||
Write(fmt::Format("%s%s r%d", FixOp(op).c_str(), (rc ? "." : ""), r0));
|
||||
}
|
||||
void DisAsm_R1(const wxString& op, u32 r0)
|
||||
void DisAsm_R1(const std::string& op, u32 r0)
|
||||
{
|
||||
DisAsm_R1_RC(op, r0, false);
|
||||
}
|
||||
void DisAsm_R2_OE_RC(const wxString& op, u32 r0, u32 r1, u32 oe, bool rc)
|
||||
void DisAsm_R2_OE_RC(const std::string& op, u32 r0, u32 r1, u32 oe, bool rc)
|
||||
{
|
||||
Write(wxString::Format("%s%s%s r%d,r%d", FixOp(op).wx_str(), wxString(oe ? "o" : "").wx_str(), wxString(rc ? "." : "").wx_str(), r0, r1));
|
||||
Write(fmt::Format("%s%s%s r%d,r%d", FixOp(op).c_str(), (oe ? "o" : ""), (rc ? "." : ""), r0, r1));
|
||||
}
|
||||
void DisAsm_R2_RC(const wxString& op, u32 r0, u32 r1, bool rc)
|
||||
void DisAsm_R2_RC(const std::string& op, u32 r0, u32 r1, bool rc)
|
||||
{
|
||||
DisAsm_R2_OE_RC(op, r0, r1, false, rc);
|
||||
}
|
||||
void DisAsm_R2(const wxString& op, u32 r0, u32 r1)
|
||||
void DisAsm_R2(const std::string& op, u32 r0, u32 r1)
|
||||
{
|
||||
DisAsm_R2_RC(op, r0, r1, false);
|
||||
}
|
||||
void DisAsm_R3_OE_RC(const wxString& op, u32 r0, u32 r1, u32 r2, u32 oe, bool rc)
|
||||
void DisAsm_R3_OE_RC(const std::string& op, u32 r0, u32 r1, u32 r2, u32 oe, bool rc)
|
||||
{
|
||||
Write(wxString::Format("%s%s%s r%d,r%d,r%d", FixOp(op).wx_str(), wxString(oe ? "o" : "").wx_str(), wxString(rc ? "." : "").wx_str(), r0, r1, r2));
|
||||
Write(fmt::Format("%s%s%s r%d,r%d,r%d", FixOp(op).c_str(), (oe ? "o" : ""), (rc ? "." : ""), r0, r1, r2));
|
||||
}
|
||||
void DisAsm_R3_INT2_RC(const wxString& op, u32 r0, u32 r1, u32 r2, s32 i0, s32 i1, bool rc)
|
||||
void DisAsm_R3_INT2_RC(const std::string& op, u32 r0, u32 r1, u32 r2, s32 i0, s32 i1, bool rc)
|
||||
{
|
||||
Write(wxString::Format("%s%s r%d,r%d,r%d,%d,%d", FixOp(op).wx_str(), wxString(rc ? "." : "").wx_str(), r0, r1, r2, i0, i1));
|
||||
Write(fmt::Format("%s%s r%d,r%d,r%d,%d,%d", FixOp(op).c_str(), (rc ? "." : ""), r0, r1, r2, i0, i1));
|
||||
}
|
||||
void DisAsm_R3_RC(const wxString& op, u32 r0, u32 r1, u32 r2, bool rc)
|
||||
void DisAsm_R3_RC(const std::string& op, u32 r0, u32 r1, u32 r2, bool rc)
|
||||
{
|
||||
DisAsm_R3_OE_RC(op, r0, r1, r2, false, rc);
|
||||
}
|
||||
void DisAsm_R3(const wxString& op, u32 r0, u32 r1, u32 r2)
|
||||
void DisAsm_R3(const std::string& op, u32 r0, u32 r1, u32 r2)
|
||||
{
|
||||
DisAsm_R3_RC(op, r0, r1, r2, false);
|
||||
}
|
||||
void DisAsm_R2_INT3_RC(const wxString& op, u32 r0, u32 r1, s32 i0, s32 i1, s32 i2, bool rc)
|
||||
void DisAsm_R2_INT3_RC(const std::string& op, u32 r0, u32 r1, s32 i0, s32 i1, s32 i2, bool rc)
|
||||
{
|
||||
Write(wxString::Format("%s%s r%d,r%d,%d,%d,%d", FixOp(op).wx_str(), wxString(rc ? "." : "").wx_str(), r0, r1, i0, i1, i2));
|
||||
Write(fmt::Format("%s%s r%d,r%d,%d,%d,%d", FixOp(op).c_str(), (rc ? "." : ""), r0, r1, i0, i1, i2));
|
||||
}
|
||||
void DisAsm_R2_INT3(const wxString& op, u32 r0, u32 r1, s32 i0, s32 i1, s32 i2)
|
||||
void DisAsm_R2_INT3(const std::string& op, u32 r0, u32 r1, s32 i0, s32 i1, s32 i2)
|
||||
{
|
||||
DisAsm_R2_INT3_RC(op, r0, r1, i0, i1, i2, false);
|
||||
}
|
||||
void DisAsm_R2_INT2_RC(const wxString& op, u32 r0, u32 r1, s32 i0, s32 i1, bool rc)
|
||||
void DisAsm_R2_INT2_RC(const std::string& op, u32 r0, u32 r1, s32 i0, s32 i1, bool rc)
|
||||
{
|
||||
Write(wxString::Format("%s%s r%d,r%d,%d,%d", FixOp(op).wx_str(), wxString(rc ? "." : "").wx_str(), r0, r1, i0, i1));
|
||||
Write(fmt::Format("%s%s r%d,r%d,%d,%d", FixOp(op).c_str(), (rc ? "." : ""), r0, r1, i0, i1));
|
||||
}
|
||||
void DisAsm_R2_INT2(const wxString& op, u32 r0, u32 r1, s32 i0, s32 i1)
|
||||
void DisAsm_R2_INT2(const std::string& op, u32 r0, u32 r1, s32 i0, s32 i1)
|
||||
{
|
||||
DisAsm_R2_INT2_RC(op, r0, r1, i0, i1, false);
|
||||
}
|
||||
void DisAsm_R2_INT1_RC(const wxString& op, u32 r0, u32 r1, s32 i0, bool rc)
|
||||
void DisAsm_R2_INT1_RC(const std::string& op, u32 r0, u32 r1, s32 i0, bool rc)
|
||||
{
|
||||
Write(wxString::Format("%s%s r%d,r%d,%d", FixOp(op).wx_str(), wxString(rc ? "." : "").wx_str(), r0, r1, i0));
|
||||
Write(fmt::Format("%s%s r%d,r%d,%d", FixOp(op).c_str(), (rc ? "." : ""), r0, r1, i0));
|
||||
}
|
||||
void DisAsm_R2_INT1(const wxString& op, u32 r0, u32 r1, s32 i0)
|
||||
void DisAsm_R2_INT1(const std::string& op, u32 r0, u32 r1, s32 i0)
|
||||
{
|
||||
DisAsm_R2_INT1_RC(op, r0, r1, i0, false);
|
||||
}
|
||||
void DisAsm_R2_IMM(const wxString& op, u32 r0, u32 r1, s32 imm0)
|
||||
void DisAsm_R2_IMM(const std::string& op, u32 r0, u32 r1, s32 imm0)
|
||||
{
|
||||
if(m_mode == CPUDisAsm_CompilerElfMode)
|
||||
{
|
||||
Write(wxString::Format("%s r%d,r%d,%d #%x", FixOp(op).wx_str(), r0, r1, imm0, imm0));
|
||||
Write(fmt::Format("%s r%d,r%d,%d #%x", FixOp(op).c_str(), r0, r1, imm0, imm0));
|
||||
return;
|
||||
}
|
||||
|
||||
Write(wxString::Format("%s r%d,%d(r%d) #%x", FixOp(op).wx_str(), r0, imm0, r1, imm0));
|
||||
Write(fmt::Format("%s r%d,%d(r%d) #%x", FixOp(op).c_str(), r0, imm0, r1, imm0));
|
||||
}
|
||||
void DisAsm_R1_IMM(const wxString& op, u32 r0, s32 imm0)
|
||||
void DisAsm_R1_IMM(const std::string& op, u32 r0, s32 imm0)
|
||||
{
|
||||
Write(wxString::Format("%s r%d,%d #%x", FixOp(op).wx_str(), r0, imm0, imm0));
|
||||
Write(fmt::Format("%s r%d,%d #%x", FixOp(op).c_str(), r0, imm0, imm0));
|
||||
}
|
||||
void DisAsm_IMM_R1(const wxString& op, s32 imm0, u32 r0)
|
||||
void DisAsm_IMM_R1(const std::string& op, s32 imm0, u32 r0)
|
||||
{
|
||||
Write(wxString::Format("%s %d,r%d #%x", FixOp(op).wx_str(), imm0, r0, imm0));
|
||||
Write(fmt::Format("%s %d,r%d #%x", FixOp(op).c_str(), imm0, r0, imm0));
|
||||
}
|
||||
void DisAsm_CR1_R1_IMM(const wxString& op, u32 cr0, u32 r0, s32 imm0)
|
||||
void DisAsm_CR1_R1_IMM(const std::string& op, u32 cr0, u32 r0, s32 imm0)
|
||||
{
|
||||
Write(wxString::Format("%s cr%d,r%d,%d #%x", FixOp(op).wx_str(), cr0, r0, imm0, imm0));
|
||||
Write(fmt::Format("%s cr%d,r%d,%d #%x", FixOp(op).c_str(), cr0, r0, imm0, imm0));
|
||||
}
|
||||
void DisAsm_CR1_R2_RC(const wxString& op, u32 cr0, u32 r0, u32 r1, bool rc)
|
||||
void DisAsm_CR1_R2_RC(const std::string& op, u32 cr0, u32 r0, u32 r1, bool rc)
|
||||
{
|
||||
Write(wxString::Format("%s%s cr%d,r%d,r%d", FixOp(op).wx_str(), wxString(rc ? "." : "").wx_str(), cr0, r0, r1));
|
||||
Write(fmt::Format("%s%s cr%d,r%d,r%d", FixOp(op).c_str(), (rc ? "." : ""), cr0, r0, r1));
|
||||
}
|
||||
void DisAsm_CR1_R2(const wxString& op, u32 cr0, u32 r0, u32 r1)
|
||||
void DisAsm_CR1_R2(const std::string& op, u32 cr0, u32 r0, u32 r1)
|
||||
{
|
||||
DisAsm_CR1_R2_RC(op, cr0, r0, r1, false);
|
||||
}
|
||||
void DisAsm_CR2(const wxString& op, u32 cr0, u32 cr1)
|
||||
void DisAsm_CR2(const std::string& op, u32 cr0, u32 cr1)
|
||||
{
|
||||
Write(wxString::Format("%s cr%d,cr%d", FixOp(op).wx_str(), cr0, cr1));
|
||||
Write(fmt::Format("%s cr%d,cr%d", FixOp(op).c_str(), cr0, cr1));
|
||||
}
|
||||
void DisAsm_INT3(const wxString& op, const int i0, const int i1, const int i2)
|
||||
void DisAsm_INT3(const std::string& op, const int i0, const int i1, const int i2)
|
||||
{
|
||||
Write(wxString::Format("%s %d,%d,%d", FixOp(op).wx_str(), i0, i1, i2));
|
||||
Write(fmt::Format("%s %d,%d,%d", FixOp(op).c_str(), i0, i1, i2));
|
||||
}
|
||||
void DisAsm_INT1(const wxString& op, const int i0)
|
||||
void DisAsm_INT1(const std::string& op, const int i0)
|
||||
{
|
||||
Write(wxString::Format("%s %d", FixOp(op).wx_str(), i0));
|
||||
Write(fmt::Format("%s %d", FixOp(op).c_str(), i0));
|
||||
}
|
||||
void DisAsm_BRANCH(const wxString& op, const int pc)
|
||||
void DisAsm_BRANCH(const std::string& op, const int pc)
|
||||
{
|
||||
Write(wxString::Format("%s 0x%x", FixOp(op).wx_str(), DisAsmBranchTarget(pc)));
|
||||
Write(fmt::Format("%s 0x%x", FixOp(op).c_str(), DisAsmBranchTarget(pc)));
|
||||
}
|
||||
void DisAsm_BRANCH_A(const wxString& op, const int pc)
|
||||
void DisAsm_BRANCH_A(const std::string& op, const int pc)
|
||||
{
|
||||
Write(wxString::Format("%s 0x%x", FixOp(op).wx_str(), pc));
|
||||
Write(fmt::Format("%s 0x%x", FixOp(op).c_str(), pc));
|
||||
}
|
||||
void DisAsm_B2_BRANCH(const wxString& op, u32 b0, u32 b1, const int pc)
|
||||
void DisAsm_B2_BRANCH(const std::string& op, u32 b0, u32 b1, const int pc)
|
||||
{
|
||||
Write(wxString::Format("%s %d,%d,0x%x ", FixOp(op).wx_str(), b0, b1, DisAsmBranchTarget(pc)));
|
||||
Write(fmt::Format("%s %d,%d,0x%x ", FixOp(op).c_str(), b0, b1, DisAsmBranchTarget(pc)));
|
||||
}
|
||||
void DisAsm_CR_BRANCH(const wxString& op, u32 cr, const int pc)
|
||||
void DisAsm_CR_BRANCH(const std::string& op, u32 cr, const int pc)
|
||||
{
|
||||
Write(wxString::Format("%s cr%d,0x%x ", FixOp(op).wx_str(), cr, DisAsmBranchTarget(pc)));
|
||||
Write(fmt::Format("%s cr%d,0x%x ", FixOp(op).c_str(), cr, DisAsmBranchTarget(pc)));
|
||||
}
|
||||
};
|
||||
|
|
|
@ -8,7 +8,7 @@ PPCThread* GetCurrentPPCThread()
|
|||
|
||||
if(!thread || (thread->GetType() != CPU_THREAD_PPU && thread->GetType() != CPU_THREAD_SPU && thread->GetType() != CPU_THREAD_RAW_SPU))
|
||||
{
|
||||
throw wxString("GetCurrentPPCThread: bad thread");
|
||||
throw std::string("GetCurrentPPCThread: bad thread");
|
||||
}
|
||||
|
||||
return (PPCThread*)thread;
|
||||
|
|
|
@ -17,7 +17,7 @@ public:
|
|||
|
||||
virtual std::string GetThreadName() const
|
||||
{
|
||||
return (GetFName() + wxString::Format("[0x%08llx]", PC)).ToStdString();
|
||||
return (GetFName() + fmt::Format("[0x%08llx]", PC));
|
||||
}
|
||||
|
||||
protected:
|
||||
|
|
|
@ -22,227 +22,227 @@ private:
|
|||
}
|
||||
|
||||
private:
|
||||
void DisAsm_V4(const wxString& op, u32 v0, u32 v1, u32 v2, u32 v3)
|
||||
void DisAsm_V4(const std::string& op, u32 v0, u32 v1, u32 v2, u32 v3)
|
||||
{
|
||||
Write(wxString::Format("%s v%d,v%d,v%d,v%d", FixOp(op).wx_str(), v0, v1, v2, v3));
|
||||
Write(fmt::Format("%s v%d,v%d,v%d,v%d", FixOp(op).c_str(), v0, v1, v2, v3));
|
||||
}
|
||||
void DisAsm_V3_UIMM(const wxString& op, u32 v0, u32 v1, u32 v2, u32 uimm)
|
||||
void DisAsm_V3_UIMM(const std::string& op, u32 v0, u32 v1, u32 v2, u32 uimm)
|
||||
{
|
||||
Write(wxString::Format("%s v%d,v%d,v%d,%u #%x", FixOp(op).wx_str(), v0, v1, v2, uimm, uimm));
|
||||
Write(fmt::Format("%s v%d,v%d,v%d,%u #%x", FixOp(op).c_str(), v0, v1, v2, uimm, uimm));
|
||||
}
|
||||
void DisAsm_V3(const wxString& op, u32 v0, u32 v1, u32 v2)
|
||||
void DisAsm_V3(const std::string& op, u32 v0, u32 v1, u32 v2)
|
||||
{
|
||||
Write(wxString::Format("%s v%d,v%d,v%d", FixOp(op).wx_str(), v0, v1, v2));
|
||||
Write(fmt::Format("%s v%d,v%d,v%d", FixOp(op).c_str(), v0, v1, v2));
|
||||
}
|
||||
void DisAsm_V2_UIMM(const wxString& op, u32 v0, u32 v1, u32 uimm)
|
||||
void DisAsm_V2_UIMM(const std::string& op, u32 v0, u32 v1, u32 uimm)
|
||||
{
|
||||
Write(wxString::Format("%s v%d,v%d,%u #%x", FixOp(op).wx_str(), v0, v1, uimm, uimm));
|
||||
Write(fmt::Format("%s v%d,v%d,%u #%x", FixOp(op).c_str(), v0, v1, uimm, uimm));
|
||||
}
|
||||
void DisAsm_V2(const wxString& op, u32 v0, u32 v1)
|
||||
void DisAsm_V2(const std::string& op, u32 v0, u32 v1)
|
||||
{
|
||||
Write(wxString::Format("%s v%d,v%d", FixOp(op).wx_str(), v0, v1));
|
||||
Write(fmt::Format("%s v%d,v%d", FixOp(op).c_str(), v0, v1));
|
||||
}
|
||||
void DisAsm_V1_SIMM(const wxString& op, u32 v0, s32 simm)
|
||||
void DisAsm_V1_SIMM(const std::string& op, u32 v0, s32 simm)
|
||||
{
|
||||
Write(wxString::Format("%s v%d,%d #%x", FixOp(op).wx_str(), v0, simm, simm));
|
||||
Write(fmt::Format("%s v%d,%d #%x", FixOp(op).c_str(), v0, simm, simm));
|
||||
}
|
||||
void DisAsm_V1(const wxString& op, u32 v0)
|
||||
void DisAsm_V1(const std::string& op, u32 v0)
|
||||
{
|
||||
Write(wxString::Format("%s v%d", FixOp(op).wx_str(), v0));
|
||||
Write(fmt::Format("%s v%d", FixOp(op).c_str(), v0));
|
||||
}
|
||||
void DisAsm_V1_R2(const wxString& op, u32 v0, u32 r1, u32 r2)
|
||||
void DisAsm_V1_R2(const std::string& op, u32 v0, u32 r1, u32 r2)
|
||||
{
|
||||
Write(wxString::Format("%s v%d,r%d,r%d", FixOp(op).wx_str(), v0, r1, r2));
|
||||
Write(fmt::Format("%s v%d,r%d,r%d", FixOp(op).c_str(), v0, r1, r2));
|
||||
}
|
||||
void DisAsm_CR1_F2_RC(const wxString& op, u32 cr0, u32 f0, u32 f1, bool rc)
|
||||
void DisAsm_CR1_F2_RC(const std::string& op, u32 cr0, u32 f0, u32 f1, bool rc)
|
||||
{
|
||||
Write(wxString::Format("%s%s cr%d,f%d,f%d", FixOp(op).wx_str(), wxString(rc ? "." : "").wx_str(), cr0, f0, f1));
|
||||
Write(fmt::Format("%s%s cr%d,f%d,f%d", FixOp(op).c_str(), (rc ? "." : ""), cr0, f0, f1));
|
||||
}
|
||||
void DisAsm_CR1_F2(const wxString& op, u32 cr0, u32 f0, u32 f1)
|
||||
void DisAsm_CR1_F2(const std::string& op, u32 cr0, u32 f0, u32 f1)
|
||||
{
|
||||
DisAsm_CR1_F2_RC(op, cr0, f0, f1, false);
|
||||
}
|
||||
void DisAsm_INT1_R2(const wxString& op, u32 i0, u32 r0, u32 r1)
|
||||
void DisAsm_INT1_R2(const std::string& op, u32 i0, u32 r0, u32 r1)
|
||||
{
|
||||
Write(wxString::Format("%s %d,r%d,r%d", FixOp(op).wx_str(), i0, r0, r1));
|
||||
Write(fmt::Format("%s %d,r%d,r%d", FixOp(op).c_str(), i0, r0, r1));
|
||||
}
|
||||
void DisAsm_INT1_R1_IMM(const wxString& op, u32 i0, u32 r0, s32 imm0)
|
||||
void DisAsm_INT1_R1_IMM(const std::string& op, u32 i0, u32 r0, s32 imm0)
|
||||
{
|
||||
Write(wxString::Format("%s %d,r%d,%d #%x", FixOp(op).wx_str(), i0, r0, imm0, imm0));
|
||||
Write(fmt::Format("%s %d,r%d,%d #%x", FixOp(op).c_str(), i0, r0, imm0, imm0));
|
||||
}
|
||||
void DisAsm_INT1_R1_RC(const wxString& op, u32 i0, u32 r0, bool rc)
|
||||
void DisAsm_INT1_R1_RC(const std::string& op, u32 i0, u32 r0, bool rc)
|
||||
{
|
||||
Write(wxString::Format("%s%s %d,r%d", FixOp(op).wx_str(), wxString(rc ? "." : "").wx_str(), i0, r0));
|
||||
Write(fmt::Format("%s%s %d,r%d", FixOp(op).c_str(), (rc ? "." : ""), i0, r0));
|
||||
}
|
||||
void DisAsm_INT1_R1(const wxString& op, u32 i0, u32 r0)
|
||||
void DisAsm_INT1_R1(const std::string& op, u32 i0, u32 r0)
|
||||
{
|
||||
DisAsm_INT1_R1_RC(op, i0, r0, false);
|
||||
}
|
||||
void DisAsm_F4_RC(const wxString& op, u32 f0, u32 f1, u32 f2, u32 f3, bool rc)
|
||||
void DisAsm_F4_RC(const std::string& op, u32 f0, u32 f1, u32 f2, u32 f3, bool rc)
|
||||
{
|
||||
Write(wxString::Format("%s%s f%d,f%d,f%d,f%d", FixOp(op).wx_str(), wxString(rc ? "." : "").wx_str(), f0, f1, f2, f3));
|
||||
Write(fmt::Format("%s%s f%d,f%d,f%d,f%d", FixOp(op).c_str(), (rc ? "." : ""), f0, f1, f2, f3));
|
||||
}
|
||||
void DisAsm_F3_RC(const wxString& op, u32 f0, u32 f1, u32 f2, bool rc)
|
||||
void DisAsm_F3_RC(const std::string& op, u32 f0, u32 f1, u32 f2, bool rc)
|
||||
{
|
||||
Write(wxString::Format("%s%s f%d,f%d,f%d", FixOp(op).wx_str(), wxString(rc ? "." : "").wx_str(), f0, f1, f2));
|
||||
Write(fmt::Format("%s%s f%d,f%d,f%d", FixOp(op).c_str(), (rc ? "." : ""), f0, f1, f2));
|
||||
}
|
||||
void DisAsm_F3(const wxString& op, u32 f0, u32 f1, u32 f2)
|
||||
void DisAsm_F3(const std::string& op, u32 f0, u32 f1, u32 f2)
|
||||
{
|
||||
DisAsm_F3_RC(op, f0, f1, f2, false);
|
||||
}
|
||||
void DisAsm_F2_RC(const wxString& op, u32 f0, u32 f1, bool rc)
|
||||
void DisAsm_F2_RC(const std::string& op, u32 f0, u32 f1, bool rc)
|
||||
{
|
||||
Write(wxString::Format("%s%s f%d,f%d", FixOp(op).wx_str(), wxString(rc ? "." : "").wx_str(), f0, f1));
|
||||
Write(fmt::Format("%s%s f%d,f%d", FixOp(op).c_str(), (rc ? "." : ""), f0, f1));
|
||||
}
|
||||
void DisAsm_F2(const wxString& op, u32 f0, u32 f1)
|
||||
void DisAsm_F2(const std::string& op, u32 f0, u32 f1)
|
||||
{
|
||||
DisAsm_F2_RC(op, f0, f1, false);
|
||||
}
|
||||
void DisAsm_F1_R2(const wxString& op, u32 f0, u32 r0, u32 r1)
|
||||
void DisAsm_F1_R2(const std::string& op, u32 f0, u32 r0, u32 r1)
|
||||
{
|
||||
if(m_mode == CPUDisAsm_CompilerElfMode)
|
||||
{
|
||||
Write(wxString::Format("%s f%d,r%d,r%d", FixOp(op).wx_str(), f0, r0, r1));
|
||||
Write(fmt::Format("%s f%d,r%d,r%d", FixOp(op).c_str(), f0, r0, r1));
|
||||
return;
|
||||
}
|
||||
|
||||
Write(wxString::Format("%s f%d,r%d(r%d)", FixOp(op).wx_str(), f0, r0, r1));
|
||||
Write(fmt::Format("%s f%d,r%d(r%d)", FixOp(op).c_str(), f0, r0, r1));
|
||||
}
|
||||
void DisAsm_F1_IMM_R1_RC(const wxString& op, u32 f0, s32 imm0, u32 r0, bool rc)
|
||||
void DisAsm_F1_IMM_R1_RC(const std::string& op, u32 f0, s32 imm0, u32 r0, bool rc)
|
||||
{
|
||||
if(m_mode == CPUDisAsm_CompilerElfMode)
|
||||
{
|
||||
Write(wxString::Format("%s%s f%d,r%d,%d #%x", FixOp(op).wx_str(), wxString(rc ? "." : "").wx_str(), f0, r0, imm0, imm0));
|
||||
Write(fmt::Format("%s%s f%d,r%d,%d #%x", FixOp(op).c_str(), (rc ? "." : ""), f0, r0, imm0, imm0));
|
||||
return;
|
||||
}
|
||||
|
||||
Write(wxString::Format("%s%s f%d,%d(r%d) #%x", FixOp(op).wx_str(), wxString(rc ? "." : "").wx_str(), f0, imm0, r0, imm0));
|
||||
Write(fmt::Format("%s%s f%d,%d(r%d) #%x", FixOp(op).c_str(), (rc ? "." : ""), f0, imm0, r0, imm0));
|
||||
}
|
||||
void DisAsm_F1_IMM_R1(const wxString& op, u32 f0, s32 imm0, u32 r0)
|
||||
void DisAsm_F1_IMM_R1(const std::string& op, u32 f0, s32 imm0, u32 r0)
|
||||
{
|
||||
DisAsm_F1_IMM_R1_RC(op, f0, imm0, r0, false);
|
||||
}
|
||||
void DisAsm_F1_RC(const wxString& op, u32 f0, bool rc)
|
||||
void DisAsm_F1_RC(const std::string& op, u32 f0, bool rc)
|
||||
{
|
||||
Write(wxString::Format("%s%s f%d", FixOp(op).wx_str(), wxString(rc ? "." : "").wx_str(), f0));
|
||||
Write(fmt::Format("%s%s f%d", FixOp(op).c_str(), (rc ? "." : ""), f0));
|
||||
}
|
||||
void DisAsm_R1_RC(const wxString& op, u32 r0, bool rc)
|
||||
void DisAsm_R1_RC(const std::string& op, u32 r0, bool rc)
|
||||
{
|
||||
Write(wxString::Format("%s%s r%d", FixOp(op).wx_str(), wxString(rc ? "." : "").wx_str(), r0));
|
||||
Write(fmt::Format("%s%s r%d", FixOp(op).c_str(), (rc ? "." : ""), r0));
|
||||
}
|
||||
void DisAsm_R1(const wxString& op, u32 r0)
|
||||
void DisAsm_R1(const std::string& op, u32 r0)
|
||||
{
|
||||
DisAsm_R1_RC(op, r0, false);
|
||||
}
|
||||
void DisAsm_R2_OE_RC(const wxString& op, u32 r0, u32 r1, u32 oe, bool rc)
|
||||
void DisAsm_R2_OE_RC(const std::string& op, u32 r0, u32 r1, u32 oe, bool rc)
|
||||
{
|
||||
Write(wxString::Format("%s%s%s r%d,r%d", FixOp(op).wx_str(), wxString(oe ? "o" : "").wx_str(), wxString(rc ? "." : "").wx_str(), r0, r1));
|
||||
Write(fmt::Format("%s%s%s r%d,r%d", FixOp(op).c_str(), (oe ? "o" : ""), (rc ? "." : ""), r0, r1));
|
||||
}
|
||||
void DisAsm_R2_RC(const wxString& op, u32 r0, u32 r1, bool rc)
|
||||
void DisAsm_R2_RC(const std::string& op, u32 r0, u32 r1, bool rc)
|
||||
{
|
||||
DisAsm_R2_OE_RC(op, r0, r1, false, rc);
|
||||
}
|
||||
void DisAsm_R2(const wxString& op, u32 r0, u32 r1)
|
||||
void DisAsm_R2(const std::string& op, u32 r0, u32 r1)
|
||||
{
|
||||
DisAsm_R2_RC(op, r0, r1, false);
|
||||
}
|
||||
void DisAsm_R3_OE_RC(const wxString& op, u32 r0, u32 r1, u32 r2, u32 oe, bool rc)
|
||||
void DisAsm_R3_OE_RC(const std::string& op, u32 r0, u32 r1, u32 r2, u32 oe, bool rc)
|
||||
{
|
||||
Write(wxString::Format("%s%s%s r%d,r%d,r%d", FixOp(op).wx_str(), wxString(oe ? "o" : "").wx_str(), wxString(rc ? "." : "").wx_str(), r0, r1, r2));
|
||||
Write(fmt::Format("%s%s%s r%d,r%d,r%d", FixOp(op).c_str(), (oe ? "o" : ""), (rc ? "." : ""), r0, r1, r2));
|
||||
}
|
||||
void DisAsm_R3_INT2_RC(const wxString& op, u32 r0, u32 r1, u32 r2, s32 i0, s32 i1, bool rc)
|
||||
void DisAsm_R3_INT2_RC(const std::string& op, u32 r0, u32 r1, u32 r2, s32 i0, s32 i1, bool rc)
|
||||
{
|
||||
Write(wxString::Format("%s%s r%d,r%d,r%d,%d,%d", FixOp(op).wx_str(), wxString(rc ? "." : "").wx_str(), r0, r1, r2, i0, i1));
|
||||
Write(fmt::Format("%s%s r%d,r%d,r%d,%d,%d", FixOp(op).c_str(), (rc ? "." : ""), r0, r1, r2, i0, i1));
|
||||
}
|
||||
void DisAsm_R3_RC(const wxString& op, u32 r0, u32 r1, u32 r2, bool rc)
|
||||
void DisAsm_R3_RC(const std::string& op, u32 r0, u32 r1, u32 r2, bool rc)
|
||||
{
|
||||
DisAsm_R3_OE_RC(op, r0, r1, r2, false, rc);
|
||||
}
|
||||
void DisAsm_R3(const wxString& op, u32 r0, u32 r1, u32 r2)
|
||||
void DisAsm_R3(const std::string& op, u32 r0, u32 r1, u32 r2)
|
||||
{
|
||||
DisAsm_R3_RC(op, r0, r1, r2, false);
|
||||
}
|
||||
void DisAsm_R2_INT3_RC(const wxString& op, u32 r0, u32 r1, s32 i0, s32 i1, s32 i2, bool rc)
|
||||
void DisAsm_R2_INT3_RC(const std::string& op, u32 r0, u32 r1, s32 i0, s32 i1, s32 i2, bool rc)
|
||||
{
|
||||
Write(wxString::Format("%s%s r%d,r%d,%d,%d,%d", FixOp(op).wx_str(), wxString(rc ? "." : "").wx_str(), r0, r1, i0, i1, i2));
|
||||
Write(fmt::Format("%s%s r%d,r%d,%d,%d,%d", FixOp(op).c_str(), (rc ? "." : ""), r0, r1, i0, i1, i2));
|
||||
}
|
||||
void DisAsm_R2_INT3(const wxString& op, u32 r0, u32 r1, s32 i0, s32 i1, s32 i2)
|
||||
void DisAsm_R2_INT3(const std::string& op, u32 r0, u32 r1, s32 i0, s32 i1, s32 i2)
|
||||
{
|
||||
DisAsm_R2_INT3_RC(op, r0, r1, i0, i1, i2, false);
|
||||
}
|
||||
void DisAsm_R2_INT2_RC(const wxString& op, u32 r0, u32 r1, s32 i0, s32 i1, bool rc)
|
||||
void DisAsm_R2_INT2_RC(const std::string& op, u32 r0, u32 r1, s32 i0, s32 i1, bool rc)
|
||||
{
|
||||
Write(wxString::Format("%s%s r%d,r%d,%d,%d", FixOp(op).wx_str(), wxString(rc ? "." : "").wx_str(), r0, r1, i0, i1));
|
||||
Write(fmt::Format("%s%s r%d,r%d,%d,%d", FixOp(op).c_str(), (rc ? "." : ""), r0, r1, i0, i1));
|
||||
}
|
||||
void DisAsm_R2_INT2(const wxString& op, u32 r0, u32 r1, s32 i0, s32 i1)
|
||||
void DisAsm_R2_INT2(const std::string& op, u32 r0, u32 r1, s32 i0, s32 i1)
|
||||
{
|
||||
DisAsm_R2_INT2_RC(op, r0, r1, i0, i1, false);
|
||||
}
|
||||
void DisAsm_R2_INT1_RC(const wxString& op, u32 r0, u32 r1, s32 i0, bool rc)
|
||||
void DisAsm_R2_INT1_RC(const std::string& op, u32 r0, u32 r1, s32 i0, bool rc)
|
||||
{
|
||||
Write(wxString::Format("%s%s r%d,r%d,%d", FixOp(op).wx_str(), wxString(rc ? "." : "").wx_str(), r0, r1, i0));
|
||||
Write(fmt::Format("%s%s r%d,r%d,%d", FixOp(op).c_str(), (rc ? "." : ""), r0, r1, i0));
|
||||
}
|
||||
void DisAsm_R2_INT1(const wxString& op, u32 r0, u32 r1, s32 i0)
|
||||
void DisAsm_R2_INT1(const std::string& op, u32 r0, u32 r1, s32 i0)
|
||||
{
|
||||
DisAsm_R2_INT1_RC(op, r0, r1, i0, false);
|
||||
}
|
||||
void DisAsm_R2_IMM(const wxString& op, u32 r0, u32 r1, s32 imm0)
|
||||
void DisAsm_R2_IMM(const std::string& op, u32 r0, u32 r1, s32 imm0)
|
||||
{
|
||||
if(m_mode == CPUDisAsm_CompilerElfMode)
|
||||
{
|
||||
Write(wxString::Format("%s r%d,r%d,%d #%x", FixOp(op).wx_str(), r0, r1, imm0, imm0));
|
||||
Write(fmt::Format("%s r%d,r%d,%d #%x", FixOp(op).c_str(), r0, r1, imm0, imm0));
|
||||
return;
|
||||
}
|
||||
|
||||
Write(wxString::Format("%s r%d,%d(r%d) #%x", FixOp(op).wx_str(), r0, imm0, r1, imm0));
|
||||
Write(fmt::Format("%s r%d,%d(r%d) #%x", FixOp(op).c_str(), r0, imm0, r1, imm0));
|
||||
}
|
||||
void DisAsm_R1_IMM(const wxString& op, u32 r0, s32 imm0)
|
||||
void DisAsm_R1_IMM(const std::string& op, u32 r0, s32 imm0)
|
||||
{
|
||||
Write(wxString::Format("%s r%d,%d #%x", FixOp(op).wx_str(), r0, imm0, imm0));
|
||||
Write(fmt::Format("%s r%d,%d #%x", FixOp(op).c_str(), r0, imm0, imm0));
|
||||
}
|
||||
void DisAsm_IMM_R1(const wxString& op, s32 imm0, u32 r0)
|
||||
void DisAsm_IMM_R1(const std::string& op, s32 imm0, u32 r0)
|
||||
{
|
||||
Write(wxString::Format("%s %d,r%d #%x", FixOp(op).wx_str(), imm0, r0, imm0));
|
||||
Write(fmt::Format("%s %d,r%d #%x", FixOp(op).c_str(), imm0, r0, imm0));
|
||||
}
|
||||
void DisAsm_CR1_R1_IMM(const wxString& op, u32 cr0, u32 r0, s32 imm0)
|
||||
void DisAsm_CR1_R1_IMM(const std::string& op, u32 cr0, u32 r0, s32 imm0)
|
||||
{
|
||||
Write(wxString::Format("%s cr%d,r%d,%d #%x", FixOp(op).wx_str(), cr0, r0, imm0, imm0));
|
||||
Write(fmt::Format("%s cr%d,r%d,%d #%x", FixOp(op).c_str(), cr0, r0, imm0, imm0));
|
||||
}
|
||||
void DisAsm_CR1_R2_RC(const wxString& op, u32 cr0, u32 r0, u32 r1, bool rc)
|
||||
void DisAsm_CR1_R2_RC(const std::string& op, u32 cr0, u32 r0, u32 r1, bool rc)
|
||||
{
|
||||
Write(wxString::Format("%s%s cr%d,r%d,r%d", FixOp(op).wx_str(), wxString(rc ? "." : "").wx_str(), cr0, r0, r1));
|
||||
Write(fmt::Format("%s%s cr%d,r%d,r%d", FixOp(op).c_str(), (rc ? "." : ""), cr0, r0, r1));
|
||||
}
|
||||
void DisAsm_CR1_R2(const wxString& op, u32 cr0, u32 r0, u32 r1)
|
||||
void DisAsm_CR1_R2(const std::string& op, u32 cr0, u32 r0, u32 r1)
|
||||
{
|
||||
DisAsm_CR1_R2_RC(op, cr0, r0, r1, false);
|
||||
}
|
||||
void DisAsm_CR2(const wxString& op, u32 cr0, u32 cr1)
|
||||
void DisAsm_CR2(const std::string& op, u32 cr0, u32 cr1)
|
||||
{
|
||||
Write(wxString::Format("%s cr%d,cr%d", FixOp(op).wx_str(), cr0, cr1));
|
||||
Write(fmt::Format("%s cr%d,cr%d", FixOp(op).c_str(), cr0, cr1));
|
||||
}
|
||||
void DisAsm_INT3(const wxString& op, const int i0, const int i1, const int i2)
|
||||
void DisAsm_INT3(const std::string& op, const int i0, const int i1, const int i2)
|
||||
{
|
||||
Write(wxString::Format("%s %d,%d,%d", FixOp(op).wx_str(), i0, i1, i2));
|
||||
Write(fmt::Format("%s %d,%d,%d", FixOp(op).c_str(), i0, i1, i2));
|
||||
}
|
||||
void DisAsm_INT1(const wxString& op, const int i0)
|
||||
void DisAsm_INT1(const std::string& op, const int i0)
|
||||
{
|
||||
Write(wxString::Format("%s %d", FixOp(op).wx_str(), i0));
|
||||
Write(fmt::Format("%s %d", FixOp(op).c_str(), i0));
|
||||
}
|
||||
void DisAsm_BRANCH(const wxString& op, const int pc)
|
||||
void DisAsm_BRANCH(const std::string& op, const int pc)
|
||||
{
|
||||
Write(wxString::Format("%s 0x%x", FixOp(op).wx_str(), DisAsmBranchTarget(pc)));
|
||||
Write(fmt::Format("%s 0x%x", FixOp(op).c_str(), DisAsmBranchTarget(pc)));
|
||||
}
|
||||
void DisAsm_BRANCH_A(const wxString& op, const int pc)
|
||||
void DisAsm_BRANCH_A(const std::string& op, const int pc)
|
||||
{
|
||||
Write(wxString::Format("%s 0x%x", FixOp(op).wx_str(), pc));
|
||||
Write(fmt::Format("%s 0x%x", FixOp(op).c_str(), pc));
|
||||
}
|
||||
void DisAsm_B2_BRANCH(const wxString& op, u32 b0, u32 b1, const int pc)
|
||||
void DisAsm_B2_BRANCH(const std::string& op, u32 b0, u32 b1, const int pc)
|
||||
{
|
||||
Write(wxString::Format("%s %d,%d,0x%x ", FixOp(op).wx_str(), b0, b1, DisAsmBranchTarget(pc)));
|
||||
Write(fmt::Format("%s %d,%d,0x%x ", FixOp(op).c_str(), b0, b1, DisAsmBranchTarget(pc)));
|
||||
}
|
||||
void DisAsm_CR_BRANCH(const wxString& op, u32 cr, const int pc)
|
||||
void DisAsm_CR_BRANCH(const std::string& op, u32 cr, const int pc)
|
||||
{
|
||||
Write(wxString::Format("%s cr%d,0x%x ", FixOp(op).wx_str(), cr, DisAsmBranchTarget(pc)));
|
||||
Write(fmt::Format("%s cr%d,0x%x ", FixOp(op).c_str(), cr, DisAsmBranchTarget(pc)));
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -902,11 +902,11 @@ private:
|
|||
}
|
||||
void CMPLI(u32 crfd, u32 l, u32 ra, u32 uimm16)
|
||||
{
|
||||
DisAsm_CR1_R1_IMM(wxString::Format("cmpl%si", wxString(l ? "d" : "w").wx_str()), crfd, ra, uimm16);
|
||||
DisAsm_CR1_R1_IMM(fmt::Format("cmpl%si", (l ? "d" : "w")), crfd, ra, uimm16);
|
||||
}
|
||||
void CMPI(u32 crfd, u32 l, u32 ra, s32 simm16)
|
||||
{
|
||||
DisAsm_CR1_R1_IMM(wxString::Format("cmp%si", wxString(l ? "d" : "w").wx_str()), crfd, ra, simm16);
|
||||
DisAsm_CR1_R1_IMM(fmt::Format("cmp%si", (l ? "d" : "w")), crfd, ra, simm16);
|
||||
}
|
||||
void ADDIC(u32 rd, u32 ra, s32 simm16)
|
||||
{
|
||||
|
@ -942,7 +942,7 @@ private:
|
|||
{
|
||||
if(m_mode == CPUDisAsm_CompilerElfMode)
|
||||
{
|
||||
Write(wxString::Format("bc 0x%x, 0x%x, 0x%x, %d, %d", bo, bi, bd, aa, lk));
|
||||
Write(fmt::Format("bc 0x%x, 0x%x, 0x%x, %d, %d", bo, bi, bd, aa, lk));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1032,7 +1032,7 @@ private:
|
|||
}
|
||||
}
|
||||
|
||||
Write(wxString::Format("bc [%x:%x:%x:%x:%x], cr%d[%x], 0x%x, %d, %d", bo0, bo1, bo2, bo3, bo4, bi/4, bi%4, bd, aa, lk));
|
||||
Write(fmt::Format("bc [%x:%x:%x:%x:%x], cr%d[%x], 0x%x, %d, %d", bo0, bo1, bo2, bo3, bo4, bi/4, bi%4, bd, aa, lk));
|
||||
}
|
||||
void SC(s32 sc_code)
|
||||
{
|
||||
|
@ -1041,14 +1041,14 @@ private:
|
|||
case 0x1: Write("HyperCall"); break;
|
||||
case 0x2: Write("sc"); break;
|
||||
case 0x22: Write("HyperCall LV1"); break;
|
||||
default: Write(wxString::Format("Unknown sc: %x", sc_code));
|
||||
default: Write(fmt::Format("Unknown sc: %x", sc_code));
|
||||
}
|
||||
}
|
||||
void B(s32 ll, u32 aa, u32 lk)
|
||||
{
|
||||
if(m_mode == CPUDisAsm_CompilerElfMode)
|
||||
{
|
||||
Write(wxString::Format("b 0x%x, %d, %d", ll, aa, lk));
|
||||
Write(fmt::Format("b 0x%x, %d, %d", ll, aa, lk));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1083,7 +1083,7 @@ private:
|
|||
const u8 bo3 = (bo & 0x02) ? 1 : 0;
|
||||
|
||||
if(bo0 && !bo1 && bo2 && !bo3) {Write("blr"); return;}
|
||||
Write(wxString::Format("bclr [%x:%x:%x:%x], cr%d[%x], %d, %d", bo0, bo1, bo2, bo3, bi/4, bi%4, bh, lk));
|
||||
Write(fmt::Format("bclr [%x:%x:%x:%x], cr%d[%x], %d, %d", bo0, bo1, bo2, bo3, bi/4, bi%4, bh, lk));
|
||||
}
|
||||
void CRNOR(u32 bt, u32 ba, u32 bb)
|
||||
{
|
||||
|
@ -1215,7 +1215,7 @@ private:
|
|||
}
|
||||
void CMP(u32 crfd, u32 l, u32 ra, u32 rb)
|
||||
{
|
||||
DisAsm_CR1_R2(wxString::Format("cmp%s", wxString(l ? "d" : "w").wx_str()), crfd, ra, rb);
|
||||
DisAsm_CR1_R2(fmt::Format("cmp%s", (l ? "d" : "w")), crfd, ra, rb);
|
||||
}
|
||||
void TW(u32 to, u32 ra, u32 rb)
|
||||
{
|
||||
|
@ -1286,7 +1286,7 @@ private:
|
|||
}
|
||||
void CMPL(u32 crfd, u32 l, u32 ra, u32 rb)
|
||||
{
|
||||
DisAsm_CR1_R2(wxString::Format("cmpl%s", wxString(l ? "d" : "w").wx_str()), crfd, ra, rb);
|
||||
DisAsm_CR1_R2(fmt::Format("cmpl%s", (l ? "d" : "w")), crfd, ra, rb);
|
||||
}
|
||||
void LVSR(u32 vd, u32 ra, u32 rb)
|
||||
{
|
||||
|
@ -2044,7 +2044,7 @@ private:
|
|||
|
||||
void UNK(const u32 code, const u32 opcode, const u32 gcode)
|
||||
{
|
||||
Write(wxString::Format("Unknown/Illegal opcode! (0x%08x : 0x%x : 0x%x)", code, opcode, gcode));
|
||||
Write(fmt::Format("Unknown/Illegal opcode! (0x%08x : 0x%x : 0x%x)", code, opcode, gcode));
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -139,7 +139,7 @@ private:
|
|||
case 0x100: return CPU.USPRG0;
|
||||
}
|
||||
|
||||
UNK(wxString::Format("GetRegBySPR error: Unknown SPR 0x%x!", n));
|
||||
UNK(fmt::Format("GetRegBySPR error: Unknown SPR 0x%x!", n));
|
||||
return CPU.XER.XER;
|
||||
}
|
||||
|
||||
|
@ -153,7 +153,7 @@ private:
|
|||
((u64)a < (u64)simm16 && (to & 0x2)) ||
|
||||
((u64)a > (u64)simm16 && (to & 0x1)) )
|
||||
{
|
||||
UNK(wxString::Format("Trap! (tdi %x, r%d, %x)", to, ra, simm16));
|
||||
UNK(fmt::Format("Trap! (tdi %x, r%d, %x)", to, ra, simm16));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -167,7 +167,7 @@ private:
|
|||
((u32)a < (u32)simm16 && (to & 0x2)) ||
|
||||
((u32)a > (u32)simm16 && (to & 0x1)) )
|
||||
{
|
||||
UNK(wxString::Format("Trap! (twi %x, r%d, %x)", to, ra, simm16));
|
||||
UNK(fmt::Format("Trap! (twi %x, r%d, %x)", to, ra, simm16));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2092,18 +2092,18 @@ private:
|
|||
{
|
||||
switch(sc_code)
|
||||
{
|
||||
case 0x1: UNK(wxString::Format("HyperCall %d", CPU.GPR[0])); break;
|
||||
case 0x1: UNK(fmt::Format("HyperCall %d", CPU.GPR[0])); break;
|
||||
case 0x2: SysCall(); break;
|
||||
case 0x3:
|
||||
StaticExecute(CPU.GPR[11]);
|
||||
if (Ini.HLELogging.GetValue())
|
||||
{
|
||||
ConLog.Write("'%s' done with code[0x%llx]! #pc: 0x%llx",
|
||||
wxString(g_static_funcs_list[CPU.GPR[11]].name).wx_str(), CPU.GPR[3], CPU.PC);
|
||||
g_static_funcs_list[CPU.GPR[11]].name, CPU.GPR[3], CPU.PC);
|
||||
}
|
||||
break;
|
||||
case 0x22: UNK("HyperCall LV1"); break;
|
||||
default: UNK(wxString::Format("Unknown sc: %x", sc_code));
|
||||
default: UNK(fmt::Format("Unknown sc: %x", sc_code));
|
||||
}
|
||||
}
|
||||
void B(s32 ll, u32 aa, u32 lk)
|
||||
|
@ -2264,7 +2264,7 @@ private:
|
|||
((u32)a < (u32)b && (to & 0x2)) ||
|
||||
((u32)a > (u32)b && (to & 0x1)) )
|
||||
{
|
||||
UNK(wxString::Format("Trap! (tw %x, r%d, r%d)", to, ra, rb));
|
||||
UNK(fmt::Format("Trap! (tw %x, r%d, r%d)", to, ra, rb));
|
||||
}
|
||||
}
|
||||
void LVSL(u32 vd, u32 ra, u32 rb)
|
||||
|
@ -2874,7 +2874,7 @@ private:
|
|||
{
|
||||
case 0x10C: CPU.GPR[rd] = CPU.TB; break;
|
||||
case 0x10D: CPU.GPR[rd] = CPU.TBH; break;
|
||||
default: UNK(wxString::Format("mftb r%d, %d", rd, spr)); break;
|
||||
default: UNK(fmt::Format("mftb r%d, %d", rd, spr)); break;
|
||||
}
|
||||
}
|
||||
void LWAUX(u32 rd, u32 ra, u32 rb)
|
||||
|
@ -4010,12 +4010,12 @@ private:
|
|||
|
||||
void UNK(const u32 code, const u32 opcode, const u32 gcode)
|
||||
{
|
||||
UNK(wxString::Format("Unknown/Illegal opcode! (0x%08x : 0x%x : 0x%x)", code, opcode, gcode));
|
||||
UNK(fmt::Format("Unknown/Illegal opcode! (0x%08x : 0x%x : 0x%x)", code, opcode, gcode));
|
||||
}
|
||||
|
||||
void UNK(const wxString& err, bool pause = true)
|
||||
void UNK(const std::string& err, bool pause = true)
|
||||
{
|
||||
ConLog.Error(err + wxString::Format(" #pc: 0x%llx", CPU.PC));
|
||||
ConLog.Error(err + fmt::Format(" #pc: 0x%llx", CPU.PC));
|
||||
|
||||
if(!pause) return;
|
||||
|
||||
|
@ -4023,11 +4023,11 @@ private:
|
|||
|
||||
for(uint i=0; i<32; ++i) ConLog.Write("r%d = 0x%llx", i, CPU.GPR[i]);
|
||||
for(uint i=0; i<32; ++i) ConLog.Write("f%d = %llf", i, CPU.FPR[i]);
|
||||
for(uint i=0; i<32; ++i) ConLog.Write("v%d = 0x%s [%s]", i, CPU.VPR[i].ToString(true).wx_str(), CPU.VPR[i].ToString().wx_str());
|
||||
for(uint i=0; i<32; ++i) ConLog.Write("v%d = 0x%s [%s]", i, CPU.VPR[i].ToString(true).c_str(), CPU.VPR[i].ToString().c_str());
|
||||
ConLog.Write("CR = 0x%08x", CPU.CR);
|
||||
ConLog.Write("LR = 0x%llx", CPU.LR);
|
||||
ConLog.Write("CTR = 0x%llx", CPU.CTR);
|
||||
ConLog.Write("XER = 0x%llx [CA=%lld | OV=%lld | SO=%lld]", CPU.XER, CPU.XER.CA, CPU.XER.OV, CPU.XER.SO);
|
||||
ConLog.Write("XER = 0x%llx [CA=%lld | OV=%lld | SO=%lld]", CPU.XER, fmt::by_value(CPU.XER.CA), fmt::by_value(CPU.XER.OV), fmt::by_value(CPU.XER.SO));
|
||||
ConLog.Write("FPSCR = 0x%x "
|
||||
"[RN=%d | NI=%d | XE=%d | ZE=%d | UE=%d | OE=%d | VE=%d | "
|
||||
"VXCVI=%d | VXSQRT=%d | VXSOFT=%d | FPRF=%d | "
|
||||
|
@ -4035,11 +4035,11 @@ private:
|
|||
"VXZDZ=%d | VXIDI=%d | VXISI=%d | VXSNAN=%d | "
|
||||
"XX=%d | ZX=%d | UX=%d | OX=%d | VX=%d | FEX=%d | FX=%d]",
|
||||
CPU.FPSCR,
|
||||
CPU.FPSCR.RN,
|
||||
CPU.FPSCR.NI, CPU.FPSCR.XE, CPU.FPSCR.ZE, CPU.FPSCR.UE, CPU.FPSCR.OE, CPU.FPSCR.VE,
|
||||
CPU.FPSCR.VXCVI, CPU.FPSCR.VXSQRT, CPU.FPSCR.VXSOFT, CPU.FPSCR.FPRF,
|
||||
CPU.FPSCR.FI, CPU.FPSCR.FR, CPU.FPSCR.VXVC, CPU.FPSCR.VXIMZ,
|
||||
CPU.FPSCR.VXZDZ, CPU.FPSCR.VXIDI, CPU.FPSCR.VXISI, CPU.FPSCR.VXSNAN,
|
||||
CPU.FPSCR.XX, CPU.FPSCR.ZX, CPU.FPSCR.UX, CPU.FPSCR.OX, CPU.FPSCR.VX, CPU.FPSCR.FEX, CPU.FPSCR.FX);
|
||||
fmt::by_value(CPU.FPSCR.RN),
|
||||
fmt::by_value(CPU.FPSCR.NI), fmt::by_value(CPU.FPSCR.XE), fmt::by_value(CPU.FPSCR.ZE), fmt::by_value(CPU.FPSCR.UE), fmt::by_value(CPU.FPSCR.OE), fmt::by_value(CPU.FPSCR.VE),
|
||||
fmt::by_value(CPU.FPSCR.VXCVI), fmt::by_value(CPU.FPSCR.VXSQRT), fmt::by_value(CPU.FPSCR.VXSOFT), fmt::by_value(CPU.FPSCR.FPRF),
|
||||
fmt::by_value(CPU.FPSCR.FI), fmt::by_value(CPU.FPSCR.FR), fmt::by_value(CPU.FPSCR.VXVC), fmt::by_value(CPU.FPSCR.VXIMZ),
|
||||
fmt::by_value(CPU.FPSCR.VXZDZ), fmt::by_value(CPU.FPSCR.VXIDI), fmt::by_value(CPU.FPSCR.VXISI), fmt::by_value(CPU.FPSCR.VXSNAN),
|
||||
fmt::by_value(CPU.FPSCR.XX), fmt::by_value(CPU.FPSCR.ZX), fmt::by_value(CPU.FPSCR.UX), fmt::by_value(CPU.FPSCR.OX), fmt::by_value(CPU.FPSCR.VX), fmt::by_value(CPU.FPSCR.FEX), fmt::by_value(CPU.FPSCR.FX));
|
||||
}
|
||||
};
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
using namespace PPU_instr;
|
||||
|
||||
template<typename TO, typename T>
|
||||
InstrBase<TO>* GetInstruction(T* list, const wxString& str)
|
||||
InstrBase<TO>* GetInstruction(T* list, const std::string& str)
|
||||
{
|
||||
for(int i=0; i<list->count; ++i)
|
||||
{
|
||||
|
@ -12,7 +12,7 @@ InstrBase<TO>* GetInstruction(T* list, const wxString& str)
|
|||
|
||||
if(instr)
|
||||
{
|
||||
if(instr->GetName().Cmp(str) == 0)
|
||||
if(instr->GetName().compare(str) == 0)
|
||||
{
|
||||
return instr;
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ InstrBase<TO>* GetInstruction(T* list, const wxString& str)
|
|||
}
|
||||
|
||||
template<typename TO>
|
||||
InstrBase<TO>* GetInstruction(const wxString& str)
|
||||
InstrBase<TO>* GetInstruction(const std::string& str)
|
||||
{
|
||||
if(auto res = GetInstruction<TO>(main_list, str)) return res;
|
||||
if(auto res = GetInstruction<TO>(g04_list, str)) return res;
|
||||
|
@ -40,19 +40,19 @@ InstrBase<TO>* GetInstruction(const wxString& str)
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
s64 FindOp(const wxString& text, const wxString& op, s64 from)
|
||||
s64 FindOp(const std::string& text, const std::string& op, s64 from)
|
||||
{
|
||||
if(text.Len() < op.Len()) return -1;
|
||||
if (text.length() < op.length()) return -1;
|
||||
|
||||
for(s64 i=from; i<text.Len(); ++i)
|
||||
for (s64 i = from; i<text.length(); ++i)
|
||||
{
|
||||
if(i - 1 < 0 || text[(size_t)i - 1] == '\n' || CompilePPUProgram::IsSkip(text[(size_t)i - 1]))
|
||||
{
|
||||
if(text.Len() - i < op.Len()) return -1;
|
||||
if (text.length() - i < op.length()) return -1;
|
||||
|
||||
if(text(i, op.Len()).Cmp(op) != 0) continue;
|
||||
if(i + op.Len() >= text.Len() || text[(size_t)i + op.Len()] == '\n' ||
|
||||
CompilePPUProgram::IsSkip(text[(size_t)i + op.Len()])) return i;
|
||||
if (text.substr(i, op.length()).compare(op) != 0) continue;
|
||||
if (i + op.length() >= text.length() || text[(size_t) i + op.length()] == '\n' ||
|
||||
CompilePPUProgram::IsSkip(text[(size_t) i + op.length()])) return i;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -63,9 +63,9 @@ ArrayF<SectionInfo> sections_list;
|
|||
u32 section_name_offs = 0;
|
||||
u32 section_offs = 0;
|
||||
|
||||
SectionInfo::SectionInfo(const wxString& _name)
|
||||
SectionInfo::SectionInfo(const std::string& _name)
|
||||
{
|
||||
name = _name.ToStdString();
|
||||
name = _name;
|
||||
memset(&shdr, 0, sizeof(Elf64_Shdr));
|
||||
|
||||
section_num = sections_list.Add(this);
|
||||
|
@ -116,8 +116,8 @@ SectionInfo::~SectionInfo()
|
|||
}
|
||||
|
||||
CompilePPUProgram::CompilePPUProgram(
|
||||
const wxString& asm_,
|
||||
const wxString& file_path,
|
||||
const std::string& asm_,
|
||||
const std::string& file_path,
|
||||
wxTextCtrl* asm_list,
|
||||
wxTextCtrl* hex_list,
|
||||
wxTextCtrl* err_list,
|
||||
|
@ -137,28 +137,28 @@ CompilePPUProgram::CompilePPUProgram(
|
|||
{
|
||||
}
|
||||
|
||||
void CompilePPUProgram::WriteHex(const wxString& text)
|
||||
void CompilePPUProgram::WriteHex(const std::string& text)
|
||||
{
|
||||
if(m_hex_list)
|
||||
{
|
||||
m_hex_list->WriteText(text);
|
||||
m_hex_list->WriteText(fmt::FromUTF8(text));
|
||||
}
|
||||
}
|
||||
|
||||
void CompilePPUProgram::WriteError(const wxString& error)
|
||||
void CompilePPUProgram::WriteError(const std::string& error)
|
||||
{
|
||||
if(m_err_list)
|
||||
{
|
||||
m_err_list->WriteText(wxString::Format("line %lld: %s\n", m_line, error.wx_str()));
|
||||
m_err_list->WriteText(fmt::FromUTF8(fmt::Format("line %lld: %s\n", m_line, error)));
|
||||
}
|
||||
}
|
||||
|
||||
bool CompilePPUProgram::IsSkip(const char c) { return c == ' ' || c == '\t'; }
|
||||
bool CompilePPUProgram::IsCommit(const char c) { return c == '#'; }
|
||||
bool CompilePPUProgram::IsEnd() const { return p >= m_asm.Len(); }
|
||||
bool CompilePPUProgram::IsEndLn(const char c) const { return c == '\n' || p - 1 >= m_asm.Len(); }
|
||||
bool CompilePPUProgram::IsEnd() const { return p >= m_asm.length(); }
|
||||
bool CompilePPUProgram::IsEndLn(const char c) const { return c == '\n' || p - 1 >= m_asm.length(); }
|
||||
|
||||
char CompilePPUProgram::NextChar() { return *(const char*)m_asm(p++, 1); }
|
||||
char CompilePPUProgram::NextChar() { return *m_asm.substr(p++, 1).c_str(); }
|
||||
void CompilePPUProgram::NextLn() { while( !IsEndLn(NextChar()) ); if(!IsEnd()) m_line++; }
|
||||
void CompilePPUProgram::EndLn()
|
||||
{
|
||||
|
@ -181,7 +181,7 @@ void CompilePPUProgram::PrevArg()
|
|||
if(IsEndLn(m_asm[(size_t)p])) p++;
|
||||
}
|
||||
|
||||
bool CompilePPUProgram::GetOp(wxString& result)
|
||||
bool CompilePPUProgram::GetOp(std::string& result)
|
||||
{
|
||||
s64 from = -1;
|
||||
|
||||
|
@ -205,7 +205,7 @@ bool CompilePPUProgram::GetOp(wxString& result)
|
|||
if(skip || endln || commit)
|
||||
{
|
||||
const s64 to = (endln ? p : p - 1) - from;
|
||||
result = m_asm(from, to);
|
||||
result = m_asm.substr(from, to);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -214,7 +214,7 @@ bool CompilePPUProgram::GetOp(wxString& result)
|
|||
return false;
|
||||
}
|
||||
|
||||
int CompilePPUProgram::GetArg(wxString& result, bool func)
|
||||
int CompilePPUProgram::GetArg(std::string& result, bool func)
|
||||
{
|
||||
s64 from = -1;
|
||||
|
||||
|
@ -246,7 +246,7 @@ int CompilePPUProgram::GetArg(wxString& result, bool func)
|
|||
|
||||
if(text && !end_text)
|
||||
{
|
||||
WriteError(wxString::Format("'\"' not found."));
|
||||
WriteError("'\"' not found.");
|
||||
m_error = true;
|
||||
}
|
||||
|
||||
|
@ -278,19 +278,19 @@ int CompilePPUProgram::GetArg(wxString& result, bool func)
|
|||
break;
|
||||
}
|
||||
|
||||
WriteError(wxString::Format("Bad symbol '%c'", cur_char));
|
||||
WriteError(fmt::Format("Bad symbol '%c'", cur_char));
|
||||
m_error = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
result = m_asm(from, to);
|
||||
result = m_asm.substr(from, to);
|
||||
|
||||
if(text)
|
||||
{
|
||||
for(u32 pos = 0; (s32)(pos = result.find('\\', pos)) >= 0;)
|
||||
for(u32 pos = 0; (s32)(pos = result.find('\\', pos)) != std::string::npos;)
|
||||
{
|
||||
if(pos + 1 < result.Len() && result[pos + 1] == '\\')
|
||||
if(pos + 1 < result.length() && result[pos + 1] == '\\')
|
||||
{
|
||||
pos += 2;
|
||||
continue;
|
||||
|
@ -299,9 +299,9 @@ int CompilePPUProgram::GetArg(wxString& result, bool func)
|
|||
const char v = result[pos + 1];
|
||||
switch(v)
|
||||
{
|
||||
case 'n': result = result(0, pos) + '\n' + result(pos+2, result.Len()-(pos+2)); break;
|
||||
case 'r': result = result(0, pos) + '\r' + result(pos+2, result.Len()-(pos+2)); break;
|
||||
case 't': result = result(0, pos) + '\t' + result(pos+2, result.Len()-(pos+2)); break;
|
||||
case 'n': result = result.substr(0, pos) + '\n' + result.substr(pos + 2, result.length() - (pos + 2)); break;
|
||||
case 'r': result = result.substr(0, pos) + '\r' + result.substr(pos + 2, result.length() - (pos + 2)); break;
|
||||
case 't': result = result.substr(0, pos) + '\t' + result.substr(pos + 2, result.length() - (pos + 2)); break;
|
||||
}
|
||||
|
||||
pos++;
|
||||
|
@ -345,7 +345,7 @@ bool CompilePPUProgram::CheckEnd(bool show_err)
|
|||
return true;
|
||||
}
|
||||
|
||||
WriteError(wxString::Format("Bad symbol '%c'", cur_char));
|
||||
WriteError(fmt::Format("Bad symbol '%c'", cur_char));
|
||||
NextLn();
|
||||
return false;
|
||||
}
|
||||
|
@ -355,9 +355,9 @@ bool CompilePPUProgram::CheckEnd(bool show_err)
|
|||
|
||||
void CompilePPUProgram::DetectArgInfo(Arg& arg)
|
||||
{
|
||||
const wxString str = arg.string;
|
||||
const std::string str = arg.string;
|
||||
|
||||
if(str.Len() <= 0)
|
||||
if(str.empty())
|
||||
{
|
||||
arg.type = ARG_ERR;
|
||||
return;
|
||||
|
@ -369,11 +369,11 @@ void CompilePPUProgram::DetectArgInfo(Arg& arg)
|
|||
return;
|
||||
}
|
||||
|
||||
if(str.Len() > 1)
|
||||
if(str.length() > 1)
|
||||
{
|
||||
for(u32 i=0; i<m_branches.GetCount(); ++i)
|
||||
{
|
||||
if(str.ToStdString() != m_branches[i].m_name)
|
||||
if(str != m_branches[i].m_name)
|
||||
continue;
|
||||
|
||||
arg.type = ARG_BRANCH;
|
||||
|
@ -386,20 +386,20 @@ void CompilePPUProgram::DetectArgInfo(Arg& arg)
|
|||
{
|
||||
case 'r': case 'f': case 'v':
|
||||
|
||||
if(str.Len() < 2)
|
||||
if(str.length() < 2)
|
||||
{
|
||||
arg.type = ARG_ERR;
|
||||
return;
|
||||
}
|
||||
|
||||
if(str.Cmp("rtoc") == 0)
|
||||
if(str.compare("rtoc") == 0)
|
||||
{
|
||||
arg.type = ARG_REG_R;
|
||||
arg.value = 2;
|
||||
return;
|
||||
}
|
||||
|
||||
for(u32 i=1; i<str.Len(); ++i)
|
||||
for(u32 i=1; i<str.length(); ++i)
|
||||
{
|
||||
if(str[i] < '0' || str[i] > '9')
|
||||
{
|
||||
|
@ -409,7 +409,7 @@ void CompilePPUProgram::DetectArgInfo(Arg& arg)
|
|||
}
|
||||
|
||||
u32 reg;
|
||||
sscanf(str(1, str.Len() - 1), "%d", ®);
|
||||
sscanf(str.substr(1, str.length() - 1).c_str(), "%d", ®);
|
||||
|
||||
if(reg >= 32)
|
||||
{
|
||||
|
@ -429,9 +429,9 @@ void CompilePPUProgram::DetectArgInfo(Arg& arg)
|
|||
return;
|
||||
|
||||
case 'c':
|
||||
if(str.Len() > 2 && str[1] == 'r')
|
||||
if(str.length() > 2 && str[1] == 'r')
|
||||
{
|
||||
for(u32 i=2; i<str.Len(); ++i)
|
||||
for(u32 i=2; i<str.length(); ++i)
|
||||
{
|
||||
if(str[i] < '0' || str[i] > '9')
|
||||
{
|
||||
|
@ -441,7 +441,7 @@ void CompilePPUProgram::DetectArgInfo(Arg& arg)
|
|||
}
|
||||
|
||||
u32 reg;
|
||||
sscanf(str, "cr%d", ®);
|
||||
sscanf(str.c_str(), "cr%d", ®);
|
||||
|
||||
if(reg < 8)
|
||||
{
|
||||
|
@ -458,26 +458,26 @@ void CompilePPUProgram::DetectArgInfo(Arg& arg)
|
|||
break;
|
||||
|
||||
case '"':
|
||||
if(str.Len() < 2)
|
||||
if(str.length() < 2)
|
||||
{
|
||||
arg.type = ARG_ERR;
|
||||
return;
|
||||
}
|
||||
|
||||
if(str[str.Len() - 1] != '"')
|
||||
if(str[str.length() - 1] != '"')
|
||||
{
|
||||
arg.type = ARG_ERR;
|
||||
return;
|
||||
}
|
||||
|
||||
arg.string = str(1, str.Len() - 2).ToStdString();
|
||||
arg.string = str.substr(1, str.length() - 2);
|
||||
arg.type = ARG_TXT;
|
||||
return;
|
||||
}
|
||||
|
||||
if(str.Len() > 2 && str(0, 2).Cmp("0x") == 0)
|
||||
if(str.length() > 2 && str.substr(0, 2).compare("0x") == 0)
|
||||
{
|
||||
for(u32 i=2; i<str.Len(); ++i)
|
||||
for(u32 i=2; i<str.length(); ++i)
|
||||
{
|
||||
if(
|
||||
(str[i] >= '0' && str[i] <= '9') ||
|
||||
|
@ -490,14 +490,14 @@ void CompilePPUProgram::DetectArgInfo(Arg& arg)
|
|||
}
|
||||
|
||||
u32 val;
|
||||
sscanf(str, "0x%x", &val);
|
||||
sscanf(str.c_str(), "0x%x", &val);
|
||||
|
||||
arg.type = ARG_NUM16;
|
||||
arg.value = val;
|
||||
return;
|
||||
}
|
||||
|
||||
for(u32 i= str[0] == '-' ? 1 : 0; i<str.Len(); ++i)
|
||||
for(u32 i= str[0] == '-' ? 1 : 0; i<str.length(); ++i)
|
||||
{
|
||||
if(str[i] < '0' || str[i] > '9')
|
||||
{
|
||||
|
@ -507,7 +507,7 @@ void CompilePPUProgram::DetectArgInfo(Arg& arg)
|
|||
}
|
||||
|
||||
u32 val;
|
||||
sscanf(str, "%d", &val);
|
||||
sscanf(str.c_str(), "%d", &val);
|
||||
|
||||
arg.type = ARG_NUM;
|
||||
arg.value = val;
|
||||
|
@ -518,7 +518,7 @@ void CompilePPUProgram::LoadArgs()
|
|||
m_args.Clear();
|
||||
m_cur_arg = 0;
|
||||
|
||||
wxString str;
|
||||
std::string str;
|
||||
while(int r = GetArg(str))
|
||||
{
|
||||
Arg* arg = new Arg(str);
|
||||
|
@ -530,11 +530,11 @@ void CompilePPUProgram::LoadArgs()
|
|||
m_end_args = m_args.GetCount() > 0;
|
||||
}
|
||||
|
||||
u32 CompilePPUProgram::GetBranchValue(const wxString& branch)
|
||||
u32 CompilePPUProgram::GetBranchValue(const std::string& branch)
|
||||
{
|
||||
for(u32 i=0; i<m_branches.GetCount(); ++i)
|
||||
{
|
||||
if(branch.ToStdString() != m_branches[i].m_name)
|
||||
if(branch != m_branches[i].m_name)
|
||||
continue;
|
||||
if(m_branches[i].m_pos >= 0) return m_text_addr + m_branches[i].m_pos * 4;
|
||||
|
||||
|
@ -552,7 +552,7 @@ bool CompilePPUProgram::SetNextArgType(u32 types, bool show_err)
|
|||
{
|
||||
if(show_err)
|
||||
{
|
||||
WriteError(wxString::Format("%d arg not found", m_cur_arg + 1));
|
||||
WriteError(fmt::Format("%d arg not found", m_cur_arg + 1));
|
||||
m_error = true;
|
||||
}
|
||||
|
||||
|
@ -569,7 +569,7 @@ bool CompilePPUProgram::SetNextArgType(u32 types, bool show_err)
|
|||
|
||||
if(show_err)
|
||||
{
|
||||
WriteError(wxString::Format("Bad arg '%s'", wxString(&arg.string[0]).wx_str()));
|
||||
WriteError(fmt::Format("Bad arg '%s'", arg.string.c_str()));
|
||||
m_error = true;
|
||||
}
|
||||
|
||||
|
@ -598,38 +598,38 @@ bool CompilePPUProgram::SetNextArgBranch(u8 aa, bool show_err)
|
|||
return ret;
|
||||
}
|
||||
|
||||
bool CompilePPUProgram::IsBranchOp(const wxString& op)
|
||||
bool CompilePPUProgram::IsBranchOp(const std::string& op)
|
||||
{
|
||||
return op.Len() > 1 && op[op.Len() - 1] == ':';
|
||||
return op.length() > 1 && op[op.length() - 1] == ':';
|
||||
}
|
||||
|
||||
bool CompilePPUProgram::IsFuncOp(const wxString& op)
|
||||
bool CompilePPUProgram::IsFuncOp(const std::string& op)
|
||||
{
|
||||
return op.Len() >= 1 && op[0] == '[';
|
||||
return op.length() >= 1 && op[0] == '[';
|
||||
}
|
||||
|
||||
CompilePPUProgram::SP_TYPE CompilePPUProgram::GetSpType(const wxString& op)
|
||||
CompilePPUProgram::SP_TYPE CompilePPUProgram::GetSpType(const std::string& op)
|
||||
{
|
||||
if(op.Cmp(".int") == 0) return SP_INT;
|
||||
if(op.Cmp(".string") == 0) return SP_STRING;
|
||||
if(op.Cmp(".strlen") == 0) return SP_STRLEN;
|
||||
if(op.Cmp(".buf") == 0) return SP_BUF;
|
||||
if(op.Cmp(".srl") == 0) return SP_SRL;
|
||||
if(op.Cmp(".srr") == 0) return SP_SRR;
|
||||
if(op.Cmp(".mul") == 0) return SP_MUL;
|
||||
if(op.Cmp(".div") == 0) return SP_DIV;
|
||||
if(op.Cmp(".add") == 0) return SP_ADD;
|
||||
if(op.Cmp(".sub") == 0) return SP_SUB;
|
||||
if(op.Cmp(".and") == 0) return SP_AND;
|
||||
if(op.Cmp(".or") == 0) return SP_OR;
|
||||
if(op.Cmp(".xor") == 0) return SP_XOR;
|
||||
if(op.Cmp(".not") == 0) return SP_NOT;
|
||||
if(op.Cmp(".nor") == 0) return SP_NOR;
|
||||
if (op.compare(".int") == 0) return SP_INT;
|
||||
if (op.compare(".string") == 0) return SP_STRING;
|
||||
if (op.compare(".strlen") == 0) return SP_STRLEN;
|
||||
if (op.compare(".buf") == 0) return SP_BUF;
|
||||
if (op.compare(".srl") == 0) return SP_SRL;
|
||||
if (op.compare(".srr") == 0) return SP_SRR;
|
||||
if (op.compare(".mul") == 0) return SP_MUL;
|
||||
if (op.compare(".div") == 0) return SP_DIV;
|
||||
if (op.compare(".add") == 0) return SP_ADD;
|
||||
if (op.compare(".sub") == 0) return SP_SUB;
|
||||
if (op.compare(".and") == 0) return SP_AND;
|
||||
if (op.compare(".or") == 0) return SP_OR;
|
||||
if (op.compare(".xor") == 0) return SP_XOR;
|
||||
if (op.compare(".not") == 0) return SP_NOT;
|
||||
if (op.compare(".nor") == 0) return SP_NOR;
|
||||
|
||||
return SP_ERR;
|
||||
}
|
||||
|
||||
wxString CompilePPUProgram::GetSpStyle(const SP_TYPE sp)
|
||||
std::string CompilePPUProgram::GetSpStyle(const SP_TYPE sp)
|
||||
{
|
||||
switch(sp)
|
||||
{
|
||||
|
@ -658,16 +658,16 @@ wxString CompilePPUProgram::GetSpStyle(const SP_TYPE sp)
|
|||
return "error";
|
||||
}
|
||||
|
||||
bool CompilePPUProgram::IsSpOp(const wxString& op)
|
||||
bool CompilePPUProgram::IsSpOp(const std::string& op)
|
||||
{
|
||||
return GetSpType(op) != SP_ERR;
|
||||
}
|
||||
|
||||
CompilePPUProgram::Branch& CompilePPUProgram::GetBranch(const wxString& name)
|
||||
CompilePPUProgram::Branch& CompilePPUProgram::GetBranch(const std::string& name)
|
||||
{
|
||||
for(u32 i=0; i<m_branches.GetCount(); ++i)
|
||||
{
|
||||
if(name.ToStdString() != m_branches[i].m_name) continue;
|
||||
if(name != m_branches[i].m_name) continue;
|
||||
|
||||
return m_branches[i];
|
||||
}
|
||||
|
@ -675,7 +675,7 @@ CompilePPUProgram::Branch& CompilePPUProgram::GetBranch(const wxString& name)
|
|||
return m_branches[0];
|
||||
}
|
||||
|
||||
void CompilePPUProgram::SetSp(const wxString& name, u32 addr, bool create)
|
||||
void CompilePPUProgram::SetSp(const std::string& name, u32 addr, bool create)
|
||||
{
|
||||
if(create)
|
||||
{
|
||||
|
@ -687,21 +687,21 @@ void CompilePPUProgram::SetSp(const wxString& name, u32 addr, bool create)
|
|||
|
||||
for(u32 i=0; i<m_branches.GetCount(); ++i)
|
||||
{
|
||||
if(name.ToStdString() != m_branches[i].m_name)
|
||||
if(name != m_branches[i].m_name)
|
||||
continue;
|
||||
m_branches[i].m_addr = addr;
|
||||
}
|
||||
}
|
||||
|
||||
void CompilePPUProgram::LoadSp(const wxString& op, Elf64_Shdr& s_opd)
|
||||
void CompilePPUProgram::LoadSp(const std::string& op, Elf64_Shdr& s_opd)
|
||||
{
|
||||
SP_TYPE sp = GetSpType(op);
|
||||
|
||||
wxString test;
|
||||
std::string test;
|
||||
if(!GetArg(test) || test[0] != '[')
|
||||
{
|
||||
if(m_analyze) WriteHex("error\n");
|
||||
WriteError(wxString::Format("data not found. style: %s", GetSpStyle(sp).wx_str()));
|
||||
WriteError(fmt::Format("data not found. style: %s", GetSpStyle(sp).c_str()));
|
||||
m_error = true;
|
||||
NextLn();
|
||||
return;
|
||||
|
@ -710,11 +710,11 @@ void CompilePPUProgram::LoadSp(const wxString& op, Elf64_Shdr& s_opd)
|
|||
while(p > 0 && m_asm[(size_t)p] != '[') p--;
|
||||
p++;
|
||||
|
||||
wxString dst;
|
||||
std::string dst;
|
||||
if(!GetArg(dst))
|
||||
{
|
||||
if(m_analyze) WriteHex("error\n");
|
||||
WriteError(wxString::Format("dst not found. style: %s", GetSpStyle(sp).wx_str()));
|
||||
WriteError(fmt::Format("dst not found. style: %s", GetSpStyle(sp).c_str()));
|
||||
m_error = true;
|
||||
NextLn();
|
||||
return;
|
||||
|
@ -736,7 +736,7 @@ void CompilePPUProgram::LoadSp(const wxString& op, Elf64_Shdr& s_opd)
|
|||
|
||||
case ARG_ERR:
|
||||
{
|
||||
m_branches.Move(new Branch(wxEmptyString, -1, 0));
|
||||
m_branches.Move(new Branch("", -1, 0)); //TODO: allocated with new, deleted with free()
|
||||
dst_branch = &m_branches[m_branches.GetCount() - 1];
|
||||
}
|
||||
break;
|
||||
|
@ -745,7 +745,7 @@ void CompilePPUProgram::LoadSp(const wxString& op, Elf64_Shdr& s_opd)
|
|||
if(!dst_branch)
|
||||
{
|
||||
if(m_analyze) WriteHex("error\n");
|
||||
WriteError(wxString::Format("bad dst type. style: %s", GetSpStyle(sp).wx_str()));
|
||||
WriteError(fmt::Format("bad dst type. style: %s", GetSpStyle(sp).c_str()));
|
||||
m_error = true;
|
||||
NextLn();
|
||||
return;
|
||||
|
@ -759,11 +759,11 @@ void CompilePPUProgram::LoadSp(const wxString& op, Elf64_Shdr& s_opd)
|
|||
case SP_BUF:
|
||||
case SP_NOT:
|
||||
{
|
||||
wxString src1;
|
||||
std::string src1;
|
||||
if(!GetArg(src1, true))
|
||||
{
|
||||
if(m_analyze) WriteHex("error\n");
|
||||
WriteError(wxString::Format("src not found. style: %s", GetSpStyle(sp).wx_str()));
|
||||
WriteError(fmt::Format("src not found. style: %s", GetSpStyle(sp).c_str()));
|
||||
m_error = true;
|
||||
NextLn();
|
||||
return;
|
||||
|
@ -779,7 +779,7 @@ void CompilePPUProgram::LoadSp(const wxString& op, Elf64_Shdr& s_opd)
|
|||
: ~(ARG_IMM | ARG_BRANCH) & a_src1.type)
|
||||
{
|
||||
if(m_analyze) WriteHex("error\n");
|
||||
WriteError(wxString::Format("bad src type. style: %s", GetSpStyle(sp).wx_str()));
|
||||
WriteError(fmt::Format("bad src type. style: %s", GetSpStyle(sp).c_str()));
|
||||
m_error = true;
|
||||
NextLn();
|
||||
return;
|
||||
|
@ -788,7 +788,7 @@ void CompilePPUProgram::LoadSp(const wxString& op, Elf64_Shdr& s_opd)
|
|||
if(m_asm[(size_t)p - 1] != ']')
|
||||
{
|
||||
if(m_analyze) WriteHex("error\n");
|
||||
WriteError(wxString::Format("']' not found. style: %s", GetSpStyle(sp).wx_str()));
|
||||
WriteError(fmt::Format("']' not found. style: %s", GetSpStyle(sp).c_str()));
|
||||
m_error = true;
|
||||
NextLn();
|
||||
return;
|
||||
|
@ -802,12 +802,12 @@ void CompilePPUProgram::LoadSp(const wxString& op, Elf64_Shdr& s_opd)
|
|||
|
||||
if(sp == SP_STRING)
|
||||
{
|
||||
src1 = src1(1, src1.Len()-2);
|
||||
src1 = src1.substr(1, src1.length()-2);
|
||||
bool founded = false;
|
||||
|
||||
for(u32 i=0; i<m_sp_string.GetCount(); ++i)
|
||||
{
|
||||
if(src1.ToStdString() != m_sp_string[i].m_data) continue;
|
||||
if(src1 != m_sp_string[i].m_data) continue;
|
||||
*dst_branch = Branch(dst, -1, m_sp_string[i].m_addr);
|
||||
founded = true;
|
||||
}
|
||||
|
@ -815,8 +815,8 @@ void CompilePPUProgram::LoadSp(const wxString& op, Elf64_Shdr& s_opd)
|
|||
if(!founded)
|
||||
{
|
||||
const u32 addr = s_opd.sh_addr + s_opd.sh_size;
|
||||
m_sp_string.Move(new SpData(src1, addr));
|
||||
s_opd.sh_size += src1.Len() + 1;
|
||||
m_sp_string.Move(new SpData(src1, addr)); //TODO: new and free mixed
|
||||
s_opd.sh_size += src1.length() + 1;
|
||||
*dst_branch = Branch(dst, -1, addr);
|
||||
}
|
||||
}
|
||||
|
@ -824,7 +824,7 @@ void CompilePPUProgram::LoadSp(const wxString& op, Elf64_Shdr& s_opd)
|
|||
{
|
||||
switch(a_src1.type)
|
||||
{
|
||||
case ARG_TXT: *dst_branch = Branch(dst, -1, src1.Len() - 2); break;
|
||||
case ARG_TXT: *dst_branch = Branch(dst, -1, src1.length() - 2); break;
|
||||
case ARG_BRANCH:
|
||||
{
|
||||
for(u32 i=0; i<m_sp_string.GetCount(); ++i)
|
||||
|
@ -865,11 +865,11 @@ void CompilePPUProgram::LoadSp(const wxString& op, Elf64_Shdr& s_opd)
|
|||
case SP_XOR:
|
||||
case SP_NOR:
|
||||
{
|
||||
wxString src1;
|
||||
std::string src1;
|
||||
if(!GetArg(src1))
|
||||
{
|
||||
if(m_analyze) WriteHex("error\n");
|
||||
WriteError(wxString::Format("src1 not found. style: %s", GetSpStyle(sp).wx_str()));
|
||||
WriteError(fmt::Format("src1 not found. style: %s", GetSpStyle(sp).c_str()));
|
||||
m_error = true;
|
||||
NextLn();
|
||||
return;
|
||||
|
@ -881,17 +881,17 @@ void CompilePPUProgram::LoadSp(const wxString& op, Elf64_Shdr& s_opd)
|
|||
if(~(ARG_IMM | ARG_BRANCH) & a_src1.type)
|
||||
{
|
||||
if(m_analyze) WriteHex("error\n");
|
||||
WriteError(wxString::Format("bad src1 type. style: %s", GetSpStyle(sp).wx_str()));
|
||||
WriteError(fmt::Format("bad src1 type. style: %s", GetSpStyle(sp).c_str()));
|
||||
m_error = true;
|
||||
NextLn();
|
||||
return;
|
||||
}
|
||||
|
||||
wxString src2;
|
||||
std::string src2;
|
||||
if(!GetArg(src2, true))
|
||||
{
|
||||
if(m_analyze) WriteHex("error\n");
|
||||
WriteError(wxString::Format("src2 not found. style: %s", GetSpStyle(sp).wx_str()));
|
||||
WriteError(fmt::Format("src2 not found. style: %s", GetSpStyle(sp).c_str()));
|
||||
m_error = true;
|
||||
return;
|
||||
}
|
||||
|
@ -902,7 +902,7 @@ void CompilePPUProgram::LoadSp(const wxString& op, Elf64_Shdr& s_opd)
|
|||
if(~(ARG_IMM | ARG_BRANCH) & a_src2.type)
|
||||
{
|
||||
if(m_analyze) WriteHex("error\n");
|
||||
WriteError(wxString::Format("bad src2 type. style: %s", GetSpStyle(sp).wx_str()));
|
||||
WriteError(fmt::Format("bad src2 type. style: %s", GetSpStyle(sp).c_str()));
|
||||
m_error = true;
|
||||
NextLn();
|
||||
return;
|
||||
|
@ -911,7 +911,7 @@ void CompilePPUProgram::LoadSp(const wxString& op, Elf64_Shdr& s_opd)
|
|||
if(m_asm[(size_t)p - 1] != ']')
|
||||
{
|
||||
if(m_analyze) WriteHex("error\n");
|
||||
WriteError(wxString::Format("']' not found. style: %s", GetSpStyle(sp).wx_str()));
|
||||
WriteError(fmt::Format("']' not found. style: %s", GetSpStyle(sp).c_str()));
|
||||
m_error = true;
|
||||
NextLn();
|
||||
return;
|
||||
|
@ -969,7 +969,7 @@ void CompilePPUProgram::Compile()
|
|||
u32 text_size = 0;
|
||||
while(!IsEnd())
|
||||
{
|
||||
wxString op;
|
||||
std::string op;
|
||||
if(GetOp(op) && !IsFuncOp(op) && !IsBranchOp(op) && !IsSpOp(op))
|
||||
{
|
||||
text_size += 4;
|
||||
|
@ -994,7 +994,7 @@ void CompilePPUProgram::Compile()
|
|||
Elf64_Shdr s_null;
|
||||
memset(&s_null, 0, sizeof(Elf64_Shdr));
|
||||
|
||||
wxArrayString sections_names;
|
||||
std::vector<std::string> sections_names;
|
||||
u32 section_name_offset = 1;
|
||||
|
||||
Elf64_Shdr s_text;
|
||||
|
@ -1006,18 +1006,18 @@ void CompilePPUProgram::Compile()
|
|||
s_text.sh_addralign = 4;
|
||||
s_text.sh_flags = 6;
|
||||
s_text.sh_name = section_name_offset;
|
||||
sections_names.Add(".text");
|
||||
section_name_offset += wxString(".text").Len() + 1;
|
||||
sections_names.push_back(".text");
|
||||
section_name_offset += std::string(".text").length() + 1;
|
||||
section_offset += s_text.sh_size;
|
||||
|
||||
m_text_addr = s_text.sh_addr;
|
||||
|
||||
struct Module
|
||||
{
|
||||
wxString m_name;
|
||||
std::string m_name;
|
||||
Array<u32> m_imports;
|
||||
|
||||
Module(const wxString& name, u32 import) : m_name(name)
|
||||
Module(const std::string& name, u32 import) : m_name(name)
|
||||
{
|
||||
Add(import);
|
||||
}
|
||||
|
@ -1029,7 +1029,7 @@ void CompilePPUProgram::Compile()
|
|||
|
||||
void Clear()
|
||||
{
|
||||
m_name.Clear();
|
||||
m_name.clear();
|
||||
m_imports.Clear();
|
||||
}
|
||||
};
|
||||
|
@ -1039,7 +1039,7 @@ void CompilePPUProgram::Compile()
|
|||
FirstChar();
|
||||
while(!IsEnd())
|
||||
{
|
||||
wxString op;
|
||||
std::string op;
|
||||
if(!GetOp(op) || !IsFuncOp(op))
|
||||
{
|
||||
NextLn();
|
||||
|
@ -1049,7 +1049,7 @@ void CompilePPUProgram::Compile()
|
|||
while(p > 0 && m_asm[(size_t)p] != '[') p--;
|
||||
p++;
|
||||
|
||||
wxString module, name, id;
|
||||
std::string module, name, id;
|
||||
|
||||
if(!GetArg(module))
|
||||
{
|
||||
|
@ -1118,13 +1118,13 @@ void CompilePPUProgram::Compile()
|
|||
|
||||
if(!CheckEnd()) continue;
|
||||
|
||||
m_branches.Move(new Branch(name, a_id.value, 0));
|
||||
m_branches.Move(new Branch(name, a_id.value, 0)); //TODO: HACK: new and free() mixed
|
||||
const u32 import = m_branches.GetCount() - 1;
|
||||
|
||||
bool founded = false;
|
||||
for(u32 i=0; i<modules.GetCount(); ++i)
|
||||
{
|
||||
if(modules[i].m_name.Cmp(module) != 0) continue;
|
||||
if(modules[i].m_name.compare(module) != 0) continue;
|
||||
founded = true;
|
||||
modules[i].Add(import);
|
||||
break;
|
||||
|
@ -1150,8 +1150,8 @@ void CompilePPUProgram::Compile()
|
|||
s_sceStub_text.sh_name = section_name_offset;
|
||||
s_sceStub_text.sh_flags = 6;
|
||||
s_sceStub_text.sh_size = imports_count * sceStub_text_block;
|
||||
sections_names.Add(".sceStub.text");
|
||||
section_name_offset += wxString(".sceStub.text").Len() + 1;
|
||||
sections_names.push_back(".sceStub.text");
|
||||
section_name_offset += std::string(".sceStub.text").length() + 1;
|
||||
section_offset += s_sceStub_text.sh_size;
|
||||
|
||||
for(u32 m=0, pos=0; m<modules.GetCount(); ++m)
|
||||
|
@ -1172,8 +1172,8 @@ void CompilePPUProgram::Compile()
|
|||
s_lib_stub_top.sh_addr = section_offset + 0x10000;
|
||||
s_lib_stub_top.sh_flags = 2;
|
||||
s_lib_stub_top.sh_size = 4;
|
||||
sections_names.Add(".lib.stub.top");
|
||||
section_name_offset += wxString(".lib.stub.top").Len() + 1;
|
||||
sections_names.push_back(".lib.stub.top");
|
||||
section_name_offset += std::string(".lib.stub.top").length() + 1;
|
||||
section_offset += s_lib_stub_top.sh_size;
|
||||
|
||||
Elf64_Shdr s_lib_stub;
|
||||
|
@ -1185,8 +1185,8 @@ void CompilePPUProgram::Compile()
|
|||
s_lib_stub.sh_addr = section_offset + 0x10000;
|
||||
s_lib_stub.sh_flags = 2;
|
||||
s_lib_stub.sh_size = sizeof(Elf64_StubHeader) * modules.GetCount();
|
||||
sections_names.Add(".lib.stub");
|
||||
section_name_offset += wxString(".lib.stub").Len() + 1;
|
||||
sections_names.push_back(".lib.stub");
|
||||
section_name_offset += std::string(".lib.stub").length() + 1;
|
||||
section_offset += s_lib_stub.sh_size;
|
||||
|
||||
Elf64_Shdr s_lib_stub_btm;
|
||||
|
@ -1198,8 +1198,8 @@ void CompilePPUProgram::Compile()
|
|||
s_lib_stub_btm.sh_addr = section_offset + 0x10000;
|
||||
s_lib_stub_btm.sh_flags = 2;
|
||||
s_lib_stub_btm.sh_size = 4;
|
||||
sections_names.Add(".lib.stub.btm");
|
||||
section_name_offset += wxString(".lib.stub.btm").Len() + 1;
|
||||
sections_names.push_back(".lib.stub.btm");
|
||||
section_name_offset += std::string(".lib.stub.btm").length() + 1;
|
||||
section_offset += s_lib_stub_btm.sh_size;
|
||||
|
||||
Elf64_Shdr s_rodata_sceFNID;
|
||||
|
@ -1212,8 +1212,8 @@ void CompilePPUProgram::Compile()
|
|||
s_rodata_sceFNID.sh_addr = section_offset + 0x10000;
|
||||
s_rodata_sceFNID.sh_flags = 2;
|
||||
s_rodata_sceFNID.sh_size = imports_count * 4;
|
||||
sections_names.Add(".rodata.sceFNID");
|
||||
section_name_offset += wxString(".rodata.sceFNID").Len() + 1;
|
||||
sections_names.push_back(".rodata.sceFNID");
|
||||
section_name_offset += std::string(".rodata.sceFNID").length() + 1;
|
||||
section_offset += s_rodata_sceFNID.sh_size;
|
||||
|
||||
Elf64_Shdr s_rodata_sceResident;
|
||||
|
@ -1228,11 +1228,11 @@ void CompilePPUProgram::Compile()
|
|||
s_rodata_sceResident.sh_size = 4;
|
||||
for(u32 i=0; i<modules.GetCount(); ++i)
|
||||
{
|
||||
s_rodata_sceResident.sh_size += modules[i].m_name.Len() + 1;
|
||||
s_rodata_sceResident.sh_size += modules[i].m_name.length() + 1;
|
||||
}
|
||||
s_rodata_sceResident.sh_size = Memory.AlignAddr(s_rodata_sceResident.sh_size, s_rodata_sceResident.sh_addralign);
|
||||
sections_names.Add(".rodata.sceResident");
|
||||
section_name_offset += wxString(".rodata.sceResident").Len() + 1;
|
||||
sections_names.push_back(".rodata.sceResident");
|
||||
section_name_offset += std::string(".rodata.sceResident").length() + 1;
|
||||
section_offset += s_rodata_sceResident.sh_size;
|
||||
|
||||
Elf64_Shdr s_lib_ent_top;
|
||||
|
@ -1245,8 +1245,8 @@ void CompilePPUProgram::Compile()
|
|||
s_lib_ent_top.sh_name = section_name_offset;
|
||||
s_lib_ent_top.sh_offset = section_offset;
|
||||
s_lib_ent_top.sh_addr = section_offset + 0x10000;
|
||||
sections_names.Add(".lib.ent.top");
|
||||
section_name_offset += wxString(".lib.ent.top").Len() + 1;
|
||||
sections_names.push_back(".lib.ent.top");
|
||||
section_name_offset += std::string(".lib.ent.top").length() + 1;
|
||||
section_offset += s_lib_ent_top.sh_size;
|
||||
|
||||
Elf64_Shdr s_lib_ent_btm;
|
||||
|
@ -1258,8 +1258,8 @@ void CompilePPUProgram::Compile()
|
|||
s_lib_ent_btm.sh_name = section_name_offset;
|
||||
s_lib_ent_btm.sh_offset = section_offset;
|
||||
s_lib_ent_btm.sh_addr = section_offset + 0x10000;
|
||||
sections_names.Add(".lib.ent.btm");
|
||||
section_name_offset += wxString(".lib.ent.btm").Len() + 1;
|
||||
sections_names.push_back(".lib.ent.btm");
|
||||
section_name_offset += std::string(".lib.ent.btm").length() + 1;
|
||||
section_offset += s_lib_ent_btm.sh_size;
|
||||
|
||||
Elf64_Shdr s_sys_proc_prx_param;
|
||||
|
@ -1272,8 +1272,8 @@ void CompilePPUProgram::Compile()
|
|||
s_sys_proc_prx_param.sh_offset = section_offset;
|
||||
s_sys_proc_prx_param.sh_addr = section_offset + 0x10000;
|
||||
s_sys_proc_prx_param.sh_flags = 2;
|
||||
sections_names.Add(".sys_proc_prx_param");
|
||||
section_name_offset += wxString(".sys_proc_prx_param").Len() + 1;
|
||||
sections_names.push_back(".sys_proc_prx_param");
|
||||
section_name_offset += std::string(".sys_proc_prx_param").length() + 1;
|
||||
section_offset += s_sys_proc_prx_param.sh_size;
|
||||
|
||||
const u32 prog_load_0_end = section_offset;
|
||||
|
@ -1291,8 +1291,8 @@ void CompilePPUProgram::Compile()
|
|||
s_data_sceFStub.sh_offset = section_offset;
|
||||
s_data_sceFStub.sh_addr = section_offset + 0x10000;
|
||||
s_data_sceFStub.sh_size = imports_count * 4;
|
||||
sections_names.Add(".data.sceFStub");
|
||||
section_name_offset += wxString(".data.sceFStub").Len() + 1;
|
||||
sections_names.push_back(".data.sceFStub");
|
||||
section_name_offset += std::string(".data.sceFStub").length() + 1;
|
||||
section_offset += s_data_sceFStub.sh_size;
|
||||
|
||||
Elf64_Shdr s_tbss;
|
||||
|
@ -1305,8 +1305,8 @@ void CompilePPUProgram::Compile()
|
|||
s_tbss.sh_name = section_name_offset;
|
||||
s_tbss.sh_offset = section_offset;
|
||||
s_tbss.sh_addr = section_offset + 0x10000;
|
||||
sections_names.Add(".tbss");
|
||||
section_name_offset += wxString(".tbss").Len() + 1;
|
||||
sections_names.push_back(".tbss");
|
||||
section_name_offset += std::string(".tbss").length() + 1;
|
||||
section_offset += s_tbss.sh_size;
|
||||
|
||||
Elf64_Shdr s_opd;
|
||||
|
@ -1319,14 +1319,14 @@ void CompilePPUProgram::Compile()
|
|||
s_opd.sh_addr = section_offset + 0x10000;
|
||||
s_opd.sh_name = section_name_offset;
|
||||
s_opd.sh_flags = 3;
|
||||
sections_names.Add(".opd");
|
||||
section_name_offset += wxString(".opd").Len() + 1;
|
||||
sections_names.push_back(".opd");
|
||||
section_name_offset += std::string(".opd").length() + 1;
|
||||
|
||||
FirstChar();
|
||||
|
||||
while(!IsEnd())
|
||||
{
|
||||
wxString op;
|
||||
std::string op;
|
||||
if(!GetOp(op) || IsFuncOp(op) || IsSpOp(op))
|
||||
{
|
||||
NextLn();
|
||||
|
@ -1335,12 +1335,12 @@ void CompilePPUProgram::Compile()
|
|||
|
||||
if(IsBranchOp(op))
|
||||
{
|
||||
const wxString& name = op(0, op.Len() - 1);
|
||||
const std::string& name = op.substr(0, op.length() - 1);
|
||||
|
||||
for(u32 i=0; i<m_branches.GetCount(); ++i)
|
||||
{
|
||||
if(name.ToStdString() != m_branches[i].m_name) continue;
|
||||
WriteError(wxString::Format("'%s' already declared", name.wx_str()));
|
||||
if(name != m_branches[i].m_name) continue;
|
||||
WriteError(fmt::Format("'%s' already declared", name.c_str()));
|
||||
m_error = true;
|
||||
break;
|
||||
}
|
||||
|
@ -1350,13 +1350,13 @@ void CompilePPUProgram::Compile()
|
|||
|
||||
if(a_name.type != ARG_ERR)
|
||||
{
|
||||
WriteError(wxString::Format("bad name '%s'", name.wx_str()));
|
||||
WriteError(fmt::Format("bad name '%s'", name.c_str()));
|
||||
m_error = true;
|
||||
}
|
||||
|
||||
if(m_error) break;
|
||||
|
||||
m_branches.Move(new Branch(name, m_branch_pos));
|
||||
m_branches.Move(new Branch(name, m_branch_pos)); //TODO: HACK: free() and new mixed
|
||||
|
||||
CheckEnd();
|
||||
continue;
|
||||
|
@ -1376,7 +1376,7 @@ void CompilePPUProgram::Compile()
|
|||
break;
|
||||
}
|
||||
|
||||
if(!has_entry) m_branches.Move(new Branch("entry", 0));
|
||||
if(!has_entry) m_branches.Move(new Branch("entry", 0)); //TODO: HACK: new and free() mixed
|
||||
|
||||
if(m_analyze) m_error = false;
|
||||
FirstChar();
|
||||
|
@ -1386,7 +1386,7 @@ void CompilePPUProgram::Compile()
|
|||
m_args.Clear();
|
||||
m_end_args = false;
|
||||
|
||||
wxString op;
|
||||
std::string op;
|
||||
if(!GetOp(op) || IsBranchOp(op) || IsFuncOp(op))
|
||||
{
|
||||
if(m_analyze) WriteHex("\n");
|
||||
|
@ -1430,7 +1430,7 @@ void CompilePPUProgram::Compile()
|
|||
}
|
||||
else
|
||||
{
|
||||
WriteError(wxString::Format("unknown instruction '%s'", op.wx_str()));
|
||||
WriteError(fmt::Format("unknown instruction '%s'", op.c_str()));
|
||||
EndLn();
|
||||
m_error = true;
|
||||
}
|
||||
|
@ -1462,14 +1462,14 @@ void CompilePPUProgram::Compile()
|
|||
code = (*instr)(args);
|
||||
}
|
||||
|
||||
if(m_analyze) WriteHex(wxString::Format("0x%08x\n", code));
|
||||
if(m_analyze) WriteHex(fmt::Format("0x%08x\n", code));
|
||||
|
||||
if(!m_analyze) m_code.AddCpy(code);
|
||||
|
||||
m_branch_pos++;
|
||||
}
|
||||
|
||||
if(!m_file_path.IsEmpty() && !m_analyze && !m_error)
|
||||
if(!m_file_path.empty() && !m_analyze && !m_error)
|
||||
{
|
||||
s_opd.sh_size = Memory.AlignAddr(s_opd.sh_size, s_opd.sh_addralign);
|
||||
section_offset += s_opd.sh_size;
|
||||
|
@ -1484,12 +1484,12 @@ void CompilePPUProgram::Compile()
|
|||
s_shstrtab.sh_type = 3;
|
||||
s_shstrtab.sh_offset = section_offset;
|
||||
s_shstrtab.sh_addr = 0;
|
||||
sections_names.Add(".shstrtab");
|
||||
section_name_offset += wxString(".shstrtab").Len() + 1;
|
||||
sections_names.push_back(".shstrtab");
|
||||
section_name_offset += std::string(".shstrtab").length() + 1;
|
||||
s_shstrtab.sh_size = section_name_offset;
|
||||
section_offset += s_shstrtab.sh_size;
|
||||
|
||||
wxFile f(m_file_path, wxFile::write);
|
||||
wxFile f(fmt::FromUTF8(m_file_path), wxFile::write);
|
||||
|
||||
elf_info.e_magic = 0x7F454C46;
|
||||
elf_info.e_class = 2; //ELF64
|
||||
|
@ -1595,7 +1595,7 @@ void CompilePPUProgram::Compile()
|
|||
dataoffs += modules[i].m_imports.GetCount() * 4;
|
||||
|
||||
f.Write(&stub, sizeof(Elf64_StubHeader));
|
||||
nameoffs += modules[i].m_name.Len() + 1;
|
||||
nameoffs += modules[i].m_name.length() + 1;
|
||||
}
|
||||
|
||||
f.Seek(s_lib_stub_btm.sh_offset);
|
||||
|
@ -1622,7 +1622,7 @@ void CompilePPUProgram::Compile()
|
|||
f.Seek(s_rodata_sceResident.sh_offset + 4);
|
||||
for(u32 i=0; i<modules.GetCount(); ++i)
|
||||
{
|
||||
f.Write(&modules[i].m_name[0], modules[i].m_name.Len() + 1);
|
||||
f.Write(&modules[i].m_name[0], modules[i].m_name.length() + 1);
|
||||
}
|
||||
|
||||
f.Seek(s_sys_proc_prx_param.sh_offset);
|
||||
|
@ -1638,9 +1638,9 @@ void CompilePPUProgram::Compile()
|
|||
f.Seek(s_tbss.sh_size, wxFromCurrent);
|
||||
|
||||
f.Seek(s_shstrtab.sh_offset + 1);
|
||||
for(u32 i=0; i<sections_names.GetCount(); ++i)
|
||||
for(u32 i=0; i<sections_names.size(); ++i)
|
||||
{
|
||||
f.Write(§ions_names[i][0], sections_names[i].Len() + 1);
|
||||
f.Write(§ions_names[i][0], sections_names[i].length() + 1);
|
||||
}
|
||||
|
||||
Elf64_Phdr p_load_0;
|
||||
|
@ -1700,7 +1700,7 @@ void CompilePPUProgram::Compile()
|
|||
WritePhdr(f, p_loos_1);
|
||||
WritePhdr(f, p_loos_2);
|
||||
|
||||
sections_names.Clear();
|
||||
sections_names.clear();
|
||||
delete[] opd_data;
|
||||
for(u32 i=0; i<modules.GetCount(); ++i) modules[i].Clear();
|
||||
modules.Clear();
|
||||
|
@ -1729,6 +1729,7 @@ void CompilePPUProgram::Compile()
|
|||
}
|
||||
else
|
||||
{
|
||||
//TODO: doesn't look portable
|
||||
system("make_fself.cmd");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,8 +23,8 @@ struct Arg
|
|||
u32 value;
|
||||
ArgType type;
|
||||
|
||||
Arg(const wxString& _string, const u32 _value = 0, const ArgType _type = ARG_ERR)
|
||||
: string(_string.ToStdString())
|
||||
Arg(const std::string& _string, const u32 _value = 0, const ArgType _type = ARG_ERR)
|
||||
: string(_string)
|
||||
, value(_value)
|
||||
, type(_type)
|
||||
{
|
||||
|
@ -38,7 +38,7 @@ struct SectionInfo
|
|||
Array<u8> code;
|
||||
u32 section_num;
|
||||
|
||||
SectionInfo(const wxString& name);
|
||||
SectionInfo(const std::string& name);
|
||||
~SectionInfo();
|
||||
|
||||
void SetDataSize(u32 size, u32 align = 0);
|
||||
|
@ -67,16 +67,16 @@ class CompilePPUProgram
|
|||
s32 m_id;
|
||||
s32 m_addr;
|
||||
|
||||
Branch(const wxString& name, s32 pos)
|
||||
: m_name(name.ToStdString())
|
||||
Branch(const std::string& name, s32 pos)
|
||||
: m_name(name)
|
||||
, m_pos(pos)
|
||||
, m_id(-1)
|
||||
, m_addr(-1)
|
||||
{
|
||||
}
|
||||
|
||||
Branch(const wxString& name, u32 id, u32 addr)
|
||||
: m_name(name.ToStdString())
|
||||
Branch(const std::string& name, u32 id, u32 addr)
|
||||
: m_name(name)
|
||||
, m_pos(-1)
|
||||
, m_id(id)
|
||||
, m_addr(addr)
|
||||
|
@ -87,7 +87,7 @@ class CompilePPUProgram
|
|||
bool m_analyze;
|
||||
s64 p;
|
||||
u64 m_line;
|
||||
const wxString& m_asm;
|
||||
const std::string& m_asm;
|
||||
wxTextCtrl* m_asm_list;
|
||||
wxTextCtrl* m_hex_list;
|
||||
wxTextCtrl* m_err_list;
|
||||
|
@ -97,15 +97,15 @@ class CompilePPUProgram
|
|||
Array<Branch> m_branches;
|
||||
s32 m_branch_pos;
|
||||
u32 m_text_addr;
|
||||
wxString m_file_path;
|
||||
std::string m_file_path;
|
||||
|
||||
struct SpData
|
||||
{
|
||||
std::string m_data;
|
||||
u32 m_addr;
|
||||
|
||||
SpData(const wxString& data, u32 addr)
|
||||
: m_data(data.ToStdString())
|
||||
SpData(const std::string& data, u32 addr)
|
||||
: m_data(data)
|
||||
, m_addr(addr)
|
||||
{
|
||||
}
|
||||
|
@ -117,8 +117,8 @@ class CompilePPUProgram
|
|||
|
||||
public:
|
||||
CompilePPUProgram(
|
||||
const wxString& asm_,
|
||||
const wxString& file_path = wxEmptyString,
|
||||
const std::string& asm_,
|
||||
const std::string& file_path = "",
|
||||
wxTextCtrl* asm_list = nullptr,
|
||||
wxTextCtrl* hex_list = nullptr,
|
||||
wxTextCtrl* err_list = nullptr,
|
||||
|
@ -131,8 +131,8 @@ protected:
|
|||
bool IsEnd() const;
|
||||
bool IsEndLn(const char c) const;
|
||||
|
||||
void WriteHex(const wxString& text);
|
||||
void WriteError(const wxString& error);
|
||||
void WriteHex(const std::string& text);
|
||||
void WriteError(const std::string& error);
|
||||
|
||||
char NextChar();
|
||||
void NextLn();
|
||||
|
@ -141,21 +141,21 @@ protected:
|
|||
void FirstChar();
|
||||
void PrevArg();
|
||||
|
||||
bool GetOp(wxString& result);
|
||||
int GetArg(wxString& result, bool func = false);
|
||||
bool GetOp(std::string& result);
|
||||
int GetArg(std::string& result, bool func = false);
|
||||
|
||||
bool CheckEnd(bool show_err = true);
|
||||
|
||||
void DetectArgInfo(Arg& arg);
|
||||
void LoadArgs();
|
||||
u32 GetBranchValue(const wxString& branch);
|
||||
u32 GetBranchValue(const std::string& branch);
|
||||
|
||||
bool SetNextArgType(u32 types, bool show_err = true);
|
||||
bool SetNextArgBranch(u8 aa, bool show_err = true);
|
||||
|
||||
public:
|
||||
static bool IsBranchOp(const wxString& op);
|
||||
static bool IsFuncOp(const wxString& op);
|
||||
static bool IsBranchOp(const std::string& op);
|
||||
static bool IsFuncOp(const std::string& op);
|
||||
|
||||
enum SP_TYPE
|
||||
{
|
||||
|
@ -177,15 +177,15 @@ public:
|
|||
SP_NOR,
|
||||
};
|
||||
|
||||
static SP_TYPE GetSpType(const wxString& op);
|
||||
static wxString GetSpStyle(const SP_TYPE sp);
|
||||
static SP_TYPE GetSpType(const std::string& op);
|
||||
static std::string GetSpStyle(const SP_TYPE sp);
|
||||
|
||||
static bool IsSpOp(const wxString& op);
|
||||
static bool IsSpOp(const std::string& op);
|
||||
|
||||
protected:
|
||||
Branch& GetBranch(const wxString& name);
|
||||
void SetSp(const wxString& name, u32 addr, bool create);
|
||||
void LoadSp(const wxString& op, Elf64_Shdr& s_opd);
|
||||
Branch& GetBranch(const std::string& name);
|
||||
void SetSp(const std::string& name, u32 addr, bool create);
|
||||
void LoadSp(const std::string& op, Elf64_Shdr& s_opd);
|
||||
|
||||
public:
|
||||
void Compile();
|
||||
|
|
|
@ -10,7 +10,7 @@ PPUThread& GetCurrentPPUThread()
|
|||
{
|
||||
PPCThread* thread = GetCurrentPPCThread();
|
||||
|
||||
if(!thread || thread->GetType() != CPU_THREAD_PPU) throw wxString("GetCurrentPPUThread: bad thread");
|
||||
if(!thread || thread->GetType() != CPU_THREAD_PPU) throw std::string("GetCurrentPPUThread: bad thread");
|
||||
|
||||
return *(PPUThread*)thread;
|
||||
}
|
||||
|
@ -47,9 +47,9 @@ void PPUThread::DoReset()
|
|||
cycle = 0;
|
||||
}
|
||||
|
||||
void PPUThread::AddArgv(const wxString& arg)
|
||||
void PPUThread::AddArgv(const std::string& arg)
|
||||
{
|
||||
m_stack_point -= arg.Len() + 1;
|
||||
m_stack_point -= arg.length() + 1;
|
||||
m_stack_point = Memory.AlignAddr(m_stack_point, 0x10) - 0x10;
|
||||
m_argv_addr.AddCpy(m_stack_point);
|
||||
Memory.WriteString(m_stack_point, arg);
|
||||
|
|
|
@ -381,7 +381,7 @@ struct PPCdouble
|
|||
}
|
||||
#endif
|
||||
|
||||
throw wxString::Format("PPCdouble::UpdateType() -> unknown fpclass (0x%04x).", fpc);
|
||||
throw fmt::Format("PPCdouble::UpdateType() -> unknown fpclass (0x%04x).", fpc);
|
||||
}
|
||||
|
||||
FPRType GetType() const
|
||||
|
@ -488,11 +488,11 @@ union VPR_reg
|
|||
|
||||
VPR_reg() { Clear(); }
|
||||
|
||||
wxString ToString(bool hex=false) const
|
||||
std::string ToString(bool hex = false) const
|
||||
{
|
||||
if(hex) return wxString::Format("%08x%08x%08x%08x", _u32[3], _u32[2], _u32[1], _u32[0]);
|
||||
if(hex) return fmt::Format("%08x%08x%08x%08x", _u32[3], _u32[2], _u32[1], _u32[0]);
|
||||
|
||||
return wxString::Format("x: %g y: %g z: %g w: %g", _f[3], _f[2], _f[1], _f[0]);
|
||||
return fmt::Format("x: %g y: %g z: %g w: %g", _f[3], _f[2], _f[1], _f[0]);
|
||||
}
|
||||
|
||||
u8 GetBit(u8 bit)
|
||||
|
@ -735,99 +735,106 @@ public:
|
|||
FPSCR.FI = val;
|
||||
}
|
||||
|
||||
virtual wxString RegsToString()
|
||||
virtual std::string RegsToString()
|
||||
{
|
||||
wxString ret = "Registers:\n=========\n";
|
||||
std::string ret = "Registers:\n=========\n";
|
||||
|
||||
for(uint i=0; i<32; ++i) ret += wxString::Format("GPR[%d] = 0x%llx\n", i, GPR[i]);
|
||||
for(uint i=0; i<32; ++i) ret += wxString::Format("FPR[%d] = %.6G\n", i, (double)FPR[i]);
|
||||
for(uint i=0; i<32; ++i) ret += wxString::Format("VPR[%d] = 0x%s [%s]\n", i, (const char*)VPR[i].ToString(true).wx_str(), (const char*)VPR[i].ToString().wx_str());
|
||||
ret += wxString::Format("CR = 0x%08x\n", CR.CR);
|
||||
ret += wxString::Format("LR = 0x%llx\n", LR);
|
||||
ret += wxString::Format("CTR = 0x%llx\n", CTR);
|
||||
ret += wxString::Format("XER = 0x%llx [CA=%lld | OV=%lld | SO=%lld]\n", XER.XER, XER.CA, XER.OV, XER.SO);
|
||||
ret += wxString::Format("FPSCR = 0x%x "
|
||||
for(uint i=0; i<32; ++i) ret += fmt::Format("GPR[%d] = 0x%llx\n", i, GPR[i]);
|
||||
for(uint i=0; i<32; ++i) ret += fmt::Format("FPR[%d] = %.6G\n", i, (double)FPR[i]);
|
||||
for(uint i=0; i<32; ++i) ret += fmt::Format("VPR[%d] = 0x%s [%s]\n", i, (const char*)VPR[i].ToString(true).c_str(), (const char*)VPR[i].ToString().c_str());
|
||||
ret += fmt::Format("CR = 0x%08x\n", CR.CR);
|
||||
ret += fmt::Format("LR = 0x%llx\n", LR);
|
||||
ret += fmt::Format("CTR = 0x%llx\n", CTR);
|
||||
ret += fmt::Format("XER = 0x%llx [CA=%lld | OV=%lld | SO=%lld]\n", XER.XER, fmt::by_value(XER.CA), fmt::by_value(XER.OV), fmt::by_value(XER.SO));
|
||||
ret += fmt::Format("FPSCR = 0x%x "
|
||||
"[RN=%d | NI=%d | XE=%d | ZE=%d | UE=%d | OE=%d | VE=%d | "
|
||||
"VXCVI=%d | VXSQRT=%d | VXSOFT=%d | FPRF=%d | "
|
||||
"FI=%d | FR=%d | VXVC=%d | VXIMZ=%d | "
|
||||
"VXZDZ=%d | VXIDI=%d | VXISI=%d | VXSNAN=%d | "
|
||||
"XX=%d | ZX=%d | UX=%d | OX=%d | VX=%d | FEX=%d | FX=%d]\n",
|
||||
FPSCR.FPSCR,
|
||||
FPSCR.RN,
|
||||
FPSCR.NI, FPSCR.XE, FPSCR.ZE, FPSCR.UE, FPSCR.OE, FPSCR.VE,
|
||||
FPSCR.VXCVI, FPSCR.VXSQRT, FPSCR.VXSOFT, FPSCR.FPRF,
|
||||
FPSCR.FI, FPSCR.FR, FPSCR.VXVC, FPSCR.VXIMZ,
|
||||
FPSCR.VXZDZ, FPSCR.VXIDI, FPSCR.VXISI, FPSCR.VXSNAN,
|
||||
FPSCR.XX, FPSCR.ZX, FPSCR.UX, FPSCR.OX, FPSCR.VX, FPSCR.FEX, FPSCR.FX);
|
||||
fmt::by_value(FPSCR.RN),
|
||||
fmt::by_value(FPSCR.NI), fmt::by_value(FPSCR.XE), fmt::by_value(FPSCR.ZE), fmt::by_value(FPSCR.UE), fmt::by_value(FPSCR.OE), fmt::by_value(FPSCR.VE),
|
||||
fmt::by_value(FPSCR.VXCVI), fmt::by_value(FPSCR.VXSQRT), fmt::by_value(FPSCR.VXSOFT), fmt::by_value(FPSCR.FPRF),
|
||||
fmt::by_value(FPSCR.FI), fmt::by_value(FPSCR.FR), fmt::by_value(FPSCR.VXVC), fmt::by_value(FPSCR.VXIMZ),
|
||||
fmt::by_value(FPSCR.VXZDZ), fmt::by_value(FPSCR.VXIDI), fmt::by_value(FPSCR.VXISI), fmt::by_value(FPSCR.VXSNAN),
|
||||
fmt::by_value(FPSCR.XX), fmt::by_value(FPSCR.ZX), fmt::by_value(FPSCR.UX), fmt::by_value(FPSCR.OX), fmt::by_value(FPSCR.VX), fmt::by_value(FPSCR.FEX), fmt::by_value(FPSCR.FX));
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
virtual wxString ReadRegString(wxString reg)
|
||||
virtual std::string ReadRegString(const std::string& reg)
|
||||
{
|
||||
if (reg.Contains("["))
|
||||
std::string::size_type first_brk = reg.find('[');
|
||||
if (first_brk != std::string::npos)
|
||||
{
|
||||
long reg_index;
|
||||
reg.AfterFirst('[').RemoveLast().ToLong(®_index);
|
||||
if (reg.StartsWith("GPR")) return wxString::Format("%016llx", GPR[reg_index]);
|
||||
if (reg.StartsWith("FPR")) return wxString::Format("%016llx", (double)FPR[reg_index]);
|
||||
if (reg.StartsWith("VPR")) return wxString::Format("%016llx%016llx", VPR[reg_index]._u64[1], VPR[reg_index]._u64[0]);
|
||||
long reg_index = atol(reg.substr(first_brk+1,reg.length()-first_brk-2).c_str());
|
||||
if (reg.find("GPR")==0) return fmt::Format("%016llx", GPR[reg_index]);
|
||||
if (reg.find("FPR")==0) return fmt::Format("%016llx", (double)FPR[reg_index]);
|
||||
if (reg.find("VPR")==0) return fmt::Format("%016llx%016llx", VPR[reg_index]._u64[1], VPR[reg_index]._u64[0]);
|
||||
}
|
||||
if (reg == "CR") return wxString::Format("%08x", CR.CR);
|
||||
if (reg == "LR") return wxString::Format("%016llx", LR);
|
||||
if (reg == "CTR") return wxString::Format("%016llx", CTR);
|
||||
if (reg == "XER") return wxString::Format("%016llx", XER.XER);
|
||||
if (reg == "FPSCR") return wxString::Format("%08x", FPSCR.FPSCR);
|
||||
if (reg == "CR") return fmt::Format("%08x", CR.CR);
|
||||
if (reg == "LR") return fmt::Format("%016llx", LR);
|
||||
if (reg == "CTR") return fmt::Format("%016llx", CTR);
|
||||
if (reg == "XER") return fmt::Format("%016llx", XER.XER);
|
||||
if (reg == "FPSCR") return fmt::Format("%08x", FPSCR.FPSCR);
|
||||
|
||||
return wxEmptyString;
|
||||
return "";
|
||||
}
|
||||
|
||||
bool WriteRegString(wxString reg, wxString value) {
|
||||
while (value.Len() < 32) value = "0"+value;
|
||||
if (reg.Contains("["))
|
||||
bool WriteRegString(const std::string& reg, std::string value) {
|
||||
while (value.length() < 32) value = "0"+value;
|
||||
std::string::size_type first_brk = reg.find('[');
|
||||
try
|
||||
{
|
||||
long reg_index;
|
||||
reg.AfterFirst('[').RemoveLast().ToLong(®_index);
|
||||
if (reg.StartsWith("GPR") || (reg.StartsWith("FPR")))
|
||||
if (first_brk != std::string::npos)
|
||||
{
|
||||
long reg_index = atol(reg.substr(first_brk + 1, reg.length() - first_brk - 2).c_str());
|
||||
if (reg.find("GPR")==0 || reg.find("FPR")==0 )
|
||||
{
|
||||
unsigned long long reg_value;
|
||||
reg_value = std::stoull(value.substr(16, 31),0,16);
|
||||
if (reg.find("GPR")==0) GPR[reg_index] = (u64)reg_value;
|
||||
if (reg.find("FPR")==0) FPR[reg_index] = (u64)reg_value;
|
||||
return true;
|
||||
}
|
||||
if (reg.find("VPR")==0)
|
||||
{
|
||||
unsigned long long reg_value0;
|
||||
unsigned long long reg_value1;
|
||||
reg_value0 = std::stoull(value.substr(16, 31), 0, 16);
|
||||
reg_value1 = std::stoull(value.substr(0, 15), 0, 16);
|
||||
VPR[reg_index]._u64[0] = (u64)reg_value0;
|
||||
VPR[reg_index]._u64[1] = (u64)reg_value1;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (reg == "LR" || reg == "CTR" || reg == "XER")
|
||||
{
|
||||
unsigned long long reg_value;
|
||||
if (!value.SubString(16,31).ToULongLong(®_value, 16)) return false;
|
||||
if (reg.StartsWith("GPR")) GPR[reg_index] = (u64)reg_value;
|
||||
if (reg.StartsWith("FPR")) FPR[reg_index] = (u64)reg_value;
|
||||
reg_value = std::stoull(value.substr(16, 31), 0, 16);
|
||||
if (reg == "LR") LR = (u64)reg_value;
|
||||
if (reg == "CTR") CTR = (u64)reg_value;
|
||||
if (reg == "XER") XER.XER = (u64)reg_value;
|
||||
return true;
|
||||
}
|
||||
if (reg.StartsWith("VPR"))
|
||||
if (reg == "CR" || reg == "FPSCR")
|
||||
{
|
||||
unsigned long long reg_value0;
|
||||
unsigned long long reg_value1;
|
||||
if (!value.SubString(16,31).ToULongLong(®_value0, 16)) return false;
|
||||
if (!value.SubString(0,15).ToULongLong(®_value1, 16)) return false;
|
||||
VPR[reg_index]._u64[0] = (u64)reg_value0;
|
||||
VPR[reg_index]._u64[1] = (u64)reg_value1;
|
||||
unsigned long reg_value;
|
||||
reg_value = std::stoull(value.substr(24, 31), 0, 16);
|
||||
if (reg == "CR") CR.CR = (u32)reg_value;
|
||||
if (reg == "FPSCR") FPSCR.FPSCR = (u32)reg_value;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (reg == "LR" || reg == "CTR" || reg == "XER")
|
||||
catch (std::invalid_argument& e)//if any of the stoull conversion fail
|
||||
{
|
||||
unsigned long long reg_value;
|
||||
if (!value.SubString(16,31).ToULongLong(®_value, 16)) return false;
|
||||
if (reg == "LR") LR = (u64)reg_value;
|
||||
if (reg == "CTR") CTR = (u64)reg_value;
|
||||
if (reg == "XER") XER.XER = (u64)reg_value;
|
||||
return true;
|
||||
}
|
||||
if (reg == "CR" || reg == "FPSCR")
|
||||
{
|
||||
unsigned long reg_value;
|
||||
if (!value.SubString(24,31).ToULong(®_value, 16)) return false;
|
||||
if (reg == "CR") CR.CR = (u32)reg_value;
|
||||
if (reg == "FPSCR") FPSCR.FPSCR = (u32)reg_value;
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual void AddArgv(const wxString& arg) override;
|
||||
virtual void AddArgv(const std::string& arg) override;
|
||||
|
||||
public:
|
||||
virtual void InitRegs();
|
||||
|
|
|
@ -251,7 +251,7 @@ u32 RawSPUThread::GetIndex() const
|
|||
|
||||
void RawSPUThread::Task()
|
||||
{
|
||||
if (Ini.HLELogging.GetValue()) ConLog.Write("%s enter", PPCThread::GetFName().wx_str());
|
||||
if (Ini.HLELogging.GetValue()) ConLog.Write("%s enter", PPCThread::GetFName().c_str());
|
||||
|
||||
const Array<u64>& bp = Emu.GetBreakPoints();
|
||||
|
||||
|
@ -325,14 +325,14 @@ void RawSPUThread::Task()
|
|||
}
|
||||
}
|
||||
}
|
||||
catch(const wxString& e)
|
||||
catch(const std::string& e)
|
||||
{
|
||||
ConLog.Error("Exception: %s", e.wx_str());
|
||||
ConLog.Error("Exception: %s", e.c_str());
|
||||
}
|
||||
catch(const char* e)
|
||||
{
|
||||
ConLog.Error("Exception: %s", wxString(e).wx_str());
|
||||
ConLog.Error("Exception: %s", e);
|
||||
}
|
||||
|
||||
if (Ini.HLELogging.GetValue()) ConLog.Write("%s leave", PPCThread::GetFName().wx_str());
|
||||
if (Ini.HLELogging.GetValue()) ConLog.Write("%s leave", PPCThread::GetFName().c_str());
|
||||
}
|
||||
|
|
|
@ -26,54 +26,54 @@ private:
|
|||
}
|
||||
|
||||
private:
|
||||
wxString& FixOp(wxString& op)
|
||||
std::string& FixOp(std::string& op)
|
||||
{
|
||||
op.Append(' ', max<int>(10 - (int)op.Len(), 0));
|
||||
op.append(max<int>(10 - (int)op.length(), 0),' ');
|
||||
return op;
|
||||
}
|
||||
void DisAsm(const char* op)
|
||||
{
|
||||
Write(op);
|
||||
}
|
||||
void DisAsm(wxString op, u32 a1)
|
||||
void DisAsm(std::string op, u32 a1)
|
||||
{
|
||||
Write(wxString::Format("%s 0x%x", FixOp(op).wx_str(), a1));
|
||||
Write(fmt::Format("%s 0x%x", FixOp(op).c_str(), a1));
|
||||
}
|
||||
void DisAsm(wxString op, const char* a1)
|
||||
void DisAsm(std::string op, const char* a1)
|
||||
{
|
||||
Write(wxString::Format("%s %s", FixOp(op).wx_str(), wxString(a1).wx_str()));
|
||||
Write(fmt::Format("%s %s", FixOp(op).c_str(), a1));
|
||||
}
|
||||
void DisAsm(wxString op, const char* a1, const char* a2)
|
||||
void DisAsm(std::string op, const char* a1, const char* a2)
|
||||
{
|
||||
Write(wxString::Format("%s %s,%s", FixOp(op).wx_str(), wxString(a1).wx_str(), wxString(a2).wx_str()));
|
||||
Write(fmt::Format("%s %s,%s", FixOp(op).c_str(), a1, a2));
|
||||
}
|
||||
void DisAsm(wxString op, int a1, const char* a2)
|
||||
void DisAsm(std::string op, int a1, const char* a2)
|
||||
{
|
||||
Write(wxString::Format("%s 0x%x,%s", FixOp(op).wx_str(), a1, wxString(a2).wx_str()));
|
||||
Write(fmt::Format("%s 0x%x,%s", FixOp(op).c_str(), a1, a2));
|
||||
}
|
||||
void DisAsm(wxString op, const char* a1, int a2)
|
||||
void DisAsm(std::string op, const char* a1, int a2)
|
||||
{
|
||||
Write(wxString::Format("%s %s,0x%x", FixOp(op).wx_str(), wxString(a1).wx_str(), a2));
|
||||
Write(fmt::Format("%s %s,0x%x", FixOp(op).c_str(), a1, a2));
|
||||
}
|
||||
void DisAsm(wxString op, int a1, int a2)
|
||||
void DisAsm(std::string op, int a1, int a2)
|
||||
{
|
||||
Write(wxString::Format("%s 0x%x,0x%x", FixOp(op).wx_str(), a1, a2));
|
||||
Write(fmt::Format("%s 0x%x,0x%x", FixOp(op).c_str(), a1, a2));
|
||||
}
|
||||
void DisAsm(wxString op, const char* a1, const char* a2, const char* a3)
|
||||
void DisAsm(std::string op, const char* a1, const char* a2, const char* a3)
|
||||
{
|
||||
Write(wxString::Format("%s %s,%s,%s", FixOp(op).wx_str(), wxString(a1).wx_str(), wxString(a2).wx_str(), wxString(a3).wx_str()));
|
||||
Write(fmt::Format("%s %s,%s,%s", FixOp(op).c_str(), a1, a2, a3));
|
||||
}
|
||||
void DisAsm(wxString op, const char* a1, int a2, const char* a3)
|
||||
void DisAsm(std::string op, const char* a1, int a2, const char* a3)
|
||||
{
|
||||
Write(wxString::Format("%s %s,0x%x(%s)", FixOp(op).wx_str(), wxString(a1).wx_str(), a2, wxString(a3).wx_str()));
|
||||
Write(fmt::Format("%s %s,0x%x(%s)", FixOp(op).c_str(), a1, a2, a3));
|
||||
}
|
||||
void DisAsm(wxString op, const char* a1, const char* a2, int a3)
|
||||
void DisAsm(std::string op, const char* a1, const char* a2, int a3)
|
||||
{
|
||||
Write(wxString::Format("%s %s,%s,0x%x", FixOp(op).wx_str(), wxString(a1).wx_str(), wxString(a2).wx_str(), a3));
|
||||
Write(fmt::Format("%s %s,%s,0x%x", FixOp(op).c_str(), a1, a2, a3));
|
||||
}
|
||||
void DisAsm(wxString op, const char* a1, const char* a2, const char* a3, const char* a4)
|
||||
void DisAsm(std::string op, const char* a1, const char* a2, const char* a3, const char* a4)
|
||||
{
|
||||
Write(wxString::Format("%s %s,%s,%s,%s", FixOp(op).wx_str(), wxString(a1).wx_str(), wxString(a2).wx_str(), wxString(a3).wx_str(), wxString(a4).wx_str()));
|
||||
Write(fmt::Format("%s %s,%s,%s,%s", FixOp(op).c_str(), a1, a2, a3, a4));
|
||||
}
|
||||
//0 - 10
|
||||
void STOP(u32 code)
|
||||
|
@ -885,6 +885,6 @@ private:
|
|||
|
||||
void UNK(u32 code, u32 opcode, u32 gcode)
|
||||
{
|
||||
Write(wxString::Format("Unknown/Illegal opcode! (0x%08x, 0x%x, 0x%x)", code, opcode, gcode));
|
||||
Write(fmt::Format("Unknown/Illegal opcode! (0x%08x, 0x%x, 0x%x)", code, opcode, gcode));
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1521,13 +1521,13 @@ private:
|
|||
|
||||
void UNK(u32 code, u32 opcode, u32 gcode)
|
||||
{
|
||||
UNK(wxString::Format("Unknown/Illegal opcode! (0x%08x, 0x%x, 0x%x)", code, opcode, gcode));
|
||||
UNK(fmt::Format("Unknown/Illegal opcode! (0x%08x, 0x%x, 0x%x)", code, opcode, gcode));
|
||||
}
|
||||
|
||||
void UNK(const wxString& err)
|
||||
void UNK(const std::string& err)
|
||||
{
|
||||
ConLog.Error(err + wxString::Format(" #pc: 0x%x", CPU.PC));
|
||||
ConLog.Error(err + fmt::Format(" #pc: 0x%x", CPU.PC));
|
||||
Emu.Pause();
|
||||
for(uint i=0; i<128; ++i) ConLog.Write("r%d = 0x%s", i, CPU.GPR[i].ToString().wx_str());
|
||||
for(uint i=0; i<128; ++i) ConLog.Write("r%d = 0x%s", i, CPU.GPR[i].ToString().c_str());
|
||||
}
|
||||
};
|
||||
|
|
|
@ -10,7 +10,7 @@ SPUThread& GetCurrentSPUThread()
|
|||
|
||||
if(!thread || (thread->GetType() != CPU_THREAD_SPU && thread->GetType() != CPU_THREAD_RAW_SPU))
|
||||
{
|
||||
throw wxString("GetCurrentSPUThread: bad thread");
|
||||
throw std::string("GetCurrentSPUThread: bad thread");
|
||||
}
|
||||
|
||||
return *(SPUThread*)thread;
|
||||
|
|
|
@ -138,9 +138,9 @@ public:
|
|||
|
||||
FPSCR() {}
|
||||
|
||||
wxString ToString() const
|
||||
std::string ToString() const
|
||||
{
|
||||
return "FPSCR writer not yet implemented"; //wxString::Format("%08x%08x%08x%08x", _u32[3], _u32[2], _u32[1], _u32[0]);
|
||||
return "FPSCR writer not yet implemented"; //fmt::Format("%08x%08x%08x%08x", _u32[3], _u32[2], _u32[1], _u32[0]);
|
||||
}
|
||||
|
||||
void Reset()
|
||||
|
@ -230,9 +230,9 @@ union SPU_GPR_hdr
|
|||
|
||||
SPU_GPR_hdr() {}
|
||||
|
||||
wxString ToString() const
|
||||
std::string ToString() const
|
||||
{
|
||||
return wxString::Format("%08x%08x%08x%08x", _u32[3], _u32[2], _u32[1], _u32[0]);
|
||||
return fmt::Format("%08x%08x%08x%08x", _u32[3], _u32[2], _u32[1], _u32[0]);
|
||||
}
|
||||
|
||||
void Reset()
|
||||
|
@ -249,9 +249,9 @@ union SPU_SPR_hdr
|
|||
|
||||
SPU_SPR_hdr() {}
|
||||
|
||||
wxString ToString() const
|
||||
std::string ToString() const
|
||||
{
|
||||
return wxString::Format("%08x%08x%08x%08x", _u32[3], _u32[2], _u32[1], _u32[0]);
|
||||
return fmt::Format("%08x%08x%08x%08x", _u32[3], _u32[2], _u32[1], _u32[0]);
|
||||
}
|
||||
|
||||
void Reset()
|
||||
|
@ -266,9 +266,9 @@ union SPU_SNRConfig_hdr
|
|||
|
||||
SPU_SNRConfig_hdr() {}
|
||||
|
||||
wxString ToString() const
|
||||
std::string ToString() const
|
||||
{
|
||||
return wxString::Format("%01x", value);
|
||||
return fmt::Format("%01x", value);
|
||||
}
|
||||
|
||||
void Reset()
|
||||
|
@ -699,10 +699,10 @@ public:
|
|||
case MFC_GET_CMD:
|
||||
{
|
||||
if (Ini.HLELogging.GetValue()) ConLog.Write("DMA %s%s%s%s: lsa = 0x%x, ea = 0x%llx, tag = 0x%x, size = 0x%x, cmd = 0x%x",
|
||||
wxString(op & MFC_PUT_CMD ? "PUT" : "GET").wx_str(),
|
||||
wxString(op & MFC_RESULT_MASK ? "R" : "").wx_str(),
|
||||
wxString(op & MFC_BARRIER_MASK ? "B" : "").wx_str(),
|
||||
wxString(op & MFC_FENCE_MASK ? "F" : "").wx_str(),
|
||||
(op & MFC_PUT_CMD ? "PUT" : "GET"),
|
||||
(op & MFC_RESULT_MASK ? "R" : ""),
|
||||
(op & MFC_BARRIER_MASK ? "B" : ""),
|
||||
(op & MFC_FENCE_MASK ? "F" : ""),
|
||||
lsa, ea, tag, size, cmd);
|
||||
|
||||
MFCArgs.CMDStatus.SetValue(dmacCmd(cmd, tag, lsa, ea, size));
|
||||
|
@ -714,10 +714,10 @@ public:
|
|||
case MFC_GETL_CMD:
|
||||
{
|
||||
if (Ini.HLELogging.GetValue()) ConLog.Write("DMA %s%s%s%s: lsa = 0x%x, list = 0x%llx, tag = 0x%x, size = 0x%x, cmd = 0x%x",
|
||||
wxString(op & MFC_PUT_CMD ? "PUT" : "GET").wx_str(),
|
||||
wxString(op & MFC_RESULT_MASK ? "RL" : "L").wx_str(),
|
||||
wxString(op & MFC_BARRIER_MASK ? "B" : "").wx_str(),
|
||||
wxString(op & MFC_FENCE_MASK ? "F" : "").wx_str(),
|
||||
(op & MFC_PUT_CMD ? "PUT" : "GET"),
|
||||
(op & MFC_RESULT_MASK ? "RL" : "L"),
|
||||
(op & MFC_BARRIER_MASK ? "B" : ""),
|
||||
(op & MFC_FENCE_MASK ? "F" : ""),
|
||||
lsa, ea, tag, size, cmd);
|
||||
|
||||
ListCmd(lsa, ea, tag, size, cmd, MFCArgs);
|
||||
|
@ -730,9 +730,9 @@ public:
|
|||
case MFC_PUTQLLUC_CMD:
|
||||
{
|
||||
if (Ini.HLELogging.GetValue() || size != 128) ConLog.Write("DMA %s: lsa=0x%x, ea = 0x%llx, (tag) = 0x%x, (size) = 0x%x, cmd = 0x%x",
|
||||
wxString(op == MFC_GETLLAR_CMD ? "GETLLAR" :
|
||||
(op == MFC_GETLLAR_CMD ? "GETLLAR" :
|
||||
op == MFC_PUTLLC_CMD ? "PUTLLC" :
|
||||
op == MFC_PUTLLUC_CMD ? "PUTLLUC" : "PUTQLLUC").wx_str(),
|
||||
op == MFC_PUTLLUC_CMD ? "PUTLLUC" : "PUTQLLUC"),
|
||||
lsa, ea, tag, size, cmd);
|
||||
|
||||
if (op == MFC_GETLLAR_CMD) // get reservation
|
||||
|
@ -863,11 +863,11 @@ public:
|
|||
|
||||
case SPU_RdInMbox:
|
||||
count = SPU.In_MBox.GetCount();
|
||||
//ConLog.Warning("GetChannelCount(%s) -> %d", wxString(spu_ch_name[ch]).wx_str(), count);
|
||||
//ConLog.Warning("GetChannelCount(%s) -> %d", spu_ch_name[ch], count);
|
||||
return count;
|
||||
|
||||
case SPU_WrOutIntrMbox:
|
||||
ConLog.Warning("GetChannelCount(%s) = 0", wxString(spu_ch_name[ch]).wx_str());
|
||||
ConLog.Warning("GetChannelCount(%s) = 0", spu_ch_name[ch]);
|
||||
return 0;
|
||||
|
||||
case MFC_RdTagStat:
|
||||
|
@ -890,7 +890,7 @@ public:
|
|||
|
||||
default:
|
||||
ConLog.Error("%s error: unknown/illegal channel (%d [%s]).",
|
||||
wxString(__FUNCTION__).wx_str(), ch, wxString(spu_ch_name[ch]).wx_str());
|
||||
__FUNCTION__, ch, spu_ch_name[ch]);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1017,17 +1017,17 @@ public:
|
|||
break;
|
||||
|
||||
case SPU_WrOutMbox:
|
||||
//ConLog.Warning("%s: %s = 0x%x", wxString(__FUNCTION__).wx_str(), wxString(spu_ch_name[ch]).wx_str(), v);
|
||||
//ConLog.Warning("%s: %s = 0x%x", __FUNCTION__, spu_ch_name[ch], v);
|
||||
while (!SPU.Out_MBox.Push(v) && !Emu.IsStopped()) Sleep(1);
|
||||
break;
|
||||
|
||||
case MFC_WrTagMask:
|
||||
//ConLog.Warning("%s: %s = 0x%x", wxString(__FUNCTION__).wx_str(), wxString(spu_ch_name[ch]).wx_str(), v);
|
||||
//ConLog.Warning("%s: %s = 0x%x", __FUNCTION__, spu_ch_name[ch], v);
|
||||
Prxy.QueryMask.SetValue(v);
|
||||
break;
|
||||
|
||||
case MFC_WrTagUpdate:
|
||||
//ConLog.Warning("%s: %s = 0x%x", wxString(__FUNCTION__).wx_str(), wxString(spu_ch_name[ch]).wx_str(), v);
|
||||
//ConLog.Warning("%s: %s = 0x%x", __FUNCTION__, spu_ch_name[ch], v);
|
||||
Prxy.TagStatus.PushUncond(Prxy.QueryMask.GetValue());
|
||||
break;
|
||||
|
||||
|
@ -1075,11 +1075,11 @@ public:
|
|||
break;
|
||||
|
||||
default:
|
||||
ConLog.Error("%s error: unknown/illegal channel (%d [%s]).", wxString(__FUNCTION__).wx_str(), ch, wxString(spu_ch_name[ch]).wx_str());
|
||||
ConLog.Error("%s error: unknown/illegal channel (%d [%s]).", __FUNCTION__, ch, spu_ch_name[ch]);
|
||||
break;
|
||||
}
|
||||
|
||||
if (Emu.IsStopped()) ConLog.Warning("%s(%s) aborted", wxString(__FUNCTION__).wx_str(), wxString(spu_ch_name[ch]).wx_str());
|
||||
if (Emu.IsStopped()) ConLog.Warning("%s(%s) aborted", __FUNCTION__, spu_ch_name[ch]);
|
||||
}
|
||||
|
||||
void ReadChannel(SPU_GPR_hdr& r, u32 ch)
|
||||
|
@ -1091,22 +1091,22 @@ public:
|
|||
{
|
||||
case SPU_RdInMbox:
|
||||
while (!SPU.In_MBox.Pop(v) && !Emu.IsStopped()) Sleep(1);
|
||||
//ConLog.Warning("%s: 0x%x = %s", wxString(__FUNCTION__).wx_str(), v, wxString(spu_ch_name[ch]).wx_str());
|
||||
//ConLog.Warning("%s: 0x%x = %s", __FUNCTION__, v, spu_ch_name[ch]);
|
||||
break;
|
||||
|
||||
case MFC_RdTagStat:
|
||||
while (!Prxy.TagStatus.Pop(v) && !Emu.IsStopped()) Sleep(1);
|
||||
//ConLog.Warning("%s: 0x%x = %s", wxString(__FUNCTION__).wx_str(), v, wxString(spu_ch_name[ch]).wx_str());
|
||||
//ConLog.Warning("%s: 0x%x = %s", __FUNCTION__, v, spu_ch_name[ch]);
|
||||
break;
|
||||
|
||||
case SPU_RdSigNotify1:
|
||||
while (!SPU.SNR[0].Pop(v) && !Emu.IsStopped()) Sleep(1);
|
||||
//ConLog.Warning("%s: 0x%x = %s", wxString(__FUNCTION__).wx_str(), v, wxString(spu_ch_name[ch]).wx_str());
|
||||
//ConLog.Warning("%s: 0x%x = %s", __FUNCTION__, v, spu_ch_name[ch]);
|
||||
break;
|
||||
|
||||
case SPU_RdSigNotify2:
|
||||
while (!SPU.SNR[1].Pop(v) && !Emu.IsStopped()) Sleep(1);
|
||||
//ConLog.Warning("%s: 0x%x = %s", wxString(__FUNCTION__).wx_str(), v, wxString(spu_ch_name[ch]).wx_str());
|
||||
//ConLog.Warning("%s: 0x%x = %s", __FUNCTION__, v, spu_ch_name[ch]);
|
||||
break;
|
||||
|
||||
case MFC_RdAtomicStat:
|
||||
|
@ -1118,11 +1118,11 @@ public:
|
|||
break;
|
||||
|
||||
default:
|
||||
ConLog.Error("%s error: unknown/illegal channel (%d [%s]).", wxString(__FUNCTION__).wx_str(), ch, wxString(spu_ch_name[ch]).wx_str());
|
||||
ConLog.Error("%s error: unknown/illegal channel (%d [%s]).", __FUNCTION__, ch, spu_ch_name[ch]);
|
||||
break;
|
||||
}
|
||||
|
||||
if (Emu.IsStopped()) ConLog.Warning("%s(%s) aborted", wxString(__FUNCTION__).wx_str(), wxString(spu_ch_name[ch]).wx_str());
|
||||
if (Emu.IsStopped()) ConLog.Warning("%s(%s) aborted", __FUNCTION__, spu_ch_name[ch]);
|
||||
}
|
||||
|
||||
bool IsGoodLSA(const u32 lsa) const { return Memory.IsGoodAddr(lsa + m_offset) && lsa < 0x40000; }
|
||||
|
@ -1142,39 +1142,48 @@ public:
|
|||
SPUThread(CPUThreadType type = CPU_THREAD_SPU);
|
||||
virtual ~SPUThread();
|
||||
|
||||
virtual wxString RegsToString()
|
||||
virtual std::string RegsToString()
|
||||
{
|
||||
wxString ret = "Registers:\n=========\n";
|
||||
std::string ret = "Registers:\n=========\n";
|
||||
|
||||
for(uint i=0; i<128; ++i) ret += wxString::Format("GPR[%d] = 0x%s\n", i, GPR[i].ToString().wx_str());
|
||||
for(uint i=0; i<128; ++i) ret += fmt::Format("GPR[%d] = 0x%s\n", i, GPR[i].ToString().c_str());
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
virtual wxString ReadRegString(wxString reg)
|
||||
virtual std::string ReadRegString(const std::string& reg)
|
||||
{
|
||||
if (reg.Contains("["))
|
||||
std::string::size_type first_brk = reg.find('[');
|
||||
if (first_brk != std::string::npos)
|
||||
{
|
||||
long reg_index;
|
||||
reg.AfterFirst('[').RemoveLast().ToLong(®_index);
|
||||
if (reg.StartsWith("GPR")) return wxString::Format("%016llx%016llx", GPR[reg_index]._u64[1], GPR[reg_index]._u64[0]);
|
||||
reg_index = atol(reg.substr(first_brk + 1, reg.length()-2).c_str());
|
||||
if (reg.find("GPR")==0) return fmt::Format("%016llx%016llx", GPR[reg_index]._u64[1], GPR[reg_index]._u64[0]);
|
||||
}
|
||||
return wxEmptyString;
|
||||
return "";
|
||||
}
|
||||
|
||||
bool WriteRegString(wxString reg, wxString value)
|
||||
bool WriteRegString(const std::string& reg, std::string value)
|
||||
{
|
||||
while (value.Len() < 32) value = "0"+value;
|
||||
if (reg.Contains("["))
|
||||
while (value.length() < 32) value = "0"+value;
|
||||
std::string::size_type first_brk = reg.find('[');
|
||||
if (first_brk != std::string::npos)
|
||||
{
|
||||
long reg_index;
|
||||
reg.AfterFirst('[').RemoveLast().ToLong(®_index);
|
||||
if (reg.StartsWith("GPR"))
|
||||
reg_index = atol(reg.substr(first_brk + 1, reg.length() - 2).c_str());
|
||||
if (reg.find("GPR")==0)
|
||||
{
|
||||
unsigned long long reg_value0;
|
||||
unsigned long long reg_value1;
|
||||
if (!value.SubString(16,31).ToULongLong(®_value0, 16)) return false;
|
||||
if (!value.SubString(0,15).ToULongLong(®_value1, 16)) return false;
|
||||
try
|
||||
{
|
||||
reg_value0 = std::stoull(value.substr(16, 31), 0, 16);
|
||||
reg_value1 = std::stoull(value.substr(0, 15), 0, 16);
|
||||
}
|
||||
catch (std::invalid_argument& e)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
GPR[reg_index]._u64[0] = (u64)reg_value0;
|
||||
GPR[reg_index]._u64[1] = (u64)reg_value1;
|
||||
return true;
|
||||
|
|
|
@ -6,7 +6,7 @@ BEGIN_EVENT_TABLE(DbgConsole, FrameBase)
|
|||
END_EVENT_TABLE()
|
||||
|
||||
DbgConsole::DbgConsole()
|
||||
: FrameBase(nullptr, wxID_ANY, "DbgConsole", wxEmptyString, wxDefaultSize, wxDefaultPosition, wxDEFAULT_FRAME_STYLE, true)
|
||||
: FrameBase(nullptr, wxID_ANY, "DbgConsole", "", wxDefaultSize, wxDefaultPosition, wxDEFAULT_FRAME_STYLE, true)
|
||||
, ThreadBase("DbgConsole thread")
|
||||
, m_output(nullptr)
|
||||
{
|
||||
|
@ -28,7 +28,7 @@ DbgConsole::~DbgConsole()
|
|||
m_dbg_buffer.Flush();
|
||||
}
|
||||
|
||||
void DbgConsole::Write(int ch, const wxString& text)
|
||||
void DbgConsole::Write(int ch, const std::string& text)
|
||||
{
|
||||
while (m_dbg_buffer.IsBusy())
|
||||
{
|
||||
|
@ -65,10 +65,10 @@ void DbgConsole::Task()
|
|||
DbgPacket packet = m_dbg_buffer.Pop();
|
||||
m_console->SetDefaultStyle(packet.m_ch == 1 ? *m_color_red : *m_color_white);
|
||||
m_console->SetInsertionPointEnd();
|
||||
m_console->WriteText(packet.m_text);
|
||||
m_console->WriteText(fmt::FromUTF8(packet.m_text));
|
||||
|
||||
if (m_output && Ini.HLESaveTTY.GetValue())
|
||||
m_output->Write(packet.m_text);
|
||||
m_output->Write(fmt::FromUTF8(packet.m_text));
|
||||
|
||||
if(!DbgConsole::IsShown()) Show();
|
||||
}
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
struct DbgPacket
|
||||
{
|
||||
int m_ch;
|
||||
wxString m_text;
|
||||
std::string m_text;
|
||||
|
||||
DbgPacket(int ch, const wxString& text)
|
||||
DbgPacket(int ch, const std::string& text)
|
||||
: m_ch(ch)
|
||||
, m_text(text)
|
||||
{
|
||||
|
@ -17,7 +17,7 @@ struct DbgPacket
|
|||
|
||||
void Clear()
|
||||
{
|
||||
m_text.Clear();
|
||||
m_text.clear();
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -29,7 +29,7 @@ struct _DbgBuffer : public MTPacketBuffer<DbgPacket>
|
|||
|
||||
void _push(const DbgPacket& data)
|
||||
{
|
||||
const u32 stext = data.m_text.Len();
|
||||
const u32 stext = data.m_text.length();
|
||||
|
||||
m_buffer.Reserve(sizeof(int) + sizeof(u32) + stext);
|
||||
|
||||
|
@ -40,7 +40,7 @@ struct _DbgBuffer : public MTPacketBuffer<DbgPacket>
|
|||
|
||||
memcpy(&m_buffer[c_put], &stext, sizeof(u32));
|
||||
c_put += sizeof(u32);
|
||||
memcpy(&m_buffer[c_put], static_cast<const char *>(data.m_text), stext);
|
||||
memcpy(&m_buffer[c_put], data.m_text.data(), stext);
|
||||
c_put += stext;
|
||||
|
||||
m_put = c_put;
|
||||
|
@ -58,7 +58,7 @@ struct _DbgBuffer : public MTPacketBuffer<DbgPacket>
|
|||
|
||||
const u32& stext = *(u32*)&m_buffer[c_get];
|
||||
c_get += sizeof(u32);
|
||||
if (stext) ret.m_text = wxString(reinterpret_cast<const char*>(&m_buffer[c_get]), stext );
|
||||
if (stext) ret.m_text = std::string(reinterpret_cast<const char*>(&m_buffer[c_get]), stext );
|
||||
c_get += stext;
|
||||
|
||||
m_get = c_get;
|
||||
|
@ -81,7 +81,7 @@ class DbgConsole
|
|||
public:
|
||||
DbgConsole();
|
||||
~DbgConsole();
|
||||
void Write(int ch, const wxString& text);
|
||||
void Write(int ch, const std::string& text);
|
||||
void Clear();
|
||||
virtual void Task();
|
||||
|
||||
|
|
|
@ -8,13 +8,13 @@ int sort_devices(const void* _a, const void* _b)
|
|||
const vfsDevice& a = **(const vfsDevice**)_a;
|
||||
const vfsDevice& b = **(const vfsDevice**)_b;
|
||||
|
||||
if(a.GetPs3Path().Len() > b.GetPs3Path().Len()) return 1;
|
||||
if(a.GetPs3Path().Len() < b.GetPs3Path().Len()) return -1;
|
||||
if(a.GetPs3Path().length() > b.GetPs3Path().length()) return 1;
|
||||
if(a.GetPs3Path().length() < b.GetPs3Path().length()) return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void VFS::Mount(const wxString& ps3_path, const wxString& local_path, vfsDevice* device)
|
||||
void VFS::Mount(const std::string& ps3_path, const std::string& local_path, vfsDevice* device)
|
||||
{
|
||||
UnMount(ps3_path);
|
||||
|
||||
|
@ -27,11 +27,11 @@ void VFS::Mount(const wxString& ps3_path, const wxString& local_path, vfsDevice*
|
|||
}
|
||||
}
|
||||
|
||||
void VFS::UnMount(const wxString& ps3_path)
|
||||
void VFS::UnMount(const std::string& ps3_path)
|
||||
{
|
||||
for(u32 i=0; i<m_devices.GetCount(); ++i)
|
||||
{
|
||||
if(!m_devices[i].GetPs3Path().Cmp(ps3_path))
|
||||
if(!m_devices[i].GetPs3Path().compare(ps3_path))
|
||||
{
|
||||
delete &m_devices[i];
|
||||
m_devices.RemoveFAt(i);
|
||||
|
@ -50,9 +50,9 @@ void VFS::UnMountAll()
|
|||
}
|
||||
}
|
||||
|
||||
vfsFileBase* VFS::OpenFile(const wxString& ps3_path, vfsOpenMode mode) const
|
||||
vfsFileBase* VFS::OpenFile(const std::string& ps3_path, vfsOpenMode mode) const
|
||||
{
|
||||
wxString path;
|
||||
std::string path;
|
||||
if(vfsDevice* dev = GetDevice(ps3_path, path))
|
||||
{
|
||||
if(vfsFileBase* res = dev->GetNewFileStream())
|
||||
|
@ -65,9 +65,9 @@ vfsFileBase* VFS::OpenFile(const wxString& ps3_path, vfsOpenMode mode) const
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
vfsDirBase* VFS::OpenDir(const wxString& ps3_path) const
|
||||
vfsDirBase* VFS::OpenDir(const std::string& ps3_path) const
|
||||
{
|
||||
wxString path;
|
||||
std::string path;
|
||||
|
||||
if(vfsDevice* dev = GetDevice(ps3_path, path))
|
||||
{
|
||||
|
@ -81,9 +81,9 @@ vfsDirBase* VFS::OpenDir(const wxString& ps3_path) const
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
bool VFS::CreateFile(const wxString& ps3_path) const
|
||||
bool VFS::CreateFile(const std::string& ps3_path) const
|
||||
{
|
||||
wxString path;
|
||||
std::string path;
|
||||
if(vfsDevice* dev = GetDevice(ps3_path, path))
|
||||
{
|
||||
std::shared_ptr<vfsFileBase> res(dev->GetNewFileStream());
|
||||
|
@ -97,9 +97,9 @@ bool VFS::CreateFile(const wxString& ps3_path) const
|
|||
return false;
|
||||
}
|
||||
|
||||
bool VFS::CreateDir(const wxString& ps3_path) const
|
||||
bool VFS::CreateDir(const std::string& ps3_path) const
|
||||
{
|
||||
wxString path;
|
||||
std::string path;
|
||||
if(vfsDevice* dev = GetDevice(ps3_path, path))
|
||||
{
|
||||
std::shared_ptr<vfsDirBase> res(dev->GetNewDirStream());
|
||||
|
@ -113,9 +113,9 @@ bool VFS::CreateDir(const wxString& ps3_path) const
|
|||
return false;
|
||||
}
|
||||
|
||||
bool VFS::RemoveFile(const wxString& ps3_path) const
|
||||
bool VFS::RemoveFile(const std::string& ps3_path) const
|
||||
{
|
||||
wxString path;
|
||||
std::string path;
|
||||
if(vfsDevice* dev = GetDevice(ps3_path, path))
|
||||
{
|
||||
std::shared_ptr<vfsFileBase> res(dev->GetNewFileStream());
|
||||
|
@ -129,9 +129,9 @@ bool VFS::RemoveFile(const wxString& ps3_path) const
|
|||
return false;
|
||||
}
|
||||
|
||||
bool VFS::RemoveDir(const wxString& ps3_path) const
|
||||
bool VFS::RemoveDir(const std::string& ps3_path) const
|
||||
{
|
||||
wxString path;
|
||||
std::string path;
|
||||
if(vfsDevice* dev = GetDevice(ps3_path, path))
|
||||
{
|
||||
std::shared_ptr<vfsDirBase> res(dev->GetNewDirStream());
|
||||
|
@ -145,9 +145,9 @@ bool VFS::RemoveDir(const wxString& ps3_path) const
|
|||
return false;
|
||||
}
|
||||
|
||||
bool VFS::ExistsFile(const wxString& ps3_path) const
|
||||
bool VFS::ExistsFile(const std::string& ps3_path) const
|
||||
{
|
||||
wxString path;
|
||||
std::string path;
|
||||
if(vfsDevice* dev = GetDevice(ps3_path, path))
|
||||
{
|
||||
std::shared_ptr<vfsFileBase> res(dev->GetNewFileStream());
|
||||
|
@ -161,9 +161,9 @@ bool VFS::ExistsFile(const wxString& ps3_path) const
|
|||
return false;
|
||||
}
|
||||
|
||||
bool VFS::ExistsDir(const wxString& ps3_path) const
|
||||
bool VFS::ExistsDir(const std::string& ps3_path) const
|
||||
{
|
||||
wxString path;
|
||||
std::string path;
|
||||
if(vfsDevice* dev = GetDevice(ps3_path, path))
|
||||
{
|
||||
std::shared_ptr<vfsDirBase> res(dev->GetNewDirStream());
|
||||
|
@ -177,9 +177,9 @@ bool VFS::ExistsDir(const wxString& ps3_path) const
|
|||
return false;
|
||||
}
|
||||
|
||||
bool VFS::RenameFile(const wxString& ps3_path_from, const wxString& ps3_path_to) const
|
||||
bool VFS::RenameFile(const std::string& ps3_path_from, const std::string& ps3_path_to) const
|
||||
{
|
||||
wxString path;
|
||||
std::string path;
|
||||
if(vfsDevice* dev = GetDevice(ps3_path_from, path))
|
||||
{
|
||||
std::shared_ptr<vfsFileBase> res(dev->GetNewFileStream());
|
||||
|
@ -193,9 +193,9 @@ bool VFS::RenameFile(const wxString& ps3_path_from, const wxString& ps3_path_to)
|
|||
return false;
|
||||
}
|
||||
|
||||
bool VFS::RenameDir(const wxString& ps3_path_from, const wxString& ps3_path_to) const
|
||||
bool VFS::RenameDir(const std::string& ps3_path_from, const std::string& ps3_path_to) const
|
||||
{
|
||||
wxString path;
|
||||
std::string path;
|
||||
if(vfsDevice* dev = GetDevice(ps3_path_from, path))
|
||||
{
|
||||
std::shared_ptr<vfsDirBase> res(dev->GetNewDirStream());
|
||||
|
@ -209,7 +209,7 @@ bool VFS::RenameDir(const wxString& ps3_path_from, const wxString& ps3_path_to)
|
|||
return false;
|
||||
}
|
||||
|
||||
vfsDevice* VFS::GetDevice(const wxString& ps3_path, wxString& path) const
|
||||
vfsDevice* VFS::GetDevice(const std::string& ps3_path, std::string& path) const
|
||||
{
|
||||
u32 max_eq;
|
||||
s32 max_i=-1;
|
||||
|
@ -226,18 +226,18 @@ vfsDevice* VFS::GetDevice(const wxString& ps3_path, wxString& path) const
|
|||
}
|
||||
|
||||
if(max_i < 0) return nullptr;
|
||||
path = vfsDevice::GetWinPath(m_devices[max_i].GetLocalPath(), ps3_path(max_eq, ps3_path.Len() - max_eq));
|
||||
path = vfsDevice::GetWinPath(m_devices[max_i].GetLocalPath(), ps3_path.substr(max_eq, ps3_path.length() - max_eq));
|
||||
return &m_devices[max_i];
|
||||
}
|
||||
|
||||
vfsDevice* VFS::GetDeviceLocal(const wxString& local_path, wxString& path) const
|
||||
vfsDevice* VFS::GetDeviceLocal(const std::string& local_path, std::string& path) const
|
||||
{
|
||||
u32 max_eq;
|
||||
s32 max_i=-1;
|
||||
|
||||
wxFileName file_path(local_path);
|
||||
wxFileName file_path(fmt::FromUTF8(local_path));
|
||||
file_path.Normalize();
|
||||
wxString mormalized_path = file_path.GetFullPath();
|
||||
std::string mormalized_path = fmt::ToUTF8(file_path.GetFullPath());
|
||||
|
||||
for(u32 i=0; i<m_devices.GetCount(); ++i)
|
||||
{
|
||||
|
@ -252,11 +252,11 @@ vfsDevice* VFS::GetDeviceLocal(const wxString& local_path, wxString& path) const
|
|||
|
||||
if(max_i < 0) return nullptr;
|
||||
|
||||
path = vfsDevice::GetPs3Path(m_devices[max_i].GetPs3Path(), local_path(max_eq, local_path.Len() - max_eq));
|
||||
path = vfsDevice::GetPs3Path(m_devices[max_i].GetPs3Path(), local_path.substr(max_eq, local_path.length() - max_eq));
|
||||
return &m_devices[max_i];
|
||||
}
|
||||
|
||||
void VFS::Init(const wxString& path)
|
||||
void VFS::Init(const std::string& path)
|
||||
{
|
||||
UnMountAll();
|
||||
|
||||
|
@ -283,8 +283,8 @@ void VFS::Init(const wxString& path)
|
|||
|
||||
wxString mpath = entry.path;
|
||||
mpath.Replace("$(EmulatorDir)", wxGetCwd());
|
||||
mpath.Replace("$(GameDir)", vfsDevice::GetRoot(path));
|
||||
Mount(entry.mount, mpath, dev);
|
||||
mpath.Replace("$(GameDir)", fmt::FromUTF8(vfsDevice::GetRoot(path)));
|
||||
Mount(entry.mount, fmt::ToUTF8(mpath), dev);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -323,22 +323,22 @@ void VFS::SaveLoadDevices(std::vector<VFSManagerEntry>& res, bool is_load)
|
|||
|
||||
for(int i=0; i<count; ++i)
|
||||
{
|
||||
IniEntry<wxString> entry_path;
|
||||
IniEntry<wxString> entry_device_path;
|
||||
IniEntry<wxString> entry_mount;
|
||||
IniEntry<std::string> entry_path;
|
||||
IniEntry<std::string> entry_device_path;
|
||||
IniEntry<std::string> entry_mount;
|
||||
IniEntry<int> entry_device;
|
||||
|
||||
entry_path.Init(wxString::Format("path[%d]", i), "VFSManager");
|
||||
entry_device_path.Init(wxString::Format("device_path[%d]", i), "VFSManager");
|
||||
entry_mount.Init(wxString::Format("mount[%d]", i), "VFSManager");
|
||||
entry_device.Init(wxString::Format("device[%d]", i), "VFSManager");
|
||||
entry_path.Init(fmt::Format("path[%d]", i), "VFSManager");
|
||||
entry_device_path.Init(fmt::Format("device_path[%d]", i), "VFSManager");
|
||||
entry_mount.Init(fmt::Format("mount[%d]", i), "VFSManager");
|
||||
entry_device.Init(fmt::Format("device[%d]", i), "VFSManager");
|
||||
|
||||
if(is_load)
|
||||
{
|
||||
res[i] = VFSManagerEntry();
|
||||
res[i].path = strdup(entry_path.LoadValue(wxEmptyString).c_str());
|
||||
res[i].device_path = strdup(entry_device_path.LoadValue(wxEmptyString).c_str());
|
||||
res[i].mount = strdup(entry_mount.LoadValue(wxEmptyString).c_str());
|
||||
res[i].path = entry_path.LoadValue("");
|
||||
res[i].device_path = entry_device_path.LoadValue("");
|
||||
res[i].mount = entry_mount.LoadValue("");
|
||||
res[i].device = (vfsDeviceType)entry_device.LoadValue(vfsDevice_LocalFile);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -17,9 +17,9 @@ static const char* vfsDeviceTypeNames[] =
|
|||
struct VFSManagerEntry
|
||||
{
|
||||
vfsDeviceType device;
|
||||
const char* device_path;
|
||||
const char* path;
|
||||
const char* mount;
|
||||
std::string device_path;
|
||||
std::string path;
|
||||
std::string mount;
|
||||
|
||||
VFSManagerEntry()
|
||||
: device(vfsDevice_LocalFile)
|
||||
|
@ -29,7 +29,7 @@ struct VFSManagerEntry
|
|||
{
|
||||
}
|
||||
|
||||
VFSManagerEntry(const vfsDeviceType& device, const char* path, const char* mount)
|
||||
VFSManagerEntry(const vfsDeviceType& device, const std::string& path, const std::string& mount)
|
||||
: device(device)
|
||||
, device_path("")
|
||||
, path(path)
|
||||
|
@ -42,24 +42,24 @@ struct VFSManagerEntry
|
|||
struct VFS
|
||||
{
|
||||
ArrayF<vfsDevice> m_devices;
|
||||
void Mount(const wxString& ps3_path, const wxString& local_path, vfsDevice* device);
|
||||
void UnMount(const wxString& ps3_path);
|
||||
void Mount(const std::string& ps3_path, const std::string& local_path, vfsDevice* device);
|
||||
void UnMount(const std::string& ps3_path);
|
||||
void UnMountAll();
|
||||
|
||||
vfsFileBase* OpenFile(const wxString& ps3_path, vfsOpenMode mode) const;
|
||||
vfsDirBase* OpenDir(const wxString& ps3_path) const;
|
||||
bool CreateFile(const wxString& ps3_path) const;
|
||||
bool CreateDir(const wxString& ps3_path) const;
|
||||
bool RemoveFile(const wxString& ps3_path) const;
|
||||
bool RemoveDir(const wxString& ps3_path) const;
|
||||
bool ExistsFile(const wxString& ps3_path) const;
|
||||
bool ExistsDir(const wxString& ps3_path) const;
|
||||
bool RenameFile(const wxString& ps3_path_from, const wxString& ps3_path_to) const;
|
||||
bool RenameDir(const wxString& ps3_path_from, const wxString& ps3_path_to) const;
|
||||
vfsFileBase* OpenFile(const std::string& ps3_path, vfsOpenMode mode) const;
|
||||
vfsDirBase* OpenDir(const std::string& ps3_path) const;
|
||||
bool CreateFile(const std::string& ps3_path) const;
|
||||
bool CreateDir(const std::string& ps3_path) const;
|
||||
bool RemoveFile(const std::string& ps3_path) const;
|
||||
bool RemoveDir(const std::string& ps3_path) const;
|
||||
bool ExistsFile(const std::string& ps3_path) const;
|
||||
bool ExistsDir(const std::string& ps3_path) const;
|
||||
bool RenameFile(const std::string& ps3_path_from, const std::string& ps3_path_to) const;
|
||||
bool RenameDir(const std::string& ps3_path_from, const std::string& ps3_path_to) const;
|
||||
|
||||
vfsDevice* GetDevice(const wxString& ps3_path, wxString& path) const;
|
||||
vfsDevice* GetDeviceLocal(const wxString& local_path, wxString& path) const;
|
||||
vfsDevice* GetDevice(const std::string& ps3_path, std::string& path) const;
|
||||
vfsDevice* GetDeviceLocal(const std::string& local_path, std::string& path) const;
|
||||
|
||||
void Init(const wxString& path);
|
||||
void Init(const std::string& path);
|
||||
void SaveLoadDevices(std::vector<VFSManagerEntry>& res, bool is_load);
|
||||
};
|
|
@ -1,31 +1,31 @@
|
|||
#include "stdafx.h"
|
||||
#include "vfsDevice.h"
|
||||
|
||||
vfsDevice::vfsDevice(const wxString& ps3_path, const wxString& local_path)
|
||||
vfsDevice::vfsDevice(const std::string& ps3_path, const std::string& local_path)
|
||||
: m_ps3_path(ps3_path)
|
||||
, m_local_path(GetWinPath(local_path))
|
||||
{
|
||||
}
|
||||
|
||||
wxString vfsDevice::GetLocalPath() const
|
||||
std::string vfsDevice::GetLocalPath() const
|
||||
{
|
||||
return m_local_path;
|
||||
}
|
||||
|
||||
wxString vfsDevice::GetPs3Path() const
|
||||
std::string vfsDevice::GetPs3Path() const
|
||||
{
|
||||
return m_ps3_path;
|
||||
}
|
||||
|
||||
void vfsDevice::SetPath(const wxString& ps3_path, const wxString& local_path)
|
||||
void vfsDevice::SetPath(const std::string& ps3_path, const std::string& local_path)
|
||||
{
|
||||
m_ps3_path = ps3_path;
|
||||
m_local_path = local_path;
|
||||
}
|
||||
|
||||
u32 vfsDevice::CmpPs3Path(const wxString& ps3_path)
|
||||
u32 vfsDevice::CmpPs3Path(const std::string& ps3_path)
|
||||
{
|
||||
const u32 lim = min(m_ps3_path.Len(), ps3_path.Len());
|
||||
const u32 lim = min(m_ps3_path.length(), ps3_path.length());
|
||||
u32 ret = 0;
|
||||
|
||||
for(u32 i=0; i<lim; ++i, ++ret)
|
||||
|
@ -40,12 +40,12 @@ u32 vfsDevice::CmpPs3Path(const wxString& ps3_path)
|
|||
return ret;
|
||||
}
|
||||
|
||||
u32 vfsDevice::CmpLocalPath(const wxString& local_path)
|
||||
u32 vfsDevice::CmpLocalPath(const std::string& local_path)
|
||||
{
|
||||
if(local_path.Len() < m_local_path.Len())
|
||||
if(local_path.length() < m_local_path.length())
|
||||
return 0;
|
||||
|
||||
wxFileName path0(m_local_path);
|
||||
wxFileName path0(fmt::FromUTF8(m_local_path));
|
||||
path0.Normalize();
|
||||
|
||||
#ifdef _WIN32
|
||||
|
@ -55,7 +55,7 @@ u32 vfsDevice::CmpLocalPath(const wxString& local_path)
|
|||
#endif
|
||||
|
||||
wxArrayString arr0 = wxSplit(path0.GetFullPath(), DL);
|
||||
wxArrayString arr1 = wxSplit(local_path, DL);
|
||||
wxArrayString arr1 = wxSplit(fmt::FromUTF8(local_path), DL);
|
||||
|
||||
const u32 lim = min(arr0.GetCount(), arr1.GetCount());
|
||||
u32 ret = 0;
|
||||
|
@ -71,14 +71,14 @@ u32 vfsDevice::CmpLocalPath(const wxString& local_path)
|
|||
return ret;
|
||||
}
|
||||
|
||||
wxString vfsDevice::ErasePath(const wxString& path, u32 start_dir_count, u32 end_dir_count)
|
||||
std::string vfsDevice::ErasePath(const std::string& path, u32 start_dir_count, u32 end_dir_count)
|
||||
{
|
||||
u32 from = 0;
|
||||
u32 to = path.Len() - 1;
|
||||
u32 to = path.length() - 1;
|
||||
|
||||
for(uint i = 0, dir = 0; i < path.Len(); ++i)
|
||||
for(uint i = 0, dir = 0; i < path.length(); ++i)
|
||||
{
|
||||
if(path[i] == '\\' || path[i] == '/' || i == path.Len() - 1)
|
||||
if(path[i] == '\\' || path[i] == '/' || i == path.length() - 1)
|
||||
{
|
||||
if(++dir == start_dir_count)
|
||||
{
|
||||
|
@ -88,7 +88,7 @@ wxString vfsDevice::ErasePath(const wxString& path, u32 start_dir_count, u32 end
|
|||
}
|
||||
}
|
||||
|
||||
for(int i = path.Len() - 1, dir = 0; i >= 0; --i)
|
||||
for(int i = path.length() - 1, dir = 0; i >= 0; --i)
|
||||
{
|
||||
if(path[i] == '\\' || path[i] == '/' || i == 0)
|
||||
{
|
||||
|
@ -100,17 +100,17 @@ wxString vfsDevice::ErasePath(const wxString& path, u32 start_dir_count, u32 end
|
|||
}
|
||||
}
|
||||
|
||||
return path(from, to - from);
|
||||
return path.substr(from, to - from);
|
||||
}
|
||||
|
||||
wxString vfsDevice::GetRoot(const wxString& path)
|
||||
std::string vfsDevice::GetRoot(const std::string& path)
|
||||
{
|
||||
//return wxFileName(path, wxPATH_UNIX).GetPath();
|
||||
if(path.IsEmpty()) return wxEmptyString;
|
||||
//return fmt::ToUTF8(wxFileName(fmt::FromUTF8(path), wxPATH_UNIX).GetPath());
|
||||
if(path.empty()) return "";
|
||||
|
||||
u32 first_dir = path.Len() - 1;
|
||||
u32 first_dir = path.length() - 1;
|
||||
|
||||
for(int i = path.Len() - 1, dir = 0, li = path.Len() - 1; i >= 0 && dir < 2; --i)
|
||||
for(int i = path.length() - 1, dir = 0, li = path.length() - 1; i >= 0 && dir < 2; --i)
|
||||
{
|
||||
if(path[i] == '\\' || path[i] == '/' || i == 0)
|
||||
{
|
||||
|
@ -121,7 +121,7 @@ wxString vfsDevice::GetRoot(const wxString& path)
|
|||
break;
|
||||
|
||||
case 1:
|
||||
if(!path(i + 1, li - i).Cmp("USRDIR")) return path(0, i + 1);
|
||||
if(!path.substr(i + 1, li - i).compare("USRDIR")) return path.substr(0, i + 1);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -129,46 +129,46 @@ wxString vfsDevice::GetRoot(const wxString& path)
|
|||
}
|
||||
}
|
||||
|
||||
return path(0, first_dir + 1);
|
||||
return path.substr(0, first_dir + 1);
|
||||
}
|
||||
|
||||
wxString vfsDevice::GetRootPs3(const wxString& path)
|
||||
std::string vfsDevice::GetRootPs3(const std::string& path)
|
||||
{
|
||||
if(path.IsEmpty()) return wxEmptyString;
|
||||
if(path.empty()) return "";
|
||||
|
||||
static const wxString& home = "/dev_hdd0/game/";
|
||||
static const std::string home = "/dev_hdd0/game/";
|
||||
u32 last_dir = 0;
|
||||
u32 first_dir = path.Len() - 1;
|
||||
u32 first_dir = path.length() - 1;
|
||||
|
||||
for(int i = path.Len() - 1, dir = 0; i >= 0; --i)
|
||||
for(int i = path.length() - 1, dir = 0; i >= 0; --i)
|
||||
{
|
||||
if(path[i] == '\\' || path[i] == '/' || i == 0)
|
||||
{
|
||||
switch(dir++)
|
||||
{
|
||||
case 1:
|
||||
if(!!path(i + 1, last_dir - i - 1).Cmp("USRDIR")) return wxEmptyString;
|
||||
if(path.substr(i + 1, last_dir - i - 1) == "USRDIR") return "";
|
||||
break;
|
||||
|
||||
case 2:
|
||||
return GetPs3Path(home + path(i + 1, last_dir - i - 1));
|
||||
return GetPs3Path(home + path.substr(i + 1, last_dir - i - 1));
|
||||
}
|
||||
|
||||
last_dir = i;
|
||||
}
|
||||
}
|
||||
|
||||
return GetPs3Path(home + path(0, last_dir - 1));
|
||||
return GetPs3Path(home + path.substr(0, last_dir - 1));
|
||||
}
|
||||
|
||||
wxString vfsDevice::GetWinPath(const wxString& p, bool is_dir)
|
||||
std::string vfsDevice::GetWinPath(const std::string& p, bool is_dir)
|
||||
{
|
||||
if(p.IsEmpty()) return wxEmptyString;
|
||||
if(p.empty()) return "";
|
||||
|
||||
wxString ret;
|
||||
std::string ret;
|
||||
bool is_ls = false;
|
||||
|
||||
for(u32 i=0; i<p.Len(); ++i)
|
||||
for(u32 i=0; i<p.length(); ++i)
|
||||
{
|
||||
if(p[i] == '/' || p[i] == '\\')
|
||||
{
|
||||
|
@ -185,29 +185,29 @@ wxString vfsDevice::GetWinPath(const wxString& p, bool is_dir)
|
|||
ret += p[i];
|
||||
}
|
||||
|
||||
if(is_dir && ret[ret.Len() - 1] != '/' && ret[ret.Len() - 1] != '\\') ret += '/'; // ???
|
||||
if(is_dir && ret[ret.length() - 1] != '/' && ret[ret.length() - 1] != '\\') ret += '/'; // ???
|
||||
|
||||
wxFileName res(ret);
|
||||
wxFileName res(fmt::FromUTF8(ret));
|
||||
res.Normalize();
|
||||
return res.GetFullPath();
|
||||
return fmt::ToUTF8(res.GetFullPath());
|
||||
}
|
||||
|
||||
wxString vfsDevice::GetWinPath(const wxString& l, const wxString& r)
|
||||
std::string vfsDevice::GetWinPath(const std::string& l, const std::string& r)
|
||||
{
|
||||
if(l.IsEmpty()) return GetWinPath(r, false);
|
||||
if(r.IsEmpty()) return GetWinPath(l);
|
||||
if(l.empty()) return GetWinPath(r, false);
|
||||
if(r.empty()) return GetWinPath(l);
|
||||
|
||||
return GetWinPath(l + '/' + r, false);
|
||||
}
|
||||
|
||||
wxString vfsDevice::GetPs3Path(const wxString& p, bool is_dir)
|
||||
std::string vfsDevice::GetPs3Path(const std::string& p, bool is_dir)
|
||||
{
|
||||
if(p.IsEmpty()) return wxEmptyString;
|
||||
if(p.empty()) return "";
|
||||
|
||||
wxString ret;
|
||||
std::string ret;
|
||||
bool is_ls = false;
|
||||
|
||||
for(u32 i=0; i<p.Len(); ++i)
|
||||
for(u32 i=0; i<p.length(); ++i)
|
||||
{
|
||||
if(p[i] == L'/' || p[i] == L'\\')
|
||||
{
|
||||
|
@ -225,15 +225,15 @@ wxString vfsDevice::GetPs3Path(const wxString& p, bool is_dir)
|
|||
}
|
||||
|
||||
if(ret[0] != '/') ret = '/' + ret;
|
||||
if(is_dir && ret[ret.Len() - 1] != '/') ret += '/';
|
||||
if(is_dir && ret[ret.length() - 1] != '/') ret += '/';
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
wxString vfsDevice::GetPs3Path(const wxString& l, const wxString& r)
|
||||
std::string vfsDevice::GetPs3Path(const std::string& l, const std::string& r)
|
||||
{
|
||||
if(l.IsEmpty()) return GetPs3Path(r, false);
|
||||
if(r.IsEmpty()) return GetPs3Path(l);
|
||||
if(l.empty()) return GetPs3Path(r, false);
|
||||
if(r.empty()) return GetPs3Path(l);
|
||||
|
||||
return GetPs3Path(l + '/' + r, false);
|
||||
}
|
||||
|
|
|
@ -4,32 +4,32 @@
|
|||
|
||||
class vfsDevice
|
||||
{
|
||||
wxString m_ps3_path;
|
||||
wxString m_local_path;
|
||||
std::string m_ps3_path;
|
||||
std::string m_local_path;
|
||||
mutable std::mutex m_mtx_lock;
|
||||
|
||||
public:
|
||||
vfsDevice(const wxString& ps3_path, const wxString& local_path);
|
||||
vfsDevice(const std::string& ps3_path, const std::string& local_path);
|
||||
vfsDevice() {}
|
||||
|
||||
virtual vfsFileBase* GetNewFileStream()=0;
|
||||
virtual vfsDirBase* GetNewDirStream()=0;
|
||||
|
||||
wxString GetLocalPath() const;
|
||||
wxString GetPs3Path() const;
|
||||
std::string GetLocalPath() const;
|
||||
std::string GetPs3Path() const;
|
||||
|
||||
void SetPath(const wxString& ps3_path, const wxString& local_path);
|
||||
void SetPath(const std::string& ps3_path, const std::string& local_path);
|
||||
|
||||
u32 CmpPs3Path(const wxString& ps3_path);
|
||||
u32 CmpLocalPath(const wxString& local_path);
|
||||
u32 CmpPs3Path(const std::string& ps3_path);
|
||||
u32 CmpLocalPath(const std::string& local_path);
|
||||
|
||||
static wxString ErasePath(const wxString& local_path, u32 start_dir_count, u32 end_dir_count);
|
||||
static wxString GetRoot(const wxString& local_path);
|
||||
static wxString GetRootPs3(const wxString& local_path);
|
||||
static wxString GetWinPath(const wxString& p, bool is_dir = true);
|
||||
static wxString GetWinPath(const wxString& l, const wxString& r);
|
||||
static wxString GetPs3Path(const wxString& p, bool is_dir = true);
|
||||
static wxString GetPs3Path(const wxString& l, const wxString& r);
|
||||
static std::string ErasePath(const std::string& local_path, u32 start_dir_count, u32 end_dir_count);
|
||||
static std::string GetRoot(const std::string& local_path);
|
||||
static std::string GetRootPs3(const std::string& local_path);
|
||||
static std::string GetWinPath(const std::string& p, bool is_dir = true);
|
||||
static std::string GetWinPath(const std::string& l, const std::string& r);
|
||||
static std::string GetPs3Path(const std::string& p, bool is_dir = true);
|
||||
static std::string GetPs3Path(const std::string& l, const std::string& r);
|
||||
|
||||
void Lock() const;
|
||||
void Unlock() const;
|
||||
|
|
|
@ -7,14 +7,14 @@ vfsDir::vfsDir()
|
|||
{
|
||||
}
|
||||
|
||||
vfsDir::vfsDir(const wxString path)
|
||||
vfsDir::vfsDir(const std::string& path)
|
||||
: vfsDirBase(nullptr)
|
||||
, m_stream(nullptr)
|
||||
{
|
||||
Open(path);
|
||||
}
|
||||
|
||||
bool vfsDir::Open(const wxString& path)
|
||||
bool vfsDir::Open(const std::string& path)
|
||||
{
|
||||
Close();
|
||||
|
||||
|
@ -23,12 +23,12 @@ bool vfsDir::Open(const wxString& path)
|
|||
return m_stream && m_stream->IsOpened();
|
||||
}
|
||||
|
||||
bool vfsDir::Create(const wxString& path)
|
||||
bool vfsDir::Create(const std::string& path)
|
||||
{
|
||||
return m_stream->Create(path);
|
||||
}
|
||||
|
||||
bool vfsDir::IsExists(const wxString& path) const
|
||||
bool vfsDir::IsExists(const std::string& path) const
|
||||
{
|
||||
return m_stream->IsExists(path); // Crash (Access violation reading location 0x0000000000000000)
|
||||
}
|
||||
|
@ -38,12 +38,12 @@ const Array<DirEntryInfo>& vfsDir::GetEntries() const
|
|||
return m_stream->GetEntries();
|
||||
}
|
||||
|
||||
bool vfsDir::Rename(const wxString& from, const wxString& to)
|
||||
bool vfsDir::Rename(const std::string& from, const std::string& to)
|
||||
{
|
||||
return m_stream->Rename(from, to);
|
||||
}
|
||||
|
||||
bool vfsDir::Remove(const wxString& path)
|
||||
bool vfsDir::Remove(const std::string& path)
|
||||
{
|
||||
return m_stream->Remove(path);
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ void vfsDir::Close()
|
|||
m_stream.reset();
|
||||
}
|
||||
|
||||
wxString vfsDir::GetPath() const
|
||||
std::string vfsDir::GetPath() const
|
||||
{
|
||||
return m_stream->GetPath();
|
||||
}
|
||||
|
|
|
@ -8,18 +8,18 @@ private:
|
|||
|
||||
public:
|
||||
vfsDir();
|
||||
vfsDir(const wxString path);
|
||||
vfsDir(const std::string& path);
|
||||
|
||||
virtual bool Open(const wxString& path) override;
|
||||
virtual bool Open(const std::string& path) override;
|
||||
virtual bool IsOpened() const override;
|
||||
virtual bool IsExists(const wxString& path) const override;
|
||||
virtual bool IsExists(const std::string& path) const override;
|
||||
virtual const Array<DirEntryInfo>& GetEntries() const override;
|
||||
virtual void Close() override;
|
||||
virtual wxString GetPath() const override;
|
||||
virtual std::string GetPath() const override;
|
||||
|
||||
virtual bool Create(const wxString& path) override;
|
||||
virtual bool Create(const std::string& path) override;
|
||||
//virtual bool Create(const DirEntryInfo& info) override;
|
||||
virtual bool Rename(const wxString& from, const wxString& to) override;
|
||||
virtual bool Remove(const wxString& path) override;
|
||||
virtual bool Rename(const std::string& from, const std::string& to) override;
|
||||
virtual bool Remove(const std::string& path) override;
|
||||
virtual const DirEntryInfo* Read() override;
|
||||
};
|
|
@ -11,7 +11,7 @@ vfsDirBase::~vfsDirBase()
|
|||
{
|
||||
}
|
||||
|
||||
bool vfsDirBase::Open(const wxString& path)
|
||||
bool vfsDirBase::Open(const std::string& path)
|
||||
{
|
||||
if(IsOpened())
|
||||
Close();
|
||||
|
@ -26,12 +26,12 @@ bool vfsDirBase::Open(const wxString& path)
|
|||
|
||||
bool vfsDirBase::IsOpened() const
|
||||
{
|
||||
return !m_cwd.IsEmpty();
|
||||
return !m_cwd.empty();
|
||||
}
|
||||
|
||||
bool vfsDirBase::IsExists(const wxString& path) const
|
||||
bool vfsDirBase::IsExists(const std::string& path) const
|
||||
{
|
||||
return wxDirExists(path);
|
||||
return wxDirExists(fmt::FromUTF8(path));
|
||||
}
|
||||
|
||||
const Array<DirEntryInfo>& vfsDirBase::GetEntries() const
|
||||
|
@ -41,11 +41,11 @@ const Array<DirEntryInfo>& vfsDirBase::GetEntries() const
|
|||
|
||||
void vfsDirBase::Close()
|
||||
{
|
||||
m_cwd = wxEmptyString;
|
||||
m_cwd = "";
|
||||
m_entries.Clear();
|
||||
}
|
||||
|
||||
wxString vfsDirBase::GetPath() const
|
||||
std::string vfsDirBase::GetPath() const
|
||||
{
|
||||
return m_cwd;
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ enum DirEntryFlags
|
|||
|
||||
struct DirEntryInfo
|
||||
{
|
||||
wxString name;
|
||||
std::string name;
|
||||
u32 flags;
|
||||
time_t create_time;
|
||||
time_t access_time;
|
||||
|
@ -30,7 +30,7 @@ struct DirEntryInfo
|
|||
class vfsDirBase
|
||||
{
|
||||
protected:
|
||||
wxString m_cwd;
|
||||
std::string m_cwd;
|
||||
Array<DirEntryInfo> m_entries;
|
||||
uint m_pos;
|
||||
vfsDevice* m_device;
|
||||
|
@ -39,16 +39,16 @@ public:
|
|||
vfsDirBase(vfsDevice* device);
|
||||
virtual ~vfsDirBase();
|
||||
|
||||
virtual bool Open(const wxString& path);
|
||||
virtual bool Open(const std::string& path);
|
||||
virtual bool IsOpened() const;
|
||||
virtual bool IsExists(const wxString& path) const;
|
||||
virtual bool IsExists(const std::string& path) const;
|
||||
virtual const Array<DirEntryInfo>& GetEntries() const;
|
||||
virtual void Close();
|
||||
virtual wxString GetPath() const;
|
||||
virtual std::string GetPath() const;
|
||||
|
||||
virtual bool Create(const wxString& path)=0;
|
||||
virtual bool Create(const std::string& path) = 0;
|
||||
//virtual bool Create(const DirEntryInfo& info)=0;
|
||||
virtual bool Rename(const wxString& from, const wxString& to)=0;
|
||||
virtual bool Remove(const wxString& path)=0;
|
||||
virtual bool Rename(const std::string& from, const std::string& to) = 0;
|
||||
virtual bool Remove(const std::string& path) = 0;
|
||||
virtual const DirEntryInfo* Read();
|
||||
};
|
|
@ -7,14 +7,14 @@ vfsFile::vfsFile()
|
|||
{
|
||||
}
|
||||
|
||||
vfsFile::vfsFile(const wxString path, vfsOpenMode mode)
|
||||
vfsFile::vfsFile(const std::string& path, vfsOpenMode mode)
|
||||
: vfsFileBase(nullptr)
|
||||
, m_stream(nullptr)
|
||||
{
|
||||
Open(path, mode);
|
||||
}
|
||||
|
||||
bool vfsFile::Open(const wxString& path, vfsOpenMode mode)
|
||||
bool vfsFile::Open(const std::string& path, vfsOpenMode mode)
|
||||
{
|
||||
Close();
|
||||
|
||||
|
@ -23,22 +23,22 @@ bool vfsFile::Open(const wxString& path, vfsOpenMode mode)
|
|||
return m_stream && m_stream->IsOpened();
|
||||
}
|
||||
|
||||
bool vfsFile::Create(const wxString& path)
|
||||
bool vfsFile::Create(const std::string& path)
|
||||
{
|
||||
return m_stream->Create(path);
|
||||
}
|
||||
|
||||
bool vfsFile::Exists(const wxString& path)
|
||||
bool vfsFile::Exists(const std::string& path)
|
||||
{
|
||||
return m_stream->Exists(path);
|
||||
}
|
||||
|
||||
bool vfsFile::Rename(const wxString& from, const wxString& to)
|
||||
bool vfsFile::Rename(const std::string& from, const std::string& to)
|
||||
{
|
||||
return m_stream->Rename(from, to);
|
||||
}
|
||||
|
||||
bool vfsFile::Remove(const wxString& path)
|
||||
bool vfsFile::Remove(const std::string& path)
|
||||
{
|
||||
return m_stream->Remove(path);
|
||||
}
|
||||
|
|
|
@ -8,13 +8,13 @@ private:
|
|||
|
||||
public:
|
||||
vfsFile();
|
||||
vfsFile(const wxString path, vfsOpenMode mode = vfsRead);
|
||||
vfsFile(const std::string& path, vfsOpenMode mode = vfsRead);
|
||||
|
||||
virtual bool Open(const wxString& path, vfsOpenMode mode = vfsRead) override;
|
||||
virtual bool Create(const wxString& path) override;
|
||||
virtual bool Exists(const wxString& path) override;
|
||||
virtual bool Rename(const wxString& from, const wxString& to) override;
|
||||
virtual bool Remove(const wxString& path) override;
|
||||
virtual bool Open(const std::string& path, vfsOpenMode mode = vfsRead) override;
|
||||
virtual bool Create(const std::string& path) override;
|
||||
virtual bool Exists(const std::string& path) override;
|
||||
virtual bool Rename(const std::string& from, const std::string& to) override;
|
||||
virtual bool Remove(const std::string& path) override;
|
||||
virtual bool Close() override;
|
||||
|
||||
virtual u64 GetSize() override;
|
||||
|
|
|
@ -12,12 +12,12 @@ vfsFileBase::~vfsFileBase()
|
|||
Close();
|
||||
}
|
||||
|
||||
bool Access(const wxString& path, vfsOpenMode mode)
|
||||
bool Access(const std::string& path, vfsOpenMode mode)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool vfsFileBase::Open(const wxString& path, vfsOpenMode mode)
|
||||
bool vfsFileBase::Open(const std::string& path, vfsOpenMode mode)
|
||||
{
|
||||
m_path = path;
|
||||
m_mode = mode;
|
||||
|
@ -29,12 +29,12 @@ bool vfsFileBase::Open(const wxString& path, vfsOpenMode mode)
|
|||
|
||||
bool vfsFileBase::Close()
|
||||
{
|
||||
m_path = wxEmptyString;
|
||||
m_path = "";
|
||||
|
||||
return vfsStream::Close();
|
||||
}
|
||||
|
||||
wxString vfsFileBase::GetPath() const
|
||||
std::string vfsFileBase::GetPath() const
|
||||
{
|
||||
return m_path;
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ class vfsDevice;
|
|||
struct vfsFileBase : public vfsStream
|
||||
{
|
||||
protected:
|
||||
wxString m_path;
|
||||
std::string m_path;
|
||||
vfsOpenMode m_mode;
|
||||
vfsDevice* m_device;
|
||||
|
||||
|
@ -25,13 +25,13 @@ public:
|
|||
vfsFileBase(vfsDevice* device);
|
||||
virtual ~vfsFileBase();
|
||||
|
||||
virtual bool Open(const wxString& path, vfsOpenMode mode);
|
||||
virtual bool Open(const std::string& path, vfsOpenMode mode);
|
||||
virtual bool Close() override;
|
||||
virtual bool Create(const wxString& path) { return false; }
|
||||
virtual bool Exists(const wxString& path) { return false; }
|
||||
virtual bool Rename(const wxString& from, const wxString& to) { return false; }
|
||||
virtual bool Remove(const wxString& path) { return false; }
|
||||
virtual bool Create(const std::string& path) { return false; }
|
||||
virtual bool Exists(const std::string& path) { return false; }
|
||||
virtual bool Rename(const std::string& from, const std::string& to) { return false; }
|
||||
virtual bool Remove(const std::string& path) { return false; }
|
||||
|
||||
wxString GetPath() const;
|
||||
std::string GetPath() const;
|
||||
vfsOpenMode GetOpenMode() const;
|
||||
};
|
||||
|
|
|
@ -9,7 +9,7 @@ vfsLocalDir::~vfsLocalDir()
|
|||
{
|
||||
}
|
||||
|
||||
bool vfsLocalDir::Open(const wxString& path)
|
||||
bool vfsLocalDir::Open(const std::string& path)
|
||||
{
|
||||
if(!vfsDirBase::Open(path))
|
||||
return false;
|
||||
|
@ -22,10 +22,10 @@ bool vfsLocalDir::Open(const wxString& path)
|
|||
wxString name;
|
||||
for(bool is_ok = dir.GetFirst(&name); is_ok; is_ok = dir.GetNext(&name))
|
||||
{
|
||||
wxString dir_path = path + name;
|
||||
wxString dir_path = fmt::FromUTF8(path) + name;
|
||||
|
||||
DirEntryInfo& info = m_entries[m_entries.Move(new DirEntryInfo())];
|
||||
info.name = name;
|
||||
info.name = fmt::ToUTF8(name);
|
||||
|
||||
info.flags |= dir.Exists(dir_path) ? DirEntry_TypeDir : DirEntry_TypeFile;
|
||||
if(wxIsWritable(dir_path)) info.flags |= DirEntry_PermWritable;
|
||||
|
@ -36,17 +36,17 @@ bool vfsLocalDir::Open(const wxString& path)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool vfsLocalDir::Create(const wxString& path)
|
||||
bool vfsLocalDir::Create(const std::string& path)
|
||||
{
|
||||
return wxFileName::Mkdir(path, 0777, wxPATH_MKDIR_FULL);
|
||||
return wxFileName::Mkdir(fmt::FromUTF8(path), 0777, wxPATH_MKDIR_FULL);
|
||||
}
|
||||
|
||||
bool vfsLocalDir::Rename(const wxString& from, const wxString& to)
|
||||
bool vfsLocalDir::Rename(const std::string& from, const std::string& to)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool vfsLocalDir::Remove(const wxString& path)
|
||||
bool vfsLocalDir::Remove(const std::string& path)
|
||||
{
|
||||
return wxRmdir(path);
|
||||
return wxRmdir(fmt::FromUTF8(path));
|
||||
}
|
||||
|
|
|
@ -10,9 +10,9 @@ public:
|
|||
vfsLocalDir(vfsDevice* device);
|
||||
virtual ~vfsLocalDir();
|
||||
|
||||
virtual bool Open(const wxString& path) override;
|
||||
virtual bool Open(const std::string& path) override;
|
||||
|
||||
virtual bool Create(const wxString& path) override;
|
||||
virtual bool Rename(const wxString& from, const wxString& to) override;
|
||||
virtual bool Remove(const wxString& path) override;
|
||||
virtual bool Create(const std::string& path) override;
|
||||
virtual bool Rename(const std::string& from, const std::string& to) override;
|
||||
virtual bool Remove(const std::string& path) override;
|
||||
};
|
|
@ -31,50 +31,50 @@ vfsLocalFile::vfsLocalFile(vfsDevice* device) : vfsFileBase(device)
|
|||
{
|
||||
}
|
||||
|
||||
bool vfsLocalFile::Open(const wxString& path, vfsOpenMode mode)
|
||||
bool vfsLocalFile::Open(const std::string& path, vfsOpenMode mode)
|
||||
{
|
||||
Close();
|
||||
|
||||
// if(m_device)
|
||||
// {
|
||||
// if(!m_file.Access(vfsDevice::GetWinPath(m_device->GetLocalPath(), path), vfs2wx_mode(mode))) return false;
|
||||
// if(!m_file.Access(fmt::FromUTF8(vfsDevice::GetWinPath(m_device->GetLocalPath(), path)), vfs2wx_mode(mode))) return false;
|
||||
|
||||
// return m_file.Open(vfsDevice::GetWinPath(m_device->GetLocalPath(), path), vfs2wx_mode(mode)) &&
|
||||
// vfsFileBase::Open(vfsDevice::GetPs3Path(m_device->GetPs3Path(), path), mode);
|
||||
// return m_file.Open(fmt::FromUTF8(vfsDevice::GetWinPath(m_device->GetLocalPath(), path)), vfs2wx_mode(mode)) &&
|
||||
// vfsFileBase::Open(fmt::FromUTF8(vfsDevice::GetPs3Path(m_device->GetPs3Path(), path)), mode);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
if(!m_file.Access(path, vfs2wx_mode(mode))) return false;
|
||||
if(!m_file.Access(fmt::FromUTF8(path), vfs2wx_mode(mode))) return false;
|
||||
|
||||
return m_file.Open(path, vfs2wx_mode(mode)) && vfsFileBase::Open(path, mode);
|
||||
return m_file.Open(fmt::FromUTF8(path), vfs2wx_mode(mode)) && vfsFileBase::Open(path, mode);
|
||||
// }
|
||||
}
|
||||
|
||||
bool vfsLocalFile::Create(const wxString& path)
|
||||
bool vfsLocalFile::Create(const std::string& path)
|
||||
{
|
||||
ConLog.Warning("vfsLocalFile::Create('%s')", path.wx_str());
|
||||
for(uint p=1; p < path.Len() && path[p] != '\0' ; p++)
|
||||
ConLog.Warning("vfsLocalFile::Create('%s')", path.c_str());
|
||||
for(uint p=1; p < path.length() && path[p] != '\0' ; p++)
|
||||
{
|
||||
for(; p < path.Len() && path[p] != '\0'; p++)
|
||||
for(; p < path.length() && path[p] != '\0'; p++)
|
||||
if(path[p] == '/' || path[p] == '\\') break; // ???
|
||||
|
||||
if(p == path.Len() || path[p] == '\0')
|
||||
if(p == path.length() || path[p] == '\0')
|
||||
break;
|
||||
|
||||
const wxString& dir = path(0, p);
|
||||
if(!wxDirExists(dir))
|
||||
const std::string& dir = path.substr(0, p);
|
||||
if(!wxDirExists(fmt::FromUTF8(dir)))
|
||||
{
|
||||
ConLog.Write("create dir: %s", dir.wx_str());
|
||||
wxMkdir(dir);
|
||||
ConLog.Write("create dir: %s", dir.c_str());
|
||||
wxMkdir(fmt::FromUTF8(dir));
|
||||
}
|
||||
}
|
||||
|
||||
//create file
|
||||
wxString m = path(path.Len() - 1, 1);
|
||||
if(m != '/' && m != '\\' && !wxFileExists(path)) // ???
|
||||
const char m = path[path.length() - 1];
|
||||
if(m != '/' && m != '\\' && !wxFileExists(fmt::FromUTF8(path))) // ???
|
||||
{
|
||||
wxFile f;
|
||||
return f.Create(path);
|
||||
return f.Create(fmt::FromUTF8(path));
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -9,8 +9,8 @@ private:
|
|||
public:
|
||||
vfsLocalFile(vfsDevice* device);
|
||||
|
||||
virtual bool Open(const wxString& path, vfsOpenMode mode = vfsRead) override;
|
||||
virtual bool Create(const wxString& path) override;
|
||||
virtual bool Open(const std::string& path, vfsOpenMode mode = vfsRead) override;
|
||||
virtual bool Create(const std::string& path) override;
|
||||
virtual bool Close() override;
|
||||
|
||||
virtual u64 GetSize() override;
|
||||
|
|
|
@ -503,12 +503,12 @@ enum
|
|||
NV3089_IMAGE_IN = 0x0000C40C,
|
||||
};
|
||||
|
||||
static const wxString GetMethodName(const u32 id)
|
||||
static const std::string GetMethodName(const u32 id)
|
||||
{
|
||||
struct MethodName
|
||||
{
|
||||
const u32 id;
|
||||
const wxString& name;
|
||||
const std::string& name;
|
||||
} static const METHOD_NAME_LIST[] = {
|
||||
{ NV4097_NO_OPERATION , "NoOperation" } ,
|
||||
{ NV4097_NOTIFY , "Notify" } ,
|
||||
|
@ -1206,5 +1206,5 @@ static const wxString GetMethodName(const u32 id)
|
|||
if(METHOD_NAME_LIST[i].id == id) return "cellGcm" + METHOD_NAME_LIST[i].name;
|
||||
}
|
||||
|
||||
return wxString::Format("unknown/illegal method [0x%08x]", id);
|
||||
return fmt::Format("unknown/illegal method [0x%08x]", id);
|
||||
}
|
|
@ -59,7 +59,7 @@ void GLFragmentDecompilerThread::AddCode(std::string code, bool append_mask)
|
|||
case 7: code = "(" + code + " / 8)"; break;
|
||||
|
||||
default:
|
||||
ConLog.Error("Bad scale: %d", src1.scale);
|
||||
ConLog.Error("Bad scale: %d", fmt::by_value(src1.scale));
|
||||
Emu.Pause();
|
||||
break;
|
||||
}
|
||||
|
@ -186,7 +186,7 @@ template<typename T> std::string GLFragmentDecompilerThread::GetSRC(T src)
|
|||
}
|
||||
else
|
||||
{
|
||||
ConLog.Error("Bad src reg num: %d", dst.src_attr_reg_num);
|
||||
ConLog.Error("Bad src reg num: %d", fmt::by_value(dst.src_attr_reg_num));
|
||||
ret += m_parr.AddParam(PARAM_IN, "vec4", "unk");
|
||||
Emu.Pause();
|
||||
}
|
||||
|
@ -200,7 +200,7 @@ template<typename T> std::string GLFragmentDecompilerThread::GetSRC(T src)
|
|||
break;
|
||||
|
||||
default:
|
||||
ConLog.Error("Bad src type %d", src.reg_type);
|
||||
ConLog.Error("Bad src type %d", fmt::by_value(src.reg_type));
|
||||
Emu.Pause();
|
||||
break;
|
||||
}
|
||||
|
@ -223,7 +223,7 @@ template<typename T> std::string GLFragmentDecompilerThread::GetSRC(T src)
|
|||
|
||||
std::string GLFragmentDecompilerThread::BuildCode()
|
||||
{
|
||||
//main += wxString::Format("\tgl_FragColor = %c0;\n", m_ctrl & 0x40 ? 'r' : 'h');
|
||||
//main += fmt::Format("\tgl_FragColor = %c0;\n", m_ctrl & 0x40 ? 'r' : 'h');
|
||||
main += "\t" + m_parr.AddParam(PARAM_OUT, "vec4", "ocol", 0) + " = " + (m_ctrl & 0x40 ? "r0" : "h0") + ";\n";
|
||||
if(m_ctrl & 0xe) main += "\tgl_FragDepth = r1.z;\n";
|
||||
|
||||
|
@ -420,7 +420,7 @@ void GLShaderProgram::Compile()
|
|||
GLsizei len;
|
||||
memset(buf, 0, r+1);
|
||||
glGetShaderInfoLog(id, r, &len, buf);
|
||||
ConLog.Error("Failed to compile shader: %s", wxString(buf).wx_str());
|
||||
ConLog.Error("Failed to compile shader: %s", buf);
|
||||
delete[] buf;
|
||||
}
|
||||
|
||||
|
|
|
@ -23,10 +23,14 @@ void printGlError(GLenum err, const char* situation)
|
|||
{
|
||||
if(err != GL_NO_ERROR)
|
||||
{
|
||||
ConLog.Error("%s: opengl error 0x%04x", wxString(situation).wx_str(), err);
|
||||
ConLog.Error("%s: opengl error 0x%04x", situation, err);
|
||||
Emu.Pause();
|
||||
}
|
||||
}
|
||||
void printGlError(GLenum err, const std::string& situation)
|
||||
{
|
||||
printGlError(err, situation.c_str());
|
||||
}
|
||||
|
||||
#if 0
|
||||
#define checkForGlError(x) /*x*/
|
||||
|
@ -316,13 +320,13 @@ void GLGSRender::InitVertexData()
|
|||
for(u32 i=0; i<m_transform_constants.GetCount(); ++i)
|
||||
{
|
||||
const RSXTransformConstant& c = m_transform_constants[i];
|
||||
const wxString name = wxString::Format("vc%u", c.id);
|
||||
const std::string name = fmt::Format("vc%u", c.id);
|
||||
l = m_program.GetLocation(name);
|
||||
checkForGlError("glGetUniformLocation " + name);
|
||||
|
||||
//ConLog.Write(name + " x: %.02f y: %.02f z: %.02f w: %.02f", c.x, c.y, c.z, c.w);
|
||||
glUniform4f(l, c.x, c.y, c.z, c.w);
|
||||
checkForGlError("glUniform4f " + name + wxString::Format(" %d [%f %f %f %f]", l, c.x, c.y, c.z, c.w));
|
||||
checkForGlError("glUniform4f " + name + fmt::Format(" %d [%f %f %f %f]", l, c.x, c.y, c.z, c.w));
|
||||
}
|
||||
|
||||
// Scale
|
||||
|
@ -358,12 +362,12 @@ void GLGSRender::InitFragmentData()
|
|||
|
||||
//ConLog.Warning("fc%u[0x%x - 0x%x] = (%f, %f, %f, %f)", id, c.id, m_cur_shader_prog->offset, c.x, c.y, c.z, c.w);
|
||||
|
||||
const wxString name = wxString::Format("fc%u", id);
|
||||
const std::string name = fmt::Format("fc%u", id);
|
||||
const int l = m_program.GetLocation(name);
|
||||
checkForGlError("glGetUniformLocation " + name);
|
||||
|
||||
glUniform4f(l, c.x, c.y, c.z, c.w);
|
||||
checkForGlError("glUniform4f " + name + wxString::Format(" %d [%f %f %f %f]", l, c.x, c.y, c.z, c.w));
|
||||
checkForGlError("glUniform4f " + name + fmt::Format(" %d [%f %f %f %f]", l, c.x, c.y, c.z, c.w));
|
||||
}
|
||||
|
||||
//if(m_fragment_constants.GetCount())
|
||||
|
@ -735,7 +739,7 @@ void GLGSRender::ExecCMD()
|
|||
for(int i=0; i<4; ++i)
|
||||
{
|
||||
m_fbo.Renderbuffer(GL_COLOR_ATTACHMENT0 + i, m_rbo.GetId(i));
|
||||
checkForGlError(wxString::Format("m_fbo.Renderbuffer(GL_COLOR_ATTACHMENT%d)", i));
|
||||
checkForGlError(fmt::Format("m_fbo.Renderbuffer(GL_COLOR_ATTACHMENT%d)", i));
|
||||
}
|
||||
|
||||
m_fbo.Renderbuffer(GL_DEPTH_ATTACHMENT, m_rbo.GetId(4));
|
||||
|
@ -1044,10 +1048,10 @@ void GLGSRender::ExecCMD()
|
|||
checkForGlError("glActiveTexture");
|
||||
m_gl_textures[i].Create();
|
||||
m_gl_textures[i].Bind();
|
||||
checkForGlError(wxString::Format("m_gl_textures[%d].Bind", i));
|
||||
checkForGlError(fmt::Format("m_gl_textures[%d].Bind", i));
|
||||
m_program.SetTex(i);
|
||||
m_gl_textures[i].Init(m_textures[i]);
|
||||
checkForGlError(wxString::Format("m_gl_textures[%d].Init", i));
|
||||
checkForGlError(fmt::Format("m_gl_textures[%d].Init", i));
|
||||
}
|
||||
|
||||
m_vao.Bind();
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
|
||||
extern GLenum g_last_gl_error;
|
||||
void printGlError(GLenum err, const char* situation);
|
||||
void printGlError(GLenum err, const std::string& situation);
|
||||
u32 LinearToSwizzleAddress(u32 x, u32 y, u32 z, u32 log2_width, u32 log2_height, u32 log2_depth);
|
||||
|
||||
#if RSX_DEBUG
|
||||
|
@ -171,7 +172,7 @@ public:
|
|||
break;
|
||||
|
||||
default: ConLog.Error("Init tex error: Bad tex format (0x%x | %s | 0x%x)", format,
|
||||
wxString(is_swizzled ? "swizzled" : "linear").wx_str(), tex.GetFormat() & 0x40); break;
|
||||
(is_swizzled ? "swizzled" : "linear"), tex.GetFormat() & 0x40); break;
|
||||
}
|
||||
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, tex.GetMipmap() - 1);
|
||||
|
|
|
@ -6,11 +6,11 @@ GLProgram::GLProgram() : id(0)
|
|||
{
|
||||
}
|
||||
|
||||
int GLProgram::GetLocation(const wxString& name)
|
||||
int GLProgram::GetLocation(const std::string& name)
|
||||
{
|
||||
for(u32 i=0; i<m_locations.GetCount(); ++i)
|
||||
{
|
||||
if(!m_locations[i].name.Cmp(name))
|
||||
if(!m_locations[i].name.compare(name))
|
||||
{
|
||||
return m_locations[i].loc;
|
||||
}
|
||||
|
@ -19,8 +19,8 @@ int GLProgram::GetLocation(const wxString& name)
|
|||
u32 pos = m_locations.Move(new Location());
|
||||
m_locations[pos].name = name;
|
||||
|
||||
m_locations[pos].loc = glGetUniformLocation(id, name);
|
||||
checkForGlError(wxString::Format("glGetUniformLocation(0x%x, %s)", id, name.wx_str()));
|
||||
m_locations[pos].loc = glGetUniformLocation(id, name.c_str());
|
||||
checkForGlError(fmt::Format("glGetUniformLocation(0x%x, %s)", id, name.c_str()));
|
||||
return m_locations[pos].loc;
|
||||
}
|
||||
|
||||
|
@ -51,7 +51,7 @@ void GLProgram::Create(const u32 vp, const u32 fp)
|
|||
char* buf = new char[bufLength+1];
|
||||
memset(buf, 0, bufLength+1);
|
||||
glGetProgramInfoLog(id, bufLength, NULL, buf);
|
||||
ConLog.Error("Could not link program: %s", wxString(buf).wx_str());
|
||||
ConLog.Error("Could not link program: %s", buf);
|
||||
delete[] buf;
|
||||
|
||||
return;
|
||||
|
@ -70,7 +70,7 @@ void GLProgram::Create(const u32 vp, const u32 fp)
|
|||
char* buf = new char[bufLength];
|
||||
memset(buf, 0, bufLength);
|
||||
glGetProgramInfoLog(id, bufLength, NULL, buf);
|
||||
ConLog.Error("Could not link program: %s", wxString(buf).wx_str());
|
||||
ConLog.Error("Could not link program: %s", buf);
|
||||
delete[] buf;
|
||||
|
||||
return;
|
||||
|
@ -95,9 +95,9 @@ void GLProgram::Use()
|
|||
|
||||
void GLProgram::SetTex(u32 index)
|
||||
{
|
||||
int loc = GetLocation(wxString::Format("tex%u", index));
|
||||
int loc = GetLocation(fmt::Format("tex%u", index));
|
||||
glProgramUniform1i(id, loc, index);
|
||||
checkForGlError(wxString::Format("SetTex(%u - %d - %d)", id, index, loc));
|
||||
checkForGlError(fmt::Format("SetTex(%u - %d - %d)", id, index, loc));
|
||||
}
|
||||
|
||||
void GLProgram::Delete()
|
||||
|
|
|
@ -8,7 +8,7 @@ private:
|
|||
struct Location
|
||||
{
|
||||
int loc;
|
||||
wxString name;
|
||||
std::string name;
|
||||
};
|
||||
|
||||
Array<Location> m_locations;
|
||||
|
@ -18,7 +18,7 @@ public:
|
|||
|
||||
GLProgram();
|
||||
|
||||
int GetLocation(const wxString& name);
|
||||
int GetLocation(const std::string& name);
|
||||
bool IsCreated() const;
|
||||
void Create(const u32 vp, const u32 fp);
|
||||
void Use();
|
||||
|
|
|
@ -93,8 +93,8 @@ void GLProgramBuffer::Add(GLProgram& prog, GLShaderProgram& gl_fp, RSXShaderProg
|
|||
ConLog.Write("*** vp data size = %d", rsx_vp.data.GetCount() * 4);
|
||||
ConLog.Write("*** fp data size = %d", rsx_fp.size);
|
||||
|
||||
ConLog.Write("*** vp shader = \n%s", gl_vp.shader.wx_str());
|
||||
ConLog.Write("*** fp shader = \n%s", wxString(gl_fp.shader).wx_str());
|
||||
ConLog.Write("*** vp shader = \n%s", gl_vp.shader.c_str());
|
||||
ConLog.Write("*** fp shader = \n%s", gl_fp.shader.c_str());
|
||||
|
||||
|
||||
new_buf.prog_id = prog.id;
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
#include "stdafx.h"
|
||||
#include "GLVertexProgram.h"
|
||||
|
||||
wxString GLVertexDecompilerThread::GetMask(bool is_sca)
|
||||
std::string GLVertexDecompilerThread::GetMask(bool is_sca)
|
||||
{
|
||||
wxString ret = wxEmptyString;
|
||||
std::string ret;
|
||||
|
||||
if(is_sca)
|
||||
{
|
||||
|
@ -20,20 +20,20 @@ wxString GLVertexDecompilerThread::GetMask(bool is_sca)
|
|||
if(d3.vec_writemask_w) ret += "w";
|
||||
}
|
||||
|
||||
return ret.IsEmpty() || ret == "xyzw" ? wxString(wxEmptyString) : ("." + ret);
|
||||
return ret.empty() || ret == "xyzw" ? "" : ("." + ret);
|
||||
}
|
||||
|
||||
wxString GLVertexDecompilerThread::GetVecMask()
|
||||
std::string GLVertexDecompilerThread::GetVecMask()
|
||||
{
|
||||
return GetMask(false);
|
||||
}
|
||||
|
||||
wxString GLVertexDecompilerThread::GetScaMask()
|
||||
std::string GLVertexDecompilerThread::GetScaMask()
|
||||
{
|
||||
return GetMask(true);
|
||||
}
|
||||
|
||||
wxString GLVertexDecompilerThread::GetDST(bool isSca)
|
||||
std::string GLVertexDecompilerThread::GetDST(bool isSca)
|
||||
{
|
||||
static const std::string reg_table[] =
|
||||
{
|
||||
|
@ -45,7 +45,7 @@ wxString GLVertexDecompilerThread::GetDST(bool isSca)
|
|||
"tc0", "tc1", "tc2", "tc3", "tc4", "tc5", "tc6", "tc7"
|
||||
};
|
||||
|
||||
wxString ret = wxEmptyString;
|
||||
std::string ret;
|
||||
|
||||
switch(isSca ? 0x1f : d3.dst)
|
||||
{
|
||||
|
@ -64,7 +64,7 @@ wxString GLVertexDecompilerThread::GetDST(bool isSca)
|
|||
}
|
||||
else
|
||||
{
|
||||
ConLog.Error("Bad dst reg num: %d", d3.dst);
|
||||
ConLog.Error("Bad dst reg num: %d", fmt::by_value(d3.dst));
|
||||
ret += m_parr.AddParam(PARAM_OUT, "vec4", "unk");
|
||||
}
|
||||
break;
|
||||
|
@ -73,7 +73,7 @@ wxString GLVertexDecompilerThread::GetDST(bool isSca)
|
|||
return ret;
|
||||
}
|
||||
|
||||
wxString GLVertexDecompilerThread::GetSRC(const u32 n, bool isSca)
|
||||
std::string GLVertexDecompilerThread::GetSRC(const u32 n, bool isSca)
|
||||
{
|
||||
static const std::string reg_table[] =
|
||||
{
|
||||
|
@ -85,7 +85,7 @@ wxString GLVertexDecompilerThread::GetSRC(const u32 n, bool isSca)
|
|||
"in_tc4", "in_tc5", "in_tc6", "in_tc7"
|
||||
};
|
||||
|
||||
wxString ret = wxEmptyString;
|
||||
std::string ret;
|
||||
|
||||
switch(src[n].reg_type)
|
||||
{
|
||||
|
@ -99,7 +99,7 @@ wxString GLVertexDecompilerThread::GetSRC(const u32 n, bool isSca)
|
|||
}
|
||||
else
|
||||
{
|
||||
ConLog.Error("Bad input src num: %d", d1.input_src);
|
||||
ConLog.Error("Bad input src num: %d", fmt::by_value(d1.input_src));
|
||||
ret += m_parr.AddParam(PARAM_IN, "vec4", "in_unk", d1.input_src);
|
||||
}
|
||||
break;
|
||||
|
@ -108,12 +108,12 @@ wxString GLVertexDecompilerThread::GetSRC(const u32 n, bool isSca)
|
|||
break;
|
||||
|
||||
default:
|
||||
ConLog.Error("Bad src%u reg type: %d", n, src[n].reg_type);
|
||||
ConLog.Error("Bad src%u reg type: %d", n, fmt::by_value(src[n].reg_type));
|
||||
Emu.Pause();
|
||||
break;
|
||||
}
|
||||
|
||||
static const wxString f = "xyzw";
|
||||
static const std::string f = "xyzw";
|
||||
|
||||
if (isSca)
|
||||
{
|
||||
|
@ -126,7 +126,7 @@ wxString GLVertexDecompilerThread::GetSRC(const u32 n, bool isSca)
|
|||
}
|
||||
else
|
||||
{
|
||||
wxString swizzle = wxEmptyString;
|
||||
std::string swizzle;
|
||||
|
||||
swizzle += f[src[n].swz_x];
|
||||
swizzle += f[src[n].swz_y];
|
||||
|
@ -151,8 +151,9 @@ wxString GLVertexDecompilerThread::GetSRC(const u32 n, bool isSca)
|
|||
return ret;
|
||||
}
|
||||
|
||||
void GLVertexDecompilerThread::AddCode(bool is_sca, wxString code, bool src_mask, bool set_dst, bool set_cond)
|
||||
void GLVertexDecompilerThread::AddCode(bool is_sca, const std::string& pCode, bool src_mask, bool set_dst, bool set_cond)
|
||||
{
|
||||
std::string code = pCode;
|
||||
if(d0.cond == 0) return;
|
||||
enum
|
||||
{
|
||||
|
@ -173,7 +174,7 @@ void GLVertexDecompilerThread::AddCode(bool is_sca, wxString code, bool src_mask
|
|||
"error"
|
||||
};
|
||||
|
||||
wxString cond;
|
||||
std::string cond;
|
||||
|
||||
if((set_cond || d0.cond_test_enable) && d0.cond != (lt | gt | eq))
|
||||
{
|
||||
|
@ -187,11 +188,11 @@ void GLVertexDecompilerThread::AddCode(bool is_sca, wxString code, bool src_mask
|
|||
|
||||
swizzle = swizzle == "xyzw" ? "" : "." + swizzle;
|
||||
|
||||
cond = wxString::Format("if(all(%s(rc%s, vec4(0.0)%s))) ", wxString(cond_string_table[d0.cond]).wx_str(), wxString(swizzle).wx_str(), wxString(swizzle).wx_str());
|
||||
cond = fmt::Format("if(all(%s(rc%s, vec4(0.0)%s))) ", cond_string_table[d0.cond], swizzle.c_str(), swizzle.c_str());
|
||||
}
|
||||
|
||||
wxString mask = GetMask(is_sca);
|
||||
wxString value = src_mask ? code + mask : code;
|
||||
std::string mask = GetMask(is_sca);
|
||||
std::string value = src_mask ? code + mask : code;
|
||||
|
||||
if(is_sca && d0.vec_result)
|
||||
{
|
||||
|
@ -205,7 +206,7 @@ void GLVertexDecompilerThread::AddCode(bool is_sca, wxString code, bool src_mask
|
|||
|
||||
if(set_dst)
|
||||
{
|
||||
wxString dest;
|
||||
std::string dest;
|
||||
if(d0.cond_update_enable_0)
|
||||
{
|
||||
dest = m_parr.AddParam(PARAM_NONE, "vec4", "rc", "vec4(0.0)") + mask;
|
||||
|
@ -224,7 +225,7 @@ void GLVertexDecompilerThread::AddCode(bool is_sca, wxString code, bool src_mask
|
|||
if(d3.vec_writemask_z) num += 1;
|
||||
else if(d3.vec_writemask_w) num += 2;
|
||||
|
||||
dest = wxString::Format(GetDST(is_sca) + "/*" + mask + "*/", num);
|
||||
dest = fmt::Format(GetDST(is_sca) + "/*" + mask + "*/", num);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -239,17 +240,17 @@ void GLVertexDecompilerThread::AddCode(bool is_sca, wxString code, bool src_mask
|
|||
code = cond + value;
|
||||
}
|
||||
|
||||
m_body.Add(code + ";");
|
||||
m_body.push_back(code + ";");
|
||||
}
|
||||
|
||||
wxString GLVertexDecompilerThread::GetFunc()
|
||||
std::string GLVertexDecompilerThread::GetFunc()
|
||||
{
|
||||
u32 offset = (d2.iaddrh << 3) | d3.iaddrl;
|
||||
wxString name = wxString::Format("func%u", offset);
|
||||
std::string name = fmt::Format("func%u", offset);
|
||||
|
||||
for(uint i=0; i<m_funcs.GetCount(); ++i)
|
||||
{
|
||||
if(m_funcs[i].name.Cmp(name) == 0)
|
||||
if(m_funcs[i].name.compare(name) == 0)
|
||||
return name + "()";
|
||||
}
|
||||
|
||||
|
@ -260,21 +261,21 @@ wxString GLVertexDecompilerThread::GetFunc()
|
|||
return name + "()";
|
||||
}
|
||||
|
||||
void GLVertexDecompilerThread::AddVecCode(const wxString& code, bool src_mask, bool set_dst)
|
||||
void GLVertexDecompilerThread::AddVecCode(const std::string& code, bool src_mask, bool set_dst)
|
||||
{
|
||||
AddCode(false, code, src_mask, set_dst);
|
||||
}
|
||||
|
||||
void GLVertexDecompilerThread::AddScaCode(const wxString& code, bool set_dst, bool set_cond)
|
||||
void GLVertexDecompilerThread::AddScaCode(const std::string& code, bool set_dst, bool set_cond)
|
||||
{
|
||||
AddCode(true, code, false, set_dst, set_cond);
|
||||
}
|
||||
|
||||
wxString GLVertexDecompilerThread::BuildFuncBody(const FuncInfo& func)
|
||||
std::string GLVertexDecompilerThread::BuildFuncBody(const FuncInfo& func)
|
||||
{
|
||||
wxString result;
|
||||
std::string result;
|
||||
|
||||
for(uint i=func.offset; i<m_body.GetCount(); ++i)
|
||||
for(uint i=func.offset; i<m_body.size(); ++i)
|
||||
{
|
||||
if(i != func.offset)
|
||||
{
|
||||
|
@ -301,33 +302,33 @@ wxString GLVertexDecompilerThread::BuildFuncBody(const FuncInfo& func)
|
|||
return result;
|
||||
}
|
||||
|
||||
wxString GLVertexDecompilerThread::BuildCode()
|
||||
std::string GLVertexDecompilerThread::BuildCode()
|
||||
{
|
||||
wxString p = wxEmptyString;
|
||||
std::string p;
|
||||
|
||||
for(u32 i=0; i<m_parr.params.GetCount(); ++i)
|
||||
{
|
||||
p += m_parr.params[i].Format();
|
||||
}
|
||||
|
||||
wxString fp = wxEmptyString;
|
||||
std::string fp;
|
||||
|
||||
for(int i=m_funcs.GetCount() - 1; i>0; --i)
|
||||
{
|
||||
fp += wxString::Format("void %s();\n", m_funcs[i].name.wx_str());
|
||||
fp += fmt::Format("void %s();\n", m_funcs[i].name.c_str());
|
||||
}
|
||||
|
||||
wxString f = wxEmptyString;
|
||||
std::string f;
|
||||
|
||||
f += wxString::Format("void %s()\n{\n\tgl_Position = vec4(0.0f, 0.0f, 0.0f, 1.0f);\n\t%s();\n\tgl_Position = gl_Position * scaleOffsetMat;\n}\n",
|
||||
m_funcs[0].name.wx_str(), m_funcs[1].name.wx_str());
|
||||
f += fmt::Format("void %s()\n{\n\tgl_Position = vec4(0.0f, 0.0f, 0.0f, 1.0f);\n\t%s();\n\tgl_Position = gl_Position * scaleOffsetMat;\n}\n",
|
||||
m_funcs[0].name.c_str(), m_funcs[1].name.c_str());
|
||||
|
||||
for(uint i=1; i<m_funcs.GetCount(); ++i)
|
||||
{
|
||||
f += wxString::Format("\nvoid %s()\n{\n%s}\n", m_funcs[i].name.wx_str(), BuildFuncBody(m_funcs[i]).wx_str());
|
||||
f += fmt::Format("\nvoid %s()\n{\n%s}\n", m_funcs[i].name.c_str(), BuildFuncBody(m_funcs[i]).c_str());
|
||||
}
|
||||
|
||||
static const wxString& prot =
|
||||
static const std::string& prot =
|
||||
"#version 330\n"
|
||||
"\n"
|
||||
"uniform mat4 scaleOffsetMat = mat4(1.0);\n"
|
||||
|
@ -335,7 +336,7 @@ wxString GLVertexDecompilerThread::BuildCode()
|
|||
"%s\n"
|
||||
"%s";
|
||||
|
||||
return wxString::Format(prot, p.wx_str(), fp.wx_str(), f.wx_str());
|
||||
return fmt::Format(prot, p.c_str(), fp.c_str(), f.c_str());
|
||||
}
|
||||
|
||||
void GLVertexDecompilerThread::Task()
|
||||
|
@ -357,7 +358,7 @@ void GLVertexDecompilerThread::Task()
|
|||
|
||||
if(!d1.sca_opcode && !d1.vec_opcode)
|
||||
{
|
||||
m_body.Add("//nop");
|
||||
m_body.push_back("//nop");
|
||||
}
|
||||
|
||||
switch(d1.sca_opcode)
|
||||
|
@ -385,8 +386,8 @@ void GLVertexDecompilerThread::Task()
|
|||
//case 0x14: break; // POP : works differently (POP o[1].x;)
|
||||
|
||||
default:
|
||||
m_body.Add(wxString::Format("//Unknown vp sca_opcode 0x%x", d1.sca_opcode));
|
||||
ConLog.Error("Unknown vp sca_opcode 0x%x", d1.sca_opcode);
|
||||
m_body.push_back(fmt::Format("//Unknown vp sca_opcode 0x%x", fmt::by_value(d1.sca_opcode)));
|
||||
ConLog.Error("Unknown vp sca_opcode 0x%x", fmt::by_value(d1.sca_opcode));
|
||||
Emu.Pause();
|
||||
break;
|
||||
}
|
||||
|
@ -417,8 +418,8 @@ void GLVertexDecompilerThread::Task()
|
|||
case 0x16: AddVecCode("sign(" + GetSRC(0) + ")"); break; //SSG
|
||||
|
||||
default:
|
||||
m_body.Add(wxString::Format("//Unknown vp opcode 0x%x", d1.vec_opcode));
|
||||
ConLog.Error("Unknown vp opcode 0x%x", d1.vec_opcode);
|
||||
m_body.push_back(fmt::Format("//Unknown vp opcode 0x%x", fmt::by_value(d1.vec_opcode)));
|
||||
ConLog.Error("Unknown vp opcode 0x%x", fmt::by_value(d1.vec_opcode));
|
||||
Emu.Pause();
|
||||
break;
|
||||
}
|
||||
|
@ -434,7 +435,7 @@ void GLVertexDecompilerThread::Task()
|
|||
|
||||
m_shader = BuildCode();
|
||||
|
||||
m_body.Clear();
|
||||
m_body.clear();
|
||||
m_funcs.RemoveAt(2, m_funcs.GetCount() - 2);
|
||||
}
|
||||
|
||||
|
@ -489,8 +490,8 @@ void GLVertexProgram::Compile()
|
|||
|
||||
id = glCreateShader(GL_VERTEX_SHADER);
|
||||
|
||||
const char* str = shader.mb_str();
|
||||
const int strlen = shader.Len();
|
||||
const char* str = shader.c_str();
|
||||
const int strlen = shader.length();
|
||||
|
||||
glShaderSource(id, 1, &str, &strlen);
|
||||
glCompileShader(id);
|
||||
|
@ -507,7 +508,7 @@ void GLVertexProgram::Compile()
|
|||
GLsizei len;
|
||||
memset(buf, 0, r+1);
|
||||
glGetShaderInfoLog(id, r, &len, buf);
|
||||
ConLog.Error("Failed to compile vertex shader: %s", wxString(buf).wx_str());
|
||||
ConLog.Error("Failed to compile vertex shader: %s", buf);
|
||||
delete[] buf;
|
||||
}
|
||||
|
||||
|
@ -521,7 +522,7 @@ void GLVertexProgram::Compile()
|
|||
void GLVertexProgram::Delete()
|
||||
{
|
||||
parr.params.Clear();
|
||||
shader.Clear();
|
||||
shader.clear();
|
||||
|
||||
if(id)
|
||||
{
|
||||
|
|
|
@ -130,19 +130,19 @@ struct GLVertexDecompilerThread : public ThreadBase
|
|||
struct FuncInfo
|
||||
{
|
||||
u32 offset;
|
||||
wxString name;
|
||||
std::string name;
|
||||
};
|
||||
|
||||
wxArrayString m_body;
|
||||
std::vector<std::string> m_body;
|
||||
|
||||
ArrayF<FuncInfo> m_funcs;
|
||||
|
||||
//wxString main;
|
||||
wxString& m_shader;
|
||||
std::string& m_shader;
|
||||
Array<u32>& m_data;
|
||||
GLParamArray& m_parr;
|
||||
|
||||
GLVertexDecompilerThread(Array<u32>& data, wxString& shader, GLParamArray& parr)
|
||||
GLVertexDecompilerThread(Array<u32>& data, std::string& shader, GLParamArray& parr)
|
||||
: ThreadBase("Vertex Shader Decompiler Thread")
|
||||
, m_data(data)
|
||||
, m_shader(shader)
|
||||
|
@ -157,17 +157,17 @@ struct GLVertexDecompilerThread : public ThreadBase
|
|||
//m_cur_func->body = "\tgl_Position = vec4(0.0f, 0.0f, 0.0f, 1.0f);\n";
|
||||
}
|
||||
|
||||
wxString GetMask(bool is_sca);
|
||||
wxString GetVecMask();
|
||||
wxString GetScaMask();
|
||||
wxString GetDST(bool is_sca = false);
|
||||
wxString GetSRC(const u32 n, bool is_sca = false);
|
||||
wxString GetFunc();
|
||||
void AddCode(bool is_sca, wxString code, bool src_mask = true, bool set_dst = true, bool set_cond = true);
|
||||
void AddVecCode(const wxString& code, bool src_mask = true, bool set_dst = true);
|
||||
void AddScaCode(const wxString& code, bool set_dst = true, bool set_cond = true);
|
||||
wxString BuildFuncBody(const FuncInfo& func);
|
||||
wxString BuildCode();
|
||||
std::string GetMask(bool is_sca);
|
||||
std::string GetVecMask();
|
||||
std::string GetScaMask();
|
||||
std::string GetDST(bool is_sca = false);
|
||||
std::string GetSRC(const u32 n, bool is_sca = false);
|
||||
std::string GetFunc();
|
||||
void AddCode(bool is_sca, const std::string& code, bool src_mask = true, bool set_dst = true, bool set_cond = true);
|
||||
void AddVecCode(const std::string& code, bool src_mask = true, bool set_dst = true);
|
||||
void AddScaCode(const std::string& code, bool set_dst = true, bool set_cond = true);
|
||||
std::string BuildFuncBody(const FuncInfo& func);
|
||||
std::string BuildCode();
|
||||
|
||||
virtual void Task();
|
||||
};
|
||||
|
@ -181,7 +181,7 @@ struct GLVertexProgram
|
|||
|
||||
GLParamArray parr;
|
||||
u32 id;
|
||||
wxString shader;
|
||||
std::string shader;
|
||||
|
||||
void Wait()
|
||||
{
|
||||
|
|
|
@ -105,9 +105,9 @@ u32 RSXVertexData::GetTypeSize()
|
|||
|
||||
u32 RSXThread::OutOfArgsCount(const uint x, const u32 cmd, const u32 count)
|
||||
{
|
||||
wxString debug = GetMethodName(cmd);
|
||||
std::string debug = GetMethodName(cmd);
|
||||
debug += "(";
|
||||
for(u32 i=0; i<count; ++i) debug += (i ? ", " : "") + wxString::Format("0x%x", ARGS(i));
|
||||
for(u32 i=0; i<count; ++i) debug += (i ? ", " : "") + fmt::Format("0x%x", ARGS(i));
|
||||
debug += ")";
|
||||
ConLog.Write("OutOfArgsCount(x=%u, count=%u): " + debug, x, count);
|
||||
|
||||
|
@ -172,9 +172,9 @@ u32 RSXThread::OutOfArgsCount(const uint x, const u32 cmd, const u32 count)
|
|||
void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, mem32_ptr_t& args, const u32 count)
|
||||
{
|
||||
#if CMD_DEBUG
|
||||
wxString debug = GetMethodName(cmd);
|
||||
std::string debug = GetMethodName(cmd);
|
||||
debug += "(";
|
||||
for(u32 i=0; i<count; ++i) debug += (i ? ", " : "") + wxString::Format("0x%x", ARGS(i));
|
||||
for(u32 i=0; i<count; ++i) debug += (i ? ", " : "") + fmt::Format("0x%x", ARGS(i));
|
||||
debug += ")";
|
||||
ConLog.Write(debug);
|
||||
#endif
|
||||
|
@ -1471,9 +1471,9 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, mem32_ptr_t& args, const u3
|
|||
|
||||
default:
|
||||
{
|
||||
wxString log = GetMethodName(cmd);
|
||||
std::string log = GetMethodName(cmd);
|
||||
log += "(";
|
||||
for(u32 i=0; i<count; ++i) log += (i ? ", " : "") + wxString::Format("0x%x", ARGS(i));
|
||||
for(u32 i=0; i<count; ++i) log += (i ? ", " : "") + fmt::Format("0x%x", ARGS(i));
|
||||
log += ")";
|
||||
ConLog.Error("TODO: " + log);
|
||||
//Emu.Pause();
|
||||
|
|
|
@ -2,13 +2,13 @@
|
|||
|
||||
struct GameInfo
|
||||
{
|
||||
wxString root;
|
||||
std::string root;
|
||||
|
||||
wxString name;
|
||||
wxString serial;
|
||||
wxString app_ver;
|
||||
wxString category;
|
||||
wxString fw;
|
||||
std::string name;
|
||||
std::string serial;
|
||||
std::string app_ver;
|
||||
std::string category;
|
||||
std::string fw;
|
||||
|
||||
u32 attr;
|
||||
u32 bootable;
|
||||
|
@ -23,7 +23,7 @@ struct GameInfo
|
|||
|
||||
void Reset()
|
||||
{
|
||||
root = wxEmptyString;
|
||||
root = "";
|
||||
|
||||
name = "Unknown";
|
||||
serial = "Unknown";
|
||||
|
|
|
@ -59,9 +59,9 @@ public:
|
|||
CreateBlock(entry);
|
||||
}
|
||||
|
||||
static void CreateHDD(const wxString& path, u64 size, u64 block_size)
|
||||
static void CreateHDD(const std::string& path, u64 size, u64 block_size)
|
||||
{
|
||||
wxFile f(path, wxFile::write);
|
||||
wxFile f(fmt::FromUTF8(path), wxFile::write);
|
||||
|
||||
static const u64 cur_dir_block = 1;
|
||||
|
||||
|
@ -174,24 +174,26 @@ class vfsHDDFile
|
|||
m_hdd.Read(&data, sizeof(vfsHDD_Entry));
|
||||
}
|
||||
|
||||
void ReadEntry(u64 block, vfsHDD_Entry& data, wxString& name)
|
||||
void ReadEntry(u64 block, vfsHDD_Entry& data, std::string& name)
|
||||
{
|
||||
m_hdd.Seek(block * m_hdd_info.block_size);
|
||||
m_hdd.Read(&data, sizeof(vfsHDD_Entry));
|
||||
m_hdd.Read(wxStringBuffer(name, GetMaxNameLen()), GetMaxNameLen());
|
||||
name.resize(GetMaxNameLen());
|
||||
m_hdd.Read(&name.front(), GetMaxNameLen());
|
||||
}
|
||||
|
||||
void ReadEntry(u64 block, wxString& name)
|
||||
void ReadEntry(u64 block, std::string& name)
|
||||
{
|
||||
m_hdd.Seek(block * m_hdd_info.block_size + sizeof(vfsHDD_Entry));
|
||||
m_hdd.Read(wxStringBuffer(name, GetMaxNameLen()), GetMaxNameLen());
|
||||
name.resize(GetMaxNameLen());
|
||||
m_hdd.Read(&name.front(), GetMaxNameLen());
|
||||
}
|
||||
|
||||
void WriteEntry(u64 block, const vfsHDD_Entry& data, const wxString& name)
|
||||
void WriteEntry(u64 block, const vfsHDD_Entry& data, const std::string& name)
|
||||
{
|
||||
m_hdd.Seek(block * m_hdd_info.block_size);
|
||||
m_hdd.Write(&data, sizeof(vfsHDD_Entry));
|
||||
m_hdd.Write(name.c_str(), min<size_t>(GetMaxNameLen() - 1, name.Len() + 1));
|
||||
m_hdd.Write(name.c_str(), min<size_t>(GetMaxNameLen() - 1, name.length() + 1));
|
||||
}
|
||||
|
||||
__forceinline u32 GetMaxNameLen() const
|
||||
|
@ -424,13 +426,13 @@ class vfsHDD : public vfsFileBase
|
|||
{
|
||||
vfsHDD_Hdr m_hdd_info;
|
||||
vfsLocalFile m_hdd_file;
|
||||
const wxString& m_hdd_path;
|
||||
const std::string& m_hdd_path;
|
||||
vfsHDD_Entry m_cur_dir;
|
||||
u64 m_cur_dir_block;
|
||||
vfsHDDFile m_file;
|
||||
|
||||
public:
|
||||
vfsHDD(vfsDevice* device, const wxString& hdd_path)
|
||||
vfsHDD(vfsDevice* device, const std::string& hdd_path)
|
||||
: m_hdd_file(device)
|
||||
, m_file(m_hdd_file, m_hdd_info)
|
||||
, m_hdd_path(hdd_path)
|
||||
|
@ -453,18 +455,18 @@ public:
|
|||
return m_hdd_info.block_size - sizeof(vfsHDD_Entry);
|
||||
}
|
||||
|
||||
bool SearchEntry(const wxString& name, u64& entry_block, u64* parent_block = nullptr)
|
||||
bool SearchEntry(const std::string& name, u64& entry_block, u64* parent_block = nullptr)
|
||||
{
|
||||
u64 last_block = 0;
|
||||
u64 block = m_cur_dir_block;
|
||||
vfsHDD_Entry entry;
|
||||
wxString buf;
|
||||
std::string buf;
|
||||
|
||||
while(block)
|
||||
{
|
||||
ReadEntry(block, entry, buf);
|
||||
|
||||
if(name.CmpNoCase(buf) == 0)
|
||||
if (fmt::CmpNoCase(name,buf) == 0)
|
||||
{
|
||||
entry_block = block;
|
||||
if(parent_block)
|
||||
|
@ -480,9 +482,9 @@ public:
|
|||
return false;
|
||||
}
|
||||
|
||||
int OpenDir(const wxString& name)
|
||||
int OpenDir(const std::string& name)
|
||||
{
|
||||
ConLog.Warning("OpenDir(%s)", name.wx_str());
|
||||
ConLog.Warning("OpenDir(%s)", name.c_str());
|
||||
u64 entry_block;
|
||||
if(!SearchEntry(name, entry_block))
|
||||
return -1;
|
||||
|
@ -499,7 +501,7 @@ public:
|
|||
return 0;
|
||||
}
|
||||
|
||||
bool Rename(const wxString& from, const wxString& to)
|
||||
bool Rename(const std::string& from, const std::string& to)
|
||||
{
|
||||
u64 entry_block;
|
||||
if(!SearchEntry(from, entry_block))
|
||||
|
@ -555,27 +557,29 @@ public:
|
|||
m_hdd_file.Read(&data, sizeof(vfsHDD_Entry));
|
||||
}
|
||||
|
||||
void ReadEntry(u64 block, vfsHDD_Entry& data, wxString& name)
|
||||
void ReadEntry(u64 block, vfsHDD_Entry& data, std::string& name)
|
||||
{
|
||||
m_hdd_file.Seek(block * m_hdd_info.block_size);
|
||||
m_hdd_file.Read(&data, sizeof(vfsHDD_Entry));
|
||||
m_hdd_file.Read(wxStringBuffer(name, GetMaxNameLen()), GetMaxNameLen());
|
||||
name.resize(GetMaxNameLen());
|
||||
m_hdd_file.Read(&name.front(), GetMaxNameLen());
|
||||
}
|
||||
|
||||
void ReadEntry(u64 block, wxString& name)
|
||||
void ReadEntry(u64 block, std::string& name)
|
||||
{
|
||||
m_hdd_file.Seek(block * m_hdd_info.block_size + sizeof(vfsHDD_Entry));
|
||||
m_hdd_file.Read(wxStringBuffer(name, GetMaxNameLen()), GetMaxNameLen());
|
||||
name.resize(GetMaxNameLen());
|
||||
m_hdd_file.Read(&name.front(), GetMaxNameLen());
|
||||
}
|
||||
|
||||
void WriteEntry(u64 block, const vfsHDD_Entry& data, const wxString& name)
|
||||
void WriteEntry(u64 block, const vfsHDD_Entry& data, const std::string& name)
|
||||
{
|
||||
m_hdd_file.Seek(block * m_hdd_info.block_size);
|
||||
m_hdd_file.Write(&data, sizeof(vfsHDD_Entry));
|
||||
m_hdd_file.Write(name.c_str(), min<size_t>(GetMaxNameLen() - 1, name.Len() + 1));
|
||||
m_hdd_file.Write(name.c_str(), min<size_t>(GetMaxNameLen() - 1, name.length() + 1));
|
||||
}
|
||||
|
||||
bool Create(vfsHDD_EntryType type, const wxString& name)
|
||||
bool Create(vfsHDD_EntryType type, const std::string& name)
|
||||
{
|
||||
if(HasEntry(name))
|
||||
{
|
||||
|
@ -659,7 +663,7 @@ public:
|
|||
return true;
|
||||
}
|
||||
|
||||
bool GetFirstEntry(u64& block, vfsHDD_Entry& entry, wxString& name)
|
||||
bool GetFirstEntry(u64& block, vfsHDD_Entry& entry, std::string& name)
|
||||
{
|
||||
if(!m_cur_dir_block)
|
||||
{
|
||||
|
@ -672,7 +676,7 @@ public:
|
|||
return true;
|
||||
}
|
||||
|
||||
bool GetNextEntry(u64& block, vfsHDD_Entry& entry, wxString& name)
|
||||
bool GetNextEntry(u64& block, vfsHDD_Entry& entry, std::string& name)
|
||||
{
|
||||
if(!block)
|
||||
{
|
||||
|
@ -685,7 +689,7 @@ public:
|
|||
return true;
|
||||
}
|
||||
|
||||
virtual bool Open(const wxString& path, vfsOpenMode mode = vfsRead)
|
||||
virtual bool Open(const std::string& path, vfsOpenMode mode = vfsRead)
|
||||
{
|
||||
const char* s = path.c_str();
|
||||
u64 from = 0;
|
||||
|
@ -705,7 +709,7 @@ public:
|
|||
{
|
||||
if(pos - from > 1)
|
||||
{
|
||||
int res = OpenDir(wxString(s + from, pos));
|
||||
int res = OpenDir(std::string(s + from, pos));
|
||||
if(res == -1)
|
||||
{
|
||||
return false;
|
||||
|
@ -733,7 +737,7 @@ public:
|
|||
}
|
||||
|
||||
u64 file_block;
|
||||
if(!SearchEntry(wxString(s + file_pos), file_block))
|
||||
if(!SearchEntry(std::string(s + file_pos), file_block))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -744,7 +748,7 @@ public:
|
|||
return vfsFileBase::Open(path, mode);
|
||||
}
|
||||
|
||||
bool HasEntry(const wxString& name)
|
||||
bool HasEntry(const std::string& name)
|
||||
{
|
||||
u64 file_block;
|
||||
if(!SearchEntry(name, file_block))
|
||||
|
@ -757,7 +761,7 @@ public:
|
|||
|
||||
void RemoveBlocksDir(u64 start_block)
|
||||
{
|
||||
wxString name;
|
||||
std::string name;
|
||||
u64 block = start_block;
|
||||
vfsHDD_Entry entry;
|
||||
|
||||
|
@ -768,7 +772,7 @@ public:
|
|||
|
||||
if(entry.type == vfsHDD_Entry_Dir && name != "." && name != "..")
|
||||
{
|
||||
ConLog.Warning("Removing sub folder '%s'", name.wx_str());
|
||||
ConLog.Warning("Removing sub folder '%s'", name.c_str());
|
||||
RemoveBlocksDir(entry.data_block);
|
||||
}
|
||||
else if(entry.type == vfsHDD_Entry_File)
|
||||
|
@ -794,7 +798,7 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
bool RemoveEntry(const wxString& name)
|
||||
bool RemoveEntry(const std::string& name)
|
||||
{
|
||||
u64 entry_block, parent_entry;
|
||||
if(!SearchEntry(name, entry_block, &parent_entry))
|
||||
|
@ -824,7 +828,7 @@ public:
|
|||
return true;
|
||||
}
|
||||
|
||||
virtual bool Create(const wxString& path)
|
||||
virtual bool Create(const std::string& path)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -400,27 +400,27 @@ public:
|
|||
*(T*)GetMemFromAddr(addr) = data;
|
||||
}
|
||||
|
||||
wxString ReadString(const u64 addr, const u64 len)
|
||||
std::string ReadString(const u64 addr, const u64 len)
|
||||
{
|
||||
wxString ret(GetMemFromAddr(addr), wxConvUTF8,len);
|
||||
std::string ret((const char *)GetMemFromAddr(addr), len);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
wxString ReadString(const u64 addr)
|
||||
std::string ReadString(const u64 addr)
|
||||
{
|
||||
return wxString((const char*)GetMemFromAddr(addr), wxConvUTF8);
|
||||
return std::string((const char*)GetMemFromAddr(addr));
|
||||
}
|
||||
|
||||
void WriteString(const u64 addr, const wxString& str)
|
||||
void WriteString(const u64 addr, const std::string& str)
|
||||
{
|
||||
if(!IsGoodAddr(addr, str.Len()))
|
||||
if(!IsGoodAddr(addr, str.length()))
|
||||
{
|
||||
ConLog.Error("Memory::WriteString error: bad address (0x%llx)", addr);
|
||||
return;
|
||||
}
|
||||
|
||||
strcpy((char*)GetMemFromAddr(addr), str);
|
||||
strcpy((char*)GetMemFromAddr(addr), str.c_str());
|
||||
}
|
||||
|
||||
static u64 AlignAddr(const u64 addr, const u64 align)
|
||||
|
@ -488,7 +488,7 @@ public:
|
|||
u8* operator + (const u64 vaddr)
|
||||
{
|
||||
u8* ret = GetMemFromAddr(vaddr);
|
||||
if(!ret) throw wxString::Format("GetMemFromAddr(0x%llx)", vaddr);
|
||||
if(!ret) throw fmt::Format("GetMemFromAddr(0x%llx)", vaddr);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -407,57 +407,57 @@ void Module::SetName(const std::string& name)
|
|||
m_name = name;
|
||||
}
|
||||
|
||||
void Module::Log(const u32 id, wxString fmt, ...)
|
||||
void Module::Log(const u32 id, std::string fmt, ...)
|
||||
{
|
||||
if(Ini.HLELogging.GetValue())
|
||||
{
|
||||
va_list list;
|
||||
va_start(list, fmt);
|
||||
ConLog.Write(GetName() + wxString::Format("[%d]: ", id).wx_str() + wxString::FormatV(fmt, list).wx_str());
|
||||
ConLog.Write(GetName() + fmt::Format("[%d]: ", id) + fmt::FormatV(fmt, list));
|
||||
va_end(list);
|
||||
}
|
||||
}
|
||||
|
||||
void Module::Log(wxString fmt, ...)
|
||||
void Module::Log(std::string fmt, ...)
|
||||
{
|
||||
if(Ini.HLELogging.GetValue())
|
||||
{
|
||||
va_list list;
|
||||
va_start(list, fmt);
|
||||
ConLog.Write(GetName() + ": " + wxString::FormatV(fmt, list).wx_str());
|
||||
ConLog.Write(GetName() + ": " + fmt::FormatV(fmt, list));
|
||||
va_end(list);
|
||||
}
|
||||
}
|
||||
|
||||
void Module::Warning(const u32 id, wxString fmt, ...)
|
||||
void Module::Warning(const u32 id, std::string fmt, ...)
|
||||
{
|
||||
va_list list;
|
||||
va_start(list, fmt);
|
||||
ConLog.Warning(GetName() + wxString::Format("[%d] warning: ", id).wx_str() + wxString::FormatV(fmt, list).wx_str());
|
||||
ConLog.Warning(GetName() + fmt::Format("[%d] warning: ", id) + fmt::FormatV(fmt, list));
|
||||
va_end(list);
|
||||
}
|
||||
|
||||
void Module::Warning(wxString fmt, ...)
|
||||
void Module::Warning(std::string fmt, ...)
|
||||
{
|
||||
va_list list;
|
||||
va_start(list, fmt);
|
||||
ConLog.Warning(GetName() + " warning: " + wxString::FormatV(fmt, list).wx_str());
|
||||
ConLog.Warning(GetName() + " warning: " + fmt::FormatV(fmt, list));
|
||||
va_end(list);
|
||||
}
|
||||
|
||||
void Module::Error(const u32 id, wxString fmt, ...)
|
||||
void Module::Error(const u32 id, std::string fmt, ...)
|
||||
{
|
||||
va_list list;
|
||||
va_start(list, fmt);
|
||||
ConLog.Error(GetName() + wxString::Format("[%d] error: ", id).wx_str() + wxString::FormatV(fmt, list).wx_str());
|
||||
ConLog.Error(GetName() + fmt::Format("[%d] error: ", id) + fmt::FormatV(fmt, list));
|
||||
va_end(list);
|
||||
}
|
||||
|
||||
void Module::Error(wxString fmt, ...)
|
||||
void Module::Error(std::string fmt, ...)
|
||||
{
|
||||
va_list list;
|
||||
va_start(list, fmt);
|
||||
ConLog.Error(GetName() + " error: " + wxString::FormatV(fmt, list).wx_str());
|
||||
ConLog.Error(GetName() + " error: " + fmt::FormatV(fmt, list));
|
||||
va_end(list);
|
||||
}
|
||||
|
||||
|
|
|
@ -71,14 +71,15 @@ public:
|
|||
void SetName(const std::string& name);
|
||||
|
||||
public:
|
||||
void Log(const u32 id, wxString fmt, ...);
|
||||
void Log(wxString fmt, ...);
|
||||
//TODO: use variadic function templates here to be able to use string references and forward all arguments without copying
|
||||
void Log(const u32 id, std::string fmt, ...);
|
||||
void Log(std::string fmt, ...);
|
||||
|
||||
void Warning(const u32 id, wxString fmt, ...);
|
||||
void Warning(wxString fmt, ...);
|
||||
void Warning(const u32 id, std::string fmt, ...);
|
||||
void Warning(std::string fmt, ...);
|
||||
|
||||
void Error(const u32 id, wxString fmt, ...);
|
||||
void Error(wxString fmt, ...);
|
||||
void Error(const u32 id, std::string fmt, ...);
|
||||
void Error(std::string fmt, ...);
|
||||
|
||||
bool CheckID(u32 id) const;
|
||||
template<typename T> bool CheckId(u32 id, T*& data)
|
||||
|
|
|
@ -308,9 +308,9 @@ int cellFontOpenFontMemory(mem_ptr_t<CellFontLibrary> library, u32 fontAddr, u32
|
|||
|
||||
int cellFontOpenFontFile(mem_ptr_t<CellFontLibrary> library, mem8_ptr_t fontPath, u32 subNum, s32 uniqueId, mem_ptr_t<CellFont> font)
|
||||
{
|
||||
wxString fp = fontPath.GetString();
|
||||
std::string fp(fontPath.GetString());
|
||||
cellFont.Warning("cellFontOpenFontFile(library_addr=0x%x, fontPath=\"%s\", subNum=%d, uniqueId=%d, font_addr=0x%x)",
|
||||
library.GetAddr(), fp.wx_str(), subNum, uniqueId, font.GetAddr());
|
||||
library.GetAddr(), fp.c_str(), subNum, uniqueId, font.GetAddr());
|
||||
|
||||
vfsFile f(fp);
|
||||
if (!f.IsOpened())
|
||||
|
|
|
@ -305,9 +305,9 @@ int cellGameContentErrorDialog(s32 type, s32 errNeedSizeKB, u32 dirName_addr)
|
|||
default: return CELL_GAME_ERROR_PARAM;
|
||||
}
|
||||
|
||||
std::string errorMsg = wxString::Format("%s\nSpace needed: %d KB\nDirectory name: %s",
|
||||
wxString(errorName).wx_str(), errNeedSizeKB, wxString(dirName).wx_str()).ToStdString();
|
||||
wxMessageBox(errorMsg, wxGetApp().GetAppName(), wxICON_ERROR | wxOK);
|
||||
std::string errorMsg = fmt::Format("%s\nSpace needed: %d KB\nDirectory name: %s",
|
||||
errorName.c_str(), errNeedSizeKB, dirName);
|
||||
wxMessageBox(fmt::FromUTF8(errorMsg), wxGetApp().GetAppName(), wxICON_ERROR | wxOK);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ int jstrchk(mem8_ptr_t jstr)
|
|||
if (!jstr.IsGood())
|
||||
cellL10n.Error("jstrchk(jstr_addr=0x%x): invalid address", jstr.GetAddr());
|
||||
else if (jstr[0])
|
||||
cellL10n.Log("jstrchk(jstr_addr=0x%x): utf-8: [%s]", jstr.GetAddr(), Memory.ReadString(jstr.GetAddr()).wx_str());
|
||||
cellL10n.Log("jstrchk(jstr_addr=0x%x): utf-8: [%s]", jstr.GetAddr(), Memory.ReadString(jstr.GetAddr()).c_str());
|
||||
else
|
||||
cellL10n.Log("jstrchk(jstr_addr=0x%x): empty string", jstr.GetAddr());
|
||||
|
||||
|
|
|
@ -78,7 +78,7 @@ int cellRtcFormatRfc2822(u32 rfc_addr, u32 tick_addr, int time_zone)
|
|||
date.Add(tz);
|
||||
|
||||
// Format date string in RFC2822 format (e.g.: Mon, 01 Jan 1990 12:00:00 +0000).
|
||||
const wxString& str = date.Format("%a, %d %b %Y %T %z", wxDateTime::TZ::UTC);
|
||||
const std::string& str = fmt::ToUTF8(date.Format("%a, %d %b %Y %T %z", wxDateTime::TZ::UTC));
|
||||
Memory.WriteString(rfc_addr, str);
|
||||
|
||||
return CELL_OK;
|
||||
|
@ -94,7 +94,7 @@ int cellRtcFormatRfc2822LocalTime(u32 rfc_addr, u32 tick_addr)
|
|||
wxDateTime date = wxDateTime::wxDateTime((time_t)current_tick.tick);
|
||||
|
||||
// Format date string in RFC2822 format (e.g.: Mon, 01 Jan 1990 12:00:00 +0000).
|
||||
const wxString& str = date.Format("%a, %d %b %Y %T %z", wxDateTime::TZ::Local);
|
||||
const std::string& str = fmt::ToUTF8(date.Format("%a, %d %b %Y %T %z", wxDateTime::TZ::Local));
|
||||
Memory.WriteString(rfc_addr, str);
|
||||
|
||||
return CELL_OK;
|
||||
|
@ -114,7 +114,7 @@ int cellRtcFormatRfc3339(u32 rfc_addr, u32 tick_addr, int time_zone)
|
|||
date.Add(tz);
|
||||
|
||||
// Format date string in RFC3339 format (e.g.: 1990-01-01T12:00:00.00Z).
|
||||
const wxString& str = date.Format("%FT%T.%zZ", wxDateTime::TZ::UTC);
|
||||
const std::string& str = fmt::ToUTF8(date.Format("%FT%T.%zZ", wxDateTime::TZ::UTC));
|
||||
Memory.WriteString(rfc_addr, str);
|
||||
|
||||
return CELL_OK;
|
||||
|
@ -130,7 +130,7 @@ int cellRtcFormatRfc3339LocalTime(u32 rfc_addr, u32 tick_addr)
|
|||
wxDateTime date = wxDateTime::wxDateTime((time_t)current_tick.tick);
|
||||
|
||||
// Format date string in RFC3339 format (e.g.: 1990-01-01T12:00:00.00Z).
|
||||
const wxString& str = date.Format("%FT%T.%zZ", wxDateTime::TZ::Local);
|
||||
const std::string& str = fmt::ToUTF8(date.Format("%FT%T.%zZ", wxDateTime::TZ::Local));
|
||||
Memory.WriteString(rfc_addr, str);
|
||||
|
||||
return CELL_OK;
|
||||
|
@ -140,11 +140,11 @@ int cellRtcParseDateTime(mem64_t tick, u32 datetime_addr)
|
|||
{
|
||||
cellRtc.Log("cellRtcParseDateTime(tick_addr=0x%x, datetime_addr=0x%x)", tick.GetAddr(), datetime_addr);
|
||||
|
||||
const wxString& format = Memory.ReadString(datetime_addr);
|
||||
const std::string& format = Memory.ReadString(datetime_addr);
|
||||
|
||||
// Get date from formatted string.
|
||||
wxDateTime date;
|
||||
date.ParseDateTime(format);
|
||||
date.ParseDateTime(fmt::FromUTF8(format));
|
||||
|
||||
tick = date.GetTicks();
|
||||
|
||||
|
@ -155,11 +155,11 @@ int cellRtcParseRfc3339(mem64_t tick, u32 datetime_addr)
|
|||
{
|
||||
cellRtc.Log("cellRtcParseRfc3339(tick_addr=0x%x, datetime_addr=0x%x)", tick.GetAddr(), datetime_addr);
|
||||
|
||||
const wxString& format = Memory.ReadString(datetime_addr);
|
||||
const std::string& format = Memory.ReadString(datetime_addr);
|
||||
|
||||
// Get date from RFC3339 formatted string.
|
||||
wxDateTime date;
|
||||
date.ParseDateTime(format);
|
||||
date.ParseDateTime(fmt::FromUTF8(format));
|
||||
|
||||
tick = date.GetTicks();
|
||||
|
||||
|
|
|
@ -95,7 +95,7 @@ int cellSpursAttributeSetNamePrefix(mem_ptr_t<CellSpursAttribute> attr, const me
|
|||
if(size > 15)
|
||||
return CELL_SPURS_CORE_ERROR_INVAL;
|
||||
|
||||
attr->attr->_setNamePrefix(Memory.ReadString(prefix.GetAddr(), size), size);
|
||||
attr->attr->_setNamePrefix(Memory.ReadString(prefix.GetAddr(), size).c_str(), size);
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
|
|
@ -162,7 +162,7 @@ int cellSysmoduleLoadModule(u16 id)
|
|||
{
|
||||
cellSysmodule.Error("cellSysmoduleLoadModule: TODO: CELL_SYSMODULE_LIBATRAC3MULTI");
|
||||
}
|
||||
cellSysmodule.Warning("cellSysmoduleLoadModule(%s)", wxString(getModuleName(id)).wx_str());
|
||||
cellSysmodule.Warning("cellSysmoduleLoadModule(%s)", getModuleName(id));
|
||||
Module* m = GetModuleById(id);
|
||||
|
||||
if(!m)
|
||||
|
@ -181,7 +181,7 @@ int cellSysmoduleLoadModule(u16 id)
|
|||
|
||||
int cellSysmoduleUnloadModule(u16 id)
|
||||
{
|
||||
cellSysmodule.Warning("cellSysmoduleUnloadModule(%s)", wxString(getModuleName(id)).wx_str());
|
||||
cellSysmodule.Warning("cellSysmoduleUnloadModule(%s)", getModuleName(id));
|
||||
Module* m = GetModuleById(id);
|
||||
|
||||
if(!m)
|
||||
|
@ -200,7 +200,7 @@ int cellSysmoduleUnloadModule(u16 id)
|
|||
|
||||
int cellSysmoduleIsLoaded(u16 id)
|
||||
{
|
||||
cellSysmodule.Warning("cellSysmoduleIsLoaded(%s)", wxString(getModuleName(id)).wx_str());
|
||||
cellSysmodule.Warning("cellSysmoduleIsLoaded(%s)", getModuleName(id));
|
||||
Module* m = GetModuleById(id);
|
||||
|
||||
if(!m)
|
||||
|
|
|
@ -794,7 +794,7 @@ public:
|
|||
virtual wxDirTraverseResult OnFile(const wxString& filename)
|
||||
{
|
||||
if (!wxRemoveFile(filename)){
|
||||
cellSysutil.Error("Couldn't delete File: %s", filename.wx_str());
|
||||
cellSysutil.Error("Couldn't delete File: %s", fmt::ToUTF8(filename).c_str());
|
||||
}
|
||||
return wxDIR_CONTINUE;
|
||||
}
|
||||
|
@ -816,11 +816,13 @@ int cellSysCacheClear(void)
|
|||
//if some software expects CELL_SYSCACHE_ERROR_NOTMOUNTED we need to check whether
|
||||
//it was mounted before, for that we would need to save the state which I don't know
|
||||
//where to put
|
||||
wxString localPath;
|
||||
Emu.GetVFS().GetDevice(wxString("/dev_hdd1/cache/"), localPath);
|
||||
if (wxDirExists(localPath)){
|
||||
std::string localPath;
|
||||
Emu.GetVFS().GetDevice(std::string("/dev_hdd1/cache/"), localPath);
|
||||
|
||||
//TODO: replace wxWidgetsSpecific filesystem stuff
|
||||
if (wxDirExists(fmt::FromUTF8(localPath))){
|
||||
WxDirDeleteTraverser deleter;
|
||||
wxString f = wxFindFirstFile(localPath+"\\*",wxDIR);
|
||||
wxString f = wxFindFirstFile(fmt::FromUTF8(localPath+"\\*"),wxDIR);
|
||||
while (!f.empty())
|
||||
{
|
||||
wxDir dir(f);
|
||||
|
@ -840,7 +842,8 @@ int cellSysCacheMount(mem_ptr_t<CellSysCacheParam> param)
|
|||
char id[CELL_SYSCACHE_ID_SIZE];
|
||||
strncpy(id, param->cacheId, CELL_SYSCACHE_ID_SIZE);
|
||||
strncpy(param->getCachePath, ("/dev_hdd1/cache/" + std::string(id) + "/").c_str(), CELL_SYSCACHE_PATH_MAX);
|
||||
Emu.GetVFS().CreateDir(wxString(param->getCachePath));
|
||||
param->getCachePath[CELL_SYSCACHE_PATH_MAX - 1] = '\0';
|
||||
Emu.GetVFS().CreateDir(std::string(param->getCachePath));
|
||||
|
||||
return CELL_SYSCACHE_RET_OK_RELAYED;
|
||||
}
|
||||
|
@ -853,7 +856,7 @@ int cellHddGameCheck(u32 version, u32 dirName_addr, u32 errDialog, mem_func_ptr_
|
|||
if (!Memory.IsGoodAddr(dirName_addr) || !funcStat.IsGood())
|
||||
return CELL_HDDGAME_ERROR_PARAM;
|
||||
|
||||
std::string dirName = Memory.ReadString(dirName_addr).ToStdString();
|
||||
std::string dirName = Memory.ReadString(dirName_addr);
|
||||
if (dirName.size() != 9)
|
||||
return CELL_HDDGAME_ERROR_PARAM;
|
||||
|
||||
|
@ -890,14 +893,17 @@ int cellHddGameCheck(u32 version, u32 dirName_addr, u32 errDialog, mem_func_ptr_
|
|||
get->getParam.attribute = psf.GetInteger("ATTRIBUTE");
|
||||
get->getParam.resolution = psf.GetInteger("RESOLUTION");
|
||||
get->getParam.soundFormat = psf.GetInteger("SOUND_FORMAT");
|
||||
memcpy(get->getParam.title, psf.GetString("TITLE"), CELL_HDDGAME_SYSP_TITLE_SIZE);
|
||||
memcpy(get->getParam.dataVersion, psf.GetString("APP_VER"), CELL_HDDGAME_SYSP_VERSION_SIZE);
|
||||
memcpy(get->getParam.titleId, dirName.c_str(), CELL_HDDGAME_SYSP_TITLEID_SIZE);
|
||||
std::string title = psf.GetString("TITLE");
|
||||
memcpy(get->getParam.title, title.c_str(), min<size_t>(CELL_HDDGAME_SYSP_TITLE_SIZE,title.length()+1));
|
||||
std::string app_ver = psf.GetString("APP_VER");
|
||||
memcpy(get->getParam.dataVersion, app_ver.c_str(), min<size_t>(CELL_HDDGAME_SYSP_VERSION_SIZE,app_ver.length()+1));
|
||||
memcpy(get->getParam.titleId, dirName.c_str(), min<size_t>(CELL_HDDGAME_SYSP_TITLEID_SIZE,dirName.length()+1));
|
||||
|
||||
for (u32 i=0; i<CELL_HDDGAME_SYSP_LANGUAGE_NUM; i++) {
|
||||
char key [16];
|
||||
sprintf(key, "TITLE_%02d", i);
|
||||
memcpy(get->getParam.titleLang[i], psf.GetString(key), CELL_HDDGAME_SYSP_TITLE_SIZE);
|
||||
title = psf.GetString(key);
|
||||
memcpy(get->getParam.titleLang[i], title.c_str(), min<size_t>(CELL_HDDGAME_SYSP_TITLE_SIZE, title.length() + 1));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -65,7 +65,7 @@ void addSaveDataEntry(std::vector<SaveDataListEntry>& saveEntries, const std::st
|
|||
return;
|
||||
|
||||
// PNG icon
|
||||
wxString localPath;
|
||||
std::string localPath;
|
||||
int width, height, actual_components;
|
||||
Emu.GetVFS().GetDevice(saveDir + "/ICON0.PNG", localPath);
|
||||
|
||||
|
@ -79,7 +79,7 @@ void addSaveDataEntry(std::vector<SaveDataListEntry>& saveEntries, const std::st
|
|||
saveEntry.st_atime_ = 0; // TODO
|
||||
saveEntry.st_mtime_ = 0; // TODO
|
||||
saveEntry.st_ctime_ = 0; // TODO
|
||||
saveEntry.iconBuf = stbi_load(localPath.mb_str(), &width, &height, &actual_components, 3);
|
||||
saveEntry.iconBuf = stbi_load(localPath.c_str(), &width, &height, &actual_components, 3);
|
||||
saveEntry.iconBufSize = width * height * 3;
|
||||
saveEntry.isNew = false;
|
||||
|
||||
|
@ -147,11 +147,11 @@ int cellSaveDataListSave2(u32 version, mem_ptr_t<CellSaveDataSetList> setList, m
|
|||
if(!dir.IsOpened())
|
||||
return CELL_SAVEDATA_ERROR_INTERNAL;
|
||||
|
||||
std::string dirNamePrefix = std::string(Memory.ReadString(setList->dirNamePrefix_addr).mb_str());
|
||||
std::string dirNamePrefix = Memory.ReadString(setList->dirNamePrefix_addr);
|
||||
std::vector<SaveDataListEntry> saveEntries;
|
||||
for(const DirEntryInfo* entry = dir.Read(); entry; entry = dir.Read())
|
||||
{
|
||||
if (entry->flags & DirEntry_TypeDir || entry->name.Left(dirNamePrefix.size()) == dirNamePrefix)
|
||||
if (entry->flags & DirEntry_TypeDir || entry->name.substr(0,dirNamePrefix.size()) == dirNamePrefix)
|
||||
{
|
||||
// Count the amount of matches and the amount of listed directories
|
||||
listGet->dirListNum++;
|
||||
|
@ -159,7 +159,7 @@ int cellSaveDataListSave2(u32 version, mem_ptr_t<CellSaveDataSetList> setList, m
|
|||
continue;
|
||||
listGet->dirNum++;
|
||||
|
||||
std::string saveDir = saveBaseDir + (const char*)(entry->name.mb_str());
|
||||
std::string saveDir = saveBaseDir + entry->name;
|
||||
addSaveDataEntry(saveEntries, saveDir);
|
||||
}
|
||||
}
|
||||
|
@ -210,11 +210,11 @@ int cellSaveDataListLoad2(u32 version, mem_ptr_t<CellSaveDataSetList> setList, m
|
|||
if(!dir.IsOpened())
|
||||
return CELL_SAVEDATA_ERROR_INTERNAL;
|
||||
|
||||
std::string dirNamePrefix = std::string(Memory.ReadString(setList->dirNamePrefix_addr).mb_str());
|
||||
std::string dirNamePrefix = Memory.ReadString(setList->dirNamePrefix_addr);
|
||||
std::vector<SaveDataListEntry> saveEntries;
|
||||
for(const DirEntryInfo* entry = dir.Read(); entry; entry = dir.Read())
|
||||
{
|
||||
if (entry->flags & DirEntry_TypeDir || entry->name.Left(dirNamePrefix.size()) == dirNamePrefix)
|
||||
if (entry->flags & DirEntry_TypeDir || entry->name.substr(0,dirNamePrefix.size()) == dirNamePrefix)
|
||||
{
|
||||
// Count the amount of matches and the amount of listed directories
|
||||
listGet->dirListNum++;
|
||||
|
@ -222,7 +222,7 @@ int cellSaveDataListLoad2(u32 version, mem_ptr_t<CellSaveDataSetList> setList, m
|
|||
continue;
|
||||
listGet->dirNum++;
|
||||
|
||||
std::string saveDir = saveBaseDir + (const char*)(entry->name.mb_str());
|
||||
std::string saveDir = saveBaseDir + entry->name;
|
||||
addSaveDataEntry(saveEntries, saveDir);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ int sceNpDrmIsAvailable(u32 k_licensee_addr, u32 drm_path_addr)
|
|||
{
|
||||
sceNp.Warning("sceNpDrmIsAvailable(k_licensee_addr=0x%x, drm_path_addr=0x%x)", k_licensee_addr, drm_path_addr);
|
||||
|
||||
wxString drm_path = Memory.ReadString(drm_path_addr);
|
||||
wxString drm_path = fmt::FromUTF8(Memory.ReadString(drm_path_addr));
|
||||
wxString k_licensee_str;
|
||||
u8 k_licensee[0x10];
|
||||
for(int i = 0; i < 0x10; i++)
|
||||
|
@ -32,8 +32,8 @@ int sceNpDrmIsAvailable(u32 k_licensee_addr, u32 drm_path_addr)
|
|||
k_licensee_str += wxString::Format("%02x", k_licensee[i]);
|
||||
}
|
||||
|
||||
sceNp.Warning("sceNpDrmIsAvailable: Found DRM license file at %s", drm_path.wx_str());
|
||||
sceNp.Warning("sceNpDrmIsAvailable: Using k_licensee 0x%s", k_licensee_str.wx_str());
|
||||
sceNp.Warning("sceNpDrmIsAvailable: Found DRM license file at %s", fmt::ToUTF8(drm_path).c_str());
|
||||
sceNp.Warning("sceNpDrmIsAvailable: Using k_licensee 0x%s", fmt::ToUTF8(k_licensee_str).c_str());
|
||||
|
||||
// Set the necessary file paths.
|
||||
wxString drm_file_name = drm_path.AfterLast('/');
|
||||
|
@ -46,7 +46,7 @@ int sceNpDrmIsAvailable(u32 k_licensee_addr, u32 drm_path_addr)
|
|||
wxString rap_file_path = rap_dir_path;
|
||||
|
||||
// Search dev_usb000 for a compatible RAP file.
|
||||
vfsDir *raps_dir = new vfsDir(rap_dir_path);
|
||||
vfsDir *raps_dir = new vfsDir(fmt::ToUTF8(rap_dir_path));
|
||||
if (!raps_dir->IsOpened())
|
||||
sceNp.Warning("sceNpDrmIsAvailable: Can't find RAP file for DRM!");
|
||||
else
|
||||
|
@ -54,9 +54,9 @@ int sceNpDrmIsAvailable(u32 k_licensee_addr, u32 drm_path_addr)
|
|||
Array<DirEntryInfo> entries = raps_dir->GetEntries();
|
||||
for (unsigned int i = 0; i < entries.GetCount(); i++)
|
||||
{
|
||||
if (entries[i].name.Contains(titleID))
|
||||
if (entries[i].name.find(fmt::ToUTF8(titleID)) != std::string::npos )
|
||||
{
|
||||
rap_file_path += entries[i].name;
|
||||
rap_file_path += fmt::FromUTF8(entries[i].name);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ int sceNpDrmIsAvailable(u32 k_licensee_addr, u32 drm_path_addr)
|
|||
wxMkdir(wxGetCwd() + "/dev_hdd1/" + titleID);
|
||||
|
||||
// Decrypt this EDAT using the supplied k_licensee and matching RAP file.
|
||||
DecryptEDAT(enc_drm_path.ToStdString(), dec_drm_path.ToStdString(), 8, rap_file_path.ToStdString(), k_licensee, false);
|
||||
DecryptEDAT(fmt::ToUTF8(enc_drm_path), fmt::ToUTF8(dec_drm_path), 8, fmt::ToUTF8(rap_file_path), k_licensee, false);
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
#include "Loader/TROPUSR.h"
|
||||
#include "Emu/SysCalls/lv2/SC_Time.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
void sceNpTrophy_unload();
|
||||
void sceNpTrophy_init();
|
||||
Module sceNpTrophy(0xf035, sceNpTrophy_init, nullptr, sceNpTrophy_unload);
|
||||
|
@ -225,25 +227,25 @@ int sceNpTrophyGetGameInfo(u32 context, u32 handle, mem_ptr_t<SceNpTrophyGameDet
|
|||
return SCE_NP_TROPHY_ERROR_INVALID_ARGUMENT;
|
||||
// TODO: There are other possible errors
|
||||
|
||||
wxString path;
|
||||
std::string path;
|
||||
wxXmlDocument doc;
|
||||
sceNpTrophyInternalContext& ctxt = s_npTrophyInstance.contexts[context];
|
||||
Emu.GetVFS().GetDevice("/dev_hdd0/home/00000001/trophy/" + ctxt.trp_name + "/TROPCONF.SFM", path); // TODO: Get the path of the current user
|
||||
doc.Load(path);
|
||||
doc.Load(fmt::FromUTF8(path));
|
||||
|
||||
std::string titleName;
|
||||
std::string titleDetail;
|
||||
for (wxXmlNode *n = doc.GetRoot()->GetChildren(); n; n = n->GetNext()) {
|
||||
if (n->GetName() == "title-name")
|
||||
titleName = n->GetNodeContent().mb_str();
|
||||
titleName = fmt::ToUTF8(n->GetNodeContent());
|
||||
if (n->GetName() == "title-detail")
|
||||
titleDetail = n->GetNodeContent().mb_str();
|
||||
titleDetail = fmt::ToUTF8(n->GetNodeContent());
|
||||
if (n->GetName() == "trophy")
|
||||
{
|
||||
u32 trophy_id = atoi(n->GetAttribute("id").mb_str());
|
||||
u32 trophy_id = atoi(fmt::ToUTF8(n->GetAttribute("id")).c_str());
|
||||
|
||||
details->numTrophies++;
|
||||
switch (((const char *)n->GetAttribute("ttype").mb_str())[0]) {
|
||||
switch (fmt::ToUTF8(n->GetAttribute("ttype"))[0]) {
|
||||
case 'B': details->numBronze++; break;
|
||||
case 'S': details->numSilver++; break;
|
||||
case 'G': details->numGold++; break;
|
||||
|
@ -253,7 +255,7 @@ int sceNpTrophyGetGameInfo(u32 context, u32 handle, mem_ptr_t<SceNpTrophyGameDet
|
|||
if (ctxt.tropusr->GetTrophyUnlockState(trophy_id))
|
||||
{
|
||||
data->unlockedTrophies++;
|
||||
switch (((const char *)n->GetAttribute("ttype").mb_str())[0]) {
|
||||
switch (fmt::ToUTF8(n->GetAttribute("ttype"))[0]) {
|
||||
case 'B': data->unlockedBronze++; break;
|
||||
case 'S': data->unlockedSilver++; break;
|
||||
case 'G': data->unlockedGold++; break;
|
||||
|
@ -263,8 +265,8 @@ int sceNpTrophyGetGameInfo(u32 context, u32 handle, mem_ptr_t<SceNpTrophyGameDet
|
|||
}
|
||||
}
|
||||
|
||||
memcpy(details->title, titleName.c_str(), SCE_NP_TROPHY_NAME_MAX_SIZE);
|
||||
memcpy(details->description, titleDetail.c_str(), SCE_NP_TROPHY_DESCR_MAX_SIZE);
|
||||
memcpy(details->title, titleName.c_str(), std::min((size_t) SCE_NP_TROPHY_NAME_MAX_SIZE, titleName.length() + 1));
|
||||
memcpy(details->description, titleDetail.c_str(), std::min((size_t) SCE_NP_TROPHY_DESCR_MAX_SIZE, titleDetail.length() + 1));
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
|
@ -352,33 +354,33 @@ int sceNpTrophyGetTrophyInfo(u32 context, u32 handle, s32 trophyId, mem_ptr_t<Sc
|
|||
return SCE_NP_TROPHY_ERROR_INVALID_ARGUMENT;
|
||||
// TODO: There are other possible errors
|
||||
|
||||
wxString path;
|
||||
std::string path;
|
||||
wxXmlDocument doc;
|
||||
sceNpTrophyInternalContext& ctxt = s_npTrophyInstance.contexts[context];
|
||||
Emu.GetVFS().GetDevice("/dev_hdd0/home/00000001/trophy/" + ctxt.trp_name + "/TROPCONF.SFM", path); // TODO: Get the path of the current user
|
||||
doc.Load(path);
|
||||
doc.Load(fmt::FromUTF8(path));
|
||||
|
||||
std::string name;
|
||||
std::string detail;
|
||||
for (wxXmlNode *n = doc.GetRoot()->GetChildren(); n; n = n->GetNext()) {
|
||||
if (n->GetName() == "trophy" && (trophyId == atoi(n->GetAttribute("id").mb_str())))
|
||||
if (n->GetName() == "trophy" && (trophyId == atoi(fmt::ToUTF8(n->GetAttribute("id")).c_str())))
|
||||
{
|
||||
details->trophyId = trophyId;
|
||||
switch (((const char *)n->GetAttribute("ttype").mb_str())[0]) {
|
||||
switch (fmt::ToUTF8(n->GetAttribute("ttype"))[0]) {
|
||||
case 'B': details->trophyGrade = SCE_NP_TROPHY_GRADE_BRONZE; break;
|
||||
case 'S': details->trophyGrade = SCE_NP_TROPHY_GRADE_SILVER; break;
|
||||
case 'G': details->trophyGrade = SCE_NP_TROPHY_GRADE_GOLD; break;
|
||||
case 'P': details->trophyGrade = SCE_NP_TROPHY_GRADE_PLATINUM; break;
|
||||
}
|
||||
|
||||
switch (((const char *)n->GetAttribute("ttype").mb_str())[0]) {
|
||||
switch (fmt::ToUTF8(n->GetAttribute("ttype"))[0]) {
|
||||
case 'y': details->hidden = true; break;
|
||||
case 'n': details->hidden = false; break;
|
||||
}
|
||||
|
||||
for (wxXmlNode *n2 = n->GetChildren(); n2; n2 = n2->GetNext()) {
|
||||
if (n2->GetName() == "name") name = n2->GetNodeContent().mb_str();
|
||||
if (n2->GetName() == "detail") detail = n2->GetNodeContent().mb_str();
|
||||
if (n2->GetName() == "name") name = fmt::ToUTF8(n2->GetNodeContent());
|
||||
if (n2->GetName() == "detail") detail = fmt::ToUTF8(n2->GetNodeContent());
|
||||
}
|
||||
|
||||
data->trophyId = trophyId;
|
||||
|
@ -387,8 +389,8 @@ int sceNpTrophyGetTrophyInfo(u32 context, u32 handle, s32 trophyId, mem_ptr_t<Sc
|
|||
}
|
||||
}
|
||||
|
||||
memcpy(details->name, name.c_str(), SCE_NP_TROPHY_NAME_MAX_SIZE);
|
||||
memcpy(details->description, detail.c_str(), SCE_NP_TROPHY_DESCR_MAX_SIZE);
|
||||
memcpy(details->name, name.c_str(), std::min((size_t) SCE_NP_TROPHY_NAME_MAX_SIZE, name.length() + 1));
|
||||
memcpy(details->description, detail.c_str(), std::min((size_t) SCE_NP_TROPHY_DESCR_MAX_SIZE, detail.length() + 1));
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -54,9 +54,9 @@ s64 sys_prx_exitspawn_with_level()
|
|||
|
||||
s64 sys_strlen(u32 addr)
|
||||
{
|
||||
const wxString& str = Memory.ReadString(addr);
|
||||
sysPrxForUser.Log("sys_strlen(0x%x - \"%s\")", addr, str.wx_str());
|
||||
return str.Len();
|
||||
const std::string& str = Memory.ReadString(addr);
|
||||
sysPrxForUser.Log("sys_strlen(0x%x - \"%s\")", addr, str.c_str());
|
||||
return str.length();
|
||||
}
|
||||
|
||||
int sys_spu_elf_get_information(u32 elf_img, mem32_t entry, mem32_t nseg)
|
||||
|
@ -100,14 +100,14 @@ int sys_spu_image_close(mem_ptr_t<sys_spu_image> img)
|
|||
|
||||
int sys_raw_spu_load(int id, u32 path_addr, mem32_t entry)
|
||||
{
|
||||
const wxString path = Memory.ReadString(path_addr).wx_str();
|
||||
const std::string path = Memory.ReadString(path_addr);
|
||||
sysPrxForUser.Warning("sys_raw_spu_load(id=0x%x, path=0x%x [%s], entry_addr=0x%x)",
|
||||
id, path_addr, path.wx_str(), entry.GetAddr());
|
||||
id, path_addr, path.c_str(), entry.GetAddr());
|
||||
|
||||
vfsFile f(path);
|
||||
if(!f.IsOpened())
|
||||
{
|
||||
sysPrxForUser.Error("sys_raw_spu_load error: '%s' not found!", path.wx_str());
|
||||
sysPrxForUser.Error("sys_raw_spu_load error: '%s' not found!", path.c_str());
|
||||
return CELL_ENOENT;
|
||||
}
|
||||
|
||||
|
|
|
@ -31,20 +31,20 @@ bool sdata_check(u32 version, u32 flags, u64 filesizeInput, u64 filesizeTmp)
|
|||
return true;
|
||||
}
|
||||
|
||||
int sdata_unpack(wxString packed_file, wxString unpacked_file)
|
||||
int sdata_unpack(const std::string& packed_file, const std::string& unpacked_file)
|
||||
{
|
||||
std::shared_ptr<vfsFileBase> packed_stream(Emu.GetVFS().OpenFile(packed_file, vfsRead));
|
||||
std::shared_ptr<vfsFileBase> unpacked_stream(Emu.GetVFS().OpenFile(unpacked_file, vfsWrite));
|
||||
|
||||
if(!packed_stream || !packed_stream->IsOpened())
|
||||
{
|
||||
sys_fs.Error("'%s' not found! flags: 0x%08x", packed_file.wx_str(), vfsRead);
|
||||
sys_fs.Error("'%s' not found! flags: 0x%08x", packed_file.c_str(), vfsRead);
|
||||
return CELL_ENOENT;
|
||||
}
|
||||
|
||||
if(!unpacked_stream || !unpacked_stream->IsOpened())
|
||||
{
|
||||
sys_fs.Error("'%s' couldn't be created! flags: 0x%08x", unpacked_file.wx_str(), vfsWrite);
|
||||
sys_fs.Error("'%s' couldn't be created! flags: 0x%08x", unpacked_file.c_str(), vfsWrite);
|
||||
return CELL_ENOENT;
|
||||
}
|
||||
|
||||
|
@ -108,9 +108,9 @@ int sdata_unpack(wxString packed_file, wxString unpacked_file)
|
|||
|
||||
int cellFsSdataOpen(u32 path_addr, int flags, mem32_t fd, mem32_t arg, u64 size)
|
||||
{
|
||||
const wxString& path = Memory.ReadString(path_addr);
|
||||
const std::string& path = Memory.ReadString(path_addr);
|
||||
sys_fs.Warning("cellFsSdataOpen(path=\"%s\", flags=0x%x, fd_addr=0x%x, arg_addr=0x%x, size=0x%llx)",
|
||||
path.wx_str(), flags, fd.GetAddr(), arg.GetAddr(), size);
|
||||
path.c_str(), flags, fd.GetAddr(), arg.GetAddr(), size);
|
||||
|
||||
if (!fd.IsGood() || (!arg.IsGood() && size))
|
||||
return CELL_EFAULT;
|
||||
|
@ -118,10 +118,13 @@ int cellFsSdataOpen(u32 path_addr, int flags, mem32_t fd, mem32_t arg, u64 size)
|
|||
if (flags != CELL_O_RDONLY)
|
||||
return CELL_EINVAL;
|
||||
|
||||
if (!path.Lower().EndsWith(".sdat"))
|
||||
std::string suffix = path.substr(path.length() - 5, 4);
|
||||
if (suffix != ".sdat" && suffix != ".SDAT")
|
||||
return CELL_ENOTSDATA;
|
||||
|
||||
wxString unpacked_path = "/dev_hdd1/"+path.AfterLast('/')+".unpacked";
|
||||
std::string::size_type last_slash = path.rfind('/'); //TODO: use a filesystem library to solve this more robustly
|
||||
last_slash = last_slash == std::string::npos ? 0 : last_slash+1;
|
||||
std::string unpacked_path = "/dev_hdd1/"+path.substr(last_slash,path.length()-last_slash)+".unpacked";
|
||||
int ret = sdata_unpack(path, unpacked_path);
|
||||
if (ret) return ret;
|
||||
|
||||
|
@ -149,7 +152,16 @@ void fsAioRead(u32 fd, mem_ptr_t<CellFsAio> aio, int xid, mem_func_ptr_t<void (*
|
|||
vfsFileBase* orig_file;
|
||||
if(!sys_fs.CheckId(fd, orig_file)) return;
|
||||
|
||||
const wxString path = orig_file->GetPath().AfterFirst('/');
|
||||
std::string path = orig_file->GetPath();
|
||||
std::string::size_type first_slash = path.find('/');
|
||||
if (first_slash == std::string::npos)
|
||||
{
|
||||
path = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
path = path.substr(first_slash+1,std::string::npos);
|
||||
}
|
||||
|
||||
u64 nbytes = aio->size;
|
||||
u32 buf_addr = aio->buf_addr;
|
||||
|
@ -204,7 +216,7 @@ fin:
|
|||
file.Seek(old_pos);
|
||||
|
||||
ConLog.Warning("*** fsAioRead(fd=%d, offset=0x%llx, buf_addr=0x%x, size=0x%x, error=0x%x, res=0x%x, xid=0x%x [%s])",
|
||||
fd, (u64)aio->offset, buf_addr, (u64)aio->size, error, res, xid, path.wx_str());
|
||||
fd, (u64)aio->offset, buf_addr, (u64)aio->size, error, res, xid, path.c_str());
|
||||
|
||||
if (func) // start callback thread
|
||||
{
|
||||
|
@ -257,16 +269,16 @@ int cellFsAioRead(mem_ptr_t<CellFsAio> aio, mem32_t aio_id, mem_func_ptr_t<void
|
|||
|
||||
int cellFsAioInit(mem8_ptr_t mount_point)
|
||||
{
|
||||
wxString mp = Memory.ReadString(mount_point.GetAddr());
|
||||
sys_fs.Warning("cellFsAioInit(mount_point_addr=0x%x (%s))", mount_point.GetAddr(), mp.wx_str());
|
||||
std::string mp = Memory.ReadString(mount_point.GetAddr());
|
||||
sys_fs.Warning("cellFsAioInit(mount_point_addr=0x%x (%s))", mount_point.GetAddr(), mp.c_str());
|
||||
aio_init = true;
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int cellFsAioFinish(mem8_ptr_t mount_point)
|
||||
{
|
||||
wxString mp = Memory.ReadString(mount_point.GetAddr());
|
||||
sys_fs.Warning("cellFsAioFinish(mount_point_addr=0x%x (%s))", mount_point.GetAddr(), mp.wx_str());
|
||||
std::string mp = Memory.ReadString(mount_point.GetAddr());
|
||||
sys_fs.Warning("cellFsAioFinish(mount_point_addr=0x%x (%s))", mount_point.GetAddr(), mp.c_str());
|
||||
aio_init = false;
|
||||
return CELL_OK;
|
||||
}
|
||||
|
|
|
@ -83,7 +83,7 @@ void StaticAnalyse(void* ptr, u32 size, u32 base)
|
|||
}
|
||||
if (found)
|
||||
{
|
||||
ConLog.Write("Function '%s' hooked (addr=0x%x)", wxString(g_static_funcs_list[j].name).wx_str(), i * 4 + base);
|
||||
ConLog.Write("Function '%s' hooked (addr=0x%x)", g_static_funcs_list[j].name, i * 4 + base);
|
||||
g_static_funcs_list[j].found++;
|
||||
data[i+0] = re32(0x39600000 | j); // li r11, j
|
||||
data[i+1] = se32(0x44000003); // sc 3
|
||||
|
@ -127,7 +127,7 @@ void StaticAnalyse(void* ptr, u32 size, u32 base)
|
|||
if (count == 0)
|
||||
{
|
||||
res |= GSR_MISSING;
|
||||
ConLog.Error("Function '%s' not found", wxString(g_static_funcs_list[j].name).wx_str());
|
||||
ConLog.Error("Function '%s' not found", g_static_funcs_list[j].name);
|
||||
}
|
||||
else if (count > 1)
|
||||
{
|
||||
|
@ -144,7 +144,7 @@ void StaticAnalyse(void* ptr, u32 size, u32 base)
|
|||
if (g_static_funcs_list[k].found)
|
||||
{
|
||||
res |= GSR_EXCESS;
|
||||
ConLog.Error("Function '%s' hooked twice", wxString(g_static_funcs_list[j].name).wx_str());
|
||||
ConLog.Error("Function '%s' hooked twice", g_static_funcs_list[j].name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -152,7 +152,7 @@ void StaticAnalyse(void* ptr, u32 size, u32 base)
|
|||
else
|
||||
{
|
||||
res |= GSR_EXCESS;
|
||||
ConLog.Error("Function '%s' hooked twice", wxString(g_static_funcs_list[j].name).wx_str());
|
||||
ConLog.Error("Function '%s' hooked twice", g_static_funcs_list[j].name);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -168,13 +168,13 @@ void StaticAnalyse(void* ptr, u32 size, u32 base)
|
|||
|
||||
if (res == GSR_SUCCESS)
|
||||
{
|
||||
ConLog.Success("Function group [%s] successfully hooked", wxString(name, 9).wx_str());
|
||||
ConLog.Success("Function group [%s] successfully hooked", std::string(name, 9).c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
ConLog.Error("Function group [%s] failed:%s%s", wxString(name, 9).wx_str(),
|
||||
wxString(res & GSR_MISSING ? " missing;" : "").wx_str(),
|
||||
wxString(res & GSR_EXCESS ? " excess;" : "").wx_str());
|
||||
ConLog.Error("Function group [%s] failed:%s%s", std::string(name, 9).c_str(),
|
||||
std::string(res & GSR_MISSING ? " missing;" : "").c_str(),
|
||||
std::string(res & GSR_EXCESS ? " excess;" : "").c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -359,12 +359,12 @@ void default_syscall()
|
|||
case 999:
|
||||
dump_enable = !dump_enable;
|
||||
Emu.Pause();
|
||||
ConLog.Warning("Dump %s", wxString(dump_enable ? "enabled" : "disabled").wx_str());
|
||||
ConLog.Warning("Dump %s", std::string(dump_enable ? "enabled" : "disabled").c_str());
|
||||
return;
|
||||
|
||||
case 1000:
|
||||
Ini.HLELogging.SetValue(!Ini.HLELogging.GetValue());
|
||||
ConLog.Warning("Log %s", wxString(Ini.HLELogging.GetValue() ? "enabled" : "disabled").wx_str());
|
||||
ConLog.Warning("Log %s", std::string(Ini.HLELogging.GetValue() ? "enabled" : "disabled").c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -44,61 +44,61 @@ public:
|
|||
|
||||
const std::string& GetName() const { return m_module_name; }
|
||||
|
||||
void Log(const u32 id, wxString fmt, ...)
|
||||
void Log(const u32 id, std::string fmt, ...)
|
||||
{
|
||||
if(Ini.HLELogging.GetValue())
|
||||
{
|
||||
va_list list;
|
||||
va_start(list, fmt);
|
||||
ConLog.Write(GetName() + wxString::Format("[%d]: ", id).wx_str() + wxString::FormatV(fmt, list).wx_str());
|
||||
ConLog.Write(GetName() + fmt::Format("[%d]: ", id) + fmt::FormatV(fmt, list));
|
||||
va_end(list);
|
||||
}
|
||||
}
|
||||
|
||||
void Log(wxString fmt, ...)
|
||||
void Log(std::string fmt, ...)
|
||||
{
|
||||
if(Ini.HLELogging.GetValue())
|
||||
{
|
||||
va_list list;
|
||||
va_start(list, fmt);
|
||||
ConLog.Write(GetName() + ": " + wxString::FormatV(fmt, list).wx_str());
|
||||
ConLog.Write(GetName() + ": " + fmt::FormatV(fmt, list));
|
||||
va_end(list);
|
||||
}
|
||||
}
|
||||
|
||||
void Warning(const u32 id, wxString fmt, ...)
|
||||
void Warning(const u32 id, std::string fmt, ...)
|
||||
{
|
||||
//#ifdef SYSCALLS_DEBUG
|
||||
va_list list;
|
||||
va_start(list, fmt);
|
||||
ConLog.Warning(GetName() + wxString::Format("[%d] warning: ", id).wx_str() + wxString::FormatV(fmt, list).wx_str());
|
||||
ConLog.Warning(GetName() + fmt::Format("[%d] warning: ", id) + fmt::FormatV(fmt, list));
|
||||
va_end(list);
|
||||
//#endif
|
||||
}
|
||||
|
||||
void Warning(wxString fmt, ...)
|
||||
void Warning(std::string fmt, ...)
|
||||
{
|
||||
//#ifdef SYSCALLS_DEBUG
|
||||
va_list list;
|
||||
va_start(list, fmt);
|
||||
ConLog.Warning(GetName() + " warning: " + wxString::FormatV(fmt, list).wx_str());
|
||||
ConLog.Warning(GetName() + " warning: " + fmt::FormatV(fmt, list));
|
||||
va_end(list);
|
||||
//#endif
|
||||
}
|
||||
|
||||
void Error(const u32 id, wxString fmt, ...)
|
||||
void Error(const u32 id, std::string fmt, ...)
|
||||
{
|
||||
va_list list;
|
||||
va_start(list, fmt);
|
||||
ConLog.Error(GetName() + wxString::Format("[%d] error: ", id).wx_str() + wxString::FormatV(fmt, list).wx_str());
|
||||
ConLog.Error(GetName() + fmt::Format("[%d] error: ", id) + fmt::FormatV(fmt, list));
|
||||
va_end(list);
|
||||
}
|
||||
|
||||
void Error(wxString fmt, ...)
|
||||
void Error(std::string fmt, ...)
|
||||
{
|
||||
va_list list;
|
||||
va_start(list, fmt);
|
||||
ConLog.Error(GetName() + " error: " + wxString::FormatV(fmt, list).wx_str());
|
||||
ConLog.Error(GetName() + " error: " + fmt::FormatV(fmt, list));
|
||||
va_end(list);
|
||||
}
|
||||
|
||||
|
@ -421,7 +421,7 @@ extern int sys_rsx_device_map(mem32_t a1, mem32_t a2, u32 a3);
|
|||
extern int sys_rsx_device_unmap();
|
||||
extern int sys_rsx_attribute();
|
||||
|
||||
#define UNIMPLEMENTED_FUNC(module) module.Error("Unimplemented function: %s", wxString(__FUNCTION__).wx_str())
|
||||
#define UNIMPLEMENTED_FUNC(module) module.Error("Unimplemented function: %s", std::string(__FUNCTION__).c_str())
|
||||
|
||||
#define SC_ARG_0 CPU.GPR[3]
|
||||
#define SC_ARG_1 CPU.GPR[4]
|
||||
|
|
|
@ -35,7 +35,7 @@ int sys_cond_create(mem32_t cond_id, u32 mutex_id, mem_ptr_t<sys_cond_attribute>
|
|||
u32 id = sys_cond.GetNewId(cond);
|
||||
cond_id = id;
|
||||
mutex->cond_count++;
|
||||
sys_cond.Warning("*** condition created [%s] (mutex_id=%d): id = %d", wxString(attr->name, 8).wx_str(), mutex_id, cond_id.GetValue());
|
||||
sys_cond.Warning("*** condition created [%s] (mutex_id=%d): id = %d", std::string(attr->name, 8).c_str(), mutex_id, cond_id.GetValue());
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ int sys_event_queue_create(mem32_t equeue_id, mem_ptr_t<sys_event_queue_attr> at
|
|||
|
||||
equeue_id = sys_event.GetNewId(eq);
|
||||
sys_event.Warning("*** event_queue created [%s] (protocol=0x%x, type=0x%x): id = %d",
|
||||
wxString(attr->name, 8).wx_str(), (u32)attr->protocol, (int)attr->type, equeue_id.GetValue());
|
||||
std::string(attr->name, 8).c_str(), (u32)attr->protocol, (int)attr->type, equeue_id.GetValue());
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ int sys_event_flag_create(mem32_t eflag_id, mem_ptr_t<sys_event_flag_attr> attr,
|
|||
eflag_id = sys_event_flag.GetNewId(new EventFlag(init, (u32)attr->protocol, (int)attr->type));
|
||||
|
||||
sys_event_flag.Warning("*** event_flag created [%s] (protocol=0x%x, type=0x%x): id = %d",
|
||||
wxString(attr->name, 8).wx_str(), (u32)attr->protocol, (int)attr->type, eflag_id.GetValue());
|
||||
std::string(attr->name, 8).c_str(), (u32)attr->protocol, (int)attr->type, eflag_id.GetValue());
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
|
|
@ -45,12 +45,12 @@ struct FsRingBufferConfig
|
|||
|
||||
int cellFsOpen(u32 path_addr, int flags, mem32_t fd, mem32_t arg, u64 size)
|
||||
{
|
||||
const wxString& path = Memory.ReadString(path_addr);
|
||||
const std::string& path = Memory.ReadString(path_addr);
|
||||
sys_fs.Log("cellFsOpen(path=\"%s\", flags=0x%x, fd_addr=0x%x, arg_addr=0x%x, size=0x%llx)",
|
||||
path.wx_str(), flags, fd.GetAddr(), arg.GetAddr(), size);
|
||||
path.c_str(), flags, fd.GetAddr(), arg.GetAddr(), size);
|
||||
|
||||
const wxString& ppath = path;
|
||||
//ConLog.Warning("path: %s [%s]", ppath.wx_str(), path.wx_str());
|
||||
const std::string& ppath = path;
|
||||
//ConLog.Warning("path: %s [%s]", ppath.c_str(), path.c_str());
|
||||
|
||||
s32 _oflags = flags;
|
||||
if(flags & CELL_O_CREAT)
|
||||
|
@ -102,7 +102,7 @@ int cellFsOpen(u32 path_addr, int flags, mem32_t fd, mem32_t arg, u64 size)
|
|||
|
||||
if(_oflags != 0)
|
||||
{
|
||||
sys_fs.Error("\"%s\" has unknown flags! flags: 0x%08x", ppath.wx_str(), flags);
|
||||
sys_fs.Error("\"%s\" has unknown flags! flags: 0x%08x", ppath.c_str(), flags);
|
||||
return CELL_EINVAL;
|
||||
}
|
||||
|
||||
|
@ -110,12 +110,12 @@ int cellFsOpen(u32 path_addr, int flags, mem32_t fd, mem32_t arg, u64 size)
|
|||
|
||||
if(!stream || !stream->IsOpened())
|
||||
{
|
||||
sys_fs.Error("\"%s\" not found! flags: 0x%08x", ppath.wx_str(), flags);
|
||||
sys_fs.Error("\"%s\" not found! flags: 0x%08x", ppath.c_str(), flags);
|
||||
return CELL_ENOENT;
|
||||
}
|
||||
|
||||
fd = sys_fs.GetNewId(stream, IDFlag_File);
|
||||
ConLog.Warning("*** cellFsOpen(path=\"%s\"): fd = %d", path.wx_str(), fd.GetValue());
|
||||
ConLog.Warning("*** cellFsOpen(path=\"%s\"): fd = %d", path.c_str(), fd.GetValue());
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
@ -201,8 +201,8 @@ int cellFsClose(u32 fd)
|
|||
|
||||
int cellFsOpendir(u32 path_addr, mem32_t fd)
|
||||
{
|
||||
const wxString& path = Memory.ReadString(path_addr);
|
||||
sys_fs.Warning("cellFsOpendir(path=\"%s\", fd_addr=0x%x)", path.wx_str(), fd.GetAddr());
|
||||
const std::string& path = Memory.ReadString(path_addr);
|
||||
sys_fs.Warning("cellFsOpendir(path=\"%s\", fd_addr=0x%x)", path.c_str(), fd.GetAddr());
|
||||
|
||||
if(!Memory.IsGoodAddr(path_addr) || !fd.IsGood())
|
||||
return CELL_EFAULT;
|
||||
|
@ -232,8 +232,8 @@ int cellFsReaddir(u32 fd, mem_ptr_t<CellFsDirent> dir, mem64_t nread)
|
|||
if(info)
|
||||
{
|
||||
nread = 1;
|
||||
Memory.WriteString(dir.GetAddr()+2, info->name.wx_str());
|
||||
dir->d_namlen = info->name.Length();
|
||||
Memory.WriteString(dir.GetAddr()+2, info->name);
|
||||
dir->d_namlen = info->name.length();
|
||||
dir->d_type = (info->flags & DirEntry_TypeFile) ? CELL_FS_TYPE_REGULAR : CELL_FS_TYPE_DIRECTORY;
|
||||
}
|
||||
else
|
||||
|
@ -256,8 +256,8 @@ int cellFsClosedir(u32 fd)
|
|||
|
||||
int cellFsStat(const u32 path_addr, mem_ptr_t<CellFsStat> sb)
|
||||
{
|
||||
const wxString& path = Memory.ReadString(path_addr);
|
||||
sys_fs.Log("cellFsStat(path=\"%s\", sb_addr: 0x%x)", path.wx_str(), sb.GetAddr());
|
||||
const std::string& path = Memory.ReadString(path_addr);
|
||||
sys_fs.Log("cellFsStat(path=\"%s\", sb_addr: 0x%x)", path.c_str(), sb.GetAddr());
|
||||
|
||||
sb->st_mode =
|
||||
CELL_FS_S_IRUSR | CELL_FS_S_IWUSR | CELL_FS_S_IXUSR |
|
||||
|
@ -290,7 +290,7 @@ int cellFsStat(const u32 path_addr, mem_ptr_t<CellFsStat> sb)
|
|||
}
|
||||
}
|
||||
|
||||
sys_fs.Warning("cellFsStat: \"%s\" not found.", path.wx_str());
|
||||
sys_fs.Warning("cellFsStat: \"%s\" not found.", path.c_str());
|
||||
return CELL_ENOENT;
|
||||
}
|
||||
|
||||
|
@ -321,8 +321,8 @@ int cellFsFstat(u32 fd, mem_ptr_t<CellFsStat> sb)
|
|||
|
||||
int cellFsMkdir(u32 path_addr, u32 mode)
|
||||
{
|
||||
const wxString& ps3_path = Memory.ReadString(path_addr);
|
||||
sys_fs.Log("cellFsMkdir(path=\"%s\", mode=0x%x)", ps3_path.wx_str(), mode);
|
||||
const std::string& ps3_path = Memory.ReadString(path_addr);
|
||||
sys_fs.Log("cellFsMkdir(path=\"%s\", mode=0x%x)", ps3_path.c_str(), mode);
|
||||
|
||||
/*vfsDir dir;
|
||||
if(dir.IsExists(ps3_path))
|
||||
|
@ -340,8 +340,8 @@ int cellFsMkdir(u32 path_addr, u32 mode)
|
|||
|
||||
int cellFsRename(u32 from_addr, u32 to_addr)
|
||||
{
|
||||
const wxString& ps3_from = Memory.ReadString(from_addr);
|
||||
const wxString& ps3_to = Memory.ReadString(to_addr);
|
||||
const std::string& ps3_from = Memory.ReadString(from_addr);
|
||||
const std::string& ps3_to = Memory.ReadString(to_addr);
|
||||
|
||||
{
|
||||
vfsDir dir;
|
||||
|
@ -370,8 +370,8 @@ int cellFsRename(u32 from_addr, u32 to_addr)
|
|||
|
||||
int cellFsRmdir(u32 path_addr)
|
||||
{
|
||||
const wxString& ps3_path = Memory.ReadString(path_addr);
|
||||
sys_fs.Log("cellFsRmdir(path=\"%s\")", ps3_path.wx_str());
|
||||
const std::string& ps3_path = Memory.ReadString(path_addr);
|
||||
sys_fs.Log("cellFsRmdir(path=\"%s\")", ps3_path.c_str());
|
||||
|
||||
vfsDir d;
|
||||
if(!d.IsExists(ps3_path))
|
||||
|
@ -385,8 +385,8 @@ int cellFsRmdir(u32 path_addr)
|
|||
|
||||
int cellFsUnlink(u32 path_addr)
|
||||
{
|
||||
const wxString& ps3_path = Memory.ReadString(path_addr);
|
||||
sys_fs.Warning("cellFsUnlink(path=\"%s\")", ps3_path.wx_str());
|
||||
const std::string& ps3_path = Memory.ReadString(path_addr);
|
||||
sys_fs.Warning("cellFsUnlink(path=\"%s\")", ps3_path.c_str());
|
||||
|
||||
if (ps3_path.empty())
|
||||
return CELL_EFAULT;
|
||||
|
@ -452,13 +452,13 @@ int cellFsFtruncate(u32 fd, u64 size)
|
|||
|
||||
int cellFsTruncate(u32 path_addr, u64 size)
|
||||
{
|
||||
const wxString& path = Memory.ReadString(path_addr);
|
||||
sys_fs.Log("cellFsTruncate(path=\"%s\", size=%lld)", path.wx_str(), size);
|
||||
const std::string& path = Memory.ReadString(path_addr);
|
||||
sys_fs.Log("cellFsTruncate(path=\"%s\", size=%lld)", path.c_str(), size);
|
||||
|
||||
vfsFile f(path, vfsReadWrite);
|
||||
if(!f.IsOpened())
|
||||
{
|
||||
sys_fs.Warning("cellFsTruncate: \"%s\" not found.", path.wx_str());
|
||||
sys_fs.Warning("cellFsTruncate: \"%s\" not found.", path.c_str());
|
||||
return CELL_ENOENT;
|
||||
}
|
||||
u64 initialSize = f.GetSize();
|
||||
|
@ -496,7 +496,7 @@ int cellFsFGetBlockSize(u32 fd, mem64_t sector_size, mem64_t block_size)
|
|||
|
||||
int cellFsGetBlockSize(u32 path_addr, mem64_t sector_size, mem64_t block_size)
|
||||
{
|
||||
sys_fs.Log("cellFsGetBlockSize(file: %s, sector_size_addr: 0x%x, block_size_addr: 0x%x)", Memory.ReadString(path_addr).wx_str(), sector_size.GetAddr(), block_size.GetAddr());
|
||||
sys_fs.Log("cellFsGetBlockSize(file: %s, sector_size_addr: 0x%x, block_size_addr: 0x%x)", Memory.ReadString(path_addr).c_str(), sector_size.GetAddr(), block_size.GetAddr());
|
||||
|
||||
sector_size = 4096; // ?
|
||||
block_size = 4096; // ?
|
||||
|
@ -506,9 +506,9 @@ int cellFsGetBlockSize(u32 path_addr, mem64_t sector_size, mem64_t block_size)
|
|||
|
||||
int cellFsGetFreeSize(u32 path_addr, mem32_t block_size, mem64_t block_count)
|
||||
{
|
||||
const wxString& ps3_path = Memory.ReadString(path_addr);
|
||||
const std::string& ps3_path = Memory.ReadString(path_addr);
|
||||
sys_fs.Warning("cellFsGetFreeSize(path=\"%s\", block_size_addr=0x%x, block_count_addr=0x%x)",
|
||||
ps3_path.wx_str(), block_size.GetAddr(), block_count.GetAddr());
|
||||
ps3_path.c_str(), block_size.GetAddr(), block_count.GetAddr());
|
||||
|
||||
if (!Memory.IsGoodAddr(path_addr) || !block_size.IsGood() || !block_count.IsGood())
|
||||
return CELL_EFAULT;
|
||||
|
@ -537,8 +537,8 @@ int cellFsGetDirectoryEntries(u32 fd, mem_ptr_t<CellFsDirectoryEntry> entries, u
|
|||
if(info)
|
||||
{
|
||||
data_count = 1;
|
||||
Memory.WriteString(entries.GetAddr()+2, info->name.wx_str());
|
||||
entries->entry_name.d_namlen = info->name.Length();
|
||||
Memory.WriteString(entries.GetAddr()+2, info->name);
|
||||
entries->entry_name.d_namlen = info->name.length();
|
||||
entries->entry_name.d_type = (info->flags & DirEntry_TypeFile) ? CELL_FS_TYPE_REGULAR : CELL_FS_TYPE_DIRECTORY;
|
||||
|
||||
entries->attribute.st_mode =
|
||||
|
|
|
@ -35,7 +35,7 @@ int sys_lwcond_create(mem_ptr_t<sys_lwcond_t> lwcond, mem_ptr_t<sys_lwmutex_t> l
|
|||
}
|
||||
|
||||
sys_lwcond.Warning("*** lwcond created [%s] (lwmutex_addr=0x%x): id = %d",
|
||||
wxString(attr->name, 8).wx_str(), lwmutex.GetAddr(), (u32)lwcond->lwcond_queue);
|
||||
std::string(attr->name, 8).c_str(), lwmutex.GetAddr(), (u32) lwcond->lwcond_queue);
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ int sys_lwmutex_create(mem_ptr_t<sys_lwmutex_t> lwmutex, mem_ptr_t<sys_lwmutex_a
|
|||
lwmutex->sleep_queue = sq_id;
|
||||
|
||||
sc_lwmutex.Warning("*** lwmutex created [%s] (attribute=0x%x): sq_id = %d",
|
||||
wxString(attr->name, 8).wx_str(), (u32)lwmutex->attribute, sq_id);
|
||||
std::string(attr->name, 8).c_str(), (u32) lwmutex->attribute, sq_id);
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
|
|
@ -45,8 +45,8 @@ int sys_mutex_create(mem32_t mutex_id, mem_ptr_t<sys_mutex_attribute> attr)
|
|||
mutex_id = id;
|
||||
mutex->m_mutex.unlock(tid);
|
||||
sys_mtx.Warning("*** mutex created [%s] (protocol=0x%x, recursive=%s): id = %d",
|
||||
wxString(attr->name, 8).wx_str(), (u32)attr->protocol,
|
||||
wxString(is_recursive ? "true" : "false").wx_str(), mutex_id.GetValue());
|
||||
std::string(attr->name, 8).c_str(), (u32) attr->protocol,
|
||||
std::string(is_recursive ? "true" : "false").c_str(), mutex_id.GetValue());
|
||||
|
||||
// TODO: unlock mutex when owner thread does exit
|
||||
|
||||
|
|
|
@ -142,7 +142,7 @@ int sys_ppu_thread_restart(u32 thread_id)
|
|||
int sys_ppu_thread_create(u32 thread_id_addr, u32 entry, u64 arg, int prio, u32 stacksize, u64 flags, u32 threadname_addr)
|
||||
{
|
||||
sysPrxForUser.Log("sys_ppu_thread_create(thread_id_addr=0x%x, entry=0x%x, arg=0x%x, prio=%d, stacksize=0x%x, flags=0x%llx, threadname_addr=0x%x('%s'))",
|
||||
thread_id_addr, entry, arg, prio, stacksize, flags, threadname_addr, Memory.ReadString(threadname_addr).wx_str());
|
||||
thread_id_addr, entry, arg, prio, stacksize, flags, threadname_addr, Memory.ReadString(threadname_addr).c_str());
|
||||
|
||||
if(!Memory.IsGoodAddr(entry) || !Memory.IsGoodAddr(thread_id_addr) || !Memory.IsGoodAddr(threadname_addr))
|
||||
{
|
||||
|
@ -157,9 +157,9 @@ int sys_ppu_thread_create(u32 thread_id_addr, u32 entry, u64 arg, int prio, u32
|
|||
new_thread.SetPrio(prio);
|
||||
new_thread.SetStackSize(stacksize);
|
||||
//new_thread.flags = flags;
|
||||
new_thread.SetName(Memory.ReadString(threadname_addr).ToStdString());
|
||||
new_thread.SetName(Memory.ReadString(threadname_addr));
|
||||
|
||||
ConLog.Write("*** New PPU Thread [%s] (): id = %d", wxString(new_thread.GetName()).wx_str(), new_thread.GetId());
|
||||
ConLog.Write("*** New PPU Thread [%s] (): id = %d", new_thread.GetName().c_str(), new_thread.GetId());
|
||||
|
||||
new_thread.Run();
|
||||
new_thread.Exec();
|
||||
|
|
|
@ -61,7 +61,7 @@ void sys_game_process_exitspawn(
|
|||
u64 flags )
|
||||
{
|
||||
sc_p.Error("sys_game_process_exitspawn UNIMPLEMENTED");
|
||||
sc_p.Warning("path: %s", Memory.ReadString(path_addr).wx_str());
|
||||
sc_p.Warning("path: %s", Memory.ReadString(path_addr).c_str());
|
||||
sc_p.Warning("argv: 0x%x", argv_addr);
|
||||
sc_p.Warning("envp: 0x%x", envp_addr);
|
||||
sc_p.Warning("data: 0x%x", data_addr);
|
||||
|
@ -69,9 +69,9 @@ void sys_game_process_exitspawn(
|
|||
sc_p.Warning("prio: %d", prio);
|
||||
sc_p.Warning("flags: %d", flags);
|
||||
|
||||
wxString path = Memory.ReadString(path_addr);
|
||||
std::vector<wxString> argv;
|
||||
std::vector<wxString> env;
|
||||
std::string path = Memory.ReadString(path_addr);
|
||||
std::vector<std::string> argv;
|
||||
std::vector<std::string> env;
|
||||
|
||||
mem_ptr_t<u32> argvp(argv_addr);
|
||||
while (argvp.GetAddr() && argvp.IsGood() && *argvp)
|
||||
|
@ -87,10 +87,10 @@ void sys_game_process_exitspawn(
|
|||
}
|
||||
|
||||
for (auto &arg : argv){
|
||||
sc_p.Log("argument: %s", arg.wx_str());
|
||||
sc_p.Log("argument: %s", arg.c_str());
|
||||
}
|
||||
for (auto &en : env){
|
||||
sc_p.Log("env_argument: %s", en.wx_str());
|
||||
sc_p.Log("env_argument: %s", en.c_str());
|
||||
}
|
||||
//TODO: execute the file in <path> with the args in argv
|
||||
//and the environment parameters in envp and copy the data
|
||||
|
@ -109,7 +109,7 @@ void sys_game_process_exitspawn2(
|
|||
u64 flags)
|
||||
{
|
||||
sc_p.Error("sys_game_process_exitspawn2 UNIMPLEMENTED");
|
||||
sc_p.Warning("path: %s", Memory.ReadString(path_addr).wx_str());
|
||||
sc_p.Warning("path: %s", Memory.ReadString(path_addr).c_str());
|
||||
sc_p.Warning("argv: 0x%x", argv_addr);
|
||||
sc_p.Warning("envp: 0x%x", envp_addr);
|
||||
sc_p.Warning("data: 0x%x", data_addr);
|
||||
|
@ -118,8 +118,8 @@ void sys_game_process_exitspawn2(
|
|||
sc_p.Warning("flags: %d", flags);
|
||||
|
||||
wxString path = Memory.ReadString(path_addr);
|
||||
std::vector<wxString> argv;
|
||||
std::vector<wxString> env;
|
||||
std::vector<std::string> argv;
|
||||
std::vector<std::string> env;
|
||||
|
||||
mem_ptr_t<u32> argvp(argv_addr);
|
||||
while (argvp.GetAddr() && argvp.IsGood() && *argvp)
|
||||
|
@ -135,10 +135,10 @@ void sys_game_process_exitspawn2(
|
|||
}
|
||||
|
||||
for (auto &arg : argv){
|
||||
sc_p.Log("argument: %s", arg.wx_str());
|
||||
sc_p.Log("argument: %s", arg.c_str());
|
||||
}
|
||||
for (auto &en : env){
|
||||
sc_p.Log("env_argument: %s", en.wx_str());
|
||||
sc_p.Log("env_argument: %s", en.c_str());
|
||||
}
|
||||
//TODO: execute the file in <path> with the args in argv
|
||||
//and the environment parameters in envp and copy the data
|
||||
|
|
|
@ -28,7 +28,7 @@ int sys_rwlock_create(mem32_t rw_lock_id, mem_ptr_t<sys_rwlock_attribute_t> attr
|
|||
rw_lock_id = sys_rwlock.GetNewId(new RWLock((u32)attr->attr_protocol, attr->name_u64));
|
||||
|
||||
sys_rwlock.Warning("*** rwlock created [%s] (protocol=0x%x): id = %d",
|
||||
wxString(attr->name, 8).wx_str(), (u32)attr->attr_protocol, rw_lock_id.GetValue());
|
||||
std::string(attr->name, 8).c_str(), (u32) attr->attr_protocol, rw_lock_id.GetValue());
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
|
|
@ -40,8 +40,8 @@ u32 LoadSpuImage(vfsStream& stream)
|
|||
//156
|
||||
int sys_spu_image_open(mem_ptr_t<sys_spu_image> img, u32 path_addr)
|
||||
{
|
||||
const wxString path = Memory.ReadString(path_addr).wx_str();
|
||||
sc_spu.Warning("sys_spu_image_open(img_addr=0x%x, path_addr=0x%x [%s])", img.GetAddr(), path_addr, path.wx_str());
|
||||
const std::string path = Memory.ReadString(path_addr).c_str();
|
||||
sc_spu.Warning("sys_spu_image_open(img_addr=0x%x, path_addr=0x%x [%s])", img.GetAddr(), path_addr, path.c_str());
|
||||
|
||||
if(!img.IsGood() || !Memory.IsGoodAddr(path_addr))
|
||||
{
|
||||
|
@ -51,7 +51,7 @@ int sys_spu_image_open(mem_ptr_t<sys_spu_image> img, u32 path_addr)
|
|||
vfsFile f(path);
|
||||
if(!f.IsOpened())
|
||||
{
|
||||
sc_spu.Error("sys_spu_image_open error: '%s' not found!", path.wx_str());
|
||||
sc_spu.Error("sys_spu_image_open error: '%s' not found!", path.c_str());
|
||||
return CELL_ENOENT;
|
||||
}
|
||||
|
||||
|
@ -106,7 +106,7 @@ int sys_spu_thread_initialize(mem32_t thread, u32 group, u32 spu_num, mem_ptr_t<
|
|||
std::string name = "SPUThread";
|
||||
if (attr->name_addr)
|
||||
{
|
||||
name = Memory.ReadString(attr->name_addr, attr->name_len).ToStdString();
|
||||
name = Memory.ReadString(attr->name_addr, attr->name_len);
|
||||
}
|
||||
|
||||
u64 a1 = arg->arg1;
|
||||
|
@ -132,7 +132,7 @@ int sys_spu_thread_initialize(mem32_t thread, u32 group, u32 spu_num, mem_ptr_t<
|
|||
(*(SPUThread*)&new_thread).group = group_info;
|
||||
|
||||
sc_spu.Warning("*** New SPU Thread [%s] (img_offset=0x%x, ls_offset=0x%x, ep=0x%x, a1=0x%llx, a2=0x%llx, a3=0x%llx, a4=0x%llx): id=%d",
|
||||
wxString(attr->name_addr ? name : "").wx_str(), (u32)img->segs_addr, ((SPUThread&)new_thread).dmac.ls_offset, spu_ep, a1, a2, a3, a4, thread.GetValue());
|
||||
std::string(attr->name_addr ? name : "").c_str(), (u32) img->segs_addr, ((SPUThread&) new_thread).dmac.ls_offset, spu_ep, a1, a2, a3, a4, thread.GetValue());
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
@ -302,12 +302,12 @@ int sys_spu_thread_group_create(mem32_t id, u32 num, int prio, mem_ptr_t<sys_spu
|
|||
|
||||
if (prio < 16 || prio > 255) return CELL_EINVAL;
|
||||
|
||||
const wxString name = Memory.ReadString(attr->name_addr, attr->name_len);
|
||||
const std::string name = Memory.ReadString(attr->name_addr, attr->name_len);
|
||||
|
||||
id = sc_spu.GetNewId(new SpuGroupInfo(name, num, prio, attr->type, attr->ct));
|
||||
|
||||
sc_spu.Warning("*** SPU Thread Group created [%s] (type=0x%x, option.ct=0x%x): id=%d",
|
||||
name.wx_str(), (int)attr->type, (u32)attr->ct, id.GetValue());
|
||||
name.c_str(), (int)attr->type, (u32)attr->ct, id.GetValue());
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
|
|
@ -41,13 +41,13 @@ void Emulator::Init()
|
|||
//m_memory_viewer = new MemoryViewerPanel(wxGetApp().m_MainFrame);
|
||||
}
|
||||
|
||||
void Emulator::SetPath(const wxString& path, const wxString& elf_path)
|
||||
void Emulator::SetPath(const std::string& path, const std::string& elf_path)
|
||||
{
|
||||
m_path = path;
|
||||
m_elf_path = elf_path;
|
||||
}
|
||||
|
||||
void Emulator::SetTitleID(const wxString& id)
|
||||
void Emulator::SetTitleID(const std::string& id)
|
||||
{
|
||||
m_title_id = id;
|
||||
}
|
||||
|
@ -103,9 +103,9 @@ bool Emulator::BootGame(const std::string& path)
|
|||
|
||||
for(int i=0; i<sizeof(elf_path) / sizeof(*elf_path);i++)
|
||||
{
|
||||
const wxString& curpath = path + elf_path[i];
|
||||
const std::string& curpath = path + elf_path[i];
|
||||
|
||||
if(wxFile::Access(curpath, wxFile::read))
|
||||
if(wxFile::Access(fmt::FromUTF8(curpath), wxFile::read))
|
||||
{
|
||||
SetPath(curpath);
|
||||
Load();
|
||||
|
@ -119,20 +119,20 @@ bool Emulator::BootGame(const std::string& path)
|
|||
|
||||
void Emulator::Load()
|
||||
{
|
||||
if(!wxFileExists(m_path)) return;
|
||||
if(!wxFileExists(fmt::FromUTF8(m_path))) return;
|
||||
|
||||
if(IsSelf(m_path.ToStdString()))
|
||||
if(IsSelf(m_path))
|
||||
{
|
||||
std::string self_path = m_path.ToStdString();
|
||||
std::string elf_path = wxFileName(m_path).GetPath().ToStdString();
|
||||
std::string self_path = m_path;
|
||||
std::string elf_path = fmt::ToUTF8(wxFileName(fmt::FromUTF8(m_path)).GetPath());
|
||||
|
||||
if(wxFileName(m_path).GetFullName().CmpNoCase("EBOOT.BIN") == 0)
|
||||
if (wxFileName(fmt::FromUTF8(m_path)).GetFullName().CmpNoCase("EBOOT.BIN") == 0)
|
||||
{
|
||||
elf_path += "/BOOT.BIN";
|
||||
}
|
||||
else
|
||||
{
|
||||
elf_path += "/" + wxFileName(m_path).GetName() + ".elf";
|
||||
elf_path += "/" + fmt::ToUTF8(wxFileName(fmt::FromUTF8(m_path)).GetName()) + ".elf";
|
||||
}
|
||||
|
||||
if(!DecryptSelf(elf_path, self_path))
|
||||
|
@ -141,7 +141,7 @@ void Emulator::Load()
|
|||
m_path = elf_path;
|
||||
}
|
||||
|
||||
ConLog.Write("Loading '%s'...", m_path.wx_str());
|
||||
ConLog.Write("Loading '%s'...", m_path.c_str());
|
||||
GetInfo().Reset();
|
||||
m_vfs.Init(m_path);
|
||||
|
||||
|
@ -149,11 +149,11 @@ void Emulator::Load()
|
|||
ConLog.Write("Mount info:");
|
||||
for(uint i=0; i<m_vfs.m_devices.GetCount(); ++i)
|
||||
{
|
||||
ConLog.Write("%s -> %s", m_vfs.m_devices[i].GetPs3Path().wx_str(), m_vfs.m_devices[i].GetLocalPath().wx_str());
|
||||
ConLog.Write("%s -> %s", m_vfs.m_devices[i].GetPs3Path().c_str(), m_vfs.m_devices[i].GetLocalPath().c_str());
|
||||
}
|
||||
ConLog.SkipLn();
|
||||
|
||||
if(m_elf_path.IsEmpty())
|
||||
if(m_elf_path.empty())
|
||||
{
|
||||
GetVFS().GetDeviceLocal(m_path, m_elf_path);
|
||||
}
|
||||
|
@ -162,7 +162,7 @@ void Emulator::Load()
|
|||
|
||||
if(!f.IsOpened())
|
||||
{
|
||||
ConLog.Error("Elf not found! (%s - %s)", m_path.wx_str(), m_elf_path.wx_str());
|
||||
ConLog.Error("Elf not found! (%s - %s)", m_path.c_str(), m_elf_path.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -193,7 +193,7 @@ void Emulator::Load()
|
|||
}
|
||||
|
||||
}
|
||||
catch(const wxString& e)
|
||||
catch(const std::string& e)
|
||||
{
|
||||
ConLog.Error(e);
|
||||
is_error = true;
|
||||
|
@ -441,7 +441,7 @@ void Emulator::LoadPoints(const std::string& path)
|
|||
if(version != bpdb_version ||
|
||||
(sizeof(u16) + break_count * sizeof(u64) + sizeof(u32) + marked_count * sizeof(u64) + sizeof(u32)) != length)
|
||||
{
|
||||
ConLog.Error("'%s' is broken", wxString(path).wx_str());
|
||||
ConLog.Error("'%s' is broken", path.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -98,15 +98,15 @@ class Emulator
|
|||
EmuInfo m_info;
|
||||
|
||||
public:
|
||||
wxString m_path;
|
||||
wxString m_elf_path;
|
||||
wxString m_title_id;
|
||||
std::string m_path;
|
||||
std::string m_elf_path;
|
||||
std::string m_title_id;
|
||||
|
||||
Emulator();
|
||||
|
||||
void Init();
|
||||
void SetPath(const wxString& path, const wxString& elf_path = wxEmptyString);
|
||||
void SetTitleID(const wxString& id);
|
||||
void SetPath(const std::string& path, const std::string& elf_path = "");
|
||||
void SetTitleID(const std::string& id);
|
||||
|
||||
CPUThreadManager& GetCPU() { return m_thread_manager; }
|
||||
PadManager& GetPadManager() { return m_pad_manager; }
|
||||
|
|
|
@ -16,7 +16,7 @@ wxFont GetFont(int size)
|
|||
}
|
||||
|
||||
CompilerELF::CompilerELF(wxWindow* parent)
|
||||
: FrameBase(parent, wxID_ANY, "CompilerELF", wxEmptyString, wxSize(640, 680))
|
||||
: FrameBase(parent, wxID_ANY, "CompilerELF", "", wxSize(640, 680))
|
||||
, m_status_bar(*CreateStatusBar())
|
||||
{
|
||||
m_disable_scroll = false;
|
||||
|
@ -392,26 +392,26 @@ void CompilerELF::LoadElf(wxCommandEvent& event)
|
|||
wxFD_OPEN | wxFD_FILE_MUST_EXIST);
|
||||
|
||||
if(ctrl.ShowModal() == wxID_CANCEL) return;
|
||||
LoadElf(ctrl.GetPath());
|
||||
LoadElf(fmt::ToUTF8(ctrl.GetPath()));
|
||||
}
|
||||
|
||||
#include "Emu/Cell/PPUDisAsm.h"
|
||||
#include "Emu/Cell/PPUDecoder.h"
|
||||
|
||||
void CompilerELF::LoadElf(const wxString& path)
|
||||
void CompilerELF::LoadElf(const std::string& path)
|
||||
{
|
||||
}
|
||||
|
||||
void CompilerELF::SetTextStyle(const wxString& text, const wxColour& color, bool bold)
|
||||
void CompilerELF::SetTextStyle(const std::string& text, const wxColour& color, bool bold)
|
||||
{
|
||||
for(int p=0; (p = asm_list->GetValue().find(text, p)) >= 0; p += text.Len())
|
||||
for(int p=0; (p = fmt::ToUTF8(asm_list->GetValue()).find(text, p)) !=std::string::npos; p += text.length())
|
||||
{
|
||||
asm_list->SetStyle(p, p + text.Len(), wxTextAttr(color, wxNullColour,
|
||||
asm_list->SetStyle(p, p + text.length(), wxTextAttr(color, wxNullColour,
|
||||
wxFont(-1, wxFONTFAMILY_MODERN, wxFONTSTYLE_NORMAL, bold ? wxFONTWEIGHT_BOLD : wxFONTWEIGHT_NORMAL)));
|
||||
}
|
||||
}
|
||||
|
||||
void CompilerELF::SetOpStyle(const wxString& text, const wxColour& color, bool bold)
|
||||
void CompilerELF::SetOpStyle(const std::string& text, const wxColour& color, bool bold)
|
||||
{
|
||||
/*
|
||||
for(int p=0; (p = FindOp(asm_list->GetValue(), text, p)) >= 0; p += text.Len())
|
||||
|
@ -424,5 +424,5 @@ void CompilerELF::SetOpStyle(const wxString& text, const wxColour& color, bool b
|
|||
|
||||
void CompilerELF::DoAnalyzeCode(bool compile)
|
||||
{
|
||||
CompilePPUProgram(asm_list->GetValue(), "compiled.elf", asm_list, hex_list, err_list, !compile).Compile();
|
||||
CompilePPUProgram(fmt::ToUTF8(asm_list->GetValue()), "compiled.elf", asm_list, hex_list, err_list, !compile).Compile();
|
||||
}
|
||||
|
|
|
@ -38,10 +38,10 @@ public:
|
|||
}
|
||||
|
||||
void LoadElf(wxCommandEvent& event);
|
||||
void LoadElf(const wxString& path);
|
||||
void LoadElf(const std::string& path);
|
||||
|
||||
void SetTextStyle(const wxString& text, const wxColour& color, bool bold=false);
|
||||
void SetOpStyle(const wxString& text, const wxColour& color, bool bold=true);
|
||||
void SetTextStyle(const std::string& text, const wxColour& color, bool bold=false);
|
||||
void SetOpStyle(const std::string& text, const wxColour& color, bool bold = true);
|
||||
void DoAnalyzeCode(bool compile);
|
||||
|
||||
void UpdateStatus(int offset=0);
|
||||
|
|
|
@ -12,20 +12,20 @@ LogFrame* ConLogFrame;
|
|||
std::mutex g_cs_conlog;
|
||||
|
||||
static const uint max_item_count = 500;
|
||||
static const uint buffer_size = 1024 * 64 * sizeof(wxChar);
|
||||
static const uint buffer_size = 1024 * 64;
|
||||
|
||||
static const wxString g_log_colors[] =
|
||||
static const std::string g_log_colors[] =
|
||||
{
|
||||
"Black", "Green", "White", "Yellow", "Red",
|
||||
};
|
||||
|
||||
struct LogPacket
|
||||
{
|
||||
wxString m_prefix;
|
||||
wxString m_text;
|
||||
wxString m_colour;
|
||||
const std::string m_prefix;
|
||||
const std::string m_text;
|
||||
const std::string m_colour;
|
||||
|
||||
LogPacket(const wxString& prefix, const wxString& text, const wxString& colour)
|
||||
LogPacket(const std::string& prefix, const std::string& text, const std::string& colour)
|
||||
: m_prefix(prefix)
|
||||
, m_text(text)
|
||||
, m_colour(colour)
|
||||
|
@ -42,9 +42,9 @@ struct _LogBuffer : public MTPacketBuffer<LogPacket>
|
|||
|
||||
void _push(const LogPacket& data)
|
||||
{
|
||||
const u32 sprefix = data.m_prefix.length() * sizeof(wxChar);
|
||||
const u32 stext = data.m_text.length() * sizeof(wxChar);
|
||||
const u32 scolour = data.m_colour.length() * sizeof(wxChar);
|
||||
const u32 sprefix = data.m_prefix.length();
|
||||
const u32 stext = data.m_text.length();
|
||||
const u32 scolour = data.m_colour.length();
|
||||
|
||||
m_buffer.Reserve(
|
||||
sizeof(u32) + sprefix +
|
||||
|
@ -55,17 +55,17 @@ struct _LogBuffer : public MTPacketBuffer<LogPacket>
|
|||
|
||||
memcpy(&m_buffer[c_put], &sprefix, sizeof(u32));
|
||||
c_put += sizeof(u32);
|
||||
memcpy(&m_buffer[c_put], data.m_prefix.wx_str(), sprefix);
|
||||
memcpy(&m_buffer[c_put], data.m_prefix.c_str(), sprefix);
|
||||
c_put += sprefix;
|
||||
|
||||
memcpy(&m_buffer[c_put], &stext, sizeof(u32));
|
||||
c_put += sizeof(u32);
|
||||
memcpy(&m_buffer[c_put], data.m_text.wx_str(), stext);
|
||||
memcpy(&m_buffer[c_put], data.m_text.c_str(), stext);
|
||||
c_put += stext;
|
||||
|
||||
memcpy(&m_buffer[c_put], &scolour, sizeof(u32));
|
||||
c_put += sizeof(u32);
|
||||
memcpy(&m_buffer[c_put], data.m_colour.wx_str(), scolour);
|
||||
memcpy(&m_buffer[c_put], data.m_colour.c_str(), scolour);
|
||||
c_put += scolour;
|
||||
|
||||
m_put = c_put;
|
||||
|
@ -78,17 +78,17 @@ struct _LogBuffer : public MTPacketBuffer<LogPacket>
|
|||
|
||||
const u32& sprefix = *(u32*)&m_buffer[c_get];
|
||||
c_get += sizeof(u32);
|
||||
const wxString& prefix = wxString((wxChar*)&m_buffer[c_get], sprefix / sizeof(wxChar));
|
||||
const std::string prefix( (const char*) &m_buffer[c_get], sprefix);
|
||||
c_get += sprefix;
|
||||
|
||||
const u32& stext = *(u32*)&m_buffer[c_get];
|
||||
c_get += sizeof(u32);
|
||||
const wxString& text = wxString((wxChar*)&m_buffer[c_get], stext / sizeof(wxChar));
|
||||
const std::string text( (const char*) &m_buffer[c_get], stext);
|
||||
c_get += stext;
|
||||
|
||||
const u32& scolour = *(u32*)&m_buffer[c_get];
|
||||
c_get += sizeof(u32);
|
||||
const wxString& colour = wxString((wxChar*)&m_buffer[c_get], scolour / sizeof(wxChar));
|
||||
const std::string colour( (const char*) &m_buffer[c_get], scolour);
|
||||
c_get += scolour;
|
||||
|
||||
m_get = c_get;
|
||||
|
@ -108,9 +108,9 @@ LogWriter::LogWriter()
|
|||
}
|
||||
}
|
||||
|
||||
void LogWriter::WriteToLog(const wxString& prefix, const wxString& value, u8 lvl/*, wxColour bgcolour*/)
|
||||
void LogWriter::WriteToLog(const std::string& prefix, const std::string& value, u8 lvl/*, wxColour bgcolour*/)
|
||||
{
|
||||
wxString new_prefix = prefix;
|
||||
std::string new_prefix = prefix;
|
||||
if(!prefix.empty())
|
||||
{
|
||||
if(NamedThreadBase* thr = GetCurrentNamedThread())
|
||||
|
@ -120,7 +120,7 @@ void LogWriter::WriteToLog(const wxString& prefix, const wxString& value, u8 lvl
|
|||
}
|
||||
|
||||
if(m_logfile.IsOpened() && !new_prefix.empty())
|
||||
m_logfile.Write(wxString("[") + new_prefix + "]: " + value + "\n");
|
||||
m_logfile.Write(fmt::FromUTF8("[" + new_prefix + "]: " + value + "\n"));
|
||||
|
||||
if(!ConLogFrame || Ini.HLELogLvl.GetValue() == 4 || (lvl != 0 && lvl <= Ini.HLELogLvl.GetValue()))
|
||||
return;
|
||||
|
@ -157,57 +157,6 @@ void LogWriter::WriteToLog(const wxString& prefix, const wxString& value, u8 lvl
|
|||
LogBuffer.Push(LogPacket(new_prefix, value, g_log_colors[lvl]));
|
||||
}
|
||||
|
||||
void LogWriter::Write(const wxString& fmt, ...)
|
||||
{
|
||||
va_list list;
|
||||
va_start(list, fmt);
|
||||
|
||||
wxString frmt;
|
||||
frmt = wxString::FormatV(fmt, list);
|
||||
|
||||
va_end(list);
|
||||
|
||||
WriteToLog("!", frmt, 2);
|
||||
}
|
||||
|
||||
void LogWriter::Error(const wxString& fmt, ...)
|
||||
{
|
||||
va_list list;
|
||||
va_start(list, fmt);
|
||||
|
||||
wxString frmt;
|
||||
frmt = wxString::FormatV(fmt, list);
|
||||
|
||||
va_end(list);
|
||||
|
||||
WriteToLog("E", frmt, 4);
|
||||
}
|
||||
|
||||
void LogWriter::Warning(const wxString& fmt, ...)
|
||||
{
|
||||
va_list list;
|
||||
va_start(list, fmt);
|
||||
|
||||
wxString frmt;
|
||||
frmt = wxString::FormatV(fmt, list);
|
||||
|
||||
va_end(list);
|
||||
|
||||
WriteToLog("W", frmt, 3);
|
||||
}
|
||||
|
||||
void LogWriter::Success(const wxString& fmt, ...)
|
||||
{
|
||||
va_list list;
|
||||
va_start(list, fmt);
|
||||
|
||||
wxString frmt;
|
||||
frmt = wxString::FormatV(fmt, list);
|
||||
|
||||
va_end(list);
|
||||
|
||||
WriteToLog("S", frmt, 1);
|
||||
}
|
||||
|
||||
void LogWriter::SkipLn()
|
||||
{
|
||||
|
@ -271,9 +220,9 @@ void LogFrame::Task()
|
|||
|
||||
const int cur_item = m_log.GetItemCount();
|
||||
|
||||
m_log.InsertItem(cur_item, item.m_prefix);
|
||||
m_log.SetItem(cur_item, 1, item.m_text);
|
||||
m_log.SetItemTextColour(cur_item, item.m_colour);
|
||||
m_log.InsertItem(cur_item, fmt::FromUTF8(item.m_prefix));
|
||||
m_log.SetItem(cur_item, 1, fmt::FromUTF8(item.m_text));
|
||||
m_log.SetItemTextColour(cur_item, fmt::FromUTF8(item.m_colour));
|
||||
m_log.SetColumnWidth(0, -1); // crashes on exit
|
||||
m_log.SetColumnWidth(1, -1);
|
||||
|
||||
|
|
|
@ -11,15 +11,39 @@ class LogWriter
|
|||
//wxString m_prefix;
|
||||
//wxString m_value;
|
||||
|
||||
virtual void WriteToLog(const wxString& prefix, const wxString& value, u8 lvl);
|
||||
virtual void WriteToLog(const std::string& prefix, const std::string& value, u8 lvl);
|
||||
|
||||
public:
|
||||
LogWriter();
|
||||
|
||||
virtual void Write(const wxString& fmt, ...);
|
||||
virtual void Error(const wxString& fmt, ...);
|
||||
virtual void Warning(const wxString& fmt, ...);
|
||||
virtual void Success(const wxString& fmt, ...);
|
||||
template <typename ...Arg>
|
||||
void Write(const std::string &fmt, Arg&&... args)
|
||||
{
|
||||
std::string frmt = fmt::Format(fmt, std::forward<Arg>(args)...);
|
||||
WriteToLog("!", frmt, 2);
|
||||
}
|
||||
|
||||
template <typename ...Arg>
|
||||
void Error(const std::string &fmt, Arg&&... args)
|
||||
{
|
||||
std::string frmt = fmt::Format(fmt, std::forward<Arg>(args)...);
|
||||
WriteToLog("E", frmt, 4);
|
||||
}
|
||||
|
||||
template <typename ...Arg>
|
||||
void Warning(const std::string &fmt, Arg&&... args)
|
||||
{
|
||||
std::string frmt = fmt::Format(fmt, std::forward<Arg>(args)...);
|
||||
WriteToLog("W", frmt, 3);
|
||||
}
|
||||
|
||||
template <typename ...Arg>
|
||||
void Success(const std::string &fmt, Arg&&... args)
|
||||
{
|
||||
std::string frmt = fmt::Format(fmt, std::forward<Arg>(args)...);
|
||||
WriteToLog("S", frmt, 1);
|
||||
}
|
||||
|
||||
virtual void SkipLn();
|
||||
};
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ public:
|
|||
{
|
||||
m_btn_run->Enable(!Emu.IsStopped());
|
||||
m_btn_stop->Enable(!Emu.IsStopped());
|
||||
m_btn_restart->Enable(!Emu.m_path.IsEmpty());
|
||||
m_btn_restart->Enable(!Emu.m_path.empty());
|
||||
}
|
||||
|
||||
void OnRun(wxCommandEvent& event)
|
||||
|
|
|
@ -172,7 +172,7 @@ public:
|
|||
disasm->dump_pc = sh_addr + off;
|
||||
decoder->Decode(Memory.Read32(disasm->dump_pc));
|
||||
|
||||
arr[id][sh].Add(disasm->last_opcode);
|
||||
arr[id][sh].Add(fmt::FromUTF8(disasm->last_opcode));
|
||||
|
||||
off += (cores - id) * 4;
|
||||
off += id * 4;
|
||||
|
@ -297,7 +297,7 @@ void DisAsmFrame::Dump(wxCommandEvent& WXUNUSED(event))
|
|||
vfsLocalFile& f_elf = *new vfsLocalFile(nullptr);
|
||||
f_elf.Open(Emu.m_path);
|
||||
|
||||
ConLog.Write("path: %s", Emu.m_path.wx_str());
|
||||
ConLog.Write("path: %s", Emu.m_path.c_str());
|
||||
Elf_Ehdr ehdr;
|
||||
ehdr.Load(f_elf);
|
||||
|
||||
|
@ -306,7 +306,7 @@ void DisAsmFrame::Dump(wxCommandEvent& WXUNUSED(event))
|
|||
ConLog.Error("Corrupted ELF!");
|
||||
return;
|
||||
}
|
||||
wxArrayString name_arr;
|
||||
std::vector<std::string> name_arr;
|
||||
|
||||
switch(ehdr.GetClass())
|
||||
{
|
||||
|
@ -384,10 +384,10 @@ void DisAsmFrame::Dump(wxCommandEvent& WXUNUSED(event))
|
|||
const u64 sh_size = (ElfType64 ? (*shdr_arr_64)[sh].sh_size : (*shdr_arr_32)[sh].sh_size) / 4;
|
||||
const u64 sh_addr = (ElfType64 ? (*shdr_arr_64)[sh].sh_addr : (*shdr_arr_32)[sh].sh_addr);
|
||||
|
||||
const wxString name = sh < name_arr.GetCount() ? name_arr[sh] : "Unknown";
|
||||
const std::string name = sh < name_arr.size() ? name_arr[sh] : "Unknown";
|
||||
|
||||
fd.Write(wxString::Format("Start of section header %s[%d] (instructions count: %d)\n", name.wx_str(), sh, sh_size));
|
||||
prog_dial.Update(0, vsize, wxString::Format("Disasm %s section", name.wx_str()));
|
||||
fd.Write(wxString::Format("Start of section header %s[%d] (instructions count: %d)\n", name.c_str(), sh, sh_size));
|
||||
prog_dial.Update(0, vsize, wxString::Format("Disasm %s section", name.c_str()));
|
||||
|
||||
if(Memory.IsGoodAddr(sh_addr))
|
||||
{
|
||||
|
@ -396,10 +396,10 @@ void DisAsmFrame::Dump(wxCommandEvent& WXUNUSED(event))
|
|||
disasm->dump_pc = addr;
|
||||
decoder->Decode(Memory.Read32(disasm->dump_pc));
|
||||
fd.Write("\t");
|
||||
fd.Write(disasm->last_opcode);
|
||||
fd.Write(fmt::FromUTF8(disasm->last_opcode));
|
||||
}
|
||||
}
|
||||
fd.Write(wxString::Format("End of section header %s[%d]\n\n", name.wx_str(), sh));
|
||||
fd.Write(wxString::Format("End of section header %s[%d]\n\n", name.c_str(), sh));
|
||||
}
|
||||
|
||||
prog_dial.Close();
|
||||
|
@ -481,7 +481,7 @@ void DisAsmFrame::SetPc(wxCommandEvent& WXUNUSED(event))
|
|||
|
||||
if(diag.ShowModal() == wxID_OK)
|
||||
{
|
||||
sscanf(p_pc->GetLabel(), "%llx", &CPU.PC);
|
||||
sscanf(fmt::ToUTF8(p_pc->GetLabel()).c_str(), "%llx", &CPU.PC);
|
||||
Resume();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ protected:
|
|||
wxWindow* parent,
|
||||
wxWindowID id = wxID_ANY,
|
||||
const wxString& framename = "UnknownFrame",
|
||||
const wxString& ininame = wxEmptyString,
|
||||
const std::string& ininame = "",
|
||||
wxSize defsize = wxDefaultSize,
|
||||
wxPoint defposition = wxDefaultPosition,
|
||||
long style = wxDEFAULT_FRAME_STYLE,
|
||||
|
@ -20,7 +20,7 @@ protected:
|
|||
, m_default_info(defsize, defposition)
|
||||
, m_is_skip_resize(is_skip_resize)
|
||||
{
|
||||
m_ini.Init(ininame.IsEmpty() ? framename : ininame, "GuiSettings");
|
||||
m_ini.Init(ininame.empty() ? fmt::ToUTF8(framename) : ininame, "GuiSettings");
|
||||
LoadInfo();
|
||||
|
||||
Connect(GetId(), wxEVT_CLOSE_WINDOW, wxCloseEventHandler(FrameBase::OnClose));
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#include "GameViewer.h"
|
||||
#include "Loader/PSF.h"
|
||||
|
||||
static const wxString m_class_name = "GameViewer";
|
||||
static const std::string m_class_name = "GameViewer";
|
||||
GameViewer::GameViewer(wxWindow* parent) : wxListView(parent)
|
||||
{
|
||||
LoadSettings();
|
||||
|
@ -28,16 +28,16 @@ void GameViewer::DoResize(wxSize size)
|
|||
void GameViewer::LoadGames()
|
||||
{
|
||||
vfsDir dir(m_path);
|
||||
ConLog.Write("path: %s", m_path.wx_str());
|
||||
ConLog.Write("path: %s", m_path.c_str());
|
||||
if(!dir.IsOpened()) return;
|
||||
|
||||
m_games.Clear();
|
||||
m_games.clear();
|
||||
|
||||
for(const DirEntryInfo* info = dir.Read(); info; info = dir.Read())
|
||||
{
|
||||
if(info->flags & DirEntry_TypeDir)
|
||||
{
|
||||
m_games.Add(info->name);
|
||||
m_games.push_back(info->name);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -48,9 +48,9 @@ void GameViewer::LoadGames()
|
|||
void GameViewer::LoadPSF()
|
||||
{
|
||||
m_game_data.clear();
|
||||
for(uint i=0; i<m_games.GetCount(); ++i)
|
||||
for(uint i=0; i<m_games.size(); ++i)
|
||||
{
|
||||
const wxString& path = m_path + m_games[i] + "/PARAM.SFO";
|
||||
const std::string path = m_path + m_games[i] + "/PARAM.SFO";
|
||||
vfsFile f;
|
||||
if(!f.Open(path))
|
||||
continue;
|
||||
|
@ -69,8 +69,8 @@ void GameViewer::LoadPSF()
|
|||
game.parental_lvl = psf.GetInteger("PARENTAL_LEVEL");
|
||||
game.resolution = psf.GetInteger("RESOLUTION");
|
||||
game.sound_format = psf.GetInteger("SOUND_FORMAT");
|
||||
if(game.serial.Length() == 9)
|
||||
game.serial = game.serial(0, 4) + "-" + game.serial(4, 5);
|
||||
if(game.serial.length() == 9)
|
||||
game.serial = game.serial.substr(0, 4) + "-" + game.serial.substr(4, 5);
|
||||
|
||||
m_game_data.push_back(game);
|
||||
}
|
||||
|
@ -107,14 +107,14 @@ void GameViewer::DClick(wxListEvent& event)
|
|||
long i = GetFirstSelected();
|
||||
if(i < 0) return;
|
||||
|
||||
const wxString& path = m_path + m_game_data[i].root;
|
||||
const std::string& path = m_path + m_game_data[i].root;
|
||||
|
||||
Emu.Stop();
|
||||
Emu.GetVFS().Init(path);
|
||||
wxString local_path;
|
||||
if(Emu.GetVFS().GetDevice(path, local_path) && !Emu.BootGame(local_path.ToStdString()))
|
||||
std::string local_path;
|
||||
if(Emu.GetVFS().GetDevice(path, local_path) && !Emu.BootGame(local_path))
|
||||
{
|
||||
ConLog.Error("Boot error: elf not found! [%s]", path.wx_str());
|
||||
ConLog.Error("Boot error: elf not found! [%s]", path.c_str());
|
||||
return;
|
||||
}
|
||||
Emu.Run();
|
||||
|
|
|
@ -7,13 +7,13 @@ struct Column
|
|||
u32 pos;
|
||||
u32 width;
|
||||
bool shown;
|
||||
wxArrayString data;
|
||||
std::vector<std::string> data;
|
||||
|
||||
const wxString name;
|
||||
const std::string name;
|
||||
const u32 def_pos;
|
||||
const u32 def_width;
|
||||
|
||||
Column(const u32 _def_pos, const u32 _def_width, const wxString& _name)
|
||||
Column(const u32 _def_pos, const u32 _def_width, const std::string& _name)
|
||||
: def_pos(_def_pos)
|
||||
, def_width(_def_width)
|
||||
, pos(_def_pos)
|
||||
|
@ -21,7 +21,7 @@ struct Column
|
|||
, shown(true)
|
||||
, name(_name)
|
||||
{
|
||||
data.Clear();
|
||||
data.clear();
|
||||
}
|
||||
|
||||
};
|
||||
|
@ -91,23 +91,23 @@ public:
|
|||
|
||||
void Update(std::vector<GameInfo>& game_data)
|
||||
{
|
||||
m_col_name->data.Clear();
|
||||
m_col_serial->data.Clear();
|
||||
m_col_fw->data.Clear();
|
||||
m_col_app_ver->data.Clear();
|
||||
m_col_category->data.Clear();
|
||||
m_col_path->data.Clear();
|
||||
m_col_name->data.clear();
|
||||
m_col_serial->data.clear();
|
||||
m_col_fw->data.clear();
|
||||
m_col_app_ver->data.clear();
|
||||
m_col_category->data.clear();
|
||||
m_col_path->data.clear();
|
||||
|
||||
if(m_columns.GetCount() == 0) return;
|
||||
|
||||
for(const auto& game : game_data)
|
||||
{
|
||||
m_col_name->data.Add(game.name);
|
||||
m_col_serial->data.Add(game.serial);
|
||||
m_col_fw->data.Add(game.fw);
|
||||
m_col_app_ver->data.Add(game.app_ver);
|
||||
m_col_category->data.Add(game.category);
|
||||
m_col_path->data.Add(game.root);
|
||||
m_col_name->data.push_back(game.name);
|
||||
m_col_serial->data.push_back(game.serial);
|
||||
m_col_fw->data.push_back(game.fw);
|
||||
m_col_app_ver->data.push_back(game.app_ver);
|
||||
m_col_category->data.push_back(game.category);
|
||||
m_col_path->data.push_back(game.root);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -118,7 +118,7 @@ public:
|
|||
for(u32 i=0, c=0; i<c_col.GetCount(); ++i)
|
||||
{
|
||||
if(!c_col[i].shown) continue;
|
||||
list->InsertColumn(c++, c_col[i].name, 0, c_col[i].width);
|
||||
list->InsertColumn(c++, fmt::FromUTF8(c_col[i].name), 0, c_col[i].width);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -135,15 +135,15 @@ public:
|
|||
return;
|
||||
}
|
||||
|
||||
for(u32 i=0; i<col->data.GetCount(); ++i)
|
||||
for(u32 i=0; i<col->data.size(); ++i)
|
||||
{
|
||||
if(list->GetItemCount() <= (int)i) list->InsertItem(i, wxEmptyString);
|
||||
list->SetItem(i, c, col->data[i]);
|
||||
list->SetItem(i, c, fmt::FromUTF8(col->data[i]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LoadSave(bool isLoad, const wxString& path, wxListView* list = NULL)
|
||||
void LoadSave(bool isLoad, const std::string& path, wxListView* list = NULL)
|
||||
{
|
||||
if(isLoad) Init();
|
||||
else if(list)
|
||||
|
@ -215,8 +215,8 @@ public:
|
|||
|
||||
class GameViewer : public wxListView
|
||||
{
|
||||
wxString m_path;
|
||||
wxArrayString m_games;
|
||||
std::string m_path;
|
||||
std::vector<std::string> m_games;
|
||||
std::vector<GameInfo> m_game_data;
|
||||
ColumnsArr m_columns;
|
||||
|
||||
|
|
|
@ -98,7 +98,7 @@ void InstructionEditorDialog::updatePreview(wxCommandEvent& event)
|
|||
{
|
||||
disasm->dump_pc = pc;
|
||||
((PPCDecoder*)decoder)->Decode((u32)opcode);
|
||||
wxString preview = disasm->last_opcode;
|
||||
wxString preview = fmt::FromUTF8(disasm->last_opcode);
|
||||
preview.Remove(0, preview.Find(':') + 1);
|
||||
t3_preview->SetLabel(preview);
|
||||
}
|
||||
|
|
|
@ -257,11 +257,11 @@ void InterpreterDisAsmFrame::ShowAddr(const u64 addr)
|
|||
|
||||
if(IsBreakPoint(PC))
|
||||
{
|
||||
m_list->SetItem(i, 0, ">>> " + disasm->last_opcode);
|
||||
m_list->SetItem(i, 0, fmt::FromUTF8(">>> " + disasm->last_opcode));
|
||||
}
|
||||
else
|
||||
{
|
||||
m_list->SetItem(i, 0, " " + disasm->last_opcode);
|
||||
m_list->SetItem(i, 0, fmt::FromUTF8(" " + disasm->last_opcode));
|
||||
}
|
||||
|
||||
wxColour colour;
|
||||
|
@ -318,11 +318,11 @@ void InterpreterDisAsmFrame::WriteRegs()
|
|||
return;
|
||||
}
|
||||
|
||||
const wxString data = CPU->RegsToString();
|
||||
const std::string data = CPU->RegsToString();
|
||||
|
||||
m_regs->Freeze();
|
||||
m_regs->Clear();
|
||||
m_regs->WriteText(data);
|
||||
m_regs->WriteText(fmt::FromUTF8(data));
|
||||
m_regs->Thaw();
|
||||
}
|
||||
|
||||
|
@ -334,11 +334,11 @@ void InterpreterDisAsmFrame::WriteCallStack()
|
|||
return;
|
||||
}
|
||||
|
||||
const wxString data = CPU->CallStackToString();
|
||||
const std::string data = CPU->CallStackToString();
|
||||
|
||||
m_calls->Freeze();
|
||||
m_calls->Clear();
|
||||
m_calls->WriteText(data);
|
||||
m_calls->WriteText(fmt::FromUTF8(data));
|
||||
m_calls->Thaw();
|
||||
}
|
||||
|
||||
|
|
|
@ -163,16 +163,16 @@ void MainFrame::AddPane(wxWindow* wind, const wxString& caption, int flags)
|
|||
|
||||
void MainFrame::DoSettings(bool load)
|
||||
{
|
||||
IniEntry<wxString> ini;
|
||||
IniEntry<std::string> ini;
|
||||
ini.Init("Settings", "MainFrameAui");
|
||||
|
||||
if(load)
|
||||
{
|
||||
m_aui_mgr.LoadPerspective(ini.LoadValue(m_aui_mgr.SavePerspective()));
|
||||
m_aui_mgr.LoadPerspective(fmt::FromUTF8(ini.LoadValue(fmt::ToUTF8(m_aui_mgr.SavePerspective()))));
|
||||
}
|
||||
else
|
||||
{
|
||||
ini.SaveValue(m_aui_mgr.SavePerspective());
|
||||
ini.SaveValue(fmt::ToUTF8(m_aui_mgr.SavePerspective()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -228,7 +228,7 @@ void MainFrame::InstallPkg(wxCommandEvent& WXUNUSED(event))
|
|||
Emu.Stop();
|
||||
|
||||
// Open and install PKG file
|
||||
std::string filePath = ctrl.GetPath().ToStdString();
|
||||
wxString filePath = ctrl.GetPath();
|
||||
wxFile pkg_f(filePath, wxFile::read); // TODO: Use VFS to install PKG files
|
||||
|
||||
if (pkg_f.IsOpened())
|
||||
|
@ -271,7 +271,7 @@ void MainFrame::BootElf(wxCommandEvent& WXUNUSED(event))
|
|||
|
||||
Emu.Stop();
|
||||
|
||||
Emu.SetPath(ctrl.GetPath());
|
||||
Emu.SetPath(fmt::ToUTF8(ctrl.GetPath()));
|
||||
Emu.Load();
|
||||
|
||||
ConLog.Success("(S)ELF: boot done.");
|
||||
|
@ -862,7 +862,7 @@ void MainFrame::UpdateUI(wxCommandEvent& event)
|
|||
//send_exit.Enable(false);
|
||||
bool enable_commands = !is_stopped && Emu.GetCallbackManager().m_exit_callback.m_callbacks.GetCount();
|
||||
|
||||
send_open_menu.SetItemLabel(wxString::Format("Send %s system menu cmd", wxString(m_sys_menu_opened ? "close" : "open").wx_str()));
|
||||
send_open_menu.SetItemLabel(wxString::Format("Send %s system menu cmd", std::string(m_sys_menu_opened ? "close" : "open").c_str()));
|
||||
send_open_menu.Enable(enable_commands);
|
||||
send_exit.Enable(enable_commands);
|
||||
|
||||
|
@ -887,7 +887,7 @@ void MainFrame::OnKeyDown(wxKeyEvent& event)
|
|||
case 'E': case 'e': if(Emu.IsPaused()) Emu.Resume(); else if(Emu.IsReady()) Emu.Run(); return;
|
||||
case 'P': case 'p': if(Emu.IsRunning()) Emu.Pause(); return;
|
||||
case 'S': case 's': if(!Emu.IsStopped()) Emu.Stop(); return;
|
||||
case 'R': case 'r': if(!Emu.m_path.IsEmpty()) {Emu.Stop(); Emu.Run();} return;
|
||||
case 'R': case 'r': if(!Emu.m_path.empty()) {Emu.Stop(); Emu.Run();} return;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue