Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Fixed mode code under VMware running Windows 98
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Jul 5, 2007
1 parent 45ddf65 commit 7bef08d
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/video/win32/SDL_win32modes.c
Expand Up @@ -110,7 +110,7 @@ WIN_GetDisplayMode(LPCTSTR deviceName, DWORD index, SDL_DisplayMode * mode)
return SDL_TRUE;
}

static void
static SDL_bool
WIN_AddDisplay(LPTSTR DeviceName)
{
SDL_VideoDisplay display;
Expand All @@ -121,12 +121,12 @@ WIN_AddDisplay(LPTSTR DeviceName)
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));
Expand All @@ -136,13 +136,14 @@ WIN_AddDisplay(LPTSTR DeviceName)
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);
Expand All @@ -159,16 +160,17 @@ WIN_InitModes(_THIS)
#ifdef DEBUG_MODES
printf("Device: %s\n", WIN_StringToUTF8(DeviceName));
#endif
count = 0;
for (j = 0;; ++j) {
if (!EnumDisplayDevices(DeviceName, j, &device, 0)) {
break;
}
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);
}
}
Expand Down

0 comments on commit 7bef08d

Please sign in to comment.