mirror of https://github.com/PCSX2/pcsx2.git
ZeroGS: Add support for GSsetSettingsDir.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2371 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
parent
a3edb9798c
commit
6c75ee61e5
|
@ -743,4 +743,8 @@ inline float Clamp(float fx, float fmin, float fmax)
|
|||
return fx > fmax ? fmax : fx;
|
||||
}
|
||||
|
||||
#include <string>
|
||||
|
||||
extern std::string s_strIniPath;
|
||||
|
||||
#endif
|
||||
|
|
|
@ -62,6 +62,8 @@ u8* g_pBasePS2Mem = NULL;
|
|||
int g_TransferredToGPU = 0;
|
||||
int g_GameSettings = 0;
|
||||
|
||||
std::string s_strIniPath( "inis/" );
|
||||
|
||||
static LARGE_INTEGER luPerfFreq;
|
||||
|
||||
// statistics
|
||||
|
@ -155,6 +157,10 @@ void __LogToConsole(const char *fmt, ...) {
|
|||
va_end(list);
|
||||
}
|
||||
|
||||
void CALLBACK GSsetSettingsDir(const char* dir) {
|
||||
s_strIniPath = (dir==NULL) ? "inis/" : dir;
|
||||
}
|
||||
|
||||
void CALLBACK GSsetBaseMem(void* pmem) {
|
||||
g_pBasePS2Mem = (u8*)pmem;
|
||||
}
|
||||
|
|
|
@ -9,39 +9,28 @@
|
|||
|
||||
extern HINSTANCE hInst;
|
||||
|
||||
|
||||
void SaveConfig() {
|
||||
|
||||
char *szTemp;
|
||||
char szIniFile[256], szValue[256];
|
||||
|
||||
GetModuleFileName(GetModuleHandle((LPCSTR)hInst), szIniFile, 256);
|
||||
szTemp = strrchr(szIniFile, '\\');
|
||||
|
||||
if(!szTemp) return;
|
||||
strcpy(szTemp, "\\inis\\zerogs.ini");
|
||||
char szValue[256];
|
||||
const std::string iniFile( s_strIniPath + "zerogs.ini" );
|
||||
|
||||
sprintf(szValue,"%u",conf.interlace);
|
||||
WritePrivateProfileString("Settings", "Interlace",szValue,szIniFile);
|
||||
WritePrivateProfileString("Settings", "Interlace",szValue,iniFile.c_str());
|
||||
sprintf(szValue,"%u",conf.aa);
|
||||
WritePrivateProfileString("Settings", "Antialiasing",szValue,szIniFile);
|
||||
WritePrivateProfileString("Settings", "Antialiasing",szValue,iniFile.c_str());
|
||||
sprintf(szValue,"%u",conf.bilinear);
|
||||
WritePrivateProfileString("Settings", "Bilinear",szValue,szIniFile);
|
||||
WritePrivateProfileString("Settings", "Bilinear",szValue,iniFile.c_str());
|
||||
sprintf(szValue,"%u",conf.options);
|
||||
WritePrivateProfileString("Settings", "Options",szValue,szIniFile);
|
||||
WritePrivateProfileString("Settings", "Options",szValue,iniFile.c_str());
|
||||
sprintf(szValue,"%u",conf.gamesettings);
|
||||
WritePrivateProfileString("Settings", "AdvancedOptions",szValue,szIniFile);
|
||||
WritePrivateProfileString("Settings", "AdvancedOptions",szValue,iniFile.c_str());
|
||||
}
|
||||
|
||||
void LoadConfig() {
|
||||
|
||||
FILE *fp;
|
||||
char *szTemp;
|
||||
char szIniFile[256], szValue[256];
|
||||
char szValue[256];
|
||||
const std::string iniFile( s_strIniPath + "zerogs.ini" );
|
||||
|
||||
GetModuleFileName(GetModuleHandle((LPCSTR)hInst), szIniFile, 256);
|
||||
szTemp = strrchr(szIniFile, '\\');
|
||||
|
||||
memset(&conf, 0, sizeof(conf));
|
||||
conf.interlace = 0; // on, mode 1
|
||||
conf.mrtdepth = 1;
|
||||
|
@ -50,26 +39,24 @@ void LoadConfig() {
|
|||
conf.width = 640;
|
||||
conf.height = 480;
|
||||
|
||||
if(!szTemp) return ;
|
||||
strcpy(szTemp, "\\inis\\zerogs.ini");
|
||||
fp=fopen("inis\\zerogs.ini","rt");
|
||||
FILE *fp=fopen(iniFile.c_str(),"rt");
|
||||
if (!fp)
|
||||
{
|
||||
CreateDirectory("inis",NULL);
|
||||
CreateDirectory(s_strIniPath.c_str(),NULL);
|
||||
SaveConfig();//save and return
|
||||
return ;
|
||||
}
|
||||
fclose(fp);
|
||||
|
||||
GetPrivateProfileString("Settings", "Interlace", NULL, szValue, 20, szIniFile);
|
||||
GetPrivateProfileString("Settings", "Interlace", NULL, szValue, 20, iniFile.c_str());
|
||||
conf.interlace = (u8)strtoul(szValue, NULL, 10);
|
||||
GetPrivateProfileString("Settings", "Antialiasing", NULL, szValue, 20, szIniFile);
|
||||
GetPrivateProfileString("Settings", "Antialiasing", NULL, szValue, 20, iniFile.c_str());
|
||||
conf.aa = (u8)strtoul(szValue, NULL, 10);
|
||||
GetPrivateProfileString("Settings", "Options", NULL, szValue, 20, szIniFile);
|
||||
GetPrivateProfileString("Settings", "Options", NULL, szValue, 20, iniFile.c_str());
|
||||
conf.options = strtoul(szValue, NULL, 10);
|
||||
GetPrivateProfileString("Settings", "AdvancedOptions", NULL, szValue, 20, szIniFile);
|
||||
GetPrivateProfileString("Settings", "AdvancedOptions", NULL, szValue, 20, iniFile.c_str());
|
||||
conf.gamesettings = strtoul(szValue, NULL, 10);
|
||||
GetPrivateProfileString("Settings", "Bilinear", NULL, szValue, 20, szIniFile);
|
||||
GetPrivateProfileString("Settings", "Bilinear", NULL, szValue, 20, iniFile.c_str());
|
||||
conf.bilinear = strtoul(szValue, NULL, 10);
|
||||
|
||||
if( conf.aa < 0 || conf.aa > 4 ) conf.aa = 0;
|
||||
|
|
|
@ -64,6 +64,8 @@ extern "C" char* CALLBACK PS2EgetLibName(void);
|
|||
#include <string>
|
||||
using namespace std;
|
||||
|
||||
extern std::string s_strIniPath;
|
||||
|
||||
extern u32 THR_KeyEvent; // value for passing out key events beetwen threads
|
||||
extern bool THR_bShift;
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ int g_GSMultiThreaded = 0;
|
|||
void (*GSirq)();
|
||||
u8* g_pBasePS2Mem = NULL;
|
||||
int g_TransferredToGPU = 0;
|
||||
string s_strIniPath="inis/zerogs.ini";
|
||||
std::string s_strIniPath("inis/");
|
||||
|
||||
static BOOL g_bHidden = 0;
|
||||
int g_GameSettings = 0;
|
||||
|
@ -157,6 +157,10 @@ void __LogToConsole(const char *fmt, ...) {
|
|||
va_end(list);
|
||||
}
|
||||
|
||||
void CALLBACK GSsetSettingsDir(const char* dir) {
|
||||
s_strIniPath = (dir==NULL) ? "inis/" : dir;
|
||||
}
|
||||
|
||||
void CALLBACK GSsetBaseMem(void* pmem) {
|
||||
g_pBasePS2Mem = (u8*)pmem;
|
||||
}
|
||||
|
|
|
@ -24,18 +24,14 @@
|
|||
#include <string.h>
|
||||
#include "GS.h"
|
||||
|
||||
extern string s_strIniPath;
|
||||
|
||||
void SaveConfig()
|
||||
{
|
||||
FILE *f;
|
||||
char cfg[255];
|
||||
const std::string iniFile( s_strIniPath + "zerogs.ini" );
|
||||
|
||||
strcpy(cfg, s_strIniPath.c_str());
|
||||
f = fopen(cfg,"w");
|
||||
FILE* f = fopen(iniFile.c_str(),"w");
|
||||
if (f == NULL)
|
||||
{
|
||||
printf("failed to open %s\n", s_strIniPath.c_str());
|
||||
printf("failed to open %s\n", iniFile.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -50,7 +46,6 @@ void SaveConfig()
|
|||
|
||||
void LoadConfig()
|
||||
{
|
||||
FILE *f;
|
||||
char cfg[255];
|
||||
|
||||
memset(&conf, 0, sizeof(conf));
|
||||
|
@ -62,11 +57,11 @@ void LoadConfig()
|
|||
conf.height = 480;
|
||||
conf.aa = 0;
|
||||
|
||||
strcpy(cfg, s_strIniPath.c_str());
|
||||
f = fopen(cfg, "r");
|
||||
const std::string iniFile( s_strIniPath + "zerogs.ini" );
|
||||
FILE* f = fopen(iniFile.c_str(), "r");
|
||||
if (f == NULL)
|
||||
{
|
||||
printf("failed to open %s\n", s_strIniPath.c_str());
|
||||
printf("failed to open %s\n", iniFile.c_str());
|
||||
SaveConfig();//save and return
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -8,35 +8,25 @@ extern HINSTANCE hInst;
|
|||
|
||||
void SaveConfig() {
|
||||
|
||||
char *szTemp;
|
||||
char szIniFile[256], szValue[256];
|
||||
|
||||
GetModuleFileName(GetModuleHandle((LPCSTR)hInst), szIniFile, 256);
|
||||
szTemp = strrchr(szIniFile, '\\');
|
||||
|
||||
if(!szTemp) return;
|
||||
strcpy(szTemp, "\\inis\\zerogs.ini");
|
||||
char szValue[256];
|
||||
const std::string iniFile( s_strIniPath + "zerogs.ini" );
|
||||
|
||||
sprintf(szValue,"%u",conf.interlace);
|
||||
WritePrivateProfileString("Settings", "Interlace",szValue,szIniFile);
|
||||
WritePrivateProfileString("Settings", "Interlace",szValue,iniFile.c_str());
|
||||
sprintf(szValue,"%u",conf.aa);
|
||||
WritePrivateProfileString("Settings", "Antialiasing",szValue,szIniFile);
|
||||
WritePrivateProfileString("Settings", "Antialiasing",szValue,iniFile.c_str());
|
||||
sprintf(szValue,"%u",conf.bilinear);
|
||||
WritePrivateProfileString("Settings", "Bilinear",szValue,szIniFile);
|
||||
WritePrivateProfileString("Settings", "Bilinear",szValue,iniFile.c_str());
|
||||
sprintf(szValue,"%u",conf.options);
|
||||
WritePrivateProfileString("Settings", "Options",szValue,szIniFile);
|
||||
WritePrivateProfileString("Settings", "Options",szValue,iniFile.c_str());
|
||||
sprintf(szValue,"%u",conf.gamesettings);
|
||||
WritePrivateProfileString("Settings", "AdvancedOptions",szValue,szIniFile);
|
||||
WritePrivateProfileString("Settings", "AdvancedOptions",szValue,iniFile.c_str());
|
||||
}
|
||||
|
||||
void LoadConfig() {
|
||||
|
||||
FILE *fp;
|
||||
char *szTemp;
|
||||
char szIniFile[256], szValue[256];
|
||||
|
||||
GetModuleFileName(GetModuleHandle((LPCSTR)hInst), szIniFile, 256);
|
||||
szTemp = strrchr(szIniFile, '\\');
|
||||
char szValue[256];
|
||||
const std::string iniFile( s_strIniPath + "zerogs.ini" );
|
||||
|
||||
memset(&conf, 0, sizeof(conf));
|
||||
conf.interlace = 0; // on, mode 1
|
||||
|
@ -46,26 +36,24 @@ void LoadConfig() {
|
|||
conf.width = 640;
|
||||
conf.height = 480;
|
||||
|
||||
if(!szTemp) return ;
|
||||
strcpy(szTemp, "\\inis\\zerogs.ini");
|
||||
fp=fopen("inis\\zerogs.ini","rt");
|
||||
FILE *fp=fopen(iniFile.c_str(),"rt");
|
||||
if (!fp)
|
||||
{
|
||||
CreateDirectory("inis",NULL);
|
||||
CreateDirectory(s_strIniPath.c_str(),NULL);
|
||||
SaveConfig();//save and return
|
||||
return ;
|
||||
}
|
||||
fclose(fp);
|
||||
|
||||
GetPrivateProfileString("Settings", "Interlace", NULL, szValue, 20, szIniFile);
|
||||
GetPrivateProfileString("Settings", "Interlace", NULL, szValue, 20, iniFile.c_str());
|
||||
conf.interlace = (u8)strtoul(szValue, NULL, 10);
|
||||
GetPrivateProfileString("Settings", "Antialiasing", NULL, szValue, 20, szIniFile);
|
||||
GetPrivateProfileString("Settings", "Antialiasing", NULL, szValue, 20, iniFile.c_str());
|
||||
conf.aa = (u8)strtoul(szValue, NULL, 10);
|
||||
GetPrivateProfileString("Settings", "Options", NULL, szValue, 20, szIniFile);
|
||||
GetPrivateProfileString("Settings", "Options", NULL, szValue, 20, iniFile.c_str());
|
||||
conf.options = strtoul(szValue, NULL, 10);
|
||||
GetPrivateProfileString("Settings", "AdvancedOptions", NULL, szValue, 20, szIniFile);
|
||||
GetPrivateProfileString("Settings", "AdvancedOptions", NULL, szValue, 20, iniFile.c_str());
|
||||
conf.gamesettings = strtoul(szValue, NULL, 10);
|
||||
GetPrivateProfileString("Settings", "Bilinear", NULL, szValue, 20, szIniFile);
|
||||
GetPrivateProfileString("Settings", "Bilinear", NULL, szValue, 20, iniFile.c_str());
|
||||
conf.bilinear = strtoul(szValue, NULL, 10);
|
||||
|
||||
if( conf.aa < 0 || conf.aa > 2 ) conf.aa = 0;
|
||||
|
|
|
@ -33,4 +33,5 @@ EXPORTS
|
|||
GSsetFrameSkip @35
|
||||
GSsetGameCRC @36
|
||||
GSgetLastTag @37
|
||||
GSsetupRecording @38
|
||||
GSsetupRecording @38
|
||||
GSsetSettingsDir @38
|
Loading…
Reference in New Issue