From d7ac8fd81cc903b67b30b5cb6afb024b8fc2cfa6 Mon Sep 17 00:00:00 2001 From: arcum42 Date: Sat, 22 May 2010 03:02:37 +0000 Subject: [PATCH] zeropad: patch the ini settings as well. git-svn-id: http://pcsx2.googlecode.com/svn/trunk@3055 96395faa-99c1-11dd-bbfe-3dabce05a288 --- plugins/zeropad/Linux/gui.cpp | 12 +++++------- plugins/zeropad/Linux/linux.cpp | 5 ----- plugins/zeropad/zeropad.cpp | 15 +++++++-------- 3 files changed, 12 insertions(+), 20 deletions(-) diff --git a/plugins/zeropad/Linux/gui.cpp b/plugins/zeropad/Linux/gui.cpp index ad063f869d..071c313121 100644 --- a/plugins/zeropad/Linux/gui.cpp +++ b/plugins/zeropad/Linux/gui.cpp @@ -41,10 +41,9 @@ void SaveConfig() { int i, j; FILE *f; - char cfg[255]; - - strcpy(cfg, s_strIniPath.c_str()); - f = fopen(cfg, "w"); + + const std::string iniFile(s_strIniPath + "zeropad.ini"); + f = fopen(iniFile.c_str(), "w"); if (f == NULL) { printf("ZeroPAD: failed to save ini %s\n", s_strIniPath.c_str()); @@ -67,7 +66,6 @@ void LoadConfig() { FILE *f; char str[256]; - char cfg[255]; int i, j; memset(&conf, 0, sizeof(conf)); @@ -87,8 +85,8 @@ void LoadConfig() conf.keys[0][15] = XK_s; // LEFT conf.log = 0; - strcpy(cfg, s_strIniPath.c_str()); - f = fopen(cfg, "r"); + const std::string iniFile(s_strIniPath + "zeropad.ini"); + f = fopen(iniFile.c_str(), "r"); if (f == NULL) { printf("ZeroPAD: failed to load ini %s\n", s_strIniPath.c_str()); diff --git a/plugins/zeropad/Linux/linux.cpp b/plugins/zeropad/Linux/linux.cpp index bef5c72d40..a042a11027 100644 --- a/plugins/zeropad/Linux/linux.cpp +++ b/plugins/zeropad/Linux/linux.cpp @@ -369,11 +369,6 @@ void OnConf_Key(GtkButton *button, gpointer user_data) void CALLBACK PADconfigure() { - char strcurdir[256]; - getcwd(strcurdir, 256); - s_strIniPath = strcurdir; - s_strIniPath += "/inis/zeropad.ini"; - LoadConfig(); Conf = create_Conf(); diff --git a/plugins/zeropad/zeropad.cpp b/plugins/zeropad/zeropad.cpp index e2ebc8061c..1acfd90614 100644 --- a/plugins/zeropad/zeropad.cpp +++ b/plugins/zeropad/zeropad.cpp @@ -40,7 +40,7 @@ keyEvent event; u16 status[2]; int pressure; static keyEvent s_event; -string s_strIniPath = "inis/zeropad.ini"; +string s_strIniPath = "inis"; const u32 version = PS2E_PAD_VERSION; const u32 revision = 0; @@ -232,13 +232,6 @@ s32 CALLBACK PADinit(u32 flags) status[0] = 0xffff; status[1] = 0xffff; -#ifdef __LINUX__ - char strcurdir[256]; - getcwd(strcurdir, 256); - s_strIniPath = strcurdir; - s_strIniPath += "/inis/zeropad.ini"; -#endif - LoadConfig(); PADsetMode(0, 0); @@ -275,6 +268,12 @@ s32 CALLBACK PADopen(void *pDsp) return _PADopen(pDsp); } +void CALLBACK PADsetSettingsDir(const char* dir) +{ + // Get the path to the ini directory. + s_strIniPath = (dir==NULL) ? "inis/" : dir; +} + void CALLBACK PADclose() { pthread_spin_destroy(&s_mutexStatus);