From db51fade6de9461e7a139da2bf5887a9a6569506 Mon Sep 17 00:00:00 2001 From: Stelios Tsampas Date: Thu, 20 Jul 2017 13:04:40 +0300 Subject: * dfinput: Fix possible buffer overflows in the ui. --- plugins/dfinput/pad.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'plugins/dfinput/pad.c') diff --git a/plugins/dfinput/pad.c b/plugins/dfinput/pad.c index bd3aef73..8861ec4d 100755 --- a/plugins/dfinput/pad.c +++ b/plugins/dfinput/pad.c @@ -17,11 +17,15 @@ */ #include "pad.h" -#if !SDL_VERSION_ATLEAST(2,0,0) && defined(__linux__) +#if defined(__linux__) +#include +#include +#if !SDL_VERSION_ATLEAST(2,0,0) #include #include #include #endif +#endif #if SDL_VERSION_ATLEAST(2,0,0) int has_haptic; @@ -121,11 +125,13 @@ long PADopen(unsigned long *Disp) { } #if SDL_VERSION_ATLEAST(2,0,0) - SDL_InitSubSystem(SDL_INIT_GAMECONTROLLER); - - has_haptic = 0; - if (SDL_InitSubSystem(SDL_INIT_HAPTIC) == 0) - has_haptic = 1; + SDL_QuitSubSystem(SDL_INIT_JOYSTICK); + if (SDL_InitSubSystem(SDL_INIT_GAMECONTROLLER) == -1) + return PSE_PAD_ERR_FAILURE; + + has_haptic = 0; + if (SDL_InitSubSystem(SDL_INIT_HAPTIC) == 0) + has_haptic = 1; #endif InitSDLJoy(); -- cgit v1.2.3 From b117a70fd03d780b5817c635d5c337c6ecc36d94 Mon Sep 17 00:00:00 2001 From: Stelios Tsampas Date: Fri, 28 Jul 2017 13:13:09 +0300 Subject: * Plugin.c: Add PGXP visual debug binding (F11) * GtkGui.c: Fix path saving in file selection dialog * LnxMain.c: Don't look for bios in data directory --- gui/GtkGui.c | 5 ++--- gui/LnxMain.c | 2 -- gui/Plugin.c | 5 +++++ plugins/dfinput/pad.c | 8 +++----- 4 files changed, 10 insertions(+), 10 deletions(-) (limited to 'plugins/dfinput/pad.c') diff --git a/gui/GtkGui.c b/gui/GtkGui.c index 970be43b..0fd6b65d 100755 --- a/gui/GtkGui.c +++ b/gui/GtkGui.c @@ -34,6 +34,7 @@ #include "../libpcsxcore/plugins.h" #include "../libpcsxcore/cheat.h" +#include "../libpcsxcore/cdrom.h" #include "MemcardDlg.h" #include "ConfDlg.h" @@ -775,11 +776,9 @@ static gchar *Open_Iso_Proc() { strncpy(current_folder, filename, strrchr(filename, '/') - filename); } - /* If ISO path is NULL save current path. */ - if (!S_ISDIR(sb.st_mode)) { + /* Save current path. */ strcpy(Config.IsoImgDir, current_folder); SaveConfig(); - } /* free useless data */ GSList * ll = l; diff --git a/gui/LnxMain.c b/gui/LnxMain.c index 716a3964..a7f934ae 100755 --- a/gui/LnxMain.c +++ b/gui/LnxMain.c @@ -232,9 +232,7 @@ static void ScanAllPlugins (void) { ScanBios("/usr/local/share/psemu/bios"); ScanBios("/usr/local/share/pcsxr"); ScanBios("/usr/local/share/pcsxr/bios"); - ScanBios(PACKAGE_DATA_DIR); ScanBios(PSEMU_DATA_DIR); - ScanBios(PACKAGE_DATA_DIR "/bios"); ScanBios(PSEMU_DATA_DIR "/bios"); currentdir = g_strconcat(getenv("HOME"), "/.psemu-plugins/", NULL); diff --git a/gui/Plugin.c b/gui/Plugin.c index 0adf3b5e..55068c31 100755 --- a/gui/Plugin.c +++ b/gui/Plugin.c @@ -30,6 +30,7 @@ #include "../libpcsxcore/plugins.h" #include "../libpcsxcore/spu.h" #include "../libpcsxcore/cdriso.h" +#include "../libpcsxcore/pgxp_mem.h" #include "nopic.h" @@ -241,6 +242,9 @@ void PADhandleKey(int key) { LidInterrupt(); break; + case XK_F11: + GPU_toggleDebug(); + break; case XK_F12: psxReset(); break; @@ -329,6 +333,7 @@ int _OpenPlugins() { SPU_registerCallback(SPUirq); ret = GPU_open(&gpuDisp, "PCSXR", NULL); if (ret < 0) { SysMessage(_("Error opening GPU plugin!")); return -1; } + GPU_pgxpMemory(0, PGXP_GetMem()); ret = PAD1_open(&gpuDisp); ret |= PAD1_init(1); // Allow setting to change during run if (ret < 0) { SysMessage(_("Error opening Controller 1 plugin!")); return -1; } diff --git a/plugins/dfinput/pad.c b/plugins/dfinput/pad.c index 8861ec4d..f413d0a4 100755 --- a/plugins/dfinput/pad.c +++ b/plugins/dfinput/pad.c @@ -125,9 +125,7 @@ long PADopen(unsigned long *Disp) { } #if SDL_VERSION_ATLEAST(2,0,0) - SDL_QuitSubSystem(SDL_INIT_JOYSTICK); - if (SDL_InitSubSystem(SDL_INIT_GAMECONTROLLER) == -1) - return PSE_PAD_ERR_FAILURE; + SDL_InitSubSystem(SDL_INIT_GAMECONTROLLER); has_haptic = 0; if (SDL_InitSubSystem(SDL_INIT_HAPTIC) == 0) @@ -497,7 +495,7 @@ unsigned char PADpoll(unsigned char value) { if (buf == NULL) { return 0; } - + switch (CurCmd) { case CMD_READ_DATA_AND_VIBRATE: if (g.cfg.PadDef[CurPad].Type == PSE_PAD_TYPE_ANALOGPAD) { @@ -516,7 +514,7 @@ unsigned char PADpoll(unsigned char value) { if (!JoyHapticRumble(CurPad, g.PadState[CurPad].VibF[0], g.PadState[CurPad].VibF[1])) { //gpuVisualVibration(g.PadState[CurPad].VibF[0], g.PadState[CurPad].VibF[1]); } - + if(gpuVisualVibration != NULL && g.cfg.PadDef[CurPad].VisualVibration) { gpuVisualVibration(g.PadState[CurPad].VibF[0], g.PadState[CurPad].VibF[1]); -- cgit v1.2.3