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_
#include <stdexcept>
#include "StringUtils.h"
// This class provides an easy and clean method for ensuring objects are not copyable.
class NoncopyableObject

View File

@ -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;
}

View File

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

View File

@ -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 );

View File

@ -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<<i), get_flag(num, i));
DevCon::WriteLn("%s %x: %x", params flag_names[i], (1<<i), get_flag(num, i));
}
else
{
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] = {
"Cpu Log",

View File

@ -76,31 +76,32 @@ namespace Console
void __fastcall SetColor( Colors color )
{
Msg( tbl_color_codes[color] );
Write( tbl_color_codes[color] );
}
void ClearColor()
{
Msg( COLOR_RESET );
Write( COLOR_RESET );
}
}
namespace Msgbox
{
bool Alert( const string& fmt )
bool Alert (const string& fmt)
{
GtkWidget *dialog;
if (!UseGui)
{
Error( msg );
Console::Error( fmt );
return false;
}
GtkWidget *dialog;
dialog = gtk_message_dialog_new (GTK_WINDOW(MainWindow),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_OK, fmt);
GTK_BUTTONS_OK, fmt.c_str());
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
@ -111,10 +112,10 @@ namespace Msgbox
{
GtkWidget *dialog;
string msg;
va_list list;
va_start(list, dummy);
ssprintf(msg, fmt, list);
vssprintf(msg, fmt, list);
va_end(list);
if (msg[msg.length()-1] == '\n')
@ -122,13 +123,14 @@ namespace Msgbox
if (!UseGui)
{
Error( msg );
Console::Error( msg );
return false;
}
dialog = gtk_message_dialog_new (GTK_WINDOW(MainWindow),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_OK, msg);
GTK_BUTTONS_OK, msg.c_str());
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);

View File

@ -23,12 +23,13 @@
// 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).
// 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)
// Definitely not all. Most of them are coming from assembly files. :(
using namespace R5900;
//using namespace Dynarec;
//using namespace Dynarec::R5900;
using namespace Dynarec;
DIR *dir;
@ -65,7 +66,7 @@ int main(int argc, char *argv[]) {
char* token = argv[i++];
if( stricmp(token, "-help") == 0 || stricmp(token, "--help") == 0 || stricmp(token, "-h") == 0 ) {
//SysMessage(phelpmsg);
//Msgbox::Alert("%s", params phelpmsg);
return 0;
}
else if( stricmp(token, "-efile") == 0 ) {
@ -164,7 +165,7 @@ int main(int argc, char *argv[]) {
Config.sseMXCSR = DEFAULT_sseMXCSR;
Config.sseVUMXCSR = DEFAULT_sseVUMXCSR;
SysMessage(_("Pcsx2 needs to be configured"));
Msgbox::Alert("Pcsx2 needs to be configured");
Pcsx2Configure();
return 0;
@ -174,14 +175,14 @@ int main(int argc, char *argv[]) {
if( Config.PsxOut ) {
// output the help commands
SysPrintf("\tF1 - save state");
SysPrintf("\t(Shift +) F2 - cycle states");
SysPrintf("\tF3 - load state");
Console::WriteLn("\tF1 - save state");
Console::WriteLn("\t(Shift +) F2 - cycle states");
Console::WriteLn("\tF3 - load state");
#ifdef PCSX2_DEVBUILD
SysPrintf("\tF10 - dump performance counters");
SysPrintf("\tF11 - save GS state");
SysPrintf("\tF12 - dump hardware registers");
Console::WriteLn("\tF10 - dump performance counters");
Console::WriteLn("\tF11 - save GS state");
Console::WriteLn("\tF12 - dump hardware registers");
#endif
}
@ -377,7 +378,7 @@ bool SysInit()
while (LoadPlugins() == -1) {
if (Pcsx2Configure() == FALSE)
{
SysMessage("Configuration failed. Exiting.");
Msgbox::Alert("Configuration failed. Exiting.");
exit(1);
}
}
@ -404,9 +405,9 @@ void SysRestorableReset()
}
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"
"Error: %s", ex.what() );
"Error: %s", params ex.what() );
safe_delete( g_RecoveryState );
}
}
@ -443,7 +444,7 @@ void SysPrintf(const char *fmt, ...) {
msg[511] = '\0';
va_end(list);
Console::Msg( msg );
Console::Write( msg );
}
void *SysLoadLibrary(const char *lib) {
@ -477,4 +478,4 @@ void *SysMmap(uptr base, u32 size) {
void SysMunmap(uptr base, u32 size) {
munmap((uptr*)base, size);
}
}

View File

@ -72,7 +72,7 @@ namespace Threading
}
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;
}

View File

@ -33,6 +33,7 @@
#include <cstring> // string.h under c++
#include <cstdio> // stdio.h under c++
#include <cstdlib>
#include <iostream>
// ... 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

View File

@ -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;
}

View File

@ -21,6 +21,7 @@
#include <string>
#include <cstdarg>
#include <sstream>
// 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

View File

@ -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 \