From baced7498df60a1ac987a03da9301a10b2a60c2e Mon Sep 17 00:00:00 2001 From: spacy51 Date: Sat, 2 Jan 2010 17:26:26 +0000 Subject: [PATCH] Add GBC BIOS selection git-svn-id: https://svn.code.sf.net/p/vbam/code/trunk@928 a31d4220-a93d-0410-bf67-fe4944624d44 --- src/win32/BIOSDialog.cpp | 29 +++++++++++++++++++++++++++++ src/win32/BIOSDialog.h | 4 ++++ src/win32/MainWndOptions.cpp | 4 ++++ src/win32/VBA.cpp | 15 +++++++++++++++ src/win32/VBA.h | 2 ++ src/win32/VBA.rc | 24 ++++++++++++++---------- src/win32/resource.h | 8 ++++++-- 7 files changed, 74 insertions(+), 12 deletions(-) diff --git a/src/win32/BIOSDialog.cpp b/src/win32/BIOSDialog.cpp index f3fc23f3..040a3c89 100644 --- a/src/win32/BIOSDialog.cpp +++ b/src/win32/BIOSDialog.cpp @@ -26,11 +26,14 @@ void BIOSDialog::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); DDX_Check(pDX, IDC_ENABLE_GB_BIOS, m_enableBIOS_GB); + DDX_Check(pDX, IDC_ENABLE_GBC_BIOS, m_enableBIOS_GBC); DDX_Check(pDX, IDC_ENABLE_GBA_BIOS, m_enableBIOS_GBA); DDX_Check(pDX, IDC_SKIP_BOOT_LOGO, m_skipLogo); DDX_Text(pDX, IDC_GB_BIOS_PATH, m_pathGB); + DDX_Text(pDX, IDC_GBC_BIOS_PATH, m_pathGBC); DDX_Text(pDX, IDC_GBA_BIOS_PATH, m_pathGBA); DDX_Control(pDX, IDC_GB_BIOS_PATH, m_editGB); + DDX_Control(pDX, IDC_GBC_BIOS_PATH, m_editGBC); DDX_Control(pDX, IDC_GBA_BIOS_PATH, m_editGBA); if( pDX->m_bSaveAndValidate == TRUE ) { @@ -38,6 +41,9 @@ void BIOSDialog::DoDataExchange(CDataExchange* pDX) if( !fileExists( m_pathGBA ) ) { m_enableBIOS_GBA = FALSE; } + if( !fileExists( m_pathGBC ) ) { + m_enableBIOS_GBC = FALSE; + } if( !fileExists( m_pathGB ) ) { m_enableBIOS_GB = FALSE; } @@ -47,6 +53,7 @@ void BIOSDialog::DoDataExchange(CDataExchange* pDX) BEGIN_MESSAGE_MAP(BIOSDialog, CDialog) ON_BN_CLICKED(IDC_SELECT_GB_BIOS_PATH, &BIOSDialog::OnBnClickedSelectGbBiosPath) + ON_BN_CLICKED(IDC_SELECT_GBC_BIOS_PATH, &BIOSDialog::OnBnClickedSelectGbcBiosPath) ON_BN_CLICKED(IDC_SELECT_GBA_BIOS_PATH, &BIOSDialog::OnBnClickedSelectGbaBiosPath) END_MESSAGE_MAP() @@ -75,6 +82,28 @@ void BIOSDialog::OnBnClickedSelectGbBiosPath() } } +void BIOSDialog::OnBnClickedSelectGbcBiosPath() +{ + CString current; + m_editGBC.GetWindowText( current ); + if( !fileExists( current ) ) { + current = _T(""); + } + + CFileDialog dlg( + TRUE, + NULL, + current, + OFN_DONTADDTORECENT | OFN_FILEMUSTEXIST, + _T("BIOS Files (*.bin;*.gbc)|*.bin;*.gbc|All Files (*.*)|*.*||"), + this, + 0 ); + + if( IDOK == dlg.DoModal() ) { + m_editGBC.SetWindowText( dlg.GetPathName() ); + } +} + void BIOSDialog::OnBnClickedSelectGbaBiosPath() { CString current; diff --git a/src/win32/BIOSDialog.h b/src/win32/BIOSDialog.h index 704cf1e5..ea3ced58 100644 --- a/src/win32/BIOSDialog.h +++ b/src/win32/BIOSDialog.h @@ -20,14 +20,18 @@ protected: DECLARE_MESSAGE_MAP() private: CEdit m_editGB; + CEdit m_editGBC; CEdit m_editGBA; bool fileExists(CString& file); afx_msg void OnBnClickedSelectGbBiosPath(); + afx_msg void OnBnClickedSelectGbcBiosPath(); afx_msg void OnBnClickedSelectGbaBiosPath(); public: BOOL m_enableBIOS_GB; + BOOL m_enableBIOS_GBC; BOOL m_enableBIOS_GBA; BOOL m_skipLogo; CString m_pathGB; + CString m_pathGBC; CString m_pathGBA; }; diff --git a/src/win32/MainWndOptions.cpp b/src/win32/MainWndOptions.cpp index 167db44d..b30a0b45 100644 --- a/src/win32/MainWndOptions.cpp +++ b/src/win32/MainWndOptions.cpp @@ -1774,16 +1774,20 @@ void MainWnd::OnEmulatorBiosfiles() { BIOSDialog dlg; dlg.m_enableBIOS_GBA = theApp.useBiosFileGBA ? TRUE : FALSE; + dlg.m_enableBIOS_GBC = theApp.useBiosFileGBC ? TRUE : FALSE; dlg.m_enableBIOS_GB = theApp.useBiosFileGB ? TRUE : FALSE; dlg.m_skipLogo = theApp.skipBiosFile ? TRUE : FALSE; dlg.m_pathGBA = theApp.biosFileNameGBA; + dlg.m_pathGBC = theApp.biosFileNameGBC; dlg.m_pathGB = theApp.biosFileNameGB; if( IDOK == dlg.DoModal() ) { theApp.useBiosFileGBA = dlg.m_enableBIOS_GBA == TRUE; + theApp.useBiosFileGBC = dlg.m_enableBIOS_GBC == TRUE; theApp.useBiosFileGB = dlg.m_enableBIOS_GB == TRUE; theApp.skipBiosFile = dlg.m_skipLogo == TRUE; theApp.biosFileNameGBA = dlg.m_pathGBA; + theApp.biosFileNameGBC = dlg.m_pathGBC; theApp.biosFileNameGB = dlg.m_pathGB; } } diff --git a/src/win32/VBA.cpp b/src/win32/VBA.cpp index 5ea54cbd..d4d8a092 100644 --- a/src/win32/VBA.cpp +++ b/src/win32/VBA.cpp @@ -232,9 +232,11 @@ VBA::VBA() cartridgeType = IMAGE_GBA; soundInitialized = false; useBiosFileGBA = false; + useBiosFileGBC = false; useBiosFileGB = false; skipBiosFile = false; biosFileNameGBA = _T(""); + biosFileNameGBC = _T(""); biosFileNameGB = _T(""); active = true; paused = false; @@ -1410,6 +1412,8 @@ void VBA::loadSettings() useBiosFileGBA = ( regQueryDwordValue("useBiosGBA", 0) == 1 ) ? true : false; + useBiosFileGBC = ( regQueryDwordValue("useBiosGBC", 0) == 1 ) ? true : false; + useBiosFileGB = ( regQueryDwordValue("useBiosGB", 0) == 1 ) ? true : false; skipBiosFile = regQueryDwordValue("skipBios", 0) ? true : false; @@ -1420,6 +1424,12 @@ void VBA::loadSettings() biosFileNameGBA = buffer; } + buffer = regQueryStringValue("biosFileGBC", ""); + + if(!buffer.IsEmpty()) { + biosFileNameGBC = buffer; + } + buffer = regQueryStringValue("biosFileGB", ""); if(!buffer.IsEmpty()) { @@ -2432,6 +2442,8 @@ void VBA::saveSettings() regSetDwordValue("useBiosGBA", useBiosFileGBA); + regSetDwordValue("useBiosGBC", useBiosFileGBC); + regSetDwordValue("useBiosGB", useBiosFileGB); regSetDwordValue("skipBios", skipBiosFile); @@ -2439,6 +2451,9 @@ void VBA::saveSettings() if(!biosFileNameGBA.IsEmpty()) regSetStringValue("biosFileGBA", biosFileNameGBA); + if(!biosFileNameGBC.IsEmpty()) + regSetStringValue("biosFileGBC", biosFileNameGBC); + if(!biosFileNameGB.IsEmpty()) regSetStringValue("biosFileGB", biosFileNameGB); diff --git a/src/win32/VBA.h b/src/win32/VBA.h index b73a481f..0f8c3a8e 100644 --- a/src/win32/VBA.h +++ b/src/win32/VBA.h @@ -95,9 +95,11 @@ class VBA : public CWinApp IMAGE_TYPE cartridgeType; bool soundInitialized; bool useBiosFileGBA; + bool useBiosFileGBC; bool useBiosFileGB; bool skipBiosFile; CString biosFileNameGBA; + CString biosFileNameGBC; CString biosFileNameGB; bool active; bool paused; diff --git a/src/win32/VBA.rc b/src/win32/VBA.rc index 401f87a9..d0098c1e 100644 --- a/src/win32/VBA.rc +++ b/src/win32/VBA.rc @@ -1131,23 +1131,27 @@ BEGIN EDITTEXT IDC_COMMENT,84,24,180,12,ES_AUTOHSCROLL END -IDD_BIOS DIALOGEX 0, 0, 220, 126 +IDD_BIOS DIALOGEX 0, 0, 220, 159 STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "BIOS Files" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN - DEFPUSHBUTTON "OK",IDOK,84,102,60,18 - PUSHBUTTON "Cancel",IDCANCEL,150,102,60,18 + DEFPUSHBUTTON "OK",IDOK,84,132,60,18 + PUSHBUTTON "Cancel",IDCANCEL,150,132,60,18 GROUPBOX "Game Boy mono",IDC_STATIC,6,6,210,30 - GROUPBOX "Game Boy Advance",IDC_STATIC,6,48,210,30 + GROUPBOX "Game Boy Advance",IDC_STATIC,6,78,210,30 EDITTEXT IDC_GB_BIOS_PATH,12,18,180,12,ES_AUTOHSCROLL - EDITTEXT IDC_GBA_BIOS_PATH,12,60,180,12,ES_AUTOHSCROLL - GROUPBOX "Options",IDC_STATIC,6,90,72,30 - CONTROL "Skip boot logo",IDC_SKIP_BOOT_LOGO,"Button",BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP,12,102,60,12 + EDITTEXT IDC_GBA_BIOS_PATH,12,90,180,12,ES_AUTOHSCROLL + GROUPBOX "Options",IDC_STATIC,6,121,72,30 + CONTROL "Skip boot logo",IDC_SKIP_BOOT_LOGO,"Button",BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP,12,132,60,12 CONTROL "Enable",IDC_ENABLE_GB_BIOS,"Button",BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP,174,6,36,8 - CONTROL "Enable",IDC_ENABLE_GBA_BIOS,"Button",BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP,174,48,36,8 + CONTROL "Enable",IDC_ENABLE_GBA_BIOS,"Button",BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP,174,78,36,8 PUSHBUTTON "...",IDC_SELECT_GB_BIOS_PATH,192,18,18,12 - PUSHBUTTON "...",IDC_SELECT_GBA_BIOS_PATH,192,60,18,12 + PUSHBUTTON "...",IDC_SELECT_GBA_BIOS_PATH,192,90,18,12 + GROUPBOX "Game Boy Color",IDC_STATIC,6,42,210,30 + EDITTEXT IDC_GBC_BIOS_PATH,12,53,180,12,ES_AUTOHSCROLL + CONTROL "Enable",IDC_ENABLE_GBC_BIOS,"Button",BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP,174,42,36,8 + PUSHBUTTON "...",IDC_SELECT_GBC_BIOS_PATH,192,53,18,12 END IDD_FULLSCREEN DIALOGEX 0, 0, 167, 96 @@ -1541,7 +1545,7 @@ BEGIN LEFTMARGIN, 7 RIGHTMARGIN, 213 TOPMARGIN, 7 - BOTTOMMARGIN, 119 + BOTTOMMARGIN, 152 END IDD_FULLSCREEN, DIALOG diff --git a/src/win32/resource.h b/src/win32/resource.h index 1753ddd5..fffe9322 100644 --- a/src/win32/resource.h +++ b/src/win32/resource.h @@ -536,8 +536,12 @@ #define IDC_SELECT_GB_BIOS_PATH 1277 #define IDC_SELECT_GBA_BIOS_PATH 1278 #define IDC_CLEAR_ALL 1278 +#define IDC_GBC_BIOS_PATH 1279 #define IDC_COMBO_RESOLUTION 1280 +#define IDC_ENABLE_GBC_BIOS 1280 #define IDC_COMBO_COLOR_DEPTH 1281 +#define IDC_SELECT_GB_BIOS_PATH2 1281 +#define IDC_SELECT_GBC_BIOS_PATH 1281 #define IDC_COMBO_REFRESH_RATE 1282 #define IDC_COMBO_DEVICE 1283 #define IDC_CHECK1 1284 @@ -587,8 +591,6 @@ #define ID_OPTIONS_VIDEO_X4 40013 #define ID_OPTIONS_VIDEO_X5 40014 #define ID_OPTIONS_VIDEO_X6 40015 -#define ID_FILE_PAUSE 40373 -#define ID_OPTIONS_EMULATOR_DIRECTORIES 40374 #define ID_OPTIONS_JOYPAD 40016 #define ID_OPTIONS_EMULATOR_SYNCHRONIZE 40017 #define ID_FILE_RESET 40018 @@ -872,6 +874,8 @@ #define ID_OPTIONS_VIDEO_LAYERS_RESET 40367 #define ID_LOADGAME_DONOTCHANGECHEATLIST 40371 #define ID_OPTIONS_EMULATOR_SAVETYPE_DETECTNOW 40372 +#define ID_FILE_PAUSE 40373 +#define ID_OPTIONS_EMULATOR_DIRECTORIES 40374 // Next default values for new objects //