From 1f3bdd4a08a48cc045d35cc08f4ee5549625f814 Mon Sep 17 00:00:00 2001 From: "Jake.Stine" Date: Tue, 27 Jan 2009 22:06:41 +0000 Subject: [PATCH] Various fixes related to the last 2 revisions. :) git-svn-id: http://pcsx2-playground.googlecode.com/svn/trunk@645 a6443dda-0b58-4228-96e9-037be469359c --- pcsx2/Elfheader.cpp | 2 +- pcsx2/Exceptions.h | 2 +- pcsx2/GS.cpp | 16 ++++++++-------- pcsx2/GS.h | 16 ++++++++-------- pcsx2/Linux/GtkGui.cpp | 22 +++++++++++----------- pcsx2/Linux/LnxConsole.cpp | 16 +++++++++------- pcsx2/System.cpp | 2 +- pcsx2/VUmicroMem.cpp | 2 +- pcsx2/windows/WinConsole.cpp | 2 +- pcsx2/x86/iVUzerorec.cpp | 2 +- 10 files changed, 42 insertions(+), 40 deletions(-) diff --git a/pcsx2/Elfheader.cpp b/pcsx2/Elfheader.cpp index e977a02cb2..e3f8640d9b 100644 --- a/pcsx2/Elfheader.cpp +++ b/pcsx2/Elfheader.cpp @@ -504,7 +504,7 @@ void ElfApplyPatches() ssprintf( filename, "%8.8x", params ElfCRC ); // if patches found the following status msg will be overwritten - Console::SetTitle( fmt_string( "Game running [CRC=%hs]", params &filename ) ); + Console::SetTitle( fmt_string( "Game running [CRC=%hs]", &filename ) ); if( !Config.Patch ) return; diff --git a/pcsx2/Exceptions.h b/pcsx2/Exceptions.h index a12aa2b177..411500f0ce 100644 --- a/pcsx2/Exceptions.h +++ b/pcsx2/Exceptions.h @@ -166,7 +166,7 @@ namespace Exception public: virtual ~UnsupportedStateVersion() throw() {} explicit UnsupportedStateVersion( int version ) : - StateLoadError_Recoverable( fmt_string( "Unknown or unsupported savestate version: 0x%x", params version ) ) + StateLoadError_Recoverable( fmt_string( "Unknown or unsupported savestate version: 0x%x", version ) ) {} explicit UnsupportedStateVersion( int version, const std::string& msg ) : diff --git a/pcsx2/GS.cpp b/pcsx2/GS.cpp index 916c58b6ca..8fef4146ea 100644 --- a/pcsx2/GS.cpp +++ b/pcsx2/GS.cpp @@ -360,7 +360,7 @@ static void IMRwrite(u32 value) { // don't update mtgs mem } -void gsWrite8(u32 mem, u8 value) { +__forceinline void gsWrite8(u32 mem, u8 value) { switch (mem) { case 0x12001000: // GS_CSR gsCSRwrite((CSRw & ~0x000000ff) | value); break; @@ -379,7 +379,7 @@ void gsWrite8(u32 mem, u8 value) { GIF_LOG("GS write 8 at %8.8lx with data %8.8lx\n", mem, value); } -void gsWrite16(u32 mem, u16 value) { +__forceinline void gsWrite16(u32 mem, u16 value) { GIF_LOG("GS write 16 at %8.8lx with data %8.8lx\n", mem, value); @@ -411,7 +411,7 @@ void gsWrite16(u32 mem, u16 value) { mtgsThread->SendSimplePacket(GS_RINGTYPE_MEMWRITE16, mem&0x13ff, value, 0); } -void gsWrite32(u32 mem, u32 value) +__forceinline void gsWrite32(u32 mem, u32 value) { assert( !(mem&3)); GIF_LOG("GS write 32 at %8.8lx with data %8.8lx\n", mem, value); @@ -441,7 +441,7 @@ void gsWrite32(u32 mem, u32 value) mtgsThread->SendSimplePacket(GS_RINGTYPE_MEMWRITE32, mem&0x13ff, value, 0); } -void gsWrite64(u32 mem, u64 value) { +__forceinline void gsWrite64(u32 mem, u64 value) { GIF_LOG("GS write 64 at %8.8lx with data %8.8lx_%8.8lx\n", mem, ((u32*)&value)[1], (u32)value); @@ -470,25 +470,25 @@ void gsWrite64(u32 mem, u64 value) { mtgsThread->SendSimplePacket(GS_RINGTYPE_MEMWRITE64, mem&0x13ff, (u32)value, (u32)(value>>32)); } -u8 gsRead8(u32 mem) +__forceinline u8 gsRead8(u32 mem) { GIF_LOG("GS read 8 from %8.8lx value: %8.8lx\n", mem, *(u8*)PS2GS_BASE(mem)); return *(u8*)PS2GS_BASE(mem); } -u16 gsRead16(u32 mem) +__forceinline u16 gsRead16(u32 mem) { GIF_LOG("GS read 16 from %8.8lx value: %8.8lx\n", mem, *(u16*)PS2GS_BASE(mem)); return *(u16*)PS2GS_BASE(mem); } -u32 gsRead32(u32 mem) +__forceinline u32 gsRead32(u32 mem) { GIF_LOG("GS read 32 from %8.8lx value: %8.8lx\n", mem, *(u32*)PS2GS_BASE(mem)); return *(u32*)PS2GS_BASE(mem); } -u64 gsRead64(u32 mem) +__forceinline u64 gsRead64(u32 mem) { GIF_LOG("GS read 64 from %8.8lx value: %8.8lx_%8.8lx\n", mem, *(u32*)PS2GS_BASE(mem+4), *(u32*)PS2GS_BASE(mem) ); return *(u64*)PS2GS_BASE(mem); diff --git a/pcsx2/GS.h b/pcsx2/GS.h index ad2b5fe8a6..d60afa4e06 100644 --- a/pcsx2/GS.h +++ b/pcsx2/GS.h @@ -260,15 +260,15 @@ extern void _gs_ChangeTimings( u32 framerate, u32 iTicks ); void gsGIFReset(); void gsCSRwrite(u32 value); -void gsWrite8(u32 mem, u8 value); -void gsWrite16(u32 mem, u16 value); -void gsWrite32(u32 mem, u32 value); -void gsWrite64(u32 mem, u64 value); +extern void gsWrite8(u32 mem, u8 value); +extern void gsWrite16(u32 mem, u16 value); +extern void gsWrite32(u32 mem, u32 value); +extern void gsWrite64(u32 mem, u64 value); -u8 gsRead8(u32 mem); -u16 gsRead16(u32 mem); -u32 gsRead32(u32 mem); -u64 gsRead64(u32 mem); +extern u8 gsRead8(u32 mem); +extern u16 gsRead16(u32 mem); +extern u32 gsRead32(u32 mem); +extern u64 gsRead64(u32 mem); void gsConstWrite8(u32 mem, int mmreg); void gsConstWrite16(u32 mem, int mmreg); diff --git a/pcsx2/Linux/GtkGui.cpp b/pcsx2/Linux/GtkGui.cpp index bd18291b59..6add212a17 100644 --- a/pcsx2/Linux/GtkGui.cpp +++ b/pcsx2/Linux/GtkGui.cpp @@ -155,15 +155,15 @@ void RunExecute( const char* elf_file, bool use_bios ) // cross platform gui?) - Air try - { - cpuReset(); - } - - catch( std::exception& ex ) - { - Msgbox::Alert( "%s", params ex.what() ); - return; - } + { + cpuReset(); + } + + catch( std::exception& ex ) + { + Msgbox::Alert( ex.what() ); + return; + } if (OpenPlugins(NULL) == -1) { @@ -418,9 +418,9 @@ void States_Save( string file, int num = -1 ) catch( std::exception& ex ) { if( num != -1 ) - Msgbox::Alert("An error occured while trying to save to slot %d", params num ); + Msgbox::Alert("An error occurred while trying to save to slot %d", params num ); else - Msgbox::Alert("An error occured while trying to save to file: %s", params file ); + Msgbox::Alert("An error occurred while trying to save to file: %s", params file ); Console::Error("Save state request failed with the following error:" ); Console::Error( "%s", params ex.what() ); diff --git a/pcsx2/Linux/LnxConsole.cpp b/pcsx2/Linux/LnxConsole.cpp index 0dc8db884e..de1ab84fbb 100644 --- a/pcsx2/Linux/LnxConsole.cpp +++ b/pcsx2/Linux/LnxConsole.cpp @@ -63,13 +63,13 @@ namespace Console return false; } - __forceinline bool __fastcall Write( const string& fmt ) + __forceinline bool __fastcall Write( const char* fmt ) { if (Config.PsxOut) - puts( fmt.c_str() ); + puts( fmt ); if (emuLog != NULL) - fputs(fmt.c_str(), emuLog); + fputs(fmt, emuLog); return false; } @@ -87,7 +87,7 @@ namespace Console namespace Msgbox { - bool Alert (const string& fmt) + bool Alert (const char* fmt) { GtkWidget *dialog; @@ -101,14 +101,14 @@ namespace Msgbox dialog = gtk_message_dialog_new (GTK_WINDOW(MainWindow), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_ERROR, - GTK_BUTTONS_OK, fmt.c_str()); + GTK_BUTTONS_OK, fmt); gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_destroy (dialog); return false; } - bool Alert(const string& fmt, VARG_PARAM dummy, ...) + bool Alert(const char* fmt, VARG_PARAM dummy, ...) { GtkWidget *dialog; string msg; @@ -118,12 +118,14 @@ namespace Msgbox vssprintf(msg, fmt, list); va_end(list); + // fixme: using NULL terminators on std::string might work, but are technically "incorrect." + // This should use one of the std::string trimming functions instead. if (msg[msg.length()-1] == '\n') msg[msg.length()-1] = 0; if (!UseGui) { - Console::Error( msg ); + Console::Error( msg.c_str() ); return false; } diff --git a/pcsx2/System.cpp b/pcsx2/System.cpp index b23d68bc57..ef70ae34d7 100644 --- a/pcsx2/System.cpp +++ b/pcsx2/System.cpp @@ -194,7 +194,7 @@ bool SysAllocateMem() if( !CreateProcess(strexe.c_str(), "", NULL, NULL, FALSE, DETACHED_PROCESS|CREATE_NEW_PROCESS_GROUP, NULL, strdir.GetPtr(), &si, &pi)) { - MessageBox(NULL, fmt_string( "Failed to launch %hs\n", params &strexe ).c_str(), "Failure", MB_OK); + MessageBox(NULL, fmt_string( "Failed to launch %hs\n", &strexe ).c_str(), "Failure", MB_OK); } else { diff --git a/pcsx2/VUmicroMem.cpp b/pcsx2/VUmicroMem.cpp index ddb1755ad4..194b93dfa6 100644 --- a/pcsx2/VUmicroMem.cpp +++ b/pcsx2/VUmicroMem.cpp @@ -96,7 +96,7 @@ void vuMicroMemAlloc() { VU0.Mem = NULL; throw Exception::OutOfMemory( - fmt_string( "Failed to alloc vu0mem 0x11000000 %d", params GetLastError() ) + fmt_string( "Failed to alloc vu0mem 0x11000000 %d", GetLastError() ) ); } diff --git a/pcsx2/windows/WinConsole.cpp b/pcsx2/windows/WinConsole.cpp index 0b20c83522..13e325b7a9 100644 --- a/pcsx2/windows/WinConsole.cpp +++ b/pcsx2/windows/WinConsole.cpp @@ -136,7 +136,7 @@ namespace Msgbox va_list list; va_start(list,dummy); - MessageBox(0, fmt_string(fmt,list).c_str(), _("Pcsx2 Msg"), 0); + MessageBox(0, vfmt_string(fmt,list).c_str(), _("Pcsx2 Msg"), 0); va_end(list); return false; diff --git a/pcsx2/x86/iVUzerorec.cpp b/pcsx2/x86/iVUzerorec.cpp index fa11268ec3..15464ab77c 100644 --- a/pcsx2/x86/iVUzerorec.cpp +++ b/pcsx2/x86/iVUzerorec.cpp @@ -349,7 +349,7 @@ void SuperVUAlloc(int vuindex) if( s_recVUMem == NULL ) { throw Exception::OutOfMemory( - fmt_string( "SuperVU Error > failed to allocate recompiler memory (addr: 0x%x)", params (u32)s_recVUMem ) + fmt_string( "SuperVU Error > failed to allocate recompiler memory (addr: 0x%x)", (u32)s_recVUMem ) ); }