From 91f11550c0ad96694688cec21d2c38faf7ff37b5 Mon Sep 17 00:00:00 2001 From: arcum42 Date: Sun, 2 Nov 2008 10:08:47 +0000 Subject: [PATCH] Convert Config.c & GtkGui.c to cpp. And remove a gcc 4.3 specific flag from my last commit. git-svn-id: http://pcsx2-playground.googlecode.com/svn/trunk@271 a6443dda-0b58-4228-96e9-037be469359c --- pcsx2/Linux/{Config.c => Config.cpp} | 2 ++ pcsx2/Linux/{GtkGui.c => GtkGui.cpp} | 20 ++++++------- pcsx2/Linux/GtkGui.h | 13 ++++++++- pcsx2/Linux/Linux.h | 43 ++++++++++++++++------------ pcsx2/Linux/LnxMain.c | 2 -- pcsx2/Linux/Makefile.am | 2 +- pcsx2/configure.ac | 6 ++-- 7 files changed, 52 insertions(+), 36 deletions(-) rename pcsx2/Linux/{Config.c => Config.cpp} (99%) rename pcsx2/Linux/{GtkGui.c => GtkGui.cpp} (99%) diff --git a/pcsx2/Linux/Config.c b/pcsx2/Linux/Config.cpp similarity index 99% rename from pcsx2/Linux/Config.c rename to pcsx2/Linux/Config.cpp index 33cba30ac3..0d23d6cb7d 100644 --- a/pcsx2/Linux/Config.c +++ b/pcsx2/Linux/Config.cpp @@ -22,7 +22,9 @@ #include #include +extern "C" { #include "Linux.h" +} #define GetValue(name, var) \ tmp = strstr(data, name); \ diff --git a/pcsx2/Linux/GtkGui.c b/pcsx2/Linux/GtkGui.cpp similarity index 99% rename from pcsx2/Linux/GtkGui.c rename to pcsx2/Linux/GtkGui.cpp index 746d818d3f..075b1bf1c8 100644 --- a/pcsx2/Linux/GtkGui.c +++ b/pcsx2/Linux/GtkGui.cpp @@ -17,8 +17,6 @@ */ #include "GtkGui.h" -#include "R3000A.h" -#include "PsxMem.h" void StartGui() { GtkWidget *Menu; @@ -607,7 +605,7 @@ void SetActiveComboItem(GtkComboBox *widget,char plist[255][255], GList *list, c while (temp) { - if (!strcmp(plist[pindex],temp->data)) + if (!strcmp(plist[pindex],(char*)temp->data)) item = i; temp = temp->next; @@ -678,7 +676,7 @@ void OnConfConf_Cancel(GtkButton *button, gpointer user_data) { getcwd(file, ARRAYSIZE(file)); /* store current dir */ \ chdir(Config.PluginsDir); /* change dirs so that plugins can find their config file*/ \ if (drv == NULL) return; \ - conf = (src) SysLoadSym(drv, name); \ + conf = (src) SysLoadSym(drv, (char*)name); \ if (SysLibError() == NULL) conf(); \ chdir(file); /* change back*/ \ SysCloseLibrary(drv); @@ -693,7 +691,7 @@ void OnConfConf_Cancel(GtkButton *button, gpointer user_data) { strcat(file, plugin); \ drv = SysLoadLibrary(file); \ if (drv == NULL) return; \ - conf = (src) SysLoadSym(drv, name); \ + conf = (src) SysLoadSym(drv, (char*)name); \ if (SysLibError() == NULL) { \ ret = conf(); \ if (ret == 0) \ @@ -812,7 +810,7 @@ void SetComboToGList(GtkComboBox *widget, GList *list) temp = list; while (temp != NULL) { - gtk_combo_box_append_text (GTK_COMBO_BOX (widget), temp->data); + gtk_combo_box_append_text(GTK_COMBO_BOX (widget), (char*)temp->data); temp = temp->next; } @@ -915,7 +913,7 @@ void UpdateDebugger() { mem = (u32*)PSXM(pc); } else - mem = PSM(pc); + mem = (u32*)PSM(pc); if (mem == NULL) { sprintf(nullAddr, "%8.8lX:\tNULL MEMORY", pc); @@ -1047,10 +1045,10 @@ void OnDumpC_Ok(GtkButton *button, gpointer user_data) { u32 *mem; if (DebugMode) { - mem = PSXM(addrf); + mem = (u32*)PSXM(addrf); } else { - mem = PSM(addrf); + mem = (u32*)PSM(addrf); } if (mem == NULL) { @@ -1104,9 +1102,9 @@ void OnDumpR_Ok(GtkButton *button, gpointer user_data) { u32 out; if (DebugMode) { - mem = PSXM(addrf); + mem = (u32*)PSXM(addrf); } else { - mem = PSM(addrf); + mem = (u32*)PSM(addrf); } if (mem == NULL) out = 0; else out = *mem; diff --git a/pcsx2/Linux/GtkGui.h b/pcsx2/Linux/GtkGui.h index 696b8afd5f..bcc47b9c3e 100644 --- a/pcsx2/Linux/GtkGui.h +++ b/pcsx2/Linux/GtkGui.h @@ -19,10 +19,21 @@ #ifndef __GTKGUI_H__ #define __GTKGUI_H__ +#include "Linux.h" +#ifdef __cplusplus +extern "C" { +#endif + #include "support.h" #include "callbacks.h" #include "interface.h" -#include "Linux.h" + +#include "R3000A.h" +#include "PsxMem.h" + +#ifdef __cplusplus +} +#endif bool applychanges = FALSE; bool configuringplug = FALSE; diff --git a/pcsx2/Linux/Linux.h b/pcsx2/Linux/Linux.h index 3cc082dc9e..8af71ac0af 100644 --- a/pcsx2/Linux/Linux.h +++ b/pcsx2/Linux/Linux.h @@ -43,13 +43,37 @@ #include #include - +#ifdef __cplusplus +extern "C" { +#endif + #include "../Paths.h" #include "Common.h" +/* Misc.c */ +extern void vu0Shutdown(); +extern void vu1Shutdown(); +extern void SaveConfig(); + extern bool UseGui; extern bool needReset; extern bool RunExe; + + +extern int g_SaveGSStream; +extern int g_ZeroGSOptions; + +/* LnxMain */ +extern void InitLanguages(); +extern char *GetLanguageNext(); +extern void CloseLanguages(); +extern void ChangeLanguage(char *lang); +extern void StartGui(); +extern void RunGui(); +extern int Pcsx2Configure(); +#ifdef __cplusplus +} +#endif extern GtkWidget *CpuDlg; @@ -58,22 +82,8 @@ extern int LoadConfig(); extern void SaveConfig(); /* GtkGui */ -extern void StartGui(); -extern void RunGui(); -extern int Pcsx2Configure(); -extern void ChangeLanguage(char *lang); extern void init_widgets(); -/* LnxMain */ -extern void InitLanguages(); -extern char *GetLanguageNext(); -extern void CloseLanguages(); -extern void ChangeLanguage(char *lang); - -/* Misc.c */ -extern void vu0Shutdown(); -extern void vu1Shutdown(); -extern void SaveConfig(); typedef struct { char lang[256]; @@ -100,9 +110,6 @@ GtkWidget *radio_normal_limit, *radio_limit_limit, *radio_fs_limit, *radio_vuski _langs *langs; unsigned int langsMax; -extern int g_SaveGSStream; -extern int g_ZeroGSOptions; - char cfgfile[256]; /* Hacks */ diff --git a/pcsx2/Linux/LnxMain.c b/pcsx2/Linux/LnxMain.c index 8446d8de1e..ce068c4ee8 100644 --- a/pcsx2/Linux/LnxMain.c +++ b/pcsx2/Linux/LnxMain.c @@ -431,7 +431,6 @@ void SysPrintf(const char *fmt, ...) { #endif #endif } - void *SysLoadLibrary(char *lib) { return dlopen(lib, RTLD_NOW); } @@ -564,5 +563,4 @@ int SysMapUserPhysicalPages(void* Addr, uptr NumPages, PSMEMORYBLOCK* pblock, in return 1; } - #endif diff --git a/pcsx2/Linux/Makefile.am b/pcsx2/Linux/Makefile.am index 84abfcfda0..cdf9f3f74d 100644 --- a/pcsx2/Linux/Makefile.am +++ b/pcsx2/Linux/Makefile.am @@ -3,7 +3,7 @@ INCLUDES = $(shell pkg-config --cflags gtk+-2.0) -I@srcdir@/../ bin_PROGRAMS = pcsx2 # the application source, library search path, and link libraries -pcsx2_SOURCES = Config.c interface.c GtkGui.c LnxMain.c support.c +pcsx2_SOURCES = Config.cpp interface.c GtkGui.cpp LnxMain.c support.c pcsx2_LDFLAGS = diff --git a/pcsx2/configure.ac b/pcsx2/configure.ac index d0c1da7365..eb3dfb8e81 100644 --- a/pcsx2/configure.ac +++ b/pcsx2/configure.ac @@ -17,9 +17,9 @@ CXXFLAGS= CCASFLAGS= WARNING_FLAGS="-Wall -Wno-format -Wno-unused-value" -dnl EXTRA_FLAGS = " -Xlinker -zmuldefs -fpermissive "-ansi -NORMAL_FLAGS="-march=native -pipe -O3 -fomit-frame-pointer ${WARNING_FLAGS}" -DEBUG_FLAGS=" -g ${WARNING_FLAGS}" +dnl EXTRA_FLAGS = " -Xlinker -fpermissive -march=native" +NORMAL_FLAGS=" -pipe -O3 -Xlinker -zmuldefs -fomit-frame-pointer ${WARNING_FLAGS}" +DEBUG_FLAGS=" -g -Xlinker -zmuldefs ${WARNING_FLAGS}" dnl Check for debug build AC_MSG_CHECKING(debug build)