home *** CD-ROM | disk | FTP | other *** search
/ Chip 2004 July / CMCD0704.ISO / Software / Freeware / Utilitare / VisualBoyAdvance-1.7.2 / src / win32 / MainWndTools.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  2004-05-13  |  14.7 KB  |  604 lines

  1. // VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
  2. // Copyright (C) 1999-2003 Forgotten
  3. // Copyright (C) 2004 Forgotten and the VBA development team
  4.  
  5. // This program is free software; you can redistribute it and/or modify
  6. // it under the terms of the GNU General Public License as published by
  7. // the Free Software Foundation; either version 2, or(at your option)
  8. // any later version.
  9. //
  10. // This program is distributed in the hope that it will be useful,
  11. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13. // GNU General Public License for more details.
  14. //
  15. // You should have received a copy of the GNU General Public License
  16. // along with this program; if not, write to the Free Software Foundation,
  17. // Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  18.  
  19. #include "stdafx.h"
  20. #include "MainWnd.h"
  21.  
  22. #include "AccelEditor.h"
  23. #include "AVIWrite.h"
  24. #include "Disassemble.h"
  25. #include "FileDlg.h"
  26. #include "GBDisassemble.h"
  27. #include "GBMapView.h"
  28. #include "GBMemoryViewerDlg.h"
  29. #include "GBOamView.h"
  30. #include "GBPaletteView.h"
  31. #include "GBTileView.h"
  32. #include "GDBConnection.h"
  33. #include "IOViewer.h"
  34. #include "MapView.h"
  35. #include "MemoryViewerDlg.h"
  36. #include "OamView.h"
  37. #include "PaletteView.h"
  38. #include "Reg.h"
  39. #include "TileView.h"
  40. #include "WavWriter.h"
  41. #include "WinResUtil.h"
  42.  
  43. #include "../GBA.h"
  44. #include "../Globals.h"
  45.  
  46. #ifdef _DEBUG
  47. #define new DEBUG_NEW
  48. #undef THIS_FILE
  49. static char THIS_FILE[] = __FILE__;
  50. #endif
  51.  
  52. extern bool debugger;
  53. extern int emulating;
  54. extern int remoteSocket;
  55.  
  56. extern void remoteCleanUp();
  57. extern void remoteSetSockets(SOCKET, SOCKET);
  58. extern void toolsLogging();
  59.  
  60. void MainWnd::OnToolsDisassemble() 
  61. {
  62.   if(theApp.cartridgeType == 0) {
  63.     Disassemble *dlg = new Disassemble();
  64.     dlg->Create(IDD_DISASSEMBLE, this);
  65.     dlg->ShowWindow(SW_SHOW);
  66.   } else {
  67.     GBDisassemble *dlg = new GBDisassemble();
  68.     dlg->Create(IDD_GB_DISASSEMBLE, this);
  69.     dlg->ShowWindow(SW_SHOW);
  70.   }
  71. }
  72.  
  73. void MainWnd::OnUpdateToolsDisassemble(CCmdUI* pCmdUI) 
  74. {
  75.   pCmdUI->Enable(theApp.videoOption <= VIDEO_4X);
  76. }
  77.  
  78. void MainWnd::OnToolsLogging() 
  79. {
  80.   toolsLogging();
  81. }
  82.  
  83. void MainWnd::OnUpdateToolsLogging(CCmdUI* pCmdUI) 
  84. {
  85.   pCmdUI->Enable(theApp.videoOption <= VIDEO_4X);
  86. }
  87.  
  88. void MainWnd::OnToolsIoviewer() 
  89. {
  90.   IOViewer *dlg = new IOViewer;
  91.   dlg->Create(IDD_IO_VIEWER,this);
  92.   dlg->ShowWindow(SW_SHOW);
  93. }
  94.  
  95. void MainWnd::OnUpdateToolsIoviewer(CCmdUI* pCmdUI) 
  96. {
  97.   pCmdUI->Enable(theApp.videoOption <= VIDEO_4X && theApp.cartridgeType == 0);
  98. }
  99.  
  100. void MainWnd::OnToolsMapview() 
  101. {
  102.   if(theApp.cartridgeType == 0) {
  103.     MapView *dlg = new MapView;
  104.     dlg->Create(IDD_MAP_VIEW, this);
  105.     dlg->ShowWindow(SW_SHOW);
  106.   } else {
  107.     GBMapView *dlg = new GBMapView;
  108.     dlg->Create(IDD_GB_MAP_VIEW, this);
  109.     dlg->ShowWindow(SW_SHOW);
  110.   }
  111. }
  112.  
  113. void MainWnd::OnUpdateToolsMapview(CCmdUI* pCmdUI) 
  114. {
  115.   pCmdUI->Enable(theApp.videoOption <= VIDEO_4X);
  116. }
  117.  
  118. void MainWnd::OnToolsMemoryviewer() 
  119. {
  120.   if(theApp.cartridgeType == 0) {
  121.     MemoryViewerDlg *dlg = new MemoryViewerDlg;
  122.     dlg->Create(IDD_MEM_VIEWER, this);
  123.     dlg->ShowWindow(SW_SHOW);
  124.   } else {
  125.     GBMemoryViewerDlg *dlg = new GBMemoryViewerDlg;
  126.     dlg->Create(IDD_MEM_VIEWER, this);
  127.     dlg->ShowWindow(SW_SHOW);
  128.   }
  129. }
  130.  
  131. void MainWnd::OnUpdateToolsMemoryviewer(CCmdUI* pCmdUI) 
  132. {
  133.   pCmdUI->Enable(theApp.videoOption <= VIDEO_4X);
  134. }
  135.  
  136. void MainWnd::OnToolsOamviewer() 
  137. {
  138.   if(theApp.cartridgeType == 0) {
  139.     OamView *dlg = new OamView;
  140.     dlg->Create(IDD_OAM_VIEW, this);
  141.     dlg->ShowWindow(SW_SHOW);
  142.   } else {
  143.     GBOamView *dlg = new GBOamView;
  144.     dlg->Create(IDD_GB_OAM_VIEW, this);
  145.     dlg->ShowWindow(SW_SHOW);
  146.   }
  147. }
  148.  
  149. void MainWnd::OnUpdateToolsOamviewer(CCmdUI* pCmdUI) 
  150. {
  151.   pCmdUI->Enable(theApp.videoOption <= VIDEO_4X);  
  152. }
  153.  
  154. void MainWnd::OnToolsPaletteview() 
  155. {
  156.   if(theApp.cartridgeType == 0) {
  157.     PaletteView *dlg = new PaletteView;
  158.     dlg->Create(IDD_PALETTE_VIEW, this);
  159.     dlg->ShowWindow(SW_SHOW);
  160.   } else {
  161.     GBPaletteView *dlg = new GBPaletteView;
  162.     dlg->Create(IDD_GB_PALETTE_VIEW, this);
  163.     dlg->ShowWindow(SW_SHOW);
  164.   }
  165. }
  166.  
  167. void MainWnd::OnUpdateToolsPaletteview(CCmdUI* pCmdUI) 
  168. {
  169.   pCmdUI->Enable(theApp.videoOption <= VIDEO_4X);  
  170. }
  171.  
  172. void MainWnd::OnToolsTileviewer() 
  173. {
  174.   if(theApp.cartridgeType == 0) {
  175.     TileView *dlg = new TileView;
  176.     dlg->Create(IDD_TILE_VIEWER, this);
  177.     dlg->ShowWindow(SW_SHOW);
  178.   } else {
  179.     GBTileView *dlg = new GBTileView;
  180.     dlg->Create(IDD_GB_TILE_VIEWER, this);
  181.     dlg->ShowWindow(SW_SHOW);
  182.   }
  183. }
  184.  
  185. void MainWnd::OnUpdateToolsTileviewer(CCmdUI* pCmdUI) 
  186. {
  187.   pCmdUI->Enable(theApp.videoOption <= VIDEO_4X);  
  188. }
  189.  
  190. void MainWnd::OnDebugNextframe() 
  191. {
  192.   if(theApp.paused)
  193.     theApp.paused = false;
  194.   theApp.winPauseNextFrame = true;
  195. }
  196.  
  197. void MainWnd::OnToolsDebugGdb() 
  198. {
  199.   theApp.winCheckFullscreen();
  200.   GDBPortDlg dlg;
  201.  
  202.   if(dlg.DoModal()) {
  203.     GDBWaitingDlg wait(dlg.getSocket(), dlg.getPort());
  204.     if(wait.DoModal()) {
  205.       remoteSetSockets(wait.getListenSocket(), wait.getSocket());
  206.       debugger = true;
  207.       emulating = 1;
  208.       theApp.cartridgeType = 0;
  209.       theApp.filename = "\\gnu_stub";
  210.       rom = (u8 *)malloc(0x2000000);
  211.       workRAM = (u8 *)calloc(1, 0x40000);
  212.       bios = (u8 *)calloc(1,0x4000);
  213.       internalRAM = (u8 *)calloc(1,0x8000);
  214.       paletteRAM = (u8 *)calloc(1,0x400);
  215.       vram = (u8 *)calloc(1, 0x20000);
  216.       oam = (u8 *)calloc(1, 0x400);
  217.       pix = (u8 *)calloc(1, 4 * 240 * 160);
  218.       ioMem = (u8 *)calloc(1, 0x400);
  219.       
  220.       theApp.emulator = GBASystem;
  221.       
  222.       CPUInit(theApp.biosFileName, theApp.useBiosFile ? true : false);
  223.       CPUReset();    
  224.     }
  225.   }
  226. }
  227.  
  228. void MainWnd::OnUpdateToolsDebugGdb(CCmdUI* pCmdUI) 
  229. {
  230.   pCmdUI->Enable(theApp.videoOption <= VIDEO_4X && remoteSocket == -1);
  231. }
  232.  
  233. void MainWnd::OnToolsDebugLoadandwait() 
  234. {
  235.   theApp.winCheckFullscreen();
  236.   if(fileOpenSelect()) {
  237.     if(FileRun()) {
  238.       if(theApp.cartridgeType != 0) {
  239.         systemMessage(IDS_ERROR_NOT_GBA_IMAGE, "Error: not a GBA image");
  240.         OnFileClose();
  241.         return;
  242.       }
  243.       GDBPortDlg dlg;
  244.  
  245.       if(dlg.DoModal()) {
  246.         GDBWaitingDlg wait(dlg.getSocket(), dlg.getPort());
  247.         if(wait.DoModal()) {
  248.           remoteSetSockets(wait.getListenSocket(), wait.getSocket());
  249.           debugger = true;
  250.           emulating = 1;
  251.         }
  252.       }
  253.     }
  254.   }
  255. }
  256.  
  257. void MainWnd::OnUpdateToolsDebugLoadandwait(CCmdUI* pCmdUI) 
  258. {
  259.   pCmdUI->Enable(theApp.videoOption <= VIDEO_4X && remoteSocket == -1);
  260. }
  261.  
  262. void MainWnd::OnToolsDebugBreak() 
  263. {
  264.   if(armState) {
  265.     armNextPC -= 4;
  266.     reg[15].I -= 4;
  267.   } else {
  268.     armNextPC -= 2;
  269.     reg[15].I -= 2;
  270.   }
  271.   debugger = true;
  272. }
  273.  
  274. void MainWnd::OnUpdateToolsDebugBreak(CCmdUI* pCmdUI) 
  275. {
  276.   pCmdUI->Enable(theApp.videoOption <= VIDEO_4X && remoteSocket != -1);
  277. }
  278.  
  279. void MainWnd::OnToolsDebugDisconnect() 
  280. {
  281.   remoteCleanUp();
  282.   debugger = false;
  283. }
  284.  
  285. void MainWnd::OnUpdateToolsDebugDisconnect(CCmdUI* pCmdUI) 
  286. {
  287.   pCmdUI->Enable(theApp.videoOption <= VIDEO_4X && remoteSocket != -1);
  288. }
  289.  
  290. void MainWnd::OnOptionsSoundStartrecording() 
  291. {
  292.   theApp.winCheckFullscreen();
  293.   CString captureBuffer;
  294.  
  295.   CString capdir = regQueryStringValue("soundRecordDir", NULL);
  296.   
  297.   if(capdir.IsEmpty())
  298.     capdir = getDirFromFile(theApp.filename);
  299.  
  300.   CString filter = theApp.winLoadFilter(IDS_FILTER_WAV);
  301.   CString title = winResLoadString(IDS_SELECT_WAV_NAME);
  302.  
  303.   LPCTSTR exts[] = { ".WAV" };
  304.   
  305.   FileDlg dlg(this, "", filter, 1, "WAV", exts, capdir, title, true);
  306.   
  307.   if(dlg.DoModal() == IDCANCEL) {
  308.     return;
  309.   }
  310.  
  311.   captureBuffer = theApp.soundRecordName =  dlg.GetPathName();
  312.   theApp.soundRecording = true;
  313.   
  314.   if(dlg.m_ofn.nFileOffset > 0) {
  315.     captureBuffer = captureBuffer.Left(dlg.m_ofn.nFileOffset);
  316.   }
  317.  
  318.   int len = captureBuffer.GetLength();
  319.  
  320.   if(len > 3 && captureBuffer[len-1] == '\\')
  321.     captureBuffer = captureBuffer.Left(len-1);
  322.   regSetStringValue("soundRecordDir", captureBuffer);
  323. }
  324.  
  325. void MainWnd::OnUpdateOptionsSoundStartrecording(CCmdUI* pCmdUI) 
  326. {
  327.   pCmdUI->Enable(!theApp.soundRecording);
  328. }
  329.  
  330. void MainWnd::OnOptionsSoundStoprecording() 
  331. {
  332.   if(theApp.soundRecorder) {
  333.     delete theApp.soundRecorder;
  334.     theApp.soundRecorder = NULL;
  335.   }
  336.   theApp.soundRecording = false;
  337. }
  338.  
  339. void MainWnd::OnUpdateOptionsSoundStoprecording(CCmdUI* pCmdUI) 
  340. {
  341.   pCmdUI->Enable(theApp.soundRecording);
  342. }
  343.  
  344. void MainWnd::OnToolsRecordStartavirecording() 
  345. {
  346.   theApp.winCheckFullscreen();
  347.   CString captureBuffer;
  348.  
  349.   CString capdir = regQueryStringValue("aviRecordDir", NULL);
  350.   
  351.   if(capdir.IsEmpty())
  352.     capdir = getDirFromFile(theApp.filename);
  353.  
  354.   CString filter = theApp.winLoadFilter(IDS_FILTER_AVI);
  355.   CString title = winResLoadString(IDS_SELECT_AVI_NAME);
  356.  
  357.   LPCTSTR exts[] = { ".AVI" };
  358.   
  359.   FileDlg dlg(this, "", filter, 1, "AVI", exts, capdir, title, true);
  360.   
  361.   if(dlg.DoModal() == IDCANCEL) {
  362.     return;
  363.   }
  364.  
  365.   captureBuffer = theApp.soundRecordName =  dlg.GetPathName();
  366.   theApp.aviRecordName = captureBuffer;
  367.   theApp.aviRecording = true;
  368.   
  369.   if(dlg.m_ofn.nFileOffset > 0) {
  370.     captureBuffer = captureBuffer.Left(dlg.m_ofn.nFileOffset);
  371.   }
  372.  
  373.   int len = captureBuffer.GetLength();
  374.  
  375.   if(len > 3 && captureBuffer[len-1] == '\\')
  376.     captureBuffer = captureBuffer.Left(len-1);
  377.  
  378.   regSetStringValue("aviRecordDir", captureBuffer);
  379. }
  380.  
  381. void MainWnd::OnUpdateToolsRecordStartavirecording(CCmdUI* pCmdUI) 
  382. {
  383.   pCmdUI->Enable(!theApp.aviRecording);
  384. }
  385.  
  386. void MainWnd::OnToolsRecordStopavirecording() 
  387. {
  388.   if(theApp.aviRecorder != NULL) {
  389.     delete theApp.aviRecorder;
  390.     theApp.aviRecorder = NULL;
  391.     theApp.aviFrameNumber = 0;
  392.   }
  393.   theApp.aviRecording = false;
  394. }
  395.  
  396. void MainWnd::OnUpdateToolsRecordStopavirecording(CCmdUI* pCmdUI) 
  397. {
  398.   pCmdUI->Enable(theApp.aviRecording);
  399. }
  400.  
  401. void MainWnd::OnToolsRecordStartmovierecording() 
  402. {
  403.   theApp.winCheckFullscreen();
  404.   CString captureBuffer;
  405.   CString capdir = regQueryStringValue("movieRecordDir", "");
  406.   
  407.   if(capdir.IsEmpty())
  408.     capdir = getDirFromFile(theApp.filename);
  409.  
  410.   CString filter = theApp.winLoadFilter(IDS_FILTER_VMV);
  411.   CString title = winResLoadString(IDS_SELECT_MOVIE_NAME);
  412.   
  413.   LPCTSTR exts[] = { ".VMV" };
  414.  
  415.   FileDlg dlg(this, "", filter, 1, "VMV", exts, capdir, title, true);
  416.   
  417.   if(dlg.DoModal() == IDCANCEL) {
  418.     return;
  419.   }
  420.   
  421.   CString movieName = dlg.GetPathName();
  422.   captureBuffer = movieName;
  423.   
  424.   if(dlg.m_ofn.nFileOffset > 0) {
  425.     captureBuffer = captureBuffer.Left(dlg.m_ofn.nFileOffset);
  426.   }
  427.  
  428.   int len = captureBuffer.GetLength();
  429.  
  430.   if(len > 3 && captureBuffer[len-1] == '\\')
  431.     captureBuffer = captureBuffer.Left(len-1);
  432.  
  433.   regSetStringValue("movieRecordDir", captureBuffer);
  434.   
  435.   theApp.movieFile = fopen(movieName, "wb");
  436.  
  437.   if(!theApp.movieFile) {
  438.     systemMessage(IDS_CANNOT_OPEN_FILE, "Cannot open file %s", 
  439.                   (const char *)movieName);
  440.     return;
  441.   }
  442.  
  443.   int version = 1;
  444.  
  445.   fwrite(&version, 1, sizeof(int), theApp.movieFile);
  446.  
  447.   movieName = movieName.Left(movieName.GetLength()-3) + "VM0";
  448.  
  449.   if(writeSaveGame(movieName)) {
  450.     theApp.movieFrame = 0;
  451.     theApp.movieLastJoypad = 0;
  452.     theApp.movieRecording = true;
  453.     theApp.moviePlaying = false;
  454.   } else {
  455.     systemMessage(IDS_CANNOT_OPEN_FILE, "Cannot open file %s", 
  456.                   (const char *)movieName);  
  457.   }
  458. }
  459.  
  460. void MainWnd::OnUpdateToolsRecordStartmovierecording(CCmdUI* pCmdUI) 
  461. {
  462.   pCmdUI->Enable(!theApp.movieRecording);
  463. }
  464.  
  465. void MainWnd::OnToolsRecordStopmovierecording() 
  466. {
  467.   if(theApp.movieRecording) {
  468.     if(theApp.movieFile != NULL) {
  469.       // record the last joypad change so that the correct time can be
  470.       // recorded
  471.       fwrite(&theApp.movieFrame, 1, sizeof(int), theApp.movieFile);
  472.       fwrite(&theApp.movieLastJoypad, 1, sizeof(u32), theApp.movieFile);
  473.       fclose(theApp.movieFile);
  474.       theApp.movieFile = NULL;
  475.     }
  476.     theApp.movieRecording = false;
  477.     theApp.moviePlaying = false;
  478.     theApp.movieLastJoypad = 0;
  479.   }
  480. }
  481.  
  482. void MainWnd::OnUpdateToolsRecordStopmovierecording(CCmdUI* pCmdUI) 
  483. {
  484.   pCmdUI->Enable(theApp.movieRecording);
  485. }
  486.  
  487. void MainWnd::OnToolsPlayStartmovieplaying() 
  488. {
  489.   static bool moviePlayMessage = false;
  490.  
  491.   if(!moviePlayMessage) {
  492.     moviePlayMessage = true;
  493.     CString msg = winResLoadString(IDS_MOVIE_PLAY);
  494.     CString title = winResLoadString(IDS_CONFIRM_ACTION);
  495.     if(MessageBox(msg,
  496.                   title,
  497.                   MB_OKCANCEL) == IDCANCEL)
  498.       return;
  499.   }
  500.  
  501.   CString captureBuffer;
  502.   CString capdir = regQueryStringValue("movieRecordDir", "");
  503.   
  504.   if(capdir.IsEmpty())
  505.     capdir = getDirFromFile(theApp.filename);
  506.  
  507.   CString filter = theApp.winLoadFilter(IDS_FILTER_VMV);
  508.   CString title = winResLoadString(IDS_SELECT_MOVIE_NAME);
  509.  
  510.   LPCTSTR exts[] = { ".VMV" };
  511.  
  512.   FileDlg dlg(this, "", filter, 1, "VMV", exts, capdir, title, false);
  513.   
  514.   if(dlg.DoModal() == IDCANCEL) {
  515.     return;
  516.   }
  517.  
  518.   CString movieName = dlg.GetPathName();
  519.   captureBuffer = movieName;
  520.   
  521.   theApp.movieFile = fopen(movieName, "rb");
  522.  
  523.   if(!theApp.movieFile) {
  524.     systemMessage(IDS_CANNOT_OPEN_FILE, "Cannot open file %s", 
  525.                   (const char *)movieName);
  526.     return;
  527.   }
  528.   int version = 0;
  529.   fread(&version, 1, sizeof(int), theApp.movieFile);
  530.   if(version != 1) {
  531.     systemMessage(IDS_UNSUPPORTED_MOVIE_VERSION, 
  532.                   "Unsupported movie version %d.",
  533.                   version);
  534.     fclose(theApp.movieFile);
  535.     theApp.movieFile = NULL;
  536.     return;
  537.   }
  538.   movieName = movieName.Left(movieName.GetLength()-3)+"VM0";
  539.   if(loadSaveGame(movieName)) {
  540.     theApp.moviePlaying = true;
  541.     theApp.movieFrame = 0;
  542.     theApp.moviePlayFrame = 0;
  543.     theApp.movieLastJoypad = 0;
  544.     theApp.movieReadNext();
  545.   } else {
  546.     systemMessage(IDS_CANNOT_OPEN_FILE, "Cannot open file %s", 
  547.                   (const char *)movieName);
  548.   }
  549. }
  550.  
  551. void MainWnd::OnUpdateToolsPlayStartmovieplaying(CCmdUI* pCmdUI) 
  552. {
  553.   pCmdUI->Enable(!theApp.moviePlaying);
  554. }
  555.  
  556. void MainWnd::OnToolsPlayStopmovieplaying() 
  557. {
  558.   if(theApp.moviePlaying) {
  559.     if(theApp.movieFile != NULL) {
  560.       fclose(theApp.movieFile);
  561.       theApp.movieFile = NULL;
  562.     }
  563.     theApp.moviePlaying = false;
  564.     theApp.movieLastJoypad = 0;
  565.   }
  566. }
  567.  
  568. void MainWnd::OnUpdateToolsPlayStopmovieplaying(CCmdUI* pCmdUI) 
  569. {
  570.   pCmdUI->Enable(theApp.moviePlaying);
  571. }
  572.  
  573. void MainWnd::OnToolsRewind() 
  574. {
  575.   if(emulating && theApp.emulator.emuReadMemState && theApp.rewindMemory && theApp.rewindCount) {
  576.     theApp.rewindPos = --theApp.rewindPos & 7;
  577.     theApp.emulator.emuReadMemState(&theApp.rewindMemory[REWIND_SIZE*theApp.rewindPos], REWIND_SIZE);
  578.     theApp.rewindCount--;
  579.     theApp.rewindCounter = 0;
  580.   }
  581. }
  582.  
  583. void MainWnd::OnUpdateToolsRewind(CCmdUI* pCmdUI) 
  584. {
  585.   pCmdUI->Enable(theApp.rewindMemory != NULL && emulating && theApp.rewindCount);
  586. }
  587.  
  588. void MainWnd::OnToolsCustomize() 
  589. {
  590.   AccelEditor dlg;
  591.  
  592.   if(dlg.DoModal()) {
  593.     theApp.winAccelMgr = dlg.mgr;
  594.     theApp.winAccelMgr.UpdateWndTable();
  595.     theApp.winAccelMgr.Write();
  596.     theApp.winAccelMgr.UpdateMenu(theApp.menu);
  597.   }
  598. }
  599.  
  600. void MainWnd::OnUpdateToolsCustomize(CCmdUI* pCmdUI) 
  601. {
  602.   pCmdUI->Enable(theApp.videoOption != VIDEO_320x240);
  603. }
  604.