| 1 |
/*************************************************************************** |
| 2 |
cfg.c - description |
| 3 |
------------------- |
| 4 |
begin : Sun Mar 08 2009 |
| 5 |
copyright : (C) 1999-2009 by Pete Bernert |
| 6 |
web : www.pbernert.com |
| 7 |
***************************************************************************/ |
| 8 |
|
| 9 |
/*************************************************************************** |
| 10 |
* * |
| 11 |
* This program is free software; you can redistribute it and/or modify * |
| 12 |
* it under the terms of the GNU General Public License as published by * |
| 13 |
* the Free Software Foundation; either version 2 of the License, or * |
| 14 |
* (at your option) any later version. See also the license.txt file for * |
| 15 |
* additional informations. * |
| 16 |
* * |
| 17 |
***************************************************************************/ |
| 18 |
|
| 19 |
#define _IN_CFG |
| 20 |
|
| 21 |
///////////////////////////////////////////////////////////////////////////// |
| 22 |
// Windows config handling |
| 23 |
|
| 24 |
#include "stdafx.h" |
| 25 |
#include "resource.h" |
| 26 |
#include "externals.h" |
| 27 |
#include "cfg.h" |
| 28 |
#include <stdio.h> |
| 29 |
|
| 30 |
char szKeyDefaults[7]={VK_DELETE,VK_INSERT,VK_HOME,VK_END,VK_PRIOR,VK_NEXT,0x00}; |
| 31 |
|
| 32 |
///////////////////////////////////////////////////////////////////////////// |
| 33 |
// CCfgDlg dialog |
| 34 |
|
| 35 |
BOOL OnInitCfgDialog(HWND hW); |
| 36 |
void OnCfgOK(HWND hW); |
| 37 |
void OnCfgCancel(HWND hW); |
| 38 |
void OnCfgDef1(HWND hW); |
| 39 |
void OnCfgDef2(HWND hW); |
| 40 |
void OnBugFixes(HWND hW); |
| 41 |
void OnKeyConfig(HWND hW); |
| 42 |
void GetSettings(HWND hW); |
| 43 |
void OnClipboard(HWND hW); |
| 44 |
char * GetConfigInfos(HWND hWE); |
| 45 |
|
| 46 |
BOOL CALLBACK CfgDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam) |
| 47 |
{ |
| 48 |
switch(uMsg) |
| 49 |
{ |
| 50 |
case WM_INITDIALOG: |
| 51 |
return OnInitCfgDialog(hW); |
| 52 |
|
| 53 |
case WM_COMMAND: |
| 54 |
{ |
| 55 |
switch(LOWORD(wParam)) |
| 56 |
{ |
| 57 |
case IDC_DEF1: OnCfgDef1(hW); return TRUE; |
| 58 |
case IDC_DEF2: OnCfgDef2(hW); return TRUE; |
| 59 |
case IDC_SELFIX: OnBugFixes(hW); return TRUE; |
| 60 |
case IDC_KEYCONFIG: OnKeyConfig(hW); return TRUE; |
| 61 |
case IDCANCEL: OnCfgCancel(hW); return TRUE; |
| 62 |
case IDOK: OnCfgOK(hW); return TRUE; |
| 63 |
case IDC_CLIPBOARD: OnClipboard(hW); return TRUE; |
| 64 |
} |
| 65 |
} |
| 66 |
} |
| 67 |
return FALSE; |
| 68 |
} |
| 69 |
|
| 70 |
///////////////////////////////////////////////////////////////////////////// |
| 71 |
// CCfgDlg message handlers |
| 72 |
|
| 73 |
//////////////////////////////////////////////////////////////////////// |
| 74 |
// init dlg |
| 75 |
//////////////////////////////////////////////////////////////////////// |
| 76 |
|
| 77 |
void ComboBoxAddRes(HWND hWC,char * cs) // ADD COMBOBOX RESOURCES |
| 78 |
{ |
| 79 |
int i=ComboBox_FindString(hWC,-1,cs); |
| 80 |
if(i!=CB_ERR) return; |
| 81 |
ComboBox_AddString(hWC,cs); |
| 82 |
} |
| 83 |
|
| 84 |
|
| 85 |
BOOL OnInitCfgDialog(HWND hW) // INIT CONFIG DIALOG |
| 86 |
{ |
| 87 |
HWND hWC;char cs[256];int i;DEVMODE dv; |
| 88 |
|
| 89 |
ReadConfig(); // read registry stuff |
| 90 |
|
| 91 |
//----------------------------------------------------// fill combo with available resolutions |
| 92 |
|
| 93 |
hWC=GetDlgItem(hW,IDC_RESOLUTION); |
| 94 |
|
| 95 |
memset(&dv,0,sizeof(DEVMODE)); |
| 96 |
dv.dmSize=sizeof(DEVMODE); |
| 97 |
i=0; |
| 98 |
|
| 99 |
while(EnumDisplaySettings(NULL,i,&dv)) // add all resolutions from the driver |
| 100 |
{ |
| 101 |
wsprintf(cs,"%4d x %4d",dv.dmPelsWidth,dv.dmPelsHeight); |
| 102 |
ComboBoxAddRes(hWC,cs); |
| 103 |
i++; |
| 104 |
} |
| 105 |
|
| 106 |
ComboBoxAddRes(hWC," 640 x 480"); // and also add some common ones |
| 107 |
ComboBoxAddRes(hWC," 800 x 600"); |
| 108 |
ComboBoxAddRes(hWC,"1024 x 768"); |
| 109 |
ComboBoxAddRes(hWC,"1152 x 864"); |
| 110 |
ComboBoxAddRes(hWC,"1280 x 1024"); |
| 111 |
ComboBoxAddRes(hWC,"1600 x 1200"); |
| 112 |
|
| 113 |
wsprintf(cs,"%4d x %4d",iResX,iResY); // search curr resolution in combo |
| 114 |
i=ComboBox_FindString(hWC,-1,cs); |
| 115 |
if(i==CB_ERR) i=0; |
| 116 |
ComboBox_SetCurSel(hWC,i); // and select this one |
| 117 |
|
| 118 |
//----------------------------------------------------// window size |
| 119 |
|
| 120 |
SetDlgItemInt(hW,IDC_WINX,LOWORD(iWinSize),FALSE); |
| 121 |
SetDlgItemInt(hW,IDC_WINY,HIWORD(iWinSize),FALSE); |
| 122 |
|
| 123 |
//----------------------------------------------------// color depth |
| 124 |
|
| 125 |
hWC=GetDlgItem(hW,IDC_COLORDEPTH); |
| 126 |
ComboBox_AddString(hWC,"16 Bit"); |
| 127 |
ComboBox_AddString(hWC,"32 Bit"); |
| 128 |
wsprintf(cs,"%d Bit",iColDepth); |
| 129 |
i=ComboBox_FindString(hWC,-1,cs); |
| 130 |
if(i==CB_ERR) i=0; |
| 131 |
ComboBox_SetCurSel(hWC,i); |
| 132 |
|
| 133 |
//----------------------------------------------------// vsync |
| 134 |
|
| 135 |
hWC=GetDlgItem(hW,IDC_VSYNC); |
| 136 |
ComboBox_AddString(hWC,"Driver"); |
| 137 |
ComboBox_AddString(hWC,"Off"); |
| 138 |
ComboBox_AddString(hWC,"On"); |
| 139 |
ComboBox_SetCurSel(hWC,iForceVSync+1); |
| 140 |
|
| 141 |
//----------------------------------------------------// vram size |
| 142 |
|
| 143 |
hWC=GetDlgItem(hW,IDC_VRAMSIZE); |
| 144 |
ComboBox_AddString(hWC,"0 (Autodetect)"); |
| 145 |
ComboBox_AddString(hWC,"2"); |
| 146 |
ComboBox_AddString(hWC,"4"); |
| 147 |
ComboBox_AddString(hWC,"8"); |
| 148 |
ComboBox_AddString(hWC,"16"); |
| 149 |
ComboBox_AddString(hWC,"32"); |
| 150 |
ComboBox_AddString(hWC,"64"); |
| 151 |
ComboBox_AddString(hWC,"128 (or more)"); |
| 152 |
|
| 153 |
if(!iVRamSize) ComboBox_SetCurSel(hWC,0); |
| 154 |
else {wsprintf(cs,"%d",iVRamSize);ComboBox_SetText(hWC,cs);} |
| 155 |
|
| 156 |
//----------------------------------------------------// texture quality |
| 157 |
|
| 158 |
hWC=GetDlgItem(hW,IDC_TEXQUALITY); |
| 159 |
ComboBox_AddString(hWC,"don't care - Use driver's default textures"); |
| 160 |
ComboBox_AddString(hWC,"R4 G4 B4 A4 - Fast, but less colorful"); |
| 161 |
ComboBox_AddString(hWC,"R5 G5 B5 A1 - Nice colors, bad transparency"); |
| 162 |
ComboBox_AddString(hWC,"R8 G8 B8 A8 - Best colors, more ram needed"); |
| 163 |
ComboBox_AddString(hWC,"B8 G8 R8 A8 - Slightly faster with some cards"); |
| 164 |
ComboBox_SetCurSel(hWC,iTexQuality); |
| 165 |
|
| 166 |
//----------------------------------------------------// all kind of on/off options |
| 167 |
|
| 168 |
if(bDrawDither) CheckDlgButton(hW,IDC_DRAWDITHER,TRUE); |
| 169 |
if(bUseLines) CheckDlgButton(hW,IDC_USELINES,TRUE); |
| 170 |
if(bUseFrameLimit) CheckDlgButton(hW,IDC_USELIMIT,TRUE); |
| 171 |
if(bUseFrameSkip) CheckDlgButton(hW,IDC_USESKIP,TRUE); |
| 172 |
if(bAdvancedBlend) CheckDlgButton(hW,IDC_ADVBLEND,TRUE); |
| 173 |
if(bOpaquePass) CheckDlgButton(hW,IDC_OPAQUE,TRUE); |
| 174 |
// if(bUseAntiAlias) CheckDlgButton(hW,IDC_USEANTIALIAS,TRUE); |
| 175 |
if(bWindowMode) CheckDlgButton(hW,IDC_DISPMODE2,TRUE); |
| 176 |
else CheckDlgButton(hW,IDC_DISPMODE1,TRUE); |
| 177 |
if(iUseMask) CheckDlgButton(hW,IDC_USEMASK,TRUE); |
| 178 |
if(bUseFastMdec) CheckDlgButton(hW,IDC_FASTMDEC,TRUE); |
| 179 |
if(bUse15bitMdec) CheckDlgButton(hW,IDC_FASTMDEC2,TRUE); |
| 180 |
if(bUseFixes) CheckDlgButton(hW,IDC_GAMEFIX,TRUE); |
| 181 |
if(bGteAccuracy) CheckDlgButton(hW,IDC_GTEACCURACY,TRUE); |
| 182 |
if(iUseScanLines) CheckDlgButton(hW,IDC_USESCANLINES,TRUE); |
| 183 |
if(iShowFPS) CheckDlgButton(hW,IDC_SHOWFPS,TRUE); |
| 184 |
if(bKeepRatio) CheckDlgButton(hW,IDC_ARATIO,TRUE); |
| 185 |
if(bForceRatio43) CheckDlgButton(hW,IDC_ARATIO43,TRUE); |
| 186 |
if(iBlurBuffer) CheckDlgButton(hW,IDC_BLUR,TRUE); |
| 187 |
if(iNoScreenSaver) CheckDlgButton(hW,IDC_SSAVE,TRUE); |
| 188 |
|
| 189 |
//----------------------------------------------------// texture filter |
| 190 |
|
| 191 |
hWC=GetDlgItem(hW,IDC_FILTERTYPE); |
| 192 |
ComboBox_AddString(hWC,"0: None"); |
| 193 |
ComboBox_AddString(hWC,"1: Standard - Glitches will happen"); |
| 194 |
ComboBox_AddString(hWC,"2: Extended - Removes black borders"); |
| 195 |
ComboBox_AddString(hWC,"3: Standard w/o Sprites - unfiltered 2D"); |
| 196 |
ComboBox_AddString(hWC,"4: Extended w/o Sprites - unfiltered 2D"); |
| 197 |
ComboBox_AddString(hWC,"5: Standard + smoothed Sprites"); |
| 198 |
ComboBox_AddString(hWC,"6: Extended + smoothed Sprites"); |
| 199 |
ComboBox_SetCurSel(hWC,iFilterType); |
| 200 |
|
| 201 |
//----------------------------------------------------// hires texture mode |
| 202 |
|
| 203 |
hWC=GetDlgItem(hW,IDC_HIRESTEX); |
| 204 |
ComboBox_AddString(hWC,"0: None (standard)"); |
| 205 |
ComboBox_AddString(hWC,"1: 2xSaI (much vram needed)"); |
| 206 |
ComboBox_AddString(hWC,"2: Stretched (filtering needed)"); |
| 207 |
ComboBox_SetCurSel(hWC,iHiResTextures); |
| 208 |
|
| 209 |
//----------------------------------------------------// offscreen drawing |
| 210 |
|
| 211 |
hWC=GetDlgItem(hW,IDC_OFFSCREEN); |
| 212 |
ComboBox_AddString(hWC,"0: None - Fastest, most glitches"); |
| 213 |
ComboBox_AddString(hWC,"1: Minimum - Missing screens"); |
| 214 |
ComboBox_AddString(hWC,"2: Standard - OK for most games"); |
| 215 |
ComboBox_AddString(hWC,"3: Enhanced - Shows more stuff"); |
| 216 |
ComboBox_AddString(hWC,"4: Extended - Can cause garbage"); |
| 217 |
ComboBox_SetCurSel(hWC,iOffscreenDrawing); |
| 218 |
|
| 219 |
//----------------------------------------------------// texture quality |
| 220 |
|
| 221 |
hWC=GetDlgItem(hW,IDC_FRAMETEX); |
| 222 |
ComboBox_AddString(hWC,"0: Emulated vram - effects need FVP"); |
| 223 |
ComboBox_AddString(hWC,"1: Black - Fast but no special effects"); |
| 224 |
ComboBox_AddString(hWC,"2: Gfx card buffer - Can be slow"); |
| 225 |
ComboBox_AddString(hWC,"3: Gfx card buffer & software - slow"); |
| 226 |
ComboBox_SetCurSel(hWC,iFrameTexType); |
| 227 |
|
| 228 |
//----------------------------------------------------// framebuffer read mode |
| 229 |
|
| 230 |
hWC=GetDlgItem(hW,IDC_FRAMEREAD); |
| 231 |
ComboBox_AddString(hWC,"0: Emulated vram - OK for most games"); |
| 232 |
ComboBox_AddString(hWC,"1: Gfx card buffer reads"); |
| 233 |
ComboBox_AddString(hWC,"2: Gfx card buffer moves"); |
| 234 |
ComboBox_AddString(hWC,"3: Gfx card buffer reads & moves"); |
| 235 |
ComboBox_AddString(hWC,"4: Full software drawing (FVP)"); |
| 236 |
ComboBox_SetCurSel(hWC,iFrameReadType); |
| 237 |
|
| 238 |
//----------------------------------------------------// framerate stuff |
| 239 |
|
| 240 |
if(iFrameLimit==2) |
| 241 |
CheckDlgButton(hW,IDC_FRAMEAUTO,TRUE); |
| 242 |
else CheckDlgButton(hW,IDC_FRAMEMANUELL,TRUE); |
| 243 |
|
| 244 |
sprintf(cs,"%.2f",fFrameRate); |
| 245 |
SetDlgItemText(hW,IDC_FRAMELIMIT,cs); |
| 246 |
SetDlgItemInt(hW,IDC_SCANBLEND,iScanBlend,TRUE); |
| 247 |
|
| 248 |
return TRUE; |
| 249 |
} |
| 250 |
|
| 251 |
//////////////////////////////////////////////////////////////////////// |
| 252 |
// on ok: take vals |
| 253 |
//////////////////////////////////////////////////////////////////////// |
| 254 |
|
| 255 |
void GetSettings(HWND hW) |
| 256 |
{ |
| 257 |
HWND hWC;char cs[256];int i,j;char * p; |
| 258 |
|
| 259 |
hWC=GetDlgItem(hW,IDC_VRAMSIZE); // get vram size |
| 260 |
ComboBox_GetText(hWC,cs,255); |
| 261 |
iVRamSize=atoi(cs); |
| 262 |
if(iVRamSize<0) iVRamSize=0; |
| 263 |
if(iVRamSize>1024) iVRamSize=1024; |
| 264 |
|
| 265 |
hWC=GetDlgItem(hW,IDC_RESOLUTION); // get resolution |
| 266 |
i=ComboBox_GetCurSel(hWC); |
| 267 |
ComboBox_GetLBText(hWC,i,cs); |
| 268 |
iResX=atol(cs); |
| 269 |
p=strchr(cs,'x'); |
| 270 |
if(p) iResY=atol(p+1); |
| 271 |
else iResY=480; |
| 272 |
|
| 273 |
hWC=GetDlgItem(hW,IDC_COLORDEPTH); // get color depth |
| 274 |
i=ComboBox_GetCurSel(hWC); |
| 275 |
ComboBox_GetLBText(hWC,i,cs); |
| 276 |
iColDepth=atol(cs); |
| 277 |
|
| 278 |
hWC=GetDlgItem(hW,IDC_VSYNC); // get vsync |
| 279 |
iForceVSync=ComboBox_GetCurSel(hWC)-1; |
| 280 |
|
| 281 |
i=GetDlgItemInt(hW,IDC_WINX,NULL,FALSE); // get win size |
| 282 |
if(i<100) i=100; if(i>16384) i=16384; |
| 283 |
j=GetDlgItemInt(hW,IDC_WINY,NULL,FALSE); |
| 284 |
if(j<100) j=100; if(j>16384) j=16384; |
| 285 |
iWinSize=MAKELONG(i,j); |
| 286 |
|
| 287 |
hWC=GetDlgItem(hW,IDC_TEXQUALITY); // texture quality |
| 288 |
iTexQuality=ComboBox_GetCurSel(hWC); |
| 289 |
|
| 290 |
hWC=GetDlgItem(hW,IDC_FILTERTYPE); // all kind of options |
| 291 |
iFilterType=ComboBox_GetCurSel(hWC); |
| 292 |
|
| 293 |
if(IsDlgButtonChecked(hW,IDC_DRAWDITHER)) |
| 294 |
bDrawDither=TRUE; else bDrawDither=FALSE; |
| 295 |
|
| 296 |
if(IsDlgButtonChecked(hW,IDC_USELINES)) |
| 297 |
bUseLines=TRUE; else bUseLines=FALSE; |
| 298 |
|
| 299 |
if(IsDlgButtonChecked(hW,IDC_DISPMODE2)) |
| 300 |
bWindowMode=TRUE; else bWindowMode=FALSE; |
| 301 |
|
| 302 |
if(IsDlgButtonChecked(hW,IDC_ADVBLEND)) |
| 303 |
bAdvancedBlend=TRUE; else bAdvancedBlend=FALSE; |
| 304 |
|
| 305 |
iOffscreenDrawing=ComboBox_GetCurSel(GetDlgItem(hW,IDC_OFFSCREEN)); |
| 306 |
|
| 307 |
iFrameTexType=ComboBox_GetCurSel(GetDlgItem(hW,IDC_FRAMETEX)); |
| 308 |
iFrameReadType=ComboBox_GetCurSel(GetDlgItem(hW,IDC_FRAMEREAD)); |
| 309 |
|
| 310 |
if(IsDlgButtonChecked(hW,IDC_USELIMIT)) |
| 311 |
bUseFrameLimit=TRUE; else bUseFrameLimit=FALSE; |
| 312 |
|
| 313 |
if(IsDlgButtonChecked(hW,IDC_USESKIP)) |
| 314 |
bUseFrameSkip=TRUE; else bUseFrameSkip=FALSE; |
| 315 |
|
| 316 |
if(IsDlgButtonChecked(hW,IDC_OPAQUE)) |
| 317 |
bOpaquePass=TRUE; else bOpaquePass=FALSE; |
| 318 |
|
| 319 |
// if(IsDlgButtonChecked(hW,IDC_USEANTIALIAS)) |
| 320 |
// bUseAntiAlias=TRUE; else bUseAntiAlias=FALSE; |
| 321 |
|
| 322 |
if(IsDlgButtonChecked(hW,IDC_FASTMDEC)) |
| 323 |
bUseFastMdec=TRUE; else bUseFastMdec=FALSE; |
| 324 |
|
| 325 |
if(IsDlgButtonChecked(hW,IDC_FASTMDEC2)) |
| 326 |
bUse15bitMdec=TRUE; else bUse15bitMdec=FALSE; |
| 327 |
|
| 328 |
if(IsDlgButtonChecked(hW,IDC_GAMEFIX)) |
| 329 |
bUseFixes=TRUE; else bUseFixes=FALSE; |
| 330 |
|
| 331 |
if(IsDlgButtonChecked(hW,IDC_GTEACCURACY)) |
| 332 |
bGteAccuracy=TRUE; else bGteAccuracy=FALSE; |
| 333 |
|
| 334 |
if(IsDlgButtonChecked(hW,IDC_USESCANLINES)) |
| 335 |
iUseScanLines=1; else iUseScanLines=0; |
| 336 |
|
| 337 |
if(IsDlgButtonChecked(hW,IDC_SHOWFPS)) |
| 338 |
iShowFPS=1; else iShowFPS=0; |
| 339 |
|
| 340 |
if(IsDlgButtonChecked(hW,IDC_ARATIO)) |
| 341 |
bKeepRatio=TRUE; else bKeepRatio=FALSE; |
| 342 |
|
| 343 |
if(IsDlgButtonChecked(hW,IDC_ARATIO43)) |
| 344 |
bForceRatio43=TRUE; else bForceRatio43=FALSE; |
| 345 |
|
| 346 |
if(IsDlgButtonChecked(hW,IDC_BLUR)) |
| 347 |
iBlurBuffer=1; else iBlurBuffer=0; |
| 348 |
|
| 349 |
if(IsDlgButtonChecked(hW,IDC_SSAVE)) |
| 350 |
iNoScreenSaver=1; else iNoScreenSaver=0; |
| 351 |
|
| 352 |
hWC=GetDlgItem(hW,IDC_HIRESTEX); |
| 353 |
iHiResTextures=ComboBox_GetCurSel(hWC); |
| 354 |
|
| 355 |
if(IsDlgButtonChecked(hW,IDC_USEMASK)) |
| 356 |
{iUseMask=1;iZBufferDepth=16;} |
| 357 |
else {iUseMask=0;iZBufferDepth=0; } |
| 358 |
|
| 359 |
iScanBlend=GetDlgItemInt(hW,IDC_SCANBLEND,NULL,TRUE); |
| 360 |
if(iScanBlend>255) iScanBlend=0; |
| 361 |
if(iScanBlend<-1) iScanBlend=-1; |
| 362 |
|
| 363 |
if(IsDlgButtonChecked(hW,IDC_FRAMEAUTO)) // frame rate settings |
| 364 |
iFrameLimit=2; |
| 365 |
else iFrameLimit=1; |
| 366 |
|
| 367 |
GetDlgItemText(hW,IDC_FRAMELIMIT,cs,255); |
| 368 |
fFrameRate=(float)atof(cs); |
| 369 |
if(fFrameRate<10.0f) fFrameRate=10.0f; |
| 370 |
if(fFrameRate>1000.0f) fFrameRate=1000.0f; |
| 371 |
} |
| 372 |
|
| 373 |
//////////////////////////////////////////////////////////////////////// |
| 374 |
// OK button |
| 375 |
//////////////////////////////////////////////////////////////////////// |
| 376 |
|
| 377 |
void OnCfgOK(HWND hW) |
| 378 |
{ |
| 379 |
GetSettings(hW); // get dialog settings |
| 380 |
|
| 381 |
WriteConfig(); // write registry |
| 382 |
|
| 383 |
EndDialog(hW,TRUE); // close dialog |
| 384 |
} |
| 385 |
|
| 386 |
//////////////////////////////////////////////////////////////////////// |
| 387 |
// Clipboard button |
| 388 |
//////////////////////////////////////////////////////////////////////// |
| 389 |
|
| 390 |
void OnClipboard(HWND hW) |
| 391 |
{ |
| 392 |
HWND hWE=GetDlgItem(hW,IDC_CLPEDIT); |
| 393 |
char * pB; |
| 394 |
|
| 395 |
GetSettings(hW); // get dialog setings |
| 396 |
pB=GetConfigInfos(hWE); // get text infos |
| 397 |
|
| 398 |
if(pB) // some text got? |
| 399 |
{ |
| 400 |
SetDlgItemText(hW,IDC_CLPEDIT,pB); // -> set text in invisible edit |
| 401 |
SendMessage(hWE,EM_SETSEL,0,-1); // -> sel all in edit |
| 402 |
SendMessage(hWE,WM_COPY,0,0); // -> copy sel to clipboard |
| 403 |
free(pB); // -> free helper text buffer |
| 404 |
|
| 405 |
MessageBox(hW,"Configuration info successfully copied to the clipboard\nJust use the PASTE function in another program to retrieve the data!","Copy Info",MB_ICONINFORMATION|MB_OK); |
| 406 |
} |
| 407 |
} |
| 408 |
|
| 409 |
//////////////////////////////////////////////////////////////////////// |
| 410 |
// Cancel button (just closes window) |
| 411 |
//////////////////////////////////////////////////////////////////////// |
| 412 |
|
| 413 |
void OnCfgCancel(HWND hW) |
| 414 |
{ |
| 415 |
EndDialog(hW,FALSE); |
| 416 |
} |
| 417 |
|
| 418 |
//////////////////////////////////////////////////////////////////////// |
| 419 |
// Bug fixes |
| 420 |
//////////////////////////////////////////////////////////////////////// |
| 421 |
|
| 422 |
BOOL CALLBACK BugFixesDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam) |
| 423 |
{ |
| 424 |
switch(uMsg) |
| 425 |
{ |
| 426 |
case WM_INITDIALOG: // init dialog: |
| 427 |
{ |
| 428 |
int i; |
| 429 |
|
| 430 |
for(i=0;i<32;i++) // -> loop all 32 checkboxes |
| 431 |
{ |
| 432 |
if(dwCfgFixes&(1<<i)) // --> if fix is active: check box |
| 433 |
CheckDlgButton(hW,IDC_FIX1+i,TRUE); |
| 434 |
} |
| 435 |
} |
| 436 |
|
| 437 |
case WM_COMMAND: |
| 438 |
{ |
| 439 |
switch(LOWORD(wParam)) |
| 440 |
{ |
| 441 |
case IDCANCEL: EndDialog(hW,FALSE);return TRUE; // cancel: close window |
| 442 |
|
| 443 |
case IDOK: // ok: take settings and close |
| 444 |
{ |
| 445 |
int i; |
| 446 |
dwCfgFixes=0; |
| 447 |
for(i=0;i<32;i++) |
| 448 |
{ |
| 449 |
if(IsDlgButtonChecked(hW,IDC_FIX1+i)) |
| 450 |
dwCfgFixes|=(1<<i); |
| 451 |
} |
| 452 |
EndDialog(hW,TRUE); |
| 453 |
return TRUE; |
| 454 |
} |
| 455 |
} |
| 456 |
} |
| 457 |
} |
| 458 |
return FALSE; |
| 459 |
} |
| 460 |
|
| 461 |
void OnBugFixes(HWND hW) // bug fix button: |
| 462 |
{ |
| 463 |
DialogBox(hInst,MAKEINTRESOURCE(IDD_FIXES), // show fix window |
| 464 |
hW,(DLGPROC)BugFixesDlgProc); |
| 465 |
} |
| 466 |
|
| 467 |
//////////////////////////////////////////////////////////////////////// |
| 468 |
// default 1: fast |
| 469 |
//////////////////////////////////////////////////////////////////////// |
| 470 |
|
| 471 |
void OnCfgDef1(HWND hW) |
| 472 |
{ |
| 473 |
HWND hWC; |
| 474 |
|
| 475 |
hWC=GetDlgItem(hW,IDC_RESOLUTION); |
| 476 |
ComboBox_SetCurSel(hWC,0); |
| 477 |
hWC=GetDlgItem(hW,IDC_COLORDEPTH); |
| 478 |
ComboBox_SetCurSel(hWC,0); |
| 479 |
hWC=GetDlgItem(hW,IDC_VSYNC); |
| 480 |
ComboBox_SetCurSel(hWC,1); |
| 481 |
hWC=GetDlgItem(hW,IDC_TEXQUALITY); |
| 482 |
ComboBox_SetCurSel(hWC,0); |
| 483 |
hWC=GetDlgItem(hW,IDC_FILTERTYPE); |
| 484 |
ComboBox_SetCurSel(hWC,0); |
| 485 |
hWC=GetDlgItem(hW,IDC_OFFSCREEN); |
| 486 |
ComboBox_SetCurSel(hWC,1); |
| 487 |
hWC=GetDlgItem(hW,IDC_VRAMSIZE); |
| 488 |
ComboBox_SetCurSel(hWC,0); |
| 489 |
|
| 490 |
CheckDlgButton(hW,IDC_TEXLINEAR,FALSE); |
| 491 |
CheckDlgButton(hW,IDC_DRAWDITHER,FALSE); |
| 492 |
CheckDlgButton(hW,IDC_USELINES,FALSE); |
| 493 |
CheckDlgButton(hW,IDC_USELIMIT,FALSE); |
| 494 |
CheckDlgButton(hW,IDC_USESKIP,FALSE); |
| 495 |
CheckDlgButton(hW,IDC_ADVBLEND,FALSE); |
| 496 |
CheckDlgButton(hW,IDC_OPAQUE,TRUE); |
| 497 |
// CheckDlgButton(hW,IDC_USEANTIALIAS,FALSE); |
| 498 |
CheckDlgButton(hW,IDC_DISPMODE2,FALSE); |
| 499 |
CheckDlgButton(hW,IDC_DISPMODE1,TRUE); |
| 500 |
CheckDlgButton(hW,IDC_FRAMEAUTO,TRUE); |
| 501 |
CheckDlgButton(hW,IDC_FRAMEMANUELL,FALSE); |
| 502 |
CheckDlgButton(hW,IDC_SHOWFPS,FALSE); |
| 503 |
|
| 504 |
ComboBox_SetCurSel(GetDlgItem(hW,IDC_SUBCACHE),2); |
| 505 |
ComboBox_SetCurSel(GetDlgItem(hW,IDC_FRAMETEX),1); |
| 506 |
ComboBox_SetCurSel(GetDlgItem(hW,IDC_FRAMEREAD),0); |
| 507 |
|
| 508 |
CheckDlgButton(hW,IDC_USEMASK,FALSE); |
| 509 |
CheckDlgButton(hW,IDC_FASTMDEC,TRUE); |
| 510 |
CheckDlgButton(hW,IDC_FASTMDEC2,TRUE); |
| 511 |
CheckDlgButton(hW,IDC_USESCANLINES,FALSE); |
| 512 |
|
| 513 |
SetDlgItemInt(hW,IDC_FRAMELIMIT,200,FALSE); |
| 514 |
SetDlgItemInt(hW,IDC_WINX,640,FALSE); |
| 515 |
SetDlgItemInt(hW,IDC_WINY,480,FALSE); |
| 516 |
|
| 517 |
CheckDlgButton(hW,IDC_ARATIO,FALSE); |
| 518 |
CheckDlgButton(hW,IDC_BLUR,FALSE); |
| 519 |
|
| 520 |
SetDlgItemInt(hW,IDC_SCANBLEND,0,TRUE); |
| 521 |
ComboBox_SetCurSel(GetDlgItem(hW,IDC_HIRESTEX),0); |
| 522 |
CheckDlgButton(hW,IDC_SSAVE,FALSE); |
| 523 |
} |
| 524 |
|
| 525 |
//////////////////////////////////////////////////////////////////////// |
| 526 |
// default 2: nice |
| 527 |
//////////////////////////////////////////////////////////////////////// |
| 528 |
|
| 529 |
void OnCfgDef2(HWND hW) |
| 530 |
{ |
| 531 |
HWND hWC; |
| 532 |
|
| 533 |
hWC=GetDlgItem(hW,IDC_RESOLUTION); |
| 534 |
ComboBox_SetCurSel(hWC,1); |
| 535 |
hWC=GetDlgItem(hW,IDC_COLORDEPTH); |
| 536 |
ComboBox_SetCurSel(hWC,1); |
| 537 |
hWC=GetDlgItem(hW,IDC_VSYNC); |
| 538 |
ComboBox_SetCurSel(hWC,2); |
| 539 |
hWC=GetDlgItem(hW,IDC_TEXQUALITY); |
| 540 |
ComboBox_SetCurSel(hWC,3); |
| 541 |
hWC=GetDlgItem(hW,IDC_FILTERTYPE); |
| 542 |
ComboBox_SetCurSel(hWC,0); |
| 543 |
hWC=GetDlgItem(hW,IDC_OFFSCREEN); |
| 544 |
ComboBox_SetCurSel(hWC,3); |
| 545 |
hWC=GetDlgItem(hW,IDC_VRAMSIZE); |
| 546 |
ComboBox_SetCurSel(hWC,0); |
| 547 |
|
| 548 |
CheckDlgButton(hW,IDC_TEXLINEAR,FALSE); |
| 549 |
CheckDlgButton(hW,IDC_DRAWDITHER,FALSE); |
| 550 |
CheckDlgButton(hW,IDC_USELINES,FALSE); |
| 551 |
CheckDlgButton(hW,IDC_USELIMIT,TRUE); |
| 552 |
CheckDlgButton(hW,IDC_USESKIP,FALSE); |
| 553 |
CheckDlgButton(hW,IDC_ADVBLEND,TRUE); |
| 554 |
CheckDlgButton(hW,IDC_OPAQUE,TRUE); |
| 555 |
// CheckDlgButton(hW,IDC_USEANTIALIAS,FALSE); |
| 556 |
CheckDlgButton(hW,IDC_DISPMODE2,FALSE); |
| 557 |
CheckDlgButton(hW,IDC_DISPMODE1,TRUE); |
| 558 |
CheckDlgButton(hW,IDC_FRAMEAUTO,TRUE); |
| 559 |
CheckDlgButton(hW,IDC_FRAMEMANUELL,FALSE); |
| 560 |
CheckDlgButton(hW,IDC_SHOWFPS,FALSE); |
| 561 |
|
| 562 |
ComboBox_SetCurSel(GetDlgItem(hW,IDC_SUBCACHE),2); |
| 563 |
ComboBox_SetCurSel(GetDlgItem(hW,IDC_FRAMETEX),2); |
| 564 |
ComboBox_SetCurSel(GetDlgItem(hW,IDC_FRAMEREAD),0); |
| 565 |
|
| 566 |
CheckDlgButton(hW,IDC_USEMASK,TRUE); |
| 567 |
CheckDlgButton(hW,IDC_FASTMDEC,FALSE); |
| 568 |
CheckDlgButton(hW,IDC_FASTMDEC2,FALSE); |
| 569 |
CheckDlgButton(hW,IDC_USESCANLINES,FALSE); |
| 570 |
|
| 571 |
SetDlgItemInt(hW,IDC_FRAMELIMIT,200,FALSE); |
| 572 |
SetDlgItemInt(hW,IDC_WINX,640,FALSE); |
| 573 |
SetDlgItemInt(hW,IDC_WINY,480,FALSE); |
| 574 |
CheckDlgButton(hW,IDC_ARATIO,FALSE); |
| 575 |
CheckDlgButton(hW,IDC_BLUR,FALSE); |
| 576 |
SetDlgItemInt(hW,IDC_SCANBLEND,0,TRUE); |
| 577 |
ComboBox_SetCurSel(GetDlgItem(hW,IDC_HIRESTEX),0); |
| 578 |
CheckDlgButton(hW,IDC_SSAVE,FALSE); |
| 579 |
} |
| 580 |
|
| 581 |
//////////////////////////////////////////////////////////////////////// |
| 582 |
// read registry |
| 583 |
//////////////////////////////////////////////////////////////////////// |
| 584 |
|
| 585 |
void ReadConfig(void) // read all config vals |
| 586 |
{ |
| 587 |
HKEY myKey; |
| 588 |
DWORD temp; |
| 589 |
DWORD type; |
| 590 |
DWORD size; |
| 591 |
|
| 592 |
// pre-init all relevant globals |
| 593 |
|
| 594 |
iResX=800;iResY=600; |
| 595 |
iColDepth=32; |
| 596 |
bChangeRes=FALSE; |
| 597 |
bWindowMode=FALSE; |
| 598 |
bFullVRam=FALSE; |
| 599 |
iFilterType=0; |
| 600 |
bAdvancedBlend=FALSE; |
| 601 |
bDrawDither=FALSE; |
| 602 |
bUseLines=FALSE; |
| 603 |
bUseFrameLimit=TRUE; |
| 604 |
bUseFrameSkip=FALSE; |
| 605 |
iFrameLimit=2; |
| 606 |
fFrameRate=200.0f; |
| 607 |
iOffscreenDrawing=1; |
| 608 |
bOpaquePass=TRUE; |
| 609 |
bUseAntiAlias=FALSE; |
| 610 |
iTexQuality=0; |
| 611 |
iWinSize=MAKELONG(400,300); |
| 612 |
iUseMask=0; |
| 613 |
iZBufferDepth=0; |
| 614 |
bUseFastMdec=FALSE; |
| 615 |
bUse15bitMdec=FALSE; |
| 616 |
dwCfgFixes=0; |
| 617 |
bUseFixes=FALSE; |
| 618 |
bGteAccuracy=FALSE; |
| 619 |
iUseScanLines=0; |
| 620 |
iFrameTexType=0; |
| 621 |
iFrameReadType=0; |
| 622 |
iShowFPS=0; |
| 623 |
bKeepRatio=FALSE; |
| 624 |
bForceRatio43=FALSE; |
| 625 |
iScanBlend=0; |
| 626 |
iVRamSize=0; |
| 627 |
iTexGarbageCollection=1; |
| 628 |
iBlurBuffer=0; |
| 629 |
iHiResTextures=0; |
| 630 |
iNoScreenSaver=1; |
| 631 |
iForceVSync=-1; |
| 632 |
|
| 633 |
lstrcpy(szGPUKeys,szKeyDefaults); |
| 634 |
|
| 635 |
// registry key: still "psemu pro/pete tnt" for compatibility reasons |
| 636 |
|
| 637 |
if (RegOpenKeyEx(HKEY_CURRENT_USER,"Software\\Vision Thing\\PSEmu Pro\\GPU\\PeteTNT",0,KEY_ALL_ACCESS,&myKey)==ERROR_SUCCESS) |
| 638 |
{ |
| 639 |
size = 4; |
| 640 |
if(RegQueryValueEx(myKey,"ResX",0,&type,(LPBYTE)&temp,&size)==ERROR_SUCCESS) |
| 641 |
iResX=(int)temp; |
| 642 |
size = 4; |
| 643 |
if(RegQueryValueEx(myKey,"ResY",0,&type,(LPBYTE)&temp,&size)==ERROR_SUCCESS) |
| 644 |
iResY=(int)temp; |
| 645 |
size = 4; |
| 646 |
if(RegQueryValueEx(myKey,"WinSize",0,&type,(LPBYTE)&temp,&size)==ERROR_SUCCESS) |
| 647 |
iWinSize=(int)temp; |
| 648 |
size = 4; |
| 649 |
if(RegQueryValueEx(myKey,"FilterType",0,&type,(LPBYTE)&temp,&size)==ERROR_SUCCESS) |
| 650 |
iFilterType=(int)temp; |
| 651 |
size = 4; |
| 652 |
if(RegQueryValueEx(myKey,"DrawDither",0,&type,(LPBYTE)&temp,&size)==ERROR_SUCCESS) |
| 653 |
bDrawDither=(BOOL)temp; |
| 654 |
size = 4; |
| 655 |
if(RegQueryValueEx(myKey,"UseLines",0,&type,(LPBYTE)&temp,&size)==ERROR_SUCCESS) |
| 656 |
bUseLines=(BOOL)temp; |
| 657 |
size = 4; |
| 658 |
if(RegQueryValueEx(myKey,"WindowMode",0,&type,(LPBYTE)&temp,&size)==ERROR_SUCCESS) |
| 659 |
bWindowMode=(BOOL)temp; |
| 660 |
size = 4; |
| 661 |
if(RegQueryValueEx(myKey,"ColDepth",0,&type,(LPBYTE)&temp,&size)==ERROR_SUCCESS) |
| 662 |
iColDepth=(int)temp; |
| 663 |
size = 4; |
| 664 |
if(RegQueryValueEx(myKey,"ForceVSync",0,&type,(LPBYTE)&temp,&size)==ERROR_SUCCESS) |
| 665 |
iForceVSync=(int)temp; |
| 666 |
size = 4; |
| 667 |
if(RegQueryValueEx(myKey,"UseFrameLimit",0,&type,(LPBYTE)&temp,&size)==ERROR_SUCCESS) |
| 668 |
bUseFrameLimit=(BOOL)temp; |
| 669 |
size = 4; |
| 670 |
if(RegQueryValueEx(myKey,"UseFrameSkip",0,&type,(LPBYTE)&temp,&size)==ERROR_SUCCESS) |
| 671 |
bUseFrameSkip=(BOOL)temp; |
| 672 |
size = 4; |
| 673 |
if(RegQueryValueEx(myKey,"FrameLimit",0,&type,(LPBYTE)&temp,&size)==ERROR_SUCCESS) |
| 674 |
iFrameLimit=(int)temp; |
| 675 |
if(!iFrameLimit) {bUseFrameLimit=TRUE;bUseFrameSkip=FALSE;iFrameLimit=2;} |
| 676 |
|
| 677 |
// try to get the float framerate... if none: take int framerate |
| 678 |
fFrameRate=0.0f; |
| 679 |
size = 4; |
| 680 |
if(RegQueryValueEx(myKey,"FrameRateFloat",0,&type,(LPBYTE)&temp,&size)==ERROR_SUCCESS) |
| 681 |
fFrameRate=*((float *)(&temp)); |
| 682 |
if(fFrameRate==0.0f) |
| 683 |
{ |
| 684 |
fFrameRate=200.0f; |
| 685 |
size = 4; |
| 686 |
if(RegQueryValueEx(myKey,"FrameRate",0,&type,(LPBYTE)&temp,&size)==ERROR_SUCCESS) |
| 687 |
fFrameRate=(float)temp; |
| 688 |
} |
| 689 |
|
| 690 |
size = 4; |
| 691 |
if(RegQueryValueEx(myKey,"UseMultiPass",0,&type,(LPBYTE)&temp,&size)==ERROR_SUCCESS) |
| 692 |
bAdvancedBlend=(int)temp; |
| 693 |
size = 4; |
| 694 |
iOffscreenDrawing=-1; |
| 695 |
if(RegQueryValueEx(myKey,"OffscreenDrawingEx",0,&type,(LPBYTE)&temp,&size)==ERROR_SUCCESS) |
| 696 |
iOffscreenDrawing=temp; |
| 697 |
if(iOffscreenDrawing==-1 && |
| 698 |
RegQueryValueEx(myKey,"OffscreenDrawing",0,&type,(LPBYTE)&temp,&size)==ERROR_SUCCESS) |
| 699 |
iOffscreenDrawing=temp*2; |
| 700 |
size = 4; |
| 701 |
if(RegQueryValueEx(myKey,"OpaquePass",0,&type,(LPBYTE)&temp,&size)==ERROR_SUCCESS) |
| 702 |
bOpaquePass=(BOOL)temp; |
| 703 |
size = 4; |
| 704 |
if(RegQueryValueEx(myKey,"VRamSize",0,&type,(LPBYTE)&temp,&size)==ERROR_SUCCESS) |
| 705 |
iVRamSize=(int)temp; |
| 706 |
// size = 4; |
| 707 |
// if(RegQueryValueEx(myKey,"UseAntiAlias",0,&type,(LPBYTE)&temp,&size)==ERROR_SUCCESS) |
| 708 |
// bUseAntiAlias=(BOOL)temp; |
| 709 |
size = 4; |
| 710 |
if(RegQueryValueEx(myKey,"TexQuality",0,&type,(LPBYTE)&temp,&size)==ERROR_SUCCESS) |
| 711 |
iTexQuality=(int)temp; |
| 712 |
size = 4; |
| 713 |
if(RegQueryValueEx(myKey,"CfgFixes",0,&type,(LPBYTE)&temp,&size)==ERROR_SUCCESS) |
| 714 |
dwCfgFixes=(int)temp; |
| 715 |
size = 4; |
| 716 |
if(RegQueryValueEx(myKey,"UseFixes",0,&type,(LPBYTE)&temp,&size)==ERROR_SUCCESS) |
| 717 |
bUseFixes=(BOOL)temp; |
| 718 |
size = 4; |
| 719 |
if(RegQueryValueEx(myKey,"GteAccuracy",0,&type,(LPBYTE)&temp,&size)==ERROR_SUCCESS) |
| 720 |
bGteAccuracy=(BOOL)temp; |
| 721 |
size = 4; |
| 722 |
if(RegQueryValueEx(myKey,"UseMask",0,&type,(LPBYTE)&temp,&size)==ERROR_SUCCESS) |
| 723 |
iUseMask=(int)temp; |
| 724 |
size = 4; |
| 725 |
if(RegQueryValueEx(myKey,"FastMdec",0,&type,(LPBYTE)&temp,&size)==ERROR_SUCCESS) |
| 726 |
bUseFastMdec=(BOOL)temp; |
| 727 |
size = 4; |
| 728 |
if(RegQueryValueEx(myKey,"15BitMdec",0,&type,(LPBYTE)&temp,&size)==ERROR_SUCCESS) |
| 729 |
bUse15bitMdec=(BOOL)temp; |
| 730 |
size = 4; |
| 731 |
if(RegQueryValueEx(myKey,"UseScanLines",0,&type,(LPBYTE)&temp,&size)==ERROR_SUCCESS) |
| 732 |
iUseScanLines=(int)temp; |
| 733 |
size = 4; |
| 734 |
if(RegQueryValueEx(myKey,"ShowFPS",0,&type,(LPBYTE)&temp,&size)==ERROR_SUCCESS) |
| 735 |
iShowFPS=(int)temp; |
| 736 |
size = 4; |
| 737 |
if(RegQueryValueEx(myKey,"KeepRatio",0,&type,(LPBYTE)&temp,&size)==ERROR_SUCCESS) |
| 738 |
bKeepRatio=(BOOL)temp; |
| 739 |
size = 4; |
| 740 |
if(RegQueryValueEx(myKey,"ForceRatio43",0,&type,(LPBYTE)&temp,&size)==ERROR_SUCCESS) |
| 741 |
bForceRatio43=(BOOL)temp; |
| 742 |
size = 4; |
| 743 |
if(RegQueryValueEx(myKey,"ScanBlend",0,&type,(LPBYTE)&temp,&size)==ERROR_SUCCESS) |
| 744 |
iScanBlend=(int)temp; |
| 745 |
size = 4; |
| 746 |
if(RegQueryValueEx(myKey,"FrameTexType",0,&type,(LPBYTE)&temp,&size)==ERROR_SUCCESS) |
| 747 |
iFrameTexType=(int)temp; |
| 748 |
size = 4; |
| 749 |
if(RegQueryValueEx(myKey,"FrameReadType",0,&type,(LPBYTE)&temp,&size)==ERROR_SUCCESS) |
| 750 |
iFrameReadType=(int)temp; |
| 751 |
size = 4; |
| 752 |
if(RegQueryValueEx(myKey,"FullscreenBlur",0,&type,(LPBYTE)&temp,&size)==ERROR_SUCCESS) |
| 753 |
iBlurBuffer=(int)temp; |
| 754 |
size = 4; |
| 755 |
if(RegQueryValueEx(myKey,"HiResTextures",0,&type,(LPBYTE)&temp,&size)==ERROR_SUCCESS) |
| 756 |
iHiResTextures=(int)temp; |
| 757 |
size = 4; |
| 758 |
if(RegQueryValueEx(myKey,"NoScreenSaver",0,&type,(LPBYTE)&temp,&size)==ERROR_SUCCESS) |
| 759 |
iNoScreenSaver=(int)temp; |
| 760 |
|
| 761 |
size=7; |
| 762 |
RegQueryValueEx(myKey,"GPUKeys",0,&type,(LPBYTE)&szGPUKeys,&size); |
| 763 |
|
| 764 |
RegCloseKey(myKey); |
| 765 |
} |
| 766 |
if(!iColDepth) iColDepth=32; // adjust color info |
| 767 |
if(iUseMask) iZBufferDepth=16; // set zbuffer depth |
| 768 |
else iZBufferDepth=0; |
| 769 |
if(bUseFixes) dwActFixes=dwCfgFixes; // init game fix global |
| 770 |
if(iFrameReadType==4) bFullVRam=TRUE; // set fullvram render flag (soft gpu) |
| 771 |
} |
| 772 |
|
| 773 |
//////////////////////////////////////////////////////////////////////// |
| 774 |
// read registry: window size (called on fullscreen/window resize) |
| 775 |
//////////////////////////////////////////////////////////////////////// |
| 776 |
|
| 777 |
void ReadWinSizeConfig(void) |
| 778 |
{ |
| 779 |
HKEY myKey; |
| 780 |
DWORD temp; |
| 781 |
DWORD type; |
| 782 |
DWORD size; |
| 783 |
|
| 784 |
iResX=800;iResY=600; |
| 785 |
iWinSize=MAKELONG(400,300); |
| 786 |
iBlurBuffer=0; |
| 787 |
|
| 788 |
// registry key: still "psemu pro/pete tnt" for compatibility reasons |
| 789 |
|
| 790 |
if (RegOpenKeyEx(HKEY_CURRENT_USER,"Software\\Vision Thing\\PSEmu Pro\\GPU\\PeteTNT",0,KEY_ALL_ACCESS,&myKey)==ERROR_SUCCESS) |
| 791 |
{ |
| 792 |
size = 4; |
| 793 |
if(RegQueryValueEx(myKey,"ResX",0,&type,(LPBYTE)&temp,&size)==ERROR_SUCCESS) |
| 794 |
iResX=(int)temp; |
| 795 |
size = 4; |
| 796 |
if(RegQueryValueEx(myKey,"ResY",0,&type,(LPBYTE)&temp,&size)==ERROR_SUCCESS) |
| 797 |
iResY=(int)temp; |
| 798 |
size = 4; |
| 799 |
if(RegQueryValueEx(myKey,"WinSize",0,&type,(LPBYTE)&temp,&size)==ERROR_SUCCESS) |
| 800 |
iWinSize=(int)temp; |
| 801 |
size = 4; |
| 802 |
if(RegQueryValueEx(myKey,"FullscreenBlur",0,&type,(LPBYTE)&temp,&size)==ERROR_SUCCESS) |
| 803 |
iBlurBuffer=(int)temp; |
| 804 |
RegCloseKey(myKey); |
| 805 |
} |
| 806 |
} |
| 807 |
|
| 808 |
//////////////////////////////////////////////////////////////////////// |
| 809 |
// write registry |
| 810 |
//////////////////////////////////////////////////////////////////////// |
| 811 |
|
| 812 |
void WriteConfig(void) |
| 813 |
{ |
| 814 |
HKEY myKey; |
| 815 |
DWORD myDisp; |
| 816 |
DWORD temp; |
| 817 |
|
| 818 |
// registry key: still "psemu pro/pete tnt" for compatibility reasons |
| 819 |
|
| 820 |
RegCreateKeyEx(HKEY_CURRENT_USER,"Software\\Vision Thing\\PSEmu Pro\\GPU\\PeteTNT",0,NULL,REG_OPTION_NON_VOLATILE,KEY_ALL_ACCESS,NULL,&myKey,&myDisp); |
| 821 |
temp=iResX; |
| 822 |
RegSetValueEx(myKey,"ResX",0,REG_DWORD,(LPBYTE) &temp,sizeof(temp)); |
| 823 |
temp=iResY; |
| 824 |
RegSetValueEx(myKey,"ResY",0,REG_DWORD,(LPBYTE) &temp,sizeof(temp)); |
| 825 |
temp=iWinSize; |
| 826 |
RegSetValueEx(myKey,"WinSize",0,REG_DWORD,(LPBYTE) &temp,sizeof(temp)); |
| 827 |
temp=iFilterType; |
| 828 |
RegSetValueEx(myKey,"FilterType",0,REG_DWORD,(LPBYTE) &temp,sizeof(temp)); |
| 829 |
temp=bDrawDither; |
| 830 |
RegSetValueEx(myKey,"DrawDither",0,REG_DWORD,(LPBYTE) &temp,sizeof(temp)); |
| 831 |
temp=bUseLines; |
| 832 |
RegSetValueEx(myKey,"UseLines",0,REG_DWORD,(LPBYTE) &temp,sizeof(temp)); |
| 833 |
temp=bWindowMode; |
| 834 |
RegSetValueEx(myKey,"WindowMode",0,REG_DWORD,(LPBYTE) &temp,sizeof(temp)); |
| 835 |
temp=iColDepth; |
| 836 |
RegSetValueEx(myKey,"ColDepth",0,REG_DWORD,(LPBYTE) &temp,sizeof(temp)); |
| 837 |
temp=iForceVSync; |
| 838 |
RegSetValueEx(myKey,"ForceVSync",0,REG_DWORD,(LPBYTE) &temp,sizeof(temp)); |
| 839 |
temp=bUseFrameLimit; |
| 840 |
RegSetValueEx(myKey,"UseFrameLimit",0,REG_DWORD,(LPBYTE) &temp,sizeof(temp)); |
| 841 |
temp=bUseFrameSkip; |
| 842 |
RegSetValueEx(myKey,"UseFrameSkip",0,REG_DWORD,(LPBYTE) &temp,sizeof(temp)); |
| 843 |
temp=iFrameLimit; |
| 844 |
RegSetValueEx(myKey,"FrameLimit",0,REG_DWORD,(LPBYTE) &temp,sizeof(temp)); |
| 845 |
temp=(DWORD)fFrameRate; |
| 846 |
RegSetValueEx(myKey,"FrameRate",0,REG_DWORD,(LPBYTE) &temp,sizeof(temp)); |
| 847 |
temp=*((DWORD *)&fFrameRate); |
| 848 |
RegSetValueEx(myKey,"FrameRateFloat",0,REG_DWORD,(LPBYTE) &temp,sizeof(temp)); |
| 849 |
temp=bAdvancedBlend; |
| 850 |
RegSetValueEx(myKey,"UseMultiPass",0,REG_DWORD,(LPBYTE) &temp,sizeof(temp)); |
| 851 |
temp=iOffscreenDrawing/2; |
| 852 |
RegSetValueEx(myKey,"OffscreenDrawing",0,REG_DWORD,(LPBYTE) &temp,sizeof(temp)); |
| 853 |
temp=iOffscreenDrawing; |
| 854 |
RegSetValueEx(myKey,"OffscreenDrawingEx",0,REG_DWORD,(LPBYTE) &temp,sizeof(temp)); |
| 855 |
temp=bOpaquePass; |
| 856 |
RegSetValueEx(myKey,"OpaquePass",0,REG_DWORD,(LPBYTE) &temp,sizeof(temp)); |
| 857 |
temp=iVRamSize; |
| 858 |
RegSetValueEx(myKey,"VRamSize",0,REG_DWORD,(LPBYTE) &temp,sizeof(temp)); |
| 859 |
// temp=bUseAntiAlias; |
| 860 |
// RegSetValueEx(myKey,"UseAntiAlias",0,REG_DWORD,(LPBYTE) &temp,sizeof(temp)); |
| 861 |
temp=iTexQuality; |
| 862 |
RegSetValueEx(myKey,"TexQuality",0,REG_DWORD,(LPBYTE) &temp,sizeof(temp)); |
| 863 |
temp=dwCfgFixes; |
| 864 |
RegSetValueEx(myKey,"CfgFixes",0,REG_DWORD,(LPBYTE) &temp,sizeof(temp)); |
| 865 |
temp=bUseFixes; |
| 866 |
RegSetValueEx(myKey,"UseFixes",0,REG_DWORD,(LPBYTE) &temp,sizeof(temp)); |
| 867 |
temp=bGteAccuracy; |
| 868 |
RegSetValueEx(myKey,"GteAccuracy",0,REG_DWORD,(LPBYTE) &temp,sizeof(temp)); |
| 869 |
temp=iUseMask; |
| 870 |
RegSetValueEx(myKey,"UseMask",0,REG_DWORD,(LPBYTE) &temp,sizeof(temp)); |
| 871 |
temp=bUseFastMdec; |
| 872 |
RegSetValueEx(myKey,"FastMdec",0,REG_DWORD,(LPBYTE) &temp,sizeof(temp)); |
| 873 |
temp=bUse15bitMdec; |
| 874 |
RegSetValueEx(myKey,"15BitMdec",0,REG_DWORD,(LPBYTE) &temp,sizeof(temp)); |
| 875 |
temp=iUseScanLines; |
| 876 |
RegSetValueEx(myKey,"UseScanLines",0,REG_DWORD,(LPBYTE) &temp,sizeof(temp)); |
| 877 |
temp=iShowFPS; |
| 878 |
RegSetValueEx(myKey,"ShowFPS",0,REG_DWORD,(LPBYTE) &temp,sizeof(temp)); |
| 879 |
temp=iFrameTexType; |
| 880 |
RegSetValueEx(myKey,"FrameTexType",0,REG_DWORD,(LPBYTE) &temp,sizeof(temp)); |
| 881 |
temp=iFrameReadType; |
| 882 |
RegSetValueEx(myKey,"FrameReadType",0,REG_DWORD,(LPBYTE) &temp,sizeof(temp)); |
| 883 |
temp=bKeepRatio; |
| 884 |
RegSetValueEx(myKey,"KeepRatio",0,REG_DWORD,(LPBYTE) &temp,sizeof(temp)); |
| 885 |
temp=bForceRatio43; |
| 886 |
RegSetValueEx(myKey,"ForceRatio43",0,REG_DWORD,(LPBYTE) &temp,sizeof(temp)); |
| 887 |
temp=iBlurBuffer; |
| 888 |
RegSetValueEx(myKey,"FullscreenBlur",0,REG_DWORD,(LPBYTE) &temp,sizeof(temp)); |
| 889 |
temp=iHiResTextures; |
| 890 |
RegSetValueEx(myKey,"HiResTextures",0,REG_DWORD,(LPBYTE) &temp,sizeof(temp)); |
| 891 |
temp=iNoScreenSaver; |
| 892 |
RegSetValueEx(myKey,"NoScreenSaver",0,REG_DWORD,(LPBYTE) &temp,sizeof(temp)); |
| 893 |
temp=iScanBlend; |
| 894 |
RegSetValueEx(myKey,"ScanBlend",0,REG_DWORD,(LPBYTE) &temp,sizeof(temp)); |
| 895 |
RegSetValueEx(myKey,"GPUKeys",0,REG_BINARY,(LPBYTE)szGPUKeys,7); |
| 896 |
|
| 897 |
RegCloseKey(myKey); |
| 898 |
} |
| 899 |
|
| 900 |
//////////////////////////////////////////////////////////////////////// |
| 901 |
//////////////////////////////////////////////////////////////////////// |
| 902 |
//////////////////////////////////////////////////////////////////////// |
| 903 |
// Key definition window |
| 904 |
|
| 905 |
typedef struct |
| 906 |
{ |
| 907 |
char szName[10]; |
| 908 |
char cCode; |
| 909 |
} |
| 910 |
KEYSETS; |
| 911 |
|
| 912 |
// sepcial keys: |
| 913 |
|
| 914 |
KEYSETS tMKeys[]= |
| 915 |
{ |
| 916 |
{"SPACE", 0x20}, |
| 917 |
{"PRIOR", 0x21}, |
| 918 |
{"NEXT", 0x22}, |
| 919 |
{"END", 0x23}, |
| 920 |
{"HOME", 0x24}, |
| 921 |
{"LEFT", 0x25}, |
| 922 |
{"UP", 0x26}, |
| 923 |
{"RIGHT", 0x27}, |
| 924 |
{"DOWN", 0x28}, |
| 925 |
{"SELECT", 0x29}, |
| 926 |
{"PRINT", 0x2A}, |
| 927 |
{"EXECUTE", 0x2B}, |
| 928 |
{"SNAPSHOT", 0x2C}, |
| 929 |
{"INSERT", 0x2D}, |
| 930 |
{"DELETE", 0x2E}, |
| 931 |
{"HELP", 0x2F}, |
| 932 |
{"NUMPAD0", 0x60}, |
| 933 |
{"NUMPAD1", 0x61}, |
| 934 |
{"NUMPAD2", 0x62}, |
| 935 |
{"NUMPAD3", 0x63}, |
| 936 |
{"NUMPAD4", 0x64}, |
| 937 |
{"NUMPAD5", 0x65}, |
| 938 |
{"NUMPAD6", 0x66}, |
| 939 |
{"NUMPAD7", 0x67}, |
| 940 |
{"NUMPAD8", 0x68}, |
| 941 |
{"NUMPAD9", 0x69}, |
| 942 |
{"MULTIPLY", 0x6A}, |
| 943 |
{"ADD", 0x6B}, |
| 944 |
{"SEPARATOR", 0x6C}, |
| 945 |
{"SUBTRACT", 0x6D}, |
| 946 |
{"DECIMAL", 0x6E}, |
| 947 |
{"DIVIDE", 0x6F}, |
| 948 |
{"", 0x00} |
| 949 |
}; |
| 950 |
|
| 951 |
// select key entry in combo box |
| 952 |
|
| 953 |
void SetGPUKey(HWND hWC,char szKey) |
| 954 |
{ |
| 955 |
int i,iCnt=ComboBox_GetCount(hWC); |
| 956 |
for(i=0;i<iCnt;i++) |
| 957 |
{ |
| 958 |
if(ComboBox_GetItemData(hWC,i)==szKey) break; |
| 959 |
} |
| 960 |
if(i!=iCnt) ComboBox_SetCurSel(hWC,i); |
| 961 |
} |
| 962 |
|
| 963 |
// key window proc |
| 964 |
|
| 965 |
BOOL CALLBACK KeyDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam) |
| 966 |
{ |
| 967 |
switch(uMsg) |
| 968 |
{ |
| 969 |
case WM_INITDIALOG: // init dialog |
| 970 |
{ |
| 971 |
int i,j,k;char szB[2];HWND hWC; |
| 972 |
for(i=IDC_KEY1;i<=IDC_KEY6;i++) |
| 973 |
{ |
| 974 |
hWC=GetDlgItem(hW,i); |
| 975 |
|
| 976 |
for(j=0;tMKeys[j].cCode!=0;j++) // fill special keys in combo |
| 977 |
{ |
| 978 |
k=ComboBox_AddString(hWC,tMKeys[j].szName); |
| 979 |
ComboBox_SetItemData(hWC,k,tMKeys[j].cCode); |
| 980 |
} |
| 981 |
for(j=0x30;j<=0x39;j++) // fill numbers in combo |
| 982 |
{ |
| 983 |
wsprintf(szB,"%c",j); |
| 984 |
k=ComboBox_AddString(hWC,szB); |
| 985 |
ComboBox_SetItemData(hWC,k,j); |
| 986 |
} |
| 987 |
for(j=0x41;j<=0x5a;j++) // fill alphas in combo |
| 988 |
{ |
| 989 |
wsprintf(szB,"%c",j); |
| 990 |
k=ComboBox_AddString(hWC,szB); |
| 991 |
ComboBox_SetItemData(hWC,k,j); |
| 992 |
} |
| 993 |
SetGPUKey(GetDlgItem(hW,i),szGPUKeys[i-IDC_KEY1]); |
| 994 |
} |
| 995 |
}return TRUE; |
| 996 |
|
| 997 |
case WM_COMMAND: |
| 998 |
{ |
| 999 |
switch(LOWORD(wParam)) |
| 1000 |
{ |
| 1001 |
case IDC_DEFAULT: // default button: |
| 1002 |
{ |
| 1003 |
int i; // -> set defaults |
| 1004 |
for(i=IDC_KEY1;i<=IDC_KEY6;i++) |
| 1005 |
SetGPUKey(GetDlgItem(hW,i),szKeyDefaults[i-IDC_KEY1]); |
| 1006 |
}break; |
| 1007 |
|
| 1008 |
case IDCANCEL: // cancel: just close window |
| 1009 |
EndDialog(hW,FALSE); return TRUE; |
| 1010 |
|
| 1011 |
case IDOK: // ok: take key bindings |
| 1012 |
{ |
| 1013 |
HWND hWC;int i; |
| 1014 |
for(i=IDC_KEY1;i<=IDC_KEY6;i++) |
| 1015 |
{ |
| 1016 |
hWC=GetDlgItem(hW,i); |
| 1017 |
szGPUKeys[i-IDC_KEY1]=ComboBox_GetItemData(hWC,ComboBox_GetCurSel(hWC)); |
| 1018 |
if(szGPUKeys[i-IDC_KEY1]<0x20) szGPUKeys[i-IDC_KEY1]=0x20; |
| 1019 |
} |
| 1020 |
EndDialog(hW,TRUE); |
| 1021 |
return TRUE; |
| 1022 |
} |
| 1023 |
} |
| 1024 |
} |
| 1025 |
} |
| 1026 |
return FALSE; |
| 1027 |
} |
| 1028 |
|
| 1029 |
void OnKeyConfig(HWND hW) // call key dialog |
| 1030 |
{ |
| 1031 |
DialogBox(hInst,MAKEINTRESOURCE(IDD_KEYS), |
| 1032 |
hW,(DLGPROC)KeyDlgProc); |
| 1033 |
} |
| 1034 |
|
| 1035 |
///////////////////////////////////////////////////////////////////////////// |
| 1036 |
// AboutDlg dialog (Windows) |
| 1037 |
|
| 1038 |
BOOL CALLBACK AboutDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam) |
| 1039 |
{ |
| 1040 |
switch(uMsg) |
| 1041 |
{ |
| 1042 |
case WM_COMMAND: |
| 1043 |
{ |
| 1044 |
switch(LOWORD(wParam)) |
| 1045 |
{ |
| 1046 |
case IDOK: EndDialog(hW,TRUE);return TRUE; |
| 1047 |
} |
| 1048 |
} |
| 1049 |
} |
| 1050 |
return FALSE; |
| 1051 |
} |