mirror of
https://github.com/Ryujinx/SDL.git
synced 2024-12-23 14:35:40 +00:00
Android active driver check (#6850)
Check if a driver is active before attempting to handle the devices. Otherwise an assertion will fail.
This commit is contained in:
parent
36c87d9f27
commit
311b02f0b5
|
@ -940,19 +940,23 @@ JNIEXPORT void JNICALL
|
|||
SDL_JAVA_AUDIO_INTERFACE(addAudioDevice)(JNIEnv *env, jclass jcls, jboolean is_capture,
|
||||
jint device_id)
|
||||
{
|
||||
if (SDL_GetCurrentAudioDriver() != NULL) {
|
||||
char device_name[64];
|
||||
SDL_snprintf(device_name, sizeof(device_name), "%d", device_id);
|
||||
SDL_Log("Adding device with name %s, capture %d", device_name, is_capture);
|
||||
SDL_AddAudioDevice(is_capture, SDL_strdup(device_name), NULL, (void *)((size_t)device_id + 1));
|
||||
}
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
SDL_JAVA_AUDIO_INTERFACE(removeAudioDevice)(JNIEnv *env, jclass jcls, jboolean is_capture,
|
||||
jint device_id)
|
||||
{
|
||||
if (SDL_GetCurrentAudioDriver() != NULL) {
|
||||
SDL_Log("Removing device with handle %d, capture %d", device_id + 1, is_capture);
|
||||
SDL_RemoveAudioDevice(is_capture, (void *)((size_t)device_id + 1));
|
||||
}
|
||||
}
|
||||
|
||||
/* Paddown */
|
||||
JNIEXPORT jint JNICALL SDL_JAVA_CONTROLLER_INTERFACE(onNativePadDown)(
|
||||
|
|
Loading…
Reference in a new issue