Various fixes related to the last 2 revisions. :)

git-svn-id: http://pcsx2-playground.googlecode.com/svn/trunk@645 a6443dda-0b58-4228-96e9-037be469359c
This commit is contained in:
Jake.Stine 2009-01-27 22:06:41 +00:00 committed by Gregory Hainaut
parent 636e4a8b42
commit 1f3bdd4a08
10 changed files with 42 additions and 40 deletions

View File

@ -504,7 +504,7 @@ void ElfApplyPatches()
ssprintf( filename, "%8.8x", params ElfCRC ); ssprintf( filename, "%8.8x", params ElfCRC );
// if patches found the following status msg will be overwritten // 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; if( !Config.Patch ) return;

View File

@ -166,7 +166,7 @@ namespace Exception
public: public:
virtual ~UnsupportedStateVersion() throw() {} virtual ~UnsupportedStateVersion() throw() {}
explicit UnsupportedStateVersion( int version ) : 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 ) : explicit UnsupportedStateVersion( int version, const std::string& msg ) :

View File

@ -360,7 +360,7 @@ static void IMRwrite(u32 value) {
// don't update mtgs mem // don't update mtgs mem
} }
void gsWrite8(u32 mem, u8 value) { __forceinline void gsWrite8(u32 mem, u8 value) {
switch (mem) { switch (mem) {
case 0x12001000: // GS_CSR case 0x12001000: // GS_CSR
gsCSRwrite((CSRw & ~0x000000ff) | value); break; 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); 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); 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); 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)); assert( !(mem&3));
GIF_LOG("GS write 32 at %8.8lx with data %8.8lx\n", mem, value); 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); 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); 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)); 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)); GIF_LOG("GS read 8 from %8.8lx value: %8.8lx\n", mem, *(u8*)PS2GS_BASE(mem));
return *(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)); GIF_LOG("GS read 16 from %8.8lx value: %8.8lx\n", mem, *(u16*)PS2GS_BASE(mem));
return *(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)); GIF_LOG("GS read 32 from %8.8lx value: %8.8lx\n", mem, *(u32*)PS2GS_BASE(mem));
return *(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) ); 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); return *(u64*)PS2GS_BASE(mem);

View File

@ -260,15 +260,15 @@ extern void _gs_ChangeTimings( u32 framerate, u32 iTicks );
void gsGIFReset(); void gsGIFReset();
void gsCSRwrite(u32 value); void gsCSRwrite(u32 value);
void gsWrite8(u32 mem, u8 value); extern void gsWrite8(u32 mem, u8 value);
void gsWrite16(u32 mem, u16 value); extern void gsWrite16(u32 mem, u16 value);
void gsWrite32(u32 mem, u32 value); extern void gsWrite32(u32 mem, u32 value);
void gsWrite64(u32 mem, u64 value); extern void gsWrite64(u32 mem, u64 value);
u8 gsRead8(u32 mem); extern u8 gsRead8(u32 mem);
u16 gsRead16(u32 mem); extern u16 gsRead16(u32 mem);
u32 gsRead32(u32 mem); extern u32 gsRead32(u32 mem);
u64 gsRead64(u32 mem); extern u64 gsRead64(u32 mem);
void gsConstWrite8(u32 mem, int mmreg); void gsConstWrite8(u32 mem, int mmreg);
void gsConstWrite16(u32 mem, int mmreg); void gsConstWrite16(u32 mem, int mmreg);

View File

@ -155,15 +155,15 @@ void RunExecute( const char* elf_file, bool use_bios )
// cross platform gui?) - Air // cross platform gui?) - Air
try try
{ {
cpuReset(); cpuReset();
} }
catch( std::exception& ex ) catch( std::exception& ex )
{ {
Msgbox::Alert( "%s", params ex.what() ); Msgbox::Alert( ex.what() );
return; return;
} }
if (OpenPlugins(NULL) == -1) if (OpenPlugins(NULL) == -1)
{ {
@ -418,9 +418,9 @@ void States_Save( string file, int num = -1 )
catch( std::exception& ex ) catch( std::exception& ex )
{ {
if( num != -1 ) 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 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("Save state request failed with the following error:" );
Console::Error( "%s", params ex.what() ); Console::Error( "%s", params ex.what() );

View File

@ -63,13 +63,13 @@ namespace Console
return false; return false;
} }
__forceinline bool __fastcall Write( const string& fmt ) __forceinline bool __fastcall Write( const char* fmt )
{ {
if (Config.PsxOut) if (Config.PsxOut)
puts( fmt.c_str() ); puts( fmt );
if (emuLog != NULL) if (emuLog != NULL)
fputs(fmt.c_str(), emuLog); fputs(fmt, emuLog);
return false; return false;
} }
@ -87,7 +87,7 @@ namespace Console
namespace Msgbox namespace Msgbox
{ {
bool Alert (const string& fmt) bool Alert (const char* fmt)
{ {
GtkWidget *dialog; GtkWidget *dialog;
@ -101,14 +101,14 @@ namespace Msgbox
dialog = gtk_message_dialog_new (GTK_WINDOW(MainWindow), dialog = gtk_message_dialog_new (GTK_WINDOW(MainWindow),
GTK_DIALOG_DESTROY_WITH_PARENT, GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_ERROR, GTK_MESSAGE_ERROR,
GTK_BUTTONS_OK, fmt.c_str()); GTK_BUTTONS_OK, fmt);
gtk_dialog_run (GTK_DIALOG (dialog)); gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog); gtk_widget_destroy (dialog);
return false; return false;
} }
bool Alert(const string& fmt, VARG_PARAM dummy, ...) bool Alert(const char* fmt, VARG_PARAM dummy, ...)
{ {
GtkWidget *dialog; GtkWidget *dialog;
string msg; string msg;
@ -118,12 +118,14 @@ namespace Msgbox
vssprintf(msg, fmt, list); vssprintf(msg, fmt, list);
va_end(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') if (msg[msg.length()-1] == '\n')
msg[msg.length()-1] = 0; msg[msg.length()-1] = 0;
if (!UseGui) if (!UseGui)
{ {
Console::Error( msg ); Console::Error( msg.c_str() );
return false; return false;
} }

View File

@ -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)) 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 else
{ {

View File

@ -96,7 +96,7 @@ void vuMicroMemAlloc()
{ {
VU0.Mem = NULL; VU0.Mem = NULL;
throw Exception::OutOfMemory( throw Exception::OutOfMemory(
fmt_string( "Failed to alloc vu0mem 0x11000000 %d", params GetLastError() ) fmt_string( "Failed to alloc vu0mem 0x11000000 %d", GetLastError() )
); );
} }

View File

@ -136,7 +136,7 @@ namespace Msgbox
va_list list; va_list list;
va_start(list,dummy); 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); va_end(list);
return false; return false;

View File

@ -349,7 +349,7 @@ void SuperVUAlloc(int vuindex)
if( s_recVUMem == NULL ) if( s_recVUMem == NULL )
{ {
throw Exception::OutOfMemory( 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 )
); );
} }