From 6bcaf469e8fe5b3d0a9e99c85ef3c9901520b165 Mon Sep 17 00:00:00 2001 From: Sacha Date: Thu, 28 Nov 2013 05:16:19 +1000 Subject: [PATCH] First stage of WX dependency removal. --- Utilities/Thread.cpp | 6 +- Utilities/Thread.h | 26 ++++---- rpcs3/Emu/CPU/CPUThread.cpp | 24 +++++++- rpcs3/Emu/CPU/CPUThread.h | 10 +-- rpcs3/Emu/CPU/CPUThreadManager.cpp | 4 ++ rpcs3/Emu/Cell/PPCThread.h | 4 +- rpcs3/Emu/Cell/PPUProgramCompiler.cpp | 41 +++++++------ rpcs3/Emu/Cell/PPUProgramCompiler.h | 24 ++++---- rpcs3/Emu/FS/VFS.cpp | 18 +++--- rpcs3/Emu/FS/VFS.h | 6 +- rpcs3/Emu/GS/GL/GLFragmentProgram.cpp | 78 ++++++++++++------------ rpcs3/Emu/GS/GL/GLFragmentProgram.h | 24 ++++---- rpcs3/Emu/GS/GL/GLProgramBuffer.cpp | 12 ++-- rpcs3/Emu/GS/GL/GLProgramBuffer.h | 4 +- rpcs3/Emu/GS/GL/GLShaderParam.h | 54 ++++++++-------- rpcs3/Emu/GS/GL/GLVertexProgram.cpp | 10 +-- rpcs3/Emu/Memory/Memory.cpp | 10 +-- rpcs3/Emu/SysCalls/lv2/SC_PPU_Thread.cpp | 2 +- rpcs3/Emu/SysCalls/lv2/SC_SPU_Thread.cpp | 18 +++--- rpcs3/Emu/System.cpp | 64 ++++++++++++------- rpcs3/Emu/System.h | 4 +- rpcs3/Gui/ConLog.cpp | 58 ++++++++++-------- rpcs3/Gui/ConLog.h | 8 +-- rpcs3/Gui/VFSManager.cpp | 18 +++--- rpcs3/git-version.h | 2 +- rpcs3/stdafx.h | 2 + 26 files changed, 296 insertions(+), 235 deletions(-) diff --git a/Utilities/Thread.cpp b/Utilities/Thread.cpp index f46e890c5a..00a723503e 100644 --- a/Utilities/Thread.cpp +++ b/Utilities/Thread.cpp @@ -7,7 +7,7 @@ ThreadBase* GetCurrentNamedThread() return thr ? thr->m_parent : nullptr; } -ThreadBase::ThreadBase(bool detached, const wxString& name) +ThreadBase::ThreadBase(bool detached, const std::string& name) : m_detached(detached) , m_name(name) , m_executor(nullptr) @@ -86,12 +86,12 @@ bool ThreadBase::TestDestroy() const return m_executor->TestDestroy(); } -wxString ThreadBase::GetThreadName() const +std::string ThreadBase::GetThreadName() const { return m_name; } -void ThreadBase::SetThreadName(const wxString& name) +void ThreadBase::SetThreadName(const std::string& name) { m_name = name; } \ No newline at end of file diff --git a/Utilities/Thread.h b/Utilities/Thread.h index 253d17d5f1..ee7559ec29 100644 --- a/Utilities/Thread.h +++ b/Utilities/Thread.h @@ -10,14 +10,14 @@ class ThreadExec; class ThreadBase { protected: - wxString m_name; + std::string m_name; bool m_detached; public: - wxMutex m_main_mutex; + std::mutex m_main_mutex; protected: - ThreadBase(bool detached = true, const wxString& name = "Unknown ThreadBase"); + ThreadBase(bool detached = true, const std::string& name = "Unknown ThreadBase"); public: ThreadExec* m_executor; @@ -34,15 +34,15 @@ public: virtual bool IsPaused() const; virtual bool IsAlive() const; virtual bool TestDestroy() const; - virtual wxString GetThreadName() const; - virtual void SetThreadName(const wxString& name); + virtual std::string GetThreadName() const; + virtual void SetThreadName(const std::string& name); }; ThreadBase* GetCurrentNamedThread(); class ThreadExec : public wxThread { - wxCriticalSection m_wait_for_exit; + std::mutex m_wait_for_exit; volatile bool m_alive; public: @@ -66,13 +66,13 @@ public: if(wait) { Delete(); - //wxCriticalSectionLocker lock(m_wait_for_exit); + //std::lock_guard lock(m_wait_for_exit); } } ExitCode Entry() { - //wxCriticalSectionLocker lock(m_wait_for_exit); + //std::lock_guard lock(m_wait_for_exit); m_parent->Task(); m_alive = false; if(m_parent) m_parent->m_executor = nullptr; @@ -89,7 +89,7 @@ protected: volatile u32 m_put, m_get; Array m_buffer; u32 m_max_buffer_size; - mutable wxCriticalSection m_cs_main; + mutable std::recursive_mutex m_cs_main; void CheckBusy() { @@ -110,7 +110,7 @@ public: void Flush() { - wxCriticalSectionLocker lock(m_cs_main); + std::lock_guard lock(m_cs_main); m_put = m_get = 0; m_buffer.Clear(); m_busy = false; @@ -123,17 +123,17 @@ private: public: void Push(const T& v) { - wxCriticalSectionLocker lock(m_cs_main); + std::lock_guard lock(m_cs_main); _push(v); } T Pop() { - wxCriticalSectionLocker lock(m_cs_main); + std::lock_guard lock(m_cs_main); return _pop(); } - bool HasNewPacket() const { wxCriticalSectionLocker lock(m_cs_main); return m_put != m_get; } + bool HasNewPacket() const { std::lock_guard lock(m_cs_main); return m_put != m_get; } bool IsBusy() const { return m_busy; } }; diff --git a/rpcs3/Emu/CPU/CPUThread.cpp b/rpcs3/Emu/CPU/CPUThread.cpp index 917b35f360..9e915800e9 100644 --- a/rpcs3/Emu/CPU/CPUThread.cpp +++ b/rpcs3/Emu/CPU/CPUThread.cpp @@ -76,7 +76,7 @@ void CPUThread::SetId(const u32 id) m_id = id; } -void CPUThread::SetName(const wxString& name) +void CPUThread::SetName(const std::string& name) { m_name = name; } @@ -197,7 +197,9 @@ void CPUThread::Run() return; } +#ifndef QT_UI wxGetApp().SendDbgCommand(DID_START_THREAD, this); +#endif m_status = Running; @@ -207,14 +209,18 @@ void CPUThread::Run() DoRun(); Emu.CheckStatus(); +#ifndef QT_UI wxGetApp().SendDbgCommand(DID_STARTED_THREAD, this); +#endif } void CPUThread::Resume() { if(!IsPaused()) return; +#ifndef QT_UI wxGetApp().SendDbgCommand(DID_RESUME_THREAD, this); +#endif m_status = Running; DoResume(); @@ -222,28 +228,36 @@ void CPUThread::Resume() ThreadBase::Start(); +#ifndef QT_UI wxGetApp().SendDbgCommand(DID_RESUMED_THREAD, this); +#endif } void CPUThread::Pause() { if(!IsRunning()) return; +#ifndef QT_UI wxGetApp().SendDbgCommand(DID_PAUSE_THREAD, this); +#endif m_status = Paused; DoPause(); Emu.CheckStatus(); ThreadBase::Stop(false); +#ifndef QT_UI wxGetApp().SendDbgCommand(DID_PAUSED_THREAD, this); +#endif } void CPUThread::Stop() { if(IsStopped()) return; +#ifndef QT_UI wxGetApp().SendDbgCommand(DID_STOP_THREAD, this); +#endif m_status = Stopped; ThreadBase::Stop(false); @@ -251,24 +265,32 @@ void CPUThread::Stop() DoStop(); Emu.CheckStatus(); +#ifndef QT_UI wxGetApp().SendDbgCommand(DID_STOPED_THREAD, this); +#endif } void CPUThread::Exec() { m_is_step = false; +#ifndef QT_UI wxGetApp().SendDbgCommand(DID_EXEC_THREAD, this); +#endif ThreadBase::Start(); } void CPUThread::ExecOnce() { m_is_step = true; +#ifndef QT_UI wxGetApp().SendDbgCommand(DID_EXEC_THREAD, this); +#endif ThreadBase::Start(); if(!ThreadBase::Wait()) while(m_is_step) Sleep(1); +#ifndef QT_UI wxGetApp().SendDbgCommand(DID_PAUSE_THREAD, this); wxGetApp().SendDbgCommand(DID_PAUSED_THREAD, this); +#endif } void CPUThread::Task() diff --git a/rpcs3/Emu/CPU/CPUThread.h b/rpcs3/Emu/CPU/CPUThread.h index 3ac354e7f5..08ec842593 100644 --- a/rpcs3/Emu/CPU/CPUThread.h +++ b/rpcs3/Emu/CPU/CPUThread.h @@ -59,7 +59,7 @@ public: virtual void SetArg(const uint pos, const u64 arg) = 0; void SetId(const u32 id); - void SetName(const wxString& name); + void SetName(const std::string& name); void SetPrio(const u64 prio) { m_prio = prio; } void SetOffset(const u64 offset) { m_offset = offset; } void SetExitStatus(const u32 status) { m_exit_status = status; } @@ -68,14 +68,14 @@ public: u32 GetExitStatus() const { return m_exit_status; } u64 GetPrio() const { return m_prio; } - wxString GetName() const { return m_name; } + std::string GetName() const { return m_name; } wxString GetFName() const { return wxString::Format("%s[%d] Thread%s", GetTypeString().mb_str(), m_id, - (GetName().IsEmpty() ? "" : (" (" + GetName() + ")").mb_str()) + (GetName().empty() ? "" : std::string(" (" + GetName() + ")").c_str()) ); } @@ -94,9 +94,9 @@ public: wxString GetTypeString() const { return CPUThreadTypeToString(m_type); } - virtual wxString GetThreadName() const + virtual std::string GetThreadName() const { - return GetFName() + wxString::Format("[0x%08llx]", PC); + return (GetFName() + wxString::Format("[0x%08llx]", PC)).mb_str(); } public: diff --git a/rpcs3/Emu/CPU/CPUThreadManager.cpp b/rpcs3/Emu/CPU/CPUThreadManager.cpp index f960e570c8..049beaa3bb 100644 --- a/rpcs3/Emu/CPU/CPUThreadManager.cpp +++ b/rpcs3/Emu/CPU/CPUThreadManager.cpp @@ -39,7 +39,9 @@ CPUThread& CPUThreadManager::AddThread(CPUThreadType type) new_thread->SetId(Emu.GetIdManager().GetNewID(wxString::Format("%s Thread", new_thread->GetTypeString().mb_str()), new_thread)); m_threads.Add(new_thread); +#ifndef QT_UI wxGetApp().SendDbgCommand(DID_CREATE_THREAD, new_thread); +#endif return *new_thread; } @@ -59,7 +61,9 @@ void CPUThreadManager::RemoveThread(const u32 id) if(m_threads[i].GetId() != id) continue; CPUThread* thr = &m_threads[i]; +#ifndef QT_UI wxGetApp().SendDbgCommand(DID_REMOVE_THREAD, thr); +#endif if(thr->IsAlive()) { thr->Close(); diff --git a/rpcs3/Emu/Cell/PPCThread.h b/rpcs3/Emu/Cell/PPCThread.h index 93b07f4bd6..c4d794d281 100644 --- a/rpcs3/Emu/Cell/PPCThread.h +++ b/rpcs3/Emu/Cell/PPCThread.h @@ -15,9 +15,9 @@ public: virtual void SetArg(const uint pos, const u64 arg) { assert(pos < 4); m_args[pos] = arg; } - virtual wxString GetThreadName() const + virtual std::string GetThreadName() const { - return GetFName() + wxString::Format("[0x%08llx]", PC); + return (GetFName() + wxString::Format("[0x%08llx]", PC)).mb_str(); } protected: diff --git a/rpcs3/Emu/Cell/PPUProgramCompiler.cpp b/rpcs3/Emu/Cell/PPUProgramCompiler.cpp index 14713c9b9b..508fba34bb 100644 --- a/rpcs3/Emu/Cell/PPUProgramCompiler.cpp +++ b/rpcs3/Emu/Cell/PPUProgramCompiler.cpp @@ -63,8 +63,9 @@ ArrayF sections_list; u32 section_name_offs = 0; u32 section_offs = 0; -SectionInfo::SectionInfo(const wxString& _name) : name(_name) +SectionInfo::SectionInfo(const wxString& _name) { + name = _name.c_str(); memset(&shdr, 0, sizeof(Elf64_Shdr)); section_num = sections_list.Add(this); @@ -72,7 +73,7 @@ SectionInfo::SectionInfo(const wxString& _name) : name(_name) shdr.sh_offset = section_offs; shdr.sh_name = section_name_offs; - section_name_offs += name.GetCount() + 1; + section_name_offs += name.length() + 1; } void SectionInfo::SetDataSize(u32 size, u32 align) @@ -107,11 +108,11 @@ SectionInfo::~SectionInfo() for(u32 i=section_num + 1; i= 0) return m_text_addr + m_branches[i].m_pos * 4; return m_branches[i].m_addr; @@ -664,7 +667,7 @@ CompilePPUProgram::Branch& CompilePPUProgram::GetBranch(const wxString& name) { for(u32 i=0; i code; u32 section_num; @@ -62,25 +62,25 @@ class CompilePPUProgram { struct Branch { - ArrayString m_name; + std::string m_name; s32 m_pos; s32 m_id; s32 m_addr; Branch(const wxString& name, s32 pos) - : m_name(name) - , m_pos(pos) + : m_pos(pos) , m_id(-1) , m_addr(-1) { + m_name = name.c_str(); } Branch(const wxString& name, u32 id, u32 addr) - : m_name(name) - , m_pos(-1) + : m_pos(-1) , m_id(id) , m_addr(addr) { + m_name = name.c_str(); } }; @@ -101,13 +101,13 @@ class CompilePPUProgram struct SpData { - ArrayString m_data; + std::string m_data; u32 m_addr; SpData(const wxString& data, u32 addr) - : m_data(data) - , m_addr(addr) + : m_addr(addr) { + m_data = data.c_str(); } }; diff --git a/rpcs3/Emu/FS/VFS.cpp b/rpcs3/Emu/FS/VFS.cpp index a58f64c72f..24141c5ff4 100644 --- a/rpcs3/Emu/FS/VFS.cpp +++ b/rpcs3/Emu/FS/VFS.cpp @@ -139,17 +139,17 @@ void VFS::Init(const wxString& path) break; case vfsDevice_HDD: - dev = new vfsHDD(entries[i].device_path.GetPtr()); + dev = new vfsHDD(entries[i].device_path); break; default: continue; } - wxString mpath = entries[i].path.GetPtr(); + wxString mpath = entries[i].path; mpath.Replace("$(EmulatorDir)", wxGetCwd()); mpath.Replace("$(GameDir)", vfsDevice::GetRoot(path)); - Mount(entries[i].mount.GetPtr(), mpath, dev); + Mount(entries[i].mount, mpath, dev); } } @@ -222,16 +222,16 @@ void VFS::SaveLoadDevices(Array& res, bool is_load) if(is_load) { new (res + i) VFSManagerEntry(); - res[i].path = entry_path.LoadValue(wxEmptyString); - res[i].device_path = entry_device_path.LoadValue(wxEmptyString); - res[i].mount = entry_mount.LoadValue(wxEmptyString); + res[i].path = strdup(entry_path.LoadValue(wxEmptyString).c_str()); + res[i].device_path = strdup(entry_device_path.LoadValue(wxEmptyString).c_str()); + res[i].mount = strdup(entry_mount.LoadValue(wxEmptyString).c_str()); res[i].device = (vfsDeviceType)entry_device.LoadValue(vfsDevice_LocalFile); } else { - entry_path.SaveValue(res[i].path.GetPtr()); - entry_device_path.SaveValue(res[i].device_path.GetPtr()); - entry_mount.SaveValue(res[i].mount.GetPtr()); + entry_path.SaveValue(res[i].path); + entry_device_path.SaveValue(res[i].device_path); + entry_mount.SaveValue(res[i].mount); entry_device.SaveValue(res[i].device); } } diff --git a/rpcs3/Emu/FS/VFS.h b/rpcs3/Emu/FS/VFS.h index 49f7798a22..d46182fc51 100644 --- a/rpcs3/Emu/FS/VFS.h +++ b/rpcs3/Emu/FS/VFS.h @@ -15,9 +15,9 @@ static const char* vfsDeviceTypeNames[] = struct VFSManagerEntry { - ArrayString device_path; - ArrayString path; - ArrayString mount; + char* device_path; + char* path; + char* mount; vfsDeviceType device; VFSManagerEntry() : device(vfsDevice_LocalFile) diff --git a/rpcs3/Emu/GS/GL/GLFragmentProgram.cpp b/rpcs3/Emu/GS/GL/GLFragmentProgram.cpp index 79c814edd4..d6585cb1b7 100644 --- a/rpcs3/Emu/GS/GL/GLFragmentProgram.cpp +++ b/rpcs3/Emu/GS/GL/GLFragmentProgram.cpp @@ -1,18 +1,18 @@ #include "stdafx.h" #include "GLFragmentProgram.h" -void GLFragmentDecompilerThread::AddCode(wxString code, bool append_mask) +void GLFragmentDecompilerThread::AddCode(std::string code, bool append_mask) { if(!src0.exec_if_eq && !src0.exec_if_gr && !src0.exec_if_lt) return; - const wxString mask = GetMask(); - wxString cond = wxEmptyString; + const std::string mask = GetMask().c_str(); + std::string cond = ""; if(!src0.exec_if_gr || !src0.exec_if_lt || !src0.exec_if_eq) { static const char f[4] = {'x', 'y', 'z', 'w'}; - wxString swizzle = wxEmptyString; + std::string swizzle = ""; swizzle += f[src0.cond_swizzle_x]; swizzle += f[src0.cond_swizzle_y]; swizzle += f[src0.cond_swizzle_z]; @@ -43,7 +43,7 @@ void GLFragmentDecompilerThread::AddCode(wxString code, bool append_mask) cond = "equal"; } - cond = wxString::Format("if(all(%s(%s.%s, vec4(0, 0, 0, 0)))) ", cond.mb_str(), AddCond(dst.no_dest).mb_str(), swizzle.mb_str()); + cond = std::string("if(all(" + cond + "(" + AddCond(dst.no_dest) + "." + swizzle +", vec4(0, 0, 0, 0)))) "); //ConLog.Error("cond! [eq: %d gr: %d lt: %d] (%s)", src0.exec_if_eq, src0.exec_if_gr, src0.exec_if_lt, cond); //Emu.Pause(); //return; @@ -72,16 +72,16 @@ void GLFragmentDecompilerThread::AddCode(wxString code, bool append_mask) code = "clamp(" + code + ", 0.0, 1.0)"; } - code = cond + (dst.set_cond ? m_parr.AddParam(PARAM_NONE , "vec4", wxString::Format(dst.fp16 ? "hc%d" : "rc%d", src0.cond_reg_index)) + code = cond + (dst.set_cond ? m_parr.AddParam(PARAM_NONE , "vec4", std::string(dst.fp16 ? "hc" : "rc") + std::to_string(src0.cond_reg_index)) : AddReg(dst.dest_reg, dst.fp16)) + mask - + " = " + code + (append_mask ? mask : wxString(wxEmptyString)); + + " = " + code + (append_mask ? mask : ""); main += "\t" + code + ";\n"; } -wxString GLFragmentDecompilerThread::GetMask() +std::string GLFragmentDecompilerThread::GetMask() { - wxString ret = wxEmptyString; + std::string ret = ""; static const char dst_mask[4] = { @@ -93,10 +93,10 @@ wxString GLFragmentDecompilerThread::GetMask() if(dst.mask_z) ret += dst_mask[2]; if(dst.mask_w) ret += dst_mask[3]; - return ret.IsEmpty() || strncmp(ret, dst_mask, 4) == 0 ? wxString(wxEmptyString) : ("." + ret); + return ret.empty() || strncmp(ret.c_str(), dst_mask, 4) == 0 ? "" : ("." + ret); } -wxString GLFragmentDecompilerThread::AddReg(u32 index, int fp16) +std::string GLFragmentDecompilerThread::AddReg(u32 index, int fp16) { /* if(HasReg(index, fp16)) @@ -108,21 +108,21 @@ wxString GLFragmentDecompilerThread::AddReg(u32 index, int fp16) //ConLog.Warning("%c%d: %d %d", (fp16 ? 'h' : 'r'), index, dst.tex_num, src2.use_index_reg); return m_parr.AddParam((index >= 2 && index <= 4) ? PARAM_OUT : PARAM_NONE, "vec4", - wxString::Format((fp16 ? "h%u" : "r%u"), index), (fp16 || !index) ? -1 : ((index >= 2 && index <= 4) ? (index - 1) : -1)); + std::string(fp16 ? "h" : "r") + std::to_string(index), (fp16 || !index) ? -1 : ((index >= 2 && index <= 4) ? (index - 1) : -1)); } bool GLFragmentDecompilerThread::HasReg(u32 index, int fp16) { return m_parr.HasParam((index >= 2 && index <= 4) ? PARAM_OUT : PARAM_NONE, "vec4", - wxString::Format((fp16 ? "h%u" : "r%u"), index)); + std::string(fp16 ? "h" : "r") + std::to_string(index)); } -wxString GLFragmentDecompilerThread::AddCond(int fp16) +std::string GLFragmentDecompilerThread::AddCond(int fp16) { - return m_parr.AddParam(PARAM_NONE , "vec4", wxString::Format(fp16 ? "hc%d" : "rc%d", src0.cond_mod_reg_index)); + return m_parr.AddParam(PARAM_NONE , "vec4", std::string(fp16 ? "hc" : "rc") + std::to_string(src0.cond_mod_reg_index)); } -wxString GLFragmentDecompilerThread::AddConst() +std::string GLFragmentDecompilerThread::AddConst() { mem32_ptr_t data(m_addr + m_size + m_offset); @@ -131,18 +131,19 @@ wxString GLFragmentDecompilerThread::AddConst() u32 y = GetData(data[1]); u32 z = GetData(data[2]); u32 w = GetData(data[3]); - return m_parr.AddParam(PARAM_UNIFORM, "vec4", wxString::Format("fc%u", m_size + 4 * 4), - wxString::Format("vec4(%f, %f, %f, %f)", (float&)x, (float&)y, (float&)z, (float&)w)); + return m_parr.AddParam(PARAM_UNIFORM, "vec4", std::string("fc") + std::to_string(m_size + 4 * 4), + std::string("vec4(") + std::to_string((float&)x) + ", " + std::to_string((float&)y) + + ", " + std::to_string((float&)z) + ", " + std::to_string((float&)w) + ")"); } -wxString GLFragmentDecompilerThread::AddTex() +std::string GLFragmentDecompilerThread::AddTex() { - return m_parr.AddParam(PARAM_UNIFORM, "sampler2D", wxString::Format("tex%d", dst.tex_num)); + return m_parr.AddParam(PARAM_UNIFORM, "sampler2D", std::string("tex") + std::to_string(dst.tex_num)); } -template wxString GLFragmentDecompilerThread::GetSRC(T src) +template std::string GLFragmentDecompilerThread::GetSRC(T src) { - wxString ret = wxEmptyString; + std::string ret = ""; switch(src.reg_type) { @@ -152,7 +153,7 @@ template wxString GLFragmentDecompilerThread::GetSRC(T src) case 1: //input { - static const wxString reg_table[] = + static const std::string reg_table[] = { "gl_Position", "col0", "col1", @@ -164,7 +165,7 @@ template wxString GLFragmentDecompilerThread::GetSRC(T src) { case 0x00: ret += reg_table[0]; break; default: - if(dst.src_attr_reg_num < WXSIZEOF(reg_table)) + if(dst.src_attr_reg_num < sizeof(reg_table)/sizeof(reg_table[0])) { ret += m_parr.AddParam(PARAM_IN, "vec4", reg_table[dst.src_attr_reg_num]); } @@ -191,13 +192,13 @@ template wxString GLFragmentDecompilerThread::GetSRC(T src) static const char f[4] = {'x', 'y', 'z', 'w'}; - wxString swizzle = wxEmptyString; + std::string swizzle = ""; swizzle += f[src.swizzle_x]; swizzle += f[src.swizzle_y]; swizzle += f[src.swizzle_z]; swizzle += f[src.swizzle_w]; - if(strncmp(swizzle, f, 4) != 0) ret += "." + swizzle; + if(strncmp(swizzle.c_str(), f, 4) != 0) ret += "." + swizzle; if(src.abs) ret = "abs(" + ret + ")"; if(src.neg) ret = "-" + ret; @@ -205,26 +206,23 @@ template wxString GLFragmentDecompilerThread::GetSRC(T src) return ret; } -wxString GLFragmentDecompilerThread::BuildCode() +std::string GLFragmentDecompilerThread::BuildCode() { //main += wxString::Format("\tgl_FragColor = %c0;\n", m_ctrl & 0x40 ? 'r' : 'h'); main += "\t" + m_parr.AddParam(PARAM_OUT, "vec4", "ocol", 0) + " = " + (m_ctrl & 0x40 ? "r0" : "h0") + ";\n"; if(m_ctrl & 0xe) main += "\tgl_FragDepth = r1.z;\n"; - wxString p = wxEmptyString; + std::string p = ""; for(u32 i=0; i wxString GetSRC(T src); - wxString BuildCode(); + template std::string GetSRC(T src); + std::string BuildCode(); virtual void Task(); @@ -147,7 +147,7 @@ struct GLShaderProgram GLParamArray parr; - wxString shader; + std::string shader; u32 id; diff --git a/rpcs3/Emu/GS/GL/GLProgramBuffer.cpp b/rpcs3/Emu/GS/GL/GLProgramBuffer.cpp index 0212c7e488..c745cf4fd2 100644 --- a/rpcs3/Emu/GS/GL/GLProgramBuffer.cpp +++ b/rpcs3/Emu/GS/GL/GLProgramBuffer.cpp @@ -8,7 +8,7 @@ int GLProgramBuffer::SearchFp(const RSXShaderProgram& rsx_fp, GLShaderProgram& g if(memcmp(&m_buf[i].fp_data[0], &Memory[rsx_fp.addr], m_buf[i].fp_data.GetCount()) != 0) continue; gl_fp.id = m_buf[i].fp_id; - gl_fp.shader = m_buf[i].fp_shader.GetPtr(); + gl_fp.shader = m_buf[i].fp_shader.c_str(); return i; } @@ -24,7 +24,7 @@ int GLProgramBuffer::SearchVp(const RSXVertexProgram& rsx_vp, GLVertexProgram& g if(memcmp(m_buf[i].vp_data.GetPtr(), rsx_vp.data.GetPtr(), rsx_vp.data.GetCount() * 4) != 0) continue; gl_vp.id = m_buf[i].vp_id; - gl_vp.shader = m_buf[i].vp_shader.GetPtr(); + gl_vp.shader = m_buf[i].vp_shader.c_str(); return i; } @@ -93,8 +93,8 @@ void GLProgramBuffer::Add(GLProgram& prog, GLShaderProgram& gl_fp, RSXShaderProg ConLog.Write("*** vp data size = %d", rsx_vp.data.GetCount() * 4); ConLog.Write("*** fp data size = %d", rsx_fp.size); - ConLog.Write("*** vp shader = \n%s", gl_vp.shader.mb_str()); - ConLog.Write("*** fp shader = \n%s", gl_fp.shader.mb_str()); + ConLog.Write("*** vp shader = \n%s", gl_vp.shader.c_str()); + ConLog.Write("*** fp shader = \n%s", gl_fp.shader.c_str()); new_buf.prog_id = prog.id; new_buf.vp_id = gl_vp.id; @@ -120,8 +120,8 @@ void GLProgramBuffer::Clear() m_buf[i].fp_data.Clear(); m_buf[i].vp_data.Clear(); - m_buf[i].vp_shader.Clear(); - m_buf[i].fp_shader.Clear(); + m_buf[i].vp_shader.clear(); + m_buf[i].fp_shader.clear(); } m_buf.Clear(); diff --git a/rpcs3/Emu/GS/GL/GLProgramBuffer.h b/rpcs3/Emu/GS/GL/GLProgramBuffer.h index 3c2c106406..5156dda59d 100644 --- a/rpcs3/Emu/GS/GL/GLProgramBuffer.h +++ b/rpcs3/Emu/GS/GL/GLProgramBuffer.h @@ -8,8 +8,8 @@ struct GLBufferInfo u32 vp_id; Array fp_data; Array vp_data; - ArrayString fp_shader; - ArrayString vp_shader; + std::string fp_shader; + std::string vp_shader; }; struct GLProgramBuffer diff --git a/rpcs3/Emu/GS/GL/GLShaderParam.h b/rpcs3/Emu/GS/GL/GLShaderParam.h index fe1991cede..26e0e34705 100644 --- a/rpcs3/Emu/GS/GL/GLShaderParam.h +++ b/rpcs3/Emu/GS/GL/GLShaderParam.h @@ -12,54 +12,53 @@ enum GLParamFlag struct GLParamItem { - ArrayString name; - ArrayString location; - ArrayString value; + std::string name; + std::string location; + std::string value; - GLParamItem(const wxString& _name, int _location, const wxString& _value = wxEmptyString) + GLParamItem(const std::string& _name, int _location, const std::string& _value = "") : name(_name) - , location(_location > -1 ? wxString::Format("layout (location = %d) ", _location) : "") , value(_value) { + if (_location > -1) + location = "layout (location = " + std::to_string(_location) + ") "; + else + location = ""; } }; struct GLParamType { const GLParamFlag flag; - ArrayString type; + std::string type; Array items; - GLParamType(const GLParamFlag _flag, const wxString& _type) - : type(_type) - , flag(_flag) + GLParamType(const GLParamFlag _flag, const std::string& _type) + : flag(_flag) + , type(_type) { } - bool SearchName(const wxString& name) + bool SearchName(const std::string& name) { for(u32 i=0; i params; - GLParamType* SearchParam(const wxString& type) + GLParamType* SearchParam(const std::string& type) { for(u32 i=0; iSearchName(name); } - wxString AddParam(const GLParamFlag flag, wxString type, const wxString& name, const wxString& value) + std::string AddParam(const GLParamFlag flag, std::string type, const std::string& name, const std::string& value) { type = GetParamFlag(flag) + type; GLParamType* t = SearchParam(type); @@ -121,7 +121,7 @@ struct GLParamArray return name; } - wxString AddParam(const GLParamFlag flag, wxString type, const wxString& name, int location = -1) + std::string AddParam(const GLParamFlag flag, std::string type, const std::string& name, int location = -1) { type = GetParamFlag(flag) + type; GLParamType* t = SearchParam(type); diff --git a/rpcs3/Emu/GS/GL/GLVertexProgram.cpp b/rpcs3/Emu/GS/GL/GLVertexProgram.cpp index 591482ff3d..6dca47ffe7 100644 --- a/rpcs3/Emu/GS/GL/GLVertexProgram.cpp +++ b/rpcs3/Emu/GS/GL/GLVertexProgram.cpp @@ -35,7 +35,7 @@ wxString GLVertexDecompilerThread::GetScaMask() wxString GLVertexDecompilerThread::GetDST(bool isSca) { - static const wxString reg_table[] = + static const std::string reg_table[] = { "gl_Position", "col0", "col1", @@ -54,7 +54,7 @@ wxString GLVertexDecompilerThread::GetDST(bool isSca) break; case 0x1f: - ret += m_parr.AddParam(PARAM_NONE, "vec4", wxString::Format("tmp%u", isSca ? d3.sca_dst_tmp : d0.dst_tmp)); + ret += m_parr.AddParam(PARAM_NONE, "vec4", std::string("tmp") + std::to_string(isSca ? d3.sca_dst_tmp : d0.dst_tmp)); break; default: @@ -75,7 +75,7 @@ wxString GLVertexDecompilerThread::GetDST(bool isSca) wxString GLVertexDecompilerThread::GetSRC(const u32 n, bool isSca) { - static const wxString reg_table[] = + static const std::string reg_table[] = { "in_pos", "in_weight", "in_normal", "in_col0", "in_col1", @@ -90,7 +90,7 @@ wxString GLVertexDecompilerThread::GetSRC(const u32 n, bool isSca) switch(src[n].reg_type) { case 1: //temp - ret += m_parr.AddParam(PARAM_NONE, "vec4", wxString::Format("tmp%u", src[n].tmp_src)); + ret += m_parr.AddParam(PARAM_NONE, "vec4", std::string("tmp") + std::to_string(src[n].tmp_src)); break; case 2: //input if(d1.input_src < WXSIZEOF(reg_table)) @@ -104,7 +104,7 @@ wxString GLVertexDecompilerThread::GetSRC(const u32 n, bool isSca) } break; case 3: //const - ret += m_parr.AddParam(PARAM_UNIFORM, "vec4", wxString::Format("vc%u", d1.const_src)); + ret += m_parr.AddParam(PARAM_UNIFORM, "vec4", std::string("vc") + std::to_string(d1.const_src)); break; default: diff --git a/rpcs3/Emu/Memory/Memory.cpp b/rpcs3/Emu/Memory/Memory.cpp index 0c5f547c33..8eb88cb3f5 100644 --- a/rpcs3/Emu/Memory/Memory.cpp +++ b/rpcs3/Emu/Memory/Memory.cpp @@ -329,35 +329,35 @@ bool MemoryBlockLE::Write128(const u64 addr, const u128 value) } //NullMemoryBlock -bool NullMemoryBlock::Read8(const u64 addr, u8* WXUNUSED(value)) +bool NullMemoryBlock::Read8(const u64 addr, u8* ) { ConLog.Error("Read8 from null block: [%08llx]", addr); Emu.Pause(); return false; } -bool NullMemoryBlock::Read16(const u64 addr, u16* WXUNUSED(value)) +bool NullMemoryBlock::Read16(const u64 addr, u16* ) { ConLog.Error("Read16 from null block: [%08llx]", addr); Emu.Pause(); return false; } -bool NullMemoryBlock::Read32(const u64 addr, u32* WXUNUSED(value)) +bool NullMemoryBlock::Read32(const u64 addr, u32* ) { ConLog.Error("Read32 from null block: [%08llx]", addr); Emu.Pause(); return false; } -bool NullMemoryBlock::Read64(const u64 addr, u64* WXUNUSED(value)) +bool NullMemoryBlock::Read64(const u64 addr, u64* ) { ConLog.Error("Read64 from null block: [%08llx]", addr); Emu.Pause(); return false; } -bool NullMemoryBlock::Read128(const u64 addr, u128* WXUNUSED(value)) +bool NullMemoryBlock::Read128(const u64 addr, u128* ) { ConLog.Error("Read128 from null block: [%08llx]", addr); Emu.Pause(); diff --git a/rpcs3/Emu/SysCalls/lv2/SC_PPU_Thread.cpp b/rpcs3/Emu/SysCalls/lv2/SC_PPU_Thread.cpp index 078d78fefa..0c80602a76 100644 --- a/rpcs3/Emu/SysCalls/lv2/SC_PPU_Thread.cpp +++ b/rpcs3/Emu/SysCalls/lv2/SC_PPU_Thread.cpp @@ -147,7 +147,7 @@ int sys_ppu_thread_create(u32 thread_id_addr, u32 entry, u32 arg, int prio, u32 new_thread.SetPrio(prio); new_thread.SetStackSize(stacksize); //new_thread.flags = flags; - new_thread.SetName(Memory.ReadString(threadname_addr)); + new_thread.SetName(Memory.ReadString(threadname_addr).mb_str()); new_thread.Run(); new_thread.Exec(); diff --git a/rpcs3/Emu/SysCalls/lv2/SC_SPU_Thread.cpp b/rpcs3/Emu/SysCalls/lv2/SC_SPU_Thread.cpp index 9d9a209317..b888915c28 100644 --- a/rpcs3/Emu/SysCalls/lv2/SC_SPU_Thread.cpp +++ b/rpcs3/Emu/SysCalls/lv2/SC_SPU_Thread.cpp @@ -35,18 +35,18 @@ u32 LoadSpuImage(vfsStream& stream) //156 int sys_spu_image_open(mem_ptr_t img, u32 path_addr) { - const wxString& path = Memory.ReadString(path_addr); - sc_spu.Warning("sys_spu_image_open(img_addr=0x%x, path_addr=0x%x [%s])", img.GetAddr(), path_addr, path.mb_str()); + const std::string& path = Memory.ReadString(path_addr).mb_str(); + sc_spu.Warning("sys_spu_image_open(img_addr=0x%x, path_addr=0x%x [%s])", img.GetAddr(), path_addr, path); if(!img.IsGood() || !Memory.IsGoodAddr(path_addr)) { return CELL_EFAULT; } - vfsFile f(path); + vfsFile f(path.c_str()); if(!f.IsOpened()) { - sc_spu.Error("sys_spu_image_open error: '%s' not found!", path.mb_str()); + sc_spu.Error("sys_spu_image_open error: '%s' not found!", path); return CELL_ENOENT; } @@ -94,7 +94,7 @@ int sys_spu_thread_initialize(mem32_t thread, u32 group, u32 spu_num, mem_ptr_t< } u32 entry = img->entry_point; - wxString name = Memory.ReadString(attr->name_addr, attr->name_len); + std::string name = Memory.ReadString(attr->name_addr, attr->name_len).mb_str(); u64 a1 = arg->arg1; u64 a2 = arg->arg2; u64 a3 = arg->arg3; @@ -102,7 +102,7 @@ int sys_spu_thread_initialize(mem32_t thread, u32 group, u32 spu_num, mem_ptr_t< ConLog.Write("New SPU Thread:"); ConLog.Write("entry = 0x%x", entry); - ConLog.Write("name = %s", name.mb_str()); + ConLog.Write("name = %s", name); ConLog.Write("a1 = 0x%x", a1); ConLog.Write("a2 = 0x%x", a2); ConLog.Write("a3 = 0x%x", a3); @@ -190,10 +190,10 @@ int sys_spu_thread_group_create(mem32_t id, u32 num, int prio, mem_ptr_ttype.ToLE()); ConLog.Write("*** attr.option.ct=%d", attr->option.ct.ToLE()); - const wxString& name = Memory.ReadString(attr->name_addr, attr->name_len); - ConLog.Write("*** name='%s'", name.mb_str()); + const std::string& name = Memory.ReadString(attr->name_addr, attr->name_len).mb_str(); + ConLog.Write("*** name='%s'", name); - id = Emu.GetIdManager().GetNewID(wxString::Format("sys_spu_thread_group '%s'", name.mb_str()), new SpuGroupInfo(*attr)); + id = Emu.GetIdManager().GetNewID(wxString::Format("sys_spu_thread_group '%s'", name), new SpuGroupInfo(*attr)); return CELL_OK; } diff --git a/rpcs3/Emu/System.cpp b/rpcs3/Emu/System.cpp index 9408842dc0..d81b93dcae 100644 --- a/rpcs3/Emu/System.cpp +++ b/rpcs3/Emu/System.cpp @@ -6,9 +6,11 @@ #include "Emu/Cell/PPUThread.h" #include "Emu/Cell/SPUThread.h" #include "Emu/Cell/PPUInstrTable.h" +#include +#include using namespace PPU_instr; -static const wxString& BreakPointsDBName = "BreakPoints.dat"; +static const std::string& BreakPointsDBName = "BreakPoints.dat"; static const u16 bpdb_version = 0x1000; ModuleInitializer::ModuleInitializer() @@ -234,7 +236,9 @@ void Emulator::Load() wxCriticalSectionLocker lock(m_cs_status); m_status = Ready; +#ifndef QT_UI wxGetApp().SendDbgCommand(DID_READY_EMU); +#endif } void Emulator::Run() @@ -251,8 +255,9 @@ void Emulator::Run() Resume(); return; } - +#ifndef QT_UI wxGetApp().SendDbgCommand(DID_START_EMU); +#endif wxCriticalSectionLocker lock(m_cs_status); //ConLog.Write("run..."); @@ -265,32 +270,42 @@ void Emulator::Run() //m_memory_viewer->ShowPC(); GetCPU().Exec(); +#ifndef QT_UI wxGetApp().SendDbgCommand(DID_STARTED_EMU); +#endif } void Emulator::Pause() { if(!IsRunning()) return; //ConLog.Write("pause..."); +#ifndef QT_UI wxGetApp().SendDbgCommand(DID_PAUSE_EMU); +#endif wxCriticalSectionLocker lock(m_cs_status); m_status = Paused; +#ifndef QT_UI wxGetApp().SendDbgCommand(DID_PAUSED_EMU); +#endif } void Emulator::Resume() { if(!IsPaused()) return; //ConLog.Write("resume..."); +#ifndef QT_UI wxGetApp().SendDbgCommand(DID_RESUME_EMU); +#endif wxCriticalSectionLocker lock(m_cs_status); m_status = Running; CheckStatus(); if(IsRunning() && Ini.CPUDecoderMode.GetValue() != 1) GetCPU().Exec(); +#ifndef QT_UI wxGetApp().SendDbgCommand(DID_RESUMED_EMU); +#endif } void Emulator::Stop() @@ -298,7 +313,9 @@ void Emulator::Stop() if(IsStopped()) return; //ConLog.Write("shutdown..."); +#ifndef QT_UI wxGetApp().SendDbgCommand(DID_STOP_EMU); +#endif { wxCriticalSectionLocker lock(m_cs_status); m_status = Stopped; @@ -326,60 +343,63 @@ void Emulator::Stop() Memory.Close(); //if(m_memory_viewer && m_memory_viewer->IsShown()) m_memory_viewer->Hide(); +#ifndef QT_UI wxGetApp().SendDbgCommand(DID_STOPPED_EMU); +#endif } -void Emulator::SavePoints(const wxString& path) +void Emulator::SavePoints(const std::string& path) { - wxFile f(path, wxFile::write); + std::ofstream f(path, std::ios::binary | std::ios::trunc); u32 break_count = m_break_points.GetCount(); u32 marked_count = m_marked_points.GetCount(); - f.Write(&bpdb_version, sizeof(u16)); - f.Write(&break_count, sizeof(u32)); - f.Write(&marked_count, sizeof(u32)); - + f << bpdb_version << break_count << marked_count; + if(break_count) { - f.Write(&m_break_points[0], sizeof(u64) * break_count); + f.write(reinterpret_cast(&m_break_points[0]), sizeof(u64) * break_count); } if(marked_count) { - f.Write(&m_marked_points[0], sizeof(u64) * marked_count); + f.write(reinterpret_cast(&m_marked_points[0]), sizeof(u64) * marked_count); } } -void Emulator::LoadPoints(const wxString& path) +void Emulator::LoadPoints(const std::string& path) { - if(!wxFileExists(path)) return; - - wxFile f(path); - + struct stat buf; + if (!stat(path.c_str(), &buf)) + return; + std::ifstream f(path, std::ios::binary); + if (!f.is_open()) + return; + f.seekg(0, std::ios::end); + int length = f.tellg(); + f.seekg(0, std::ios::beg); u32 break_count, marked_count; u16 version; - f.Read(&version, sizeof(u16)); - f.Read(&break_count, sizeof(u32)); - f.Read(&marked_count, sizeof(u32)); + f >> version >> break_count >> marked_count; if(version != bpdb_version || - (sizeof(u16) + break_count * sizeof(u64) + sizeof(u32) + marked_count * sizeof(u64) + sizeof(u32)) != f.Length()) + (sizeof(u16) + break_count * sizeof(u64) + sizeof(u32) + marked_count * sizeof(u64) + sizeof(u32)) != length) { - ConLog.Error("'%s' is broken", path.mb_str()); + ConLog.Error("'%s' is broken", path.c_str()); return; } if(break_count > 0) { m_break_points.SetCount(break_count); - f.Read(&m_break_points[0], sizeof(u64) * break_count); + f.read(reinterpret_cast(&m_break_points[0]), sizeof(u64) * break_count); } if(marked_count > 0) { m_marked_points.SetCount(marked_count); - f.Read(&m_marked_points[0], sizeof(u64) * marked_count); + f.read(reinterpret_cast(&m_marked_points[0]), sizeof(u64) * marked_count); } } diff --git a/rpcs3/Emu/System.h b/rpcs3/Emu/System.h index bed7c5c332..5090e2e2f5 100644 --- a/rpcs3/Emu/System.h +++ b/rpcs3/Emu/System.h @@ -150,8 +150,8 @@ public: void Resume(); void Stop(); - void SavePoints(const wxString& path); - void LoadPoints(const wxString& path); + void SavePoints(const std::string& path); + void LoadPoints(const std::string& path); __forceinline bool IsRunning() const { wxCriticalSectionLocker lock(m_cs_status); return m_status == Running; } __forceinline bool IsPaused() const { wxCriticalSectionLocker lock(m_cs_status); return m_status == Paused; } diff --git a/rpcs3/Gui/ConLog.cpp b/rpcs3/Gui/ConLog.cpp index b36fd383d8..c505691d17 100644 --- a/rpcs3/Gui/ConLog.cpp +++ b/rpcs3/Gui/ConLog.cpp @@ -9,18 +9,18 @@ LogWriter ConLog; LogFrame* ConLogFrame; -wxCriticalSection g_cs_conlog; +std::mutex g_cs_conlog; static const uint max_item_count = 500; static const uint buffer_size = 1024 * 64; struct LogPacket { - wxString m_prefix; - wxString m_text; - wxString m_colour; + std::string m_prefix; + std::string m_text; + std::string m_colour; - LogPacket(const wxString& prefix, const wxString& text, const wxString& colour) + LogPacket(const std::string& prefix, const std::string& text, const std::string& colour) : m_prefix(prefix) , m_text(text) , m_colour(colour) @@ -41,9 +41,9 @@ struct _LogBuffer : public MTPacketBuffer void _push(const LogPacket& data) { - const u32 sprefix = data.m_prefix.Len(); - const u32 stext = data.m_text.Len(); - const u32 scolour = data.m_colour.Len(); + const u32 sprefix = data.m_prefix.length(); + const u32 stext = data.m_text.length(); + const u32 scolour = data.m_colour.length(); m_buffer.Reserve( sizeof(u32) + sprefix + @@ -79,17 +79,20 @@ struct _LogBuffer : public MTPacketBuffer const u32& sprefix = *(u32*)&m_buffer[c_get]; c_get += sizeof(u32); - if(sprefix) memcpy(wxStringBuffer(ret.m_prefix, sprefix), &m_buffer[c_get], sprefix); + ret.m_prefix.resize(sprefix); + if(sprefix) memcpy((void*)ret.m_prefix.c_str(), &m_buffer[c_get], sprefix); c_get += sprefix; const u32& stext = *(u32*)&m_buffer[c_get]; c_get += sizeof(u32); - if(stext) memcpy(wxStringBuffer(ret.m_text, stext), &m_buffer[c_get], stext); + ret.m_text.resize(stext); + if(stext) memcpy((void*)ret.m_text.c_str(), &m_buffer[c_get], stext); c_get += stext; const u32& scolour = *(u32*)&m_buffer[c_get]; c_get += sizeof(u32); - if(scolour) memcpy(wxStringBuffer(ret.m_colour, scolour), &m_buffer[c_get], scolour); + ret.m_colour.resize(scolour); + if(scolour) memcpy((void*)ret.m_colour.c_str(), &m_buffer[c_get], scolour); c_get += scolour; m_get = c_get; @@ -103,25 +106,32 @@ LogWriter::LogWriter() { if(!m_logfile.Open(_PRGNAME_ ".log", wxFile::write)) { - wxMessageBox("Cann't create log file! (" _PRGNAME_ ".log)", wxMessageBoxCaptionStr, wxICON_ERROR); +#ifndef QT_UI + wxMessageBox("Can't create log file! (" _PRGNAME_ ".log)", wxMessageBoxCaptionStr, wxICON_ERROR); +#endif } } -void LogWriter::WriteToLog(wxString prefix, wxString value, wxString colour/*, wxColour bgcolour*/) +void LogWriter::WriteToLog(std::string prefix, std::string value, std::string colour/*, wxColour bgcolour*/) { if(ThreadBase* thr = GetCurrentNamedThread()) { - prefix = (prefix.IsEmpty() ? "" : prefix + " : ") + thr->GetThreadName(); + prefix = (prefix.empty() ? "" : prefix + " : ") + thr->GetThreadName(); } if(m_logfile.IsOpened()) - m_logfile.Write((prefix.IsEmpty() ? wxString(wxEmptyString) : "[" + prefix + "]: ") + value + "\n"); + m_logfile.Write((prefix.empty() ? wxString(wxEmptyString) : std::string("[" + prefix + "]: ") + value + "\n").c_str()); if(!ConLogFrame) return; - wxCriticalSectionLocker lock(g_cs_conlog); + std::lock_guard lock(g_cs_conlog); +#ifdef QT_UI + // TODO: Use ThreadBase instead, track main thread id + if(QThread::currentThread() == qApp->thread()) +#else if(wxThread::IsMain()) +#endif { while(LogBuffer.IsBusy()) wxYieldIfNeeded(); } @@ -161,7 +171,7 @@ void LogWriter::Write(const wxString fmt, ...) va_end(list); - WriteToLog("!", frmt, "White"); + WriteToLog("!", frmt.mb_str(), "White"); } void LogWriter::Error(const wxString fmt, ...) @@ -173,7 +183,7 @@ void LogWriter::Error(const wxString fmt, ...) va_end(list); - WriteToLog("E", frmt, "Red"); + WriteToLog("E", frmt.mb_str(), "Red"); } void LogWriter::Warning(const wxString fmt, ...) @@ -185,12 +195,12 @@ void LogWriter::Warning(const wxString fmt, ...) va_end(list); - WriteToLog("W", frmt, "Yellow"); + WriteToLog("W", frmt.mb_str(), "Yellow"); } void LogWriter::SkipLn() { - WriteToLog(wxEmptyString, wxEmptyString, "Black"); + WriteToLog("", "", "Black"); } BEGIN_EVENT_TABLE(LogFrame, wxPanel) @@ -210,7 +220,7 @@ LogFrame::LogFrame(wxWindow* parent) s_main.Add(&m_log, 1, wxEXPAND); SetSizer(&s_main); Layout(); - + Show(); ThreadBase::Start(); } @@ -250,9 +260,9 @@ void LogFrame::Task() const int cur_item = m_log.GetItemCount(); - m_log.InsertItem(cur_item, item.m_prefix); - m_log.SetItem(cur_item, 1, item.m_text); - m_log.SetItemTextColour(cur_item, item.m_colour); + m_log.InsertItem(cur_item, item.m_prefix.c_str()); + m_log.SetItem(cur_item, 1, item.m_text.c_str()); + m_log.SetItemTextColour(cur_item, item.m_colour.c_str()); m_log.SetColumnWidth(0, -1); m_log.SetColumnWidth(1, -1); diff --git a/rpcs3/Gui/ConLog.h b/rpcs3/Gui/ConLog.h index 6d724ec485..65ddda6531 100644 --- a/rpcs3/Gui/ConLog.h +++ b/rpcs3/Gui/ConLog.h @@ -8,10 +8,10 @@ class LogWriter wxFile m_logfile; wxColour m_txtcolour; - wxString m_prefix; - wxString m_value; + std::string m_prefix; + std::string m_value; - virtual void WriteToLog(wxString prefix, wxString value, wxString colour); + virtual void WriteToLog(std::string prefix, std::string value, std::string colour); public: LogWriter(); @@ -38,7 +38,7 @@ private: virtual void Task(); void OnQuit(wxCloseEvent& event); - + DECLARE_EVENT_TABLE(); }; diff --git a/rpcs3/Gui/VFSManager.cpp b/rpcs3/Gui/VFSManager.cpp index 7060821bed..44d276b398 100644 --- a/rpcs3/Gui/VFSManager.cpp +++ b/rpcs3/Gui/VFSManager.cpp @@ -53,9 +53,9 @@ VFSEntrySettingsDialog::VFSEntrySettingsDialog(wxWindow* parent, VFSManagerEntry Connect(m_btn_select_dev_path->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(VFSEntrySettingsDialog::OnSelectDevPath)); Connect(wxID_OK, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(VFSEntrySettingsDialog::OnOk)); - m_tctrl_dev_path->SetValue(m_entry.device_path.GetPtr()); - m_tctrl_path->SetValue(m_entry.path.GetPtr()); - m_tctrl_mount->SetValue(m_entry.mount.GetPtr()); + m_tctrl_dev_path->SetValue(m_entry.device_path); + m_tctrl_path->SetValue(m_entry.path); + m_tctrl_mount->SetValue(m_entry.mount); m_ch_type->SetSelection(m_entry.device); wxCommandEvent ce; @@ -95,9 +95,9 @@ void VFSEntrySettingsDialog::OnSelectDevPath(wxCommandEvent& event) void VFSEntrySettingsDialog::OnOk(wxCommandEvent& event) { - m_entry.device_path = m_tctrl_dev_path->GetValue(); - m_entry.path = m_tctrl_path->GetValue(); - m_entry.mount = m_tctrl_mount->GetValue(); + m_entry.device_path = strdup( m_tctrl_dev_path->GetValue().c_str()); + m_entry.path = strdup(m_tctrl_path->GetValue().c_str()); + m_entry.mount = strdup(m_tctrl_mount->GetValue().c_str()); m_entry.device = (vfsDeviceType)m_ch_type->GetSelection(); EndModal(wxID_OK); @@ -143,9 +143,9 @@ void VFSManagerDialog::UpdateList() m_list->DeleteAllItems(); for(uint i=0; iInsertItem(i, m_entries[i].mount.GetPtr()); - m_list->SetItem(i, 1, m_entries[i].path.GetPtr()); - m_list->SetItem(i, 2, m_entries[i].device_path.GetPtr()); + m_list->InsertItem(i, m_entries[i].mount); + m_list->SetItem(i, 1, m_entries[i].path); + m_list->SetItem(i, 2, m_entries[i].device_path); m_list->SetItem(i, 3, vfsDeviceTypeNames[m_entries[i].device]); } m_list->SetColumnWidth(0, wxLIST_AUTOSIZE_USEHEADER); diff --git a/rpcs3/git-version.h b/rpcs3/git-version.h index 55c272acc7..07a3d127dd 100644 --- a/rpcs3/git-version.h +++ b/rpcs3/git-version.h @@ -1,6 +1,6 @@ // This is a generated file. -#define RPCS3_GIT_VERSION "cd3ad0b" +#define RPCS3_GIT_VERSION "d83a9b1" // If you don't want this file to update/recompile, change to 1. #define RPCS3_GIT_VERSION_NO_UPDATE 0 diff --git a/rpcs3/stdafx.h b/rpcs3/stdafx.h index 71d44a0170..18a72ee8dc 100644 --- a/rpcs3/stdafx.h +++ b/rpcs3/stdafx.h @@ -2,6 +2,7 @@ #define NOMINMAX +#ifndef QT_UI #include #include @@ -17,6 +18,7 @@ #include #include +#endif #include