Skip to content

Commit

Permalink
SDL 9871:381981a8adb6
Browse files Browse the repository at this point in the history
  • Loading branch information
ruby0x1 committed Sep 18, 2015
1 parent f314cd7 commit d45c280
Show file tree
Hide file tree
Showing 21 changed files with 1,156 additions and 853 deletions.
1,788 changes: 1,032 additions & 756 deletions include/SDL_egl.h

Large diffs are not rendered by default.

16 changes: 15 additions & 1 deletion include/SDL_hints.h
Original file line number Diff line number Diff line change
Expand Up @@ -532,14 +532,28 @@ extern "C" {
*
*/
#define SDL_HINT_MAC_BACKGROUND_APP "SDL_MAC_BACKGROUND_APP"

/**
* \brief Android APK expansion main file version. Should be a string number like "1", "2" etc.
*
* Must be set together with SDL_HINT_ANDROID_APK_EXPANSION_PATCH_FILE_VERSION.
*
* If both hints were set then SDL_RWFromFile() will look into expansion files
* after a given relative path was not found in the internal storage and assets.
*
* By default this hint is not set and the APK expansion files are not searched.
*/
#define SDL_HINT_ANDROID_APK_EXPANSION_MAIN_FILE_VERSION "SDL_ANDROID_APK_EXPANSION_MAIN_FILE_VERSION"

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

Expand Down
4 changes: 2 additions & 2 deletions include/SDL_render.h
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ extern DECLSPEC int SDLCALL SDL_GetRendererOutputSize(SDL_Renderer * renderer,
* \param w The width of the texture in pixels.
* \param h The height of the texture in pixels.
*
* \return The created texture is returned, or 0 if no rendering context was
* \return The created texture is returned, or NULL if no rendering context was
* active, the format was unsupported, or the width or height were out
* of range.
*
Expand All @@ -248,7 +248,7 @@ extern DECLSPEC SDL_Texture * SDLCALL SDL_CreateTexture(SDL_Renderer * renderer,
* \param renderer The renderer.
* \param surface The surface containing pixel data used to fill the texture.
*
* \return The created texture is returned, or 0 on error.
* \return The created texture is returned, or NULL on error.
*
* \note The surface is not modified or freed by this function.
*
Expand Down
4 changes: 2 additions & 2 deletions include/SDL_revision.h
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#define SDL_REVISION "hg-9859:2ec928ff921c"
#define SDL_REVISION_NUMBER 9859
#define SDL_REVISION "hg-9871:381981a8adb6"
#define SDL_REVISION_NUMBER 9871
2 changes: 1 addition & 1 deletion include/SDL_timer.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ typedef int SDL_TimerID;
/**
* \brief Add a new timer to the pool of timers already running.
*
* \return A timer ID, or NULL when an error occurs.
* \return A timer ID, or 0 when an error occurs.
*/
extern DECLSPEC SDL_TimerID SDLCALL SDL_AddTimer(Uint32 interval,
SDL_TimerCallback callback,
Expand Down
17 changes: 10 additions & 7 deletions src/core/android/SDL_android.c
Original file line number Diff line number Diff line change
Expand Up @@ -160,15 +160,15 @@ JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_onNativeResize(
}

/* Paddown */
JNIEXPORT int JNICALL Java_org_libsdl_app_SDLActivity_onNativePadDown(
JNIEXPORT jint JNICALL Java_org_libsdl_app_SDLActivity_onNativePadDown(
JNIEnv* env, jclass jcls,
jint device_id, jint keycode)
{
return Android_OnPadDown(device_id, keycode);
}

/* Padup */
JNIEXPORT int JNICALL Java_org_libsdl_app_SDLActivity_onNativePadUp(
JNIEXPORT jint JNICALL Java_org_libsdl_app_SDLActivity_onNativePadUp(
JNIEnv* env, jclass jcls,
jint device_id, jint keycode)
{
Expand All @@ -192,7 +192,7 @@ JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_onNativeHat(
}


JNIEXPORT int JNICALL Java_org_libsdl_app_SDLActivity_nativeAddJoystick(
JNIEXPORT jint JNICALL Java_org_libsdl_app_SDLActivity_nativeAddJoystick(
JNIEnv* env, jclass jcls,
jint device_id, jstring device_name, jint is_accelerometer,
jint nbuttons, jint naxes, jint nhats, jint nballs)
Expand All @@ -207,7 +207,7 @@ JNIEXPORT int JNICALL Java_org_libsdl_app_SDLActivity_nativeAddJoystick(
return retval;
}

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

if (Android_JNI_ExceptionOccurred(SDL_FALSE)) {
/* Exception is checked first because it always needs to be cleared.
* If no exception occurred then the last SDL error message is kept.
*/
if (Android_JNI_ExceptionOccurred(SDL_FALSE) || !inputStream) {
goto failure;
}
}
Expand Down
9 changes: 8 additions & 1 deletion src/core/windows/SDL_xinput.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,15 @@ WIN_LoadXInputDLL(void)
s_pXInputDLL = LoadLibrary(L"XInput1_4.dll"); /* 1.4 Ships with Windows 8. */
if (!s_pXInputDLL) {
version = (1 << 16) | 3;
s_pXInputDLL = LoadLibrary(L"XInput1_3.dll"); /* 1.3 Ships with Vista and Win7, can be installed as a redistributable component. */
s_pXInputDLL = LoadLibrary(L"XInput1_3.dll"); /* 1.3 can be installed as a redistributable component. */
}
if (!s_pXInputDLL) {
s_pXInputDLL = LoadLibrary(L"bin\\XInput1_3.dll");
}
if (!s_pXInputDLL) {
/* "9.1.0" Ships with Vista and Win7, and is more limited than 1.3+ (e.g. XInputGetStateEx is not available.) */
s_pXInputDLL = LoadLibrary(L"XInput9_1_0.dll");
}
if (!s_pXInputDLL) {
return -1;
}
Expand All @@ -99,6 +103,9 @@ WIN_LoadXInputDLL(void)

/* 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... */
SDL_XInputGetState = (XInputGetState_t)GetProcAddress((HMODULE)s_pXInputDLL, (LPCSTR)100);
if (!SDL_XInputGetState) {
SDL_XInputGetState = (XInputGetState_t)GetProcAddress((HMODULE)s_pXInputDLL, "XInputGetState");
}
SDL_XInputSetState = (XInputSetState_t)GetProcAddress((HMODULE)s_pXInputDLL, "XInputSetState");
SDL_XInputGetCapabilities = (XInputGetCapabilities_t)GetProcAddress((HMODULE)s_pXInputDLL, "XInputGetCapabilities");
if (!SDL_XInputGetState || !SDL_XInputSetState || !SDL_XInputGetCapabilities) {
Expand Down
1 change: 1 addition & 0 deletions src/joystick/darwin/SDL_sysjoystick_c.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include "../../SDL_internal.h"

#ifndef SDL_JOYSTICK_IOKIT_H
#define SDL_JOYSTICK_IOKIT_H

#include <IOKit/hid/IOHIDLib.h>

Expand Down
9 changes: 3 additions & 6 deletions src/joystick/emscripten/SDL_sysjoystick.c
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,7 @@ SDL_SYS_JoystickInit(void)

/* Check if gamepad is supported by browser */
if (numjs == EMSCRIPTEN_RESULT_NOT_SUPPORTED) {
SDL_SetError("Gamepads not supported");
return -1;
return SDL_SetError("Gamepads not supported");
}

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

if(retval != EMSCRIPTEN_RESULT_SUCCESS) {
SDL_SYS_JoystickQuit();
SDL_SetError("Could not set gamepad connect callback");
return -1;
return SDL_SetError("Could not set gamepad connect callback");
}

retval = emscripten_set_gamepaddisconnected_callback(NULL,
0,
Emscripten_JoyStickDisconnected);
if(retval != EMSCRIPTEN_RESULT_SUCCESS) {
SDL_SYS_JoystickQuit();
SDL_SetError("Could not set gamepad disconnect callback");
return -1;
return SDL_SetError("Could not set gamepad disconnect callback");
}

return 0;
Expand Down
2 changes: 1 addition & 1 deletion src/render/SDL_render.c
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ SDL_CreateTexture(SDL_Renderer * renderer, Uint32 format, int access, int w, int
if (IsSupportedFormat(renderer, format)) {
if (renderer->CreateTexture(renderer, texture) < 0) {
SDL_DestroyTexture(texture);
return 0;
return NULL;
}
} else {
texture->native = SDL_CreateTexture(renderer,
Expand Down
3 changes: 0 additions & 3 deletions src/thread/pthread/SDL_systhread.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ int
SDL_SYS_CreateThread(SDL_Thread * thread, void *args)
{
pthread_attr_t type;
size_t ss;
const char *hint = SDL_GetHint(SDL_HINT_THREAD_STACK_SIZE);

/* do this here before any threads exist, so there's no race condition. */
Expand Down Expand Up @@ -116,8 +115,6 @@ SDL_SYS_CreateThread(SDL_Thread * thread, void *args)
pthread_attr_setstacksize(&type, stacksize);
}
}

pthread_attr_getstacksize(&type, &ss);

/* Create the thread and go! */
if (pthread_create(&thread->handle, &type, RunThread, args) != 0) {
Expand Down
4 changes: 2 additions & 2 deletions src/video/psp/SDL_pspevents.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
#define IRKBD_CONFIG_FILE NULL /* this will take ms0:/seplugins/pspirkeyb.ini */

static int irkbd_ready = 0;
static SDLKey keymap[256];
static SDL_Keycode keymap[256];
#endif

static enum PspHprmKeys hprm = 0;
Expand Down Expand Up @@ -124,7 +124,7 @@ void PSP_PumpEvents(_THIS)
/* not tested */
/* SDL_PrivateKeyboard(pressed?SDL_PRESSED:SDL_RELEASED, &sym); */
SDL_SendKeyboardKey((keys & keymap_psp[i].id) ?
SDL_PRESSED : SDL_RELEASED, SDL_GetScancodeFromKey(keymap[raw]);
SDL_PRESSED : SDL_RELEASED, SDL_GetScancodeFromKey(keymap[raw]));

}
}
Expand Down
8 changes: 2 additions & 6 deletions src/video/uikit/SDL_uikitopenglview.m
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,8 @@ - (instancetype)initWithFrame:(CGRect)frame
GLint maxsamples = 0;
glGetIntegerv(GL_MAX_SAMPLES, &maxsamples);

/* Verify that the sample count is supported before creating any
* multisample Renderbuffers, to avoid generating GL errors. */
if (samples > maxsamples) {
SDL_SetError("Failed creating OpenGL ES framebuffer: Unsupported MSAA sample count");
return nil;
}
/* Clamp the samples to the max supported count. */
samples = MIN(samples, maxsamples);
}

if (sRGB) {
Expand Down
23 changes: 20 additions & 3 deletions src/video/uikit/SDL_uikitview.m
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,22 @@ - (CGPoint)touchLocation:(UITouch *)touch shouldNormalize:(BOOL)normalize
return point;
}

- (float)pressureForTouch:(UITouch *)touch
{
#ifdef __IPHONE_9_0
if ([touch respondsToSelector:@selector(force)]) {
return (float) touch.force;
}
#endif

return 1.0f;
}

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
for (UITouch *touch in touches) {
float pressure = [self pressureForTouch:touch];

if (!firstFingerDown) {
CGPoint locationInView = [self touchLocation:touch shouldNormalize:NO];

Expand All @@ -140,13 +153,15 @@ - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event

CGPoint locationInView = [self touchLocation:touch shouldNormalize:YES];
SDL_SendTouch(touchId, (SDL_FingerID)((size_t)touch),
SDL_TRUE, locationInView.x, locationInView.y, 1.0f);
SDL_TRUE, locationInView.x, locationInView.y, pressure);
}
}

- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
for (UITouch *touch in touches) {
float pressure = [self pressureForTouch:touch];

if (touch == firstFingerDown) {
/* send mouse up */
SDL_SendMouseButton(sdlwindow, SDL_TOUCH_MOUSEID, SDL_RELEASED, SDL_BUTTON_LEFT);
Expand All @@ -155,7 +170,7 @@ - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event

CGPoint locationInView = [self touchLocation:touch shouldNormalize:YES];
SDL_SendTouch(touchId, (SDL_FingerID)((size_t)touch),
SDL_FALSE, locationInView.x, locationInView.y, 1.0f);
SDL_FALSE, locationInView.x, locationInView.y, pressure);
}
}

Expand All @@ -167,6 +182,8 @@ - (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
for (UITouch *touch in touches) {
float pressure = [self pressureForTouch:touch];

if (touch == firstFingerDown) {
CGPoint locationInView = [self touchLocation:touch shouldNormalize:NO];

Expand All @@ -176,7 +193,7 @@ - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event

CGPoint locationInView = [self touchLocation:touch shouldNormalize:YES];
SDL_SendTouchMotion(touchId, (SDL_FingerID)((size_t)touch),
locationInView.x, locationInView.y, 1.0f);
locationInView.x, locationInView.y, pressure);
}
}

Expand Down
9 changes: 6 additions & 3 deletions src/video/windows/SDL_windowsmessagebox.c
Original file line number Diff line number Diff line change
Expand Up @@ -297,9 +297,12 @@ static WIN_DialogData *CreateDialogData(int w, int h, const char *caption)

/* Font size - convert to logical font size for dialog parameter. */
{
HDC ScreenDC = GetDC(0);
WordToPass = (WORD)(-72 * NCM.lfMessageFont.lfHeight / GetDeviceCaps(ScreenDC, LOGPIXELSY));
ReleaseDC(0, ScreenDC);
HDC ScreenDC = GetDC(NULL);
int LogicalPixelsY = GetDeviceCaps(ScreenDC, LOGPIXELSY);
if (!LogicalPixelsY) /* This can happen if the application runs out of GDI handles */
LogicalPixelsY = 72;
WordToPass = (WORD)(-72 * NCM.lfMessageFont.lfHeight / LogicalPixelsY);
ReleaseDC(NULL, ScreenDC);
}

if (!AddDialogData(dialog, &WordToPass, 2)) {
Expand Down
Loading

0 comments on commit d45c280

Please sign in to comment.