changeset 34979:93a763f04563

Fix bug with definition of IDPLAYDISK in Win32 GUI. Numeric identifiers starting from IDPLAYDISK are used for CDROM/DVD drive menu entries and there must be enough identifier for all drives available. Introduce IDPLAYDISK_LIMIT for a range of such identifiers. Additionally, add a check when creating menu entries and rework the condition for checking the play command for reasons of clarity. Reported by Stephen Sheldon, sfsheldo gmail com.
author ib
date Sat, 11 Aug 2012 13:02:58 +0000
parents b8565c1d7db3
children e8612836f3eb
files gui/win32/dialogs.h gui/win32/gui.c
diffstat 2 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/gui/win32/dialogs.h	Fri Aug 10 21:12:02 2012 +0000
+++ b/gui/win32/dialogs.h	Sat Aug 11 13:02:58 2012 +0000
@@ -104,7 +104,6 @@
 #define IDFILE_SAVE          72
 #define IDHELP_ABOUT         73
 #define IDSUBTITLE_OPEN      74
-#define IDPLAYDISK           75
 #define ID_CONSOLE           76
 #define ID_EQ0               77
 #define ID_EQ1               78
@@ -121,6 +120,9 @@
 #define ID_MUTE              89
 #define ID_FULLSCREEN        90
 #define ID_IDLE              91
+/* support for 64 drives */
+#define IDPLAYDISK           100
+#define IDPLAYDISK_LIMIT     164
 
 /* gtk emulation */
 #define GTK_MB_FATAL         0x1
--- a/gui/win32/gui.c	Fri Aug 10 21:12:02 2012 +0000
+++ b/gui/win32/gui.c	Sat Aug 11 13:02:58 2012 +0000
@@ -887,7 +887,7 @@
                         strcat(menuitem, volname);
                     }
                     AppendMenu(gui->diskmenu, flags, IDPLAYDISK + cdromdrive, menuitem);
-                        cdromdrive++;
+                    if (++cdromdrive == IDPLAYDISK_LIMIT - IDPLAYDISK) break;
                 }
                 pos += strlen(device + pos) + 1;
             }
@@ -1029,7 +1029,7 @@
                     handlemsg(hWnd, evAbout);
                     break;
             }
-            if((IDPLAYDISK <= LOWORD(wParam)) && (LOWORD(wParam) < (IDPLAYDISK + 100)))
+            if(LOWORD(wParam) >= IDPLAYDISK && LOWORD(wParam) < IDPLAYDISK_LIMIT)
             {
                 char device[MAX_PATH];
                 char searchpath[MAX_PATH];