mirror of https://github.com/PCSX2/pcsx2.git
[spu2null, gsnull, padnull]: Use the same configuration interface as others null plugins. Drop the glade dependency ^^
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@3194 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
parent
6a79fef67a
commit
080d68927e
|
@ -100,6 +100,10 @@ void SysPrintf(const char *fmt, ...)
|
|||
}
|
||||
|
||||
// basic funcs
|
||||
EXPORT_C_(void) GSsetSettingsDir(const char* dir)
|
||||
{
|
||||
s_strIniPath = (dir == NULL) ? "inis/" : dir;
|
||||
}
|
||||
|
||||
EXPORT_C_(s32) GSinit()
|
||||
{
|
||||
|
|
|
@ -32,6 +32,7 @@ typedef struct _keyEvent keyEvent;
|
|||
|
||||
#define GSdefs
|
||||
#include "PS2Edefs.h"
|
||||
#include "PS2Eext.h"
|
||||
|
||||
#include "Registers.h"
|
||||
#include "null/GSnull.h"
|
||||
|
|
|
@ -44,6 +44,7 @@ extern "C"
|
|||
|
||||
GtkWidget *MsgDlg, *About, *Conf;
|
||||
extern string s_strIniPath;
|
||||
PluginConf Ini;
|
||||
|
||||
void OnMsg_Ok()
|
||||
{
|
||||
|
@ -121,12 +122,9 @@ void OnConf_Cancel(GtkButton *button, gpointer user_data)
|
|||
|
||||
void CFGconfigure()
|
||||
{
|
||||
Conf = create_Config();
|
||||
|
||||
LoadConfig();
|
||||
|
||||
gtk_widget_show_all(Conf);
|
||||
gtk_main();
|
||||
PluginNullConfigure("Since this is a null plugin, all that is really configurable is logging.", conf.Log);
|
||||
SaveConfig();
|
||||
}
|
||||
|
||||
long CFGmessage(char *msg) {
|
||||
|
@ -137,35 +135,29 @@ long CFGmessage(char *msg) {
|
|||
|
||||
void LoadConfig()
|
||||
{
|
||||
FILE *f;
|
||||
char cfg[255];
|
||||
const std::string iniFile(s_strIniPath + "/GSNull.ini");
|
||||
|
||||
strcpy(cfg, s_strIniPath.c_str());
|
||||
f = fopen(cfg, "r");
|
||||
if (f == NULL)
|
||||
if (!Ini.Open(iniFile, READ_FILE))
|
||||
{
|
||||
printf("failed to open %s\n", s_strIniPath.c_str());
|
||||
printf("failed to open %s\n", iniFile.c_str());
|
||||
SaveConfig();//save and return
|
||||
return;
|
||||
}
|
||||
//fscanf(f, "options = %hhx\n", &confOptions);
|
||||
fclose(f);
|
||||
|
||||
conf.Log = Ini.ReadInt("logging", 0);
|
||||
Ini.Close();
|
||||
}
|
||||
|
||||
void SaveConfig()
|
||||
{
|
||||
FILE *f;
|
||||
char cfg[255];
|
||||
const std::string iniFile(s_strIniPath + "/GSNull.ini");
|
||||
|
||||
strcpy(cfg, s_strIniPath.c_str());
|
||||
f = fopen(cfg,"w");
|
||||
if (f == NULL)
|
||||
if (!Ini.Open(iniFile, WRITE_FILE))
|
||||
{
|
||||
printf("failed to open %s\n", s_strIniPath.c_str());
|
||||
printf("failed to open %s\n", iniFile.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
//fprintf(f, "options = %hhx\n", confOptions);
|
||||
fclose(f);
|
||||
Ini.WriteInt("logging", conf.Log);
|
||||
Ini.Close();
|
||||
}
|
||||
|
||||
|
|
|
@ -44,6 +44,7 @@ extern "C"
|
|||
|
||||
GtkWidget *MsgDlg, *About, *Conf;
|
||||
extern string s_strIniPath;
|
||||
PluginConf Ini;
|
||||
|
||||
void OnMsg_Ok()
|
||||
{
|
||||
|
@ -124,45 +125,36 @@ void OnConf_Cancel(GtkButton *button, gpointer user_data)
|
|||
EXPORT_C_(void) PADconfigure()
|
||||
{
|
||||
LoadConfig();
|
||||
Conf = create_Config();
|
||||
|
||||
set_checked(Conf, "check_logging", conf.Log);
|
||||
gtk_widget_show_all(Conf);
|
||||
gtk_main();
|
||||
PluginNullConfigure("Since this is a null plugin, all that is really configurable is logging.", conf.Log);
|
||||
SaveConfig();
|
||||
}
|
||||
|
||||
void LoadConfig()
|
||||
{
|
||||
FILE *f;
|
||||
char cfg[255];
|
||||
const std::string iniFile(s_strIniPath + "/Padnull.ini");
|
||||
|
||||
strcpy(cfg, s_strIniPath.c_str());
|
||||
f = fopen(cfg, "r");
|
||||
if (f == NULL)
|
||||
if (!Ini.Open(iniFile, READ_FILE))
|
||||
{
|
||||
printf("failed to open %s\n", s_strIniPath.c_str());
|
||||
printf("failed to open %s\n", iniFile.c_str());
|
||||
SaveConfig();//save and return
|
||||
return;
|
||||
}
|
||||
fscanf(f, "logging = %hhx\n", &conf.Log);
|
||||
//fscanf(f, "options = %hhx\n", &confOptions);
|
||||
fclose(f);
|
||||
|
||||
conf.Log = Ini.ReadInt("logging", 0);
|
||||
Ini.Close();
|
||||
}
|
||||
|
||||
void SaveConfig()
|
||||
{
|
||||
FILE *f;
|
||||
char cfg[255];
|
||||
const std::string iniFile(s_strIniPath + "/Padnull.ini");
|
||||
|
||||
strcpy(cfg, s_strIniPath.c_str());
|
||||
f = fopen(cfg,"w");
|
||||
if (f == NULL)
|
||||
if (!Ini.Open(iniFile, WRITE_FILE))
|
||||
{
|
||||
printf("failed to open '%s'\n", s_strIniPath.c_str());
|
||||
printf("failed to open %s\n", iniFile.c_str());
|
||||
return;
|
||||
}
|
||||
fprintf(f, "logging = %hhx\n", conf.Log);
|
||||
//fprintf(f, "options = %hhx\n", confOptions);
|
||||
fclose(f);
|
||||
|
||||
Ini.WriteInt("logging", conf.Log);
|
||||
Ini.Close();
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ const u8 revision = 0;
|
|||
const u8 build = 1; // increase that with each version
|
||||
|
||||
static char *libraryName = "Padnull Driver";
|
||||
string s_strIniPath="inis/Padnull.ini";
|
||||
string s_strIniPath="inis/";
|
||||
|
||||
FILE *padLog;
|
||||
Config conf;
|
||||
|
@ -71,6 +71,11 @@ void __LogToConsole(const char *fmt, ...)
|
|||
va_end(list);
|
||||
}
|
||||
|
||||
EXPORT_C_(void) PADsetSettingsDir(const char* dir)
|
||||
{
|
||||
s_strIniPath = (dir == NULL) ? "inis/" : dir;
|
||||
}
|
||||
|
||||
EXPORT_C_(s32) PADinit(u32 flags)
|
||||
{
|
||||
LoadConfig();
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
#define PADdefs
|
||||
#include "PS2Edefs.h"
|
||||
#include "PS2Eext.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#include "PadWin.h"
|
||||
|
|
|
@ -35,6 +35,8 @@ extern "C"
|
|||
using namespace std;
|
||||
|
||||
GtkWidget *MsgDlg, *About, *Conf;
|
||||
extern string s_strIniPath;
|
||||
PluginConf Ini;
|
||||
|
||||
void OnMsg_Ok()
|
||||
{
|
||||
|
@ -107,15 +109,9 @@ void OnConf_Cancel(GtkButton *button, gpointer user_data)
|
|||
|
||||
EXPORT_C_(void) SPU2configure()
|
||||
{
|
||||
//SysMessage("Nothing to Configure");
|
||||
|
||||
Conf = create_Config();
|
||||
|
||||
LoadConfig();
|
||||
|
||||
set_checked(Conf, "check_logging", conf.Log);
|
||||
gtk_widget_show_all(Conf);
|
||||
gtk_main();
|
||||
LoadConfig();
|
||||
PluginNullConfigure("Since this is a null plugin, all that is really configurable is logging.", conf.Log);
|
||||
SaveConfig();
|
||||
}
|
||||
|
||||
EXPORT_C_(void) SPU2about()
|
||||
|
@ -129,36 +125,29 @@ EXPORT_C_(void) SPU2about()
|
|||
|
||||
void LoadConfig()
|
||||
{
|
||||
FILE *f;
|
||||
char cfg[255];
|
||||
const std::string iniFile(s_strIniPath + "/Spu2null.ini");
|
||||
|
||||
strcpy(cfg, s_strIniPath.c_str());
|
||||
f = fopen(cfg, "r");
|
||||
if (f == NULL)
|
||||
if (!Ini.Open(iniFile, READ_FILE))
|
||||
{
|
||||
printf("failed to open %s\n", s_strIniPath.c_str());
|
||||
printf("failed to open %s\n", iniFile.c_str());
|
||||
SaveConfig();//save and return
|
||||
return;
|
||||
}
|
||||
fscanf(f, "logging = %hhx\n", &conf.Log);
|
||||
//fscanf(f, "options = %hhx\n", &confOptions);
|
||||
fclose(f);
|
||||
|
||||
conf.Log = Ini.ReadInt("logging", 0);
|
||||
Ini.Close();
|
||||
}
|
||||
|
||||
void SaveConfig()
|
||||
{
|
||||
FILE *f;
|
||||
char cfg[255];
|
||||
const std::string iniFile(s_strIniPath + "/Spu2null.ini");
|
||||
|
||||
strcpy(cfg, s_strIniPath.c_str());
|
||||
f = fopen(cfg,"w");
|
||||
if (f == NULL)
|
||||
if (!Ini.Open(iniFile, WRITE_FILE))
|
||||
{
|
||||
printf("failed to open %s\n", s_strIniPath.c_str());
|
||||
printf("failed to open %s\n", iniFile.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
fprintf(f, "logging = %hhx\n", conf.Log);
|
||||
//fprintf(f, "options = %hhx\n", confOptions);
|
||||
fclose(f);
|
||||
Ini.WriteInt("logging", conf.Log);
|
||||
Ini.Close();
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ char *libraryName = "SPU2null (Debug)";
|
|||
#else
|
||||
char *libraryName = "SPU2null ";
|
||||
#endif
|
||||
string s_strIniPath="inis/SPU2null.ini";
|
||||
string s_strIniPath="inis/";
|
||||
|
||||
FILE *spu2Log;
|
||||
Config conf;
|
||||
|
@ -109,6 +109,11 @@ void __Log(char *fmt, ...)
|
|||
va_end(list);
|
||||
}
|
||||
|
||||
EXPORT_C_(void) SPU2setSettingsDir(const char* dir)
|
||||
{
|
||||
s_strIniPath = (dir == NULL) ? "inis/" : dir;
|
||||
}
|
||||
|
||||
EXPORT_C_(s32) SPU2init()
|
||||
{
|
||||
#ifdef SPU2_LOG
|
||||
|
|
|
@ -29,6 +29,7 @@ extern "C"
|
|||
#define SPU2defs
|
||||
#include "PS2Edefs.h"
|
||||
}
|
||||
#include "PS2Eext.h"
|
||||
|
||||
#ifdef __LINUX__
|
||||
#include <gtk/gtk.h>
|
||||
|
|
Loading…
Reference in New Issue