From 76237955c7653fdb02337db57fffe549fb85b6d1 Mon Sep 17 00:00:00 2001 From: Gregory Hainaut Date: Sun, 29 Jun 2014 12:42:58 +0200 Subject: [PATCH] wx3.0: fix various string printing on linux wide-char must use %ls format on linux. Don't rely on non standard %s/%S --- common/src/Utilities/Exceptions.cpp | 8 ++++---- common/src/Utilities/VirtualMemory.cpp | 6 +++--- pcsx2/gui/ConsoleLogger.cpp | 6 +++--- pcsx2/gui/FrameForGS.cpp | 2 +- pcsx2/gui/Panels/MemoryCardListView.cpp | 4 +++- pcsx2/ps2/BiosTools.cpp | 2 +- pcsx2/x86/iR3000A.cpp | 2 +- pcsx2/x86/newVif_Dynarec.cpp | 2 +- pcsx2/x86/newVif_UnpackSSE.cpp | 2 +- 9 files changed, 18 insertions(+), 16 deletions(-) diff --git a/common/src/Utilities/Exceptions.cpp b/common/src/Utilities/Exceptions.cpp index eb6d99dd97..1c622d3cfb 100644 --- a/common/src/Utilities/Exceptions.cpp +++ b/common/src/Utilities/Exceptions.cpp @@ -49,18 +49,18 @@ wxString DiagnosticOrigin::ToString( const wxChar* msg ) const { FastFormatUnicode message; - message.Write( L"%s(%d) : assertion failed:\n", srcfile, line ); + message.Write( L"%ls(%d) : assertion failed:\n", srcfile, line ); if( function != NULL ) - message.Write( " Function: %S\n", function ); + message.Write( " Function: %s\n", function ); message.Write(L" Thread: %s\n", WX_STR(Threading::pxGetCurrentThreadName()) ); if( condition != NULL ) - message.Write(L" Condition: %S\n", condition); + message.Write(L" Condition: %ls\n", condition); if( msg != NULL ) - message.Write(L" Message: %S\n", msg); + message.Write(L" Message: %ls\n", msg); return message; } diff --git a/common/src/Utilities/VirtualMemory.cpp b/common/src/Utilities/VirtualMemory.cpp index 09d4daa3be..2c20db5811 100644 --- a/common/src/Utilities/VirtualMemory.cpp +++ b/common/src/Utilities/VirtualMemory.cpp @@ -129,7 +129,7 @@ void* VirtualMemoryReserve::Reserve( size_t size, uptr base, uptr upper_bounds ) if (!m_baseptr || (upper_bounds != 0 && (((uptr)m_baseptr + reserved_bytes) > upper_bounds))) { - DevCon.Warning( L"%s: host memory @ %s -> %s is unavailable; attempting to map elsewhere...", + DevCon.Warning( L"%s: host memory @ %ls -> %ls is unavailable; attempting to map elsewhere...", WX_STR(m_name), pxsPtr(base), pxsPtr(base + size) ); SafeSysMunmap(m_baseptr, reserved_bytes); @@ -157,7 +157,7 @@ void* VirtualMemoryReserve::Reserve( size_t size, uptr base, uptr upper_bounds ) else mbkb.Write( "[%ukb]", reserved_bytes / 1024 ); - DevCon.WriteLn( Color_Gray, L"%-32s @ %s -> %s %s", WX_STR(m_name), + DevCon.WriteLn( Color_Gray, L"%-32s @ %ls -> %ls %ls", WX_STR(m_name), pxsPtr(m_baseptr), pxsPtr((uptr)m_baseptr+reserved_bytes), mbkb.c_str()); return m_baseptr; @@ -295,7 +295,7 @@ void BaseVmReserveListener::OnPageFaultEvent(const PageFaultInfo& info, bool& ha if (!m_allow_writes) { pxFailRel( pxsFmt( - L"Memory Protection Fault @ %s (%s)\n" + L"Memory Protection Fault @ %ls (%s)\n" L"Modification of this reserve has been disabled (m_allow_writes == false).", pxsPtr(info.addr), WX_STR(m_name)) ); diff --git a/pcsx2/gui/ConsoleLogger.cpp b/pcsx2/gui/ConsoleLogger.cpp index b115e3cc5e..ed75ad910a 100644 --- a/pcsx2/gui/ConsoleLogger.cpp +++ b/pcsx2/gui/ConsoleLogger.cpp @@ -70,15 +70,15 @@ void pxLogConsole::DoLog( wxLogLevel level, const wxChar *szString, time_t t ) // fallthrough! case wxLOG_Message: - Console.WriteLn( L"[wx] %s", szString ); + Console.WriteLn( L"[wx] %ls", szString ); break; case wxLOG_Error: - Console.Error( L"[wx] %s", szString ); + Console.Error( L"[wx] %ls", szString ); break; case wxLOG_Warning: - Console.Warning( L"[wx] %s", szString ); + Console.Warning( L"[wx] %ls", szString ); break; } } diff --git a/pcsx2/gui/FrameForGS.cpp b/pcsx2/gui/FrameForGS.cpp index 7af9de908b..cdcedae9f6 100644 --- a/pcsx2/gui/FrameForGS.cpp +++ b/pcsx2/gui/FrameForGS.cpp @@ -567,7 +567,7 @@ void GSFrame::OnUpdateTitle( wxTimerEvent& evt ) const u64& smode2 = *(u64*)PS2GS_BASE(GS_SMODE2); - SetTitle( pxsFmt( L"%s | %s (%s) | Limiter: %s | fps: %6.02f%s | State %d", + SetTitle( pxsFmt( L"%s | %ls (%ls) | Limiter: %ls | fps: %6.02f%ls | State %d", WX_STR(fromUTF8(gsDest)), (smode2 & 1) ? L"Interlaced" : L"Progressive", (smode2 & 2) ? L"frame" : L"field", diff --git a/pcsx2/gui/Panels/MemoryCardListView.cpp b/pcsx2/gui/Panels/MemoryCardListView.cpp index 40edf7ffba..5b7e89027a 100644 --- a/pcsx2/gui/Panels/MemoryCardListView.cpp +++ b/pcsx2/gui/Panels/MemoryCardListView.cpp @@ -57,8 +57,10 @@ void BaseMcdListView::LoadSaveColumns( IniInterface& ini ) { const ListViewColumnInfo& cinfo = GetDefaultColumnInfo(col); label.Clear(); - label.Write( L"ColumnWidth_%s", cinfo.name ); + label.Write( L"ColumnWidth_%ls", cinfo.name ); + int width = GetColumnWidth(col); + ini.Entry( label, width, cinfo.width ); if (ini.IsLoading()) diff --git a/pcsx2/ps2/BiosTools.cpp b/pcsx2/ps2/BiosTools.cpp index 126b530b8c..cea35a0d7e 100644 --- a/pcsx2/ps2/BiosTools.cpp +++ b/pcsx2/ps2/BiosTools.cpp @@ -129,7 +129,7 @@ static void LoadBiosVersion( pxInputStream& fp, u32& version, wxString& descript version = strtol(vermaj, (char**)NULL, 0) << 8; version|= strtol(vermin, (char**)NULL, 0); - Console.WriteLn(L"Bios Found: %s", result.c_str()); + Console.WriteLn(L"Bios Found: %ls", result.c_str()); description = result.c_str(); zoneStr = fromUTF8(zone); diff --git a/pcsx2/x86/iR3000A.cpp b/pcsx2/x86/iR3000A.cpp index 098c8fd277..10664fed68 100644 --- a/pcsx2/x86/iR3000A.cpp +++ b/pcsx2/x86/iR3000A.cpp @@ -125,7 +125,7 @@ static void recEventTest() // stackframe setup code in this function) static void __fastcall StackFrameCheckFailed( int espORebp, int regval ) { - pxFailDev( pxsFmt( L"(R3000A Recompiler Stackframe) Sanity check failed on %s\n\tCurrent=%d; Saved=%d", + pxFailDev( pxsFmt( L"(R3000A Recompiler Stackframe) Sanity check failed on %ls\n\tCurrent=%d; Saved=%d", (espORebp==0) ? L"ESP" : L"EBP", regval, (espORebp==0) ? s_store_esp : s_store_ebp ) ); diff --git a/pcsx2/x86/newVif_Dynarec.cpp b/pcsx2/x86/newVif_Dynarec.cpp index 41f2460d21..4a7cc64698 100644 --- a/pcsx2/x86/newVif_Dynarec.cpp +++ b/pcsx2/x86/newVif_Dynarec.cpp @@ -273,7 +273,7 @@ _vifT static __fi u8* dVifsetVUptr(uint cl, uint wl, bool isFill) { // it clears the buffer only. static __fi void dVifRecLimit(int idx) { if (nVif[idx].recWritePtr > (nVif[idx].recReserve->GetPtrEnd() - _256kb)) { - DevCon.WriteLn(L"nVif Recompiler Cache Reset! [%s > %s]", + DevCon.WriteLn(L"nVif Recompiler Cache Reset! [%ls > %ls]", pxsPtr(nVif[idx].recWritePtr), pxsPtr(nVif[idx].recReserve->GetPtrEnd()) ); nVif[idx].recReserve->Reset(); diff --git a/pcsx2/x86/newVif_UnpackSSE.cpp b/pcsx2/x86/newVif_UnpackSSE.cpp index fd9cd10e42..9ca3bbfeda 100644 --- a/pcsx2/x86/newVif_UnpackSSE.cpp +++ b/pcsx2/x86/newVif_UnpackSSE.cpp @@ -426,7 +426,7 @@ void VifUnpackSSE_Init() DevCon.WriteLn( "Unpack function generation complete. Generated function statistics:" ); DevCon.Indent().WriteLn( - L"Reserved buffer : %u bytes @ %s\n" + L"Reserved buffer : %u bytes @ %ls\n" L"x86 code generated : %u bytes\n", (uint)nVifUpkExec->GetCommittedBytes(), pxsPtr(nVifUpkExec->GetPtr()),