onepad: apply a patch to the ini settings.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@3054 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
arcum42 2010-05-22 02:52:47 +00:00
parent e3cc848a72
commit f67299ad83
5 changed files with 16 additions and 22 deletions

View File

@ -35,7 +35,6 @@ extern "C"
#include "callbacks.h"
}
extern string s_strIniPath;
GtkWidget *Conf, *About, *MsgDlg;
GtkWidget *s_devicecombo;

View File

@ -35,6 +35,8 @@ extern "C"
#include "callbacks.h"
}
extern std::string s_strIniPath;
string KeyName(int pad, int key)
{
string tmp;
@ -123,11 +125,11 @@ void SaveConfig()
FILE *f;
char cfg[255];
strcpy(cfg, s_strIniPath.c_str());
f = fopen(cfg, "w");
const std::string iniFile(s_strIniPath + "OnePAD.ini");
f = fopen(iniFile.c_str(), "w");
if (f == NULL)
{
printf("ZeroPAD: failed to save ini %s\n", s_strIniPath.c_str());
printf("ZeroPAD: failed to save ini %s\n", iniFile.c_str());
return;
}
@ -147,17 +149,16 @@ void LoadConfig()
{
FILE *f;
char str[256];
char cfg[255];
memset(&conf, 0, sizeof(conf));
DefaultValues();
conf.log = 0;
strcpy(cfg, s_strIniPath.c_str());
f = fopen(cfg, "r");
const std::string iniFile(s_strIniPath + "OnePAD.ini");
f = fopen(iniFile.c_str(), "r");
if (f == NULL)
{
printf("OnePAD: failed to load ini %s\n", s_strIniPath.c_str());
printf("OnePAD: failed to load ini %s\n", iniFile.c_str());
SaveConfig(); //save and return
return;
}

View File

@ -338,11 +338,6 @@ void OnConf_Key(GtkButton *button, gpointer user_data)
EXPORT_C_(void) PADconfigure()
{
char strcurdir[256];
getcwd(strcurdir, 256);
s_strIniPath = strcurdir;
s_strIniPath += "/inis/OnePAD.ini";
LoadConfig();
Conf = create_Conf();

View File

@ -37,7 +37,6 @@ extern "C"
}
extern GtkWidget *Conf, *s_devicecombo;
extern string s_strIniPath;
extern void init_tree_view();
extern void destroy_tree_view();

View File

@ -43,7 +43,7 @@ keyEvent event;
u16 status[2];
int pressure;
static keyEvent s_event;
string s_strIniPath = "inis/OnePAD.ini";
std::string s_strIniPath("inis/");
bool toggleAutoRepeat = true;
const u32 version = PS2E_PAD_VERSION;
@ -243,13 +243,6 @@ EXPORT_C_(s32) PADinit(u32 flags)
status[0] = 0xffff;
status[1] = 0xffff;
#ifdef __LINUX__
/*char strcurdir[256];
getcwd(strcurdir, 256);
s_strIniPath = strcurdir;
s_strIniPath += "/inis/OnePAD.ini";*/
#endif
LoadConfig();
PADsetMode(0, 0);
@ -286,6 +279,13 @@ EXPORT_C_(s32) 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;
}
EXPORT_C_(void) PADclose()
{
pthread_spin_destroy(&s_mutexStatus);