Date: Thu, 05 Feb 2009 18:07:35 +0100
authorSam Lantinga <slouken@libsdl.org>
Mon, 23 Mar 2009 05:35:21 +0000
changeset 30970d12e8f1de3c
parent 3096 ae4e80dbe330
child 3098 5f372cef955d
Date: Thu, 05 Feb 2009 18:07:35 +0100
From: Stefan Klug
Subject: [SDL] SDL 1.3 WinCE backend

as promised, I've started to work on the WinCE backend of SDL 1.3
I've modified the win32 video backend and the gdi renderer, to work
properly in WinCE.
The results till now are great, but there is still some work to do.

Attached are two patches with my changes.
I would be happy if someone could review and propably commit them.

The first one (configure.in.patch) should be straight forward without
any side effects.

The second one does the necessary changes to the win32 backend. I was
really unhappy to start slicing this shiny new backend with
#ifdef/#endif but I saw no other option.

The most problematic issues are:
- WinCe has no GetDIBits, so its practically impossible to fill a
BITMAPINFO with correct values. I therefore removed the bmi member from
the GDI_RenderData in SDL_gdirender.c to prevent usage of a not or not
properly initialized bmi.
- In SDL_win32window.c I exchanged some ASCII function by their general
counterparts, (In CE only the Unicode versions are available). I don't
know if this has a negative effect when running in win32


Cheers
Stefan
configure.in
src/video/win32/SDL_gdirender.c
src/video/win32/SDL_win32events.c
src/video/win32/SDL_win32gamma.c
src/video/win32/SDL_win32modes.c
src/video/win32/SDL_win32mouse.c
src/video/win32/SDL_win32window.c
     1.1 --- a/configure.in	Mon Mar 23 05:21:40 2009 +0000
     1.2 +++ b/configure.in	Mon Mar 23 05:35:21 2009 +0000
     1.3 @@ -2531,6 +2531,71 @@
     1.4              have_haptic=yes
     1.5          fi
     1.6          ;;
     1.7 +    *-wince* | *-mingw32ce)
     1.8 +        ARCH=win32
     1.9 +        CheckDummyVideo
    1.10 +        CheckDiskAudio
    1.11 +        CheckDummyAudio
    1.12 +        CheckWIN32
    1.13 +        CheckNASM
    1.14 +        #SOURCES="$SOURCES $srcdir/src/video/gapi/*.c"
    1.15 +        #AC_DEFINE(SDL_VIDEO_DRIVER_GAPI)
    1.16 +        if test x$enable_video = xyes; then
    1.17 +            AC_DEFINE(SDL_VIDEO_DRIVER_WIN32)
    1.18 +            SOURCES="$SOURCES $srcdir/src/video/win32/*.c"
    1.19 +            have_video=yes
    1.20 +            AC_ARG_ENABLE(render-gdi,
    1.21 +AC_HELP_STRING([--enable-render-gdi], [enable the GDI render driver [[default=yes]]]),
    1.22 +                                , enable_render_gdi=yes)
    1.23 +            if test x$enable_render_gdi = xyes; then
    1.24 +                AC_DEFINE(SDL_VIDEO_RENDER_GDI)
    1.25 +            fi
    1.26 +            AC_ARG_ENABLE(render-d3d,
    1.27 +AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[default=yes]]]),
    1.28 +                                , enable_render_d3d=yes)
    1.29 +            enable_render_d3d=no
    1.30 +            if test x$enable_render_d3d = xyes -a x$have_d3d = xyes; then
    1.31 +                AC_DEFINE(SDL_VIDEO_RENDER_D3D)
    1.32 +            fi
    1.33 +        fi
    1.34 +        # Set up files for the audio library
    1.35 +        if test x$enable_audio = xyes; then
    1.36 +            AC_DEFINE(SDL_AUDIO_DRIVER_WINWAVEOUT)
    1.37 +            SOURCES="$SOURCES $srcdir/src/audio/windib/*.c"
    1.38 +            if test x$have_dsound = xyes; then
    1.39 +                AC_DEFINE(SDL_AUDIO_DRIVER_DSOUND)
    1.40 +                SOURCES="$SOURCES $srcdir/src/audio/windx5/*.c"
    1.41 +            fi
    1.42 +            have_audio=yes
    1.43 +        fi
    1.44 +        # Set up files for the thread library
    1.45 +        if test x$enable_threads = xyes; then
    1.46 +            AC_DEFINE(SDL_THREAD_WIN32)
    1.47 +            SOURCES="$SOURCES $srcdir/src/thread/win32/SDL_sysmutex.c"
    1.48 +            SOURCES="$SOURCES $srcdir/src/thread/win32/SDL_syssem.c"
    1.49 +            SOURCES="$SOURCES $srcdir/src/thread/win32/SDL_systhread.c"
    1.50 +            SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c"
    1.51 +            have_threads=yes
    1.52 +        fi
    1.53 +        # Set up files for the timer library
    1.54 +        if test x$enable_timers = xyes; then
    1.55 +            AC_DEFINE(SDL_TIMER_WINCE)
    1.56 +            SOURCES="$SOURCES $srcdir/src/timer/wince/*.c"
    1.57 +            have_timers=yes
    1.58 +        fi
    1.59 +        # Set up files for the shared object loading library
    1.60 +        if test x$enable_loadso = xyes; then
    1.61 +            AC_DEFINE(SDL_LOADSO_WIN32)
    1.62 +            SOURCES="$SOURCES $srcdir/src/loadso/win32/*.c"
    1.63 +            have_loadso=yes
    1.64 +        fi
    1.65 +        # Set up the system libraries we need
    1.66 +        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lcoredll -lcommctrl -lmmtimer"
    1.67 +        # The Win32 platform requires special setup
    1.68 +        SDLMAIN_SOURCES="$srcdir/src/main/win32/*.c"
    1.69 +        SDL_CFLAGS="$SDL_CFLAGS -Dmain=SDL_main -D_WIN32_WCE=0x420"
    1.70 +        SDL_LIBS="-lSDLmain $SDL_LIBS"
    1.71 +        ;;
    1.72      *-*-cygwin* | *-*-mingw32*)
    1.73          ARCH=win32
    1.74          if test "$build" != "$host"; then # cross-compiling
    1.75 @@ -2850,10 +2915,10 @@
    1.76  # Verify that we have all the platform specific files we need
    1.77  
    1.78  if test x$enable_joystick = xyes; then
    1.79 -  if test x$have_joystick != xyes; then
    1.80 -    # Wants joystick subsystem, but doesn't have a platform-specific backend...
    1.81 +    if test x$have_joystick != xyes; then
    1.82 +        AC_DEFINE(SDL_JOYSTICK_DISABLED)
    1.83 +    fi
    1.84      SOURCES="$SOURCES $srcdir/src/joystick/dummy/*.c"
    1.85 -  fi
    1.86  fi
    1.87  if test x$have_haptic != xyes; then
    1.88      if test x$enable_haptic = xyes; then
     2.1 --- a/src/video/win32/SDL_gdirender.c	Mon Mar 23 05:21:40 2009 +0000
     2.2 +++ b/src/video/win32/SDL_gdirender.c	Mon Mar 23 05:35:21 2009 +0000
     2.3 @@ -28,6 +28,10 @@
     2.4  #include "../SDL_yuv_sw_c.h"
     2.5  #include "../SDL_alphamult.h"
     2.6  
     2.7 +#ifdef _WIN32_WCE
     2.8 +#define NO_GETDIBBITS 1
     2.9 +#endif
    2.10 +
    2.11  /* GDI renderer implementation */
    2.12  
    2.13  static SDL_Renderer *GDI_CreateRenderer(SDL_Window * window, Uint32 flags);
    2.14 @@ -106,7 +110,9 @@
    2.15      HDC render_hdc;
    2.16      HDC memory_hdc;
    2.17      HDC current_hdc;
    2.18 +#ifndef NO_GETDIBBITS
    2.19      LPBITMAPINFO bmi;
    2.20 +#endif
    2.21      HBITMAP hbm[3];
    2.22      int current_hbm;
    2.23      SDL_DirtyRectList dirty;
    2.24 @@ -197,6 +203,7 @@
    2.25      data->render_hdc = CreateCompatibleDC(data->window_hdc);
    2.26      data->memory_hdc = CreateCompatibleDC(data->window_hdc);
    2.27  
    2.28 +#ifndef NO_GETDIBBITS
    2.29      /* Fill in the compatible bitmap info */
    2.30      bmi_size = sizeof(BITMAPINFOHEADER) + 256 * sizeof(RGBQUAD);
    2.31      data->bmi = (LPBITMAPINFO) SDL_calloc(1, bmi_size);
    2.32 @@ -211,6 +218,7 @@
    2.33      GetDIBits(data->window_hdc, hbm, 0, 1, NULL, data->bmi, DIB_RGB_COLORS);
    2.34      GetDIBits(data->window_hdc, hbm, 0, 1, NULL, data->bmi, DIB_RGB_COLORS);
    2.35      DeleteObject(hbm);
    2.36 +#endif
    2.37  
    2.38      if (flags & SDL_RENDERER_SINGLEBUFFER) {
    2.39          renderer->info.flags |=
    2.40 @@ -473,6 +481,7 @@
    2.41              /* Crap, we've lost the original pixel data... *sigh* */
    2.42          }
    2.43          return 0;
    2.44 +#ifndef _WIN32_WCE /* WinCE has no alphablend */
    2.45      case SDL_BLENDMODE_MASK:
    2.46      case SDL_BLENDMODE_BLEND:
    2.47          if (!data->premultiplied && data->pixels) {
    2.48 @@ -504,6 +513,7 @@
    2.49              }
    2.50          }
    2.51          return 0;
    2.52 +#endif
    2.53      default:
    2.54          SDL_Unsupported();
    2.55          texture->blendMode = SDL_BLENDMODE_NONE;
    2.56 @@ -585,12 +595,17 @@
    2.57                  }
    2.58              }
    2.59          } else if (rect->w == texture->w && pitch == data->pitch) {
    2.60 +#ifndef NO_GETDIBBITS
    2.61              if (!SetDIBits
    2.62                  (renderdata->window_hdc, data->hbm, rect->y, rect->h, pixels,
    2.63                   renderdata->bmi, DIB_RGB_COLORS)) {
    2.64                  WIN_SetError("SetDIBits()");
    2.65                  return -1;
    2.66              }
    2.67 +#else
    2.68 +            SDL_SetError("FIXME: Update Texture");
    2.69 +            return -1;
    2.70 +#endif
    2.71          } else {
    2.72              SDL_SetError
    2.73                  ("FIXME: Need to allocate temporary memory and do GetDIBits() followed by SetDIBits(), since we can only set blocks of scanlines at a time");
    2.74 @@ -611,7 +626,10 @@
    2.75          return SDL_SW_LockYUVTexture(data->yuv, rect, markDirty, pixels,
    2.76                                       pitch);
    2.77      } else if (data->pixels) {
    2.78 +#ifndef _WIN32_WCE
    2.79 +    	/* WinCE has no GdiFlush */
    2.80          GdiFlush();
    2.81 +#endif
    2.82          *pixels =
    2.83              (void *) ((Uint8 *) data->pixels + rect->y * data->pitch +
    2.84                        rect->x * SDL_BYTESPERPIXEL(texture->format));
    2.85 @@ -760,6 +778,10 @@
    2.86          RealizePalette(data->memory_hdc);
    2.87      }
    2.88      if (texture->blendMode & (SDL_BLENDMODE_MASK | SDL_BLENDMODE_BLEND)) {
    2.89 +#ifdef _WIN32_WCE
    2.90 +        SDL_SetError("Texture has blendmode not supported under WinCE");
    2.91 +        return -1;
    2.92 +#else
    2.93          BLENDFUNCTION blendFunc = {
    2.94              AC_SRC_OVER,
    2.95              0,
    2.96 @@ -773,6 +795,7 @@
    2.97              WIN_SetError("AlphaBlend()");
    2.98              return -1;
    2.99          }
   2.100 +#endif
   2.101      } else {
   2.102          if (srcrect->w == dstrect->w && srcrect->h == dstrect->h) {
   2.103              if (!BitBlt
   2.104 @@ -851,9 +874,11 @@
   2.105      if (data) {
   2.106          DeleteDC(data->render_hdc);
   2.107          DeleteDC(data->memory_hdc);
   2.108 +#ifndef NO_GETDIBBITS
   2.109          if (data->bmi) {
   2.110              SDL_free(data->bmi);
   2.111          }
   2.112 +#endif
   2.113          for (i = 0; i < SDL_arraysize(data->hbm); ++i) {
   2.114              if (data->hbm[i]) {
   2.115                  DeleteObject(data->hbm[i]);
     3.1 --- a/src/video/win32/SDL_win32events.c	Mon Mar 23 05:21:40 2009 +0000
     3.2 +++ b/src/video/win32/SDL_win32events.c	Mon Mar 23 05:35:21 2009 +0000
     3.3 @@ -191,10 +191,12 @@
     3.4                                      0, 0);
     3.5                  SDL_SendWindowEvent(data->windowID,
     3.6                                      SDL_WINDOWEVENT_RESTORED, 0, 0);
     3.7 +#ifndef _WIN32_WCE /* WinCE misses IsZoomed() */
     3.8                  if (IsZoomed(hwnd)) {
     3.9                      SDL_SendWindowEvent(data->windowID,
    3.10                                          SDL_WINDOWEVENT_MAXIMIZED, 0, 0);
    3.11                  }
    3.12 +#endif              
    3.13                  if (keyboard && keyboard->focus != data->windowID) {
    3.14                      SDL_SetKeyboardFocus(index, data->windowID);
    3.15                  }
    3.16 @@ -211,6 +213,25 @@
    3.17          }
    3.18          return (0);
    3.19  
    3.20 +/* WinCE has no RawInput, so we use the classic mouse events.
    3.21 +   In classic Win32 this is done by WM_INPUT
    3.22 + */
    3.23 +#ifdef _WIN32_WCE
    3.24 +    case WM_MOUSEMOVE:
    3.25 +    	SDL_SendMouseMotion(0, 0, LOWORD(lParam), HIWORD(lParam), 0);
    3.26 +    	break;
    3.27 +    
    3.28 +    case WM_LBUTTONDOWN:
    3.29 +    	SDL_SendMouseMotion(0, 0, LOWORD(lParam), HIWORD(lParam), 0);
    3.30 +    	SDL_SendMouseButton(0, SDL_PRESSED, SDL_BUTTON_LEFT);
    3.31 +    	break;
    3.32 +    	
    3.33 +    case WM_LBUTTONUP:
    3.34 +    	SDL_SendMouseMotion(0, 0, LOWORD(lParam), HIWORD(lParam), 0);
    3.35 +    	SDL_SendMouseButton(0, SDL_RELEASED, SDL_BUTTON_LEFT);
    3.36 +    	break;
    3.37 +#else /* _WIN32_WCE */
    3.38 +
    3.39      case WM_INPUT:             /* mouse events */
    3.40          {
    3.41              LPBYTE lpb;
    3.42 @@ -223,7 +244,7 @@
    3.43              USHORT flags;
    3.44              int w, h;
    3.45  
    3.46 -            /* we're collecting data from the mouse */
    3.47 +            /* we're collecting raw data to be able to identify the mouse (if there are several) */
    3.48              GetRawInputData((HRAWINPUT) lParam, RID_INPUT, NULL, &size,
    3.49                              sizeof(RAWINPUTHEADER));
    3.50              lpb = SDL_stack_alloc(BYTE, size);
    3.51 @@ -240,7 +261,7 @@
    3.52                      break;
    3.53                  }
    3.54              }
    3.55 -/* FIXME: Doesn't this defeat the point of using raw input? */
    3.56 +            
    3.57              GetCursorPos(&point);
    3.58              ScreenToClient(hwnd, &point);
    3.59  
    3.60 @@ -292,7 +313,8 @@
    3.61              SDL_stack_free(lpb);
    3.62          }
    3.63          return (0);
    3.64 -
    3.65 +#endif /* _WIN32_WCE */
    3.66 +        
    3.67      case WM_MOUSELEAVE:
    3.68          {
    3.69              int i;
     4.1 --- a/src/video/win32/SDL_win32gamma.c	Mon Mar 23 05:21:40 2009 +0000
     4.2 +++ b/src/video/win32/SDL_win32gamma.c	Mon Mar 23 05:35:21 2009 +0000
     4.3 @@ -27,6 +27,9 @@
     4.4  int
     4.5  WIN_SetDisplayGammaRamp(_THIS, Uint16 * ramp)
     4.6  {
     4.7 +#ifdef _WIN32_WCE
     4.8 +	return -1;
     4.9 +#else
    4.10      SDL_DisplayData *data = (SDL_DisplayData *) SDL_CurrentDisplay.driverdata;
    4.11      HDC hdc;
    4.12      BOOL succeeded = FALSE;
    4.13 @@ -40,11 +43,15 @@
    4.14          DeleteDC(hdc);
    4.15      }
    4.16      return succeeded ? 0 : -1;
    4.17 +#endif
    4.18  }
    4.19  
    4.20  int
    4.21  WIN_GetDisplayGammaRamp(_THIS, Uint16 * ramp)
    4.22  {
    4.23 +#ifdef _WIN32_WCE
    4.24 +	return -1;
    4.25 +#else
    4.26      SDL_DisplayData *data = (SDL_DisplayData *) SDL_CurrentDisplay.driverdata;
    4.27      HDC hdc;
    4.28      BOOL succeeded = FALSE;
    4.29 @@ -58,6 +65,7 @@
    4.30          DeleteDC(hdc);
    4.31      }
    4.32      return succeeded ? 0 : -1;
    4.33 +#endif
    4.34  }
    4.35  
    4.36  /* vi: set ts=4 sw=4 expandtab: */
     5.1 --- a/src/video/win32/SDL_win32modes.c	Mon Mar 23 05:21:40 2009 +0000
     5.2 +++ b/src/video/win32/SDL_win32modes.c	Mon Mar 23 05:35:21 2009 +0000
     5.3 @@ -53,7 +53,17 @@
     5.4      mode->h = devmode.dmPelsHeight;
     5.5      mode->refresh_rate = devmode.dmDisplayFrequency;
     5.6      mode->driverdata = data;
     5.7 +#ifdef _WIN32_WCE
     5.8 +    /* In WinCE EnumDisplaySettings(ENUM_CURRENT_SETTINGS) doesn't take the user defined orientation
     5.9 +     into account but GetSystemMetrixs does. */
    5.10 +    if(index == ENUM_CURRENT_SETTINGS) {
    5.11 +    	mode->w = GetSystemMetrics(SM_CXSCREEN);
    5.12 +    	mode->h = GetSystemMetrics(SM_CYSCREEN);
    5.13 +    }
    5.14 +#endif
    5.15  
    5.16 +/* WinCE has no GetDIBits, therefore we can't use it to get the display format */
    5.17 +#ifndef _WIN32_WCE
    5.18      if (index == ENUM_CURRENT_SETTINGS
    5.19          && (hdc = CreateDC(deviceName, NULL, NULL, NULL)) != NULL) {
    5.20          char bmi_data[sizeof(BITMAPINFOHEADER) + 256 * sizeof(RGBQUAD)];
    5.21 @@ -87,7 +97,10 @@
    5.22          } else if (bmi->bmiHeader.biBitCount == 8) {
    5.23              mode->format = SDL_PIXELFORMAT_INDEX8;
    5.24          }
    5.25 -    } else {
    5.26 +    } else
    5.27 +#endif /* _WIN32_WCE */
    5.28 +    {
    5.29 +
    5.30          /* FIXME: Can we tell what this will be? */
    5.31          switch (devmode.dmBitsPerPel) {
    5.32          case 32:
    5.33 @@ -198,6 +211,14 @@
    5.34  {
    5.35      SDL_DisplayModeData *data = (SDL_DisplayModeData *) mode->driverdata;
    5.36      LONG status;
    5.37 +    
    5.38 +#ifdef _WIN32_WCE
    5.39 +    /* TODO: implement correctly.
    5.40 +       On my Asus MyPAL, if I execute the code below
    5.41 +       I get DISP_CHANGE_BADFLAGS and the Titlebar of the fullscreen window stays
    5.42 +       visible ... (SDL_RaiseWindow() would fix that one)*/ 
    5.43 +    return 0;
    5.44 +#endif
    5.45  
    5.46      status =
    5.47          ChangeDisplaySettingsEx(data->DeviceName, &data->DeviceMode, NULL,
     6.1 --- a/src/video/win32/SDL_win32mouse.c	Mon Mar 23 05:21:40 2009 +0000
     6.2 +++ b/src/video/win32/SDL_win32mouse.c	Mon Mar 23 05:35:21 2009 +0000
     6.3 @@ -50,6 +50,13 @@
     6.4      const char *rdp = "rdp_mou";
     6.5      SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
     6.6  
     6.7 +/* WinCE has no RawInputDeviceList */
     6.8 +#ifdef _WIN32_WCE
     6.9 +    SDL_Mouse mouse;
    6.10 +    SDL_zero(mouse);
    6.11 +    mouse.id = 0;
    6.12 +    SDL_AddMouse(&mouse, "Stylus", 0, 0, 1);
    6.13 +#else
    6.14      /* we're checking for the number of rawinput devices */
    6.15      if (GetRawInputDeviceList(NULL, &devCount, sizeof(RAWINPUTDEVICELIST))) {
    6.16          return;
    6.17 @@ -190,6 +197,7 @@
    6.18      }
    6.19      total_mice = index;
    6.20      SDL_free(deviceList);
    6.21 +#endif /*_WIN32_WCE*/
    6.22  }
    6.23  
    6.24  void
     7.1 --- a/src/video/win32/SDL_win32window.c	Mon Mar 23 05:21:40 2009 +0000
     7.2 +++ b/src/video/win32/SDL_win32window.c	Mon Mar 23 05:35:21 2009 +0000
     7.3 @@ -243,12 +243,14 @@
     7.4          g_hCtx[window->id] = videodata->WTOpenA(hwnd, &lc, TRUE);
     7.5      }
     7.6  
     7.7 +#ifndef _WIN32_WCE /* has no RawInput */
     7.8      /* we're telling the window, we want it to report raw input events from mice */
     7.9      Rid.usUsagePage = 0x01;
    7.10      Rid.usUsage = 0x02;
    7.11      Rid.dwFlags = RIDEV_INPUTSINK;
    7.12      Rid.hwndTarget = hwnd;
    7.13      RegisterRawInputDevices(&Rid, 1, sizeof(Rid));
    7.14 +#endif
    7.15  
    7.16      WIN_PumpEvents(_this);
    7.17  
    7.18 @@ -360,8 +362,11 @@
    7.19              }
    7.20              SDL_FreeSurface(surface);
    7.21  
    7.22 +/* TODO: create the icon in WinCE (CreateIconFromResource isn't available) */
    7.23 +#ifndef _WIN32_WCE
    7.24              hicon =
    7.25                  CreateIconFromResource(icon_bmp, icon_len, TRUE, 0x00030000);
    7.26 +#endif
    7.27          }
    7.28          SDL_RWclose(dst);
    7.29          SDL_stack_free(icon_bmp);
    7.30 @@ -553,8 +558,8 @@
    7.31  int
    7.32  SDL_HelperWindowCreate(void)
    7.33  {
    7.34 -    HINSTANCE hInstance = GetModuleHandleA(NULL);
    7.35 -    WNDCLASSEX wce;
    7.36 +    HINSTANCE hInstance = GetModuleHandle(NULL);
    7.37 +    WNDCLASS wce;
    7.38  
    7.39      /* Make sure window isn't created twice. */
    7.40      if (SDL_HelperWindow != NULL) {
    7.41 @@ -563,13 +568,12 @@
    7.42  
    7.43      /* Create the class. */
    7.44      SDL_zero(wce);
    7.45 -    wce.cbSize = sizeof(WNDCLASSEX);
    7.46 -    wce.lpfnWndProc = DefWindowProcA;
    7.47 +    wce.lpfnWndProc = DefWindowProc;
    7.48      wce.lpszClassName = (LPCWSTR) SDL_HelperWindowClassName;
    7.49      wce.hInstance = hInstance;
    7.50  
    7.51      /* Register the class. */
    7.52 -    SDL_HelperWindowClass = RegisterClassEx(&wce);
    7.53 +    SDL_HelperWindowClass = RegisterClass(&wce);
    7.54      if (SDL_HelperWindowClass == 0) {
    7.55          SDL_SetError("Unable to create Helper Window Class: error %d.",
    7.56                       GetLastError());
    7.57 @@ -600,7 +604,7 @@
    7.58  void
    7.59  SDL_HelperWindowDestroy(void)
    7.60  {
    7.61 -    HINSTANCE hInstance = GetModuleHandleA(NULL);
    7.62 +    HINSTANCE hInstance = GetModuleHandle(NULL);
    7.63  
    7.64      /* Destroy the window. */
    7.65      if (SDL_HelperWindow != NULL) {