From 4a133e99f3246a6d49f9553fcbc8231a3fd84d8b Mon Sep 17 00:00:00 2001 From: OBattler Date: Sun, 13 Nov 2016 06:19:19 +0100 Subject: [PATCH] Bugfixes related to the SCSI CD-ROM menu item; Added a menu item to enable/disable the SCSI controller. --- src/pc.rc | 5 +++-- src/resources.h | 3 ++- src/win.c | 37 +++++++++++++++++++++++++++---------- 3 files changed, 32 insertions(+), 13 deletions(-) diff --git a/src/pc.rc b/src/pc.rc index 0fcea2214..308044666 100644 --- a/src/pc.rc +++ b/src/pc.rc @@ -27,14 +27,15 @@ BEGIN MENUITEM "E&ject drive B:", IDM_EJECT_B MENUITEM SEPARATOR MENUITEM "&Configure hard discs...",IDM_HDCONF - POPUP "&CD-ROM" + POPUP "C&D-ROM" BEGIN - MENUITEM "&Disabled", IDM_CDROM_DISABLED + MENUITEM "&Enabled", IDM_CDROM_ENABLED MENUITEM "&SCSI", IDM_CDROM_SCSI MENUITEM SEPARATOR MENUITEM "&Empty",IDM_CDROM_EMPTY MENUITEM "&ISO...",IDM_CDROM_ISO END + MENUITEM "&SCSI controller enabled",IDM_SCSI_ENABLED END POPUP "&Settings" BEGIN diff --git a/src/resources.h b/src/resources.h index a19c28e2c..9fcc9850c 100644 --- a/src/resources.h +++ b/src/resources.h @@ -29,8 +29,9 @@ #define IDM_CDROM_ISO 40100 #define IDM_CDROM_EMPTY 40200 #define IDM_CDROM_REAL 40200 -#define IDM_CDROM_DISABLED 40300 +#define IDM_CDROM_ENABLED 40300 #define IDM_CDROM_SCSI 40400 +#define IDM_SCSI_ENABLED 40500 #define IDC_COMBO1 1000 #define IDC_COMBOVID 1001 diff --git a/src/win.c b/src/win.c index 6b3ad8edb..cfd8565c2 100644 --- a/src/win.c +++ b/src/win.c @@ -321,8 +321,8 @@ static void initmenu(void) int c; HMENU m; char s[32]; - m=GetSubMenu(menu,1); /*Disc*/ - m=GetSubMenu(m,9); /*CD-ROM*/ + m=GetSubMenu(menu,2); /*Settings*/ + m=GetSubMenu(m,5); /*CD-ROM*/ /* Loop through each Windows drive letter and test to see if it's a CDROM */ @@ -619,12 +619,15 @@ int WINAPI WinMain (HINSTANCE hThisInstance, // pclog("Checking CD-ROM menu item...\n"); /* Note by Kiririn: I've redone this since the CD-ROM can be disabled but still have something inside it. */ - if (!cdrom_enabled) - CheckMenuItem(menu, IDM_CDROM_DISABLED, MF_CHECKED); + if (cdrom_enabled) + CheckMenuItem(menu, IDM_CDROM_ENABLED, MF_CHECKED); if (scsi_cdrom_enabled) CheckMenuItem(menu, IDM_CDROM_SCSI, MF_CHECKED); + if (aha154x_enabled) + CheckMenuItem(menu, IDM_SCSI_ENABLED, MF_CHECKED); + if (cdrom_drive == 200) CheckMenuItem(menu, IDM_CDROM_ISO, MF_CHECKED); else @@ -1167,7 +1170,7 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM } break; #endif - case IDM_CDROM_DISABLED: + case IDM_CDROM_ENABLED: if (MessageBox(NULL,"This will reset 86Box!\nOkay to continue?","86Box",MB_OKCANCEL) != IDOK) { break; @@ -1175,7 +1178,7 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM pause = 1; Sleep(100); cdrom_enabled ^= 1; - CheckMenuItem(hmenu, IDM_CDROM_DISABLED, cdrom_enabled ? MF_UNCHECKED : MF_CHECKED); + CheckMenuItem(hmenu, IDM_CDROM_ENABLED, cdrom_enabled ? MF_CHECKED : MF_UNCHECKED); saveconfig(); resetpchard(); pause = 0; @@ -1189,7 +1192,21 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM pause = 1; Sleep(100); scsi_cdrom_enabled ^= 1; - CheckMenuItem(hmenu, IDM_CDROM_DISABLED, scsi_cdrom_enabled ? MF_CHECKED : MF_UNCHECKED); + CheckMenuItem(hmenu, IDM_CDROM_SCSI, scsi_cdrom_enabled ? MF_CHECKED : MF_UNCHECKED); + saveconfig(); + resetpchard(); + pause = 0; + break; + + case SCSI_ENABLED: + if (MessageBox(NULL,"This will reset 86Box!\nOkay to continue?","86Box",MB_OKCANCEL) != IDOK) + { + break; + } + pause = 1; + Sleep(100); + aha154x_enabled ^= 1; + CheckMenuItem(hmenu, IDM_SCSI_ENABLED, aha_154x_enabled ? MF_CHECKED : MF_UNCHECKED); saveconfig(); resetpchard(); pause = 0; @@ -1216,7 +1233,7 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM SCSICDROM_Insert(); } CheckMenuItem(hmenu, IDM_CDROM_REAL + cdrom_drive, MF_UNCHECKED); - CheckMenuItem(hmenu, IDM_CDROM_DISABLED, MF_UNCHECKED); + // CheckMenuItem(hmenu, IDM_CDROM_DISABLED, MF_UNCHECKED); CheckMenuItem(hmenu, IDM_CDROM_ISO, MF_UNCHECKED); old_cdrom_drive = cdrom_drive; cdrom_drive=0; @@ -1258,7 +1275,7 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM SCSICDROM_Insert(); } CheckMenuItem(hmenu, IDM_CDROM_REAL + cdrom_drive, MF_UNCHECKED); - CheckMenuItem(hmenu, IDM_CDROM_DISABLED, MF_UNCHECKED); + // CheckMenuItem(hmenu, IDM_CDROM_DISABLED, MF_UNCHECKED); CheckMenuItem(hmenu, IDM_CDROM_ISO, MF_UNCHECKED); cdrom_drive = 200; CheckMenuItem(hmenu, IDM_CDROM_ISO, MF_CHECKED); @@ -1300,7 +1317,7 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM SCSICDROM_Insert(); } CheckMenuItem(hmenu, IDM_CDROM_REAL + cdrom_drive, MF_UNCHECKED); - CheckMenuItem(hmenu, IDM_CDROM_DISABLED, MF_UNCHECKED); + // CheckMenuItem(hmenu, IDM_CDROM_DISABLED, MF_UNCHECKED); CheckMenuItem(hmenu, IDM_CDROM_ISO, MF_UNCHECKED); cdrom_drive = new_cdrom_drive; CheckMenuItem(hmenu, IDM_CDROM_REAL + cdrom_drive, MF_CHECKED);