summaryrefslogtreecommitdiff
path: root/gui
diff options
context:
space:
mode:
authorSND\dario86_cp <SND\dario86_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97>2011-03-12 18:54:28 +0000
committerSND\dario86_cp <SND\dario86_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97>2011-03-12 18:54:28 +0000
commita58cfdac407bc1d8fedc11acd924b275ba28cc51 (patch)
treeb4c2e08c34ef1bfe0ba947ef8eed931c9a43fc0e /gui
parent9bdd06684bcc627c06ddcf4c406f6b48f0dfe389 (diff)
downloadpcsxr-a58cfdac407bc1d8fedc11acd924b275ba28cc51.tar.gz
Commited patch in issue #8171 (by darktjm).
git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@64524 e17a0e51-4ae3-4d35-97c3-1a29b211df97
Diffstat (limited to 'gui')
-rw-r--r--gui/AboutDlg.c1
-rw-r--r--gui/ConfDlg.c18
-rw-r--r--gui/Config.c5
-rw-r--r--gui/DebugMemory.c4
-rw-r--r--gui/DebugMemory.h2
-rw-r--r--gui/Gtk2Gui.c40
-rw-r--r--gui/Linux.h2
-rw-r--r--gui/LnxMain.c14
-rw-r--r--gui/MemcardDlg.c19
-rw-r--r--gui/MemcardDlg.h2
-rw-r--r--gui/Plugin.c22
-rw-r--r--gui/nopic.h4
12 files changed, 71 insertions, 62 deletions
diff --git a/gui/AboutDlg.c b/gui/AboutDlg.c
index 2dcff91e..c55dc2dc 100644
--- a/gui/AboutDlg.c
+++ b/gui/AboutDlg.c
@@ -18,6 +18,7 @@
#include "Linux.h"
#include <gtk/gtk.h>
+#include "AboutDlg.h"
#define ABOUT_VERSION "svn"
diff --git a/gui/ConfDlg.c b/gui/ConfDlg.c
index a49740b4..a0e229eb 100644
--- a/gui/ConfDlg.c
+++ b/gui/ConfDlg.c
@@ -178,7 +178,7 @@ void ConfigurePlugins() {
G_CALLBACK(OnConf_Clicked), xml, (GClosureNotify)g_object_unref, G_CONNECT_AFTER);
}
-void OnNet_Clicked(GtkDialog *dialog, gint arg1, gpointer user_data) {
+static void OnNet_Clicked(GtkDialog *dialog, gint arg1, gpointer user_data) {
GetComboText(NetConfS.Combo, NetConfS.plist, Config.Net);
SaveConfig();
gtk_widget_destroy(GTK_WIDGET(dialog));
@@ -358,7 +358,7 @@ static int all_config_set() {
}
static void on_configure_plugin(GtkWidget *widget, gpointer user_data) {
- gint plugin_type = (int) user_data;
+ gint plugin_type = (int)(long) user_data;
while (gtk_events_pending())
gtk_main_iteration();
@@ -379,7 +379,7 @@ static void on_configure_plugin(GtkWidget *widget, gpointer user_data) {
}
static void on_about_plugin(GtkWidget *widget, gpointer user_data) {
- gint plugin_type = (int) user_data;
+ gint plugin_type = (int)(long) user_data;
while (gtk_events_pending())
gtk_main_iteration();
@@ -467,7 +467,7 @@ void OnConf_Clicked(GtkDialog *dialog, gint arg1, gpointer user_data) {
type##ConfS.glist = g_list_append(type##ConfS.glist, type##ConfS.plist[type##ConfS.plugins-1]); \
}
-void populate_combo_box(GtkWidget *widget, GList *list) {
+static void populate_combo_box(GtkWidget *widget, GList *list) {
GtkListStore *store;
GtkCellRenderer *renderer;
store = gtk_list_store_new(1, G_TYPE_STRING);
@@ -515,7 +515,7 @@ void populate_combo_box(GtkWidget *widget, GList *list) {
} \
}
-int plugin_is_available(gchar *plugin) {
+static int plugin_is_available(gchar *plugin) {
int retval;
gchar *pluginfile;
struct stat stbuf;
@@ -549,7 +549,7 @@ int plugins_configured() {
return TRUE;
}
-int is_valid_bios_file(gchar *filename) {
+static int is_valid_bios_file(gchar *filename) {
int valid;
struct stat buf;
@@ -564,14 +564,14 @@ int is_valid_bios_file(gchar *filename) {
// Add the name of the BIOS file to the drop-down list. This will
// be the filename, not the full path to the file
-void add_bios_to_list(gchar *bios_name, gchar *internal_name) {
+static void add_bios_to_list(gchar *bios_name, gchar *internal_name) {
BiosConfS.plugins += 2;
strcpy(BiosConfS.plist[BiosConfS.plugins - 1], bios_name);
strcpy(BiosConfS.plist[BiosConfS.plugins - 2], internal_name);
BiosConfS.glist = g_list_append(BiosConfS.glist, BiosConfS.plist[BiosConfS.plugins - 1]);
}
-void scan_bios_dir(gchar *dirname) {
+static void scan_bios_dir(gchar *dirname) {
DIR *dir;
struct dirent *ent;
gchar *filename;
@@ -777,7 +777,7 @@ static void OnCpu_CpuClicked(GtkWidget *widget, gpointer user_data) {
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)));
}
-void OnCpu_Clicked(GtkDialog *dialog, gint arg1, gpointer user_data) {
+static void OnCpu_Clicked(GtkDialog *dialog, gint arg1, gpointer user_data) {
GtkWidget *widget;
GladeXML *xml = user_data;
int tmp;
diff --git a/gui/Config.c b/gui/Config.c
index 375b5ac5..abd63434 100644
--- a/gui/Config.c
+++ b/gui/Config.c
@@ -105,7 +105,10 @@ int LoadConfig(PcsxConfig *Conf) {
data = (char *)malloc(size + 1);
if (data == NULL) return -1;
- fread(data, 1, buf.st_size, f);
+ if(fread(data, buf.st_size, 1, f) != 1) {
+ fclose(f);
+ return -1;
+ }
fclose(f);
data[size] = '\0';
diff --git a/gui/DebugMemory.c b/gui/DebugMemory.c
index 289c9b9a..59792cd3 100644
--- a/gui/DebugMemory.c
+++ b/gui/DebugMemory.c
@@ -19,6 +19,7 @@
#include "Linux.h"
#include "../libpcsxcore/psxmem.h"
#include <glade/glade.h>
+#include "DebugMemory.h"
#define MEMVIEW_MAX_LINES 256
@@ -156,7 +157,8 @@ static void MemView_Dump() {
FILE *fp = fopen(file, "wb");
if (fp != NULL) {
- fwrite(&psxM[start], 1, length, fp);
+ if(fwrite(&psxM[start], length, 1, fp) != 1)
+ SysMessage(_("Error writing to %s!"), file);
fclose(fp);
} else {
SysMessage(_("Error writing to %s!"), file);
diff --git a/gui/DebugMemory.h b/gui/DebugMemory.h
index 49673731..28cb2e99 100644
--- a/gui/DebugMemory.h
+++ b/gui/DebugMemory.h
@@ -19,6 +19,6 @@
#ifndef DEBUGMEMORY_H
#define DEBUGMEMORY_H
-void RunDebugMemoryDialog();
+void RunDebugMemoryDialog(void);
#endif
diff --git a/gui/Gtk2Gui.c b/gui/Gtk2Gui.c
index c7448163..77e07828 100644
--- a/gui/Gtk2Gui.c
+++ b/gui/Gtk2Gui.c
@@ -67,7 +67,7 @@ int destroy = 0;
/* TODO - If MAX_SLOTS changes, need to find a way to automatically set all positions */
int Slots[MAX_SLOTS] = { -1, -1, -1, -1, -1, -1, -1, -1, -1 };
-void ResetMenuSlots(GladeXML *xml) {
+static void ResetMenuSlots(GladeXML *xml) {
GtkWidget *widget;
gchar *str;
int i;
@@ -411,7 +411,7 @@ void OnDestroy() {
if (!destroy) OnFile_Exit();
}
-void destroy_main_window () {
+static void destroy_main_window () {
destroy = 1;
gtk_widget_destroy(Window);
Window = NULL;
@@ -467,7 +467,7 @@ void OnFile_RunExe() {
g_free(file);
SysRunGui();
} else {
- // Auto-detect: get region first, then rcnt-bios reset
+ // Auto-detect: get region first, then rcnt-bios reset
SysReset();
if (Load(file) == 0) {
@@ -510,9 +510,9 @@ void OnFile_RunCd() {
return;
}
- // Auto-detect: get region first, then rcnt-bios reset
- SysReset();
-
+ // Auto-detect: get region first, then rcnt-bios reset
+ SysReset();
+
// Read main executable directly from CDRom and start it
if (LoadCdrom() == -1) {
ClosePlugins();
@@ -651,9 +651,9 @@ void OnFile_RunImage() {
return;
}
- // Auto-detect: get region first, then rcnt-bios reset
- SysReset();
-
+ // Auto-detect: get region first, then rcnt-bios reset
+ SysReset();
+
// Read main executable directly from CDRom and start it
if (LoadCdrom() == -1) {
ClosePlugins();
@@ -698,9 +698,9 @@ void OnEmu_Reset() {
LoadCdrom();
}
- // Auto-detect: get region first, then rcnt-bios reset
- SysReset();
-
+ // Auto-detect: get region first, then rcnt-bios reset
+ SysReset();
+
psxCpu->Execute();
}
@@ -805,11 +805,11 @@ void state_load(gchar *state_filename) {
SysRunGui();
return;
}
-
+
// Auto-detect: region first, then rcnt reset
- SysReset();
- ret = LoadState(state_filename);
-
+ SysReset();
+ ret = LoadState(state_filename);
+
sprintf(Text, _("Loaded state %s."), state_filename);
GPU_displayText(Text);
} else {
@@ -833,7 +833,7 @@ void state_save(gchar *state_filename) {
void on_states_load (GtkWidget *widget, gpointer user_data) {
gchar *state_filename;
- gint state = (int)user_data;
+ gint state = (int)(long)user_data;
state_filename = get_state_filename(state);
@@ -846,7 +846,7 @@ void on_states_load (GtkWidget *widget, gpointer user_data) {
void on_states_save (GtkWidget *widget, gpointer user_data) {
gchar *state_filename;
- gint state = (int)user_data;
+ gint state = (int)(long)user_data;
state_filename = get_state_filename(state);
@@ -959,7 +959,7 @@ void SysErrorMessage(gchar *primary, gchar *secondary) {
primary,
NULL);
gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(message_dialog),
- secondary);
+ "%s", secondary);
gtk_dialog_run(GTK_DIALOG(message_dialog));
gtk_widget_destroy(message_dialog);
@@ -978,7 +978,7 @@ void SysInfoMessage(gchar *primary, gchar *secondary) {
primary,
NULL);
gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(message_dialog),
- secondary);
+ "%s", secondary);
gtk_dialog_run(GTK_DIALOG(message_dialog));
gtk_widget_destroy(message_dialog);
diff --git a/gui/Linux.h b/gui/Linux.h
index 6f0e0c09..a4df01fd 100644
--- a/gui/Linux.h
+++ b/gui/Linux.h
@@ -64,4 +64,6 @@ void UpdatePluginsBIOS();
void SysErrorMessage(gchar *primary, gchar *secondary);
void SysInfoMessage(gchar *primary, gchar *secondary);
+extern unsigned long gpuDisp;
+
#endif /* __LINUX_H__ */
diff --git a/gui/LnxMain.c b/gui/LnxMain.c
index c04061c0..84800f61 100644
--- a/gui/LnxMain.c
+++ b/gui/LnxMain.c
@@ -262,7 +262,7 @@ static void ScanAllPlugins (void) {
}
// Set the default plugin name
-void set_default_plugin(char *plugin_name, char *conf_plugin_name) {
+static void set_default_plugin(char *plugin_name, char *conf_plugin_name) {
if (strlen(plugin_name) != 0) {
strcpy(conf_plugin_name, plugin_name);
printf("Picking default plugin: %s\n", plugin_name);
@@ -308,8 +308,8 @@ int main(int argc, char *argv[]) {
if (i+1 >= argc) break;
strncpy(isofilename, argv[++i], MAXPATHLEN);
if (isofilename[0] != '/') {
- getcwd(path, MAXPATHLEN);
- if (strlen(path) + strlen(isofilename) + 1 < MAXPATHLEN) {
+ if (getcwd(path, MAXPATHLEN) != NULL &&
+ strlen(path) + strlen(isofilename) + 1 < MAXPATHLEN) {
strcat(path, "/");
strcat(path, isofilename);
strcpy(isofilename, path);
@@ -340,8 +340,8 @@ int main(int argc, char *argv[]) {
} else {
strncpy(file, argv[i], MAXPATHLEN);
if (file[0] != '/') {
- getcwd(path, MAXPATHLEN);
- if (strlen(path) + strlen(file) + 1 < MAXPATHLEN) {
+ if (getcwd(path, MAXPATHLEN) != NULL &&
+ strlen(path) + strlen(file) + 1 < MAXPATHLEN) {
strcat(path, "/");
strcat(path, file);
strcpy(file, path);
@@ -406,7 +406,8 @@ int main(int argc, char *argv[]) {
// switch to plugin dotdir
// this lets plugins work without modification!
gchar *plugin_default_dir = g_build_filename(getenv("HOME"), PLUGINS_DIR, NULL);
- chdir(plugin_default_dir);
+ if(chdir(Config.PluginsDir) < 0)
+ perror(Config.PluginsDir);
g_free(plugin_default_dir);
if (UseGui && runcd != RUN_CD) SetIsoFile(NULL);
@@ -542,7 +543,6 @@ static void SysDisableScreenSaver() {
static time_t fake_key_timer = 0;
static char first_time = 1, has_test_ext = 0, t = 1;
Display *display;
- extern unsigned long gpuDisp;
display = (Display *)gpuDisp;
diff --git a/gui/MemcardDlg.c b/gui/MemcardDlg.c
index bfe96125..137fe907 100644
--- a/gui/MemcardDlg.c
+++ b/gui/MemcardDlg.c
@@ -28,6 +28,7 @@
#include "Linux.h"
#include "../libpcsxcore/sio.h"
+#include "MemcardDlg.h"
#if GTK_CHECK_VERSION(2, 20, 0) && !GTK_CHECK_VERSION(3, 0, 0)
#include "gdk-compat.h"
@@ -328,7 +329,7 @@ static void UpdateListItems(int mcd, GtkWidget *widget) {
gtk_widget_show(List);
- OnTreeSelectionChanged(gtk_tree_view_get_selection(GTK_TREE_VIEW(List)), (gpointer)mcd);
+ OnTreeSelectionChanged(gtk_tree_view_get_selection(GTK_TREE_VIEW(List)), (gpointer)(long)mcd);
}
static void UpdateMcdDlg(GtkWidget *widget) {
@@ -352,7 +353,7 @@ static void OnMcd_Close(GtkDialog *dialog, gint arg1, gpointer user_data) {
}
static void OnMcd_FileChange(GtkWidget *widget, gpointer user_data) {
- gint memcard = (int)user_data;
+ gint memcard = (int)(long)user_data;
gchar *filename;
GtkWidget *chooser;
@@ -394,7 +395,7 @@ static void OnMcd_Format(GtkWidget *widget, gpointer user_data) {
gint result;
char *str;
- gint memcard = (int)user_data;
+ gint memcard = (int)(long)user_data;
message_dialog = gtk_message_dialog_new(NULL, GTK_DIALOG_MODAL,
GTK_MESSAGE_QUESTION, GTK_BUTTONS_NONE,
@@ -447,10 +448,10 @@ static void OnMcd_New(GtkWidget *widget, gpointer user_data) {
CreateMcd(name);
- if ((int)user_data == 1) strncpy(Config.Mcd1, name, MAXPATHLEN);
+ if ((int)(long)user_data == 1) strncpy(Config.Mcd1, name, MAXPATHLEN);
else strncpy(Config.Mcd2, name, MAXPATHLEN);
- LoadMcd((int)user_data, name);
+ LoadMcd((int)(long)user_data, name);
LoadMcdDlg(widget);
g_free(name);
@@ -504,7 +505,7 @@ static void CopyMemcardData(char *from, char *to, gint *i, gchar *str) {
}
static void OnMcd_CopyTo(GtkWidget *widget, gpointer user_data) {
- gint mcd = (gint)user_data;
+ gint mcd = (gint)(long)user_data;
GtkTreeIter iter;
GtkTreeModel *model;
@@ -571,7 +572,7 @@ static void OnMemcardDelete(GtkWidget *widget, gpointer user_data) {
GtkWidget *tree;
GtkTreeSelection *sel;
- gint memcard = (int)user_data;
+ gint memcard = (int)(long)user_data;
xml = glade_get_widget_tree(widget);
@@ -624,7 +625,7 @@ static void OnTreeSelectionChanged(GtkTreeSelection *selection, gpointer user_da
int i;
McdBlock b;
- gint memcard = (int)user_data;
+ gint memcard = (int)(long)user_data;
xml = glade_get_widget_tree(GtkCList_McdList1);
selected = gtk_tree_selection_get_selected(selection, &model, &iter);
@@ -676,7 +677,7 @@ static void OnTreeSelectionChanged(GtkTreeSelection *selection, gpointer user_da
}
}
-gboolean updateFunc(gpointer data) {
+static gboolean updateFunc(gpointer data) {
if (quit) return FALSE;
currentIcon++;
UpdateListItems(1, GtkCList_McdList1);
diff --git a/gui/MemcardDlg.h b/gui/MemcardDlg.h
index 519283a2..3a8231d7 100644
--- a/gui/MemcardDlg.h
+++ b/gui/MemcardDlg.h
@@ -19,6 +19,6 @@
#ifndef MEMCARDDLG_H
#define MEMCARDDLG_H
-void OnConf_Mcds();
+void OnConf_Mcds(void);
#endif
diff --git a/gui/Plugin.c b/gui/Plugin.c
index 67ef1472..8ed74465 100644
--- a/gui/Plugin.c
+++ b/gui/Plugin.c
@@ -31,19 +31,19 @@
#include "nopic.h"
+#include "cdrom.h"
+
#define MAX_SLOTS 9 /* ADB TODO Same as Gtk2Gui.c */
void OnFile_Exit();
-extern void LidInterrupt();
-
unsigned long gpuDisp;
int StatesC = 0;
extern int UseGui;
int ShowPic = 0;
-void gpuShowPic() {
+static void gpuShowPic() {
gchar *state_filename;
gzFile f;
@@ -79,7 +79,7 @@ void gpuShowPic() {
}
}
-void KeyStateSave(int i) {
+static void KeyStateSave(int i) {
gchar *state_filename;
state_filename = get_state_filename (i);
@@ -88,7 +88,7 @@ void KeyStateSave(int i) {
g_free (state_filename);
}
-void KeyStateLoad(int i) {
+static void KeyStateLoad(int i) {
gchar *state_filename;
state_filename = get_state_filename (i);
@@ -259,13 +259,13 @@ void PADhandleKey(int key) {
break;
case XK_F9:
SetCdOpenCaseTime(-1);
-
- LidInterrupt();
+
+ LidInterrupt();
break;
case XK_F10:
SetCdOpenCaseTime(0);
-
- LidInterrupt();
+
+ LidInterrupt();
break;
case XK_F12:
psxReset();
@@ -299,7 +299,7 @@ void PADhandleKey(int key) {
void OnFile_Exit();
-void SignalExit(int sig) {
+static void SignalExit(int sig) {
ClosePlugins();
OnFile_Exit();
}
@@ -311,7 +311,7 @@ void SignalExit(int sig) {
strcpy(dst, ptr+1); \
}
-int _OpenPlugins() {
+static int _OpenPlugins() {
int ret;
signal(SIGINT, SignalExit);
diff --git a/gui/nopic.h b/gui/nopic.h
index 553cede5..b4296c1b 100644
--- a/gui/nopic.h
+++ b/gui/nopic.h
@@ -234,7 +234,7 @@ unsigned char cFont[10][120]=
////////////////////////////////////////////////////////////////////////
-void PaintPicDot(unsigned char * p,unsigned char c)
+static void PaintPicDot(unsigned char * p,unsigned char c)
{
if(c==0) {*p++=0x00;*p++=0x00;*p=0x00;return;} // black
@@ -246,7 +246,7 @@ void PaintPicDot(unsigned char * p,unsigned char c)
/////////////////////////////////////////////////////////////////////
// generic number/border painter
-void DrawNumBorPic(unsigned char *pMem, int lSelectedSlot)
+static void DrawNumBorPic(unsigned char *pMem, int lSelectedSlot)
{
unsigned char *pf;
int x,y;