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

importing src directory
author Robert McIntyre <rlm@mit.edu>
date Sat, 03 Mar 2012 10:31:27 -0600
parents
children
line wrap: on
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/win32/MainWndCheats.cpp	Sat Mar 03 10:31:27 2012 -0600
     1.3 @@ -0,0 +1,164 @@
     1.4 +#include "stdafx.h"
     1.5 +#include "resource.h"
     1.6 +#include "MainWnd.h"
     1.7 +#include "FileDlg.h"
     1.8 +#include "GBACheatsDlg.h"
     1.9 +#include "GBCheatsDlg.h"
    1.10 +#include "Reg.h"
    1.11 +#include "WinResUtil.h"
    1.12 +#include "WinMiscUtil.h"
    1.13 +#include "VBA.h"
    1.14 +
    1.15 +#include "../gba/GBA.h"
    1.16 +#include "../gba/GBAGlobals.h"
    1.17 +#include "../gb/gbCheats.h"
    1.18 +
    1.19 +GBACheatSearch gbaDlg;
    1.20 +GBCheatSearch  gbDlg;
    1.21 +
    1.22 +void MainWnd::OnCheatsSearchforcheats()
    1.23 +{
    1.24 +	theApp.winCheckFullscreen();
    1.25 +
    1.26 +	if (theApp.modelessCheatDialogIsOpen)
    1.27 +	{
    1.28 +		gbaDlg.DestroyWindow();
    1.29 +		gbDlg.DestroyWindow();
    1.30 +		theApp.modelessCheatDialogIsOpen = false;
    1.31 +	}
    1.32 +
    1.33 +	if (systemCartridgeType == 0)
    1.34 +	{
    1.35 +		if (theApp.pauseDuringCheatSearch)
    1.36 +		{
    1.37 +			gbaDlg.DoModal();
    1.38 +		}
    1.39 +		else
    1.40 +		{
    1.41 +			if (!theApp.modelessCheatDialogIsOpen)
    1.42 +			{
    1.43 +				theApp.modelessCheatDialogIsOpen = true;
    1.44 +				gbaDlg.Create(GBACheatSearch::IDD, theApp.m_pMainWnd);
    1.45 +			}
    1.46 +		}
    1.47 +	}
    1.48 +	else
    1.49 +	{
    1.50 +		if (theApp.pauseDuringCheatSearch)
    1.51 +		{
    1.52 +			gbDlg.DoModal();
    1.53 +		}
    1.54 +		else
    1.55 +		{
    1.56 +			if (!theApp.modelessCheatDialogIsOpen)
    1.57 +			{
    1.58 +				theApp.modelessCheatDialogIsOpen = true;
    1.59 +				gbDlg.Create(GBCheatSearch::IDD, theApp.m_pMainWnd);
    1.60 +			}
    1.61 +		}
    1.62 +	}
    1.63 +}
    1.64 +
    1.65 +void MainWnd::OnUpdateCheatsSearchforcheats(CCmdUI*pCmdUI)
    1.66 +{
    1.67 +	pCmdUI->Enable(emulating);
    1.68 +}
    1.69 +
    1.70 +void MainWnd::OnCheatsCheatlist()
    1.71 +{
    1.72 +	theApp.winCheckFullscreen();
    1.73 +	if (systemCartridgeType == 0)
    1.74 +	{
    1.75 +		GBACheatList dlg;
    1.76 +		dlg.DoModal();
    1.77 +	}
    1.78 +	else
    1.79 +	{
    1.80 +		GBCheatList dlg;
    1.81 +		dlg.DoModal();
    1.82 +	}
    1.83 +}
    1.84 +
    1.85 +void MainWnd::OnUpdateCheatsCheatlist(CCmdUI*pCmdUI)
    1.86 +{
    1.87 +	pCmdUI->Enable(emulating);
    1.88 +}
    1.89 +
    1.90 +void MainWnd::OnCheatsAutomaticsaveloadcheats()
    1.91 +{
    1.92 +	theApp.autoSaveLoadCheatList = !theApp.autoSaveLoadCheatList;
    1.93 +}
    1.94 +
    1.95 +void MainWnd::OnUpdateCheatsAutomaticsaveloadcheats(CCmdUI*pCmdUI)
    1.96 +{
    1.97 +	pCmdUI->SetCheck(theApp.autoSaveLoadCheatList);
    1.98 +}
    1.99 +
   1.100 +void MainWnd::OnCheatsPauseDuringCheatSearch()
   1.101 +{
   1.102 +	theApp.pauseDuringCheatSearch = !theApp.pauseDuringCheatSearch;
   1.103 +}
   1.104 +
   1.105 +void MainWnd::OnUpdateCheatsPauseDuringCheatSearch(CCmdUI*pCmdUI)
   1.106 +{
   1.107 +	pCmdUI->SetCheck(theApp.pauseDuringCheatSearch);
   1.108 +}
   1.109 +
   1.110 +void MainWnd::OnCheatsLoadcheatlist()
   1.111 +{
   1.112 +	theApp.winCheckFullscreen();
   1.113 +
   1.114 +	LPCTSTR exts[] = { ".clt", NULL };
   1.115 +	CString filter = winResLoadFilter(IDS_FILTER_CHEAT_LIST);
   1.116 +	CString title  = winResLoadString(IDS_SELECT_CHEAT_LIST_NAME);
   1.117 +
   1.118 +	CString cheatName = winGetDestFilename(theApp.gameFilename, IDS_CHEAT_DIR, exts[0]);
   1.119 +	CString cheatDir = winGetDestDir(IDS_CHEAT_DIR);
   1.120 +
   1.121 +	FileDlg dlg(this, cheatName, filter, 0, "CLT", exts, cheatDir, title, false);
   1.122 +
   1.123 +	if (dlg.DoModal() == IDOK)
   1.124 +	{
   1.125 +		winLoadCheatList(dlg.GetPathName());
   1.126 +	}
   1.127 +}
   1.128 +
   1.129 +void MainWnd::OnUpdateCheatsLoadcheatlist(CCmdUI*pCmdUI)
   1.130 +{
   1.131 +	pCmdUI->Enable(emulating);
   1.132 +}
   1.133 +
   1.134 +void MainWnd::OnCheatsSavecheatlist()
   1.135 +{
   1.136 +	theApp.winCheckFullscreen();
   1.137 +
   1.138 +	LPCTSTR exts[] = { ".clt", NULL };
   1.139 +	CString filter = winResLoadFilter(IDS_FILTER_CHEAT_LIST);
   1.140 +	CString title  = winResLoadString(IDS_SELECT_CHEAT_LIST_NAME);
   1.141 +
   1.142 +	CString cheatName = winGetDestFilename(theApp.gameFilename, IDS_CHEAT_DIR, exts[0]);
   1.143 +	CString cheatDir = winGetDestDir(IDS_CHEAT_DIR);
   1.144 +
   1.145 +	FileDlg dlg(this, cheatName, filter, 0, "CLT", exts, cheatDir, title, true);
   1.146 +
   1.147 +	if (dlg.DoModal() == IDOK)
   1.148 +	{
   1.149 +		winSaveCheatList(dlg.GetPathName());
   1.150 +	}
   1.151 +}
   1.152 +
   1.153 +void MainWnd::OnUpdateCheatsSavecheatlist(CCmdUI*pCmdUI)
   1.154 +{
   1.155 +	pCmdUI->Enable(emulating);
   1.156 +}
   1.157 +
   1.158 +void MainWnd::OnCheatsDisablecheats()
   1.159 +{
   1.160 +	cheatsEnabled = !cheatsEnabled;
   1.161 +}
   1.162 +
   1.163 +void MainWnd::OnUpdateCheatsDisablecheats(CCmdUI*pCmdUI)
   1.164 +{
   1.165 +	pCmdUI->SetCheck(!cheatsEnabled);
   1.166 +}
   1.167 +