Fixed mode code under VMware running Windows 98
authorSam Lantinga <slouken@libsdl.org>
Thu, 05 Jul 2007 05:57:31 +0000
changeset 2149 eba4fd03b4f6
parent 2148 b93d0b4625f6
child 2150 abbe2c1dcf0a
Fixed mode code under VMware running Windows 98
src/video/win32/SDL_win32modes.c
--- a/src/video/win32/SDL_win32modes.c	Thu Jul 05 05:28:08 2007 +0000
+++ b/src/video/win32/SDL_win32modes.c	Thu Jul 05 05:57:31 2007 +0000
@@ -110,7 +110,7 @@
     return SDL_TRUE;
 }
 
-static void
+static SDL_bool
 WIN_AddDisplay(LPTSTR DeviceName)
 {
     SDL_VideoDisplay display;
@@ -121,12 +121,12 @@
     printf("Display: %s\n", WIN_StringToUTF8(DeviceName));
 #endif
     if (!WIN_GetDisplayMode(DeviceName, ENUM_CURRENT_SETTINGS, &mode)) {
-        return;
+        return SDL_FALSE;
     }
 
     displaydata = (SDL_DisplayData *) SDL_malloc(sizeof(*displaydata));
     if (!displaydata) {
-        return;
+        return SDL_FALSE;
     }
     SDL_memcpy(displaydata->DeviceName, DeviceName,
                sizeof(displaydata->DeviceName));
@@ -136,13 +136,14 @@
     display.current_mode = mode;
     display.driverdata = displaydata;
     SDL_AddVideoDisplay(&display);
+    return SDL_TRUE;
 }
 
 void
 WIN_InitModes(_THIS)
 {
     SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
-    DWORD i, j;
+    DWORD i, j, count;
     DISPLAY_DEVICE device;
 
     device.cb = sizeof(device);
@@ -159,6 +160,7 @@
 #ifdef DEBUG_MODES
         printf("Device: %s\n", WIN_StringToUTF8(DeviceName));
 #endif
+        count = 0;
         for (j = 0;; ++j) {
             if (!EnumDisplayDevices(DeviceName, j, &device, 0)) {
                 break;
@@ -166,9 +168,9 @@
             if (!(device.StateFlags & DISPLAY_DEVICE_ATTACHED_TO_DESKTOP)) {
                 continue;
             }
-            WIN_AddDisplay(device.DeviceName);
+            count += WIN_AddDisplay(device.DeviceName);
         }
-        if (j == 0) {
+        if (count == 0) {
             WIN_AddDisplay(DeviceName);
         }
     }