view src/win32/MainWndCheats.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 #include "stdafx.h"
2 #include "resource.h"
3 #include "MainWnd.h"
4 #include "FileDlg.h"
5 #include "GBACheatsDlg.h"
6 #include "GBCheatsDlg.h"
7 #include "Reg.h"
8 #include "WinResUtil.h"
9 #include "WinMiscUtil.h"
10 #include "VBA.h"
12 #include "../gba/GBA.h"
13 #include "../gba/GBAGlobals.h"
14 #include "../gb/gbCheats.h"
16 GBACheatSearch gbaDlg;
17 GBCheatSearch gbDlg;
19 void MainWnd::OnCheatsSearchforcheats()
20 {
21 theApp.winCheckFullscreen();
23 if (theApp.modelessCheatDialogIsOpen)
24 {
25 gbaDlg.DestroyWindow();
26 gbDlg.DestroyWindow();
27 theApp.modelessCheatDialogIsOpen = false;
28 }
30 if (systemCartridgeType == 0)
31 {
32 if (theApp.pauseDuringCheatSearch)
33 {
34 gbaDlg.DoModal();
35 }
36 else
37 {
38 if (!theApp.modelessCheatDialogIsOpen)
39 {
40 theApp.modelessCheatDialogIsOpen = true;
41 gbaDlg.Create(GBACheatSearch::IDD, theApp.m_pMainWnd);
42 }
43 }
44 }
45 else
46 {
47 if (theApp.pauseDuringCheatSearch)
48 {
49 gbDlg.DoModal();
50 }
51 else
52 {
53 if (!theApp.modelessCheatDialogIsOpen)
54 {
55 theApp.modelessCheatDialogIsOpen = true;
56 gbDlg.Create(GBCheatSearch::IDD, theApp.m_pMainWnd);
57 }
58 }
59 }
60 }
62 void MainWnd::OnUpdateCheatsSearchforcheats(CCmdUI*pCmdUI)
63 {
64 pCmdUI->Enable(emulating);
65 }
67 void MainWnd::OnCheatsCheatlist()
68 {
69 theApp.winCheckFullscreen();
70 if (systemCartridgeType == 0)
71 {
72 GBACheatList dlg;
73 dlg.DoModal();
74 }
75 else
76 {
77 GBCheatList dlg;
78 dlg.DoModal();
79 }
80 }
82 void MainWnd::OnUpdateCheatsCheatlist(CCmdUI*pCmdUI)
83 {
84 pCmdUI->Enable(emulating);
85 }
87 void MainWnd::OnCheatsAutomaticsaveloadcheats()
88 {
89 theApp.autoSaveLoadCheatList = !theApp.autoSaveLoadCheatList;
90 }
92 void MainWnd::OnUpdateCheatsAutomaticsaveloadcheats(CCmdUI*pCmdUI)
93 {
94 pCmdUI->SetCheck(theApp.autoSaveLoadCheatList);
95 }
97 void MainWnd::OnCheatsPauseDuringCheatSearch()
98 {
99 theApp.pauseDuringCheatSearch = !theApp.pauseDuringCheatSearch;
100 }
102 void MainWnd::OnUpdateCheatsPauseDuringCheatSearch(CCmdUI*pCmdUI)
103 {
104 pCmdUI->SetCheck(theApp.pauseDuringCheatSearch);
105 }
107 void MainWnd::OnCheatsLoadcheatlist()
108 {
109 theApp.winCheckFullscreen();
111 LPCTSTR exts[] = { ".clt", NULL };
112 CString filter = winResLoadFilter(IDS_FILTER_CHEAT_LIST);
113 CString title = winResLoadString(IDS_SELECT_CHEAT_LIST_NAME);
115 CString cheatName = winGetDestFilename(theApp.gameFilename, IDS_CHEAT_DIR, exts[0]);
116 CString cheatDir = winGetDestDir(IDS_CHEAT_DIR);
118 FileDlg dlg(this, cheatName, filter, 0, "CLT", exts, cheatDir, title, false);
120 if (dlg.DoModal() == IDOK)
121 {
122 winLoadCheatList(dlg.GetPathName());
123 }
124 }
126 void MainWnd::OnUpdateCheatsLoadcheatlist(CCmdUI*pCmdUI)
127 {
128 pCmdUI->Enable(emulating);
129 }
131 void MainWnd::OnCheatsSavecheatlist()
132 {
133 theApp.winCheckFullscreen();
135 LPCTSTR exts[] = { ".clt", NULL };
136 CString filter = winResLoadFilter(IDS_FILTER_CHEAT_LIST);
137 CString title = winResLoadString(IDS_SELECT_CHEAT_LIST_NAME);
139 CString cheatName = winGetDestFilename(theApp.gameFilename, IDS_CHEAT_DIR, exts[0]);
140 CString cheatDir = winGetDestDir(IDS_CHEAT_DIR);
142 FileDlg dlg(this, cheatName, filter, 0, "CLT", exts, cheatDir, title, true);
144 if (dlg.DoModal() == IDOK)
145 {
146 winSaveCheatList(dlg.GetPathName());
147 }
148 }
150 void MainWnd::OnUpdateCheatsSavecheatlist(CCmdUI*pCmdUI)
151 {
152 pCmdUI->Enable(emulating);
153 }
155 void MainWnd::OnCheatsDisablecheats()
156 {
157 cheatsEnabled = !cheatsEnabled;
158 }
160 void MainWnd::OnUpdateCheatsDisablecheats(CCmdUI*pCmdUI)
161 {
162 pCmdUI->SetCheck(!cheatsEnabled);
163 }