Mercurial > sdl-ios-xcode
comparison src/haptic/win32/SDL_syshaptic.c @ 2623:6deba05725ac gsoc2008_force_feedback
This should hopefully allow initailizing the joystick/haptic subsystems without calling SetVideoMode first.
author | Edgar Simo <bobbens@gmail.com> |
---|---|
date | Wed, 06 Aug 2008 09:52:51 +0000 |
parents | 83659de20bf2 |
children | 53dd30491c71 |
comparison
equal
deleted
inserted
replaced
2622:446054caaa81 | 2623:6deba05725ac |
---|---|
89 | 89 |
90 | 90 |
91 /* | 91 /* |
92 * External stuff. | 92 * External stuff. |
93 */ | 93 */ |
94 extern HINSTANCE SDL_Instance; | |
95 extern HWND SDL_HelperWindow; | 94 extern HWND SDL_HelperWindow; |
96 | 95 |
97 | 96 |
98 /* | 97 /* |
99 * Prototypes. | 98 * Prototypes. |
144 */ | 143 */ |
145 int | 144 int |
146 SDL_SYS_HapticInit(void) | 145 SDL_SYS_HapticInit(void) |
147 { | 146 { |
148 HRESULT ret; | 147 HRESULT ret; |
148 HINSTANCE instance; | |
149 | 149 |
150 if (dinput != NULL) { /* Already open. */ | 150 if (dinput != NULL) { /* Already open. */ |
151 SDL_SetError("Haptic: SubSystem already open."); | 151 SDL_SetError("Haptic: SubSystem already open."); |
152 return -1; | 152 return -1; |
153 } | 153 } |
169 DI_SetError("CoCreateInstance",ret); | 169 DI_SetError("CoCreateInstance",ret); |
170 return -1; | 170 return -1; |
171 } | 171 } |
172 | 172 |
173 /* Because we used CoCreateInstance, we need to Initialize it, first. */ | 173 /* Because we used CoCreateInstance, we need to Initialize it, first. */ |
174 ret = IDirectInput_Initialize(dinput, SDL_Instance, DIRECTINPUT_VERSION); | 174 instance = GetModuleHandle(NULL); |
175 if (instance == NULL) { | |
176 SDL_SetError("GetModuleHandle() failed with error code %d.", GetLastError()); | |
177 return -1; | |
178 } | |
179 ret = IDirectInput_Initialize(dinput, instance, DIRECTINPUT_VERSION); | |
175 if (FAILED(ret)) { | 180 if (FAILED(ret)) { |
176 DI_SetError("Initializing DirectInput device",ret); | 181 DI_SetError("Initializing DirectInput device",ret); |
177 return -1; | 182 return -1; |
178 } | 183 } |
179 | 184 |