Skip to content

Commit d45c280

Browse files
committed
SDL 9871:381981a8adb6
1 parent f314cd7 commit d45c280

21 files changed

+1156
-853
lines changed

include/SDL_egl.h

Lines changed: 1032 additions & 756 deletions
Large diffs are not rendered by default.

include/SDL_hints.h

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -532,14 +532,28 @@ extern "C" {
532532
*
533533
*/
534534
#define SDL_HINT_MAC_BACKGROUND_APP "SDL_MAC_BACKGROUND_APP"
535-
535+
536536
/**
537537
* \brief Android APK expansion main file version. Should be a string number like "1", "2" etc.
538+
*
539+
* Must be set together with SDL_HINT_ANDROID_APK_EXPANSION_PATCH_FILE_VERSION.
540+
*
541+
* If both hints were set then SDL_RWFromFile() will look into expansion files
542+
* after a given relative path was not found in the internal storage and assets.
543+
*
544+
* By default this hint is not set and the APK expansion files are not searched.
538545
*/
539546
#define SDL_HINT_ANDROID_APK_EXPANSION_MAIN_FILE_VERSION "SDL_ANDROID_APK_EXPANSION_MAIN_FILE_VERSION"
540547

541548
/**
542549
* \brief Android APK expansion patch file version. Should be a string number like "1", "2" etc.
550+
*
551+
* Must be set together with SDL_HINT_ANDROID_APK_EXPANSION_MAIN_FILE_VERSION.
552+
*
553+
* If both hints were set then SDL_RWFromFile() will look into expansion files
554+
* after a given relative path was not found in the internal storage and assets.
555+
*
556+
* By default this hint is not set and the APK expansion files are not searched.
543557
*/
544558
#define SDL_HINT_ANDROID_APK_EXPANSION_PATCH_FILE_VERSION "SDL_ANDROID_APK_EXPANSION_PATCH_FILE_VERSION"
545559

include/SDL_render.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ extern DECLSPEC int SDLCALL SDL_GetRendererOutputSize(SDL_Renderer * renderer,
229229
* \param w The width of the texture in pixels.
230230
* \param h The height of the texture in pixels.
231231
*
232-
* \return The created texture is returned, or 0 if no rendering context was
232+
* \return The created texture is returned, or NULL if no rendering context was
233233
* active, the format was unsupported, or the width or height were out
234234
* of range.
235235
*
@@ -248,7 +248,7 @@ extern DECLSPEC SDL_Texture * SDLCALL SDL_CreateTexture(SDL_Renderer * renderer,
248248
* \param renderer The renderer.
249249
* \param surface The surface containing pixel data used to fill the texture.
250250
*
251-
* \return The created texture is returned, or 0 on error.
251+
* \return The created texture is returned, or NULL on error.
252252
*
253253
* \note The surface is not modified or freed by this function.
254254
*

include/SDL_revision.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
#define SDL_REVISION "hg-9859:2ec928ff921c"
2-
#define SDL_REVISION_NUMBER 9859
1+
#define SDL_REVISION "hg-9871:381981a8adb6"
2+
#define SDL_REVISION_NUMBER 9871

include/SDL_timer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ typedef int SDL_TimerID;
8888
/**
8989
* \brief Add a new timer to the pool of timers already running.
9090
*
91-
* \return A timer ID, or NULL when an error occurs.
91+
* \return A timer ID, or 0 when an error occurs.
9292
*/
9393
extern DECLSPEC SDL_TimerID SDLCALL SDL_AddTimer(Uint32 interval,
9494
SDL_TimerCallback callback,

src/core/android/SDL_android.c

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -160,15 +160,15 @@ JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_onNativeResize(
160160
}
161161

162162
/* Paddown */
163-
JNIEXPORT int JNICALL Java_org_libsdl_app_SDLActivity_onNativePadDown(
163+
JNIEXPORT jint JNICALL Java_org_libsdl_app_SDLActivity_onNativePadDown(
164164
JNIEnv* env, jclass jcls,
165165
jint device_id, jint keycode)
166166
{
167167
return Android_OnPadDown(device_id, keycode);
168168
}
169169

170170
/* Padup */
171-
JNIEXPORT int JNICALL Java_org_libsdl_app_SDLActivity_onNativePadUp(
171+
JNIEXPORT jint JNICALL Java_org_libsdl_app_SDLActivity_onNativePadUp(
172172
JNIEnv* env, jclass jcls,
173173
jint device_id, jint keycode)
174174
{
@@ -192,7 +192,7 @@ JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_onNativeHat(
192192
}
193193

194194

195-
JNIEXPORT int JNICALL Java_org_libsdl_app_SDLActivity_nativeAddJoystick(
195+
JNIEXPORT jint JNICALL Java_org_libsdl_app_SDLActivity_nativeAddJoystick(
196196
JNIEnv* env, jclass jcls,
197197
jint device_id, jstring device_name, jint is_accelerometer,
198198
jint nbuttons, jint naxes, jint nhats, jint nballs)
@@ -207,7 +207,7 @@ JNIEXPORT int JNICALL Java_org_libsdl_app_SDLActivity_nativeAddJoystick(
207207
return retval;
208208
}
209209

210-
JNIEXPORT int JNICALL Java_org_libsdl_app_SDLActivity_nativeRemoveJoystick(
210+
JNIEXPORT jint JNICALL Java_org_libsdl_app_SDLActivity_nativeRemoveJoystick(
211211
JNIEnv* env, jclass jcls, jint device_id)
212212
{
213213
return Android_RemoveJoystick(device_id);
@@ -785,12 +785,15 @@ static int Internal_Android_JNI_FileOpen(SDL_RWops* ctx)
785785
"open", "(Ljava/lang/String;I)Ljava/io/InputStream;");
786786
inputStream = (*mEnv)->CallObjectMethod(mEnv, assetManager, mid, fileNameJString, 1 /* ACCESS_RANDOM */);
787787
if (Android_JNI_ExceptionOccurred(SDL_FALSE)) {
788-
// Try fallback to APK Extension files
788+
/* Try fallback to APK expansion files */
789789
mid = (*mEnv)->GetMethodID(mEnv, (*mEnv)->GetObjectClass(mEnv, context),
790-
"openAPKExtensionInputStream", "(Ljava/lang/String;)Ljava/io/InputStream;");
790+
"openAPKExpansionInputStream", "(Ljava/lang/String;)Ljava/io/InputStream;");
791791
inputStream = (*mEnv)->CallObjectMethod(mEnv, context, mid, fileNameJString);
792792

793-
if (Android_JNI_ExceptionOccurred(SDL_FALSE)) {
793+
/* Exception is checked first because it always needs to be cleared.
794+
* If no exception occurred then the last SDL error message is kept.
795+
*/
796+
if (Android_JNI_ExceptionOccurred(SDL_FALSE) || !inputStream) {
794797
goto failure;
795798
}
796799
}

src/core/windows/SDL_xinput.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,15 @@ WIN_LoadXInputDLL(void)
8484
s_pXInputDLL = LoadLibrary(L"XInput1_4.dll"); /* 1.4 Ships with Windows 8. */
8585
if (!s_pXInputDLL) {
8686
version = (1 << 16) | 3;
87-
s_pXInputDLL = LoadLibrary(L"XInput1_3.dll"); /* 1.3 Ships with Vista and Win7, can be installed as a redistributable component. */
87+
s_pXInputDLL = LoadLibrary(L"XInput1_3.dll"); /* 1.3 can be installed as a redistributable component. */
8888
}
8989
if (!s_pXInputDLL) {
9090
s_pXInputDLL = LoadLibrary(L"bin\\XInput1_3.dll");
9191
}
92+
if (!s_pXInputDLL) {
93+
/* "9.1.0" Ships with Vista and Win7, and is more limited than 1.3+ (e.g. XInputGetStateEx is not available.) */
94+
s_pXInputDLL = LoadLibrary(L"XInput9_1_0.dll");
95+
}
9296
if (!s_pXInputDLL) {
9397
return -1;
9498
}
@@ -99,6 +103,9 @@ WIN_LoadXInputDLL(void)
99103

100104
/* 100 is the ordinal for _XInputGetStateEx, which returns the same struct as XinputGetState, but with extra data in wButtons for the guide button, we think... */
101105
SDL_XInputGetState = (XInputGetState_t)GetProcAddress((HMODULE)s_pXInputDLL, (LPCSTR)100);
106+
if (!SDL_XInputGetState) {
107+
SDL_XInputGetState = (XInputGetState_t)GetProcAddress((HMODULE)s_pXInputDLL, "XInputGetState");
108+
}
102109
SDL_XInputSetState = (XInputSetState_t)GetProcAddress((HMODULE)s_pXInputDLL, "XInputSetState");
103110
SDL_XInputGetCapabilities = (XInputGetCapabilities_t)GetProcAddress((HMODULE)s_pXInputDLL, "XInputGetCapabilities");
104111
if (!SDL_XInputGetState || !SDL_XInputSetState || !SDL_XInputGetCapabilities) {

src/joystick/darwin/SDL_sysjoystick_c.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include "../../SDL_internal.h"
2222

2323
#ifndef SDL_JOYSTICK_IOKIT_H
24+
#define SDL_JOYSTICK_IOKIT_H
2425

2526
#include <IOKit/hid/IOHIDLib.h>
2627

src/joystick/emscripten/SDL_sysjoystick.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -200,8 +200,7 @@ SDL_SYS_JoystickInit(void)
200200

201201
/* Check if gamepad is supported by browser */
202202
if (numjs == EMSCRIPTEN_RESULT_NOT_SUPPORTED) {
203-
SDL_SetError("Gamepads not supported");
204-
return -1;
203+
return SDL_SetError("Gamepads not supported");
205204
}
206205

207206
/* handle already connected gamepads */
@@ -222,17 +221,15 @@ SDL_SYS_JoystickInit(void)
222221

223222
if(retval != EMSCRIPTEN_RESULT_SUCCESS) {
224223
SDL_SYS_JoystickQuit();
225-
SDL_SetError("Could not set gamepad connect callback");
226-
return -1;
224+
return SDL_SetError("Could not set gamepad connect callback");
227225
}
228226

229227
retval = emscripten_set_gamepaddisconnected_callback(NULL,
230228
0,
231229
Emscripten_JoyStickDisconnected);
232230
if(retval != EMSCRIPTEN_RESULT_SUCCESS) {
233231
SDL_SYS_JoystickQuit();
234-
SDL_SetError("Could not set gamepad disconnect callback");
235-
return -1;
232+
return SDL_SetError("Could not set gamepad disconnect callback");
236233
}
237234

238235
return 0;

src/render/SDL_render.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ SDL_CreateTexture(SDL_Renderer * renderer, Uint32 format, int access, int w, int
457457
if (IsSupportedFormat(renderer, format)) {
458458
if (renderer->CreateTexture(renderer, texture) < 0) {
459459
SDL_DestroyTexture(texture);
460-
return 0;
460+
return NULL;
461461
}
462462
} else {
463463
texture->native = SDL_CreateTexture(renderer,

0 commit comments

Comments
 (0)