HwRegs: Swap wxString desc() for std::string

This commit is contained in:
Connor McLaughlin 2022-04-12 21:54:30 +10:00 committed by refractionpcsx2
parent 63424b765d
commit 850deed6c1
13 changed files with 77 additions and 70 deletions

View File

@ -15,6 +15,8 @@
#pragma once
#include "common/StringUtil.h"
// Useful enums for some of the fields.
enum pce_values
{
@ -97,19 +99,19 @@ union tDMA_TAG {
tDMA_TAG(u32 val) { _u32 = val; }
u16 upper() const { return (_u32 >> 16); }
u16 lower() const { return (u16)_u32; }
wxString tag_to_str() const
std::string tag_to_str() const
{
switch(ID)
{
case TAG_REFE: return wxsFormat(L"REFE %08X", _u32); break;
case TAG_CNT: return L"CNT"; break;
case TAG_NEXT: return wxsFormat(L"NEXT %08X", _u32); break;
case TAG_REF: return wxsFormat(L"REF %08X", _u32); break;
case TAG_REFS: return wxsFormat(L"REFS %08X", _u32); break;
case TAG_CALL: return L"CALL"; break;
case TAG_RET: return L"RET"; break;
case TAG_END: return L"END"; break;
default: return L"????"; break;
case TAG_REFE: return StringUtil::StdStringFromFormat("REFE %08X", _u32);
case TAG_CNT: return "CNT";
case TAG_NEXT: return StringUtil::StdStringFromFormat("NEXT %08X", _u32);
case TAG_REF: return StringUtil::StdStringFromFormat("REF %08X", _u32);
case TAG_REFS: return StringUtil::StdStringFromFormat("REFS %08X", _u32);
case TAG_CALL: return "CALL";
case TAG_RET: return "RET";
case TAG_END: return "END";
default: return "????";
}
}
void reset() { _u32 = 0; }
@ -139,7 +141,7 @@ union tDMA_CHCR {
void reset() { _u32 = 0; }
u16 upper() const { return (_u32 >> 16); }
u16 lower() const { return (u16)_u32; }
wxString desc() const { return wxsFormat(L"Chcr: 0x%x", _u32); }
std::string desc() const { return StringUtil::StdStringFromFormat("Chcr: 0x%x", _u32); }
tDMA_TAG tag() { return (tDMA_TAG)_u32; }
};
@ -155,7 +157,7 @@ union tDMA_SADR {
tDMA_SADR(u32 val) { _u32 = val; }
void reset() { _u32 = 0; }
wxString desc() const { return wxsFormat(L"Sadr: 0x%x", _u32); }
std::string desc() const { return StringUtil::StdStringFromFormat("Sadr: 0x%x", _u32); }
tDMA_TAG tag() const { return (tDMA_TAG)_u32; }
};
@ -168,7 +170,7 @@ union tDMA_QWC {
tDMA_QWC(u32 val) { _u32 = val; }
void reset() { _u32 = 0; }
wxString desc() const { return wxsFormat(L"QWC: 0x%04x", QWC); }
std::string desc() const { return StringUtil::StdStringFromFormat("QWC: 0x%04x", QWC); }
tDMA_TAG tag() const { return (tDMA_TAG)_u32; }
};
@ -203,8 +205,8 @@ struct DMACh {
tDMA_TAG *DMAtransfer(u32 addr, u32 num);
tDMA_TAG dma_tag();
wxString cmq_to_str() const;
wxString cmqt_to_str() const;
std::string cmq_to_str() const;
std::string cmqt_to_str() const;
};
enum INTCIrqs
@ -337,7 +339,7 @@ union tDMAC_CTRL {
void set_flags(u32 flags) { _u32 |= flags; }
void clear_flags(u32 flags) { _u32 &= ~flags; }
void reset() { _u32 = 0; }
wxString desc() const { return wxsFormat(L"Ctrl: 0x%x", _u32); }
std::string desc() const { return StringUtil::StdStringFromFormat("Ctrl: 0x%x", _u32); }
};
union tDMAC_STAT {
@ -362,7 +364,7 @@ union tDMAC_STAT {
void set_flags(u32 flags) { _u32 |= flags; }
void clear_flags(u32 flags) { _u32 &= ~flags; }
void reset() { _u32 = 0; }
wxString desc() const { return wxsFormat(L"Stat: 0x%x", _u32); }
std::string desc() const { return StringUtil::StdStringFromFormat("Stat: 0x%x", _u32); }
bool TestForInterrupt() const
{
@ -386,7 +388,7 @@ union tDMAC_PCR {
void set_flags(u32 flags) { _u32 |= flags; }
void clear_flags(u32 flags) { _u32 &= ~flags; }
void reset() { _u32 = 0; }
wxString desc() const { return wxsFormat(L"Pcr: 0x%x", _u32); }
std::string desc() const { return StringUtil::StdStringFromFormat("Pcr: 0x%x", _u32); }
};
union tDMAC_SQWC {
@ -404,7 +406,7 @@ union tDMAC_SQWC {
void set_flags(u32 flags) { _u32 |= flags; }
void clear_flags(u32 flags) { _u32 &= ~flags; }
void reset() { _u32 = 0; }
wxString desc() const { return wxsFormat(L"Sqwc: 0x%x", _u32); }
std::string desc() const { return StringUtil::StdStringFromFormat("Sqwc: 0x%x", _u32); }
};
union tDMAC_RBSR {
@ -417,7 +419,7 @@ union tDMAC_RBSR {
tDMAC_RBSR(u32 val) { _u32 = val; }
void reset() { _u32 = 0; }
wxString desc() const { return wxsFormat(L"Rbsr: 0x%x", _u32); }
std::string desc() const { return StringUtil::StdStringFromFormat("Rbsr: 0x%x", _u32); }
};
union tDMAC_RBOR {
@ -430,7 +432,7 @@ union tDMAC_RBOR {
tDMAC_RBOR(u32 val) { _u32 = val; }
void reset() { _u32 = 0; }
wxString desc() const { return wxsFormat(L"Rbor: 0x%x", _u32); }
std::string desc() const { return StringUtil::StdStringFromFormat("Rbor: 0x%x", _u32); }
};
// --------------------------------------------------------------------------------------
@ -465,14 +467,9 @@ union tDMAC_ADDR
if (SPR) ADDR &= (Ps2MemSize::Scratch-1);
}
wxString ToString(bool sprIsValid=true) const
std::string ToString(bool sprIsValid=true) const
{
return pxsFmt((sprIsValid && SPR) ? L"0x%04X(SPR)" : L"0x%08X", ADDR);
}
wxCharBuffer ToUTF8(bool sprIsValid=true) const
{
return FastFormatAscii().Write((sprIsValid && SPR) ? "0x%04X(SPR)" : "0x%08X", ADDR).c_str();
return StringUtil::StdStringFromFormat((sprIsValid && SPR) ? "0x%04X(SPR)" : "0x%08X", ADDR);
}
};
@ -509,7 +506,7 @@ union tINTC_STAT {
void set_flags(u32 flags) { _u32 |= flags; }
void clear_flags(u32 flags) { _u32 &= ~flags; }
void reset() { _u32 = 0; }
wxString desc() const { return wxsFormat(L"Stat: 0x%x", _u32); }
std::string desc() const { return StringUtil::StdStringFromFormat("Stat: 0x%x", _u32); }
};
union tINTC_MASK {
@ -525,7 +522,7 @@ union tINTC_MASK {
void set_flags(u32 flags) { _u32 |= flags; }
void clear_flags(u32 flags) { _u32 &= ~flags; }
void reset() { _u32 = 0; }
wxString desc() const { return wxsFormat(L"Mask: 0x%x", _u32); }
std::string desc() const { return StringUtil::StdStringFromFormat("Mask: 0x%x", _u32); }
};
struct INTCregisters

View File

@ -15,6 +15,8 @@
#pragma once
#include "common/StringUtil.h"
#define COPY_GS_PACKET_TO_MTGS 0
#define PRINT_GIF_PACKET 0
@ -107,7 +109,7 @@ union tGIF_CTRL
void set_flags(u32 flags) { _u32 |= flags; }
void clear_flags(u32 flags) { _u32 &= ~flags; }
void reset() { _u32 = 0; }
wxString desc() { return wxsFormat(L"Ctrl: 0x%x", _u32); }
std::string desc() { return StringUtil::StdStringFromFormat("Ctrl: 0x%x", _u32); }
};
union tGIF_MODE
@ -127,7 +129,7 @@ union tGIF_MODE
void set_flags(u32 flags) { _u32 |= flags; }
void clear_flags(u32 flags) { _u32 &= ~flags; }
void reset() { _u32 = 0; }
wxString desc() { return wxsFormat(L"Mode: 0x%x", _u32); }
std::string desc() { return StringUtil::StdStringFromFormat("Mode: 0x%x", _u32); }
};
union tGIF_STAT
@ -158,7 +160,7 @@ union tGIF_STAT
void set_flags(u32 flags) { _u32 |= flags; }
void clear_flags(u32 flags) { _u32 &= ~flags; }
void reset() { _u32 = 0; }
wxString desc() { return wxsFormat(L"Stat: 0x%x", _u32); }
std::string desc() { return StringUtil::StdStringFromFormat("Stat: 0x%x", _u32); }
};
union tGIF_TAG0
@ -176,7 +178,7 @@ union tGIF_TAG0
void set_flags(u32 flags) { _u32 |= flags; }
void clear_flags(u32 flags) { _u32 &= ~flags; }
void reset() { _u32 = 0; }
wxString desc() { return wxsFormat(L"Tag0: 0x%x", _u32); }
std::string desc() { return StringUtil::StdStringFromFormat("Tag0: 0x%x", _u32); }
};
union tGIF_TAG1
@ -196,7 +198,7 @@ union tGIF_TAG1
void set_flags(u32 flags) { _u32 |= flags; }
void clear_flags(u32 flags) { _u32 &= ~flags; }
void reset() { _u32 = 0; }
wxString desc() { return wxsFormat(L"Tag1: 0x%x", _u32); }
std::string desc() { return StringUtil::StdStringFromFormat("Tag1: 0x%x", _u32); }
};
union tGIF_CNT
@ -217,7 +219,7 @@ union tGIF_CNT
void set_flags(u32 flags) { _u32 |= flags; }
void clear_flags(u32 flags) { _u32 &= ~flags; }
void reset() { _u32 = 0; }
wxString desc() { return wxsFormat(L"CNT: 0x%x", _u32); }
std::string desc() { return StringUtil::StdStringFromFormat("CNT: 0x%x", _u32); }
};
union tGIF_P3CNT
@ -231,7 +233,7 @@ union tGIF_P3CNT
tGIF_P3CNT(u32 val) { _u32 = val; }
void reset() { _u32 = 0; }
wxString desc() { return wxsFormat(L"P3CNT: 0x%x", _u32); }
std::string desc() { return StringUtil::StdStringFromFormat("P3CNT: 0x%x", _u32); }
};
union tGIF_P3TAG
@ -249,7 +251,7 @@ union tGIF_P3TAG
void set_flags(u32 flags) { _u32 |= flags; }
void clear_flags(u32 flags) { _u32 &= ~flags; }
void reset() { _u32 = 0; }
wxString desc() { return wxsFormat(L"P3Tag: 0x%x", _u32); }
std::string desc() { return StringUtil::StdStringFromFormat("P3Tag: 0x%x", _u32); }
};
struct GIFregisters

View File

@ -140,9 +140,9 @@ struct alignas(16) tIPU_BP {
return true;
}
wxString desc() const
std::string desc() const
{
return wxsFormat(L"Ipu BP: bp = 0x%x, IFC = 0x%x, FP = 0x%x.", BP, IFC, FP);
return StringUtil::StdStringFromFormat("Ipu BP: bp = 0x%x, IFC = 0x%x, FP = 0x%x.", BP, IFC, FP);
}
};
@ -277,9 +277,9 @@ union tIPU_cmd
u128 _u128[2];
void clear();
wxString desc() const
std::string desc() const
{
return pxsFmt(L"Ipu cmd: index = 0x%x, current = 0x%x, pos[0] = 0x%x, pos[1] = 0x%x",
return StringUtil::StdStringFromFormat("Ipu cmd: index = 0x%x, current = 0x%x, pos[0] = 0x%x, pos[1] = 0x%x",
index, current, pos[0], pos[1]);
}
};

View File

@ -61,14 +61,14 @@ void IPU_Fifo::clear()
out.clear();
}
wxString IPU_Fifo_Input::desc() const
std::string IPU_Fifo_Input::desc() const
{
return wxsFormat(L"IPU Fifo Input: readpos = 0x%x, writepos = 0x%x, data = 0x%x", readpos, writepos, data);
return StringUtil::StdStringFromFormat("IPU Fifo Input: readpos = 0x%x, writepos = 0x%x, data = 0x%x", readpos, writepos, data);
}
wxString IPU_Fifo_Output::desc() const
std::string IPU_Fifo_Output::desc() const
{
return wxsFormat(L"IPU Fifo Output: readpos = 0x%x, writepos = 0x%x, data = 0x%x", readpos, writepos, data);
return StringUtil::StdStringFromFormat("IPU Fifo Output: readpos = 0x%x, writepos = 0x%x, data = 0x%x", readpos, writepos, data);
}
int IPU_Fifo_Input::write(u32* pMem, int size)

View File

@ -13,8 +13,10 @@
* If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef IPU_FIFO_H_INCLUDED
#define IPU_FIFO_H_INCLUDED
#pragma once
#include "common/Pcsx2Defs.h"
#include <string>
// Important! All FIFO containers in this header should be 'struct' type, not class type.
// They are saved into the savestate as-is, and keeping them as struct ensures that the
@ -28,7 +30,7 @@ struct IPU_Fifo_Input
int write(u32* pMem, int size);
int read(void *value);
void clear();
wxString desc() const;
std::string desc() const;
};
struct IPU_Fifo_Output
@ -40,7 +42,7 @@ struct IPU_Fifo_Output
int write(const u32 * value, uint size);
void read(void *value, uint size);
void clear();
wxString desc() const;
std::string desc() const;
};
struct IPU_Fifo
@ -53,5 +55,3 @@ struct IPU_Fifo
};
alignas(16) extern IPU_Fifo ipu_fifo;
#endif // IPU_FIFO_H_INCLUDED

View File

@ -17,6 +17,8 @@
#include "IopMem.h"
#include "common/StringUtil.h"
static const u32
HW_PS1_GPU_START = 0x1F8010A0,
HW_PS1_GPU_END = 0x1F8010B0,
@ -208,7 +210,7 @@ struct dma_mbc
{
return (bcr >> 16);
}
wxString desc() const { return wxsFormat(L"madr: 0x%x bcr: 0x%x chcr: 0x%x", madr, bcr, chcr); }
std::string desc() const { return StringUtil::StdStringFromFormat("madr: 0x%x bcr: 0x%x chcr: 0x%x", madr, bcr, chcr); }
};
struct dma_mbct
@ -226,7 +228,7 @@ struct dma_mbct
{
return (bcr >> 16);
}
wxString desc() const { return wxsFormat(L"madr: 0x%x bcr: 0x%x chcr: 0x%x tadr: 0x%x", madr, bcr, chcr, tadr); }
std::string desc() const { return StringUtil::StdStringFromFormat("madr: 0x%x bcr: 0x%x chcr: 0x%x tadr: 0x%x", madr, bcr, chcr, tadr); }
};
static dma_mbc& hw_dma0 = (dma_mbc&) iopHw[0x1080];

View File

@ -355,7 +355,7 @@ __fi void EEsif0Interrupt()
__fi void dmaSIF0()
{
SIF_LOG(wxString(L"dmaSIF0" + sif0ch.cmqt_to_str()).To8BitData());
SIF_LOG("dmaSIF0 %s", sif0ch.cmqt_to_str().c_str());
if (sif0.fifo.readPos != sif0.fifo.writePos)
{

View File

@ -102,7 +102,7 @@ static __fi bool ProcessEETag()
sif1.fifo.write((u32*)ptag + 2, 2);
}
SIF_LOG(wxString(ptag->tag_to_str()).To8BitData());
SIF_LOG("%s", ptag->tag_to_str().c_str());
sif1ch.madr = ptag[1]._u32;
sif1.ee.end = hwDmacSrcChain(sif1ch, ptag->ID);
@ -331,7 +331,7 @@ __fi void EEsif1Interrupt()
// Main difference is this checks for iop, where psxDma10 checks for ee.
__fi void dmaSIF1()
{
SIF_LOG(wxString(L"dmaSIF1" + sif1ch.cmqt_to_str()).To8BitData());
SIF_LOG("dmaSIF1 %s", sif1ch.cmqt_to_str().c_str());
if (sif1.fifo.readPos != sif1.fifo.writePos)
{

View File

@ -187,6 +187,9 @@ extern SysMainMemory& GetVmMemory();
// responded to the prompt.
//
#ifndef PCSX2_CORE
#include <wx/string.h>
namespace Msgbox
{
extern bool Alert( const wxString& text, const wxString& caption=_("PCSX2 Message"), int icon=wxICON_EXCLAMATION );
@ -195,6 +198,7 @@ namespace Msgbox
extern int Assertion( const wxString& text, const wxString& stacktrace );
}
#endif
#ifdef _WIN32
extern void CheckIsUserOnHighPerfPowerPlan();

View File

@ -72,7 +72,7 @@ public:
}
virtual const char* GetShortName() const=0;
virtual wxString GetLongName() const=0;
virtual const char* GetLongName() const=0;
// returns the number of bytes committed to the working caches for this CPU
// provider (typically this refers to recompiled code caches, but could also refer
@ -166,7 +166,7 @@ public:
virtual ~InterpVU0() { Shutdown(); }
const char* GetShortName() const { return "intVU0"; }
wxString GetLongName() const { return L"VU0 Interpreter"; }
const char* GetLongName() const { return "VU0 Interpreter"; }
void Reserve() { }
void Shutdown() noexcept { }
@ -188,7 +188,7 @@ public:
virtual ~InterpVU1() { Shutdown(); }
const char* GetShortName() const { return "intVU1"; }
wxString GetLongName() const { return L"VU1 Interpreter"; }
const char* GetLongName() const { return "VU1 Interpreter"; }
void Reserve() { }
void Shutdown() noexcept;
@ -214,7 +214,7 @@ public:
virtual ~recMicroVU0() { Shutdown(); }
const char* GetShortName() const { return "mVU0"; }
wxString GetLongName() const { return L"microVU0 Recompiler"; }
const char* GetLongName() const { return "microVU0 Recompiler"; }
void Reserve();
void Shutdown() noexcept;
@ -236,7 +236,7 @@ public:
virtual ~recMicroVU1() { Shutdown(); }
const char* GetShortName() const { return "mVU1"; }
wxString GetLongName() const { return L"microVU1 Recompiler"; }
const char* GetLongName() const { return "microVU1 Recompiler"; }
void Reserve();
void Shutdown() noexcept;

View File

@ -18,6 +18,8 @@
#include "MemoryTypes.h"
#include "R5900.h"
#include "common/StringUtil.h"
enum vif0_stat_flags
{
VIF0_STAT_VPS_W = (1),
@ -118,7 +120,7 @@ union tVIF_STAT {
void set_flags (u32 flags) { _u32 |= flags; }
void clear_flags(u32 flags) { _u32 &= ~flags; }
void reset() { _u32 = 0; }
wxString desc() const { return wxsFormat(L"Stat: 0x%x", _u32); }
std::string desc() const { return StringUtil::StdStringFromFormat("Stat: 0x%x", _u32); }
};
#define VIF_STAT(value) ((tVIF_STAT)(value))
@ -138,7 +140,7 @@ union tVIF_FBRST {
void set_flags (u32 flags) { _u32 |= flags; }
void clear_flags(u32 flags) { _u32 &= ~flags; }
void reset() { _u32 = 0; }
wxString desc() const { return wxsFormat(L"Fbrst: 0x%x", _u32); }
std::string desc() const { return StringUtil::StdStringFromFormat("Fbrst: 0x%x", _u32); }
};
#define FBRST(value) ((tVIF_FBRST)(value))
@ -159,7 +161,7 @@ union tVIF_ERR {
void set_flags (u32 flags) { _u32 |= flags; }
void clear_flags(u32 flags) { _u32 &= ~flags; }
void reset() { _u32 = 0; }
wxString desc() const { return wxsFormat(L"Err: 0x%x", _u32); }
std::string desc() const { return StringUtil::StdStringFromFormat("Err: 0x%x", _u32); }
};
struct vifCycle

View File

@ -70,14 +70,14 @@ tDMA_TAG DMACh::dma_tag()
return chcr.tag();
}
wxString DMACh::cmq_to_str() const
std::string DMACh::cmq_to_str() const
{
return wxsFormat(L"chcr = %lx, madr = %lx, qwc = %lx", chcr._u32, madr, qwc);
return StringUtil::StdStringFromFormat("chcr = %lx, madr = %lx, qwc = %lx", chcr._u32, madr, qwc);
}
wxString DMACh::cmqt_to_str() const
std::string DMACh::cmqt_to_str() const
{
return wxsFormat(L"chcr = %lx, madr = %lx, qwc = %lx, tadr = %1x", chcr._u32, madr, qwc, tadr);
return StringUtil::StdStringFromFormat("chcr = %lx, madr = %lx, qwc = %lx, tadr = %1x", chcr._u32, madr, qwc, tadr);
}
__fi void throwBusError(const char *s)

View File

@ -372,7 +372,7 @@ __fi void EEsif2Interrupt()
__fi void dmaSIF2()
{
DevCon.Warning("SIF2 EE CHCR %x", sif2dma.chcr._u32);
SIF_LOG(wxString(L"dmaSIF2" + sif2dma.cmqt_to_str()).To8BitData());
SIF_LOG("dmaSIF2%s", sif2dma.cmqt_to_str().c_str());
if (sif2.fifo.readPos != sif2.fifo.writePos)
{