diff --git a/src/drivers/win/res.rc b/src/drivers/win/res.rc index 0b95d93a..31596cc4 100644 Binary files a/src/drivers/win/res.rc and b/src/drivers/win/res.rc differ diff --git a/src/drivers/win/resource.h b/src/drivers/win/resource.h index 2255f0f7..466b5fd6 100644 --- a/src/drivers/win/resource.h +++ b/src/drivers/win/resource.h @@ -12,12 +12,14 @@ #define EDIT_CHEATS 100 #define MENU_CLOSE_FILE 101 #define IDI_ICON1 101 +#define CB_DISABLE_SPEED_THROTTLING 101 #define IDI_ICON2 102 #define MENU_RECENT_FILES 102 #define CB_LOAD_FILE_OPEN 102 #define CB_AUTO_HIDE_MENU 104 #define COMBO_PAD1 104 #define COMBO_PAD2 105 +#define CB_SET_HIGH_PRIORITY 105 #define BTN_PORT1 106 #define BTN_PORT2 107 #define MENU_SAVE_STATE 110 diff --git a/src/drivers/win/timing.cpp b/src/drivers/win/timing.cpp index e874ac81..502a4dfd 100644 --- a/src/drivers/win/timing.cpp +++ b/src/drivers/win/timing.cpp @@ -1,54 +1,79 @@ #include "common.h" #include "main.h" +#include "gui.h" +#include "resource.h" + +/** +* This function is called when the dialog closes. +* +* @param hwndDlg Handle of the timing dialog. +**/ +void CloseTimingDialog(HWND hwndDlg) +{ + if(IsDlgButtonChecked(hwndDlg, CB_SET_HIGH_PRIORITY) == BST_CHECKED) + { + eoptions |= EO_HIGHPRIO; + } + else + { + eoptions &= ~EO_HIGHPRIO; + } + + if(IsDlgButtonChecked(hwndDlg, CB_DISABLE_SPEED_THROTTLING)==BST_CHECKED) + { + eoptions |= EO_NOTHROTTLE; + } + else + { + eoptions &= ~EO_NOTHROTTLE; + } + + EndDialog(hwndDlg, 0); +} /** * Callback function of the Timing configuration dialog. **/ BOOL CALLBACK TimingConCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { - int x; + switch(uMsg) + { + case WM_INITDIALOG: - switch(uMsg) { - case WM_INITDIALOG: - if(eoptions&EO_HIGHPRIO) - CheckDlgButton(hwndDlg,105,BST_CHECKED); - if(eoptions&EO_NOTHROTTLE) - CheckDlgButton(hwndDlg,101,BST_CHECKED); - for(x=0;x<10;x++) - { - char buf[8]; - sprintf(buf,"%d",x); - SendDlgItemMessage(hwndDlg,110,CB_ADDSTRING,0,(LPARAM)(LPSTR)buf); - SendDlgItemMessage(hwndDlg,111,CB_ADDSTRING,0,(LPARAM)(LPSTR)buf); - } - SendDlgItemMessage(hwndDlg,110,CB_SETCURSEL,maxconbskip,(LPARAM)(LPSTR)0); - SendDlgItemMessage(hwndDlg,111,CB_SETCURSEL,ffbskip,(LPARAM)(LPSTR)0); - break; - case WM_CLOSE: - case WM_QUIT: goto gornk; - case WM_COMMAND: - if(!(wParam>>16)) - switch(wParam&0xFFFF) - { - case 1: - gornk: - if(IsDlgButtonChecked(hwndDlg,105)==BST_CHECKED) - eoptions|=EO_HIGHPRIO; - else - eoptions&=~EO_HIGHPRIO; + // Update controls to the current settings. + if(eoptions & EO_HIGHPRIO) + { + CheckDlgButton(hwndDlg, CB_SET_HIGH_PRIORITY, BST_CHECKED); + } - if(IsDlgButtonChecked(hwndDlg,101)==BST_CHECKED) - eoptions|=EO_NOTHROTTLE; - else - eoptions&=~EO_NOTHROTTLE; + if(eoptions & EO_NOTHROTTLE) + { + CheckDlgButton(hwndDlg, CB_DISABLE_SPEED_THROTTLING, BST_CHECKED); + } - maxconbskip=SendDlgItemMessage(hwndDlg,110,CB_GETCURSEL,0,(LPARAM)(LPSTR)0); - ffbskip=SendDlgItemMessage(hwndDlg,111,CB_GETCURSEL,0,(LPARAM)(LPSTR)0); - EndDialog(hwndDlg,0); - break; - } - } - return 0; + CenterWindowOnScreen(hwndDlg); + + break; + + case WM_CLOSE: + case WM_QUIT: + CloseTimingDialog(hwndDlg); + break; + + case WM_COMMAND: + + if(!(wParam >> 16)) + { + switch(wParam & 0xFFFF) + { + case 1: + CloseTimingDialog(hwndDlg); + break; + } + } + } + + return 0; } void DoTimingConfigFix()