rlm@1
|
1 #include "stdafx.h"
|
rlm@1
|
2 #include "resource.h"
|
rlm@1
|
3 #include "MainWnd.h"
|
rlm@1
|
4 #include "ExportGSASnapshot.h"
|
rlm@1
|
5 #include "FileDlg.h"
|
rlm@1
|
6 #include "GSACodeSelect.h"
|
rlm@1
|
7 #include "RomInfo.h"
|
rlm@1
|
8 #include "Reg.h"
|
rlm@1
|
9 #include "WinResUtil.h"
|
rlm@1
|
10 #include "WinMiscUtil.h"
|
rlm@1
|
11 #include "LuaOpenDialog.h"
|
rlm@1
|
12 #include "ram_search.h"
|
rlm@1
|
13 #include "ramwatch.h"
|
rlm@1
|
14 #include "Sound.h"
|
rlm@1
|
15 #include "VBA.h"
|
rlm@1
|
16
|
rlm@1
|
17 #include "../NLS.h"
|
rlm@1
|
18 #include "../version.h"
|
rlm@1
|
19 #include "../gba/GBA.h"
|
rlm@1
|
20 #include "../gba/GBAGlobals.h"
|
rlm@1
|
21 #include "../gba/EEprom.h"
|
rlm@1
|
22 #include "../gba/GBASound.h"
|
rlm@1
|
23 #include "../gb/GB.h"
|
rlm@1
|
24 #include "../gb/gbGlobals.h"
|
rlm@1
|
25 #include "../common/movie.h"
|
rlm@1
|
26 #include "../common/vbalua.h"
|
rlm@1
|
27
|
rlm@1
|
28 void MainWnd::OnFileOpen()
|
rlm@1
|
29 {
|
rlm@1
|
30 theApp.winCheckFullscreen();
|
rlm@1
|
31 if (winFileOpenSelect(0))
|
rlm@1
|
32 {
|
rlm@1
|
33 winFileRun();
|
rlm@1
|
34 }
|
rlm@1
|
35 }
|
rlm@1
|
36
|
rlm@1
|
37 void MainWnd::OnFileOpenGBx()
|
rlm@1
|
38 {
|
rlm@1
|
39 theApp.winCheckFullscreen();
|
rlm@1
|
40 if (winFileOpenSelect(1))
|
rlm@1
|
41 {
|
rlm@1
|
42 winFileRun();
|
rlm@1
|
43 }
|
rlm@1
|
44 }
|
rlm@1
|
45
|
rlm@1
|
46 void MainWnd::OnFilePause()
|
rlm@1
|
47 {
|
rlm@1
|
48 systemSetPause(!theApp.paused);
|
rlm@1
|
49 }
|
rlm@1
|
50
|
rlm@1
|
51 void MainWnd::OnUpdateFilePause(CCmdUI *pCmdUI)
|
rlm@1
|
52 {
|
rlm@1
|
53 pCmdUI->SetCheck(theApp.paused);
|
rlm@1
|
54 }
|
rlm@1
|
55
|
rlm@1
|
56 void MainWnd::OnFileReset()
|
rlm@1
|
57 {
|
rlm@1
|
58 if (emulating)
|
rlm@1
|
59 {
|
rlm@1
|
60 if (VBAMovieGetState() == MOVIE_STATE_PLAY)
|
rlm@1
|
61 {
|
rlm@1
|
62 OnToolsPlayRestart(); // HACK: shortcut
|
rlm@1
|
63 }
|
rlm@1
|
64 else
|
rlm@1
|
65 {
|
rlm@1
|
66 theApp.emulator.emuReset(true);
|
rlm@1
|
67 systemScreenMessage(winResLoadString(IDS_RESET));
|
rlm@1
|
68 }
|
rlm@1
|
69 }
|
rlm@1
|
70 }
|
rlm@1
|
71
|
rlm@1
|
72 void MainWnd::OnUpdateFileReset(CCmdUI *pCmdUI)
|
rlm@1
|
73 {
|
rlm@1
|
74 pCmdUI->Enable(emulating);
|
rlm@1
|
75 }
|
rlm@1
|
76
|
rlm@1
|
77 void MainWnd::OnFileRecentFreeze()
|
rlm@1
|
78 {
|
rlm@1
|
79 theApp.recentFreeze = !theApp.recentFreeze;
|
rlm@1
|
80 }
|
rlm@1
|
81
|
rlm@1
|
82 void MainWnd::OnUpdateFileRecentFreeze(CCmdUI *pCmdUI)
|
rlm@1
|
83 {
|
rlm@1
|
84 pCmdUI->SetCheck(theApp.recentFreeze);
|
rlm@1
|
85 }
|
rlm@1
|
86
|
rlm@1
|
87 void MainWnd::OnFileRecentReset()
|
rlm@1
|
88 {
|
rlm@1
|
89 theApp.winCheckFullscreen();
|
rlm@1
|
90 systemSoundClearBuffer();
|
rlm@1
|
91 if (MessageBox("Really clear your recent ROMs list?", //winResLoadString(IDS_REALLY_CLEAR),
|
rlm@1
|
92 winResLoadString(IDS_CONFIRM_ACTION),
|
rlm@1
|
93 MB_YESNO | MB_DEFBUTTON2) == IDNO)
|
rlm@1
|
94 return;
|
rlm@1
|
95
|
rlm@1
|
96 for (int i = 0; i < 10; ++i)
|
rlm@1
|
97 theApp.recentFiles[i] = "";
|
rlm@1
|
98 }
|
rlm@1
|
99
|
rlm@1
|
100 BOOL MainWnd::OnFileRecentFile(UINT nID)
|
rlm@1
|
101 {
|
rlm@1
|
102 if (theApp.recentFiles[(nID & 0xFFFF) - ID_FILE_MRU_FILE1].GetLength())
|
rlm@1
|
103 {
|
rlm@1
|
104 theApp.romFilename = theApp.recentFiles[(nID & 0xFFFF) - ID_FILE_MRU_FILE1];
|
rlm@1
|
105 winFileRun();
|
rlm@1
|
106 }
|
rlm@1
|
107 return TRUE;
|
rlm@1
|
108 }
|
rlm@1
|
109
|
rlm@1
|
110 void MainWnd::OnUpdateFileRecentFile(CCmdUI *pCmdUI)
|
rlm@1
|
111 {
|
rlm@1
|
112 int fileID = pCmdUI->m_nID - ID_FILE_MRU_FILE1;
|
rlm@1
|
113
|
rlm@1
|
114 bool bExist = !theApp.recentFiles[fileID].IsEmpty();
|
rlm@1
|
115
|
rlm@1
|
116 if (pCmdUI->m_pMenu != NULL)
|
rlm@1
|
117 {
|
rlm@1
|
118 CString p = theApp.recentFiles[fileID];
|
rlm@1
|
119
|
rlm@1
|
120 int index = max(p.ReverseFind('/'), max(p.ReverseFind('\\'), p.ReverseFind('|')));
|
rlm@1
|
121
|
rlm@1
|
122 if (index != -1)
|
rlm@1
|
123 {
|
rlm@1
|
124 p.Delete(0, index + 1);
|
rlm@1
|
125 }
|
rlm@1
|
126
|
rlm@1
|
127 p.Replace("&", "&&");
|
rlm@1
|
128
|
rlm@1
|
129 CString number("1&0 - ");
|
rlm@1
|
130 if (fileID < 9)
|
rlm@1
|
131 number.Format("&%d - ", fileID + 1);
|
rlm@1
|
132
|
rlm@1
|
133 if (p.IsEmpty())
|
rlm@1
|
134 {
|
rlm@1
|
135 p = "No Recent ROM";
|
rlm@1
|
136 bExist = false;
|
rlm@1
|
137 }
|
rlm@1
|
138
|
rlm@1
|
139 pCmdUI->SetText(number + p);
|
rlm@1
|
140 theApp.winAccelMgr.UpdateMenu(pCmdUI->m_pMenu->GetSafeHmenu());
|
rlm@1
|
141 }
|
rlm@1
|
142
|
rlm@1
|
143 pCmdUI->Enable(bExist);
|
rlm@1
|
144 }
|
rlm@1
|
145
|
rlm@1
|
146 void MainWnd::OnFileExit()
|
rlm@1
|
147 {
|
rlm@1
|
148 if (AskSave())
|
rlm@1
|
149 SendMessage(WM_CLOSE);
|
rlm@1
|
150 }
|
rlm@1
|
151
|
rlm@1
|
152 void MainWnd::OnFileClose()
|
rlm@1
|
153 {
|
rlm@1
|
154 // save battery file before we change the filename...
|
rlm@1
|
155 CloseRamWindows();
|
rlm@1
|
156 winFileClose();
|
rlm@1
|
157 }
|
rlm@1
|
158
|
rlm@1
|
159 void MainWnd::OnUpdateFileClose(CCmdUI *pCmdUI)
|
rlm@1
|
160 {
|
rlm@1
|
161 pCmdUI->Enable(emulating);
|
rlm@1
|
162 }
|
rlm@1
|
163
|
rlm@1
|
164 void MainWnd::OnFileLoad()
|
rlm@1
|
165 {
|
rlm@1
|
166 theApp.winCheckFullscreen();
|
rlm@1
|
167
|
rlm@1
|
168 LPCTSTR exts[] = { ".sgm", NULL };
|
rlm@1
|
169 CString filter = winResLoadFilter(IDS_FILTER_SGM);
|
rlm@1
|
170 CString title = winResLoadString(IDS_SELECT_SAVE_GAME_NAME);
|
rlm@1
|
171
|
rlm@1
|
172 CString saveName = winGetDestFilename(theApp.gameFilename, IDS_SAVE_DIR, exts[0]);
|
rlm@1
|
173 CString saveDir = winGetDestDir(IDS_SAVE_DIR);
|
rlm@1
|
174
|
rlm@1
|
175 FileDlg dlg(this, saveName, filter, 0, "SGM", exts, saveDir, title, false, true);
|
rlm@1
|
176
|
rlm@1
|
177 if (dlg.DoModal() == IDOK)
|
rlm@1
|
178 {
|
rlm@1
|
179 bool res = winReadSaveGame(dlg.GetPathName());
|
rlm@1
|
180
|
rlm@1
|
181 theApp.rewindCount = 0;
|
rlm@1
|
182 theApp.rewindCounter = 0;
|
rlm@1
|
183 theApp.rewindSaveNeeded = false;
|
rlm@1
|
184
|
rlm@1
|
185 if (res)
|
rlm@1
|
186 {
|
rlm@1
|
187 if (VBAMovieActive() && !VBAMovieReadOnly())
|
rlm@1
|
188 {
|
rlm@1
|
189 VBAMovieSwitchToRecording();
|
rlm@1
|
190 }
|
rlm@1
|
191 systemScreenMessage(winResLoadString(IDS_LOADED_STATE));
|
rlm@1
|
192 }
|
rlm@1
|
193 }
|
rlm@1
|
194 }
|
rlm@1
|
195
|
rlm@1
|
196 void MainWnd::OnUpdateFileLoad(CCmdUI *pCmdUI)
|
rlm@1
|
197 {
|
rlm@1
|
198 pCmdUI->Enable(emulating);
|
rlm@1
|
199 }
|
rlm@1
|
200
|
rlm@1
|
201 BOOL MainWnd::OnFileLoadSlot(UINT nID)
|
rlm@1
|
202 {
|
rlm@1
|
203 nID = nID + 1 - ID_FILE_LOADGAME_SLOT1;
|
rlm@1
|
204
|
rlm@1
|
205 CString filename = winGetSavestateFilename(theApp.gameFilename, nID);
|
rlm@1
|
206
|
rlm@1
|
207 bool res = winReadSaveGame(filename);
|
rlm@1
|
208
|
rlm@1
|
209 // deleting rewinds because you loaded a save state is stupid
|
rlm@1
|
210 /// theApp.rewindCount = 0;
|
rlm@1
|
211 /// theApp.rewindCounter = 0;
|
rlm@1
|
212 /// theApp.rewindSaveNeeded = false;
|
rlm@1
|
213
|
rlm@1
|
214 if (res)
|
rlm@1
|
215 {
|
rlm@1
|
216 CString format;
|
rlm@1
|
217 if (VBAMovieActive())
|
rlm@1
|
218 {
|
rlm@1
|
219 if (VBAMovieReadOnly())
|
rlm@1
|
220 {
|
rlm@1
|
221 format = winResLoadString(IDS_REPLAYED_STATE_N);
|
rlm@1
|
222 }
|
rlm@1
|
223 else
|
rlm@1
|
224 {
|
rlm@1
|
225 VBAMovieSwitchToRecording();
|
rlm@1
|
226 format = winResLoadString(IDS_RERECORDED_STATE_N);
|
rlm@1
|
227 }
|
rlm@1
|
228 }
|
rlm@1
|
229 else
|
rlm@1
|
230 {
|
rlm@1
|
231 format = winResLoadString(IDS_LOADED_STATE_N);
|
rlm@1
|
232 }
|
rlm@1
|
233
|
rlm@1
|
234 CString buffer;
|
rlm@1
|
235 buffer.Format(format, nID);
|
rlm@1
|
236 systemScreenMessage(buffer);
|
rlm@1
|
237
|
rlm@1
|
238 int lastSlot = theApp.currentSlot;
|
rlm@1
|
239
|
rlm@1
|
240 if (theApp.loadMakesRecent)
|
rlm@1
|
241 {
|
rlm@1
|
242 // to update the file's modification date
|
rlm@1
|
243 SYSTEMTIME st;
|
rlm@1
|
244 FILETIME ft;
|
rlm@1
|
245 GetSystemTime(&st);
|
rlm@1
|
246 SystemTimeToFileTime(&st, &ft);
|
rlm@1
|
247 HANDLE fh = CreateFile(filename,
|
rlm@1
|
248 GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE,
|
rlm@1
|
249 NULL,
|
rlm@1
|
250 OPEN_EXISTING,
|
rlm@1
|
251 0,
|
rlm@1
|
252 NULL);
|
rlm@1
|
253 if (fh != INVALID_HANDLE_VALUE)
|
rlm@1
|
254 SetFileTime(fh, NULL, NULL, &ft);
|
rlm@1
|
255 CloseHandle(fh);
|
rlm@1
|
256 }
|
rlm@1
|
257
|
rlm@1
|
258 if (theApp.loadMakesCurrent)
|
rlm@1
|
259 theApp.currentSlot = nID - 1;
|
rlm@1
|
260 else
|
rlm@1
|
261 theApp.currentSlot = lastSlot; // restore value in case the call to OnFileSaveSlot changed it
|
rlm@1
|
262
|
rlm@1
|
263 theApp.frameSearching = false;
|
rlm@1
|
264 theApp.frameSearchSkipping = false;
|
rlm@1
|
265 }
|
rlm@1
|
266
|
rlm@1
|
267 return res;
|
rlm@1
|
268 }
|
rlm@1
|
269
|
rlm@1
|
270 void MainWnd::OnFileSave()
|
rlm@1
|
271 {
|
rlm@1
|
272 theApp.winCheckFullscreen();
|
rlm@1
|
273
|
rlm@1
|
274 LPCTSTR exts[] = { ".sgm", NULL };
|
rlm@1
|
275 CString filter = winResLoadFilter(IDS_FILTER_SGM);
|
rlm@1
|
276 CString title = winResLoadString(IDS_SELECT_SAVE_GAME_NAME);
|
rlm@1
|
277
|
rlm@1
|
278 CString saveName = winGetDestFilename(theApp.gameFilename, IDS_SAVE_DIR, exts[0]);
|
rlm@1
|
279 CString saveDir = winGetDestDir(IDS_SAVE_DIR);
|
rlm@1
|
280
|
rlm@1
|
281 FileDlg dlg(this, saveName, filter, 0, "SGM", exts, saveDir, title, true);
|
rlm@1
|
282
|
rlm@1
|
283 if (dlg.DoModal() == IDOK)
|
rlm@1
|
284 {
|
rlm@1
|
285 bool res = winWriteSaveGame(dlg.GetPathName());
|
rlm@1
|
286 if (res)
|
rlm@1
|
287 systemScreenMessage(winResLoadString(IDS_WROTE_STATE));
|
rlm@1
|
288 }
|
rlm@1
|
289 }
|
rlm@1
|
290
|
rlm@1
|
291 void MainWnd::OnUpdateFileSave(CCmdUI *pCmdUI)
|
rlm@1
|
292 {
|
rlm@1
|
293 pCmdUI->Enable(emulating);
|
rlm@1
|
294 }
|
rlm@1
|
295
|
rlm@1
|
296 BOOL MainWnd::OnFileSaveSlot(UINT nID)
|
rlm@1
|
297 {
|
rlm@1
|
298 nID = nID + 1 - ID_FILE_SAVEGAME_SLOT1;
|
rlm@1
|
299
|
rlm@1
|
300 if (theApp.saveMakesCurrent)
|
rlm@1
|
301 theApp.currentSlot = nID - 1;
|
rlm@1
|
302
|
rlm@1
|
303 CString filename = winGetSavestateFilename(theApp.gameFilename, nID);
|
rlm@1
|
304
|
rlm@1
|
305 bool res = winWriteSaveGame(filename);
|
rlm@1
|
306
|
rlm@1
|
307 CString format = winResLoadString(IDS_WROTE_STATE_N);
|
rlm@1
|
308 CString buffer;
|
rlm@1
|
309 buffer.Format(format, nID);
|
rlm@1
|
310
|
rlm@1
|
311 systemScreenMessage(buffer);
|
rlm@1
|
312
|
rlm@1
|
313 return res;
|
rlm@1
|
314 }
|
rlm@1
|
315
|
rlm@1
|
316 BOOL MainWnd::OnSelectSlot(UINT nID)
|
rlm@1
|
317 {
|
rlm@1
|
318 nID -= ID_SELECT_SLOT1;
|
rlm@1
|
319 theApp.currentSlot = nID;
|
rlm@1
|
320
|
rlm@1
|
321 CString buffer;
|
rlm@1
|
322 buffer.Format("Slot %d selected", nID + 1);
|
rlm@1
|
323 systemScreenMessage(buffer, 0);
|
rlm@1
|
324
|
rlm@1
|
325 return true;
|
rlm@1
|
326 }
|
rlm@1
|
327
|
rlm@1
|
328 void MainWnd::OnFileImportBatteryfile()
|
rlm@1
|
329 {
|
rlm@1
|
330 theApp.winCheckFullscreen();
|
rlm@1
|
331
|
rlm@1
|
332 LPCTSTR exts[] = { ".sav", NULL };
|
rlm@1
|
333 CString filter = winResLoadFilter(IDS_FILTER_SAV);
|
rlm@1
|
334 CString title = winResLoadString(IDS_SELECT_BATTERY_FILE);
|
rlm@1
|
335
|
rlm@1
|
336 CString batteryName = winGetDestFilename(theApp.gameFilename, IDS_BATTERY_DIR, exts[0]);
|
rlm@1
|
337 CString batteryDir = winGetDestDir(IDS_BATTERY_DIR);
|
rlm@1
|
338
|
rlm@1
|
339 FileDlg dlg(this, batteryName, filter, 0, "SAV", exts, batteryDir, title, false, true);
|
rlm@1
|
340
|
rlm@1
|
341 if (dlg.DoModal() == IDCANCEL)
|
rlm@1
|
342 return;
|
rlm@1
|
343
|
rlm@1
|
344 CString str1 = winResLoadString(IDS_SAVE_WILL_BE_LOST);
|
rlm@1
|
345 CString str2 = winResLoadString(IDS_CONFIRM_ACTION);
|
rlm@1
|
346
|
rlm@1
|
347 systemSoundClearBuffer();
|
rlm@1
|
348 if (MessageBox(str1,
|
rlm@1
|
349 str2,
|
rlm@1
|
350 MB_OKCANCEL) == IDCANCEL)
|
rlm@1
|
351 return;
|
rlm@1
|
352
|
rlm@1
|
353 bool res = false;
|
rlm@1
|
354
|
rlm@1
|
355 res = theApp.emulator.emuReadBattery(dlg.GetPathName());
|
rlm@1
|
356
|
rlm@1
|
357 if (!res)
|
rlm@1
|
358 systemMessage(MSG_CANNOT_OPEN_FILE, "Cannot open file %s", dlg.GetPathName());
|
rlm@1
|
359 else
|
rlm@1
|
360 {
|
rlm@1
|
361 theApp.emulator.emuReset(true);
|
rlm@1
|
362 }
|
rlm@1
|
363 }
|
rlm@1
|
364
|
rlm@1
|
365 void MainWnd::OnUpdateFileImportBatteryfile(CCmdUI *pCmdUI)
|
rlm@1
|
366 {
|
rlm@1
|
367 // we allow this as we allow using cheats during recording
|
rlm@1
|
368 pCmdUI->Enable(emulating /*&& !VBAMovieActive()*/);
|
rlm@1
|
369 }
|
rlm@1
|
370
|
rlm@1
|
371 void MainWnd::OnFileImportGamesharkcodefile()
|
rlm@1
|
372 {
|
rlm@1
|
373 theApp.winCheckFullscreen();
|
rlm@1
|
374
|
rlm@1
|
375 LPCTSTR exts[] = { NULL };
|
rlm@1
|
376 CString filter = systemCartridgeType == 0 ? winResLoadFilter(IDS_FILTER_SPC) : winResLoadFilter(IDS_FILTER_GCF);
|
rlm@1
|
377 CString title = winResLoadString(IDS_SELECT_CODE_FILE);
|
rlm@1
|
378
|
rlm@1
|
379 FileDlg dlg(this, "", filter, 0, "", exts, "", title, false, true);
|
rlm@1
|
380
|
rlm@1
|
381 if (dlg.DoModal() == IDCANCEL)
|
rlm@1
|
382 return;
|
rlm@1
|
383
|
rlm@1
|
384 CString str1 = winResLoadString(IDS_CODES_WILL_BE_LOST);
|
rlm@1
|
385 CString str2 = winResLoadString(IDS_CONFIRM_ACTION);
|
rlm@1
|
386
|
rlm@1
|
387 systemSoundClearBuffer();
|
rlm@1
|
388 if (MessageBox(str1,
|
rlm@1
|
389 str2,
|
rlm@1
|
390 MB_OKCANCEL) == IDCANCEL)
|
rlm@1
|
391 return;
|
rlm@1
|
392
|
rlm@1
|
393 CString file = dlg.GetPathName();
|
rlm@1
|
394 bool res = winImportGSACodeFile(file);
|
rlm@1
|
395 }
|
rlm@1
|
396
|
rlm@1
|
397 void MainWnd::OnUpdateFileImportGamesharkcodefile(CCmdUI *pCmdUI)
|
rlm@1
|
398 {
|
rlm@1
|
399 pCmdUI->Enable(emulating /*&& !VBAMovieActive()*/);
|
rlm@1
|
400 }
|
rlm@1
|
401
|
rlm@1
|
402 void MainWnd::OnFileImportGamesharksnapshot()
|
rlm@1
|
403 {
|
rlm@1
|
404 theApp.winCheckFullscreen();
|
rlm@1
|
405
|
rlm@1
|
406 LPCTSTR exts[] = { NULL };
|
rlm@1
|
407 CString filter = systemCartridgeType == 1 ? winResLoadFilter(IDS_FILTER_GBS) : winResLoadFilter(IDS_FILTER_SPS);
|
rlm@1
|
408 CString title = winResLoadString(IDS_SELECT_SNAPSHOT_FILE);
|
rlm@1
|
409
|
rlm@1
|
410 FileDlg dlg(this, "", filter, 0, "", exts, "", title, false, true);
|
rlm@1
|
411
|
rlm@1
|
412 if (dlg.DoModal() == IDCANCEL)
|
rlm@1
|
413 return;
|
rlm@1
|
414
|
rlm@1
|
415 CString str1 = winResLoadString(IDS_SAVE_WILL_BE_LOST);
|
rlm@1
|
416 CString str2 = winResLoadString(IDS_CONFIRM_ACTION);
|
rlm@1
|
417
|
rlm@1
|
418 systemSoundClearBuffer();
|
rlm@1
|
419 if (MessageBox(str1,
|
rlm@1
|
420 str2,
|
rlm@1
|
421 MB_OKCANCEL) == IDCANCEL)
|
rlm@1
|
422 return;
|
rlm@1
|
423
|
rlm@1
|
424 if (systemCartridgeType == 1)
|
rlm@1
|
425 gbReadGSASnapshot(dlg.GetPathName());
|
rlm@1
|
426 else
|
rlm@1
|
427 CPUReadGSASnapshot(dlg.GetPathName());
|
rlm@1
|
428 }
|
rlm@1
|
429
|
rlm@1
|
430 void MainWnd::OnUpdateFileImportGamesharksnapshot(CCmdUI *pCmdUI)
|
rlm@1
|
431 {
|
rlm@1
|
432 pCmdUI->Enable(emulating /*&& !VBAMovieActive()*/);
|
rlm@1
|
433 }
|
rlm@1
|
434
|
rlm@1
|
435 void MainWnd::OnFileExportBatteryfile()
|
rlm@1
|
436 {
|
rlm@1
|
437 theApp.winCheckFullscreen();
|
rlm@1
|
438
|
rlm@1
|
439 LPCTSTR exts[] = { ".sav", ".dat", NULL };
|
rlm@1
|
440 CString filter = winResLoadFilter(IDS_FILTER_SAV);
|
rlm@1
|
441 CString title = winResLoadString(IDS_SELECT_BATTERY_FILE);
|
rlm@1
|
442
|
rlm@1
|
443 CString batteryName = winGetDestFilename(theApp.gameFilename, IDS_BATTERY_DIR, exts[0]);
|
rlm@1
|
444 CString batteryDir = winGetDestDir(IDS_BATTERY_DIR);
|
rlm@1
|
445
|
rlm@1
|
446 FileDlg dlg(this, batteryName, filter, 1, "SAV", exts, batteryDir, title, true);
|
rlm@1
|
447
|
rlm@1
|
448 if (dlg.DoModal() == IDCANCEL)
|
rlm@1
|
449 {
|
rlm@1
|
450 return;
|
rlm@1
|
451 }
|
rlm@1
|
452
|
rlm@1
|
453 bool result = false;
|
rlm@1
|
454
|
rlm@1
|
455 if (systemCartridgeType == 1)
|
rlm@1
|
456 {
|
rlm@1
|
457 result = gbWriteBatteryFile(dlg.GetPathName(), false);
|
rlm@1
|
458 }
|
rlm@1
|
459 else
|
rlm@1
|
460 result = theApp.emulator.emuWriteBattery(dlg.GetPathName());
|
rlm@1
|
461
|
rlm@1
|
462 if (!result)
|
rlm@1
|
463 systemMessage(MSG_ERROR_CREATING_FILE, "Error creating file %s",
|
rlm@1
|
464 dlg.GetPathName());
|
rlm@1
|
465 }
|
rlm@1
|
466
|
rlm@1
|
467 void MainWnd::OnUpdateFileExportBatteryfile(CCmdUI *pCmdUI)
|
rlm@1
|
468 {
|
rlm@1
|
469 pCmdUI->Enable(emulating);
|
rlm@1
|
470 }
|
rlm@1
|
471
|
rlm@1
|
472 void MainWnd::OnFileExportGamesharksnapshot()
|
rlm@1
|
473 {
|
rlm@1
|
474 theApp.winCheckFullscreen();
|
rlm@1
|
475 if (eepromInUse)
|
rlm@1
|
476 {
|
rlm@1
|
477 systemMessage(IDS_EEPROM_NOT_SUPPORTED, "EEPROM saves cannot be exported");
|
rlm@1
|
478 return;
|
rlm@1
|
479 }
|
rlm@1
|
480
|
rlm@1
|
481 LPCTSTR exts[] = { ".sps", NULL };
|
rlm@1
|
482
|
rlm@1
|
483 CString filter = winResLoadFilter(IDS_FILTER_SPS);
|
rlm@1
|
484 CString title = winResLoadString(IDS_SELECT_SNAPSHOT_FILE);
|
rlm@1
|
485
|
rlm@1
|
486 CString name = winGetDestFilename(theApp.gameFilename, CString(), exts[0]);
|
rlm@1
|
487
|
rlm@1
|
488 FileDlg dlg(this, name, filter, 1, "SPS", exts, "", title, true);
|
rlm@1
|
489
|
rlm@1
|
490 if (dlg.DoModal() == IDCANCEL)
|
rlm@1
|
491 return;
|
rlm@1
|
492
|
rlm@1
|
493 char buffer[16];
|
rlm@1
|
494 strncpy(buffer, (const char *)&rom[0xa0], 12);
|
rlm@1
|
495 buffer[12] = 0;
|
rlm@1
|
496
|
rlm@1
|
497 ExportGSASnapshot dlg2(dlg.GetPathName(), buffer, this);
|
rlm@1
|
498 dlg2.DoModal();
|
rlm@1
|
499 }
|
rlm@1
|
500
|
rlm@1
|
501 void MainWnd::OnUpdateFileExportGamesharksnapshot(CCmdUI *pCmdUI)
|
rlm@1
|
502 {
|
rlm@1
|
503 pCmdUI->Enable(emulating && systemCartridgeType == 0);
|
rlm@1
|
504 }
|
rlm@1
|
505
|
rlm@1
|
506 void MainWnd::OnFileQuickScreencapture()
|
rlm@1
|
507 {
|
rlm@1
|
508 extern int32 captureNumber; // GBAGlobals.cpp
|
rlm@1
|
509 captureNumber = winScreenCapture(captureNumber);
|
rlm@1
|
510 }
|
rlm@1
|
511
|
rlm@1
|
512 void MainWnd::OnFileScreencapture()
|
rlm@1
|
513 {
|
rlm@1
|
514 theApp.winCheckFullscreen();
|
rlm@1
|
515
|
rlm@1
|
516 LPCTSTR exts[] = { ".png", ".bmp", NULL };
|
rlm@1
|
517
|
rlm@1
|
518 CString filter = winResLoadFilter(IDS_FILTER_PNG);
|
rlm@1
|
519 CString title = winResLoadString(IDS_SELECT_CAPTURE_NAME);
|
rlm@1
|
520
|
rlm@1
|
521 CString ext;
|
rlm@1
|
522
|
rlm@1
|
523 if (theApp.captureFormat != 0)
|
rlm@1
|
524 ext.Format(".bmp");
|
rlm@1
|
525 else
|
rlm@1
|
526 ext.Format(".png");
|
rlm@1
|
527
|
rlm@1
|
528 CString captureName = winGetDestFilename(theApp.gameFilename, IDS_CAPTURE_DIR, ext);
|
rlm@1
|
529 CString captureDir = winGetDestDir(IDS_CAPTURE_DIR);
|
rlm@1
|
530
|
rlm@1
|
531 FileDlg dlg(this,
|
rlm@1
|
532 captureName,
|
rlm@1
|
533 filter,
|
rlm@1
|
534 theApp.captureFormat ? 2 : 1,
|
rlm@1
|
535 theApp.captureFormat ? "BMP" : "PNG",
|
rlm@1
|
536 exts,
|
rlm@1
|
537 captureDir,
|
rlm@1
|
538 title,
|
rlm@1
|
539 true);
|
rlm@1
|
540
|
rlm@1
|
541 if (dlg.DoModal() == IDCANCEL)
|
rlm@1
|
542 return;
|
rlm@1
|
543
|
rlm@1
|
544 if (dlg.getFilterIndex() == 2)
|
rlm@1
|
545 theApp.emulator.emuWriteBMP(dlg.GetPathName());
|
rlm@1
|
546 else
|
rlm@1
|
547 theApp.emulator.emuWritePNG(dlg.GetPathName());
|
rlm@1
|
548
|
rlm@1
|
549 systemScreenMessage(winResLoadString(IDS_SCREEN_CAPTURE));
|
rlm@1
|
550 }
|
rlm@1
|
551
|
rlm@1
|
552 void MainWnd::OnUpdateFileScreencapture(CCmdUI *pCmdUI)
|
rlm@1
|
553 {
|
rlm@1
|
554 pCmdUI->Enable(emulating);
|
rlm@1
|
555 }
|
rlm@1
|
556
|
rlm@1
|
557 void MainWnd::OnFileRominformation()
|
rlm@1
|
558 {
|
rlm@1
|
559 theApp.winCheckFullscreen();
|
rlm@1
|
560 if (systemCartridgeType == 0)
|
rlm@1
|
561 {
|
rlm@1
|
562 RomInfoGBA dlg(rom);
|
rlm@1
|
563 dlg.DoModal();
|
rlm@1
|
564 }
|
rlm@1
|
565 else
|
rlm@1
|
566 {
|
rlm@1
|
567 RomInfoGB dlg(gbRom);
|
rlm@1
|
568 dlg.DoModal();
|
rlm@1
|
569 }
|
rlm@1
|
570 }
|
rlm@1
|
571
|
rlm@1
|
572 void MainWnd::OnUpdateFileRominformation(CCmdUI *pCmdUI)
|
rlm@1
|
573 {
|
rlm@1
|
574 pCmdUI->Enable(emulating);
|
rlm@1
|
575 }
|
rlm@1
|
576
|
rlm@1
|
577 void MainWnd::OnFileTogglemenu()
|
rlm@1
|
578 {
|
rlm@1
|
579 theApp.menuToggle = !theApp.menuToggle;
|
rlm@1
|
580
|
rlm@1
|
581 if (theApp.menuToggle)
|
rlm@1
|
582 {
|
rlm@1
|
583 SetMenu(&theApp.m_menu);
|
rlm@1
|
584 if (theApp.tripleBuffering)
|
rlm@1
|
585 {
|
rlm@1
|
586 if (theApp.display)
|
rlm@1
|
587 theApp.display->renderMenu();
|
rlm@1
|
588 }
|
rlm@1
|
589 }
|
rlm@1
|
590 else
|
rlm@1
|
591 {
|
rlm@1
|
592 SetMenu(NULL);
|
rlm@1
|
593 }
|
rlm@1
|
594
|
rlm@1
|
595 theApp.adjustDestRect();
|
rlm@1
|
596 }
|
rlm@1
|
597
|
rlm@1
|
598 void MainWnd::OnUpdateFileTogglemenu(CCmdUI *pCmdUI)
|
rlm@1
|
599 {
|
rlm@1
|
600 pCmdUI->Enable(theApp.videoOption > VIDEO_4X);
|
rlm@1
|
601 }
|
rlm@1
|
602
|
rlm@1
|
603 void MainWnd::OnFileSavegameOldestslot()
|
rlm@1
|
604 {
|
rlm@1
|
605 if (!emulating)
|
rlm@1
|
606 return;
|
rlm@1
|
607
|
rlm@1
|
608 CFileStatus status;
|
rlm@1
|
609 CString str;
|
rlm@1
|
610 time_t time = -1;
|
rlm@1
|
611 int found = -1;
|
rlm@1
|
612
|
rlm@1
|
613 for (int i = 0; i < 10; i++)
|
rlm@1
|
614 {
|
rlm@1
|
615 if (CFile::GetStatus(winGetSavestateFilename(theApp.gameFilename, i + 1), status))
|
rlm@1
|
616 {
|
rlm@1
|
617 if (time - status.m_mtime.GetTime() > 0 || time == -1)
|
rlm@1
|
618 {
|
rlm@1
|
619 time = (time_t)status.m_mtime.GetTime();
|
rlm@1
|
620 found = i;
|
rlm@1
|
621 }
|
rlm@1
|
622 }
|
rlm@1
|
623 else
|
rlm@1
|
624 {
|
rlm@1
|
625 found = i;
|
rlm@1
|
626 break;
|
rlm@1
|
627 }
|
rlm@1
|
628 }
|
rlm@1
|
629
|
rlm@1
|
630 OnFileSaveSlot(ID_FILE_SAVEGAME_SLOT1 + found);
|
rlm@1
|
631 }
|
rlm@1
|
632
|
rlm@1
|
633 void MainWnd::OnUpdateFileSavegameOldestslot(CCmdUI *pCmdUI)
|
rlm@1
|
634 {
|
rlm@1
|
635 bool enabled = emulating;
|
rlm@1
|
636 if (pCmdUI->m_pMenu != NULL)
|
rlm@1
|
637 {
|
rlm@1
|
638 CFileStatus status;
|
rlm@1
|
639 time_t time = -1;
|
rlm@1
|
640 int found = -1;
|
rlm@1
|
641
|
rlm@1
|
642 if (emulating)
|
rlm@1
|
643 {
|
rlm@1
|
644 for (int i = 0; i < 10; i++)
|
rlm@1
|
645 {
|
rlm@1
|
646 if (CFile::GetStatus(winGetSavestateFilename(theApp.gameFilename, i + 1), status))
|
rlm@1
|
647 {
|
rlm@1
|
648 if (time - status.m_mtime.GetTime() > 0 || time == -1)
|
rlm@1
|
649 {
|
rlm@1
|
650 time = (time_t)status.m_mtime.GetTime();
|
rlm@1
|
651 found = i;
|
rlm@1
|
652 }
|
rlm@1
|
653 }
|
rlm@1
|
654 else
|
rlm@1
|
655 {
|
rlm@1
|
656 found = i;
|
rlm@1
|
657 break;
|
rlm@1
|
658 }
|
rlm@1
|
659 }
|
rlm@1
|
660 }
|
rlm@1
|
661
|
rlm@1
|
662 CString str;
|
rlm@1
|
663 enabled = (found != -1);
|
rlm@1
|
664 if (enabled)
|
rlm@1
|
665 str.Format("&Oldest Slot (#%d)", found + 1);
|
rlm@1
|
666 else
|
rlm@1
|
667 str.Format("&Oldest Slot", found + 1);
|
rlm@1
|
668
|
rlm@1
|
669 pCmdUI->SetText(str);
|
rlm@1
|
670
|
rlm@1
|
671 theApp.winAccelMgr.UpdateMenu(pCmdUI->m_pMenu->GetSafeHmenu());
|
rlm@1
|
672 }
|
rlm@1
|
673
|
rlm@1
|
674 pCmdUI->Enable(enabled);
|
rlm@1
|
675 }
|
rlm@1
|
676
|
rlm@1
|
677 void MainWnd::OnFileLoadgameMostrecent()
|
rlm@1
|
678 {
|
rlm@1
|
679 if (!emulating)
|
rlm@1
|
680 return;
|
rlm@1
|
681
|
rlm@1
|
682 CFileStatus status;
|
rlm@1
|
683 CString str;
|
rlm@1
|
684 time_t time = 0;
|
rlm@1
|
685 int found = -1;
|
rlm@1
|
686
|
rlm@1
|
687 for (int i = 0; i < 10; i++)
|
rlm@1
|
688 {
|
rlm@1
|
689 if (CFile::GetStatus(winGetSavestateFilename(theApp.gameFilename, i + 1), status))
|
rlm@1
|
690 {
|
rlm@1
|
691 if (status.m_mtime.GetTime() > time)
|
rlm@1
|
692 {
|
rlm@1
|
693 time = (time_t)status.m_mtime.GetTime();
|
rlm@1
|
694 found = i;
|
rlm@1
|
695 }
|
rlm@1
|
696 }
|
rlm@1
|
697 }
|
rlm@1
|
698
|
rlm@1
|
699 if (found != -1)
|
rlm@1
|
700 {
|
rlm@1
|
701 OnFileLoadSlot(ID_FILE_LOADGAME_SLOT1 + found);
|
rlm@1
|
702 }
|
rlm@1
|
703 }
|
rlm@1
|
704
|
rlm@1
|
705 void MainWnd::OnUpdateFileLoadgameMostrecent(CCmdUI *pCmdUI)
|
rlm@1
|
706 {
|
rlm@1
|
707 bool enabled = emulating;
|
rlm@1
|
708 if (pCmdUI->m_pMenu != NULL)
|
rlm@1
|
709 {
|
rlm@1
|
710 CFileStatus status;
|
rlm@1
|
711 int found = -1;
|
rlm@1
|
712
|
rlm@1
|
713 time_t time = 0;
|
rlm@1
|
714 if (emulating)
|
rlm@1
|
715 {
|
rlm@1
|
716 for (int i = 0; i < 10; i++)
|
rlm@1
|
717 {
|
rlm@1
|
718 if (CFile::GetStatus(winGetSavestateFilename(theApp.gameFilename, i + 1), status))
|
rlm@1
|
719 {
|
rlm@1
|
720 if (status.m_mtime.GetTime() > time)
|
rlm@1
|
721 {
|
rlm@1
|
722 time = (time_t)status.m_mtime.GetTime();
|
rlm@1
|
723 found = i;
|
rlm@1
|
724 }
|
rlm@1
|
725 }
|
rlm@1
|
726 }
|
rlm@1
|
727 }
|
rlm@1
|
728
|
rlm@1
|
729 CString str;
|
rlm@1
|
730 enabled = (found != -1);
|
rlm@1
|
731 if (enabled)
|
rlm@1
|
732 str.Format("Most &Recent Slot (#%d)", found + 1);
|
rlm@1
|
733 else
|
rlm@1
|
734 str.Format("Most &Recent Slot", found + 1);
|
rlm@1
|
735
|
rlm@1
|
736 pCmdUI->SetText(str);
|
rlm@1
|
737
|
rlm@1
|
738 theApp.winAccelMgr.UpdateMenu(pCmdUI->m_pMenu->GetSafeHmenu());
|
rlm@1
|
739 }
|
rlm@1
|
740
|
rlm@1
|
741 pCmdUI->Enable(enabled);
|
rlm@1
|
742 }
|
rlm@1
|
743
|
rlm@1
|
744 void MainWnd::OnUpdateFileLoadSlot(CCmdUI *pCmdUI)
|
rlm@1
|
745 {
|
rlm@1
|
746 int slotID = pCmdUI->m_nID - ID_FILE_LOADGAME_SLOT1 + 1;
|
rlm@1
|
747
|
rlm@1
|
748 if (pCmdUI->m_pMenu != NULL)
|
rlm@1
|
749 {
|
rlm@1
|
750 pCmdUI->SetText(winGetSavestateMenuString(theApp.gameFilename, slotID));
|
rlm@1
|
751
|
rlm@1
|
752 theApp.winAccelMgr.UpdateMenu(pCmdUI->m_pMenu->GetSafeHmenu());
|
rlm@1
|
753 }
|
rlm@1
|
754
|
rlm@1
|
755 pCmdUI->Enable(emulating && winFileExists(winGetSavestateFilename(theApp.gameFilename, slotID)));
|
rlm@1
|
756 }
|
rlm@1
|
757
|
rlm@1
|
758 void MainWnd::OnUpdateFileSaveSlot(CCmdUI *pCmdUI)
|
rlm@1
|
759 {
|
rlm@1
|
760 if (pCmdUI->m_pMenu != NULL)
|
rlm@1
|
761 {
|
rlm@1
|
762 int slotID = pCmdUI->m_nID - ID_FILE_SAVEGAME_SLOT1 + 1;
|
rlm@1
|
763
|
rlm@1
|
764 pCmdUI->SetText(winGetSavestateMenuString(theApp.gameFilename, slotID));
|
rlm@1
|
765
|
rlm@1
|
766 theApp.winAccelMgr.UpdateMenu(pCmdUI->m_pMenu->GetSafeHmenu());
|
rlm@1
|
767 }
|
rlm@1
|
768
|
rlm@1
|
769 pCmdUI->Enable(emulating);
|
rlm@1
|
770 }
|
rlm@1
|
771
|
rlm@1
|
772 void MainWnd::OnUpdateSelectSlot(CCmdUI *pCmdUI)
|
rlm@1
|
773 {
|
rlm@1
|
774 if (pCmdUI->m_pMenu != NULL)
|
rlm@1
|
775 {
|
rlm@1
|
776 int slot = pCmdUI->m_nID - ID_SELECT_SLOT1;
|
rlm@1
|
777
|
rlm@1
|
778 pCmdUI->SetText(winGetSavestateMenuString(theApp.gameFilename, slot + 1));
|
rlm@1
|
779
|
rlm@1
|
780 theApp.winAccelMgr.UpdateMenu(pCmdUI->m_pMenu->GetSafeHmenu());
|
rlm@1
|
781
|
rlm@1
|
782 pCmdUI->SetCheck(slot == theApp.currentSlot);
|
rlm@1
|
783 }
|
rlm@1
|
784 }
|
rlm@1
|
785
|
rlm@1
|
786 void MainWnd::OnFileLoadgameAutoloadmostrecent()
|
rlm@1
|
787 {
|
rlm@1
|
788 theApp.autoLoadMostRecent = !theApp.autoLoadMostRecent;
|
rlm@1
|
789 }
|
rlm@1
|
790
|
rlm@1
|
791 void MainWnd::OnUpdateFileLoadgameAutoloadmostrecent(CCmdUI *pCmdUI)
|
rlm@1
|
792 {
|
rlm@1
|
793 pCmdUI->SetCheck(theApp.autoLoadMostRecent);
|
rlm@1
|
794 }
|
rlm@1
|
795
|
rlm@1
|
796 void MainWnd::OnFileLoadgameMakeRecent()
|
rlm@1
|
797 {
|
rlm@1
|
798 theApp.loadMakesRecent = !theApp.loadMakesRecent;
|
rlm@1
|
799 }
|
rlm@1
|
800
|
rlm@1
|
801 void MainWnd::OnUpdateFileLoadgameMakeRecent(CCmdUI *pCmdUI)
|
rlm@1
|
802 {
|
rlm@1
|
803 pCmdUI->SetCheck(theApp.loadMakesRecent);
|
rlm@1
|
804 }
|
rlm@1
|
805
|
rlm@1
|
806 void MainWnd::OnFileSavegameCurrent()
|
rlm@1
|
807 {
|
rlm@1
|
808 OnFileSaveSlot(ID_FILE_SAVEGAME_SLOT1 + theApp.currentSlot);
|
rlm@1
|
809 }
|
rlm@1
|
810
|
rlm@1
|
811 void MainWnd::OnUpdateFileSavegameCurrent(CCmdUI *pCmdUI)
|
rlm@1
|
812 {
|
rlm@1
|
813 if (pCmdUI->m_pMenu != NULL)
|
rlm@1
|
814 {
|
rlm@1
|
815 int slotID = theApp.currentSlot + 1;
|
rlm@1
|
816
|
rlm@1
|
817 CString str;
|
rlm@1
|
818 str.Format("&Current Slot (#%d)", slotID);
|
rlm@1
|
819
|
rlm@1
|
820 pCmdUI->SetText(str);
|
rlm@1
|
821
|
rlm@1
|
822 theApp.winAccelMgr.UpdateMenu(pCmdUI->m_pMenu->GetSafeHmenu());
|
rlm@1
|
823 }
|
rlm@1
|
824
|
rlm@1
|
825 pCmdUI->Enable(emulating);
|
rlm@1
|
826 }
|
rlm@1
|
827
|
rlm@1
|
828 void MainWnd::OnFileLoadgameCurrent()
|
rlm@1
|
829 {
|
rlm@1
|
830 OnFileLoadSlot(ID_FILE_LOADGAME_SLOT1 + theApp.currentSlot);
|
rlm@1
|
831 }
|
rlm@1
|
832
|
rlm@1
|
833 void MainWnd::OnUpdateFileLoadgameCurrent(CCmdUI *pCmdUI)
|
rlm@1
|
834 {
|
rlm@1
|
835 int slotID = theApp.currentSlot + 1;
|
rlm@1
|
836
|
rlm@1
|
837 if (pCmdUI->m_pMenu != NULL)
|
rlm@1
|
838 {
|
rlm@1
|
839 CString str;
|
rlm@1
|
840 str.Format("&Current Slot (#%d)", slotID);
|
rlm@1
|
841
|
rlm@1
|
842 pCmdUI->SetText(str);
|
rlm@1
|
843
|
rlm@1
|
844 theApp.winAccelMgr.UpdateMenu(pCmdUI->m_pMenu->GetSafeHmenu());
|
rlm@1
|
845 }
|
rlm@1
|
846
|
rlm@1
|
847 CFileStatus status;
|
rlm@1
|
848 pCmdUI->Enable(emulating && CFile::GetStatus(winGetSavestateFilename(theApp.gameFilename, slotID), status));
|
rlm@1
|
849 }
|
rlm@1
|
850
|
rlm@1
|
851 void MainWnd::OnFileLoadgameMakeCurrent()
|
rlm@1
|
852 {
|
rlm@1
|
853 theApp.loadMakesCurrent = !theApp.loadMakesCurrent;
|
rlm@1
|
854 }
|
rlm@1
|
855
|
rlm@1
|
856 void MainWnd::OnUpdateFileLoadgameMakeCurrent(CCmdUI *pCmdUI)
|
rlm@1
|
857 {
|
rlm@1
|
858 pCmdUI->SetCheck(theApp.loadMakesCurrent);
|
rlm@1
|
859 }
|
rlm@1
|
860
|
rlm@1
|
861 void MainWnd::OnFileSavegameMakeCurrent()
|
rlm@1
|
862 {
|
rlm@1
|
863 theApp.saveMakesCurrent = !theApp.saveMakesCurrent;
|
rlm@1
|
864 }
|
rlm@1
|
865
|
rlm@1
|
866 void MainWnd::OnUpdateFileSavegameMakeCurrent(CCmdUI *pCmdUI)
|
rlm@1
|
867 {
|
rlm@1
|
868 pCmdUI->SetCheck(theApp.saveMakesCurrent);
|
rlm@1
|
869 }
|
rlm@1
|
870
|
rlm@1
|
871 void MainWnd::OnFileSavegameIncrementSlot()
|
rlm@1
|
872 {
|
rlm@1
|
873 theApp.currentSlot = (theApp.currentSlot + 1) % 10;
|
rlm@1
|
874
|
rlm@1
|
875 char str [32];
|
rlm@1
|
876 sprintf(str, "Current Slot: %d", theApp.currentSlot + 1);
|
rlm@1
|
877 systemScreenMessage(str, 0);
|
rlm@1
|
878 }
|
rlm@1
|
879
|
rlm@1
|
880 void MainWnd::OnUpdateFileSavegameIncrementSlot(CCmdUI *pCmdUI)
|
rlm@1
|
881 {
|
rlm@1
|
882 if (pCmdUI->m_pMenu != NULL)
|
rlm@1
|
883 {
|
rlm@1
|
884 int slotID = theApp.currentSlot + 1;
|
rlm@1
|
885
|
rlm@1
|
886 CString str;
|
rlm@1
|
887 str.Format("&Increase Current Slot (#%d -> #%d)", slotID, slotID % 10 + 1);
|
rlm@1
|
888
|
rlm@1
|
889 pCmdUI->SetText(str);
|
rlm@1
|
890
|
rlm@1
|
891 theApp.winAccelMgr.UpdateMenu(pCmdUI->m_pMenu->GetSafeHmenu());
|
rlm@1
|
892 }
|
rlm@1
|
893 }
|
rlm@1
|
894
|
rlm@1
|
895 void MainWnd::OnFileSavegameDecrementSlot()
|
rlm@1
|
896 {
|
rlm@1
|
897 theApp.currentSlot = (theApp.currentSlot + 9) % 10;
|
rlm@1
|
898
|
rlm@1
|
899 char str [32];
|
rlm@1
|
900 sprintf(str, "Current Slot: %d", theApp.currentSlot + 1);
|
rlm@1
|
901 systemScreenMessage(str, 0);
|
rlm@1
|
902 }
|
rlm@1
|
903
|
rlm@1
|
904 void MainWnd::OnUpdateFileSavegameDecrementSlot(CCmdUI *pCmdUI)
|
rlm@1
|
905 {
|
rlm@1
|
906 if (pCmdUI->m_pMenu != NULL)
|
rlm@1
|
907 {
|
rlm@1
|
908 int slotID = theApp.currentSlot + 1;
|
rlm@1
|
909
|
rlm@1
|
910 CString str;
|
rlm@1
|
911 str.Format("&Decrease Current Slot (#%d -> #%d)", slotID, (slotID + 8) % 10 + 1);
|
rlm@1
|
912
|
rlm@1
|
913 pCmdUI->SetText(str);
|
rlm@1
|
914
|
rlm@1
|
915 theApp.winAccelMgr.UpdateMenu(pCmdUI->m_pMenu->GetSafeHmenu());
|
rlm@1
|
916 }
|
rlm@1
|
917 }
|
rlm@1
|
918
|
rlm@1
|
919 void MainWnd::OnFileSlotDisplayModificationTime()
|
rlm@1
|
920 {
|
rlm@1
|
921 theApp.showSlotTime = !theApp.showSlotTime;
|
rlm@1
|
922 }
|
rlm@1
|
923
|
rlm@1
|
924 void MainWnd::OnUpdateFileSlotDisplayModificationTime(CCmdUI *pCmdUI)
|
rlm@1
|
925 {
|
rlm@1
|
926 pCmdUI->SetCheck(theApp.showSlotTime);
|
rlm@1
|
927 }
|
rlm@1
|
928
|
rlm@1
|
929 void MainWnd::OnFileLuaOpen()
|
rlm@1
|
930 {
|
rlm@1
|
931 theApp.winCheckFullscreen();
|
rlm@1
|
932
|
rlm@1
|
933 if (!LuaConsoleHWnd)
|
rlm@1
|
934 {
|
rlm@1
|
935 LuaConsoleHWnd = ::CreateDialog(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDD_LUA), AfxGetMainWnd()->GetSafeHwnd(), (DLGPROC) DlgLuaScriptDialog);
|
rlm@1
|
936 }
|
rlm@1
|
937 else
|
rlm@1
|
938 ::SetForegroundWindow(LuaConsoleHWnd);
|
rlm@1
|
939 }
|
rlm@1
|
940
|
rlm@1
|
941 void MainWnd::OnUpdateFileLuaOpen(CCmdUI *pCmdUI)
|
rlm@1
|
942 {
|
rlm@1
|
943 pCmdUI->SetCheck(LuaConsoleHWnd != NULL);
|
rlm@1
|
944 pCmdUI->Enable(true);
|
rlm@1
|
945 }
|
rlm@1
|
946
|
rlm@1
|
947 void MainWnd::OnFileLuaCloseAll()
|
rlm@1
|
948 {
|
rlm@1
|
949 if (LuaConsoleHWnd)
|
rlm@1
|
950 ::PostMessage(LuaConsoleHWnd, WM_CLOSE, 0, 0);
|
rlm@1
|
951 }
|
rlm@1
|
952
|
rlm@1
|
953 void MainWnd::OnFileLuaReload()
|
rlm@1
|
954 {
|
rlm@1
|
955 VBAReloadLuaCode();
|
rlm@1
|
956 }
|
rlm@1
|
957
|
rlm@1
|
958 void MainWnd::OnFileLuaStop()
|
rlm@1
|
959 {
|
rlm@1
|
960 VBALuaStop();
|
rlm@1
|
961 }
|
rlm@1
|
962
|
rlm@1
|
963 void MainWnd::OnFileRamSearch()
|
rlm@1
|
964 {
|
rlm@1
|
965 theApp.winCheckFullscreen();
|
rlm@1
|
966
|
rlm@1
|
967 if (!RamSearchHWnd)
|
rlm@1
|
968 {
|
rlm@1
|
969 reset_address_info();
|
rlm@1
|
970 LRESULT CALLBACK RamSearchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
rlm@1
|
971 ::CreateDialog(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDD_RAMSEARCH), AfxGetMainWnd()->GetSafeHwnd(), (DLGPROC) RamSearchProc);
|
rlm@1
|
972 }
|
rlm@1
|
973 else
|
rlm@1
|
974 ::SetForegroundWindow(RamSearchHWnd);
|
rlm@1
|
975 }
|
rlm@1
|
976
|
rlm@1
|
977 void MainWnd::OnUpdateFileRamSearch(CCmdUI *pCmdUI)
|
rlm@1
|
978 {
|
rlm@1
|
979 pCmdUI->Enable(TRUE);
|
rlm@1
|
980 }
|
rlm@1
|
981
|
rlm@1
|
982 void MainWnd::OnFileRamWatch()
|
rlm@1
|
983 {
|
rlm@1
|
984 theApp.winCheckFullscreen();
|
rlm@1
|
985
|
rlm@1
|
986 if (!RamWatchHWnd)
|
rlm@1
|
987 {
|
rlm@1
|
988 LRESULT CALLBACK RamWatchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
rlm@1
|
989 RamWatchHWnd = ::CreateDialog(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDD_RAMWATCH), AfxGetMainWnd()->GetSafeHwnd(), (DLGPROC) RamWatchProc);
|
rlm@1
|
990 }
|
rlm@1
|
991 else
|
rlm@1
|
992 ::SetForegroundWindow(RamWatchHWnd);
|
rlm@1
|
993 }
|
rlm@1
|
994
|
rlm@1
|
995 void MainWnd::OnUpdateFileRamWatch(CCmdUI *pCmdUI)
|
rlm@1
|
996 {
|
rlm@1
|
997 pCmdUI->Enable(TRUE);
|
rlm@1
|
998 }
|
rlm@1
|
999
|
rlm@1
|
1000 void MainWnd::OnUpdateFileLuaCloseAll(CCmdUI *pCmdUI)
|
rlm@1
|
1001 {
|
rlm@1
|
1002 pCmdUI->Enable(LuaConsoleHWnd != NULL);
|
rlm@1
|
1003 }
|
rlm@1
|
1004
|