diff --git a/include/SDL3/SDL_system.h b/include/SDL3/SDL_system.h index 8f92b615da..6d3e61a403 100644 --- a/include/SDL3/SDL_system.h +++ b/include/SDL3/SDL_system.h @@ -261,13 +261,6 @@ extern SDL_DECLSPEC void SDLCALL SDL_SetiOSEventPump(bool enabled); /* * Platform specific functions for Android */ - -#if defined(__cplusplus) -typedef struct _JNIEnv JNIEnv; -#else -typedef const struct JNINativeInterface* JNIEnv; -#endif - #ifdef SDL_PLATFORM_ANDROID /** @@ -290,7 +283,7 @@ typedef const struct JNINativeInterface* JNIEnv; * * \sa SDL_GetAndroidActivity */ -extern SDL_DECLSPEC JNIEnv * SDLCALL SDL_GetAndroidJNIEnv(void); +extern SDL_DECLSPEC void * SDLCALL SDL_GetAndroidJNIEnv(void); /** * Retrieve the Java instance of the Android activity class. diff --git a/src/core/SDL_core_unsupported.c b/src/core/SDL_core_unsupported.c index 54fa095a85..b36c7f7441 100644 --- a/src/core/SDL_core_unsupported.c +++ b/src/core/SDL_core_unsupported.c @@ -146,8 +146,8 @@ const char *SDL_GetAndroidInternalStoragePath(void) return NULL; } -SDL_DECLSPEC JNIEnv *SDLCALL SDL_GetAndroidJNIEnv(void); -JNIEnv *SDL_GetAndroidJNIEnv(void) +SDL_DECLSPEC void *SDLCALL SDL_GetAndroidJNIEnv(void); +void *SDL_GetAndroidJNIEnv(void) { SDL_Unsupported(); return NULL; diff --git a/src/core/android/SDL_android.c b/src/core/android/SDL_android.c index 7f8b56ee88..78d8b71941 100644 --- a/src/core/android/SDL_android.c +++ b/src/core/android/SDL_android.c @@ -2177,7 +2177,7 @@ bool Android_JNI_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *b ////////////////////////////////////////////////////////////////////////////// */ -JNIEnv *SDL_GetAndroidJNIEnv(void) +void *SDL_GetAndroidJNIEnv(void) { return Android_JNI_GetEnv(); } diff --git a/src/dynapi/SDL_dynapi_procs.h b/src/dynapi/SDL_dynapi_procs.h index 165de3c064..f308ce52ef 100644 --- a/src/dynapi/SDL_dynapi_procs.h +++ b/src/dynapi/SDL_dynapi_procs.h @@ -255,7 +255,7 @@ SDL_DYNAPI_PROC(const char*,SDL_GetAndroidCachePath,(void),(),return) SDL_DYNAPI_PROC(const char*,SDL_GetAndroidExternalStoragePath,(void),(),return) SDL_DYNAPI_PROC(Uint32,SDL_GetAndroidExternalStorageState,(void),(),return) SDL_DYNAPI_PROC(const char*,SDL_GetAndroidInternalStoragePath,(void),(),return) -SDL_DYNAPI_PROC(JNIEnv*,SDL_GetAndroidJNIEnv,(void),(),return) +SDL_DYNAPI_PROC(void*,SDL_GetAndroidJNIEnv,(void),(),return) SDL_DYNAPI_PROC(int,SDL_GetAndroidSDKVersion,(void),(),return) SDL_DYNAPI_PROC(const char*,SDL_GetAppMetadataProperty,(const char *a),(a),return) SDL_DYNAPI_PROC(SDL_AssertionHandler,SDL_GetAssertionHandler,(void **a),(a),return) diff --git a/src/hidapi/android/hid.cpp b/src/hidapi/android/hid.cpp index 86040d655f..13f312921a 100644 --- a/src/hidapi/android/hid.cpp +++ b/src/hidapi/android/hid.cpp @@ -492,7 +492,7 @@ public: bool BOpen() { - JNIEnv *env = SDL_GetAndroidJNIEnv(); + JNIEnv *env = (JNIEnv *)SDL_GetAndroidJNIEnv(); if ( !g_HIDDeviceManagerCallbackHandler ) { @@ -624,7 +624,7 @@ public: int WriteReport( const unsigned char *pData, size_t nDataLen, bool bFeature ) { - JNIEnv *env = SDL_GetAndroidJNIEnv(); + JNIEnv *env = (JNIEnv *)SDL_GetAndroidJNIEnv(); if ( !g_HIDDeviceManagerCallbackHandler ) { @@ -654,7 +654,7 @@ public: int ReadReport( unsigned char *pData, size_t nDataLen, bool bFeature ) { - JNIEnv *env = SDL_GetAndroidJNIEnv(); + JNIEnv *env = (JNIEnv *)SDL_GetAndroidJNIEnv(); if ( !g_HIDDeviceManagerCallbackHandler ) { @@ -727,7 +727,7 @@ public: void Close( bool bDeleteDevice ) { - JNIEnv *env = SDL_GetAndroidJNIEnv(); + JNIEnv *env = (JNIEnv *)SDL_GetAndroidJNIEnv(); if ( g_HIDDeviceManagerCallbackHandler ) { @@ -1022,7 +1022,7 @@ static void SDLCALL RequestBluetoothPermissionCallback( void *userdata, const ch if ( granted && g_HIDDeviceManagerCallbackHandler ) { - JNIEnv *env = SDL_GetAndroidJNIEnv(); + JNIEnv *env = (JNIEnv *)SDL_GetAndroidJNIEnv(); env->CallBooleanMethod( g_HIDDeviceManagerCallbackHandler, g_midHIDDeviceManagerInitialize, false, true ); } @@ -1035,7 +1035,7 @@ int hid_init(void) // HIDAPI doesn't work well with Android < 4.3 if ( SDL_GetAndroidSDKVersion() >= 18 ) { - JNIEnv *env = SDL_GetAndroidJNIEnv(); + JNIEnv *env = (JNIEnv *)SDL_GetAndroidJNIEnv(); env->CallBooleanMethod( g_HIDDeviceManagerCallbackHandler, g_midHIDDeviceManagerInitialize, true, false );