This'll at least get rid of the Linux compiler errors, though the tons of linker errors, half of which are in assembly files, are still there.

git-svn-id: http://pcsx2-playground.googlecode.com/svn/trunk@575 a6443dda-0b58-4228-96e9-037be469359c
This commit is contained in:
arcum42 2009-01-10 12:19:07 +00:00 committed by Gregory Hainaut
parent 84c7b1bdc3
commit 2821b483bf
12 changed files with 89 additions and 78 deletions

View File

@ -20,6 +20,7 @@
#define _PCSX2_EXCEPTIONS_H_ #define _PCSX2_EXCEPTIONS_H_
#include <stdexcept> #include <stdexcept>
#include "StringUtils.h"
// This class provides an easy and clean method for ensuring objects are not copyable. // This class provides an easy and clean method for ensuring objects are not copyable.
class NoncopyableObject class NoncopyableObject

View File

@ -23,8 +23,8 @@ using namespace std;
// these namespace directives globalize the new namespaces and make the code behave basically // 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). // like it used to (with cpuReset() and other cpu* vars and functions global).
using namespace R5900; using namespace R5900;
using namespace Dynarec; //using namespace Dynarec;
using namespace Dynarec::R5900; //using namespace Dynarec::R5900;
static void FindComboText(GtkWidget *combo, char plist[255][255], GList *list, char *conf) 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); SysCloseLibrary(drv);
if (ret == 0) if (ret == 0)
SysMessage(_("This plugin reports that should work correctly")); Msgbox::Alert("This plugin reports that should work correctly");
else 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) void OnConf_Gs(GtkMenuItem *menuitem, gpointer user_data)
@ -433,7 +433,7 @@ void OnConf_Conf(GtkMenuItem *menuitem, gpointer user_data) {
FindPlugins(); FindPlugins();
ConfDlg = create_ConfDlg(); ConfDlg = create_ConfDlg();
gtk_window_set_title(GTK_WINDOW(ConfDlg), _("Configuration")); gtk_window_set_title(GTK_WINDOW(ConfDlg), "Configuration");
UpdateConfDlg(); UpdateConfDlg();
@ -465,7 +465,7 @@ void FindPlugins() {
dir = opendir(Config.PluginsDir); dir = opendir(Config.PluginsDir);
if (dir == NULL) { if (dir == NULL) {
SysMessage(_("Could not open '%s' directory"), Config.PluginsDir); Msgbox::Alert("Could not open '%s' directory", params Config.PluginsDir);
return; return;
} }
while ((ent = readdir(dir)) != NULL) { while ((ent = readdir(dir)) != NULL) {
@ -478,7 +478,7 @@ void FindPlugins() {
Handle = dlopen(plugin, RTLD_NOW); Handle = dlopen(plugin, RTLD_NOW);
if (Handle == NULL) 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; continue;
} }
@ -511,7 +511,7 @@ void FindPlugins() {
if (((version >> 16)&0xff) == PS2E_GS_VERSION) if (((version >> 16)&0xff) == PS2E_GS_VERSION)
ComboAddPlugin(name, &GSConfS, version, ent); ComboAddPlugin(name, &GSConfS, version, ent);
else 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) if (type & PS2E_LT_PAD)
{ {
@ -579,7 +579,7 @@ void FindPlugins() {
dir = opendir(Config.BiosDir); dir = opendir(Config.BiosDir);
if (dir == NULL) if (dir == NULL)
{ {
SysMessage(_("Could not open '%s' directory"), Config.BiosDir); Msgbox::Alert("Could not open '%s' directory", params Config.BiosDir);
return; return;
} }

View File

@ -17,6 +17,8 @@
*/ */
#include "DebugDlg.h" #include "DebugDlg.h"
using namespace R5900;
using namespace Dynarec;
void UpdateDebugger() { void UpdateDebugger() {

View File

@ -18,6 +18,8 @@
#include "GtkGui.h" #include "GtkGui.h"
using namespace R5900;
void On_Dialog_Cancelled(GtkButton* button, gpointer user_data) { void On_Dialog_Cancelled(GtkButton* button, gpointer user_data) {
gtk_widget_destroy((GtkWidget*)gtk_widget_get_toplevel ((GtkWidget*)button)); gtk_widget_destroy((GtkWidget*)gtk_widget_get_toplevel ((GtkWidget*)button));
gtk_widget_set_sensitive(MainWindow, TRUE); gtk_widget_set_sensitive(MainWindow, TRUE);
@ -159,7 +161,7 @@ void RunExecute( const char* elf_file, bool use_bios )
catch( std::exception& ex ) catch( std::exception& ex )
{ {
SysMessage( ex.what() ); Msgbox::Alert( "%s", params ex.what() );
return; return;
} }
@ -179,9 +181,9 @@ void RunExecute( const char* elf_file, bool use_bios )
} }
catch( std::runtime_error& ex ) catch( std::runtime_error& ex )
{ {
SysMessage( Msgbox::Alert(
"Gamestate recovery failed. Your game progress will be lost (sorry!)\n" "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... // Take the user back to the GUI...
safe_delete( g_RecoveryState ); safe_delete( g_RecoveryState );
@ -278,7 +280,7 @@ void pcsx2_exit()
} }
} }
printf(_("PCSX2 Quitting\n")); printf("PCSX2 Quitting\n");
if (UseGui) 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; efile = 2;
try try
@ -357,9 +359,9 @@ void States_Load(const char* file, int num = -1 )
catch( Exception::UnsupportedStateVersion& ) catch( Exception::UnsupportedStateVersion& )
{ {
if( num != -1 ) if( num != -1 )
SysMessage( _( "Savestate slot %d is an unsupported version." ), num); Msgbox::Alert("Savestate slot %d is an unsupported version." , params num);
else 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 // At this point the cpu hasn't been reset, so we can return
// control to the user safely... // control to the user safely...
@ -369,18 +371,18 @@ void States_Load(const char* file, int num = -1 )
catch( std::exception& ex ) catch( std::exception& ex )
{ {
if (num != -1) if (num != -1)
Console::Error( _("Error occured while trying to load savestate slot %d")F_, num); Console::Error("Error occured while trying to load savestate slot %d", params num);
else 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. // 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" "An error occured while trying to load the savestate data.\n"
"Pcsx2 emulation state has been reset." "Pcsx2 emulation state has been reset."
) ); );
cpuShutdown(); cpuShutdown();
return; return;
@ -390,43 +392,43 @@ void States_Load(const char* file, int num = -1 )
} }
void States_Load(int num) { void States_Load(int num) {
char Text[g_MaxPath]; string Text;
SaveState::GetFilename( Text, num ); SaveState::GetFilename( Text, num );
struct stat buf; 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; return;
} }
States_Load( Text, num ); States_Load( Text, num );
} }
void States_Save( const char* file, int num = -1 ) void States_Save( string file, int num = -1 )
{ {
try try
{ {
gzSavingState(file).FreezeAll(); gzSavingState(file).FreezeAll();
if( num != -1 ) if( num != -1 )
Console::Notice( _( "State saved to slot %d" )F_, num ); Console::Notice("State saved to slot %d", params num );
else else
Console::Notice( _( "State saved to file: %s" )F_, file ); Console::Notice( "State saved to file: %s", params file );
} }
catch( std::exception& ex ) catch( std::exception& ex )
{ {
if( num != -1 ) 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 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("Save state request failed with the following error:" );
Console::Error( ex.what() ); Console::Error( "%s", params ex.what() );
} }
} }
void States_Save(int num) { void States_Save(int num) {
char Text[g_MaxPath]; string Text;
SaveState::GetFilename( Text, num ); SaveState::GetFilename( Text, num );
States_Save( Text, num ); States_Save( Text, num );

View File

@ -69,6 +69,7 @@ extern void StartGui();
extern void RunGui(); extern void RunGui();
extern int Pcsx2Configure(); extern int Pcsx2Configure();
extern GtkWidget *CpuDlg; extern GtkWidget *CpuDlg;
extern void SysMessage(const char *fmt, ...);
/* Config.c */ /* Config.c */
extern int LoadConfig(); 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 set_flag(v, flag, value) if (value == TRUE) v |= flag; else v &= flag;
#define get_flag(v,flag) ((v & (1 << flag)) != 0) #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; int i;
@ -133,14 +134,14 @@ static __forceinline void print_flags(char *name, u32 num, char *flag_names[16])
if (flag_names != NULL) if (flag_names != NULL)
{ {
for(i=0; i<=15; i++) for(i=0; i<=15; i++)
DevCon::WriteLn("%s %x: %x", flag_names[i], (1<<i), get_flag(num, i)); DevCon::WriteLn("%s %x: %x", params flag_names[i], (1<<i), get_flag(num, i));
} }
else else
{ {
for(i=0; i<=15; i++) for(i=0; i<=15; i++)
DevCon::WriteLn("%x: %x", (1<<i), get_flag(num, i)); DevCon::WriteLn("%x: %x", params (1<<i), get_flag(num, i));
}
} }
} */
char ee_log_names[17][32] = { char ee_log_names[17][32] = {
"Cpu Log", "Cpu Log",

View File

@ -76,12 +76,12 @@ namespace Console
void __fastcall SetColor( Colors color ) void __fastcall SetColor( Colors color )
{ {
Msg( tbl_color_codes[color] ); Write( tbl_color_codes[color] );
} }
void ClearColor() void ClearColor()
{ {
Msg( COLOR_RESET ); Write( COLOR_RESET );
} }
} }
@ -89,18 +89,19 @@ namespace Msgbox
{ {
bool Alert (const string& fmt) bool Alert (const string& fmt)
{ {
GtkWidget *dialog;
if (!UseGui) if (!UseGui)
{ {
Error( msg ); Console::Error( fmt );
return false; return false;
} }
GtkWidget *dialog;
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); GTK_BUTTONS_OK, fmt.c_str());
gtk_dialog_run (GTK_DIALOG (dialog)); gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog); gtk_widget_destroy (dialog);
@ -111,10 +112,10 @@ namespace Msgbox
{ {
GtkWidget *dialog; GtkWidget *dialog;
string msg; string msg;
va_list list; va_list list;
va_start(list, dummy); va_start(list, dummy);
ssprintf(msg, fmt, list); vssprintf(msg, fmt, list);
va_end(list); va_end(list);
if (msg[msg.length()-1] == '\n') if (msg[msg.length()-1] == '\n')
@ -122,13 +123,14 @@ namespace Msgbox
if (!UseGui) if (!UseGui)
{ {
Error( msg ); Console::Error( msg );
return false; return false;
} }
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, msg); GTK_BUTTONS_OK, msg.c_str());
gtk_dialog_run (GTK_DIALOG (dialog)); gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog); gtk_widget_destroy (dialog);

View File

@ -23,12 +23,13 @@
// these namespace directives globalize the new namespaces and make the code behave basically // 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). // like it used to (with cpuReset() and other cpu* vars and functions global).
// Not sure if the Dynarec ones are needed, so ncomment them if you get unresolved external // Not sure if the Dynarec ones are needed, so uncomment them if you get unresolved external
// link errors. Should solve some of them (maybe not all...) - (air) // link errors. Should solve some of them (maybe not all...) - (air)
// Definitely not all. Most of them are coming from assembly files. :(
using namespace R5900; using namespace R5900;
//using namespace Dynarec; using namespace Dynarec;
//using namespace Dynarec::R5900;
DIR *dir; DIR *dir;
@ -65,7 +66,7 @@ int main(int argc, char *argv[]) {
char* token = argv[i++]; char* token = argv[i++];
if( stricmp(token, "-help") == 0 || stricmp(token, "--help") == 0 || stricmp(token, "-h") == 0 ) { if( stricmp(token, "-help") == 0 || stricmp(token, "--help") == 0 || stricmp(token, "-h") == 0 ) {
//SysMessage(phelpmsg); //Msgbox::Alert("%s", params phelpmsg);
return 0; return 0;
} }
else if( stricmp(token, "-efile") == 0 ) { else if( stricmp(token, "-efile") == 0 ) {
@ -164,7 +165,7 @@ int main(int argc, char *argv[]) {
Config.sseMXCSR = DEFAULT_sseMXCSR; Config.sseMXCSR = DEFAULT_sseMXCSR;
Config.sseVUMXCSR = DEFAULT_sseVUMXCSR; Config.sseVUMXCSR = DEFAULT_sseVUMXCSR;
SysMessage(_("Pcsx2 needs to be configured")); Msgbox::Alert("Pcsx2 needs to be configured");
Pcsx2Configure(); Pcsx2Configure();
return 0; return 0;
@ -174,14 +175,14 @@ int main(int argc, char *argv[]) {
if( Config.PsxOut ) { if( Config.PsxOut ) {
// output the help commands // output the help commands
SysPrintf("\tF1 - save state"); Console::WriteLn("\tF1 - save state");
SysPrintf("\t(Shift +) F2 - cycle states"); Console::WriteLn("\t(Shift +) F2 - cycle states");
SysPrintf("\tF3 - load state"); Console::WriteLn("\tF3 - load state");
#ifdef PCSX2_DEVBUILD #ifdef PCSX2_DEVBUILD
SysPrintf("\tF10 - dump performance counters"); Console::WriteLn("\tF10 - dump performance counters");
SysPrintf("\tF11 - save GS state"); Console::WriteLn("\tF11 - save GS state");
SysPrintf("\tF12 - dump hardware registers"); Console::WriteLn("\tF12 - dump hardware registers");
#endif #endif
} }
@ -377,7 +378,7 @@ bool SysInit()
while (LoadPlugins() == -1) { while (LoadPlugins() == -1) {
if (Pcsx2Configure() == FALSE) if (Pcsx2Configure() == FALSE)
{ {
SysMessage("Configuration failed. Exiting."); Msgbox::Alert("Configuration failed. Exiting.");
exit(1); exit(1);
} }
} }
@ -404,9 +405,9 @@ void SysRestorableReset()
} }
catch( std::runtime_error& ex ) catch( std::runtime_error& ex )
{ {
SysMessage( Msgbox::Alert(
"Pcsx2 gamestate recovery failed. Some options may have been reverted to protect your game's state.\n" "Pcsx2 gamestate recovery failed. Some options may have been reverted to protect your game's state.\n"
"Error: %s", ex.what() ); "Error: %s", params ex.what() );
safe_delete( g_RecoveryState ); safe_delete( g_RecoveryState );
} }
} }
@ -443,7 +444,7 @@ void SysPrintf(const char *fmt, ...) {
msg[511] = '\0'; msg[511] = '\0';
va_end(list); va_end(list);
Console::Msg( msg ); Console::Write( msg );
} }
void *SysLoadLibrary(const char *lib) { void *SysLoadLibrary(const char *lib) {

View File

@ -72,7 +72,7 @@ namespace Threading
} }
catch( std::exception& ex ) catch( std::exception& ex )
{ {
Console::Error( "Thread terminated abnormally with error:\n\t%s", params ex.what() ); Console::Error( "Thread terminated abnormally with error:\n%s", params ex.what() );
owner.m_returncode = -1; owner.m_returncode = -1;
} }

View File

@ -33,6 +33,7 @@
#include <cstring> // string.h under c++ #include <cstring> // string.h under c++
#include <cstdio> // stdio.h under c++ #include <cstdio> // stdio.h under c++
#include <cstdlib> #include <cstdlib>
#include <iostream>
// ... and include some ANSI/POSIX C libs that are useful too, just for good measure. // ... 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 // (these compile lightning fast with or without PCH, but they never change so

View File

@ -1,4 +1,4 @@
void/* Pcsx2 - Pc Ps2 Emulator /* Pcsx2 - Pc Ps2 Emulator
* Copyright (C) 2002-2008 Pcsx2 Team * Copyright (C) 2002-2008 Pcsx2 Team
* *
* This program is free software; you can redistribute it and/or modify * 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 writtenCount;
int newSize = strlen(format) * 2; int newSize = strlen(format) * 2;
char *buf; char *buf, *out;
while( true ) while( true )
{ {
@ -45,7 +45,7 @@ void _format_vstring( string& dest, const char* format, va_list args )
} }
buf[writtenCount] = '\0'; buf[writtenCount] = '\0';
out = buf; cout << buf;
delete[] buf; delete[] buf;
} }

View File

@ -21,6 +21,7 @@
#include <string> #include <string>
#include <cstdarg> #include <cstdarg>
#include <sstream>
// to_string: A utility template for quick and easy inline string type conversion. // 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 // Use to_string(intval), or to_string(float), etc. Anything that the STL itself

View File

@ -5,8 +5,8 @@ noinst_LIBRARIES = libx86recomp.a
archfiles = ix86-32/iR5900-32.cpp ix86-32/iR5900AritImm.cpp ix86-32/iR5900Jump.cpp \ 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/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/iR5900LoadStore.cpp ix86-32/iR5900MultDiv.cpp ix86-32/iCore-32.cpp ix86-32/aR5900-32.S \
#ix86-32/iR5900Templates.cpp ix86-32/iR5900Templates.cpp
libx86recomp_a_SOURCES = iCOP2.cpp iCP0.cpp iFPU.cpp iHw.cpp iMMI.cpp iPsxHw.cpp iPsxMem.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 \ ir5900tables.cpp iVU0micro.cpp iVU1micro.cpp iVUmicro.cpp iVUmicroUpper.cpp iVUmicroLower.cpp \