annotate src/win32/MainWndCheats.cpp @ 8:08a8e09ca414

add files required by automake
author Robert McIntyre <rlm@mit.edu>
date Sat, 03 Mar 2012 10:54:39 -0600
parents f9f4f1b99eed
children
rev   line source
rlm@1 1 #include "stdafx.h"
rlm@1 2 #include "resource.h"
rlm@1 3 #include "MainWnd.h"
rlm@1 4 #include "FileDlg.h"
rlm@1 5 #include "GBACheatsDlg.h"
rlm@1 6 #include "GBCheatsDlg.h"
rlm@1 7 #include "Reg.h"
rlm@1 8 #include "WinResUtil.h"
rlm@1 9 #include "WinMiscUtil.h"
rlm@1 10 #include "VBA.h"
rlm@1 11
rlm@1 12 #include "../gba/GBA.h"
rlm@1 13 #include "../gba/GBAGlobals.h"
rlm@1 14 #include "../gb/gbCheats.h"
rlm@1 15
rlm@1 16 GBACheatSearch gbaDlg;
rlm@1 17 GBCheatSearch gbDlg;
rlm@1 18
rlm@1 19 void MainWnd::OnCheatsSearchforcheats()
rlm@1 20 {
rlm@1 21 theApp.winCheckFullscreen();
rlm@1 22
rlm@1 23 if (theApp.modelessCheatDialogIsOpen)
rlm@1 24 {
rlm@1 25 gbaDlg.DestroyWindow();
rlm@1 26 gbDlg.DestroyWindow();
rlm@1 27 theApp.modelessCheatDialogIsOpen = false;
rlm@1 28 }
rlm@1 29
rlm@1 30 if (systemCartridgeType == 0)
rlm@1 31 {
rlm@1 32 if (theApp.pauseDuringCheatSearch)
rlm@1 33 {
rlm@1 34 gbaDlg.DoModal();
rlm@1 35 }
rlm@1 36 else
rlm@1 37 {
rlm@1 38 if (!theApp.modelessCheatDialogIsOpen)
rlm@1 39 {
rlm@1 40 theApp.modelessCheatDialogIsOpen = true;
rlm@1 41 gbaDlg.Create(GBACheatSearch::IDD, theApp.m_pMainWnd);
rlm@1 42 }
rlm@1 43 }
rlm@1 44 }
rlm@1 45 else
rlm@1 46 {
rlm@1 47 if (theApp.pauseDuringCheatSearch)
rlm@1 48 {
rlm@1 49 gbDlg.DoModal();
rlm@1 50 }
rlm@1 51 else
rlm@1 52 {
rlm@1 53 if (!theApp.modelessCheatDialogIsOpen)
rlm@1 54 {
rlm@1 55 theApp.modelessCheatDialogIsOpen = true;
rlm@1 56 gbDlg.Create(GBCheatSearch::IDD, theApp.m_pMainWnd);
rlm@1 57 }
rlm@1 58 }
rlm@1 59 }
rlm@1 60 }
rlm@1 61
rlm@1 62 void MainWnd::OnUpdateCheatsSearchforcheats(CCmdUI*pCmdUI)
rlm@1 63 {
rlm@1 64 pCmdUI->Enable(emulating);
rlm@1 65 }
rlm@1 66
rlm@1 67 void MainWnd::OnCheatsCheatlist()
rlm@1 68 {
rlm@1 69 theApp.winCheckFullscreen();
rlm@1 70 if (systemCartridgeType == 0)
rlm@1 71 {
rlm@1 72 GBACheatList dlg;
rlm@1 73 dlg.DoModal();
rlm@1 74 }
rlm@1 75 else
rlm@1 76 {
rlm@1 77 GBCheatList dlg;
rlm@1 78 dlg.DoModal();
rlm@1 79 }
rlm@1 80 }
rlm@1 81
rlm@1 82 void MainWnd::OnUpdateCheatsCheatlist(CCmdUI*pCmdUI)
rlm@1 83 {
rlm@1 84 pCmdUI->Enable(emulating);
rlm@1 85 }
rlm@1 86
rlm@1 87 void MainWnd::OnCheatsAutomaticsaveloadcheats()
rlm@1 88 {
rlm@1 89 theApp.autoSaveLoadCheatList = !theApp.autoSaveLoadCheatList;
rlm@1 90 }
rlm@1 91
rlm@1 92 void MainWnd::OnUpdateCheatsAutomaticsaveloadcheats(CCmdUI*pCmdUI)
rlm@1 93 {
rlm@1 94 pCmdUI->SetCheck(theApp.autoSaveLoadCheatList);
rlm@1 95 }
rlm@1 96
rlm@1 97 void MainWnd::OnCheatsPauseDuringCheatSearch()
rlm@1 98 {
rlm@1 99 theApp.pauseDuringCheatSearch = !theApp.pauseDuringCheatSearch;
rlm@1 100 }
rlm@1 101
rlm@1 102 void MainWnd::OnUpdateCheatsPauseDuringCheatSearch(CCmdUI*pCmdUI)
rlm@1 103 {
rlm@1 104 pCmdUI->SetCheck(theApp.pauseDuringCheatSearch);
rlm@1 105 }
rlm@1 106
rlm@1 107 void MainWnd::OnCheatsLoadcheatlist()
rlm@1 108 {
rlm@1 109 theApp.winCheckFullscreen();
rlm@1 110
rlm@1 111 LPCTSTR exts[] = { ".clt", NULL };
rlm@1 112 CString filter = winResLoadFilter(IDS_FILTER_CHEAT_LIST);
rlm@1 113 CString title = winResLoadString(IDS_SELECT_CHEAT_LIST_NAME);
rlm@1 114
rlm@1 115 CString cheatName = winGetDestFilename(theApp.gameFilename, IDS_CHEAT_DIR, exts[0]);
rlm@1 116 CString cheatDir = winGetDestDir(IDS_CHEAT_DIR);
rlm@1 117
rlm@1 118 FileDlg dlg(this, cheatName, filter, 0, "CLT", exts, cheatDir, title, false);
rlm@1 119
rlm@1 120 if (dlg.DoModal() == IDOK)
rlm@1 121 {
rlm@1 122 winLoadCheatList(dlg.GetPathName());
rlm@1 123 }
rlm@1 124 }
rlm@1 125
rlm@1 126 void MainWnd::OnUpdateCheatsLoadcheatlist(CCmdUI*pCmdUI)
rlm@1 127 {
rlm@1 128 pCmdUI->Enable(emulating);
rlm@1 129 }
rlm@1 130
rlm@1 131 void MainWnd::OnCheatsSavecheatlist()
rlm@1 132 {
rlm@1 133 theApp.winCheckFullscreen();
rlm@1 134
rlm@1 135 LPCTSTR exts[] = { ".clt", NULL };
rlm@1 136 CString filter = winResLoadFilter(IDS_FILTER_CHEAT_LIST);
rlm@1 137 CString title = winResLoadString(IDS_SELECT_CHEAT_LIST_NAME);
rlm@1 138
rlm@1 139 CString cheatName = winGetDestFilename(theApp.gameFilename, IDS_CHEAT_DIR, exts[0]);
rlm@1 140 CString cheatDir = winGetDestDir(IDS_CHEAT_DIR);
rlm@1 141
rlm@1 142 FileDlg dlg(this, cheatName, filter, 0, "CLT", exts, cheatDir, title, true);
rlm@1 143
rlm@1 144 if (dlg.DoModal() == IDOK)
rlm@1 145 {
rlm@1 146 winSaveCheatList(dlg.GetPathName());
rlm@1 147 }
rlm@1 148 }
rlm@1 149
rlm@1 150 void MainWnd::OnUpdateCheatsSavecheatlist(CCmdUI*pCmdUI)
rlm@1 151 {
rlm@1 152 pCmdUI->Enable(emulating);
rlm@1 153 }
rlm@1 154
rlm@1 155 void MainWnd::OnCheatsDisablecheats()
rlm@1 156 {
rlm@1 157 cheatsEnabled = !cheatsEnabled;
rlm@1 158 }
rlm@1 159
rlm@1 160 void MainWnd::OnUpdateCheatsDisablecheats(CCmdUI*pCmdUI)
rlm@1 161 {
rlm@1 162 pCmdUI->SetCheck(!cheatsEnabled);
rlm@1 163 }
rlm@1 164