2010-03-19 00:31:15 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <windows.h>
|
|
|
|
#include <windowsx.h>
|
|
|
|
|
|
|
|
#include "resrc1.h"
|
|
|
|
|
|
|
|
#include "GS.h"
|
2010-09-15 16:54:19 +00:00
|
|
|
#include "ZZoglShaders.h"
|
2010-03-19 00:31:15 +00:00
|
|
|
#include "Win32.h"
|
|
|
|
|
|
|
|
#include <map>
|
2010-05-01 23:34:44 +00:00
|
|
|
|
2010-03-19 00:31:15 +00:00
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
extern int g_nPixelShaderVer;
|
|
|
|
static int prevbilinearfilter;
|
2010-05-01 23:34:44 +00:00
|
|
|
HINSTANCE hInst = NULL;
|
2010-03-19 00:31:15 +00:00
|
|
|
|
2010-05-01 23:34:44 +00:00
|
|
|
void CALLBACK GSkeyEvent(keyEvent *ev)
|
|
|
|
{
|
2010-03-19 00:31:15 +00:00
|
|
|
// switch (ev->event) {
|
|
|
|
// case KEYPRESS:
|
|
|
|
// switch (ev->key) {
|
|
|
|
// case VK_PRIOR:
|
|
|
|
// if (conf.fps) fpspos++; break;
|
|
|
|
// case VK_NEXT:
|
|
|
|
// if (conf.fps) fpspos--; break;
|
|
|
|
// case VK_END:
|
|
|
|
// if (conf.fps) fpspress = 1; break;
|
|
|
|
// case VK_DELETE:
|
|
|
|
// conf.fps = 1 - conf.fps;
|
|
|
|
// break;
|
|
|
|
// }
|
|
|
|
// break;
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "Win32/resource.h"
|
|
|
|
|
2010-09-19 08:01:48 +00:00
|
|
|
map<int, int> mapConfOpts;
|
|
|
|
#define PUT_CONF(id) mapConfOpts[IDC_CONFOPT_##id] = 0x##id;
|
2010-05-01 23:34:44 +00:00
|
|
|
|
2010-09-19 08:01:48 +00:00
|
|
|
void OnAdvOK(HWND hW)
|
|
|
|
{
|
|
|
|
conf.hacks._u32 = 0;
|
2010-03-19 00:31:15 +00:00
|
|
|
|
2010-09-19 08:01:48 +00:00
|
|
|
for (map<int, int>::iterator it = mapConfOpts.begin(); it != mapConfOpts.end(); ++it)
|
|
|
|
{
|
|
|
|
if (IsDlgButtonChecked(hW, it->first)) conf.hacks._u32 |= it->second;
|
|
|
|
}
|
2010-05-01 23:34:44 +00:00
|
|
|
|
2010-09-19 08:01:48 +00:00
|
|
|
GSsetGameCRC(g_LastCRC, conf.hacks._u32);
|
2010-05-01 23:34:44 +00:00
|
|
|
|
2010-09-19 08:01:48 +00:00
|
|
|
SaveConfig();
|
2010-05-01 23:34:44 +00:00
|
|
|
|
2010-09-19 08:01:48 +00:00
|
|
|
EndDialog(hW, false);
|
2010-03-19 00:31:15 +00:00
|
|
|
}
|
|
|
|
|
2010-09-19 08:01:48 +00:00
|
|
|
void OnInitAdvDialog(HWND hW)
|
2010-03-19 00:31:15 +00:00
|
|
|
{
|
|
|
|
mapConfOpts.clear();
|
2010-05-01 23:34:44 +00:00
|
|
|
|
2010-03-19 00:31:15 +00:00
|
|
|
PUT_CONF(00000001);
|
|
|
|
PUT_CONF(00000002);
|
|
|
|
PUT_CONF(00000004);
|
|
|
|
PUT_CONF(00000008);
|
|
|
|
PUT_CONF(00000010);
|
|
|
|
PUT_CONF(00000020);
|
|
|
|
PUT_CONF(00000040);
|
|
|
|
PUT_CONF(00000080);
|
|
|
|
PUT_CONF(00000100);
|
|
|
|
PUT_CONF(00000200);
|
|
|
|
PUT_CONF(00000400);
|
|
|
|
PUT_CONF(00000800);
|
|
|
|
PUT_CONF(00001000);
|
|
|
|
PUT_CONF(00002000);
|
|
|
|
PUT_CONF(00004000);
|
|
|
|
PUT_CONF(00008000);
|
|
|
|
PUT_CONF(00010000);
|
|
|
|
PUT_CONF(00020000);
|
|
|
|
PUT_CONF(00040000);
|
|
|
|
PUT_CONF(00080000);
|
|
|
|
PUT_CONF(00100000);
|
|
|
|
PUT_CONF(00200000);
|
|
|
|
PUT_CONF(00800000);
|
|
|
|
PUT_CONF(01000000);
|
|
|
|
PUT_CONF(02000000);
|
|
|
|
PUT_CONF(04000000);
|
|
|
|
PUT_CONF(10000000);
|
|
|
|
|
2010-05-01 23:34:44 +00:00
|
|
|
for (map<int, int>::iterator it = mapConfOpts.begin(); it != mapConfOpts.end(); ++it)
|
|
|
|
{
|
2010-07-24 08:05:53 +00:00
|
|
|
CheckDlgButton(hW, it->first, (conf.settings()._u32 & it->second) ? 1 : 0);
|
2010-03-19 00:31:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-09-19 08:01:48 +00:00
|
|
|
BOOL CALLBACK AdvancedDialogProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
2010-05-01 23:34:44 +00:00
|
|
|
{
|
2010-09-19 08:01:48 +00:00
|
|
|
switch (uMsg)
|
|
|
|
{
|
|
|
|
case WM_INITDIALOG:
|
|
|
|
OnInitAdvDialog(hW);
|
|
|
|
return true;
|
2010-03-19 00:31:15 +00:00
|
|
|
|
2010-09-19 08:01:48 +00:00
|
|
|
case WM_COMMAND:
|
2010-03-19 00:31:15 +00:00
|
|
|
|
2010-09-19 08:01:48 +00:00
|
|
|
switch (LOWORD(wParam))
|
|
|
|
{
|
|
|
|
case IDCANCEL:
|
|
|
|
EndDialog(hW, true);
|
|
|
|
return true;
|
2010-05-01 23:34:44 +00:00
|
|
|
|
2010-09-19 08:01:48 +00:00
|
|
|
case IDOK:
|
|
|
|
OnAdvOK(hW);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
2010-03-19 00:31:15 +00:00
|
|
|
|
2010-09-19 08:01:48 +00:00
|
|
|
return false;
|
|
|
|
}
|
2010-03-19 00:31:15 +00:00
|
|
|
|
2010-09-19 08:01:48 +00:00
|
|
|
void CALLBACK AdvancedDialog()
|
|
|
|
{
|
|
|
|
DialogBox(hInst,
|
|
|
|
MAKEINTRESOURCE(IDD_ADV_OPTIONS),
|
|
|
|
GetActiveWindow(),
|
|
|
|
(DLGPROC)AdvancedDialogProc);
|
|
|
|
}
|
|
|
|
|
|
|
|
void OnInitConfDialog(HWND hW)
|
|
|
|
{
|
|
|
|
if (!(conf.zz_options.loaded)) LoadConfig();
|
|
|
|
|
|
|
|
TCHAR *aaName[] = {"None", "x2", "x4", "x8", "x16"};
|
|
|
|
|
|
|
|
for(int i=0; i<5; i++)
|
|
|
|
{
|
|
|
|
ComboBox_AddString(GetDlgItem(hW, IDC_AA_COMBO), (LPARAM)aaName[i]);
|
|
|
|
}
|
|
|
|
ComboBox_SelectString(GetDlgItem(hW, IDC_AA_COMBO), -1, (LPARAM)aaName[conf.aa]);
|
|
|
|
|
|
|
|
TCHAR *sizeName[] = {"640 x 480", "800 x 600", "1024 x 768", "1280 x 960"};
|
|
|
|
|
|
|
|
for(int i=0; i<4; i++)
|
2010-05-01 23:34:44 +00:00
|
|
|
{
|
2010-09-19 08:01:48 +00:00
|
|
|
ComboBox_AddString(GetDlgItem(hW, IDC_WIN_SIZE_COMBO), (LPARAM)sizeName[i]);
|
2010-05-01 23:34:44 +00:00
|
|
|
}
|
2010-09-19 08:01:48 +00:00
|
|
|
ComboBox_SelectString(GetDlgItem(hW, IDC_WIN_SIZE_COMBO), -1, (LPARAM)sizeName[conf.zz_options.dimensions]);
|
|
|
|
|
|
|
|
CheckDlgButton(hW, IDC_CONFIG_INTERLACE, conf.interlace);
|
|
|
|
CheckDlgButton(hW, IDC_CONFIG_BILINEAR, conf.bilinear);
|
|
|
|
CheckDlgButton(hW, IDC_CONFIG_DEPTHWRITE, conf.mrtdepth);
|
|
|
|
CheckDlgButton(hW, IDC_CONFIG_WIREFRAME, (conf.wireframe()) ? 1 : 0);
|
|
|
|
CheckDlgButton(hW, IDC_CONFIG_CAPTUREAVI, (conf.captureAvi()) ? 1 : 0);
|
|
|
|
CheckDlgButton(hW, IDC_CONFIG_FULLSCREEN, (conf.fullscreen()) ? 1 : 0);
|
|
|
|
CheckDlgButton(hW, IDC_CONFIG_WIDESCREEN, (conf.widescreen()) ? 1 : 0);
|
|
|
|
CheckDlgButton(hW, IDC_CONFIG_BMPSS, (conf.zz_options.tga_snap) ? 1 : 0);
|
|
|
|
|
|
|
|
prevbilinearfilter = conf.bilinear;
|
|
|
|
}
|
|
|
|
|
|
|
|
void OnConfOK(HWND hW)
|
|
|
|
{
|
|
|
|
u32 newinterlace = IsDlgButtonChecked(hW, IDC_CONFIG_INTERLACE);
|
|
|
|
|
|
|
|
if (!conf.interlace)
|
|
|
|
conf.interlace = newinterlace;
|
|
|
|
else if (!newinterlace)
|
|
|
|
conf.interlace = 2; // off
|
|
|
|
|
|
|
|
conf.bilinear = IsDlgButtonChecked(hW, IDC_CONFIG_BILINEAR);
|
|
|
|
|
|
|
|
// restore
|
|
|
|
if (conf.bilinear && prevbilinearfilter) conf.bilinear = prevbilinearfilter;
|
|
|
|
|
|
|
|
if (ComboBox_GetCurSel(GetDlgItem(hW, IDC_AA_COMBO)) != -1)
|
|
|
|
conf.aa = ComboBox_GetCurSel(GetDlgItem(hW, IDC_AA_COMBO));
|
2010-03-19 00:31:15 +00:00
|
|
|
|
2010-06-19 09:07:21 +00:00
|
|
|
conf.zz_options._u32 = 0;
|
2010-05-01 23:34:44 +00:00
|
|
|
|
2010-06-19 08:46:40 +00:00
|
|
|
conf.zz_options.capture_avi = IsDlgButtonChecked(hW, IDC_CONFIG_CAPTUREAVI) ? 1 : 0;
|
|
|
|
conf.zz_options.wireframe = IsDlgButtonChecked(hW, IDC_CONFIG_WIREFRAME) ? 1 : 0;
|
|
|
|
conf.zz_options.fullscreen = IsDlgButtonChecked(hW, IDC_CONFIG_FULLSCREEN) ? 1 : 0;
|
|
|
|
conf.zz_options.widescreen = IsDlgButtonChecked(hW, IDC_CONFIG_WIDESCREEN) ? 1 : 0;
|
|
|
|
conf.zz_options.tga_snap = IsDlgButtonChecked(hW, IDC_CONFIG_BMPSS) ? 1 : 0;
|
2010-03-19 00:31:15 +00:00
|
|
|
|
2010-09-19 08:01:48 +00:00
|
|
|
if (ComboBox_GetCurSel(GetDlgItem(hW, IDC_WIN_SIZE_COMBO)) == 0)
|
2010-06-19 08:46:40 +00:00
|
|
|
conf.zz_options.dimensions = GSDim_640;
|
2010-09-19 08:01:48 +00:00
|
|
|
else if (ComboBox_GetCurSel(GetDlgItem(hW, IDC_WIN_SIZE_COMBO)) == 1)
|
2010-06-19 08:46:40 +00:00
|
|
|
conf.zz_options.dimensions = GSDim_800;
|
2010-09-19 08:01:48 +00:00
|
|
|
else if (ComboBox_GetCurSel(GetDlgItem(hW, IDC_WIN_SIZE_COMBO)) == 2)
|
2010-06-19 08:46:40 +00:00
|
|
|
conf.zz_options.dimensions = GSDim_1024;
|
2010-09-19 08:01:48 +00:00
|
|
|
else if (ComboBox_GetCurSel(GetDlgItem(hW, IDC_WIN_SIZE_COMBO)) == 3)
|
2010-06-19 08:46:40 +00:00
|
|
|
conf.zz_options.dimensions = GSDim_1280;
|
2010-03-19 00:31:15 +00:00
|
|
|
|
|
|
|
SaveConfig();
|
2010-05-01 23:34:44 +00:00
|
|
|
|
|
|
|
EndDialog(hW, false);
|
2010-03-19 00:31:15 +00:00
|
|
|
}
|
|
|
|
|
2010-06-01 02:00:48 +00:00
|
|
|
BOOL CALLBACK ConfigureDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
2010-05-01 23:34:44 +00:00
|
|
|
{
|
|
|
|
switch (uMsg)
|
|
|
|
{
|
2010-03-19 00:31:15 +00:00
|
|
|
case WM_INITDIALOG:
|
2010-09-19 08:01:48 +00:00
|
|
|
OnInitConfDialog(hW);
|
2010-05-01 23:34:44 +00:00
|
|
|
return true;
|
2010-03-19 00:31:15 +00:00
|
|
|
|
|
|
|
case WM_COMMAND:
|
2010-05-01 23:34:44 +00:00
|
|
|
|
|
|
|
switch (LOWORD(wParam))
|
|
|
|
{
|
2010-09-19 08:01:48 +00:00
|
|
|
case IDC_AA_COMBO:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case IDC_ADV_BTN:
|
|
|
|
AdvancedDialog();
|
|
|
|
return true;
|
|
|
|
|
2010-03-19 00:31:15 +00:00
|
|
|
case IDCANCEL:
|
2010-05-01 23:34:44 +00:00
|
|
|
EndDialog(hW, true);
|
|
|
|
return true;
|
|
|
|
|
2010-03-19 00:31:15 +00:00
|
|
|
case IDOK:
|
2010-09-19 08:01:48 +00:00
|
|
|
OnConfOK(hW);
|
2010-05-01 23:34:44 +00:00
|
|
|
return true;
|
2010-03-19 00:31:15 +00:00
|
|
|
}
|
|
|
|
}
|
2010-05-01 23:34:44 +00:00
|
|
|
|
|
|
|
return false;
|
2010-03-19 00:31:15 +00:00
|
|
|
}
|
|
|
|
|
2010-09-19 08:01:48 +00:00
|
|
|
void CALLBACK GSconfigure()
|
|
|
|
{
|
|
|
|
DialogBox(hInst,
|
|
|
|
MAKEINTRESOURCE(IDD_CONFIG2),
|
|
|
|
GetActiveWindow(),
|
|
|
|
(DLGPROC)ConfigureDlgProc);
|
|
|
|
|
|
|
|
if (g_nPixelShaderVer == SHADER_REDUCED) conf.bilinear = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
s32 CALLBACK GStest()
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2010-06-01 02:00:48 +00:00
|
|
|
BOOL CALLBACK AboutDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
2010-05-01 23:34:44 +00:00
|
|
|
{
|
|
|
|
switch (uMsg)
|
|
|
|
{
|
2010-03-19 00:31:15 +00:00
|
|
|
case WM_INITDIALOG:
|
2010-05-01 23:34:44 +00:00
|
|
|
return true;
|
2010-03-19 00:31:15 +00:00
|
|
|
|
|
|
|
case WM_COMMAND:
|
2010-05-01 23:34:44 +00:00
|
|
|
switch (LOWORD(wParam))
|
|
|
|
{
|
2010-03-19 00:31:15 +00:00
|
|
|
case IDOK:
|
2010-05-01 23:34:44 +00:00
|
|
|
EndDialog(hW, false);
|
|
|
|
return true;
|
2010-03-19 00:31:15 +00:00
|
|
|
}
|
|
|
|
}
|
2010-05-01 23:34:44 +00:00
|
|
|
|
|
|
|
return false;
|
2010-03-19 00:31:15 +00:00
|
|
|
}
|
|
|
|
|
2010-05-01 23:34:44 +00:00
|
|
|
void CALLBACK GSabout()
|
|
|
|
{
|
2010-03-19 00:31:15 +00:00
|
|
|
DialogBox(hInst,
|
|
|
|
MAKEINTRESOURCE(IDD_ABOUT),
|
2010-04-25 00:31:27 +00:00
|
|
|
GetActiveWindow(),
|
2010-03-19 00:31:15 +00:00
|
|
|
(DLGPROC)AboutDlgProc);
|
|
|
|
}
|
|
|
|
|
2010-05-01 23:34:44 +00:00
|
|
|
bool APIENTRY DllMain(HANDLE hModule, // DLL INIT
|
2010-04-25 00:31:27 +00:00
|
|
|
DWORD dwReason,
|
2010-05-01 23:34:44 +00:00
|
|
|
LPVOID lpReserved)
|
|
|
|
{
|
2010-03-19 00:31:15 +00:00
|
|
|
hInst = (HINSTANCE)hModule;
|
2010-05-01 23:34:44 +00:00
|
|
|
return true; // very quick :)
|
2010-03-19 00:31:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static char *err = "Error Loading Symbol";
|
|
|
|
static int errval;
|
|
|
|
|
2010-05-01 23:34:44 +00:00
|
|
|
void *SysLoadLibrary(char *lib)
|
|
|
|
{
|
2010-03-19 00:31:15 +00:00
|
|
|
return LoadLibrary(lib);
|
|
|
|
}
|
|
|
|
|
2010-05-01 23:34:44 +00:00
|
|
|
void *SysLoadSym(void *lib, char *sym)
|
|
|
|
{
|
2010-03-19 00:31:15 +00:00
|
|
|
void *tmp = GetProcAddress((HINSTANCE)lib, sym);
|
2010-05-01 23:34:44 +00:00
|
|
|
|
|
|
|
if (tmp == NULL)
|
|
|
|
errval = 1;
|
|
|
|
else
|
|
|
|
errval = 0;
|
|
|
|
|
2010-03-19 00:31:15 +00:00
|
|
|
return tmp;
|
|
|
|
}
|
|
|
|
|
2010-05-01 23:34:44 +00:00
|
|
|
char *SysLibError()
|
|
|
|
{
|
2010-03-19 00:31:15 +00:00
|
|
|
if (errval) { errval = 0; return err; }
|
2010-05-01 23:34:44 +00:00
|
|
|
|
2010-03-19 00:31:15 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2010-05-01 23:34:44 +00:00
|
|
|
void SysCloseLibrary(void *lib)
|
|
|
|
{
|
2010-03-19 00:31:15 +00:00
|
|
|
FreeLibrary((HINSTANCE)lib);
|
|
|
|
}
|
2010-04-30 04:40:31 +00:00
|
|
|
|
2010-05-01 23:34:44 +00:00
|
|
|
void SysMessage(const char *fmt, ...)
|
|
|
|
{
|
2010-04-30 04:40:31 +00:00
|
|
|
va_list list;
|
|
|
|
char tmp[512];
|
|
|
|
|
2010-05-01 23:34:44 +00:00
|
|
|
va_start(list, fmt);
|
|
|
|
vsprintf(tmp, fmt, list);
|
2010-04-30 04:40:31 +00:00
|
|
|
va_end(list);
|
2010-05-01 23:34:44 +00:00
|
|
|
MessageBox(0, tmp, "ZZOgl-PG Msg", 0);
|
2010-04-30 04:40:31 +00:00
|
|
|
}
|