comparison src/video/win32/SDL_win32video.c @ 2726:f23ebf1ddac4

Dynamically load wintab32.dll
author Sam Lantinga <slouken@libsdl.org>
date Tue, 26 Aug 2008 06:03:48 +0000
parents 0e2b65f32298
children 2768bd7281e0
comparison
equal deleted inserted replaced
2725:6ce6d56b63bf 2726:f23ebf1ddac4
58 if (data->d3d) { 58 if (data->d3d) {
59 IDirect3D9_Release(data->d3d); 59 IDirect3D9_Release(data->d3d);
60 FreeLibrary(data->d3dDLL); 60 FreeLibrary(data->d3dDLL);
61 } 61 }
62 #endif 62 #endif
63 if (data->wintabDLL) {
64 FreeLibrary(data->wintabDLL);
65 }
63 SDL_free(device->driverdata); 66 SDL_free(device->driverdata);
64 SDL_free(device); 67 SDL_free(device);
65 } 68 }
66 69
67 static SDL_VideoDevice * 70 static SDL_VideoDevice *
101 FreeLibrary(data->d3dDLL); 104 FreeLibrary(data->d3dDLL);
102 data->d3dDLL = NULL; 105 data->d3dDLL = NULL;
103 } 106 }
104 } 107 }
105 #endif /* SDL_VIDEO_RENDER_D3D */ 108 #endif /* SDL_VIDEO_RENDER_D3D */
109
110 data->wintabDLL = LoadLibrary(TEXT("WINTAB32.DLL"));
111 if (data->wintabDLL) {
112 #define PROCNAME(X) #X
113 data->WTInfo =
114 (UINT(*)(UINT, UINT, LPVOID)) GetProcAddress(data->wintabDLL,
115 PROCNAME(WTInfo));
116 data->WTOpen =
117 (HCTX(*)(HWND, LPLOGCONTEXT, BOOL)) GetProcAddress(data->
118 wintabDLL,
119 PROCNAME
120 (WTOpen));
121 data->WTPacket =
122 (int (*)(HCTX, UINT, LPVOID)) GetProcAddress(data->wintabDLL,
123 PROCNAME(WTPacket));
124 data->WTClose =
125 (BOOL(*)(HCTX)) GetProcAddress(data->wintabDLL,
126 PROCNAME(WTClose));
127 #undef PROCNAME
128
129 if (!data->WTInfo || !data->WTOpen || !data->WTPacket
130 || !data->WTClose) {
131 FreeLibrary(data->wintabDLL);
132 data->wintabDLL = NULL;
133 }
134 }
106 135
107 /* Set the function pointers */ 136 /* Set the function pointers */
108 device->VideoInit = WIN_VideoInit; 137 device->VideoInit = WIN_VideoInit;
109 device->VideoQuit = WIN_VideoQuit; 138 device->VideoQuit = WIN_VideoQuit;
110 device->GetDisplayModes = WIN_GetDisplayModes; 139 device->GetDisplayModes = WIN_GetDisplayModes;