2010-03-19 00:31:15 +00:00
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
#include "GS.h"
|
|
|
|
#include "Win32.h"
|
2011-03-25 01:09:18 +00:00
|
|
|
#include "Utilities/Path.h"
|
2010-03-19 00:31:15 +00:00
|
|
|
|
|
|
|
extern HINSTANCE hInst;
|
|
|
|
|
|
|
|
|
2010-05-01 23:34:44 +00:00
|
|
|
void SaveConfig()
|
|
|
|
{
|
2010-12-25 04:38:44 +00:00
|
|
|
wxChar szValue[256];
|
2011-03-25 01:09:18 +00:00
|
|
|
const wxString iniFile(Path::Combine(s_strIniPath, L"zzogl-pg.ini"));
|
2010-12-25 04:38:44 +00:00
|
|
|
|
|
|
|
wxSprintf(szValue, L"%u", conf.interlace);
|
|
|
|
WritePrivateProfileString(L"Settings", L"Interlace", szValue, iniFile);
|
|
|
|
wxSprintf(szValue, L"%u", conf.aa);
|
|
|
|
WritePrivateProfileString(L"Settings", L"Antialiasing", szValue, iniFile);
|
|
|
|
wxSprintf(szValue, L"%u", conf.bilinear);
|
|
|
|
WritePrivateProfileString(L"Settings", L"Bilinear", szValue, iniFile);
|
|
|
|
wxSprintf(szValue, L"%u", conf.zz_options);
|
|
|
|
WritePrivateProfileString(L"Settings", L"ZZOptions", szValue, iniFile);
|
|
|
|
wxSprintf(szValue, L"%u", conf.hacks);
|
|
|
|
WritePrivateProfileString(L"Settings", L"AdvancedOptions", szValue, iniFile);
|
|
|
|
wxSprintf(szValue, L"%u", conf.width);
|
|
|
|
WritePrivateProfileString(L"Settings", L"Width", szValue, iniFile);
|
|
|
|
wxSprintf(szValue, L"%u", conf.height);
|
|
|
|
WritePrivateProfileString(L"Settings", L"Height", szValue, iniFile);
|
|
|
|
wxSprintf(szValue, L"%u", conf.SkipDraw);
|
|
|
|
WritePrivateProfileString(L"Settings", L"SkipDraw", szValue, iniFile);
|
2010-03-19 00:31:15 +00:00
|
|
|
}
|
|
|
|
|
2010-05-01 23:34:44 +00:00
|
|
|
void LoadConfig()
|
|
|
|
{
|
2010-12-25 04:38:44 +00:00
|
|
|
wxChar szValue[256];
|
2011-03-25 01:09:18 +00:00
|
|
|
const wxString iniFile(Path::Combine(s_strIniPath, L"zzogl-pg.ini"));
|
2010-03-19 00:31:15 +00:00
|
|
|
|
|
|
|
memset(&conf, 0, sizeof(conf));
|
|
|
|
conf.interlace = 0; // on, mode 1
|
|
|
|
conf.mrtdepth = 1;
|
2010-06-19 09:07:21 +00:00
|
|
|
conf.zz_options._u32 = 0;
|
|
|
|
conf.hacks._u32 = 0;
|
2010-03-19 00:31:15 +00:00
|
|
|
conf.bilinear = 1;
|
|
|
|
conf.width = 640;
|
|
|
|
conf.height = 480;
|
2010-10-03 12:35:57 +00:00
|
|
|
conf.SkipDraw = 0;
|
2010-10-09 07:32:33 +00:00
|
|
|
conf.disableHacks = 0;
|
2010-03-19 00:31:15 +00:00
|
|
|
|
2010-12-25 04:38:44 +00:00
|
|
|
FILE *fp = wxFopen(iniFile, L"rt");
|
2010-05-01 23:34:44 +00:00
|
|
|
|
2010-03-19 00:31:15 +00:00
|
|
|
if (!fp)
|
|
|
|
{
|
2010-07-24 08:08:42 +00:00
|
|
|
SysMessage("Unable to open ZZOgl-PG's ini file!");
|
2011-03-25 01:09:18 +00:00
|
|
|
CreateDirectory(s_strIniPath, NULL);
|
2010-03-19 00:31:15 +00:00
|
|
|
SaveConfig();//save and return
|
|
|
|
return ;
|
|
|
|
}
|
2010-05-01 23:34:44 +00:00
|
|
|
|
2010-03-19 00:31:15 +00:00
|
|
|
fclose(fp);
|
|
|
|
|
2010-12-25 04:38:44 +00:00
|
|
|
GetPrivateProfileString(L"Settings", L"Interlace", NULL, szValue, 20, iniFile);
|
|
|
|
conf.interlace = (u8)wxStrtoul(szValue, NULL, 10);
|
|
|
|
GetPrivateProfileString(L"Settings", L"Antialiasing", NULL, szValue, 20, iniFile);
|
|
|
|
conf.aa = (u8)wxStrtoul(szValue, NULL, 10);
|
|
|
|
GetPrivateProfileString(L"Settings", L"ZZOptions", NULL, szValue, 20, iniFile);
|
|
|
|
conf.zz_options._u32 = wxStrtoul(szValue, NULL, 10);
|
|
|
|
GetPrivateProfileString(L"Settings", L"AdvancedOptions", NULL, szValue, 20, iniFile);
|
|
|
|
conf.hacks._u32 = wxStrtoul(szValue, NULL, 10);
|
|
|
|
GetPrivateProfileString(L"Settings", L"Bilinear", NULL, szValue, 20, iniFile);
|
|
|
|
conf.bilinear = (u8)wxStrtoul(szValue, NULL, 10);
|
|
|
|
GetPrivateProfileString(L"Settings", L"Width", NULL, szValue, 20, iniFile);
|
|
|
|
conf.width = wxStrtoul(szValue, NULL, 10);
|
|
|
|
GetPrivateProfileString(L"Settings", L"Height", NULL, szValue, 20, iniFile);
|
|
|
|
conf.height = wxStrtoul(szValue, NULL, 10);
|
|
|
|
GetPrivateProfileString(L"Settings", L"SkipDraw", NULL, szValue, 20, iniFile);
|
|
|
|
conf.SkipDraw = wxStrtoul(szValue, NULL, 10);
|
2010-03-19 00:31:15 +00:00
|
|
|
|
2010-05-01 23:34:44 +00:00
|
|
|
if (conf.aa < 0 || conf.aa > 4) conf.aa = 0;
|
2010-03-19 00:31:15 +00:00
|
|
|
|
2010-06-19 06:23:40 +00:00
|
|
|
conf.isWideScreen = (conf.widescreen() != 0);
|
2010-05-01 23:34:44 +00:00
|
|
|
|
2010-06-19 08:46:40 +00:00
|
|
|
switch (conf.zz_options.dimensions)
|
2010-03-19 00:31:15 +00:00
|
|
|
{
|
2010-06-19 08:46:40 +00:00
|
|
|
case GSDim_640:
|
2010-03-19 00:31:15 +00:00
|
|
|
conf.width = 640;
|
|
|
|
conf.height = conf.isWideScreen ? 360 : 480;
|
|
|
|
break;
|
2010-05-01 23:34:44 +00:00
|
|
|
|
2010-06-19 08:46:40 +00:00
|
|
|
case GSDim_800:
|
2010-03-19 00:31:15 +00:00
|
|
|
conf.width = 800;
|
|
|
|
conf.height = conf.isWideScreen ? 450 : 600;
|
|
|
|
break;
|
2010-05-01 23:34:44 +00:00
|
|
|
|
2010-06-19 08:46:40 +00:00
|
|
|
case GSDim_1024:
|
2010-03-19 00:31:15 +00:00
|
|
|
conf.width = 1024;
|
|
|
|
conf.height = conf.isWideScreen ? 576 : 768;
|
|
|
|
break;
|
2010-05-01 23:34:44 +00:00
|
|
|
|
2010-06-19 08:46:40 +00:00
|
|
|
case GSDim_1280:
|
2010-03-19 00:31:15 +00:00
|
|
|
conf.width = 1280;
|
|
|
|
conf.height = conf.isWideScreen ? 720 : 960;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2010-06-19 06:23:40 +00:00
|
|
|
// turn off all hacks by default
|
|
|
|
conf.setWireframe(false);
|
|
|
|
conf.setCaptureAvi(false);
|
|
|
|
conf.setLoaded(true);
|
2010-03-19 00:31:15 +00:00
|
|
|
|
2010-05-01 23:34:44 +00:00
|
|
|
if (conf.width <= 0 || conf.height <= 0)
|
|
|
|
{
|
2010-03-19 00:31:15 +00:00
|
|
|
conf.width = 640;
|
|
|
|
conf.height = 480;
|
|
|
|
}
|
|
|
|
}
|