PAD: fix ini saving

This commit is contained in:
Gauvain 'GovanifY' Roussel-Tarbouriech 2020-12-11 05:19:15 +01:00 committed by lightningterror
parent 8f7b9f609f
commit a90d588167
4 changed files with 10 additions and 14 deletions

View File

@ -39,7 +39,6 @@ PADconf g_conf;
keyEvent event; keyEvent event;
static keyEvent s_event; static keyEvent s_event;
std::string s_padstrIniPath("inis/");
std::string s_padstrLogPath("logs/"); std::string s_padstrLogPath("logs/");
FILE* padLog = NULL; FILE* padLog = NULL;
@ -124,12 +123,6 @@ s32 PADopen(void* pDsp)
return _PADopen(pDsp); return _PADopen(pDsp);
} }
void PADsetSettingsDir(const char* dir)
{
// Get the path to the ini directory.
s_padstrIniPath = (dir == NULL) ? "inis/" : dir;
}
void PADsetLogDir(const char* dir) void PADsetLogDir(const char* dir)
{ {
// Get the path to the log directory. // Get the path to the log directory.

View File

@ -127,7 +127,6 @@ void SysMessage(char* fmt, ...);
s32 PADinit(); s32 PADinit();
void PADshutdown(); void PADshutdown();
s32 PADopen(void* pDsp); s32 PADopen(void* pDsp);
void PADsetSettingsDir(const char* dir);
void PADsetLogDir(const char* dir); void PADsetLogDir(const char* dir);
void PADclose(); void PADclose();
u32 PADquery(); u32 PADquery();

View File

@ -17,10 +17,9 @@
#include "GamePad.h" #include "GamePad.h"
#include "keyboard.h" #include "keyboard.h"
#include "AppConfig.h"
#include "PAD.h" #include "PAD.h"
extern std::string s_padstrIniPath;
void DefaultKeyboardValues() void DefaultKeyboardValues()
{ {
set_keyboard_key(0, XK_a, PAD_L2); set_keyboard_key(0, XK_a, PAD_L2);
@ -43,7 +42,8 @@ void PADSaveConfig()
{ {
FILE* f; FILE* f;
const std::string iniFile(s_padstrIniPath + "PAD.ini"); wxString iniName(L"PAD.ini");
const std::string iniFile = std::string(GetSettingsFolder().Combine(iniName).GetFullPath()); // default path, just in case
f = fopen(iniFile.c_str(), "w"); f = fopen(iniFile.c_str(), "w");
if (f == NULL) if (f == NULL)
{ {
@ -76,7 +76,9 @@ void PADLoadConfig()
g_conf.init(); g_conf.init();
const std::string iniFile(s_padstrIniPath + "PAD.ini");
wxString iniName(L"PAD.ini");
const std::string iniFile = std::string(GetSettingsFolder().Combine(iniName).GetFullPath()); // default path, just in case
f = fopen(iniFile.c_str(), "r"); f = fopen(iniFile.c_str(), "r");
if (f == NULL) if (f == NULL)
{ {

View File

@ -18,11 +18,13 @@
#include "PAD.h" #include "PAD.h"
#if defined(__unix__) || defined(__APPLE__)
#include <X11/Xlib.h> #include <X11/Xlib.h>
#include <X11/Xutil.h> #include <X11/Xutil.h>
#include <X11/keysym.h> #include <X11/keysym.h>
// x11 is dumb like that
#if defined(__unix__) || defined(__APPLE__) #undef DisableScreenSaver
extern void AnalyzeKeyEvent(keyEvent& evt); extern void AnalyzeKeyEvent(keyEvent& evt);
extern void UpdateKeyboardInput(); extern void UpdateKeyboardInput();