Throw exception when win32 can't create DirectInput for some reason
This commit is contained in:
parent
054e1f9f29
commit
8099826ab7
|
@ -194,24 +194,23 @@ static int findPixelFormat(JNIEnv *env, int bpp, int alpha, int depth, int stenc
|
||||||
* Create DirectInput.
|
* Create DirectInput.
|
||||||
* Returns true for success, or false for failure
|
* Returns true for success, or false for failure
|
||||||
*/
|
*/
|
||||||
static bool createDirectInput()
|
static bool createDirectInput(JNIEnv *env)
|
||||||
{
|
{
|
||||||
// Create input
|
// Create input
|
||||||
HRESULT ret = DirectInputCreate(dll_handle, DIRECTINPUT_VERSION, &lpdi, NULL);
|
HRESULT ret = DirectInputCreate(dll_handle, DIRECTINPUT_VERSION, &lpdi, NULL);
|
||||||
if (ret != DI_OK && ret != DIERR_BETADIRECTINPUTVERSION ) {
|
if (ret != DI_OK && ret != DIERR_BETADIRECTINPUTVERSION ) {
|
||||||
printfDebug("Failed to create directinput");
|
|
||||||
switch (ret) {
|
switch (ret) {
|
||||||
case DIERR_INVALIDPARAM :
|
case DIERR_INVALIDPARAM :
|
||||||
printfDebug(" - Invalid parameter\n");
|
throwException(env, "Failed to create DirectInput - Invalid parameter\n");
|
||||||
break;
|
break;
|
||||||
case DIERR_OLDDIRECTINPUTVERSION :
|
case DIERR_OLDDIRECTINPUTVERSION :
|
||||||
printfDebug(" - Old Version\n");
|
throwException(env, "Failed to create DirectInput - Old Version\n");
|
||||||
break;
|
break;
|
||||||
case DIERR_OUTOFMEMORY :
|
case DIERR_OUTOFMEMORY :
|
||||||
printfDebug(" - Out Of Memory\n");
|
throwException(env, "Failed to create DirectInput - Out Of Memory\n");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
printfDebug(" - Unknown failure\n");
|
throwException(env, "Failed to create DirectInput - Unknown failure\n");
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
|
@ -552,7 +551,7 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Window_nCreate
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!createDirectInput()) {
|
if (!createDirectInput(env)) {
|
||||||
// Close the window
|
// Close the window
|
||||||
closeWindow();
|
closeWindow();
|
||||||
extgl_Close();
|
extgl_Close();
|
||||||
|
|
Loading…
Reference in New Issue