view src/win32/MainWnd.cpp @ 4:5f6f2134e8ce

apu appears to not be used
author Robert McIntyre <rlm@mit.edu>
date Sat, 03 Mar 2012 10:35:58 -0600
parents f9f4f1b99eed
children
line wrap: on
line source
1 // MainWnd.cpp : implementation file
2 //
4 #include "stdafx.h"
5 #include <winsock.h>
7 #include "resource.h"
8 #include "MainWnd.h"
10 #include "CmdAccelOb.h"
11 #include "FileDlg.h"
12 #include "ModeConfirm.h"
13 #include "Reg.h"
14 #include "WinResUtil.h"
15 #include "WinMiscUtil.h"
16 #include "Input.h"
17 #include "7zip/7zip.h"
18 #include "7zip/OpenArchive.h"
19 #include "LuaOpenDialog.h"
20 #include "ram_search.h"
21 #include "ramwatch.h"
22 #include "Sound.h"
23 #include "VBA.h"
25 #include "../version.h"
26 #include "../common/Util.h"
27 #include "../common/movie.h"
28 #include "../common/vbalua.h"
29 #include "../gba/GBASound.h"
30 #include "../gba/GBAGlobals.h"
31 #include "../gb/gbGlobals.h"
33 #define VBA_CONFIRM_MODE WM_APP + 100
35 /////////////////////////////////////////////////////////////////////////////
36 // MainWnd
38 MainWnd::MainWnd()
39 {
40 m_hAccelTable = NULL;
41 arrow = LoadCursor(NULL, IDC_ARROW);
43 InitDecoder();
44 }
46 MainWnd::~MainWnd()
47 {
48 CleanupDecoder();
49 }
51 BEGIN_MESSAGE_MAP(MainWnd, CWnd)
52 //{{AFX_MSG_MAP(MainWnd)
53 ON_WM_MOVE()
54 ON_WM_SIZE()
55 ON_WM_CLOSE()
56 ON_WM_INITMENUPOPUP()
57 ON_WM_INITMENU()
58 ON_WM_CONTEXTMENU()
59 ON_WM_MOUSEMOVE()
60 ON_WM_ACTIVATE()
61 ON_WM_ACTIVATEAPP()
62 ON_WM_DROPFILES()
63 ON_WM_PAINT()
65 ON_COMMAND(ID_HELP_ABOUT, OnHelpAbout)
66 ON_COMMAND(ID_HELP_FAQ, OnHelpFaq)
67 ON_COMMAND(ID_FILE_OPEN, OnFileOpen)
68 ON_COMMAND(ID_FILE_OPENGAMEBOY, OnFileOpenGBx)
69 ON_COMMAND(ID_FILE_PAUSE, OnFilePause)
70 ON_UPDATE_COMMAND_UI(ID_FILE_PAUSE, OnUpdateFilePause)
71 ON_COMMAND(ID_FILE_RESET, OnFileReset)
72 ON_UPDATE_COMMAND_UI(ID_FILE_RESET, OnUpdateFileReset)
73 ON_UPDATE_COMMAND_UI(ID_FILE_RECENT_FREEZE, OnUpdateFileRecentFreeze)
74 ON_COMMAND(ID_FILE_RECENT_RESET, OnFileRecentReset)
75 ON_COMMAND(ID_FILE_RECENT_FREEZE, OnFileRecentFreeze)
76 ON_COMMAND(ID_FILE_EXIT, OnFileExit)
77 ON_COMMAND(ID_FILE_CLOSE, OnFileClose)
78 ON_UPDATE_COMMAND_UI(ID_FILE_CLOSE, OnUpdateFileClose)
79 ON_COMMAND(ID_FILE_LOAD, OnFileLoad)
80 ON_UPDATE_COMMAND_UI(ID_FILE_LOAD, OnUpdateFileLoad)
81 ON_COMMAND(ID_FILE_SAVE, OnFileSave)
82 ON_UPDATE_COMMAND_UI(ID_FILE_SAVE, OnUpdateFileSave)
83 ON_COMMAND(ID_FILE_IMPORT_BATTERYFILE, OnFileImportBatteryfile)
84 ON_UPDATE_COMMAND_UI(ID_FILE_IMPORT_BATTERYFILE, OnUpdateFileImportBatteryfile)
85 ON_COMMAND(ID_FILE_IMPORT_GAMESHARKCODEFILE, OnFileImportGamesharkcodefile)
86 ON_UPDATE_COMMAND_UI(ID_FILE_IMPORT_GAMESHARKCODEFILE, OnUpdateFileImportGamesharkcodefile)
87 ON_COMMAND(ID_FILE_IMPORT_GAMESHARKSNAPSHOT, OnFileImportGamesharksnapshot)
88 ON_UPDATE_COMMAND_UI(ID_FILE_IMPORT_GAMESHARKSNAPSHOT, OnUpdateFileImportGamesharksnapshot)
89 ON_COMMAND(ID_FILE_EXPORT_BATTERYFILE, OnFileExportBatteryfile)
90 ON_UPDATE_COMMAND_UI(ID_FILE_EXPORT_BATTERYFILE, OnUpdateFileExportBatteryfile)
91 ON_COMMAND(ID_FILE_EXPORT_GAMESHARKSNAPSHOT, OnFileExportGamesharksnapshot)
92 ON_UPDATE_COMMAND_UI(ID_FILE_EXPORT_GAMESHARKSNAPSHOT, OnUpdateFileExportGamesharksnapshot)
93 ON_COMMAND(ID_FILE_QUICKSCREENCAPTURE, OnFileQuickScreencapture)
94 ON_COMMAND(ID_FILE_SCREENCAPTURE, OnFileScreencapture)
95 ON_UPDATE_COMMAND_UI(ID_FILE_SCREENCAPTURE, OnUpdateFileScreencapture)
96 ON_COMMAND(ID_FILE_ROMINFORMATION, OnFileRominformation)
97 ON_UPDATE_COMMAND_UI(ID_FILE_ROMINFORMATION, OnUpdateFileRominformation)
98 ON_COMMAND(ID_FILE_TOGGLEMENU, OnFileTogglemenu)
99 ON_UPDATE_COMMAND_UI(ID_FILE_TOGGLEMENU, OnUpdateFileTogglemenu)
100 ON_UPDATE_COMMAND_UI(ID_OPTIONS_FRAMESKIP_THROTTLE_6, OnUpdateOptionsFrameskipThrottle6)
101 ON_UPDATE_COMMAND_UI(ID_OPTIONS_FRAMESKIP_THROTTLE_15, OnUpdateOptionsFrameskipThrottle15)
102 ON_UPDATE_COMMAND_UI(ID_OPTIONS_FRAMESKIP_THROTTLE_25, OnUpdateOptionsFrameskipThrottle25)
103 ON_UPDATE_COMMAND_UI(ID_OPTIONS_FRAMESKIP_THROTTLE_50, OnUpdateOptionsFrameskipThrottle50)
104 ON_UPDATE_COMMAND_UI(ID_OPTIONS_FRAMESKIP_THROTTLE_75, OnUpdateOptionsFrameskipThrottle75)
105 ON_UPDATE_COMMAND_UI(ID_OPTIONS_FRAMESKIP_THROTTLE_100, OnUpdateOptionsFrameskipThrottle100)
106 ON_UPDATE_COMMAND_UI(ID_OPTIONS_FRAMESKIP_THROTTLE_125, OnUpdateOptionsFrameskipThrottle125)
107 ON_UPDATE_COMMAND_UI(ID_OPTIONS_FRAMESKIP_THROTTLE_150, OnUpdateOptionsFrameskipThrottle150)
108 ON_UPDATE_COMMAND_UI(ID_OPTIONS_FRAMESKIP_THROTTLE_200, OnUpdateOptionsFrameskipThrottle200)
109 ON_UPDATE_COMMAND_UI(ID_OPTIONS_FRAMESKIP_THROTTLE_300, OnUpdateOptionsFrameskipThrottle300)
110 ON_UPDATE_COMMAND_UI(ID_OPTIONS_FRAMESKIP_THROTTLE_400, OnUpdateOptionsFrameskipThrottle400)
111 ON_UPDATE_COMMAND_UI(ID_OPTIONS_FRAMESKIP_THROTTLE_600, OnUpdateOptionsFrameskipThrottle600)
112 ON_UPDATE_COMMAND_UI(ID_OPTIONS_FRAMESKIP_THROTTLE_1000, OnUpdateOptionsFrameskipThrottle1000)
113 ON_UPDATE_COMMAND_UI(ID_OPTIONS_FRAMESKIP_THROTTLE_OTHER, OnUpdateOptionsFrameskipThrottleOther)
114 ON_UPDATE_COMMAND_UI(ID_OPTIONS_FRAMESKIP_THROTTLE_INCREASE, OnUpdateOptionsFrameskipThrottleIncrease)
115 ON_UPDATE_COMMAND_UI(ID_OPTIONS_FRAMESKIP_THROTTLE_DECREASE, OnUpdateOptionsFrameskipThrottleDecrease)
116 ON_COMMAND(ID_OPTIONS_FRAMESKIP_THROTTLE_6, OnOptionsFrameskipThrottle6)
117 ON_COMMAND(ID_OPTIONS_FRAMESKIP_THROTTLE_15, OnOptionsFrameskipThrottle15)
118 ON_COMMAND(ID_OPTIONS_FRAMESKIP_THROTTLE_25, OnOptionsFrameskipThrottle25)
119 ON_COMMAND(ID_OPTIONS_FRAMESKIP_THROTTLE_50, OnOptionsFrameskipThrottle50)
120 ON_COMMAND(ID_OPTIONS_FRAMESKIP_THROTTLE_75, OnOptionsFrameskipThrottle75)
121 ON_COMMAND(ID_OPTIONS_FRAMESKIP_THROTTLE_100, OnOptionsFrameskipThrottle100)
122 ON_COMMAND(ID_OPTIONS_FRAMESKIP_THROTTLE_125, OnOptionsFrameskipThrottle125)
123 ON_COMMAND(ID_OPTIONS_FRAMESKIP_THROTTLE_150, OnOptionsFrameskipThrottle150)
124 ON_COMMAND(ID_OPTIONS_FRAMESKIP_THROTTLE_200, OnOptionsFrameskipThrottle200)
125 ON_COMMAND(ID_OPTIONS_FRAMESKIP_THROTTLE_300, OnOptionsFrameskipThrottle300)
126 ON_COMMAND(ID_OPTIONS_FRAMESKIP_THROTTLE_400, OnOptionsFrameskipThrottle400)
127 ON_COMMAND(ID_OPTIONS_FRAMESKIP_THROTTLE_600, OnOptionsFrameskipThrottle600)
128 ON_COMMAND(ID_OPTIONS_FRAMESKIP_THROTTLE_1000, OnOptionsFrameskipThrottle1000)
129 ON_COMMAND(ID_OPTIONS_FRAMESKIP_THROTTLE_OTHER, OnOptionsFrameskipThrottleOther)
130 ON_COMMAND(ID_OPTIONS_FRAMESKIP_THROTTLE_INCREASE, OnOptionsFrameskipThrottleIncrease)
131 ON_COMMAND(ID_OPTIONS_FRAMESKIP_THROTTLE_DECREASE, OnOptionsFrameskipThrottleDecrease)
132 ON_COMMAND(ID_OPTIONS_FRAMESKIP_ACCURATEPITCH, OnOptionsFrameskipAccuratePitch)
133 ON_COMMAND(ID_OPTIONS_FRAMESKIP_ACCURATESPEED, OnOptionsFrameskipAccurateSpeed)
134 ON_UPDATE_COMMAND_UI(ID_OPTIONS_FRAMESKIP_ACCURATEPITCH, OnUpdateOptionsFrameskipAccuratePitch)
135 ON_UPDATE_COMMAND_UI(ID_OPTIONS_FRAMESKIP_ACCURATESPEED, OnUpdateOptionsFrameskipAccurateSpeed)
136 ON_UPDATE_COMMAND_UI(ID_OPTIONS_VIDEO_FRAMESKIP_0, OnUpdateOptionsVideoFrameskip0)
137 ON_UPDATE_COMMAND_UI(ID_OPTIONS_VIDEO_FRAMESKIP_1, OnUpdateOptionsVideoFrameskip1)
138 ON_UPDATE_COMMAND_UI(ID_OPTIONS_VIDEO_FRAMESKIP_2, OnUpdateOptionsVideoFrameskip2)
139 ON_UPDATE_COMMAND_UI(ID_OPTIONS_VIDEO_FRAMESKIP_3, OnUpdateOptionsVideoFrameskip3)
140 ON_UPDATE_COMMAND_UI(ID_OPTIONS_VIDEO_FRAMESKIP_4, OnUpdateOptionsVideoFrameskip4)
141 ON_UPDATE_COMMAND_UI(ID_OPTIONS_VIDEO_FRAMESKIP_5, OnUpdateOptionsVideoFrameskip5)
142 ON_UPDATE_COMMAND_UI(ID_OPTIONS_VIDEO_FRAMESKIP_6, OnUpdateOptionsVideoFrameskip6)
143 ON_UPDATE_COMMAND_UI(ID_OPTIONS_VIDEO_FRAMESKIP_7, OnUpdateOptionsVideoFrameskip7)
144 ON_UPDATE_COMMAND_UI(ID_OPTIONS_VIDEO_FRAMESKIP_8, OnUpdateOptionsVideoFrameskip8)
145 ON_UPDATE_COMMAND_UI(ID_OPTIONS_VIDEO_FRAMESKIP_9, OnUpdateOptionsVideoFrameskip9)
146 ON_COMMAND(ID_OPTIONS_VIDEO_VSYNC, OnOptionsVideoVsync)
147 ON_UPDATE_COMMAND_UI(ID_OPTIONS_VIDEO_VSYNC, OnUpdateOptionsVideoVsync)
148 ON_UPDATE_COMMAND_UI(ID_OPTIONS_VIDEO_X1, OnUpdateOptionsVideoX1)
149 ON_UPDATE_COMMAND_UI(ID_OPTIONS_VIDEO_X2, OnUpdateOptionsVideoX2)
150 ON_UPDATE_COMMAND_UI(ID_OPTIONS_VIDEO_X3, OnUpdateOptionsVideoX3)
151 ON_UPDATE_COMMAND_UI(ID_OPTIONS_VIDEO_X4, OnUpdateOptionsVideoX4)
152 ON_UPDATE_COMMAND_UI(ID_OPTIONS_VIDEO_FULLSCREEN320X240, OnUpdateOptionsVideoFullscreen320x240)
153 ON_UPDATE_COMMAND_UI(ID_OPTIONS_VIDEO_FULLSCREEN640X480, OnUpdateOptionsVideoFullscreen640x480)
154 ON_UPDATE_COMMAND_UI(ID_OPTIONS_VIDEO_FULLSCREEN800X600, OnUpdateOptionsVideoFullscreen800x600)
155 ON_COMMAND(ID_OPTIONS_VIDEO_FULLSCREEN320X240, OnOptionsVideoFullscreen320x240)
156 ON_COMMAND(ID_OPTIONS_VIDEO_FULLSCREEN640X480, OnOptionsVideoFullscreen640x480)
157 ON_COMMAND(ID_OPTIONS_VIDEO_FULLSCREEN800X600, OnOptionsVideoFullscreen800x600)
158 ON_COMMAND(ID_OPTIONS_VIDEO_FULLSCREEN, OnOptionsVideoFullscreen)
159 ON_UPDATE_COMMAND_UI(ID_OPTIONS_VIDEO_FULLSCREEN, OnUpdateOptionsVideoFullscreen)
160 ON_COMMAND(ID_OPTIONS_VIDEO_DISABLESFX, OnOptionsVideoDisablesfx)
161 ON_UPDATE_COMMAND_UI(ID_OPTIONS_VIDEO_DISABLESFX, OnUpdateOptionsVideoDisablesfx)
162 ON_COMMAND(ID_OPTIONS_VIDEO_FULLSCREENSTRETCHTOFIT, OnOptionsVideoFullscreenstretchtofit)
163 ON_UPDATE_COMMAND_UI(ID_OPTIONS_VIDEO_FULLSCREENSTRETCHTOFIT, OnUpdateOptionsVideoFullscreenstretchtofit)
164 ON_COMMAND(ID_OPTIONS_VIDEO_RENDERMETHOD_GDI, OnOptionsVideoRendermethodGdi)
165 ON_UPDATE_COMMAND_UI(ID_OPTIONS_VIDEO_RENDERMETHOD_GDI, OnUpdateOptionsVideoRendermethodGdi)
166 ON_COMMAND(ID_OPTIONS_VIDEO_RENDERMETHOD_DIRECTDRAW, OnOptionsVideoRendermethodDirectdraw)
167 ON_UPDATE_COMMAND_UI(ID_OPTIONS_VIDEO_RENDERMETHOD_DIRECTDRAW, OnUpdateOptionsVideoRendermethodDirectdraw)
168 ON_COMMAND(ID_OPTIONS_VIDEO_RENDERMETHOD_DIRECT3D, OnOptionsVideoRendermethodDirect3d)
169 ON_UPDATE_COMMAND_UI(ID_OPTIONS_VIDEO_RENDERMETHOD_DIRECT3D, OnUpdateOptionsVideoRendermethodDirect3d)
170 ON_COMMAND(ID_OPTIONS_VIDEO_RENDERMETHOD_OPENGL, OnOptionsVideoRendermethodOpengl)
171 ON_UPDATE_COMMAND_UI(ID_OPTIONS_VIDEO_RENDERMETHOD_OPENGL, OnUpdateOptionsVideoRendermethodOpengl)
172 ON_COMMAND(ID_OPTIONS_VIDEO_TRIPLEBUFFERING, OnOptionsVideoTriplebuffering)
173 ON_UPDATE_COMMAND_UI(ID_OPTIONS_VIDEO_TRIPLEBUFFERING, OnUpdateOptionsVideoTriplebuffering)
174 ON_COMMAND(ID_OPTIONS_VIDEO_DDRAWEMULATIONONLY, OnOptionsVideoDdrawemulationonly)
175 ON_UPDATE_COMMAND_UI(ID_OPTIONS_VIDEO_DDRAWEMULATIONONLY, OnUpdateOptionsVideoDdrawemulationonly)
176 ON_COMMAND(ID_OPTIONS_VIDEO_DDRAWUSEVIDEOMEMORY, OnOptionsVideoDdrawusevideomemory)
177 ON_UPDATE_COMMAND_UI(ID_OPTIONS_VIDEO_DDRAWUSEVIDEOMEMORY, OnUpdateOptionsVideoDdrawusevideomemory)
178 ON_COMMAND(ID_OPTIONS_VIDEO_RENDEROPTIONS_D3DNOFILTER, OnOptionsVideoRenderoptionsD3dnofilter)
179 ON_UPDATE_COMMAND_UI(ID_OPTIONS_VIDEO_RENDEROPTIONS_D3DNOFILTER, OnUpdateOptionsVideoRenderoptionsD3dnofilter)
180 ON_COMMAND(ID_OPTIONS_VIDEO_RENDEROPTIONS_D3DBILINEAR, OnOptionsVideoRenderoptionsD3dbilinear)
181 ON_UPDATE_COMMAND_UI(ID_OPTIONS_VIDEO_RENDEROPTIONS_D3DBILINEAR, OnUpdateOptionsVideoRenderoptionsD3dbilinear)
182 ON_COMMAND(ID_OPTIONS_VIDEO_RENDEROPTIONS_GLNEAREST, OnOptionsVideoRenderoptionsGlnearest)
183 ON_UPDATE_COMMAND_UI(ID_OPTIONS_VIDEO_RENDEROPTIONS_GLNEAREST, OnUpdateOptionsVideoRenderoptionsGlnearest)
184 ON_COMMAND(ID_OPTIONS_VIDEO_RENDEROPTIONS_GLBILINEAR, OnOptionsVideoRenderoptionsGlbilinear)
185 ON_UPDATE_COMMAND_UI(ID_OPTIONS_VIDEO_RENDEROPTIONS_GLBILINEAR, OnUpdateOptionsVideoRenderoptionsGlbilinear)
186 ON_COMMAND(ID_OPTIONS_VIDEO_RENDEROPTIONS_GLTRIANGLE, OnOptionsVideoRenderoptionsGltriangle)
187 ON_UPDATE_COMMAND_UI(ID_OPTIONS_VIDEO_RENDEROPTIONS_GLTRIANGLE, OnUpdateOptionsVideoRenderoptionsGltriangle)
188 ON_COMMAND(ID_OPTIONS_VIDEO_RENDEROPTIONS_GLQUADS, OnOptionsVideoRenderoptionsGlquads)
189 ON_UPDATE_COMMAND_UI(ID_OPTIONS_VIDEO_RENDEROPTIONS_GLQUADS, OnUpdateOptionsVideoRenderoptionsGlquads)
190 ON_COMMAND(ID_OPTIONS_VIDEO_RENDEROPTIONS_SELECTSKIN, OnOptionsVideoRenderoptionsSelectskin)
191 ON_UPDATE_COMMAND_UI(ID_OPTIONS_VIDEO_RENDEROPTIONS_SELECTSKIN, OnUpdateOptionsVideoRenderoptionsSelectskin)
192 ON_COMMAND(ID_OPTIONS_VIDEO_RENDEROPTIONS_SKIN, OnOptionsVideoRenderoptionsSkin)
193 ON_UPDATE_COMMAND_UI(ID_OPTIONS_VIDEO_RENDEROPTIONS_SKIN, OnUpdateOptionsVideoRenderoptionsSkin)
194 ON_COMMAND(ID_OPTIONS_EMULATOR_ASSOCIATE, OnOptionsEmulatorAssociate)
195 ON_COMMAND(ID_OPTIONS_EMULATOR_DIRECTORIES, OnOptionsEmulatorDirectories)
196 ON_COMMAND_RANGE(ID_OPTIONS_PREFER_ARCHIVE_NAME, ID_OPTIONS_PREFER_ROM_NAME, OnOptionsEmulatorFilenamePreference)
197 ON_UPDATE_COMMAND_UI_RANGE(ID_OPTIONS_PREFER_ARCHIVE_NAME, ID_OPTIONS_PREFER_ROM_NAME, OnUpdateOptionsEmulatorFilenamePreference)
198 ON_COMMAND(ID_OPTIONS_VIDEO_DISABLESTATUSMESSAGES, OnOptionsVideoDisablestatusmessages)
199 ON_UPDATE_COMMAND_UI(ID_OPTIONS_VIDEO_DISABLESTATUSMESSAGES, OnUpdateOptionsVideoDisablestatusmessages)
200 ON_COMMAND(ID_OPTIONS_EMULATOR_SYNCHRONIZE, OnOptionsEmulatorSynchronize)
201 ON_UPDATE_COMMAND_UI(ID_OPTIONS_EMULATOR_SYNCHRONIZE, OnUpdateOptionsEmulatorSynchronize)
203 ON_COMMAND(ID_OPTIONS_EMULATOR_ALWAYSONTOP, OnOptionsEmulatorAlwaysOnTop)
204 ON_UPDATE_COMMAND_UI(ID_OPTIONS_EMULATOR_ALWAYSONTOP, OnUpdateOptionsEmulatorAlwaysOnTop)
205 ON_COMMAND(ID_OPTIONS_EMULATOR_PAUSEWHENINACTIVE, OnOptionsEmulatorPausewheninactive)
206 ON_UPDATE_COMMAND_UI(ID_OPTIONS_EMULATOR_PAUSEWHENINACTIVE, OnUpdateOptionsEmulatorPausewheninactive)
207 ON_COMMAND(ID_OPTIONS_EMULATOR_BACKGROUNDINPUT, OnOptionsEmulatorEnableBackgroundInput)
208 ON_UPDATE_COMMAND_UI(ID_OPTIONS_EMULATOR_BACKGROUNDINPUT, OnUpdateOptionsEmulatorEnableBackgroundInput)
209 ON_COMMAND(ID_OPTIONS_EMULATOR_SPEEDUPTOGGLE, OnOptionsEmulatorSpeeduptoggle)
211 ON_UPDATE_COMMAND_UI(ID_OPTIONS_EMULATOR_SPEEDUPTOGGLE, OnUpdateOptionsEmulatorSpeeduptoggle)
212 ON_COMMAND(ID_OPTIONS_EMULATOR_REMOVEINTROSGBA, OnOptionsEmulatorRemoveintrosgba)
213 ON_UPDATE_COMMAND_UI(ID_OPTIONS_EMULATOR_REMOVEINTROSGBA, OnUpdateOptionsEmulatorRemoveintrosgba)
214 ON_COMMAND(ID_OPTIONS_EMULATOR_AUTOMATICALLYIPSPATCH, OnOptionsEmulatorAutomaticallyipspatch)
215 ON_UPDATE_COMMAND_UI(ID_OPTIONS_EMULATOR_AUTOMATICALLYIPSPATCH, OnUpdateOptionsEmulatorAutomaticallyipspatch)
216 ON_COMMAND(ID_OPTIONS_EMULATOR_AGBPRINT, OnOptionsEmulatorAgbprint)
217 ON_UPDATE_COMMAND_UI(ID_OPTIONS_EMULATOR_AGBPRINT, OnUpdateOptionsEmulatorAgbprint)
218 ON_COMMAND(ID_OPTIONS_EMULATOR_REALTIMECLOCK, OnOptionsEmulatorRealtimeclock)
219 ON_UPDATE_COMMAND_UI(ID_OPTIONS_EMULATOR_REALTIMECLOCK, OnUpdateOptionsEmulatorRealtimeclock)
220 ON_COMMAND(ID_OPTIONS_EMULATOR_AUTOHIDEMENU, OnOptionsEmulatorAutohidemenu)
221 ON_UPDATE_COMMAND_UI(ID_OPTIONS_EMULATOR_AUTOHIDEMENU, OnUpdateOptionsEmulatorAutohidemenu)
222 ON_COMMAND(ID_OPTIONS_EMULATOR_REWINDINTERVAL, OnOptionsEmulatorRewindinterval)
223 ON_COMMAND(ID_OPTIONS_EMULATOR_SAVETYPE_AUTOMATIC, OnOptionsEmulatorSavetypeAutomatic)
224 ON_UPDATE_COMMAND_UI(ID_OPTIONS_EMULATOR_SAVETYPE_AUTOMATIC, OnUpdateOptionsEmulatorSavetypeAutomatic)
225 ON_COMMAND(ID_OPTIONS_EMULATOR_SAVETYPE_EEPROM, OnOptionsEmulatorSavetypeEeprom)
226 ON_UPDATE_COMMAND_UI(ID_OPTIONS_EMULATOR_SAVETYPE_EEPROM, OnUpdateOptionsEmulatorSavetypeEeprom)
227 ON_COMMAND(ID_OPTIONS_EMULATOR_SAVETYPE_SRAM, OnOptionsEmulatorSavetypeSram)
228 ON_UPDATE_COMMAND_UI(ID_OPTIONS_EMULATOR_SAVETYPE_SRAM, OnUpdateOptionsEmulatorSavetypeSram)
229 ON_COMMAND(ID_OPTIONS_EMULATOR_SAVETYPE_FLASH, OnOptionsEmulatorSavetypeFlash)
230 ON_UPDATE_COMMAND_UI(ID_OPTIONS_EMULATOR_SAVETYPE_FLASH, OnUpdateOptionsEmulatorSavetypeFlash)
231 ON_COMMAND(ID_OPTIONS_EMULATOR_SAVETYPE_EEPROMSENSOR, OnOptionsEmulatorSavetypeEepromsensor)
232 ON_UPDATE_COMMAND_UI(ID_OPTIONS_EMULATOR_SAVETYPE_EEPROMSENSOR, OnUpdateOptionsEmulatorSavetypeEepromsensor)
233 ON_COMMAND(ID_OPTIONS_EMULATOR_SAVETYPE_NONE, OnOptionsEmulatorSavetypeNone)
234 ON_UPDATE_COMMAND_UI(ID_OPTIONS_EMULATOR_SAVETYPE_NONE, OnUpdateOptionsEmulatorSavetypeNone)
235 ON_COMMAND(ID_OPTIONS_EMULATOR_SAVETYPE_FLASH512K, OnOptionsEmulatorSavetypeFlash512k)
236 ON_UPDATE_COMMAND_UI(ID_OPTIONS_EMULATOR_SAVETYPE_FLASH512K, OnUpdateOptionsEmulatorSavetypeFlash512k)
237 ON_COMMAND(ID_OPTIONS_EMULATOR_SAVETYPE_FLASH1M, OnOptionsEmulatorSavetypeFlash1m)
238 ON_UPDATE_COMMAND_UI(ID_OPTIONS_EMULATOR_SAVETYPE_FLASH1M, OnUpdateOptionsEmulatorSavetypeFlash1m)
239 ON_COMMAND(ID_OPTIONS_EMULATOR_USEBIOSFILE, OnOptionsEmulatorUsebiosfile)
240 ON_UPDATE_COMMAND_UI(ID_OPTIONS_EMULATOR_USEBIOSFILE, OnUpdateOptionsEmulatorUsebiosfile)
241 ON_COMMAND(ID_OPTIONS_EMULATOR_SKIPBIOS, OnOptionsEmulatorSkipbios)
242 ON_UPDATE_COMMAND_UI(ID_OPTIONS_EMULATOR_SKIPBIOS, OnUpdateOptionsEmulatorSkipbios)
243 ON_COMMAND(ID_OPTIONS_EMULATOR_SELECTBIOSFILE, OnOptionsEmulatorSelectbiosfile)
245 ON_COMMAND(ID_EMULATOR_USE_OLD_FRAME_TIMING, OnOptionsEmulatorUseOldGBTiming)
246 ON_UPDATE_COMMAND_UI(ID_EMULATOR_USE_OLD_FRAME_TIMING, OnUpdateOptionsEmulatorUseOldGBTiming)
247 ON_COMMAND(ID_EMULATOR_USE_GB_INPUT_KLUDGE, OnOptionsEmulatorUseGBNullInputKludge)
248 ON_UPDATE_COMMAND_UI(ID_EMULATOR_USE_GB_INPUT_KLUDGE, OnUpdateOptionsEmulatorUseGBNullInputKludge)
249 ON_COMMAND(ID_EMULATOR_GBALAG, OnOptionsEmulatorGBALag)
250 ON_UPDATE_COMMAND_UI(ID_EMULATOR_GBALAG, OnUpdateOptionsEmulatorGBALag)
252 ON_COMMAND(ID_OPTIONS_EMULATOR_PNGFORMAT, OnOptionsEmulatorPngformat)
253 ON_UPDATE_COMMAND_UI(ID_OPTIONS_EMULATOR_PNGFORMAT, OnUpdateOptionsEmulatorPngformat)
254 ON_COMMAND(ID_OPTIONS_EMULATOR_BMPFORMAT, OnOptionsEmulatorBmpformat)
255 ON_UPDATE_COMMAND_UI(ID_OPTIONS_EMULATOR_BMPFORMAT, OnUpdateOptionsEmulatorBmpformat)
256 ON_COMMAND(ID_OPTIONS_SOUND_DISABLE, OnOptionsSoundDisable)
257 ON_UPDATE_COMMAND_UI(ID_OPTIONS_SOUND_DISABLE, OnUpdateOptionsSoundDisable)
258 ON_COMMAND(ID_OPTIONS_SOUND_MUTE, OnOptionsSoundMute)
259 ON_UPDATE_COMMAND_UI(ID_OPTIONS_SOUND_MUTE, OnUpdateOptionsSoundMute)
260 ON_COMMAND(ID_OPTIONS_SOUND_OFF, OnOptionsSoundOff)
261 ON_UPDATE_COMMAND_UI(ID_OPTIONS_SOUND_OFF, OnUpdateOptionsSoundOff)
262 ON_COMMAND(ID_OPTIONS_SOUND_ON, OnOptionsSoundOn)
263 ON_UPDATE_COMMAND_UI(ID_OPTIONS_SOUND_ON, OnUpdateOptionsSoundOn)
264 ON_COMMAND(ID_OPTIONS_SOUND_USEOLDSYNCHRONIZATION, OnOptionsSoundUseoldsynchronization)
265 ON_UPDATE_COMMAND_UI(ID_OPTIONS_SOUND_USEOLDSYNCHRONIZATION, OnUpdateOptionsSoundUseoldsynchronization)
266 ON_COMMAND(ID_OPTIONS_SOUND_ECHO, OnOptionsSoundEcho)
267 ON_UPDATE_COMMAND_UI(ID_OPTIONS_SOUND_ECHO, OnUpdateOptionsSoundEcho)
268 ON_COMMAND(ID_OPTIONS_SOUND_LOWPASSFILTER, OnOptionsSoundLowpassfilter)
269 ON_UPDATE_COMMAND_UI(ID_OPTIONS_SOUND_LOWPASSFILTER, OnUpdateOptionsSoundLowpassfilter)
270 ON_COMMAND(ID_OPTIONS_SOUND_REVERSESTEREO, OnOptionsSoundReversestereo)
271 ON_UPDATE_COMMAND_UI(ID_OPTIONS_SOUND_REVERSESTEREO, OnUpdateOptionsSoundReversestereo)
272 ON_COMMAND(ID_OPTIONS_SOUND_MUTEFRAMEADVANCE, OnOptionsSoundMuteFrameAdvance)
273 ON_UPDATE_COMMAND_UI(ID_OPTIONS_SOUND_MUTEFRAMEADVANCE, OnUpdateOptionsSoundMuteFrameAdvance)
274 ON_COMMAND(ID_OPTIONS_SOUND_MUTEWHENINACTIVE, OnOptionsSoundMuteWhenInactive)
275 ON_UPDATE_COMMAND_UI(ID_OPTIONS_SOUND_MUTEWHENINACTIVE, OnUpdateOptionsSoundMuteWhenInactive)
276 ON_COMMAND(ID_OPTIONS_SOUND_11KHZ, OnOptionsSound11khz)
277 ON_UPDATE_COMMAND_UI(ID_OPTIONS_SOUND_11KHZ, OnUpdateOptionsSound11khz)
278 ON_COMMAND(ID_OPTIONS_SOUND_22KHZ, OnOptionsSound22khz)
279 ON_UPDATE_COMMAND_UI(ID_OPTIONS_SOUND_22KHZ, OnUpdateOptionsSound22khz)
280 ON_COMMAND(ID_OPTIONS_SOUND_44KHZ, OnOptionsSound44khz)
281 ON_UPDATE_COMMAND_UI(ID_OPTIONS_SOUND_44KHZ, OnUpdateOptionsSound44khz)
282 ON_COMMAND(ID_OPTIONS_SOUND_CHANNEL1, OnOptionsSoundChannel1)
283 ON_UPDATE_COMMAND_UI(ID_OPTIONS_SOUND_CHANNEL1, OnUpdateOptionsSoundChannel1)
284 ON_COMMAND(ID_OPTIONS_SOUND_CHANNEL2, OnOptionsSoundChannel2)
285 ON_UPDATE_COMMAND_UI(ID_OPTIONS_SOUND_CHANNEL2, OnUpdateOptionsSoundChannel2)
286 ON_COMMAND(ID_OPTIONS_SOUND_CHANNEL3, OnOptionsSoundChannel3)
287 ON_UPDATE_COMMAND_UI(ID_OPTIONS_SOUND_CHANNEL3, OnUpdateOptionsSoundChannel3)
288 ON_COMMAND(ID_OPTIONS_SOUND_CHANNEL4, OnOptionsSoundChannel4)
289 ON_UPDATE_COMMAND_UI(ID_OPTIONS_SOUND_CHANNEL4, OnUpdateOptionsSoundChannel4)
290 ON_COMMAND(ID_OPTIONS_SOUND_DIRECTSOUNDA, OnOptionsSoundDirectsounda)
291 ON_UPDATE_COMMAND_UI(ID_OPTIONS_SOUND_DIRECTSOUNDA, OnUpdateOptionsSoundDirectsounda)
292 ON_COMMAND(ID_OPTIONS_SOUND_DIRECTSOUNDB, OnOptionsSoundDirectsoundb)
293 ON_UPDATE_COMMAND_UI(ID_OPTIONS_SOUND_DIRECTSOUNDB, OnUpdateOptionsSoundDirectsoundb)
294 ON_COMMAND(ID_OPTIONS_GAMEBOY_BORDER, OnOptionsGameboyBorder)
295 ON_UPDATE_COMMAND_UI(ID_OPTIONS_GAMEBOY_BORDER, OnUpdateOptionsGameboyBorder)
296 ON_COMMAND(ID_OPTIONS_GAMEBOY_PRINTER, OnOptionsGameboyPrinter)
297 ON_UPDATE_COMMAND_UI(ID_OPTIONS_GAMEBOY_PRINTER, OnUpdateOptionsGameboyPrinter)
298 ON_COMMAND(ID_OPTIONS_GAMEBOY_BORDERAUTOMATIC, OnOptionsGameboyBorderAutomatic)
299 ON_UPDATE_COMMAND_UI(ID_OPTIONS_GAMEBOY_BORDERAUTOMATIC, OnUpdateOptionsGameboyBorderAutomatic)
300 ON_COMMAND(ID_OPTIONS_GAMEBOY_AUTOMATIC, OnOptionsGameboyAutomatic)
301 ON_UPDATE_COMMAND_UI(ID_OPTIONS_GAMEBOY_AUTOMATIC, OnUpdateOptionsGameboyAutomatic)
302 ON_COMMAND(ID_OPTIONS_GAMEBOY_GBA, OnOptionsGameboyGba)
303 ON_UPDATE_COMMAND_UI(ID_OPTIONS_GAMEBOY_GBA, OnUpdateOptionsGameboyGba)
304 ON_COMMAND(ID_OPTIONS_GAMEBOY_CGB, OnOptionsGameboyCgb)
305 ON_UPDATE_COMMAND_UI(ID_OPTIONS_GAMEBOY_CGB, OnUpdateOptionsGameboyCgb)
306 ON_COMMAND(ID_OPTIONS_GAMEBOY_SGB, OnOptionsGameboySgb)
307 ON_UPDATE_COMMAND_UI(ID_OPTIONS_GAMEBOY_SGB, OnUpdateOptionsGameboySgb)
308 ON_COMMAND(ID_OPTIONS_GAMEBOY_SGB2, OnOptionsGameboySgb2)
309 ON_UPDATE_COMMAND_UI(ID_OPTIONS_GAMEBOY_SGB2, OnUpdateOptionsGameboySgb2)
310 ON_COMMAND(ID_OPTIONS_GAMEBOY_GB, OnOptionsGameboyGb)
311 ON_UPDATE_COMMAND_UI(ID_OPTIONS_GAMEBOY_GB, OnUpdateOptionsGameboyGb)
312 ON_COMMAND(ID_OPTIONS_GAMEBOY_REALCOLORS, OnOptionsGameboyRealcolors)
313 ON_UPDATE_COMMAND_UI(ID_OPTIONS_GAMEBOY_REALCOLORS, OnUpdateOptionsGameboyRealcolors)
314 ON_COMMAND(ID_OPTIONS_GAMEBOY_GAMEBOYCOLORS, OnOptionsGameboyGameboycolors)
315 ON_UPDATE_COMMAND_UI(ID_OPTIONS_GAMEBOY_GAMEBOYCOLORS, OnUpdateOptionsGameboyGameboycolors)
316 ON_COMMAND(ID_OPTIONS_GAMEBOY_COLORS, OnOptionsGameboyColors)
317 ON_COMMAND(ID_OPTIONS_FILTER_DISABLEMMX, OnOptionsFilterDisablemmx)
318 ON_UPDATE_COMMAND_UI(ID_OPTIONS_FILTER_DISABLEMMX, OnUpdateOptionsFilterDisablemmx)
319 ON_COMMAND(ID_OPTIONS_LANGUAGE_SYSTEM, OnOptionsLanguageSystem)
320 ON_UPDATE_COMMAND_UI(ID_OPTIONS_LANGUAGE_SYSTEM, OnUpdateOptionsLanguageSystem)
321 ON_COMMAND(ID_OPTIONS_LANGUAGE_ENGLISH, OnOptionsLanguageEnglish)
322 ON_UPDATE_COMMAND_UI(ID_OPTIONS_LANGUAGE_ENGLISH, OnUpdateOptionsLanguageEnglish)
323 ON_COMMAND(ID_OPTIONS_LANGUAGE_OTHER, OnOptionsLanguageOther)
324 ON_UPDATE_COMMAND_UI(ID_OPTIONS_LANGUAGE_OTHER, OnUpdateOptionsLanguageOther)
325 ON_COMMAND(ID_OPTIONS_JOYPAD_CONFIGURE_1, OnOptionsJoypadConfigure1)
326 ON_UPDATE_COMMAND_UI(ID_OPTIONS_JOYPAD_CONFIGURE_1, OnUpdateOptionsJoypadConfigure1)
327 ON_COMMAND(ID_OPTIONS_JOYPAD_CONFIGURE_2, OnOptionsJoypadConfigure2)
328 ON_UPDATE_COMMAND_UI(ID_OPTIONS_JOYPAD_CONFIGURE_2, OnUpdateOptionsJoypadConfigure2)
329 ON_COMMAND(ID_OPTIONS_JOYPAD_CONFIGURE_3, OnOptionsJoypadConfigure3)
330 ON_UPDATE_COMMAND_UI(ID_OPTIONS_JOYPAD_CONFIGURE_3, OnUpdateOptionsJoypadConfigure3)
331 ON_COMMAND(ID_OPTIONS_JOYPAD_CONFIGURE_4, OnOptionsJoypadConfigure4)
332 ON_UPDATE_COMMAND_UI(ID_OPTIONS_JOYPAD_CONFIGURE_4, OnUpdateOptionsJoypadConfigure4)
333 ON_COMMAND(ID_OPTIONS_JOYPAD_MOTIONCONFIGURE, OnOptionsJoypadMotionconfigure)
334 ON_UPDATE_COMMAND_UI(ID_OPTIONS_JOYPAD_MOTIONCONFIGURE, OnUpdateOptionsJoypadMotionconfigure)
335 ON_COMMAND(ID_OPTIONS_JOYPAD_ALLOWLEFTRIGHT, OnOptionsJoypadAllowLeftRight)
336 ON_UPDATE_COMMAND_UI(ID_OPTIONS_JOYPAD_ALLOWLEFTRIGHT, OnUpdateOptionsJoypadAllowLeftRight)
337 ON_COMMAND(ID_OPTIONS_JOYPAD_AUTOFIRE_ACCOUNTFORLAG, OnOptionsJoypadAutofireAccountForLag)
338 ON_UPDATE_COMMAND_UI(ID_OPTIONS_JOYPAD_AUTOFIRE_ACCOUNTFORLAG, OnUpdateOptionsJoypadAutofireAccountForLag)
339 ON_COMMAND(ID_CHEATS_SEARCHFORCHEATS, OnCheatsSearchforcheats)
340 ON_UPDATE_COMMAND_UI(ID_CHEATS_SEARCHFORCHEATS, OnUpdateCheatsSearchforcheats)
341 ON_COMMAND(ID_CHEATS_CHEATLIST, OnCheatsCheatlist)
342 ON_UPDATE_COMMAND_UI(ID_CHEATS_CHEATLIST, OnUpdateCheatsCheatlist)
343 ON_COMMAND(ID_CHEATS_AUTOMATICSAVELOADCHEATS, OnCheatsAutomaticsaveloadcheats)
344 ON_COMMAND(ID_CHEATS_PAUSEDURINGCHEATSEARCH, OnCheatsPauseDuringCheatSearch)
345 ON_COMMAND(ID_CHEATS_LOADCHEATLIST, OnCheatsLoadcheatlist)
346 ON_UPDATE_COMMAND_UI(ID_CHEATS_LOADCHEATLIST, OnUpdateCheatsLoadcheatlist)
347 ON_COMMAND(ID_CHEATS_SAVECHEATLIST, OnCheatsSavecheatlist)
348 ON_UPDATE_COMMAND_UI(ID_CHEATS_SAVECHEATLIST, OnUpdateCheatsSavecheatlist)
349 ON_COMMAND(ID_TOOLS_DISASSEMBLE, OnToolsDisassemble)
350 ON_UPDATE_COMMAND_UI(ID_TOOLS_DISASSEMBLE, OnUpdateToolsDisassemble)
351 ON_COMMAND(ID_TOOLS_LOGGING, OnToolsLogging)
352 ON_UPDATE_COMMAND_UI(ID_TOOLS_LOGGING, OnUpdateToolsLogging)
353 ON_COMMAND(ID_TOOLS_IOVIEWER, OnToolsIoviewer)
354 ON_UPDATE_COMMAND_UI(ID_TOOLS_IOVIEWER, OnUpdateToolsIoviewer)
355 ON_COMMAND(ID_TOOLS_MAPVIEW, OnToolsMapview)
356 ON_UPDATE_COMMAND_UI(ID_TOOLS_MAPVIEW, OnUpdateToolsMapview)
357 ON_COMMAND(ID_TOOLS_MEMORYVIEWER, OnToolsMemoryviewer)
358 ON_UPDATE_COMMAND_UI(ID_TOOLS_MEMORYVIEWER, OnUpdateToolsMemoryviewer)
359 ON_COMMAND(ID_TOOLS_OAMVIEWER, OnToolsOamviewer)
360 ON_UPDATE_COMMAND_UI(ID_TOOLS_OAMVIEWER, OnUpdateToolsOamviewer)
361 ON_COMMAND(ID_TOOLS_PALETTEVIEW, OnToolsPaletteview)
362 ON_UPDATE_COMMAND_UI(ID_TOOLS_PALETTEVIEW, OnUpdateToolsPaletteview)
363 ON_COMMAND(ID_TOOLS_TILEVIEWER, OnToolsTileviewer)
364 ON_UPDATE_COMMAND_UI(ID_TOOLS_TILEVIEWER, OnUpdateToolsTileviewer)
366 ON_COMMAND(ID_DEBUG_NEXTFRAME, OnDebugNextframe)
367 ON_UPDATE_COMMAND_UI(ID_DEBUG_NEXTFRAME, OnUpdateDebugNextframe)
368 ON_COMMAND(ID_DEBUG_NEXTFRAME_ACCOUNTFORLAG, OnDebugNextframeAccountForLag)
369 ON_UPDATE_COMMAND_UI(ID_DEBUG_NEXTFRAME_ACCOUNTFORLAG, OnUpdateDebugNextframeAccountForLag)
370 ON_COMMAND(ID_DEBUG_FRAMESEARCH, OnDebugFramesearch)
371 ON_UPDATE_COMMAND_UI(ID_DEBUG_FRAMESEARCH, OnUpdateDebugFramesearch)
372 ON_COMMAND(ID_DEBUG_FRAMESEARCHPREV, OnDebugFramesearchPrev)
373 ON_UPDATE_COMMAND_UI(ID_DEBUG_FRAMESEARCHPREV, OnUpdateDebugFramesearchPrev)
374 ON_COMMAND(ID_DEBUG_FRAMESEARCHLOAD, OnDebugFramesearchLoad)
375 ON_UPDATE_COMMAND_UI(ID_DEBUG_FRAMESEARCHLOAD, OnUpdateDebugFramesearchLoad)
376 ON_UPDATE_COMMAND_UI(ID_CHEATS_AUTOMATICSAVELOADCHEATS, OnUpdateCheatsAutomaticsaveloadcheats)
377 ON_UPDATE_COMMAND_UI(ID_CHEATS_PAUSEDURINGCHEATSEARCH, OnUpdateCheatsPauseDuringCheatSearch)
378 ON_COMMAND(ID_TOOLS_FRAMECOUNTER, OnToolsFrameCounter)
379 ON_UPDATE_COMMAND_UI(ID_TOOLS_FRAMECOUNTER, OnUpdateToolsFrameCounter)
380 ON_COMMAND(ID_TOOLS_LAGCOUNTER, OnToolsLagCounter)
381 ON_UPDATE_COMMAND_UI(ID_TOOLS_LAGCOUNTER, OnUpdateToolsLagCounter)
382 ON_COMMAND(ID_TOOLS_EXTRACOUNTER, OnToolsExtraCounter)
383 ON_UPDATE_COMMAND_UI(ID_TOOLS_EXTRACOUNTER, OnUpdateToolsExtraCounter)
384 ON_COMMAND(ID_TOOLS_EXTRACOUNTERRESET, OnToolsExtraCounterReset)
385 ON_COMMAND(ID_TOOLS_INPUTDISPLAY, OnToolsInputDisplay)
386 ON_UPDATE_COMMAND_UI(ID_TOOLS_INPUTDISPLAY, OnUpdateToolsInputDisplay)
387 ON_COMMAND(ID_TOOLS_DEBUG_GDB, OnToolsDebugGdb)
388 ON_UPDATE_COMMAND_UI(ID_TOOLS_DEBUG_GDB, OnUpdateToolsDebugGdb)
389 ON_COMMAND(ID_TOOLS_DEBUG_LOADANDWAIT, OnToolsDebugLoadandwait)
390 ON_UPDATE_COMMAND_UI(ID_TOOLS_DEBUG_LOADANDWAIT, OnUpdateToolsDebugLoadandwait)
391 ON_COMMAND(ID_TOOLS_DEBUG_BREAK, OnToolsDebugBreak)
392 ON_UPDATE_COMMAND_UI(ID_TOOLS_DEBUG_BREAK, OnUpdateToolsDebugBreak)
393 ON_COMMAND(ID_TOOLS_DEBUG_DISCONNECT, OnToolsDebugDisconnect)
394 ON_UPDATE_COMMAND_UI(ID_TOOLS_DEBUG_DISCONNECT, OnUpdateToolsDebugDisconnect)
396 ON_COMMAND(ID_TOOLS_SOUNDRECORDING, OnToolsSoundRecording)
397 ON_UPDATE_COMMAND_UI(ID_TOOLS_SOUNDRECORDING, OnUpdateToolsSoundRecording)
398 ON_COMMAND(ID_TOOLS_AVIRECORDING, OnToolsAVIRecording)
399 ON_UPDATE_COMMAND_UI(ID_TOOLS_AVIRECORDING, OnUpdateToolsAVIRecording)
400 ON_COMMAND(ID_TOOLS_PAUSEAVIRECORDING, OnToolsPauseAVIRecording)
401 ON_UPDATE_COMMAND_UI(ID_TOOLS_PAUSEAVIRECORDING, OnUpdateToolsPauseAVIRecording)
403 ON_COMMAND(ID_MOVIE_RECORD, OnToolsRecordMovie)
404 ON_UPDATE_COMMAND_UI(ID_MOVIE_RECORD, OnUpdateToolsRecordMovie)
405 ON_COMMAND(ID_MOVIE_STOP, OnToolsStopMovie)
406 ON_UPDATE_COMMAND_UI(ID_MOVIE_STOP, OnUpdateToolsStopMovie)
407 ON_COMMAND(ID_MOVIE_PLAY, OnToolsPlayMovie)
408 ON_UPDATE_COMMAND_UI(ID_MOVIE_PLAY, OnUpdateToolsPlayMovie)
409 ON_COMMAND(ID_MOVIE_READONLY, OnToolsPlayReadOnly)
410 ON_UPDATE_COMMAND_UI(ID_MOVIE_READONLY, OnUpdateToolsPlayReadOnly)
411 ON_COMMAND(ID_MOVIE_ASSC_WITH_SAVESTATE, OnAsscWithSaveState)
412 ON_UPDATE_COMMAND_UI(ID_MOVIE_ASSC_WITH_SAVESTATE, OnUpdateAsscWithSaveState)
413 ON_COMMAND(ID_MOVIE_RESUME_RECORD, OnToolsResumeRecord)
414 ON_UPDATE_COMMAND_UI(ID_MOVIE_RESUME_RECORD, OnUpdateToolsResumeRecord)
415 ON_COMMAND(ID_MOVIE_RESTART_PLAY, OnToolsPlayRestart)
416 ON_UPDATE_COMMAND_UI(ID_MOVIE_RESTART_PLAY, OnUpdateToolsPlayRestart)
418 ON_COMMAND(ID_MOVIE_END_PAUSE, OnToolsOnMovieEndPause)
419 ON_UPDATE_COMMAND_UI(ID_MOVIE_END_PAUSE, OnUpdateToolsOnMovieEndPause)
420 ON_COMMAND(ID_MOVIE_END_STOP, OnToolsOnMovieEndStop)
421 ON_UPDATE_COMMAND_UI(ID_MOVIE_END_STOP, OnUpdateToolsOnMovieEndStop)
422 ON_COMMAND(ID_MOVIE_END_RESTART, OnToolsOnMovieEndRestart)
423 ON_UPDATE_COMMAND_UI(ID_MOVIE_END_RESTART, OnUpdateToolsOnMovieEndRestart)
424 ON_COMMAND(ID_MOVIE_END_APPEND, OnToolsOnMovieEndAppend)
425 ON_UPDATE_COMMAND_UI(ID_MOVIE_END_APPEND, OnUpdateToolsOnMovieEndAppend)
426 ON_COMMAND(ID_MOVIE_END_KEEP, OnToolsOnMovieEndKeep)
427 ON_UPDATE_COMMAND_UI(ID_MOVIE_END_KEEP, OnUpdateToolsOnMovieEndKeep)
429 ON_COMMAND(ID_MOVIE_TOOL_SET_PAUSE_AT, OnToolsMovieSetPauseAt)
430 ON_UPDATE_COMMAND_UI(ID_MOVIE_TOOL_SET_PAUSE_AT, OnUpdateToolsSetMoviePauseAt)
431 ON_COMMAND(ID_MOVIE_TOOL_CONVERT, OnToolsMovieConvertCurrent)
432 ON_UPDATE_COMMAND_UI(ID_MOVIE_TOOL_CONVERT, OnUpdateToolsMovieConvertCurrent)
433 ON_COMMAND(ID_MOVIE_TOOL_AUTO_CONVERT, OnToolsMovieAutoConvert)
434 ON_UPDATE_COMMAND_UI(ID_MOVIE_TOOL_AUTO_CONVERT, OnUpdateToolsMovieAutoConvert)
435 ON_COMMAND(ID_MOVIE_TOOL_FIX_HEADER, OnToolsMovieFixHeader)
436 ON_UPDATE_COMMAND_UI(ID_MOVIE_TOOL_FIX_HEADER, OnUpdateToolsMovieFixHeader)
437 ON_COMMAND(ID_MOVIE_TOOL_TRUNCATE, OnToolsMovieTruncateAtCurrent)
438 ON_UPDATE_COMMAND_UI(ID_MOVIE_TOOL_TRUNCATE, OnUpdateToolsMovieTruncateAtCurrent)
439 ON_COMMAND(ID_MOVIE_TOOL_EXTRACT_FROM_SAVEGAME, OnToolsMovieExtractFromSavegame)
440 ON_UPDATE_COMMAND_UI(ID_MOVIE_TOOL_EXTRACT_FROM_SAVEGAME, OnUpdateToolsMovieExtractFromSavegame)
442 ON_COMMAND(ID_TOOLS_REWIND, OnToolsRewind)
443 ON_UPDATE_COMMAND_UI(ID_TOOLS_REWIND, OnUpdateToolsRewind)
444 ON_COMMAND(ID_TOOLS_CUSTOMIZE, OnToolsCustomize)
445 ON_UPDATE_COMMAND_UI(ID_TOOLS_CUSTOMIZE, OnUpdateToolsCustomize)
446 // ON_COMMAND(ID_TOOLS_CUSTOMIZE_COMMON, OnToolsCustomizeCommon)
447 // ON_UPDATE_COMMAND_UI(ID_TOOLS_CUSTOMIZE_COMMON, OnUpdateToolsCustomizeCommon)
448 ON_COMMAND(ID_HELP_BUGREPORT, OnHelpBugreport)
450 ON_COMMAND_EX_RANGE(ID_FILE_MRU_FILE1, ID_FILE_MRU_FILE10, OnFileRecentFile)
451 ON_COMMAND_EX_RANGE(ID_FILE_LOADGAME_SLOT1, ID_FILE_LOADGAME_SLOT10, OnFileLoadSlot)
452 ON_COMMAND_EX_RANGE(ID_FILE_SAVEGAME_SLOT1, ID_FILE_SAVEGAME_SLOT10, OnFileSaveSlot)
453 ON_COMMAND_EX_RANGE(ID_SELECT_SLOT1, ID_SELECT_SLOT10, OnSelectSlot)
454 ON_UPDATE_COMMAND_UI_RANGE(ID_FILE_MRU_FILE1, ID_FILE_MRU_FILE10, OnUpdateFileRecentFile)
455 ON_UPDATE_COMMAND_UI_RANGE(ID_FILE_LOADGAME_SLOT1, ID_FILE_LOADGAME_SLOT10, OnUpdateFileLoadSlot)
456 ON_UPDATE_COMMAND_UI_RANGE(ID_FILE_SAVEGAME_SLOT1, ID_FILE_SAVEGAME_SLOT10, OnUpdateFileSaveSlot)
457 ON_UPDATE_COMMAND_UI_RANGE(ID_SELECT_SLOT1, ID_SELECT_SLOT10, OnUpdateSelectSlot)
459 ON_COMMAND(ID_FILE_SAVEGAME_OLDESTSLOT, OnFileSavegameOldestslot)
460 ON_UPDATE_COMMAND_UI(ID_FILE_SAVEGAME_OLDESTSLOT, OnUpdateFileSavegameOldestslot)
461 ON_COMMAND(ID_FILE_LOADGAME_MOSTRECENT, OnFileLoadgameMostrecent)
462 ON_UPDATE_COMMAND_UI(ID_FILE_LOADGAME_MOSTRECENT, OnUpdateFileLoadgameMostrecent)
463 ON_COMMAND(ID_FILE_SAVEGAME_CURRENT, OnFileSavegameCurrent)
464 ON_UPDATE_COMMAND_UI(ID_FILE_SAVEGAME_CURRENT, OnUpdateFileSavegameCurrent)
465 ON_COMMAND(ID_FILE_LOADGAME_CURRENT, OnFileLoadgameCurrent)
466 ON_UPDATE_COMMAND_UI(ID_FILE_LOADGAME_CURRENT, OnUpdateFileLoadgameCurrent)
467 ON_COMMAND(ID_FILE_LOADGAME_MAKECURRENT, OnFileLoadgameMakeCurrent)
468 ON_UPDATE_COMMAND_UI(ID_FILE_LOADGAME_MAKECURRENT, OnUpdateFileLoadgameMakeCurrent)
469 ON_COMMAND(ID_FILE_SAVEGAME_MAKECURRENT, OnFileSavegameMakeCurrent)
470 ON_UPDATE_COMMAND_UI(ID_FILE_SAVEGAME_MAKECURRENT, OnUpdateFileSavegameMakeCurrent)
472 ON_COMMAND(ID_FILE_SAVEGAME_INCREMENTSLOT, OnFileSavegameIncrementSlot)
473 ON_UPDATE_COMMAND_UI(ID_FILE_SAVEGAME_INCREMENTSLOT, OnUpdateFileSavegameIncrementSlot)
474 ON_COMMAND(ID_FILE_SAVEGAME_DECREMENTSLOT, OnFileSavegameDecrementSlot)
475 ON_UPDATE_COMMAND_UI(ID_FILE_SAVEGAME_DECREMENTSLOT, OnUpdateFileSavegameDecrementSlot)
476 ON_COMMAND(ID_FILE_SLOT_DISPLAYMODIFICATIONTIME, OnFileSlotDisplayModificationTime)
477 ON_UPDATE_COMMAND_UI(ID_FILE_SLOT_DISPLAYMODIFICATIONTIME, OnUpdateFileSlotDisplayModificationTime)
479 ON_COMMAND(ID_FILE_LOADGAME_AUTOLOADMOSTRECENT, OnFileLoadgameAutoloadmostrecent)
480 ON_UPDATE_COMMAND_UI(ID_FILE_LOADGAME_AUTOLOADMOSTRECENT, OnUpdateFileLoadgameAutoloadmostrecent)
481 ON_COMMAND(ID_FILE_LOADGAME_MAKERECENT, OnFileLoadgameMakeRecent)
482 ON_UPDATE_COMMAND_UI(ID_FILE_LOADGAME_MAKERECENT, OnUpdateFileLoadgameMakeRecent)
484 ON_COMMAND(ID_OPTIONS_SOUND_VOLUME_25X, OnOptionsSoundVolume25x)
485 ON_UPDATE_COMMAND_UI(ID_OPTIONS_SOUND_VOLUME_25X, OnUpdateOptionsSoundVolume25x)
486 ON_COMMAND(ID_OPTIONS_SOUND_VOLUME_5X, OnOptionsSoundVolume5x)
487 ON_UPDATE_COMMAND_UI(ID_OPTIONS_SOUND_VOLUME_5X, OnUpdateOptionsSoundVolume5x)
488 ON_COMMAND(ID_CHEATS_DISABLECHEATS, OnCheatsDisablecheats)
489 ON_UPDATE_COMMAND_UI(ID_CHEATS_DISABLECHEATS, OnUpdateCheatsDisablecheats)
490 ON_COMMAND(ID_OPTIONS_VIDEO_FULLSCREENMAXSCALE, OnOptionsVideoFullscreenmaxscale)
492 ON_COMMAND_EX_RANGE(ID_OPTIONS_VIDEO_FRAMESKIP_0, ID_OPTIONS_VIDEO_FRAMESKIP_9, OnOptionsFrameskip)
493 ON_COMMAND_EX_RANGE(ID_OPTIONS_VIDEO_X1, ID_OPTIONS_VIDEO_X4, OnOptionVideoSize)
494 ON_COMMAND_EX_RANGE(ID_OPTIONS_VIDEO_LAYERS_BG0, ID_OPTIONS_VIDEO_LAYERS_OBJWIN, OnVideoLayer)
495 ON_UPDATE_COMMAND_UI_RANGE(ID_OPTIONS_VIDEO_LAYERS_BG0, ID_OPTIONS_VIDEO_LAYERS_OBJWIN, OnUpdateVideoLayer)
496 ON_COMMAND(ID_SYSTEM_MINIMIZE, OnSystemMinimize)
497 ON_COMMAND(ID_SYSTEM_MAXIMIZE, OnSystemMaximize)
498 ON_COMMAND_EX_RANGE(ID_OPTIONS_EMULATOR_SHOWSPEED_NONE, ID_OPTIONS_EMULATOR_SHOWSPEED_TRANSPARENT, OnOptionsEmulatorShowSpeed)
499 ON_UPDATE_COMMAND_UI_RANGE(ID_OPTIONS_EMULATOR_SHOWSPEED_NONE,
500 ID_OPTIONS_EMULATOR_SHOWSPEED_TRANSPARENT,
501 OnUpdateOptionsEmulatorShowSpeed)
502 ON_COMMAND_EX_RANGE(ID_OPTIONS_SOUND_VOLUME_1X, ID_OPTIONS_SOUND_VOLUME_4X, OnOptionsSoundVolume)
503 ON_UPDATE_COMMAND_UI_RANGE(ID_OPTIONS_SOUND_VOLUME_1X, ID_OPTIONS_SOUND_VOLUME_4X, OnUpdateOptionsSoundVolume)
504 ON_COMMAND_EX_RANGE(ID_OPTIONS_PRIORITY_HIGHEST, ID_OPTIONS_PRIORITY_BELOWNORMAL, OnOptionsPriority)
505 ON_UPDATE_COMMAND_UI_RANGE(ID_OPTIONS_PRIORITY_HIGHEST, ID_OPTIONS_PRIORITY_BELOWNORMAL, OnUpdateOptionsPriority)
507 ON_COMMAND_EX_RANGE(ID_OPTIONS_FILTER_NORMAL, ID_OPTIONS_FILTER_TVMODE, OnOptionsFilter)
508 ON_COMMAND_EX_RANGE(ID_OPTIONS_FILTER16BIT_PIXELATEEXPERIMENTAL, ID_OPTIONS_FILTER16BIT_MOTIONBLUREXPERIMENTAL, OnOptionsFilter)
509 ON_COMMAND_EX_RANGE(ID_OPTIONS_FILTER16BIT_ADVANCEMAMESCALE2X, ID_OPTIONS_FILTER16BIT_SIMPLE2X, OnOptionsFilter)
510 ON_COMMAND_EX_RANGE(ID_OPTIONS_FILTER_BILINEAR, ID_OPTIONS_FILTER_BILINEARPLUS, OnOptionsFilter)
511 ON_COMMAND_EX_RANGE(ID_OPTIONS_FILTER_SCANLINES, ID_OPTIONS_FILTER_SCANLINES, OnOptionsFilter)
512 ON_COMMAND_EX_RANGE(ID_OPTIONS_FILTER_LQ2X, ID_OPTIONS_FILTER_HQ3X2, OnOptionsFilter)
513 ON_COMMAND_EX_RANGE(ID_OPTIONS_FILTER16BIT_SIMPLE3X, ID_OPTIONS_FILTER16BIT_PIXELATEEXPERIMENTAL4X, OnOptionsFilter)
514 ON_UPDATE_COMMAND_UI_RANGE(ID_OPTIONS_FILTER_NORMAL, ID_OPTIONS_FILTER_TVMODE, OnUpdateOptionsFilter)
515 ON_UPDATE_COMMAND_UI_RANGE(ID_OPTIONS_FILTER16BIT_PIXELATEEXPERIMENTAL, ID_OPTIONS_FILTER16BIT_MOTIONBLUREXPERIMENTAL, OnUpdateOptionsFilter)
516 ON_UPDATE_COMMAND_UI_RANGE(ID_OPTIONS_FILTER16BIT_ADVANCEMAMESCALE2X, ID_OPTIONS_FILTER16BIT_SIMPLE2X, OnUpdateOptionsFilter)
517 ON_UPDATE_COMMAND_UI_RANGE(ID_OPTIONS_FILTER_BILINEAR, ID_OPTIONS_FILTER_BILINEARPLUS, OnUpdateOptionsFilter)
518 ON_UPDATE_COMMAND_UI_RANGE(ID_OPTIONS_FILTER_SCANLINES, ID_OPTIONS_FILTER_SCANLINES, OnUpdateOptionsFilter)
519 ON_UPDATE_COMMAND_UI_RANGE(ID_OPTIONS_FILTER_LQ2X, ID_OPTIONS_FILTER_HQ3X2, OnUpdateOptionsFilter)
520 ON_UPDATE_COMMAND_UI_RANGE(ID_OPTIONS_FILTER16BIT_SIMPLE3X, ID_OPTIONS_FILTER16BIT_PIXELATEEXPERIMENTAL4X, OnUpdateOptionsFilter)
521 ON_COMMAND_EX_RANGE(ID_OPTIONS_FILTER_INTERFRAMEBLENDING_NONE, ID_OPTIONS_FILTER_INTERFRAMEBLENDING_SMART, OnOptionsFilterIFB)
522 ON_UPDATE_COMMAND_UI_RANGE(ID_OPTIONS_FILTER_INTERFRAMEBLENDING_NONE,
523 ID_OPTIONS_FILTER_INTERFRAMEBLENDING_SMART,
524 OnUpdateOptionsFilterIFB)
526 ON_COMMAND_EX_RANGE(ID_OPTIONS_JOYPAD_DEFAULTJOYPAD_1, ID_OPTIONS_JOYPAD_DEFAULTJOYPAD_4, OnOptionsJoypadDefault)
527 ON_UPDATE_COMMAND_UI_RANGE(ID_OPTIONS_JOYPAD_DEFAULTJOYPAD_1, ID_OPTIONS_JOYPAD_DEFAULTJOYPAD_4, OnUpdateOptionsJoypadDefault)
528 ON_COMMAND_EX_RANGE(ID_OPTIONS_JOYPAD_AUTOFIRE_A, ID_OPTIONS_JOYPAD_AUTOFIRE_CLEAR, OnOptionsJoypadAutofire)
529 ON_UPDATE_COMMAND_UI_RANGE(ID_OPTIONS_JOYPAD_AUTOFIRE_A, ID_OPTIONS_JOYPAD_AUTOFIRE_CLEAR, OnUpdateOptionsJoypadAutofire)
530 ON_COMMAND_EX_RANGE(ID_STICKY_A, ID_STICKY_CLEAR, OnOptionsJoypadSticky)
531 ON_UPDATE_COMMAND_UI_RANGE(ID_STICKY_A, ID_STICKY_CLEAR, OnUpdateOptionsJoypadSticky)
532 ON_MESSAGE(VBA_CONFIRM_MODE, OnConfirmMode)
533 ON_MESSAGE(WM_SYSCOMMAND, OnMySysCommand)
534 ON_COMMAND(ID_OPTIONS_VIDEO_TEXTDISPLAYOPTIONS, OnOptionsVideoTextdisplayoptions)
535 ON_UPDATE_COMMAND_UI(ID_OPTIONS_VIDEO_TEXTDISPLAYOPTIONS, OnUpdateOptionsVideoTextdisplayoptions)
537 ON_COMMAND(ID_FILE_LUA_OPEN, OnFileLuaOpen)
538 ON_UPDATE_COMMAND_UI(ID_FILE_LUA_OPEN, OnUpdateFileLuaOpen)
539 ON_COMMAND(ID_FILE_LUA_CLOSE_ALL, OnFileLuaCloseAll)
540 ON_UPDATE_COMMAND_UI(ID_FILE_LUA_CLOSE_ALL, OnUpdateFileLuaCloseAll)
541 ON_COMMAND(ID_FILE_LUA_RELOAD, OnFileLuaReload)
542 ON_COMMAND(ID_FILE_LUA_STOP, OnFileLuaStop)
543 ON_COMMAND(ID_RAM_SEARCH, OnFileRamSearch)
544 ON_UPDATE_COMMAND_UI(ID_RAM_SEARCH, OnUpdateFileRamSearch)
545 ON_COMMAND(ID_RAM_WATCH, OnFileRamWatch)
546 ON_UPDATE_COMMAND_UI(ID_RAM_WATCH, OnUpdateFileRamWatch)
547 //}}AFX_MSG_MAP
548 END_MESSAGE_MAP()
550 /////////////////////////////////////////////////////////////////////////////
551 // MainWnd message handlers
553 bool vbaShuttingDown = false;
555 void MainWnd::OnClose()
556 {
557 vbaShuttingDown = true; // HACK to fix crash on exit while memory viewer is open
559 CWnd::OnClose();
561 delete this;
562 }
564 void MainWnd::OnMove(int x, int y)
565 {
566 CWnd::OnMove(x, y);
568 if (!theApp.changingVideoSize)
569 {
570 if (this)
571 {
572 if (!IsIconic() && !IsZoomed())
573 {
574 RECT r;
576 GetWindowRect(&r);
577 theApp.windowPositionX = r.left;
578 theApp.windowPositionY = r.top;
579 theApp.adjustDestRect();
580 regSetDwordValue("windowX", theApp.windowPositionX);
581 regSetDwordValue("windowY", theApp.windowPositionY);
582 }
583 }
584 }
585 }
587 void MainWnd::OnSize(UINT nType, int cx, int cy)
588 {
589 CWnd::OnSize(nType, cx, cy);
591 static int lastType = -1;
593 // FIXME: hack to re-maximize window after it auto-unmaximizes while loading a ROM
594 if (nType == SIZE_MAXIMIZED && lastType == SIZE_MAXIMIZED)
595 {
596 lastType = -1;
597 ShowWindow(SW_SHOWMAXIMIZED);
598 MoveWindow(0, 0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN));
599 return;
600 }
602 lastType = nType;
604 if (IsIconic())
605 {
606 theApp.iconic = true;
607 return;
608 }
609 else if (theApp.iconic)
610 {
611 theApp.iconic = false;
612 }
614 if (!theApp.changingVideoSize)
615 {
616 if (this)
617 {
618 if (theApp.videoOption <= VIDEO_4X)
619 {
620 theApp.surfaceSizeX = cx;
621 theApp.surfaceSizeY = cy;
622 theApp.adjustDestRect();
623 if (theApp.display)
624 theApp.display->resize(theApp.dest.right - theApp.dest.left, theApp.dest.bottom - theApp.dest.top);
625 systemRefreshScreen(); // useful when shrinking
626 }
627 }
628 }
629 }
631 void MainWnd::OnContextMenu(CWnd *pWnd, CPoint point)
632 {
633 winMouseOn();
634 }
636 void MainWnd::OnSystemMinimize()
637 {
638 ShowWindow(SW_SHOWMINIMIZED);
639 }
641 void MainWnd::OnSystemMaximize()
642 {
643 ShowWindow(SW_SHOWMAXIMIZED);
644 }
646 void MainWnd::OnPaint()
647 {
648 CPaintDC dc(this); // device context for painting, calling BeginPaint/EndPaint internally
649 if (emulating && (!theApp.active || theApp.paused))
650 {
651 systemRedrawScreen();
652 }
653 }
655 static bool translatingAccelerator = false;
657 // FIXME: this fix for accel keys is ugly
658 // using too many static variables for a single accel key kludge
659 static bool recursiveCall = true;
660 static bool fullUpdated = false;
661 static bool lastKeyModifier = false; // maybe better check current key press status instead
662 static WPARAM lastKey = 0;
664 BOOL MainWnd::PreTranslateMessage(MSG *pMsg)
665 {
666 if (RamSearchHWnd && ::IsDialogMessage(RamSearchHWnd, pMsg))
667 {
668 return TRUE;
669 }
670 else if (RamWatchHWnd && ::IsDialogMessage(RamWatchHWnd, pMsg))
671 {
672 if (RamWatchAccels)
673 TranslateAccelerator(RamWatchHWnd, RamWatchAccels, pMsg);
674 return TRUE;
675 }
676 else if (LuaConsoleHWnd && ::IsDialogMessage(LuaConsoleHWnd, pMsg))
677 {
678 return TRUE;
679 }
680 else if (CWnd::PreTranslateMessage(pMsg))
681 {
682 return TRUE;
683 }
684 else if (pMsg->message == WM_KEYDOWN || pMsg->message == WM_SYSKEYDOWN)
685 {
686 translatingAccelerator = true;
688 bool bHit = theApp.hAccel != NULL && ::TranslateAccelerator(m_hWnd, theApp.hAccel, pMsg);
689 bool isModifier = pMsg->wParam == VK_SHIFT || pMsg->wParam == VK_CONTROL || pMsg->wParam == VK_MENU;
691 // HACK to get around the fact that TranslateAccelerator can't handle modifier-only accelerators
692 // (it would be better to fix TranslateAccelerator, but its code is in a Microsoft library...)
693 if (!bHit)
694 {
695 if (isModifier)
696 {
697 // do a linear loop through all accelerators to find modifier-only ones...
698 CCmdAccelOb *pCmdAccel;
699 WORD wKey;
700 CAccelsOb * pAccelOb;
701 POSITION pos = theApp.winAccelMgr.m_mapAccelTable.GetStartPosition();
702 const int modifiers = ((pMsg->wParam == VK_SHIFT) ? FSHIFT : ((pMsg->wParam == VK_CONTROL) ? FCONTROL : FALT));
703 while (pos != NULL)
704 {
705 theApp.winAccelMgr.m_mapAccelTable.GetNextAssoc(pos, wKey, pCmdAccel);
706 POSITION pos = pCmdAccel->m_Accels.GetHeadPosition();
707 while (pos != NULL)
708 {
709 pAccelOb = pCmdAccel->m_Accels.GetNext(pos);
711 if (pAccelOb->m_wKey == 0) // if accelerator-only
712 {
713 if ((pAccelOb->m_cVirt & modifiers) == modifiers) // if modifier matches
714 {
715 bHit = true;
716 SendMessage(WM_COMMAND, pCmdAccel->m_wIDCommand, 0); // tell Windows to call the right function
717 }
718 }
719 }
720 }
721 }
723 if (!bHit)
724 {
725 lastKeyModifier = true;
726 }
727 }
729 if (bHit)
730 {
731 if (lastKeyModifier && !isModifier)
732 {
733 fullUpdated = false;
734 lastKeyModifier = false;
735 }
737 if (lastKey != pMsg->wParam)
738 {
739 fullUpdated = false;
740 lastKey = pMsg->wParam;
741 }
742 }
744 translatingAccelerator = false;
745 return bHit ? TRUE : FALSE;
746 }
748 return FALSE;
749 }
751 void MainWnd::OnMouseMove(UINT nFlags, CPoint point)
752 {
753 winMouseOn();
755 CWnd::OnMouseMove(nFlags, point);
756 }
758 // recursive kludge
759 static void InitMenuKludge(CMenu *pParentMenu, CMenu *pMenu, CCmdTarget *pWnd)
760 {
761 ASSERT(pMenu != NULL);
763 CCmdUI state;
764 state.m_pParentMenu = pParentMenu;
765 state.m_pMenu = pMenu;
766 ASSERT(state.m_pOther == NULL);
768 state.m_nIndexMax = pMenu->GetMenuItemCount();
769 for (state.m_nIndex = 0; state.m_nIndex < state.m_nIndexMax;
770 state.m_nIndex++)
771 {
772 state.m_nID = pMenu->GetMenuItemID(state.m_nIndex);
773 if (state.m_nID == 0)
774 continue; // menu separator or invalid cmd - ignore it
776 ASSERT(state.m_pOther == NULL);
777 ASSERT(state.m_pMenu != NULL);
778 if (state.m_nID == (UINT)-1)
779 {
780 // possibly a popup menu, route to first item of that popup
781 state.m_pSubMenu = pMenu->GetSubMenu(state.m_nIndex);
782 if (state.m_pSubMenu == NULL)
783 {
784 continue; // first item of popup can't be routed to
785 }
787 state.DoUpdate(pWnd, false);
788 if (recursiveCall)
789 {
790 // FIXME: slow recursive calls to fix enabling/disabling of accel keys
791 InitMenuKludge(state.m_pMenu, state.m_pSubMenu, pWnd);
792 }
793 }
794 else
795 {
796 // normal menu item
797 // Auto enable/disable if frame window has 'm_bAutoMenuEnable'
798 // set and command is _not_ a system command.
799 state.m_pSubMenu = NULL;
800 state.DoUpdate(pWnd, state.m_nID < 0xF000);
801 }
803 // adjust for menu deletions and additions
804 UINT nCount = pMenu->GetMenuItemCount();
805 if (nCount < state.m_nIndexMax)
806 {
807 state.m_nIndex -= (state.m_nIndexMax - nCount);
808 while (state.m_nIndex < nCount &&
809 pMenu->GetMenuItemID(state.m_nIndex) == state.m_nID)
810 {
811 state.m_nIndex++;
812 }
813 }
814 state.m_nIndexMax = nCount;
815 }
816 }
818 void MainWnd::OnInitMenuPopup(CMenu *pMenu, UINT nIndex, BOOL bSysMenu)
819 {
820 ASSERT(pMenu != NULL);
822 CCmdUI state;
823 state.m_pMenu = pMenu;
824 ASSERT(state.m_pOther == NULL);
825 ASSERT(state.m_pParentMenu == NULL);
827 // determine if menu is popup in top-level menu and set m_pOther to
828 // it if so (m_pParentMenu == NULL indicates that it is secondary popup)
829 HMENU hParentMenu;
830 if (AfxGetThreadState()->m_hTrackingMenu == pMenu->m_hMenu)
831 state.m_pParentMenu = pMenu; // parent == child for tracking popup
832 else if ((hParentMenu = ::GetMenu(m_hWnd)) != NULL)
833 {
834 CWnd *pParent = GetTopLevelParent();
835 // children windows don't have menus -- need to go to the top!
836 if (pParent != NULL &&
837 (hParentMenu = ::GetMenu(pParent->m_hWnd)) != NULL)
838 {
839 int nIndexMax = ::GetMenuItemCount(hParentMenu);
840 for (int nIndex = 0; nIndex < nIndexMax; nIndex++)
841 {
842 if (::GetSubMenu(hParentMenu, nIndex) == pMenu->m_hMenu)
843 {
844 // when popup is found, m_pParentMenu is containing menu
845 state.m_pParentMenu = CMenu::FromHandle(hParentMenu);
846 break;
847 }
848 }
849 }
850 }
852 // FIXME: magic to workaround the accel key bug without slowing down too much
853 if (translatingAccelerator && !fullUpdated && state.m_pParentMenu == &theApp.m_menu)
854 {
855 state.m_pMenu = state.m_pParentMenu;
856 recursiveCall = true;
857 fullUpdated = true;
858 }
859 else if (!translatingAccelerator && fullUpdated)
860 {
861 fullUpdated = false;
862 }
864 InitMenuKludge(state.m_pParentMenu, state.m_pMenu, this);
866 recursiveCall = false;
867 }
869 void MainWnd::OnInitMenu(CMenu *pMenu)
870 {
871 // CWnd::OnInitMenu(pMenu);
873 if (translatingAccelerator)
874 {}
875 else
876 {
877 // HACK: we only want to call this if the user is pulling down the menu,
878 // but TranslateAccelerator also causes OnInitMenu to be called, so ignore that
880 systemSoundPause();
881 }
882 }
884 void MainWnd::OnActivate(UINT nState, CWnd *pWndOther, BOOL bMinimized)
885 {
886 CWnd::OnActivate(nState, pWndOther, bMinimized);
888 bool activated = (nState == WA_ACTIVE || nState == WA_CLICKACTIVE) && !bMinimized;
890 theApp.active = activated || !theApp.pauseWhenInactive;
892 extern bool inputActive;
893 inputActive = activated || (!theApp.pauseWhenInactive && theApp.enableBackgroundInput);
895 if (theApp.active)
896 {
897 if (theApp.input)
898 {
899 theApp.input->activate();
900 }
902 if (!theApp.paused && emulating)
903 {
904 systemSoundResume();
905 }
906 }
907 else
908 {
909 theApp.wasPaused = true;
911 if (!theApp.paused && emulating)
912 {
913 systemSoundPause();
914 }
916 memset(theApp.delta, 255, sizeof(theApp.delta));
917 }
919 if (theApp.muteWhenInactive)
920 {
921 theApp.winMuteForNow = !activated;
922 }
924 if (theApp.paused && emulating)
925 {
926 systemRefreshScreen();
927 }
928 }
930 #if _MSC_VER <= 1200
931 void MainWnd::OnActivateApp(BOOL bActive, HTASK hTask)
932 #else
933 void MainWnd::OnActivateApp(BOOL bActive, DWORD hTask)
934 #endif
935 {
936 CWnd::OnActivateApp(bActive, hTask);
938 if (theApp.tripleBuffering && theApp.videoOption > VIDEO_4X)
939 {
940 if (bActive)
941 {
942 if (theApp.display)
943 theApp.display->clear();
944 }
945 }
946 }
948 LRESULT MainWnd::OnMySysCommand(WPARAM wParam, LPARAM lParam)
949 {
950 if (emulating && !theApp.paused)
951 {
952 if ((wParam & 0xFFF0) == SC_SCREENSAVE || (wParam & 0xFFF0) == SC_MONITORPOWER)
953 return 0;
954 }
955 return Default();
956 }
958 void MainWnd::OnDropFiles(HDROP hDropInfo)
959 {
960 // FIXME: required for the accel key fix
961 fullUpdated = false;
963 systemSoundClearBuffer();
965 char szFile[1024];
966 char ext[1024];
968 if (DragQueryFile(hDropInfo, 0, szFile, 1024))
969 {
970 DragFinish(hDropInfo);
972 _splitpath(szFile, NULL, NULL, NULL, ext);
973 if (strcasecmp(ext, ".lua") == 0)
974 {
975 if (VBALoadLuaCode(szFile))
976 {
977 // success, there is nothing to do
978 }
979 else
980 {
981 // Errors are displayed by the Lua code.
982 }
983 }
984 else if (strcasecmp(ext, ".vbm") == 0)
985 {
986 SMovie movieInfo;
987 char * movieName = szFile;
988 char romTitle [12];
989 uint32 romGameCode;
990 uint16 checksum;
991 uint8 crc;
993 if (VBAMovieGetInfo(movieName, &movieInfo) != MOVIE_SUCCESS)
994 {
995 return;
996 }
998 int cartType = movieInfo.header.typeFlags & 1 ? 0 : 1;
1000 if (!emulating)
1002 theApp.winCheckFullscreen();
1003 if (winFileOpenSelect(cartType))
1005 if (VBAMovieActive())
1006 VBAMovieStop(false); // will only get here on user selecting to play a ROM, canceling movie
1007 if (!winFileRun())
1008 return;
1010 else
1011 return;
1013 VBAMovieGetRomInfo(movieInfo, romTitle, romGameCode, checksum, crc);
1015 while (movieInfo.header.romCRC != crc
1016 || strncmp(movieInfo.header.romTitle, romTitle, 12) != 0
1017 || movieInfo.header.romOrBiosChecksum != checksum
1018 && !((movieInfo.header.optionFlags & MOVIE_SETTING_USEBIOSFILE) == 0 && checksum == 0))
1020 char msg[1024], warning1[1024], warning2[1024], buffer[1024];
1022 strcpy(warning1, "");
1023 strcpy(warning2, "");
1025 char str [13];
1026 strncpy(str, movieInfo.header.romTitle, 12);
1027 str[12] = '\0';
1028 sprintf(buffer, "title=%s ", str);
1029 strcat(warning1, buffer);
1031 strncpy(str, romTitle, 12);
1032 str[12] = '\0';
1033 sprintf(buffer, "title=%s ", str);
1034 strcat(warning2, buffer);
1037 sprintf(buffer, "type=%s ",
1038 (movieInfo.header.typeFlags & MOVIE_TYPE_GBA) ?
1039 "GBA" : (movieInfo.header.typeFlags & MOVIE_TYPE_GBC) ?
1040 "GBC" : (movieInfo.header.typeFlags & MOVIE_TYPE_SGB) ? "SGB" : "GB");
1041 strcat(warning1, buffer);
1043 sprintf(buffer, "type=%s ", systemCartridgeType ==
1044 0 ? "GBA" : (gbRom[0x143] & 0x80 ? "GBC" : (gbRom[0x146] == 0x03 ? "SGB" : "GB")));
1045 strcat(warning2, buffer);
1048 sprintf(buffer, "crc=%02x ", movieInfo.header.romCRC);
1049 strcat(warning1, buffer);
1051 sprintf(buffer, "crc=%02x ", crc);
1052 strcat(warning2, buffer);
1055 char code [5];
1056 if (movieInfo.header.typeFlags & MOVIE_TYPE_GBA)
1058 memcpy(code, &movieInfo.header.romGameCode, 4);
1059 code[4] = '\0';
1060 sprintf(buffer, "code=%s ", code);
1061 strcat(warning1, buffer);
1064 if (systemCartridgeType == 0)
1066 memcpy(code, &romGameCode, 4);
1067 code[4] = '\0';
1068 sprintf(buffer, "code=%s ", code);
1069 strcat(warning2, buffer);
1073 sprintf(buffer,
1074 movieInfo.header.typeFlags &
1075 MOVIE_TYPE_GBA ? ((movieInfo.header.optionFlags & MOVIE_SETTING_USEBIOSFILE) ==
1076 0 ? "(bios=none) " : "(bios=%04x) ") : "check=%04x ",
1077 movieInfo.header.romOrBiosChecksum);
1078 strcat(warning1, buffer);
1080 sprintf(buffer,
1081 checksum == 0 ? "(bios=none) " : systemCartridgeType == 0 ? "(bios=%04x) " : "check=%04x ",
1082 checksum);
1083 strcat(warning2, buffer);
1086 strcpy(msg, "");
1087 sprintf(buffer, "Movie ROM: %s\n", warning1);
1088 strcat(msg, buffer);
1089 sprintf(buffer, "Your ROM: %s\n", warning2);
1090 strcat(msg, buffer);
1091 strcat(msg, "still want to play the movie?");
1093 int sel = MessageBox(msg, TEXT("ROM Mismatch"), MB_ABORTRETRYIGNORE | MB_ICONQUESTION);
1094 switch (sel)
1096 case IDABORT:
1097 return;
1098 case IDRETRY:
1099 theApp.winCheckFullscreen();
1100 if (winFileOpenSelect(cartType))
1102 if (VBAMovieActive())
1103 VBAMovieStop(false); // will only get here on user selecting to play a ROM, canceling movie
1104 if (!winFileRun())
1105 return;
1106 VBAMovieGetRomInfo(movieInfo, romTitle, romGameCode, checksum, crc);
1108 else
1109 return;
1110 break;
1111 default:
1112 goto romcheck_exit;
1115 romcheck_exit:
1117 bool useBIOSFile = (movieInfo.header.optionFlags & MOVIE_SETTING_USEBIOSFILE) != 0;
1118 if (useBIOSFile)
1120 extern bool systemLoadBIOS(const char *biosFileName, bool useBiosFile);
1121 if (!systemLoadBIOS(theApp.biosFileName, useBIOSFile))
1123 systemMessage(0, "This movie requires a valid GBA BIOS file to play.\nPlease locate a BIOS file.");
1124 ((MainWnd *)theApp.m_pMainWnd)->OnOptionsEmulatorSelectbiosfile();
1125 if (!systemLoadBIOS(theApp.biosFileName, useBIOSFile))
1127 systemMessage(0, "\"%s\" is not a valid BIOS file; cannot play movie without one.", theApp.biosFileName);
1128 return;
1133 int code = VBAMovieOpen(movieName, TRUE);
1135 if (code != MOVIE_SUCCESS)
1137 if (code == MOVIE_FILE_NOT_FOUND)
1138 systemMessage(0, "Could not find movie file \"%s\".", (const char *)movieName);
1139 else if (code == MOVIE_WRONG_FORMAT)
1140 systemMessage(0, "Movie file \"%s\" is not in proper VBM format.", (const char *)movieName);
1141 else if (code == MOVIE_WRONG_VERSION)
1142 systemMessage(0, "Movie file \"%s\" is not a supported version.", (const char *)movieName);
1143 else
1144 systemMessage(0, "Failed to open movie \"%s\".", (const char *)movieName);
1145 return;
1148 else if (strcasecmp(ext, ".wch") == 0)
1150 if (emulating)
1152 MainWnd::OnFileRamWatch();
1153 Load_Watches(true, szFile);
1156 else
1158 theApp.romFilename = szFile;
1159 if (winFileRun())
1161 SetForegroundWindow();
1165 else
1166 DragFinish(hDropInfo);
1169 /////////////////////
1171 void MainWnd::winMouseOn()
1173 SetCursor(arrow);
1174 if (theApp.videoOption > VIDEO_4X)
1176 theApp.mouseCounter = 120;
1178 else
1179 theApp.mouseCounter = 0;
1182 void MainWnd::winConfirmMode()
1184 if (theApp.renderMethod == DIRECT_DRAW && theApp.videoOption > VIDEO_4X)
1186 theApp.winCheckFullscreen();
1187 ModeConfirm dlg(this);
1189 if (!dlg.DoModal())
1191 theApp.updateVideoSize(ID_OPTIONS_VIDEO_X2);
1196 bool MainWnd::winFileOpenSelect(int cartridgeType)
1198 int selectedFilter = regQueryDwordValue("selectedFilter", 0);
1199 if (selectedFilter < 0 || selectedFilter > 2)
1200 selectedFilter = 0;
1202 LPCTSTR exts[] = { NULL };
1203 CString filter = winResLoadFilter(IDS_FILTER_ROM);
1204 CString title = winResLoadString(IDS_SELECT_ROM);
1206 bool isOverrideEmpty = false;
1207 CString initialDir = regQueryStringValue(cartridgeType == 0 ? IDS_ROM_DIR : IDS_GBXROM_DIR, NULL);
1208 if (initialDir.IsEmpty())
1210 isOverrideEmpty = true;
1211 CString altDir = regQueryStringValue(cartridgeType != 0 ? IDS_ROM_DIR : IDS_GBXROM_DIR, NULL);
1212 initialDir = altDir.IsEmpty() ? theApp.exeDir : altDir;
1215 FileDlg dlg(this, "", filter, selectedFilter, "ROM", exts, initialDir, title, false, true);
1217 if (dlg.DoModal() == IDOK)
1219 regSetDwordValue("selectedFilter", dlg.m_ofn.nFilterIndex);
1220 theApp.romFilename = dlg.GetPathName();
1221 initialDir = winGetDirFromFilename(theApp.romFilename);
1223 // we have directory override for that purpose
1224 // but this can be...desirable
1225 if (isOverrideEmpty)
1226 regSetStringValue(cartridgeType == 0 ? IDS_ROM_DIR : IDS_GBXROM_DIR, initialDir);
1227 return true;
1229 return false;
1232 // some extensions that might commonly be near emulation-related files that we almost certainly can't open, or at least not
1233 // directly.
1234 // also includes definitely non-ROM extensions we know about, since we only use this variable in a ROM opening function.
1235 // we do this by exclusion instead of inclusion because we don't want to exclude extensions used for any archive files, even
1236 // extensionless or unusually-named archives.
1237 static const char *s_romIgnoreExtensions[] = {
1238 "vbm", "sgm", "clt", "dat", "gbs", "gcf", "spc", "xpc", "pal", "act", "dmp", "avi", "ini", "txt", "nfo",
1239 "htm", "html", "jpg", "jpeg", "png", "bmp", "gif", "mp3", "wav", "lnk", "exe", "bat", "sav", "luasav"
1240 };
1242 #include "GBACheatsDlg.h"
1243 #include "GBCheatsDlg.h"
1245 #include "../common/CheatSearch.h"
1246 #include "../gba/GBA.h"
1247 #include "../gb/GB.h"
1248 #include "../gba/Flash.h"
1249 #include "../gba/RTC.h"
1251 void MainWnd::winFileClose(bool reopening)
1253 if (rom != NULL || gbRom != NULL)
1255 if (theApp.autoSaveLoadCheatList)
1256 winSaveCheatListDefault();
1258 if (!reopening)
1260 // save battery file before we change the filename...
1261 winWriteBatteryFile();
1262 cheatSearchCleanup(&cheatSearchData);
1263 capturePrevious = 0;
1264 captureNumber = 0;
1267 theApp.emulator.emuCleanUp();
1269 extern void remoteCleanUp();
1270 remoteCleanUp();
1273 if (VBAMovieActive())
1274 VBAMovieStop(false); // will only get here on user selecting to open a ROM, canceling movie
1276 theApp.frameSearching = false;
1277 theApp.frameSearchSkipping = false;
1278 emulating = 0;
1280 if (this)
1281 RedrawWindow(NULL, NULL, RDW_INVALIDATE | RDW_ERASE | RDW_ALLCHILDREN);
1282 systemSetTitle(VBA_NAME_AND_VERSION);
1285 bool MainWnd::winFileRun(bool reopening)
1287 int prevCartridgeType = systemCartridgeType;
1289 //bool requiresInitRAMSearch = (rom == NULL && gbRom == NULL) || !reopening;
1290 winFileClose(reopening);
1292 // use ObtainFile to support opening files within archives (.7z, .rar, .zip, .zip.rar.7z, etc.)
1293 if (theApp.romFilename.GetLength() > 2048) theApp.romFilename.Truncate(2048);
1295 char logicalName[2048], physicalName[2048];
1297 // FIXME: assertion failure in fopen.c if canceled
1298 if (ObtainFile(theApp.romFilename, logicalName, physicalName, "rom", s_romIgnoreExtensions,
1299 sizeof(s_romIgnoreExtensions) / sizeof(*s_romIgnoreExtensions)))
1301 // theApp.romFilename is exactly the filename used for opening, while theApp.gameFilename is always the logical name
1302 theApp.romFilename = theApp.gameFilename = logicalName;
1303 ReleaseTempFileCategory("rom", physicalName);
1305 else
1307 return false;
1310 IMAGE_TYPE type = utilFindType(physicalName);
1312 if (type == IMAGE_UNKNOWN)
1314 systemMessage(IDS_UNSUPPORTED_FILE_TYPE,
1315 "The file \"%s\" is an unsupported type.", logicalName);
1316 return false;
1318 systemSaveUpdateCounter = SYSTEM_SAVE_NOT_UPDATED;
1319 systemCartridgeType = (int)type;
1320 if (type == IMAGE_GB)
1322 if (!gbLoadRom(physicalName))
1323 return false;
1325 gbBorderOn = theApp.winGbBorderOn;
1326 theApp.emulator = GBSystem;
1327 theApp.romSize = gbRomSize;
1328 if (theApp.autoIPS)
1330 CString ipsname = winGetDestFilename(logicalName, IDS_IPS_DIR, ".ips");
1331 int size = gbRomSize;
1332 utilApplyIPS(ipsname, &gbRom, &size);
1333 if (size != gbRomSize)
1335 extern bool gbUpdateSizes();
1336 gbUpdateSizes();
1337 theApp.romSize = size;
1341 useBios = false; // FIXME
1343 if (reopening)
1345 bool winGbCheatReaddress();
1346 winGbCheatReaddress();
1349 else
1351 int size = CPULoadRom(physicalName);
1352 if (!size)
1353 return false;
1355 flashSetSize(theApp.winFlashSize);
1356 rtcEnable(theApp.winRtcEnable);
1357 cpuSaveType = theApp.winSaveType;
1359 // if(cpuEnhancedDetection && winSaveType == 0) {
1360 // utilGBAFindSave(rom, size);
1361 // }
1363 char buffer[5];
1364 strncpy(buffer, (const char *)&rom[0xac], 4);
1365 buffer[4] = 0;
1367 // vba-over.ini
1368 CString vbaOverINI = theApp.exeDir;
1369 vbaOverINI += "\\vba-over.ini";
1371 UINT i = GetPrivateProfileInt(buffer, "rtcEnabled", -1, vbaOverINI);
1372 if (i != (UINT)-1)
1373 rtcEnable(i == 0 ? false : true);
1375 i = GetPrivateProfileInt(buffer, "flashSize", -1, vbaOverINI);
1376 if (i != (UINT)-1 && (i == 0x10000 || i == 0x20000))
1377 flashSetSize((int)i);
1379 i = GetPrivateProfileInt(buffer, "saveType", -1, vbaOverINI);
1380 if (i != (UINT)-1 && (i <= 5))
1381 cpuSaveType = (int)i;
1383 /* disabled due to problems
1384 if(theApp.removeIntros && rom != NULL) {
1385 *((u32 *)rom)= 0xea00002e;
1387 */
1388 theApp.emulator = GBASystem;
1389 theApp.romSize = size;
1390 if (theApp.autoIPS)
1392 CString ipsname = winGetDestFilename(logicalName, IDS_IPS_DIR, ".ips");
1393 int size = 0x2000000;
1394 utilApplyIPS(ipsname, &rom, &size);
1397 skipBios = theApp.skipBiosFile ? true : false;
1398 CPUInit();
1399 CPULoadBios(theApp.biosFileName, theApp.useBiosFile ? true : false);
1400 CPUReset();
1402 if (reopening)
1404 bool winGbaCheatReaddress();
1405 winGbaCheatReaddress();
1409 if (theApp.soundInitialized)
1411 if (systemCartridgeType == 1)
1412 gbSoundReset();
1413 else
1414 soundReset();
1416 else
1418 if (!soundOffFlag)
1419 soundInit();
1420 theApp.soundInitialized = true;
1423 winReadBatteryFile();
1425 emulating = true;
1427 if (theApp.autoSaveLoadCheatList)
1428 winLoadCheatListDefault();
1430 if (theApp.filenamePreference == 0)
1431 theApp.addRecentFile(winGetOriginalFilename(logicalName));
1432 else
1433 theApp.addRecentFile(logicalName);
1435 theApp.updateWindowSize(theApp.videoOption);
1437 theApp.updateFrameSkip();
1439 if (theApp.autoHideMenu && theApp.videoOption > VIDEO_4X && theApp.menuToggle)
1440 OnFileTogglemenu();
1442 if (theApp.autoLoadMostRecent && !VBAMovieActive() && !VBAMovieLoading()) // would cause desync in movies...
1443 OnFileLoadgameMostrecent();
1445 theApp.renderedFrames = 0;
1447 theApp.rewindCount = 0;
1448 theApp.rewindCounter = 0;
1449 theApp.rewindSaveNeeded = false;
1452 extern bool playMovieFile, playMovieFileReadOnly, outputWavFile, outputAVIFile, flagHideMenu; // from VBA.cpp
1453 extern char movieFileToPlay[1024], wavFileToOutput[1024]; // from VBA.cpp
1454 extern int pauseAfterTime; // from VBA.cpp
1455 if (playMovieFile)
1457 playMovieFile = false;
1458 VBAMovieOpen(movieFileToPlay, playMovieFileReadOnly);
1460 if (outputWavFile)
1462 outputWavFile = false;
1463 theApp.soundRecordName = wavFileToOutput;
1464 theApp.soundRecording = true;
1466 if (outputAVIFile)
1468 outputAVIFile = false;
1469 OnToolsStartAVIRecording();
1471 if (pauseAfterTime >= 0)
1473 VBAMovieSetPauseAt(pauseAfterTime);
1475 if (flagHideMenu)
1477 OnFileTogglemenu();
1478 theApp.updateWindowSize(theApp.videoOption);
1482 if (systemCartridgeType != prevCartridgeType)
1484 extern GBACheatSearch gbaDlg;
1485 extern GBCheatSearch gbDlg;
1486 if (!theApp.pauseDuringCheatSearch && theApp.modelessCheatDialogIsOpen)
1488 gbaDlg.DestroyWindow();
1489 gbDlg.DestroyWindow();
1490 theApp.modelessCheatDialogIsOpen = false;
1494 theApp.winCheckFullscreen();
1495 ReopenRamWindows();
1497 // FIXME
1498 reset_address_info();
1499 //if (requiresInitRAMSearch)
1501 // extern void soft_reset_address_info();
1502 // soft_reset_address_info();
1505 VBAUpdateButtonPressDisplay();
1506 VBAUpdateFrameCountDisplay();
1507 systemRefreshScreen();
1509 return true;