diff src/win32/MainWndOptions.cpp @ 1:f9f4f1b99eed

importing src directory
author Robert McIntyre <rlm@mit.edu>
date Sat, 03 Mar 2012 10:31:27 -0600
parents
children
line wrap: on
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/win32/MainWndOptions.cpp	Sat Mar 03 10:31:27 2012 -0600
     1.3 @@ -0,0 +1,2309 @@
     1.4 +#include "stdafx.h"
     1.5 +#include "resource.h"
     1.6 +#include "MainWnd.h"
     1.7 +#include "Associate.h"
     1.8 +#include "Directories.h"
     1.9 +#include "FileDlg.h"
    1.10 +#include "GBColorDlg.h"
    1.11 +#include "Joypad.h"
    1.12 +#include "MaxScale.h"
    1.13 +#include "ModeConfirm.h"
    1.14 +#include "Reg.h"
    1.15 +#include "RewindInterval.h"
    1.16 +#include "Throttle.h"
    1.17 +#include "TextOptions.h"
    1.18 +#include "WinResUtil.h"
    1.19 +#include "VBA.h"
    1.20 +
    1.21 +#include "../gba/GBA.h"
    1.22 +#include "../gba/GBAGlobals.h"
    1.23 +#include "../gba/Flash.h"
    1.24 +#include "../gba/GBASound.h"
    1.25 +#include "../gba/agbprint.h"
    1.26 +#include "../gb/GB.h"
    1.27 +#include "../gb/gbGlobals.h"
    1.28 +#include "../gb/gbPrinter.h"
    1.29 +#include "../common/inputGlobal.h"
    1.30 +#include "../common/movie.h"
    1.31 +#include "../version.h"
    1.32 +
    1.33 +extern int emulating;
    1.34 +
    1.35 +#define VBA_CONFIRM_MODE WM_APP + 100
    1.36 +
    1.37 +void MainWnd::OnOptionsFrameskipThrottleNothrottle()
    1.38 +{
    1.39 +	systemSetThrottle(0);
    1.40 +}
    1.41 +
    1.42 +void MainWnd::OnUpdateOptionsFrameskipThrottleNothrottle(CCmdUI*pCmdUI)
    1.43 +{
    1.44 +	pCmdUI->SetCheck(theApp.throttle == 0);
    1.45 +}
    1.46 +
    1.47 +void MainWnd::OnOptionsFrameskipThrottle6()
    1.48 +{
    1.49 +	systemSetThrottle(6);
    1.50 +}
    1.51 +
    1.52 +void MainWnd::OnUpdateOptionsFrameskipThrottle6(CCmdUI*pCmdUI)
    1.53 +{
    1.54 +	pCmdUI->SetCheck(theApp.throttle == 6);
    1.55 +}
    1.56 +
    1.57 +void MainWnd::OnOptionsFrameskipThrottle15()
    1.58 +{
    1.59 +	systemSetThrottle(15);
    1.60 +}
    1.61 +
    1.62 +void MainWnd::OnUpdateOptionsFrameskipThrottle15(CCmdUI*pCmdUI)
    1.63 +{
    1.64 +	pCmdUI->SetCheck(theApp.throttle == 15);
    1.65 +}
    1.66 +
    1.67 +void MainWnd::OnOptionsFrameskipThrottle25()
    1.68 +{
    1.69 +	systemSetThrottle(25);
    1.70 +}
    1.71 +
    1.72 +void MainWnd::OnUpdateOptionsFrameskipThrottle25(CCmdUI*pCmdUI)
    1.73 +{
    1.74 +	pCmdUI->SetCheck(theApp.throttle == 25);
    1.75 +}
    1.76 +
    1.77 +void MainWnd::OnOptionsFrameskipThrottle50()
    1.78 +{
    1.79 +	systemSetThrottle(50);
    1.80 +}
    1.81 +
    1.82 +void MainWnd::OnUpdateOptionsFrameskipThrottle50(CCmdUI*pCmdUI)
    1.83 +{
    1.84 +	pCmdUI->SetCheck(theApp.throttle == 50);
    1.85 +}
    1.86 +
    1.87 +void MainWnd::OnOptionsFrameskipThrottle75()
    1.88 +{
    1.89 +	systemSetThrottle(75);
    1.90 +}
    1.91 +
    1.92 +void MainWnd::OnUpdateOptionsFrameskipThrottle75(CCmdUI*pCmdUI)
    1.93 +{
    1.94 +	pCmdUI->SetCheck(theApp.throttle == 75);
    1.95 +}
    1.96 +
    1.97 +void MainWnd::OnOptionsFrameskipThrottle100()
    1.98 +{
    1.99 +	systemSetThrottle(100);
   1.100 +}
   1.101 +
   1.102 +void MainWnd::OnUpdateOptionsFrameskipThrottle100(CCmdUI*pCmdUI)
   1.103 +{
   1.104 +	pCmdUI->SetCheck(theApp.throttle == 100);
   1.105 +}
   1.106 +
   1.107 +void MainWnd::OnOptionsFrameskipThrottle125()
   1.108 +{
   1.109 +	systemSetThrottle(125);
   1.110 +}
   1.111 +
   1.112 +void MainWnd::OnUpdateOptionsFrameskipThrottle125(CCmdUI*pCmdUI)
   1.113 +{
   1.114 +	pCmdUI->SetCheck(theApp.throttle == 125);
   1.115 +}
   1.116 +
   1.117 +void MainWnd::OnOptionsFrameskipThrottle150()
   1.118 +{
   1.119 +	systemSetThrottle(150);
   1.120 +}
   1.121 +
   1.122 +void MainWnd::OnUpdateOptionsFrameskipThrottle150(CCmdUI*pCmdUI)
   1.123 +{
   1.124 +	pCmdUI->SetCheck(theApp.throttle == 150);
   1.125 +}
   1.126 +
   1.127 +void MainWnd::OnOptionsFrameskipThrottle200()
   1.128 +{
   1.129 +	systemSetThrottle(200);
   1.130 +}
   1.131 +
   1.132 +void MainWnd::OnUpdateOptionsFrameskipThrottle200(CCmdUI*pCmdUI)
   1.133 +{
   1.134 +	pCmdUI->SetCheck(theApp.throttle == 200);
   1.135 +}
   1.136 +
   1.137 +void MainWnd::OnOptionsFrameskipThrottle300()
   1.138 +{
   1.139 +	systemSetThrottle(300);
   1.140 +}
   1.141 +
   1.142 +void MainWnd::OnUpdateOptionsFrameskipThrottle300(CCmdUI*pCmdUI)
   1.143 +{
   1.144 +	pCmdUI->SetCheck(theApp.throttle == 300);
   1.145 +}
   1.146 +
   1.147 +void MainWnd::OnOptionsFrameskipThrottle400()
   1.148 +{
   1.149 +	systemSetThrottle(400);
   1.150 +}
   1.151 +
   1.152 +void MainWnd::OnUpdateOptionsFrameskipThrottle400(CCmdUI*pCmdUI)
   1.153 +{
   1.154 +	pCmdUI->SetCheck(theApp.throttle == 400);
   1.155 +}
   1.156 +
   1.157 +void MainWnd::OnOptionsFrameskipThrottle600()
   1.158 +{
   1.159 +	systemSetThrottle(600);
   1.160 +}
   1.161 +
   1.162 +void MainWnd::OnUpdateOptionsFrameskipThrottle600(CCmdUI*pCmdUI)
   1.163 +{
   1.164 +	pCmdUI->SetCheck(theApp.throttle == 600);
   1.165 +}
   1.166 +
   1.167 +void MainWnd::OnOptionsFrameskipThrottle1000()
   1.168 +{
   1.169 +	systemSetThrottle(1000);
   1.170 +}
   1.171 +
   1.172 +void MainWnd::OnUpdateOptionsFrameskipThrottle1000(CCmdUI*pCmdUI)
   1.173 +{
   1.174 +	pCmdUI->SetCheck(theApp.throttle == 1000);
   1.175 +}
   1.176 +
   1.177 +void MainWnd::OnOptionsFrameskipThrottleOther()
   1.178 +{
   1.179 +	Throttle dlg;
   1.180 +	int      v = dlg.DoModal();
   1.181 +	if (v)
   1.182 +		systemSetThrottle(v);
   1.183 +}
   1.184 +
   1.185 +void MainWnd::OnUpdateOptionsFrameskipThrottleOther(CCmdUI*pCmdUI)
   1.186 +{
   1.187 +}
   1.188 +
   1.189 +void MainWnd::OnOptionsFrameskipThrottleIncrease()
   1.190 +{
   1.191 +	systemIncreaseThrottle();
   1.192 +}
   1.193 +
   1.194 +void MainWnd::OnUpdateOptionsFrameskipThrottleIncrease(CCmdUI*pCmdUI)
   1.195 +{
   1.196 +}
   1.197 +
   1.198 +void MainWnd::OnOptionsFrameskipThrottleDecrease()
   1.199 +{
   1.200 +	systemDecreaseThrottle();
   1.201 +}
   1.202 +
   1.203 +void MainWnd::OnUpdateOptionsFrameskipThrottleDecrease(CCmdUI*pCmdUI)
   1.204 +{
   1.205 +}
   1.206 +
   1.207 +/*
   1.208 +   void MainWnd::OnOptionsFrameskipAutomatic()
   1.209 +   {
   1.210 +   theApp.autoFrameSkip = !theApp.autoFrameSkip;
   1.211 +   if(!theApp.autoFrameSkip && emulating)
   1.212 +    theApp.updateFrameSkip();
   1.213 +   }
   1.214 +
   1.215 +   void MainWnd::OnUpdateOptionsFrameskipAutomatic(CCmdUI* pCmdUI)
   1.216 +   {
   1.217 +   pCmdUI->SetCheck(theApp.autoFrameSkip);
   1.218 +   }
   1.219 + */
   1.220 +
   1.221 +void MainWnd::OnOptionsFrameskipAccuratePitch()
   1.222 +{
   1.223 +	theApp.accuratePitchThrottle = true;
   1.224 +}
   1.225 +
   1.226 +void MainWnd::OnUpdateOptionsFrameskipAccuratePitch(CCmdUI*pCmdUI)
   1.227 +{
   1.228 +	pCmdUI->SetCheck(theApp.accuratePitchThrottle);
   1.229 +	pCmdUI->Enable(!soundOffFlag && synchronize);
   1.230 +}
   1.231 +
   1.232 +void MainWnd::OnOptionsFrameskipAccurateSpeed()
   1.233 +{
   1.234 +	theApp.accuratePitchThrottle = false;
   1.235 +}
   1.236 +
   1.237 +void MainWnd::OnUpdateOptionsFrameskipAccurateSpeed(CCmdUI*pCmdUI)
   1.238 +{
   1.239 +	pCmdUI->SetCheck(!theApp.accuratePitchThrottle);
   1.240 +	pCmdUI->Enable(!soundOffFlag && synchronize);
   1.241 +}
   1.242 +
   1.243 +BOOL MainWnd::OnOptionsFrameskip(UINT nID)
   1.244 +{
   1.245 +	switch (nID)
   1.246 +	{
   1.247 +	case ID_OPTIONS_VIDEO_FRAMESKIP_0:
   1.248 +	case ID_OPTIONS_VIDEO_FRAMESKIP_1:
   1.249 +	case ID_OPTIONS_VIDEO_FRAMESKIP_2:
   1.250 +	case ID_OPTIONS_VIDEO_FRAMESKIP_3:
   1.251 +	case ID_OPTIONS_VIDEO_FRAMESKIP_4:
   1.252 +	case ID_OPTIONS_VIDEO_FRAMESKIP_5:
   1.253 +	case ID_OPTIONS_VIDEO_FRAMESKIP_6:
   1.254 +	case ID_OPTIONS_VIDEO_FRAMESKIP_7:
   1.255 +	case ID_OPTIONS_VIDEO_FRAMESKIP_8:
   1.256 +	case ID_OPTIONS_VIDEO_FRAMESKIP_9:
   1.257 +		if (systemCartridgeType == 0)
   1.258 +		{
   1.259 +			frameSkip = nID - ID_OPTIONS_VIDEO_FRAMESKIP_0;
   1.260 +		}
   1.261 +		else
   1.262 +		{
   1.263 +			gbFrameSkip = nID - ID_OPTIONS_VIDEO_FRAMESKIP_0;
   1.264 +		}
   1.265 +		if (emulating)
   1.266 +			theApp.updateFrameSkip();
   1.267 +		return TRUE;
   1.268 +		break;
   1.269 +	}
   1.270 +	return FALSE;
   1.271 +}
   1.272 +
   1.273 +void MainWnd::OnUpdateOptionsVideoFrameskip0(CCmdUI*pCmdUI)
   1.274 +{
   1.275 +	pCmdUI->SetCheck(systemCartridgeType == 0 ? frameSkip == 0 : gbFrameSkip == 0);
   1.276 +}
   1.277 +
   1.278 +void MainWnd::OnUpdateOptionsVideoFrameskip1(CCmdUI*pCmdUI)
   1.279 +{
   1.280 +	pCmdUI->SetCheck(systemCartridgeType == 0 ? frameSkip == 1 : gbFrameSkip == 1);
   1.281 +}
   1.282 +
   1.283 +void MainWnd::OnUpdateOptionsVideoFrameskip2(CCmdUI*pCmdUI)
   1.284 +{
   1.285 +	pCmdUI->SetCheck(systemCartridgeType == 0 ? frameSkip == 2 : gbFrameSkip == 2);
   1.286 +}
   1.287 +
   1.288 +void MainWnd::OnUpdateOptionsVideoFrameskip3(CCmdUI*pCmdUI)
   1.289 +{
   1.290 +	pCmdUI->SetCheck(systemCartridgeType == 0 ? frameSkip == 3 : gbFrameSkip == 3);
   1.291 +}
   1.292 +
   1.293 +void MainWnd::OnUpdateOptionsVideoFrameskip4(CCmdUI*pCmdUI)
   1.294 +{
   1.295 +	pCmdUI->SetCheck(systemCartridgeType == 0 ? frameSkip == 4 : gbFrameSkip == 4);
   1.296 +}
   1.297 +
   1.298 +void MainWnd::OnUpdateOptionsVideoFrameskip5(CCmdUI*pCmdUI)
   1.299 +{
   1.300 +	pCmdUI->SetCheck(systemCartridgeType == 0 ? frameSkip == 5 : gbFrameSkip == 5);
   1.301 +}
   1.302 +
   1.303 +void MainWnd::OnUpdateOptionsVideoFrameskip6(CCmdUI*pCmdUI)
   1.304 +{
   1.305 +	pCmdUI->SetCheck(systemCartridgeType == 0 ? frameSkip == 6 : gbFrameSkip == 6);
   1.306 +}
   1.307 +
   1.308 +void MainWnd::OnUpdateOptionsVideoFrameskip7(CCmdUI*pCmdUI)
   1.309 +{
   1.310 +	pCmdUI->SetCheck(systemCartridgeType == 0 ? frameSkip == 7 : gbFrameSkip == 7);
   1.311 +}
   1.312 +
   1.313 +void MainWnd::OnUpdateOptionsVideoFrameskip8(CCmdUI*pCmdUI)
   1.314 +{
   1.315 +	pCmdUI->SetCheck(systemCartridgeType == 0 ? frameSkip == 8 : gbFrameSkip == 8);
   1.316 +}
   1.317 +
   1.318 +void MainWnd::OnUpdateOptionsVideoFrameskip9(CCmdUI*pCmdUI)
   1.319 +{
   1.320 +	pCmdUI->SetCheck(systemCartridgeType == 0 ? frameSkip == 9 : gbFrameSkip == 9);
   1.321 +}
   1.322 +
   1.323 +void MainWnd::OnOptionsVideoVsync()
   1.324 +{
   1.325 +	theApp.vsync = !theApp.vsync;
   1.326 +}
   1.327 +
   1.328 +void MainWnd::OnUpdateOptionsVideoVsync(CCmdUI*pCmdUI)
   1.329 +{
   1.330 +	pCmdUI->SetCheck(theApp.vsync);
   1.331 +}
   1.332 +
   1.333 +void MainWnd::OnUpdateOptionsVideoX1(CCmdUI*pCmdUI)
   1.334 +{
   1.335 +	pCmdUI->SetCheck(theApp.videoOption == VIDEO_1X);
   1.336 +}
   1.337 +
   1.338 +void MainWnd::OnUpdateOptionsVideoX2(CCmdUI*pCmdUI)
   1.339 +{
   1.340 +	pCmdUI->SetCheck(theApp.videoOption == VIDEO_2X);
   1.341 +}
   1.342 +
   1.343 +void MainWnd::OnUpdateOptionsVideoX3(CCmdUI*pCmdUI)
   1.344 +{
   1.345 +	pCmdUI->SetCheck(theApp.videoOption == VIDEO_3X);
   1.346 +}
   1.347 +
   1.348 +void MainWnd::OnUpdateOptionsVideoX4(CCmdUI*pCmdUI)
   1.349 +{
   1.350 +	pCmdUI->SetCheck(theApp.videoOption == VIDEO_4X);
   1.351 +}
   1.352 +
   1.353 +void MainWnd::OnUpdateOptionsVideoFullscreen320x240(CCmdUI*pCmdUI)
   1.354 +{
   1.355 +	pCmdUI->Enable(theApp.mode320Available);
   1.356 +	pCmdUI->SetCheck(theApp.videoOption == VIDEO_320x240);
   1.357 +}
   1.358 +
   1.359 +void MainWnd::OnUpdateOptionsVideoFullscreen640x480(CCmdUI*pCmdUI)
   1.360 +{
   1.361 +	pCmdUI->Enable(theApp.mode640Available);
   1.362 +	pCmdUI->SetCheck(theApp.videoOption == VIDEO_640x480);
   1.363 +}
   1.364 +
   1.365 +void MainWnd::OnUpdateOptionsVideoFullscreen800x600(CCmdUI*pCmdUI)
   1.366 +{
   1.367 +	pCmdUI->Enable(theApp.mode800Available);
   1.368 +	pCmdUI->SetCheck(theApp.videoOption == VIDEO_800x600);
   1.369 +}
   1.370 +
   1.371 +BOOL MainWnd::OnOptionVideoSize(UINT nID)
   1.372 +{
   1.373 +	theApp.updateVideoSize(nID);
   1.374 +	theApp.m_pMainWnd->PostMessage(VBA_CONFIRM_MODE);
   1.375 +	return TRUE;
   1.376 +}
   1.377 +
   1.378 +void MainWnd::OnOptionsVideoFullscreen320x240()
   1.379 +{
   1.380 +	OnOptionVideoSize(ID_OPTIONS_VIDEO_FULLSCREEN320X240);
   1.381 +}
   1.382 +
   1.383 +void MainWnd::OnOptionsVideoFullscreen640x480()
   1.384 +{
   1.385 +	OnOptionVideoSize(ID_OPTIONS_VIDEO_FULLSCREEN640X480);
   1.386 +}
   1.387 +
   1.388 +void MainWnd::OnOptionsVideoFullscreen800x600()
   1.389 +{
   1.390 +	OnOptionVideoSize(ID_OPTIONS_VIDEO_FULLSCREEN800X600);
   1.391 +}
   1.392 +
   1.393 +void MainWnd::OnOptionsVideoFullscreen()
   1.394 +{
   1.395 +	theApp.winCheckFullscreen();
   1.396 +	GUID *pGUID = NULL;
   1.397 +	int   size  = theApp.display->selectFullScreenMode(&pGUID);
   1.398 +	if (size != -1)
   1.399 +	{
   1.400 +		int width      = (size >> 12) & 4095;
   1.401 +		int height     = (size & 4095);
   1.402 +		int colorDepth = (size >> 24);
   1.403 +		if (width != theApp.fsWidth ||
   1.404 +		    height != theApp.fsHeight ||
   1.405 +		    colorDepth != theApp.fsColorDepth ||
   1.406 +		    pGUID != theApp.pVideoDriverGUID ||
   1.407 +		    theApp.videoOption != VIDEO_OTHER)
   1.408 +		{
   1.409 +			theApp.fsForceChange    = true;
   1.410 +			theApp.fsWidth          = width;
   1.411 +			theApp.fsHeight         = height;
   1.412 +			theApp.fsColorDepth     = colorDepth;
   1.413 +			theApp.pVideoDriverGUID = pGUID;
   1.414 +			if (pGUID)
   1.415 +			{
   1.416 +				theApp.videoDriverGUID = *pGUID;
   1.417 +				regSetDwordValue("defaultVideoDriver", FALSE);
   1.418 +				regSetBinaryValue("videoDriverGUID",
   1.419 +				                  (char *)pGUID, sizeof(GUID));
   1.420 +			}
   1.421 +			else
   1.422 +			{
   1.423 +				regSetDwordValue("defaultVideoDriver", TRUE);
   1.424 +			}
   1.425 +			theApp.updateVideoSize(ID_OPTIONS_VIDEO_FULLSCREEN);
   1.426 +			theApp.m_pMainWnd->PostMessage(VBA_CONFIRM_MODE);
   1.427 +		}
   1.428 +	}
   1.429 +}
   1.430 +
   1.431 +void MainWnd::OnUpdateOptionsVideoFullscreen(CCmdUI*pCmdUI)
   1.432 +{
   1.433 +	pCmdUI->SetCheck(theApp.videoOption == VIDEO_OTHER);
   1.434 +}
   1.435 +
   1.436 +void MainWnd::OnOptionsVideoDisablesfx()
   1.437 +{
   1.438 +	cpuDisableSfx = !cpuDisableSfx;
   1.439 +	if (emulating && systemCartridgeType == 0)
   1.440 +		CPUUpdateRender();
   1.441 +}
   1.442 +
   1.443 +void MainWnd::OnUpdateOptionsVideoDisablesfx(CCmdUI*pCmdUI)
   1.444 +{
   1.445 +	pCmdUI->SetCheck(cpuDisableSfx);
   1.446 +}
   1.447 +
   1.448 +void MainWnd::OnOptionsVideoFullscreenstretchtofit()
   1.449 +{
   1.450 +	theApp.fullScreenStretch = !theApp.fullScreenStretch;
   1.451 +	theApp.updateWindowSize(theApp.videoOption);
   1.452 +	if (theApp.display)
   1.453 +		theApp.display->clear();
   1.454 +}
   1.455 +
   1.456 +void MainWnd::OnUpdateOptionsVideoFullscreenstretchtofit(CCmdUI*pCmdUI)
   1.457 +{
   1.458 +	pCmdUI->SetCheck(theApp.fullScreenStretch);
   1.459 +}
   1.460 +
   1.461 +BOOL MainWnd::OnVideoLayer(UINT nID)
   1.462 +{
   1.463 +	layerSettings ^= 0x0100 << ((nID & 0xFFFF) - ID_OPTIONS_VIDEO_LAYERS_BG0);
   1.464 +	layerEnable = DISPCNT & layerSettings;
   1.465 +	CPUUpdateRenderBuffers(false);
   1.466 +	return TRUE;
   1.467 +}
   1.468 +
   1.469 +void MainWnd::OnUpdateVideoLayer(CCmdUI *pCmdUI)
   1.470 +{
   1.471 +	pCmdUI->SetCheck((layerSettings >> (8 + pCmdUI->m_nID - ID_OPTIONS_VIDEO_LAYERS_BG0)) & 1);
   1.472 +	switch (pCmdUI->m_nID)
   1.473 +	{
   1.474 +	case ID_OPTIONS_VIDEO_LAYERS_BG1:
   1.475 +	case ID_OPTIONS_VIDEO_LAYERS_BG2:
   1.476 +	case ID_OPTIONS_VIDEO_LAYERS_BG3:
   1.477 +	case ID_OPTIONS_VIDEO_LAYERS_WIN1:
   1.478 +	case ID_OPTIONS_VIDEO_LAYERS_OBJWIN:
   1.479 +		pCmdUI->Enable(systemCartridgeType == 0);
   1.480 +		break;
   1.481 +	}
   1.482 +}
   1.483 +
   1.484 +void MainWnd::OnOptionsVideoRendermethodGdi()
   1.485 +{
   1.486 +	theApp.renderMethod = GDI;
   1.487 +	theApp.updateRenderMethod(false);
   1.488 +}
   1.489 +
   1.490 +void MainWnd::OnUpdateOptionsVideoRendermethodGdi(CCmdUI*pCmdUI)
   1.491 +{
   1.492 +	pCmdUI->SetCheck(theApp.renderMethod == GDI);
   1.493 +}
   1.494 +
   1.495 +void MainWnd::OnOptionsVideoRendermethodDirectdraw()
   1.496 +{
   1.497 +	theApp.renderMethod = DIRECT_DRAW;
   1.498 +	theApp.updateRenderMethod(false);
   1.499 +}
   1.500 +
   1.501 +void MainWnd::OnUpdateOptionsVideoRendermethodDirectdraw(CCmdUI*pCmdUI)
   1.502 +{
   1.503 +	pCmdUI->SetCheck(theApp.renderMethod == DIRECT_DRAW);
   1.504 +}
   1.505 +
   1.506 +void MainWnd::OnOptionsVideoRendermethodDirect3d()
   1.507 +{
   1.508 +	theApp.renderMethod = DIRECT_3D;
   1.509 +	theApp.updateRenderMethod(false);
   1.510 +}
   1.511 +
   1.512 +void MainWnd::OnUpdateOptionsVideoRendermethodDirect3d(CCmdUI*pCmdUI)
   1.513 +{
   1.514 +	pCmdUI->SetCheck(theApp.renderMethod == DIRECT_3D);
   1.515 +}
   1.516 +
   1.517 +void MainWnd::OnOptionsVideoRendermethodOpengl()
   1.518 +{
   1.519 +	theApp.renderMethod = OPENGL;
   1.520 +	theApp.updateRenderMethod(false);
   1.521 +}
   1.522 +
   1.523 +void MainWnd::OnUpdateOptionsVideoRendermethodOpengl(CCmdUI*pCmdUI)
   1.524 +{
   1.525 +	pCmdUI->SetCheck(theApp.renderMethod == OPENGL);
   1.526 +}
   1.527 +
   1.528 +void MainWnd::OnOptionsVideoTriplebuffering()
   1.529 +{
   1.530 +	theApp.tripleBuffering = !theApp.tripleBuffering;
   1.531 +}
   1.532 +
   1.533 +void MainWnd::OnUpdateOptionsVideoTriplebuffering(CCmdUI*pCmdUI)
   1.534 +{
   1.535 +	pCmdUI->SetCheck(theApp.tripleBuffering);
   1.536 +}
   1.537 +
   1.538 +void MainWnd::OnOptionsVideoDdrawemulationonly()
   1.539 +{
   1.540 +	theApp.ddrawEmulationOnly = !theApp.ddrawEmulationOnly;
   1.541 +}
   1.542 +
   1.543 +void MainWnd::OnUpdateOptionsVideoDdrawemulationonly(CCmdUI*pCmdUI)
   1.544 +{
   1.545 +	pCmdUI->SetCheck(theApp.ddrawEmulationOnly);
   1.546 +}
   1.547 +
   1.548 +void MainWnd::OnOptionsVideoDdrawusevideomemory()
   1.549 +{
   1.550 +	theApp.ddrawUseVideoMemory = !theApp.ddrawUseVideoMemory;
   1.551 +}
   1.552 +
   1.553 +void MainWnd::OnUpdateOptionsVideoDdrawusevideomemory(CCmdUI*pCmdUI)
   1.554 +{
   1.555 +	pCmdUI->SetCheck(theApp.ddrawUseVideoMemory);
   1.556 +}
   1.557 +
   1.558 +void MainWnd::OnOptionsVideoRenderoptionsD3dnofilter()
   1.559 +{
   1.560 +	theApp.d3dFilter = 0;
   1.561 +	if (theApp.display)
   1.562 +		theApp.display->setOption("d3dFilter", 0);
   1.563 +}
   1.564 +
   1.565 +void MainWnd::OnUpdateOptionsVideoRenderoptionsD3dnofilter(CCmdUI*pCmdUI)
   1.566 +{
   1.567 +	pCmdUI->SetCheck(theApp.d3dFilter == 0);
   1.568 +}
   1.569 +
   1.570 +void MainWnd::OnOptionsVideoRenderoptionsD3dbilinear()
   1.571 +{
   1.572 +	theApp.d3dFilter = 1;
   1.573 +	if (theApp.display)
   1.574 +		theApp.display->setOption("d3dFilter", 1);
   1.575 +}
   1.576 +
   1.577 +void MainWnd::OnUpdateOptionsVideoRenderoptionsD3dbilinear(CCmdUI*pCmdUI)
   1.578 +{
   1.579 +	pCmdUI->SetCheck(theApp.d3dFilter == 1);
   1.580 +}
   1.581 +
   1.582 +void MainWnd::OnOptionsVideoRenderoptionsGlnearest()
   1.583 +{
   1.584 +	theApp.glFilter = 0;
   1.585 +	if (theApp.display)
   1.586 +		theApp.display->setOption("glFilter", 0);
   1.587 +}
   1.588 +
   1.589 +void MainWnd::OnUpdateOptionsVideoRenderoptionsGlnearest(CCmdUI*pCmdUI)
   1.590 +{
   1.591 +	pCmdUI->SetCheck(theApp.glFilter == 0);
   1.592 +}
   1.593 +
   1.594 +void MainWnd::OnOptionsVideoRenderoptionsGlbilinear()
   1.595 +{
   1.596 +	theApp.glFilter = 1;
   1.597 +	if (theApp.display)
   1.598 +		theApp.display->setOption("glFilter", 1);
   1.599 +}
   1.600 +
   1.601 +void MainWnd::OnUpdateOptionsVideoRenderoptionsGlbilinear(CCmdUI*pCmdUI)
   1.602 +{
   1.603 +	pCmdUI->SetCheck(theApp.glFilter == 1);
   1.604 +}
   1.605 +
   1.606 +void MainWnd::OnOptionsVideoRenderoptionsGltriangle()
   1.607 +{
   1.608 +	theApp.glType = 0;
   1.609 +	if (theApp.display)
   1.610 +		theApp.display->setOption("glType", 0);
   1.611 +}
   1.612 +
   1.613 +void MainWnd::OnUpdateOptionsVideoRenderoptionsGltriangle(CCmdUI*pCmdUI)
   1.614 +{
   1.615 +	pCmdUI->SetCheck(theApp.glType == 0);
   1.616 +}
   1.617 +
   1.618 +void MainWnd::OnOptionsVideoRenderoptionsGlquads()
   1.619 +{
   1.620 +	theApp.glType = 1;
   1.621 +	if (theApp.display)
   1.622 +		theApp.display->setOption("glType", 1);
   1.623 +}
   1.624 +
   1.625 +void MainWnd::OnUpdateOptionsVideoRenderoptionsGlquads(CCmdUI*pCmdUI)
   1.626 +{
   1.627 +	pCmdUI->SetCheck(theApp.glType == 1);
   1.628 +}
   1.629 +
   1.630 +void MainWnd::OnOptionsVideoRenderoptionsSelectskin()
   1.631 +{}
   1.632 +
   1.633 +void MainWnd::OnUpdateOptionsVideoRenderoptionsSelectskin(CCmdUI*pCmdUI)
   1.634 +{}
   1.635 +
   1.636 +void MainWnd::OnOptionsVideoRenderoptionsSkin()
   1.637 +{}
   1.638 +
   1.639 +void MainWnd::OnUpdateOptionsVideoRenderoptionsSkin(CCmdUI*pCmdUI)
   1.640 +{}
   1.641 +
   1.642 +void MainWnd::OnOptionsEmulatorAssociate()
   1.643 +{
   1.644 +	theApp.winCheckFullscreen();
   1.645 +	Associate dlg;
   1.646 +	dlg.DoModal();
   1.647 +}
   1.648 +
   1.649 +void MainWnd::OnOptionsEmulatorDirectories()
   1.650 +{
   1.651 +	theApp.winCheckFullscreen();
   1.652 +	Directories dlg;
   1.653 +	dlg.DoModal();
   1.654 +}
   1.655 +
   1.656 +void MainWnd::OnOptionsEmulatorFilenamePreference(UINT nID)
   1.657 +{
   1.658 +	theApp.filenamePreference = nID - ID_OPTIONS_PREFER_ARCHIVE_NAME;
   1.659 +}
   1.660 +
   1.661 +void MainWnd::OnUpdateOptionsEmulatorFilenamePreference(CCmdUI *pCmdUI)
   1.662 +{
   1.663 +	pCmdUI->SetRadio(pCmdUI->m_nID == theApp.filenamePreference + ID_OPTIONS_PREFER_ARCHIVE_NAME);
   1.664 +}
   1.665 +
   1.666 +void MainWnd::OnOptionsVideoDisablestatusmessages()
   1.667 +{
   1.668 +	theApp.disableStatusMessage = !theApp.disableStatusMessage;
   1.669 +}
   1.670 +
   1.671 +void MainWnd::OnUpdateOptionsVideoDisablestatusmessages(CCmdUI*pCmdUI)
   1.672 +{
   1.673 +	pCmdUI->SetCheck(theApp.disableStatusMessage);
   1.674 +}
   1.675 +
   1.676 +void MainWnd::OnOptionsEmulatorSynchronize()
   1.677 +{
   1.678 +	synchronize = !synchronize;
   1.679 +}
   1.680 +
   1.681 +void MainWnd::OnUpdateOptionsEmulatorSynchronize(CCmdUI*pCmdUI)
   1.682 +{
   1.683 +	pCmdUI->SetCheck(synchronize);
   1.684 +}
   1.685 +
   1.686 +void MainWnd::OnOptionsEmulatorAlwaysOnTop()
   1.687 +{
   1.688 +	theApp.alwaysOnTop = !theApp.alwaysOnTop;
   1.689 +	SetWindowPos((theApp.alwaysOnTop ? &wndTopMost : &wndNoTopMost), 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE);
   1.690 +}
   1.691 +
   1.692 +void MainWnd::OnUpdateOptionsEmulatorAlwaysOnTop(CCmdUI*pCmdUI)
   1.693 +{
   1.694 +	pCmdUI->SetCheck(theApp.alwaysOnTop);
   1.695 +}
   1.696 +
   1.697 +void MainWnd::OnOptionsEmulatorPausewheninactive()
   1.698 +{
   1.699 +	theApp.pauseWhenInactive = !theApp.pauseWhenInactive;
   1.700 +}
   1.701 +
   1.702 +void MainWnd::OnUpdateOptionsEmulatorPausewheninactive(CCmdUI*pCmdUI)
   1.703 +{
   1.704 +	pCmdUI->SetCheck(theApp.pauseWhenInactive);
   1.705 +}
   1.706 +
   1.707 +void MainWnd::OnOptionsEmulatorEnableBackgroundInput()
   1.708 +{
   1.709 +	theApp.enableBackgroundInput = !theApp.enableBackgroundInput;
   1.710 +}
   1.711 +
   1.712 +void MainWnd::OnUpdateOptionsEmulatorEnableBackgroundInput(CCmdUI*pCmdUI)
   1.713 +{
   1.714 +	pCmdUI->SetCheck(theApp.enableBackgroundInput);
   1.715 +}
   1.716 +
   1.717 +BOOL MainWnd::OnOptionsPriority(UINT nID)
   1.718 +{
   1.719 +	switch (nID)
   1.720 +	{
   1.721 +	case ID_OPTIONS_PRIORITY_HIGHEST:
   1.722 +		theApp.threadPriority = 0;
   1.723 +		break;
   1.724 +	case ID_OPTIONS_PRIORITY_ABOVENORMAL:
   1.725 +		theApp.threadPriority = 1;
   1.726 +		break;
   1.727 +	case ID_OPTIONS_PRIORITY_NORMAL:
   1.728 +		theApp.threadPriority = 2;
   1.729 +		break;
   1.730 +	case ID_OPTIONS_PRIORITY_BELOWNORMAL:
   1.731 +		theApp.threadPriority = 3;
   1.732 +		break;
   1.733 +	default:
   1.734 +		return FALSE;
   1.735 +	}
   1.736 +	theApp.updatePriority();
   1.737 +
   1.738 +	return TRUE;
   1.739 +}
   1.740 +
   1.741 +void MainWnd::OnUpdateOptionsPriority(CCmdUI *pCmdUI)
   1.742 +{
   1.743 +	switch (pCmdUI->m_nID)
   1.744 +	{
   1.745 +	case ID_OPTIONS_PRIORITY_HIGHEST:
   1.746 +		pCmdUI->SetCheck(theApp.threadPriority == 0);
   1.747 +		break;
   1.748 +	case ID_OPTIONS_PRIORITY_ABOVENORMAL:
   1.749 +		pCmdUI->SetCheck(theApp.threadPriority == 1);
   1.750 +		break;
   1.751 +	case ID_OPTIONS_PRIORITY_NORMAL:
   1.752 +		pCmdUI->SetCheck(theApp.threadPriority == 2);
   1.753 +		break;
   1.754 +	case ID_OPTIONS_PRIORITY_BELOWNORMAL:
   1.755 +		pCmdUI->SetCheck(theApp.threadPriority == 3);
   1.756 +		break;
   1.757 +	}
   1.758 +}
   1.759 +
   1.760 +void MainWnd::OnOptionsEmulatorSpeeduptoggle()
   1.761 +{
   1.762 +	theApp.speedupToggle = !theApp.speedupToggle;
   1.763 +}
   1.764 +
   1.765 +void MainWnd::OnUpdateOptionsEmulatorSpeeduptoggle(CCmdUI*pCmdUI)
   1.766 +{
   1.767 +	pCmdUI->SetCheck(theApp.speedupToggle);
   1.768 +}
   1.769 +
   1.770 +void MainWnd::OnOptionsEmulatorRemoveintrosgba()
   1.771 +{
   1.772 +	//  theApp.removeIntros = !theApp.removeIntros;
   1.773 +}
   1.774 +
   1.775 +void MainWnd::OnUpdateOptionsEmulatorRemoveintrosgba(CCmdUI*pCmdUI)
   1.776 +{
   1.777 +	pCmdUI->Enable(false);
   1.778 +	//  pCmdUI->SetCheck(theApp.removeIntros);
   1.779 +}
   1.780 +
   1.781 +void MainWnd::OnOptionsEmulatorAutomaticallyipspatch()
   1.782 +{
   1.783 +	theApp.autoIPS = !theApp.autoIPS;
   1.784 +}
   1.785 +
   1.786 +void MainWnd::OnUpdateOptionsEmulatorAutomaticallyipspatch(CCmdUI*pCmdUI)
   1.787 +{
   1.788 +	pCmdUI->SetCheck(theApp.autoIPS);
   1.789 +}
   1.790 +
   1.791 +void MainWnd::OnOptionsEmulatorAgbprint()
   1.792 +{
   1.793 +	agbPrintEnable(!agbPrintIsEnabled());
   1.794 +}
   1.795 +
   1.796 +void MainWnd::OnUpdateOptionsEmulatorAgbprint(CCmdUI*pCmdUI)
   1.797 +{
   1.798 +	pCmdUI->SetCheck(agbPrintIsEnabled());
   1.799 +}
   1.800 +
   1.801 +void MainWnd::OnOptionsEmulatorRealtimeclock()
   1.802 +{
   1.803 +	theApp.winRtcEnable = !theApp.winRtcEnable;
   1.804 +}
   1.805 +
   1.806 +void MainWnd::OnUpdateOptionsEmulatorRealtimeclock(CCmdUI*pCmdUI)
   1.807 +{
   1.808 +	pCmdUI->SetCheck(theApp.winRtcEnable);
   1.809 +	pCmdUI->Enable(!VBAMovieActive() || GetAsyncKeyState(VK_CONTROL));
   1.810 +}
   1.811 +
   1.812 +void MainWnd::OnOptionsEmulatorAutohidemenu()
   1.813 +{
   1.814 +	theApp.autoHideMenu = !theApp.autoHideMenu;
   1.815 +}
   1.816 +
   1.817 +void MainWnd::OnUpdateOptionsEmulatorAutohidemenu(CCmdUI*pCmdUI)
   1.818 +{
   1.819 +	pCmdUI->SetCheck(theApp.autoHideMenu);
   1.820 +}
   1.821 +
   1.822 +void MainWnd::OnOptionsEmulatorRewindinterval()
   1.823 +{
   1.824 +	RewindInterval dlg((float)theApp.rewindTimer/6.0f, theApp.rewindSlots);
   1.825 +	int v = dlg.DoModal();
   1.826 +
   1.827 +	if (v >= 0)
   1.828 +	{
   1.829 +		int interval = v & 0x0000ffff;
   1.830 +		int slots    = (v & 0xffff0000) >> 16;
   1.831 +
   1.832 +		int prevSlots = theApp.rewindSlots;
   1.833 +
   1.834 +		theApp.rewindTimer = interval; // already converted to a multiple of 10 frames
   1.835 +		theApp.rewindSlots = slots;
   1.836 +		if (interval == 0 || slots == 0)
   1.837 +		{
   1.838 +			theApp.rewindTimer = theApp.rewindSlots = 0;
   1.839 +			regSetDwordValue("rewindTimer", interval);
   1.840 +			regSetDwordValue("rewindSlots", slots);
   1.841 +			if (theApp.rewindMemory)
   1.842 +				free(theApp.rewindMemory);
   1.843 +			theApp.rewindMemory     = NULL;
   1.844 +			theApp.rewindCount      = 0;
   1.845 +			theApp.rewindCounter    = 0;
   1.846 +			theApp.rewindSaveNeeded = false;
   1.847 +		}
   1.848 +		else
   1.849 +		{
   1.850 +			regSetDwordValue("rewindTimer", interval);
   1.851 +			regSetDwordValue("rewindSlots", slots);
   1.852 +			if (slots != prevSlots)
   1.853 +			{
   1.854 +				if (theApp.rewindMemory)
   1.855 +					free(theApp.rewindMemory);
   1.856 +				theApp.rewindMemory = NULL;
   1.857 +				theApp.rewindPos    = 0;
   1.858 +			}
   1.859 +			if (theApp.rewindMemory == NULL)
   1.860 +				theApp.rewindMemory = (char *)malloc(theApp.rewindSlots*REWIND_SIZE);
   1.861 +			theApp.rewindCount      = 0;
   1.862 +			theApp.rewindSaveNeeded = true;
   1.863 +		}
   1.864 +	}
   1.865 +}
   1.866 +
   1.867 +BOOL MainWnd::OnOptionsEmulatorShowSpeed(UINT nID)
   1.868 +{
   1.869 +	switch (nID)
   1.870 +	{
   1.871 +	case ID_OPTIONS_EMULATOR_SHOWSPEED_NONE:
   1.872 +		theApp.showSpeed = 0;
   1.873 +		systemSetTitle(VBA_NAME_AND_VERSION);
   1.874 +		break;
   1.875 +	case ID_OPTIONS_EMULATOR_SHOWSPEED_PERCENTAGE:
   1.876 +		theApp.showSpeed = 1;
   1.877 +		break;
   1.878 +	case ID_OPTIONS_EMULATOR_SHOWSPEED_DETAILED:
   1.879 +		theApp.showSpeed = 2;
   1.880 +		break;
   1.881 +	case ID_OPTIONS_EMULATOR_SHOWSPEED_TRANSPARENT:
   1.882 +		theApp.showSpeedTransparent = !theApp.showSpeedTransparent;
   1.883 +		break;
   1.884 +	default:
   1.885 +		return FALSE;
   1.886 +	}
   1.887 +	return TRUE;
   1.888 +}
   1.889 +
   1.890 +void MainWnd::OnUpdateOptionsEmulatorShowSpeed(CCmdUI *pCmdUI)
   1.891 +{
   1.892 +	switch (pCmdUI->m_nID)
   1.893 +	{
   1.894 +	case ID_OPTIONS_EMULATOR_SHOWSPEED_NONE:
   1.895 +		pCmdUI->SetCheck(theApp.showSpeed == 0);
   1.896 +		break;
   1.897 +	case ID_OPTIONS_EMULATOR_SHOWSPEED_PERCENTAGE:
   1.898 +		pCmdUI->SetCheck(theApp.showSpeed == 1);
   1.899 +		break;
   1.900 +	case ID_OPTIONS_EMULATOR_SHOWSPEED_DETAILED:
   1.901 +		pCmdUI->SetCheck(theApp.showSpeed == 2);
   1.902 +		break;
   1.903 +	case ID_OPTIONS_EMULATOR_SHOWSPEED_TRANSPARENT:
   1.904 +		pCmdUI->SetCheck(theApp.showSpeedTransparent);
   1.905 +		break;
   1.906 +	}
   1.907 +}
   1.908 +
   1.909 +void MainWnd::OnOptionsEmulatorSavetypeAutomatic()
   1.910 +{
   1.911 +	theApp.winSaveType = 0;
   1.912 +}
   1.913 +
   1.914 +void MainWnd::OnUpdateOptionsEmulatorSavetypeAutomatic(CCmdUI*pCmdUI)
   1.915 +{
   1.916 +	pCmdUI->SetCheck(theApp.winSaveType == 0);
   1.917 +	pCmdUI->Enable(!VBAMovieActive() || GetAsyncKeyState(VK_CONTROL));
   1.918 +}
   1.919 +
   1.920 +void MainWnd::OnOptionsEmulatorSavetypeEeprom()
   1.921 +{
   1.922 +	theApp.winSaveType = 1;
   1.923 +}
   1.924 +
   1.925 +void MainWnd::OnUpdateOptionsEmulatorSavetypeEeprom(CCmdUI*pCmdUI)
   1.926 +{
   1.927 +	pCmdUI->SetCheck(theApp.winSaveType == 1);
   1.928 +	pCmdUI->Enable(!VBAMovieActive() || GetAsyncKeyState(VK_CONTROL));
   1.929 +}
   1.930 +
   1.931 +void MainWnd::OnOptionsEmulatorSavetypeSram()
   1.932 +{
   1.933 +	theApp.winSaveType = 2;
   1.934 +}
   1.935 +
   1.936 +void MainWnd::OnUpdateOptionsEmulatorSavetypeSram(CCmdUI*pCmdUI)
   1.937 +{
   1.938 +	pCmdUI->SetCheck(theApp.winSaveType == 2);
   1.939 +	pCmdUI->Enable(!VBAMovieActive() || GetAsyncKeyState(VK_CONTROL));
   1.940 +}
   1.941 +
   1.942 +void MainWnd::OnOptionsEmulatorSavetypeFlash()
   1.943 +{
   1.944 +	theApp.winSaveType = 3;
   1.945 +}
   1.946 +
   1.947 +void MainWnd::OnUpdateOptionsEmulatorSavetypeFlash(CCmdUI*pCmdUI)
   1.948 +{
   1.949 +	pCmdUI->SetCheck(theApp.winSaveType == 3);
   1.950 +	pCmdUI->Enable(!VBAMovieActive() || GetAsyncKeyState(VK_CONTROL));
   1.951 +}
   1.952 +
   1.953 +void MainWnd::OnOptionsEmulatorSavetypeEepromsensor()
   1.954 +{
   1.955 +	theApp.winSaveType = 4;
   1.956 +}
   1.957 +
   1.958 +void MainWnd::OnUpdateOptionsEmulatorSavetypeEepromsensor(CCmdUI*pCmdUI)
   1.959 +{
   1.960 +	pCmdUI->SetCheck(theApp.winSaveType == 4);
   1.961 +	pCmdUI->Enable(!VBAMovieActive() || GetAsyncKeyState(VK_CONTROL));
   1.962 +}
   1.963 +
   1.964 +void MainWnd::OnOptionsEmulatorSavetypeNone()
   1.965 +{
   1.966 +	theApp.winSaveType = 5;
   1.967 +}
   1.968 +
   1.969 +void MainWnd::OnUpdateOptionsEmulatorSavetypeNone(CCmdUI*pCmdUI)
   1.970 +{
   1.971 +	pCmdUI->SetCheck(theApp.winSaveType == 5);
   1.972 +	pCmdUI->Enable(!VBAMovieActive() || GetAsyncKeyState(VK_CONTROL));
   1.973 +}
   1.974 +
   1.975 +void MainWnd::OnOptionsEmulatorSavetypeFlash512k()
   1.976 +{
   1.977 +	flashSetSize(0x10000);
   1.978 +	theApp.winFlashSize = 0x10000;
   1.979 +}
   1.980 +
   1.981 +void MainWnd::OnUpdateOptionsEmulatorSavetypeFlash512k(CCmdUI*pCmdUI)
   1.982 +{
   1.983 +	pCmdUI->SetCheck(theApp.winFlashSize == 0x10000);
   1.984 +	pCmdUI->Enable(!VBAMovieActive() || GetAsyncKeyState(VK_CONTROL));
   1.985 +}
   1.986 +
   1.987 +void MainWnd::OnOptionsEmulatorSavetypeFlash1m()
   1.988 +{
   1.989 +	flashSetSize(0x20000);
   1.990 +	theApp.winFlashSize = 0x20000;
   1.991 +}
   1.992 +
   1.993 +void MainWnd::OnUpdateOptionsEmulatorSavetypeFlash1m(CCmdUI*pCmdUI)
   1.994 +{
   1.995 +	pCmdUI->SetCheck(theApp.winFlashSize == 0x20000);
   1.996 +	pCmdUI->Enable(!VBAMovieActive() || GetAsyncKeyState(VK_CONTROL));
   1.997 +}
   1.998 +
   1.999 +void MainWnd::OnOptionsEmulatorUsebiosfile()
  1.1000 +{
  1.1001 +	if (!theApp.biosFileName.IsEmpty())
  1.1002 +		theApp.useBiosFile = !theApp.useBiosFile;
  1.1003 +}
  1.1004 +
  1.1005 +void MainWnd::OnUpdateOptionsEmulatorUsebiosfile(CCmdUI*pCmdUI)
  1.1006 +{
  1.1007 +	pCmdUI->SetCheck(theApp.useBiosFile);
  1.1008 +	pCmdUI->Enable(!theApp.biosFileName.IsEmpty() && (!VBAMovieActive() || GetAsyncKeyState(VK_CONTROL)));
  1.1009 +}
  1.1010 +
  1.1011 +void MainWnd::OnOptionsEmulatorSkipbios()
  1.1012 +{
  1.1013 +	theApp.skipBiosFile = !theApp.skipBiosFile;
  1.1014 +}
  1.1015 +
  1.1016 +void MainWnd::OnUpdateOptionsEmulatorSkipbios(CCmdUI*pCmdUI)
  1.1017 +{
  1.1018 +	pCmdUI->SetCheck(theApp.skipBiosFile);
  1.1019 +	pCmdUI->Enable(!VBAMovieActive() || GetAsyncKeyState(VK_CONTROL));
  1.1020 +}
  1.1021 +
  1.1022 +void MainWnd::OnOptionsEmulatorUseOldGBTiming()
  1.1023 +{
  1.1024 +	useOldFrameTiming = !useOldFrameTiming;
  1.1025 +}
  1.1026 +
  1.1027 +void MainWnd::OnUpdateOptionsEmulatorUseOldGBTiming(CCmdUI*pCmdUI)
  1.1028 +{
  1.1029 +	pCmdUI->SetCheck(useOldFrameTiming);
  1.1030 +	pCmdUI->Enable(!VBAMovieActive() || GetAsyncKeyState(VK_CONTROL));
  1.1031 +}
  1.1032 +
  1.1033 +void MainWnd::OnOptionsEmulatorUseGBNullInputKludge()
  1.1034 +{
  1.1035 +	if (VBAMovieActive())
  1.1036 +		gbNullInputHackTempEnabled = !gbNullInputHackTempEnabled;
  1.1037 +	else
  1.1038 +		gbNullInputHackTempEnabled = gbNullInputHackEnabled = !gbNullInputHackEnabled;
  1.1039 +}
  1.1040 +
  1.1041 +void MainWnd::OnUpdateOptionsEmulatorUseGBNullInputKludge(CCmdUI*pCmdUI)
  1.1042 +{
  1.1043 +	pCmdUI->SetCheck(VBAMovieActive() || GetAsyncKeyState(VK_CONTROL) ? gbNullInputHackTempEnabled : gbNullInputHackEnabled);
  1.1044 +	pCmdUI->Enable((!VBAMovieActive() && !useOldFrameTiming) || GetAsyncKeyState(VK_CONTROL));
  1.1045 +}
  1.1046 +
  1.1047 +void MainWnd::OnOptionsEmulatorGBALag()
  1.1048 +{
  1.1049 +	extern void TogglePrefetchHack();
  1.1050 +	TogglePrefetchHack();
  1.1051 +	memLagEnabled = memLagTempEnabled; // memLagEnabled is only to hold the last value that the user chose, so temporary changes
  1.1052 +                                       // don't get into the registry
  1.1053 +}
  1.1054 +
  1.1055 +void MainWnd::OnUpdateOptionsEmulatorGBALag(CCmdUI*pCmdUI)
  1.1056 +{
  1.1057 +	pCmdUI->SetCheck(!memLagTempEnabled);
  1.1058 +	pCmdUI->Enable(!VBAMovieActive() || GetAsyncKeyState(VK_CONTROL));
  1.1059 +}
  1.1060 +
  1.1061 +void MainWnd::OnOptionsEmulatorSelectbiosfile()
  1.1062 +{
  1.1063 +	theApp.winCheckFullscreen();
  1.1064 +	LPCTSTR exts[] = { NULL };
  1.1065 +	CString filter = winResLoadFilter(IDS_FILTER_BIOS);
  1.1066 +	CString title  = winResLoadString(IDS_SELECT_BIOS_FILE);
  1.1067 +
  1.1068 +	FileDlg dlg(this,
  1.1069 +	            theApp.biosFileName,
  1.1070 +	            filter,
  1.1071 +	            0,
  1.1072 +	            "BIOS",
  1.1073 +	            exts,
  1.1074 +	            "",
  1.1075 +	            title,
  1.1076 +	            false);
  1.1077 +
  1.1078 +	if (dlg.DoModal() == IDOK)
  1.1079 +	{
  1.1080 +		theApp.biosFileName = dlg.GetPathName();
  1.1081 +	}
  1.1082 +}
  1.1083 +
  1.1084 +void MainWnd::OnOptionsEmulatorPngformat()
  1.1085 +{
  1.1086 +	theApp.captureFormat = 0;
  1.1087 +}
  1.1088 +
  1.1089 +void MainWnd::OnUpdateOptionsEmulatorPngformat(CCmdUI*pCmdUI)
  1.1090 +{
  1.1091 +	pCmdUI->SetCheck(theApp.captureFormat == 0);
  1.1092 +}
  1.1093 +
  1.1094 +void MainWnd::OnOptionsEmulatorBmpformat()
  1.1095 +{
  1.1096 +	theApp.captureFormat = 1;
  1.1097 +}
  1.1098 +
  1.1099 +void MainWnd::OnUpdateOptionsEmulatorBmpformat(CCmdUI*pCmdUI)
  1.1100 +{
  1.1101 +	pCmdUI->SetCheck(theApp.captureFormat == 1);
  1.1102 +}
  1.1103 +
  1.1104 +void MainWnd::OnOptionsSoundDisable()
  1.1105 +{
  1.1106 +	if (soundOffFlag)
  1.1107 +	{
  1.1108 +		soundOffFlag = false;
  1.1109 +		soundInit();
  1.1110 +	}
  1.1111 +	else
  1.1112 +	{
  1.1113 +		soundOffFlag = true;
  1.1114 +		soundShutdown();
  1.1115 +	}
  1.1116 +}
  1.1117 +
  1.1118 +void MainWnd::OnUpdateOptionsSoundDisable(CCmdUI*pCmdUI)
  1.1119 +{
  1.1120 +	pCmdUI->SetCheck(soundOffFlag);
  1.1121 +	pCmdUI->Enable(!VBAMovieActive() || GetAsyncKeyState(VK_CONTROL));
  1.1122 +}
  1.1123 +
  1.1124 +static void OnSoundToggleEnabled(int c)
  1.1125 +{
  1.1126 +	if (soundGetEnabledChannels() & c)
  1.1127 +	{
  1.1128 +		soundDisableChannels(c);
  1.1129 +	}
  1.1130 +	else
  1.1131 +	{
  1.1132 +		soundEnableChannels(c);
  1.1133 +	}
  1.1134 +}
  1.1135 +
  1.1136 +void MainWnd::OnOptionsSoundMute()
  1.1137 +{
  1.1138 +	if ((soundGetEnabledChannels() & 0x030f) == 0)
  1.1139 +		soundEnableChannels(0x030f);
  1.1140 +	else
  1.1141 +		soundDisableChannels(0x030f);
  1.1142 +}
  1.1143 +
  1.1144 +void MainWnd::OnUpdateOptionsSoundMute(CCmdUI*pCmdUI)
  1.1145 +{
  1.1146 +	pCmdUI->SetCheck((soundGetEnabledChannels() & 0x030f) == 0);
  1.1147 +}
  1.1148 +
  1.1149 +void MainWnd::OnOptionsSoundOff()
  1.1150 +{
  1.1151 +	soundDisableChannels(0x030f);
  1.1152 +}
  1.1153 +
  1.1154 +void MainWnd::OnUpdateOptionsSoundOff(CCmdUI*pCmdUI)
  1.1155 +{
  1.1156 +	pCmdUI->SetCheck((soundGetEnabledChannels() & 0x030f) == 0);
  1.1157 +}
  1.1158 +
  1.1159 +void MainWnd::OnOptionsSoundOn()
  1.1160 +{
  1.1161 +	soundEnableChannels(0x030f);
  1.1162 +}
  1.1163 +
  1.1164 +void MainWnd::OnUpdateOptionsSoundOn(CCmdUI*pCmdUI)
  1.1165 +{
  1.1166 +	pCmdUI->SetCheck(soundGetEnabledChannels() == 0x030f);
  1.1167 +}
  1.1168 +
  1.1169 +void MainWnd::OnOptionsSoundUseoldsynchronization()
  1.1170 +{
  1.1171 +	theApp.useOldSync = !theApp.useOldSync;
  1.1172 +	systemMessage(IDS_SETTING_WILL_BE_EFFECTIVE,
  1.1173 +	              "Setting will be effective the next time you start the emulator");
  1.1174 +}
  1.1175 +
  1.1176 +void MainWnd::OnUpdateOptionsSoundUseoldsynchronization(CCmdUI*pCmdUI)
  1.1177 +{
  1.1178 +	pCmdUI->SetCheck(theApp.useOldSync);
  1.1179 +}
  1.1180 +
  1.1181 +void MainWnd::OnOptionsSoundEcho()
  1.1182 +{
  1.1183 +	soundEcho = !soundEcho;
  1.1184 +}
  1.1185 +
  1.1186 +void MainWnd::OnUpdateOptionsSoundEcho(CCmdUI*pCmdUI)
  1.1187 +{
  1.1188 +	pCmdUI->SetCheck(soundEcho);
  1.1189 +}
  1.1190 +
  1.1191 +void MainWnd::OnOptionsSoundLowpassfilter()
  1.1192 +{
  1.1193 +	soundLowPass = !soundLowPass;
  1.1194 +}
  1.1195 +
  1.1196 +void MainWnd::OnUpdateOptionsSoundLowpassfilter(CCmdUI*pCmdUI)
  1.1197 +{
  1.1198 +	pCmdUI->SetCheck(soundLowPass);
  1.1199 +}
  1.1200 +
  1.1201 +void MainWnd::OnOptionsSoundReversestereo()
  1.1202 +{
  1.1203 +	soundReverse = !soundReverse;
  1.1204 +}
  1.1205 +
  1.1206 +void MainWnd::OnUpdateOptionsSoundReversestereo(CCmdUI*pCmdUI)
  1.1207 +{
  1.1208 +	pCmdUI->SetCheck(soundReverse);
  1.1209 +}
  1.1210 +
  1.1211 +void MainWnd::OnOptionsSoundMuteFrameAdvance()
  1.1212 +{
  1.1213 +	theApp.muteFrameAdvance = !theApp.muteFrameAdvance;
  1.1214 +}
  1.1215 +
  1.1216 +void MainWnd::OnUpdateOptionsSoundMuteFrameAdvance(CCmdUI*pCmdUI)
  1.1217 +{
  1.1218 +	pCmdUI->SetCheck(theApp.muteFrameAdvance);
  1.1219 +}
  1.1220 +
  1.1221 +void MainWnd::OnOptionsSoundMuteWhenInactive()
  1.1222 +{
  1.1223 +	theApp.muteWhenInactive = !theApp.muteWhenInactive;
  1.1224 +}
  1.1225 +
  1.1226 +void MainWnd::OnUpdateOptionsSoundMuteWhenInactive(CCmdUI*pCmdUI)
  1.1227 +{
  1.1228 +	pCmdUI->SetCheck(theApp.muteWhenInactive);
  1.1229 +}
  1.1230 +
  1.1231 +void MainWnd::OnOptionsSound11khz()
  1.1232 +{
  1.1233 +	if (systemCartridgeType == 0)
  1.1234 +		soundSetQuality(4);
  1.1235 +	else
  1.1236 +		gbSoundSetQuality(4);
  1.1237 +}
  1.1238 +
  1.1239 +void MainWnd::OnUpdateOptionsSound11khz(CCmdUI*pCmdUI)
  1.1240 +{
  1.1241 +	pCmdUI->SetCheck(soundQuality == 4);
  1.1242 +	pCmdUI->Enable((!VBAMovieActive() ||
  1.1243 +	                GetAsyncKeyState(VK_CONTROL)) && !(theApp.soundRecording || theApp.aviRecording || theApp.nvAudioLog));
  1.1244 +}
  1.1245 +
  1.1246 +void MainWnd::OnOptionsSound22khz()
  1.1247 +{
  1.1248 +	if (systemCartridgeType == 0)
  1.1249 +		soundSetQuality(2);
  1.1250 +	else
  1.1251 +		gbSoundSetQuality(2);
  1.1252 +}
  1.1253 +
  1.1254 +void MainWnd::OnUpdateOptionsSound22khz(CCmdUI*pCmdUI)
  1.1255 +{
  1.1256 +	pCmdUI->SetCheck(soundQuality == 2);
  1.1257 +	pCmdUI->Enable((!VBAMovieActive() ||
  1.1258 +	                GetAsyncKeyState(VK_CONTROL)) && !(theApp.soundRecording || theApp.aviRecording || theApp.nvAudioLog));
  1.1259 +}
  1.1260 +
  1.1261 +void MainWnd::OnOptionsSound44khz()
  1.1262 +{
  1.1263 +	systemSoundSetQuality(1);
  1.1264 +}
  1.1265 +
  1.1266 +void MainWnd::OnUpdateOptionsSound44khz(CCmdUI*pCmdUI)
  1.1267 +{
  1.1268 +	pCmdUI->SetCheck(soundQuality == 1);
  1.1269 +	pCmdUI->Enable(!(theApp.soundRecording || theApp.aviRecording || theApp.nvAudioLog));
  1.1270 +}
  1.1271 +
  1.1272 +BOOL MainWnd::OnOptionsSoundVolume(UINT nID)
  1.1273 +{
  1.1274 +	soundVolume = nID - ID_OPTIONS_SOUND_VOLUME_1X;
  1.1275 +	return TRUE;
  1.1276 +}
  1.1277 +
  1.1278 +void MainWnd::OnUpdateOptionsSoundVolume(CCmdUI *pCmdUI)
  1.1279 +{
  1.1280 +	pCmdUI->SetCheck(soundVolume == (int)(pCmdUI->m_nID - ID_OPTIONS_SOUND_VOLUME_1X));
  1.1281 +}
  1.1282 +
  1.1283 +void MainWnd::OnOptionsSoundVolume25x()
  1.1284 +{
  1.1285 +	soundVolume = 4;
  1.1286 +}
  1.1287 +
  1.1288 +void MainWnd::OnUpdateOptionsSoundVolume25x(CCmdUI*pCmdUI)
  1.1289 +{
  1.1290 +	pCmdUI->SetCheck(soundVolume == 4);
  1.1291 +}
  1.1292 +
  1.1293 +void MainWnd::OnOptionsSoundVolume5x()
  1.1294 +{
  1.1295 +	soundVolume = 5;
  1.1296 +}
  1.1297 +
  1.1298 +void MainWnd::OnUpdateOptionsSoundVolume5x(CCmdUI*pCmdUI)
  1.1299 +{
  1.1300 +	pCmdUI->SetCheck(soundVolume == 5);
  1.1301 +}
  1.1302 +
  1.1303 +void MainWnd::OnOptionsSoundChannel1()
  1.1304 +{
  1.1305 +	OnSoundToggleEnabled(0x01);
  1.1306 +}
  1.1307 +
  1.1308 +void MainWnd::OnUpdateOptionsSoundChannel1(CCmdUI*pCmdUI)
  1.1309 +{
  1.1310 +	pCmdUI->SetCheck(soundGetEnabledChannels() & 0x01);
  1.1311 +}
  1.1312 +
  1.1313 +void MainWnd::OnOptionsSoundChannel2()
  1.1314 +{
  1.1315 +	OnSoundToggleEnabled(0x02);
  1.1316 +}
  1.1317 +
  1.1318 +void MainWnd::OnUpdateOptionsSoundChannel2(CCmdUI*pCmdUI)
  1.1319 +{
  1.1320 +	pCmdUI->SetCheck(soundGetEnabledChannels() & 0x02);
  1.1321 +}
  1.1322 +
  1.1323 +void MainWnd::OnOptionsSoundChannel3()
  1.1324 +{
  1.1325 +	OnSoundToggleEnabled(0x04);
  1.1326 +}
  1.1327 +
  1.1328 +void MainWnd::OnUpdateOptionsSoundChannel3(CCmdUI*pCmdUI)
  1.1329 +{
  1.1330 +	pCmdUI->SetCheck(soundGetEnabledChannels() & 0x04);
  1.1331 +}
  1.1332 +
  1.1333 +void MainWnd::OnOptionsSoundChannel4()
  1.1334 +{
  1.1335 +	OnSoundToggleEnabled(0x08);
  1.1336 +}
  1.1337 +
  1.1338 +void MainWnd::OnUpdateOptionsSoundChannel4(CCmdUI*pCmdUI)
  1.1339 +{
  1.1340 +	pCmdUI->SetCheck(soundGetEnabledChannels() & 0x08);
  1.1341 +}
  1.1342 +
  1.1343 +void MainWnd::OnOptionsSoundDirectsounda()
  1.1344 +{
  1.1345 +	OnSoundToggleEnabled(0x0100);
  1.1346 +}
  1.1347 +
  1.1348 +void MainWnd::OnUpdateOptionsSoundDirectsounda(CCmdUI*pCmdUI)
  1.1349 +{
  1.1350 +	pCmdUI->SetCheck(soundGetEnabledChannels() & 0x0100);
  1.1351 +	//pCmdUI->Enable(systemCartridgeType == 0);
  1.1352 +}
  1.1353 +
  1.1354 +void MainWnd::OnOptionsSoundDirectsoundb()
  1.1355 +{
  1.1356 +	OnSoundToggleEnabled(0x0200);
  1.1357 +}
  1.1358 +
  1.1359 +void MainWnd::OnUpdateOptionsSoundDirectsoundb(CCmdUI*pCmdUI)
  1.1360 +{
  1.1361 +	pCmdUI->SetCheck(soundGetEnabledChannels() & 0x0200);
  1.1362 +	//pCmdUI->Enable(systemCartridgeType == 0);
  1.1363 +}
  1.1364 +
  1.1365 +void MainWnd::OnOptionsGameboyBorder()
  1.1366 +{
  1.1367 +	theApp.winGbBorderOn = !theApp.winGbBorderOn;
  1.1368 +	gbBorderOn = theApp.winGbBorderOn;
  1.1369 +	if (emulating && systemCartridgeType == 1 && gbBorderOn)
  1.1370 +	{
  1.1371 +		gbSgbRenderBorder();
  1.1372 +	}
  1.1373 +	theApp.updateWindowSize(theApp.videoOption);
  1.1374 +}
  1.1375 +
  1.1376 +void MainWnd::OnUpdateOptionsGameboyBorder(CCmdUI*pCmdUI)
  1.1377 +{
  1.1378 +	pCmdUI->SetCheck(theApp.winGbBorderOn);
  1.1379 +}
  1.1380 +
  1.1381 +void MainWnd::OnOptionsGameboyPrinter()
  1.1382 +{
  1.1383 +	theApp.winGbPrinterEnabled = !theApp.winGbPrinterEnabled;
  1.1384 +	if (theApp.winGbPrinterEnabled)
  1.1385 +		gbSerialFunction = gbPrinterSend;
  1.1386 +	else
  1.1387 +		gbSerialFunction = NULL;
  1.1388 +}
  1.1389 +
  1.1390 +void MainWnd::OnUpdateOptionsGameboyPrinter(CCmdUI*pCmdUI)
  1.1391 +{
  1.1392 +	pCmdUI->SetCheck(gbSerialFunction == gbPrinterSend);
  1.1393 +}
  1.1394 +
  1.1395 +void MainWnd::OnOptionsGameboyBorderAutomatic()
  1.1396 +{
  1.1397 +	gbBorderAutomatic = !gbBorderAutomatic;
  1.1398 +	if (emulating && systemCartridgeType == 1 && gbBorderOn)
  1.1399 +	{
  1.1400 +		gbSgbRenderBorder();
  1.1401 +		theApp.updateWindowSize(theApp.videoOption);
  1.1402 +	}
  1.1403 +}
  1.1404 +
  1.1405 +void MainWnd::OnUpdateOptionsGameboyBorderAutomatic(CCmdUI*pCmdUI)
  1.1406 +{
  1.1407 +	pCmdUI->SetCheck(gbBorderAutomatic);
  1.1408 +}
  1.1409 +
  1.1410 +void MainWnd::OnOptionsGameboyAutomatic()
  1.1411 +{
  1.1412 +	gbEmulatorType = 0;
  1.1413 +}
  1.1414 +
  1.1415 +void MainWnd::OnUpdateOptionsGameboyAutomatic(CCmdUI*pCmdUI)
  1.1416 +{
  1.1417 +	pCmdUI->SetCheck(gbEmulatorType == 0);
  1.1418 +	pCmdUI->Enable(!VBAMovieActive() || GetAsyncKeyState(VK_CONTROL));
  1.1419 +}
  1.1420 +
  1.1421 +void MainWnd::OnOptionsGameboyGba()
  1.1422 +{
  1.1423 +	gbEmulatorType = 4;
  1.1424 +}
  1.1425 +
  1.1426 +void MainWnd::OnUpdateOptionsGameboyGba(CCmdUI*pCmdUI)
  1.1427 +{
  1.1428 +	pCmdUI->SetCheck(gbEmulatorType == 4);
  1.1429 +	pCmdUI->Enable(!VBAMovieActive() || GetAsyncKeyState(VK_CONTROL));
  1.1430 +}
  1.1431 +
  1.1432 +void MainWnd::OnOptionsGameboyCgb()
  1.1433 +{
  1.1434 +	gbEmulatorType = 1;
  1.1435 +}
  1.1436 +
  1.1437 +void MainWnd::OnUpdateOptionsGameboyCgb(CCmdUI*pCmdUI)
  1.1438 +{
  1.1439 +	pCmdUI->SetCheck(gbEmulatorType == 1);
  1.1440 +	pCmdUI->Enable(!VBAMovieActive() || GetAsyncKeyState(VK_CONTROL));
  1.1441 +}
  1.1442 +
  1.1443 +void MainWnd::OnOptionsGameboySgb()
  1.1444 +{
  1.1445 +	gbEmulatorType = 2;
  1.1446 +}
  1.1447 +
  1.1448 +void MainWnd::OnUpdateOptionsGameboySgb(CCmdUI*pCmdUI)
  1.1449 +{
  1.1450 +	pCmdUI->SetCheck(gbEmulatorType == 2);
  1.1451 +	pCmdUI->Enable(!VBAMovieActive() || GetAsyncKeyState(VK_CONTROL));
  1.1452 +}
  1.1453 +
  1.1454 +void MainWnd::OnOptionsGameboySgb2()
  1.1455 +{
  1.1456 +	gbEmulatorType = 5;
  1.1457 +}
  1.1458 +
  1.1459 +void MainWnd::OnUpdateOptionsGameboySgb2(CCmdUI*pCmdUI)
  1.1460 +{
  1.1461 +	pCmdUI->SetCheck(gbEmulatorType == 5);
  1.1462 +	pCmdUI->Enable(!VBAMovieActive() || GetAsyncKeyState(VK_CONTROL));
  1.1463 +}
  1.1464 +
  1.1465 +void MainWnd::OnOptionsGameboyGb()
  1.1466 +{
  1.1467 +	gbEmulatorType = 3;
  1.1468 +}
  1.1469 +
  1.1470 +void MainWnd::OnUpdateOptionsGameboyGb(CCmdUI*pCmdUI)
  1.1471 +{
  1.1472 +	pCmdUI->SetCheck(gbEmulatorType == 3);
  1.1473 +	pCmdUI->Enable(!VBAMovieActive() || GetAsyncKeyState(VK_CONTROL));
  1.1474 +}
  1.1475 +
  1.1476 +void MainWnd::OnOptionsGameboyRealcolors()
  1.1477 +{
  1.1478 +	gbColorOption = 0;
  1.1479 +}
  1.1480 +
  1.1481 +void MainWnd::OnUpdateOptionsGameboyRealcolors(CCmdUI*pCmdUI)
  1.1482 +{
  1.1483 +	pCmdUI->SetCheck(gbColorOption == 0);
  1.1484 +}
  1.1485 +
  1.1486 +void MainWnd::OnOptionsGameboyGameboycolors()
  1.1487 +{
  1.1488 +	gbColorOption = 1;
  1.1489 +}
  1.1490 +
  1.1491 +void MainWnd::OnUpdateOptionsGameboyGameboycolors(CCmdUI*pCmdUI)
  1.1492 +{
  1.1493 +	pCmdUI->SetCheck(gbColorOption == 1);
  1.1494 +}
  1.1495 +
  1.1496 +void MainWnd::OnOptionsGameboyColors()
  1.1497 +{
  1.1498 +	theApp.winCheckFullscreen();
  1.1499 +	GBColorDlg dlg;
  1.1500 +	if (dlg.DoModal())
  1.1501 +	{
  1.1502 +		gbPaletteOption = dlg.getWhich();
  1.1503 +		memcpy(systemGbPalette, dlg.getColors(), 24*sizeof(u16));
  1.1504 +		if (emulating && systemCartridgeType == 1)
  1.1505 +		{
  1.1506 +			memcpy(gbPalette, &systemGbPalette[dlg.getWhich()*8], 8*sizeof(u16));
  1.1507 +		}
  1.1508 +	}
  1.1509 +}
  1.1510 +
  1.1511 +BOOL MainWnd::OnOptionsFilter(UINT nID)
  1.1512 +{
  1.1513 +	switch (nID)
  1.1514 +	{
  1.1515 +	case ID_OPTIONS_FILTER_NORMAL:
  1.1516 +		theApp.filterType = 0;
  1.1517 +		break;
  1.1518 +	case ID_OPTIONS_FILTER_TVMODE:
  1.1519 +		theApp.filterType = 1;
  1.1520 +		break;
  1.1521 +	case ID_OPTIONS_FILTER_2XSAI:
  1.1522 +		theApp.filterType = 2;
  1.1523 +		break;
  1.1524 +	case ID_OPTIONS_FILTER_SUPER2XSAI:
  1.1525 +		theApp.filterType = 3;
  1.1526 +		break;
  1.1527 +	case ID_OPTIONS_FILTER_SUPEREAGLE:
  1.1528 +		theApp.filterType = 4;
  1.1529 +		break;
  1.1530 +	case ID_OPTIONS_FILTER16BIT_PIXELATEEXPERIMENTAL:
  1.1531 +		theApp.filterType = 5;
  1.1532 +		break;
  1.1533 +	case ID_OPTIONS_FILTER16BIT_MOTIONBLUREXPERIMENTAL:
  1.1534 +		theApp.filterType = 6;
  1.1535 +		break;
  1.1536 +	case ID_OPTIONS_FILTER16BIT_ADVANCEMAMESCALE2X:
  1.1537 +		theApp.filterType = 7;
  1.1538 +		break;
  1.1539 +	case ID_OPTIONS_FILTER16BIT_SIMPLE2X:
  1.1540 +		theApp.filterType = 8;
  1.1541 +		break;
  1.1542 +	case ID_OPTIONS_FILTER_BILINEAR:
  1.1543 +		theApp.filterType = 9;
  1.1544 +		break;
  1.1545 +	case ID_OPTIONS_FILTER_BILINEARPLUS:
  1.1546 +		theApp.filterType = 10;
  1.1547 +		break;
  1.1548 +	case ID_OPTIONS_FILTER_SCANLINES:
  1.1549 +		theApp.filterType = 11;
  1.1550 +		break;
  1.1551 +	case ID_OPTIONS_FILTER_HQ2X2:
  1.1552 +		theApp.filterType = 12;
  1.1553 +		break;
  1.1554 +	case ID_OPTIONS_FILTER_HQ2X:
  1.1555 +		theApp.filterType = 13;
  1.1556 +		break;
  1.1557 +	case ID_OPTIONS_FILTER_LQ2X:
  1.1558 +		theApp.filterType = 14;
  1.1559 +		break;
  1.1560 +	case ID_OPTIONS_FILTER_HQ3X2:
  1.1561 +		theApp.filterType = 15;
  1.1562 +		break;
  1.1563 +	case ID_OPTIONS_FILTER_HQ3X:
  1.1564 +		theApp.filterType = 16;
  1.1565 +		break;
  1.1566 +	case ID_OPTIONS_FILTER16BIT_SIMPLE3X:
  1.1567 +		theApp.filterType = 17;
  1.1568 +		break;
  1.1569 +	case ID_OPTIONS_FILTER16BIT_SIMPLE4X:
  1.1570 +		theApp.filterType = 18;
  1.1571 +		break;
  1.1572 +	case ID_OPTIONS_FILTER16BIT_PIXELATEEXPERIMENTAL3X:
  1.1573 +		theApp.filterType = 19;
  1.1574 +		break;
  1.1575 +	case ID_OPTIONS_FILTER16BIT_PIXELATEEXPERIMENTAL4X:
  1.1576 +		theApp.filterType = 20;
  1.1577 +		break;
  1.1578 +	default:
  1.1579 +		return FALSE;
  1.1580 +	}
  1.1581 +	theApp.updateFilter();
  1.1582 +	return TRUE;
  1.1583 +}
  1.1584 +
  1.1585 +void MainWnd::OnUpdateOptionsFilter(CCmdUI *pCmdUI)
  1.1586 +{
  1.1587 +	pCmdUI->Enable(systemColorDepth == 16 || systemColorDepth == 32);
  1.1588 +	switch (pCmdUI->m_nID)
  1.1589 +	{
  1.1590 +	case ID_OPTIONS_FILTER_NORMAL:
  1.1591 +		pCmdUI->SetCheck(theApp.filterType == 0);
  1.1592 +		break;
  1.1593 +	case ID_OPTIONS_FILTER_TVMODE:
  1.1594 +		pCmdUI->SetCheck(theApp.filterType == 1);
  1.1595 +		break;
  1.1596 +	case ID_OPTIONS_FILTER_2XSAI:
  1.1597 +		pCmdUI->SetCheck(theApp.filterType == 2);
  1.1598 +		break;
  1.1599 +	case ID_OPTIONS_FILTER_SUPER2XSAI:
  1.1600 +		pCmdUI->SetCheck(theApp.filterType == 3);
  1.1601 +		break;
  1.1602 +	case ID_OPTIONS_FILTER_SUPEREAGLE:
  1.1603 +		pCmdUI->SetCheck(theApp.filterType == 4);
  1.1604 +		break;
  1.1605 +	case ID_OPTIONS_FILTER16BIT_PIXELATEEXPERIMENTAL:
  1.1606 +		pCmdUI->SetCheck(theApp.filterType == 5);
  1.1607 +		break;
  1.1608 +	case ID_OPTIONS_FILTER16BIT_MOTIONBLUREXPERIMENTAL:
  1.1609 +		pCmdUI->SetCheck(theApp.filterType == 6);
  1.1610 +		break;
  1.1611 +	case ID_OPTIONS_FILTER16BIT_ADVANCEMAMESCALE2X:
  1.1612 +		pCmdUI->SetCheck(theApp.filterType == 7);
  1.1613 +		break;
  1.1614 +	case ID_OPTIONS_FILTER16BIT_SIMPLE2X:
  1.1615 +		pCmdUI->SetCheck(theApp.filterType == 8);
  1.1616 +		break;
  1.1617 +	case ID_OPTIONS_FILTER_BILINEAR:
  1.1618 +		pCmdUI->SetCheck(theApp.filterType == 9);
  1.1619 +		break;
  1.1620 +	case ID_OPTIONS_FILTER_BILINEARPLUS:
  1.1621 +		pCmdUI->SetCheck(theApp.filterType == 10);
  1.1622 +		break;
  1.1623 +	case ID_OPTIONS_FILTER_SCANLINES:
  1.1624 +		pCmdUI->SetCheck(theApp.filterType == 11);
  1.1625 +		break;
  1.1626 +	case ID_OPTIONS_FILTER_HQ2X2:
  1.1627 +		pCmdUI->SetCheck(theApp.filterType == 12);
  1.1628 +		break;
  1.1629 +	case ID_OPTIONS_FILTER_HQ2X:
  1.1630 +		pCmdUI->SetCheck(theApp.filterType == 13);
  1.1631 +		break;
  1.1632 +	case ID_OPTIONS_FILTER_LQ2X:
  1.1633 +		pCmdUI->SetCheck(theApp.filterType == 14);
  1.1634 +		break;
  1.1635 +	case ID_OPTIONS_FILTER_HQ3X2:
  1.1636 +		pCmdUI->SetCheck(theApp.filterType == 15);
  1.1637 +		break;
  1.1638 +	case ID_OPTIONS_FILTER_HQ3X:
  1.1639 +		pCmdUI->SetCheck(theApp.filterType == 16);
  1.1640 +		break;
  1.1641 +	case ID_OPTIONS_FILTER16BIT_SIMPLE3X:
  1.1642 +		pCmdUI->SetCheck(theApp.filterType == 17);
  1.1643 +		break;
  1.1644 +	case ID_OPTIONS_FILTER16BIT_SIMPLE4X:
  1.1645 +		pCmdUI->SetCheck(theApp.filterType == 18);
  1.1646 +		break;
  1.1647 +	case ID_OPTIONS_FILTER16BIT_PIXELATEEXPERIMENTAL3X:
  1.1648 +		pCmdUI->SetCheck(theApp.filterType == 19);
  1.1649 +		break;
  1.1650 +	case ID_OPTIONS_FILTER16BIT_PIXELATEEXPERIMENTAL4X:
  1.1651 +		pCmdUI->SetCheck(theApp.filterType == 20);
  1.1652 +		break;
  1.1653 +	}
  1.1654 +}
  1.1655 +
  1.1656 +BOOL MainWnd::OnOptionsFilterIFB(UINT nID)
  1.1657 +{
  1.1658 +	switch (nID)
  1.1659 +	{
  1.1660 +	case ID_OPTIONS_FILTER_INTERFRAMEBLENDING_NONE:
  1.1661 +		theApp.ifbType = 0;
  1.1662 +		break;
  1.1663 +	case ID_OPTIONS_FILTER_INTERFRAMEBLENDING_MOTIONBLUR:
  1.1664 +		theApp.ifbType = 1;
  1.1665 +		break;
  1.1666 +	case ID_OPTIONS_FILTER_INTERFRAMEBLENDING_SMART:
  1.1667 +		theApp.ifbType = 2;
  1.1668 +		break;
  1.1669 +	default:
  1.1670 +		return FALSE;
  1.1671 +	}
  1.1672 +	theApp.updateIFB();
  1.1673 +	return TRUE;
  1.1674 +}
  1.1675 +
  1.1676 +void MainWnd::OnUpdateOptionsFilterIFB(CCmdUI *pCmdUI)
  1.1677 +{
  1.1678 +	switch (pCmdUI->m_nID)
  1.1679 +	{
  1.1680 +	case ID_OPTIONS_FILTER_INTERFRAMEBLENDING_NONE:
  1.1681 +		pCmdUI->SetCheck(theApp.ifbType == 0);
  1.1682 +		break;
  1.1683 +	case ID_OPTIONS_FILTER_INTERFRAMEBLENDING_MOTIONBLUR:
  1.1684 +		pCmdUI->SetCheck(theApp.ifbType == 1);
  1.1685 +		break;
  1.1686 +	case ID_OPTIONS_FILTER_INTERFRAMEBLENDING_SMART:
  1.1687 +		pCmdUI->SetCheck(theApp.ifbType == 2);
  1.1688 +		break;
  1.1689 +	}
  1.1690 +}
  1.1691 +
  1.1692 +void MainWnd::OnOptionsFilterDisablemmx()
  1.1693 +{
  1.1694 +	theApp.disableMMX = !theApp.disableMMX;
  1.1695 +	if (!theApp.disableMMX)
  1.1696 +		cpu_mmx = theApp.detectMMX();
  1.1697 +	else
  1.1698 +		cpu_mmx = 0;
  1.1699 +}
  1.1700 +
  1.1701 +void MainWnd::OnUpdateOptionsFilterDisablemmx(CCmdUI*pCmdUI)
  1.1702 +{
  1.1703 +	pCmdUI->SetCheck(theApp.disableMMX);
  1.1704 +}
  1.1705 +
  1.1706 +void MainWnd::OnOptionsLanguageSystem()
  1.1707 +{
  1.1708 +	theApp.winSetLanguageOption(0, false);
  1.1709 +}
  1.1710 +
  1.1711 +void MainWnd::OnUpdateOptionsLanguageSystem(CCmdUI*pCmdUI)
  1.1712 +{
  1.1713 +	pCmdUI->SetCheck(theApp.languageOption == 0);
  1.1714 +}
  1.1715 +
  1.1716 +void MainWnd::OnOptionsLanguageEnglish()
  1.1717 +{
  1.1718 +	theApp.winSetLanguageOption(1, false);
  1.1719 +}
  1.1720 +
  1.1721 +void MainWnd::OnUpdateOptionsLanguageEnglish(CCmdUI*pCmdUI)
  1.1722 +{
  1.1723 +	pCmdUI->SetCheck(theApp.languageOption == 1);
  1.1724 +}
  1.1725 +
  1.1726 +void MainWnd::OnOptionsLanguageOther()
  1.1727 +{
  1.1728 +	theApp.winCheckFullscreen();
  1.1729 +	theApp.winSetLanguageOption(2, false);
  1.1730 +}
  1.1731 +
  1.1732 +void MainWnd::OnUpdateOptionsLanguageOther(CCmdUI*pCmdUI)
  1.1733 +{
  1.1734 +	pCmdUI->SetCheck(theApp.languageOption == 2);
  1.1735 +}
  1.1736 +
  1.1737 +void MainWnd::OnOptionsJoypadConfigure1()
  1.1738 +{
  1.1739 +	theApp.winCheckFullscreen();
  1.1740 +	JoypadConfig dlg(0);
  1.1741 +	dlg.DoModal();
  1.1742 +}
  1.1743 +
  1.1744 +void MainWnd::OnUpdateOptionsJoypadConfigure1(CCmdUI*pCmdUI)
  1.1745 +{
  1.1746 +	pCmdUI->Enable(theApp.videoOption != VIDEO_320x240);
  1.1747 +}
  1.1748 +
  1.1749 +void MainWnd::OnOptionsJoypadConfigure2()
  1.1750 +{
  1.1751 +	theApp.winCheckFullscreen();
  1.1752 +	JoypadConfig dlg(1);
  1.1753 +	dlg.DoModal();
  1.1754 +}
  1.1755 +
  1.1756 +void MainWnd::OnUpdateOptionsJoypadConfigure2(CCmdUI*pCmdUI)
  1.1757 +{
  1.1758 +	pCmdUI->Enable(theApp.videoOption != VIDEO_320x240);
  1.1759 +}
  1.1760 +
  1.1761 +void MainWnd::OnOptionsJoypadConfigure3()
  1.1762 +{
  1.1763 +	theApp.winCheckFullscreen();
  1.1764 +	JoypadConfig dlg(2);
  1.1765 +	dlg.DoModal();
  1.1766 +}
  1.1767 +
  1.1768 +void MainWnd::OnUpdateOptionsJoypadConfigure3(CCmdUI*pCmdUI)
  1.1769 +{
  1.1770 +	pCmdUI->Enable(theApp.videoOption != VIDEO_320x240);
  1.1771 +}
  1.1772 +
  1.1773 +void MainWnd::OnOptionsJoypadConfigure4()
  1.1774 +{
  1.1775 +	theApp.winCheckFullscreen();
  1.1776 +	JoypadConfig dlg(3);
  1.1777 +	dlg.DoModal();
  1.1778 +}
  1.1779 +
  1.1780 +void MainWnd::OnUpdateOptionsJoypadConfigure4(CCmdUI*pCmdUI)
  1.1781 +{
  1.1782 +	pCmdUI->Enable(theApp.videoOption != VIDEO_320x240);
  1.1783 +}
  1.1784 +
  1.1785 +BOOL MainWnd::OnOptionsJoypadDefault(UINT nID)
  1.1786 +{
  1.1787 +	theApp.joypadDefault = nID - ID_OPTIONS_JOYPAD_DEFAULTJOYPAD_1;
  1.1788 +	return TRUE;
  1.1789 +}
  1.1790 +
  1.1791 +void MainWnd::OnUpdateOptionsJoypadDefault(CCmdUI *pCmdUI)
  1.1792 +{
  1.1793 +	pCmdUI->SetCheck(theApp.joypadDefault == (int)(pCmdUI->m_nID - ID_OPTIONS_JOYPAD_DEFAULTJOYPAD_1));
  1.1794 +}
  1.1795 +
  1.1796 +void MainWnd::OnOptionsJoypadMotionconfigure()
  1.1797 +{
  1.1798 +	theApp.winCheckFullscreen();
  1.1799 +	MotionConfig dlg;
  1.1800 +	dlg.DoModal();
  1.1801 +}
  1.1802 +
  1.1803 +void MainWnd::OnUpdateOptionsJoypadMotionconfigure(CCmdUI*pCmdUI)
  1.1804 +{
  1.1805 +	pCmdUI->Enable(theApp.videoOption != VIDEO_320x240);
  1.1806 +}
  1.1807 +
  1.1808 +void MainWnd::OnOptionsJoypadAllowLeftRight()
  1.1809 +{
  1.1810 +	theApp.allowLeftRight = !theApp.allowLeftRight;
  1.1811 +}
  1.1812 +
  1.1813 +void MainWnd::OnUpdateOptionsJoypadAllowLeftRight(CCmdUI*pCmdUI)
  1.1814 +{
  1.1815 +	pCmdUI->SetCheck(theApp.allowLeftRight);
  1.1816 +}
  1.1817 +
  1.1818 +void MainWnd::OnOptionsJoypadAutofireAccountForLag()
  1.1819 +{
  1.1820 +	theApp.autofireAccountForLag = !theApp.autofireAccountForLag;
  1.1821 +}
  1.1822 +
  1.1823 +void MainWnd::OnUpdateOptionsJoypadAutofireAccountForLag(CCmdUI*pCmdUI)
  1.1824 +{
  1.1825 +	pCmdUI->SetCheck(theApp.autofireAccountForLag);
  1.1826 +}
  1.1827 +
  1.1828 +BOOL MainWnd::OnOptionsJoypadAutofire(UINT nID)
  1.1829 +{
  1.1830 +	int & autoFire  = (theApp.autoFireToggle ? theApp.autoFire : theApp.autoFire2);
  1.1831 +	int & autoFire2 = (theApp.autoFireToggle ? theApp.autoFire2 : theApp.autoFire);
  1.1832 +	int   autoFires = (theApp.autoFire | theApp.autoFire2);
  1.1833 +
  1.1834 +	switch (nID)
  1.1835 +	{
  1.1836 +	case ID_OPTIONS_JOYPAD_AUTOFIRE_A:
  1.1837 +		if (autoFires & BUTTON_MASK_A)
  1.1838 +		{
  1.1839 +			autoFire &= ~BUTTON_MASK_A;
  1.1840 +///      systemScreenMessage(winResLoadString(IDS_AUTOFIRE_A_DISABLED));
  1.1841 +		}
  1.1842 +		else
  1.1843 +		{
  1.1844 +			autoFire |= BUTTON_MASK_A;
  1.1845 +///      systemScreenMessage(winResLoadString(IDS_AUTOFIRE_A));
  1.1846 +		}
  1.1847 +		autoFire2       &= ~BUTTON_MASK_A;
  1.1848 +		theApp.autoHold &= ~BUTTON_MASK_A;
  1.1849 +		break;
  1.1850 +	case ID_OPTIONS_JOYPAD_AUTOFIRE_B:
  1.1851 +		if (autoFires & BUTTON_MASK_B)
  1.1852 +		{
  1.1853 +			autoFire &= ~BUTTON_MASK_B;
  1.1854 +///      systemScreenMessage(winResLoadString(IDS_AUTOFIRE_B_DISABLED));
  1.1855 +		}
  1.1856 +		else
  1.1857 +		{
  1.1858 +			autoFire |= BUTTON_MASK_B;
  1.1859 +///      systemScreenMessage(winResLoadString(IDS_AUTOFIRE_B));
  1.1860 +		}
  1.1861 +		autoFire2       &= ~BUTTON_MASK_B;
  1.1862 +		theApp.autoHold &= ~BUTTON_MASK_B;
  1.1863 +		break;
  1.1864 +	case ID_OPTIONS_JOYPAD_AUTOFIRE_L:
  1.1865 +		if (autoFires & BUTTON_MASK_L)
  1.1866 +		{
  1.1867 +			autoFire &= ~BUTTON_MASK_L;
  1.1868 +///      systemScreenMessage(winResLoadString(IDS_AUTOFIRE_L_DISABLED));
  1.1869 +		}
  1.1870 +		else
  1.1871 +		{
  1.1872 +			autoFire |= BUTTON_MASK_L;
  1.1873 +///      systemScreenMessage(winResLoadString(IDS_AUTOFIRE_L));
  1.1874 +		}
  1.1875 +		autoFire2       &= ~BUTTON_MASK_L;
  1.1876 +		theApp.autoHold &= ~BUTTON_MASK_L;
  1.1877 +		break;
  1.1878 +	case ID_OPTIONS_JOYPAD_AUTOFIRE_R:
  1.1879 +		if (autoFires & BUTTON_MASK_R)
  1.1880 +		{
  1.1881 +			autoFire &= ~BUTTON_MASK_R;
  1.1882 +///      systemScreenMessage(winResLoadString(IDS_AUTOFIRE_R_DISABLED));
  1.1883 +		}
  1.1884 +		else
  1.1885 +		{
  1.1886 +			autoFire |= BUTTON_MASK_R;
  1.1887 +///      systemScreenMessage(winResLoadString(IDS_AUTOFIRE_R));
  1.1888 +		}
  1.1889 +		autoFire2       &= ~BUTTON_MASK_R;
  1.1890 +		theApp.autoHold &= ~BUTTON_MASK_R;
  1.1891 +		break;
  1.1892 +	case ID_OPTIONS_JOYPAD_AUTOFIRE_START:
  1.1893 +		if (autoFires & BUTTON_MASK_START)
  1.1894 +		{
  1.1895 +			autoFire &= ~BUTTON_MASK_START;
  1.1896 +///      systemScreenMessage(winResLoadString(IDS_AUTOFIRE_START_DISABLED));
  1.1897 +		}
  1.1898 +		else
  1.1899 +		{
  1.1900 +			autoFire |= BUTTON_MASK_START;
  1.1901 +///      systemScreenMessage(winResLoadString(IDS_AUTOFIRE_START));
  1.1902 +		}
  1.1903 +		autoFire2       &= ~BUTTON_MASK_START;
  1.1904 +		theApp.autoHold &= ~BUTTON_MASK_START;
  1.1905 +		break;
  1.1906 +	case ID_OPTIONS_JOYPAD_AUTOFIRE_SELECT:
  1.1907 +		if (autoFires & BUTTON_MASK_SELECT)
  1.1908 +		{
  1.1909 +			autoFire &= ~BUTTON_MASK_SELECT;
  1.1910 +///      systemScreenMessage(winResLoadString(IDS_AUTOFIRE_SELECT_DISABLED));
  1.1911 +		}
  1.1912 +		else
  1.1913 +		{
  1.1914 +			autoFire |= BUTTON_MASK_SELECT;
  1.1915 +///      systemScreenMessage(winResLoadString(IDS_AUTOFIRE_SELECT));
  1.1916 +		}
  1.1917 +		autoFire2       &= ~BUTTON_MASK_SELECT;
  1.1918 +		theApp.autoHold &= ~BUTTON_MASK_SELECT;
  1.1919 +		break;
  1.1920 +	case ID_OPTIONS_JOYPAD_AUTOFIRE_UP:
  1.1921 +		if (autoFires & BUTTON_MASK_UP)
  1.1922 +		{
  1.1923 +			autoFire &= ~BUTTON_MASK_UP;
  1.1924 +///      systemScreenMessage(winResLoadString(IDS_AUTOFIRE_UP_DISABLED));
  1.1925 +		}
  1.1926 +		else
  1.1927 +		{
  1.1928 +			autoFire |= BUTTON_MASK_UP;
  1.1929 +///      systemScreenMessage(winResLoadString(IDS_AUTOFIRE_UP));
  1.1930 +		}
  1.1931 +		autoFire2       &= ~BUTTON_MASK_UP;
  1.1932 +		theApp.autoHold &= ~BUTTON_MASK_UP;
  1.1933 +		break;
  1.1934 +	case ID_OPTIONS_JOYPAD_AUTOFIRE_DOWN:
  1.1935 +		if (autoFires & BUTTON_MASK_DOWN)
  1.1936 +		{
  1.1937 +			autoFire &= ~BUTTON_MASK_DOWN;
  1.1938 +///      systemScreenMessage(winResLoadString(IDS_AUTOFIRE_DOWN_DISABLED));
  1.1939 +		}
  1.1940 +		else
  1.1941 +		{
  1.1942 +			autoFire |= BUTTON_MASK_DOWN;
  1.1943 +///      systemScreenMessage(winResLoadString(IDS_AUTOFIRE_DOWN));
  1.1944 +		}
  1.1945 +		autoFire2       &= ~BUTTON_MASK_DOWN;
  1.1946 +		theApp.autoHold &= ~BUTTON_MASK_DOWN;
  1.1947 +		break;
  1.1948 +	case ID_OPTIONS_JOYPAD_AUTOFIRE_LEFT:
  1.1949 +		if (autoFires & BUTTON_MASK_LEFT)
  1.1950 +		{
  1.1951 +			autoFire &= ~BUTTON_MASK_LEFT;
  1.1952 +///      systemScreenMessage(winResLoadString(IDS_AUTOFIRE_LEFT_DISABLED));
  1.1953 +		}
  1.1954 +		else
  1.1955 +		{
  1.1956 +			autoFire |= BUTTON_MASK_LEFT;
  1.1957 +///      systemScreenMessage(winResLoadString(IDS_AUTOFIRE_LEFT));
  1.1958 +		}
  1.1959 +		autoFire2       &= ~BUTTON_MASK_LEFT;
  1.1960 +		theApp.autoHold &= ~BUTTON_MASK_LEFT;
  1.1961 +		break;
  1.1962 +	case ID_OPTIONS_JOYPAD_AUTOFIRE_RIGHT:
  1.1963 +		if (autoFires & BUTTON_MASK_RIGHT)
  1.1964 +		{
  1.1965 +			autoFire &= ~BUTTON_MASK_RIGHT;
  1.1966 +///      systemScreenMessage(winResLoadString(IDS_AUTOFIRE_RIGHT_DISABLED));
  1.1967 +		}
  1.1968 +		else
  1.1969 +		{
  1.1970 +			autoFire |= BUTTON_MASK_RIGHT;
  1.1971 +///      systemScreenMessage(winResLoadString(IDS_AUTOFIRE_RIGHT));
  1.1972 +		}
  1.1973 +		autoFire2       &= ~BUTTON_MASK_RIGHT;
  1.1974 +		theApp.autoHold &= ~BUTTON_MASK_RIGHT;
  1.1975 +		break;
  1.1976 +	case ID_OPTIONS_JOYPAD_AUTOFIRE_CLEAR:
  1.1977 +		if (autoFires != 0)
  1.1978 +		{
  1.1979 +			theApp.autoFire = theApp.autoFire2 = 0;
  1.1980 +///      systemScreenMessage(winResLoadString(IDS_AUTOFIRE_DISABLED));
  1.1981 +		}
  1.1982 +		else
  1.1983 +		{
  1.1984 +///      systemScreenMessage(winResLoadString(IDS_AUTOFIRE_ALREADY_DISABLED));
  1.1985 +			systemScreenMessage("already cleared");
  1.1986 +		}
  1.1987 +		break;
  1.1988 +	default:
  1.1989 +		return FALSE;
  1.1990 +	}
  1.1991 +
  1.1992 +	extern void VBAUpdateButtonPressDisplay(); VBAUpdateButtonPressDisplay();
  1.1993 +
  1.1994 +	return TRUE;
  1.1995 +}
  1.1996 +
  1.1997 +void MainWnd::OnUpdateOptionsJoypadAutofire(CCmdUI *pCmdUI)
  1.1998 +{
  1.1999 +///  pCmdUI->Enable(emulating); // FIXME: this is right, but disabling menu items screws up accelerators until you view the
  1.2000 +// menu!
  1.2001 +	pCmdUI->Enable(TRUE); // TEMP
  1.2002 +
  1.2003 +	int autoFires = (theApp.autoFire | theApp.autoFire2);
  1.2004 +
  1.2005 +	bool check = true;
  1.2006 +	switch (pCmdUI->m_nID)
  1.2007 +	{
  1.2008 +	case ID_OPTIONS_JOYPAD_AUTOFIRE_A:
  1.2009 +		check = (autoFires & BUTTON_MASK_A) != 0;
  1.2010 +		break;
  1.2011 +	case ID_OPTIONS_JOYPAD_AUTOFIRE_B:
  1.2012 +		check = (autoFires & BUTTON_MASK_B) != 0;
  1.2013 +		break;
  1.2014 +	case ID_OPTIONS_JOYPAD_AUTOFIRE_L:
  1.2015 +		check = (autoFires & BUTTON_MASK_L) != 0;
  1.2016 +///	extern int gbSgbMode; // from gbSGB.cpp
  1.2017 +///	if(emulating && systemCartridgeType != 0 && !gbSgbMode) // regular GB has no L button
  1.2018 +///      pCmdUI->Enable(false); // FIXME: this is right, but disabling menu items screws up accelerators until you view the
  1.2019 +// menu!
  1.2020 +		break;
  1.2021 +	case ID_OPTIONS_JOYPAD_AUTOFIRE_R:
  1.2022 +		check = (autoFires & BUTTON_MASK_R) != 0;
  1.2023 +///	extern int gbSgbMode; // from gbSGB.cpp
  1.2024 +///	if(emulating && systemCartridgeType != 0 && !gbSgbMode) // regular GB has no R button
  1.2025 +///      pCmdUI->Enable(false); // FIXME: this is right, but disabling menu items screws up accelerators until you view the
  1.2026 +// menu!
  1.2027 +		break;
  1.2028 +	case ID_OPTIONS_JOYPAD_AUTOFIRE_START:
  1.2029 +		check = (autoFires & BUTTON_MASK_START) != 0;
  1.2030 +		break;
  1.2031 +	case ID_OPTIONS_JOYPAD_AUTOFIRE_SELECT:
  1.2032 +		check = (autoFires & BUTTON_MASK_SELECT) != 0;
  1.2033 +		break;
  1.2034 +	case ID_OPTIONS_JOYPAD_AUTOFIRE_UP:
  1.2035 +		check = (autoFires & BUTTON_MASK_UP) != 0;
  1.2036 +		break;
  1.2037 +	case ID_OPTIONS_JOYPAD_AUTOFIRE_DOWN:
  1.2038 +		check = (autoFires & BUTTON_MASK_DOWN) != 0;
  1.2039 +		break;
  1.2040 +	case ID_OPTIONS_JOYPAD_AUTOFIRE_LEFT:
  1.2041 +		check = (autoFires & BUTTON_MASK_LEFT) != 0;
  1.2042 +		break;
  1.2043 +	case ID_OPTIONS_JOYPAD_AUTOFIRE_RIGHT:
  1.2044 +		check = (autoFires & BUTTON_MASK_RIGHT) != 0;
  1.2045 +		break;
  1.2046 +	case ID_OPTIONS_JOYPAD_AUTOFIRE_CLEAR:
  1.2047 +		check = (autoFires == 0);
  1.2048 +///    pCmdUI->Enable(!check); // FIXME: this is right, but disabling menu items screws up accelerators until you view the menu!
  1.2049 +		break;
  1.2050 +	}
  1.2051 +	pCmdUI->SetCheck(check);
  1.2052 +}
  1.2053 +
  1.2054 +BOOL MainWnd::OnOptionsJoypadSticky(UINT nID)
  1.2055 +{
  1.2056 +	switch (nID)
  1.2057 +	{
  1.2058 +	case ID_STICKY_A:
  1.2059 +		if (theApp.autoHold & BUTTON_MASK_A)
  1.2060 +		{
  1.2061 +			theApp.autoHold &= ~BUTTON_MASK_A;
  1.2062 +///      systemScreenMessage(winResLoadString(IDS_STICKY_A_DISABLED));
  1.2063 +		}
  1.2064 +		else
  1.2065 +		{
  1.2066 +			theApp.autoHold |= BUTTON_MASK_A;
  1.2067 +///      systemScreenMessage(winResLoadString(IDS_STICKY_A));
  1.2068 +		}
  1.2069 +		theApp.autoFire  &= ~BUTTON_MASK_A;
  1.2070 +		theApp.autoFire2 &= ~BUTTON_MASK_A;
  1.2071 +		break;
  1.2072 +	case ID_STICKY_B:
  1.2073 +		if (theApp.autoHold & BUTTON_MASK_B)
  1.2074 +		{
  1.2075 +			theApp.autoHold &= ~BUTTON_MASK_B;
  1.2076 +///      systemScreenMessage(winResLoadString(IDS_STICKY_B_DISABLED));
  1.2077 +		}
  1.2078 +		else
  1.2079 +		{
  1.2080 +			theApp.autoHold |= BUTTON_MASK_B;
  1.2081 +///      systemScreenMessage(winResLoadString(IDS_STICKY_B));
  1.2082 +		}
  1.2083 +		theApp.autoFire  &= ~BUTTON_MASK_B;
  1.2084 +		theApp.autoFire2 &= ~BUTTON_MASK_B;
  1.2085 +		break;
  1.2086 +	case ID_STICKY_L:
  1.2087 +		if (theApp.autoHold & BUTTON_MASK_L)
  1.2088 +		{
  1.2089 +			theApp.autoHold &= ~BUTTON_MASK_L;
  1.2090 +///      systemScreenMessage(winResLoadString(IDS_STICKY_L_DISABLED));
  1.2091 +		}
  1.2092 +		else
  1.2093 +		{
  1.2094 +			theApp.autoHold |= BUTTON_MASK_L;
  1.2095 +///      systemScreenMessage(winResLoadString(IDS_STICKY_L));
  1.2096 +		}
  1.2097 +		theApp.autoFire  &= ~BUTTON_MASK_L;
  1.2098 +		theApp.autoFire2 &= ~BUTTON_MASK_L;
  1.2099 +		break;
  1.2100 +	case ID_STICKY_R:
  1.2101 +		if (theApp.autoHold & BUTTON_MASK_R)
  1.2102 +		{
  1.2103 +			theApp.autoHold &= ~BUTTON_MASK_R;
  1.2104 +///      systemScreenMessage(winResLoadString(IDS_STICKY_R_DISABLED));
  1.2105 +		}
  1.2106 +		else
  1.2107 +		{
  1.2108 +			theApp.autoHold |= BUTTON_MASK_R;
  1.2109 +///      systemScreenMessage(winResLoadString(IDS_STICKY_R));
  1.2110 +		}
  1.2111 +		theApp.autoFire  &= ~BUTTON_MASK_R;
  1.2112 +		theApp.autoFire2 &= ~BUTTON_MASK_R;
  1.2113 +		break;
  1.2114 +	case ID_STICKY_START:
  1.2115 +		if (theApp.autoHold & BUTTON_MASK_START)
  1.2116 +		{
  1.2117 +			theApp.autoHold &= ~BUTTON_MASK_START;
  1.2118 +///      systemScreenMessage(winResLoadString(IDS_STICKY_START_DISABLED));
  1.2119 +		}
  1.2120 +		else
  1.2121 +		{
  1.2122 +			theApp.autoHold |= BUTTON_MASK_START;
  1.2123 +///      systemScreenMessage(winResLoadString(IDS_STICKY_START));
  1.2124 +		}
  1.2125 +		theApp.autoFire  &= ~BUTTON_MASK_START;
  1.2126 +		theApp.autoFire2 &= ~BUTTON_MASK_START;
  1.2127 +		break;
  1.2128 +	case ID_STICKY_SELECT:
  1.2129 +		if (theApp.autoHold & BUTTON_MASK_SELECT)
  1.2130 +		{
  1.2131 +			theApp.autoHold &= ~BUTTON_MASK_SELECT;
  1.2132 +///      systemScreenMessage(winResLoadString(IDS_STICKY_SELECT_DISABLED));
  1.2133 +		}
  1.2134 +		else
  1.2135 +		{
  1.2136 +			theApp.autoHold |= BUTTON_MASK_SELECT;
  1.2137 +///      systemScreenMessage(winResLoadString(IDS_STICKY_SELECT));
  1.2138 +		}
  1.2139 +		theApp.autoFire  &= ~BUTTON_MASK_SELECT;
  1.2140 +		theApp.autoFire2 &= ~BUTTON_MASK_SELECT;
  1.2141 +		break;
  1.2142 +	case ID_STICKY_UP:
  1.2143 +		if (theApp.autoHold & BUTTON_MASK_UP)
  1.2144 +		{
  1.2145 +			theApp.autoHold &= ~BUTTON_MASK_UP;
  1.2146 +///      systemScreenMessage(winResLoadString(IDS_STICKY_UP_DISABLED));
  1.2147 +		}
  1.2148 +		else
  1.2149 +		{
  1.2150 +			theApp.autoHold |= BUTTON_MASK_UP;
  1.2151 +///      systemScreenMessage(winResLoadString(IDS_STICKY_UP));
  1.2152 +		}
  1.2153 +		theApp.autoFire  &= ~BUTTON_MASK_UP;
  1.2154 +		theApp.autoFire2 &= ~BUTTON_MASK_UP;
  1.2155 +		if (!theApp.allowLeftRight)
  1.2156 +			theApp.autoHold &= ~BUTTON_MASK_DOWN;
  1.2157 +		break;
  1.2158 +	case ID_STICKY_DOWN:
  1.2159 +		if (theApp.autoHold & BUTTON_MASK_DOWN)
  1.2160 +		{
  1.2161 +			theApp.autoHold &= ~BUTTON_MASK_DOWN;
  1.2162 +///      systemScreenMessage(winResLoadString(IDS_STICKY_DOWN_DISABLED));
  1.2163 +		}
  1.2164 +		else
  1.2165 +		{
  1.2166 +			theApp.autoHold |= BUTTON_MASK_DOWN;
  1.2167 +///      systemScreenMessage(winResLoadString(IDS_STICKY_DOWN));
  1.2168 +		}
  1.2169 +		theApp.autoFire  &= ~BUTTON_MASK_DOWN;
  1.2170 +		theApp.autoFire2 &= ~BUTTON_MASK_DOWN;
  1.2171 +		if (!theApp.allowLeftRight)
  1.2172 +			theApp.autoHold &= ~BUTTON_MASK_UP;
  1.2173 +		break;
  1.2174 +	case ID_STICKY_LEFT:
  1.2175 +		if (theApp.autoHold & BUTTON_MASK_LEFT)
  1.2176 +		{
  1.2177 +			theApp.autoHold &= ~BUTTON_MASK_LEFT;
  1.2178 +///      systemScreenMessage(winResLoadString(IDS_STICKY_LEFT_DISABLED));
  1.2179 +		}
  1.2180 +		else
  1.2181 +		{
  1.2182 +			theApp.autoHold |= BUTTON_MASK_LEFT;
  1.2183 +///      systemScreenMessage(winResLoadString(IDS_STICKY_LEFT));
  1.2184 +		}
  1.2185 +		theApp.autoFire  &= ~BUTTON_MASK_LEFT;
  1.2186 +		theApp.autoFire2 &= ~BUTTON_MASK_LEFT;
  1.2187 +		if (!theApp.allowLeftRight)
  1.2188 +			theApp.autoHold &= ~BUTTON_MASK_RIGHT;
  1.2189 +		break;
  1.2190 +	case ID_STICKY_RIGHT:
  1.2191 +		if (theApp.autoHold & BUTTON_MASK_RIGHT)
  1.2192 +		{
  1.2193 +			theApp.autoHold &= ~BUTTON_MASK_RIGHT;
  1.2194 +///      systemScreenMessage(winResLoadString(IDS_STICKY_RIGHT_DISABLED));
  1.2195 +		}
  1.2196 +		else
  1.2197 +		{
  1.2198 +			theApp.autoHold |= BUTTON_MASK_RIGHT;
  1.2199 +///      systemScreenMessage(winResLoadString(IDS_STICKY_RIGHT));
  1.2200 +		}
  1.2201 +		theApp.autoFire  &= ~BUTTON_MASK_RIGHT;
  1.2202 +		theApp.autoFire2 &= ~BUTTON_MASK_RIGHT;
  1.2203 +		if (!theApp.allowLeftRight)
  1.2204 +			theApp.autoHold &= ~BUTTON_MASK_LEFT;
  1.2205 +		break;
  1.2206 +	case ID_STICKY_CLEAR:
  1.2207 +		if (theApp.autoHold != 0)
  1.2208 +		{
  1.2209 +			theApp.autoHold = 0;
  1.2210 +///      systemScreenMessage(winResLoadString(IDS_STICKY_DISABLED));
  1.2211 +		}
  1.2212 +		else
  1.2213 +		{
  1.2214 +///      systemScreenMessage(winResLoadString(IDS_STICKY_ALREADY_DISABLED));
  1.2215 +			systemScreenMessage("already cleared");
  1.2216 +		}
  1.2217 +		break;
  1.2218 +	default:
  1.2219 +		return FALSE;
  1.2220 +	}
  1.2221 +
  1.2222 +	extern void VBAUpdateButtonPressDisplay(); VBAUpdateButtonPressDisplay();
  1.2223 +
  1.2224 +	return TRUE;
  1.2225 +}
  1.2226 +
  1.2227 +void MainWnd::OnUpdateOptionsJoypadSticky(CCmdUI *pCmdUI)
  1.2228 +{
  1.2229 +///  pCmdUI->Enable(emulating); // FIXME: this is right, but disabling menu items screws up accelerators until you view the
  1.2230 +// menu!
  1.2231 +	pCmdUI->Enable(TRUE); // TEMP
  1.2232 +
  1.2233 +	bool check = true;
  1.2234 +	switch (pCmdUI->m_nID)
  1.2235 +	{
  1.2236 +	case ID_STICKY_A:
  1.2237 +		check = (theApp.autoHold & BUTTON_MASK_A) != 0;
  1.2238 +		break;
  1.2239 +	case ID_STICKY_B:
  1.2240 +		check = (theApp.autoHold & BUTTON_MASK_B) != 0;
  1.2241 +		break;
  1.2242 +	case ID_STICKY_L:
  1.2243 +		check = (theApp.autoHold & BUTTON_MASK_L) != 0;
  1.2244 +///	extern int gbSgbMode; // from gbSGB.cpp
  1.2245 +///	if(emulating && systemCartridgeType != 0 && !gbSgbMode) // regular GB has no L button
  1.2246 +///      pCmdUI->Enable(false); // FIXME: this is right, but disabling menu items screws up accelerators until you view the
  1.2247 +// menu!
  1.2248 +		break;
  1.2249 +	case ID_STICKY_R:
  1.2250 +		check = (theApp.autoHold & BUTTON_MASK_R) != 0;
  1.2251 +///	extern int gbSgbMode; // from gbSGB.cpp
  1.2252 +///	if(emulating && systemCartridgeType != 0 && !gbSgbMode) // regular GB has no R button
  1.2253 +///      pCmdUI->Enable(false); // FIXME: this is right, but disabling menu items screws up accelerators until you view the
  1.2254 +// menu!
  1.2255 +		break;
  1.2256 +	case ID_STICKY_START:
  1.2257 +		check = (theApp.autoHold & BUTTON_MASK_START) != 0;
  1.2258 +		break;
  1.2259 +	case ID_STICKY_SELECT:
  1.2260 +		check = (theApp.autoHold & BUTTON_MASK_SELECT) != 0;
  1.2261 +		break;
  1.2262 +	case ID_STICKY_UP:
  1.2263 +		check = (theApp.autoHold & BUTTON_MASK_UP) != 0;
  1.2264 +		break;
  1.2265 +	case ID_STICKY_DOWN:
  1.2266 +		check = (theApp.autoHold & BUTTON_MASK_DOWN) != 0;
  1.2267 +		break;
  1.2268 +	case ID_STICKY_LEFT:
  1.2269 +		check = (theApp.autoHold & BUTTON_MASK_LEFT) != 0;
  1.2270 +		break;
  1.2271 +	case ID_STICKY_RIGHT:
  1.2272 +		check = (theApp.autoHold & BUTTON_MASK_RIGHT) != 0;
  1.2273 +		break;
  1.2274 +	case ID_STICKY_CLEAR:
  1.2275 +		check = (theApp.autoHold == 0);
  1.2276 +///    pCmdUI->Enable(!check); // FIXME: this is right, but disabling menu items screws up accelerators until you view the menu!
  1.2277 +		break;
  1.2278 +	}
  1.2279 +	pCmdUI->SetCheck(check);
  1.2280 +}
  1.2281 +
  1.2282 +LRESULT MainWnd::OnConfirmMode(WPARAM, LPARAM)
  1.2283 +{
  1.2284 +	// we need to do this separately or the window will not have the right
  1.2285 +	// parent. must be related to the way MFC does modal dialogs
  1.2286 +	winConfirmMode();
  1.2287 +	return 0;
  1.2288 +}
  1.2289 +
  1.2290 +void MainWnd::OnOptionsVideoFullscreenmaxscale()
  1.2291 +{
  1.2292 +	MaxScale dlg;
  1.2293 +
  1.2294 +	theApp.winCheckFullscreen();
  1.2295 +
  1.2296 +	dlg.DoModal();
  1.2297 +}
  1.2298 +
  1.2299 +void MainWnd::OnOptionsVideoTextdisplayoptions()
  1.2300 +{
  1.2301 +	TextOptions dlg;
  1.2302 +
  1.2303 +	theApp.winCheckFullscreen();
  1.2304 +
  1.2305 +	dlg.DoModal();
  1.2306 +}
  1.2307 +
  1.2308 +void MainWnd::OnUpdateOptionsVideoTextdisplayoptions(CCmdUI *pCmdUI)
  1.2309 +{
  1.2310 +	pCmdUI->Enable(TRUE);
  1.2311 +}
  1.2312 +