mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-11-22 02:32:36 +01:00
fmt::by_value, fmt::Format removed
This commit is contained in:
parent
15057ffc5e
commit
ce494f8847
@ -131,5 +131,5 @@ void log_message(Log::LogType type, Log::Severity sev, std::string text);
|
||||
|
||||
template<typename... Args> never_inline void log_message(Log::LogType type, Log::Severity sev, const char* fmt, Args... args)
|
||||
{
|
||||
log_message(type, sev, fmt::Format(fmt, fmt::do_unveil(args)...));
|
||||
log_message(type, sev, fmt::format(fmt, fmt::do_unveil(args)...));
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ std::string v128::to_hex() const
|
||||
|
||||
std::string v128::to_xyzw() const
|
||||
{
|
||||
return fmt::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]);
|
||||
}
|
||||
|
||||
std::string fmt::to_hex(u64 value, size_t count)
|
||||
@ -74,7 +74,7 @@ std::string fmt::to_sdec(s64 svalue)
|
||||
return std::string(&res[first], sizeof(res) - first);
|
||||
}
|
||||
|
||||
extern const std::string fmt::placeholder = "???";
|
||||
//extern const std::string fmt::placeholder = "???";
|
||||
|
||||
std::string fmt::replace_first(const std::string& src, const std::string& from, const std::string& to)
|
||||
{
|
||||
@ -240,7 +240,7 @@ std::string fmt::escape(std::string source)
|
||||
|
||||
for (char c = 0; c < 32; c++)
|
||||
{
|
||||
if (c != '\n') source = fmt::replace_all(source, std::string(1, c), fmt::Format("\\x%02X", c));
|
||||
if (c != '\n') source = fmt::replace_all(source, std::string(1, c), fmt::format("\\x%02X", c));
|
||||
}
|
||||
|
||||
return source;
|
||||
|
@ -2,15 +2,15 @@
|
||||
|
||||
class wxString;
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_MSC_VER) && _MSC_VER <= 1800
|
||||
#define snprintf _snprintf
|
||||
#endif
|
||||
|
||||
namespace fmt
|
||||
{
|
||||
struct empty_t{};
|
||||
//struct empty_t{};
|
||||
|
||||
extern const std::string placeholder;
|
||||
//extern const std::string placeholder;
|
||||
|
||||
template <typename T>
|
||||
std::string AfterLast(const std::string& source, T searchstr)
|
||||
@ -90,37 +90,6 @@ namespace fmt
|
||||
// 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
|
||||
template<typename... Args> std::string Format(const char* fmt, Args... parameters)
|
||||
{
|
||||
size_t length = 256;
|
||||
std::string str;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
std::vector<char> buffptr(length);
|
||||
#if !defined(_MSC_VER)
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wformat-security"
|
||||
size_t printlen = snprintf(buffptr.data(), length, fmt, std::forward<Args>(parameters)...);
|
||||
#pragma GCC diagnostic pop
|
||||
#else
|
||||
size_t printlen = _snprintf_s(buffptr.data(), length, length - 1, fmt, std::forward<Args>(parameters)...);
|
||||
#endif
|
||||
if (printlen < length)
|
||||
{
|
||||
str = std::string(buffptr.data(), printlen);
|
||||
break;
|
||||
}
|
||||
length *= 2;
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
std::string replace_first(const std::string& src, const std::string& from, const std::string& to);
|
||||
std::string replace_all(const std::string &src, const std::string& from, const std::string& to);
|
||||
|
||||
@ -259,22 +228,39 @@ namespace fmt
|
||||
return unveil<T>::get_value(arg);
|
||||
}
|
||||
|
||||
/*
|
||||
fmt::format(const char* fmt, args...)
|
||||
|
||||
Formatting function with special functionality:
|
||||
|
||||
std::string forced to .c_str()
|
||||
be_t<> forced to .value() (fmt::unveil reverts byte order automatically)
|
||||
|
||||
External specializations for fmt::unveil (can be found in another headers):
|
||||
vm::ptr, vm::bptr, ... (fmt::unveil) (vm_ptr.h) (with appropriate address type, using .addr() can be avoided)
|
||||
vm::ref, vm::bref, ... (fmt::unveil) (vm_ref.h)
|
||||
|
||||
*/
|
||||
template<typename... Args> force_inline safe_buffers std::string format(const char* fmt, Args... args)
|
||||
// Formatting function with special functionality:
|
||||
//
|
||||
// std::string is forced to .c_str()
|
||||
// be_t<> is forced to .value() (fmt::do_unveil reverts byte order automatically)
|
||||
//
|
||||
// External specializations for fmt::do_unveil (can be found in another headers):
|
||||
// vm::ptr, vm::bptr, ... (fmt::do_unveil) (vm_ptr.h) (with appropriate address type, using .addr() can be avoided)
|
||||
// vm::ref, vm::bref, ... (fmt::do_unveil) (vm_ref.h)
|
||||
//
|
||||
template<typename... Args> safe_buffers std::string format(const char* fmt, Args... args)
|
||||
{
|
||||
return Format(fmt, do_unveil(args)...);
|
||||
// fixed stack buffer for the first attempt
|
||||
std::array<char, 4096> fixed_buf;
|
||||
|
||||
// possibly dynamically allocated buffer for additional attempts
|
||||
std::unique_ptr<char[]> buf;
|
||||
|
||||
// pointer to the current buffer
|
||||
char* buf_addr = fixed_buf.data();
|
||||
|
||||
for (std::size_t buf_size = fixed_buf.size();; buf_size *= 2, buf.reset(buf_addr = new char[buf_size]))
|
||||
{
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wformat-security"
|
||||
const std::size_t len = snprintf(buf_addr, buf_size, fmt, do_unveil(args)...);
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
if (len <= buf_size)
|
||||
{
|
||||
return{ buf_addr, len };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct exception
|
||||
@ -285,7 +271,7 @@ namespace fmt
|
||||
{
|
||||
const std::string data = format(text, args...) + format("\n(in file %s:%d, in function %s)", file, line, func);
|
||||
|
||||
message = std::make_unique<char[]>(data.size() + 1);
|
||||
message.reset(new char[data.size() + 1]);
|
||||
|
||||
std::memcpy(message.get(), data.c_str(), data.size() + 1);
|
||||
}
|
||||
@ -294,7 +280,7 @@ namespace fmt
|
||||
{
|
||||
const std::size_t size = std::strlen(other);
|
||||
|
||||
message = std::make_unique<char[]>(size + 1);
|
||||
message.reset(new char[size + 1]);
|
||||
|
||||
std::memcpy(message.get(), other, size + 1);
|
||||
}
|
||||
|
@ -353,7 +353,7 @@ void ControlInfo::Show()
|
||||
{
|
||||
std::string digest_str;
|
||||
for (int i = 0; i < 20; i++)
|
||||
digest_str += fmt::Format("%02x", file_digest_30.digest[i]);
|
||||
digest_str += fmt::format("%02x", file_digest_30.digest[i]);
|
||||
|
||||
LOG_NOTICE(LOADER, "Digest: %s", digest_str.c_str());
|
||||
LOG_NOTICE(LOADER, "Unknown: 0x%llx", file_digest_30.unknown);
|
||||
@ -364,8 +364,8 @@ void ControlInfo::Show()
|
||||
std::string digest_str2;
|
||||
for (int i = 0; i < 20; i++)
|
||||
{
|
||||
digest_str1 += fmt::Format("%02x", file_digest_40.digest1[i]);
|
||||
digest_str2 += fmt::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]);
|
||||
}
|
||||
|
||||
LOG_NOTICE(LOADER, "Digest1: %s", digest_str1.c_str());
|
||||
@ -380,12 +380,12 @@ void ControlInfo::Show()
|
||||
std::string invdigest_str;
|
||||
std::string xordigest_str;
|
||||
for (int i = 0; i < 48; i++)
|
||||
contentid_str += fmt::Format("%02x", npdrm.content_id[i]);
|
||||
contentid_str += fmt::format("%02x", npdrm.content_id[i]);
|
||||
for (int i = 0; i < 16; 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]);
|
||||
digest_str += fmt::format("%02x", npdrm.digest[i]);
|
||||
invdigest_str += fmt::format("%02x", npdrm.invdigest[i]);
|
||||
xordigest_str += fmt::format("%02x", npdrm.xordigest[i]);
|
||||
}
|
||||
|
||||
LOG_NOTICE(LOADER, "Magic: 0x%08x", npdrm.magic);
|
||||
@ -417,10 +417,10 @@ void MetadataInfo::Show()
|
||||
std::string iv_pad_str;
|
||||
for (int i = 0; i < 0x10; 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]);
|
||||
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]);
|
||||
}
|
||||
|
||||
LOG_NOTICE(LOADER, "Key: %s", key_str.c_str());
|
||||
|
@ -97,11 +97,11 @@ void ARMv7DisAsm::B(const u32 data, const ARMv7_encoding type)
|
||||
Write(__FUNCTION__);
|
||||
//if ((cond & 0xe) == 0xe)
|
||||
//{
|
||||
// Write(fmt::Format("b 0x%x", DisAsmBranchTarget(imm) + intstr_size));
|
||||
// Write(fmt::format("b 0x%x", DisAsmBranchTarget(imm) + intstr_size));
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// Write(fmt::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));
|
||||
//}
|
||||
}
|
||||
|
||||
@ -142,13 +142,13 @@ void ARMv7DisAsm::BKPT(const u32 data, const ARMv7_encoding type)
|
||||
void ARMv7DisAsm::BL(const u32 data, const ARMv7_encoding type)
|
||||
{
|
||||
Write(__FUNCTION__);
|
||||
//Write(fmt::Format("bl 0x%x", DisAsmBranchTarget(imm) + intstr_size));
|
||||
//Write(fmt::format("bl 0x%x", DisAsmBranchTarget(imm) + intstr_size));
|
||||
}
|
||||
|
||||
void ARMv7DisAsm::BLX(const u32 data, const ARMv7_encoding type)
|
||||
{
|
||||
Write(__FUNCTION__);
|
||||
//Write(fmt::Format("bl 0x%x", DisAsmBranchTarget(imm) + intstr_size));
|
||||
//Write(fmt::format("bl 0x%x", DisAsmBranchTarget(imm) + intstr_size));
|
||||
}
|
||||
|
||||
void ARMv7DisAsm::BX(const u32 data, const ARMv7_encoding type)
|
||||
@ -160,8 +160,8 @@ void ARMv7DisAsm::BX(const u32 data, const ARMv7_encoding type)
|
||||
void ARMv7DisAsm::CB_Z(const u32 data, const ARMv7_encoding type)
|
||||
{
|
||||
Write(__FUNCTION__);
|
||||
//Write(fmt::Format("cbz 0x%x,%s", DisAsmBranchTarget(imm) + intstr_size, g_arm_reg_name[rn]));
|
||||
//Write(fmt::Format("cbnz 0x%x,%s", DisAsmBranchTarget(imm) + intstr_size, g_arm_reg_name[rn]));
|
||||
//Write(fmt::format("cbz 0x%x,%s", DisAsmBranchTarget(imm) + intstr_size, g_arm_reg_name[rn]));
|
||||
//Write(fmt::format("cbnz 0x%x,%s", DisAsmBranchTarget(imm) + intstr_size, g_arm_reg_name[rn]));
|
||||
}
|
||||
|
||||
|
||||
@ -471,13 +471,13 @@ void ARMv7DisAsm::PKH(const u32 data, const ARMv7_encoding type)
|
||||
void ARMv7DisAsm::POP(const u32 data, const ARMv7_encoding type)
|
||||
{
|
||||
Write(__FUNCTION__);
|
||||
//Write(fmt::Format("pop {%s}", GetRegsListString(regs_list).c_str()));
|
||||
//Write(fmt::format("pop {%s}", GetRegsListString(regs_list).c_str()));
|
||||
}
|
||||
|
||||
void ARMv7DisAsm::PUSH(const u32 data, const ARMv7_encoding type)
|
||||
{
|
||||
Write(__FUNCTION__);
|
||||
//Write(fmt::Format("push {%s}", GetRegsListString(regs_list).c_str()));
|
||||
//Write(fmt::format("push {%s}", GetRegsListString(regs_list).c_str()));
|
||||
}
|
||||
|
||||
|
||||
|
@ -151,16 +151,16 @@ std::string ARMv7Thread::RegsToString() const
|
||||
std::string result = "Registers:\n=========\n";
|
||||
for(int i=0; i<15; ++i)
|
||||
{
|
||||
result += fmt::Format("%s\t= 0x%08x\n", g_arm_reg_name[i], GPR[i]);
|
||||
result += fmt::format("%s\t= 0x%08x\n", g_arm_reg_name[i], GPR[i]);
|
||||
}
|
||||
|
||||
result += fmt::Format("APSR\t= 0x%08x [N: %d, Z: %d, C: %d, V: %d, Q: %d]\n",
|
||||
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));
|
||||
u32{ APSR.N },
|
||||
u32{ APSR.Z },
|
||||
u32{ APSR.C },
|
||||
u32{ APSR.V },
|
||||
u32{ APSR.Q });
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -13,39 +13,39 @@ protected:
|
||||
|
||||
void DisAsm_V4(const std::string& op, u32 v0, u32 v1, u32 v2, u32 v3)
|
||||
{
|
||||
Write(fmt::Format("%s v%d,v%d,v%d,v%d", FixOp(op).c_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 std::string& op, u32 v0, u32 v1, u32 v2, u32 uimm)
|
||||
{
|
||||
Write(fmt::Format("%s v%d,v%d,v%d,%u #%x", FixOp(op).c_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 std::string& op, u32 v0, u32 v1, u32 v2)
|
||||
{
|
||||
Write(fmt::Format("%s v%d,v%d,v%d", FixOp(op).c_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 std::string& op, u32 v0, u32 v1, u32 uimm)
|
||||
{
|
||||
Write(fmt::Format("%s v%d,v%d,%u #%x", FixOp(op).c_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 std::string& op, u32 v0, u32 v1)
|
||||
{
|
||||
Write(fmt::Format("%s v%d,v%d", FixOp(op).c_str(), v0, v1));
|
||||
Write(fmt::format("%s v%d,v%d", FixOp(op).c_str(), v0, v1));
|
||||
}
|
||||
void DisAsm_V1_SIMM(const std::string& op, u32 v0, s32 simm)
|
||||
{
|
||||
Write(fmt::Format("%s v%d,%d #%x", FixOp(op).c_str(), v0, simm, simm));
|
||||
Write(fmt::format("%s v%d,%d #%x", FixOp(op).c_str(), v0, simm, simm));
|
||||
}
|
||||
void DisAsm_V1(const std::string& op, u32 v0)
|
||||
{
|
||||
Write(fmt::Format("%s v%d", FixOp(op).c_str(), v0));
|
||||
Write(fmt::format("%s v%d", FixOp(op).c_str(), v0));
|
||||
}
|
||||
void DisAsm_V1_R2(const std::string& op, u32 v0, u32 r1, u32 r2)
|
||||
{
|
||||
Write(fmt::Format("%s v%d,r%d,r%d", FixOp(op).c_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 std::string& op, u32 cr0, u32 f0, u32 f1, u32 rc)
|
||||
{
|
||||
Write(fmt::Format("%s%s cr%d,f%d,f%d", FixOp(op).c_str(), (rc ? "." : ""), 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 std::string& op, u32 cr0, u32 f0, u32 f1)
|
||||
{
|
||||
@ -53,15 +53,15 @@ protected:
|
||||
}
|
||||
void DisAsm_INT1_R2(const std::string& op, u32 i0, u32 r0, u32 r1)
|
||||
{
|
||||
Write(fmt::Format("%s %d,r%d,r%d", FixOp(op).c_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 std::string& op, u32 i0, u32 r0, s32 imm0)
|
||||
{
|
||||
Write(fmt::Format("%s %d,r%d,%d #%x", FixOp(op).c_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 std::string& op, u32 i0, u32 r0, u32 rc)
|
||||
{
|
||||
Write(fmt::Format("%s%s %d,r%d", FixOp(op).c_str(), (rc ? "." : ""), i0, r0));
|
||||
Write(fmt::format("%s%s %d,r%d", FixOp(op).c_str(), (rc ? "." : ""), i0, r0));
|
||||
}
|
||||
void DisAsm_INT1_R1(const std::string& op, u32 i0, u32 r0)
|
||||
{
|
||||
@ -69,11 +69,11 @@ protected:
|
||||
}
|
||||
void DisAsm_F4_RC(const std::string& op, u32 f0, u32 f1, u32 f2, u32 f3, u32 rc)
|
||||
{
|
||||
Write(fmt::Format("%s%s f%d,f%d,f%d,f%d", FixOp(op).c_str(), (rc ? "." : ""), 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 std::string& op, u32 f0, u32 f1, u32 f2, u32 rc)
|
||||
{
|
||||
Write(fmt::Format("%s%s f%d,f%d,f%d", FixOp(op).c_str(), (rc ? "." : ""), 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 std::string& op, u32 f0, u32 f1, u32 f2)
|
||||
{
|
||||
@ -81,7 +81,7 @@ protected:
|
||||
}
|
||||
void DisAsm_F2_RC(const std::string& op, u32 f0, u32 f1, u32 rc)
|
||||
{
|
||||
Write(fmt::Format("%s%s f%d,f%d", FixOp(op).c_str(), (rc ? "." : ""), f0, f1));
|
||||
Write(fmt::format("%s%s f%d,f%d", FixOp(op).c_str(), (rc ? "." : ""), f0, f1));
|
||||
}
|
||||
void DisAsm_F2(const std::string& op, u32 f0, u32 f1)
|
||||
{
|
||||
@ -91,21 +91,21 @@ protected:
|
||||
{
|
||||
if(m_mode == CPUDisAsm_CompilerElfMode)
|
||||
{
|
||||
Write(fmt::Format("%s f%d,r%d,r%d", FixOp(op).c_str(), f0, r0, r1));
|
||||
Write(fmt::format("%s f%d,r%d,r%d", FixOp(op).c_str(), f0, r0, r1));
|
||||
return;
|
||||
}
|
||||
|
||||
Write(fmt::Format("%s f%d,r%d(r%d)", FixOp(op).c_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 std::string& op, u32 f0, s32 imm0, u32 r0, u32 rc)
|
||||
{
|
||||
if(m_mode == CPUDisAsm_CompilerElfMode)
|
||||
{
|
||||
Write(fmt::Format("%s%s f%d,r%d,%d #%x", FixOp(op).c_str(), (rc ? "." : ""), 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(fmt::Format("%s%s f%d,%d(r%d) #%x", FixOp(op).c_str(), (rc ? "." : ""), 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 std::string& op, u32 f0, s32 imm0, u32 r0)
|
||||
{
|
||||
@ -113,11 +113,11 @@ protected:
|
||||
}
|
||||
void DisAsm_F1_RC(const std::string& op, u32 f0, u32 rc)
|
||||
{
|
||||
Write(fmt::Format("%s%s f%d", FixOp(op).c_str(), (rc ? "." : ""), f0));
|
||||
Write(fmt::format("%s%s f%d", FixOp(op).c_str(), (rc ? "." : ""), f0));
|
||||
}
|
||||
void DisAsm_R1_RC(const std::string& op, u32 r0, u32 rc)
|
||||
{
|
||||
Write(fmt::Format("%s%s r%d", FixOp(op).c_str(), (rc ? "." : ""), r0));
|
||||
Write(fmt::format("%s%s r%d", FixOp(op).c_str(), (rc ? "." : ""), r0));
|
||||
}
|
||||
void DisAsm_R1(const std::string& op, u32 r0)
|
||||
{
|
||||
@ -125,7 +125,7 @@ protected:
|
||||
}
|
||||
void DisAsm_R2_OE_RC(const std::string& op, u32 r0, u32 r1, u32 oe, u32 rc)
|
||||
{
|
||||
Write(fmt::Format("%s%s%s r%d,r%d", FixOp(op).c_str(), (oe ? "o" : ""), (rc ? "." : ""), 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 std::string& op, u32 r0, u32 r1, u32 rc)
|
||||
{
|
||||
@ -137,11 +137,11 @@ protected:
|
||||
}
|
||||
void DisAsm_R3_OE_RC(const std::string& op, u32 r0, u32 r1, u32 r2, u32 oe, u32 rc)
|
||||
{
|
||||
Write(fmt::Format("%s%s%s r%d,r%d,r%d", FixOp(op).c_str(), (oe ? "o" : ""), (rc ? "." : ""), 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 std::string& op, u32 r0, u32 r1, u32 r2, s32 i0, s32 i1, u32 rc)
|
||||
{
|
||||
Write(fmt::Format("%s%s r%d,r%d,r%d,%d,%d", FixOp(op).c_str(), (rc ? "." : ""), 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 std::string& op, u32 r0, u32 r1, u32 r2, u32 rc)
|
||||
{
|
||||
@ -153,7 +153,7 @@ protected:
|
||||
}
|
||||
void DisAsm_R2_INT3_RC(const std::string& op, u32 r0, u32 r1, s32 i0, s32 i1, s32 i2, u32 rc)
|
||||
{
|
||||
Write(fmt::Format("%s%s r%d,r%d,%d,%d,%d", FixOp(op).c_str(), (rc ? "." : ""), 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 std::string& op, u32 r0, u32 r1, s32 i0, s32 i1, s32 i2)
|
||||
{
|
||||
@ -161,7 +161,7 @@ protected:
|
||||
}
|
||||
void DisAsm_R2_INT2_RC(const std::string& op, u32 r0, u32 r1, s32 i0, s32 i1, u32 rc)
|
||||
{
|
||||
Write(fmt::Format("%s%s r%d,r%d,%d,%d", FixOp(op).c_str(), (rc ? "." : ""), 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 std::string& op, u32 r0, u32 r1, s32 i0, s32 i1)
|
||||
{
|
||||
@ -169,7 +169,7 @@ protected:
|
||||
}
|
||||
void DisAsm_R2_INT1_RC(const std::string& op, u32 r0, u32 r1, s32 i0, u32 rc)
|
||||
{
|
||||
Write(fmt::Format("%s%s r%d,r%d,%d", FixOp(op).c_str(), (rc ? "." : ""), 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 std::string& op, u32 r0, u32 r1, s32 i0)
|
||||
{
|
||||
@ -179,27 +179,27 @@ protected:
|
||||
{
|
||||
if(m_mode == CPUDisAsm_CompilerElfMode)
|
||||
{
|
||||
Write(fmt::Format("%s r%d,r%d,%d #%x", FixOp(op).c_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(fmt::Format("%s r%d,%d(r%d) #%x", FixOp(op).c_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 std::string& op, u32 r0, s32 imm0)
|
||||
{
|
||||
Write(fmt::Format("%s r%d,%d #%x", FixOp(op).c_str(), r0, imm0, imm0));
|
||||
Write(fmt::format("%s r%d,%d #%x", FixOp(op).c_str(), r0, imm0, imm0));
|
||||
}
|
||||
void DisAsm_IMM_R1(const std::string& op, s32 imm0, u32 r0)
|
||||
{
|
||||
Write(fmt::Format("%s %d,r%d #%x", FixOp(op).c_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 std::string& op, u32 cr0, u32 r0, s32 imm0)
|
||||
{
|
||||
Write(fmt::Format("%s cr%d,r%d,%d #%x", FixOp(op).c_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 std::string& op, u32 cr0, u32 r0, u32 r1, u32 rc)
|
||||
{
|
||||
Write(fmt::Format("%s%s cr%d,r%d,r%d", FixOp(op).c_str(), (rc ? "." : ""), 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 std::string& op, u32 cr0, u32 r0, u32 r1)
|
||||
{
|
||||
@ -207,30 +207,30 @@ protected:
|
||||
}
|
||||
void DisAsm_CR2(const std::string& op, u32 cr0, u32 cr1)
|
||||
{
|
||||
Write(fmt::Format("%s cr%d,cr%d", FixOp(op).c_str(), cr0, cr1));
|
||||
Write(fmt::format("%s cr%d,cr%d", FixOp(op).c_str(), cr0, cr1));
|
||||
}
|
||||
void DisAsm_INT3(const std::string& op, const int i0, const int i1, const int i2)
|
||||
{
|
||||
Write(fmt::Format("%s %d,%d,%d", FixOp(op).c_str(), i0, i1, i2));
|
||||
Write(fmt::format("%s %d,%d,%d", FixOp(op).c_str(), i0, i1, i2));
|
||||
}
|
||||
void DisAsm_INT1(const std::string& op, const int i0)
|
||||
{
|
||||
Write(fmt::Format("%s %d", FixOp(op).c_str(), i0));
|
||||
Write(fmt::format("%s %d", FixOp(op).c_str(), i0));
|
||||
}
|
||||
void DisAsm_BRANCH(const std::string& op, const int pc)
|
||||
{
|
||||
Write(fmt::Format("%s 0x%x", FixOp(op).c_str(), DisAsmBranchTarget(pc)));
|
||||
Write(fmt::format("%s 0x%x", FixOp(op).c_str(), DisAsmBranchTarget(pc)));
|
||||
}
|
||||
void DisAsm_BRANCH_A(const std::string& op, const int pc)
|
||||
{
|
||||
Write(fmt::Format("%s 0x%x", FixOp(op).c_str(), pc));
|
||||
Write(fmt::format("%s 0x%x", FixOp(op).c_str(), pc));
|
||||
}
|
||||
void DisAsm_B2_BRANCH(const std::string& op, u32 b0, u32 b1, const int pc)
|
||||
{
|
||||
Write(fmt::Format("%s %d,%d,0x%x ", FixOp(op).c_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 std::string& op, u32 cr, const int pc)
|
||||
{
|
||||
Write(fmt::Format("%s cr%d,0x%x ", FixOp(op).c_str(), cr, DisAsmBranchTarget(pc)));
|
||||
Write(fmt::format("%s cr%d,0x%x ", FixOp(op).c_str(), cr, DisAsmBranchTarget(pc)));
|
||||
}
|
||||
};
|
||||
|
@ -21,39 +21,39 @@ private:
|
||||
private:
|
||||
void DisAsm_V4(const std::string& op, u32 v0, u32 v1, u32 v2, u32 v3)
|
||||
{
|
||||
Write(fmt::Format("%s v%d,v%d,v%d,v%d", FixOp(op).c_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 std::string& op, u32 v0, u32 v1, u32 v2, u32 uimm)
|
||||
{
|
||||
Write(fmt::Format("%s v%d,v%d,v%d,%u #%x", FixOp(op).c_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 std::string& op, u32 v0, u32 v1, u32 v2)
|
||||
{
|
||||
Write(fmt::Format("%s v%d,v%d,v%d", FixOp(op).c_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 std::string& op, u32 v0, u32 v1, u32 uimm)
|
||||
{
|
||||
Write(fmt::Format("%s v%d,v%d,%u #%x", FixOp(op).c_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 std::string& op, u32 v0, u32 v1)
|
||||
{
|
||||
Write(fmt::Format("%s v%d,v%d", FixOp(op).c_str(), v0, v1));
|
||||
Write(fmt::format("%s v%d,v%d", FixOp(op).c_str(), v0, v1));
|
||||
}
|
||||
void DisAsm_V1_SIMM(const std::string& op, u32 v0, s32 simm)
|
||||
{
|
||||
Write(fmt::Format("%s v%d,%d #%x", FixOp(op).c_str(), v0, simm, simm));
|
||||
Write(fmt::format("%s v%d,%d #%x", FixOp(op).c_str(), v0, simm, simm));
|
||||
}
|
||||
void DisAsm_V1(const std::string& op, u32 v0)
|
||||
{
|
||||
Write(fmt::Format("%s v%d", FixOp(op).c_str(), v0));
|
||||
Write(fmt::format("%s v%d", FixOp(op).c_str(), v0));
|
||||
}
|
||||
void DisAsm_V1_R2(const std::string& op, u32 v0, u32 r1, u32 r2)
|
||||
{
|
||||
Write(fmt::Format("%s v%d,r%d,r%d", FixOp(op).c_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 std::string& op, u32 cr0, u32 f0, u32 f1, u32 rc)
|
||||
{
|
||||
Write(fmt::Format("%s%s cr%d,f%d,f%d", FixOp(op).c_str(), (rc ? "." : ""), 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 std::string& op, u32 cr0, u32 f0, u32 f1)
|
||||
{
|
||||
@ -61,15 +61,15 @@ private:
|
||||
}
|
||||
void DisAsm_INT1_R2(const std::string& op, u32 i0, u32 r0, u32 r1)
|
||||
{
|
||||
Write(fmt::Format("%s %d,r%d,r%d", FixOp(op).c_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 std::string& op, u32 i0, u32 r0, s32 imm0)
|
||||
{
|
||||
Write(fmt::Format("%s %d,r%d,%d #%x", FixOp(op).c_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 std::string& op, u32 i0, u32 r0, u32 rc)
|
||||
{
|
||||
Write(fmt::Format("%s%s %d,r%d", FixOp(op).c_str(), (rc ? "." : ""), i0, r0));
|
||||
Write(fmt::format("%s%s %d,r%d", FixOp(op).c_str(), (rc ? "." : ""), i0, r0));
|
||||
}
|
||||
void DisAsm_INT1_R1(const std::string& op, u32 i0, u32 r0)
|
||||
{
|
||||
@ -77,11 +77,11 @@ private:
|
||||
}
|
||||
void DisAsm_F4_RC(const std::string& op, u32 f0, u32 f1, u32 f2, u32 f3, u32 rc)
|
||||
{
|
||||
Write(fmt::Format("%s%s f%d,f%d,f%d,f%d", FixOp(op).c_str(), (rc ? "." : ""), 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 std::string& op, u32 f0, u32 f1, u32 f2, u32 rc)
|
||||
{
|
||||
Write(fmt::Format("%s%s f%d,f%d,f%d", FixOp(op).c_str(), (rc ? "." : ""), 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 std::string& op, u32 f0, u32 f1, u32 f2)
|
||||
{
|
||||
@ -89,7 +89,7 @@ private:
|
||||
}
|
||||
void DisAsm_F2_RC(const std::string& op, u32 f0, u32 f1, u32 rc)
|
||||
{
|
||||
Write(fmt::Format("%s%s f%d,f%d", FixOp(op).c_str(), (rc ? "." : ""), f0, f1));
|
||||
Write(fmt::format("%s%s f%d,f%d", FixOp(op).c_str(), (rc ? "." : ""), f0, f1));
|
||||
}
|
||||
void DisAsm_F2(const std::string& op, u32 f0, u32 f1)
|
||||
{
|
||||
@ -99,21 +99,21 @@ private:
|
||||
{
|
||||
if(m_mode == CPUDisAsm_CompilerElfMode)
|
||||
{
|
||||
Write(fmt::Format("%s f%d,r%d,r%d", FixOp(op).c_str(), f0, r0, r1));
|
||||
Write(fmt::format("%s f%d,r%d,r%d", FixOp(op).c_str(), f0, r0, r1));
|
||||
return;
|
||||
}
|
||||
|
||||
Write(fmt::Format("%s f%d,r%d(r%d)", FixOp(op).c_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 std::string& op, u32 f0, s32 imm0, u32 r0, u32 rc)
|
||||
{
|
||||
if(m_mode == CPUDisAsm_CompilerElfMode)
|
||||
{
|
||||
Write(fmt::Format("%s%s f%d,r%d,%d #%x", FixOp(op).c_str(), (rc ? "." : ""), 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(fmt::Format("%s%s f%d,%d(r%d) #%x", FixOp(op).c_str(), (rc ? "." : ""), 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 std::string& op, u32 f0, s32 imm0, u32 r0)
|
||||
{
|
||||
@ -121,11 +121,11 @@ private:
|
||||
}
|
||||
void DisAsm_F1_RC(const std::string& op, u32 f0, u32 rc)
|
||||
{
|
||||
Write(fmt::Format("%s%s f%d", FixOp(op).c_str(), (rc ? "." : ""), f0));
|
||||
Write(fmt::format("%s%s f%d", FixOp(op).c_str(), (rc ? "." : ""), f0));
|
||||
}
|
||||
void DisAsm_R1_RC(const std::string& op, u32 r0, u32 rc)
|
||||
{
|
||||
Write(fmt::Format("%s%s r%d", FixOp(op).c_str(), (rc ? "." : ""), r0));
|
||||
Write(fmt::format("%s%s r%d", FixOp(op).c_str(), (rc ? "." : ""), r0));
|
||||
}
|
||||
void DisAsm_R1(const std::string& op, u32 r0)
|
||||
{
|
||||
@ -133,7 +133,7 @@ private:
|
||||
}
|
||||
void DisAsm_R2_OE_RC(const std::string& op, u32 r0, u32 r1, u32 oe, u32 rc)
|
||||
{
|
||||
Write(fmt::Format("%s%s%s r%d,r%d", FixOp(op).c_str(), (oe ? "o" : ""), (rc ? "." : ""), 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 std::string& op, u32 r0, u32 r1, u32 rc)
|
||||
{
|
||||
@ -145,11 +145,11 @@ private:
|
||||
}
|
||||
void DisAsm_R3_OE_RC(const std::string& op, u32 r0, u32 r1, u32 r2, u32 oe, u32 rc)
|
||||
{
|
||||
Write(fmt::Format("%s%s%s r%d,r%d,r%d", FixOp(op).c_str(), (oe ? "o" : ""), (rc ? "." : ""), 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 std::string& op, u32 r0, u32 r1, u32 r2, s32 i0, s32 i1, u32 rc)
|
||||
{
|
||||
Write(fmt::Format("%s%s r%d,r%d,r%d,%d,%d", FixOp(op).c_str(), (rc ? "." : ""), 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 std::string& op, u32 r0, u32 r1, u32 r2, u32 rc)
|
||||
{
|
||||
@ -161,7 +161,7 @@ private:
|
||||
}
|
||||
void DisAsm_R2_INT3_RC(const std::string& op, u32 r0, u32 r1, s32 i0, s32 i1, s32 i2, u32 rc)
|
||||
{
|
||||
Write(fmt::Format("%s%s r%d,r%d,%d,%d,%d", FixOp(op).c_str(), (rc ? "." : ""), 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 std::string& op, u32 r0, u32 r1, s32 i0, s32 i1, s32 i2)
|
||||
{
|
||||
@ -169,7 +169,7 @@ private:
|
||||
}
|
||||
void DisAsm_R2_INT2_RC(const std::string& op, u32 r0, u32 r1, s32 i0, s32 i1, u32 rc)
|
||||
{
|
||||
Write(fmt::Format("%s%s r%d,r%d,%d,%d", FixOp(op).c_str(), (rc ? "." : ""), 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 std::string& op, u32 r0, u32 r1, s32 i0, s32 i1)
|
||||
{
|
||||
@ -177,7 +177,7 @@ private:
|
||||
}
|
||||
void DisAsm_R2_INT1_RC(const std::string& op, u32 r0, u32 r1, s32 i0, u32 rc)
|
||||
{
|
||||
Write(fmt::Format("%s%s r%d,r%d,%d", FixOp(op).c_str(), (rc ? "." : ""), 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 std::string& op, u32 r0, u32 r1, s32 i0)
|
||||
{
|
||||
@ -187,27 +187,27 @@ private:
|
||||
{
|
||||
if(m_mode == CPUDisAsm_CompilerElfMode)
|
||||
{
|
||||
Write(fmt::Format("%s r%d,r%d,%d #%x", FixOp(op).c_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(fmt::Format("%s r%d,%d(r%d) #%x", FixOp(op).c_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 std::string& op, u32 r0, s32 imm0)
|
||||
{
|
||||
Write(fmt::Format("%s r%d,%d #%x", FixOp(op).c_str(), r0, imm0, imm0));
|
||||
Write(fmt::format("%s r%d,%d #%x", FixOp(op).c_str(), r0, imm0, imm0));
|
||||
}
|
||||
void DisAsm_IMM_R1(const std::string& op, s32 imm0, u32 r0)
|
||||
{
|
||||
Write(fmt::Format("%s %d,r%d #%x", FixOp(op).c_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 std::string& op, u32 cr0, u32 r0, s32 imm0)
|
||||
{
|
||||
Write(fmt::Format("%s cr%d,r%d,%d #%x", FixOp(op).c_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 std::string& op, u32 cr0, u32 r0, u32 r1, u32 rc)
|
||||
{
|
||||
Write(fmt::Format("%s%s cr%d,r%d,r%d", FixOp(op).c_str(), (rc ? "." : ""), 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 std::string& op, u32 cr0, u32 r0, u32 r1)
|
||||
{
|
||||
@ -215,31 +215,31 @@ private:
|
||||
}
|
||||
void DisAsm_CR2(const std::string& op, u32 cr0, u32 cr1)
|
||||
{
|
||||
Write(fmt::Format("%s cr%d,cr%d", FixOp(op).c_str(), cr0, cr1));
|
||||
Write(fmt::format("%s cr%d,cr%d", FixOp(op).c_str(), cr0, cr1));
|
||||
}
|
||||
void DisAsm_INT3(const std::string& op, const int i0, const int i1, const int i2)
|
||||
{
|
||||
Write(fmt::Format("%s %d,%d,%d", FixOp(op).c_str(), i0, i1, i2));
|
||||
Write(fmt::format("%s %d,%d,%d", FixOp(op).c_str(), i0, i1, i2));
|
||||
}
|
||||
void DisAsm_INT1(const std::string& op, const int i0)
|
||||
{
|
||||
Write(fmt::Format("%s %d", FixOp(op).c_str(), i0));
|
||||
Write(fmt::format("%s %d", FixOp(op).c_str(), i0));
|
||||
}
|
||||
void DisAsm_BRANCH(const std::string& op, const int pc)
|
||||
{
|
||||
Write(fmt::Format("%s 0x%x", FixOp(op).c_str(), DisAsmBranchTarget(pc)));
|
||||
Write(fmt::format("%s 0x%x", FixOp(op).c_str(), DisAsmBranchTarget(pc)));
|
||||
}
|
||||
void DisAsm_BRANCH_A(const std::string& op, const int pc)
|
||||
{
|
||||
Write(fmt::Format("%s 0x%x", FixOp(op).c_str(), pc));
|
||||
Write(fmt::format("%s 0x%x", FixOp(op).c_str(), pc));
|
||||
}
|
||||
void DisAsm_B2_BRANCH(const std::string& op, u32 b0, u32 b1, const int pc)
|
||||
{
|
||||
Write(fmt::Format("%s %d,%d,0x%x ", FixOp(op).c_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 std::string& op, u32 cr, const int pc)
|
||||
{
|
||||
Write(fmt::Format("%s cr%d,0x%x ", FixOp(op).c_str(), cr, DisAsmBranchTarget(pc)));
|
||||
Write(fmt::format("%s cr%d,0x%x ", FixOp(op).c_str(), cr, DisAsmBranchTarget(pc)));
|
||||
}
|
||||
|
||||
private:
|
||||
@ -899,11 +899,11 @@ private:
|
||||
}
|
||||
void CMPLI(u32 crfd, u32 l, u32 ra, u32 uimm16)
|
||||
{
|
||||
DisAsm_CR1_R1_IMM(fmt::Format("cmpl%si", (l ? "d" : "w")), 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(fmt::Format("cmp%si", (l ? "d" : "w")), 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)
|
||||
{
|
||||
@ -939,7 +939,7 @@ private:
|
||||
{
|
||||
if(m_mode == CPUDisAsm_CompilerElfMode)
|
||||
{
|
||||
Write(fmt::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;
|
||||
}
|
||||
|
||||
@ -1029,11 +1029,11 @@ private:
|
||||
}
|
||||
}
|
||||
|
||||
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));
|
||||
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 HACK(u32 index)
|
||||
{
|
||||
Write(fmt::Format("hack %d", index));
|
||||
Write(fmt::format("hack %d", index));
|
||||
}
|
||||
void SC(u32 lev)
|
||||
{
|
||||
@ -1041,14 +1041,14 @@ private:
|
||||
{
|
||||
case 0x0: Write("sc"); break;
|
||||
case 0x1: Write("HyperCall LV1"); break;
|
||||
default: Write(fmt::Format("Unknown sc: 0x%x", lev));
|
||||
default: Write(fmt::format("Unknown sc: 0x%x", lev));
|
||||
}
|
||||
}
|
||||
void B(s32 ll, u32 aa, u32 lk)
|
||||
{
|
||||
if(m_mode == CPUDisAsm_CompilerElfMode)
|
||||
{
|
||||
Write(fmt::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(fmt::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(fmt::Format("cmp%s", (l ? "d" : "w")), 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(fmt::Format("cmpl%s", (l ? "d" : "w")), crfd, ra, rb);
|
||||
DisAsm_CR1_R2(fmt::format("cmpl%s", (l ? "d" : "w")), crfd, ra, rb);
|
||||
}
|
||||
void LVSR(u32 vd, u32 ra, u32 rb)
|
||||
{
|
||||
@ -2074,7 +2074,7 @@ private:
|
||||
|
||||
void UNK(const u32 code, const u32 opcode, const u32 gcode)
|
||||
{
|
||||
Write(fmt::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));
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -259,7 +259,7 @@ std::pair<Executable, llvm::ExecutionEngine *> Compiler::Compile(const std::stri
|
||||
char str[1024];
|
||||
|
||||
auto size = LLVMDisasmInstruction(disassembler, ((u8 *)mci.address()) + pc, mci.size() - pc, (uint64_t)(((u8 *)mci.address()) + pc), str, sizeof(str));
|
||||
m_recompilation_engine.Log() << fmt::Format("0x%08X: ", (u64)(((u8 *)mci.address()) + pc)) << str << '\n';
|
||||
m_recompilation_engine.Log() << fmt::format("0x%08X: ", (u64)(((u8 *)mci.address()) + pc)) << str << '\n';
|
||||
pc += size;
|
||||
}
|
||||
|
||||
@ -549,7 +549,7 @@ void RecompilationEngine::CompileBlock(BlockEntry & block_entry) {
|
||||
Log() << "CFG: " << block_entry.cfg.ToString() << "\n";
|
||||
|
||||
const std::pair<Executable, llvm::ExecutionEngine *> &compileResult =
|
||||
m_compiler.Compile(fmt::Format("fn_0x%08X_%u", block_entry.cfg.start_address, block_entry.revision++), block_entry.cfg,
|
||||
m_compiler.Compile(fmt::format("fn_0x%08X_%u", block_entry.cfg.start_address, block_entry.revision++), block_entry.cfg,
|
||||
block_entry.IsFunction() ? true : false /*generate_linkable_exits*/);
|
||||
|
||||
// If entry doesn't exist, create it (using lock)
|
||||
|
@ -91,11 +91,11 @@ namespace ppu_recompiler_llvm {
|
||||
std::string ToString() const {
|
||||
switch (type) {
|
||||
case Type::Instruction:
|
||||
return fmt::Format("I:0x%08X", data.instruction.address);
|
||||
return fmt::format("I:0x%08X", data.instruction.address);
|
||||
case Type::FunctionCall:
|
||||
return fmt::Format("F:0x%08X", data.function_call.address);
|
||||
return fmt::format("F:0x%08X", data.function_call.address);
|
||||
case Type::CompiledBlock:
|
||||
return fmt::Format("C:0x%08X-0x%08X", data.compiled_block.entry_address, data.compiled_block.exit_address);
|
||||
return fmt::format("C:0x%08X-0x%08X", data.compiled_block.entry_address, data.compiled_block.exit_address);
|
||||
default:
|
||||
assert(0);
|
||||
return "";
|
||||
@ -147,7 +147,7 @@ namespace ppu_recompiler_llvm {
|
||||
}
|
||||
|
||||
std::string ToString() const {
|
||||
auto s = fmt::Format("0x%08X %s ->", function_address, type == ExecutionTrace::Type::Loop ? "Loop" : "Linear");
|
||||
auto s = fmt::format("0x%08X %s ->", function_address, type == ExecutionTrace::Type::Loop ? "Loop" : "Linear");
|
||||
for (auto i = 0; i < entries.size(); i++) {
|
||||
s += " " + entries[i].ToString();
|
||||
}
|
||||
@ -222,24 +222,24 @@ namespace ppu_recompiler_llvm {
|
||||
}
|
||||
|
||||
std::string ToString() const {
|
||||
auto s = fmt::Format("0x%08X (0x%08X): Size=%u ->", start_address, function_address, GetSize());
|
||||
auto s = fmt::format("0x%08X (0x%08X): Size=%u ->", start_address, function_address, GetSize());
|
||||
for (auto i = instruction_addresses.begin(); i != instruction_addresses.end(); i++) {
|
||||
s += fmt::Format(" 0x%08X", *i);
|
||||
s += fmt::format(" 0x%08X", *i);
|
||||
}
|
||||
|
||||
s += "\nBranches:";
|
||||
for (auto i = branches.begin(); i != branches.end(); i++) {
|
||||
s += fmt::Format("\n0x%08X ->", i->first);
|
||||
s += fmt::format("\n0x%08X ->", i->first);
|
||||
for (auto j = i->second.begin(); j != i->second.end(); j++) {
|
||||
s += fmt::Format(" 0x%08X", *j);
|
||||
s += fmt::format(" 0x%08X", *j);
|
||||
}
|
||||
}
|
||||
|
||||
s += "\nCalls:";
|
||||
for (auto i = calls.begin(); i != calls.end(); i++) {
|
||||
s += fmt::Format("\n0x%08X ->", i->first);
|
||||
s += fmt::format("\n0x%08X ->", i->first);
|
||||
for (auto j = i->second.begin(); j != i->second.end(); j++) {
|
||||
s += fmt::Format(" 0x%08X", *j);
|
||||
s += fmt::format(" 0x%08X", *j);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1064,7 +1064,7 @@ namespace ppu_recompiler_llvm {
|
||||
}
|
||||
|
||||
std::string ToString() const {
|
||||
return fmt::Format("0x%08X (0x%08X): NumHits=%u, Revision=%u, LastCompiledCfgSize=%u, IsCompiled=%c",
|
||||
return fmt::format("0x%08X (0x%08X): NumHits=%u, Revision=%u, LastCompiledCfgSize=%u, IsCompiled=%c",
|
||||
cfg.start_address, cfg.function_address, num_hits, revision, last_compiled_cfg_size, is_compiled ? 'Y' : 'N');
|
||||
}
|
||||
|
||||
|
@ -1776,7 +1776,7 @@ void Compiler::SC(u32 lev) {
|
||||
Call<void>("PPUThread.FastStop", &PPUThread::fast_stop, m_state.args[CompileTaskState::Args::State]);
|
||||
break;
|
||||
default:
|
||||
CompilationError(fmt::Format("SC %u", lev));
|
||||
CompilationError(fmt::format("SC %u", lev));
|
||||
break;
|
||||
}
|
||||
|
||||
@ -4700,7 +4700,7 @@ void Compiler::FCFID(u32 frd, u32 frb, u32 rc) {
|
||||
}
|
||||
|
||||
void Compiler::UNK(const u32 code, const u32 opcode, const u32 gcode) {
|
||||
CompilationError(fmt::Format("Unknown/Illegal opcode! (0x%08x : 0x%x : 0x%x)", code, opcode, gcode));
|
||||
CompilationError(fmt::format("Unknown/Illegal opcode! (0x%08x : 0x%x : 0x%x)", code, opcode, gcode));
|
||||
}
|
||||
|
||||
std::string Compiler::GetBasicBlockNameFromAddress(u32 address, const std::string & suffix) const {
|
||||
@ -4713,7 +4713,7 @@ std::string Compiler::GetBasicBlockNameFromAddress(u32 address, const std::strin
|
||||
name = "default_exit";
|
||||
}
|
||||
else {
|
||||
name = fmt::Format("instr_0x%08X", address);
|
||||
name = fmt::format("instr_0x%08X", address);
|
||||
}
|
||||
|
||||
if (suffix != "") {
|
||||
@ -5229,7 +5229,7 @@ void Compiler::CreateBranch(llvm::Value * cmp_i1, llvm::Value * target_i32, bool
|
||||
auto call_i = m_state.cfg->calls.find(m_state.current_instruction_address);
|
||||
if (call_i != m_state.cfg->calls.end()) {
|
||||
for (auto function_i = call_i->second.begin(); function_i != call_i->second.end(); function_i++) {
|
||||
auto block = GetBasicBlockFromAddress(m_state.current_instruction_address, fmt::Format("0x%08X", *function_i));
|
||||
auto block = GetBasicBlockFromAddress(m_state.current_instruction_address, fmt::format("0x%08X", *function_i));
|
||||
m_ir_builder->SetInsertPoint(block);
|
||||
IndirectCall(*function_i, m_ir_builder->getInt64(0), true);
|
||||
m_ir_builder->CreateBr(next_block);
|
||||
|
@ -29,7 +29,7 @@ using namespace llvm;
|
||||
using namespace ppu_recompiler_llvm;
|
||||
|
||||
#define VERIFY_INSTRUCTION_AGAINST_INTERPRETER(fn, tc, input, ...) \
|
||||
VerifyInstructionAgainstInterpreter(fmt::Format("%s.%d", #fn, tc).c_str(), &Compiler::fn, &PPUInterpreter::fn, input, ##__VA_ARGS__)
|
||||
VerifyInstructionAgainstInterpreter(fmt::format("%s.%d", #fn, tc).c_str(), &Compiler::fn, &PPUInterpreter::fn, input, ##__VA_ARGS__)
|
||||
|
||||
#define VERIFY_INSTRUCTION_AGAINST_INTERPRETER_USING_RANDOM_INPUT(fn, s, n, ...) { \
|
||||
PPUState input; \
|
||||
@ -167,32 +167,18 @@ struct ppu_recompiler_llvm::PPUState {
|
||||
std::string ret;
|
||||
|
||||
for (int i = 0; i < 32; i++) {
|
||||
ret += fmt::Format("GPR[%02d] = 0x%016llx FPR[%02d] = %16g (0x%016llx) VPR[%02d] = 0x%s [%s]\n", i, GPR[i], i, FPR[i]._double, FPR[i]._u64, i, VPR[i].to_hex().c_str(), VPR[i].to_xyzw().c_str());
|
||||
ret += fmt::format("GPR[%02d] = 0x%016llx FPR[%02d] = %16g (0x%016llx) VPR[%02d] = 0x%s [%s]\n", i, GPR[i], i, FPR[i]._double, FPR[i]._u64, i, VPR[i].to_hex().c_str(), VPR[i].to_xyzw().c_str());
|
||||
}
|
||||
|
||||
for (int i = 0; i < 8; i++) {
|
||||
ret += fmt::Format("SPRG[%d] = 0x%016llx\n", i, SPRG[i]);
|
||||
ret += fmt::format("SPRG[%d] = 0x%016llx\n", i, SPRG[i]);
|
||||
}
|
||||
|
||||
ret += fmt::Format("CR = 0x%08x LR = 0x%016llx CTR = 0x%016llx TB=0x%016llx\n", CR.CR, LR, CTR, TB);
|
||||
ret += fmt::Format("XER = 0x%016llx [CA=%d | OV=%d | SO=%d]\n", XER.XER, fmt::by_value(XER.CA), fmt::by_value(XER.OV), fmt::by_value(XER.SO));
|
||||
//ret += fmt::Format("FPSCR = 0x%08x " // TODO: Uncomment after implementing FPSCR
|
||||
// "[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,
|
||||
// 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));
|
||||
//ret += fmt::Format("VSCR = 0x%08x [NJ=%d | SAT=%d]\n", VSCR.VSCR, fmt::by_value(VSCR.NJ), fmt::by_value(VSCR.SAT)); // TODO: Uncomment after implementing VSCR.SAT
|
||||
ret += fmt::format("CR = 0x%08x LR = 0x%016llx CTR = 0x%016llx TB=0x%016llx\n", CR.CR, LR, CTR, TB);
|
||||
ret += fmt::format("XER = 0x%016llx [CA=%d | OV=%d | SO=%d]\n", XER.XER, u32{ XER.CA }, u32{ XER.OV }, u32{ XER.SO });
|
||||
|
||||
for (int i = 0; i < (sizeof(mem_block) / 8); i += 2) {
|
||||
ret += fmt::Format("mem_block[%d] = 0x%016llx mem_block[%d] = 0x%016llx\n", i, mem_block[i], i + 1, mem_block[i + 1]);
|
||||
ret += fmt::format("mem_block[%d] = 0x%016llx mem_block[%d] = 0x%016llx\n", i, mem_block[i], i + 1, mem_block[i + 1]);
|
||||
}
|
||||
|
||||
return ret;
|
||||
@ -205,48 +191,48 @@ static std::string StateDiff(PPUState const & recomp, PPUState const & interp) {
|
||||
|
||||
for (int i = 0; i < 32; i++) {
|
||||
if (recomp.GPR[i] != interp.GPR[i]) {
|
||||
ret += fmt::Format("recomp: GPR[%02d] = 0x%016llx interp: GPR[%02d] = 0x%016llx\n", i, recomp.GPR[i], i, interp.GPR[i]);
|
||||
ret += fmt::format("recomp: GPR[%02d] = 0x%016llx interp: GPR[%02d] = 0x%016llx\n", i, recomp.GPR[i], i, interp.GPR[i]);
|
||||
}
|
||||
if (recomp.FPR[i]._u64 != interp.FPR[i]._u64) {
|
||||
ret += fmt::Format("recomp: FPR[%02d] = %16g (0x%016llx) interp: FPR[%02d] = %16g (0x%016llx)\n", i, recomp.FPR[i]._double, recomp.FPR[i]._u64, i, interp.FPR[i]._double, interp.FPR[i]._u64);
|
||||
ret += fmt::format("recomp: FPR[%02d] = %16g (0x%016llx) interp: FPR[%02d] = %16g (0x%016llx)\n", i, recomp.FPR[i]._double, recomp.FPR[i]._u64, i, interp.FPR[i]._double, interp.FPR[i]._u64);
|
||||
}
|
||||
if (recomp.VPR[i] != interp.VPR[i]) {
|
||||
ret += fmt::Format("recomp: VPR[%02d] = 0x%s [%s]\n", i, recomp.VPR[i].to_hex().c_str(), recomp.VPR[i].to_xyzw().c_str());
|
||||
ret += fmt::Format("interp: VPR[%02d] = 0x%s [%s]\n", i, interp.VPR[i].to_hex().c_str(), interp.VPR[i].to_xyzw().c_str());
|
||||
ret += fmt::format("recomp: VPR[%02d] = 0x%s [%s]\n", i, recomp.VPR[i].to_hex().c_str(), recomp.VPR[i].to_xyzw().c_str());
|
||||
ret += fmt::format("interp: VPR[%02d] = 0x%s [%s]\n", i, interp.VPR[i].to_hex().c_str(), interp.VPR[i].to_xyzw().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < 8; i++) {
|
||||
if (recomp.SPRG[i] != interp.SPRG[i])
|
||||
ret += fmt::Format("recomp: SPRG[%d] = 0x%016llx interp: SPRG[%d] = 0x%016llx\n", i, recomp.SPRG[i], i, interp.SPRG[i]);
|
||||
ret += fmt::format("recomp: SPRG[%d] = 0x%016llx interp: SPRG[%d] = 0x%016llx\n", i, recomp.SPRG[i], i, interp.SPRG[i]);
|
||||
}
|
||||
|
||||
if (recomp.CR.CR != interp.CR.CR) {
|
||||
ret += fmt::Format("recomp: CR = 0x%08x\n", recomp.CR.CR);
|
||||
ret += fmt::Format("interp: CR = 0x%08x\n", interp.CR.CR);
|
||||
ret += fmt::format("recomp: CR = 0x%08x\n", recomp.CR.CR);
|
||||
ret += fmt::format("interp: CR = 0x%08x\n", interp.CR.CR);
|
||||
}
|
||||
if (recomp.LR != interp.LR) {
|
||||
ret += fmt::Format("recomp: LR = 0x%016llx\n", recomp.LR);
|
||||
ret += fmt::Format("interp: LR = 0x%016llx\n", interp.LR);
|
||||
ret += fmt::format("recomp: LR = 0x%016llx\n", recomp.LR);
|
||||
ret += fmt::format("interp: LR = 0x%016llx\n", interp.LR);
|
||||
}
|
||||
if (recomp.CTR != interp.CTR) {
|
||||
ret += fmt::Format("recomp: CTR = 0x%016llx\n", recomp.CTR);
|
||||
ret += fmt::Format("interp: CTR = 0x%016llx\n", interp.CTR);
|
||||
ret += fmt::format("recomp: CTR = 0x%016llx\n", recomp.CTR);
|
||||
ret += fmt::format("interp: CTR = 0x%016llx\n", interp.CTR);
|
||||
}
|
||||
if (recomp.TB != interp.TB) {
|
||||
ret += fmt::Format("recomp: TB = 0x%016llx\n", recomp.TB);
|
||||
ret += fmt::Format("interp: TB = 0x%016llx\n", interp.TB);
|
||||
ret += fmt::format("recomp: TB = 0x%016llx\n", recomp.TB);
|
||||
ret += fmt::format("interp: TB = 0x%016llx\n", interp.TB);
|
||||
}
|
||||
|
||||
if (recomp.XER.XER != interp.XER.XER) {
|
||||
ret += fmt::Format("recomp: XER = 0x%016llx [CA=%d | OV=%d | SO=%d]\n", recomp.XER.XER, fmt::by_value(recomp.XER.CA), fmt::by_value(recomp.XER.OV), fmt::by_value(recomp.XER.SO));
|
||||
ret += fmt::Format("interp: XER = 0x%016llx [CA=%d | OV=%d | SO=%d]\n", interp.XER.XER, fmt::by_value(interp.XER.CA), fmt::by_value(interp.XER.OV), fmt::by_value(interp.XER.SO));
|
||||
ret += fmt::format("recomp: XER = 0x%016llx [CA=%d | OV=%d | SO=%d]\n", recomp.XER.XER, u32{ recomp.XER.CA }, u32{ recomp.XER.OV }, u32{ recomp.XER.SO });
|
||||
ret += fmt::format("interp: XER = 0x%016llx [CA=%d | OV=%d | SO=%d]\n", interp.XER.XER, u32{ interp.XER.CA }, u32{ interp.XER.OV }, u32{ interp.XER.SO });
|
||||
}
|
||||
|
||||
for (int i = 0; i < (sizeof(recomp.mem_block) / 8); i++) {
|
||||
if (recomp.mem_block[i] != interp.mem_block[i]) {
|
||||
ret += fmt::Format("recomp: mem_block[%d] = 0x%016llx\n", i, recomp.mem_block[i]);
|
||||
ret += fmt::Format("interp: mem_block[%d] = 0x%016llx\n", i, interp.mem_block[i]);
|
||||
ret += fmt::format("recomp: mem_block[%d] = 0x%016llx\n", i, recomp.mem_block[i]);
|
||||
ret += fmt::format("interp: mem_block[%d] = 0x%016llx\n", i, interp.mem_block[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -151,7 +151,7 @@ void CompilePPUProgram::WriteError(const std::string& error)
|
||||
{
|
||||
if(m_err_list)
|
||||
{
|
||||
m_err_list->WriteText(fmt::FromUTF8(fmt::Format("line %lld: %s\n", m_line, error.c_str())));
|
||||
m_err_list->WriteText(fmt::FromUTF8(fmt::format("line %lld: %s\n", m_line, error.c_str())));
|
||||
}
|
||||
}
|
||||
|
||||
@ -280,7 +280,7 @@ int CompilePPUProgram::GetArg(std::string& result, bool func)
|
||||
break;
|
||||
}
|
||||
|
||||
WriteError(fmt::Format("Bad symbol '%c'", cur_char));
|
||||
WriteError(fmt::format("Bad symbol '%c'", cur_char));
|
||||
m_error = true;
|
||||
break;
|
||||
}
|
||||
@ -347,7 +347,7 @@ bool CompilePPUProgram::CheckEnd(bool show_err)
|
||||
return true;
|
||||
}
|
||||
|
||||
WriteError(fmt::Format("Bad symbol '%c'", cur_char));
|
||||
WriteError(fmt::format("Bad symbol '%c'", cur_char));
|
||||
NextLn();
|
||||
return false;
|
||||
}
|
||||
@ -552,7 +552,7 @@ bool CompilePPUProgram::SetNextArgType(u32 types, bool show_err)
|
||||
{
|
||||
if(show_err)
|
||||
{
|
||||
WriteError(fmt::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(fmt::Format("Bad arg '%s'", arg.string.c_str()));
|
||||
WriteError(fmt::format("Bad arg '%s'", arg.string.c_str()));
|
||||
m_error = true;
|
||||
}
|
||||
|
||||
@ -703,7 +703,7 @@ void CompilePPUProgram::LoadSp(const std::string& op, Elf64_Shdr& s_opd)
|
||||
if(!GetArg(test) || test[0] != '[')
|
||||
{
|
||||
if(m_analyze) WriteHex("error\n");
|
||||
WriteError(fmt::Format("data not found. style: %s", GetSpStyle(sp).c_str()));
|
||||
WriteError(fmt::format("data not found. style: %s", GetSpStyle(sp).c_str()));
|
||||
m_error = true;
|
||||
NextLn();
|
||||
return;
|
||||
@ -716,7 +716,7 @@ void CompilePPUProgram::LoadSp(const std::string& op, Elf64_Shdr& s_opd)
|
||||
if(!GetArg(dst))
|
||||
{
|
||||
if(m_analyze) WriteHex("error\n");
|
||||
WriteError(fmt::Format("dst not found. style: %s", GetSpStyle(sp).c_str()));
|
||||
WriteError(fmt::format("dst not found. style: %s", GetSpStyle(sp).c_str()));
|
||||
m_error = true;
|
||||
NextLn();
|
||||
return;
|
||||
@ -747,7 +747,7 @@ void CompilePPUProgram::LoadSp(const std::string& op, Elf64_Shdr& s_opd)
|
||||
if(!dst_branch)
|
||||
{
|
||||
if(m_analyze) WriteHex("error\n");
|
||||
WriteError(fmt::Format("bad dst type. style: %s", GetSpStyle(sp).c_str()));
|
||||
WriteError(fmt::format("bad dst type. style: %s", GetSpStyle(sp).c_str()));
|
||||
m_error = true;
|
||||
NextLn();
|
||||
return;
|
||||
@ -765,7 +765,7 @@ void CompilePPUProgram::LoadSp(const std::string& op, Elf64_Shdr& s_opd)
|
||||
if(!GetArg(src1, true))
|
||||
{
|
||||
if(m_analyze) WriteHex("error\n");
|
||||
WriteError(fmt::Format("src not found. style: %s", GetSpStyle(sp).c_str()));
|
||||
WriteError(fmt::format("src not found. style: %s", GetSpStyle(sp).c_str()));
|
||||
m_error = true;
|
||||
NextLn();
|
||||
return;
|
||||
@ -781,7 +781,7 @@ void CompilePPUProgram::LoadSp(const std::string& op, Elf64_Shdr& s_opd)
|
||||
: ~(ARG_IMM | ARG_BRANCH) & a_src1.type)
|
||||
{
|
||||
if(m_analyze) WriteHex("error\n");
|
||||
WriteError(fmt::Format("bad src type. style: %s", GetSpStyle(sp).c_str()));
|
||||
WriteError(fmt::format("bad src type. style: %s", GetSpStyle(sp).c_str()));
|
||||
m_error = true;
|
||||
NextLn();
|
||||
return;
|
||||
@ -790,7 +790,7 @@ void CompilePPUProgram::LoadSp(const std::string& op, Elf64_Shdr& s_opd)
|
||||
if(m_asm[(size_t)p - 1] != ']')
|
||||
{
|
||||
if(m_analyze) WriteHex("error\n");
|
||||
WriteError(fmt::Format("']' not found. style: %s", GetSpStyle(sp).c_str()));
|
||||
WriteError(fmt::format("']' not found. style: %s", GetSpStyle(sp).c_str()));
|
||||
m_error = true;
|
||||
NextLn();
|
||||
return;
|
||||
@ -873,7 +873,7 @@ void CompilePPUProgram::LoadSp(const std::string& op, Elf64_Shdr& s_opd)
|
||||
if(!GetArg(src1))
|
||||
{
|
||||
if(m_analyze) WriteHex("error\n");
|
||||
WriteError(fmt::Format("src1 not found. style: %s", GetSpStyle(sp).c_str()));
|
||||
WriteError(fmt::format("src1 not found. style: %s", GetSpStyle(sp).c_str()));
|
||||
m_error = true;
|
||||
NextLn();
|
||||
return;
|
||||
@ -885,7 +885,7 @@ void CompilePPUProgram::LoadSp(const std::string& op, Elf64_Shdr& s_opd)
|
||||
if(~(ARG_IMM | ARG_BRANCH) & a_src1.type)
|
||||
{
|
||||
if(m_analyze) WriteHex("error\n");
|
||||
WriteError(fmt::Format("bad src1 type. style: %s", GetSpStyle(sp).c_str()));
|
||||
WriteError(fmt::format("bad src1 type. style: %s", GetSpStyle(sp).c_str()));
|
||||
m_error = true;
|
||||
NextLn();
|
||||
return;
|
||||
@ -895,7 +895,7 @@ void CompilePPUProgram::LoadSp(const std::string& op, Elf64_Shdr& s_opd)
|
||||
if(!GetArg(src2, true))
|
||||
{
|
||||
if(m_analyze) WriteHex("error\n");
|
||||
WriteError(fmt::Format("src2 not found. style: %s", GetSpStyle(sp).c_str()));
|
||||
WriteError(fmt::format("src2 not found. style: %s", GetSpStyle(sp).c_str()));
|
||||
m_error = true;
|
||||
return;
|
||||
}
|
||||
@ -906,7 +906,7 @@ void CompilePPUProgram::LoadSp(const std::string& op, Elf64_Shdr& s_opd)
|
||||
if(~(ARG_IMM | ARG_BRANCH) & a_src2.type)
|
||||
{
|
||||
if(m_analyze) WriteHex("error\n");
|
||||
WriteError(fmt::Format("bad src2 type. style: %s", GetSpStyle(sp).c_str()));
|
||||
WriteError(fmt::format("bad src2 type. style: %s", GetSpStyle(sp).c_str()));
|
||||
m_error = true;
|
||||
NextLn();
|
||||
return;
|
||||
@ -915,7 +915,7 @@ void CompilePPUProgram::LoadSp(const std::string& op, Elf64_Shdr& s_opd)
|
||||
if(m_asm[(size_t)p - 1] != ']')
|
||||
{
|
||||
if(m_analyze) WriteHex("error\n");
|
||||
WriteError(fmt::Format("']' not found. style: %s", GetSpStyle(sp).c_str()));
|
||||
WriteError(fmt::format("']' not found. style: %s", GetSpStyle(sp).c_str()));
|
||||
m_error = true;
|
||||
NextLn();
|
||||
return;
|
||||
@ -1344,7 +1344,7 @@ void CompilePPUProgram::Compile()
|
||||
if(name != branch.m_name)
|
||||
continue;
|
||||
|
||||
WriteError(fmt::Format("'%s' already declared", name.c_str()));
|
||||
WriteError(fmt::format("'%s' already declared", name.c_str()));
|
||||
m_error = true;
|
||||
break;
|
||||
}
|
||||
@ -1354,7 +1354,7 @@ void CompilePPUProgram::Compile()
|
||||
|
||||
if(a_name.type != ARG_ERR)
|
||||
{
|
||||
WriteError(fmt::Format("bad name '%s'", name.c_str()));
|
||||
WriteError(fmt::format("bad name '%s'", name.c_str()));
|
||||
m_error = true;
|
||||
}
|
||||
|
||||
@ -1434,7 +1434,7 @@ void CompilePPUProgram::Compile()
|
||||
}
|
||||
else
|
||||
{
|
||||
WriteError(fmt::Format("unknown instruction '%s'", op.c_str()));
|
||||
WriteError(fmt::format("unknown instruction '%s'", op.c_str()));
|
||||
EndLn();
|
||||
m_error = true;
|
||||
}
|
||||
@ -1466,7 +1466,7 @@ void CompilePPUProgram::Compile()
|
||||
code = (*instr)(args);
|
||||
}
|
||||
|
||||
if(m_analyze) WriteHex(fmt::Format("0x%08x\n", code));
|
||||
if(m_analyze) WriteHex(fmt::format("0x%08x\n", code));
|
||||
|
||||
if(!m_analyze) m_code.push_back(code);
|
||||
|
||||
|
@ -707,26 +707,26 @@ public:
|
||||
{
|
||||
std::string ret = "Registers:\n=========\n";
|
||||
|
||||
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, VPR[i].to_hex().c_str(), VPR[i].to_xyzw().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 "
|
||||
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, VPR[i].to_hex().c_str(), VPR[i].to_xyzw().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, u32{ XER.CA }, u32{ XER.OV }, u32{ 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,
|
||||
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));
|
||||
u32{ FPSCR.RN },
|
||||
u32{ FPSCR.NI }, u32{ FPSCR.XE }, u32{ FPSCR.ZE }, u32{ FPSCR.UE }, u32{ FPSCR.OE }, u32{ FPSCR.VE },
|
||||
u32{ FPSCR.VXCVI }, u32{ FPSCR.VXSQRT }, u32{ FPSCR.VXSOFT }, u32{ FPSCR.FPRF },
|
||||
u32{ FPSCR.FI }, u32{ FPSCR.FR }, u32{ FPSCR.VXVC }, u32{ FPSCR.VXIMZ },
|
||||
u32{ FPSCR.VXZDZ }, u32{ FPSCR.VXIDI }, u32{ FPSCR.VXISI }, u32{ FPSCR.VXSNAN },
|
||||
u32{ FPSCR.XX }, u32{ FPSCR.ZX }, u32{ FPSCR.UX }, u32{ FPSCR.OX }, u32{ FPSCR.VX }, u32{ FPSCR.FEX }, u32{ FPSCR.FX });
|
||||
|
||||
return ret;
|
||||
}
|
||||
@ -737,15 +737,15 @@ public:
|
||||
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) 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.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 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);
|
||||
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 "";
|
||||
}
|
||||
|
@ -97,43 +97,43 @@ private:
|
||||
}
|
||||
void DisAsm(std::string op, u32 a1)
|
||||
{
|
||||
Write(fmt::Format("%s 0x%x", FixOp(op).c_str(), a1));
|
||||
Write(fmt::format("%s 0x%x", FixOp(op).c_str(), a1));
|
||||
}
|
||||
void DisAsm(std::string op, const char* a1)
|
||||
{
|
||||
Write(fmt::Format("%s %s", FixOp(op).c_str(), a1));
|
||||
Write(fmt::format("%s %s", FixOp(op).c_str(), a1));
|
||||
}
|
||||
void DisAsm(std::string op, const char* a1, const char* a2)
|
||||
{
|
||||
Write(fmt::Format("%s %s,%s", FixOp(op).c_str(), a1, a2));
|
||||
Write(fmt::format("%s %s,%s", FixOp(op).c_str(), a1, a2));
|
||||
}
|
||||
void DisAsm(std::string op, int a1, const char* a2)
|
||||
{
|
||||
Write(fmt::Format("%s 0x%x,%s", FixOp(op).c_str(), a1, a2));
|
||||
Write(fmt::format("%s 0x%x,%s", FixOp(op).c_str(), a1, a2));
|
||||
}
|
||||
void DisAsm(std::string op, const char* a1, int a2)
|
||||
{
|
||||
Write(fmt::Format("%s %s,0x%x", FixOp(op).c_str(), a1, a2));
|
||||
Write(fmt::format("%s %s,0x%x", FixOp(op).c_str(), a1, a2));
|
||||
}
|
||||
void DisAsm(std::string op, int a1, int a2)
|
||||
{
|
||||
Write(fmt::Format("%s 0x%x,0x%x", FixOp(op).c_str(), a1, a2));
|
||||
Write(fmt::format("%s 0x%x,0x%x", FixOp(op).c_str(), a1, a2));
|
||||
}
|
||||
void DisAsm(std::string op, const char* a1, const char* a2, const char* a3)
|
||||
{
|
||||
Write(fmt::Format("%s %s,%s,%s", FixOp(op).c_str(), a1, a2, a3));
|
||||
Write(fmt::format("%s %s,%s,%s", FixOp(op).c_str(), a1, a2, a3));
|
||||
}
|
||||
void DisAsm(std::string op, const char* a1, int a2, const char* a3)
|
||||
{
|
||||
Write(fmt::Format("%s %s,0x%x(%s)", FixOp(op).c_str(), a1, a2, a3));
|
||||
Write(fmt::format("%s %s,0x%x(%s)", FixOp(op).c_str(), a1, a2, a3));
|
||||
}
|
||||
void DisAsm(std::string op, const char* a1, const char* a2, int a3)
|
||||
{
|
||||
Write(fmt::Format("%s %s,%s,0x%x", FixOp(op).c_str(), a1, a2, a3));
|
||||
Write(fmt::format("%s %s,%s,0x%x", FixOp(op).c_str(), a1, a2, a3));
|
||||
}
|
||||
void DisAsm(std::string op, const char* a1, const char* a2, const char* a3, const char* a4)
|
||||
{
|
||||
Write(fmt::Format("%s %s,%s,%s,%s", FixOp(op).c_str(), a1, a2, a3, a4));
|
||||
Write(fmt::format("%s %s,%s,%s,%s", FixOp(op).c_str(), a1, a2, a3, a4));
|
||||
}
|
||||
//0 - 10
|
||||
void STOP(u32 code)
|
||||
@ -945,6 +945,6 @@ private:
|
||||
|
||||
void UNK(u32 code, u32 opcode, u32 gcode)
|
||||
{
|
||||
Write(fmt::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));
|
||||
}
|
||||
};
|
||||
|
@ -2054,7 +2054,7 @@ private:
|
||||
|
||||
void UNK(u32 code, u32 opcode, u32 gcode)
|
||||
{
|
||||
UNK(fmt::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 std::string& err)
|
||||
|
@ -88,7 +88,7 @@ void SPURecompilerCore::Compile(u16 pos)
|
||||
|
||||
for (u32 i = 0; i < 16; i++)
|
||||
{
|
||||
m_enc->xmm_var[i].data = new X86XmmVar(compiler, kX86VarTypeXmm, fmt::Format("reg_%d", i).c_str());
|
||||
m_enc->xmm_var[i].data = new X86XmmVar(compiler, kX86VarTypeXmm, fmt::format("reg_%d", i).c_str());
|
||||
}
|
||||
|
||||
compiler.xor_(pos_var, pos_var);
|
||||
@ -103,7 +103,7 @@ void SPURecompilerCore::Compile(u16 pos)
|
||||
// disasm for logging:
|
||||
//dis_asm.dump_pc = pos * 4;
|
||||
//(*SPU_instr::rrr_list)(&dis_asm, opcode);
|
||||
//compiler.addComment(fmt::Format("SPU data: PC=0x%05x %s", pos * 4, dis_asm.last_opcode.c_str()).c_str());
|
||||
//compiler.addComment(fmt::format("SPU data: PC=0x%05x %s", pos * 4, dis_asm.last_opcode.c_str()).c_str());
|
||||
// compile single opcode:
|
||||
(*SPU_instr::rrr_list)(m_enc.get(), opcode);
|
||||
// force finalization between every slice using absolute alignment
|
||||
@ -160,7 +160,7 @@ void SPURecompilerCore::Compile(u16 pos)
|
||||
// entry[start].count, excess, stamp1 - stamp0, time0, get_system_time() - stamp1);
|
||||
//}
|
||||
|
||||
//fs::file(fmt::Format("SPUjit_%d.log", this->CPU.GetId()), fom::write | fom::create | (first ? fom::trunc : fom::append)).write(log.c_str(), log.size());
|
||||
//fs::file(fmt::format("SPUjit_%d.log", this->CPU.GetId()), fom::write | fom::create | (first ? fom::trunc : fom::append)).write(log.c_str(), log.size());
|
||||
|
||||
m_enc->compiler = nullptr;
|
||||
first = false;
|
||||
@ -270,7 +270,7 @@ u32 SPURecompilerCore::DecodeMemory(const u32 address)
|
||||
|
||||
#define LOG3_OPCODE(...) //ConLog.Write("Linked "__FUNCTION__"(): "__VA_ARGS__)
|
||||
|
||||
#define LOG4_OPCODE(...) //c.addComment(fmt::Format("SPU info: "__FUNCTION__"(): "__VA_ARGS__).c_str())
|
||||
#define LOG4_OPCODE(...) //c.addComment(fmt::format("SPU info: "__FUNCTION__"(): "__VA_ARGS__).c_str())
|
||||
|
||||
#define WRAPPER_BEGIN(a0, a1, a2) struct opwr_##a0 \
|
||||
{ \
|
||||
@ -3415,7 +3415,7 @@ void SPURecompiler::FMS(u32 rt, u32 ra, u32 rb, u32 rc)
|
||||
|
||||
void SPURecompiler::UNK(u32 code, u32 opcode, u32 gcode)
|
||||
{
|
||||
UNK(fmt::Format("Unimplemented opcode! (0x%08x, 0x%x, 0x%x)", code, opcode, gcode));
|
||||
UNK(fmt::format("Unimplemented opcode! (0x%08x, 0x%x, 0x%x)", code, opcode, gcode));
|
||||
}
|
||||
|
||||
void SPURecompiler::UNK(const std::string& err)
|
||||
|
@ -467,7 +467,7 @@ public:
|
||||
|
||||
std::string ToString() const
|
||||
{
|
||||
return fmt::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()
|
||||
@ -709,7 +709,7 @@ public:
|
||||
{
|
||||
std::string ret = "Registers:\n=========\n";
|
||||
|
||||
for(uint i=0; i<128; ++i) ret += fmt::Format("GPR[%d] = 0x%s\n", i, GPR[i].to_hex().c_str());
|
||||
for(uint i=0; i<128; ++i) ret += fmt::format("GPR[%d] = 0x%s\n", i, GPR[i].to_hex().c_str());
|
||||
|
||||
return ret;
|
||||
}
|
||||
@ -721,7 +721,7 @@ public:
|
||||
{
|
||||
long reg_index;
|
||||
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]);
|
||||
if (reg.find("GPR")==0) return fmt::format("%016llx%016llx", GPR[reg_index]._u64[1], GPR[reg_index]._u64[0]);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
@ -552,10 +552,10 @@ void VFS::SaveLoadDevices(std::vector<VFSManagerEntry>& res, bool is_load)
|
||||
IniEntry<std::string> entry_mount;
|
||||
IniEntry<int> entry_device;
|
||||
|
||||
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");
|
||||
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)
|
||||
{
|
||||
|
@ -76,7 +76,7 @@ std::string CgBinaryDisasm::AddConstDisAsm()
|
||||
const u32 z = GetData(data[2]);
|
||||
const u32 w = GetData(data[3]);
|
||||
|
||||
return fmt::Format("{0x%08x(%g), 0x%08x(%g), 0x%08x(%g), 0x%08x(%g)}", x, (float&)x, y, (float&)y, z, (float&)z, w, (float&)w);
|
||||
return fmt::format("{0x%08x(%g), 0x%08x(%g), 0x%08x(%g), 0x%08x(%g)}", x, (float&)x, y, (float&)y, z, (float&)z, w, (float&)w);
|
||||
}
|
||||
|
||||
std::string CgBinaryDisasm::AddTexDisAsm()
|
||||
@ -183,7 +183,7 @@ template<typename T> std::string CgBinaryDisasm::GetSrcDisAsm(T src)
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_ERROR(RSX, "Bad src reg num: %d", fmt::by_value(dst.src_attr_reg_num));
|
||||
LOG_ERROR(RSX, "Bad src reg num: %d", u32{ dst.src_attr_reg_num });
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -195,7 +195,7 @@ template<typename T> std::string CgBinaryDisasm::GetSrcDisAsm(T src)
|
||||
break;
|
||||
|
||||
default:
|
||||
LOG_ERROR(RSX, "Bad src type %d", fmt::by_value(src.reg_type));
|
||||
LOG_ERROR(RSX, "Bad src type %d", u32{ src.reg_type });
|
||||
break;
|
||||
}
|
||||
|
||||
@ -402,12 +402,12 @@ void CgBinaryDisasm::TaskFP()
|
||||
{
|
||||
if (!src0.exec_if_eq && !src0.exec_if_gr && !src0.exec_if_lt)
|
||||
{
|
||||
AddCodeAsm(fmt::Format("{ %u, %u, %u }", src1.end_counter, src1.init_counter, src1.increment));
|
||||
AddCodeAsm(fmt::format("{ %u, %u, %u }", src1.end_counter, src1.init_counter, src1.increment));
|
||||
}
|
||||
else
|
||||
{
|
||||
m_loop_end_offsets.push_back(src2.end_offset << 2);
|
||||
AddCodeAsm(fmt::Format("{ %u, %u, %u }", src1.end_counter, src1.init_counter, src1.increment));
|
||||
AddCodeAsm(fmt::format("{ %u, %u, %u }", src1.end_counter, src1.init_counter, src1.increment));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -61,7 +61,7 @@ std::string CgBinaryDisasm::GetDSTDisasm(bool isSca)
|
||||
|
||||
default:
|
||||
if (d3.dst > 15)
|
||||
LOG_ERROR(RSX, fmt::Format("dst index out of range: %u", d3.dst));
|
||||
LOG_ERROR(RSX, fmt::format("dst index out of range: %u", d3.dst));
|
||||
|
||||
ret += fmt::format("o[%d]", d3.dst) + GetVecMaskDisasm();
|
||||
break;
|
||||
@ -86,7 +86,7 @@ std::string CgBinaryDisasm::GetSRCDisasm(const u32 n)
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_ERROR(RSX, "Bad input src num: %d", fmt::by_value(d1.input_src));
|
||||
LOG_ERROR(RSX, "Bad input src num: %d", u32{ d1.input_src });
|
||||
ret += fmt::format("v[%d] # bad src", d1.input_src);
|
||||
}
|
||||
break;
|
||||
@ -95,7 +95,7 @@ std::string CgBinaryDisasm::GetSRCDisasm(const u32 n)
|
||||
break;
|
||||
|
||||
default:
|
||||
LOG_ERROR(RSX, fmt::Format("Bad src%u reg type: %d", n, fmt::by_value(src[n].reg_type)));
|
||||
LOG_ERROR(RSX, fmt::format("Bad src%u reg type: %d", n, u32{ src[n].reg_type }));
|
||||
Emu.Pause();
|
||||
break;
|
||||
}
|
||||
@ -233,7 +233,7 @@ std::string CgBinaryDisasm::GetCondDisasm()
|
||||
|
||||
swizzle = swizzle == "xyzw" ? "" : "." + swizzle;
|
||||
|
||||
return fmt::Format("(%s%s)", cond_string_table[d0.cond], swizzle.c_str());
|
||||
return fmt::format("(%s%s)", cond_string_table[d0.cond], swizzle.c_str());
|
||||
}
|
||||
|
||||
void CgBinaryDisasm::AddCodeCondDisasm(const std::string& dst, const std::string& src)
|
||||
@ -280,7 +280,7 @@ void CgBinaryDisasm::AddCodeCondDisasm(const std::string& dst, const std::string
|
||||
|
||||
swizzle = swizzle == "xyzw" ? "" : "." + swizzle;
|
||||
|
||||
std::string cond = fmt::Format("%s%s", cond_string_table[d0.cond], swizzle.c_str());
|
||||
std::string cond = fmt::format("%s%s", cond_string_table[d0.cond], swizzle.c_str());
|
||||
AddCodeDisasm(dst + "(" + cond + ") " + ", " + src + ";");
|
||||
}
|
||||
|
||||
@ -410,7 +410,7 @@ void CgBinaryDisasm::TaskVP()
|
||||
case RSX_SCA_OPCODE_POP: SetDSTScaDisasm(""); break;
|
||||
|
||||
default:
|
||||
LOG_ERROR(RSX, "Unknown vp sca_opcode 0x%x", fmt::by_value(d1.sca_opcode));
|
||||
LOG_ERROR(RSX, "Unknown vp sca_opcode 0x%x", u32{ d1.sca_opcode });
|
||||
break;
|
||||
}
|
||||
|
||||
@ -443,7 +443,7 @@ void CgBinaryDisasm::TaskVP()
|
||||
case RSX_VEC_OPCODE_TXL: SetDSTVecDisasm("$t, $0"); break;
|
||||
|
||||
default:
|
||||
LOG_ERROR(RSX, "Unknown vp opcode 0x%x", fmt::by_value(d1.vec_opcode));
|
||||
LOG_ERROR(RSX, "Unknown vp opcode 0x%x", u32{ d1.vec_opcode });
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ void FragmentProgramDecompiler::SetDst(std::string code, bool append_mask)
|
||||
case 7: code = "(" + code + " / 8.0)"; break;
|
||||
|
||||
default:
|
||||
LOG_ERROR(RSX, "Bad scale: %d", fmt::by_value(src1.scale));
|
||||
LOG_ERROR(RSX, "Bad scale: %d", u32{ src1.scale });
|
||||
Emu.Pause();
|
||||
break;
|
||||
}
|
||||
@ -276,7 +276,7 @@ template<typename T> std::string FragmentProgramDecompiler::GetSRC(T src)
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_ERROR(RSX, "Bad src reg num: %d", fmt::by_value(dst.src_attr_reg_num));
|
||||
LOG_ERROR(RSX, "Bad src reg num: %d", u32{ dst.src_attr_reg_num });
|
||||
ret += m_parr.AddParam(PF_PARAM_IN, getFloatTypeName(4), "unk");
|
||||
Emu.Pause();
|
||||
}
|
||||
@ -290,7 +290,7 @@ template<typename T> std::string FragmentProgramDecompiler::GetSRC(T src)
|
||||
break;
|
||||
|
||||
default:
|
||||
LOG_ERROR(RSX, "Bad src type %d", fmt::by_value(src.reg_type));
|
||||
LOG_ERROR(RSX, "Bad src type %d", u32{ src.reg_type });
|
||||
Emu.Pause();
|
||||
break;
|
||||
}
|
||||
@ -313,7 +313,7 @@ template<typename T> std::string FragmentProgramDecompiler::GetSRC(T src)
|
||||
|
||||
std::string FragmentProgramDecompiler::BuildCode()
|
||||
{
|
||||
//main += fmt::Format("\tgl_FragColor = %c0;\n", m_ctrl & 0x40 ? 'r' : 'h');
|
||||
//main += fmt::format("\tgl_FragColor = %c0;\n", m_ctrl & 0x40 ? 'r' : 'h');
|
||||
|
||||
if (m_ctrl & 0xe) main += m_ctrl & 0x40 ? "\tgl_FragDepth = r1.z;\n" : "\tgl_FragDepth = h2.z;\n";
|
||||
|
||||
@ -510,12 +510,12 @@ std::string FragmentProgramDecompiler::Decompile()
|
||||
case RSX_FP_OPCODE_LOOP:
|
||||
if (!src0.exec_if_eq && !src0.exec_if_gr && !src0.exec_if_lt)
|
||||
{
|
||||
AddCode(fmt::Format("$ifcond for(int i%u = %u; i%u < %u; i%u += %u) {} //-> %u //LOOP",
|
||||
AddCode(fmt::format("$ifcond for(int i%u = %u; i%u < %u; i%u += %u) {} //-> %u //LOOP",
|
||||
m_loop_count, src1.init_counter, m_loop_count, src1.end_counter, m_loop_count, src1.increment, src2.end_offset));
|
||||
}
|
||||
else
|
||||
{
|
||||
AddCode(fmt::Format("$ifcond for(int i%u = %u; i%u < %u; i%u += %u) //LOOP",
|
||||
AddCode(fmt::format("$ifcond for(int i%u = %u; i%u < %u; i%u += %u) //LOOP",
|
||||
m_loop_count, src1.init_counter, m_loop_count, src1.end_counter, m_loop_count, src1.increment));
|
||||
m_loop_count++;
|
||||
m_end_offsets.push_back(src2.end_offset << 2);
|
||||
@ -526,12 +526,12 @@ std::string FragmentProgramDecompiler::Decompile()
|
||||
case RSX_FP_OPCODE_REP:
|
||||
if (!src0.exec_if_eq && !src0.exec_if_gr && !src0.exec_if_lt)
|
||||
{
|
||||
AddCode(fmt::Format("$ifcond for(int i%u = %u; i%u < %u; i%u += %u) {} //-> %u //REP",
|
||||
AddCode(fmt::format("$ifcond for(int i%u = %u; i%u < %u; i%u += %u) {} //-> %u //REP",
|
||||
m_loop_count, src1.init_counter, m_loop_count, src1.end_counter, m_loop_count, src1.increment, src2.end_offset));
|
||||
}
|
||||
else
|
||||
{
|
||||
AddCode(fmt::Format("if($cond) for(int i%u = %u; i%u < %u; i%u += %u) //REP",
|
||||
AddCode(fmt::format("if($cond) for(int i%u = %u; i%u < %u; i%u += %u) //REP",
|
||||
m_loop_count, src1.init_counter, m_loop_count, src1.end_counter, m_loop_count, src1.increment));
|
||||
m_loop_count++;
|
||||
m_end_offsets.push_back(src2.end_offset << 2);
|
||||
|
@ -48,7 +48,7 @@ std::string VertexProgramDecompiler::GetDST(bool isSca)
|
||||
|
||||
default:
|
||||
if (d3.dst > 15)
|
||||
LOG_ERROR(RSX, fmt::Format("dst index out of range: %u", d3.dst));
|
||||
LOG_ERROR(RSX, fmt::format("dst index out of range: %u", d3.dst));
|
||||
ret += m_parr.AddParam(PF_PARAM_NONE, getFloatTypeName(4), std::string("dst_reg") + std::to_string(d3.dst), d3.dst == 0 ? getFloatTypeName(4) + "(0.0f, 0.0f, 0.0f, 1.0f)" : getFloatTypeName(4) + "(0.0, 0.0, 0.0, 0.0)");
|
||||
break;
|
||||
}
|
||||
@ -82,7 +82,7 @@ std::string VertexProgramDecompiler::GetSRC(const u32 n)
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_ERROR(RSX, "Bad input src num: %d", fmt::by_value(d1.input_src));
|
||||
LOG_ERROR(RSX, "Bad input src num: %d", u32{ d1.input_src });
|
||||
ret += m_parr.AddParam(PF_PARAM_IN, getFloatTypeName(4), "in_unk", d1.input_src);
|
||||
}
|
||||
break;
|
||||
@ -92,7 +92,7 @@ std::string VertexProgramDecompiler::GetSRC(const u32 n)
|
||||
break;
|
||||
|
||||
default:
|
||||
LOG_ERROR(RSX, fmt::Format("Bad src%u reg type: %d", n, fmt::by_value(src[n].reg_type)));
|
||||
LOG_ERROR(RSX, fmt::format("Bad src%u reg type: %d", n, u32{ src[n].reg_type }));
|
||||
Emu.Pause();
|
||||
break;
|
||||
}
|
||||
@ -254,7 +254,7 @@ std::string VertexProgramDecompiler::GetCond()
|
||||
|
||||
swizzle = swizzle == "xyzw" ? "" : "." + swizzle;
|
||||
|
||||
return fmt::Format("any(%s(cc%d%s, vec4(0.0)%s))", cond_string_table[d0.cond], d0.cond_reg_sel_1, swizzle.c_str(), swizzle.c_str());
|
||||
return fmt::format("any(%s(cc%d%s, vec4(0.0)%s))", cond_string_table[d0.cond], d0.cond_reg_sel_1, swizzle.c_str(), swizzle.c_str());
|
||||
}
|
||||
|
||||
void VertexProgramDecompiler::AddCodeCond(const std::string& dst, const std::string& src)
|
||||
@ -517,7 +517,7 @@ std::string VertexProgramDecompiler::Decompile()
|
||||
AddCode("{");
|
||||
m_cur_instr->open_scopes++;
|
||||
|
||||
AddCode(fmt::Format("if (jump_position <= %u)", jump_position++));
|
||||
AddCode(fmt::format("if (jump_position <= %u)", jump_position++));
|
||||
AddCode("{");
|
||||
m_cur_instr->open_scopes++;
|
||||
}
|
||||
@ -543,7 +543,7 @@ std::string VertexProgramDecompiler::Decompile()
|
||||
AddCode("}");
|
||||
AddCode("");
|
||||
|
||||
AddCode(fmt::Format("if (jump_position <= %u)", jump_position++));
|
||||
AddCode(fmt::format("if (jump_position <= %u)", jump_position++));
|
||||
AddCode("{");
|
||||
m_cur_instr->open_scopes++;
|
||||
}
|
||||
@ -600,7 +600,7 @@ std::string VertexProgramDecompiler::Decompile()
|
||||
AddCode("$ifcond ");
|
||||
AddCode("{");
|
||||
m_cur_instr->open_scopes++;
|
||||
AddCode(fmt::Format("jump_position = %u;", jump_position));
|
||||
AddCode(fmt::format("jump_position = %u;", jump_position));
|
||||
AddCode("continue;");
|
||||
m_cur_instr->close_scopes++;
|
||||
AddCode("}");
|
||||
@ -641,8 +641,8 @@ std::string VertexProgramDecompiler::Decompile()
|
||||
break;
|
||||
|
||||
default:
|
||||
AddCode(fmt::Format("//Unknown vp sca_opcode 0x%x", fmt::by_value(d1.sca_opcode)));
|
||||
LOG_ERROR(RSX, "Unknown vp sca_opcode 0x%x", fmt::by_value(d1.sca_opcode));
|
||||
AddCode(fmt::format("//Unknown vp sca_opcode 0x%x", u32{ d1.sca_opcode }));
|
||||
LOG_ERROR(RSX, "Unknown vp sca_opcode 0x%x", u32{ d1.sca_opcode });
|
||||
Emu.Pause();
|
||||
break;
|
||||
}
|
||||
@ -675,8 +675,8 @@ std::string VertexProgramDecompiler::Decompile()
|
||||
case RSX_VEC_OPCODE_TXL: SetDSTVec("texture($t, $0.xy)"); break;
|
||||
|
||||
default:
|
||||
AddCode(fmt::Format("//Unknown vp opcode 0x%x", fmt::by_value(d1.vec_opcode)));
|
||||
LOG_ERROR(RSX, "Unknown vp opcode 0x%x", fmt::by_value(d1.vec_opcode));
|
||||
AddCode(fmt::format("//Unknown vp opcode 0x%x", u32{ d1.vec_opcode }));
|
||||
LOG_ERROR(RSX, "Unknown vp opcode 0x%x", u32{ d1.vec_opcode });
|
||||
Emu.Pause();
|
||||
break;
|
||||
}
|
||||
|
@ -1445,5 +1445,5 @@ static const std::string GetMethodName(const u32 id)
|
||||
return "CELL_GCM_" + s.name;
|
||||
}
|
||||
|
||||
return fmt::Format("unknown/illegal method [0x%08x]", id);
|
||||
return fmt::format("unknown/illegal method [0x%08x]", id);
|
||||
}
|
||||
|
@ -613,8 +613,8 @@ void GLTexture::Save(RSXTexture& tex)
|
||||
if (!fs::exists(dir_path)) fs::create_dir(dir_path);
|
||||
|
||||
u32 count = 0;
|
||||
while (fs::exists(fmt::Format(file_fmt.c_str(), count))) count++;
|
||||
Save(tex, fmt::Format(file_fmt.c_str(), count));
|
||||
while (fs::exists(fmt::format(file_fmt.c_str(), count))) count++;
|
||||
Save(tex, fmt::format(file_fmt.c_str(), count));
|
||||
}
|
||||
|
||||
void GLTexture::Bind()
|
||||
@ -1063,12 +1063,12 @@ void GLGSRender::InitVertexData()
|
||||
|
||||
for (const RSXTransformConstant& c : m_transform_constants)
|
||||
{
|
||||
const std::string name = fmt::Format("vc[%u]", c.id);
|
||||
const std::string name = fmt::format("vc[%u]", c.id);
|
||||
l = m_program.GetLocation(name);
|
||||
checkForGlError("glGetUniformLocation " + name);
|
||||
|
||||
glUniform4f(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));
|
||||
checkForGlError("glUniform4f " + name + fmt::format(" %d [%f %f %f %f]", l, c.x, c.y, c.z, c.w));
|
||||
}
|
||||
|
||||
// Scale
|
||||
@ -1107,7 +1107,7 @@ void GLGSRender::InitFragmentData()
|
||||
u32 c1 = (data[1] >> 16 | data[1] << 16);
|
||||
u32 c2 = (data[2] >> 16 | data[2] << 16);
|
||||
u32 c3 = (data[3] >> 16 | data[3] << 16);
|
||||
const std::string name = fmt::Format("fc%u", offsetInFP);
|
||||
const std::string name = fmt::format("fc%u", offsetInFP);
|
||||
const int l = m_program.GetLocation(name);
|
||||
checkForGlError("glGetUniformLocation " + name);
|
||||
|
||||
@ -1116,7 +1116,7 @@ void GLGSRender::InitFragmentData()
|
||||
float f2 = (float&)c2;
|
||||
float f3 = (float&)c3;
|
||||
glUniform4f(l, f0, f1, f2, f3);
|
||||
checkForGlError("glUniform4f " + name + fmt::Format(" %u [%f %f %f %f]", l, f0, f1, f2, f3));
|
||||
checkForGlError("glUniform4f " + name + fmt::format(" %u [%f %f %f %f]", l, f0, f1, f2, f3));
|
||||
}
|
||||
|
||||
for (const RSXTransformConstant& c : m_fragment_constants)
|
||||
@ -1125,12 +1125,12 @@ void GLGSRender::InitFragmentData()
|
||||
|
||||
//LOG_WARNING(RSX,"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 std::string name = fmt::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 + fmt::Format(" %u [%f %f %f %f]", l, c.x, c.y, c.z, c.w));
|
||||
checkForGlError("glUniform4f " + name + fmt::format(" %u [%f %f %f %f]", l, c.x, c.y, c.z, c.w));
|
||||
}
|
||||
|
||||
|
||||
@ -1520,7 +1520,7 @@ void GLGSRender::InitDrawBuffers()
|
||||
for (int i = 0; i < 4; ++i)
|
||||
{
|
||||
m_fbo.Renderbuffer(GL_COLOR_ATTACHMENT0 + i, m_rbo.GetId(i));
|
||||
checkForGlError(fmt::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));
|
||||
@ -1951,10 +1951,10 @@ void GLGSRender::Draw()
|
||||
checkForGlError("glActiveTexture");
|
||||
m_gl_textures[i].Create();
|
||||
m_gl_textures[i].Bind();
|
||||
checkForGlError(fmt::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(fmt::Format("m_gl_textures[%d].Init", i));
|
||||
checkForGlError(fmt::format("m_gl_textures[%d].Init", i));
|
||||
}
|
||||
|
||||
for (u32 i = 0; i < m_textures_count; ++i)
|
||||
@ -1965,10 +1965,10 @@ void GLGSRender::Draw()
|
||||
checkForGlError("glActiveTexture");
|
||||
m_gl_vertex_textures[i].Create();
|
||||
m_gl_vertex_textures[i].Bind();
|
||||
checkForGlError(fmt::Format("m_gl_vertex_textures[%d].Bind", i));
|
||||
checkForGlError(fmt::format("m_gl_vertex_textures[%d].Bind", i));
|
||||
m_program.SetVTex(i);
|
||||
m_gl_vertex_textures[i].Init(m_vertex_textures[i]);
|
||||
checkForGlError(fmt::Format("m_gl_vertex_textures[%d].Init", i));
|
||||
checkForGlError(fmt::format("m_gl_vertex_textures[%d].Init", i));
|
||||
}
|
||||
|
||||
m_vao.Bind();
|
||||
|
@ -23,7 +23,7 @@ int GLProgram::GetLocation(const std::string& name)
|
||||
m_locations[pos].name = name;
|
||||
|
||||
m_locations[pos].loc = glGetUniformLocation(id, name.c_str());
|
||||
checkForGlError(fmt::Format("glGetUniformLocation(0x%x, %s)", id, name.c_str()));
|
||||
checkForGlError(fmt::format("glGetUniformLocation(0x%x, %s)", id, name.c_str()));
|
||||
return m_locations[pos].loc;
|
||||
}
|
||||
|
||||
@ -95,16 +95,16 @@ void GLProgram::Use()
|
||||
|
||||
void GLProgram::SetTex(u32 index)
|
||||
{
|
||||
int loc = GetLocation(fmt::Format("tex%u", index));
|
||||
int loc = GetLocation(fmt::format("tex%u", index));
|
||||
glProgramUniform1i(id, loc, index);
|
||||
checkForGlError(fmt::Format("SetTex(%u - %d - %d)", id, index, loc));
|
||||
checkForGlError(fmt::format("SetTex(%u - %d - %d)", id, index, loc));
|
||||
}
|
||||
|
||||
void GLProgram::SetVTex(u32 index)
|
||||
{
|
||||
int loc = GetLocation(fmt::Format("vtex%u", index));
|
||||
int loc = GetLocation(fmt::format("vtex%u", index));
|
||||
glProgramUniform1i(id, loc, index);
|
||||
checkForGlError(fmt::Format("SetVTex(%u - %d - %d)", id, index, loc));
|
||||
checkForGlError(fmt::format("SetVTex(%u - %d - %d)", id, index, loc));
|
||||
}
|
||||
|
||||
void GLProgram::Delete()
|
||||
|
@ -141,7 +141,7 @@ u32 RSXThread::OutOfArgsCount(const uint x, const u32 cmd, const u32 count, cons
|
||||
auto args = vm::ptr<u32>::make(args_addr);
|
||||
std::string debug = GetMethodName(cmd);
|
||||
debug += "(";
|
||||
for (u32 i = 0; i < count; ++i) debug += (i ? ", " : "") + fmt::Format("0x%x", ARGS(i));
|
||||
for (u32 i = 0; i < count; ++i) debug += (i ? ", " : "") + fmt::format("0x%x", ARGS(i));
|
||||
debug += ")";
|
||||
LOG_NOTICE(RSX, "OutOfArgsCount(x=%d, count=%d): %s", x, count, debug.c_str());
|
||||
|
||||
@ -174,7 +174,7 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, const u32 args_addr, const
|
||||
#if CMD_DEBUG
|
||||
std::string debug = GetMethodName(cmd);
|
||||
debug += "(";
|
||||
for (u32 i = 0; i < count; ++i) debug += (i ? ", " : "") + fmt::Format("0x%x", ARGS(i));
|
||||
for (u32 i = 0; i < count; ++i) debug += (i ? ", " : "") + fmt::format("0x%x", ARGS(i));
|
||||
debug += ")";
|
||||
LOG_NOTICE(RSX, debug);
|
||||
#endif
|
||||
@ -2422,7 +2422,7 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, const u32 args_addr, const
|
||||
log += "(";
|
||||
for (u32 i = 0; i < count; ++i)
|
||||
{
|
||||
log += (i ? ", " : "") + fmt::Format("0x%x", ARGS(i));
|
||||
log += (i ? ", " : "") + fmt::format("0x%x", ARGS(i));
|
||||
}
|
||||
log += ")";
|
||||
LOG_ERROR(RSX, "TODO: %s", log.c_str());
|
||||
|
@ -18,7 +18,7 @@ class LogBase
|
||||
|
||||
template<typename... Args> never_inline void LogPrepare(LogType type, const char* fmt, Args... args) const
|
||||
{
|
||||
LogOutput(type, fmt::Format(fmt, args...));
|
||||
LogOutput(type, fmt::format(fmt, args...));
|
||||
}
|
||||
|
||||
public:
|
||||
|
@ -640,7 +640,7 @@ s32 cellGameContentErrorDialog(s32 type, s32 errNeedSizeKB, vm::cptr<char> dirNa
|
||||
|
||||
if (dirName)
|
||||
{
|
||||
errorMsg += fmt::Format("\nDirectory name: %s", dirName.get_ptr());
|
||||
errorMsg += fmt::format("\nDirectory name: %s", dirName.get_ptr());
|
||||
}
|
||||
|
||||
rMessageBox(errorMsg, "Error", rICON_ERROR | rOK);
|
||||
|
@ -57,7 +57,7 @@ s32 npDrmIsAvailable(u32 k_licensee_addr, vm::cptr<char> drm_path)
|
||||
for (s32 i = 0; i < 0x10; i++)
|
||||
{
|
||||
k_licensee[i] = vm::read8(k_licensee_addr + i);
|
||||
k_licensee_str += fmt::Format("%02x", k_licensee[i]);
|
||||
k_licensee_str += fmt::format("%02x", k_licensee[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -169,7 +169,7 @@ s32 sceNpTrophyRegisterContext(PPUThread& CPU, u32 context, u32 handle, vm::ptr<
|
||||
const size_t kTargetBufferLength = 31;
|
||||
char target[kTargetBufferLength + 1];
|
||||
target[kTargetBufferLength] = 0;
|
||||
strcpy_trunc(target, fmt::Format("TROP_%02d.SFM", Ini.SysLanguage.GetValue()));
|
||||
strcpy_trunc(target, fmt::format("TROP_%02d.SFM", Ini.SysLanguage.GetValue()));
|
||||
|
||||
if (trp.ContainsEntry(target))
|
||||
{
|
||||
@ -190,7 +190,7 @@ s32 sceNpTrophyRegisterContext(PPUThread& CPU, u32 context, u32 handle, vm::ptr<
|
||||
// Discard unnecessary TROP_XX.SFM files
|
||||
for (s32 i = 0; i <= 18; i++)
|
||||
{
|
||||
strcpy_trunc(target, fmt::Format("TROP_%02d.SFM", i));
|
||||
strcpy_trunc(target, fmt::format("TROP_%02d.SFM", i));
|
||||
if (i != Ini.SysLanguage.GetValue())
|
||||
{
|
||||
trp.RemoveEntry(target);
|
||||
|
@ -43,8 +43,7 @@ static std::vector<std::string> GetAdapters()
|
||||
PIP_ADAPTER_INFO pAdapter = pAdapterInfo;
|
||||
while (pAdapter)
|
||||
{
|
||||
std::string adapterName = fmt::Format("%s", pAdapter->Description);
|
||||
adapters.push_back(adapterName);
|
||||
adapters.emplace_back(pAdapter->Description);
|
||||
pAdapter = pAdapter->Next;
|
||||
}
|
||||
}
|
||||
@ -73,8 +72,7 @@ static std::vector<std::string> GetAdapters()
|
||||
|
||||
if (family == AF_INET || family == AF_INET6)
|
||||
{
|
||||
std::string adapterName = fmt::Format("%s", ifa->ifa_name);
|
||||
adapters.push_back(adapterName);
|
||||
adapters.emplace_back(ifa->ifa_name);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -250,20 +250,18 @@ void VHDDExplorer::OnRemove(wxCommandEvent& event)
|
||||
void VHDDExplorer::OnCreateDir(wxCommandEvent& event)
|
||||
{
|
||||
int i = 1;
|
||||
static const std::string& fmt = "New Dir (%d)";
|
||||
while(m_hdd->HasEntry(fmt::Format(fmt.c_str(), i))) i++;
|
||||
while(m_hdd->HasEntry(fmt::format("New Dir (%d)", i))) i++;
|
||||
|
||||
m_hdd->Create(vfsHDD_Entry_Dir, fmt::Format(fmt.c_str(), i));
|
||||
m_hdd->Create(vfsHDD_Entry_Dir, fmt::format("New Dir (%d)", i));
|
||||
UpdateList();
|
||||
}
|
||||
|
||||
void VHDDExplorer::OnCreateFile(wxCommandEvent& event)
|
||||
{
|
||||
int i = 1;
|
||||
static const std::string& fmt = "New File (%d)";
|
||||
while (m_hdd->HasEntry(fmt::Format(fmt.c_str(), i))) i++;
|
||||
while (m_hdd->HasEntry(fmt::format("New File (%d)", i))) i++;
|
||||
|
||||
m_hdd->Create(vfsHDD_Entry_File, fmt::Format(fmt.c_str(), i));
|
||||
m_hdd->Create(vfsHDD_Entry_File, fmt::format("New File (%d)", i));
|
||||
UpdateList();
|
||||
}
|
||||
|
||||
@ -537,7 +535,7 @@ void VHDDManagerDialog::LoadPaths()
|
||||
for(size_t i=0; i<count; ++i)
|
||||
{
|
||||
IniEntry<std::string> path_entry;
|
||||
path_entry.Init(fmt::Format("path[%d]", i), "HDDManager");
|
||||
path_entry.Init(fmt::format("path[%d]", i), "HDDManager");
|
||||
m_paths.emplace_back(path_entry.LoadValue(""));
|
||||
}
|
||||
}
|
||||
@ -551,7 +549,7 @@ void VHDDManagerDialog::SavePaths()
|
||||
for(size_t i=0; i<m_paths.size(); ++i)
|
||||
{
|
||||
IniEntry<std::string> path_entry;
|
||||
path_entry.Init(fmt::Format("path[%d]", i), "HDDManager");
|
||||
path_entry.Init(fmt::format("path[%d]", i), "HDDManager");
|
||||
path_entry.SaveValue(m_paths[i]);
|
||||
}
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ static std::pair<int, int> StringToSize(const std::string& str)
|
||||
|
||||
static std::string SizeToString(const std::pair<int, int>& size)
|
||||
{
|
||||
return fmt::Format("%dx%d", size.first, size.second);
|
||||
return fmt::format("%dx%d", size.first, size.second);
|
||||
}
|
||||
|
||||
static WindowInfo StringToWindowInfo(const std::string& str)
|
||||
@ -100,7 +100,7 @@ static std::string WindowInfoToString(const WindowInfo& wind)
|
||||
{
|
||||
const int px = wind.position.first < -wind.size.first ? -1 : wind.position.first;
|
||||
const int py = wind.position.second < -wind.size.second ? -1 : wind.position.second;
|
||||
return fmt::Format("%dx%d:%dx%d", wind.size.first, wind.size.second, px, py);
|
||||
return fmt::format("%dx%d:%dx%d", wind.size.first, wind.size.second, px, py);
|
||||
}
|
||||
|
||||
//Ini
|
||||
|
@ -44,10 +44,10 @@ static const u64 g_spu_offset = 0x10000;
|
||||
|
||||
const std::string Ehdr_DataToString(const u8 data)
|
||||
{
|
||||
if(data > 1) return fmt::Format("%d's complement, big endian", data);
|
||||
if(data > 1) return fmt::format("%d's complement, big endian", data);
|
||||
if(data < 1) return "Data is not found";
|
||||
|
||||
return fmt::Format("%d's complement, little endian", data);
|
||||
return fmt::format("%d's complement, little endian", data);
|
||||
}
|
||||
|
||||
const std::string Ehdr_TypeToString(const u16 type)
|
||||
@ -58,7 +58,7 @@ const std::string Ehdr_TypeToString(const u16 type)
|
||||
case 2: return "EXEC (Executable file)";
|
||||
};
|
||||
|
||||
return fmt::Format("Unknown (%d)", type);
|
||||
return fmt::format("Unknown (%d)", type);
|
||||
}
|
||||
|
||||
const std::string Ehdr_OS_ABIToString(const u8 os_abi)
|
||||
@ -69,7 +69,7 @@ const std::string Ehdr_OS_ABIToString(const u8 os_abi)
|
||||
case 0x66: return "Cell OS LV-2";
|
||||
};
|
||||
|
||||
return fmt::Format("Unknown (0x%x)", os_abi);
|
||||
return fmt::format("Unknown (0x%x)", os_abi);
|
||||
}
|
||||
|
||||
const std::string Ehdr_MachineToString(const u16 machine)
|
||||
@ -82,7 +82,7 @@ const std::string Ehdr_MachineToString(const u16 machine)
|
||||
case MACHINE_ARM: return "ARM";
|
||||
};
|
||||
|
||||
return fmt::Format("Unknown (0x%x)", machine);
|
||||
return fmt::format("Unknown (0x%x)", machine);
|
||||
}
|
||||
|
||||
const std::string Phdr_FlagsToString(u32 flags)
|
||||
@ -101,13 +101,13 @@ const std::string Phdr_FlagsToString(u32 flags)
|
||||
const u8 rsx = (flags >> 0x18) & 0xf;
|
||||
|
||||
std::string ret;
|
||||
ret += fmt::Format("[0x%x] ", flags);
|
||||
ret += fmt::format("[0x%x] ", flags);
|
||||
|
||||
flags &= ~ppu;
|
||||
flags &= ~spu << 0x14;
|
||||
flags &= ~rsx << 0x18;
|
||||
|
||||
if(flags != 0) return fmt::Format("Unknown %s PPU[0x%x] SPU[0x%x] RSX[0x%x]", ret.c_str(), ppu, spu, rsx);
|
||||
if(flags != 0) return fmt::format("Unknown %s PPU[0x%x] SPU[0x%x] RSX[0x%x]", ret.c_str(), ppu, spu, rsx);
|
||||
|
||||
ret += "PPU[" + FLAGS_TO_STRING(ppu) + "] ";
|
||||
ret += "SPU[" + FLAGS_TO_STRING(spu) + "] ";
|
||||
@ -127,5 +127,5 @@ const std::string Phdr_TypeToString(const u32 type)
|
||||
case 0x60000002: return "LOOS+2";
|
||||
};
|
||||
|
||||
return fmt::Format("Unknown (0x%x)", type);
|
||||
return fmt::format("Unknown (0x%x)", type);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user