diff --git a/pcsx2/Exceptions.h b/pcsx2/Exceptions.h index 7887025941..32af70b8e1 100644 --- a/pcsx2/Exceptions.h +++ b/pcsx2/Exceptions.h @@ -20,6 +20,7 @@ #define _PCSX2_EXCEPTIONS_H_ #include +#include "StringUtils.h" // This class provides an easy and clean method for ensuring objects are not copyable. class NoncopyableObject diff --git a/pcsx2/Linux/ConfigDlg.cpp b/pcsx2/Linux/ConfigDlg.cpp index d259cf865e..4e8b0b9b40 100644 --- a/pcsx2/Linux/ConfigDlg.cpp +++ b/pcsx2/Linux/ConfigDlg.cpp @@ -23,8 +23,8 @@ using namespace std; // these namespace directives globalize the new namespaces and make the code behave basically // like it used to (with cpuReset() and other cpu* vars and functions global). using namespace R5900; -using namespace Dynarec; -using namespace Dynarec::R5900; +//using namespace Dynarec; +//using namespace Dynarec::R5900; static void FindComboText(GtkWidget *combo, char plist[255][255], GList *list, char *conf) { @@ -96,9 +96,9 @@ static void TestPlugin(PluginConf confs, char* plugin, const char* name) SysCloseLibrary(drv); if (ret == 0) - SysMessage(_("This plugin reports that should work correctly")); + Msgbox::Alert("This plugin reports that should work correctly"); else - SysMessage(_("This plugin reports that should not work correctly")); + Msgbox::Alert("This plugin reports that should not work correctly"); } void OnConf_Gs(GtkMenuItem *menuitem, gpointer user_data) @@ -433,7 +433,7 @@ void OnConf_Conf(GtkMenuItem *menuitem, gpointer user_data) { FindPlugins(); ConfDlg = create_ConfDlg(); - gtk_window_set_title(GTK_WINDOW(ConfDlg), _("Configuration")); + gtk_window_set_title(GTK_WINDOW(ConfDlg), "Configuration"); UpdateConfDlg(); @@ -465,7 +465,7 @@ void FindPlugins() { dir = opendir(Config.PluginsDir); if (dir == NULL) { - SysMessage(_("Could not open '%s' directory"), Config.PluginsDir); + Msgbox::Alert("Could not open '%s' directory", params Config.PluginsDir); return; } while ((ent = readdir(dir)) != NULL) { @@ -478,7 +478,7 @@ void FindPlugins() { Handle = dlopen(plugin, RTLD_NOW); if (Handle == NULL) { - Console::Error("Can't open %s: %s", params ent->d_name, dlerror()); + Console::Error("Can't open %s: %s\n", params ent->d_name, dlerror()); continue; } @@ -488,17 +488,17 @@ void FindPlugins() { if (PS2EgetLibType == NULL) { - Console::Error("PS2EgetLibType==NULL for %s", params ent->d_name); + Console::Error("PS2EgetLibType==NULL for %s", params ent->d_name); continue; } if (PS2EgetLibName == NULL) { - Console::Error("PS2EgetLibName==NULL for %s", params ent->d_name); + Console::Error("PS2EgetLibName==NULL for %s", params ent->d_name); continue; } if (PS2EgetLibVersion2 == NULL) { - Console::Error("PS2EgetLibVersion2==NULL for %s", params ent->d_name); + Console::Error("PS2EgetLibVersion2==NULL for %s", params ent->d_name); continue; } @@ -511,7 +511,7 @@ void FindPlugins() { if (((version >> 16)&0xff) == PS2E_GS_VERSION) ComboAddPlugin(name, &GSConfS, version, ent); else - Console::Notice("Plugin %s: Version %x != %x"F_, plugin, (version >> 16)&0xff, PS2E_GS_VERSION); + Console::Notice("Plugin %s: Version %x != %x", params plugin, (version >> 16)&0xff, PS2E_GS_VERSION); } if (type & PS2E_LT_PAD) { @@ -526,7 +526,7 @@ void FindPlugins() { if (query() & 0x2) ComboAddPlugin(name, &PAD2ConfS, version, ent); } else - Console::Notice("Plugin %s: Version %x != %x", params plugin, (version >> 16)&0xff, PS2E_PAD_VERSION); + Console::Notice("Plugin %s: Version %x != %x", params plugin, (version >> 16)&0xff, PS2E_PAD_VERSION); } if (type & PS2E_LT_SPU2) { @@ -535,7 +535,7 @@ void FindPlugins() { if (((version >> 16)&0xff) == PS2E_SPU2_VERSION) ComboAddPlugin(name, &SPU2ConfS, version, ent); else - Console::Notice("Plugin %s: Version %x != %x", params plugin, (version >> 16)&0xff, PS2E_SPU2_VERSION); + Console::Notice("Plugin %s: Version %x != %x", params plugin, (version >> 16)&0xff, PS2E_SPU2_VERSION); } if (type & PS2E_LT_CDVD) { @@ -544,7 +544,7 @@ void FindPlugins() { if (((version >> 16)&0xff) == PS2E_CDVD_VERSION) ComboAddPlugin(name, &CDVDConfS, version, ent); else - Console::Notice("Plugin %s: Version %x != %x", params plugin, (version >> 16)&0xff, PS2E_CDVD_VERSION); + Console::Notice("Plugin %s: Version %x != %x", params plugin, (version >> 16)&0xff, PS2E_CDVD_VERSION); } if (type & PS2E_LT_DEV9) { @@ -553,7 +553,7 @@ void FindPlugins() { if (((version >> 16)&0xff) == PS2E_DEV9_VERSION) ComboAddPlugin(name, &DEV9ConfS, version, ent); else - Console::Notice("DEV9Plugin %s: Version %x != %x", params plugin, (version >> 16)&0xff, PS2E_DEV9_VERSION); + Console::Notice("DEV9Plugin %s: Version %x != %x", params plugin, (version >> 16)&0xff, PS2E_DEV9_VERSION); } if (type & PS2E_LT_USB) { @@ -562,7 +562,7 @@ void FindPlugins() { if (((version >> 16)&0xff) == PS2E_USB_VERSION) ComboAddPlugin(name, &USBConfS, version, ent); else - Console::Notice("USBPlugin %s: Version %x != %x", params plugin, (version >> 16)&0xff, PS2E_USB_VERSION); + Console::Notice("USBPlugin %s: Version %x != %x", params plugin, (version >> 16)&0xff, PS2E_USB_VERSION); } if (type & PS2E_LT_FW) { @@ -571,7 +571,7 @@ void FindPlugins() { if (((version >> 16)&0xff) == PS2E_FW_VERSION) ComboAddPlugin(name, &FWConfS, version, ent); else - Console::Notice("FWPlugin %s: Version %x != %x", params plugin, (version >> 16)&0xff, PS2E_FW_VERSION); + Console::Notice("FWPlugin %s: Version %x != %x", params plugin, (version >> 16)&0xff, PS2E_FW_VERSION); } } closedir(dir); @@ -579,7 +579,7 @@ void FindPlugins() { dir = opendir(Config.BiosDir); if (dir == NULL) { - SysMessage(_("Could not open '%s' directory"), Config.BiosDir); + Msgbox::Alert("Could not open '%s' directory", params Config.BiosDir); return; } diff --git a/pcsx2/Linux/DebugDlg.cpp b/pcsx2/Linux/DebugDlg.cpp index 94e45b3855..b157937bc4 100644 --- a/pcsx2/Linux/DebugDlg.cpp +++ b/pcsx2/Linux/DebugDlg.cpp @@ -17,6 +17,8 @@ */ #include "DebugDlg.h" +using namespace R5900; +using namespace Dynarec; void UpdateDebugger() { diff --git a/pcsx2/Linux/GtkGui.cpp b/pcsx2/Linux/GtkGui.cpp index d0f565ad1c..9dbae1b834 100644 --- a/pcsx2/Linux/GtkGui.cpp +++ b/pcsx2/Linux/GtkGui.cpp @@ -18,6 +18,8 @@ #include "GtkGui.h" +using namespace R5900; + void On_Dialog_Cancelled(GtkButton* button, gpointer user_data) { gtk_widget_destroy((GtkWidget*)gtk_widget_get_toplevel ((GtkWidget*)button)); gtk_widget_set_sensitive(MainWindow, TRUE); @@ -159,7 +161,7 @@ void RunExecute( const char* elf_file, bool use_bios ) catch( std::exception& ex ) { - SysMessage( ex.what() ); + Msgbox::Alert( "%s", params ex.what() ); return; } @@ -179,9 +181,9 @@ void RunExecute( const char* elf_file, bool use_bios ) } catch( std::runtime_error& ex ) { - SysMessage( + Msgbox::Alert( "Gamestate recovery failed. Your game progress will be lost (sorry!)\n" - "\nError: %s\n", ex.what() ); + "\nError: %s\n", params ex.what() ); // Take the user back to the GUI... safe_delete( g_RecoveryState ); @@ -278,7 +280,7 @@ void pcsx2_exit() } } - printf(_("PCSX2 Quitting\n")); + printf("PCSX2 Quitting\n"); if (UseGui) { @@ -338,7 +340,7 @@ void OnEmu_Reset(GtkMenuItem *menuitem, gpointer user_data) } }*/ -void States_Load(const char* file, int num = -1 ) +void States_Load(string file, int num = -1 ) { efile = 2; try @@ -357,9 +359,9 @@ void States_Load(const char* file, int num = -1 ) catch( Exception::UnsupportedStateVersion& ) { if( num != -1 ) - SysMessage( _( "Savestate slot %d is an unsupported version." ), num); + Msgbox::Alert("Savestate slot %d is an unsupported version." , params num); else - SysMessage( _( "%s : This is an unsupported savestate version." ), file); + Msgbox::Alert( "%s : This is an unsupported savestate version." , params file); // At this point the cpu hasn't been reset, so we can return // control to the user safely... @@ -368,19 +370,19 @@ void States_Load(const char* file, int num = -1 ) } catch( std::exception& ex ) { - if( num != -1 ) - Console::Error( _("Error occured while trying to load savestate slot %d")F_, num); + if (num != -1) + Console::Error("Error occured while trying to load savestate slot %d", params num); else - Console::Error( _("Error occured while trying to load savestate file: %d")F_, file); + Console::Error("Error occured while trying to load savestate file: %d", params file); - Console::Error( ex.what() ); + Console::Error( "%s", params ex.what() ); // The emulation state is ruined. Might as well give them a popup and start the gui. - SysMessage( _( + Msgbox::Alert( "An error occured while trying to load the savestate data.\n" "Pcsx2 emulation state has been reset." - ) ); + ); cpuShutdown(); return; @@ -390,43 +392,43 @@ void States_Load(const char* file, int num = -1 ) } void States_Load(int num) { - char Text[g_MaxPath]; + string Text; SaveState::GetFilename( Text, num ); struct stat buf; - if( stat(Text, &buf ) == -1 ) + if( stat(Text.c_str(), &buf ) == -1 ) { - Console::Notice( "Saveslot %d is empty."F_, num ); + Console::Notice( "Saveslot %d is empty.", params num ); return; } States_Load( Text, num ); } -void States_Save( const char* file, int num = -1 ) +void States_Save( string file, int num = -1 ) { try { gzSavingState(file).FreezeAll(); if( num != -1 ) - Console::Notice( _( "State saved to slot %d" )F_, num ); + Console::Notice("State saved to slot %d", params num ); else - Console::Notice( _( "State saved to file: %s" )F_, file ); + Console::Notice( "State saved to file: %s", params file ); } catch( std::exception& ex ) { if( num != -1 ) - SysMessage( _("An error occured while trying to save to slot %d"), num ); + Msgbox::Alert("An error occured while trying to save to slot %d", params num ); else - SysMessage( _("An error occured while trying to save to file: %s"), file ); + Msgbox::Alert("An error occured while trying to save to file: %s", params file ); - Console::Error( _( "Save state request failed with the following error:" ) ); - Console::Error( ex.what() ); + Console::Error("Save state request failed with the following error:" ); + Console::Error( "%s", params ex.what() ); } } void States_Save(int num) { - char Text[g_MaxPath]; + string Text; SaveState::GetFilename( Text, num ); States_Save( Text, num ); diff --git a/pcsx2/Linux/Linux.h b/pcsx2/Linux/Linux.h index 665f704521..9520c28114 100644 --- a/pcsx2/Linux/Linux.h +++ b/pcsx2/Linux/Linux.h @@ -69,6 +69,7 @@ extern void StartGui(); extern void RunGui(); extern int Pcsx2Configure(); extern GtkWidget *CpuDlg; +extern void SysMessage(const char *fmt, ...); /* Config.c */ extern int LoadConfig(); @@ -124,7 +125,7 @@ int Config_hacks_backup; #define set_flag(v, flag, value) if (value == TRUE) v |= flag; else v &= flag; #define get_flag(v,flag) ((v & (1 << flag)) != 0) -static __forceinline void print_flags(char *name, u32 num, char *flag_names[16]) +/*static __forceinline void print_flags(char *name, u32 num, char *flag_names[16]) { int i; @@ -133,14 +134,14 @@ static __forceinline void print_flags(char *name, u32 num, char *flag_names[16]) if (flag_names != NULL) { for(i=0; i<=15; i++) - DevCon::WriteLn("%s %x: %x", flag_names[i], (1< // string.h under c++ #include // stdio.h under c++ #include +#include // ... and include some ANSI/POSIX C libs that are useful too, just for good measure. // (these compile lightning fast with or without PCH, but they never change so diff --git a/pcsx2/StringUtils.cpp b/pcsx2/StringUtils.cpp index 2cf391eced..abae867daa 100644 --- a/pcsx2/StringUtils.cpp +++ b/pcsx2/StringUtils.cpp @@ -1,4 +1,4 @@ -void/* Pcsx2 - Pc Ps2 Emulator +/* Pcsx2 - Pc Ps2 Emulator * Copyright (C) 2002-2008 Pcsx2 Team * * This program is free software; you can redistribute it and/or modify @@ -25,7 +25,7 @@ void _format_vstring( string& dest, const char* format, va_list args ) { int writtenCount; int newSize = strlen(format) * 2; - char *buf; + char *buf, *out; while( true ) { @@ -45,7 +45,7 @@ void _format_vstring( string& dest, const char* format, va_list args ) } buf[writtenCount] = '\0'; - out = buf; + cout << buf; delete[] buf; } diff --git a/pcsx2/StringUtils.h b/pcsx2/StringUtils.h index d28d89beb2..23f605b607 100644 --- a/pcsx2/StringUtils.h +++ b/pcsx2/StringUtils.h @@ -21,6 +21,7 @@ #include #include +#include // to_string: A utility template for quick and easy inline string type conversion. // Use to_string(intval), or to_string(float), etc. Anything that the STL itself diff --git a/pcsx2/x86/Makefile.am b/pcsx2/x86/Makefile.am index 4fbf2d4c3b..5e9dcf9dbb 100644 --- a/pcsx2/x86/Makefile.am +++ b/pcsx2/x86/Makefile.am @@ -5,8 +5,8 @@ noinst_LIBRARIES = libx86recomp.a archfiles = ix86-32/iR5900-32.cpp ix86-32/iR5900AritImm.cpp ix86-32/iR5900Jump.cpp \ ix86-32/iR5900Move.cpp ix86-32/iR5900Shift.cpp ix86-32/iR5900Arit.cpp ix86-32/iR5900Branch.cpp \ -ix86-32/iR5900LoadStore.cpp ix86-32/iR5900MultDiv.cpp ix86-32/iCore-32.cpp ix86-32/aR5900-32.S -#ix86-32/iR5900Templates.cpp +ix86-32/iR5900LoadStore.cpp ix86-32/iR5900MultDiv.cpp ix86-32/iCore-32.cpp ix86-32/aR5900-32.S \ +ix86-32/iR5900Templates.cpp libx86recomp_a_SOURCES = iCOP2.cpp iCP0.cpp iFPU.cpp iHw.cpp iMMI.cpp iPsxHw.cpp iPsxMem.cpp \ ir5900tables.cpp iVU0micro.cpp iVU1micro.cpp iVUmicro.cpp iVUmicroUpper.cpp iVUmicroLower.cpp \