From cdadc4875d568a22722745fdf33f59521e30616f Mon Sep 17 00:00:00 2001 From: qfox Date: Tue, 22 Jul 2008 22:27:42 +0000 Subject: [PATCH] Removes some printf's that were in place for every frame... --- src/drivers/win/basicbot.cpp | 6 ++++-- src/drivers/win/basicbot2.cpp | 18 ++++++++++++------ src/drivers/win/res.rc | 16 ++++++++-------- src/drivers/win/resource.h | 6 ++++-- 4 files changed, 28 insertions(+), 18 deletions(-) diff --git a/src/drivers/win/basicbot.cpp b/src/drivers/win/basicbot.cpp index 88730266..f1d6776d 100644 --- a/src/drivers/win/basicbot.cpp +++ b/src/drivers/win/basicbot.cpp @@ -2620,8 +2620,10 @@ void CrashWindow() delete Formula[i]; delete Bytecode[i]; } - DestroyWindow(hwndBasicBot); - hwndBasicBot=0; + if (hwndBasicBot) { + DestroyWindow(hwndBasicBot); + hwndBasicBot=0; + } } /** * Update the text on this button. Called from input, when this state changes. diff --git a/src/drivers/win/basicbot2.cpp b/src/drivers/win/basicbot2.cpp index 3a390000..92a877ca 100644 --- a/src/drivers/win/basicbot2.cpp +++ b/src/drivers/win/basicbot2.cpp @@ -6,13 +6,15 @@ // Static variables and functions are only used in this file static HWND hwndBasicBot = 0; // GUI handle +// GUI values static char * inputStrings[16]; // from gui static int inputNumbers[16]; // temp: the values static char * romString; static char * commentString; static char * scoreString[3][2]; // score[n][title/value] -// put all the inputs into an array for easy iterative access (indices are synced with inputStrings) +// put all the inputs into an array for easy iterative access +// (indices are synced with the order of BotInput[1] inputs) static int inputs[] = { BOT_TF_A_1, BOT_TF_B_1, @@ -48,10 +50,12 @@ void BotCreateBasicBot() { SetMenu(hwndBasicBot, hmenu); // initialize the random generator srand( (unsigned)time( NULL ) ); + // set all inputs to 0 + GetAllInputs(); } FCEU_SetBotMode(BOTMODE_NEWBOT); } -static void BotCloseWindow() { +static void BotCloseBasicBot() { if (hwndBasicBot) { DestroyWindow(hwndBasicBot); hwndBasicBot = 0; @@ -83,7 +87,7 @@ static BOOL CALLBACK WindowCallback(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPAR case WM_CLOSE: case WM_QUIT: { - BotCloseWindow(); + BotCloseBasicBot(); break; } case WM_COMMAND: @@ -107,6 +111,11 @@ static BOOL CALLBACK WindowCallback(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPAR { break; } + case BOT_MENU_CLOSE: + { + BotCloseBasicBot(); + break; + } } break; } @@ -123,9 +132,7 @@ static BOOL CALLBACK WindowCallback(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPAR // Called from main emulator loop void BasicBotGetInput() { - printf("yes?"); if (FCEU_BotMode() != BOTMODE_NEWBOT) { - printf(" no...\n"); return; } BotInput[0] = 1; // number of frames on the buffer (starts at BotInput[1]) @@ -149,7 +156,6 @@ void BasicBotGetInput() { BotInput[1] |= 1 << i; } } - printf(" yes! %d\n", BotInput[1]); } diff --git a/src/drivers/win/res.rc b/src/drivers/win/res.rc index 44d42c4c..aac78593 100644 --- a/src/drivers/win/res.rc +++ b/src/drivers/win/res.rc @@ -1479,7 +1479,7 @@ BEGIN LTEXT "(Hex)",IDC_STATIC,226,34,19,8 END -BASICBOT2 DIALOGEX 0, 0, 335, 222 +BASICBOT2 DIALOGEX 0, 0, 335, 316 STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU CAPTION "Dialog" FONT 8, "MS Shell Dlg", 400, 0, 0x1 @@ -1686,7 +1686,7 @@ BEGIN VERTGUIDE, 325 VERTGUIDE, 331 TOPMARGIN, 5 - BOTTOMMARGIN, 212 + BOTTOMMARGIN, 306 HORZGUIDE, 19 HORZGUIDE, 31 HORZGUIDE, 44 @@ -1828,13 +1828,13 @@ BASICBOTMENU MENU BEGIN POPUP "File" BEGIN - MENUITEM "Clear", ID_FILE_CLEAR - MENUITEM "Load", ID_FILE_LOAD - MENUITEM "Save", ID_FILE_SAVE40223 - MENUITEM "Close", ID_FILE_CLOSE40218 + MENUITEM "Clear", ID_FILE_CLEAR, INACTIVE + MENUITEM "Load", ID_FILE_LOAD, INACTIVE + MENUITEM "Save", ID_FILE_SAVE40223, INACTIVE + MENUITEM "Close", BOT_MENU_CLOSE END - MENUITEM "Play Best", 0 - MENUITEM "Reset", 0 + MENUITEM "Play Best", ID_PLAYBEST, INACTIVE + MENUITEM "Reset", ID_RESET, INACTIVE POPUP "Mode" BEGIN MENUITEM "Simple", ID_MODE_SIMPLE, CHECKED diff --git a/src/drivers/win/resource.h b/src/drivers/win/resource.h index 7627d8d0..293b15d3 100644 --- a/src/drivers/win/resource.h +++ b/src/drivers/win/resource.h @@ -488,7 +488,6 @@ #define BOT_TF_SCORE2_DESC 1181 #define BOT_TF_SCORE2_VALUE 1182 #define BOT_TF_SCORE3_DESC 1183 -#define IDC_EDIT24 1184 #define BOT_TF_SCORE3_VALUE 1184 #define MENU_NETWORK 40040 #define MENU_PALETTE 40041 @@ -645,6 +644,9 @@ #define ID_FILE_SAVE40223 40223 #define ID_MODE_SIMPLE 40224 #define ID_MODE_ADVANCED 40225 +#define ID_PLAYBEST 40226 +#define ID_RESET 40227 +#define BOT_MENU_CLOSE 40228 #define MW_ValueLabel2 65423 #define MW_ValueLabel1 65426 #define GUI_BOT_DEBUG 65436 @@ -655,7 +657,7 @@ #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 123 -#define _APS_NEXT_COMMAND_VALUE 40226 +#define _APS_NEXT_COMMAND_VALUE 40229 #define _APS_NEXT_CONTROL_VALUE 1175 #define _APS_NEXT_SYMED_VALUE 101 #endif