Win32: Added missing throwException in Controller.cpp
This commit is contained in:
parent
7bd59ed27d
commit
e1656b862b
|
@ -117,33 +117,33 @@ JNIEXPORT void JNICALL Java_org_lwjgl_input_Controller_initIDs(JNIEnv * env, jcl
|
||||||
*/
|
*/
|
||||||
JNIEXPORT void JNICALL Java_org_lwjgl_input_Controller_nCreate(JNIEnv *env, jclass clazz) {
|
JNIEXPORT void JNICALL Java_org_lwjgl_input_Controller_nCreate(JNIEnv *env, jclass clazz) {
|
||||||
|
|
||||||
// assert that window has been created
|
// assert that window has been created
|
||||||
if(hwnd == NULL) {
|
if(hwnd == NULL) {
|
||||||
throwException(env, "Please create the window before initializing input devices");
|
throwException(env, "Please create the window before initializing input devices");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create the DirectInput object.
|
// Create the DirectInput object.
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
hr = DirectInputCreate(dll_handle, DIRECTINPUT_VERSION, &cDI, NULL);
|
hr = DirectInputCreate(dll_handle, DIRECTINPUT_VERSION, &cDI, NULL);
|
||||||
if (FAILED(hr)) {
|
if (FAILED(hr)) {
|
||||||
printfDebug("DirectInputCreate failed\n");
|
|
||||||
ShutdownController();
|
ShutdownController();
|
||||||
|
throwException(env, "DirectInputCreate failed\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Find all Controllers */
|
/* Find all Controllers */
|
||||||
EnumerateControllers();
|
EnumerateControllers();
|
||||||
if (!cCreate_success) {
|
if (!cCreate_success) {
|
||||||
throwException(env, "Failed to enumerate.");
|
|
||||||
ShutdownController();
|
ShutdownController();
|
||||||
|
throwException(env, "Failed to enumerate.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check that we got at least 1 controller */
|
/* check that we got at least 1 controller */
|
||||||
if (cDIDevice == NULL) {
|
if (cDIDevice == NULL) {
|
||||||
throwException(env, "No devices found.");
|
|
||||||
ShutdownController();
|
ShutdownController();
|
||||||
|
throwException(env, "No devices found.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -154,8 +154,8 @@ JNIEXPORT void JNICALL Java_org_lwjgl_input_Controller_nCreate(JNIEnv *env, jcla
|
||||||
/* Enumerate capabilities of Controller */
|
/* Enumerate capabilities of Controller */
|
||||||
EnumerateControllerCapabilities();
|
EnumerateControllerCapabilities();
|
||||||
if (!cCreate_success) {
|
if (!cCreate_success) {
|
||||||
throwException(env, "Falied to enumerate capabilities.");
|
|
||||||
ShutdownController();
|
ShutdownController();
|
||||||
|
throwException(env, "Falied to enumerate capabilities.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -180,8 +180,8 @@ JNIEXPORT void JNICALL Java_org_lwjgl_input_Controller_nCreate(JNIEnv *env, jcla
|
||||||
/* Aquire the Controller */
|
/* Aquire the Controller */
|
||||||
hr = cDIDevice->Acquire();
|
hr = cDIDevice->Acquire();
|
||||||
if(FAILED(hr)) {
|
if(FAILED(hr)) {
|
||||||
throwException(env, "Acquire failed");
|
|
||||||
ShutdownController();
|
ShutdownController();
|
||||||
|
throwException(env, "Acquire failed");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue