summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/SDL.c26
-rw-r--r--src/SDL_error.c6
-rw-r--r--src/SDL_error_c.h4
-rw-r--r--src/SDL_hints.c4
-rw-r--r--src/SDL_hints_c.h6
-rw-r--r--src/SDL_log.c25
-rw-r--r--src/atomic/SDL_atomic.c6
-rw-r--r--src/atomic/SDL_spinlock.c10
-rw-r--r--src/audio/SDL_audiocvt.c2
-rw-r--r--src/audio/SDL_audiodev.c4
-rw-r--r--src/audio/SDL_audiomem.h4
-rw-r--r--src/audio/SDL_mixer.c4
-rw-r--r--src/audio/SDL_sysaudio.h2
-rw-r--r--src/audio/SDL_wave.h31
-rw-r--r--src/audio/alsa/SDL_alsa_audio.c2
-rw-r--r--src/audio/alsa/SDL_alsa_audio.h2
-rw-r--r--src/audio/android/SDL_androidaudio.c40
-rw-r--r--src/audio/android/SDL_androidaudio.h2
-rw-r--r--src/audio/arts/SDL_artsaudio.h4
-rw-r--r--src/audio/baudio/SDL_beaudio.h2
-rw-r--r--src/audio/bsd/SDL_bsdaudio.h4
-rw-r--r--src/audio/coreaudio/SDL_coreaudio.c6
-rw-r--r--src/audio/coreaudio/SDL_coreaudio.h2
-rw-r--r--src/audio/directsound/SDL_directsound.h2
-rw-r--r--src/audio/directsound/directx.h24
-rw-r--r--src/audio/disk/SDL_diskaudio.h2
-rw-r--r--src/audio/dsp/SDL_dspaudio.c2
-rw-r--r--src/audio/dsp/SDL_dspaudio.h4
-rw-r--r--src/audio/dummy/SDL_dummyaudio.h2
-rw-r--r--src/audio/esd/SDL_esdaudio.c4
-rw-r--r--src/audio/esd/SDL_esdaudio.h4
-rw-r--r--src/audio/fusionsound/SDL_fsaudio.c6
-rw-r--r--src/audio/fusionsound/SDL_fsaudio.h2
-rw-r--r--src/audio/nas/SDL_nasaudio.h2
-rw-r--r--src/audio/paudio/SDL_paudio.c6
-rw-r--r--src/audio/paudio/SDL_paudio.h4
-rw-r--r--src/audio/psp/SDL_pspaudio.c154
-rw-r--r--src/audio/psp/SDL_pspaudio.h18
-rw-r--r--src/audio/pulseaudio/SDL_pulseaudio.c2
-rw-r--r--src/audio/sun/SDL_sunaudio.c4
-rw-r--r--src/audio/sun/SDL_sunaudio.h2
-rw-r--r--src/audio/winmm/SDL_winmm.h2
-rw-r--r--src/audio/xaudio2/SDL_xaudio2.c10
-rw-r--r--src/core/android/SDL_android.cpp20
-rw-r--r--src/events/SDL_events.c2
-rw-r--r--src/events/SDL_gesture.c5
-rw-r--r--src/events/SDL_keyboard.c124
-rw-r--r--src/events/SDL_mouse.c16
-rw-r--r--src/events/SDL_mouse_c.h2
-rw-r--r--src/events/SDL_touch.c10
-rw-r--r--src/events/SDL_touch_c.h8
-rw-r--r--src/events/SDL_windowevents.c16
-rw-r--r--src/events/blank_cursor.h10
-rw-r--r--src/events/default_cursor.h10
-rw-r--r--src/file/SDL_rwops.c12
-rw-r--r--src/file/cocoa/SDL_rwopsbundlesupport.m40
-rw-r--r--src/haptic/SDL_syshaptic.h2
-rw-r--r--src/haptic/darwin/SDL_syshaptic.c6
-rw-r--r--src/haptic/linux/SDL_syshaptic.c68
-rw-r--r--src/haptic/windows/SDL_syshaptic.c28
-rw-r--r--src/joystick/SDL_gamecontroller.c1279
-rw-r--r--src/joystick/SDL_joystick.c303
-rw-r--r--src/joystick/SDL_joystick_c.h2
-rw-r--r--src/joystick/android/SDL_sysjoystick.c12
-rw-r--r--src/joystick/beos/SDL_bejoystick.cc4
-rw-r--r--src/joystick/bsd/SDL_sysjoystick.c10
-rw-r--r--src/joystick/darwin/SDL_sysjoystick.c556
-rw-r--r--src/joystick/darwin/SDL_sysjoystick_c.h14
-rw-r--r--src/joystick/dummy/SDL_sysjoystick.c4
-rw-r--r--src/joystick/iphoneos/SDLUIAccelerationDelegate.m138
-rw-r--r--src/joystick/iphoneos/SDL_sysjoystick.m40
-rw-r--r--src/joystick/linux/SDL_sysjoystick.c10
-rw-r--r--src/joystick/psp/SDL_sysjoystick.c212
-rw-r--r--src/joystick/windows/SDL_dxjoystick.c1704
-rw-r--r--src/joystick/windows/SDL_dxjoystick_c.h60
-rw-r--r--src/joystick/windows/SDL_mmjoystick.c16
-rw-r--r--src/main/beos/SDL_BApp.h594
-rw-r--r--src/main/psp/SDL_psp_main.c42
-rw-r--r--src/power/beos/SDL_syspower.c4
-rw-r--r--src/power/linux/SDL_syspower.c4
-rw-r--r--src/power/psp/SDL_syspower.c32
-rw-r--r--src/power/uikit/SDL_syspower.m15
-rw-r--r--src/render/SDL_render.c2
-rw-r--r--src/render/SDL_yuv_mmx.c426
-rw-r--r--src/render/SDL_yuv_sw.c22
-rw-r--r--src/render/direct3d/SDL_render_d3d.c50
-rw-r--r--src/render/opengl/SDL_render_gl.c30
-rw-r--r--src/render/opengl/SDL_shaders_gl.c4
-rw-r--r--src/render/opengles/SDL_render_gles.c14
-rw-r--r--src/render/opengles2/SDL_render_gles2.c8
-rw-r--r--src/render/opengles2/SDL_shaders_gles2.c12
-rw-r--r--src/render/psp/SDL_render_psp.c1182
-rw-r--r--src/render/software/SDL_drawline.c1
-rw-r--r--src/render/software/SDL_rotate.c4
-rw-r--r--src/stdlib/SDL_malloc.c20
-rw-r--r--src/test/SDL_test_assert.c128
-rw-r--r--src/test/SDL_test_common.c18
-rw-r--r--src/test/SDL_test_compare.c6
-rw-r--r--src/test/SDL_test_crc32.c40
-rw-r--r--src/test/SDL_test_font.c6370
-rw-r--r--src/test/SDL_test_fuzzer.c480
-rw-r--r--src/test/SDL_test_harness.c1008
-rw-r--r--src/test/SDL_test_imageBlit.c22
-rw-r--r--src/test/SDL_test_imageBlitBlend.c40
-rw-r--r--src/test/SDL_test_imageFace.c8
-rw-r--r--src/test/SDL_test_imagePrimitives.c6
-rw-r--r--src/test/SDL_test_imagePrimitivesBlend.c8
-rw-r--r--src/test/SDL_test_log.c58
-rw-r--r--src/test/SDL_test_md5.c170
-rw-r--r--src/test/SDL_test_random.c14
-rw-r--r--src/thread/SDL_thread.c2
-rw-r--r--src/thread/psp/SDL_syssem.c136
-rw-r--r--src/thread/psp/SDL_systhread.c58
-rw-r--r--src/thread/pthread/SDL_systhread.c2
-rw-r--r--src/thread/windows/SDL_systhread.c6
-rw-r--r--src/timer/SDL_timer.c2
-rw-r--r--src/timer/SDL_timer_c.h4
-rw-r--r--src/timer/psp/SDL_systimer.c20
-rw-r--r--src/timer/unix/SDL_systimer.c2
-rw-r--r--src/timer/windows/SDL_systimer.c4
-rw-r--r--src/video/SDL_RLEaccel.c938
-rw-r--r--src/video/SDL_blit.h602
-rw-r--r--src/video/SDL_bmp.c14
-rw-r--r--src/video/SDL_pixels.c10
-rw-r--r--src/video/SDL_rect.c26
-rw-r--r--src/video/SDL_shape.c49
-rw-r--r--src/video/SDL_surface.c14
-rw-r--r--src/video/SDL_sysvideo.h14
-rw-r--r--src/video/SDL_video.c144
-rw-r--r--src/video/android/SDL_androidkeyboard.c2
-rw-r--r--src/video/android/SDL_androidtouch.c6
-rw-r--r--src/video/android/SDL_androidvideo.c6
-rw-r--r--src/video/android/SDL_androidwindow.c2
-rw-r--r--src/video/bwindow/SDL_BWin.h742
-rw-r--r--src/video/bwindow/SDL_bevents.h2
-rw-r--r--src/video/bwindow/SDL_bmodes.cc2
-rw-r--r--src/video/bwindow/SDL_bmodes.h4
-rw-r--r--src/video/bwindow/SDL_bopengl.h10
-rw-r--r--src/video/cocoa/SDL_cocoaclipboard.m4
-rw-r--r--src/video/cocoa/SDL_cocoaevents.m16
-rw-r--r--src/video/cocoa/SDL_cocoakeyboard.m117
-rw-r--r--src/video/cocoa/SDL_cocoamodes.m8
-rw-r--r--src/video/cocoa/SDL_cocoamouse.m2
-rw-r--r--src/video/cocoa/SDL_cocoashape.h8
-rw-r--r--src/video/cocoa/SDL_cocoashape.m22
-rw-r--r--src/video/cocoa/SDL_cocoavideo.m6
-rw-r--r--src/video/cocoa/SDL_cocoawindow.m87
-rw-r--r--src/video/directfb/SDL_DirectFB_WM.c138
-rw-r--r--src/video/directfb/SDL_DirectFB_dyn.c2
-rw-r--r--src/video/directfb/SDL_DirectFB_dyn.h18
-rw-r--r--src/video/directfb/SDL_DirectFB_events.c98
-rw-r--r--src/video/directfb/SDL_DirectFB_modes.c6
-rw-r--r--src/video/directfb/SDL_DirectFB_modes.h18
-rw-r--r--src/video/directfb/SDL_DirectFB_mouse.c12
-rw-r--r--src/video/directfb/SDL_DirectFB_mouse.h4
-rw-r--r--src/video/directfb/SDL_DirectFB_opengl.c71
-rw-r--r--src/video/directfb/SDL_DirectFB_opengl.h10
-rw-r--r--src/video/directfb/SDL_DirectFB_render.c38
-rw-r--r--src/video/directfb/SDL_DirectFB_shape.c58
-rw-r--r--src/video/directfb/SDL_DirectFB_shape.h4
-rw-r--r--src/video/directfb/SDL_DirectFB_video.c82
-rw-r--r--src/video/directfb/SDL_DirectFB_video.h72
-rw-r--r--src/video/directfb/SDL_DirectFB_window.c58
-rw-r--r--src/video/directfb/SDL_DirectFB_window.h36
-rw-r--r--src/video/pandora/SDL_pandora.c28
-rw-r--r--src/video/psp/SDL_pspevents.c388
-rw-r--r--src/video/psp/SDL_pspevents_c.h2
-rw-r--r--src/video/psp/SDL_pspgl.c162
-rw-r--r--src/video/psp/SDL_pspgl_c.h6
-rw-r--r--src/video/psp/SDL_pspmouse.c2
-rw-r--r--src/video/psp/SDL_pspvideo.c59
-rw-r--r--src/video/psp/SDL_pspvideo.h6
-rw-r--r--src/video/uikit/SDL_uikitappdelegate.m15
-rw-r--r--src/video/uikit/SDL_uikitmessagebox.m16
-rw-r--r--src/video/uikit/SDL_uikitmodes.m96
-rw-r--r--src/video/uikit/SDL_uikitopengles.m6
-rw-r--r--src/video/uikit/SDL_uikitopenglview.m9
-rw-r--r--src/video/uikit/SDL_uikitvideo.h4
-rw-r--r--src/video/uikit/SDL_uikitview.m11
-rw-r--r--src/video/uikit/SDL_uikitviewcontroller.m18
-rw-r--r--src/video/uikit/SDL_uikitwindow.m68
-rw-r--r--src/video/windows/SDL_vkeys.h98
-rw-r--r--src/video/windows/SDL_windowsclipboard.c2
-rw-r--r--src/video/windows/SDL_windowsevents.c642
-rw-r--r--src/video/windows/SDL_windowsframebuffer.c2
-rw-r--r--src/video/windows/SDL_windowskeyboard.c10
-rw-r--r--src/video/windows/SDL_windowsmessagebox.c162
-rw-r--r--src/video/windows/SDL_windowsmouse.c62
-rw-r--r--src/video/windows/SDL_windowsopengl.c36
-rw-r--r--src/video/windows/SDL_windowsshape.c24
-rw-r--r--src/video/windows/SDL_windowsshape.h2
-rw-r--r--src/video/windows/SDL_windowsvideo.c22
-rw-r--r--src/video/windows/SDL_windowsvideo.h38
-rw-r--r--src/video/windows/SDL_windowswindow.c56
-rw-r--r--src/video/windows/wmmsg.h2
-rw-r--r--src/video/x11/SDL_x11clipboard.c4
-rw-r--r--src/video/x11/SDL_x11dyn.c6
-rw-r--r--src/video/x11/SDL_x11events.c42
-rw-r--r--src/video/x11/SDL_x11framebuffer.c4
-rw-r--r--src/video/x11/SDL_x11messagebox.c4
-rw-r--r--src/video/x11/SDL_x11modes.c2
-rw-r--r--src/video/x11/SDL_x11mouse.c10
-rw-r--r--src/video/x11/SDL_x11opengl.c44
-rw-r--r--src/video/x11/SDL_x11opengles.c16
-rw-r--r--src/video/x11/SDL_x11shape.c14
-rw-r--r--src/video/x11/SDL_x11shape.h6
-rw-r--r--src/video/x11/SDL_x11video.c2
-rw-r--r--src/video/x11/SDL_x11video.h4
-rw-r--r--src/video/x11/SDL_x11window.c22
-rw-r--r--src/video/x11/SDL_x11xinput2.c22
-rw-r--r--src/video/x11/SDL_x11xinput2.h4
211 files changed, 11058 insertions, 11059 deletions
diff --git a/src/SDL.c b/src/SDL.c
index a61c710a72..5f28373a1f 100644
--- a/src/SDL.c
+++ b/src/SDL.c
@@ -138,7 +138,7 @@ SDL_InitSubSystem(Uint32 flags)
}
if ((flags & SDL_INIT_GAMECONTROLLER)) {
- // Game controller implies Joystick.
+ /* Game controller implies Joystick. */
flags |= SDL_INIT_JOYSTICK;
}
@@ -221,19 +221,19 @@ SDL_QuitSubSystem(Uint32 flags)
/* Shut down requested initialized subsystems */
#if !SDL_JOYSTICK_DISABLED
if ((flags & SDL_INIT_GAMECONTROLLER)) {
- // Game controller implies Joystick.
+ /* Game controller implies Joystick. */
flags |= SDL_INIT_JOYSTICK;
if (SDL_PrivateShouldQuitSubsystem(SDL_INIT_GAMECONTROLLER)) {
SDL_GameControllerQuit();
- }
+ }
SDL_PrivateSubsystemRefCountDecr(SDL_INIT_GAMECONTROLLER);
}
if ((flags & SDL_INIT_JOYSTICK)) {
if (SDL_PrivateShouldQuitSubsystem(SDL_INIT_JOYSTICK)) {
- SDL_JoystickQuit();
- }
+ SDL_JoystickQuit();
+ }
SDL_PrivateSubsystemRefCountDecr(SDL_INIT_JOYSTICK);
}
#endif
@@ -241,8 +241,8 @@ SDL_QuitSubSystem(Uint32 flags)
#if !SDL_HAPTIC_DISABLED
if ((flags & SDL_INIT_HAPTIC)) {
if (SDL_PrivateShouldQuitSubsystem(SDL_INIT_HAPTIC)) {
- SDL_HapticQuit();
- }
+ SDL_HapticQuit();
+ }
SDL_PrivateSubsystemRefCountDecr(SDL_INIT_HAPTIC);
}
#endif
@@ -250,8 +250,8 @@ SDL_QuitSubSystem(Uint32 flags)
#if !SDL_AUDIO_DISABLED
if ((flags & SDL_INIT_AUDIO)) {
if (SDL_PrivateShouldQuitSubsystem(SDL_INIT_AUDIO)) {
- SDL_AudioQuit();
- }
+ SDL_AudioQuit();
+ }
SDL_PrivateSubsystemRefCountDecr(SDL_INIT_AUDIO);
}
#endif
@@ -259,8 +259,8 @@ SDL_QuitSubSystem(Uint32 flags)
#if !SDL_VIDEO_DISABLED
if ((flags & SDL_INIT_VIDEO)) {
if (SDL_PrivateShouldQuitSubsystem(SDL_INIT_VIDEO)) {
- SDL_VideoQuit();
- }
+ SDL_VideoQuit();
+ }
SDL_PrivateSubsystemRefCountDecr(SDL_INIT_VIDEO);
}
#endif
@@ -268,8 +268,8 @@ SDL_QuitSubSystem(Uint32 flags)
#if !SDL_TIMERS_DISABLED
if ((flags & SDL_INIT_TIMER)) {
if (SDL_PrivateShouldQuitSubsystem(SDL_INIT_TIMER)) {
- SDL_TimerQuit();
- }
+ SDL_TimerQuit();
+ }
SDL_PrivateSubsystemRefCountDecr(SDL_INIT_TIMER);
}
#endif
diff --git a/src/SDL_error.c b/src/SDL_error.c
index 40388124b5..98ef84ac6f 100644
--- a/src/SDL_error.c
+++ b/src/SDL_error.c
@@ -31,12 +31,12 @@
#if SDL_THREADS_DISABLED
/* The default (non-thread-safe) global error variable */
static SDL_error SDL_global_error;
-#define SDL_GetErrBuf() (&SDL_global_error)
+#define SDL_GetErrBuf() (&SDL_global_error)
#else
extern SDL_error *SDL_GetErrBuf(void);
#endif /* SDL_THREADS_DISABLED */
-#define SDL_ERRBUFIZE 1024
+#define SDL_ERRBUFIZE 1024
/* Private functions */
@@ -57,7 +57,7 @@ SDL_SetError(const char *fmt, ...)
/* Ignore call if invalid format pointer was passed */
if (fmt == NULL) return -1;
-
+
/* Copy in the key, mark error as valid */
error = SDL_GetErrBuf();
error->error = 1;
diff --git a/src/SDL_error_c.h b/src/SDL_error_c.h
index 1277b086dd..2014cc1e77 100644
--- a/src/SDL_error_c.h
+++ b/src/SDL_error_c.h
@@ -27,8 +27,8 @@
#ifndef _SDL_error_c_h
#define _SDL_error_c_h
-#define ERR_MAX_STRLEN 128
-#define ERR_MAX_ARGS 5
+#define ERR_MAX_STRLEN 128
+#define ERR_MAX_ARGS 5
typedef struct SDL_error
{
diff --git a/src/SDL_hints.c b/src/SDL_hints.c
index ed635c76d9..bd9404d46b 100644
--- a/src/SDL_hints.c
+++ b/src/SDL_hints.c
@@ -41,14 +41,14 @@ SDL_bool
SDL_RegisterHintChangedCb(const char *name, SDL_HintChangedCb hintCb)
{
SDL_Hint *hint;
-
+
for (hint = SDL_hints; hint; hint = hint->next) {
if (SDL_strcmp(name, hint->name) == 0) {
hint->callback = hintCb;
return SDL_TRUE;
}
}
-
+
return SDL_FALSE;
}
diff --git a/src/SDL_hints_c.h b/src/SDL_hints_c.h
index 74830c30c6..232e263845 100644
--- a/src/SDL_hints_c.h
+++ b/src/SDL_hints_c.h
@@ -1,15 +1,15 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
-
+
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
-
+
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
-
+
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
diff --git a/src/SDL_log.c b/src/SDL_log.c
index b62f7fd5a3..fd9545e4c2 100644
--- a/src/SDL_log.c
+++ b/src/SDL_log.c
@@ -138,7 +138,7 @@ SDL_LogGetPriority(int category)
}
if (category == SDL_LOG_CATEGORY_TEST) {
- return SDL_test_priority;
+ return SDL_test_priority;
} else if (category == SDL_LOG_CATEGORY_APPLICATION) {
return SDL_application_priority;
} else if (category == SDL_LOG_CATEGORY_ASSERT) {
@@ -328,19 +328,18 @@ SDL_LogOutput(void *userdata, int category, SDL_LogPriority priority,
}
}
#elif defined(__PSP__)
-//Simple Log System for PSP
- {
- unsigned int length;
- char* output;
- FILE* pFile;
- length = SDL_strlen(SDL_priority_prefixes[priority]) + 2 + SDL_strlen(message) + 1;
+ {
+ unsigned int length;
+ char* output;
+ FILE* pFile;
+ length = SDL_strlen(SDL_priority_prefixes[priority]) + 2 + SDL_strlen(message) + 1;
output = SDL_stack_alloc(char, length);
- SDL_snprintf(output, length, "%s: %s", SDL_priority_prefixes[priority], message);
- pFile = fopen ("SDL_Log.txt", "a");
- fwrite (output, strlen (output), 1, pFile);
- SDL_stack_free(output);
- fclose (pFile);
- }
+ SDL_snprintf(output, length, "%s: %s", SDL_priority_prefixes[priority], message);
+ pFile = fopen ("SDL_Log.txt", "a");
+ fwrite (output, strlen (output), 1, pFile);
+ SDL_stack_free(output);
+ fclose (pFile);
+ }
#endif
#if HAVE_STDIO_H
fprintf(stderr, "%s: %s\n", SDL_priority_prefixes[priority], message);
diff --git a/src/atomic/SDL_atomic.c b/src/atomic/SDL_atomic.c
index 6cf2384a5d..cd799dea79 100644
--- a/src/atomic/SDL_atomic.c
+++ b/src/atomic/SDL_atomic.c
@@ -29,8 +29,8 @@
*/
#undef SDL_AtomicCAS
#undef SDL_AtomicCASPtr
-
-/*
+
+/*
If any of the operations are not provided then we must emulate some
of them. That means we need a nice implementation of spin locks
that avoids the "one big lock" problem. We use a vector of spin
@@ -40,7 +40,7 @@
To generate the index of the lock we first shift by 3 bits to get
rid on the zero bits that result from 32 and 64 bit allignment of
data. We then mask off all but 5 bits and use those 5 bits as an
- index into the table.
+ index into the table.
Picking the lock this way insures that accesses to the same data at
the same time will go to the same lock. OTOH, accesses to different
diff --git a/src/atomic/SDL_spinlock.c b/src/atomic/SDL_spinlock.c
index 12c06a33e3..f3aeea0e2d 100644
--- a/src/atomic/SDL_spinlock.c
+++ b/src/atomic/SDL_spinlock.c
@@ -76,11 +76,11 @@ SDL_AtomicTryLock(SDL_SpinLock *lock)
return (result == 0);
#elif defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
- int result;
- __asm__ __volatile__(
+ int result;
+ __asm__ __volatile__(
"lock ; xchgl %0, (%1)\n"
: "=r" (result) : "r" (lock), "0" (1) : "cc", "memory");
- return (result == 0);
+ return (result == 0);
#elif defined(__MACOSX__) || defined(__IPHONEOS__)
/* Maybe used for PowerPC, but the Intel asm or gcc atomics are favored. */
@@ -114,10 +114,10 @@ SDL_AtomicUnlock(SDL_SpinLock *lock)
#elif HAVE_GCC_ATOMICS || HAVE_GCC_SYNC_LOCK_TEST_AND_SET
__sync_lock_release(lock);
-
+
#elif HAVE_PTHREAD_SPINLOCK
pthread_spin_unlock(lock);
-
+
#else
*lock = 0;
#endif
diff --git a/src/audio/SDL_audiocvt.c b/src/audio/SDL_audiocvt.c
index 2d067e7799..1ccd83d745 100644
--- a/src/audio/SDL_audiocvt.c
+++ b/src/audio/SDL_audiocvt.c
@@ -972,7 +972,7 @@ SDL_BuildAudioCVT(SDL_AudioCVT * cvt,
if (cvt == NULL) {
return SDL_InvalidParamError("cvt");
}
-
+
/* there are no unsigned types over 16 bits, so catch this up front. */
if ((SDL_AUDIO_BITSIZE(src_fmt) > 16) && (!SDL_AUDIO_ISSIGNED(src_fmt))) {
return SDL_SetError("Invalid source format");
diff --git a/src/audio/SDL_audiodev.c b/src/audio/SDL_audiodev.c
index 048a8a54e7..91b60c3767 100644
--- a/src/audio/SDL_audiodev.c
+++ b/src/audio/SDL_audiodev.c
@@ -40,10 +40,10 @@
#endif
#endif
#ifndef _PATH_DEV_DSP24
-#define _PATH_DEV_DSP24 "/dev/sound/dsp"
+#define _PATH_DEV_DSP24 "/dev/sound/dsp"
#endif
#ifndef _PATH_DEV_AUDIO
-#define _PATH_DEV_AUDIO "/dev/audio"
+#define _PATH_DEV_AUDIO "/dev/audio"
#endif
static inline void
diff --git a/src/audio/SDL_audiomem.h b/src/audio/SDL_audiomem.h
index 558ea49852..8c027c3a5f 100644
--- a/src/audio/SDL_audiomem.h
+++ b/src/audio/SDL_audiomem.h
@@ -20,6 +20,6 @@
*/
#include "SDL_config.h"
-#define SDL_AllocAudioMem SDL_malloc
-#define SDL_FreeAudioMem SDL_free
+#define SDL_AllocAudioMem SDL_malloc
+#define SDL_FreeAudioMem SDL_free
/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/audio/SDL_mixer.c b/src/audio/SDL_mixer.c
index b45102daa6..37907596f1 100644
--- a/src/audio/SDL_mixer.c
+++ b/src/audio/SDL_mixer.c
@@ -82,8 +82,8 @@ static const Uint8 mix8[] = {
};
/* The volume ranges from 0 - 128 */
-#define ADJUST_VOLUME(s, v) (s = (s*v)/SDL_MIX_MAXVOLUME)
-#define ADJUST_VOLUME_U8(s, v) (s = (((s-128)*v)/SDL_MIX_MAXVOLUME)+128)
+#define ADJUST_VOLUME(s, v) (s = (s*v)/SDL_MIX_MAXVOLUME)
+#define ADJUST_VOLUME_U8(s, v) (s = (((s-128)*v)/SDL_MIX_MAXVOLUME)+128)
void
diff --git a/src/audio/SDL_sysaudio.h b/src/audio/SDL_sysaudio.h
index 13c82045ed..83919c6e4c 100644
--- a/src/audio/SDL_sysaudio.h
+++ b/src/audio/SDL_sysaudio.h
@@ -28,7 +28,7 @@
/* The SDL audio driver */
typedef struct SDL_AudioDevice SDL_AudioDevice;
-#define _THIS SDL_AudioDevice *_this
+#define _THIS SDL_AudioDevice *_this
/* Used by audio targets during DetectDevices() */
typedef void (*SDL_AddAudioDevice)(const char *name);
diff --git a/src/audio/SDL_wave.h b/src/audio/SDL_wave.h
index d66e684d20..d82399cb8a 100644
--- a/src/audio/SDL_wave.h
+++ b/src/audio/SDL_wave.h
@@ -25,26 +25,26 @@
/*******************************************/
/* Define values for Microsoft WAVE format */
/*******************************************/
-#define RIFF 0x46464952 /* "RIFF" */
-#define WAVE 0x45564157 /* "WAVE" */
-#define FACT 0x74636166 /* "fact" */
-#define LIST 0x5453494c /* "LIST" */
-#define FMT 0x20746D66 /* "fmt " */
-#define DATA 0x61746164 /* "data" */
-#define PCM_CODE 0x0001
-#define MS_ADPCM_CODE 0x0002
-#define IEEE_FLOAT_CODE 0x0003
-#define IMA_ADPCM_CODE 0x0011
-#define MP3_CODE 0x0055
-#define WAVE_MONO 1
-#define WAVE_STEREO 2
+#define RIFF 0x46464952 /* "RIFF" */
+#define WAVE 0x45564157 /* "WAVE" */
+#define FACT 0x74636166 /* "fact" */
+#define LIST 0x5453494c /* "LIST" */
+#define FMT 0x20746D66 /* "fmt " */
+#define DATA 0x61746164 /* "data" */
+#define PCM_CODE 0x0001
+#define MS_ADPCM_CODE 0x0002
+#define IEEE_FLOAT_CODE 0x0003
+#define IMA_ADPCM_CODE 0x0011
+#define MP3_CODE 0x0055
+#define WAVE_MONO 1
+#define WAVE_STEREO 2
/* Normally, these three chunks come consecutively in a WAVE file */
typedef struct WaveFMT
{
/* Not saved in the chunk we read:
- Uint32 FMTchunk;
- Uint32 fmtlen;
+ Uint32 FMTchunk;
+ Uint32 fmtlen;
*/
Uint16 encoding;
Uint16 channels; /* 1 = mono, 2 = stereo */
@@ -61,4 +61,5 @@ typedef struct Chunk
Uint32 length;
Uint8 *data;
} Chunk;
+
/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/audio/alsa/SDL_alsa_audio.c b/src/audio/alsa/SDL_alsa_audio.c
index 9b5e75624a..180064f318 100644
--- a/src/audio/alsa/SDL_alsa_audio.c
+++ b/src/audio/alsa/SDL_alsa_audio.c
@@ -155,7 +155,7 @@ static void
UnloadALSALibrary(void)
{
if (alsa_handle != NULL) {
- SDL_UnloadObject(alsa_handle);
+ SDL_UnloadObject(alsa_handle);
alsa_handle = NULL;
}
}
diff --git a/src/audio/alsa/SDL_alsa_audio.h b/src/audio/alsa/SDL_alsa_audio.h
index 50acd5a33c..5a4bf7fcf8 100644
--- a/src/audio/alsa/SDL_alsa_audio.h
+++ b/src/audio/alsa/SDL_alsa_audio.h
@@ -28,7 +28,7 @@
#include "../SDL_sysaudio.h"
/* Hidden "this" pointer for the audio functions */
-#define _THIS SDL_AudioDevice *this
+#define _THIS SDL_AudioDevice *this
struct SDL_PrivateAudioData
{
diff --git a/src/audio/android/SDL_androidaudio.c b/src/audio/android/SDL_androidaudio.c
index a1df475129..45c1282829 100644
--- a/src/audio/android/SDL_androidaudio.c
+++ b/src/audio/android/SDL_androidaudio.c
@@ -40,12 +40,12 @@ AndroidAUD_OpenDevice(_THIS, const char *devname, int iscapture)
SDL_AudioFormat test_format;
if (iscapture) {
- //TODO: implement capture
- return SDL_SetError("Capture not supported on Android");
+ /* TODO: implement capture */
+ return SDL_SetError("Capture not supported on Android");
}
if (audioDevice != NULL) {
- return SDL_SetError("Only one audio device at a time please!");
+ return SDL_SetError("Only one audio device at a time please!");
}
audioDevice = this;
@@ -57,39 +57,39 @@ AndroidAUD_OpenDevice(_THIS, const char *devname, int iscapture)
SDL_memset(this->hidden, 0, (sizeof *this->hidden));
test_format = SDL_FirstAudioFormat(this->spec.format);
- while (test_format != 0) { // no "UNKNOWN" constant
+ while (test_format != 0) { /* no "UNKNOWN" constant */
if ((test_format == AUDIO_U8) || (test_format == AUDIO_S16LSB)) {
this->spec.format = test_format;
break;
}
test_format = SDL_NextAudioFormat();
}
-
+
if (test_format == 0) {
- // Didn't find a compatible format :(
- return SDL_SetError("No compatible audio format!");
+ /* Didn't find a compatible format :( */
+ return SDL_SetError("No compatible audio format!");
}
if (this->spec.channels > 1) {
- this->spec.channels = 2;
+ this->spec.channels = 2;
} else {
- this->spec.channels = 1;
+ this->spec.channels = 1;
}
if (this->spec.freq < 8000) {
- this->spec.freq = 8000;
+ this->spec.freq = 8000;
}
if (this->spec.freq > 48000) {
- this->spec.freq = 48000;
+ this->spec.freq = 48000;
}
- // TODO: pass in/return a (Java) device ID, also whether we're opening for input or output
+ /* TODO: pass in/return a (Java) device ID, also whether we're opening for input or output */
this->spec.samples = Android_JNI_OpenAudioDevice(this->spec.freq, this->spec.format == AUDIO_U8 ? 0 : 1, this->spec.channels, this->spec.samples);
SDL_CalculateAudioSpec(&this->spec);
if (this->spec.samples == 0) {
- // Init failed?
- return SDL_SetError("Java-side initialization failed!");
+ /* Init failed? */
+ return SDL_SetError("Java-side initialization failed!");
}
return 0;
@@ -111,13 +111,13 @@ static void
AndroidAUD_CloseDevice(_THIS)
{
if (this->hidden != NULL) {
- SDL_free(this->hidden);
- this->hidden = NULL;
+ SDL_free(this->hidden);
+ this->hidden = NULL;
}
- Android_JNI_CloseAudioDevice();
+ Android_JNI_CloseAudioDevice();
if (audioDevice == this) {
- audioDevice = NULL;
+ audioDevice = NULL;
}
}
@@ -132,7 +132,7 @@ AndroidAUD_Init(SDL_AudioDriverImpl * impl)
/* and the capabilities */
impl->ProvidesOwnCallbackThread = 1;
- impl->HasCaptureSupport = 0; //TODO
+ impl->HasCaptureSupport = 0; /* TODO */
impl->OnlyHasDefaultOutputDevice = 1;
impl->OnlyHasDefaultInputDevice = 1;
@@ -147,7 +147,7 @@ AudioBootStrap ANDROIDAUD_bootstrap = {
void
Android_RunAudioThread()
{
- SDL_RunAudio(audioDevice);
+ SDL_RunAudio(audioDevice);
}
#endif /* SDL_AUDIO_DRIVER_ANDROID */
diff --git a/src/audio/android/SDL_androidaudio.h b/src/audio/android/SDL_androidaudio.h
index fbadcfc71c..383c708b77 100644
--- a/src/audio/android/SDL_androidaudio.h
+++ b/src/audio/android/SDL_androidaudio.h
@@ -26,7 +26,7 @@
#include "../SDL_sysaudio.h"
/* Hidden "this" pointer for the audio functions */
-#define _THIS SDL_AudioDevice *this
+#define _THIS SDL_AudioDevice *this
struct SDL_PrivateAudioData
{
diff --git a/src/audio/arts/SDL_artsaudio.h b/src/audio/arts/SDL_artsaudio.h
index 8b3f290b1a..1387cc5c06 100644
--- a/src/audio/arts/SDL_artsaudio.h
+++ b/src/audio/arts/SDL_artsaudio.h
@@ -28,7 +28,7 @@
#include "../SDL_sysaudio.h"
/* Hidden "this" pointer for the audio functions */
-#define _THIS SDL_AudioDevice *this
+#define _THIS SDL_AudioDevice *this
struct SDL_PrivateAudioData
{
@@ -46,7 +46,7 @@ struct SDL_PrivateAudioData
float frame_ticks;
float next_frame;
};
-#define FUDGE_TICKS 10 /* The scheduler overhead ticks per frame */
+#define FUDGE_TICKS 10 /* The scheduler overhead ticks per frame */
#endif /* _SDL_artscaudio_h */
/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/audio/baudio/SDL_beaudio.h b/src/audio/baudio/SDL_beaudio.h
index 9ce5af2355..61f9dec832 100644
--- a/src/audio/baudio/SDL_beaudio.h
+++ b/src/audio/baudio/SDL_beaudio.h
@@ -26,7 +26,7 @@
#include "../SDL_sysaudio.h"
/* Hidden "this" pointer for the audio functions */
-#define _THIS SDL_AudioDevice *_this
+#define _THIS SDL_AudioDevice *_this
struct SDL_PrivateAudioData
{
diff --git a/src/audio/bsd/SDL_bsdaudio.h b/src/audio/bsd/SDL_bsdaudio.h
index b06aca9c9f..b64be31b2a 100644
--- a/src/audio/bsd/SDL_bsdaudio.h
+++ b/src/audio/bsd/SDL_bsdaudio.h
@@ -25,7 +25,7 @@
#include "../SDL_sysaudio.h"
-#define _THIS SDL_AudioDevice *this
+#define _THIS SDL_AudioDevice *this
struct SDL_PrivateAudioData
{
@@ -44,7 +44,7 @@ struct SDL_PrivateAudioData
float next_frame;
};
-#define FUDGE_TICKS 10 /* The scheduler overhead ticks per frame */
+#define FUDGE_TICKS 10 /* The scheduler overhead ticks per frame */
#endif /* _SDL_bsdaudio_h */
diff --git a/src/audio/coreaudio/SDL_coreaudio.c b/src/audio/coreaudio/SDL_coreaudio.c
index 8f83d0b390..a35135a2fc 100644
--- a/src/audio/coreaudio/SDL_coreaudio.c
+++ b/src/audio/coreaudio/SDL_coreaudio.c
@@ -308,8 +308,8 @@ inputCallback(void *inRefCon,
UInt32 inBusNumber, UInt32 inNumberFrames,
AudioBufferList * ioData)
{
- //err = AudioUnitRender(afr->fAudioUnit, ioActionFlags, inTimeStamp, inBusNumber, inNumberFrames, afr->fAudioBuffer);
- // !!! FIXME: write me!
+ /* err = AudioUnitRender(afr->fAudioUnit, ioActionFlags, inTimeStamp, inBusNumber, inNumberFrames, afr->fAudioBuffer); */
+ /* !!! FIXME: write me! */
return noErr;
}
@@ -380,7 +380,7 @@ prepare_audiounit(_THIS, const char *devname, int iscapture,
return 0;
}
#endif
-
+
SDL_zero(desc);
desc.componentType = kAudioUnitType_Output;
desc.componentManufacturer = kAudioUnitManufacturer_Apple;
diff --git a/src/audio/coreaudio/SDL_coreaudio.h b/src/audio/coreaudio/SDL_coreaudio.h
index 31057557eb..a05d4504fc 100644
--- a/src/audio/coreaudio/SDL_coreaudio.h
+++ b/src/audio/coreaudio/SDL_coreaudio.h
@@ -42,7 +42,7 @@
#include <AudioUnit/AudioUnit.h>
/* Hidden "this" pointer for the audio functions */
-#define _THIS SDL_AudioDevice *this
+#define _THIS SDL_AudioDevice *this
struct SDL_PrivateAudioData
{
diff --git a/src/audio/directsound/SDL_directsound.h b/src/audio/directsound/SDL_directsound.h
index 37a6ee133a..758299f14f 100644
--- a/src/audio/directsound/SDL_directsound.h
+++ b/src/audio/directsound/SDL_directsound.h
@@ -28,7 +28,7 @@
#include "../SDL_sysaudio.h"
/* Hidden "this" pointer for the audio functions */
-#define _THIS SDL_AudioDevice *this
+#define _THIS SDL_AudioDevice *this
/* The DirectSound objects */
struct SDL_PrivateAudioData
diff --git a/src/audio/directsound/directx.h b/src/audio/directsound/directx.h
index 8ddfa00cb7..963d2b88e1 100644
--- a/src/audio/directsound/directx.h
+++ b/src/audio/directsound/directx.h
@@ -19,47 +19,47 @@
/* Error codes not yet included in Win32 API header files */
#ifndef MAKE_HRESULT
#define MAKE_HRESULT(sev,fac,code) \
- ((HRESULT)(((unsigned long)(sev)<<31) | ((unsigned long)(fac)<<16) | ((unsigned long)(code))))
+ ((HRESULT)(((unsigned long)(sev)<<31) | ((unsigned long)(fac)<<16) | ((unsigned long)(code))))
#endif
#ifndef S_OK
-#define S_OK (HRESULT)0x00000000L
+#define S_OK (HRESULT)0x00000000L
#endif
#ifndef SUCCEEDED
-#define SUCCEEDED(x) ((HRESULT)(x) >= 0)
+#define SUCCEEDED(x) ((HRESULT)(x) >= 0)
#endif
#ifndef FAILED
-#define FAILED(x) ((HRESULT)(x)<0)
+#define FAILED(x) ((HRESULT)(x)<0)
#endif
#ifndef E_FAIL
-#define E_FAIL (HRESULT)0x80000008L
+#define E_FAIL (HRESULT)0x80000008L
#endif
#ifndef E_NOINTERFACE
-#define E_NOINTERFACE (HRESULT)0x80004002L
+#define E_NOINTERFACE (HRESULT)0x80004002L
#endif
#ifndef E_OUTOFMEMORY
-#define E_OUTOFMEMORY (HRESULT)0x8007000EL
+#define E_OUTOFMEMORY (HRESULT)0x8007000EL
#endif
#ifndef E_INVALIDARG
-#define E_INVALIDARG (HRESULT)0x80070057L
+#define E_INVALIDARG (HRESULT)0x80070057L
#endif
#ifndef E_NOTIMPL
-#define E_NOTIMPL (HRESULT)0x80004001L
+#define E_NOTIMPL (HRESULT)0x80004001L
#endif
#ifndef REGDB_E_CLASSNOTREG
-#define REGDB_E_CLASSNOTREG (HRESULT)0x80040154L
+#define REGDB_E_CLASSNOTREG (HRESULT)0x80040154L
#endif
/* Severity codes */
#ifndef SEVERITY_ERROR
-#define SEVERITY_ERROR 1
+#define SEVERITY_ERROR 1
#endif
/* Error facility codes */
#ifndef FACILITY_WIN32
-#define FACILITY_WIN32 7
+#define FACILITY_WIN32 7
#endif
#ifndef FIELD_OFFSET
diff --git a/src/audio/disk/SDL_diskaudio.h b/src/audio/disk/SDL_diskaudio.h
index 3869bd1457..7e5b48406f 100644
--- a/src/audio/disk/SDL_diskaudio.h
+++ b/src/audio/disk/SDL_diskaudio.h
@@ -27,7 +27,7 @@
#include "../SDL_sysaudio.h"
/* Hidden "this" pointer for the audio functions */
-#define _THIS SDL_AudioDevice *this
+#define _THIS SDL_AudioDevice *this
struct SDL_PrivateAudioData
{
diff --git a/src/audio/dsp/SDL_dspaudio.c b/src/audio/dsp/SDL_dspaudio.c
index f868e874a1..c62a22f8a6 100644
--- a/src/audio/dsp/SDL_dspaudio.c
+++ b/src/audio/dsp/SDL_dspaudio.c
@@ -161,7 +161,7 @@ DSP_OpenDevice(_THIS, const char *devname, int iscapture)
break;
#if 0
/*
- * These formats are not used by any real life systems so they are not
+ * These formats are not used by any real life systems so they are not
* needed here.
*/
case AUDIO_S8:
diff --git a/src/audio/dsp/SDL_dspaudio.h b/src/audio/dsp/SDL_dspaudio.h
index 9f7df71c52..62ed45f181 100644
--- a/src/audio/dsp/SDL_dspaudio.h
+++ b/src/audio/dsp/SDL_dspaudio.h
@@ -26,7 +26,7 @@
#include "../SDL_sysaudio.h"
/* Hidden "this" pointer for the audio functions */
-#define _THIS SDL_AudioDevice *this
+#define _THIS SDL_AudioDevice *this
struct SDL_PrivateAudioData
{
@@ -37,7 +37,7 @@ struct SDL_PrivateAudioData
Uint8 *mixbuf;
int mixlen;
};
-#define FUDGE_TICKS 10 /* The scheduler overhead ticks per frame */
+#define FUDGE_TICKS 10 /* The scheduler overhead ticks per frame */
#endif /* _SDL_dspaudio_h */
/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/audio/dummy/SDL_dummyaudio.h b/src/audio/dummy/SDL_dummyaudio.h
index 22a4cd2420..c0015a54dc 100644
--- a/src/audio/dummy/SDL_dummyaudio.h
+++ b/src/audio/dummy/SDL_dummyaudio.h
@@ -26,7 +26,7 @@
#include "../SDL_sysaudio.h"
/* Hidden "this" pointer for the audio functions */
-#define _THIS SDL_AudioDevice *this
+#define _THIS SDL_AudioDevice *this
struct SDL_PrivateAudioData
{
diff --git a/src/audio/esd/SDL_esdaudio.c b/src/audio/esd/SDL_esdaudio.c
index cdc12120f4..92716f39b9 100644
--- a/src/audio/esd/SDL_esdaudio.c
+++ b/src/audio/esd/SDL_esdaudio.c
@@ -40,7 +40,7 @@
#include "SDL_name.h"
#include "SDL_loadso.h"
#else
-#define SDL_NAME(X) X
+#define SDL_NAME(X) X
#endif
#ifdef SDL_AUDIO_DRIVER_ESD_DYNAMIC
@@ -123,7 +123,7 @@ ESD_WaitDevice(_THIS)
/* Check to see if the thread-parent process is still alive */
{
static int cnt = 0;
- /* Note that this only works with thread implementations
+ /* Note that this only works with thread implementations
that use a different process id for each thread.
*/
/* Check every 10 loops */
diff --git a/src/audio/esd/SDL_esdaudio.h b/src/audio/esd/SDL_esdaudio.h
index ab0e252178..26bea9cf01 100644
--- a/src/audio/esd/SDL_esdaudio.h
+++ b/src/audio/esd/SDL_esdaudio.h
@@ -26,7 +26,7 @@
#include "../SDL_sysaudio.h"
/* Hidden "this" pointer for the audio functions */
-#define _THIS SDL_AudioDevice *this
+#define _THIS SDL_AudioDevice *this
struct SDL_PrivateAudioData
{
@@ -44,7 +44,7 @@ struct SDL_PrivateAudioData
float frame_ticks;
float next_frame;
};
-#define FUDGE_TICKS 10 /* The scheduler overhead ticks per frame */
+#define FUDGE_TICKS 10 /* The scheduler overhead ticks per frame */
#endif /* _SDL_esdaudio_h */
/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/audio/fusionsound/SDL_fsaudio.c b/src/audio/fusionsound/SDL_fsaudio.c
index bc279fec6e..2e468d5c6a 100644
--- a/src/audio/fusionsound/SDL_fsaudio.c
+++ b/src/audio/fusionsound/SDL_fsaudio.c
@@ -37,13 +37,13 @@
#include <fusionsound/fusionsound_version.h>
-//#define SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC "libfusionsound.so"
+/* #define SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC "libfusionsound.so" */
#ifdef SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC
#include "SDL_name.h"
#include "SDL_loadso.h"
#else
-#define SDL_NAME(X) X
+#define SDL_NAME(X) X
#endif
#if (FUSIONSOUND_MAJOR_VERSION == 1) && (FUSIONSOUND_MINOR_VERSION < 1)
@@ -51,7 +51,7 @@ typedef DFBResult DirectResult;
#endif
/* Buffers to use - more than 2 gives a lot of latency */
-#define FUSION_BUFFERS (2)
+#define FUSION_BUFFERS (2)
#ifdef SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC
diff --git a/src/audio/fusionsound/SDL_fsaudio.h b/src/audio/fusionsound/SDL_fsaudio.h
index 0c313d6665..7f22775014 100644
--- a/src/audio/fusionsound/SDL_fsaudio.h
+++ b/src/audio/fusionsound/SDL_fsaudio.h
@@ -28,7 +28,7 @@
#include "../SDL_sysaudio.h"
/* Hidden "this" pointer for the audio functions */
-#define _THIS SDL_AudioDevice *this
+#define _THIS SDL_AudioDevice *this
struct SDL_PrivateAudioData
{
diff --git a/src/audio/nas/SDL_nasaudio.h b/src/audio/nas/SDL_nasaudio.h
index 65739cdf79..85bd761dd4 100644
--- a/src/audio/nas/SDL_nasaudio.h
+++ b/src/audio/nas/SDL_nasaudio.h
@@ -33,7 +33,7 @@
#include "../SDL_sysaudio.h"
/* Hidden "this" pointer for the audio functions */
-#define _THIS SDL_AudioDevice *this
+#define _THIS SDL_AudioDevice *this
struct SDL_PrivateAudioData
{
diff --git a/src/audio/paudio/SDL_paudio.c b/src/audio/paudio/SDL_paudio.c
index 3966d1e7a2..5a18b45e56 100644
--- a/src/audio/paudio/SDL_paudio.c
+++ b/src/audio/paudio/SDL_paudio.c
@@ -48,13 +48,13 @@
#include <sys/audio.h>
/* Open the audio device for playback, and don't block if busy */
-/* #define OPEN_FLAGS (O_WRONLY|O_NONBLOCK) */
-#define OPEN_FLAGS O_WRONLY
+/* #define OPEN_FLAGS (O_WRONLY|O_NONBLOCK) */
+#define OPEN_FLAGS O_WRONLY
/* Get the name of the audio device we use for output */
#ifndef _PATH_DEV_DSP
-#define _PATH_DEV_DSP "/dev/%caud%c/%c"
+#define _PATH_DEV_DSP "/dev/%caud%c/%c"
#endif
static char devsettings[][3] = {
diff --git a/src/audio/paudio/SDL_paudio.h b/src/audio/paudio/SDL_paudio.h
index 0aa0e2be9f..7be1ed6513 100644
--- a/src/audio/paudio/SDL_paudio.h
+++ b/src/audio/paudio/SDL_paudio.h
@@ -26,7 +26,7 @@
#include "../SDL_sysaudio.h"
/* Hidden "this" pointer for the audio functions */
-#define _THIS SDL_AudioDevice *this
+#define _THIS SDL_AudioDevice *this
struct SDL_PrivateAudioData
{
@@ -41,7 +41,7 @@ struct SDL_PrivateAudioData
float frame_ticks;
float next_frame;
};
-#define FUDGE_TICKS 10 /* The scheduler overhead ticks per frame */
+#define FUDGE_TICKS 10 /* The scheduler overhead ticks per frame */
#endif /* _SDL_paudaudio_h */
/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/audio/psp/SDL_pspaudio.c b/src/audio/psp/SDL_pspaudio.c
index fc03a87544..4b5534a3c5 100644
--- a/src/audio/psp/SDL_pspaudio.c
+++ b/src/audio/psp/SDL_pspaudio.c
@@ -42,28 +42,28 @@
static int
PSPAUD_OpenDevice(_THIS, const char *devname, int iscapture)
{
- int format, mixlen, i;
+ int format, mixlen, i;
this->hidden = (struct SDL_PrivateAudioData *)
SDL_malloc(sizeof(*this->hidden));
if (this->hidden == NULL) {
return SDL_OutOfMemory();
}
SDL_memset(this->hidden, 0, sizeof(*this->hidden));
- switch (this->spec.format & 0xff) {
- case 8:
- case 16:
- this->spec.format = AUDIO_S16LSB;
- break;
- default:
- return SDL_SetError("Unsupported audio format");
- }
-
- /* The sample count must be a multiple of 64. */
- this->spec.samples = PSP_AUDIO_SAMPLE_ALIGN(this->spec.samples);
- this->spec.freq = 44100;
-
- /* Update the fragment size as size in bytes. */
-// SDL_CalculateAudioSpec(this->spec); MOD
+ switch (this->spec.format & 0xff) {
+ case 8:
+ case 16:
+ this->spec.format = AUDIO_S16LSB;
+ break;
+ default:
+ return SDL_SetError("Unsupported audio format");
+ }
+
+ /* The sample count must be a multiple of 64. */
+ this->spec.samples = PSP_AUDIO_SAMPLE_ALIGN(this->spec.samples);
+ this->spec.freq = 44100;
+
+ /* Update the fragment size as size in bytes. */
+// SDL_CalculateAudioSpec(this->spec); MOD
switch (this->spec.format) {
case AUDIO_U8:
this->spec.silence = 0x80;
@@ -75,86 +75,86 @@ PSPAUD_OpenDevice(_THIS, const char *devname, int iscapture)
this->spec.size = SDL_AUDIO_BITSIZE(this->spec.format) / 8;
this->spec.size *= this->spec.channels;
this->spec.size *= this->spec.samples;
-
+
//==========================================
- /* Allocate the mixing buffer. Its size and starting address must
- be a multiple of 64 bytes. Our sample count is already a multiple of
- 64, so spec->size should be a multiple of 64 as well. */
- mixlen = this->spec.size * NUM_BUFFERS;
- this->hidden->rawbuf = (Uint8 *) memalign(64, mixlen);
- if (this->hidden->rawbuf == NULL) {
- return SDL_SetError("Couldn't allocate mixing buffer");
- }
-
- /* Setup the hardware channel. */
- if (this->spec.channels == 1) {
- format = PSP_AUDIO_FORMAT_MONO;
- } else {
- format = PSP_AUDIO_FORMAT_STEREO;
- }
- this->hidden->channel = sceAudioChReserve(PSP_AUDIO_NEXT_CHANNEL, this->spec.samples, format);
- if (this->hidden->channel < 0) {
- free(this->hidden->rawbuf);
- this->hidden->rawbuf = NULL;
- return SDL_SetError("Couldn't reserve hardware channel");
- }
-
- memset(this->hidden->rawbuf, 0, mixlen);
- for (i = 0; i < NUM_BUFFERS; i++) {
- this->hidden->mixbufs[i] = &this->hidden->rawbuf[i * this->spec.size];
- }
-
- this->hidden->next_buffer = 0;
- return 0;
+ /* Allocate the mixing buffer. Its size and starting address must
+ be a multiple of 64 bytes. Our sample count is already a multiple of
+ 64, so spec->size should be a multiple of 64 as well. */
+ mixlen = this->spec.size * NUM_BUFFERS;
+ this->hidden->rawbuf = (Uint8 *) memalign(64, mixlen);
+ if (this->hidden->rawbuf == NULL) {
+ return SDL_SetError("Couldn't allocate mixing buffer");
+ }
+
+ /* Setup the hardware channel. */
+ if (this->spec.channels == 1) {
+ format = PSP_AUDIO_FORMAT_MONO;
+ } else {
+ format = PSP_AUDIO_FORMAT_STEREO;
+ }
+ this->hidden->channel = sceAudioChReserve(PSP_AUDIO_NEXT_CHANNEL, this->spec.samples, format);
+ if (this->hidden->channel < 0) {
+ free(this->hidden->rawbuf);
+ this->hidden->rawbuf = NULL;
+ return SDL_SetError("Couldn't reserve hardware channel");
+ }
+
+ memset(this->hidden->rawbuf, 0, mixlen);
+ for (i = 0; i < NUM_BUFFERS; i++) {
+ this->hidden->mixbufs[i] = &this->hidden->rawbuf[i * this->spec.size];
+ }
+
+ this->hidden->next_buffer = 0;
+ return 0;
}
static void PSPAUD_PlayDevice(_THIS)
{
- Uint8 *mixbuf = this->hidden->mixbufs[this->hidden->next_buffer];
+ Uint8 *mixbuf = this->hidden->mixbufs[this->hidden->next_buffer];
- if (this->spec.channels == 1) {
- sceAudioOutputBlocking(this->hidden->channel, PSP_AUDIO_VOLUME_MAX, mixbuf);
- } else {
- sceAudioOutputPannedBlocking(this->hidden->channel, PSP_AUDIO_VOLUME_MAX, PSP_AUDIO_VOLUME_MAX, mixbuf);
- }
+ if (this->spec.channels == 1) {
+ sceAudioOutputBlocking(this->hidden->channel, PSP_AUDIO_VOLUME_MAX, mixbuf);
+ } else {
+ sceAudioOutputPannedBlocking(this->hidden->channel, PSP_AUDIO_VOLUME_MAX, PSP_AUDIO_VOLUME_MAX, mixbuf);
+ }
- this->hidden->next_buffer = (this->hidden->next_buffer + 1) % NUM_BUFFERS;
+ this->hidden->next_buffer = (this->hidden->next_buffer + 1) % NUM_BUFFERS;
}
/* This function waits until it is possible to write a full sound buffer */
static void PSPAUD_WaitDevice(_THIS)
{
- /* Because we block when sending audio, there's no need for this function to do anything. */
+ /* Because we block when sending audio, there's no need for this function to do anything. */
}
static Uint8 *PSPAUD_GetDeviceBuf(_THIS)
{
- return this->hidden->mixbufs[this->hidden->next_buffer];
+ return this->hidden->mixbufs[this->hidden->next_buffer];
}
static void PSPAUD_CloseDevice(_THIS)
{
- if (this->hidden->channel >= 0) {
- sceAudioChRelease(this->hidden->channel);
- this->hidden->channel = -1;
- }
-
- if (this->hidden->rawbuf != NULL) {
- free(this->hidden->rawbuf);
- this->hidden->rawbuf = NULL;
- }
+ if (this->hidden->channel >= 0) {
+ sceAudioChRelease(this->hidden->channel);
+ this->hidden->channel = -1;
+ }
+
+ if (this->hidden->rawbuf != NULL) {
+ free(this->hidden->rawbuf);
+ this->hidden->rawbuf = NULL;
+ }
}
static void PSPAUD_ThreadInit(_THIS)
{
- /* Increase the priority of this audio thread by 1 to put it
- ahead of other SDL threads. */
- SceUID thid;
- SceKernelThreadInfo status;
- thid = sceKernelGetThreadId();
- status.size = sizeof(SceKernelThreadInfo);
- if (sceKernelReferThreadStatus(thid, &status) == 0) {
- sceKernelChangeThreadPriority(thid, status.currentPriority - 1);
- }
+ /* Increase the priority of this audio thread by 1 to put it
+ ahead of other SDL threads. */
+ SceUID thid;
+ SceKernelThreadInfo status;
+ thid = sceKernelGetThreadId();
+ status.size = sizeof(SceKernelThreadInfo);
+ if (sceKernelReferThreadStatus(thid, &status) == 0) {
+ sceKernelChangeThreadPriority(thid, status.currentPriority - 1);
+ }
}
@@ -162,17 +162,17 @@ static int
PSPAUD_Init(SDL_AudioDriverImpl * impl)
{
- // Set the function pointers
+ // Set the function pointers
impl->OpenDevice = PSPAUD_OpenDevice;
impl->PlayDevice = PSPAUD_PlayDevice;
impl->WaitDevice = PSPAUD_WaitDevice;
- impl->GetDeviceBuf = PSPAUD_GetDeviceBuf;
+ impl->GetDeviceBuf = PSPAUD_GetDeviceBuf;
impl->WaitDone = PSPAUD_WaitDevice;
impl->CloseDevice = PSPAUD_CloseDevice;
impl->ThreadInit = PSPAUD_ThreadInit;
-
+
//PSP audio device
- impl->OnlyHasDefaultOutputDevice = 1;
+ impl->OnlyHasDefaultOutputDevice = 1;
/*
impl->HasCaptureSupport = 1;
diff --git a/src/audio/psp/SDL_pspaudio.h b/src/audio/psp/SDL_pspaudio.h
index 22cf2d327a..139476c6ba 100644
--- a/src/audio/psp/SDL_pspaudio.h
+++ b/src/audio/psp/SDL_pspaudio.h
@@ -25,19 +25,19 @@
#include "../SDL_sysaudio.h"
/* Hidden "this" pointer for the video functions */
-#define _THIS SDL_AudioDevice *this
+#define _THIS SDL_AudioDevice *this
#define NUM_BUFFERS 2
struct SDL_PrivateAudioData {
- /* The hardware output channel. */
- int channel;
- /* The raw allocated mixing buffer. */
- Uint8 *rawbuf;
- /* Individual mixing buffers. */
- Uint8 *mixbufs[NUM_BUFFERS];
- /* Index of the next available mixing buffer. */
- int next_buffer;
+ /* The hardware output channel. */
+ int channel;
+ /* The raw allocated mixing buffer. */
+ Uint8 *rawbuf;
+ /* Individual mixing buffers. */
+ Uint8 *mixbufs[NUM_BUFFERS];
+ /* Index of the next available mixing buffer. */
+ int next_buffer;
};
#endif /* _SDL_pspaudio_h */
diff --git a/src/audio/pulseaudio/SDL_pulseaudio.c b/src/audio/pulseaudio/SDL_pulseaudio.c
index 12021e6de8..c8d25a800f 100644
--- a/src/audio/pulseaudio/SDL_pulseaudio.c
+++ b/src/audio/pulseaudio/SDL_pulseaudio.c
@@ -131,7 +131,7 @@ static void
UnloadPulseAudioLibrary(void)
{
if (pulseaudio_handle != NULL) {
- SDL_UnloadObject(pulseaudio_handle);
+ SDL_UnloadObject(pulseaudio_handle);
pulseaudio_handle = NULL;
}
}
diff --git a/src/audio/sun/SDL_sunaudio.c b/src/audio/sun/SDL_sunaudio.c
index 37e175e107..950ba444c3 100644
--- a/src/audio/sun/SDL_sunaudio.c
+++ b/src/audio/sun/SDL_sunaudio.c
@@ -47,7 +47,7 @@
/* Open the audio device for playback, and don't block if busy */
-#if defined(AUDIO_GETINFO) && !defined(AUDIO_GETBUFINFO)
+#if defined(AUDIO_GETINFO) && !defined(AUDIO_GETBUFINFO)
#define AUDIO_GETBUFINFO AUDIO_GETINFO
#endif
@@ -82,7 +82,7 @@ static void
SUNAUDIO_WaitDevice(_THIS)
{
#ifdef AUDIO_GETBUFINFO
-#define SLEEP_FUDGE 10 /* 10 ms scheduling fudge factor */
+#define SLEEP_FUDGE 10 /* 10 ms scheduling fudge factor */
audio_info_t info;
Sint32 left;
diff --git a/src/audio/sun/SDL_sunaudio.h b/src/audio/sun/SDL_sunaudio.h
index 1f2c0b4f24..9b92266fb1 100644
--- a/src/audio/sun/SDL_sunaudio.h
+++ b/src/audio/sun/SDL_sunaudio.h
@@ -26,7 +26,7 @@
#include "../SDL_sysaudio.h"
/* Hidden "this" pointer for the audio functions */
-#define _THIS SDL_AudioDevice *this
+#define _THIS SDL_AudioDevice *this
struct SDL_PrivateAudioData
{
diff --git a/src/audio/winmm/SDL_winmm.h b/src/audio/winmm/SDL_winmm.h
index 8e67f22373..5a0574d1ec 100644
--- a/src/audio/winmm/SDL_winmm.h
+++ b/src/audio/winmm/SDL_winmm.h
@@ -26,7 +26,7 @@
#include "../SDL_sysaudio.h"
/* Hidden "this" pointer for the audio functions */
-#define _THIS SDL_AudioDevice *this
+#define _THIS SDL_AudioDevice *this
#define NUM_BUFFERS 2 /* -- Don't lower this! */
diff --git a/src/audio/xaudio2/SDL_xaudio2.c b/src/audio/xaudio2/SDL_xaudio2.c
index 40d94086fc..db29e8dbbe 100644
--- a/src/audio/xaudio2/SDL_xaudio2.c
+++ b/src/audio/xaudio2/SDL_xaudio2.c
@@ -41,7 +41,7 @@
#include <XAudio2.h>
/* Hidden "this" pointer for the audio functions */
-#define _THIS SDL_AudioDevice *this
+#define _THIS SDL_AudioDevice *this
struct SDL_PrivateAudioData
{
@@ -232,17 +232,17 @@ XAUDIO2_OpenDevice(_THIS, const char *devname, int iscapture)
IXAudio2SourceVoice *source = NULL;
UINT32 devId = 0; /* 0 == system default device. */
- static IXAudio2VoiceCallbackVtbl callbacks_vtable = {
- VoiceCBOnVoiceProcessPassStart,
+ static IXAudio2VoiceCallbackVtbl callbacks_vtable = {
+ VoiceCBOnVoiceProcessPassStart,
VoiceCBOnVoiceProcessPassEnd,
VoiceCBOnStreamEnd,
VoiceCBOnBufferStart,
VoiceCBOnBufferEnd,
VoiceCBOnLoopEnd,
VoiceCBOnVoiceError
- };
+ };
- static IXAudio2VoiceCallback callbacks = { &callbacks_vtable };
+ static IXAudio2VoiceCallback callbacks = { &callbacks_vtable };
if (iscapture) {
return SDL_SetError("XAudio2: capture devices unsupported.");
diff --git a/src/core/android/SDL_android.cpp b/src/core/android/SDL_android.cpp
index cf0e0c1292..6fbb678fd6 100644
--- a/src/core/android/SDL_android.cpp
+++ b/src/core/android/SDL_android.cpp
@@ -121,7 +121,7 @@ extern "C" void SDL_Android_Init(JNIEnv* mEnv, jclass cls)
"createGLContext","(II[I)Z");
midFlipBuffers = mEnv->GetStaticMethodID(mActivityClass,
"flipBuffers","()V");
- midAudioInit = mEnv->GetStaticMethodID(mActivityClass,
+ midAudioInit = mEnv->GetStaticMethodID(mActivityClass,
"audioInit", "(IZZI)V");
midAudioWriteShortBuffer = mEnv->GetStaticMethodID(mActivityClass,
"audioWriteShortBuffer", "([S)V");
@@ -184,14 +184,14 @@ extern "C" void Java_org_libsdl_app_SDLActivity_onNativeAccel(
// Low memory
extern "C" void Java_org_libsdl_app_SDLActivity_nativeLowMemory(
JNIEnv* env, jclass cls)
-{
+{
SDL_SendAppEvent(SDL_APP_LOWMEMORY);
}
// Quit
extern "C" void Java_org_libsdl_app_SDLActivity_nativeQuit(
JNIEnv* env, jclass cls)
-{
+{
// Inject a SDL_QUIT event
SDL_SendQuit();
SDL_SendAppEvent(SDL_APP_TERMINATING);
@@ -348,7 +348,7 @@ extern "C" SDL_bool Android_JNI_CreateContext(int majorVersion, int minorVersion
extern "C" void Android_JNI_SwapWindow()
{
JNIEnv *mEnv = Android_JNI_GetEnv();
- mEnv->CallStaticVoidMethod(mActivityClass, midFlipBuffers);
+ mEnv->CallStaticVoidMethod(mActivityClass, midFlipBuffers);
}
extern "C" void Android_JNI_SetActivityTitle(const char *title)
@@ -453,7 +453,7 @@ extern "C" int Android_JNI_OpenAudioDevice(int sampleRate, int is16Bit, int chan
/* Allocating the audio buffer from the Java side and passing it as the return value for audioInit no longer works on
* Android >= 4.2 due to a "stale global reference" error. So now we allocate this buffer directly from this side. */
-
+
if (is16Bit) {
jshortArray audioBufferLocal = env->NewShortArray(desiredBufferFrames * (audioBufferStereo ? 2 : 1));
if (audioBufferLocal) {
@@ -513,7 +513,7 @@ extern "C" void Android_JNI_CloseAudioDevice()
{
JNIEnv *env = Android_JNI_GetEnv();
- env->CallStaticVoidMethod(mActivityClass, midAudioQuit);
+ env->CallStaticVoidMethod(mActivityClass, midAudioQuit);
if (audioBuffer) {
env->DeleteGlobalRef(audioBuffer);
@@ -592,7 +592,7 @@ static int Android_JNI_FileOpen(SDL_RWops* ctx)
mid = mEnv->GetStaticMethodID(mActivityClass,
"getContext","()Landroid/content/Context;");
context = mEnv->CallStaticObjectMethod(mActivityClass, mid);
-
+
// assetManager = context.getAssets();
mid = mEnv->GetMethodID(mEnv->GetObjectClass(context),
@@ -779,7 +779,7 @@ extern "C" size_t Android_JNI_FileRead(SDL_RWops* ctx, void* buffer,
ctx->hidden.androidio.position += result;
}
return bytesRead / size;
- }
+ }
}
extern "C" size_t Android_JNI_FileWrite(SDL_RWops* ctx, const void* buffer,
@@ -920,7 +920,7 @@ extern "C" Sint64 Android_JNI_FileSeek(SDL_RWops* ctx, Sint64 offset, int whence
}
return ctx->hidden.androidio.position;
-
+
}
extern "C" int Android_JNI_FileClose(SDL_RWops* ctx)
@@ -1151,7 +1151,7 @@ extern "C" void *SDL_AndroidGetJNIEnv()
extern "C" void *SDL_AndroidGetActivity()
{
/* See SDL_system.h for caveats on using this function. */
-
+
jmethodID mid;
JNIEnv *env = Android_JNI_GetEnv();
diff --git a/src/events/SDL_events.c b/src/events/SDL_events.c
index d6bb22e06a..f27c3cb85e 100644
--- a/src/events/SDL_events.c
+++ b/src/events/SDL_events.c
@@ -53,7 +53,7 @@ static SDL_DisabledEventBlock *SDL_disabled_events[256];
static Uint32 SDL_userevents = SDL_USEREVENT;
/* Private data -- event queue */
-#define MAXEVENTS 128
+#define MAXEVENTS 128
static struct
{
SDL_mutex *lock;
diff --git a/src/events/SDL_gesture.c b/src/events/SDL_gesture.c
index a56aa3e554..f7c8c89320 100644
--- a/src/events/SDL_gesture.c
+++ b/src/events/SDL_gesture.c
@@ -35,13 +35,10 @@
#include <stdio.h>
#include <math.h>
-//TODO: Replace with malloc
+/* TODO: Replace with malloc */
#define MAXPATHSIZE 1024
-
-
-
#define DOLLARNPOINTS 64
#define DOLLARSIZE 256
diff --git a/src/events/SDL_keyboard.c b/src/events/SDL_keyboard.c
index 3454bf8bb8..680091f426 100644
--- a/src/events/SDL_keyboard.c
+++ b/src/events/SDL_keyboard.c
@@ -860,7 +860,7 @@ SDL_Keycode
SDL_GetKeyFromScancode(SDL_Scancode scancode)
{
SDL_Keyboard *keyboard = &SDL_keyboard;
-
+
if (scancode < SDL_SCANCODE_UNKNOWN || scancode >= SDL_NUM_SCANCODES) {
SDL_InvalidParamError("scancode");
return 0;
@@ -890,7 +890,7 @@ SDL_GetScancodeName(SDL_Scancode scancode)
const char *name;
if (scancode < SDL_SCANCODE_UNKNOWN || scancode >= SDL_NUM_SCANCODES) {
SDL_InvalidParamError("scancode");
- return "";
+ return "";
}
name = SDL_scancode_names[scancode];
@@ -902,24 +902,24 @@ SDL_GetScancodeName(SDL_Scancode scancode)
SDL_Scancode SDL_GetScancodeFromName(const char *name)
{
- int i;
-
- if (!name || !*name) {
- SDL_InvalidParamError("name");
- return SDL_SCANCODE_UNKNOWN;
- }
-
- for (i = 0; i < SDL_arraysize(SDL_scancode_names); ++i) {
- if (!SDL_scancode_names[i]) {
- continue;
- }
- if (SDL_strcasecmp(name, SDL_scancode_names[i]) == 0) {
- return (SDL_Scancode)i;
- }
- }
-
- SDL_InvalidParamError("name");
- return SDL_SCANCODE_UNKNOWN;
+ int i;
+
+ if (!name || !*name) {
+ SDL_InvalidParamError("name");
+ return SDL_SCANCODE_UNKNOWN;
+ }
+
+ for (i = 0; i < SDL_arraysize(SDL_scancode_names); ++i) {
+ if (!SDL_scancode_names[i]) {
+ continue;
+ }
+ if (SDL_strcasecmp(name, SDL_scancode_names[i]) == 0) {
+ return (SDL_Scancode)i;
+ }
+ }
+
+ SDL_InvalidParamError("name");
+ return SDL_SCANCODE_UNKNOWN;
}
const char *
@@ -964,51 +964,51 @@ SDL_GetKeyName(SDL_Keycode key)
SDL_Keycode
SDL_GetKeyFromName(const char *name)
{
- SDL_Keycode key;
+ SDL_Keycode key;
/* Check input */
if (name == NULL) return SDLK_UNKNOWN;
-
- /* If it's a single UTF-8 character, then that's the keycode itself */
- key = *(const unsigned char *)name;
- if (key >= 0xF0) {
- if (SDL_strlen(name) == 4) {
- int i = 0;
- key = (Uint16)(name[i]&0x07) << 18;
- key |= (Uint16)(name[++i]&0x3F) << 12;
- key |= (Uint16)(name[++i]&0x3F) << 6;
- key |= (Uint16)(name[++i]&0x3F);
- return key;
- }
- return SDLK_UNKNOWN;
- } else if (key >= 0xE0) {
- if (SDL_strlen(name) == 3) {
- int i = 0;
- key = (Uint16)(name[i]&0x0F) << 12;
- key |= (Uint16)(name[++i]&0x3F) << 6;
- key |= (Uint16)(name[++i]&0x3F);
- return key;
- }
- return SDLK_UNKNOWN;
- } else if (key >= 0xC0) {
- if (SDL_strlen(name) == 2) {
- int i = 0;
- key = (Uint16)(name[i]&0x1F) << 6;
- key |= (Uint16)(name[++i]&0x3F);
- return key;
- }
- return SDLK_UNKNOWN;
- } else {
- if (SDL_strlen(name) == 1) {
- if (key >= 'A' && key <= 'Z') {
- key += 32;
- }
- return key;
- }
-
- /* Get the scancode for this name, and the associated keycode */
- return SDL_default_keymap[SDL_GetScancodeFromName(name)];
- }
+
+ /* If it's a single UTF-8 character, then that's the keycode itself */
+ key = *(const unsigned char *)name;
+ if (key >= 0xF0) {
+ if (SDL_strlen(name) == 4) {
+ int i = 0;
+ key = (Uint16)(name[i]&0x07) << 18;
+ key |= (Uint16)(name[++i]&0x3F) << 12;
+ key |= (Uint16)(name[++i]&0x3F) << 6;
+ key |= (Uint16)(name[++i]&0x3F);
+ return key;
+ }
+ return SDLK_UNKNOWN;
+ } else if (key >= 0xE0) {
+ if (SDL_strlen(name) == 3) {
+ int i = 0;
+ key = (Uint16)(name[i]&0x0F) << 12;
+ key |= (Uint16)(name[++i]&0x3F) << 6;
+ key |= (Uint16)(name[++i]&0x3F);
+ return key;
+ }
+ return SDLK_UNKNOWN;
+ } else if (key >= 0xC0) {
+ if (SDL_strlen(name) == 2) {
+ int i = 0;
+ key = (Uint16)(name[i]&0x1F) << 6;
+ key |= (Uint16)(name[++i]&0x3F);
+ return key;
+ }
+ return SDLK_UNKNOWN;
+ } else {
+ if (SDL_strlen(name) == 1) {
+ if (key >= 'A' && key <= 'Z') {
+ key += 32;
+ }
+ return key;
+ }
+
+ /* Get the scancode for this name, and the associated keycode */
+ return SDL_default_keymap[SDL_GetScancodeFromName(name)];
+ }
}
/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/events/SDL_mouse.c b/src/events/SDL_mouse.c
index ede6a6c466..5536ab73b7 100644
--- a/src/events/SDL_mouse.c
+++ b/src/events/SDL_mouse.c
@@ -397,12 +397,12 @@ void
SDL_WarpMouseInWindow(SDL_Window * window, int x, int y)
{
SDL_Mouse *mouse = SDL_GetMouse();
-
- if ( window == NULL )
- window = mouse->focus;
-
- if ( window == NULL )
- return;
+
+ if ( window == NULL )
+ window = mouse->focus;
+
+ if ( window == NULL )
+ return;
if (mouse->WarpMouse) {
mouse->WarpMouse(window, x, y);
@@ -572,13 +572,13 @@ SDL_CreateSystemCursor(SDL_SystemCursor id)
return NULL;
}
- cursor = mouse->CreateSystemCursor(id);
+ cursor = mouse->CreateSystemCursor(id);
if (cursor) {
cursor->next = mouse->cursors;
mouse->cursors = cursor;
}
- return cursor;
+ return cursor;
}
/* SDL_SetCursor(NULL) can be used to force the cursor redraw,
diff --git a/src/events/SDL_mouse_c.h b/src/events/SDL_mouse_c.h
index 9994bc640c..a8faa2e17f 100644
--- a/src/events/SDL_mouse_c.h
+++ b/src/events/SDL_mouse_c.h
@@ -39,7 +39,7 @@ typedef struct
SDL_Cursor *(*CreateCursor) (SDL_Surface * surface, int hot_x, int hot_y);
/* Create a system cursor */
- SDL_Cursor *(*CreateSystemCursor) (SDL_SystemCursor id);
+ SDL_Cursor *(*CreateSystemCursor) (SDL_SystemCursor id);
/* Show the specified cursor, or hide if cursor is NULL */
int (*ShowCursor) (SDL_Cursor * cursor);
diff --git a/src/events/SDL_touch.c b/src/events/SDL_touch.c
index 6fca4038d7..3429b57d77 100644
--- a/src/events/SDL_touch.c
+++ b/src/events/SDL_touch.c
@@ -165,7 +165,7 @@ SDL_AddTouch(SDL_TouchID touchID, const char *name)
return index;
}
-static int
+static int
SDL_AddFinger(SDL_Touch *touch, SDL_FingerID fingerid, float x, float y, float pressure)
{
SDL_Finger *finger;
@@ -258,7 +258,7 @@ SDL_SendTouch(SDL_TouchID id, SDL_FingerID fingerid,
event.tfinger.touchId = id;
event.tfinger.fingerId = fingerid;
/* I don't trust the coordinates passed on fingerUp */
- event.tfinger.x = finger->x;
+ event.tfinger.x = finger->x;
event.tfinger.y = finger->y;
event.tfinger.dx = 0;
event.tfinger.dy = 0;
@@ -287,7 +287,7 @@ SDL_SendTouchMotion(SDL_TouchID id, SDL_FingerID fingerid,
finger = SDL_GetFinger(touch,fingerid);
if (!finger) {
- return SDL_SendTouch(id, fingerid, SDL_TRUE, x, y, pressure);
+ return SDL_SendTouch(id, fingerid, SDL_TRUE, x, y, pressure);
}
xrel = x - finger->x;
@@ -306,7 +306,7 @@ SDL_SendTouchMotion(SDL_TouchID id, SDL_FingerID fingerid,
finger->x = x;
finger->y = y;
finger->pressure = pressure;
-
+
/* Post the event, if desired */
posted = 0;
if (SDL_GetEventState(SDL_FINGERMOTION) == SDL_ENABLE) {
@@ -317,7 +317,7 @@ SDL_SendTouchMotion(SDL_TouchID id, SDL_FingerID fingerid,
event.tfinger.x = x;
event.tfinger.y = y;
event.tfinger.dx = xrel;
- event.tfinger.dy = yrel;
+ event.tfinger.dy = yrel;
event.tfinger.pressure = pressure;
posted = (SDL_PushEvent(&event) > 0);
}
diff --git a/src/events/SDL_touch_c.h b/src/events/SDL_touch_c.h
index 8961d74e50..d0a2cf2f78 100644
--- a/src/events/SDL_touch_c.h
+++ b/src/events/SDL_touch_c.h
@@ -38,17 +38,17 @@ extern int SDL_TouchInit(void);
/* Add a touch, returning the index of the touch, or -1 if there was an error. */
extern int SDL_AddTouch(SDL_TouchID id, const char *name);
-
+
/* Get the touch with a given id */
extern SDL_Touch *SDL_GetTouch(SDL_TouchID id);
/* Send a touch down/up event for a touch */
-extern int SDL_SendTouch(SDL_TouchID id, SDL_FingerID fingerid,
- SDL_bool down, float x, float y, float pressure);
+extern int SDL_SendTouch(SDL_TouchID id, SDL_FingerID fingerid,
+ SDL_bool down, float x, float y, float pressure);
/* Send a touch motion event for a touch */
extern int SDL_SendTouchMotion(SDL_TouchID id, SDL_FingerID fingerid,
- float x, float y, float pressure);
+ float x, float y, float pressure);
/* Remove a touch */
extern void SDL_DelTouch(SDL_TouchID id);
diff --git a/src/events/SDL_windowevents.c b/src/events/SDL_windowevents.c
index 60d65ae577..9011f68e14 100644
--- a/src/events/SDL_windowevents.c
+++ b/src/events/SDL_windowevents.c
@@ -155,7 +155,7 @@ SDL_SendWindowEvent(SDL_Window * window, Uint8 windowevent, int data1,
return 0;
}
window->flags &= ~SDL_WINDOW_MOUSE_FOCUS;
- SDL_OnWindowLeave(window);
+ SDL_OnWindowLeave(window);
break;
case SDL_WINDOWEVENT_FOCUS_GAINED:
if (window->flags & SDL_WINDOW_INPUT_FOCUS) {
@@ -196,13 +196,13 @@ SDL_SendWindowEvent(SDL_Window * window, Uint8 windowevent, int data1,
posted = (SDL_PushEvent(&event) > 0);
}
-
- if (windowevent == SDL_WINDOWEVENT_CLOSE) {
- if ( !window->prev && !window->next ) {
- // This is the last window in the list so send the SDL_QUIT event
- SDL_SendQuit();
- }
- }
+
+ if (windowevent == SDL_WINDOWEVENT_CLOSE) {
+ if ( !window->prev && !window->next ) {
+ /* This is the last window in the list so send the SDL_QUIT event */
+ SDL_SendQuit();
+ }
+ }
return (posted);
}
diff --git a/src/events/blank_cursor.h b/src/events/blank_cursor.h
index 534d2e2d26..6efb4741e1 100644
--- a/src/events/blank_cursor.h
+++ b/src/events/blank_cursor.h
@@ -19,13 +19,13 @@
3. This notice may not be removed or altered from any source distribution.
*/
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* A default blank 8x8 cursor */
-#define BLANK_CWIDTH 8
-#define BLANK_CHEIGHT 8
-#define BLANK_CHOTX 0
-#define BLANK_CHOTY 0
+#define BLANK_CWIDTH 8
+#define BLANK_CHEIGHT 8
+#define BLANK_CHOTX 0
+#define BLANK_CHOTY 0
static const unsigned char blank_cdata[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
static const unsigned char blank_cmask[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
diff --git a/src/events/default_cursor.h b/src/events/default_cursor.h
index 8a7b2a9e32..8c2dcfcff2 100644
--- a/src/events/default_cursor.h
+++ b/src/events/default_cursor.h
@@ -19,13 +19,13 @@
3. This notice may not be removed or altered from any source distribution.
*/
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Default cursor - it happens to be the Mac cursor, but could be anything */
-#define DEFAULT_CWIDTH 16
-#define DEFAULT_CHEIGHT 16
-#define DEFAULT_CHOTX 0
-#define DEFAULT_CHOTY 0
+#define DEFAULT_CWIDTH 16
+#define DEFAULT_CHEIGHT 16
+#define DEFAULT_CHOTX 0
+#define DEFAULT_CHOTY 0
/* Added a real MacOS cursor, at the request of Luc-Olivier de Charrière */
#define USE_MACOS_CURSOR
diff --git a/src/file/SDL_rwops.c b/src/file/SDL_rwops.c
index 44b0e8407c..59e83c89a1 100644
--- a/src/file/SDL_rwops.c
+++ b/src/file/SDL_rwops.c
@@ -47,7 +47,7 @@
#define INVALID_SET_FILE_POINTER 0xFFFFFFFF
#endif
-#define READAHEAD_BUFFER_SIZE 1024
+#define READAHEAD_BUFFER_SIZE 1024
static int SDLCALL
windows_file_open(SDL_RWops * context, const char *filename, const char *mode)
@@ -518,12 +518,12 @@ SDL_RWFromFile(const char *file, const char *mode)
#elif HAVE_STDIO_H
{
- #ifdef __APPLE__
- FILE *fp = SDL_OpenFPFromBundleOrFallback(file, mode);
+ #ifdef __APPLE__
+ FILE *fp = SDL_OpenFPFromBundleOrFallback(file, mode);
#else
- FILE *fp = fopen(file, mode);
- #endif
- if (fp == NULL) {
+ FILE *fp = fopen(file, mode);
+ #endif
+ if (fp == NULL) {
SDL_SetError("Couldn't open %s", file);
} else {
rwops = SDL_RWFromFP(fp, 1);
diff --git a/src/file/cocoa/SDL_rwopsbundlesupport.m b/src/file/cocoa/SDL_rwopsbundlesupport.m
index 39b4c0e9c9..8ec0220ec3 100644
--- a/src/file/cocoa/SDL_rwopsbundlesupport.m
+++ b/src/file/cocoa/SDL_rwopsbundlesupport.m
@@ -14,32 +14,32 @@ FILE* SDL_OpenFPFromBundleOrFallback(const char *file, const char *mode)
{
FILE* fp = NULL;
- // If the file mode is writable, skip all the bundle stuff because generally the bundle is read-only.
- if(strcmp("r", mode) && strcmp("rb", mode))
- {
- return fopen(file, mode);
- }
+ /* If the file mode is writable, skip all the bundle stuff because generally the bundle is read-only. */
+ if(strcmp("r", mode) && strcmp("rb", mode))
+ {
+ return fopen(file, mode);
+ }
- NSAutoreleasePool* autorelease_pool = [[NSAutoreleasePool alloc] init];
+ NSAutoreleasePool* autorelease_pool = [[NSAutoreleasePool alloc] init];
- NSFileManager* file_manager = [NSFileManager defaultManager];
- NSString* resource_path = [[NSBundle mainBundle] resourcePath];
+ NSFileManager* file_manager = [NSFileManager defaultManager];
+ NSString* resource_path = [[NSBundle mainBundle] resourcePath];
- NSString* ns_string_file_component = [file_manager stringWithFileSystemRepresentation:file length:strlen(file)];
+ NSString* ns_string_file_component = [file_manager stringWithFileSystemRepresentation:file length:strlen(file)];
- NSString* full_path_with_file_to_try = [resource_path stringByAppendingPathComponent:ns_string_file_component];
- if([file_manager fileExistsAtPath:full_path_with_file_to_try])
- {
- fp = fopen([full_path_with_file_to_try fileSystemRepresentation], mode);
- }
- else
- {
- fp = fopen(file, mode);
- }
+ NSString* full_path_with_file_to_try = [resource_path stringByAppendingPathComponent:ns_string_file_component];
+ if([file_manager fileExistsAtPath:full_path_with_file_to_try])
+ {
+ fp = fopen([full_path_with_file_to_try fileSystemRepresentation], mode);
+ }
+ else
+ {
+ fp = fopen(file, mode);
+ }
- [autorelease_pool drain];
+ [autorelease_pool drain];
- return fp;
+ return fp;
}
#endif
diff --git a/src/haptic/SDL_syshaptic.h b/src/haptic/SDL_syshaptic.h
index affd5731f0..28ef84399e 100644
--- a/src/haptic/SDL_syshaptic.h
+++ b/src/haptic/SDL_syshaptic.h
@@ -56,7 +56,7 @@ struct _SDL_Haptic
SDL_HapticEffect rumble_effect; /* Rumble effect. */
};
-/*
+/*
* Scans the system for haptic devices.
*
* Returns 0 on success, -1 on error.
diff --git a/src/haptic/darwin/SDL_syshaptic.c b/src/haptic/darwin/SDL_syshaptic.c
index a8b1d586f8..53c5acddd5 100644
--- a/src/haptic/darwin/SDL_syshaptic.c
+++ b/src/haptic/darwin/SDL_syshaptic.c
@@ -35,7 +35,7 @@
#include <ForceFeedback/ForceFeedbackConstants.h>
#ifndef IO_OBJECT_NULL
-#define IO_OBJECT_NULL ((io_service_t)0)
+#define IO_OBJECT_NULL ((io_service_t)0)
#endif
#define MAX_HAPTICS 32
@@ -83,7 +83,7 @@ static void SDL_SYS_HapticFreeFFEFFECT(FFEFFECT * effect, int type);
static int HIDGetDeviceProduct(io_service_t dev, char *name);
-/*
+/*
* Like strerror but for force feedback errors.
*/
static const char *
@@ -562,7 +562,7 @@ SDL_SYS_HapticClose(SDL_Haptic * haptic)
}
-/*
+/*
* Clean up after system specific haptic stuff
*/
void
diff --git a/src/haptic/linux/SDL_syshaptic.c b/src/haptic/linux/SDL_syshaptic.c
index 23a373520e..92705320a9 100644
--- a/src/haptic/linux/SDL_syshaptic.c
+++ b/src/haptic/linux/SDL_syshaptic.c
@@ -155,7 +155,7 @@ SDL_SYS_HapticInit(void)
numhaptics = 0;
- /*
+ /*
* Limit amount of checks to MAX_HAPTICS since we may or may not have
* permission to some or all devices.
*/
@@ -446,7 +446,7 @@ SDL_SYS_HapticClose(SDL_Haptic * haptic)
}
-/*
+/*
* Clean up after system specific haptic stuff
*/
void
@@ -498,44 +498,44 @@ SDL_SYS_ToDirection(SDL_HapticDirection * dir)
switch (dir->type) {
case SDL_HAPTIC_POLAR:
/* Linux directions start from south.
- (and range from 0 to 0xFFFF)
- Quoting include/linux/input.h, line 926:
- Direction of the effect is encoded as follows:
- 0 deg -> 0x0000 (down)
- 90 deg -> 0x4000 (left)
- 180 deg -> 0x8000 (up)
- 270 deg -> 0xC000 (right)
- */
- tmp = (((18000 + dir->dir[0]) % 36000) * 0xFFFF) / 36000; // convert to range [0,0xFFFF]
+ (and range from 0 to 0xFFFF)
+ Quoting include/linux/input.h, line 926:
+ Direction of the effect is encoded as follows:
+ 0 deg -> 0x0000 (down)
+ 90 deg -> 0x4000 (left)
+ 180 deg -> 0x8000 (up)
+ 270 deg -> 0xC000 (right)
+ */
+ tmp = (((18000 + dir->dir[0]) % 36000) * 0xFFFF) / 36000; /* convert to range [0,0xFFFF] */
return (Uint16) tmp;
- case SDL_HAPTIC_SPHERICAL:
- /*
- We convert to polar, because that's the only supported direction on Linux.
- The first value of a spherical direction is practically the same as a
- Polar direction, except that we have to add 90 degrees. It is the angle
- from EAST {1,0} towards SOUTH {0,1}.
- --> add 9000
- --> finally add 18000 and convert to [0,0xFFFF] as in case SDL_HAPTIC_POLAR.
- */
- tmp = ((dir->dir[0]) + 9000) % 36000; /* Convert to polars */
- tmp = (((18000 + tmp) % 36000) * 0xFFFF) / 36000; // convert to range [0,0xFFFF]
+ case SDL_HAPTIC_SPHERICAL:
+ /*
+ We convert to polar, because that's the only supported direction on Linux.
+ The first value of a spherical direction is practically the same as a
+ Polar direction, except that we have to add 90 degrees. It is the angle
+ from EAST {1,0} towards SOUTH {0,1}.
+ --> add 9000
+ --> finally add 18000 and convert to [0,0xFFFF] as in case SDL_HAPTIC_POLAR.
+ */
+ tmp = ((dir->dir[0]) + 9000) % 36000; /* Convert to polars */
+ tmp = (((18000 + tmp) % 36000) * 0xFFFF) / 36000; /* convert to range [0,0xFFFF] */
return (Uint16) tmp;
case SDL_HAPTIC_CARTESIAN:
f = atan2(dir->dir[1], dir->dir[0]);
- /*
- atan2 takes the parameters: Y-axis-value and X-axis-value (in that order)
- - Y-axis-value is the second coordinate (from center to SOUTH)
- - X-axis-value is the first coordinate (from center to EAST)
- We add 36000, because atan2 also returns negative values. Then we practically
- have the first spherical value. Therefore we proceed as in case
- SDL_HAPTIC_SPHERICAL and add another 9000 to get the polar value.
- --> add 45000 in total
- --> finally add 18000 and convert to [0,0xFFFF] as in case SDL_HAPTIC_POLAR.
- */
- tmp = (((int) (f * 18000. / M_PI)) + 45000) % 36000;
- tmp = (((18000 + tmp) % 36000) * 0xFFFF) / 36000; // convert to range [0,0xFFFF]
+ /*
+ atan2 takes the parameters: Y-axis-value and X-axis-value (in that order)
+ - Y-axis-value is the second coordinate (from center to SOUTH)
+ - X-axis-value is the first coordinate (from center to EAST)
+ We add 36000, because atan2 also returns negative values. Then we practically
+ have the first spherical value. Therefore we proceed as in case
+ SDL_HAPTIC_SPHERICAL and add another 9000 to get the polar value.
+ --> add 45000 in total
+ --> finally add 18000 and convert to [0,0xFFFF] as in case SDL_HAPTIC_POLAR.
+ */
+ tmp = (((int) (f * 18000. / M_PI)) + 45000) % 36000;
+ tmp = (((18000 + tmp) % 36000) * 0xFFFF) / 36000; /* convert to range [0,0xFFFF] */
return (Uint16) tmp;
default:
diff --git a/src/haptic/windows/SDL_syshaptic.c b/src/haptic/windows/SDL_syshaptic.c
index a41c68ea2c..b567ed7d7c 100644
--- a/src/haptic/windows/SDL_syshaptic.c
+++ b/src/haptic/windows/SDL_syshaptic.c
@@ -41,8 +41,8 @@ static struct
char *name;
SDL_Haptic *haptic;
DIDEVCAPS capabilities;
- Uint8 bXInputHaptic; // Supports force feedback via XInput.
- Uint8 userid; // XInput userid index for this joystick
+ Uint8 bXInputHaptic; /* Supports force feedback via XInput. */
+ Uint8 userid; /* XInput userid index for this joystick */
} SDL_hapticlist[MAX_HAPTICS];
@@ -54,8 +54,8 @@ struct haptic_hwdata
LPDIRECTINPUTDEVICE8 device;
DWORD axes[3]; /* Axes to use. */
int is_joystick; /* Device is loaded as joystick. */
- Uint8 bXInputHaptic; // Supports force feedback via XInput.
- Uint8 userid; // XInput userid index for this joystick
+ Uint8 bXInputHaptic; /* Supports force feedback via XInput. */
+ Uint8 userid; /* XInput userid index for this joystick */
};
@@ -107,7 +107,7 @@ static BOOL CALLBACK EnumHapticsCallback(const DIDEVICEINSTANCE *
static BOOL CALLBACK DI_EffectCallback(LPCDIEFFECTINFO pei, LPVOID pv);
-/*
+/*
* Like SDL_SetError but for DX error codes.
*/
static int
@@ -732,7 +732,7 @@ SDL_SYS_HapticClose(SDL_Haptic * haptic)
}
-/*
+/*
* Clean up after system specific haptic stuff
*/
void
@@ -1264,12 +1264,13 @@ SDL_SYS_HapticUpdateEffect(SDL_Haptic * haptic,
DIEFFECT temp;
if (haptic->hwdata->bXInputHaptic) {
- // !!! FIXME: this isn't close to right. We only support "sine" effects,
- // !!! FIXME: we ignore most of the parameters, and we probably get
- // !!! FIXME: the ones we don't ignore wrong, too.
- // !!! FIXME: if I had a better understanding of how the two motors
- // !!! FIXME: could be used in unison, perhaps I could implement other
- // !!! FIXME: effect types?
+ /* !!! FIXME: this isn't close to right. We only support "sine" effects,
+ * !!! FIXME: we ignore most of the parameters, and we probably get
+ * !!! FIXME: the ones we don't ignore wrong, too.
+ * !!! FIXME: if I had a better understanding of how the two motors
+ * !!! FIXME: could be used in unison, perhaps I could implement other
+ * !!! FIXME: effect types?
+ */
/* From MSDN:
"Note that the right motor is the high-frequency motor, the left
motor is the low-frequency motor. They do not always need to be
@@ -1528,5 +1529,6 @@ SDL_SYS_HapticStopAll(SDL_Haptic * haptic)
return 0;
}
-
#endif /* SDL_HAPTIC_DINPUT */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/joystick/SDL_gamecontroller.c b/src/joystick/SDL_gamecontroller.c
index fda506af7f..b8718a190a 100644
--- a/src/joystick/SDL_gamecontroller.c
+++ b/src/joystick/SDL_gamecontroller.c
@@ -39,8 +39,8 @@ static SDL_GameController *SDL_gamecontrollers = NULL;
/* keep track of the hat and mask value that transforms this hat movement into a button/axis press */
struct _SDL_HatMapping
{
- int hat;
- Uint8 mask;
+ int hat;
+ Uint8 mask;
};
#define k_nMaxReverseEntries 20
@@ -54,24 +54,24 @@ struct _SDL_HatMapping
/* our in memory mapping db between joystick objects and controller mappings*/
struct _SDL_ControllerMapping
{
- SDL_JoystickGUID guid;
- const char *name;
+ SDL_JoystickGUID guid;
+ const char *name;
- // mapping of axis/button id to controller version
- int axes[SDL_CONTROLLER_AXIS_MAX];
- int buttonasaxis[SDL_CONTROLLER_AXIS_MAX];
+ /* mapping of axis/button id to controller version */
+ int axes[SDL_CONTROLLER_AXIS_MAX];
+ int buttonasaxis[SDL_CONTROLLER_AXIS_MAX];
- int buttons[SDL_CONTROLLER_BUTTON_MAX];
- int axesasbutton[SDL_CONTROLLER_BUTTON_MAX];
- struct _SDL_HatMapping hatasbutton[SDL_CONTROLLER_BUTTON_MAX];
+ int buttons[SDL_CONTROLLER_BUTTON_MAX];
+ int axesasbutton[SDL_CONTROLLER_BUTTON_MAX];
+ struct _SDL_HatMapping hatasbutton[SDL_CONTROLLER_BUTTON_MAX];
- // reverse mapping, joystick indices to buttons
- SDL_GameControllerAxis raxes[k_nMaxReverseEntries];
- SDL_GameControllerAxis rbuttonasaxis[k_nMaxReverseEntries];
+ /* reverse mapping, joystick indices to buttons */
+ SDL_GameControllerAxis raxes[k_nMaxReverseEntries];
+ SDL_GameControllerAxis rbuttonasaxis[k_nMaxReverseEntries];
- SDL_GameControllerButton rbuttons[k_nMaxReverseEntries];
- SDL_GameControllerButton raxesasbutton[k_nMaxReverseEntries];
- SDL_GameControllerButton rhatasbutton[k_nMaxHatEntries];
+ SDL_GameControllerButton rbuttons[k_nMaxReverseEntries];
+ SDL_GameControllerButton raxesasbutton[k_nMaxReverseEntries];
+ SDL_GameControllerButton rhatasbutton[k_nMaxHatEntries];
};
@@ -79,10 +79,10 @@ struct _SDL_ControllerMapping
/* our hard coded list of mapping support */
typedef struct _ControllerMapping_t
{
- SDL_JoystickGUID guid;
- char *name;
- char *mapping;
- struct _ControllerMapping_t *next;
+ SDL_JoystickGUID guid;
+ char *name;
+ char *mapping;
+ struct _ControllerMapping_t *next;
} ControllerMapping_t;
@@ -90,33 +90,33 @@ typedef struct _ControllerMapping_t
const char *s_ControllerMappings [] =
{
#ifdef SDL_JOYSTICK_DINPUT
- "xinput,X360 Controller,a:b10,b:b11,y:b13,x:b12,start:b4,guide:b14,back:b5,dpup:b0,dpleft:b2,dpdown:b1,dpright:b3,leftshoulder:b8,rightshoulder:b9,leftstick:b6,rightstick:b7,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5",
- "341a3608000000000000504944564944,Afterglow PS3 Controller,a:b1,b:b2,y:b3,x:b0,start:b9,guide:b12,back:b8,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftshoulder:b4,rightshoulder:b5,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7",
- "88880803000000000000504944564944,PS3 Controller,a:b2,b:b1,x:b0,y:b3,start:b11,back:b8,leftstick:b9,rightstick:b10,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.4,dpdown:h0.8,dpright:h0.2,leftx:a0,lefty:a1,rightx:a3,righty:a4,lefttrigger:b6,righttrigger:b7,guide:b12",
- "4c056802000000000000504944564944,PS3 Controller,a:b14,b:b13,y:b12,x:b15,start:b3,guide:b16,back:b0,leftstick:b1,rightstick:b2,leftshoulder:b10,rightshoulder:b11,dpup:b4,dpleft:b7,dpdown:b6,dpright:b5,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b8,righttrigger:b9,",
- "25090500000000000000504944564944,PS3 DualShock,a:b2,b:b1,x:b0,y:b3,start:b8,guide:,back:b9,leftstick:b10,rightstick:b11,leftshoulder:b6,rightshoulder:b7,dpup:h0.1,dpleft:h0.4,dpdown:h0.8,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b4,righttrigger:b5",
+ "xinput,X360 Controller,a:b10,b:b11,y:b13,x:b12,start:b4,guide:b14,back:b5,dpup:b0,dpleft:b2,dpdown:b1,dpright:b3,leftshoulder:b8,rightshoulder:b9,leftstick:b6,rightstick:b7,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5",
+ "341a3608000000000000504944564944,Afterglow PS3 Controller,a:b1,b:b2,y:b3,x:b0,start:b9,guide:b12,back:b8,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftshoulder:b4,rightshoulder:b5,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7",
+ "88880803000000000000504944564944,PS3 Controller,a:b2,b:b1,x:b0,y:b3,start:b11,back:b8,leftstick:b9,rightstick:b10,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.4,dpdown:h0.8,dpright:h0.2,leftx:a0,lefty:a1,rightx:a3,righty:a4,lefttrigger:b6,righttrigger:b7,guide:b12",
+ "4c056802000000000000504944564944,PS3 Controller,a:b14,b:b13,y:b12,x:b15,start:b3,guide:b16,back:b0,leftstick:b1,rightstick:b2,leftshoulder:b10,rightshoulder:b11,dpup:b4,dpleft:b7,dpdown:b6,dpright:b5,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b8,righttrigger:b9,",
+ "25090500000000000000504944564944,PS3 DualShock,a:b2,b:b1,x:b0,y:b3,start:b8,guide:,back:b9,leftstick:b10,rightstick:b11,leftshoulder:b6,rightshoulder:b7,dpup:h0.1,dpleft:h0.4,dpdown:h0.8,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b4,righttrigger:b5",
"ffff0000000000000000504944564944,GameStop Gamepad,a:b0,b:b1,y:b3,x:b2,start:b9,guide:,back:b8,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7,",
"6d0416c2000000000000504944564944,Generic DirectInput Controller,a:b1,b:b2,y:b3,x:b0,start:b9,back:b8,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7,",
#elif defined(__MACOSX__)
- "5e040000000000008e02000000000000,X360 Controller,a:b0,b:b1,y:b3,x:b2,start:b8,guide:b10,back:b9,dpup:b11,dpleft:b13,dpdown:b12,dpright:b14,leftshoulder:b4,rightshoulder:b5,leftstick:b6,rightstick:b7,leftx:a0,lefty:a1,rightx:a3,righty:a4,lefttrigger:a2,righttrigger:a5",
- "4c050000000000006802000000000000,PS3 Controller,a:b14,b:b13,x:b12,y:b15,start:b3,guide:b16,back:b0,leftstick:b1,rightstick:b2,leftshoulder:b10,rightshoulder:b11,dpup:b4,dpleft:b6,dpdown:b7,dpright:b5,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b8,righttrigger:b9",
+ "5e040000000000008e02000000000000,X360 Controller,a:b0,b:b1,y:b3,x:b2,start:b8,guide:b10,back:b9,dpup:b11,dpleft:b13,dpdown:b12,dpright:b14,leftshoulder:b4,rightshoulder:b5,leftstick:b6,rightstick:b7,leftx:a0,lefty:a1,rightx:a3,righty:a4,lefttrigger:a2,righttrigger:a5",
+ "4c050000000000006802000000000000,PS3 Controller,a:b14,b:b13,x:b12,y:b15,start:b3,guide:b16,back:b0,leftstick:b1,rightstick:b2,leftshoulder:b10,rightshoulder:b11,dpup:b4,dpleft:b6,dpdown:b7,dpright:b5,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b8,righttrigger:b9",
"0500000047532047616d657061640000,GameStop Gamepad,a:b0,b:b1,y:b3,x:b2,start:b9,guide:,back:b8,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7,",
"6d040000000000001fc2000000000000,Logitech F710 Gamepad Controller (XInput),a:b0,b:b1,y:b3,x:b2,start:b8,guide:b10,back:b9,leftstick:b6,rightstick:b7,leftshoulder:b4,rightshoulder:b5,dpup:b11,dpleft:b13,dpdown:b12,dpright:b14,leftx:a0,lefty:a1,rightx:a3,righty:a4,lefttrigger:a2,righttrigger:a5,",
- "6d0400000000000016c2000000000000,Logitech F310 Gamepad Controller (DInput),a:b1,b:b2,y:b3,x:b0,start:b9,back:b8,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7,", // Guide button doesn't seem to be sent in DInput mode.
- "6d0400000000000019c2000000000000,Logitech Wireless Gamepad Controller (DInput),a:b1,b:b2,y:b3,x:b0,start:b9,back:b8,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7,", // This includes F710 in DInput mode and the "Logitech Cordless RumblePad 2", at the very least.
+ "6d0400000000000016c2000000000000,Logitech F310 Gamepad Controller (DInput),a:b1,b:b2,y:b3,x:b0,start:b9,back:b8,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7,", /* Guide button doesn't seem to be sent in DInput mode. */
+ "6d0400000000000019c2000000000000,Logitech Wireless Gamepad Controller (DInput),a:b1,b:b2,y:b3,x:b0,start:b9,back:b8,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7,", /* This includes F710 in DInput mode and the "Logitech Cordless RumblePad 2", at the very least. */
#elif defined(__LINUX__)
- "030000005e0400008e02000014010000,X360 Controller,a:b0,b:b1,y:b3,x:b2,start:b7,guide:b8,back:b6,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftshoulder:b4,rightshoulder:b5,leftstick:b9,rightstick:b10,leftx:a0,lefty:a1,rightx:a3,righty:a4,lefttrigger:a2,righttrigger:a5",
+ "030000005e0400008e02000014010000,X360 Controller,a:b0,b:b1,y:b3,x:b2,start:b7,guide:b8,back:b6,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftshoulder:b4,rightshoulder:b5,leftstick:b9,rightstick:b10,leftx:a0,lefty:a1,rightx:a3,righty:a4,lefttrigger:a2,righttrigger:a5",
"030000005e0400008e02000010010000,X360 Controller,a:b0,b:b1,y:b3,x:b2,start:b7,guide:b8,back:b6,leftstick:b9,rightstick:b10,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a3,righty:a4,lefttrigger:a2,righttrigger:a5,",
"030000005e0400001907000000010000,X360 Wireless Controller,a:b0,b:b1,y:b3,x:b2,start:b7,guide:b8,back:b6,leftstick:b9,rightstick:b10,leftshoulder:b4,rightshoulder:b5,dpup:b13,dpleft:b11,dpdown:b14,dpright:b12,leftx:a0,lefty:a1,rightx:a3,righty:a4,lefttrigger:a2,righttrigger:a5,",
- "030000004c0500006802000011010000,PS3 Controller,a:b14,b:b13,x:b15,y:b12,start:b3,guide:b16,back:b0,leftstick:b1,rightstick:b2,leftshoulder:b10,rightshoulder:b11,dpup:b4,dpleft:b7,dpdown:b6,dpright:b5,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b8,righttrigger:b9",
+ "030000004c0500006802000011010000,PS3 Controller,a:b14,b:b13,x:b15,y:b12,start:b3,guide:b16,back:b0,leftstick:b1,rightstick:b2,leftshoulder:b10,rightshoulder:b11,dpup:b4,dpleft:b7,dpdown:b6,dpright:b5,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b8,righttrigger:b9",
"030000006d0400001fc2000005030000,Logitech F710 Gamepad Controller (XInput),a:b0,b:b1,y:b3,x:b2,start:b7,guide:b8,back:b6,leftstick:b9,rightstick:b10,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a3,righty:a4,lefttrigger:a2,righttrigger:a5,",
- "030000006d04000019c2000011010000,Logitech F710 Gamepad Controller (DInput),a:b1,b:b2,y:b3,x:b0,start:b9,back:b8,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7,", // Guide button doesn't seem to be sent in DInput mode.
+ "030000006d04000019c2000011010000,Logitech F710 Gamepad Controller (DInput),a:b1,b:b2,y:b3,x:b0,start:b9,back:b8,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7,", /* Guide button doesn't seem to be sent in DInput mode. */
"030000006d0400001dc2000014400000,Logitech F310 Gamepad (XInput),a:b0,b:b1,y:b3,x:b2,start:b7,guide:b8,back:b6,leftstick:b9,rightstick:b10,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a3,righty:a4,lefttrigger:a2,righttrigger:a5,",
"030000006d04000019c2000010010000,Logitech Cordless RumblePad 2,a:b1,b:b2,y:b3,x:b0,start:b9,guide:,back:b8,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7,",
"0500000047532047616d657061640000,GameStop Gamepad,a:b0,b:b1,y:b3,x:b2,start:b9,guide:,back:b8,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7,",
"03000000ba2200002010000001010000,Jess Technology USB Game Controller,start:b9,a:b2,b:b1,x:b3,y:b0,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a3,righty:a2,lefttrigger:b6,righttrigger:b7,leftshoulder:b4,rightshoulder:b5,guide:,back:b8",
#endif
- NULL
+ NULL
};
static ControllerMapping_t *s_pSupportedControllers = NULL;
@@ -127,166 +127,166 @@ static ControllerMapping_t *s_pXInputMapping = NULL;
/* The SDL game controller structure */
struct _SDL_GameController
{
- SDL_Joystick *joystick; /* underlying joystick device */
- int ref_count;
- Uint8 hatState[4]; /* the current hat state for this controller */
- struct _SDL_ControllerMapping mapping; /* the mapping object for this controller */
- struct _SDL_GameController *next; /* pointer to next game controller we have allocated */
+ SDL_Joystick *joystick; /* underlying joystick device */
+ int ref_count;
+ Uint8 hatState[4]; /* the current hat state for this controller */
+ struct _SDL_ControllerMapping mapping; /* the mapping object for this controller */
+ struct _SDL_GameController *next; /* pointer to next game controller we have allocated */
};
int SDL_PrivateGameControllerAxis(SDL_GameController * gamecontroller, SDL_GameControllerAxis axis, Sint16 value);
-int SDL_PrivateGameControllerButton(SDL_GameController * gamecontroller, SDL_GameControllerButton button, Uint8 state);
+int SDL_PrivateGameControllerButton(SDL_GameController * gamecontroller, SDL_GameControllerButton button, Uint8 state);
/*
* Event filter to fire controller events from joystick ones
*/
int SDL_GameControllerEventWatcher(void *userdata, SDL_Event * event)
{
- switch( event->type )
- {
- case SDL_JOYAXISMOTION:
- {
- SDL_GameController *controllerlist;
-
- if ( event->jaxis.axis >= k_nMaxReverseEntries ) break;
-
- controllerlist = SDL_gamecontrollers;
- while ( controllerlist )
- {
- if ( controllerlist->joystick->instance_id == event->jaxis.which )
- {
- if ( controllerlist->mapping.raxes[event->jaxis.axis] >= 0 ) // simple axis to axis, send it through
- {
- SDL_GameControllerAxis axis = controllerlist->mapping.raxes[event->jaxis.axis];
+ switch( event->type )
+ {
+ case SDL_JOYAXISMOTION:
+ {
+ SDL_GameController *controllerlist;
+
+ if ( event->jaxis.axis >= k_nMaxReverseEntries ) break;
+
+ controllerlist = SDL_gamecontrollers;
+ while ( controllerlist )
+ {
+ if ( controllerlist->joystick->instance_id == event->jaxis.which )
+ {
+ if ( controllerlist->mapping.raxes[event->jaxis.axis] >= 0 ) /* simple axis to axis, send it through */
+ {
+ SDL_GameControllerAxis axis = controllerlist->mapping.raxes[event->jaxis.axis];
Sint16 value = event->jaxis.value;
- switch (axis)
- {
- case SDL_CONTROLLER_AXIS_TRIGGERLEFT:
- case SDL_CONTROLLER_AXIS_TRIGGERRIGHT:
- /* Shift it to be 0 - 32767. */
- value = value / 2 + 16384;
- default:
- break;
- }
- SDL_PrivateGameControllerAxis( controllerlist, axis, value );
- }
- else if ( controllerlist->mapping.raxesasbutton[event->jaxis.axis] >= 0 ) // simulate an axis as a button
- {
- SDL_PrivateGameControllerButton( controllerlist, controllerlist->mapping.raxesasbutton[event->jaxis.axis], ABS(event->jaxis.value) > 32768/2 ? SDL_PRESSED : SDL_RELEASED );
- }
- break;
- }
- controllerlist = controllerlist->next;
- }
- }
- break;
- case SDL_JOYBUTTONDOWN:
- case SDL_JOYBUTTONUP:
- {
- SDL_GameController *controllerlist;
-
- if ( event->jbutton.button >= k_nMaxReverseEntries ) break;
-
- controllerlist = SDL_gamecontrollers;
- while ( controllerlist )
- {
- if ( controllerlist->joystick->instance_id == event->jbutton.which )
- {
- if ( controllerlist->mapping.rbuttons[event->jbutton.button] >= 0 ) // simple button as button
- {
- SDL_PrivateGameControllerButton( controllerlist, controllerlist->mapping.rbuttons[event->jbutton.button], event->jbutton.state );
- }
- else if ( controllerlist->mapping.rbuttonasaxis[event->jbutton.button] >= 0 ) // an button pretending to be an axis
- {
- SDL_PrivateGameControllerAxis( controllerlist, controllerlist->mapping.rbuttonasaxis[event->jbutton.button], event->jbutton.state > 0 ? 32767 : 0 );
- }
- break;
- }
- controllerlist = controllerlist->next;
- }
- }
- break;
- case SDL_JOYHATMOTION:
- {
- SDL_GameController *controllerlist;
-
- if ( event->jhat.hat >= 4 ) break;
-
- controllerlist = SDL_gamecontrollers;
- while ( controllerlist )
- {
- if ( controllerlist->joystick->instance_id == event->jhat.which )
- {
- Uint8 bSame = controllerlist->hatState[event->jhat.hat] & event->jhat.value;
- // Get list of removed bits (button release)
- Uint8 bChanged = controllerlist->hatState[event->jhat.hat] ^ bSame;
- // the hat idx in the high nibble
- int bHighHat = event->jhat.hat << 4;
-
- if ( bChanged & SDL_HAT_DOWN )
- SDL_PrivateGameControllerButton( controllerlist, controllerlist->mapping.rhatasbutton[bHighHat | SDL_HAT_DOWN], SDL_RELEASED );
- if ( bChanged & SDL_HAT_UP )
- SDL_PrivateGameControllerButton( controllerlist, controllerlist->mapping.rhatasbutton[bHighHat | SDL_HAT_UP], SDL_RELEASED );
- if ( bChanged & SDL_HAT_LEFT )
- SDL_PrivateGameControllerButton( controllerlist, controllerlist->mapping.rhatasbutton[bHighHat | SDL_HAT_LEFT], SDL_RELEASED );
- if ( bChanged & SDL_HAT_RIGHT )
- SDL_PrivateGameControllerButton( controllerlist, controllerlist->mapping.rhatasbutton[bHighHat | SDL_HAT_RIGHT], SDL_RELEASED );
-
- // Get list of added bits (button press)
- bChanged = event->jhat.value ^ bSame;
-
- if ( bChanged & SDL_HAT_DOWN )
- SDL_PrivateGameControllerButton( controllerlist, controllerlist->mapping.rhatasbutton[bHighHat | SDL_HAT_DOWN], SDL_PRESSED );
- if ( bChanged & SDL_HAT_UP )
- SDL_PrivateGameControllerButton( controllerlist, controllerlist->mapping.rhatasbutton[bHighHat | SDL_HAT_UP], SDL_PRESSED );
- if ( bChanged & SDL_HAT_LEFT )
- SDL_PrivateGameControllerButton( controllerlist, controllerlist->mapping.rhatasbutton[bHighHat | SDL_HAT_LEFT], SDL_PRESSED );
- if ( bChanged & SDL_HAT_RIGHT )
- SDL_PrivateGameControllerButton( controllerlist, controllerlist->mapping.rhatasbutton[bHighHat | SDL_HAT_RIGHT], SDL_PRESSED );
-
- // update our state cache
- controllerlist->hatState[event->jhat.hat] = event->jhat.value;
-
- break;
- }
- controllerlist = controllerlist->next;
- }
- }
- break;
- case SDL_JOYDEVICEADDED:
- {
- if ( SDL_IsGameController(event->jdevice.which ) )
- {
- SDL_Event deviceevent;
- deviceevent.type = SDL_CONTROLLERDEVICEADDED;
- deviceevent.cdevice.which = event->jdevice.which;
- SDL_PushEvent(&deviceevent);
- }
- }
- break;
- case SDL_JOYDEVICEREMOVED:
- {
- SDL_GameController *controllerlist = SDL_gamecontrollers;
- while ( controllerlist )
- {
- if ( controllerlist->joystick->instance_id == event->jdevice.which )
- {
- SDL_Event deviceevent;
- deviceevent.type = SDL_CONTROLLERDEVICEREMOVED;
- deviceevent.cdevice.which = event->jdevice.which;
- SDL_PushEvent(&deviceevent);
- break;
- }
- controllerlist = controllerlist->next;
- }
- }
- break;
- default:
- break;
- }
-
- return 1;
+ switch (axis)
+ {
+ case SDL_CONTROLLER_AXIS_TRIGGERLEFT:
+ case SDL_CONTROLLER_AXIS_TRIGGERRIGHT:
+ /* Shift it to be 0 - 32767. */
+ value = value / 2 + 16384;
+ default:
+ break;
+ }
+ SDL_PrivateGameControllerAxis( controllerlist, axis, value );
+ }
+ else if ( controllerlist->mapping.raxesasbutton[event->jaxis.axis] >= 0 ) /* simulate an axis as a button */
+ {
+ SDL_PrivateGameControllerButton( controllerlist, controllerlist->mapping.raxesasbutton[event->jaxis.axis], ABS(event->jaxis.value) > 32768/2 ? SDL_PRESSED : SDL_RELEASED );
+ }
+ break;
+ }
+ controllerlist = controllerlist->next;
+ }
+ }
+ break;
+ case SDL_JOYBUTTONDOWN:
+ case SDL_JOYBUTTONUP:
+ {
+ SDL_GameController *controllerlist;
+
+ if ( event->jbutton.button >= k_nMaxReverseEntries ) break;
+
+ controllerlist = SDL_gamecontrollers;
+ while ( controllerlist )
+ {
+ if ( controllerlist->joystick->instance_id == event->jbutton.which )
+ {
+ if ( controllerlist->mapping.rbuttons[event->jbutton.button] >= 0 ) /* simple button as button */
+ {
+ SDL_PrivateGameControllerButton( controllerlist, controllerlist->mapping.rbuttons[event->jbutton.button], event->jbutton.state );
+ }
+ else if ( controllerlist->mapping.rbuttonasaxis[event->jbutton.button] >= 0 ) /* an button pretending to be an axis */
+ {
+ SDL_PrivateGameControllerAxis( controllerlist, controllerlist->mapping.rbuttonasaxis[event->jbutton.button], event->jbutton.state > 0 ? 32767 : 0 );
+ }
+ break;
+ }
+ controllerlist = controllerlist->next;
+ }
+ }
+ break;
+ case SDL_JOYHATMOTION:
+ {
+ SDL_GameController *controllerlist;
+
+ if ( event->jhat.hat >= 4 ) break;
+
+ controllerlist = SDL_gamecontrollers;
+ while ( controllerlist )
+ {
+ if ( controllerlist->joystick->instance_id == event->jhat.which )
+ {
+ Uint8 bSame = controllerlist->hatState[event->jhat.hat] & event->jhat.value;
+ /* Get list of removed bits (button release) */
+ Uint8 bChanged = controllerlist->hatState[event->jhat.hat] ^ bSame;
+ /* the hat idx in the high nibble */
+ int bHighHat = event->jhat.hat << 4;
+
+ if ( bChanged & SDL_HAT_DOWN )
+ SDL_PrivateGameControllerButton( controllerlist, controllerlist->mapping.rhatasbutton[bHighHat | SDL_HAT_DOWN], SDL_RELEASED );
+ if ( bChanged & SDL_HAT_UP )
+ SDL_PrivateGameControllerButton( controllerlist, controllerlist->mapping.rhatasbutton[bHighHat | SDL_HAT_UP], SDL_RELEASED );
+ if ( bChanged & SDL_HAT_LEFT )
+ SDL_PrivateGameControllerButton( controllerlist, controllerlist->mapping.rhatasbutton[bHighHat | SDL_HAT_LEFT], SDL_RELEASED );
+ if ( bChanged & SDL_HAT_RIGHT )
+ SDL_PrivateGameControllerButton( controllerlist, controllerlist->mapping.rhatasbutton[bHighHat | SDL_HAT_RIGHT], SDL_RELEASED );
+
+ /* Get list of added bits (button press) */
+ bChanged = event->jhat.value ^ bSame;
+
+ if ( bChanged & SDL_HAT_DOWN )
+ SDL_PrivateGameControllerButton( controllerlist, controllerlist->mapping.rhatasbutton[bHighHat | SDL_HAT_DOWN], SDL_PRESSED );
+ if ( bChanged & SDL_HAT_UP )
+ SDL_PrivateGameControllerButton( controllerlist, controllerlist->mapping.rhatasbutton[bHighHat | SDL_HAT_UP], SDL_PRESSED );
+ if ( bChanged & SDL_HAT_LEFT )
+ SDL_PrivateGameControllerButton( controllerlist, controllerlist->mapping.rhatasbutton[bHighHat | SDL_HAT_LEFT], SDL_PRESSED );
+ if ( bChanged & SDL_HAT_RIGHT )
+ SDL_PrivateGameControllerButton( controllerlist, controllerlist->mapping.rhatasbutton[bHighHat | SDL_HAT_RIGHT], SDL_PRESSED );
+
+ /* update our state cache */
+ controllerlist->hatState[event->jhat.hat] = event->jhat.value;
+
+ break;
+ }
+ controllerlist = controllerlist->next;
+ }
+ }
+ break;
+ case SDL_JOYDEVICEADDED:
+ {
+ if ( SDL_IsGameController(event->jdevice.which ) )
+ {
+ SDL_Event deviceevent;
+ deviceevent.type = SDL_CONTROLLERDEVICEADDED;
+ deviceevent.cdevice.which = event->jdevice.which;
+ SDL_PushEvent(&deviceevent);
+ }
+ }
+ break;
+ case SDL_JOYDEVICEREMOVED:
+ {
+ SDL_GameController *controllerlist = SDL_gamecontrollers;
+ while ( controllerlist )
+ {
+ if ( controllerlist->joystick->instance_id == event->jdevice.which )
+ {
+ SDL_Event deviceevent;
+ deviceevent.type = SDL_CONTROLLERDEVICEREMOVED;
+ deviceevent.cdevice.which = event->jdevice.which;
+ SDL_PushEvent(&deviceevent);
+ break;
+ }
+ controllerlist = controllerlist->next;
+ }
+ }
+ break;
+ default:
+ break;
+ }
+
+ return 1;
}
/*
@@ -294,15 +294,15 @@ int SDL_GameControllerEventWatcher(void *userdata, SDL_Event * event)
*/
ControllerMapping_t *SDL_PrivateGetControllerMappingForGUID(SDL_JoystickGUID *guid)
{
- ControllerMapping_t *pSupportedController = s_pSupportedControllers;
- while ( pSupportedController )
- {
- if ( !SDL_memcmp( guid, &pSupportedController->guid, sizeof(*guid) ) )
- {
- return pSupportedController;
- }
- pSupportedController = pSupportedController->next;
- }
+ ControllerMapping_t *pSupportedController = s_pSupportedControllers;
+ while ( pSupportedController )
+ {
+ if ( !SDL_memcmp( guid, &pSupportedController->guid, sizeof(*guid) ) )
+ {
+ return pSupportedController;
+ }
+ pSupportedController = pSupportedController->next;
+ }
return NULL;
}
@@ -312,18 +312,18 @@ ControllerMapping_t *SDL_PrivateGetControllerMappingForGUID(SDL_JoystickGUID *gu
ControllerMapping_t *SDL_PrivateGetControllerMapping(int device_index)
{
#ifdef SDL_JOYSTICK_DINPUT
- if ( SDL_SYS_IsXInputDeviceIndex(device_index) && s_pXInputMapping )
- {
- return s_pXInputMapping;
- }
- else
+ if ( SDL_SYS_IsXInputDeviceIndex(device_index) && s_pXInputMapping )
+ {
+ return s_pXInputMapping;
+ }
+ else
#endif
- {
- SDL_JoystickGUID jGUID = SDL_JoystickGetDeviceGUID( device_index );
- return SDL_PrivateGetControllerMappingForGUID(&jGUID);
- }
+ {
+ SDL_JoystickGUID jGUID = SDL_JoystickGetDeviceGUID( device_index );
+ return SDL_PrivateGetControllerMappingForGUID(&jGUID);
+ }
- return NULL;
+ return NULL;
}
static const char* map_StringForControllerAxis[] = {
@@ -342,8 +342,8 @@ static const char* map_StringForControllerAxis[] = {
SDL_GameControllerAxis SDL_GameControllerGetAxisFromString( const char *pchString )
{
int entry;
- if ( !pchString || !pchString[0] )
- return SDL_CONTROLLER_AXIS_INVALID;
+ if ( !pchString || !pchString[0] )
+ return SDL_CONTROLLER_AXIS_INVALID;
for ( entry = 0; map_StringForControllerAxis[entry]; ++entry)
{
@@ -390,15 +390,15 @@ static const char* map_StringForControllerButton[] = {
SDL_GameControllerButton SDL_GameControllerGetButtonFromString( const char *pchString )
{
int entry;
- if ( !pchString || !pchString[0] )
- return SDL_CONTROLLER_BUTTON_INVALID;
+ if ( !pchString || !pchString[0] )
+ return SDL_CONTROLLER_BUTTON_INVALID;
for ( entry = 0; map_StringForControllerButton[entry]; ++entry)
- {
- if ( !SDL_strcasecmp( pchString, map_StringForControllerButton[entry] ) )
- return entry;
- }
- return SDL_CONTROLLER_BUTTON_INVALID;
+ {
+ if ( !SDL_strcasecmp( pchString, map_StringForControllerButton[entry] ) )
+ return entry;
+ }
+ return SDL_CONTROLLER_BUTTON_INVALID;
}
/*
@@ -418,83 +418,83 @@ const char* SDL_GameControllerGetStringForButton( SDL_GameControllerButton axis
*/
void SDL_PrivateGameControllerParseButton( const char *szGameButton, const char *szJoystickButton, struct _SDL_ControllerMapping *pMapping )
{
- int iSDLButton = 0;
- SDL_GameControllerButton button;
- SDL_GameControllerAxis axis;
- button = SDL_GameControllerGetButtonFromString( szGameButton );
- axis = SDL_GameControllerGetAxisFromString( szGameButton );
- iSDLButton = SDL_atoi( &szJoystickButton[1] );
-
- if ( szJoystickButton[0] == 'a' )
- {
- if ( iSDLButton >= k_nMaxReverseEntries )
- {
- SDL_SetError("Axis index too large: %d", iSDLButton );
- return;
- }
- if ( axis != SDL_CONTROLLER_AXIS_INVALID )
- {
- pMapping->axes[ axis ] = iSDLButton;
- pMapping->raxes[ iSDLButton ] = axis;
- }
- else if ( button != SDL_CONTROLLER_BUTTON_INVALID )
- {
- pMapping->axesasbutton[ button ] = iSDLButton;
- pMapping->raxesasbutton[ iSDLButton ] = button;
- }
- else
- {
- SDL_assert( !"How did we get here?" );
- }
-
- }
- else if ( szJoystickButton[0] == 'b' )
- {
- if ( iSDLButton >= k_nMaxReverseEntries )
- {
- SDL_SetError("Button index too large: %d", iSDLButton );
- return;
- }
- if ( button != SDL_CONTROLLER_BUTTON_INVALID )
- {
- pMapping->buttons[ button ] = iSDLButton;
- pMapping->rbuttons[ iSDLButton ] = button;
- }
- else if ( axis != SDL_CONTROLLER_AXIS_INVALID )
- {
- pMapping->buttonasaxis[ axis ] = iSDLButton;
- pMapping->rbuttonasaxis[ iSDLButton ] = axis;
- }
- else
- {
- SDL_assert( !"How did we get here?" );
- }
- }
- else if ( szJoystickButton[0] == 'h' )
- {
- int hat = SDL_atoi( &szJoystickButton[1] );
- int mask = SDL_atoi( &szJoystickButton[3] );
- if (hat >= 4) {
- SDL_SetError("Hat index too large: %d", iSDLButton );
- }
-
- if ( button != SDL_CONTROLLER_BUTTON_INVALID )
- {
+ int iSDLButton = 0;
+ SDL_GameControllerButton button;
+ SDL_GameControllerAxis axis;
+ button = SDL_GameControllerGetButtonFromString( szGameButton );
+ axis = SDL_GameControllerGetAxisFromString( szGameButton );
+ iSDLButton = SDL_atoi( &szJoystickButton[1] );
+
+ if ( szJoystickButton[0] == 'a' )
+ {
+ if ( iSDLButton >= k_nMaxReverseEntries )
+ {
+ SDL_SetError("Axis index too large: %d", iSDLButton );
+ return;
+ }
+ if ( axis != SDL_CONTROLLER_AXIS_INVALID )
+ {
+ pMapping->axes[ axis ] = iSDLButton;
+ pMapping->raxes[ iSDLButton ] = axis;
+ }
+ else if ( button != SDL_CONTROLLER_BUTTON_INVALID )
+ {
+ pMapping->axesasbutton[ button ] = iSDLButton;
+ pMapping->raxesasbutton[ iSDLButton ] = button;
+ }
+ else
+ {
+ SDL_assert( !"How did we get here?" );
+ }
+
+ }
+ else if ( szJoystickButton[0] == 'b' )
+ {
+ if ( iSDLButton >= k_nMaxReverseEntries )
+ {
+ SDL_SetError("Button index too large: %d", iSDLButton );
+ return;
+ }
+ if ( button != SDL_CONTROLLER_BUTTON_INVALID )
+ {
+ pMapping->buttons[ button ] = iSDLButton;
+ pMapping->rbuttons[ iSDLButton ] = button;
+ }
+ else if ( axis != SDL_CONTROLLER_AXIS_INVALID )
+ {
+ pMapping->buttonasaxis[ axis ] = iSDLButton;
+ pMapping->rbuttonasaxis[ iSDLButton ] = axis;
+ }
+ else
+ {
+ SDL_assert( !"How did we get here?" );
+ }
+ }
+ else if ( szJoystickButton[0] == 'h' )
+ {
+ int hat = SDL_atoi( &szJoystickButton[1] );
+ int mask = SDL_atoi( &szJoystickButton[3] );
+ if (hat >= 4) {
+ SDL_SetError("Hat index too large: %d", iSDLButton );
+ }
+
+ if ( button != SDL_CONTROLLER_BUTTON_INVALID )
+ {
int ridx;
- pMapping->hatasbutton[ button ].hat = hat;
- pMapping->hatasbutton[ button ].mask = mask;
- ridx = (hat << 4) | mask;
- pMapping->rhatasbutton[ ridx ] = button;
- }
- else if ( axis != SDL_CONTROLLER_AXIS_INVALID )
- {
- SDL_assert( !"Support hat as axis" );
- }
- else
- {
- SDL_assert( !"How did we get here?" );
- }
- }
+ pMapping->hatasbutton[ button ].hat = hat;
+ pMapping->hatasbutton[ button ].mask = mask;
+ ridx = (hat << 4) | mask;
+ pMapping->rhatasbutton[ ridx ] = button;
+ }
+ else if ( axis != SDL_CONTROLLER_AXIS_INVALID )
+ {
+ SDL_assert( !"Support hat as axis" );
+ }
+ else
+ {
+ SDL_assert( !"How did we get here?" );
+ }
+ }
}
@@ -504,59 +504,59 @@ void SDL_PrivateGameControllerParseButton( const char *szGameButton, const char
static void
SDL_PrivateGameControllerParseControllerConfigString( struct _SDL_ControllerMapping *pMapping, const char *pchString )
{
- char szGameButton[20];
- char szJoystickButton[20];
- SDL_bool bGameButton = SDL_TRUE;
- int i = 0;
- const char *pchPos = pchString;
-
- SDL_memset( szGameButton, 0x0, sizeof(szGameButton) );
- SDL_memset( szJoystickButton, 0x0, sizeof(szJoystickButton) );
-
- while ( pchPos && *pchPos )
- {
- if ( *pchPos == ':' )
- {
- i = 0;
- bGameButton = SDL_FALSE;
- }
- else if ( *pchPos == ' ' )
- {
-
- }
- else if ( *pchPos == ',' )
- {
- i = 0;
- bGameButton = SDL_TRUE;
- SDL_PrivateGameControllerParseButton( szGameButton, szJoystickButton, pMapping );
- SDL_memset( szGameButton, 0x0, sizeof(szGameButton) );
- SDL_memset( szJoystickButton, 0x0, sizeof(szJoystickButton) );
-
- }
- else if ( bGameButton )
- {
- if ( i >= sizeof(szGameButton))
- {
- SDL_SetError( "Button name too large: %s", szGameButton );
- return;
- }
- szGameButton[i] = *pchPos;
- i++;
- }
- else
- {
- if ( i >= sizeof(szJoystickButton))
- {
- SDL_SetError( "Joystick button name too large: %s", szJoystickButton );
- return;
- }
- szJoystickButton[i] = *pchPos;
- i++;
- }
- pchPos++;
- }
-
- SDL_PrivateGameControllerParseButton( szGameButton, szJoystickButton, pMapping );
+ char szGameButton[20];
+ char szJoystickButton[20];
+ SDL_bool bGameButton = SDL_TRUE;
+ int i = 0;
+ const char *pchPos = pchString;
+
+ SDL_memset( szGameButton, 0x0, sizeof(szGameButton) );
+ SDL_memset( szJoystickButton, 0x0, sizeof(szJoystickButton) );
+
+ while ( pchPos && *pchPos )
+ {
+ if ( *pchPos == ':' )
+ {
+ i = 0;
+ bGameButton = SDL_FALSE;
+ }
+ else if ( *pchPos == ' ' )
+ {
+
+ }
+ else if ( *pchPos == ',' )
+ {
+ i = 0;
+ bGameButton = SDL_TRUE;
+ SDL_PrivateGameControllerParseButton( szGameButton, szJoystickButton, pMapping );
+ SDL_memset( szGameButton, 0x0, sizeof(szGameButton) );
+ SDL_memset( szJoystickButton, 0x0, sizeof(szJoystickButton) );
+
+ }
+ else if ( bGameButton )
+ {
+ if ( i >= sizeof(szGameButton))
+ {
+ SDL_SetError( "Button name too large: %s", szGameButton );
+ return;
+ }
+ szGameButton[i] = *pchPos;
+ i++;
+ }
+ else
+ {
+ if ( i >= sizeof(szJoystickButton))
+ {
+ SDL_SetError( "Joystick button name too large: %s", szJoystickButton );
+ return;
+ }
+ szJoystickButton[i] = *pchPos;
+ i++;
+ }
+ pchPos++;
+ }
+
+ SDL_PrivateGameControllerParseButton( szGameButton, szJoystickButton, pMapping );
}
@@ -565,38 +565,38 @@ SDL_PrivateGameControllerParseControllerConfigString( struct _SDL_ControllerMapp
*/
void SDL_PrivateLoadButtonMapping( struct _SDL_ControllerMapping *pMapping, SDL_JoystickGUID guid, const char *pchName, const char *pchMapping )
{
- int j;
-
- pMapping->guid = guid;
- pMapping->name = pchName;
-
- // set all the button mappings to non defaults
- for ( j = 0; j < SDL_CONTROLLER_AXIS_MAX; j++ )
- {
- pMapping->axes[j] = -1;
- pMapping->buttonasaxis[j] = -1;
- }
- for ( j = 0; j < SDL_CONTROLLER_BUTTON_MAX; j++ )
- {
- pMapping->buttons[j] = -1;
- pMapping->axesasbutton[j] = -1;
- pMapping->hatasbutton[j].hat = -1;
- }
-
- for ( j = 0; j < k_nMaxReverseEntries; j++ )
- {
- pMapping->raxes[j] = SDL_CONTROLLER_AXIS_INVALID;
- pMapping->rbuttonasaxis[j] = SDL_CONTROLLER_AXIS_INVALID;
- pMapping->rbuttons[j] = SDL_CONTROLLER_BUTTON_INVALID;
- pMapping->raxesasbutton[j] = SDL_CONTROLLER_BUTTON_INVALID;
- }
-
- for (j = 0; j < k_nMaxHatEntries; j++)
- {
- pMapping->rhatasbutton[j] = SDL_CONTROLLER_BUTTON_INVALID;
- }
-
- SDL_PrivateGameControllerParseControllerConfigString( pMapping, pchMapping );
+ int j;
+
+ pMapping->guid = guid;
+ pMapping->name = pchName;
+
+ /* set all the button mappings to non defaults */
+ for ( j = 0; j < SDL_CONTROLLER_AXIS_MAX; j++ )
+ {
+ pMapping->axes[j] = -1;
+ pMapping->buttonasaxis[j] = -1;
+ }
+ for ( j = 0; j < SDL_CONTROLLER_BUTTON_MAX; j++ )
+ {
+ pMapping->buttons[j] = -1;
+ pMapping->axesasbutton[j] = -1;
+ pMapping->hatasbutton[j].hat = -1;
+ }
+
+ for ( j = 0; j < k_nMaxReverseEntries; j++ )
+ {
+ pMapping->raxes[j] = SDL_CONTROLLER_AXIS_INVALID;
+ pMapping->rbuttonasaxis[j] = SDL_CONTROLLER_AXIS_INVALID;
+ pMapping->rbuttons[j] = SDL_CONTROLLER_BUTTON_INVALID;
+ pMapping->raxesasbutton[j] = SDL_CONTROLLER_BUTTON_INVALID;
+ }
+
+ for (j = 0; j < k_nMaxHatEntries; j++)
+ {
+ pMapping->rhatasbutton[j] = SDL_CONTROLLER_BUTTON_INVALID;
+ }
+
+ SDL_PrivateGameControllerParseControllerConfigString( pMapping, pchMapping );
}
@@ -605,20 +605,20 @@ void SDL_PrivateLoadButtonMapping( struct _SDL_ControllerMapping *pMapping, SDL_
*/
char *SDL_PrivateGetControllerGUIDFromMappingString( const char *pMapping )
{
- const char *pFirstComma = SDL_strchr( pMapping, ',' );
- if ( pFirstComma )
- {
- char *pchGUID = SDL_malloc( pFirstComma - pMapping + 1 );
- if ( !pchGUID )
- {
- SDL_OutOfMemory();
- return NULL;
- }
- SDL_memcpy( pchGUID, pMapping, pFirstComma - pMapping );
- pchGUID[ pFirstComma - pMapping ] = 0;
- return pchGUID;
- }
- return NULL;
+ const char *pFirstComma = SDL_strchr( pMapping, ',' );
+ if ( pFirstComma )
+ {
+ char *pchGUID = SDL_malloc( pFirstComma - pMapping + 1 );
+ if ( !pchGUID )
+ {
+ SDL_OutOfMemory();
+ return NULL;
+ }
+ SDL_memcpy( pchGUID, pMapping, pFirstComma - pMapping );
+ pchGUID[ pFirstComma - pMapping ] = 0;
+ return pchGUID;
+ }
+ return NULL;
}
@@ -627,14 +627,14 @@ char *SDL_PrivateGetControllerGUIDFromMappingString( const char *pMapping )
*/
char *SDL_PrivateGetControllerNameFromMappingString( const char *pMapping )
{
- const char *pFirstComma, *pSecondComma;
+ const char *pFirstComma, *pSecondComma;
char *pchName;
pFirstComma = SDL_strchr( pMapping, ',' );
if ( !pFirstComma )
return NULL;
- pSecondComma = SDL_strchr( pFirstComma + 1, ',' );
+ pSecondComma = SDL_strchr( pFirstComma + 1, ',' );
if ( !pSecondComma )
return NULL;
@@ -655,13 +655,13 @@ char *SDL_PrivateGetControllerNameFromMappingString( const char *pMapping )
*/
char *SDL_PrivateGetControllerMappingFromMappingString( const char *pMapping )
{
- const char *pFirstComma, *pSecondComma;
+ const char *pFirstComma, *pSecondComma;
pFirstComma = SDL_strchr( pMapping, ',' );
if ( !pFirstComma )
return NULL;
- pSecondComma = SDL_strchr( pFirstComma + 1, ',' );
+ pSecondComma = SDL_strchr( pFirstComma + 1, ',' );
if ( !pSecondComma )
return NULL;
@@ -679,11 +679,11 @@ void SDL_PrivateGameControllerRefreshMapping( ControllerMapping_t *pControllerMa
event.type = SDL_CONTROLLERDEVICEREMAPPED;
event.cdevice.which = gamecontrollerlist->joystick->instance_id;
SDL_PushEvent(&event);
-
- // Not really threadsafe. Should this lock access within SDL_GameControllerEventWatcher?
+
+ /* Not really threadsafe. Should this lock access within SDL_GameControllerEventWatcher? */
SDL_PrivateLoadButtonMapping(&gamecontrollerlist->mapping, pControllerMapping->guid, pControllerMapping->name, pControllerMapping->mapping);
}
-
+
gamecontrollerlist = gamecontrollerlist->next;
}
}
@@ -694,9 +694,9 @@ void SDL_PrivateGameControllerRefreshMapping( ControllerMapping_t *pControllerMa
int
SDL_GameControllerAddMapping( const char *mappingString )
{
- char *pchGUID;
- char *pchName;
- char *pchMapping;
+ char *pchGUID;
+ char *pchName;
+ char *pchMapping;
SDL_JoystickGUID jGUID;
ControllerMapping_t *pControllerMapping;
#ifdef SDL_JOYSTICK_DINPUT
@@ -715,46 +715,46 @@ SDL_GameControllerAddMapping( const char *mappingString )
jGUID = SDL_JoystickGetGUIDFromString(pchGUID);
SDL_free(pchGUID);
- pControllerMapping = SDL_PrivateGetControllerMappingForGUID(&jGUID);
-
- pchName = SDL_PrivateGetControllerNameFromMappingString( mappingString );
- if (!pchName) return -1;
-
- pchMapping = SDL_PrivateGetControllerMappingFromMappingString( mappingString );
- if (!pchMapping) {
- SDL_free( pchName );
- return -1;
- }
-
- if (pControllerMapping) {
- // Update existing mapping
- SDL_free( pControllerMapping->name );
- pControllerMapping->name = pchName;
- SDL_free( pControllerMapping->mapping );
- pControllerMapping->mapping = pchMapping;
- // refresh open controllers
- SDL_PrivateGameControllerRefreshMapping( pControllerMapping );
- return 0;
- } else {
- pControllerMapping = SDL_malloc( sizeof(*pControllerMapping) );
- if (!pControllerMapping) {
- SDL_free( pchName );
- SDL_free( pchMapping );
- return SDL_OutOfMemory();
- }
+ pControllerMapping = SDL_PrivateGetControllerMappingForGUID(&jGUID);
+
+ pchName = SDL_PrivateGetControllerNameFromMappingString( mappingString );
+ if (!pchName) return -1;
+
+ pchMapping = SDL_PrivateGetControllerMappingFromMappingString( mappingString );
+ if (!pchMapping) {
+ SDL_free( pchName );
+ return -1;
+ }
+
+ if (pControllerMapping) {
+ /* Update existing mapping */
+ SDL_free( pControllerMapping->name );
+ pControllerMapping->name = pchName;
+ SDL_free( pControllerMapping->mapping );
+ pControllerMapping->mapping = pchMapping;
+ /* refresh open controllers */
+ SDL_PrivateGameControllerRefreshMapping( pControllerMapping );
+ return 0;
+ } else {
+ pControllerMapping = SDL_malloc( sizeof(*pControllerMapping) );
+ if (!pControllerMapping) {
+ SDL_free( pchName );
+ SDL_free( pchMapping );
+ return SDL_OutOfMemory();
+ }
#ifdef SDL_JOYSTICK_DINPUT
- if ( is_xinput_mapping )
- {
- s_pXInputMapping = pControllerMapping;
- }
+ if ( is_xinput_mapping )
+ {
+ s_pXInputMapping = pControllerMapping;
+ }
#endif
- pControllerMapping->guid = jGUID;
- pControllerMapping->name = pchName;
- pControllerMapping->mapping = pchMapping;
- pControllerMapping->next = s_pSupportedControllers;
- s_pSupportedControllers = pControllerMapping;
- return 1;
- }
+ pControllerMapping->guid = jGUID;
+ pControllerMapping->name = pchName;
+ pControllerMapping->mapping = pchMapping;
+ pControllerMapping->next = s_pSupportedControllers;
+ s_pSupportedControllers = pControllerMapping;
+ return 1;
+ }
}
/*
@@ -763,18 +763,18 @@ SDL_GameControllerAddMapping( const char *mappingString )
char *
SDL_GameControllerMappingForGUID( SDL_JoystickGUID guid )
{
- char *pMappingString = NULL;
- ControllerMapping_t *mapping = SDL_PrivateGetControllerMappingForGUID(&guid);
- if (mapping) {
- char pchGUID[33];
+ char *pMappingString = NULL;
+ ControllerMapping_t *mapping = SDL_PrivateGetControllerMappingForGUID(&guid);
+ if (mapping) {
+ char pchGUID[33];
size_t needed;
- SDL_JoystickGetGUIDString(guid, pchGUID, sizeof(pchGUID));
- // allocate enough memory for GUID + ',' + name + ',' + mapping + \0
- needed = SDL_strlen(pchGUID) + 1 + SDL_strlen(mapping->name) + 1 + SDL_strlen(mapping->mapping) + 1;
- pMappingString = SDL_malloc( needed );
- SDL_snprintf( pMappingString, needed, "%s,%s,%s", pchGUID, mapping->name, mapping->mapping );
- }
- return pMappingString;
+ SDL_JoystickGetGUIDString(guid, pchGUID, sizeof(pchGUID));
+ /* allocate enough memory for GUID + ',' + name + ',' + mapping + \0 */
+ needed = SDL_strlen(pchGUID) + 1 + SDL_strlen(mapping->name) + 1 + SDL_strlen(mapping->mapping) + 1;
+ pMappingString = SDL_malloc( needed );
+ SDL_snprintf( pMappingString, needed, "%s,%s,%s", pchGUID, mapping->name, mapping->mapping );
+ }
+ return pMappingString;
}
/*
@@ -783,7 +783,7 @@ SDL_GameControllerMappingForGUID( SDL_JoystickGUID guid )
char *
SDL_GameControllerMapping( SDL_GameController * gamecontroller )
{
- return SDL_GameControllerMappingForGUID( gamecontroller->mapping.guid );
+ return SDL_GameControllerMappingForGUID( gamecontroller->mapping.guid );
}
static void
@@ -819,25 +819,25 @@ SDL_GameControllerLoadHints()
int
SDL_GameControllerInit(void)
{
- int i = 0;
- const char *pMappingString = NULL;
- s_pSupportedControllers = NULL;
- pMappingString = s_ControllerMappings[i];
- while ( pMappingString )
- {
- SDL_GameControllerAddMapping( pMappingString );
-
- i++;
- pMappingString = s_ControllerMappings[i];
- }
-
- // load in any user supplied config
+ int i = 0;
+ const char *pMappingString = NULL;
+ s_pSupportedControllers = NULL;
+ pMappingString = s_ControllerMappings[i];
+ while ( pMappingString )
+ {
+ SDL_GameControllerAddMapping( pMappingString );
+
+ i++;
+ pMappingString = s_ControllerMappings[i];
+ }
+
+ /* load in any user supplied config */
SDL_GameControllerLoadHints();
- /* watch for joy events and fire controller ones if needed */
- SDL_AddEventWatch( SDL_GameControllerEventWatcher, NULL );
+ /* watch for joy events and fire controller ones if needed */
+ SDL_AddEventWatch( SDL_GameControllerEventWatcher, NULL );
- return (0);
+ return (0);
}
@@ -847,11 +847,11 @@ SDL_GameControllerInit(void)
const char *
SDL_GameControllerNameForIndex(int device_index)
{
- ControllerMapping_t *pSupportedController = SDL_PrivateGetControllerMapping(device_index);
- if ( pSupportedController )
- {
- return pSupportedController->name;
- }
+ ControllerMapping_t *pSupportedController = SDL_PrivateGetControllerMapping(device_index);
+ if ( pSupportedController )
+ {
+ return pSupportedController->name;
+ }
return NULL;
}
@@ -862,13 +862,13 @@ SDL_GameControllerNameForIndex(int device_index)
SDL_bool
SDL_IsGameController(int device_index)
{
- ControllerMapping_t *pSupportedController = SDL_PrivateGetControllerMapping(device_index);
- if ( pSupportedController )
- {
- return SDL_TRUE;
- }
+ ControllerMapping_t *pSupportedController = SDL_PrivateGetControllerMapping(device_index);
+ if ( pSupportedController )
+ {
+ return SDL_TRUE;
+ }
- return SDL_FALSE;
+ return SDL_FALSE;
}
/*
@@ -882,56 +882,56 @@ SDL_GameController *
SDL_GameControllerOpen(int device_index)
{
SDL_GameController *gamecontroller;
- SDL_GameController *gamecontrollerlist;
- ControllerMapping_t *pSupportedController = NULL;
+ SDL_GameController *gamecontrollerlist;
+ ControllerMapping_t *pSupportedController = NULL;
if ((device_index < 0) || (device_index >= SDL_NumJoysticks())) {
SDL_SetError("There are %d joysticks available", SDL_NumJoysticks());
return (NULL);
}
- gamecontrollerlist = SDL_gamecontrollers;
- // If the controller is already open, return it
- while ( gamecontrollerlist )
- {
- if ( SDL_SYS_GetInstanceIdOfDeviceIndex(device_index) == gamecontrollerlist->joystick->instance_id ) {
- gamecontroller = gamecontrollerlist;
- ++gamecontroller->ref_count;
- return (gamecontroller);
- }
- gamecontrollerlist = gamecontrollerlist->next;
+ gamecontrollerlist = SDL_gamecontrollers;
+ /* If the controller is already open, return it */
+ while ( gamecontrollerlist )
+ {
+ if ( SDL_SYS_GetInstanceIdOfDeviceIndex(device_index) == gamecontrollerlist->joystick->instance_id ) {
+ gamecontroller = gamecontrollerlist;
+ ++gamecontroller->ref_count;
+ return (gamecontroller);
+ }
+ gamecontrollerlist = gamecontrollerlist->next;
}
- // Find a controller mapping
- pSupportedController = SDL_PrivateGetControllerMapping(device_index);
- if ( !pSupportedController ) {
- SDL_SetError("Couldn't find mapping for device (%d)", device_index );
- return (NULL);
- }
+ /* Find a controller mapping */
+ pSupportedController = SDL_PrivateGetControllerMapping(device_index);
+ if ( !pSupportedController ) {
+ SDL_SetError("Couldn't find mapping for device (%d)", device_index );
+ return (NULL);
+ }
- // Create and initialize the joystick
- gamecontroller = (SDL_GameController *) SDL_malloc((sizeof *gamecontroller));
- if (gamecontroller == NULL) {
- SDL_OutOfMemory();
- return NULL;
- }
+ /* Create and initialize the joystick */
+ gamecontroller = (SDL_GameController *) SDL_malloc((sizeof *gamecontroller));
+ if (gamecontroller == NULL) {
+ SDL_OutOfMemory();
+ return NULL;
+ }
SDL_memset(gamecontroller, 0, (sizeof *gamecontroller));
gamecontroller->joystick = SDL_JoystickOpen(device_index);
- if ( !gamecontroller->joystick ) {
+ if ( !gamecontroller->joystick ) {
SDL_free(gamecontroller);
return NULL;
}
- SDL_PrivateLoadButtonMapping( &gamecontroller->mapping, pSupportedController->guid, pSupportedController->name, pSupportedController->mapping );
+ SDL_PrivateLoadButtonMapping( &gamecontroller->mapping, pSupportedController->guid, pSupportedController->name, pSupportedController->mapping );
- // Add joystick to list
+ /* Add joystick to list */
++gamecontroller->ref_count;
- // Link the joystick in the list
- gamecontroller->next = SDL_gamecontrollers;
- SDL_gamecontrollers = gamecontroller;
+ /* Link the joystick in the list */
+ gamecontroller->next = SDL_gamecontrollers;
+ SDL_gamecontrollers = gamecontroller;
- SDL_SYS_JoystickUpdate( gamecontroller->joystick );
+ SDL_SYS_JoystickUpdate( gamecontroller->joystick );
return (gamecontroller);
}
@@ -953,22 +953,22 @@ SDL_GameControllerUpdate(void)
Sint16
SDL_GameControllerGetAxis(SDL_GameController * gamecontroller, SDL_GameControllerAxis axis)
{
- if ( !gamecontroller )
- return 0;
-
- if (gamecontroller->mapping.axes[axis] >= 0 )
- {
- return ( SDL_JoystickGetAxis( gamecontroller->joystick, gamecontroller->mapping.axes[axis]) );
- }
- else if (gamecontroller->mapping.buttonasaxis[axis] >= 0 )
- {
- Uint8 value;
- value = SDL_JoystickGetButton( gamecontroller->joystick, gamecontroller->mapping.buttonasaxis[axis] );
- if ( value > 0 )
- return 32767;
- return 0;
- }
- return 0;
+ if ( !gamecontroller )
+ return 0;
+
+ if (gamecontroller->mapping.axes[axis] >= 0 )
+ {
+ return ( SDL_JoystickGetAxis( gamecontroller->joystick, gamecontroller->mapping.axes[axis]) );
+ }
+ else if (gamecontroller->mapping.buttonasaxis[axis] >= 0 )
+ {
+ Uint8 value;
+ value = SDL_JoystickGetButton( gamecontroller->joystick, gamecontroller->mapping.buttonasaxis[axis] );
+ if ( value > 0 )
+ return 32767;
+ return 0;
+ }
+ return 0;
}
@@ -978,32 +978,32 @@ SDL_GameControllerGetAxis(SDL_GameController * gamecontroller, SDL_GameControlle
Uint8
SDL_GameControllerGetButton(SDL_GameController * gamecontroller, SDL_GameControllerButton button)
{
- if ( !gamecontroller )
- return 0;
-
- if ( gamecontroller->mapping.buttons[button] >= 0 )
- {
- return ( SDL_JoystickGetButton( gamecontroller->joystick, gamecontroller->mapping.buttons[button] ) );
- }
- else if ( gamecontroller->mapping.axesasbutton[button] >= 0 )
- {
- Sint16 value;
- value = SDL_JoystickGetAxis( gamecontroller->joystick, gamecontroller->mapping.axesasbutton[button] );
- if ( ABS(value) > 32768/2 )
- return 1;
- return 0;
- }
- else if ( gamecontroller->mapping.hatasbutton[button].hat >= 0 )
- {
- Uint8 value;
- value = SDL_JoystickGetHat( gamecontroller->joystick, gamecontroller->mapping.hatasbutton[button].hat );
-
- if ( value & gamecontroller->mapping.hatasbutton[button].mask )
- return 1;
- return 0;
- }
-
- return 0;
+ if ( !gamecontroller )
+ return 0;
+
+ if ( gamecontroller->mapping.buttons[button] >= 0 )
+ {
+ return ( SDL_JoystickGetButton( gamecontroller->joystick, gamecontroller->mapping.buttons[button] ) );
+ }
+ else if ( gamecontroller->mapping.axesasbutton[button] >= 0 )
+ {
+ Sint16 value;
+ value = SDL_JoystickGetAxis( gamecontroller->joystick, gamecontroller->mapping.axesasbutton[button] );
+ if ( ABS(value) > 32768/2 )
+ return 1;
+ return 0;
+ }
+ else if ( gamecontroller->mapping.hatasbutton[button].hat >= 0 )
+ {
+ Uint8 value;
+ value = SDL_JoystickGetHat( gamecontroller->joystick, gamecontroller->mapping.hatasbutton[button].hat );
+
+ if ( value & gamecontroller->mapping.hatasbutton[button].mask )
+ return 1;
+ return 0;
+ }
+
+ return 0;
}
/*
@@ -1013,10 +1013,10 @@ SDL_GameControllerGetButton(SDL_GameController * gamecontroller, SDL_GameControl
SDL_bool
SDL_GameControllerGetAttached( SDL_GameController * gamecontroller )
{
- if ( !gamecontroller )
- return SDL_FALSE;
+ if ( !gamecontroller )
+ return SDL_FALSE;
- return SDL_JoystickGetAttached(gamecontroller->joystick);
+ return SDL_JoystickGetAttached(gamecontroller->joystick);
}
@@ -1026,8 +1026,8 @@ SDL_GameControllerGetAttached( SDL_GameController * gamecontroller )
const char *
SDL_GameControllerName(SDL_GameController * gamecontroller)
{
- if ( !gamecontroller )
- return NULL;
+ if ( !gamecontroller )
+ return NULL;
return (gamecontroller->mapping.name);
}
@@ -1038,10 +1038,10 @@ SDL_GameControllerName(SDL_GameController * gamecontroller)
*/
SDL_Joystick *SDL_GameControllerGetJoystick(SDL_GameController * gamecontroller)
{
- if ( !gamecontroller )
- return NULL;
+ if ( !gamecontroller )
+ return NULL;
- return gamecontroller->joystick;
+ return gamecontroller->joystick;
}
/**
@@ -1049,24 +1049,24 @@ SDL_Joystick *SDL_GameControllerGetJoystick(SDL_GameController * gamecontroller)
*/
SDL_GameControllerButtonBind SDL_GameControllerGetBindForAxis(SDL_GameController * gamecontroller, SDL_GameControllerAxis axis)
{
- SDL_GameControllerButtonBind bind;
- SDL_memset( &bind, 0x0, sizeof(bind) );
-
- if ( !gamecontroller || axis == SDL_CONTROLLER_AXIS_INVALID )
- return bind;
-
- if (gamecontroller->mapping.axes[axis] >= 0 )
- {
- bind.bindType = SDL_CONTROLLER_BINDTYPE_AXIS;
- bind.value.button = gamecontroller->mapping.axes[axis];
- }
- else if (gamecontroller->mapping.buttonasaxis[axis] >= 0 )
- {
- bind.bindType = SDL_CONTROLLER_BINDTYPE_BUTTON;
- bind.value.button = gamecontroller->mapping.buttonasaxis[axis];
- }
-
- return bind;
+ SDL_GameControllerButtonBind bind;
+ SDL_memset( &bind, 0x0, sizeof(bind) );
+
+ if ( !gamecontroller || axis == SDL_CONTROLLER_AXIS_INVALID )
+ return bind;
+
+ if (gamecontroller->mapping.axes[axis] >= 0 )
+ {
+ bind.bindType = SDL_CONTROLLER_BINDTYPE_AXIS;
+ bind.value.button = gamecontroller->mapping.axes[axis];
+ }
+ else if (gamecontroller->mapping.buttonasaxis[axis] >= 0 )
+ {
+ bind.bindType = SDL_CONTROLLER_BINDTYPE_BUTTON;
+ bind.value.button = gamecontroller->mapping.buttonasaxis[axis];
+ }
+
+ return bind;
}
@@ -1075,30 +1075,30 @@ SDL_GameControllerButtonBind SDL_GameControllerGetBindForAxis(SDL_GameController
*/
SDL_GameControllerButtonBind SDL_GameControllerGetBindForButton(SDL_GameController * gamecontroller, SDL_GameControllerButton button)
{
- SDL_GameControllerButtonBind bind;
- SDL_memset( &bind, 0x0, sizeof(bind) );
-
- if ( !gamecontroller || button == SDL_CONTROLLER_BUTTON_INVALID )
- return bind;
-
- if ( gamecontroller->mapping.buttons[button] >= 0 )
- {
- bind.bindType = SDL_CONTROLLER_BINDTYPE_BUTTON;
- bind.value.button = gamecontroller->mapping.buttons[button];
- }
- else if ( gamecontroller->mapping.axesasbutton[button] >= 0 )
- {
- bind.bindType = SDL_CONTROLLER_BINDTYPE_AXIS;
- bind.value.axis = gamecontroller->mapping.axesasbutton[button];
- }
- else if ( gamecontroller->mapping.hatasbutton[button].hat >= 0 )
- {
- bind.bindType = SDL_CONTROLLER_BINDTYPE_HAT;
- bind.value.hat.hat = gamecontroller->mapping.hatasbutton[button].hat;
- bind.value.hat.hat_mask = gamecontroller->mapping.hatasbutton[button].mask;
- }
-
- return bind;
+ SDL_GameControllerButtonBind bind;
+ SDL_memset( &bind, 0x0, sizeof(bind) );
+
+ if ( !gamecontroller || button == SDL_CONTROLLER_BUTTON_INVALID )
+ return bind;
+
+ if ( gamecontroller->mapping.buttons[button] >= 0 )
+ {
+ bind.bindType = SDL_CONTROLLER_BINDTYPE_BUTTON;
+ bind.value.button = gamecontroller->mapping.buttons[button];
+ }
+ else if ( gamecontroller->mapping.axesasbutton[button] >= 0 )
+ {
+ bind.bindType = SDL_CONTROLLER_BINDTYPE_AXIS;
+ bind.value.axis = gamecontroller->mapping.axesasbutton[button];
+ }
+ else if ( gamecontroller->mapping.hatasbutton[button].hat >= 0 )
+ {
+ bind.bindType = SDL_CONTROLLER_BINDTYPE_HAT;
+ bind.value.hat.hat = gamecontroller->mapping.hatasbutton[button].hat;
+ bind.value.hat.hat_mask = gamecontroller->mapping.hatasbutton[button].mask;
+ }
+
+ return bind;
}
@@ -1108,39 +1108,39 @@ SDL_GameControllerButtonBind SDL_GameControllerGetBindForButton(SDL_GameControll
void
SDL_GameControllerClose(SDL_GameController * gamecontroller)
{
- SDL_GameController *gamecontrollerlist, *gamecontrollerlistprev;
+ SDL_GameController *gamecontrollerlist, *gamecontrollerlistprev;
- if ( !gamecontroller )
- return;
+ if ( !gamecontroller )
+ return;
- // First decrement ref count
+ /* First decrement ref count */
if (--gamecontroller->ref_count > 0) {
return;
}
- SDL_JoystickClose( gamecontroller->joystick );
-
- gamecontrollerlist = SDL_gamecontrollers;
- gamecontrollerlistprev = NULL;
- while ( gamecontrollerlist )
- {
- if (gamecontroller == gamecontrollerlist)
- {
- if ( gamecontrollerlistprev )
- {
- // unlink this entry
- gamecontrollerlistprev->next = gamecontrollerlist->next;
- }
- else
- {
- SDL_gamecontrollers = gamecontroller->next;
- }
-
- break;
- }
- gamecontrollerlistprev = gamecontrollerlist;
- gamecontrollerlist = gamecontrollerlist->next;
- }
+ SDL_JoystickClose( gamecontroller->joystick );
+
+ gamecontrollerlist = SDL_gamecontrollers;
+ gamecontrollerlistprev = NULL;
+ while ( gamecontrollerlist )
+ {
+ if (gamecontroller == gamecontrollerlist)
+ {
+ if ( gamecontrollerlistprev )
+ {
+ /* unlink this entry */
+ gamecontrollerlistprev->next = gamecontrollerlist->next;
+ }
+ else
+ {
+ SDL_gamecontrollers = gamecontroller->next;
+ }
+
+ break;
+ }
+ gamecontrollerlistprev = gamecontrollerlist;
+ gamecontrollerlist = gamecontrollerlist->next;
+ }
SDL_free(gamecontroller);
}
@@ -1152,22 +1152,22 @@ SDL_GameControllerClose(SDL_GameController * gamecontroller)
void
SDL_GameControllerQuit(void)
{
- ControllerMapping_t *pControllerMap;
- while ( SDL_gamecontrollers )
- {
- SDL_gamecontrollers->ref_count = 1;
+ ControllerMapping_t *pControllerMap;
+ while ( SDL_gamecontrollers )
+ {
+ SDL_gamecontrollers->ref_count = 1;
SDL_GameControllerClose(SDL_gamecontrollers);
- }
+ }
- while ( s_pSupportedControllers )
- {
- pControllerMap = s_pSupportedControllers;
- s_pSupportedControllers = s_pSupportedControllers->next;
- SDL_free( pControllerMap->name );
- SDL_free( pControllerMap );
- }
+ while ( s_pSupportedControllers )
+ {
+ pControllerMap = s_pSupportedControllers;
+ s_pSupportedControllers = s_pSupportedControllers->next;
+ SDL_free( pControllerMap->name );
+ SDL_free( pControllerMap );
+ }
- SDL_DelEventWatch( SDL_GameControllerEventWatcher, NULL );
+ SDL_DelEventWatch( SDL_GameControllerEventWatcher, NULL );
}
@@ -1177,7 +1177,7 @@ SDL_GameControllerQuit(void)
int
SDL_PrivateGameControllerAxis(SDL_GameController * gamecontroller, SDL_GameControllerAxis axis, Sint16 value)
{
- int posted;
+ int posted;
/* translate the event, if desired */
posted = 0;
@@ -1188,7 +1188,7 @@ SDL_PrivateGameControllerAxis(SDL_GameController * gamecontroller, SDL_GameContr
event.caxis.which = gamecontroller->joystick->instance_id;
event.caxis.axis = axis;
event.caxis.value = value;
- posted = SDL_PushEvent(&event) == 1;
+ posted = SDL_PushEvent(&event) == 1;
}
#endif /* !SDL_EVENTS_DISABLED */
return (posted);
@@ -1203,7 +1203,7 @@ SDL_PrivateGameControllerButton(SDL_GameController * gamecontroller, SDL_GameCon
{
int posted;
#if !SDL_EVENTS_DISABLED
- SDL_Event event;
+ SDL_Event event;
if ( button == SDL_CONTROLLER_BUTTON_INVALID )
return (0);
@@ -1228,7 +1228,7 @@ SDL_PrivateGameControllerButton(SDL_GameController * gamecontroller, SDL_GameCon
event.cbutton.which = gamecontroller->joystick->instance_id;
event.cbutton.button = button;
event.cbutton.state = state;
- posted = SDL_PushEvent(&event) == 1;
+ posted = SDL_PushEvent(&event) == 1;
}
#endif /* !SDL_EVENTS_DISABLED */
return (posted);
@@ -1269,5 +1269,4 @@ SDL_GameControllerEventState(int state)
#endif /* SDL_EVENTS_DISABLED */
}
-
/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/joystick/SDL_joystick.c b/src/joystick/SDL_joystick.c
index 53b465caa4..0e9c3f74c3 100644
--- a/src/joystick/SDL_joystick.c
+++ b/src/joystick/SDL_joystick.c
@@ -78,26 +78,26 @@ SDL_Joystick *
SDL_JoystickOpen(int device_index)
{
SDL_Joystick *joystick;
- SDL_Joystick *joysticklist;
- const char *joystickname = NULL;
+ SDL_Joystick *joysticklist;
+ const char *joystickname = NULL;
if ((device_index < 0) || (device_index >= SDL_NumJoysticks())) {
SDL_SetError("There are %d joysticks available", SDL_NumJoysticks());
return (NULL);
}
- joysticklist = SDL_joysticks;
- /* If the joystick is already open, return it
- * it is important that we have a single joystick * for each instance id
- */
- while ( joysticklist )
- {
- if ( SDL_SYS_GetInstanceIdOfDeviceIndex(device_index) == joysticklist->instance_id ) {
- joystick = joysticklist;
- ++joystick->ref_count;
- return (joystick);
- }
- joysticklist = joysticklist->next;
+ joysticklist = SDL_joysticks;
+ /* If the joystick is already open, return it
+ * it is important that we have a single joystick * for each instance id
+ */
+ while ( joysticklist )
+ {
+ if ( SDL_SYS_GetInstanceIdOfDeviceIndex(device_index) == joysticklist->instance_id ) {
+ joystick = joysticklist;
+ ++joystick->ref_count;
+ return (joystick);
+ }
+ joysticklist = joysticklist->next;
}
/* Create and initialize the joystick */
@@ -113,11 +113,11 @@ SDL_JoystickOpen(int device_index)
return NULL;
}
- joystickname = SDL_SYS_JoystickNameForDeviceIndex( device_index );
- if ( joystickname )
- joystick->name = SDL_strdup( joystickname );
- else
- joystick->name = NULL;
+ joystickname = SDL_SYS_JoystickNameForDeviceIndex( device_index );
+ if ( joystickname )
+ joystick->name = SDL_strdup( joystickname );
+ else
+ joystick->name = NULL;
if (joystick->naxes > 0) {
joystick->axes = (Sint16 *) SDL_malloc
@@ -159,11 +159,11 @@ SDL_JoystickOpen(int device_index)
/* Add joystick to list */
++joystick->ref_count;
- /* Link the joystick in the list */
- joystick->next = SDL_joysticks;
- SDL_joysticks = joystick;
+ /* Link the joystick in the list */
+ joystick->next = SDL_joysticks;
+ SDL_joysticks = joystick;
- SDL_SYS_JoystickUpdate( joystick );
+ SDL_SYS_JoystickUpdate( joystick );
return (joystick);
}
@@ -183,12 +183,12 @@ SDL_PrivateJoystickValid(SDL_Joystick * joystick)
} else {
valid = 1;
}
-
- if ( joystick && joystick->closed )
- {
- valid = 0;
- }
-
+
+ if ( joystick && joystick->closed )
+ {
+ valid = 0;
+ }
+
return valid;
}
@@ -335,24 +335,24 @@ SDL_JoystickGetButton(SDL_Joystick * joystick, int button)
SDL_bool
SDL_JoystickGetAttached(SDL_Joystick * joystick)
{
- if (!SDL_PrivateJoystickValid(joystick)) {
+ if (!SDL_PrivateJoystickValid(joystick)) {
return SDL_FALSE;
}
- return SDL_SYS_JoystickAttached(joystick);
+ return SDL_SYS_JoystickAttached(joystick);
}
/*
* Get the instance id for this opened joystick
*/
-SDL_JoystickID
+SDL_JoystickID
SDL_JoystickInstanceID(SDL_Joystick * joystick)
{
- if (!SDL_PrivateJoystickValid(joystick)) {
+ if (!SDL_PrivateJoystickValid(joystick)) {
return (-1);
}
- return (joystick->instance_id);
+ return (joystick->instance_id);
}
/*
@@ -364,7 +364,7 @@ SDL_JoystickName(SDL_Joystick * joystick)
if (!SDL_PrivateJoystickValid(joystick)) {
return (NULL);
}
-
+
return (joystick->name);
}
@@ -374,8 +374,8 @@ SDL_JoystickName(SDL_Joystick * joystick)
void
SDL_JoystickClose(SDL_Joystick * joystick)
{
- SDL_Joystick *joysticklist;
- SDL_Joystick *joysticklistprev;
+ SDL_Joystick *joysticklist;
+ SDL_Joystick *joysticklistprev;
if (!joystick) {
return;
@@ -391,31 +391,31 @@ SDL_JoystickClose(SDL_Joystick * joystick)
}
SDL_SYS_JoystickClose(joystick);
-
- joysticklist = SDL_joysticks;
- joysticklistprev = NULL;
- while ( joysticklist )
- {
- if (joystick == joysticklist)
- {
- if ( joysticklistprev )
- {
- // unlink this entry
- joysticklistprev->next = joysticklist->next;
- }
- else
- {
- SDL_joysticks = joystick->next;
- }
-
- break;
- }
- joysticklistprev = joysticklist;
- joysticklist = joysticklist->next;
- }
-
- if (joystick->name)
- SDL_free(joystick->name);
+
+ joysticklist = SDL_joysticks;
+ joysticklistprev = NULL;
+ while ( joysticklist )
+ {
+ if (joystick == joysticklist)
+ {
+ if ( joysticklistprev )
+ {
+ /* unlink this entry */
+ joysticklistprev->next = joysticklist->next;
+ }
+ else
+ {
+ SDL_joysticks = joystick->next;
+ }
+
+ break;
+ }
+ joysticklistprev = joysticklist;
+ joysticklist = joysticklist->next;
+ }
+
+ if (joystick->name)
+ SDL_free(joystick->name);
/* Free the data associated with this joystick */
if (joystick->axes) {
@@ -440,11 +440,11 @@ SDL_JoystickQuit(void)
SDL_assert(!SDL_updating_joystick);
/* Stop the event polling */
- while ( SDL_joysticks )
- {
- SDL_joysticks->ref_count = 1;
+ while ( SDL_joysticks )
+ {
+ SDL_joysticks->ref_count = 1;
SDL_JoystickClose(SDL_joysticks);
- }
+ }
/* Quit the joystick setup */
SDL_SYS_JoystickQuit();
@@ -587,25 +587,25 @@ SDL_PrivateJoystickButton(SDL_Joystick * joystick, Uint8 button, Uint8 state)
void
SDL_JoystickUpdate(void)
{
- SDL_Joystick *joystick;
-
- joystick = SDL_joysticks;
- while ( joystick )
- {
- SDL_Joystick *joysticknext;
- /* save off the next pointer, the Update call may cause a joystick removed event
- * and cause our joystick pointer to be freed
- */
- joysticknext = joystick->next;
+ SDL_Joystick *joystick;
+
+ joystick = SDL_joysticks;
+ while ( joystick )
+ {
+ SDL_Joystick *joysticknext;
+ /* save off the next pointer, the Update call may cause a joystick removed event
+ * and cause our joystick pointer to be freed
+ */
+ joysticknext = joystick->next;
SDL_updating_joystick = joystick;
SDL_SYS_JoystickUpdate( joystick );
- if ( joystick->closed && joystick->uncentered )
- {
- int i;
- joystick->uncentered = 0;
+ if ( joystick->closed && joystick->uncentered )
+ {
+ int i;
+ joystick->uncentered = 0;
/* Tell the app that everything is centered/unpressed... */
for (i = 0; i < joystick->naxes; i++)
@@ -617,7 +617,7 @@ SDL_JoystickUpdate(void)
for (i = 0; i < joystick->nhats; i++)
SDL_PrivateJoystickHat(joystick, i, SDL_HAT_CENTERED);
- }
+ }
SDL_updating_joystick = NULL;
@@ -626,12 +626,13 @@ SDL_JoystickUpdate(void)
SDL_JoystickClose(joystick);
}
- joystick = joysticknext;
- }
+ joystick = joysticknext;
+ }
- // this needs to happen AFTER walking the joystick list above, so that any
- // dangling hardware data from removed devices can be free'd
- SDL_SYS_JoystickDetect();
+ /* this needs to happen AFTER walking the joystick list above, so that any
+ dangling hardware data from removed devices can be free'd
+ */
+ SDL_SYS_JoystickDetect();
}
int
@@ -667,106 +668,106 @@ SDL_JoystickEventState(int state)
}
/* return 1 if you want to run the joystick update loop this frame, used by hotplug support */
-SDL_bool
+SDL_bool
SDL_PrivateJoystickNeedsPolling()
{
- if (SDL_joysticks != NULL) {
- return SDL_TRUE;
- } else {
- return SDL_SYS_JoystickNeedsPolling();
- }
+ if (SDL_joysticks != NULL) {
+ return SDL_TRUE;
+ } else {
+ return SDL_SYS_JoystickNeedsPolling();
+ }
}
/* return the guid for this index */
SDL_JoystickGUID SDL_JoystickGetDeviceGUID(int device_index)
{
- return SDL_SYS_JoystickGetDeviceGUID( device_index );
+ return SDL_SYS_JoystickGetDeviceGUID( device_index );
}
/* return the guid for this opened device */
SDL_JoystickGUID SDL_JoystickGetGUID(SDL_Joystick * joystick)
{
- return SDL_SYS_JoystickGetGUID( joystick );
+ return SDL_SYS_JoystickGetGUID( joystick );
}
/* convert the guid to a printable string */
void SDL_JoystickGetGUIDString( SDL_JoystickGUID guid, char *pszGUID, int cbGUID )
{
- static const char k_rgchHexToASCII[] = "0123456789abcdef";
- int i;
+ static const char k_rgchHexToASCII[] = "0123456789abcdef";
+ int i;
if ((pszGUID == NULL) || (cbGUID <= 0)) {
return;
}
- for ( i = 0; i < sizeof(guid.data) && i < (cbGUID-1); i++ )
- {
- // each input byte writes 2 ascii chars, and might write a null byte.
- // If we don't have room for next input byte, stop
- unsigned char c = guid.data[i];
+ for ( i = 0; i < sizeof(guid.data) && i < (cbGUID-1); i++ )
+ {
+ /* each input byte writes 2 ascii chars, and might write a null byte. */
+ /* If we don't have room for next input byte, stop */
+ unsigned char c = guid.data[i];
- *pszGUID++ = k_rgchHexToASCII[ c >> 4 ];
- *pszGUID++ = k_rgchHexToASCII[ c & 0x0F ];
- }
- *pszGUID = '\0';
+ *pszGUID++ = k_rgchHexToASCII[ c >> 4 ];
+ *pszGUID++ = k_rgchHexToASCII[ c & 0x0F ];
+ }
+ *pszGUID = '\0';
}
-//-----------------------------------------------------------------------------
-// Purpose: Returns the 4 bit nibble for a hex character
-// Input : c -
-// Output : unsigned char
-//-----------------------------------------------------------------------------
+/*-----------------------------------------------------------------------------
+ * Purpose: Returns the 4 bit nibble for a hex character
+ * Input : c -
+ * Output : unsigned char
+ *-----------------------------------------------------------------------------*/
static unsigned char nibble( char c )
{
- if ( ( c >= '0' ) &&
- ( c <= '9' ) )
- {
- return (unsigned char)(c - '0');
- }
-
- if ( ( c >= 'A' ) &&
- ( c <= 'F' ) )
- {
- return (unsigned char)(c - 'A' + 0x0a);
- }
-
- if ( ( c >= 'a' ) &&
- ( c <= 'f' ) )
- {
- return (unsigned char)(c - 'a' + 0x0a);
- }
-
- // received an invalid character, and no real way to return an error
- // AssertMsg1( false, "Q_nibble invalid hex character '%c' ", c );
- return 0;
+ if ( ( c >= '0' ) &&
+ ( c <= '9' ) )
+ {
+ return (unsigned char)(c - '0');
+ }
+
+ if ( ( c >= 'A' ) &&
+ ( c <= 'F' ) )
+ {
+ return (unsigned char)(c - 'A' + 0x0a);
+ }
+
+ if ( ( c >= 'a' ) &&
+ ( c <= 'f' ) )
+ {
+ return (unsigned char)(c - 'a' + 0x0a);
+ }
+
+ /* received an invalid character, and no real way to return an error */
+ /* AssertMsg1( false, "Q_nibble invalid hex character '%c' ", c ); */
+ return 0;
}
/* convert the string version of a joystick guid to the struct */
SDL_JoystickGUID SDL_JoystickGetGUIDFromString(const char *pchGUID)
{
- SDL_JoystickGUID guid;
- int maxoutputbytes= sizeof(guid);
- int len = SDL_strlen( pchGUID );
- Uint8 *p;
- int i;
-
- // Make sure it's even
- len = ( len ) & ~0x1;
-
- SDL_memset( &guid, 0x00, sizeof(guid) );
-
- p = (Uint8 *)&guid;
- for ( i = 0;
- ( i < len ) && ( ( p - (Uint8 *)&guid ) < maxoutputbytes );
- i+=2, p++ )
- {
- *p = ( nibble( pchGUID[i] ) << 4 ) | nibble( pchGUID[i+1] );
- }
-
- return guid;
+ SDL_JoystickGUID guid;
+ int maxoutputbytes= sizeof(guid);
+ int len = SDL_strlen( pchGUID );
+ Uint8 *p;
+ int i;
+
+ /* Make sure it's even */
+ len = ( len ) & ~0x1;
+
+ SDL_memset( &guid, 0x00, sizeof(guid) );
+
+ p = (Uint8 *)&guid;
+ for ( i = 0;
+ ( i < len ) && ( ( p - (Uint8 *)&guid ) < maxoutputbytes );
+ i+=2, p++ )
+ {
+ *p = ( nibble( pchGUID[i] ) << 4 ) | nibble( pchGUID[i+1] );
+ }
+
+ return guid;
}
diff --git a/src/joystick/SDL_joystick_c.h b/src/joystick/SDL_joystick_c.h
index 526cc46236..38bc78553c 100644
--- a/src/joystick/SDL_joystick_c.h
+++ b/src/joystick/SDL_joystick_c.h
@@ -41,7 +41,7 @@ extern int SDL_PrivateJoystickHat(SDL_Joystick * joystick,
Uint8 hat, Uint8 value);
extern int SDL_PrivateJoystickButton(SDL_Joystick * joystick,
Uint8 button, Uint8 state);
-
+
/* Helper function to let lower sys layer tell the event system if the joystick code needs to think */
extern SDL_bool SDL_PrivateJoystickNeedsPolling();
diff --git a/src/joystick/android/SDL_sysjoystick.c b/src/joystick/android/SDL_sysjoystick.c
index 2e2d98a02d..adaca528e9 100644
--- a/src/joystick/android/SDL_sysjoystick.c
+++ b/src/joystick/android/SDL_sysjoystick.c
@@ -87,10 +87,10 @@ SDL_SYS_JoystickOpen(SDL_Joystick * joystick, int device_index)
joystick->nballs = 0;
joystick->naxes = 3;
return 0;
- } else {
- SDL_SetError("No joystick available with that index");
- return (-1);
- }
+ } else {
+ SDL_SetError("No joystick available with that index");
+ return (-1);
+ }
}
/* Function to determine is this joystick is attached to the system right now */
@@ -134,7 +134,7 @@ SDL_SYS_JoystickQuit(void)
SDL_JoystickGUID SDL_SYS_JoystickGetDeviceGUID( int device_index )
{
SDL_JoystickGUID guid;
- // the GUID is just the first 16 chars of the name for now
+ /* the GUID is just the first 16 chars of the name for now */
const char *name = SDL_SYS_JoystickNameForDeviceIndex( device_index );
SDL_zero( guid );
SDL_memcpy( &guid, name, SDL_min( sizeof(guid), SDL_strlen( name ) ) );
@@ -144,7 +144,7 @@ SDL_JoystickGUID SDL_SYS_JoystickGetDeviceGUID( int device_index )
SDL_JoystickGUID SDL_SYS_JoystickGetGUID(SDL_Joystick * joystick)
{
SDL_JoystickGUID guid;
- // the GUID is just the first 16 chars of the name for now
+ /* the GUID is just the first 16 chars of the name for now */
const char *name = joystick->name;
SDL_zero( guid );
SDL_memcpy( &guid, name, SDL_min( sizeof(guid), SDL_strlen( name ) ) );
diff --git a/src/joystick/beos/SDL_bejoystick.cc b/src/joystick/beos/SDL_bejoystick.cc
index f8a7f14a01..4e342ed416 100644
--- a/src/joystick/beos/SDL_bejoystick.cc
+++ b/src/joystick/beos/SDL_bejoystick.cc
@@ -261,7 +261,7 @@ extern "C"
SDL_JoystickGUID SDL_SYS_JoystickGetDeviceGUID( int device_index )
{
SDL_JoystickGUID guid;
- // the GUID is just the first 16 chars of the name for now
+ /* the GUID is just the first 16 chars of the name for now */
const char *name = SDL_SYS_JoystickNameForDeviceIndex( device_index );
SDL_zero( guid );
SDL_memcpy( &guid, name, SDL_min( sizeof(guid), SDL_strlen( name ) ) );
@@ -271,7 +271,7 @@ extern "C"
SDL_JoystickGUID SDL_SYS_JoystickGetGUID(SDL_Joystick * joystick)
{
SDL_JoystickGUID guid;
- // the GUID is just the first 16 chars of the name for now
+ /* the GUID is just the first 16 chars of the name for now */
const char *name = joystick->name;
SDL_zero( guid );
SDL_memcpy( &guid, name, SDL_min( sizeof(guid), SDL_strlen( name ) ) );
diff --git a/src/joystick/bsd/SDL_sysjoystick.c b/src/joystick/bsd/SDL_sysjoystick.c
index bbdae328c5..6d35d91b5c 100644
--- a/src/joystick/bsd/SDL_sysjoystick.c
+++ b/src/joystick/bsd/SDL_sysjoystick.c
@@ -76,9 +76,9 @@
#include "../SDL_sysjoystick.h"
#include "../SDL_joystick_c.h"
-#define MAX_UHID_JOYS 16
-#define MAX_JOY_JOYS 2
-#define MAX_JOYS (MAX_UHID_JOYS + MAX_JOY_JOYS)
+#define MAX_UHID_JOYS 16
+#define MAX_JOY_JOYS 2
+#define MAX_JOYS (MAX_UHID_JOYS + MAX_JOY_JOYS)
struct report
@@ -589,7 +589,7 @@ SDL_SYS_JoystickQuit(void)
SDL_JoystickGUID SDL_SYS_JoystickGetDeviceGUID( int device_index )
{
SDL_JoystickGUID guid;
- // the GUID is just the first 16 chars of the name for now
+ /* the GUID is just the first 16 chars of the name for now */
const char *name = SDL_SYS_JoystickNameForDeviceIndex( device_index );
SDL_zero( guid );
SDL_memcpy( &guid, name, SDL_min( sizeof(guid), SDL_strlen( name ) ) );
@@ -599,7 +599,7 @@ SDL_JoystickGUID SDL_SYS_JoystickGetDeviceGUID( int device_index )
SDL_JoystickGUID SDL_SYS_JoystickGetGUID(SDL_Joystick * joystick)
{
SDL_JoystickGUID guid;
- // the GUID is just the first 16 chars of the name for now
+ /* the GUID is just the first 16 chars of the name for now */
const char *name = joystick->name;
SDL_zero( guid );
SDL_memcpy( &guid, name, SDL_min( sizeof(guid), SDL_strlen( name ) ) );
diff --git a/src/joystick/darwin/SDL_sysjoystick.c b/src/joystick/darwin/SDL_sysjoystick.c
index c97f47eb88..97f0e393b7 100644
--- a/src/joystick/darwin/SDL_sysjoystick.c
+++ b/src/joystick/darwin/SDL_sysjoystick.c
@@ -127,7 +127,7 @@ HIDRemovalCallback(void *target, IOReturn result, void *refcon, void *sender)
{
recDevice *device = (recDevice *) refcon;
device->removed = 1;
- s_bDeviceRemoved = SDL_TRUE;
+ s_bDeviceRemoved = SDL_TRUE;
}
@@ -137,10 +137,10 @@ void JoystickDeviceWasRemovedCallback( void * refcon, io_service_t service, natu
{
if( messageType == kIOMessageServiceIsTerminated && refcon )
{
- recDevice *device = (recDevice *) refcon;
- device->removed = 1;
- s_bDeviceRemoved = SDL_TRUE;
- }
+ recDevice *device = (recDevice *) refcon;
+ device->removed = 1;
+ s_bDeviceRemoved = SDL_TRUE;
+ }
}
@@ -186,33 +186,33 @@ HIDCreateOpenDeviceInterface(io_object_t hidDevice, recDevice * pDevice)
HIDReportErrorNum
("Failed to open pDevice->interface via open.", result);
else
- {
- pDevice->portIterator = 0;
+ {
+ pDevice->portIterator = 0;
- // It's okay if this fails, we have another detection method below
+ /* It's okay if this fails, we have another detection method below */
(*(pDevice->interface))->setRemovalCallback(pDevice->interface,
HIDRemovalCallback,
pDevice, pDevice);
-
- /* now connect notification for new devices */
- pDevice->notificationPort = IONotificationPortCreate(kIOMasterPortDefault);
-
- CFRunLoopAddSource(CFRunLoopGetCurrent(),
- IONotificationPortGetRunLoopSource(pDevice->notificationPort),
- kCFRunLoopDefaultMode);
-
- // Register for notifications when a serial port is added to the system
- result = IOServiceAddInterestNotification(pDevice->notificationPort,
- hidDevice,
- kIOGeneralInterest,
- JoystickDeviceWasRemovedCallback,
- pDevice,
- &pDevice->portIterator);
- if (kIOReturnSuccess != result) {
- HIDReportErrorNum
- ("Failed to register for removal callback.", result);
- }
- }
+
+ /* now connect notification for new devices */
+ pDevice->notificationPort = IONotificationPortCreate(kIOMasterPortDefault);
+
+ CFRunLoopAddSource(CFRunLoopGetCurrent(),
+ IONotificationPortGetRunLoopSource(pDevice->notificationPort),
+ kCFRunLoopDefaultMode);
+
+ /* Register for notifications when a serial port is added to the system */
+ result = IOServiceAddInterestNotification(pDevice->notificationPort,
+ hidDevice,
+ kIOGeneralInterest,
+ JoystickDeviceWasRemovedCallback,
+ pDevice,
+ &pDevice->portIterator);
+ if (kIOReturnSuccess != result) {
+ HIDReportErrorNum
+ ("Failed to register for removal callback.", result);
+ }
+ }
}
return result;
@@ -243,12 +243,12 @@ HIDCloseReleaseInterface(recDevice * pDevice)
HIDReportErrorNum("Failed to release IOHIDDeviceInterface.",
result);
pDevice->interface = NULL;
-
- if ( pDevice->portIterator )
- {
- IOObjectRelease( pDevice->portIterator );
- pDevice->portIterator = 0;
- }
+
+ if ( pDevice->portIterator )
+ {
+ IOObjectRelease( pDevice->portIterator );
+ pDevice->portIterator = 0;
+ }
}
return result;
}
@@ -272,32 +272,32 @@ HIDGetElementInfo(CFTypeRef refElement, recElement * pElement)
if (refType && CFNumberGetValue(refType, kCFNumberLongType, &number))
pElement->maxReport = pElement->max = number;
/*
- TODO: maybe should handle the following stuff somehow?
-
- refType = CFDictionaryGetValue (refElement, CFSTR(kIOHIDElementScaledMinKey));
- if (refType && CFNumberGetValue (refType, kCFNumberLongType, &number))
- pElement->scaledMin = number;
- refType = CFDictionaryGetValue (refElement, CFSTR(kIOHIDElementScaledMaxKey));
- if (refType && CFNumberGetValue (refType, kCFNumberLongType, &number))
- pElement->scaledMax = number;
- refType = CFDictionaryGetValue (refElement, CFSTR(kIOHIDElementSizeKey));
- if (refType && CFNumberGetValue (refType, kCFNumberLongType, &number))
- pElement->size = number;
- refType = CFDictionaryGetValue (refElement, CFSTR(kIOHIDElementIsRelativeKey));
- if (refType)
- pElement->relative = CFBooleanGetValue (refType);
- refType = CFDictionaryGetValue (refElement, CFSTR(kIOHIDElementIsWrappingKey));
- if (refType)
- pElement->wrapping = CFBooleanGetValue (refType);
- refType = CFDictionaryGetValue (refElement, CFSTR(kIOHIDElementIsNonLinearKey));
- if (refType)
- pElement->nonLinear = CFBooleanGetValue (refType);
- refType = CFDictionaryGetValue (refElement, CFSTR(kIOHIDElementHasPreferedStateKey));
- if (refType)
- pElement->preferredState = CFBooleanGetValue (refType);
- refType = CFDictionaryGetValue (refElement, CFSTR(kIOHIDElementHasNullStateKey));
- if (refType)
- pElement->nullState = CFBooleanGetValue (refType);
+ TODO: maybe should handle the following stuff somehow?
+
+ refType = CFDictionaryGetValue (refElement, CFSTR(kIOHIDElementScaledMinKey));
+ if (refType && CFNumberGetValue (refType, kCFNumberLongType, &number))
+ pElement->scaledMin = number;
+ refType = CFDictionaryGetValue (refElement, CFSTR(kIOHIDElementScaledMaxKey));
+ if (refType && CFNumberGetValue (refType, kCFNumberLongType, &number))
+ pElement->scaledMax = number;
+ refType = CFDictionaryGetValue (refElement, CFSTR(kIOHIDElementSizeKey));
+ if (refType && CFNumberGetValue (refType, kCFNumberLongType, &number))
+ pElement->size = number;
+ refType = CFDictionaryGetValue (refElement, CFSTR(kIOHIDElementIsRelativeKey));
+ if (refType)
+ pElement->relative = CFBooleanGetValue (refType);
+ refType = CFDictionaryGetValue (refElement, CFSTR(kIOHIDElementIsWrappingKey));
+ if (refType)
+ pElement->wrapping = CFBooleanGetValue (refType);
+ refType = CFDictionaryGetValue (refElement, CFSTR(kIOHIDElementIsNonLinearKey));
+ if (refType)
+ pElement->nonLinear = CFBooleanGetValue (refType);
+ refType = CFDictionaryGetValue (refElement, CFSTR(kIOHIDElementHasPreferedStateKey));
+ if (refType)
+ pElement->preferredState = CFBooleanGetValue (refType);
+ refType = CFDictionaryGetValue (refElement, CFSTR(kIOHIDElementHasNullStateKey));
+ if (refType)
+ pElement->nullState = CFBooleanGetValue (refType);
*/
}
@@ -501,14 +501,14 @@ HIDGetDeviceInfo(io_object_t hidDevice, CFMutableDictionaryRef hidProperties,
}
}
- refCF = CFDictionaryGetValue(hidProperties, CFSTR(kIOHIDVendorIDKey));
+ refCF = CFDictionaryGetValue(hidProperties, CFSTR(kIOHIDVendorIDKey));
if (refCF) {
if (!CFNumberGetValue(refCF, kCFNumberLongType, &pDevice->guid.data[0])) {
SDL_SetError("CFNumberGetValue error retrieving pDevice->guid[0]");
}
}
- refCF = CFDictionaryGetValue(hidProperties, CFSTR(kIOHIDProductIDKey));
+ refCF = CFDictionaryGetValue(hidProperties, CFSTR(kIOHIDProductIDKey));
if (refCF) {
if (!CFNumberGetValue(refCF, kCFNumberLongType, &pDevice->guid.data[8])) {
SDL_SetError("CFNumberGetValue error retrieving pDevice->guid[8]");
@@ -573,7 +573,7 @@ HIDBuildDevice(io_object_t hidDevice)
if (kIOReturnSuccess == result) {
HIDGetDeviceInfo(hidDevice, hidProperties, pDevice); /* hidDevice used to find parents in registry tree */
HIDGetCollectionElements(hidProperties, pDevice);
- pDevice->instance_id = ++s_joystick_instance_id;
+ pDevice->instance_id = ++s_joystick_instance_id;
} else {
DisposePtr((Ptr) pDevice);
pDevice = NULL;
@@ -640,57 +640,57 @@ HIDDisposeDevice(recDevice ** ppDevice)
/* Given an io_object_t from OSX adds a joystick device to our list if appropriate
*/
-int
+int
AddDeviceHelper( io_object_t ioHIDDeviceObject )
{
recDevice *device;
-
- /* build a device record */
- device = HIDBuildDevice(ioHIDDeviceObject);
- if (!device)
- return 0;
-
- /* Filter device list to non-keyboard/mouse stuff */
- if ((device->usagePage != kHIDPage_GenericDesktop) ||
- ((device->usage != kHIDUsage_GD_Joystick &&
- device->usage != kHIDUsage_GD_GamePad &&
- device->usage != kHIDUsage_GD_MultiAxisController))) {
-
- /* release memory for the device */
- HIDDisposeDevice(&device);
- DisposePtr((Ptr) device);
- return 0;
- }
-
- /* We have to do some storage of the io_service_t for
- * SDL_HapticOpenFromJoystick */
- if (FFIsForceFeedback(ioHIDDeviceObject) == FF_OK) {
- device->ffservice = ioHIDDeviceObject;
- } else {
- device->ffservice = 0;
- }
-
- device->send_open_event = 1;
- s_bDeviceAdded = SDL_TRUE;
-
- /* Add device to the end of the list */
- if ( !gpDeviceList )
- {
- gpDeviceList = device;
- }
- else
- {
- recDevice *curdevice;
-
- curdevice = gpDeviceList;
- while ( curdevice->pNext )
- {
- curdevice = curdevice->pNext;
- }
- curdevice->pNext = device;
- }
-
- return 1;
+
+ /* build a device record */
+ device = HIDBuildDevice(ioHIDDeviceObject);
+ if (!device)
+ return 0;
+
+ /* Filter device list to non-keyboard/mouse stuff */
+ if ((device->usagePage != kHIDPage_GenericDesktop) ||
+ ((device->usage != kHIDUsage_GD_Joystick &&
+ device->usage != kHIDUsage_GD_GamePad &&
+ device->usage != kHIDUsage_GD_MultiAxisController))) {
+
+ /* release memory for the device */
+ HIDDisposeDevice(&device);
+ DisposePtr((Ptr) device);
+ return 0;
+ }
+
+ /* We have to do some storage of the io_service_t for
+ * SDL_HapticOpenFromJoystick */
+ if (FFIsForceFeedback(ioHIDDeviceObject) == FF_OK) {
+ device->ffservice = ioHIDDeviceObject;
+ } else {
+ device->ffservice = 0;
+ }
+
+ device->send_open_event = 1;
+ s_bDeviceAdded = SDL_TRUE;
+
+ /* Add device to the end of the list */
+ if ( !gpDeviceList )
+ {
+ gpDeviceList = device;
+ }
+ else
+ {
+ recDevice *curdevice;
+
+ curdevice = gpDeviceList;
+ while ( curdevice->pNext )
+ {
+ curdevice = curdevice->pNext;
+ }
+ curdevice->pNext = device;
+ }
+
+ return 1;
}
@@ -700,16 +700,16 @@ AddDeviceHelper( io_object_t ioHIDDeviceObject )
void JoystickDeviceWasAddedCallback( void *refcon, io_iterator_t iterator )
{
io_object_t ioHIDDeviceObject = 0;
-
- while ( ( ioHIDDeviceObject = IOIteratorNext(iterator) ) )
- {
- if ( ioHIDDeviceObject )
- {
- AddDeviceHelper( ioHIDDeviceObject );
- }
- }
+
+ while ( ( ioHIDDeviceObject = IOIteratorNext(iterator) ) )
+ {
+ if ( ioHIDDeviceObject )
+ {
+ AddDeviceHelper( ioHIDDeviceObject );
+ }
+ }
}
-
+
/* Function to scan the system for joysticks.
* Joystick 0 should be the system default joystick.
@@ -724,7 +724,7 @@ SDL_SYS_JoystickInit(void)
io_iterator_t hidObjectIterator = 0;
CFMutableDictionaryRef hidMatchDictionary = NULL;
io_object_t ioHIDDeviceObject = 0;
- io_iterator_t portIterator = 0;
+ io_iterator_t portIterator = 0;
if (gpDeviceList) {
return SDL_SetError("Joystick: Device list already inited.");
@@ -774,26 +774,26 @@ SDL_SYS_JoystickInit(void)
gpDeviceList = NULL;
while ((ioHIDDeviceObject = IOIteratorNext(hidObjectIterator))) {
- AddDeviceHelper( ioHIDDeviceObject );
+ AddDeviceHelper( ioHIDDeviceObject );
}
result = IOObjectRelease(hidObjectIterator); /* release the iterator */
-
- /* now connect notification for new devices */
- notificationPort = IONotificationPortCreate(masterPort);
- hidMatchDictionary = IOServiceMatching(kIOHIDDeviceKey);
-
- CFRunLoopAddSource(CFRunLoopGetCurrent(),
- IONotificationPortGetRunLoopSource(notificationPort),
- kCFRunLoopDefaultMode);
-
- // Register for notifications when a serial port is added to the system
- result = IOServiceAddMatchingNotification(notificationPort,
- kIOFirstMatchNotification,
- hidMatchDictionary,
- JoystickDeviceWasAddedCallback,
- NULL,
- &portIterator);
- while (IOIteratorNext(portIterator)) {}; // Run out the iterator or notifications won't start (you can also use it to iterate the available devices).
+
+ /* now connect notification for new devices */
+ notificationPort = IONotificationPortCreate(masterPort);
+ hidMatchDictionary = IOServiceMatching(kIOHIDDeviceKey);
+
+ CFRunLoopAddSource(CFRunLoopGetCurrent(),
+ IONotificationPortGetRunLoopSource(notificationPort),
+ kCFRunLoopDefaultMode);
+
+ /* Register for notifications when a serial port is added to the system */
+ result = IOServiceAddMatchingNotification(notificationPort,
+ kIOFirstMatchNotification,
+ hidMatchDictionary,
+ JoystickDeviceWasAddedCallback,
+ NULL,
+ &portIterator);
+ while (IOIteratorNext(portIterator)) {}; /* Run out the iterator or notifications won't start (you can also use it to iterate the available devices). */
return SDL_SYS_NumJoysticks();
}
@@ -802,17 +802,17 @@ SDL_SYS_JoystickInit(void)
int
SDL_SYS_NumJoysticks()
{
- recDevice *device = gpDeviceList;
+ recDevice *device = gpDeviceList;
int nJoySticks = 0;
-
- while ( device )
- {
- if ( !device->removed )
- nJoySticks++;
+
+ while ( device )
+ {
+ if ( !device->removed )
+ nJoySticks++;
device = device->pNext;
- }
+ }
- return nJoySticks;
+ return nJoySticks;
}
/* Function to cause any queued joystick insertions to be processed
@@ -820,81 +820,81 @@ SDL_SYS_NumJoysticks()
void
SDL_SYS_JoystickDetect()
{
- if ( s_bDeviceAdded || s_bDeviceRemoved )
- {
- recDevice *device = gpDeviceList;
- s_bDeviceAdded = SDL_FALSE;
- s_bDeviceRemoved = SDL_FALSE;
- int device_index = 0;
- // send notifications
- while ( device )
- {
- if ( device->send_open_event )
- {
- device->send_open_event = 0;
+ if ( s_bDeviceAdded || s_bDeviceRemoved )
+ {
+ recDevice *device = gpDeviceList;
+ s_bDeviceAdded = SDL_FALSE;
+ s_bDeviceRemoved = SDL_FALSE;
+ int device_index = 0;
+ /* send notifications */
+ while ( device )
+ {
+ if ( device->send_open_event )
+ {
+ device->send_open_event = 0;
#if !SDL_EVENTS_DISABLED
- SDL_Event event;
- event.type = SDL_JOYDEVICEADDED;
-
- if (SDL_GetEventState(event.type) == SDL_ENABLE) {
- event.jdevice.which = device_index;
- if ((SDL_EventOK == NULL)
- || (*SDL_EventOK) (SDL_EventOKParam, &event)) {
- SDL_PushEvent(&event);
- }
- }
+ SDL_Event event;
+ event.type = SDL_JOYDEVICEADDED;
+
+ if (SDL_GetEventState(event.type) == SDL_ENABLE) {
+ event.jdevice.which = device_index;
+ if ((SDL_EventOK == NULL)
+ || (*SDL_EventOK) (SDL_EventOKParam, &event)) {
+ SDL_PushEvent(&event);
+ }
+ }
#endif /* !SDL_EVENTS_DISABLED */
-
- }
-
- if ( device->removed )
- {
- recDevice *removeDevice = device;
- if ( gpDeviceList == removeDevice )
- {
- device = device->pNext;
- gpDeviceList = device;
- }
- else
- {
- device = gpDeviceList;
- while ( device->pNext != removeDevice )
- {
- device = device->pNext;
- }
-
- device->pNext = removeDevice->pNext;
- }
-
+
+ }
+
+ if ( device->removed )
+ {
+ recDevice *removeDevice = device;
+ if ( gpDeviceList == removeDevice )
+ {
+ device = device->pNext;
+ gpDeviceList = device;
+ }
+ else
+ {
+ device = gpDeviceList;
+ while ( device->pNext != removeDevice )
+ {
+ device = device->pNext;
+ }
+
+ device->pNext = removeDevice->pNext;
+ }
+
#if !SDL_EVENTS_DISABLED
- SDL_Event event;
- event.type = SDL_JOYDEVICEREMOVED;
-
- if (SDL_GetEventState(event.type) == SDL_ENABLE) {
- event.jdevice.which = removeDevice->instance_id;
- if ((SDL_EventOK == NULL)
- || (*SDL_EventOK) (SDL_EventOKParam, &event)) {
- SDL_PushEvent(&event);
- }
- }
-
- DisposePtr((Ptr) removeDevice);
-#endif /* !SDL_EVENTS_DISABLED */
-
- }
- else
- {
- device = device->pNext;
- device_index++;
- }
- }
- }
+ SDL_Event event;
+ event.type = SDL_JOYDEVICEREMOVED;
+
+ if (SDL_GetEventState(event.type) == SDL_ENABLE) {
+ event.jdevice.which = removeDevice->instance_id;
+ if ((SDL_EventOK == NULL)
+ || (*SDL_EventOK) (SDL_EventOKParam, &event)) {
+ SDL_PushEvent(&event);
+ }
+ }
+
+ DisposePtr((Ptr) removeDevice);
+#endif /* !SDL_EVENTS_DISABLED */
+
+ }
+ else
+ {
+ device = device->pNext;
+ device_index++;
+ }
+ }
+ }
}
SDL_bool
SDL_SYS_JoystickNeedsPolling()
{
- return s_bDeviceAdded || s_bDeviceRemoved;
+ return s_bDeviceAdded || s_bDeviceRemoved;
}
/* Function to get the device-dependent name of a joystick */
@@ -906,7 +906,7 @@ SDL_SYS_JoystickNameForDeviceIndex(int device_index)
for (; device_index > 0; device_index--)
device = device->pNext;
- return device->product;
+ return device->product;
}
/* Function to return the instance id of the joystick at device_index
@@ -916,11 +916,11 @@ SDL_SYS_GetInstanceIdOfDeviceIndex(int device_index)
{
recDevice *device = gpDeviceList;
int index;
-
+
for (index = device_index; index > 0; index--)
device = device->pNext;
- return device->instance_id;
+ return device->instance_id;
}
/* Function to open a joystick for use.
@@ -937,14 +937,14 @@ SDL_SYS_JoystickOpen(SDL_Joystick * joystick, int device_index)
for (index = device_index; index > 0; index--)
device = device->pNext;
- joystick->instance_id = device->instance_id;
+ joystick->instance_id = device->instance_id;
joystick->hwdata = device;
- joystick->name = device->product;
+ joystick->name = device->product;
- joystick->naxes = device->axes;
- joystick->nhats = device->hats;
- joystick->nballs = 0;
- joystick->nbuttons = device->buttons;
+ joystick->naxes = device->axes;
+ joystick->nhats = device->hats;
+ joystick->nballs = 0;
+ joystick->nbuttons = device->buttons;
return 0;
}
@@ -954,17 +954,17 @@ SDL_SYS_JoystickOpen(SDL_Joystick * joystick, int device_index)
SDL_bool
SDL_SYS_JoystickAttached(SDL_Joystick * joystick)
{
- recDevice *device = gpDeviceList;
-
- while ( device )
- {
- if ( joystick->instance_id == device->instance_id )
- return SDL_TRUE;
+ recDevice *device = gpDeviceList;
+
+ while ( device )
+ {
+ if ( joystick->instance_id == device->instance_id )
+ return SDL_TRUE;
device = device->pNext;
- }
-
- return SDL_FALSE;
+ }
+
+ return SDL_FALSE;
}
/* Function to update the state of a joystick - called as a device poll.
@@ -975,49 +975,49 @@ SDL_SYS_JoystickAttached(SDL_Joystick * joystick)
void
SDL_SYS_JoystickUpdate(SDL_Joystick * joystick)
{
- recDevice *device = joystick->hwdata;
+ recDevice *device = joystick->hwdata;
recElement *element;
SInt32 value, range;
int i;
- if ( !device )
- return;
+ if ( !device )
+ return;
if (device->removed) { /* device was unplugged; ignore it. */
- recDevice *devicelist = gpDeviceList;
- joystick->closed = 1;
- joystick->uncentered = 1;
-
- if ( devicelist == device )
- {
- gpDeviceList = device->pNext;
- }
- else
- {
- while ( devicelist->pNext != device )
- {
- devicelist = devicelist->pNext;
- }
-
- devicelist->pNext = device->pNext;
- }
-
- DisposePtr((Ptr) device);
- joystick->hwdata = NULL;
+ recDevice *devicelist = gpDeviceList;
+ joystick->closed = 1;
+ joystick->uncentered = 1;
+
+ if ( devicelist == device )
+ {
+ gpDeviceList = device->pNext;
+ }
+ else
+ {
+ while ( devicelist->pNext != device )
+ {
+ devicelist = devicelist->pNext;
+ }
+
+ devicelist->pNext = device->pNext;
+ }
+
+ DisposePtr((Ptr) device);
+ joystick->hwdata = NULL;
#if !SDL_EVENTS_DISABLED
- SDL_Event event;
- event.type = SDL_JOYDEVICEREMOVED;
-
- if (SDL_GetEventState(event.type) == SDL_ENABLE) {
- event.jdevice.which = joystick->instance_id;
- if ((SDL_EventOK == NULL)
- || (*SDL_EventOK) (SDL_EventOKParam, &event)) {
- SDL_PushEvent(&event);
- }
- }
+ SDL_Event event;
+ event.type = SDL_JOYDEVICEREMOVED;
+
+ if (SDL_GetEventState(event.type) == SDL_ENABLE) {
+ event.jdevice.which = joystick->instance_id;
+ if ((SDL_EventOK == NULL)
+ || (*SDL_EventOK) (SDL_EventOKParam, &event)) {
+ SDL_PushEvent(&event);
+ }
+ }
#endif /* !SDL_EVENTS_DISABLED */
-
+
return;
}
@@ -1099,8 +1099,8 @@ SDL_SYS_JoystickUpdate(SDL_Joystick * joystick)
/* Function to close a joystick after use */
void
SDL_SYS_JoystickClose(SDL_Joystick * joystick)
-{
- joystick->closed = 1;
+{
+ joystick->closed = 1;
}
/* Function to perform any system-specific joystick related cleanup */
@@ -1109,12 +1109,12 @@ SDL_SYS_JoystickQuit(void)
{
while (NULL != gpDeviceList)
gpDeviceList = HIDDisposeDevice(&gpDeviceList);
-
- if ( notificationPort )
- {
- IONotificationPortDestroy( notificationPort );
- notificationPort = 0;
- }
+
+ if ( notificationPort )
+ {
+ IONotificationPortDestroy( notificationPort );
+ notificationPort = 0;
+ }
}
@@ -1122,16 +1122,16 @@ SDL_JoystickGUID SDL_SYS_JoystickGetDeviceGUID( int device_index )
{
recDevice *device = gpDeviceList;
int index;
-
+
for (index = device_index; index > 0; index--)
device = device->pNext;
-
- return device->guid;
+
+ return device->guid;
}
SDL_JoystickGUID SDL_SYS_JoystickGetGUID(SDL_Joystick *joystick)
{
- return joystick->hwdata->guid;
+ return joystick->hwdata->guid;
}
#endif /* SDL_JOYSTICK_IOKIT */
diff --git a/src/joystick/darwin/SDL_sysjoystick_c.h b/src/joystick/darwin/SDL_sysjoystick_c.h
index 21cf7e9114..f99dbd8af8 100644
--- a/src/joystick/darwin/SDL_sysjoystick_c.h
+++ b/src/joystick/darwin/SDL_sysjoystick_c.h
@@ -59,9 +59,9 @@ struct joystick_hwdata
{
io_service_t ffservice; /* Interface for force feedback, 0 = no ff */
IOHIDDeviceInterface **interface; /* interface to device, NULL = no interface */
- IONotificationPortRef notificationPort; /* port to be notified on joystick removal */
- io_iterator_t portIterator; /* iterator for removal callback */
-
+ IONotificationPortRef notificationPort; /* port to be notified on joystick removal */
+ io_iterator_t portIterator; /* iterator for removal callback */
+
char product[256]; /* name of product */
long usage; /* usage page from IOUSBHID Parser.h which defines general usage */
long usagePage; /* usage within above page from IOUSBHID Parser.h which defines specific usage */
@@ -77,10 +77,10 @@ struct joystick_hwdata
int removed;
int uncentered;
-
- int instance_id;
- SDL_JoystickGUID guid;
- Uint8 send_open_event; /* 1 if we need to send an Added event for this device */
+
+ int instance_id;
+ SDL_JoystickGUID guid;
+ Uint8 send_open_event; /* 1 if we need to send an Added event for this device */
struct joystick_hwdata *pNext; /* next device */
};
diff --git a/src/joystick/dummy/SDL_sysjoystick.c b/src/joystick/dummy/SDL_sysjoystick.c
index 2f03e39c37..7dd9153b25 100644
--- a/src/joystick/dummy/SDL_sysjoystick.c
+++ b/src/joystick/dummy/SDL_sysjoystick.c
@@ -110,7 +110,7 @@ SDL_SYS_JoystickQuit(void)
SDL_JoystickGUID SDL_SYS_JoystickGetDeviceGUID( int device_index )
{
SDL_JoystickGUID guid;
- // the GUID is just the first 16 chars of the name for now
+ /* the GUID is just the first 16 chars of the name for now */
const char *name = SDL_SYS_JoystickNameForDeviceIndex( device_index );
SDL_zero( guid );
SDL_memcpy( &guid, name, SDL_min( sizeof(guid), SDL_strlen( name ) ) );
@@ -121,7 +121,7 @@ SDL_JoystickGUID SDL_SYS_JoystickGetDeviceGUID( int device_index )
SDL_JoystickGUID SDL_SYS_JoystickGetGUID(SDL_Joystick * joystick)
{
SDL_JoystickGUID guid;
- // the GUID is just the first 16 chars of the name for now
+ /* the GUID is just the first 16 chars of the name for now */
const char *name = joystick->name;
SDL_zero( guid );
SDL_memcpy( &guid, name, SDL_min( sizeof(guid), SDL_strlen( name ) ) );
diff --git a/src/joystick/iphoneos/SDLUIAccelerationDelegate.m b/src/joystick/iphoneos/SDLUIAccelerationDelegate.m
index 9865d364a3..0037c585b0 100644
--- a/src/joystick/iphoneos/SDLUIAccelerationDelegate.m
+++ b/src/joystick/iphoneos/SDLUIAccelerationDelegate.m
@@ -28,114 +28,114 @@ static SDLUIAccelerationDelegate *sharedDelegate=nil;
@implementation SDLUIAccelerationDelegate
/*
- Returns a shared instance of the SDLUIAccelerationDelegate, creating the shared delegate if it doesn't exist yet.
+ Returns a shared instance of the SDLUIAccelerationDelegate, creating the shared delegate if it doesn't exist yet.
*/
+(SDLUIAccelerationDelegate *)sharedDelegate {
- if (sharedDelegate == nil) {
- sharedDelegate = [[SDLUIAccelerationDelegate alloc] init];
- }
- return sharedDelegate;
+ if (sharedDelegate == nil) {
+ sharedDelegate = [[SDLUIAccelerationDelegate alloc] init];
+ }
+ return sharedDelegate;
}
/*
- UIAccelerometerDelegate delegate method. Invoked by the UIAccelerometer instance when it has new data for us.
- We just take the data and mark that we have new data available so that the joystick system will pump it to the
- events system when SDL_SYS_JoystickUpdate is called.
-*/
+ UIAccelerometerDelegate delegate method. Invoked by the UIAccelerometer instance when it has new data for us.
+ We just take the data and mark that we have new data available so that the joystick system will pump it to the
+ events system when SDL_SYS_JoystickUpdate is called.
+*/
-(void)accelerometer:(UIAccelerometer *)accelerometer didAccelerate:(UIAcceleration *)acceleration {
-
- x = acceleration.x;
- y = acceleration.y;
- z = acceleration.z;
-
- hasNewData = YES;
+
+ x = acceleration.x;
+ y = acceleration.y;
+ z = acceleration.z;
+
+ hasNewData = YES;
}
-/*
- getLastOrientation -- put last obtained accelerometer data into Sint16 array
-
- Called from the joystick system when it needs the accelerometer data.
- Function grabs the last data sent to the accelerometer and converts it
- from floating point to Sint16, which is what the joystick system expects.
-
- To do the conversion, the data is first clamped onto the interval
- [-SDL_IPHONE_MAX_G_FORCE, SDL_IPHONE_MAX_G_FORCE], then the data is multiplied
- by MAX_SINT16 so that it is mapped to the full range of an Sint16.
-
- You can customize the clamped range of this function by modifying the
- SDL_IPHONE_MAX_GFORCE macro in SDL_config_iphoneos.h.
-
- Once converted to Sint16, the accelerometer data no longer has coherent units.
- You can convert the data back to units of g-force by multiplying it
- in your application's code by SDL_IPHONE_MAX_GFORCE / 0x7FFF.
+/*
+ getLastOrientation -- put last obtained accelerometer data into Sint16 array
+
+ Called from the joystick system when it needs the accelerometer data.
+ Function grabs the last data sent to the accelerometer and converts it
+ from floating point to Sint16, which is what the joystick system expects.
+
+ To do the conversion, the data is first clamped onto the interval
+ [-SDL_IPHONE_MAX_G_FORCE, SDL_IPHONE_MAX_G_FORCE], then the data is multiplied
+ by MAX_SINT16 so that it is mapped to the full range of an Sint16.
+
+ You can customize the clamped range of this function by modifying the
+ SDL_IPHONE_MAX_GFORCE macro in SDL_config_iphoneos.h.
+
+ Once converted to Sint16, the accelerometer data no longer has coherent units.
+ You can convert the data back to units of g-force by multiplying it
+ in your application's code by SDL_IPHONE_MAX_GFORCE / 0x7FFF.
*/
-(void)getLastOrientation:(Sint16 *)data {
- #define MAX_SINT16 0x7FFF
-
- /* clamp the data */
- if (x > SDL_IPHONE_MAX_GFORCE) x = SDL_IPHONE_MAX_GFORCE;
- else if (x < -SDL_IPHONE_MAX_GFORCE) x = -SDL_IPHONE_MAX_GFORCE;
- if (y > SDL_IPHONE_MAX_GFORCE) y = SDL_IPHONE_MAX_GFORCE;
- else if (y < -SDL_IPHONE_MAX_GFORCE) y = -SDL_IPHONE_MAX_GFORCE;
- if (z > SDL_IPHONE_MAX_GFORCE) z = SDL_IPHONE_MAX_GFORCE;
- else if (z < -SDL_IPHONE_MAX_GFORCE) z = -SDL_IPHONE_MAX_GFORCE;
-
- /* pass in data mapped to range of SInt16 */
- data[0] = (x / SDL_IPHONE_MAX_GFORCE) * MAX_SINT16;
- data[1] = (y / SDL_IPHONE_MAX_GFORCE) * MAX_SINT16;
- data[2] = (z / SDL_IPHONE_MAX_GFORCE) * MAX_SINT16;
+ #define MAX_SINT16 0x7FFF
+
+ /* clamp the data */
+ if (x > SDL_IPHONE_MAX_GFORCE) x = SDL_IPHONE_MAX_GFORCE;
+ else if (x < -SDL_IPHONE_MAX_GFORCE) x = -SDL_IPHONE_MAX_GFORCE;
+ if (y > SDL_IPHONE_MAX_GFORCE) y = SDL_IPHONE_MAX_GFORCE;
+ else if (y < -SDL_IPHONE_MAX_GFORCE) y = -SDL_IPHONE_MAX_GFORCE;
+ if (z > SDL_IPHONE_MAX_GFORCE) z = SDL_IPHONE_MAX_GFORCE;
+ else if (z < -SDL_IPHONE_MAX_GFORCE) z = -SDL_IPHONE_MAX_GFORCE;
+
+ /* pass in data mapped to range of SInt16 */
+ data[0] = (x / SDL_IPHONE_MAX_GFORCE) * MAX_SINT16;
+ data[1] = (y / SDL_IPHONE_MAX_GFORCE) * MAX_SINT16;
+ data[2] = (z / SDL_IPHONE_MAX_GFORCE) * MAX_SINT16;
}
/*
- Initialize SDLUIAccelerationDelegate. Since we don't have any data yet,
- just set our last received data to zero, and indicate we don't have any;
+ Initialize SDLUIAccelerationDelegate. Since we don't have any data yet,
+ just set our last received data to zero, and indicate we don't have any;
*/
-(id)init {
- self = [super init];
- x = y = z = 0.0;
- hasNewData = NO;
- return self;
+ self = [super init];
+ x = y = z = 0.0;
+ hasNewData = NO;
+ return self;
}
-(void)dealloc {
- sharedDelegate = nil;
- [self shutdown];
- [super dealloc];
+ sharedDelegate = nil;
+ [self shutdown];
+ [super dealloc];
}
/*
- Lets our delegate start receiving accelerometer updates.
+ Lets our delegate start receiving accelerometer updates.
*/
-(void)startup {
- [UIAccelerometer sharedAccelerometer].delegate = self;
- isRunning = YES;
+ [UIAccelerometer sharedAccelerometer].delegate = self;
+ isRunning = YES;
}
/*
- Stops our delegate from receiving accelerometer updates.
+ Stops our delegate from receiving accelerometer updates.
*/
-(void)shutdown {
- if ([UIAccelerometer sharedAccelerometer].delegate == self) {
- [UIAccelerometer sharedAccelerometer].delegate = nil;
- }
- isRunning = NO;
+ if ([UIAccelerometer sharedAccelerometer].delegate == self) {
+ [UIAccelerometer sharedAccelerometer].delegate = nil;
+ }
+ isRunning = NO;
}
/*
- Our we currently receiving accelerometer updates?
+ Our we currently receiving accelerometer updates?
*/
-(BOOL)isRunning {
- return isRunning;
+ return isRunning;
}
/*
- Do we have any data that hasn't been pumped into SDL's event system?
+ Do we have any data that hasn't been pumped into SDL's event system?
*/
-(BOOL)hasNewData {
- return hasNewData;
+ return hasNewData;
}
/*
- When the joystick system grabs the new data, it sets this to NO.
+ When the joystick system grabs the new data, it sets this to NO.
*/
-(void)setHasNewData:(BOOL)value {
- hasNewData = value;
+ hasNewData = value;
}
@end
diff --git a/src/joystick/iphoneos/SDL_sysjoystick.m b/src/joystick/iphoneos/SDL_sysjoystick.m
index e930025765..231c851cf7 100644
--- a/src/joystick/iphoneos/SDL_sysjoystick.m
+++ b/src/joystick/iphoneos/SDL_sysjoystick.m
@@ -97,20 +97,20 @@ SDL_bool SDL_SYS_JoystickAttached(SDL_Joystick *joystick)
void
SDL_SYS_JoystickUpdate(SDL_Joystick * joystick)
{
-
- Sint16 orientation[3];
-
- if ([[SDLUIAccelerationDelegate sharedDelegate] hasNewData]) {
-
- [[SDLUIAccelerationDelegate sharedDelegate] getLastOrientation: orientation];
- [[SDLUIAccelerationDelegate sharedDelegate] setHasNewData: NO];
-
- SDL_PrivateJoystickAxis(joystick, 0, orientation[0]);
- SDL_PrivateJoystickAxis(joystick, 1, orientation[1]);
- SDL_PrivateJoystickAxis(joystick, 2, orientation[2]);
-
- }
-
+
+ Sint16 orientation[3];
+
+ if ([[SDLUIAccelerationDelegate sharedDelegate] hasNewData]) {
+
+ [[SDLUIAccelerationDelegate sharedDelegate] getLastOrientation: orientation];
+ [[SDLUIAccelerationDelegate sharedDelegate] setHasNewData: NO];
+
+ SDL_PrivateJoystickAxis(joystick, 0, orientation[0]);
+ SDL_PrivateJoystickAxis(joystick, 1, orientation[1]);
+ SDL_PrivateJoystickAxis(joystick, 2, orientation[2]);
+
+ }
+
return;
}
@@ -118,10 +118,10 @@ SDL_SYS_JoystickUpdate(SDL_Joystick * joystick)
void
SDL_SYS_JoystickClose(SDL_Joystick * joystick)
{
- if ([[SDLUIAccelerationDelegate sharedDelegate] isRunning]) {
- [[SDLUIAccelerationDelegate sharedDelegate] shutdown];
- }
- SDL_SetError("No joystick open with that index");
+ if ([[SDLUIAccelerationDelegate sharedDelegate] isRunning]) {
+ [[SDLUIAccelerationDelegate sharedDelegate] shutdown];
+ }
+ SDL_SetError("No joystick open with that index");
}
/* Function to perform any system-specific joystick related cleanup */
@@ -133,7 +133,7 @@ SDL_SYS_JoystickQuit(void)
SDL_JoystickGUID SDL_SYS_JoystickGetDeviceGUID( int device_index )
{
SDL_JoystickGUID guid;
- // the GUID is just the first 16 chars of the name for now
+ /* the GUID is just the first 16 chars of the name for now */
const char *name = SDL_SYS_JoystickNameForDeviceIndex( device_index );
SDL_zero( guid );
SDL_memcpy( &guid, name, SDL_min( sizeof(guid), SDL_strlen( name ) ) );
@@ -143,7 +143,7 @@ SDL_JoystickGUID SDL_SYS_JoystickGetDeviceGUID( int device_index )
SDL_JoystickGUID SDL_SYS_JoystickGetGUID(SDL_Joystick * joystick)
{
SDL_JoystickGUID guid;
- // the GUID is just the first 16 chars of the name for now
+ /* the GUID is just the first 16 chars of the name for now */
const char *name = joystick->name;
SDL_zero( guid );
SDL_memcpy( &guid, name, SDL_min( sizeof(guid), SDL_strlen( name ) ) );
diff --git a/src/joystick/linux/SDL_sysjoystick.c b/src/joystick/linux/SDL_sysjoystick.c
index 23915b45aa..8582838a77 100644
--- a/src/joystick/linux/SDL_sysjoystick.c
+++ b/src/joystick/linux/SDL_sysjoystick.c
@@ -510,7 +510,7 @@ void SDL_SYS_JoystickDetect()
SDL_PushEvent(&event);
}
}
- #endif // !SDL_EVENTS_DISABLED
+ #endif /* !SDL_EVENTS_DISABLED */
}
} else if (SDL_strcmp(action, "remove") == 0) {
const int inst = MaybeRemoveDevice(devnode);
@@ -527,7 +527,7 @@ void SDL_SYS_JoystickDetect()
SDL_PushEvent(&event);
}
}
- #endif // !SDL_EVENTS_DISABLED
+ #endif /* !SDL_EVENTS_DISABLED */
}
}
UDEV_udev_device_unref(dev);
@@ -760,7 +760,7 @@ SDL_SYS_JoystickOpen(SDL_Joystick * joystick, int device_index)
/* Get the number of buttons and axes on the joystick */
ConfigJoystick(joystick, fd);
- // mark joystick as fresh and ready
+ /* mark joystick as fresh and ready */
joystick->hwdata->fresh = 1;
return (0);
@@ -840,7 +840,7 @@ PollAllValues(SDL_Joystick * joystick)
struct input_absinfo absinfo;
int a, b = 0;
- // Poll all axis
+ /* Poll all axis */
for (a = ABS_X; b < ABS_MAX; a++) {
switch (a) {
case ABS_HAT0X:
@@ -851,7 +851,7 @@ PollAllValues(SDL_Joystick * joystick)
case ABS_HAT2Y:
case ABS_HAT3X:
case ABS_HAT3Y:
- // ingore hats
+ /* ingore hats */
break;
default:
if (joystick->hwdata->abs_correct[b].used) {
diff --git a/src/joystick/psp/SDL_sysjoystick.c b/src/joystick/psp/SDL_sysjoystick.c
index a2c51a2851..d6ca6989eb 100644
--- a/src/joystick/psp/SDL_sysjoystick.c
+++ b/src/joystick/psp/SDL_sysjoystick.c
@@ -23,7 +23,7 @@
#include <pspctrl.h>
#include <pspkernel.h>
-#include <stdio.h> /* For the definition of NULL */
+#include <stdio.h> /* For the definition of NULL */
#include <stdlib.h>
#include "../SDL_sysjoystick.h"
@@ -41,10 +41,10 @@ static SDL_sem *pad_sem = NULL;
static SDL_Thread *thread = NULL;
static int running = 0;
static const enum PspCtrlButtons button_map[] = {
- PSP_CTRL_TRIANGLE, PSP_CTRL_CIRCLE, PSP_CTRL_CROSS, PSP_CTRL_SQUARE,
- PSP_CTRL_LTRIGGER, PSP_CTRL_RTRIGGER,
- PSP_CTRL_DOWN, PSP_CTRL_LEFT, PSP_CTRL_UP, PSP_CTRL_RIGHT,
- PSP_CTRL_SELECT, PSP_CTRL_START, PSP_CTRL_HOME, PSP_CTRL_HOLD };
+ PSP_CTRL_TRIANGLE, PSP_CTRL_CIRCLE, PSP_CTRL_CROSS, PSP_CTRL_SQUARE,
+ PSP_CTRL_LTRIGGER, PSP_CTRL_RTRIGGER,
+ PSP_CTRL_DOWN, PSP_CTRL_LEFT, PSP_CTRL_UP, PSP_CTRL_RIGHT,
+ PSP_CTRL_SELECT, PSP_CTRL_START, PSP_CTRL_HOME, PSP_CTRL_HOLD };
static int analog_map[256]; /* Map analog inputs to -32768 -> 32767 */
typedef struct
@@ -53,30 +53,30 @@ typedef struct
int y;
} point;
-// 4 points define the bezier-curve.
+/* 4 points define the bezier-curve. */
static point a = { 0, 0 };
static point b = { 50, 0 };
static point c = { 78, 32767 };
static point d = { 128, 32767 };
-// simple linear interpolation between two points
+/* simple linear interpolation between two points */
static __inline__ void lerp (point *dest, point *a, point *b, float t)
{
- dest->x = a->x + (b->x - a->x)*t;
- dest->y = a->y + (b->y - a->y)*t;
+ dest->x = a->x + (b->x - a->x)*t;
+ dest->y = a->y + (b->y - a->y)*t;
}
-// evaluate a point on a bezier-curve. t goes from 0 to 1.0
+/* evaluate a point on a bezier-curve. t goes from 0 to 1.0 */
static int calc_bezier_y(float t)
{
- point ab, bc, cd, abbc, bccd, dest;
- lerp (&ab, &a, &b, t); // point between a and b
- lerp (&bc, &b, &c, t); // point between b and c
- lerp (&cd, &c, &d, t); // point between c and d
- lerp (&abbc, &ab, &bc, t); // point between ab and bc
- lerp (&bccd, &bc, &cd, t); // point between bc and cd
- lerp (&dest, &abbc, &bccd, t); // point on the bezier-curve
- return dest.y;
+ point ab, bc, cd, abbc, bccd, dest;
+ lerp (&ab, &a, &b, t); /* point between a and b */
+ lerp (&bc, &b, &c, t); /* point between b and c */
+ lerp (&cd, &c, &d, t); /* point between c and d */
+ lerp (&abbc, &ab, &bc, t); /* point between ab and bc */
+ lerp (&bccd, &bc, &cd, t); /* point between bc and cd */
+ lerp (&dest, &abbc, &bccd, t); /* point on the bezier-curve */
+ return dest.y;
}
/*
@@ -84,14 +84,14 @@ static int calc_bezier_y(float t)
*/
int JoystickUpdate(void *data)
{
- while (running) {
- SDL_SemWait(pad_sem);
- sceCtrlPeekBufferPositive(&pad, 1);
- SDL_SemPost(pad_sem);
- /* Delay 1/60th of a second */
- sceKernelDelayThread(1000000 / 60);
- }
- return 0;
+ while (running) {
+ SDL_SemWait(pad_sem);
+ sceCtrlPeekBufferPositive(&pad, 1);
+ SDL_SemPost(pad_sem);
+ /* Delay 1/60th of a second */
+ sceKernelDelayThread(1000000 / 60);
+ }
+ return 0;
}
@@ -103,33 +103,33 @@ int JoystickUpdate(void *data)
*/
int SDL_SYS_JoystickInit(void)
{
- int i;
-
-// SDL_numjoysticks = 1;
-
- /* Setup input */
- sceCtrlSetSamplingCycle(0);
- sceCtrlSetSamplingMode(PSP_CTRL_MODE_ANALOG);
-
- /* Start thread to read data */
- if((pad_sem = SDL_CreateSemaphore(1)) == NULL) {
- return SDL_SetError("Can't create input semaphore");
- }
- running = 1;
- if((thread = SDL_CreateThread(JoystickUpdate, "JoySitckThread",NULL)) == NULL) {
- return SDL_SetError("Can't create input thread");
- }
-
- /* Create an accurate map from analog inputs (0 to 255)
- to SDL joystick positions (-32768 to 32767) */
- for (i = 0; i < 128; i++)
- {
- float t = (float)i/127.0f;
- analog_map[i+128] = calc_bezier_y(t);
- analog_map[127-i] = -1 * analog_map[i+128];
- }
-
- return 1;
+ int i;
+
+/* SDL_numjoysticks = 1; */
+
+ /* Setup input */
+ sceCtrlSetSamplingCycle(0);
+ sceCtrlSetSamplingMode(PSP_CTRL_MODE_ANALOG);
+
+ /* Start thread to read data */
+ if((pad_sem = SDL_CreateSemaphore(1)) == NULL) {
+ return SDL_SetError("Can't create input semaphore");
+ }
+ running = 1;
+ if((thread = SDL_CreateThread(JoystickUpdate, "JoySitckThread",NULL)) == NULL) {
+ return SDL_SetError("Can't create input thread");
+ }
+
+ /* Create an accurate map from analog inputs (0 to 255)
+ to SDL joystick positions (-32768 to 32767) */
+ for (i = 0; i < 128; i++)
+ {
+ float t = (float)i/127.0f;
+ analog_map[i+128] = calc_bezier_y(t);
+ analog_map[127-i] = -1 * analog_map[i+128];
+ }
+
+ return 1;
}
int SDL_SYS_NumJoysticks()
@@ -161,11 +161,11 @@ SDL_JoystickID SDL_SYS_GetInstanceIdOfDeviceIndex(int device_index)
/* Function to get the device-dependent name of a joystick */
const char *SDL_SYS_JoystickName(int index)
{
- if (index == 0)
- return "PSP controller";
+ if (index == 0)
+ return "PSP controller";
- SDL_SetError("No joystick available with that index");
- return(NULL);
+ SDL_SetError("No joystick available with that index");
+ return(NULL);
}
/* Function to open a joystick for use.
@@ -175,11 +175,11 @@ const char *SDL_SYS_JoystickName(int index)
*/
int SDL_SYS_JoystickOpen(SDL_Joystick *joystick, int device_index)
{
- joystick->nbuttons = 14;
- joystick->naxes = 2;
- joystick->nhats = 0;
+ joystick->nbuttons = 14;
+ joystick->naxes = 2;
+ joystick->nhats = 0;
- return 0;
+ return 0;
}
/* Function to determine is this joystick is attached to the system right now */
@@ -195,65 +195,65 @@ SDL_bool SDL_SYS_JoystickAttached(SDL_Joystick *joystick)
void SDL_SYS_JoystickUpdate(SDL_Joystick *joystick)
{
- int i;
- enum PspCtrlButtons buttons;
- enum PspCtrlButtons changed;
- unsigned char x, y;
- static enum PspCtrlButtons old_buttons = 0;
- static unsigned char old_x = 0, old_y = 0;
-
- SDL_SemWait(pad_sem);
- buttons = pad.Buttons;
- x = pad.Lx;
- y = pad.Ly;
- SDL_SemPost(pad_sem);
-
- /* Axes */
- if(old_x != x) {
- SDL_PrivateJoystickAxis(joystick, 0, analog_map[x]);
- old_x = x;
- }
- if(old_y != y) {
- SDL_PrivateJoystickAxis(joystick, 1, analog_map[y]);
- old_y = y;
- }
-
- /* Buttons */
- changed = old_buttons ^ buttons;
- old_buttons = buttons;
- if(changed) {
- for(i=0; i<sizeof(button_map)/sizeof(button_map[0]); i++) {
- if(changed & button_map[i]) {
- SDL_PrivateJoystickButton(
- joystick, i,
- (buttons & button_map[i]) ?
- SDL_PRESSED : SDL_RELEASED);
- }
- }
- }
-
- sceKernelDelayThread(0);
+ int i;
+ enum PspCtrlButtons buttons;
+ enum PspCtrlButtons changed;
+ unsigned char x, y;
+ static enum PspCtrlButtons old_buttons = 0;
+ static unsigned char old_x = 0, old_y = 0;
+
+ SDL_SemWait(pad_sem);
+ buttons = pad.Buttons;
+ x = pad.Lx;
+ y = pad.Ly;
+ SDL_SemPost(pad_sem);
+
+ /* Axes */
+ if(old_x != x) {
+ SDL_PrivateJoystickAxis(joystick, 0, analog_map[x]);
+ old_x = x;
+ }
+ if(old_y != y) {
+ SDL_PrivateJoystickAxis(joystick, 1, analog_map[y]);
+ old_y = y;
+ }
+
+ /* Buttons */
+ changed = old_buttons ^ buttons;
+ old_buttons = buttons;
+ if(changed) {
+ for(i=0; i<sizeof(button_map)/sizeof(button_map[0]); i++) {
+ if(changed & button_map[i]) {
+ SDL_PrivateJoystickButton(
+ joystick, i,
+ (buttons & button_map[i]) ?
+ SDL_PRESSED : SDL_RELEASED);
+ }
+ }
+ }
+
+ sceKernelDelayThread(0);
}
/* Function to close a joystick after use */
void SDL_SYS_JoystickClose(SDL_Joystick *joystick)
{
- /* Do nothing. */
+ /* Do nothing. */
}
/* Function to perform any system-specific joystick related cleanup */
void SDL_SYS_JoystickQuit(void)
{
- /* Cleanup Threads and Semaphore. */
- running = 0;
- SDL_WaitThread(thread, NULL);
- SDL_DestroySemaphore(pad_sem);
+ /* Cleanup Threads and Semaphore. */
+ running = 0;
+ SDL_WaitThread(thread, NULL);
+ SDL_DestroySemaphore(pad_sem);
}
SDL_JoystickGUID SDL_SYS_JoystickGetDeviceGUID( int device_index )
{
SDL_JoystickGUID guid;
- // the GUID is just the first 16 chars of the name for now
+ /* the GUID is just the first 16 chars of the name for now */
const char *name = SDL_SYS_JoystickNameForDeviceIndex( device_index );
SDL_zero( guid );
SDL_memcpy( &guid, name, SDL_min( sizeof(guid), SDL_strlen( name ) ) );
@@ -263,7 +263,7 @@ SDL_JoystickGUID SDL_SYS_JoystickGetDeviceGUID( int device_index )
SDL_JoystickGUID SDL_SYS_JoystickGetGUID(SDL_Joystick * joystick)
{
SDL_JoystickGUID guid;
- // the GUID is just the first 16 chars of the name for now
+ /* the GUID is just the first 16 chars of the name for now */
const char *name = joystick->name;
SDL_zero( guid );
SDL_memcpy( &guid, name, SDL_min( sizeof(guid), SDL_strlen( name ) ) );
diff --git a/src/joystick/windows/SDL_dxjoystick.c b/src/joystick/windows/SDL_dxjoystick.c
index b610220046..9e86e2f0e9 100644
--- a/src/joystick/windows/SDL_dxjoystick.c
+++ b/src/joystick/windows/SDL_dxjoystick.c
@@ -23,10 +23,10 @@
#ifdef SDL_JOYSTICK_DINPUT
/* DirectInput joystick driver; written by Glenn Maynard, based on Andrei de
- * A. Formiga's WINMM driver.
+ * A. Formiga's WINMM driver.
*
* Hats and sliders are completely untested; the app I'm writing this for mostly
- * doesn't use them and I don't own any joysticks with them.
+ * doesn't use them and I don't own any joysticks with them.
*
* We don't bother to use event notification here. It doesn't seem to work
* with polled devices, and it's fine to call IDirectInputDevice8_GetDeviceData and
@@ -49,15 +49,15 @@
#endif
#ifndef DIDFT_OPTIONAL
-#define DIDFT_OPTIONAL 0x80000000
+#define DIDFT_OPTIONAL 0x80000000
#endif
-#define INPUT_QSIZE 32 /* Buffer up to 32 input messages */
+#define INPUT_QSIZE 32 /* Buffer up to 32 input messages */
#define MAX_JOYSTICKS 8
-#define AXIS_MIN -32768 /* minimum value for axis coordinate */
-#define AXIS_MAX 32767 /* maximum value for axis coordinate */
-#define JOY_AXIS_THRESHOLD (((AXIS_MAX)-(AXIS_MIN))/100) /* 1% motion */
+#define AXIS_MIN -32768 /* minimum value for axis coordinate */
+#define AXIS_MAX 32767 /* maximum value for axis coordinate */
+#define JOY_AXIS_THRESHOLD (((AXIS_MAX)-(AXIS_MIN))/100) /* 1% motion */
/* external variables referenced. */
extern HWND SDL_HelperWindow;
@@ -96,10 +96,10 @@ WIN_LoadXInputDLL(void)
}
version = (1 << 16) | 4;
- s_pXInputDLL = LoadLibrary( L"XInput1_4.dll" ); // 1.4 Ships with Windows 8.
+ 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 Ships with Vista and Win7, can be installed as a redistributable component. */
}
if (!s_pXInputDLL) {
s_pXInputDLL = LoadLibrary( L"bin\\XInput1_3.dll" );
@@ -144,14 +144,14 @@ extern HRESULT(WINAPI * DInputCreate) (HINSTANCE hinst, DWORD dwVersion,
LPUNKNOWN punkOuter);
struct JoyStick_DeviceData_
{
- SDL_JoystickGUID guid;
- DIDEVICEINSTANCE dxdevice;
- char *joystickname;
- Uint8 send_add_event;
- SDL_JoystickID nInstanceID;
- SDL_bool bXInputDevice;
- Uint8 XInputUserId;
- struct JoyStick_DeviceData_ *pNext;
+ SDL_JoystickGUID guid;
+ DIDEVICEINSTANCE dxdevice;
+ char *joystickname;
+ Uint8 send_add_event;
+ SDL_JoystickID nInstanceID;
+ SDL_bool bXInputDevice;
+ Uint8 XInputUserId;
+ struct JoyStick_DeviceData_ *pNext;
};
typedef struct JoyStick_DeviceData_ JoyStick_DeviceData;
@@ -173,7 +173,7 @@ static int SDL_PrivateJoystickHat_Int(SDL_Joystick * joystick, Uint8 hat,
static int SDL_PrivateJoystickButton_Int(SDL_Joystick * joystick,
Uint8 button, Uint8 state);
-// Taken from Wine - Thanks!
+/* Taken from Wine - Thanks! */
DIOBJECTDATAFORMAT dfDIJoystick2[] = {
{ &GUID_XAxis,DIJOFS_X,DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0},
{ &GUID_YAxis,DIJOFS_Y,DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0},
@@ -365,150 +365,150 @@ SetDIerror(const char *function, HRESULT code)
#define SAFE_RELEASE(p) \
{ \
- if (p) { \
- (p)->lpVtbl->Release((p)); \
- (p) = 0; \
- } \
+ if (p) { \
+ (p)->lpVtbl->Release((p)); \
+ (p) = 0; \
+ } \
}
DEFINE_GUID(CLSID_WbemLocator, 0x4590f811,0x1d3a,0x11d0,0x89,0x1F,0x00,0xaa,0x00,0x4b,0x2e,0x24);
DEFINE_GUID(IID_IWbemLocator, 0xdc12a687,0x737f,0x11cf,0x88,0x4d,0x00,0xaa,0x00,0x4b,0x2e,0x24);
-//-----------------------------------------------------------------------------
-//
-// code from MSDN: http://msdn.microsoft.com/en-us/library/windows/desktop/ee417014(v=vs.85).aspx
-//
-// Enum each PNP device using WMI and check each device ID to see if it contains
-// "IG_" (ex. "VID_045E&PID_028E&IG_00"). If it does, then it's an XInput device
-// Unfortunately this information can not be found by just using DirectInput
-//-----------------------------------------------------------------------------
+/*-----------------------------------------------------------------------------
+ *
+ * code from MSDN: http://msdn.microsoft.com/en-us/library/windows/desktop/ee417014(v=vs.85).aspx
+ *
+ * Enum each PNP device using WMI and check each device ID to see if it contains
+ * "IG_" (ex. "VID_045E&PID_028E&IG_00"). If it does, then it's an XInput device
+ * Unfortunately this information can not be found by just using DirectInput
+ *-----------------------------------------------------------------------------*/
BOOL IsXInputDevice( const GUID* pGuidProductFromDirectInput )
{
- IWbemLocator* pIWbemLocator = NULL;
- IEnumWbemClassObject* pEnumDevices = NULL;
- IWbemClassObject* pDevices[20];
- IWbemServices* pIWbemServices = NULL;
- DWORD uReturned = 0;
- BSTR bstrNamespace = NULL;
- BSTR bstrDeviceID = NULL;
- BSTR bstrClassName = NULL;
- SDL_bool bIsXinputDevice= SDL_FALSE;
- UINT iDevice = 0;
- VARIANT var;
- HRESULT hr;
- DWORD bCleanupCOM;
+ IWbemLocator* pIWbemLocator = NULL;
+ IEnumWbemClassObject* pEnumDevices = NULL;
+ IWbemClassObject* pDevices[20];
+ IWbemServices* pIWbemServices = NULL;
+ DWORD uReturned = 0;
+ BSTR bstrNamespace = NULL;
+ BSTR bstrDeviceID = NULL;
+ BSTR bstrClassName = NULL;
+ SDL_bool bIsXinputDevice= SDL_FALSE;
+ UINT iDevice = 0;
+ VARIANT var;
+ HRESULT hr;
+ DWORD bCleanupCOM;
if (!s_bXInputEnabled)
{
return SDL_FALSE;
}
- SDL_memset( pDevices, 0x0, sizeof(pDevices) );
-
- // CoInit if needed
- hr = CoInitialize(NULL);
- bCleanupCOM = SUCCEEDED(hr);
-
- // Create WMI
- hr = CoCreateInstance( &CLSID_WbemLocator,
- NULL,
- CLSCTX_INPROC_SERVER,
- &IID_IWbemLocator,
- (LPVOID*) &pIWbemLocator);
- if( FAILED(hr) || pIWbemLocator == NULL )
- goto LCleanup;
-
- bstrNamespace = SysAllocString( L"\\\\.\\root\\cimv2" );if( bstrNamespace == NULL ) goto LCleanup;
- bstrClassName = SysAllocString( L"Win32_PNPEntity" ); if( bstrClassName == NULL ) goto LCleanup;
- bstrDeviceID = SysAllocString( L"DeviceID" ); if( bstrDeviceID == NULL ) goto LCleanup;
-
- // Connect to WMI
- hr = IWbemLocator_ConnectServer( pIWbemLocator, bstrNamespace, NULL, NULL, 0L,
- 0L, NULL, NULL, &pIWbemServices );
- if( FAILED(hr) || pIWbemServices == NULL )
- goto LCleanup;
-
- // Switch security level to IMPERSONATE.
- CoSetProxyBlanket( (IUnknown *)pIWbemServices, RPC_C_AUTHN_WINNT, RPC_C_AUTHZ_NONE, NULL,
- RPC_C_AUTHN_LEVEL_CALL, RPC_C_IMP_LEVEL_IMPERSONATE, NULL, EOAC_NONE );
-
- hr = IWbemServices_CreateInstanceEnum( pIWbemServices, bstrClassName, 0, NULL, &pEnumDevices );
- if( FAILED(hr) || pEnumDevices == NULL )
- goto LCleanup;
-
- // Loop over all devices
- for( ;; )
- {
- // Get 20 at a time
- hr = IEnumWbemClassObject_Next( pEnumDevices, 10000, 20, pDevices, &uReturned );
- if( FAILED(hr) )
- goto LCleanup;
- if( uReturned == 0 )
- break;
-
- for( iDevice=0; iDevice<uReturned; iDevice++ )
- {
- // For each device, get its device ID
- hr = IWbemClassObject_Get( pDevices[iDevice], bstrDeviceID, 0L, &var, NULL, NULL );
- if( SUCCEEDED( hr ) && var.vt == VT_BSTR && var.bstrVal != NULL )
- {
- // Check if the device ID contains "IG_". If it does, then it's an XInput device
- // This information can not be found from DirectInput
- char *pDeviceString = WIN_StringToUTF8( var.bstrVal );
- if( SDL_strstr( pDeviceString, "IG_" ) )
- {
- // If it does, then get the VID/PID from var.bstrVal
- long dwPid = 0, dwVid = 0;
- char * strPid = NULL;
- DWORD dwVidPid = 0;
- char * strVid = SDL_strstr( pDeviceString, "VID_" );
- if( strVid )
- {
- dwVid = SDL_strtol( strVid + 4, NULL, 16 );
- }
- strPid = SDL_strstr( pDeviceString, "PID_" );
- if( strPid )
- {
- dwPid = SDL_strtol( strPid + 4, NULL, 16 );
- }
-
- // Compare the VID/PID to the DInput device
- dwVidPid = MAKELONG( dwVid, dwPid );
- if( dwVidPid == pGuidProductFromDirectInput->Data1 )
- {
- bIsXinputDevice = SDL_TRUE;
- }
- }
- if ( pDeviceString )
- SDL_free( pDeviceString );
-
- if ( bIsXinputDevice )
- break;
- }
- SAFE_RELEASE( pDevices[iDevice] );
- }
- }
-
+ SDL_memset( pDevices, 0x0, sizeof(pDevices) );
+
+ /* CoInit if needed */
+ hr = CoInitialize(NULL);
+ bCleanupCOM = SUCCEEDED(hr);
+
+ /* Create WMI */
+ hr = CoCreateInstance( &CLSID_WbemLocator,
+ NULL,
+ CLSCTX_INPROC_SERVER,
+ &IID_IWbemLocator,
+ (LPVOID*) &pIWbemLocator);
+ if( FAILED(hr) || pIWbemLocator == NULL )
+ goto LCleanup;
+
+ bstrNamespace = SysAllocString( L"\\\\.\\root\\cimv2" );if( bstrNamespace == NULL ) goto LCleanup;
+ bstrClassName = SysAllocString( L"Win32_PNPEntity" ); if( bstrClassName == NULL ) goto LCleanup;
+ bstrDeviceID = SysAllocString( L"DeviceID" ); if( bstrDeviceID == NULL ) goto LCleanup;
+
+ /* Connect to WMI */
+ hr = IWbemLocator_ConnectServer( pIWbemLocator, bstrNamespace, NULL, NULL, 0L,
+ 0L, NULL, NULL, &pIWbemServices );
+ if( FAILED(hr) || pIWbemServices == NULL )
+ goto LCleanup;
+
+ /* Switch security level to IMPERSONATE. */
+ CoSetProxyBlanket( (IUnknown *)pIWbemServices, RPC_C_AUTHN_WINNT, RPC_C_AUTHZ_NONE, NULL,
+ RPC_C_AUTHN_LEVEL_CALL, RPC_C_IMP_LEVEL_IMPERSONATE, NULL, EOAC_NONE );
+
+ hr = IWbemServices_CreateInstanceEnum( pIWbemServices, bstrClassName, 0, NULL, &pEnumDevices );
+ if( FAILED(hr) || pEnumDevices == NULL )
+ goto LCleanup;
+
+ /* Loop over all devices */
+ for( ;; )
+ {
+ /* Get 20 at a time */
+ hr = IEnumWbemClassObject_Next( pEnumDevices, 10000, 20, pDevices, &uReturned );
+ if( FAILED(hr) )
+ goto LCleanup;
+ if( uReturned == 0 )
+ break;
+
+ for( iDevice=0; iDevice<uReturned; iDevice++ )
+ {
+ /* For each device, get its device ID */
+ hr = IWbemClassObject_Get( pDevices[iDevice], bstrDeviceID, 0L, &var, NULL, NULL );
+ if( SUCCEEDED( hr ) && var.vt == VT_BSTR && var.bstrVal != NULL )
+ {
+ /* Check if the device ID contains "IG_". If it does, then it's an XInput device */
+ /* This information can not be found from DirectInput */
+ char *pDeviceString = WIN_StringToUTF8( var.bstrVal );
+ if( SDL_strstr( pDeviceString, "IG_" ) )
+ {
+ /* If it does, then get the VID/PID from var.bstrVal */
+ long dwPid = 0, dwVid = 0;
+ char * strPid = NULL;
+ DWORD dwVidPid = 0;
+ char * strVid = SDL_strstr( pDeviceString, "VID_" );
+ if( strVid )
+ {
+ dwVid = SDL_strtol( strVid + 4, NULL, 16 );
+ }
+ strPid = SDL_strstr( pDeviceString, "PID_" );
+ if( strPid )
+ {
+ dwPid = SDL_strtol( strPid + 4, NULL, 16 );
+ }
+
+ /* Compare the VID/PID to the DInput device */
+ dwVidPid = MAKELONG( dwVid, dwPid );
+ if( dwVidPid == pGuidProductFromDirectInput->Data1 )
+ {
+ bIsXinputDevice = SDL_TRUE;
+ }
+ }
+ if ( pDeviceString )
+ SDL_free( pDeviceString );
+
+ if ( bIsXinputDevice )
+ break;
+ }
+ SAFE_RELEASE( pDevices[iDevice] );
+ }
+ }
+
LCleanup:
- for( iDevice=0; iDevice<20; iDevice++ )
- SAFE_RELEASE( pDevices[iDevice] );
- SAFE_RELEASE( pEnumDevices );
- SAFE_RELEASE( pIWbemLocator );
- SAFE_RELEASE( pIWbemServices );
-
- if ( bstrNamespace )
- SysFreeString( bstrNamespace );
- if ( bstrClassName )
- SysFreeString( bstrClassName );
- if ( bstrDeviceID )
- SysFreeString( bstrDeviceID );
-
- if( bCleanupCOM )
- CoUninitialize();
-
- return bIsXinputDevice;
+ for( iDevice=0; iDevice<20; iDevice++ )
+ SAFE_RELEASE( pDevices[iDevice] );
+ SAFE_RELEASE( pEnumDevices );
+ SAFE_RELEASE( pIWbemLocator );
+ SAFE_RELEASE( pIWbemServices );
+
+ if ( bstrNamespace )
+ SysFreeString( bstrNamespace );
+ if ( bstrClassName )
+ SysFreeString( bstrClassName );
+ if ( bstrDeviceID )
+ SysFreeString( bstrDeviceID );
+
+ if( bCleanupCOM )
+ CoUninitialize();
+
+ return bIsXinputDevice;
}
@@ -517,137 +517,137 @@ static SDL_bool s_bWindowsDeviceChanged = SDL_FALSE;
/* windowproc for our joystick detect thread message only window, to detect any USB device addition/removal
*/
LRESULT CALLBACK SDL_PrivateJoystickDetectProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) {
- switch (message) {
- case WM_DEVICECHANGE:
- switch (wParam) {
- case DBT_DEVICEARRIVAL:
- if (((DEV_BROADCAST_HDR*)lParam)->dbch_devicetype == DBT_DEVTYP_DEVICEINTERFACE) {
- s_bWindowsDeviceChanged = SDL_TRUE;
- }
- break;
- case DBT_DEVICEREMOVECOMPLETE:
- if (((DEV_BROADCAST_HDR*)lParam)->dbch_devicetype == DBT_DEVTYP_DEVICEINTERFACE) {
- s_bWindowsDeviceChanged = SDL_TRUE;
- }
- break;
- }
- return 0;
- }
-
- return DefWindowProc (hwnd, message, wParam, lParam);
+ switch (message) {
+ case WM_DEVICECHANGE:
+ switch (wParam) {
+ case DBT_DEVICEARRIVAL:
+ if (((DEV_BROADCAST_HDR*)lParam)->dbch_devicetype == DBT_DEVTYP_DEVICEINTERFACE) {
+ s_bWindowsDeviceChanged = SDL_TRUE;
+ }
+ break;
+ case DBT_DEVICEREMOVECOMPLETE:
+ if (((DEV_BROADCAST_HDR*)lParam)->dbch_devicetype == DBT_DEVTYP_DEVICEINTERFACE) {
+ s_bWindowsDeviceChanged = SDL_TRUE;
+ }
+ break;
+ }
+ return 0;
+ }
+
+ return DefWindowProc (hwnd, message, wParam, lParam);
}
DEFINE_GUID(GUID_DEVINTERFACE_USB_DEVICE, 0xA5DCBF10L, 0x6530, 0x11D2, 0x90, 0x1F, 0x00, \
- 0xC0, 0x4F, 0xB9, 0x51, 0xED);
+ 0xC0, 0x4F, 0xB9, 0x51, 0xED);
/* Function/thread to scan the system for joysticks.
*/
static int
SDL_JoystickThread(void *_data)
{
- HRESULT result = S_OK;
- HWND messageWindow = 0;
- HDEVNOTIFY hNotify = 0;
- DEV_BROADCAST_DEVICEINTERFACE dbh;
- SDL_bool bOpenedXInputDevices[4];
- WNDCLASSEX wincl;
-
- SDL_memset( bOpenedXInputDevices, 0x0, sizeof(bOpenedXInputDevices) );
-
- result = WIN_CoInitialize();
-
- SDL_memset( &wincl, 0x0, sizeof(wincl) );
- wincl.hInstance = GetModuleHandle( NULL );
- wincl.lpszClassName = L"Message";
- wincl.lpfnWndProc = SDL_PrivateJoystickDetectProc; // This function is called by windows
- wincl.cbSize = sizeof (WNDCLASSEX);
-
- if (!RegisterClassEx (&wincl))
- {
- return SDL_SetError("Failed to create register class for joystick autodetect.", GetLastError());
- }
-
- messageWindow = (HWND)CreateWindowEx( 0, L"Message", NULL, 0, 0, 0, 0, 0, HWND_MESSAGE, NULL, NULL, NULL );
- if ( !messageWindow )
- {
- return SDL_SetError("Failed to create message window for joystick autodetect.", GetLastError());
- }
-
- SDL_memset(&dbh, 0x0, sizeof(dbh));
-
- dbh.dbcc_size = sizeof(dbh);
- dbh.dbcc_devicetype = DBT_DEVTYP_DEVICEINTERFACE;
- dbh.dbcc_classguid = GUID_DEVINTERFACE_USB_DEVICE;
-
- hNotify = RegisterDeviceNotification( messageWindow, &dbh, DEVICE_NOTIFY_WINDOW_HANDLE );
- if ( !hNotify )
- {
- return SDL_SetError("Failed to create notify device for joystick autodetect.", GetLastError());
- }
-
- SDL_LockMutex( s_mutexJoyStickEnum );
- while ( s_bJoystickThreadQuit == SDL_FALSE )
- {
- MSG messages;
- Uint8 userId;
- int nCurrentOpenedXInputDevices = 0;
- int nNewOpenedXInputDevices = 0;
- SDL_CondWaitTimeout( s_condJoystickThread, s_mutexJoyStickEnum, 300 );
-
- while ( s_bJoystickThreadQuit == SDL_FALSE && PeekMessage(&messages, messageWindow, 0, 0, PM_NOREMOVE) )
- {
- if ( GetMessage(&messages, messageWindow, 0, 0) != 0 ) {
- TranslateMessage(&messages);
- DispatchMessage(&messages);
- }
- }
-
- if ( s_bXInputEnabled && XINPUTGETCAPABILITIES )
- {
- // scan for any change in XInput devices
- for ( userId = 0; userId < 4; userId++ )
- {
- XINPUT_CAPABILITIES capabilities;
- DWORD result;
-
- if ( bOpenedXInputDevices[userId] == SDL_TRUE )
- nCurrentOpenedXInputDevices++;
-
- result = XINPUTGETCAPABILITIES( userId, XINPUT_FLAG_GAMEPAD, &capabilities );
- if ( result == ERROR_SUCCESS )
- {
- bOpenedXInputDevices[userId] = SDL_TRUE;
- nNewOpenedXInputDevices++;
- }
- else
- {
- bOpenedXInputDevices[userId] = SDL_FALSE;
- }
- }
- }
-
- if ( s_pKnownJoystickGUIDs && ( s_bWindowsDeviceChanged || nNewOpenedXInputDevices != nCurrentOpenedXInputDevices ) )
- {
- SDL_Delay( 300 ); // wait for direct input to find out about this device
-
- s_bDeviceRemoved = SDL_TRUE;
- s_bDeviceAdded = SDL_TRUE;
- s_bWindowsDeviceChanged = SDL_FALSE;
- }
- }
- SDL_UnlockMutex( s_mutexJoyStickEnum );
-
- if ( hNotify )
- UnregisterDeviceNotification( hNotify );
-
- if ( messageWindow )
- DestroyWindow( messageWindow );
-
- UnregisterClass( wincl.lpszClassName, wincl.hInstance );
- messageWindow = 0;
- WIN_CoUninitialize();
- return 1;
+ HRESULT result = S_OK;
+ HWND messageWindow = 0;
+ HDEVNOTIFY hNotify = 0;
+ DEV_BROADCAST_DEVICEINTERFACE dbh;
+ SDL_bool bOpenedXInputDevices[4];
+ WNDCLASSEX wincl;
+
+ SDL_memset( bOpenedXInputDevices, 0x0, sizeof(bOpenedXInputDevices) );
+
+ result = WIN_CoInitialize();
+
+ SDL_memset( &wincl, 0x0, sizeof(wincl) );
+ wincl.hInstance = GetModuleHandle( NULL );
+ wincl.lpszClassName = L"Message";
+ wincl.lpfnWndProc = SDL_PrivateJoystickDetectProc; /* This function is called by windows */
+ wincl.cbSize = sizeof (WNDCLASSEX);
+
+ if (!RegisterClassEx (&wincl))
+ {
+ return SDL_SetError("Failed to create register class for joystick autodetect.", GetLastError());
+ }
+
+ messageWindow = (HWND)CreateWindowEx( 0, L"Message", NULL, 0, 0, 0, 0, 0, HWND_MESSAGE, NULL, NULL, NULL );
+ if ( !messageWindow )
+ {
+ return SDL_SetError("Failed to create message window for joystick autodetect.", GetLastError());
+ }
+
+ SDL_memset(&dbh, 0x0, sizeof(dbh));
+
+ dbh.dbcc_size = sizeof(dbh);
+ dbh.dbcc_devicetype = DBT_DEVTYP_DEVICEINTERFACE;
+ dbh.dbcc_classguid = GUID_DEVINTERFACE_USB_DEVICE;
+
+ hNotify = RegisterDeviceNotification( messageWindow, &dbh, DEVICE_NOTIFY_WINDOW_HANDLE );
+ if ( !hNotify )
+ {
+ return SDL_SetError("Failed to create notify device for joystick autodetect.", GetLastError());
+ }
+
+ SDL_LockMutex( s_mutexJoyStickEnum );
+ while ( s_bJoystickThreadQuit == SDL_FALSE )
+ {
+ MSG messages;
+ Uint8 userId;
+ int nCurrentOpenedXInputDevices = 0;
+ int nNewOpenedXInputDevices = 0;
+ SDL_CondWaitTimeout( s_condJoystickThread, s_mutexJoyStickEnum, 300 );
+
+ while ( s_bJoystickThreadQuit == SDL_FALSE && PeekMessage(&messages, messageWindow, 0, 0, PM_NOREMOVE) )
+ {
+ if ( GetMessage(&messages, messageWindow, 0, 0) != 0 ) {
+ TranslateMessage(&messages);
+ DispatchMessage(&messages);
+ }
+ }
+
+ if ( s_bXInputEnabled && XINPUTGETCAPABILITIES )
+ {
+ /* scan for any change in XInput devices */
+ for ( userId = 0; userId < 4; userId++ )
+ {
+ XINPUT_CAPABILITIES capabilities;
+ DWORD result;
+
+ if ( bOpenedXInputDevices[userId] == SDL_TRUE )
+ nCurrentOpenedXInputDevices++;
+
+ result = XINPUTGETCAPABILITIES( userId, XINPUT_FLAG_GAMEPAD, &capabilities );
+ if ( result == ERROR_SUCCESS )
+ {
+ bOpenedXInputDevices[userId] = SDL_TRUE;
+ nNewOpenedXInputDevices++;
+ }
+ else
+ {
+ bOpenedXInputDevices[userId] = SDL_FALSE;
+ }
+ }
+ }
+
+ if ( s_pKnownJoystickGUIDs && ( s_bWindowsDeviceChanged || nNewOpenedXInputDevices != nCurrentOpenedXInputDevices ) )
+ {
+ SDL_Delay( 300 ); /* wait for direct input to find out about this device */
+
+ s_bDeviceRemoved = SDL_TRUE;
+ s_bDeviceAdded = SDL_TRUE;
+ s_bWindowsDeviceChanged = SDL_FALSE;
+ }
+ }
+ SDL_UnlockMutex( s_mutexJoyStickEnum );
+
+ if ( hNotify )
+ UnregisterDeviceNotification( hNotify );
+
+ if ( messageWindow )
+ DestroyWindow( messageWindow );
+
+ UnregisterClass( wincl.lpszClassName, wincl.hInstance );
+ messageWindow = 0;
+ WIN_CoUninitialize();
+ return 1;
}
@@ -661,10 +661,10 @@ SDL_SYS_JoystickInit(void)
{
HRESULT result;
HINSTANCE instance;
- const char *env = SDL_GetHint(SDL_HINT_XINPUT_ENABLED);
- if (env && !SDL_atoi(env)) {
- s_bXInputEnabled = SDL_FALSE;
- }
+ const char *env = SDL_GetHint(SDL_HINT_XINPUT_ENABLED);
+ if (env && !SDL_atoi(env)) {
+ s_bXInputEnabled = SDL_FALSE;
+ }
result = WIN_CoInitialize();
if (FAILED(result)) {
@@ -696,238 +696,238 @@ SDL_SYS_JoystickInit(void)
s_mutexJoyStickEnum = SDL_CreateMutex();
s_condJoystickThread = SDL_CreateCond();
- s_bDeviceAdded = SDL_TRUE; // force a scan of the system for joysticks this first time
+ s_bDeviceAdded = SDL_TRUE; /* force a scan of the system for joysticks this first time */
SDL_SYS_JoystickDetect();
if ((s_bXInputEnabled) && (WIN_LoadXInputDLL() == -1)) {
s_bXInputEnabled = SDL_FALSE; /* oh well. */
}
- if ( !s_threadJoystick )
- {
- s_bJoystickThreadQuit = SDL_FALSE;
- /* spin up the thread to detect hotplug of devices */
+ if ( !s_threadJoystick )
+ {
+ s_bJoystickThreadQuit = SDL_FALSE;
+ /* spin up the thread to detect hotplug of devices */
#if defined(__WIN32__) && !defined(HAVE_LIBC)
#undef SDL_CreateThread
- s_threadJoystick= SDL_CreateThread( SDL_JoystickThread, "SDL_joystick", NULL, NULL, NULL );
+ s_threadJoystick= SDL_CreateThread( SDL_JoystickThread, "SDL_joystick", NULL, NULL, NULL );
#else
- s_threadJoystick = SDL_CreateThread( SDL_JoystickThread, "SDL_joystick", NULL );
+ s_threadJoystick = SDL_CreateThread( SDL_JoystickThread, "SDL_joystick", NULL );
#endif
- }
- return SDL_SYS_NumJoysticks();
+ }
+ return SDL_SYS_NumJoysticks();
}
/* return the number of joysticks that are connected right now */
int SDL_SYS_NumJoysticks()
{
- int nJoysticks = 0;
- JoyStick_DeviceData *device = SYS_Joystick;
- while ( device )
- {
- nJoysticks++;
- device = device->pNext;
- }
-
- return nJoysticks;
+ int nJoysticks = 0;
+ JoyStick_DeviceData *device = SYS_Joystick;
+ while ( device )
+ {
+ nJoysticks++;
+ device = device->pNext;
+ }
+
+ return nJoysticks;
}
static int s_iNewGUID = 0;
/* helper function for direct input, gets called for each connected joystick */
static BOOL CALLBACK
- EnumJoysticksCallback(const DIDEVICEINSTANCE * pdidInstance, VOID * pContext)
+ EnumJoysticksCallback(const DIDEVICEINSTANCE * pdidInstance, VOID * pContext)
{
- JoyStick_DeviceData *pNewJoystick;
- JoyStick_DeviceData *pPrevJoystick = NULL;
- SDL_bool bXInputDevice;
- pNewJoystick = *(JoyStick_DeviceData **)pContext;
- while ( pNewJoystick )
- {
- if ( !SDL_memcmp( &pNewJoystick->dxdevice.guidInstance, &pdidInstance->guidInstance, sizeof(pNewJoystick->dxdevice.guidInstance) ) )
- {
- /* if we are replacing the front of the list then update it */
- if ( pNewJoystick == *(JoyStick_DeviceData **)pContext )
- {
- *(JoyStick_DeviceData **)pContext = pNewJoystick->pNext;
- }
- else if ( pPrevJoystick )
- {
- pPrevJoystick->pNext = pNewJoystick->pNext;
- }
-
- pNewJoystick->pNext = SYS_Joystick;
- SYS_Joystick = pNewJoystick;
-
- s_pKnownJoystickGUIDs[ s_iNewGUID ] = pdidInstance->guidInstance;
- s_iNewGUID++;
- if ( s_iNewGUID < MAX_JOYSTICKS )
- return DIENUM_CONTINUE; // already have this joystick loaded, just keep going
- else
- return DIENUM_STOP;
- }
-
- pPrevJoystick = pNewJoystick;
- pNewJoystick = pNewJoystick->pNext;
- }
-
- s_bDeviceAdded = SDL_TRUE;
-
- bXInputDevice = IsXInputDevice( &pdidInstance->guidProduct );
-
- pNewJoystick = (JoyStick_DeviceData *)SDL_malloc( sizeof(JoyStick_DeviceData) );
-
- if ( bXInputDevice )
- {
- pNewJoystick->bXInputDevice = SDL_TRUE;
- pNewJoystick->XInputUserId = INVALID_XINPUT_USERID;
- }
- else
- {
- pNewJoystick->bXInputDevice = SDL_FALSE;
- }
-
- SDL_memcpy(&(pNewJoystick->dxdevice), pdidInstance,
- sizeof(DIDEVICEINSTANCE));
-
- pNewJoystick->joystickname = WIN_StringToUTF8(pdidInstance->tszProductName);
- pNewJoystick->send_add_event = 1;
- pNewJoystick->nInstanceID = ++s_nInstanceID;
- SDL_memcpy( &pNewJoystick->guid, &pdidInstance->guidProduct, sizeof(pNewJoystick->guid) );
- pNewJoystick->pNext = NULL;
-
- if ( SYS_Joystick )
- {
- pNewJoystick->pNext = SYS_Joystick;
- }
- SYS_Joystick = pNewJoystick;
-
- s_pKnownJoystickGUIDs[ s_iNewGUID ] = pdidInstance->guidInstance;
- s_iNewGUID++;
-
- if ( s_iNewGUID < MAX_JOYSTICKS )
- return DIENUM_CONTINUE; // already have this joystick loaded, just keep going
- else
- return DIENUM_STOP;
+ JoyStick_DeviceData *pNewJoystick;
+ JoyStick_DeviceData *pPrevJoystick = NULL;
+ SDL_bool bXInputDevice;
+ pNewJoystick = *(JoyStick_DeviceData **)pContext;
+ while ( pNewJoystick )
+ {
+ if ( !SDL_memcmp( &pNewJoystick->dxdevice.guidInstance, &pdidInstance->guidInstance, sizeof(pNewJoystick->dxdevice.guidInstance) ) )
+ {
+ /* if we are replacing the front of the list then update it */
+ if ( pNewJoystick == *(JoyStick_DeviceData **)pContext )
+ {
+ *(JoyStick_DeviceData **)pContext = pNewJoystick->pNext;
+ }
+ else if ( pPrevJoystick )
+ {
+ pPrevJoystick->pNext = pNewJoystick->pNext;
+ }
+
+ pNewJoystick->pNext = SYS_Joystick;
+ SYS_Joystick = pNewJoystick;
+
+ s_pKnownJoystickGUIDs[ s_iNewGUID ] = pdidInstance->guidInstance;
+ s_iNewGUID++;
+ if ( s_iNewGUID < MAX_JOYSTICKS )
+ return DIENUM_CONTINUE; /* already have this joystick loaded, just keep going */
+ else
+ return DIENUM_STOP;
+ }
+
+ pPrevJoystick = pNewJoystick;
+ pNewJoystick = pNewJoystick->pNext;
+ }
+
+ s_bDeviceAdded = SDL_TRUE;
+
+ bXInputDevice = IsXInputDevice( &pdidInstance->guidProduct );
+
+ pNewJoystick = (JoyStick_DeviceData *)SDL_malloc( sizeof(JoyStick_DeviceData) );
+
+ if ( bXInputDevice )
+ {
+ pNewJoystick->bXInputDevice = SDL_TRUE;
+ pNewJoystick->XInputUserId = INVALID_XINPUT_USERID;
+ }
+ else
+ {
+ pNewJoystick->bXInputDevice = SDL_FALSE;
+ }
+
+ SDL_memcpy(&(pNewJoystick->dxdevice), pdidInstance,
+ sizeof(DIDEVICEINSTANCE));
+
+ pNewJoystick->joystickname = WIN_StringToUTF8(pdidInstance->tszProductName);
+ pNewJoystick->send_add_event = 1;
+ pNewJoystick->nInstanceID = ++s_nInstanceID;
+ SDL_memcpy( &pNewJoystick->guid, &pdidInstance->guidProduct, sizeof(pNewJoystick->guid) );
+ pNewJoystick->pNext = NULL;
+
+ if ( SYS_Joystick )
+ {
+ pNewJoystick->pNext = SYS_Joystick;
+ }
+ SYS_Joystick = pNewJoystick;
+
+ s_pKnownJoystickGUIDs[ s_iNewGUID ] = pdidInstance->guidInstance;
+ s_iNewGUID++;
+
+ if ( s_iNewGUID < MAX_JOYSTICKS )
+ return DIENUM_CONTINUE; /* already have this joystick loaded, just keep going */
+ else
+ return DIENUM_STOP;
}
/* detect any new joysticks being inserted into the system */
void SDL_SYS_JoystickDetect()
{
- HRESULT result;
- JoyStick_DeviceData *pCurList = NULL;
- /* only enum the devices if the joystick thread told us something changed */
- if ( s_bDeviceAdded || s_bDeviceRemoved )
- {
- s_bDeviceAdded = SDL_FALSE;
- s_bDeviceRemoved = SDL_FALSE;
-
- pCurList = SYS_Joystick;
- SYS_Joystick = NULL;
- s_iNewGUID = 0;
- SDL_LockMutex( s_mutexJoyStickEnum );
-
- if ( !s_pKnownJoystickGUIDs )
- s_pKnownJoystickGUIDs = SDL_malloc( sizeof(GUID)*MAX_JOYSTICKS );
-
- SDL_memset( s_pKnownJoystickGUIDs, 0x0, sizeof(GUID)*MAX_JOYSTICKS );
-
- /* Look for joysticks, wheels, head trackers, gamepads, etc.. */
- result = IDirectInput8_EnumDevices(dinput,
- DI8DEVCLASS_GAMECTRL,
- EnumJoysticksCallback,
- &pCurList, DIEDFL_ATTACHEDONLY);
-
- SDL_UnlockMutex( s_mutexJoyStickEnum );
- }
-
- if ( pCurList )
- {
- while ( pCurList )
- {
- JoyStick_DeviceData *pListNext = NULL;
+ HRESULT result;
+ JoyStick_DeviceData *pCurList = NULL;
+ /* only enum the devices if the joystick thread told us something changed */
+ if ( s_bDeviceAdded || s_bDeviceRemoved )
+ {
+ s_bDeviceAdded = SDL_FALSE;
+ s_bDeviceRemoved = SDL_FALSE;
+
+ pCurList = SYS_Joystick;
+ SYS_Joystick = NULL;
+ s_iNewGUID = 0;
+ SDL_LockMutex( s_mutexJoyStickEnum );
+
+ if ( !s_pKnownJoystickGUIDs )
+ s_pKnownJoystickGUIDs = SDL_malloc( sizeof(GUID)*MAX_JOYSTICKS );
+
+ SDL_memset( s_pKnownJoystickGUIDs, 0x0, sizeof(GUID)*MAX_JOYSTICKS );
+
+ /* Look for joysticks, wheels, head trackers, gamepads, etc.. */
+ result = IDirectInput8_EnumDevices(dinput,
+ DI8DEVCLASS_GAMECTRL,
+ EnumJoysticksCallback,
+ &pCurList, DIEDFL_ATTACHEDONLY);
+
+ SDL_UnlockMutex( s_mutexJoyStickEnum );
+ }
+
+ if ( pCurList )
+ {
+ while ( pCurList )
+ {
+ JoyStick_DeviceData *pListNext = NULL;
#if !SDL_EVENTS_DISABLED
- SDL_Event event;
- event.type = SDL_JOYDEVICEREMOVED;
-
- if (SDL_GetEventState(event.type) == SDL_ENABLE) {
- event.jdevice.which = pCurList->nInstanceID;
- if ((SDL_EventOK == NULL)
- || (*SDL_EventOK) (SDL_EventOKParam, &event)) {
- SDL_PushEvent(&event);
- }
- }
-#endif // !SDL_EVENTS_DISABLED
-
- pListNext = pCurList->pNext;
- SDL_free(pCurList->joystickname);
- SDL_free( pCurList );
- pCurList = pListNext;
- }
-
- }
-
- if ( s_bDeviceAdded )
- {
- JoyStick_DeviceData *pNewJoystick;
- int device_index = 0;
- s_bDeviceAdded = SDL_FALSE;
- pNewJoystick = SYS_Joystick;
- while ( pNewJoystick )
- {
- if ( pNewJoystick->send_add_event )
- {
+ SDL_Event event;
+ event.type = SDL_JOYDEVICEREMOVED;
+
+ if (SDL_GetEventState(event.type) == SDL_ENABLE) {
+ event.jdevice.which = pCurList->nInstanceID;
+ if ((SDL_EventOK == NULL)
+ || (*SDL_EventOK) (SDL_EventOKParam, &event)) {
+ SDL_PushEvent(&event);
+ }
+ }
+#endif /* !SDL_EVENTS_DISABLED */
+
+ pListNext = pCurList->pNext;
+ SDL_free(pCurList->joystickname);
+ SDL_free( pCurList );
+ pCurList = pListNext;
+ }
+
+ }
+
+ if ( s_bDeviceAdded )
+ {
+ JoyStick_DeviceData *pNewJoystick;
+ int device_index = 0;
+ s_bDeviceAdded = SDL_FALSE;
+ pNewJoystick = SYS_Joystick;
+ while ( pNewJoystick )
+ {
+ if ( pNewJoystick->send_add_event )
+ {
#if !SDL_EVENTS_DISABLED
- SDL_Event event;
- event.type = SDL_JOYDEVICEADDED;
-
- if (SDL_GetEventState(event.type) == SDL_ENABLE) {
- event.jdevice.which = device_index;
- if ((SDL_EventOK == NULL)
- || (*SDL_EventOK) (SDL_EventOKParam, &event)) {
- SDL_PushEvent(&event);
- }
- }
+ SDL_Event event;
+ event.type = SDL_JOYDEVICEADDED;
+
+ if (SDL_GetEventState(event.type) == SDL_ENABLE) {
+ event.jdevice.which = device_index;
+ if ((SDL_EventOK == NULL)
+ || (*SDL_EventOK) (SDL_EventOKParam, &event)) {
+ SDL_PushEvent(&event);
+ }
+ }
#endif /* !SDL_EVENTS_DISABLED */
- pNewJoystick->send_add_event = 0;
- }
- device_index++;
- pNewJoystick = pNewJoystick->pNext;
- }
- }
+ pNewJoystick->send_add_event = 0;
+ }
+ device_index++;
+ pNewJoystick = pNewJoystick->pNext;
+ }
+ }
}
/* we need to poll if we have pending hotplug device changes or connected devices */
SDL_bool SDL_SYS_JoystickNeedsPolling()
{
- /* we have a new device or one was pulled, we need to think this frame please */
- if ( s_bDeviceAdded || s_bDeviceRemoved )
- return SDL_TRUE;
+ /* we have a new device or one was pulled, we need to think this frame please */
+ if ( s_bDeviceAdded || s_bDeviceRemoved )
+ return SDL_TRUE;
- return SDL_FALSE;
+ return SDL_FALSE;
}
/* Function to get the device-dependent name of a joystick */
const char *
SDL_SYS_JoystickNameForDeviceIndex(int device_index)
{
- JoyStick_DeviceData *device = SYS_Joystick;
+ JoyStick_DeviceData *device = SYS_Joystick;
- for (; device_index > 0; device_index--)
- device = device->pNext;
+ for (; device_index > 0; device_index--)
+ device = device->pNext;
- return device->joystickname;
+ return device->joystickname;
}
/* Function to perform the mapping between current device instance and this joysticks instance id */
SDL_JoystickID SDL_SYS_GetInstanceIdOfDeviceIndex(int device_index)
{
- JoyStick_DeviceData *device = SYS_Joystick;
- int index;
+ JoyStick_DeviceData *device = SYS_Joystick;
+ int index;
- for (index = device_index; index > 0; index--)
- device = device->pNext;
+ for (index = device_index; index > 0; index--)
+ device = device->pNext;
- return device->nInstanceID;
+ return device->nInstanceID;
}
/* Function to open a joystick for use.
@@ -941,17 +941,17 @@ SDL_SYS_JoystickOpen(SDL_Joystick * joystick, int device_index)
HRESULT result;
LPDIRECTINPUTDEVICE8 device;
DIPROPDWORD dipdw;
- JoyStick_DeviceData *joystickdevice = SYS_Joystick;
+ JoyStick_DeviceData *joystickdevice = SYS_Joystick;
- for (; device_index > 0; device_index--)
- joystickdevice = joystickdevice->pNext;
+ for (; device_index > 0; device_index--)
+ joystickdevice = joystickdevice->pNext;
SDL_memset(&dipdw, 0, sizeof(DIPROPDWORD));
dipdw.diph.dwSize = sizeof(DIPROPDWORD);
dipdw.diph.dwHeaderSize = sizeof(DIPROPHEADER);
/* allocate memory for system specific hardware data */
- joystick->instance_id = joystickdevice->nInstanceID;
+ joystick->instance_id = joystickdevice->nInstanceID;
joystick->closed = 0;
joystick->hwdata =
(struct joystick_hwdata *) SDL_malloc(sizeof(struct joystick_hwdata));
@@ -960,194 +960,194 @@ SDL_SYS_JoystickOpen(SDL_Joystick * joystick, int device_index)
}
SDL_memset(joystick->hwdata, 0, sizeof(struct joystick_hwdata));
joystick->hwdata->buffered = 1;
- joystick->hwdata->removed = 0;
+ joystick->hwdata->removed = 0;
joystick->hwdata->Capabilities.dwSize = sizeof(DIDEVCAPS);
- joystick->hwdata->guid = joystickdevice->guid;
-
- if ( joystickdevice->bXInputDevice )
- {
- XINPUT_CAPABILITIES capabilities;
- Uint8 userId = 0;
- DWORD result;
- JoyStick_DeviceData *joysticklist = SYS_Joystick;
- // scan the opened joysticks and pick the next free xinput userid for this one
- for( ; joysticklist; joysticklist = joysticklist->pNext)
- {
- if ( joysticklist->bXInputDevice && joysticklist->XInputUserId == userId )
- userId++;
- }
-
- if ( s_bXInputEnabled && XINPUTGETCAPABILITIES )
- {
- result = XINPUTGETCAPABILITIES( userId, XINPUT_FLAG_GAMEPAD, &capabilities );
- if ( result == ERROR_SUCCESS )
- {
+ joystick->hwdata->guid = joystickdevice->guid;
+
+ if ( joystickdevice->bXInputDevice )
+ {
+ XINPUT_CAPABILITIES capabilities;
+ Uint8 userId = 0;
+ DWORD result;
+ JoyStick_DeviceData *joysticklist = SYS_Joystick;
+ /* scan the opened joysticks and pick the next free xinput userid for this one */
+ for( ; joysticklist; joysticklist = joysticklist->pNext)
+ {
+ if ( joysticklist->bXInputDevice && joysticklist->XInputUserId == userId )
+ userId++;
+ }
+
+ if ( s_bXInputEnabled && XINPUTGETCAPABILITIES )
+ {
+ result = XINPUTGETCAPABILITIES( userId, XINPUT_FLAG_GAMEPAD, &capabilities );
+ if ( result == ERROR_SUCCESS )
+ {
const SDL_bool bIs14OrLater = (SDL_XInputVersion >= ((1<<16)|4));
- SDL_bool bIsSupported = SDL_FALSE;
- // Current version of XInput mistakenly returns 0 as the Type. Ignore it and ensure the subtype is a gamepad.
- bIsSupported = ( capabilities.SubType == XINPUT_DEVSUBTYPE_GAMEPAD );
-
- if ( !bIsSupported )
- {
- joystickdevice->bXInputDevice = SDL_FALSE;
- }
- else
- {
- // valid
- joystick->hwdata->bXInputDevice = SDL_TRUE;
+ SDL_bool bIsSupported = SDL_FALSE;
+ /* Current version of XInput mistakenly returns 0 as the Type. Ignore it and ensure the subtype is a gamepad. */
+ bIsSupported = ( capabilities.SubType == XINPUT_DEVSUBTYPE_GAMEPAD );
+
+ if ( !bIsSupported )
+ {
+ joystickdevice->bXInputDevice = SDL_FALSE;
+ }
+ else
+ {
+ /* valid */
+ joystick->hwdata->bXInputDevice = SDL_TRUE;
if ((!bIs14OrLater) || (capabilities.Flags & XINPUT_CAPS_FFB_SUPPORTED)) {
- joystick->hwdata->bXInputHaptic = SDL_TRUE;
+ joystick->hwdata->bXInputHaptic = SDL_TRUE;
}
- SDL_memset( joystick->hwdata->XInputState, 0x0, sizeof(joystick->hwdata->XInputState) );
- joystickdevice->XInputUserId = userId;
- joystick->hwdata->userid = userId;
- joystick->hwdata->currentXInputSlot = 0;
- // The XInput API has a hard coded button/axis mapping, so we just match it
- joystick->naxes = 6;
- joystick->nbuttons = 15;
- joystick->nballs = 0;
- joystick->nhats = 0;
- }
- }
- else
- {
- joystickdevice->bXInputDevice = SDL_FALSE;
- }
- }
- else
- {
- joystickdevice->bXInputDevice = SDL_FALSE;
- }
- }
-
- if ( joystickdevice->bXInputDevice == SDL_FALSE )
- {
- joystick->hwdata->bXInputDevice = SDL_FALSE;
-
- result =
- IDirectInput8_CreateDevice(dinput,
- &(joystickdevice->dxdevice.guidInstance), &device, NULL);
- if (FAILED(result)) {
- return SetDIerror("IDirectInput::CreateDevice", result);
- }
-
- /* Now get the IDirectInputDevice8 interface, instead. */
- result = IDirectInputDevice8_QueryInterface(device,
- &IID_IDirectInputDevice8,
- (LPVOID *) & joystick->
- hwdata->InputDevice);
- /* We are done with this object. Use the stored one from now on. */
- IDirectInputDevice8_Release(device);
-
- if (FAILED(result)) {
- return SetDIerror("IDirectInputDevice8::QueryInterface", result);
- }
-
- /* Acquire shared access. Exclusive access is required for forces,
- * though. */
- result =
- IDirectInputDevice8_SetCooperativeLevel(joystick->hwdata->
- InputDevice, SDL_HelperWindow,
- DISCL_NONEXCLUSIVE |
- DISCL_BACKGROUND);
- if (FAILED(result)) {
- return SetDIerror("IDirectInputDevice8::SetCooperativeLevel", result);
- }
-
- /* Use the extended data structure: DIJOYSTATE2. */
- result =
- IDirectInputDevice8_SetDataFormat(joystick->hwdata->InputDevice,
- &c_dfDIJoystick2);
- if (FAILED(result)) {
- return SetDIerror("IDirectInputDevice8::SetDataFormat", result);
- }
-
- /* Get device capabilities */
- result =
- IDirectInputDevice8_GetCapabilities(joystick->hwdata->InputDevice,
- &joystick->hwdata->Capabilities);
-
- if (FAILED(result)) {
- return SetDIerror("IDirectInputDevice8::GetCapabilities", result);
- }
-
- /* Force capable? */
- if (joystick->hwdata->Capabilities.dwFlags & DIDC_FORCEFEEDBACK) {
-
- result = IDirectInputDevice8_Acquire(joystick->hwdata->InputDevice);
-
- if (FAILED(result)) {
- return SetDIerror("IDirectInputDevice8::Acquire", result);
- }
-
- /* reset all accuators. */
- result =
- IDirectInputDevice8_SendForceFeedbackCommand(joystick->hwdata->
- InputDevice,
- DISFFC_RESET);
-
- /* Not necessarily supported, ignore if not supported.
- if (FAILED(result)) {
- return SetDIerror("IDirectInputDevice8::SendForceFeedbackCommand", result);
- }
- */
-
- result = IDirectInputDevice8_Unacquire(joystick->hwdata->InputDevice);
-
- if (FAILED(result)) {
- return SetDIerror("IDirectInputDevice8::Unacquire", result);
- }
-
- /* Turn on auto-centering for a ForceFeedback device (until told
- * otherwise). */
- dipdw.diph.dwObj = 0;
- dipdw.diph.dwHow = DIPH_DEVICE;
- dipdw.dwData = DIPROPAUTOCENTER_ON;
-
- result =
- IDirectInputDevice8_SetProperty(joystick->hwdata->InputDevice,
- DIPROP_AUTOCENTER, &dipdw.diph);
-
- /* Not necessarily supported, ignore if not supported.
- if (FAILED(result)) {
- return SetDIerror("IDirectInputDevice8::SetProperty", result);
- }
- */
- }
-
- /* What buttons and axes does it have? */
- IDirectInputDevice8_EnumObjects(joystick->hwdata->InputDevice,
- EnumDevObjectsCallback, joystick,
- DIDFT_BUTTON | DIDFT_AXIS | DIDFT_POV);
-
- /* Reorder the input objects. Some devices do not report the X axis as
- * the first axis, for example. */
- SortDevObjects(joystick);
-
- dipdw.diph.dwObj = 0;
- dipdw.diph.dwHow = DIPH_DEVICE;
- dipdw.dwData = INPUT_QSIZE;
-
- /* Set the buffer size */
- result =
- IDirectInputDevice8_SetProperty(joystick->hwdata->InputDevice,
- DIPROP_BUFFERSIZE, &dipdw.diph);
-
- if (result == DI_POLLEDDEVICE) {
- /* This device doesn't support buffering, so we're forced
- * to use less reliable polling. */
- joystick->hwdata->buffered = 0;
- } else if (FAILED(result)) {
- return SetDIerror("IDirectInputDevice8::SetProperty", result);
- }
- }
+ SDL_memset( joystick->hwdata->XInputState, 0x0, sizeof(joystick->hwdata->XInputState) );
+ joystickdevice->XInputUserId = userId;
+ joystick->hwdata->userid = userId;
+ joystick->hwdata->currentXInputSlot = 0;
+ /* The XInput API has a hard coded button/axis mapping, so we just match it */
+ joystick->naxes = 6;
+ joystick->nbuttons = 15;
+ joystick->nballs = 0;
+ joystick->nhats = 0;
+ }
+ }
+ else
+ {
+ joystickdevice->bXInputDevice = SDL_FALSE;
+ }
+ }
+ else
+ {
+ joystickdevice->bXInputDevice = SDL_FALSE;
+ }
+ }
+
+ if ( joystickdevice->bXInputDevice == SDL_FALSE )
+ {
+ joystick->hwdata->bXInputDevice = SDL_FALSE;
+
+ result =
+ IDirectInput8_CreateDevice(dinput,
+ &(joystickdevice->dxdevice.guidInstance), &device, NULL);
+ if (FAILED(result)) {
+ return SetDIerror("IDirectInput::CreateDevice", result);
+ }
+
+ /* Now get the IDirectInputDevice8 interface, instead. */
+ result = IDirectInputDevice8_QueryInterface(device,
+ &IID_IDirectInputDevice8,
+ (LPVOID *) & joystick->
+ hwdata->InputDevice);
+ /* We are done with this object. Use the stored one from now on. */
+ IDirectInputDevice8_Release(device);
+
+ if (FAILED(result)) {
+ return SetDIerror("IDirectInputDevice8::QueryInterface", result);
+ }
+
+ /* Acquire shared access. Exclusive access is required for forces,
+ * though. */
+ result =
+ IDirectInputDevice8_SetCooperativeLevel(joystick->hwdata->
+ InputDevice, SDL_HelperWindow,
+ DISCL_NONEXCLUSIVE |
+ DISCL_BACKGROUND);
+ if (FAILED(result)) {
+ return SetDIerror("IDirectInputDevice8::SetCooperativeLevel", result);
+ }
+
+ /* Use the extended data structure: DIJOYSTATE2. */
+ result =
+ IDirectInputDevice8_SetDataFormat(joystick->hwdata->InputDevice,
+ &c_dfDIJoystick2);
+ if (FAILED(result)) {
+ return SetDIerror("IDirectInputDevice8::SetDataFormat", result);
+ }
+
+ /* Get device capabilities */
+ result =
+ IDirectInputDevice8_GetCapabilities(joystick->hwdata->InputDevice,
+ &joystick->hwdata->Capabilities);
+
+ if (FAILED(result)) {
+ return SetDIerror("IDirectInputDevice8::GetCapabilities", result);
+ }
+
+ /* Force capable? */
+ if (joystick->hwdata->Capabilities.dwFlags & DIDC_FORCEFEEDBACK) {
+
+ result = IDirectInputDevice8_Acquire(joystick->hwdata->InputDevice);
+
+ if (FAILED(result)) {
+ return SetDIerror("IDirectInputDevice8::Acquire", result);
+ }
+
+ /* reset all accuators. */
+ result =
+ IDirectInputDevice8_SendForceFeedbackCommand(joystick->hwdata->
+ InputDevice,
+ DISFFC_RESET);
+
+ /* Not necessarily supported, ignore if not supported.
+ if (FAILED(result)) {
+ return SetDIerror("IDirectInputDevice8::SendForceFeedbackCommand", result);
+ }
+ */
+
+ result = IDirectInputDevice8_Unacquire(joystick->hwdata->InputDevice);
+
+ if (FAILED(result)) {
+ return SetDIerror("IDirectInputDevice8::Unacquire", result);
+ }
+
+ /* Turn on auto-centering for a ForceFeedback device (until told
+ * otherwise). */
+ dipdw.diph.dwObj = 0;
+ dipdw.diph.dwHow = DIPH_DEVICE;
+ dipdw.dwData = DIPROPAUTOCENTER_ON;
+
+ result =
+ IDirectInputDevice8_SetProperty(joystick->hwdata->InputDevice,
+ DIPROP_AUTOCENTER, &dipdw.diph);
+
+ /* Not necessarily supported, ignore if not supported.
+ if (FAILED(result)) {
+ return SetDIerror("IDirectInputDevice8::SetProperty", result);
+ }
+ */
+ }
+
+ /* What buttons and axes does it have? */
+ IDirectInputDevice8_EnumObjects(joystick->hwdata->InputDevice,
+ EnumDevObjectsCallback, joystick,
+ DIDFT_BUTTON | DIDFT_AXIS | DIDFT_POV);
+
+ /* Reorder the input objects. Some devices do not report the X axis as
+ * the first axis, for example. */
+ SortDevObjects(joystick);
+
+ dipdw.diph.dwObj = 0;
+ dipdw.diph.dwHow = DIPH_DEVICE;
+ dipdw.dwData = INPUT_QSIZE;
+
+ /* Set the buffer size */
+ result =
+ IDirectInputDevice8_SetProperty(joystick->hwdata->InputDevice,
+ DIPROP_BUFFERSIZE, &dipdw.diph);
+
+ if (result == DI_POLLEDDEVICE) {
+ /* This device doesn't support buffering, so we're forced
+ * to use less reliable polling. */
+ joystick->hwdata->buffered = 0;
+ } else if (FAILED(result)) {
+ return SetDIerror("IDirectInputDevice8::SetProperty", result);
+ }
+ }
return (0);
}
/* return true if this joystick is plugged in right now */
SDL_bool SDL_SYS_JoystickAttached( SDL_Joystick * joystick )
{
- return joystick->closed == 0 && joystick->hwdata->removed == 0;
+ return joystick->closed == 0 && joystick->hwdata->removed == 0;
}
@@ -1156,48 +1156,48 @@ SDL_bool SDL_SYS_JoystickAttached( SDL_Joystick * joystick )
static int
SortDevFunc(const void *a, const void *b)
{
- const input_t *inputA = (const input_t*)a;
- const input_t *inputB = (const input_t*)b;
-
- if (inputA->ofs < inputB->ofs)
- return -1;
- if (inputA->ofs > inputB->ofs)
- return 1;
- return 0;
+ const input_t *inputA = (const input_t*)a;
+ const input_t *inputB = (const input_t*)b;
+
+ if (inputA->ofs < inputB->ofs)
+ return -1;
+ if (inputA->ofs > inputB->ofs)
+ return 1;
+ return 0;
}
/* Sort the input objects and recalculate the indices for each input. */
static void
SortDevObjects(SDL_Joystick *joystick)
{
- input_t *inputs = joystick->hwdata->Inputs;
- int nButtons = 0;
- int nHats = 0;
- int nAxis = 0;
- int n;
-
- SDL_qsort(inputs, joystick->hwdata->NumInputs, sizeof(input_t), SortDevFunc);
-
- for (n = 0; n < joystick->hwdata->NumInputs; n++)
- {
- switch (inputs[n].type)
- {
- case BUTTON:
- inputs[n].num = nButtons;
- nButtons++;
- break;
-
- case HAT:
- inputs[n].num = nHats;
- nHats++;
- break;
-
- case AXIS:
- inputs[n].num = nAxis;
- nAxis++;
- break;
- }
- }
+ input_t *inputs = joystick->hwdata->Inputs;
+ int nButtons = 0;
+ int nHats = 0;
+ int nAxis = 0;
+ int n;
+
+ SDL_qsort(inputs, joystick->hwdata->NumInputs, sizeof(input_t), SortDevFunc);
+
+ for (n = 0; n < joystick->hwdata->NumInputs; n++)
+ {
+ switch (inputs[n].type)
+ {
+ case BUTTON:
+ inputs[n].num = nButtons;
+ nButtons++;
+ break;
+
+ case HAT:
+ inputs[n].num = nHats;
+ nHats++;
+ break;
+
+ case AXIS:
+ inputs[n].num = nAxis;
+ nAxis++;
+ break;
+ }
+ }
}
static BOOL CALLBACK
@@ -1210,12 +1210,12 @@ EnumDevObjectsCallback(LPCDIDEVICEOBJECTINSTANCE dev, LPVOID pvRef)
if (dev->dwType & DIDFT_BUTTON) {
in->type = BUTTON;
in->num = joystick->nbuttons;
- in->ofs = DIJOFS_BUTTON( in->num );
+ in->ofs = DIJOFS_BUTTON( in->num );
joystick->nbuttons++;
} else if (dev->dwType & DIDFT_POV) {
in->type = HAT;
in->num = joystick->nhats;
- in->ofs = DIJOFS_POV( in->num );
+ in->ofs = DIJOFS_POV( in->num );
joystick->nhats++;
} else if (dev->dwType & DIDFT_AXIS) {
DIPROPRANGE diprg;
@@ -1223,28 +1223,28 @@ EnumDevObjectsCallback(LPCDIDEVICEOBJECTINSTANCE dev, LPVOID pvRef)
in->type = AXIS;
in->num = joystick->naxes;
- // work our the axis this guy maps too, thanks for the code icculus!
- if ( !SDL_memcmp( &dev->guidType, &GUID_XAxis, sizeof(dev->guidType) ) )
- in->ofs = DIJOFS_X;
- else if ( !SDL_memcmp( &dev->guidType, &GUID_YAxis, sizeof(dev->guidType) ) )
- in->ofs = DIJOFS_Y;
- else if ( !SDL_memcmp( &dev->guidType, &GUID_ZAxis, sizeof(dev->guidType) ) )
- in->ofs = DIJOFS_Z;
- else if ( !SDL_memcmp( &dev->guidType, &GUID_RxAxis, sizeof(dev->guidType) ) )
- in->ofs = DIJOFS_RX;
- else if ( !SDL_memcmp( &dev->guidType, &GUID_RyAxis, sizeof(dev->guidType) ) )
- in->ofs = DIJOFS_RY;
- else if ( !SDL_memcmp( &dev->guidType, &GUID_RzAxis, sizeof(dev->guidType) ) )
- in->ofs = DIJOFS_RZ;
- else if ( !SDL_memcmp( &dev->guidType, &GUID_Slider, sizeof(dev->guidType) ) )
- {
- in->ofs = DIJOFS_SLIDER( joystick->hwdata->NumSliders );
- ++joystick->hwdata->NumSliders;
- }
- else
- {
- return DIENUM_CONTINUE; // not an axis we can grok
- }
+ /* work our the axis this guy maps too, thanks for the code icculus! */
+ if ( !SDL_memcmp( &dev->guidType, &GUID_XAxis, sizeof(dev->guidType) ) )
+ in->ofs = DIJOFS_X;
+ else if ( !SDL_memcmp( &dev->guidType, &GUID_YAxis, sizeof(dev->guidType) ) )
+ in->ofs = DIJOFS_Y;
+ else if ( !SDL_memcmp( &dev->guidType, &GUID_ZAxis, sizeof(dev->guidType) ) )
+ in->ofs = DIJOFS_Z;
+ else if ( !SDL_memcmp( &dev->guidType, &GUID_RxAxis, sizeof(dev->guidType) ) )
+ in->ofs = DIJOFS_RX;
+ else if ( !SDL_memcmp( &dev->guidType, &GUID_RyAxis, sizeof(dev->guidType) ) )
+ in->ofs = DIJOFS_RY;
+ else if ( !SDL_memcmp( &dev->guidType, &GUID_RzAxis, sizeof(dev->guidType) ) )
+ in->ofs = DIJOFS_RZ;
+ else if ( !SDL_memcmp( &dev->guidType, &GUID_Slider, sizeof(dev->guidType) ) )
+ {
+ in->ofs = DIJOFS_SLIDER( joystick->hwdata->NumSliders );
+ ++joystick->hwdata->NumSliders;
+ }
+ else
+ {
+ return DIENUM_CONTINUE; /* not an axis we can grok */
+ }
diprg.diph.dwSize = sizeof(diprg);
diprg.diph.dwHeaderSize = sizeof(diprg.diph);
@@ -1310,12 +1310,12 @@ SDL_SYS_JoystickUpdate_Polled(SDL_Joystick * joystick)
sizeof(DIJOYSTATE2), &state);
}
- if ( result != DI_OK )
- {
- joystick->hwdata->send_remove_event = 1;
- joystick->hwdata->removed = 1;
- return;
- }
+ if ( result != DI_OK )
+ {
+ joystick->hwdata->send_remove_event = 1;
+ joystick->hwdata->removed = 1;
+ return;
+ }
/* Set each known axis, button and POV. */
for (i = 0; i < joystick->hwdata->NumInputs; ++i) {
@@ -1402,11 +1402,11 @@ SDL_SYS_JoystickUpdate_Buffered(SDL_Joystick * joystick)
/* Handle the events or punt */
if (FAILED(result))
- {
- joystick->hwdata->send_remove_event = 1;
- joystick->hwdata->removed = 1;
+ {
+ joystick->hwdata->send_remove_event = 1;
+ joystick->hwdata->removed = 1;
return;
- }
+ }
for (i = 0; i < (int) numevents; ++i) {
int j;
@@ -1443,7 +1443,7 @@ SDL_SYS_JoystickUpdate_Buffered(SDL_Joystick * joystick)
*/
int ButtonChanged( int ButtonsNow, int ButtonsPrev, int ButtonMask )
{
- return ( ButtonsNow & ButtonMask ) != ( ButtonsPrev & ButtonMask );
+ return ( ButtonsNow & ButtonMask ) != ( ButtonsPrev & ButtonMask );
}
/* Function to update the state of a XInput style joystick.
@@ -1451,67 +1451,67 @@ int ButtonChanged( int ButtonsNow, int ButtonsPrev, int ButtonMask )
void
SDL_SYS_JoystickUpdate_XInput(SDL_Joystick * joystick)
{
- HRESULT result;
-
- if ( !XINPUTGETSTATE )
- return;
-
- result = XINPUTGETSTATE( joystick->hwdata->userid, &joystick->hwdata->XInputState[joystick->hwdata->currentXInputSlot] );
- if ( result == ERROR_DEVICE_NOT_CONNECTED )
- {
- joystick->hwdata->send_remove_event = 1;
- joystick->hwdata->removed = 1;
- return;
- }
-
- // only fire events if the data changed from last time
- if ( joystick->hwdata->XInputState[joystick->hwdata->currentXInputSlot].dwPacketNumber != 0
- && joystick->hwdata->XInputState[joystick->hwdata->currentXInputSlot].dwPacketNumber != joystick->hwdata->XInputState[joystick->hwdata->currentXInputSlot^1].dwPacketNumber )
- {
- XINPUT_STATE_EX *pXInputState = &joystick->hwdata->XInputState[joystick->hwdata->currentXInputSlot];
- XINPUT_STATE_EX *pXInputStatePrev = &joystick->hwdata->XInputState[joystick->hwdata->currentXInputSlot ^ 1];
-
- SDL_PrivateJoystickAxis(joystick, 0, (Sint16)pXInputState->Gamepad.sThumbLX );
- SDL_PrivateJoystickAxis(joystick, 1, (Sint16)(-1*pXInputState->Gamepad.sThumbLY-1) );
- SDL_PrivateJoystickAxis(joystick, 2, (Sint16)pXInputState->Gamepad.sThumbRX );
- SDL_PrivateJoystickAxis(joystick, 3, (Sint16)(-1*pXInputState->Gamepad.sThumbRY-1) );
- SDL_PrivateJoystickAxis(joystick, 4, (Sint16)((int)pXInputState->Gamepad.bLeftTrigger*32767/255) );
- SDL_PrivateJoystickAxis(joystick, 5, (Sint16)((int)pXInputState->Gamepad.bRightTrigger*32767/255) );
-
- if ( ButtonChanged( pXInputState->Gamepad.wButtons, pXInputStatePrev->Gamepad.wButtons, XINPUT_GAMEPAD_DPAD_UP ) )
- SDL_PrivateJoystickButton(joystick, 0, pXInputState->Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_UP ? SDL_PRESSED : SDL_RELEASED );
- if ( ButtonChanged( pXInputState->Gamepad.wButtons, pXInputStatePrev->Gamepad.wButtons, XINPUT_GAMEPAD_DPAD_DOWN ) )
- SDL_PrivateJoystickButton(joystick, 1, pXInputState->Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_DOWN ? SDL_PRESSED : SDL_RELEASED );
- if ( ButtonChanged( pXInputState->Gamepad.wButtons, pXInputStatePrev->Gamepad.wButtons, XINPUT_GAMEPAD_DPAD_LEFT ) )
- SDL_PrivateJoystickButton(joystick, 2, pXInputState->Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_LEFT ? SDL_PRESSED : SDL_RELEASED );
- if ( ButtonChanged( pXInputState->Gamepad.wButtons, pXInputStatePrev->Gamepad.wButtons, XINPUT_GAMEPAD_DPAD_RIGHT ) )
- SDL_PrivateJoystickButton(joystick, 3, pXInputState->Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_RIGHT ? SDL_PRESSED : SDL_RELEASED );
- if ( ButtonChanged( pXInputState->Gamepad.wButtons, pXInputStatePrev->Gamepad.wButtons, XINPUT_GAMEPAD_START ) )
- SDL_PrivateJoystickButton(joystick, 4, pXInputState->Gamepad.wButtons & XINPUT_GAMEPAD_START ? SDL_PRESSED : SDL_RELEASED );
- if ( ButtonChanged( pXInputState->Gamepad.wButtons, pXInputStatePrev->Gamepad.wButtons, XINPUT_GAMEPAD_BACK ) )
- SDL_PrivateJoystickButton(joystick, 5, pXInputState->Gamepad.wButtons & XINPUT_GAMEPAD_BACK ? SDL_PRESSED : SDL_RELEASED );
- if ( ButtonChanged( pXInputState->Gamepad.wButtons, pXInputStatePrev->Gamepad.wButtons, XINPUT_GAMEPAD_LEFT_THUMB ) )
- SDL_PrivateJoystickButton(joystick, 6, pXInputState->Gamepad.wButtons & XINPUT_GAMEPAD_LEFT_THUMB ? SDL_PRESSED : SDL_RELEASED );
- if ( ButtonChanged( pXInputState->Gamepad.wButtons, pXInputStatePrev->Gamepad.wButtons, XINPUT_GAMEPAD_RIGHT_THUMB ) )
- SDL_PrivateJoystickButton(joystick, 7, pXInputState->Gamepad.wButtons & XINPUT_GAMEPAD_RIGHT_THUMB ? SDL_PRESSED : SDL_RELEASED );
- if ( ButtonChanged( pXInputState->Gamepad.wButtons, pXInputStatePrev->Gamepad.wButtons, XINPUT_GAMEPAD_LEFT_SHOULDER ) )
- SDL_PrivateJoystickButton(joystick, 8, pXInputState->Gamepad.wButtons & XINPUT_GAMEPAD_LEFT_SHOULDER ? SDL_PRESSED : SDL_RELEASED );
- if ( ButtonChanged( pXInputState->Gamepad.wButtons, pXInputStatePrev->Gamepad.wButtons, XINPUT_GAMEPAD_RIGHT_SHOULDER ) )
- SDL_PrivateJoystickButton(joystick, 9, pXInputState->Gamepad.wButtons & XINPUT_GAMEPAD_RIGHT_SHOULDER ? SDL_PRESSED : SDL_RELEASED );
- if ( ButtonChanged( pXInputState->Gamepad.wButtons, pXInputStatePrev->Gamepad.wButtons, XINPUT_GAMEPAD_A ) )
- SDL_PrivateJoystickButton(joystick, 10, pXInputState->Gamepad.wButtons & XINPUT_GAMEPAD_A ? SDL_PRESSED : SDL_RELEASED );
- if ( ButtonChanged( pXInputState->Gamepad.wButtons, pXInputStatePrev->Gamepad.wButtons, XINPUT_GAMEPAD_B ) )
- SDL_PrivateJoystickButton(joystick, 11, pXInputState->Gamepad.wButtons & XINPUT_GAMEPAD_B ? SDL_PRESSED : SDL_RELEASED );
- if ( ButtonChanged( pXInputState->Gamepad.wButtons, pXInputStatePrev->Gamepad.wButtons, XINPUT_GAMEPAD_X ) )
- SDL_PrivateJoystickButton(joystick, 12, pXInputState->Gamepad.wButtons & XINPUT_GAMEPAD_X ? SDL_PRESSED : SDL_RELEASED );
- if ( ButtonChanged( pXInputState->Gamepad.wButtons, pXInputStatePrev->Gamepad.wButtons, XINPUT_GAMEPAD_Y ) )
- SDL_PrivateJoystickButton(joystick, 13, pXInputState->Gamepad.wButtons & XINPUT_GAMEPAD_Y ? SDL_PRESSED : SDL_RELEASED );
- if ( ButtonChanged( pXInputState->Gamepad.wButtons, pXInputStatePrev->Gamepad.wButtons, 0x400 ) )
- SDL_PrivateJoystickButton(joystick, 14, pXInputState->Gamepad.wButtons & 0x400 ? SDL_PRESSED : SDL_RELEASED ); // 0x400 is the undocumented code for the guide button
-
- joystick->hwdata->currentXInputSlot ^= 1;
-
- }
+ HRESULT result;
+
+ if ( !XINPUTGETSTATE )
+ return;
+
+ result = XINPUTGETSTATE( joystick->hwdata->userid, &joystick->hwdata->XInputState[joystick->hwdata->currentXInputSlot] );
+ if ( result == ERROR_DEVICE_NOT_CONNECTED )
+ {
+ joystick->hwdata->send_remove_event = 1;
+ joystick->hwdata->removed = 1;
+ return;
+ }
+
+ /* only fire events if the data changed from last time */
+ if ( joystick->hwdata->XInputState[joystick->hwdata->currentXInputSlot].dwPacketNumber != 0
+ && joystick->hwdata->XInputState[joystick->hwdata->currentXInputSlot].dwPacketNumber != joystick->hwdata->XInputState[joystick->hwdata->currentXInputSlot^1].dwPacketNumber )
+ {
+ XINPUT_STATE_EX *pXInputState = &joystick->hwdata->XInputState[joystick->hwdata->currentXInputSlot];
+ XINPUT_STATE_EX *pXInputStatePrev = &joystick->hwdata->XInputState[joystick->hwdata->currentXInputSlot ^ 1];
+
+ SDL_PrivateJoystickAxis(joystick, 0, (Sint16)pXInputState->Gamepad.sThumbLX );
+ SDL_PrivateJoystickAxis(joystick, 1, (Sint16)(-1*pXInputState->Gamepad.sThumbLY-1) );
+ SDL_PrivateJoystickAxis(joystick, 2, (Sint16)pXInputState->Gamepad.sThumbRX );
+ SDL_PrivateJoystickAxis(joystick, 3, (Sint16)(-1*pXInputState->Gamepad.sThumbRY-1) );
+ SDL_PrivateJoystickAxis(joystick, 4, (Sint16)((int)pXInputState->Gamepad.bLeftTrigger*32767/255) );
+ SDL_PrivateJoystickAxis(joystick, 5, (Sint16)((int)pXInputState->Gamepad.bRightTrigger*32767/255) );
+
+ if ( ButtonChanged( pXInputState->Gamepad.wButtons, pXInputStatePrev->Gamepad.wButtons, XINPUT_GAMEPAD_DPAD_UP ) )
+ SDL_PrivateJoystickButton(joystick, 0, pXInputState->Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_UP ? SDL_PRESSED : SDL_RELEASED );
+ if ( ButtonChanged( pXInputState->Gamepad.wButtons, pXInputStatePrev->Gamepad.wButtons, XINPUT_GAMEPAD_DPAD_DOWN ) )
+ SDL_PrivateJoystickButton(joystick, 1, pXInputState->Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_DOWN ? SDL_PRESSED : SDL_RELEASED );
+ if ( ButtonChanged( pXInputState->Gamepad.wButtons, pXInputStatePrev->Gamepad.wButtons, XINPUT_GAMEPAD_DPAD_LEFT ) )
+ SDL_PrivateJoystickButton(joystick, 2, pXInputState->Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_LEFT ? SDL_PRESSED : SDL_RELEASED );
+ if ( ButtonChanged( pXInputState->Gamepad.wButtons, pXInputStatePrev->Gamepad.wButtons, XINPUT_GAMEPAD_DPAD_RIGHT ) )
+ SDL_PrivateJoystickButton(joystick, 3, pXInputState->Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_RIGHT ? SDL_PRESSED : SDL_RELEASED );
+ if ( ButtonChanged( pXInputState->Gamepad.wButtons, pXInputStatePrev->Gamepad.wButtons, XINPUT_GAMEPAD_START ) )
+ SDL_PrivateJoystickButton(joystick, 4, pXInputState->Gamepad.wButtons & XINPUT_GAMEPAD_START ? SDL_PRESSED : SDL_RELEASED );
+ if ( ButtonChanged( pXInputState->Gamepad.wButtons, pXInputStatePrev->Gamepad.wButtons, XINPUT_GAMEPAD_BACK ) )
+ SDL_PrivateJoystickButton(joystick, 5, pXInputState->Gamepad.wButtons & XINPUT_GAMEPAD_BACK ? SDL_PRESSED : SDL_RELEASED );
+ if ( ButtonChanged( pXInputState->Gamepad.wButtons, pXInputStatePrev->Gamepad.wButtons, XINPUT_GAMEPAD_LEFT_THUMB ) )
+ SDL_PrivateJoystickButton(joystick, 6, pXInputState->Gamepad.wButtons & XINPUT_GAMEPAD_LEFT_THUMB ? SDL_PRESSED : SDL_RELEASED );
+ if ( ButtonChanged( pXInputState->Gamepad.wButtons, pXInputStatePrev->Gamepad.wButtons, XINPUT_GAMEPAD_RIGHT_THUMB ) )
+ SDL_PrivateJoystickButton(joystick, 7, pXInputState->Gamepad.wButtons & XINPUT_GAMEPAD_RIGHT_THUMB ? SDL_PRESSED : SDL_RELEASED );
+ if ( ButtonChanged( pXInputState->Gamepad.wButtons, pXInputStatePrev->Gamepad.wButtons, XINPUT_GAMEPAD_LEFT_SHOULDER ) )
+ SDL_PrivateJoystickButton(joystick, 8, pXInputState->Gamepad.wButtons & XINPUT_GAMEPAD_LEFT_SHOULDER ? SDL_PRESSED : SDL_RELEASED );
+ if ( ButtonChanged( pXInputState->Gamepad.wButtons, pXInputStatePrev->Gamepad.wButtons, XINPUT_GAMEPAD_RIGHT_SHOULDER ) )
+ SDL_PrivateJoystickButton(joystick, 9, pXInputState->Gamepad.wButtons & XINPUT_GAMEPAD_RIGHT_SHOULDER ? SDL_PRESSED : SDL_RELEASED );
+ if ( ButtonChanged( pXInputState->Gamepad.wButtons, pXInputStatePrev->Gamepad.wButtons, XINPUT_GAMEPAD_A ) )
+ SDL_PrivateJoystickButton(joystick, 10, pXInputState->Gamepad.wButtons & XINPUT_GAMEPAD_A ? SDL_PRESSED : SDL_RELEASED );
+ if ( ButtonChanged( pXInputState->Gamepad.wButtons, pXInputStatePrev->Gamepad.wButtons, XINPUT_GAMEPAD_B ) )
+ SDL_PrivateJoystickButton(joystick, 11, pXInputState->Gamepad.wButtons & XINPUT_GAMEPAD_B ? SDL_PRESSED : SDL_RELEASED );
+ if ( ButtonChanged( pXInputState->Gamepad.wButtons, pXInputStatePrev->Gamepad.wButtons, XINPUT_GAMEPAD_X ) )
+ SDL_PrivateJoystickButton(joystick, 12, pXInputState->Gamepad.wButtons & XINPUT_GAMEPAD_X ? SDL_PRESSED : SDL_RELEASED );
+ if ( ButtonChanged( pXInputState->Gamepad.wButtons, pXInputStatePrev->Gamepad.wButtons, XINPUT_GAMEPAD_Y ) )
+ SDL_PrivateJoystickButton(joystick, 13, pXInputState->Gamepad.wButtons & XINPUT_GAMEPAD_Y ? SDL_PRESSED : SDL_RELEASED );
+ if ( ButtonChanged( pXInputState->Gamepad.wButtons, pXInputStatePrev->Gamepad.wButtons, 0x400 ) )
+ SDL_PrivateJoystickButton(joystick, 14, pXInputState->Gamepad.wButtons & 0x400 ? SDL_PRESSED : SDL_RELEASED ); /* 0x400 is the undocumented code for the guide button */
+
+ joystick->hwdata->currentXInputSlot ^= 1;
+
+ }
}
@@ -1575,94 +1575,94 @@ SDL_SYS_JoystickUpdate(SDL_Joystick * joystick)
{
HRESULT result;
- if ( joystick->closed || !joystick->hwdata )
- return;
-
- if (joystick->hwdata->bXInputDevice)
- {
- SDL_SYS_JoystickUpdate_XInput(joystick);
- }
- else
- {
- result = IDirectInputDevice8_Poll(joystick->hwdata->InputDevice);
- if (result == DIERR_INPUTLOST || result == DIERR_NOTACQUIRED) {
- IDirectInputDevice8_Acquire(joystick->hwdata->InputDevice);
- IDirectInputDevice8_Poll(joystick->hwdata->InputDevice);
- }
-
- if (joystick->hwdata->buffered)
- SDL_SYS_JoystickUpdate_Buffered(joystick);
- else
- SDL_SYS_JoystickUpdate_Polled(joystick);
- }
-
- if ( joystick->hwdata->removed )
- {
- joystick->closed = 1;
- joystick->uncentered = 1;
- }
+ if ( joystick->closed || !joystick->hwdata )
+ return;
+
+ if (joystick->hwdata->bXInputDevice)
+ {
+ SDL_SYS_JoystickUpdate_XInput(joystick);
+ }
+ else
+ {
+ result = IDirectInputDevice8_Poll(joystick->hwdata->InputDevice);
+ if (result == DIERR_INPUTLOST || result == DIERR_NOTACQUIRED) {
+ IDirectInputDevice8_Acquire(joystick->hwdata->InputDevice);
+ IDirectInputDevice8_Poll(joystick->hwdata->InputDevice);
+ }
+
+ if (joystick->hwdata->buffered)
+ SDL_SYS_JoystickUpdate_Buffered(joystick);
+ else
+ SDL_SYS_JoystickUpdate_Polled(joystick);
+ }
+
+ if ( joystick->hwdata->removed )
+ {
+ joystick->closed = 1;
+ joystick->uncentered = 1;
+ }
}
/* Function to close a joystick after use */
void
SDL_SYS_JoystickClose(SDL_Joystick * joystick)
{
- if ( joystick->hwdata->bXInputDevice )
- {
- JoyStick_DeviceData *joysticklist = SYS_Joystick;
- // scan the opened joysticks and clear the userid for this instance
- for( ; joysticklist; joysticklist = joysticklist->pNext)
- {
- if ( joysticklist->bXInputDevice && joysticklist->nInstanceID == joystick->instance_id )
- {
- joysticklist->XInputUserId = INVALID_XINPUT_USERID;
- }
- }
-
- }
- else
- {
- IDirectInputDevice8_Unacquire(joystick->hwdata->InputDevice);
- IDirectInputDevice8_Release(joystick->hwdata->InputDevice);
- }
+ if ( joystick->hwdata->bXInputDevice )
+ {
+ JoyStick_DeviceData *joysticklist = SYS_Joystick;
+ /* scan the opened joysticks and clear the userid for this instance */
+ for( ; joysticklist; joysticklist = joysticklist->pNext)
+ {
+ if ( joysticklist->bXInputDevice && joysticklist->nInstanceID == joystick->instance_id )
+ {
+ joysticklist->XInputUserId = INVALID_XINPUT_USERID;
+ }
+ }
+
+ }
+ else
+ {
+ IDirectInputDevice8_Unacquire(joystick->hwdata->InputDevice);
+ IDirectInputDevice8_Release(joystick->hwdata->InputDevice);
+ }
if (joystick->hwdata != NULL) {
/* free system specific hardware data */
SDL_free(joystick->hwdata);
}
- joystick->closed = 1;
+ joystick->closed = 1;
}
/* Function to perform any system-specific joystick related cleanup */
void
SDL_SYS_JoystickQuit(void)
{
- JoyStick_DeviceData *device = SYS_Joystick;
-
- while ( device )
- {
- JoyStick_DeviceData *device_next = device->pNext;
- SDL_free(device->joystickname);
- SDL_free(device);
- device = device_next;
- }
- SYS_Joystick = NULL;
-
- if ( s_threadJoystick )
- {
- SDL_LockMutex( s_mutexJoyStickEnum );
- s_bJoystickThreadQuit = SDL_TRUE;
- SDL_CondBroadcast( s_condJoystickThread ); // signal the joystick thread to quit
- SDL_UnlockMutex( s_mutexJoyStickEnum );
- SDL_WaitThread( s_threadJoystick, NULL ); // wait for it to bugger off
-
- SDL_DestroyMutex( s_mutexJoyStickEnum );
- SDL_DestroyCond( s_condJoystickThread );
- s_condJoystickThread= NULL;
- s_mutexJoyStickEnum = NULL;
- s_threadJoystick = NULL;
- }
+ JoyStick_DeviceData *device = SYS_Joystick;
+
+ while ( device )
+ {
+ JoyStick_DeviceData *device_next = device->pNext;
+ SDL_free(device->joystickname);
+ SDL_free(device);
+ device = device_next;
+ }
+ SYS_Joystick = NULL;
+
+ if ( s_threadJoystick )
+ {
+ SDL_LockMutex( s_mutexJoyStickEnum );
+ s_bJoystickThreadQuit = SDL_TRUE;
+ SDL_CondBroadcast( s_condJoystickThread ); /* signal the joystick thread to quit */
+ SDL_UnlockMutex( s_mutexJoyStickEnum );
+ SDL_WaitThread( s_threadJoystick, NULL ); /* wait for it to bugger off */
+
+ SDL_DestroyMutex( s_mutexJoyStickEnum );
+ SDL_DestroyCond( s_condJoystickThread );
+ s_condJoystickThread= NULL;
+ s_mutexJoyStickEnum = NULL;
+ s_threadJoystick = NULL;
+ }
if (dinput != NULL) {
IDirectInput8_Release(dinput);
@@ -1674,11 +1674,11 @@ SDL_SYS_JoystickQuit(void)
coinitialized = SDL_FALSE;
}
- if ( s_pKnownJoystickGUIDs )
- {
- SDL_free( s_pKnownJoystickGUIDs );
- s_pKnownJoystickGUIDs = NULL;
- }
+ if ( s_pKnownJoystickGUIDs )
+ {
+ SDL_free( s_pKnownJoystickGUIDs );
+ s_pKnownJoystickGUIDs = NULL;
+ }
if (s_bXInputEnabled) {
WIN_UnloadXInputDLL();
@@ -1689,30 +1689,30 @@ SDL_SYS_JoystickQuit(void)
/* return the stable device guid for this device index */
SDL_JoystickGUID SDL_SYS_JoystickGetDeviceGUID( int device_index )
{
- JoyStick_DeviceData *device = SYS_Joystick;
- int index;
+ JoyStick_DeviceData *device = SYS_Joystick;
+ int index;
- for (index = device_index; index > 0; index--)
- device = device->pNext;
+ for (index = device_index; index > 0; index--)
+ device = device->pNext;
- return device->guid;
+ return device->guid;
}
SDL_JoystickGUID SDL_SYS_JoystickGetGUID(SDL_Joystick * joystick)
{
- return joystick->hwdata->guid;
+ return joystick->hwdata->guid;
}
/* return SDL_TRUE if this device is using XInput */
SDL_bool SDL_SYS_IsXInputDeviceIndex(int device_index)
{
- JoyStick_DeviceData *device = SYS_Joystick;
- int index;
+ JoyStick_DeviceData *device = SYS_Joystick;
+ int index;
- for (index = device_index; index > 0; index--)
- device = device->pNext;
+ for (index = device_index; index > 0; index--)
+ device = device->pNext;
- return device->bXInputDevice;
+ return device->bXInputDevice;
}
#endif /* SDL_JOYSTICK_DINPUT */
diff --git a/src/joystick/windows/SDL_dxjoystick_c.h b/src/joystick/windows/SDL_dxjoystick_c.h
index 564a566bb4..01cfca9705 100644
--- a/src/joystick/windows/SDL_dxjoystick_c.h
+++ b/src/joystick/windows/SDL_dxjoystick_c.h
@@ -23,10 +23,10 @@
#ifndef SDL_JOYSTICK_DINPUT_H
/* DirectInput joystick driver; written by Glenn Maynard, based on Andrei de
- * A. Formiga's WINMM driver.
+ * A. Formiga's WINMM driver.
*
* Hats and sliders are completely untested; the app I'm writing this for mostly
- * doesn't use them and I don't own any joysticks with them.
+ * doesn't use them and I don't own any joysticks with them.
*
* We don't bother to use event notification here. It doesn't seem to work
* with polled devices, and it's fine to call IDirectInputDevice2_GetDeviceData and
@@ -57,7 +57,7 @@ typedef struct
DWORD dwPaddingReserved;
} XINPUT_GAMEPAD_EX;
-typedef struct
+typedef struct
{
DWORD dwPacketNumber;
XINPUT_GAMEPAD_EX Gamepad;
@@ -65,23 +65,23 @@ typedef struct
/* Forward decl's for XInput API's we load dynamically and use if available */
typedef DWORD (WINAPI *XInputGetState_t)
- (
- DWORD dwUserIndex, // [in] Index of the gamer associated with the device
- XINPUT_STATE_EX* pState // [out] Receives the current state
- );
+ (
+ DWORD dwUserIndex, /* [in] Index of the gamer associated with the device */
+ XINPUT_STATE_EX* pState /* [out] Receives the current state */
+ );
typedef DWORD (WINAPI *XInputSetState_t)
- (
- DWORD dwUserIndex, // [in] Index of the gamer associated with the device
- XINPUT_VIBRATION* pVibration // [in, out] The vibration information to send to the controller
- );
+ (
+ DWORD dwUserIndex, /* [in] Index of the gamer associated with the device */
+ XINPUT_VIBRATION* pVibration /* [in, out] The vibration information to send to the controller */
+ );
typedef DWORD (WINAPI *XInputGetCapabilities_t)
- (
- DWORD dwUserIndex, // [in] Index of the gamer associated with the device
- DWORD dwFlags, // [in] Input flags that identify the device type
- XINPUT_CAPABILITIES* pCapabilities // [out] Receives the capabilities
- );
+ (
+ DWORD dwUserIndex, /* [in] Index of the gamer associated with the device */
+ DWORD dwFlags, /* [in] Input flags that identify the device type */
+ XINPUT_CAPABILITIES* pCapabilities /* [out] Receives the capabilities */
+ );
extern int WIN_LoadXInputDLL(void);
extern void WIN_UnloadXInputDLL(void);
@@ -89,11 +89,11 @@ extern void WIN_UnloadXInputDLL(void);
extern XInputGetState_t SDL_XInputGetState;
extern XInputSetState_t SDL_XInputSetState;
extern XInputGetCapabilities_t SDL_XInputGetCapabilities;
-extern DWORD SDL_XInputVersion; // ((major << 16) & 0xFF00) | (minor & 0xFF)
+extern DWORD SDL_XInputVersion; /* ((major << 16) & 0xFF00) | (minor & 0xFF) */
-#define XINPUTGETSTATE SDL_XInputGetState
-#define XINPUTSETSTATE SDL_XInputSetState
-#define XINPUTGETCAPABILITIES SDL_XInputGetCapabilities
+#define XINPUTGETSTATE SDL_XInputGetState
+#define XINPUTSETSTATE SDL_XInputSetState
+#define XINPUTGETCAPABILITIES SDL_XInputGetCapabilities
#define INVALID_XINPUT_USERID 255
#define SDL_XINPUT_MAX_DEVICES 4
@@ -102,7 +102,7 @@ extern DWORD SDL_XInputVersion; // ((major << 16) & 0xFF00) | (minor & 0xFF)
#endif
-#define MAX_INPUTS 256 /* each joystick can have up to 256 inputs */
+#define MAX_INPUTS 256 /* each joystick can have up to 256 inputs */
/* local types */
@@ -127,18 +127,18 @@ struct joystick_hwdata
LPDIRECTINPUTDEVICE8 InputDevice;
DIDEVCAPS Capabilities;
int buffered;
- SDL_JoystickGUID guid;
+ SDL_JoystickGUID guid;
input_t Inputs[MAX_INPUTS];
int NumInputs;
- int NumSliders;
- Uint8 removed;
- Uint8 send_remove_event;
- Uint8 bXInputDevice; // 1 if this device supports using the xinput API rather than DirectInput
- Uint8 bXInputHaptic; // Supports force feedback via XInput.
- Uint8 userid; // XInput userid index for this joystick
- Uint8 currentXInputSlot; // the current position to write to in XInputState below, used so we can compare old and new values
- XINPUT_STATE_EX XInputState[2];
+ int NumSliders;
+ Uint8 removed;
+ Uint8 send_remove_event;
+ Uint8 bXInputDevice; /* 1 if this device supports using the xinput API rather than DirectInput */
+ Uint8 bXInputHaptic; /* Supports force feedback via XInput. */
+ Uint8 userid; /* XInput userid index for this joystick */
+ Uint8 currentXInputSlot; /* the current position to write to in XInputState below, used so we can compare old and new values */
+ XINPUT_STATE_EX XInputState[2];
};
#endif /* SDL_JOYSTICK_DINPUT_H */
diff --git a/src/joystick/windows/SDL_mmjoystick.c b/src/joystick/windows/SDL_mmjoystick.c
index 73ad7fb955..413053f14d 100644
--- a/src/joystick/windows/SDL_mmjoystick.c
+++ b/src/joystick/windows/SDL_mmjoystick.c
@@ -33,14 +33,14 @@
#include "../SDL_sysjoystick.h"
#include "../SDL_joystick_c.h"
-#define MAX_JOYSTICKS 16
-#define MAX_AXES 6 /* each joystick can have up to 6 axes */
-#define MAX_BUTTONS 32 /* and 32 buttons */
-#define AXIS_MIN -32768 /* minimum value for axis coordinate */
-#define AXIS_MAX 32767 /* maximum value for axis coordinate */
+#define MAX_JOYSTICKS 16
+#define MAX_AXES 6 /* each joystick can have up to 6 axes */
+#define MAX_BUTTONS 32 /* and 32 buttons */
+#define AXIS_MIN -32768 /* minimum value for axis coordinate */
+#define AXIS_MAX 32767 /* maximum value for axis coordinate */
/* limit axis to 256 possible positions to filter out noise */
#define JOY_AXIS_THRESHOLD (((AXIS_MAX)-(AXIS_MIN))/256)
-#define JOY_BUTTON_FLAG(n) (1<<n)
+#define JOY_BUTTON_FLAG(n) (1<<n)
/* array to hold joystick ID values */
@@ -407,7 +407,7 @@ SDL_SYS_JoystickQuit(void)
SDL_JoystickGUID SDL_SYS_JoystickGetDeviceGUID( int device_index )
{
SDL_JoystickGUID guid;
- // the GUID is just the first 16 chars of the name for now
+ /* the GUID is just the first 16 chars of the name for now */
const char *name = SDL_SYS_JoystickNameForDeviceIndex( device_index );
SDL_zero( guid );
SDL_memcpy( &guid, name, SDL_min( sizeof(guid), SDL_strlen( name ) ) );
@@ -417,7 +417,7 @@ SDL_JoystickGUID SDL_SYS_JoystickGetDeviceGUID( int device_index )
SDL_JoystickGUID SDL_SYS_JoystickGetGUID(SDL_Joystick * joystick)
{
SDL_JoystickGUID guid;
- // the GUID is just the first 16 chars of the name for now
+ /* the GUID is just the first 16 chars of the name for now */
const char *name = joystick->name;
SDL_zero( guid );
SDL_memcpy( &guid, name, SDL_min( sizeof(guid), SDL_strlen( name ) ) );
diff --git a/src/main/beos/SDL_BApp.h b/src/main/beos/SDL_BApp.h
index 5bde94c183..2a64455b68 100644
--- a/src/main/beos/SDL_BApp.h
+++ b/src/main/beos/SDL_BApp.h
@@ -54,24 +54,24 @@ class SDL_BWin;
/* Message constants */
enum ToSDL {
- /* Intercepted by BWindow on its way to BView */
- BAPP_MOUSE_MOVED,
- BAPP_MOUSE_BUTTON,
- BAPP_MOUSE_WHEEL,
- BAPP_KEY,
- BAPP_REPAINT, /* from _UPDATE_ */
- /* From BWindow */
- BAPP_MAXIMIZE, /* from B_ZOOM */
- BAPP_MINIMIZE,
- BAPP_RESTORE, /* TODO: IMPLEMENT! */
- BAPP_SHOW,
- BAPP_HIDE,
- BAPP_MOUSE_FOCUS, /* caused by MOUSE_MOVE */
- BAPP_KEYBOARD_FOCUS, /* from WINDOW_ACTIVATED */
- BAPP_WINDOW_CLOSE_REQUESTED,
- BAPP_WINDOW_MOVED,
- BAPP_WINDOW_RESIZED,
- BAPP_SCREEN_CHANGED
+ /* Intercepted by BWindow on its way to BView */
+ BAPP_MOUSE_MOVED,
+ BAPP_MOUSE_BUTTON,
+ BAPP_MOUSE_WHEEL,
+ BAPP_KEY,
+ BAPP_REPAINT, /* from _UPDATE_ */
+ /* From BWindow */
+ BAPP_MAXIMIZE, /* from B_ZOOM */
+ BAPP_MINIMIZE,
+ BAPP_RESTORE, /* TODO: IMPLEMENT! */
+ BAPP_SHOW,
+ BAPP_HIDE,
+ BAPP_MOUSE_FOCUS, /* caused by MOUSE_MOVE */
+ BAPP_KEYBOARD_FOCUS, /* from WINDOW_ACTIVATED */
+ BAPP_WINDOW_CLOSE_REQUESTED,
+ BAPP_WINDOW_MOVED,
+ BAPP_WINDOW_RESIZED,
+ BAPP_SCREEN_CHANGED
};
@@ -79,302 +79,302 @@ enum ToSDL {
/* Create a descendant of BApplication */
class SDL_BApp : public BApplication {
public:
- SDL_BApp(const char* signature) :
- BApplication(signature) {
- _current_context = NULL;
- }
-
-
- virtual ~SDL_BApp() {
- }
-
-
-
- /* Event-handling functions */
- virtual void MessageReceived(BMessage* message) {
- /* Sort out SDL-related messages */
+ SDL_BApp(const char* signature) :
+ BApplication(signature) {
+ _current_context = NULL;
+ }
+
+
+ virtual ~SDL_BApp() {
+ }
+
+
+
+ /* Event-handling functions */
+ virtual void MessageReceived(BMessage* message) {
+ /* Sort out SDL-related messages */
switch ( message->what ) {
case BAPP_MOUSE_MOVED:
- _HandleMouseMove(message);
- break;
-
- case BAPP_MOUSE_BUTTON:
- _HandleMouseButton(message);
- break;
-
- case BAPP_MOUSE_WHEEL:
- _HandleMouseWheel(message);
- break;
-
- case BAPP_KEY:
- _HandleKey(message);
- break;
-
- case BAPP_REPAINT:
- _HandleBasicWindowEvent(message, SDL_WINDOWEVENT_EXPOSED);
- break;
-
- case BAPP_MAXIMIZE:
- _HandleBasicWindowEvent(message, SDL_WINDOWEVENT_MAXIMIZED);
- break;
-
- case BAPP_MINIMIZE:
- _HandleBasicWindowEvent(message, SDL_WINDOWEVENT_MINIMIZED);
- break;
-
- case BAPP_SHOW:
- _HandleBasicWindowEvent(message, SDL_WINDOWEVENT_SHOWN);
- break;
-
- case BAPP_HIDE:
- _HandleBasicWindowEvent(message, SDL_WINDOWEVENT_HIDDEN);
- break;
-
- case BAPP_MOUSE_FOCUS:
- _HandleMouseFocus(message);
- break;
-
- case BAPP_KEYBOARD_FOCUS:
- _HandleKeyboardFocus(message);
- break;
-
- case BAPP_WINDOW_CLOSE_REQUESTED:
- _HandleBasicWindowEvent(message, SDL_WINDOWEVENT_CLOSE);
- break;
-
- case BAPP_WINDOW_MOVED:
- _HandleWindowMoved(message);
- break;
-
- case BAPP_WINDOW_RESIZED:
- _HandleWindowResized(message);
- break;
-
- case BAPP_SCREEN_CHANGED:
- /* TODO: Handle screen resize or workspace change */
- break;
+ _HandleMouseMove(message);
+ break;
+
+ case BAPP_MOUSE_BUTTON:
+ _HandleMouseButton(message);
+ break;
+
+ case BAPP_MOUSE_WHEEL:
+ _HandleMouseWheel(message);
+ break;
+
+ case BAPP_KEY:
+ _HandleKey(message);
+ break;
+
+ case BAPP_REPAINT:
+ _HandleBasicWindowEvent(message, SDL_WINDOWEVENT_EXPOSED);
+ break;
+
+ case BAPP_MAXIMIZE:
+ _HandleBasicWindowEvent(message, SDL_WINDOWEVENT_MAXIMIZED);
+ break;
+
+ case BAPP_MINIMIZE:
+ _HandleBasicWindowEvent(message, SDL_WINDOWEVENT_MINIMIZED);
+ break;
+
+ case BAPP_SHOW:
+ _HandleBasicWindowEvent(message, SDL_WINDOWEVENT_SHOWN);
+ break;
+
+ case BAPP_HIDE:
+ _HandleBasicWindowEvent(message, SDL_WINDOWEVENT_HIDDEN);
+ break;
+
+ case BAPP_MOUSE_FOCUS:
+ _HandleMouseFocus(message);
+ break;
+
+ case BAPP_KEYBOARD_FOCUS:
+ _HandleKeyboardFocus(message);
+ break;
+
+ case BAPP_WINDOW_CLOSE_REQUESTED:
+ _HandleBasicWindowEvent(message, SDL_WINDOWEVENT_CLOSE);
+ break;
+
+ case BAPP_WINDOW_MOVED:
+ _HandleWindowMoved(message);
+ break;
+
+ case BAPP_WINDOW_RESIZED:
+ _HandleWindowResized(message);
+ break;
+
+ case BAPP_SCREEN_CHANGED:
+ /* TODO: Handle screen resize or workspace change */
+ break;
default:
BApplication::MessageReceived(message);
break;
}
}
-
+
/* Window creation/destruction methods */
int32 GetID(SDL_Window *win) {
- int32 i;
- for(i = 0; i < _GetNumWindowSlots(); ++i) {
- if( GetSDLWindow(i) == NULL ) {
- _SetSDLWindow(win, i);
- return i;
- }
- }
-
- /* Expand the vector if all slots are full */
- if( i == _GetNumWindowSlots() ) {
- _PushBackWindow(win);
- return i;
- }
-
- /* TODO: error handling */
- return 0;
+ int32 i;
+ for(i = 0; i < _GetNumWindowSlots(); ++i) {
+ if( GetSDLWindow(i) == NULL ) {
+ _SetSDLWindow(win, i);
+ return i;
+ }
+ }
+
+ /* Expand the vector if all slots are full */
+ if( i == _GetNumWindowSlots() ) {
+ _PushBackWindow(win);
+ return i;
+ }
+
+ /* TODO: error handling */
+ return 0;
}
-
+
/* FIXME: Bad coding practice, but I can't include SDL_BWin.h here. Is
there another way to do this? */
void ClearID(SDL_BWin *bwin); /* Defined in SDL_BeApp.cc */
-
-
- SDL_Window *GetSDLWindow(int32 winID) {
- return _window_map[winID];
- }
-
+
+
+ SDL_Window *GetSDLWindow(int32 winID) {
+ return _window_map[winID];
+ }
+
void SetCurrentContext(BGLView *newContext) {
- if(_current_context)
- _current_context->UnlockGL();
- _current_context = newContext;
- _current_context->LockGL();
+ if(_current_context)
+ _current_context->UnlockGL();
+ _current_context = newContext;
+ _current_context->LockGL();
}
private:
- /* Event management */
- void _HandleBasicWindowEvent(BMessage *msg, int32 sdlEventType) {
- SDL_Window *win;
- int32 winID;
- if(
- !_GetWinID(msg, &winID)
- ) {
- return;
- }
- win = GetSDLWindow(winID);
- SDL_SendWindowEvent(win, sdlEventType, 0, 0);
- }
-
- void _HandleMouseMove(BMessage *msg) {
- SDL_Window *win;
- int32 winID;
- int32 x = 0, y = 0;
- if(
- !_GetWinID(msg, &winID) ||
- msg->FindInt32("x", &x) != B_OK || /* x movement */
- msg->FindInt32("y", &y) != B_OK /* y movement */
- ) {
- return;
- }
- win = GetSDLWindow(winID);
- SDL_SendMouseMotion(win, 0, 0, x, y);
-
- /* Tell the application that the mouse passed over, redraw needed */
- BE_UpdateWindowFramebuffer(NULL,win,NULL,-1);
- }
-
- void _HandleMouseButton(BMessage *msg) {
- SDL_Window *win;
- int32 winID;
- int32 button, state; /* left/middle/right, pressed/released */
- if(
- !_GetWinID(msg, &winID) ||
- msg->FindInt32("button-id", &button) != B_OK ||
- msg->FindInt32("button-state", &state) != B_OK
- ) {
- return;
- }
- win = GetSDLWindow(winID);
- SDL_SendMouseButton(win, 0, state, button);
- }
-
- void _HandleMouseWheel(BMessage *msg) {
- SDL_Window *win;
- int32 winID;
- int32 xTicks, yTicks;
- if(
- !_GetWinID(msg, &winID) ||
- msg->FindInt32("xticks", &xTicks) != B_OK ||
- msg->FindInt32("yticks", &yTicks) != B_OK
- ) {
- return;
- }
- win = GetSDLWindow(winID);
- SDL_SendMouseWheel(win, 0, xTicks, yTicks);
- }
-
- void _HandleKey(BMessage *msg) {
- int32 scancode, state; /* scancode, pressed/released */
- if(
- msg->FindInt32("key-state", &state) != B_OK ||
- msg->FindInt32("key-scancode", &scancode) != B_OK
- ) {
- return;
- }
-
- /* Make sure this isn't a repeated event (key pressed and held) */
- if(state == SDL_PRESSED && BE_GetKeyState(scancode) == SDL_PRESSED) {
- return;
- }
- BE_SetKeyState(scancode, state);
- SDL_SendKeyboardKey(state, BE_GetScancodeFromBeKey(scancode));
- }
-
- void _HandleMouseFocus(BMessage *msg) {
- SDL_Window *win;
- int32 winID;
- bool bSetFocus; /* If false, lose focus */
- if(
- !_GetWinID(msg, &winID) ||
- msg->FindBool("focusGained", &bSetFocus) != B_OK
- ) {
- return;
- }
- win = GetSDLWindow(winID);
- if(bSetFocus) {
- SDL_SetMouseFocus(win);
- } else if(SDL_GetMouseFocus() == win) {
- /* Only lose all focus if this window was the current focus */
- SDL_SetMouseFocus(NULL);
- }
- }
-
- void _HandleKeyboardFocus(BMessage *msg) {
- SDL_Window *win;
- int32 winID;
- bool bSetFocus; /* If false, lose focus */
- if(
- !_GetWinID(msg, &winID) ||
- msg->FindBool("focusGained", &bSetFocus) != B_OK
- ) {
- return;
- }
- win = GetSDLWindow(winID);
- if(bSetFocus) {
- SDL_SetKeyboardFocus(win);
- } else if(SDL_GetKeyboardFocus() == win) {
- /* Only lose all focus if this window was the current focus */
- SDL_SetKeyboardFocus(NULL);
- }
- }
-
- void _HandleWindowMoved(BMessage *msg) {
- SDL_Window *win;
- int32 winID;
- int32 xPos, yPos;
- /* Get the window id and new x/y position of the window */
- if(
- !_GetWinID(msg, &winID) ||
- msg->FindInt32("window-x", &xPos) != B_OK ||
- msg->FindInt32("window-y", &yPos) != B_OK
- ) {
- return;
- }
- win = GetSDLWindow(winID);
- SDL_SendWindowEvent(win, SDL_WINDOWEVENT_MOVED, xPos, yPos);
- }
-
- void _HandleWindowResized(BMessage *msg) {
- SDL_Window *win;
- int32 winID;
- int32 w, h;
- /* Get the window id ]and new x/y position of the window */
- if(
- !_GetWinID(msg, &winID) ||
- msg->FindInt32("window-w", &w) != B_OK ||
- msg->FindInt32("window-h", &h) != B_OK
- ) {
- return;
- }
- win = GetSDLWindow(winID);
- SDL_SendWindowEvent(win, SDL_WINDOWEVENT_RESIZED, w, h);
- }
-
- bool _GetWinID(BMessage *msg, int32 *winID) {
- return msg->FindInt32("window-id", winID) == B_OK;
- }
-
-
-
- /* Vector functions: Wraps vector stuff in case we need to change
- implementation */
- void _SetSDLWindow(SDL_Window *win, int32 winID) {
- _window_map[winID] = win;
- }
-
- int32 _GetNumWindowSlots() {
- return _window_map.size();
- }
-
-
- void _PopBackWindow() {
- _window_map.pop_back();
- }
-
- void _PushBackWindow(SDL_Window *win) {
- _window_map.push_back(win);
- }
-
-
- /* Members */
- vector<SDL_Window*> _window_map; /* Keeps track of SDL_Windows by index-id*/
-
- display_mode *_saved_mode;
- BGLView *_current_context;
+ /* Event management */
+ void _HandleBasicWindowEvent(BMessage *msg, int32 sdlEventType) {
+ SDL_Window *win;
+ int32 winID;
+ if(
+ !_GetWinID(msg, &winID)
+ ) {
+ return;
+ }
+ win = GetSDLWindow(winID);
+ SDL_SendWindowEvent(win, sdlEventType, 0, 0);
+ }
+
+ void _HandleMouseMove(BMessage *msg) {
+ SDL_Window *win;
+ int32 winID;
+ int32 x = 0, y = 0;
+ if(
+ !_GetWinID(msg, &winID) ||
+ msg->FindInt32("x", &x) != B_OK || /* x movement */
+ msg->FindInt32("y", &y) != B_OK /* y movement */
+ ) {
+ return;
+ }
+ win = GetSDLWindow(winID);
+ SDL_SendMouseMotion(win, 0, 0, x, y);
+
+ /* Tell the application that the mouse passed over, redraw needed */
+ BE_UpdateWindowFramebuffer(NULL,win,NULL,-1);
+ }
+
+ void _HandleMouseButton(BMessage *msg) {
+ SDL_Window *win;
+ int32 winID;
+ int32 button, state; /* left/middle/right, pressed/released */
+ if(
+ !_GetWinID(msg, &winID) ||
+ msg->FindInt32("button-id", &button) != B_OK ||
+ msg->FindInt32("button-state", &state) != B_OK
+ ) {
+ return;
+ }
+ win = GetSDLWindow(winID);
+ SDL_SendMouseButton(win, 0, state, button);
+ }
+
+ void _HandleMouseWheel(BMessage *msg) {
+ SDL_Window *win;
+ int32 winID;
+ int32 xTicks, yTicks;
+ if(
+ !_GetWinID(msg, &winID) ||
+ msg->FindInt32("xticks", &xTicks) != B_OK ||
+ msg->FindInt32("yticks", &yTicks) != B_OK
+ ) {
+ return;
+ }
+ win = GetSDLWindow(winID);
+ SDL_SendMouseWheel(win, 0, xTicks, yTicks);
+ }
+
+ void _HandleKey(BMessage *msg) {
+ int32 scancode, state; /* scancode, pressed/released */
+ if(
+ msg->FindInt32("key-state", &state) != B_OK ||
+ msg->FindInt32("key-scancode", &scancode) != B_OK
+ ) {
+ return;
+ }
+
+ /* Make sure this isn't a repeated event (key pressed and held) */
+ if(state == SDL_PRESSED && BE_GetKeyState(scancode) == SDL_PRESSED) {
+ return;
+ }
+ BE_SetKeyState(scancode, state);
+ SDL_SendKeyboardKey(state, BE_GetScancodeFromBeKey(scancode));
+ }
+
+ void _HandleMouseFocus(BMessage *msg) {
+ SDL_Window *win;
+ int32 winID;
+ bool bSetFocus; /* If false, lose focus */
+ if(
+ !_GetWinID(msg, &winID) ||
+ msg->FindBool("focusGained", &bSetFocus) != B_OK
+ ) {
+ return;
+ }
+ win = GetSDLWindow(winID);
+ if(bSetFocus) {
+ SDL_SetMouseFocus(win);
+ } else if(SDL_GetMouseFocus() == win) {
+ /* Only lose all focus if this window was the current focus */
+ SDL_SetMouseFocus(NULL);
+ }
+ }
+
+ void _HandleKeyboardFocus(BMessage *msg) {
+ SDL_Window *win;
+ int32 winID;
+ bool bSetFocus; /* If false, lose focus */
+ if(
+ !_GetWinID(msg, &winID) ||
+ msg->FindBool("focusGained", &bSetFocus) != B_OK
+ ) {
+ return;
+ }
+ win = GetSDLWindow(winID);
+ if(bSetFocus) {
+ SDL_SetKeyboardFocus(win);
+ } else if(SDL_GetKeyboardFocus() == win) {
+ /* Only lose all focus if this window was the current focus */
+ SDL_SetKeyboardFocus(NULL);
+ }
+ }
+
+ void _HandleWindowMoved(BMessage *msg) {
+ SDL_Window *win;
+ int32 winID;
+ int32 xPos, yPos;
+ /* Get the window id and new x/y position of the window */
+ if(
+ !_GetWinID(msg, &winID) ||
+ msg->FindInt32("window-x", &xPos) != B_OK ||
+ msg->FindInt32("window-y", &yPos) != B_OK
+ ) {
+ return;
+ }
+ win = GetSDLWindow(winID);
+ SDL_SendWindowEvent(win, SDL_WINDOWEVENT_MOVED, xPos, yPos);
+ }
+
+ void _HandleWindowResized(BMessage *msg) {
+ SDL_Window *win;
+ int32 winID;
+ int32 w, h;
+ /* Get the window id ]and new x/y position of the window */
+ if(
+ !_GetWinID(msg, &winID) ||
+ msg->FindInt32("window-w", &w) != B_OK ||
+ msg->FindInt32("window-h", &h) != B_OK
+ ) {
+ return;
+ }
+ win = GetSDLWindow(winID);
+ SDL_SendWindowEvent(win, SDL_WINDOWEVENT_RESIZED, w, h);
+ }
+
+ bool _GetWinID(BMessage *msg, int32 *winID) {
+ return msg->FindInt32("window-id", winID) == B_OK;
+ }
+
+
+
+ /* Vector functions: Wraps vector stuff in case we need to change
+ implementation */
+ void _SetSDLWindow(SDL_Window *win, int32 winID) {
+ _window_map[winID] = win;
+ }
+
+ int32 _GetNumWindowSlots() {
+ return _window_map.size();
+ }
+
+
+ void _PopBackWindow() {
+ _window_map.pop_back();
+ }
+
+ void _PushBackWindow(SDL_Window *win) {
+ _window_map.push_back(win);
+ }
+
+
+ /* Members */
+ vector<SDL_Window*> _window_map; /* Keeps track of SDL_Windows by index-id*/
+
+ display_mode *_saved_mode;
+ BGLView *_current_context;
};
#endif
diff --git a/src/main/psp/SDL_psp_main.c b/src/main/psp/SDL_psp_main.c
index 0286eadecd..c60e8441ba 100644
--- a/src/main/psp/SDL_psp_main.c
+++ b/src/main/psp/SDL_psp_main.c
@@ -30,7 +30,7 @@
/* If application's main() is redefined as SDL_main, and libSDLmain is
linked, then this file will create the standard exit callback,
define the PSP_MODULE_INFO macro, and exit back to the browser when
- the program is finished.
+ the program is finished.
You can still override other parameters in your own code if you
desire, such as PSP_HEAP_SIZE_KB, PSP_MAIN_THREAD_ATTR,
@@ -43,38 +43,38 @@ PSP_MODULE_INFO("SDL App", 0, 1, 1);
int sdl_psp_exit_callback(int arg1, int arg2, void *common)
{
- exit(0);
- return 0;
+ exit(0);
+ return 0;
}
int sdl_psp_callback_thread(SceSize args, void *argp)
{
- int cbid;
- cbid = sceKernelCreateCallback("Exit Callback",
- sdl_psp_exit_callback, NULL);
- sceKernelRegisterExitCallback(cbid);
- sceKernelSleepThreadCB();
- return 0;
+ int cbid;
+ cbid = sceKernelCreateCallback("Exit Callback",
+ sdl_psp_exit_callback, NULL);
+ sceKernelRegisterExitCallback(cbid);
+ sceKernelSleepThreadCB();
+ return 0;
}
int sdl_psp_setup_callbacks(void)
{
- int thid = 0;
- thid = sceKernelCreateThread("update_thread",
- sdl_psp_callback_thread, 0x11, 0xFA0, 0, 0);
- if(thid >= 0)
- sceKernelStartThread(thid, 0, 0);
- return thid;
+ int thid = 0;
+ thid = sceKernelCreateThread("update_thread",
+ sdl_psp_callback_thread, 0x11, 0xFA0, 0, 0);
+ if(thid >= 0)
+ sceKernelStartThread(thid, 0, 0);
+ return thid;
}
int main(int argc, char *argv[])
{
- pspDebugScreenInit();
- sdl_psp_setup_callbacks();
+ pspDebugScreenInit();
+ sdl_psp_setup_callbacks();
- /* Register sceKernelExitGame() to be called when we exit */
- atexit(sceKernelExitGame);
+ /* Register sceKernelExitGame() to be called when we exit */
+ atexit(sceKernelExitGame);
- (void)SDL_main(argc, argv);
- return 0;
+ (void)SDL_main(argc, argv);
+ return 0;
}
diff --git a/src/power/beos/SDL_syspower.c b/src/power/beos/SDL_syspower.c
index 5c7b47cd2e..8f172cc0e8 100644
--- a/src/power/beos/SDL_syspower.c
+++ b/src/power/beos/SDL_syspower.c
@@ -50,8 +50,8 @@ SDL_GetPowerInfo_BeOS(SDL_PowerState * state, int *seconds, int *percent)
uint8 battery_flags;
uint8 battery_life;
uint32 battery_time;
- int rc;
-
+ int rc;
+
if (fd == -1) {
return SDL_FALSE; /* maybe some other method will work? */
}
diff --git a/src/power/linux/SDL_syspower.c b/src/power/linux/SDL_syspower.c
index a019e39922..d9616de257 100644
--- a/src/power/linux/SDL_syspower.c
+++ b/src/power/linux/SDL_syspower.c
@@ -64,7 +64,7 @@ load_acpi_file(const char *base, const char *node, const char *key,
if (br < 0) {
return SDL_FALSE;
}
- buf[br] = '\0'; // null-terminate the string.
+ buf[br] = '\0'; /* null-terminate the string. */
return SDL_TRUE;
}
@@ -342,7 +342,7 @@ SDL_GetPowerInfo_Linux_proc_apm(SDL_PowerState * state,
return SDL_FALSE;
}
- buf[br] = '\0'; // null-terminate the string.
+ buf[br] = '\0'; /* null-terminate the string. */
if (!next_string(&ptr, &str)) { /* driver version */
return SDL_FALSE;
}
diff --git a/src/power/psp/SDL_syspower.c b/src/power/psp/SDL_syspower.c
index 363c952d00..8c791bba4d 100644
--- a/src/power/psp/SDL_syspower.c
+++ b/src/power/psp/SDL_syspower.c
@@ -25,7 +25,7 @@
#if SDL_POWER_PSP
#include "SDL_power.h"
-#include <psppower.h>
+#include <psppower.h>
SDL_bool
@@ -34,31 +34,31 @@ SDL_GetPowerInfo_PSP(SDL_PowerState * state, int *seconds,
{
int battery = scePowerIsBatteryExist();
int plugged = scePowerIsPowerOnline();
- int charging = scePowerIsBatteryCharging();
+ int charging = scePowerIsBatteryCharging();
*state = SDL_POWERSTATE_UNKNOWN;
- *seconds = -1;
- *percent = -1;
-
- if (!battery) {
- *state = SDL_POWERSTATE_NO_BATTERY;
- *seconds = -1;
- *percent = -1;
+ *seconds = -1;
+ *percent = -1;
+
+ if (!battery) {
+ *state = SDL_POWERSTATE_NO_BATTERY;
+ *seconds = -1;
+ *percent = -1;
} else if (charging) {
*state = SDL_POWERSTATE_CHARGING;
- *percent = scePowerGetBatteryLifePercent();
- *seconds = scePowerGetBatteryLifeTime()*60;
+ *percent = scePowerGetBatteryLifePercent();
+ *seconds = scePowerGetBatteryLifeTime()*60;
} else if (plugged) {
*state = SDL_POWERSTATE_CHARGED;
- *percent = scePowerGetBatteryLifePercent();
- *seconds = scePowerGetBatteryLifeTime()*60;
+ *percent = scePowerGetBatteryLifePercent();
+ *seconds = scePowerGetBatteryLifeTime()*60;
} else {
*state = SDL_POWERSTATE_ON_BATTERY;
- *percent = scePowerGetBatteryLifePercent();
- *seconds = scePowerGetBatteryLifeTime()*60;
+ *percent = scePowerGetBatteryLifePercent();
+ *seconds = scePowerGetBatteryLifeTime()*60;
}
-
+
return SDL_TRUE; /* always the definitive answer on PSP. */
}
diff --git a/src/power/uikit/SDL_syspower.m b/src/power/uikit/SDL_syspower.m
index cb309fcb42..3364da56ee 100644
--- a/src/power/uikit/SDL_syspower.m
+++ b/src/power/uikit/SDL_syspower.m
@@ -30,7 +30,7 @@
#include "SDL_assert.h"
#include "SDL_syspower.h"
-// turn off the battery monitor if it's been more than X ms since last check.
+/* turn off the battery monitor if it's been more than X ms since last check. */
static const int BATTERY_MONITORING_TIMEOUT = 3000;
static Uint32 SDL_UIKitLastPowerInfoQuery = 0;
@@ -41,7 +41,7 @@ SDL_UIKit_UpdateBatteryMonitoring(void)
const Uint32 prev = SDL_UIKitLastPowerInfoQuery;
const UInt32 now = SDL_GetTicks();
const UInt32 ticks = now - prev;
- // if timer wrapped (now < prev), shut down, too.
+ /* if timer wrapped (now < prev), shut down, too. */
if ((now < prev) || (ticks >= BATTERY_MONITORING_TIMEOUT)) {
UIDevice *uidev = [UIDevice currentDevice];
SDL_assert([uidev isBatteryMonitoringEnabled] == YES);
@@ -61,13 +61,14 @@ SDL_GetPowerInfo_UIKit(SDL_PowerState * state, int *seconds, int *percent)
[uidev setBatteryMonitoringEnabled:YES];
}
- // UIKit_GL_SwapWindow() (etc) will check this and disable the battery
- // monitoring if the app hasn't queried it in the last X seconds.
- // Apparently monitoring the battery burns battery life. :)
- // Apple's docs say not to monitor the battery unless you need it.
+ /* UIKit_GL_SwapWindow() (etc) will check this and disable the battery
+ * monitoring if the app hasn't queried it in the last X seconds.
+ * Apparently monitoring the battery burns battery life. :)
+ * Apple's docs say not to monitor the battery unless you need it.
+ */
SDL_UIKitLastPowerInfoQuery = SDL_GetTicks();
- *seconds = -1; // no API to estimate this in UIKit.
+ *seconds = -1; /* no API to estimate this in UIKit. */
switch ([uidev batteryState])
{
diff --git a/src/render/SDL_render.c b/src/render/SDL_render.c
index 3a8666d772..785e0b9055 100644
--- a/src/render/SDL_render.c
+++ b/src/render/SDL_render.c
@@ -1601,7 +1601,7 @@ SDL_RenderCopyEx(SDL_Renderer * renderer, SDL_Texture * texture,
if (!renderer->RenderCopyEx) {
return SDL_SetError("Renderer does not support RenderCopyEx");
}
-
+
real_srcrect.x = 0;
real_srcrect.y = 0;
real_srcrect.w = texture->w;
diff --git a/src/render/SDL_yuv_mmx.c b/src/render/SDL_yuv_mmx.c
index 6d6c000f3c..b223d2d281 100644
--- a/src/render/SDL_yuv_mmx.c
+++ b/src/render/SDL_yuv_mmx.c
@@ -63,10 +63,10 @@ static mmx_t MMX_grn565 = { .uw = {0x07e0, 0x07e0, 0x07e0, 0x07e0} };
The MMX routine calculates 256bit=8RGB values in each cycle
(4 for row1 & 4 for row2)
- The red/green/blue.. coefficents are taken from the mpeg_play
+ The red/green/blue.. coefficents are taken from the mpeg_play
player. They look nice, but I dont know if you can have
better values, to avoid integer rounding errors.
-
+
IMPORTANT:
==========
@@ -84,152 +84,152 @@ void ColorRGBDitherYV12MMX1X( int *colortab, Uint32 *rgb_2_pix,
Uint32 *row1;
Uint32 *row2;
- unsigned char* y = lum +cols*rows; // Pointer to the end
+ unsigned char* y = lum +cols*rows; /* Pointer to the end */
int x = 0;
- row1 = (Uint32 *)out; // 32 bit target
- row2 = (Uint32 *)out+cols+mod; // start of second row
- mod = (mod+cols+mod)*4; // increment for row1 in byte
+ row1 = (Uint32 *)out; /* 32 bit target */
+ row2 = (Uint32 *)out+cols+mod; /* start of second row */
+ mod = (mod+cols+mod)*4; /* increment for row1 in byte */
__asm__ __volatile__ (
- // tap dance to workaround the inability to use %%ebx at will...
- // move one thing to the stack...
- "pushl $0\n" // save a slot on the stack.
- "pushl %%ebx\n" // save %%ebx.
- "movl %0, %%ebx\n" // put the thing in ebx.
- "movl %%ebx,4(%%esp)\n" // put the thing in the stack slot.
- "popl %%ebx\n" // get back %%ebx (the PIC register).
+ /* tap dance to workaround the inability to use %%ebx at will... */
+ /* move one thing to the stack... */
+ "pushl $0\n" /* save a slot on the stack. */
+ "pushl %%ebx\n" /* save %%ebx. */
+ "movl %0, %%ebx\n" /* put the thing in ebx. */
+ "movl %%ebx,4(%%esp)\n" /* put the thing in the stack slot. */
+ "popl %%ebx\n" /* get back %%ebx (the PIC register). */
".align 8\n"
"1:\n"
- // create Cr (result in mm1)
+ /* create Cr (result in mm1) */
"pushl %%ebx\n"
"movl 4(%%esp),%%ebx\n"
- "movd (%%ebx),%%mm1\n" // 0 0 0 0 v3 v2 v1 v0
+ "movd (%%ebx),%%mm1\n" /* 0 0 0 0 v3 v2 v1 v0 */
"popl %%ebx\n"
- "pxor %%mm7,%%mm7\n" // 00 00 00 00 00 00 00 00
- "movd (%2), %%mm2\n" // 0 0 0 0 l3 l2 l1 l0
- "punpcklbw %%mm7,%%mm1\n" // 0 v3 0 v2 00 v1 00 v0
- "punpckldq %%mm1,%%mm1\n" // 00 v1 00 v0 00 v1 00 v0
- "psubw %9,%%mm1\n" // mm1-128:r1 r1 r0 r0 r1 r1 r0 r0
-
- // create Cr_g (result in mm0)
- "movq %%mm1,%%mm0\n" // r1 r1 r0 r0 r1 r1 r0 r0
- "pmullw %10,%%mm0\n" // red*-46dec=0.7136*64
- "pmullw %11,%%mm1\n" // red*89dec=1.4013*64
- "psraw $6, %%mm0\n" // red=red/64
- "psraw $6, %%mm1\n" // red=red/64
-
- // create L1 L2 (result in mm2,mm4)
- // L2=lum+cols
- "movq (%2,%4),%%mm3\n" // 0 0 0 0 L3 L2 L1 L0
- "punpckldq %%mm3,%%mm2\n" // L3 L2 L1 L0 l3 l2 l1 l0
- "movq %%mm2,%%mm4\n" // L3 L2 L1 L0 l3 l2 l1 l0
- "pand %12,%%mm2\n" // L3 0 L1 0 l3 0 l1 0
- "pand %13,%%mm4\n" // 0 L2 0 L0 0 l2 0 l0
- "psrlw $8,%%mm2\n" // 0 L3 0 L1 0 l3 0 l1
-
- // create R (result in mm6)
- "movq %%mm2,%%mm5\n" // 0 L3 0 L1 0 l3 0 l1
- "movq %%mm4,%%mm6\n" // 0 L2 0 L0 0 l2 0 l0
- "paddsw %%mm1, %%mm5\n" // lum1+red:x R3 x R1 x r3 x r1
- "paddsw %%mm1, %%mm6\n" // lum1+red:x R2 x R0 x r2 x r0
- "packuswb %%mm5,%%mm5\n" // R3 R1 r3 r1 R3 R1 r3 r1
- "packuswb %%mm6,%%mm6\n" // R2 R0 r2 r0 R2 R0 r2 r0
- "pxor %%mm7,%%mm7\n" // 00 00 00 00 00 00 00 00
- "punpcklbw %%mm5,%%mm6\n" // R3 R2 R1 R0 r3 r2 r1 r0
-
- // create Cb (result in mm1)
- "movd (%1), %%mm1\n" // 0 0 0 0 u3 u2 u1 u0
- "punpcklbw %%mm7,%%mm1\n" // 0 u3 0 u2 00 u1 00 u0
- "punpckldq %%mm1,%%mm1\n" // 00 u1 00 u0 00 u1 00 u0
- "psubw %9,%%mm1\n" // mm1-128:u1 u1 u0 u0 u1 u1 u0 u0
-
- // create Cb_g (result in mm5)
- "movq %%mm1,%%mm5\n" // u1 u1 u0 u0 u1 u1 u0 u0
- "pmullw %14,%%mm5\n" // blue*-109dec=1.7129*64
- "pmullw %15,%%mm1\n" // blue*114dec=1.78125*64
- "psraw $6, %%mm5\n" // blue=red/64
- "psraw $6, %%mm1\n" // blue=blue/64
-
- // create G (result in mm7)
- "movq %%mm2,%%mm3\n" // 0 L3 0 L1 0 l3 0 l1
- "movq %%mm4,%%mm7\n" // 0 L2 0 L0 0 l2 0 l1
- "paddsw %%mm5, %%mm3\n" // lum1+Cb_g:x G3t x G1t x g3t x g1t
- "paddsw %%mm5, %%mm7\n" // lum1+Cb_g:x G2t x G0t x g2t x g0t
- "paddsw %%mm0, %%mm3\n" // lum1+Cr_g:x G3 x G1 x g3 x g1
- "paddsw %%mm0, %%mm7\n" // lum1+blue:x G2 x G0 x g2 x g0
- "packuswb %%mm3,%%mm3\n" // G3 G1 g3 g1 G3 G1 g3 g1
- "packuswb %%mm7,%%mm7\n" // G2 G0 g2 g0 G2 G0 g2 g0
- "punpcklbw %%mm3,%%mm7\n" // G3 G2 G1 G0 g3 g2 g1 g0
-
- // create B (result in mm5)
- "movq %%mm2,%%mm3\n" // 0 L3 0 L1 0 l3 0 l1
- "movq %%mm4,%%mm5\n" // 0 L2 0 L0 0 l2 0 l1
- "paddsw %%mm1, %%mm3\n" // lum1+blue:x B3 x B1 x b3 x b1
- "paddsw %%mm1, %%mm5\n" // lum1+blue:x B2 x B0 x b2 x b0
- "packuswb %%mm3,%%mm3\n" // B3 B1 b3 b1 B3 B1 b3 b1
- "packuswb %%mm5,%%mm5\n" // B2 B0 b2 b0 B2 B0 b2 b0
- "punpcklbw %%mm3,%%mm5\n" // B3 B2 B1 B0 b3 b2 b1 b0
-
- // fill destination row1 (needed are mm6=Rr,mm7=Gg,mm5=Bb)
-
- "pxor %%mm2,%%mm2\n" // 0 0 0 0 0 0 0 0
- "pxor %%mm4,%%mm4\n" // 0 0 0 0 0 0 0 0
- "movq %%mm6,%%mm1\n" // R3 R2 R1 R0 r3 r2 r1 r0
- "movq %%mm5,%%mm3\n" // B3 B2 B1 B0 b3 b2 b1 b0
-
- // process lower lum
- "punpcklbw %%mm4,%%mm1\n" // 0 r3 0 r2 0 r1 0 r0
- "punpcklbw %%mm4,%%mm3\n" // 0 b3 0 b2 0 b1 0 b0
- "movq %%mm1,%%mm2\n" // 0 r3 0 r2 0 r1 0 r0
- "movq %%mm3,%%mm0\n" // 0 b3 0 b2 0 b1 0 b0
- "punpcklwd %%mm1,%%mm3\n" // 0 r1 0 b1 0 r0 0 b0
- "punpckhwd %%mm2,%%mm0\n" // 0 r3 0 b3 0 r2 0 b2
-
- "pxor %%mm2,%%mm2\n" // 0 0 0 0 0 0 0 0
- "movq %%mm7,%%mm1\n" // G3 G2 G1 G0 g3 g2 g1 g0
- "punpcklbw %%mm1,%%mm2\n" // g3 0 g2 0 g1 0 g0 0
- "punpcklwd %%mm4,%%mm2\n" // 0 0 g1 0 0 0 g0 0
- "por %%mm3, %%mm2\n" // 0 r1 g1 b1 0 r0 g0 b0
- "movq %%mm2,(%3)\n" // wrote out ! row1
-
- "pxor %%mm2,%%mm2\n" // 0 0 0 0 0 0 0 0
- "punpcklbw %%mm1,%%mm4\n" // g3 0 g2 0 g1 0 g0 0
- "punpckhwd %%mm2,%%mm4\n" // 0 0 g3 0 0 0 g2 0
- "por %%mm0, %%mm4\n" // 0 r3 g3 b3 0 r2 g2 b2
- "movq %%mm4,8(%3)\n" // wrote out ! row1
-
- // fill destination row2 (needed are mm6=Rr,mm7=Gg,mm5=Bb)
- // this can be done "destructive"
- "pxor %%mm2,%%mm2\n" // 0 0 0 0 0 0 0 0
- "punpckhbw %%mm2,%%mm6\n" // 0 R3 0 R2 0 R1 0 R0
- "punpckhbw %%mm1,%%mm5\n" // G3 B3 G2 B2 G1 B1 G0 B0
- "movq %%mm5,%%mm1\n" // G3 B3 G2 B2 G1 B1 G0 B0
- "punpcklwd %%mm6,%%mm1\n" // 0 R1 G1 B1 0 R0 G0 B0
- "movq %%mm1,(%5)\n" // wrote out ! row2
- "punpckhwd %%mm6,%%mm5\n" // 0 R3 G3 B3 0 R2 G2 B2
- "movq %%mm5,8(%5)\n" // wrote out ! row2
-
- "addl $4,%2\n" // lum+4
- "leal 16(%3),%3\n" // row1+16
- "leal 16(%5),%5\n" // row2+16
- "addl $2,(%%esp)\n" // cr+2
- "addl $2,%1\n" // cb+2
-
- "addl $4,%6\n" // x+4
+ "pxor %%mm7,%%mm7\n" /* 00 00 00 00 00 00 00 00 */
+ "movd (%2), %%mm2\n" /* 0 0 0 0 l3 l2 l1 l0 */
+ "punpcklbw %%mm7,%%mm1\n" /* 0 v3 0 v2 00 v1 00 v0 */
+ "punpckldq %%mm1,%%mm1\n" /* 00 v1 00 v0 00 v1 00 v0 */
+ "psubw %9,%%mm1\n" /* mm1-128:r1 r1 r0 r0 r1 r1 r0 r0 */
+
+ /* create Cr_g (result in mm0) */
+ "movq %%mm1,%%mm0\n" /* r1 r1 r0 r0 r1 r1 r0 r0 */
+ "pmullw %10,%%mm0\n" /* red*-46dec=0.7136*64 */
+ "pmullw %11,%%mm1\n" /* red*89dec=1.4013*64 */
+ "psraw $6, %%mm0\n" /* red=red/64 */
+ "psraw $6, %%mm1\n" /* red=red/64 */
+
+ /* create L1 L2 (result in mm2,mm4) */
+ /* L2=lum+cols */
+ "movq (%2,%4),%%mm3\n" /* 0 0 0 0 L3 L2 L1 L0 */
+ "punpckldq %%mm3,%%mm2\n" /* L3 L2 L1 L0 l3 l2 l1 l0 */
+ "movq %%mm2,%%mm4\n" /* L3 L2 L1 L0 l3 l2 l1 l0 */
+ "pand %12,%%mm2\n" /* L3 0 L1 0 l3 0 l1 0 */
+ "pand %13,%%mm4\n" /* 0 L2 0 L0 0 l2 0 l0 */
+ "psrlw $8,%%mm2\n" /* 0 L3 0 L1 0 l3 0 l1 */
+
+ /* create R (result in mm6) */
+ "movq %%mm2,%%mm5\n" /* 0 L3 0 L1 0 l3 0 l1 */
+ "movq %%mm4,%%mm6\n" /* 0 L2 0 L0 0 l2 0 l0 */
+ "paddsw %%mm1, %%mm5\n" /* lum1+red:x R3 x R1 x r3 x r1 */
+ "paddsw %%mm1, %%mm6\n" /* lum1+red:x R2 x R0 x r2 x r0 */
+ "packuswb %%mm5,%%mm5\n" /* R3 R1 r3 r1 R3 R1 r3 r1 */
+ "packuswb %%mm6,%%mm6\n" /* R2 R0 r2 r0 R2 R0 r2 r0 */
+ "pxor %%mm7,%%mm7\n" /* 00 00 00 00 00 00 00 00 */
+ "punpcklbw %%mm5,%%mm6\n" /* R3 R2 R1 R0 r3 r2 r1 r0 */
+
+ /* create Cb (result in mm1) */
+ "movd (%1), %%mm1\n" /* 0 0 0 0 u3 u2 u1 u0 */
+ "punpcklbw %%mm7,%%mm1\n" /* 0 u3 0 u2 00 u1 00 u0 */
+ "punpckldq %%mm1,%%mm1\n" /* 00 u1 00 u0 00 u1 00 u0 */
+ "psubw %9,%%mm1\n" /* mm1-128:u1 u1 u0 u0 u1 u1 u0 u0 */
+
+ /* create Cb_g (result in mm5) */
+ "movq %%mm1,%%mm5\n" /* u1 u1 u0 u0 u1 u1 u0 u0 */
+ "pmullw %14,%%mm5\n" /* blue*-109dec=1.7129*64 */
+ "pmullw %15,%%mm1\n" /* blue*114dec=1.78125*64 */
+ "psraw $6, %%mm5\n" /* blue=red/64 */
+ "psraw $6, %%mm1\n" /* blue=blue/64 */
+
+ /* create G (result in mm7) */
+ "movq %%mm2,%%mm3\n" /* 0 L3 0 L1 0 l3 0 l1 */
+ "movq %%mm4,%%mm7\n" /* 0 L2 0 L0 0 l2 0 l1 */
+ "paddsw %%mm5, %%mm3\n" /* lum1+Cb_g:x G3t x G1t x g3t x g1t */
+ "paddsw %%mm5, %%mm7\n" /* lum1+Cb_g:x G2t x G0t x g2t x g0t */
+ "paddsw %%mm0, %%mm3\n" /* lum1+Cr_g:x G3 x G1 x g3 x g1 */
+ "paddsw %%mm0, %%mm7\n" /* lum1+blue:x G2 x G0 x g2 x g0 */
+ "packuswb %%mm3,%%mm3\n" /* G3 G1 g3 g1 G3 G1 g3 g1 */
+ "packuswb %%mm7,%%mm7\n" /* G2 G0 g2 g0 G2 G0 g2 g0 */
+ "punpcklbw %%mm3,%%mm7\n" /* G3 G2 G1 G0 g3 g2 g1 g0 */
+
+ /* create B (result in mm5) */
+ "movq %%mm2,%%mm3\n" /* 0 L3 0 L1 0 l3 0 l1 */
+ "movq %%mm4,%%mm5\n" /* 0 L2 0 L0 0 l2 0 l1 */
+ "paddsw %%mm1, %%mm3\n" /* lum1+blue:x B3 x B1 x b3 x b1 */
+ "paddsw %%mm1, %%mm5\n" /* lum1+blue:x B2 x B0 x b2 x b0 */
+ "packuswb %%mm3,%%mm3\n" /* B3 B1 b3 b1 B3 B1 b3 b1 */
+ "packuswb %%mm5,%%mm5\n" /* B2 B0 b2 b0 B2 B0 b2 b0 */
+ "punpcklbw %%mm3,%%mm5\n" /* B3 B2 B1 B0 b3 b2 b1 b0 */
+
+ /* fill destination row1 (needed are mm6=Rr,mm7=Gg,mm5=Bb) */
+
+ "pxor %%mm2,%%mm2\n" /* 0 0 0 0 0 0 0 0 */
+ "pxor %%mm4,%%mm4\n" /* 0 0 0 0 0 0 0 0 */
+ "movq %%mm6,%%mm1\n" /* R3 R2 R1 R0 r3 r2 r1 r0 */
+ "movq %%mm5,%%mm3\n" /* B3 B2 B1 B0 b3 b2 b1 b0 */
+
+ /* process lower lum */
+ "punpcklbw %%mm4,%%mm1\n" /* 0 r3 0 r2 0 r1 0 r0 */
+ "punpcklbw %%mm4,%%mm3\n" /* 0 b3 0 b2 0 b1 0 b0 */
+ "movq %%mm1,%%mm2\n" /* 0 r3 0 r2 0 r1 0 r0 */
+ "movq %%mm3,%%mm0\n" /* 0 b3 0 b2 0 b1 0 b0 */
+ "punpcklwd %%mm1,%%mm3\n" /* 0 r1 0 b1 0 r0 0 b0 */
+ "punpckhwd %%mm2,%%mm0\n" /* 0 r3 0 b3 0 r2 0 b2 */
+
+ "pxor %%mm2,%%mm2\n" /* 0 0 0 0 0 0 0 0 */
+ "movq %%mm7,%%mm1\n" /* G3 G2 G1 G0 g3 g2 g1 g0 */
+ "punpcklbw %%mm1,%%mm2\n" /* g3 0 g2 0 g1 0 g0 0 */
+ "punpcklwd %%mm4,%%mm2\n" /* 0 0 g1 0 0 0 g0 0 */
+ "por %%mm3, %%mm2\n" /* 0 r1 g1 b1 0 r0 g0 b0 */
+ "movq %%mm2,(%3)\n" /* wrote out ! row1 */
+
+ "pxor %%mm2,%%mm2\n" /* 0 0 0 0 0 0 0 0 */
+ "punpcklbw %%mm1,%%mm4\n" /* g3 0 g2 0 g1 0 g0 0 */
+ "punpckhwd %%mm2,%%mm4\n" /* 0 0 g3 0 0 0 g2 0 */
+ "por %%mm0, %%mm4\n" /* 0 r3 g3 b3 0 r2 g2 b2 */
+ "movq %%mm4,8(%3)\n" /* wrote out ! row1 */
+
+ /* fill destination row2 (needed are mm6=Rr,mm7=Gg,mm5=Bb) */
+ /* this can be done "destructive" */
+ "pxor %%mm2,%%mm2\n" /* 0 0 0 0 0 0 0 0 */
+ "punpckhbw %%mm2,%%mm6\n" /* 0 R3 0 R2 0 R1 0 R0 */
+ "punpckhbw %%mm1,%%mm5\n" /* G3 B3 G2 B2 G1 B1 G0 B0 */
+ "movq %%mm5,%%mm1\n" /* G3 B3 G2 B2 G1 B1 G0 B0 */
+ "punpcklwd %%mm6,%%mm1\n" /* 0 R1 G1 B1 0 R0 G0 B0 */
+ "movq %%mm1,(%5)\n" /* wrote out ! row2 */
+ "punpckhwd %%mm6,%%mm5\n" /* 0 R3 G3 B3 0 R2 G2 B2 */
+ "movq %%mm5,8(%5)\n" /* wrote out ! row2 */
+
+ "addl $4,%2\n" /* lum+4 */
+ "leal 16(%3),%3\n" /* row1+16 */
+ "leal 16(%5),%5\n" /* row2+16 */
+ "addl $2,(%%esp)\n" /* cr+2 */
+ "addl $2,%1\n" /* cb+2 */
+
+ "addl $4,%6\n" /* x+4 */
"cmpl %4,%6\n"
"jl 1b\n"
- "addl %4,%2\n" // lum += cols
- "addl %8,%3\n" // row1+= mod
- "addl %8,%5\n" // row2+= mod
- "movl $0,%6\n" // x=0
+ "addl %4,%2\n" /* lum += cols */
+ "addl %8,%3\n" /* row1+= mod */
+ "addl %8,%5\n" /* row2+= mod */
+ "movl $0,%6\n" /* x=0 */
"cmpl %7,%2\n"
"jl 1b\n"
- "addl $4,%%esp\n" // get rid of the stack slot we reserved.
- "emms\n" // reset MMX registers.
+ "addl $4,%%esp\n" /* get rid of the stack slot we reserved. */
+ "emms\n" /* reset MMX registers. */
:
: "m" (cr), "r"(cb),"r"(lum),
"r"(row1),"r"(cols),"r"(row2),"m"(x),"m"(y),"m"(mod),
@@ -254,125 +254,125 @@ void Color565DitherYV12MMX1X( int *colortab, Uint32 *rgb_2_pix,
mod = (mod+cols+mod)*2; /* increment for row1 in byte */
__asm__ __volatile__(
- // tap dance to workaround the inability to use %%ebx at will...
- // move one thing to the stack...
- "pushl $0\n" // save a slot on the stack.
- "pushl %%ebx\n" // save %%ebx.
- "movl %0, %%ebx\n" // put the thing in ebx.
- "movl %%ebx, 4(%%esp)\n" // put the thing in the stack slot.
- "popl %%ebx\n" // get back %%ebx (the PIC register).
+ /* tap dance to workaround the inability to use %%ebx at will... */
+ /* move one thing to the stack... */
+ "pushl $0\n" /* save a slot on the stack. */
+ "pushl %%ebx\n" /* save %%ebx. */
+ "movl %0, %%ebx\n" /* put the thing in ebx. */
+ "movl %%ebx, 4(%%esp)\n" /* put the thing in the stack slot. */
+ "popl %%ebx\n" /* get back %%ebx (the PIC register). */
".align 8\n"
"1:\n"
- "movd (%1), %%mm0\n" // 4 Cb 0 0 0 0 u3 u2 u1 u0
+ "movd (%1), %%mm0\n" /* 4 Cb 0 0 0 0 u3 u2 u1 u0 */
"pxor %%mm7, %%mm7\n"
"pushl %%ebx\n"
"movl 4(%%esp), %%ebx\n"
- "movd (%%ebx), %%mm1\n" // 4 Cr 0 0 0 0 v3 v2 v1 v0
+ "movd (%%ebx), %%mm1\n" /* 4 Cr 0 0 0 0 v3 v2 v1 v0 */
"popl %%ebx\n"
- "punpcklbw %%mm7, %%mm0\n" // 4 W cb 0 u3 0 u2 0 u1 0 u0
- "punpcklbw %%mm7, %%mm1\n" // 4 W cr 0 v3 0 v2 0 v1 0 v0
+ "punpcklbw %%mm7, %%mm0\n" /* 4 W cb 0 u3 0 u2 0 u1 0 u0 */
+ "punpcklbw %%mm7, %%mm1\n" /* 4 W cr 0 v3 0 v2 0 v1 0 v0 */
"psubw %9, %%mm0\n"
"psubw %9, %%mm1\n"
- "movq %%mm0, %%mm2\n" // Cb 0 u3 0 u2 0 u1 0 u0
- "movq %%mm1, %%mm3\n" // Cr
- "pmullw %10, %%mm2\n" // Cb2green 0 R3 0 R2 0 R1 0 R0
- "movq (%2), %%mm6\n" // L1 l7 L6 L5 L4 L3 L2 L1 L0
- "pmullw %11, %%mm0\n" // Cb2blue
- "pand %12, %%mm6\n" // L1 00 L6 00 L4 00 L2 00 L0
- "pmullw %13, %%mm3\n" // Cr2green
- "movq (%2), %%mm7\n" // L2
- "pmullw %14, %%mm1\n" // Cr2red
- "psrlw $8, %%mm7\n" // L2 00 L7 00 L5 00 L3 00 L1
- "pmullw %15, %%mm6\n" // lum1
- "paddw %%mm3, %%mm2\n" // Cb2green + Cr2green == green
- "pmullw %15, %%mm7\n" // lum2
-
- "movq %%mm6, %%mm4\n" // lum1
- "paddw %%mm0, %%mm6\n" // lum1 +blue 00 B6 00 B4 00 B2 00 B0
- "movq %%mm4, %%mm5\n" // lum1
- "paddw %%mm1, %%mm4\n" // lum1 +red 00 R6 00 R4 00 R2 00 R0
- "paddw %%mm2, %%mm5\n" // lum1 +green 00 G6 00 G4 00 G2 00 G0
- "psraw $6, %%mm4\n" // R1 0 .. 64
- "movq %%mm7, %%mm3\n" // lum2 00 L7 00 L5 00 L3 00 L1
- "psraw $6, %%mm5\n" // G1 - .. +
- "paddw %%mm0, %%mm7\n" // Lum2 +blue 00 B7 00 B5 00 B3 00 B1
- "psraw $6, %%mm6\n" // B1 0 .. 64
- "packuswb %%mm4, %%mm4\n" // R1 R1
- "packuswb %%mm5, %%mm5\n" // G1 G1
- "packuswb %%mm6, %%mm6\n" // B1 B1
+ "movq %%mm0, %%mm2\n" /* Cb 0 u3 0 u2 0 u1 0 u0 */
+ "movq %%mm1, %%mm3\n" /* Cr */
+ "pmullw %10, %%mm2\n" /* Cb2green 0 R3 0 R2 0 R1 0 R0 */
+ "movq (%2), %%mm6\n" /* L1 l7 L6 L5 L4 L3 L2 L1 L0 */
+ "pmullw %11, %%mm0\n" /* Cb2blue */
+ "pand %12, %%mm6\n" /* L1 00 L6 00 L4 00 L2 00 L0 */
+ "pmullw %13, %%mm3\n" /* Cr2green */
+ "movq (%2), %%mm7\n" /* L2 */
+ "pmullw %14, %%mm1\n" /* Cr2red */
+ "psrlw $8, %%mm7\n" /* L2 00 L7 00 L5 00 L3 00 L1 */
+ "pmullw %15, %%mm6\n" /* lum1 */
+ "paddw %%mm3, %%mm2\n" /* Cb2green + Cr2green == green */
+ "pmullw %15, %%mm7\n" /* lum2 */
+
+ "movq %%mm6, %%mm4\n" /* lum1 */
+ "paddw %%mm0, %%mm6\n" /* lum1 +blue 00 B6 00 B4 00 B2 00 B0 */
+ "movq %%mm4, %%mm5\n" /* lum1 */
+ "paddw %%mm1, %%mm4\n" /* lum1 +red 00 R6 00 R4 00 R2 00 R0 */
+ "paddw %%mm2, %%mm5\n" /* lum1 +green 00 G6 00 G4 00 G2 00 G0 */
+ "psraw $6, %%mm4\n" /* R1 0 .. 64 */
+ "movq %%mm7, %%mm3\n" /* lum2 00 L7 00 L5 00 L3 00 L1 */
+ "psraw $6, %%mm5\n" /* G1 - .. + */
+ "paddw %%mm0, %%mm7\n" /* Lum2 +blue 00 B7 00 B5 00 B3 00 B1 */
+ "psraw $6, %%mm6\n" /* B1 0 .. 64 */
+ "packuswb %%mm4, %%mm4\n" /* R1 R1 */
+ "packuswb %%mm5, %%mm5\n" /* G1 G1 */
+ "packuswb %%mm6, %%mm6\n" /* B1 B1 */
"punpcklbw %%mm4, %%mm4\n"
"punpcklbw %%mm5, %%mm5\n"
"pand %16, %%mm4\n"
- "psllw $3, %%mm5\n" // GREEN 1
+ "psllw $3, %%mm5\n" /* GREEN 1 */
"punpcklbw %%mm6, %%mm6\n"
"pand %17, %%mm5\n"
"pand %16, %%mm6\n"
- "por %%mm5, %%mm4\n" //
- "psrlw $11, %%mm6\n" // BLUE 1
- "movq %%mm3, %%mm5\n" // lum2
- "paddw %%mm1, %%mm3\n" // lum2 +red 00 R7 00 R5 00 R3 00 R1
- "paddw %%mm2, %%mm5\n" // lum2 +green 00 G7 00 G5 00 G3 00 G1
- "psraw $6, %%mm3\n" // R2
- "por %%mm6, %%mm4\n" // MM4
- "psraw $6, %%mm5\n" // G2
- "movq (%2, %4), %%mm6\n" // L3 load lum2
+ "por %%mm5, %%mm4\n" /* */
+ "psrlw $11, %%mm6\n" /* BLUE 1 */
+ "movq %%mm3, %%mm5\n" /* lum2 */
+ "paddw %%mm1, %%mm3\n" /* lum2 +red 00 R7 00 R5 00 R3 00 R1 */
+ "paddw %%mm2, %%mm5\n" /* lum2 +green 00 G7 00 G5 00 G3 00 G1 */
+ "psraw $6, %%mm3\n" /* R2 */
+ "por %%mm6, %%mm4\n" /* MM4 */
+ "psraw $6, %%mm5\n" /* G2 */
+ "movq (%2, %4), %%mm6\n" /* L3 load lum2 */
"psraw $6, %%mm7\n"
"packuswb %%mm3, %%mm3\n"
"packuswb %%mm5, %%mm5\n"
"packuswb %%mm7, %%mm7\n"
- "pand %12, %%mm6\n" // L3
+ "pand %12, %%mm6\n" /* L3 */
"punpcklbw %%mm3, %%mm3\n"
"punpcklbw %%mm5, %%mm5\n"
- "pmullw %15, %%mm6\n" // lum3
+ "pmullw %15, %%mm6\n" /* lum3 */
"punpcklbw %%mm7, %%mm7\n"
- "psllw $3, %%mm5\n" // GREEN 2
+ "psllw $3, %%mm5\n" /* GREEN 2 */
"pand %16, %%mm7\n"
"pand %16, %%mm3\n"
- "psrlw $11, %%mm7\n" // BLUE 2
+ "psrlw $11, %%mm7\n" /* BLUE 2 */
"pand %17, %%mm5\n"
"por %%mm7, %%mm3\n"
- "movq (%2,%4), %%mm7\n" // L4 load lum2
- "por %%mm5, %%mm3\n" //
- "psrlw $8, %%mm7\n" // L4
+ "movq (%2,%4), %%mm7\n" /* L4 load lum2 */
+ "por %%mm5, %%mm3\n"
+ "psrlw $8, %%mm7\n" /* L4 */
"movq %%mm4, %%mm5\n"
"punpcklwd %%mm3, %%mm4\n"
- "pmullw %15, %%mm7\n" // lum4
+ "pmullw %15, %%mm7\n" /* lum4 */
"punpckhwd %%mm3, %%mm5\n"
- "movq %%mm4, (%3)\n" // write row1
- "movq %%mm5, 8(%3)\n" // write row1
+ "movq %%mm4, (%3)\n" /* write row1 */
+ "movq %%mm5, 8(%3)\n" /* write row1 */
- "movq %%mm6, %%mm4\n" // Lum3
- "paddw %%mm0, %%mm6\n" // Lum3 +blue
+ "movq %%mm6, %%mm4\n" /* Lum3 */
+ "paddw %%mm0, %%mm6\n" /* Lum3 +blue */
- "movq %%mm4, %%mm5\n" // Lum3
- "paddw %%mm1, %%mm4\n" // Lum3 +red
- "paddw %%mm2, %%mm5\n" // Lum3 +green
+ "movq %%mm4, %%mm5\n" /* Lum3 */
+ "paddw %%mm1, %%mm4\n" /* Lum3 +red */
+ "paddw %%mm2, %%mm5\n" /* Lum3 +green */
"psraw $6, %%mm4\n"
- "movq %%mm7, %%mm3\n" // Lum4
+ "movq %%mm7, %%mm3\n" /* Lum4 */
"psraw $6, %%mm5\n"
- "paddw %%mm0, %%mm7\n" // Lum4 +blue
- "psraw $6, %%mm6\n" // Lum3 +blue
- "movq %%mm3, %%mm0\n" // Lum4
+ "paddw %%mm0, %%mm7\n" /* Lum4 +blue */
+ "psraw $6, %%mm6\n" /* Lum3 +blue */
+ "movq %%mm3, %%mm0\n" /* Lum4 */
"packuswb %%mm4, %%mm4\n"
- "paddw %%mm1, %%mm3\n" // Lum4 +red
+ "paddw %%mm1, %%mm3\n" /* Lum4 +red */
"packuswb %%mm5, %%mm5\n"
- "paddw %%mm2, %%mm0\n" // Lum4 +green
+ "paddw %%mm2, %%mm0\n" /* Lum4 +green */
"packuswb %%mm6, %%mm6\n"
"punpcklbw %%mm4, %%mm4\n"
"punpcklbw %%mm5, %%mm5\n"
"punpcklbw %%mm6, %%mm6\n"
- "psllw $3, %%mm5\n" // GREEN 3
+ "psllw $3, %%mm5\n" /* GREEN 3 */
"pand %16, %%mm4\n"
- "psraw $6, %%mm3\n" // psr 6
+ "psraw $6, %%mm3\n" /* psr 6 */
"psraw $6, %%mm0\n"
- "pand %16, %%mm6\n" // BLUE
+ "pand %16, %%mm6\n" /* BLUE */
"pand %17, %%mm5\n"
- "psrlw $11, %%mm6\n" // BLUE 3
+ "psrlw $11, %%mm6\n" /* BLUE 3 */
"por %%mm5, %%mm4\n"
"psraw $6, %%mm7\n"
"por %%mm6, %%mm4\n"
@@ -383,8 +383,8 @@ void Color565DitherYV12MMX1X( int *colortab, Uint32 *rgb_2_pix,
"punpcklbw %%mm0, %%mm0\n"
"punpcklbw %%mm7, %%mm7\n"
"pand %16, %%mm3\n"
- "pand %16, %%mm7\n" // BLUE
- "psllw $3, %%mm0\n" // GREEN 4
+ "pand %16, %%mm7\n" /* BLUE */
+ "psllw $3, %%mm0\n" /* GREEN 4 */
"psrlw $11, %%mm7\n"
"pand %17, %%mm0\n"
"por %%mm7, %%mm3\n"
@@ -404,16 +404,16 @@ void Color565DitherYV12MMX1X( int *colortab, Uint32 *rgb_2_pix,
"addl $4, %1\n"
"cmpl %4, %6\n"
"leal 16(%3), %3\n"
- "leal 16(%5),%5\n" // row2+16
+ "leal 16(%5),%5\n" /* row2+16 */
"jl 1b\n"
- "addl %4, %2\n" // lum += cols
- "addl %8, %3\n" // row1+= mod
- "addl %8, %5\n" // row2+= mod
- "movl $0, %6\n" // x=0
+ "addl %4, %2\n" /* lum += cols */
+ "addl %8, %3\n" /* row1+= mod */
+ "addl %8, %5\n" /* row2+= mod */
+ "movl $0, %6\n" /* x=0 */
"cmpl %7, %2\n"
"jl 1b\n"
- "addl $4, %%esp\n" // get rid of the stack slot we reserved.
+ "addl $4, %%esp\n" /* get rid of the stack slot we reserved. */
"emms\n"
:
: "m" (cr), "r"(cb),"r"(lum),
diff --git a/src/render/SDL_yuv_sw.c b/src/render/SDL_yuv_sw.c
index 9f04c21ca3..1d7e024c26 100644
--- a/src/render/SDL_yuv_sw.c
+++ b/src/render/SDL_yuv_sw.c
@@ -26,17 +26,17 @@
* Copyright (c) 1995 The Regents of the University of California.
* All rights reserved.
- *
+ *
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose, without fee, and without written agreement is
* hereby granted, provided that the above copyright notice and the following
* two paragraphs appear in all copies of this software.
- *
+ *
* IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
* OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
* CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
@@ -45,17 +45,17 @@
* Copyright (c) 1995 Erik Corry
* All rights reserved.
- *
+ *
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose, without fee, and without written agreement is
* hereby granted, provided that the above copyright notice and the following
* two paragraphs appear in all copies of this software.
- *
+ *
* IN NO EVENT SHALL ERIK CORRY BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
* SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF
* THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF ERIK CORRY HAS BEEN ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* ERIK CORRY SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS"
@@ -64,17 +64,17 @@
* Portions of this software Copyright (c) 1995 Brown University.
* All rights reserved.
- *
+ *
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose, without fee, and without written agreement
* is hereby granted, provided that the above copyright notice and the
* following two paragraphs appear in all copies of this software.
- *
+ *
* IN NO EVENT SHALL BROWN UNIVERSITY BE LIABLE TO ANY PARTY FOR
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
* OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF BROWN
* UNIVERSITY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* BROWN UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS"
@@ -904,7 +904,7 @@ SDL_SW_SetupYUVDisplay(SDL_SW_YUVTexture * swdata, Uint32 target_format)
g_2_pix_alloc = &swdata->rgb_2_pix[1 * 768];
b_2_pix_alloc = &swdata->rgb_2_pix[2 * 768];
- /*
+ /*
* Set up entries 0-255 in rgb-to-pixel value tables.
*/
for (i = 0; i < 256; ++i) {
@@ -922,7 +922,7 @@ SDL_SW_SetupYUVDisplay(SDL_SW_YUVTexture * swdata, Uint32 target_format)
/*
* If we have 16-bit output depth, then we double the value
* in the top word. This means that we can write out both
- * pixels in the pixel doubling mode with one op. It is
+ * pixels in the pixel doubling mode with one op. It is
* harmless in the normal case as storing a 32-bit value
* through a short pointer will lose the top bits anyway.
*/
diff --git a/src/render/direct3d/SDL_render_d3d.c b/src/render/direct3d/SDL_render_d3d.c
index 55c313a6ce..dea31f6442 100644
--- a/src/render/direct3d/SDL_render_d3d.c
+++ b/src/render/direct3d/SDL_render_d3d.c
@@ -121,23 +121,23 @@ HRESULT WINAPI D3DXCreateMatrixStack(DWORD flags, LPD3DXMATRIXSTACK* ppstack);
#endif
#ifdef ASSEMBLE_SHADER
-///////////////////////////////////////////////////////////////////////////
-// ID3DXBuffer:
-// ------------
-// The buffer object is used by D3DX to return arbitrary size data.
-//
-// GetBufferPointer -
-// Returns a pointer to the beginning of the buffer.
-//
-// GetBufferSize -
-// Returns the size of the buffer, in bytes.
-///////////////////////////////////////////////////////////////////////////
+/**************************************************************************
+ * ID3DXBuffer:
+ * ------------
+ * The buffer object is used by D3DX to return arbitrary size data.
+ *
+ * GetBufferPointer -
+ * Returns a pointer to the beginning of the buffer.
+ *
+ * GetBufferSize -
+ * Returns the size of the buffer, in bytes.
+ **************************************************************************/
typedef interface ID3DXBuffer ID3DXBuffer;
typedef interface ID3DXBuffer *LPD3DXBUFFER;
-// {8BA5FB08-5195-40e2-AC58-0D989C3A0102}
-DEFINE_GUID(IID_ID3DXBuffer,
+/* {8BA5FB08-5195-40e2-AC58-0D989C3A0102} */
+DEFINE_GUID(IID_ID3DXBuffer,
0x8ba5fb08, 0x5195, 0x40e2, 0xac, 0x58, 0xd, 0x98, 0x9c, 0x3a, 0x1, 0x2);
#undef INTERFACE
@@ -149,12 +149,12 @@ typedef interface ID3DXBuffer {
typedef const struct ID3DXBufferVtbl ID3DXBufferVtbl;
const struct ID3DXBufferVtbl
{
- // IUnknown
+ /* IUnknown */
STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE;
STDMETHOD_(ULONG, AddRef)(THIS) PURE;
STDMETHOD_(ULONG, Release)(THIS) PURE;
- // ID3DXBuffer
+ /* ID3DXBuffer */
STDMETHOD_(LPVOID, GetBufferPointer)(THIS) PURE;
STDMETHOD_(DWORD, GetBufferSize)(THIS) PURE;
};
@@ -444,7 +444,7 @@ D3D_CreateRenderer(SDL_Window * window, Uint32 flags)
SDL_DisplayMode fullscreen_mode;
D3DMATRIX matrix;
int d3dxVersion;
- char d3dxDLLFile[50];
+ char d3dxDLLFile[50];
renderer = (SDL_Renderer *) SDL_calloc(1, sizeof(*renderer));
if (!renderer) {
@@ -496,7 +496,7 @@ D3D_CreateRenderer(SDL_Window * window, Uint32 flags)
}
-
+
if (!data->d3d || !data->matrixStack) {
SDL_free(renderer);
SDL_free(data);
@@ -548,14 +548,14 @@ D3D_CreateRenderer(SDL_Window * window, Uint32 flags)
pparams.SwapEffect = D3DSWAPEFFECT_DISCARD;
if (window_flags & SDL_WINDOW_FULLSCREEN) {
- if ( ( window_flags & SDL_WINDOW_FULLSCREEN_DESKTOP ) == SDL_WINDOW_FULLSCREEN_DESKTOP ) {
- pparams.Windowed = TRUE;
- pparams.FullScreen_RefreshRateInHz = 0;
- } else {
+ if ( ( window_flags & SDL_WINDOW_FULLSCREEN_DESKTOP ) == SDL_WINDOW_FULLSCREEN_DESKTOP ) {
+ pparams.Windowed = TRUE;
+ pparams.FullScreen_RefreshRateInHz = 0;
+ } else {
pparams.Windowed = FALSE;
pparams.FullScreen_RefreshRateInHz =
fullscreen_mode.refresh_rate;
- }
+ }
} else {
pparams.Windowed = TRUE;
pparams.FullScreen_RefreshRateInHz = 0;
@@ -1338,7 +1338,7 @@ D3D_RenderCopyEx(SDL_Renderer * renderer, SDL_Texture * texture,
D3D_SetBlendMode(data, texture->blendMode);
- // Rotate and translate
+ /* Rotate and translate */
ID3DXMatrixStack_Push(data->matrixStack);
ID3DXMatrixStack_LoadIdentity(data->matrixStack);
ID3DXMatrixStack_RotateYawPitchRoll(data->matrixStack, 0.0, 0.0, (float)(M_PI * (float) angle / 180.0f));
@@ -1491,7 +1491,7 @@ D3D_DestroyRenderer(SDL_Renderer * renderer)
D3D_RenderData *data = (D3D_RenderData *) renderer->driverdata;
if (data) {
- // Release the render target
+ /* Release the render target */
if (data->defaultRenderTarget) {
IDirect3DSurface9_Release(data->defaultRenderTarget);
data->defaultRenderTarget = NULL;
@@ -1500,7 +1500,7 @@ D3D_DestroyRenderer(SDL_Renderer * renderer)
IDirect3DSurface9_Release(data->currentRenderTarget);
data->currentRenderTarget = NULL;
}
-
+
if (data->device) {
IDirect3DDevice9_Release(data->device);
}
diff --git a/src/render/opengl/SDL_render_gl.c b/src/render/opengl/SDL_render_gl.c
index 3b0f01f15d..73ec0a8f85 100644
--- a/src/render/opengl/SDL_render_gl.c
+++ b/src/render/opengl/SDL_render_gl.c
@@ -106,7 +106,7 @@ typedef struct
Uint32 color;
int blendMode;
} current;
-
+
SDL_bool GL_EXT_framebuffer_object_supported;
GL_FBOList *framebuffers;
@@ -119,7 +119,7 @@ typedef struct
SDL_bool GL_ARB_multitexture_supported;
PFNGLACTIVETEXTUREARBPROC glActiveTextureARB;
GLint num_texture_units;
-
+
PFNGLGENFRAMEBUFFERSEXTPROC glGenFramebuffersEXT;
PFNGLDELETEFRAMEBUFFERSEXTPROC glDeleteFramebuffersEXT;
PFNGLFRAMEBUFFERTEXTURE2DEXTPROC glFramebufferTexture2DEXT;
@@ -147,7 +147,7 @@ typedef struct
SDL_bool yuv;
GLuint utexture;
GLuint vtexture;
-
+
GL_FBOList *fbo;
} GL_TextureData;
@@ -408,7 +408,7 @@ GL_CreateRenderer(SDL_Window * window, Uint32 flags)
renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_YV12;
renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_IYUV;
}
-
+
if (SDL_GL_ExtensionSupported("GL_EXT_framebuffer_object")) {
data->GL_EXT_framebuffer_object_supported = SDL_TRUE;
data->glGenFramebuffersEXT = (PFNGLGENFRAMEBUFFERSEXTPROC)
@@ -527,7 +527,7 @@ GL_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
}
texture->driverdata = data;
-
+
if (texture->access == SDL_TEXTUREACCESS_TARGET) {
data->fbo = GL_GetFBO(renderdata, texture->w, texture->h);
} else {
@@ -702,7 +702,7 @@ GL_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture,
GL_TextureData *data = (GL_TextureData *) texture->driverdata;
data->locked_rect = *rect;
- *pixels =
+ *pixels =
(void *) ((Uint8 *) data->pixels + rect->y * data->pitch +
rect->x * SDL_BYTESPERPIXEL(texture->format));
*pitch = data->pitch;
@@ -717,7 +717,7 @@ GL_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture)
void *pixels;
rect = &data->locked_rect;
- pixels =
+ pixels =
(void *) ((Uint8 *) data->pixels + rect->y * data->pitch +
rect->x * SDL_BYTESPERPIXEL(texture->format));
GL_UpdateTexture(renderer, texture, rect, pixels, data->pitch);
@@ -726,12 +726,12 @@ GL_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture)
static int
GL_SetRenderTarget(SDL_Renderer * renderer, SDL_Texture * texture)
{
- GL_RenderData *data = (GL_RenderData *) renderer->driverdata;
+ GL_RenderData *data = (GL_RenderData *) renderer->driverdata;
GL_TextureData *texturedata;
GLenum status;
GL_ActivateRenderer(renderer);
-
+
if (texture == NULL) {
data->glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
return 0;
@@ -914,7 +914,7 @@ GL_RenderDrawLines(SDL_Renderer * renderer, const SDL_FPoint * points,
GL_SetDrawingState(renderer);
- if (count > 2 &&
+ if (count > 2 &&
points[0].x == points[count-1].x && points[0].y == points[count-1].y) {
data->glBegin(GL_LINE_LOOP);
/* GL_LINE_LOOP takes care of the final segment */
@@ -1125,11 +1125,11 @@ GL_RenderCopyEx(SDL_Renderer * renderer, SDL_Texture * texture,
maxv = (GLfloat) (srcrect->y + srcrect->h) / texture->h;
maxv *= texturedata->texh;
- // Translate to flip, rotate, translate to position
+ /* Translate to flip, rotate, translate to position */
data->glPushMatrix();
- data->glTranslatef((GLfloat)dstrect->x + centerx, (GLfloat)dstrect->y + centery, (GLfloat)0.0);
+ data->glTranslatef((GLfloat)dstrect->x + centerx, (GLfloat)dstrect->y + centery, (GLfloat)0.0);
data->glRotated(angle, (GLdouble)0.0, (GLdouble)0.0, (GLdouble)1.0);
-
+
data->glBegin(GL_TRIANGLE_STRIP);
data->glTexCoord2f(minu, minv);
data->glVertex2f(minx, miny);
@@ -1141,7 +1141,7 @@ GL_RenderCopyEx(SDL_Renderer * renderer, SDL_Texture * texture,
data->glVertex2f(maxx, maxy);
data->glEnd();
data->glPopMatrix();
-
+
data->glDisable(texturedata->type);
GL_CheckError("", renderer);
@@ -1303,7 +1303,7 @@ static int GL_UnbindTexture (SDL_Renderer * renderer, SDL_Texture *texture) {
data->glActiveTextureARB(GL_TEXTURE0_ARB);
}
-
+
data->glDisable(texturedata->type);
return 0;
diff --git a/src/render/opengl/SDL_shaders_gl.c b/src/render/opengl/SDL_shaders_gl.c
index 9b75032ef6..1e6262191d 100644
--- a/src/render/opengl/SDL_shaders_gl.c
+++ b/src/render/opengl/SDL_shaders_gl.c
@@ -216,7 +216,7 @@ CompileShaderProgram(GL_ShaderContext *ctx, int index, GL_ShaderData *data)
/* Make sure we use the correct sampler type for our texture type */
if (ctx->GL_ARB_texture_rectangle_supported) {
- frag_defines =
+ frag_defines =
"#define sampler2D sampler2DRect\n"
"#define texture2D texture2DRect\n";
}
@@ -252,7 +252,7 @@ CompileShaderProgram(GL_ShaderContext *ctx, int index, GL_ShaderData *data)
}
}
ctx->glUseProgramObjectARB(0);
-
+
return (ctx->glGetError() == GL_NO_ERROR);
}
diff --git a/src/render/opengles/SDL_render_gles.c b/src/render/opengles/SDL_render_gles.c
index 37e32bfe77..bd3eedfead 100644
--- a/src/render/opengles/SDL_render_gles.c
+++ b/src/render/opengles/SDL_render_gles.c
@@ -189,7 +189,7 @@ static int GLES_LoadFunctions(GLES_RenderData * data)
if ( ! data->func ) { \
return SDL_SetError("Couldn't load GLES function %s: %s\n", #func, SDL_GetError()); \
} \
- } while ( 0 );
+ } while ( 0 );
#endif /* _SDL_NOGETPROCADDR_ */
#include "SDL_glesfuncs.h"
@@ -270,11 +270,11 @@ GLES_CreateRenderer(SDL_Window * window, Uint32 flags)
GLES_RenderData *data;
GLint value;
Uint32 windowFlags;
-
+
SDL_GL_SetAttribute(SDL_GL_CONTEXT_EGL, 1);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 1);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1);
-
+
windowFlags = SDL_GetWindowFlags(window);
if (!(windowFlags & SDL_WINDOW_OPENGL)) {
if (SDL_RecreateWindow(window, windowFlags | SDL_WINDOW_OPENGL) < 0) {
@@ -386,7 +386,7 @@ static void
GLES_WindowEvent(SDL_Renderer * renderer, const SDL_WindowEvent *event)
{
GLES_RenderData *data = (GLES_RenderData *) renderer->driverdata;
-
+
if (event->event == SDL_WINDOWEVENT_SIZE_CHANGED ||
event->event == SDL_WINDOWEVENT_SHOWN ||
event->event == SDL_WINDOWEVENT_HIDDEN) {
@@ -765,7 +765,7 @@ GLES_RenderDrawLines(SDL_Renderer * renderer, const SDL_FPoint * points,
GLES_SetDrawingState(renderer);
data->glVertexPointer(2, GL_FLOAT, 0, points);
- if (count > 2 &&
+ if (count > 2 &&
points[0].x == points[count-1].x && points[0].y == points[count-1].y) {
/* GL_LINE_LOOP takes care of the final segment */
--count;
@@ -920,7 +920,7 @@ GLES_RenderCopyEx(SDL_Renderer * renderer, SDL_Texture * texture,
GLfloat minx, miny, maxx, maxy;
GLfloat minu, maxu, minv, maxv;
GLfloat centerx, centery;
-
+
GLES_ActivateRenderer(renderer);
data->glEnable(GL_TEXTURE_2D);
@@ -940,7 +940,7 @@ GLES_RenderCopyEx(SDL_Renderer * renderer, SDL_Texture * texture,
centerx = center->x;
centery = center->y;
- // Rotate and translate
+ /* Rotate and translate */
data->glPushMatrix();
data->glTranslatef(dstrect->x + centerx, dstrect->y + centery, 0.0f);
data->glRotatef((GLfloat)angle, 0.0f, 0.0f, 1.0f);
diff --git a/src/render/opengles2/SDL_render_gles2.c b/src/render/opengles2/SDL_render_gles2.c
index 0f74aeadc2..3933100d68 100644
--- a/src/render/opengles2/SDL_render_gles2.c
+++ b/src/render/opengles2/SDL_render_gles2.c
@@ -1237,7 +1237,7 @@ GLES2_RenderCopy(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect *s
break;
}
}
- else sourceType = GLES2_IMAGESOURCE_TEXTURE_ABGR; // Texture formats match, use the non color mapping shader (even if the formats are not ABGR)
+ else sourceType = GLES2_IMAGESOURCE_TEXTURE_ABGR; /* Texture formats match, use the non color mapping shader (even if the formats are not ABGR) */
}
else {
switch (texture->format)
@@ -1334,7 +1334,7 @@ GLES2_RenderCopyEx(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect
GLfloat tmp;
GLES2_ActivateRenderer(renderer);
-
+
rdata->glEnableVertexAttribArray(GLES2_ATTRIBUTE_CENTER);
rdata->glEnableVertexAttribArray(GLES2_ATTRIBUTE_ANGLE);
fAngle[0] = fAngle[1] = fAngle[2] = fAngle[3] = (GLfloat)(360.0f - angle);
@@ -1403,7 +1403,7 @@ GLES2_RenderCopyEx(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect
break;
}
}
- else sourceType = GLES2_IMAGESOURCE_TEXTURE_ABGR; // Texture formats match, use the non color mapping shader (even if the formats are not ABGR)
+ else sourceType = GLES2_IMAGESOURCE_TEXTURE_ABGR; /* Texture formats match, use the non color mapping shader (even if the formats are not ABGR) */
}
else {
switch (texture->format)
@@ -1476,7 +1476,7 @@ GLES2_RenderCopyEx(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect
vertices[1] = vertices[3] = vertices[5];
vertices[5] = vertices[7] = tmp;
}
-
+
rdata->glVertexAttribPointer(GLES2_ATTRIBUTE_ANGLE, 1, GL_FLOAT, GL_FALSE, 0, &fAngle);
rdata->glVertexAttribPointer(GLES2_ATTRIBUTE_CENTER, 2, GL_FLOAT, GL_FALSE, 0, translate);
rdata->glVertexAttribPointer(GLES2_ATTRIBUTE_POSITION, 2, GL_FLOAT, GL_FALSE, 0, vertices);
diff --git a/src/render/opengles2/SDL_shaders_gles2.c b/src/render/opengles2/SDL_shaders_gles2.c
index 3d3a2416c0..fb6921fd09 100644
--- a/src/render/opengles2/SDL_shaders_gles2.c
+++ b/src/render/opengles2/SDL_shaders_gles2.c
@@ -75,7 +75,7 @@ static const Uint8 GLES2_FragmentSrc_TextureABGRSrc_[] = " \
} \
";
-// ARGB to ABGR conversion
+/* ARGB to ABGR conversion */
static const Uint8 GLES2_FragmentSrc_TextureARGBSrc_[] = " \
precision mediump float; \
uniform sampler2D u_texture; \
@@ -92,7 +92,7 @@ static const Uint8 GLES2_FragmentSrc_TextureARGBSrc_[] = " \
} \
";
-// RGB to ABGR conversion
+/* RGB to ABGR conversion */
static const Uint8 GLES2_FragmentSrc_TextureRGBSrc_[] = " \
precision mediump float; \
uniform sampler2D u_texture; \
@@ -110,7 +110,7 @@ static const Uint8 GLES2_FragmentSrc_TextureRGBSrc_[] = " \
} \
";
-// BGR to ABGR conversion
+/* BGR to ABGR conversion */
static const Uint8 GLES2_FragmentSrc_TextureBGRSrc_[] = " \
precision mediump float; \
uniform sampler2D u_texture; \
@@ -744,7 +744,7 @@ const GLES2_Shader *GLES2_GetShader(GLES2_ShaderType type, SDL_BlendMode blendMo
default:
return NULL;
}
-
+
case GLES2_SHADER_FRAGMENT_TEXTURE_RGB_SRC:
switch (blendMode)
{
@@ -759,7 +759,7 @@ const GLES2_Shader *GLES2_GetShader(GLES2_ShaderType type, SDL_BlendMode blendMo
default:
return NULL;
}
-
+
case GLES2_SHADER_FRAGMENT_TEXTURE_BGR_SRC:
switch (blendMode)
{
@@ -774,7 +774,7 @@ const GLES2_Shader *GLES2_GetShader(GLES2_ShaderType type, SDL_BlendMode blendMo
default:
return NULL;
}
-
+
default:
return NULL;
}
diff --git a/src/render/psp/SDL_render_psp.c b/src/render/psp/SDL_render_psp.c
index 4d8f333046..7ea536d145 100644
--- a/src/render/psp/SDL_render_psp.c
+++ b/src/render/psp/SDL_render_psp.c
@@ -20,7 +20,7 @@
*/
#include "SDL_config.h"
-#if SDL_VIDEO_RENDER_PSP
+#if SDL_VIDEO_RENDER_PSP
#include "SDL_hints.h"
#include "../SDL_sysrender.h"
@@ -93,94 +93,94 @@ SDL_RenderDriver PSP_RenderDriver = {
};
*/
SDL_RenderDriver PSP_RenderDriver = {
- .CreateRenderer = PSP_CreateRenderer,
+ .CreateRenderer = PSP_CreateRenderer,
.info = {
- .name = "PSP",
- .flags = SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_TARGETTEXTURE,
- .num_texture_formats = 4,
- .texture_formats = { [0] = SDL_PIXELFORMAT_BGR565,
- [1] = SDL_PIXELFORMAT_ABGR1555,
- [2] = SDL_PIXELFORMAT_ABGR4444,
- [3] = SDL_PIXELFORMAT_ABGR8888,
- },
- .max_texture_width = 512,
- .max_texture_height = 512,
+ .name = "PSP",
+ .flags = SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_TARGETTEXTURE,
+ .num_texture_formats = 4,
+ .texture_formats = { [0] = SDL_PIXELFORMAT_BGR565,
+ [1] = SDL_PIXELFORMAT_ABGR1555,
+ [2] = SDL_PIXELFORMAT_ABGR4444,
+ [3] = SDL_PIXELFORMAT_ABGR8888,
+ },
+ .max_texture_width = 512,
+ .max_texture_height = 512,
}
};
-#define PSP_SCREEN_WIDTH 480
-#define PSP_SCREEN_HEIGHT 272
+#define PSP_SCREEN_WIDTH 480
+#define PSP_SCREEN_HEIGHT 272
-#define PSP_FRAME_BUFFER_WIDTH 512
-#define PSP_FRAME_BUFFER_SIZE (PSP_FRAME_BUFFER_WIDTH*PSP_SCREEN_HEIGHT)
+#define PSP_FRAME_BUFFER_WIDTH 512
+#define PSP_FRAME_BUFFER_SIZE (PSP_FRAME_BUFFER_WIDTH*PSP_SCREEN_HEIGHT)
static unsigned int __attribute__((aligned(16))) DisplayList[262144];
-
-#define COL5650(r,g,b,a) ((r>>3) | ((g>>2)<<5) | ((b>>3)<<11))
-#define COL5551(r,g,b,a) ((r>>3) | ((g>>3)<<5) | ((b>>3)<<10) | (a>0?0x7000:0))
-#define COL4444(r,g,b,a) ((r>>4) | ((g>>4)<<4) | ((b>>4)<<8) | ((a>>4)<<12))
-#define COL8888(r,g,b,a) ((r) | ((g)<<8) | ((b)<<16) | ((a)<<24))
-
+
+#define COL5650(r,g,b,a) ((r>>3) | ((g>>2)<<5) | ((b>>3)<<11))
+#define COL5551(r,g,b,a) ((r>>3) | ((g>>3)<<5) | ((b>>3)<<10) | (a>0?0x7000:0))
+#define COL4444(r,g,b,a) ((r>>4) | ((g>>4)<<4) | ((b>>4)<<8) | ((a>>4)<<12))
+#define COL8888(r,g,b,a) ((r) | ((g)<<8) | ((b)<<16) | ((a)<<24))
+
typedef struct
{
- void* frontbuffer ;
- void* backbuffer ;
- SDL_bool initialized ;
- SDL_bool displayListAvail ;
- unsigned int psm ;
- unsigned int bpp ;
-
- SDL_bool vsync;
- unsigned int currentColor;
- int currentBlendMode;
-
+ void* frontbuffer ;
+ void* backbuffer ;
+ SDL_bool initialized ;
+ SDL_bool displayListAvail ;
+ unsigned int psm ;
+ unsigned int bpp ;
+
+ SDL_bool vsync;
+ unsigned int currentColor;
+ int currentBlendMode;
+
} PSP_RenderData;
typedef struct
{
- void *data; /**< Image data. */
- unsigned int size; /**< Size of data in bytes. */
- unsigned int width; /**< Image width. */
- unsigned int height; /**< Image height. */
- unsigned int textureWidth; /**< Texture width (power of two). */
- unsigned int textureHeight; /**< Texture height (power of two). */
- unsigned int bits; /**< Image bits per pixel. */
- unsigned int format; /**< Image format - one of ::pgePixelFormat. */
- unsigned int pitch;
- SDL_bool swizzled; /**< Is image swizzled. */
+ void *data; /**< Image data. */
+ unsigned int size; /**< Size of data in bytes. */
+ unsigned int width; /**< Image width. */
+ unsigned int height; /**< Image height. */
+ unsigned int textureWidth; /**< Texture width (power of two). */
+ unsigned int textureHeight; /**< Texture height (power of two). */
+ unsigned int bits; /**< Image bits per pixel. */
+ unsigned int format; /**< Image format - one of ::pgePixelFormat. */
+ unsigned int pitch;
+ SDL_bool swizzled; /**< Is image swizzled. */
} PSP_TextureData;
typedef struct
-{
- float x, y, z;
+{
+ float x, y, z;
} VertV;
typedef struct
{
- float u, v;
- float x, y, z;
-
+ float u, v;
+ float x, y, z;
+
} VertTV;
-// Return next power of 2
-static int
+/* Return next power of 2 */
+static int
TextureNextPow2(unsigned int w)
{
- if(w == 0)
- return 0;
+ if(w == 0)
+ return 0;
- unsigned int n = 2;
+ unsigned int n = 2;
- while(w > n)
- n <<= 1;
+ while(w > n)
+ n <<= 1;
- return n;
+ return n;
}
@@ -190,9 +190,9 @@ GetScaleQuality(void)
const char *hint = SDL_GetHint(SDL_HINT_RENDER_SCALE_QUALITY);
if (!hint || *hint == '0' || SDL_strcasecmp(hint, "nearest") == 0) {
- return GU_NEAREST; // GU_NEAREST good for tile-map
+ return GU_NEAREST; /* GU_NEAREST good for tile-map */
} else {
- return GU_LINEAR; // GU_LINEAR good for scaling
+ return GU_LINEAR; /* GU_LINEAR good for scaling */
}
}
@@ -207,133 +207,133 @@ PixelFormatToPSPFMT(Uint32 format)
case SDL_PIXELFORMAT_ABGR4444:
return GU_PSM_4444;
case SDL_PIXELFORMAT_ABGR8888:
- return GU_PSM_8888;
- default:
+ return GU_PSM_8888;
+ default:
return GU_PSM_8888;
}
}
-void
+void
StartDrawing(SDL_Renderer * renderer)
-{
- PSP_RenderData *data = (PSP_RenderData *) renderer->driverdata;
- if(data->displayListAvail)
- return;
+{
+ PSP_RenderData *data = (PSP_RenderData *) renderer->driverdata;
+ if(data->displayListAvail)
+ return;
- sceGuStart(GU_DIRECT, DisplayList);
- data->displayListAvail = SDL_TRUE;
+ sceGuStart(GU_DIRECT, DisplayList);
+ data->displayListAvail = SDL_TRUE;
}
-int
+int
TextureSwizzle(PSP_TextureData *psp_texture)
{
- if(psp_texture->swizzled)
- return 1;
-
- int bytewidth = psp_texture->textureWidth*(psp_texture->bits>>3);
- int height = psp_texture->size / bytewidth;
+ if(psp_texture->swizzled)
+ return 1;
+
+ int bytewidth = psp_texture->textureWidth*(psp_texture->bits>>3);
+ int height = psp_texture->size / bytewidth;
- int rowblocks = (bytewidth>>4);
- int rowblocksadd = (rowblocks-1)<<7;
- unsigned int blockaddress = 0;
- unsigned int *src = (unsigned int*) psp_texture->data;
+ int rowblocks = (bytewidth>>4);
+ int rowblocksadd = (rowblocks-1)<<7;
+ unsigned int blockaddress = 0;
+ unsigned int *src = (unsigned int*) psp_texture->data;
- unsigned char *data = NULL;
- data = malloc(psp_texture->size);
+ unsigned char *data = NULL;
+ data = malloc(psp_texture->size);
- int j;
+ int j;
- for(j = 0; j < height; j++, blockaddress += 16)
- {
- unsigned int *block;
+ for(j = 0; j < height; j++, blockaddress += 16)
+ {
+ unsigned int *block;
- block = (unsigned int*)&data[blockaddress];
+ block = (unsigned int*)&data[blockaddress];
- int i;
+ int i;
- for(i = 0; i < rowblocks; i++)
- {
- *block++ = *src++;
- *block++ = *src++;
- *block++ = *src++;
- *block++ = *src++;
- block += 28;
- }
+ for(i = 0; i < rowblocks; i++)
+ {
+ *block++ = *src++;
+ *block++ = *src++;
+ *block++ = *src++;
+ *block++ = *src++;
+ block += 28;
+ }
- if((j & 0x7) == 0x7)
- blockaddress += rowblocksadd;
- }
+ if((j & 0x7) == 0x7)
+ blockaddress += rowblocksadd;
+ }
- free(psp_texture->data);
- psp_texture->data = data;
- psp_texture->swizzled = SDL_TRUE;
+ free(psp_texture->data);
+ psp_texture->data = data;
+ psp_texture->swizzled = SDL_TRUE;
- return 1;
+ return 1;
}
int TextureUnswizzle(PSP_TextureData *psp_texture)
{
- if(!psp_texture->swizzled)
- return 1;
-
- int blockx, blocky;
-
- int bytewidth = psp_texture->textureWidth*(psp_texture->bits>>3);
- int height = psp_texture->size / bytewidth;
-
- int widthblocks = bytewidth/16;
- int heightblocks = height/8;
-
- int dstpitch = (bytewidth - 16)/4;
- int dstrow = bytewidth * 8;
-
- unsigned int *src = (unsigned int*) psp_texture->data;
-
- unsigned char *data = NULL;
-
- data = malloc(psp_texture->size);
-
- if(!data)
- return 0;
-
- sceKernelDcacheWritebackAll();
-
- int j;
-
- unsigned char *ydst = (unsigned char *)data;
-
- for(blocky = 0; blocky < heightblocks; ++blocky)
- {
- unsigned char *xdst = ydst;
-
- for(blockx = 0; blockx < widthblocks; ++blockx)
- {
- unsigned int *block;
-
- block = (unsigned int*)xdst;
-
- for(j = 0; j < 8; ++j)
- {
- *(block++) = *(src++);
- *(block++) = *(src++);
- *(block++) = *(src++);
- *(block++) = *(src++);
- block += dstpitch;
- }
-
- xdst += 16;
- }
-
- ydst += dstrow;
- }
-
- free(psp_texture->data);
-
- psp_texture->data = data;
-
- psp_texture->swizzled = SDL_FALSE;
-
- return 1;
+ if(!psp_texture->swizzled)
+ return 1;
+
+ int blockx, blocky;
+
+ int bytewidth = psp_texture->textureWidth*(psp_texture->bits>>3);
+ int height = psp_texture->size / bytewidth;
+
+ int widthblocks = bytewidth/16;
+ int heightblocks = height/8;
+
+ int dstpitch = (bytewidth - 16)/4;
+ int dstrow = bytewidth * 8;
+
+ unsigned int *src = (unsigned int*) psp_texture->data;
+
+ unsigned char *data = NULL;
+
+ data = malloc(psp_texture->size);
+
+ if(!data)
+ return 0;
+
+ sceKernelDcacheWritebackAll();
+
+ int j;
+
+ unsigned char *ydst = (unsigned char *)data;
+
+ for(blocky = 0; blocky < heightblocks; ++blocky)
+ {
+ unsigned char *xdst = ydst;
+
+ for(blockx = 0; blockx < widthblocks; ++blockx)
+ {
+ unsigned int *block;
+
+ block = (unsigned int*)xdst;
+
+ for(j = 0; j < 8; ++j)
+ {
+ *(block++) = *(src++);
+ *(block++) = *(src++);
+ *(block++) = *(src++);
+ *(block++) = *(src++);
+ block += dstpitch;
+ }
+
+ xdst += 16;
+ }
+
+ ydst += dstrow;
+ }
+
+ free(psp_texture->data);
+
+ psp_texture->data = data;
+
+ psp_texture->swizzled = SDL_FALSE;
+
+ return 1;
}
SDL_Renderer *
@@ -342,7 +342,7 @@ PSP_CreateRenderer(SDL_Window * window, Uint32 flags)
SDL_Renderer *renderer;
PSP_RenderData *data;
- int pixelformat;
+ int pixelformat;
renderer = (SDL_Renderer *) SDL_calloc(1, sizeof(*renderer));
if (!renderer) {
SDL_OutOfMemory();
@@ -355,8 +355,8 @@ PSP_CreateRenderer(SDL_Window * window, Uint32 flags)
SDL_OutOfMemory();
return NULL;
}
-
-
+
+
renderer->WindowEvent = PSP_WindowEvent;
renderer->CreateTexture = PSP_CreateTexture;
renderer->UpdateTexture = PSP_UpdateTexture;
@@ -378,73 +378,73 @@ PSP_CreateRenderer(SDL_Window * window, Uint32 flags)
renderer->info.flags = SDL_RENDERER_ACCELERATED;
renderer->driverdata = data;
renderer->window = window;
-
- if (data->initialized != SDL_FALSE)
- return 0;
- data->initialized = SDL_TRUE;
-
+
+ if (data->initialized != SDL_FALSE)
+ return 0;
+ data->initialized = SDL_TRUE;
+
if (flags & SDL_RENDERER_PRESENTVSYNC) {
data->vsync = SDL_TRUE;
} else {
data->vsync = SDL_FALSE;
}
-
- pixelformat=PixelFormatToPSPFMT(SDL_GetWindowPixelFormat(window));
- switch(pixelformat)
- {
- case GU_PSM_4444:
- case GU_PSM_5650:
- case GU_PSM_5551:
- data->frontbuffer = (unsigned int *)(PSP_FRAME_BUFFER_SIZE<<1);
- data->backbuffer = (unsigned int *)(0);
- data->bpp = 2;
- data->psm = pixelformat;
- break;
- default:
- data->frontbuffer = (unsigned int *)(PSP_FRAME_BUFFER_SIZE<<2);
- data->backbuffer = (unsigned int *)(0);
- data->bpp = 4;
- data->psm = GU_PSM_8888;
- break;
- }
-
- sceGuInit();
- // setup GU
- sceGuStart(GU_DIRECT, DisplayList);
- sceGuDrawBuffer(data->psm, data->frontbuffer, PSP_FRAME_BUFFER_WIDTH);
- sceGuDispBuffer(PSP_SCREEN_WIDTH, PSP_SCREEN_HEIGHT, data->backbuffer, PSP_FRAME_BUFFER_WIDTH);
-
-
- sceGuOffset(2048 - (PSP_SCREEN_WIDTH>>1), 2048 - (PSP_SCREEN_HEIGHT>>1));
- sceGuViewport(2048, 2048, PSP_SCREEN_WIDTH, PSP_SCREEN_HEIGHT);
+
+ pixelformat=PixelFormatToPSPFMT(SDL_GetWindowPixelFormat(window));
+ switch(pixelformat)
+ {
+ case GU_PSM_4444:
+ case GU_PSM_5650:
+ case GU_PSM_5551:
+ data->frontbuffer = (unsigned int *)(PSP_FRAME_BUFFER_SIZE<<1);
+ data->backbuffer = (unsigned int *)(0);
+ data->bpp = 2;
+ data->psm = pixelformat;
+ break;
+ default:
+ data->frontbuffer = (unsigned int *)(PSP_FRAME_BUFFER_SIZE<<2);
+ data->backbuffer = (unsigned int *)(0);
+ data->bpp = 4;
+ data->psm = GU_PSM_8888;
+ break;
+ }
+
+ sceGuInit();
+ /* setup GU */
+ sceGuStart(GU_DIRECT, DisplayList);
+ sceGuDrawBuffer(data->psm, data->frontbuffer, PSP_FRAME_BUFFER_WIDTH);
+ sceGuDispBuffer(PSP_SCREEN_WIDTH, PSP_SCREEN_HEIGHT, data->backbuffer, PSP_FRAME_BUFFER_WIDTH);
+
+
+ sceGuOffset(2048 - (PSP_SCREEN_WIDTH>>1), 2048 - (PSP_SCREEN_HEIGHT>>1));
+ sceGuViewport(2048, 2048, PSP_SCREEN_WIDTH, PSP_SCREEN_HEIGHT);
data->frontbuffer = vabsptr(data->frontbuffer);
data->backbuffer = vabsptr(data->backbuffer);
-
- // Scissoring
- sceGuScissor(0, 0, PSP_SCREEN_WIDTH, PSP_SCREEN_HEIGHT);
- sceGuEnable(GU_SCISSOR_TEST);
-
- // Backface culling
- sceGuFrontFace(GU_CCW);
- sceGuEnable(GU_CULL_FACE);
-
- // Texturing
- sceGuEnable(GU_TEXTURE_2D);
- sceGuShadeModel(GU_SMOOTH);
- sceGuTexWrap(GU_REPEAT, GU_REPEAT);
-
- // Blending
- sceGuEnable(GU_BLEND);
- sceGuBlendFunc(GU_ADD, GU_SRC_ALPHA, GU_ONE_MINUS_SRC_ALPHA, 0, 0);
-
- sceGuTexFilter(GU_LINEAR,GU_LINEAR);
-
- sceGuFinish();
- sceGuSync(0,0);
- sceDisplayWaitVblankStartCB();
- sceGuDisplay(GU_TRUE);
-
+
+ /* Scissoring */
+ sceGuScissor(0, 0, PSP_SCREEN_WIDTH, PSP_SCREEN_HEIGHT);
+ sceGuEnable(GU_SCISSOR_TEST);
+
+ /* Backface culling */
+ sceGuFrontFace(GU_CCW);
+ sceGuEnable(GU_CULL_FACE);
+
+ /* Texturing */
+ sceGuEnable(GU_TEXTURE_2D);
+ sceGuShadeModel(GU_SMOOTH);
+ sceGuTexWrap(GU_REPEAT, GU_REPEAT);
+
+ /* Blending */
+ sceGuEnable(GU_BLEND);
+ sceGuBlendFunc(GU_ADD, GU_SRC_ALPHA, GU_ONE_MINUS_SRC_ALPHA, 0, 0);
+
+ sceGuTexFilter(GU_LINEAR,GU_LINEAR);
+
+ sceGuFinish();
+ sceGuSync(0,0);
+ sceDisplayWaitVblankStartCB();
+ sceGuDisplay(GU_TRUE);
+
return renderer;
}
@@ -458,69 +458,69 @@ PSP_WindowEvent(SDL_Renderer * renderer, const SDL_WindowEvent *event)
static int
PSP_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
{
-// PSP_RenderData *renderdata = (PSP_RenderData *) renderer->driverdata;
- PSP_TextureData* psp_texture = (PSP_TextureData*) SDL_calloc(1, sizeof(*psp_texture));;
-
- if(!psp_texture)
- return -1;
-
- psp_texture->swizzled = SDL_FALSE;
- psp_texture->width = texture->w;
- psp_texture->height = texture->h;
- psp_texture->textureHeight = TextureNextPow2(texture->h);
- psp_texture->textureWidth = TextureNextPow2(texture->w);
- psp_texture->format = PixelFormatToPSPFMT(texture->format);
-
- switch(psp_texture->format)
- {
- case GU_PSM_5650:
- case GU_PSM_5551:
- case GU_PSM_4444:
- psp_texture->bits = 16;
- break;
-
- case GU_PSM_8888:
- psp_texture->bits = 32;
- break;
-
- default:
- return -1;
- }
-
- psp_texture->pitch = psp_texture->textureWidth * SDL_BYTESPERPIXEL(texture->format);
- psp_texture->size = psp_texture->textureHeight*psp_texture->pitch;
- psp_texture->data = SDL_calloc(1, psp_texture->size);
-
- if(!psp_texture->data)
- {
- SDL_free(psp_texture);
- return SDL_OutOfMemory();
- }
+// PSP_RenderData *renderdata = (PSP_RenderData *) renderer->driverdata;
+ PSP_TextureData* psp_texture = (PSP_TextureData*) SDL_calloc(1, sizeof(*psp_texture));;
+
+ if(!psp_texture)
+ return -1;
+
+ psp_texture->swizzled = SDL_FALSE;
+ psp_texture->width = texture->w;
+ psp_texture->height = texture->h;
+ psp_texture->textureHeight = TextureNextPow2(texture->h);
+ psp_texture->textureWidth = TextureNextPow2(texture->w);
+ psp_texture->format = PixelFormatToPSPFMT(texture->format);
+
+ switch(psp_texture->format)
+ {
+ case GU_PSM_5650:
+ case GU_PSM_5551:
+ case GU_PSM_4444:
+ psp_texture->bits = 16;
+ break;
+
+ case GU_PSM_8888:
+ psp_texture->bits = 32;
+ break;
+
+ default:
+ return -1;
+ }
+
+ psp_texture->pitch = psp_texture->textureWidth * SDL_BYTESPERPIXEL(texture->format);
+ psp_texture->size = psp_texture->textureHeight*psp_texture->pitch;
+ psp_texture->data = SDL_calloc(1, psp_texture->size);
+
+ if(!psp_texture->data)
+ {
+ SDL_free(psp_texture);
+ return SDL_OutOfMemory();
+ }
texture->driverdata = psp_texture;
-
+
return 0;
}
-void
+void
TextureActivate(SDL_Texture * texture)
-{
- PSP_TextureData *psp_texture = (PSP_TextureData *) texture->driverdata;
- int scaleMode = GetScaleQuality();
-
- // Swizzling is useless with small textures.
+{
+ PSP_TextureData *psp_texture = (PSP_TextureData *) texture->driverdata;
+ int scaleMode = GetScaleQuality();
+
+ /* Swizzling is useless with small textures. */
if (texture->w >= 16 || texture->h >= 16)
{
- TextureSwizzle(psp_texture);
+ TextureSwizzle(psp_texture);
}
-
- sceGuEnable(GU_TEXTURE_2D);
- sceGuTexWrap(GU_REPEAT, GU_REPEAT);
- sceGuTexMode(psp_texture->format, 0, 0, psp_texture->swizzled);
- sceGuTexFilter(scaleMode, scaleMode); // GU_NEAREST good for tile-map
- // GU_LINEAR good for scaling
- sceGuTexImage(0, psp_texture->textureWidth, psp_texture->textureHeight, psp_texture->textureWidth, psp_texture->data);
- sceGuTexFunc(GU_TFX_REPLACE, GU_TCC_RGBA);
+
+ sceGuEnable(GU_TEXTURE_2D);
+ sceGuTexWrap(GU_REPEAT, GU_REPEAT);
+ sceGuTexMode(psp_texture->format, 0, 0, psp_texture->swizzled);
+ sceGuTexFilter(scaleMode, scaleMode); /* GU_NEAREST good for tile-map */
+ /* GU_LINEAR good for scaling */
+ sceGuTexImage(0, psp_texture->textureWidth, psp_texture->textureHeight, psp_texture->textureWidth, psp_texture->data);
+ sceGuTexFunc(GU_TFX_REPLACE, GU_TCC_RGBA);
}
@@ -528,12 +528,12 @@ static int
PSP_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
const SDL_Rect * rect, const void *pixels, int pitch)
{
-// PSP_TextureData *psp_texture = (PSP_TextureData *) texture->driverdata;
+// PSP_TextureData *psp_texture = (PSP_TextureData *) texture->driverdata;
const Uint8 *src;
Uint8 *dst;
int row, length,dpitch;
src = pixels;
-
+
PSP_LockTexture(renderer, texture,rect,(void **)&dst, &dpitch);
length = rect->w * SDL_BYTESPERPIXEL(texture->format);
if (length == pitch && length == dpitch) {
@@ -545,8 +545,8 @@ PSP_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
dst += dpitch;
}
}
-
- sceKernelDcacheWritebackAll();
+
+ sceKernelDcacheWritebackAll();
return 0;
}
@@ -554,7 +554,7 @@ static int
PSP_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture,
const SDL_Rect * rect, void **pixels, int *pitch)
{
- PSP_TextureData *psp_texture = (PSP_TextureData *) texture->driverdata;
+ PSP_TextureData *psp_texture = (PSP_TextureData *) texture->driverdata;
*pixels =
(void *) ((Uint8 *) psp_texture->data + rect->y * psp_texture->pitch +
@@ -566,7 +566,7 @@ PSP_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture,
static void
PSP_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture)
{
- PSP_TextureData *psp_texture = (PSP_TextureData *) texture->driverdata;
+ PSP_TextureData *psp_texture = (PSP_TextureData *) texture->driverdata;
SDL_Rect rect;
/* We do whole texture updates, at least for now */
@@ -595,27 +595,27 @@ PSP_UpdateViewport(SDL_Renderer * renderer)
static void
PSP_SetBlendMode(SDL_Renderer * renderer, int blendMode)
{
- PSP_RenderData *data = (PSP_RenderData *) renderer->driverdata;
+ PSP_RenderData *data = (PSP_RenderData *) renderer->driverdata;
if (blendMode != data-> currentBlendMode) {
switch (blendMode) {
case SDL_BLENDMODE_NONE:
- sceGuTexFunc(GU_TFX_REPLACE, GU_TCC_RGBA);
- sceGuDisable(GU_BLEND);
+ sceGuTexFunc(GU_TFX_REPLACE, GU_TCC_RGBA);
+ sceGuDisable(GU_BLEND);
break;
case SDL_BLENDMODE_BLEND:
- sceGuTexFunc(GU_TFX_MODULATE , GU_TCC_RGBA);
- sceGuEnable(GU_BLEND);
- sceGuBlendFunc(GU_ADD, GU_SRC_ALPHA, GU_ONE_MINUS_SRC_ALPHA, 0, 0 );
+ sceGuTexFunc(GU_TFX_MODULATE , GU_TCC_RGBA);
+ sceGuEnable(GU_BLEND);
+ sceGuBlendFunc(GU_ADD, GU_SRC_ALPHA, GU_ONE_MINUS_SRC_ALPHA, 0, 0 );
break;
case SDL_BLENDMODE_ADD:
- sceGuTexFunc(GU_TFX_MODULATE , GU_TCC_RGBA);
- sceGuEnable(GU_BLEND);
- sceGuBlendFunc(GU_ADD, GU_SRC_ALPHA, GU_FIX, 0, 0x00FFFFFF );
+ sceGuTexFunc(GU_TFX_MODULATE , GU_TCC_RGBA);
+ sceGuEnable(GU_BLEND);
+ sceGuBlendFunc(GU_ADD, GU_SRC_ALPHA, GU_FIX, 0, 0x00FFFFFF );
break;
case SDL_BLENDMODE_MOD:
- sceGuTexFunc(GU_TFX_MODULATE , GU_TCC_RGBA);
- sceGuEnable(GU_BLEND);
- sceGuBlendFunc( GU_ADD, GU_FIX, GU_SRC_COLOR, 0, 0);
+ sceGuTexFunc(GU_TFX_MODULATE , GU_TCC_RGBA);
+ sceGuEnable(GU_BLEND);
+ sceGuBlendFunc( GU_ADD, GU_FIX, GU_SRC_COLOR, 0, 0);
break;
}
data->currentBlendMode = blendMode;
@@ -626,13 +626,13 @@ PSP_SetBlendMode(SDL_Renderer * renderer, int blendMode)
static int
PSP_RenderClear(SDL_Renderer * renderer)
-{
- //start list
- StartDrawing(renderer);
- int color = renderer->a << 24 | renderer->b << 16 | renderer->g << 8 | renderer->r;
- sceGuClearColor(color);
- sceGuClearDepth(0);
- sceGuClear(GU_COLOR_BUFFER_BIT|GU_DEPTH_BUFFER_BIT|GU_FAST_CLEAR_BIT);
+{
+ /* start list */
+ StartDrawing(renderer);
+ int color = renderer->a << 24 | renderer->b << 16 | renderer->g << 8 | renderer->r;
+ sceGuClearColor(color);
+ sceGuClearDepth(0);
+ sceGuClear(GU_COLOR_BUFFER_BIT|GU_DEPTH_BUFFER_BIT|GU_FAST_CLEAR_BIT);
return 0;
}
@@ -641,22 +641,22 @@ static int
PSP_RenderDrawPoints(SDL_Renderer * renderer, const SDL_FPoint * points,
int count)
{
- int color = renderer->a << 24 | renderer->b << 16 | renderer->g << 8 | renderer->r;
- int i;
- StartDrawing(renderer);
- VertV* vertices = (VertV*)sceGuGetMemory(count*sizeof(VertV));
-
- for (i = 0; i < count; ++i) {
- vertices[i].x = points[i].x;
- vertices[i].y = points[i].y;
- vertices[i].z = 0.0f;
- }
- sceGuDisable(GU_TEXTURE_2D);
- sceGuColor(color);
- sceGuShadeModel(GU_FLAT);
- sceGuDrawArray(GU_POINTS, GU_VERTEX_32BITF|GU_TRANSFORM_2D, count, 0, vertices);
- sceGuShadeModel(GU_SMOOTH);
- sceGuEnable(GU_TEXTURE_2D);
+ int color = renderer->a << 24 | renderer->b << 16 | renderer->g << 8 | renderer->r;
+ int i;
+ StartDrawing(renderer);
+ VertV* vertices = (VertV*)sceGuGetMemory(count*sizeof(VertV));
+
+ for (i = 0; i < count; ++i) {
+ vertices[i].x = points[i].x;
+ vertices[i].y = points[i].y;
+ vertices[i].z = 0.0f;
+ }
+ sceGuDisable(GU_TEXTURE_2D);
+ sceGuColor(color);
+ sceGuShadeModel(GU_FLAT);
+ sceGuDrawArray(GU_POINTS, GU_VERTEX_32BITF|GU_TRANSFORM_2D, count, 0, vertices);
+ sceGuShadeModel(GU_SMOOTH);
+ sceGuEnable(GU_TEXTURE_2D);
return 0;
}
@@ -665,24 +665,24 @@ static int
PSP_RenderDrawLines(SDL_Renderer * renderer, const SDL_FPoint * points,
int count)
{
- int color = renderer->a << 24 | renderer->b << 16 | renderer->g << 8 | renderer->r;
- int i;
- StartDrawing(renderer);
- VertV* vertices = (VertV*)sceGuGetMemory(count*sizeof(VertV));
-
- for (i = 0; i < count; ++i) {
- vertices[i].x = points[i].x;
- vertices[i].y = points[i].y;
- vertices[i].z = 0.0f;
- }
-
- sceGuDisable(GU_TEXTURE_2D);
- sceGuColor(color);
- sceGuShadeModel(GU_FLAT);
- sceGuDrawArray(GU_LINE_STRIP, GU_VERTEX_32BITF|GU_TRANSFORM_2D, count, 0, vertices);
- sceGuShadeModel(GU_SMOOTH);
- sceGuEnable(GU_TEXTURE_2D);
-
+ int color = renderer->a << 24 | renderer->b << 16 | renderer->g << 8 | renderer->r;
+ int i;
+ StartDrawing(renderer);
+ VertV* vertices = (VertV*)sceGuGetMemory(count*sizeof(VertV));
+
+ for (i = 0; i < count; ++i) {
+ vertices[i].x = points[i].x;
+ vertices[i].y = points[i].y;
+ vertices[i].z = 0.0f;
+ }
+
+ sceGuDisable(GU_TEXTURE_2D);
+ sceGuColor(color);
+ sceGuShadeModel(GU_FLAT);
+ sceGuDrawArray(GU_LINE_STRIP, GU_VERTEX_32BITF|GU_TRANSFORM_2D, count, 0, vertices);
+ sceGuShadeModel(GU_SMOOTH);
+ sceGuEnable(GU_TEXTURE_2D);
+
return 0;
}
@@ -690,29 +690,29 @@ static int
PSP_RenderFillRects(SDL_Renderer * renderer, const SDL_FRect * rects,
int count)
{
- int color = renderer->a << 24 | renderer->b << 16 | renderer->g << 8 | renderer->r;
- int i;
- StartDrawing(renderer);
-
- for (i = 0; i < count; ++i) {
- const SDL_FRect *rect = &rects[i];
- VertV* vertices = (VertV*)sceGuGetMemory((sizeof(VertV)<<1));
- vertices[0].x = rect->x;
- vertices[0].y = rect->y;
- vertices[0].z = 0.0f;
-
- vertices[1].x = rect->x + rect->w;
- vertices[1].y = rect->y + rect->h;
- vertices[1].z = 0.0f;
-
- sceGuDisable(GU_TEXTURE_2D);
- sceGuColor(color);
- sceGuShadeModel(GU_FLAT);
- sceGuDrawArray(GU_SPRITES, GU_VERTEX_32BITF|GU_TRANSFORM_2D, 2, 0, vertices);
- sceGuShadeModel(GU_SMOOTH);
- sceGuEnable(GU_TEXTURE_2D);
+ int color = renderer->a << 24 | renderer->b << 16 | renderer->g << 8 | renderer->r;
+ int i;
+ StartDrawing(renderer);
+
+ for (i = 0; i < count; ++i) {
+ const SDL_FRect *rect = &rects[i];
+ VertV* vertices = (VertV*)sceGuGetMemory((sizeof(VertV)<<1));
+ vertices[0].x = rect->x;
+ vertices[0].y = rect->y;
+ vertices[0].z = 0.0f;
+
+ vertices[1].x = rect->x + rect->w;
+ vertices[1].y = rect->y + rect->h;
+ vertices[1].z = 0.0f;
+
+ sceGuDisable(GU_TEXTURE_2D);
+ sceGuColor(color);
+ sceGuShadeModel(GU_FLAT);
+ sceGuDrawArray(GU_SPRITES, GU_VERTEX_32BITF|GU_TRANSFORM_2D, 2, 0, vertices);
+ sceGuShadeModel(GU_SMOOTH);
+ sceGuEnable(GU_TEXTURE_2D);
}
-
+
return 0;
}
@@ -724,127 +724,127 @@ PSP_RenderFillRects(SDL_Renderer * renderer, const SDL_FRect * rects,
float MathAbs(float x)
{
- float result;
+ float result;
- __asm__ volatile (
- "mtv %1, S000\n"
- "vabs.s S000, S000\n"
- "mfv %0, S000\n"
- : "=r"(result) : "r"(x));
+ __asm__ volatile (
+ "mtv %1, S000\n"
+ "vabs.s S000, S000\n"
+ "mfv %0, S000\n"
+ : "=r"(result) : "r"(x));
- return result;
+ return result;
}
void MathSincos(float r, float *s, float *c)
{
- __asm__ volatile (
- "mtv %2, S002\n"
- "vcst.s S003, VFPU_2_PI\n"
- "vmul.s S002, S002, S003\n"
- "vrot.p C000, S002, [s, c]\n"
- "mfv %0, S000\n"
- "mfv %1, S001\n"
- : "=r"(*s), "=r"(*c): "r"(r));
+ __asm__ volatile (
+ "mtv %2, S002\n"
+ "vcst.s S003, VFPU_2_PI\n"
+ "vmul.s S002, S002, S003\n"
+ "vrot.p C000, S002, [s, c]\n"
+ "mfv %0, S000\n"
+ "mfv %1, S001\n"
+ : "=r"(*s), "=r"(*c): "r"(r));
}
void Swap(float *a, float *b)
{
- float n=*a;
- *a = *b;
- *b = n;
+ float n=*a;
+ *a = *b;
+ *b = n;
}
static int
PSP_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture,
const SDL_Rect * srcrect, const SDL_FRect * dstrect)
{
- float x, y, width, height;
- float u0, v0, u1, v1;
- unsigned char alpha;
-
- x = dstrect->x;
- y = dstrect->y;
- width = dstrect->w;
- height = dstrect->h;
-
- u0 = srcrect->x;
- v0 = srcrect->y;
- u1 = srcrect->x + srcrect->w;
- v1 = srcrect->y + srcrect->h;
-
- alpha = texture->a;
-
- StartDrawing(renderer);
- TextureActivate(texture);
- PSP_SetBlendMode(renderer, renderer->blendMode);
-
- if(alpha != 255)
- {
- sceGuTexFunc(GU_TFX_MODULATE, GU_TCC_RGBA);
- sceGuColor(GU_RGBA(255, 255, 255, alpha));
- }else{
- sceGuTexFunc(GU_TFX_REPLACE, GU_TCC_RGBA);
- sceGuColor(0xFFFFFFFF);
- }
-
- if((MathAbs(u1) - MathAbs(u0)) < 64.0f)
- {
- VertTV* vertices = (VertTV*)sceGuGetMemory((sizeof(VertTV))<<1);
-
- vertices[0].u = u0;
- vertices[0].v = v0;
- vertices[0].x = x;
- vertices[0].y = y;
- vertices[0].z = 0;
-
- vertices[1].u = u1;
- vertices[1].v = v1;
- vertices[1].x = x + width;
- vertices[1].y = y + height;
- vertices[1].z = 0;
-
- sceGuDrawArray(GU_SPRITES, GU_TEXTURE_32BITF|GU_VERTEX_32BITF|GU_TRANSFORM_2D, 2, 0, vertices);
- }
- else
- {
- float start, end;
- float curU = u0;
- float curX = x;
- float endX = x + width;
- float slice = 64.0f;
- float ustep = (u1 - u0)/width * slice;
-
- if(ustep < 0.0f)
- ustep = -ustep;
-
- for(start = 0, end = width; start < end; start += slice)
- {
- VertTV* vertices = (VertTV*)sceGuGetMemory((sizeof(VertTV))<<1);
-
- float polyWidth = ((curX + slice) > endX) ? (endX - curX) : slice;
- float sourceWidth = ((curU + ustep) > u1) ? (u1 - curU) : ustep;
-
- vertices[0].u = curU;
- vertices[0].v = v0;
- vertices[0].x = curX;
- vertices[0].y = y;
- vertices[0].z = 0;
-
- curU += sourceWidth;
- curX += polyWidth;
-
- vertices[1].u = curU;
- vertices[1].v = v1;
- vertices[1].x = curX;
- vertices[1].y = (y + height);
- vertices[1].z = 0;
-
- sceGuDrawArray(GU_SPRITES, GU_TEXTURE_32BITF|GU_VERTEX_32BITF|GU_TRANSFORM_2D, 2, 0, vertices);
- }
- }
-
- if(alpha != 255)
- sceGuTexFunc(GU_TFX_REPLACE, GU_TCC_RGBA);
+ float x, y, width, height;
+ float u0, v0, u1, v1;
+ unsigned char alpha;
+
+ x = dstrect->x;
+ y = dstrect->y;
+ width = dstrect->w;
+ height = dstrect->h;
+
+ u0 = srcrect->x;
+ v0 = srcrect->y;
+ u1 = srcrect->x + srcrect->w;
+ v1 = srcrect->y + srcrect->h;
+
+ alpha = texture->a;
+
+ StartDrawing(renderer);
+ TextureActivate(texture);
+ PSP_SetBlendMode(renderer, renderer->blendMode);
+
+ if(alpha != 255)
+ {
+ sceGuTexFunc(GU_TFX_MODULATE, GU_TCC_RGBA);
+ sceGuColor(GU_RGBA(255, 255, 255, alpha));
+ }else{
+ sceGuTexFunc(GU_TFX_REPLACE, GU_TCC_RGBA);
+ sceGuColor(0xFFFFFFFF);
+ }
+
+ if((MathAbs(u1) - MathAbs(u0)) < 64.0f)
+ {
+ VertTV* vertices = (VertTV*)sceGuGetMemory((sizeof(VertTV))<<1);
+
+ vertices[0].u = u0;
+ vertices[0].v = v0;
+ vertices[0].x = x;
+ vertices[0].y = y;
+ vertices[0].z = 0;
+
+ vertices[1].u = u1;
+ vertices[1].v = v1;
+ vertices[1].x = x + width;
+ vertices[1].y = y + height;
+ vertices[1].z = 0;
+
+ sceGuDrawArray(GU_SPRITES, GU_TEXTURE_32BITF|GU_VERTEX_32BITF|GU_TRANSFORM_2D, 2, 0, vertices);
+ }
+ else
+ {
+ float start, end;
+ float curU = u0;
+ float curX = x;
+ float endX = x + width;
+ float slice = 64.0f;
+ float ustep = (u1 - u0)/width * slice;
+
+ if(ustep < 0.0f)
+ ustep = -ustep;
+
+ for(start = 0, end = width; start < end; start += slice)
+ {
+ VertTV* vertices = (VertTV*)sceGuGetMemory((sizeof(VertTV))<<1);
+
+ float polyWidth = ((curX + slice) > endX) ? (endX - curX) : slice;
+ float sourceWidth = ((curU + ustep) > u1) ? (u1 - curU) : ustep;
+
+ vertices[0].u = curU;
+ vertices[0].v = v0;
+ vertices[0].x = curX;
+ vertices[0].y = y;
+ vertices[0].z = 0;
+
+ curU += sourceWidth;
+ curX += polyWidth;
+
+ vertices[1].u = curU;
+ vertices[1].v = v1;
+ vertices[1].x = curX;
+ vertices[1].y = (y + height);
+ vertices[1].z = 0;
+
+ sceGuDrawArray(GU_SPRITES, GU_TEXTURE_32BITF|GU_VERTEX_32BITF|GU_TRANSFORM_2D, 2, 0, vertices);
+ }
+ }
+
+ if(alpha != 255)
+ sceGuTexFunc(GU_TFX_REPLACE, GU_TCC_RGBA);
return 0;
}
@@ -853,7 +853,7 @@ PSP_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect,
Uint32 pixel_format, void * pixels, int pitch)
{
- return 0;
+ return 0;
}
@@ -862,98 +862,98 @@ PSP_RenderCopyEx(SDL_Renderer * renderer, SDL_Texture * texture,
const SDL_Rect * srcrect, const SDL_FRect * dstrect,
const double angle, const SDL_FPoint *center, const SDL_RendererFlip flip)
{
- float x, y, width, height;
- float u0, v0, u1, v1;
- unsigned char alpha;
- float centerx, centery;
-
- x = dstrect->x;
- y = dstrect->y;
- width = dstrect->w;
- height = dstrect->h;
-
- u0 = srcrect->x;
- v0 = srcrect->y;
- u1 = srcrect->x + srcrect->w;
- v1 = srcrect->y + srcrect->h;
-
+ float x, y, width, height;
+ float u0, v0, u1, v1;
+ unsigned char alpha;
+ float centerx, centery;
+
+ x = dstrect->x;
+ y = dstrect->y;
+ width = dstrect->w;
+ height = dstrect->h;
+
+ u0 = srcrect->x;
+ v0 = srcrect->y;
+ u1 = srcrect->x + srcrect->w;
+ v1 = srcrect->y + srcrect->h;
+
centerx = center->x;
centery = center->y;
-
- alpha = texture->a;
-
- StartDrawing(renderer);
- TextureActivate(texture);
- PSP_SetBlendMode(renderer, renderer->blendMode);
-
- if(alpha != 255)
- {
- sceGuTexFunc(GU_TFX_MODULATE, GU_TCC_RGBA);
- sceGuColor(GU_RGBA(255, 255, 255, alpha));
- }else{
- sceGuTexFunc(GU_TFX_REPLACE, GU_TCC_RGBA);
- sceGuColor(0xFFFFFFFF);
- }
-
-// x += width * 0.5f;
-// y += height * 0.5f;
- x += centerx;
- y += centery;
-
- float c, s;
-
- MathSincos(degToRad(angle), &s, &c);
-
-// width *= 0.5f;
-// height *= 0.5f;
- width -= centerx;
- height -= centery;
-
-
- float cw = c*width;
- float sw = s*width;
- float ch = c*height;
- float sh = s*height;
-
- VertTV* vertices = (VertTV*)sceGuGetMemory(sizeof(VertTV)<<2);
-
- vertices[0].u = u0;
- vertices[0].v = v0;
- vertices[0].x = x - cw + sh;
- vertices[0].y = y - sw - ch;
- vertices[0].z = 0;
-
- vertices[1].u = u0;
- vertices[1].v = v1;
- vertices[1].x = x - cw - sh;
- vertices[1].y = y - sw + ch;
- vertices[1].z = 0;
-
- vertices[2].u = u1;
- vertices[2].v = v1;
- vertices[2].x = x + cw - sh;
- vertices[2].y = y + sw + ch;
- vertices[2].z = 0;
-
- vertices[3].u = u1;
- vertices[3].v = v0;
- vertices[3].x = x + cw + sh;
- vertices[3].y = y + sw - ch;
- vertices[3].z = 0;
-
- if (flip & SDL_FLIP_HORIZONTAL) {
- Swap(&vertices[0].v, &vertices[2].v);
- Swap(&vertices[1].v, &vertices[3].v);
- }
- if (flip & SDL_FLIP_VERTICAL) {
- Swap(&vertices[0].u, &vertices[2].u);
- Swap(&vertices[1].u, &vertices[3].u);
- }
-
- sceGuDrawArray(GU_TRIANGLE_FAN, GU_TEXTURE_32BITF|GU_VERTEX_32BITF|GU_TRANSFORM_2D, 4, 0, vertices);
-
- if(alpha != 255)
- sceGuTexFunc(GU_TFX_REPLACE, GU_TCC_RGBA);
+
+ alpha = texture->a;
+
+ StartDrawing(renderer);
+ TextureActivate(texture);
+ PSP_SetBlendMode(renderer, renderer->blendMode);
+
+ if(alpha != 255)
+ {
+ sceGuTexFunc(GU_TFX_MODULATE, GU_TCC_RGBA);
+ sceGuColor(GU_RGBA(255, 255, 255, alpha));
+ }else{
+ sceGuTexFunc(GU_TFX_REPLACE, GU_TCC_RGBA);
+ sceGuColor(0xFFFFFFFF);
+ }
+
+// x += width * 0.5f;
+// y += height * 0.5f;
+ x += centerx;
+ y += centery;
+
+ float c, s;
+
+ MathSincos(degToRad(angle), &s, &c);
+
+// width *= 0.5f;
+// height *= 0.5f;
+ width -= centerx;
+ height -= centery;
+
+
+ float cw = c*width;
+ float sw = s*width;
+ float ch = c*height;
+ float sh = s*height;
+
+ VertTV* vertices = (VertTV*)sceGuGetMemory(sizeof(VertTV)<<2);
+
+ vertices[0].u = u0;
+ vertices[0].v = v0;
+ vertices[0].x = x - cw + sh;
+ vertices[0].y = y - sw - ch;
+ vertices[0].z = 0;
+
+ vertices[1].u = u0;
+ vertices[1].v = v1;
+ vertices[1].x = x - cw - sh;
+ vertices[1].y = y - sw + ch;
+ vertices[1].z = 0;
+
+ vertices[2].u = u1;
+ vertices[2].v = v1;
+ vertices[2].x = x + cw - sh;
+ vertices[2].y = y + sw + ch;
+ vertices[2].z = 0;
+
+ vertices[3].u = u1;
+ vertices[3].v = v0;
+ vertices[3].x = x + cw + sh;
+ vertices[3].y = y + sw - ch;
+ vertices[3].z = 0;
+
+ if (flip & SDL_FLIP_HORIZONTAL) {
+ Swap(&vertices[0].v, &vertices[2].v);
+ Swap(&vertices[1].v, &vertices[3].v);
+ }
+ if (flip & SDL_FLIP_VERTICAL) {
+ Swap(&vertices[0].u, &vertices[2].u);
+ Swap(&vertices[1].u, &vertices[3].u);
+ }
+
+ sceGuDrawArray(GU_TRIANGLE_FAN, GU_TEXTURE_32BITF|GU_VERTEX_32BITF|GU_TRANSFORM_2D, 4, 0, vertices);
+
+ if(alpha != 255)
+ sceGuTexFunc(GU_TFX_REPLACE, GU_TCC_RGBA);
return 0;
}
@@ -961,39 +961,39 @@ static void
PSP_RenderPresent(SDL_Renderer * renderer)
{
PSP_RenderData *data = (PSP_RenderData *) renderer->driverdata;
- if(!data->displayListAvail)
- return;
-
- data->displayListAvail = SDL_FALSE;
- sceGuFinish();
- sceGuSync(0,0);
-
-// if(data->vsync)
- sceDisplayWaitVblankStart();
-
+ if(!data->displayListAvail)
+ return;
+
+ data->displayListAvail = SDL_FALSE;
+ sceGuFinish();
+ sceGuSync(0,0);
+
+// if(data->vsync)
+ sceDisplayWaitVblankStart();
+
data->backbuffer = data->frontbuffer;
data->frontbuffer = vabsptr(sceGuSwapBuffers());
-
+
}
static void
PSP_DestroyTexture(SDL_Renderer * renderer, SDL_Texture * texture)
{
- PSP_RenderData *renderdata = (PSP_RenderData *) renderer->driverdata;
- PSP_TextureData *psp_texture = (PSP_TextureData *) texture->driverdata;
-
- if (renderdata == 0)
- return;
-
- if(psp_texture == 0)
- return;
-
- if(psp_texture->data != 0)
- {
- SDL_free(psp_texture->data);
- }
- SDL_free(psp_texture);
- texture->driverdata = NULL;
+ PSP_RenderData *renderdata = (PSP_RenderData *) renderer->driverdata;
+ PSP_TextureData *psp_texture = (PSP_TextureData *) texture->driverdata;
+
+ if (renderdata == 0)
+ return;
+
+ if(psp_texture == 0)
+ return;
+
+ if(psp_texture->data != 0)
+ {
+ SDL_free(psp_texture->data);
+ }
+ SDL_free(psp_texture);
+ texture->driverdata = NULL;
}
static void
@@ -1001,17 +1001,17 @@ PSP_DestroyRenderer(SDL_Renderer * renderer)
{
PSP_RenderData *data = (PSP_RenderData *) renderer->driverdata;
if (data) {
- if (!data->initialized)
- return;
-
- StartDrawing(renderer);
-
- sceGuTerm();
-// vfree(data->backbuffer);
-// vfree(data->frontbuffer);
-
- data->initialized = SDL_FALSE;
- data->displayListAvail = SDL_FALSE;
+ if (!data->initialized)
+ return;
+
+ StartDrawing(renderer);
+
+ sceGuTerm();
+// vfree(data->backbuffer);
+// vfree(data->frontbuffer);
+
+ data->initialized = SDL_FALSE;
+ data->displayListAvail = SDL_FALSE;
SDL_free(data);
}
SDL_free(renderer);
diff --git a/src/render/software/SDL_drawline.c b/src/render/software/SDL_drawline.c
index 9f5da0ab64..5cda4ccca2 100644
--- a/src/render/software/SDL_drawline.c
+++ b/src/render/software/SDL_drawline.c
@@ -32,7 +32,6 @@ SDL_DrawLine1(SDL_Surface * dst, int x1, int y1, int x2, int y2, Uint32 color,
SDL_bool draw_end)
{
if (y1 == y2) {
- //HLINE(Uint8, DRAW_FASTSETPIXEL1, draw_end);
int length;
int pitch = (dst->pitch / dst->format->BytesPerPixel);
Uint8 *pixel;
diff --git a/src/render/software/SDL_rotate.c b/src/render/software/SDL_rotate.c
index 2eae0393f5..b315535870 100644
--- a/src/render/software/SDL_rotate.c
+++ b/src/render/software/SDL_rotate.c
@@ -398,7 +398,7 @@ SDL_Surface *_rotateSurface(SDL_Surface * src, double angle, int centerx, int ce
/* Determine target size */
- //_rotozoomSurfaceSizeTrig(rz_src->w, rz_src->h, angle, &dstwidth, &dstheight, &cangle, &sangle);
+ /*_rotozoomSurfaceSizeTrig(rz_src->w, rz_src->h, angle, &dstwidth, &dstheight, &cangle, &sangle); */
/*
* Calculate target factors from sin/cos and zoom
@@ -459,7 +459,7 @@ SDL_Surface *_rotateSurface(SDL_Surface * src, double angle, int centerx, int ce
/*
* Turn on source-alpha support
*/
- //SDL_SetAlpha(rz_dst, SDL_SRCALPHA, 255);
+ /*SDL_SetAlpha(rz_dst, SDL_SRCALPHA, 255);*/
SDL_SetColorKey(rz_dst, /*SDL_SRCCOLORKEY*/ SDL_TRUE | SDL_RLEACCEL, _colorkey(rz_src));
} else {
/*
diff --git a/src/stdlib/SDL_malloc.c b/src/stdlib/SDL_malloc.c
index 65d1e1d168..5f7882139d 100644
--- a/src/stdlib/SDL_malloc.c
+++ b/src/stdlib/SDL_malloc.c
@@ -409,9 +409,9 @@ MALLINFO_FIELD_TYPE default: size_t
size_t. The value is used only if HAVE_USR_INCLUDE_MALLOC_H is not set
REALLOC_ZERO_BYTES_FREES default: not defined
- This should be set if a call to realloc with zero bytes should
- be the same as a call to free. Some people think it should. Otherwise,
- since this malloc returns a unique pointer for malloc(0), so does
+ This should be set if a call to realloc with zero bytes should
+ be the same as a call to free. Some people think it should. Otherwise,
+ since this malloc returns a unique pointer for malloc(0), so does
realloc(p, 0).
LACKS_UNISTD_H, LACKS_FCNTL_H, LACKS_SYS_PARAM_H, LACKS_SYS_MMAN_H
@@ -619,12 +619,12 @@ DEFAULT_MMAP_THRESHOLD default: 256K
#define MALLINFO_FIELD_TYPE size_t
#endif /* MALLINFO_FIELD_TYPE */
-#define memset SDL_memset
-#define memcpy SDL_memcpy
-#define malloc SDL_malloc
-#define calloc SDL_calloc
-#define realloc SDL_realloc
-#define free SDL_free
+#define memset SDL_memset
+#define memcpy SDL_memcpy
+#define malloc SDL_malloc
+#define calloc SDL_calloc
+#define realloc SDL_realloc
+#define free SDL_free
/*
mallopt tuning options. SVID/XPG defines four standard parameter
@@ -5239,7 +5239,7 @@ History:
Trial version Fri Aug 28 13:14:29 1992 Doug Lea (dl at g.oswego.edu)
* Based loosely on libg++-1.2X malloc. (It retains some of the overall
structure of old version, but most details differ.)
-
+
*/
#endif /* !HAVE_MALLOC */
diff --git a/src/test/SDL_test_assert.c b/src/test/SDL_test_assert.c
index 4896bc0e5d..41a3df68fd 100644
--- a/src/test/SDL_test_assert.c
+++ b/src/test/SDL_test_assert.c
@@ -21,7 +21,7 @@
/*
- Used by the test framework and test cases.
+ Used by the test framework and test cases.
*/
@@ -47,16 +47,16 @@ static Uint32 SDLTest_AssertsPassed = 0;
void SDLTest_Assert(int assertCondition, const char *assertDescription, ...)
{
va_list list;
- char logMessage[SDLTEST_MAX_LOGMESSAGE_LENGTH];
-
- // Print assert description into a buffer
- SDL_memset(logMessage, 0, SDLTEST_MAX_LOGMESSAGE_LENGTH);
- va_start(list, assertDescription);
- SDL_vsnprintf(logMessage, SDLTEST_MAX_LOGMESSAGE_LENGTH - 1, assertDescription, list);
- va_end(list);
-
- // Log, then assert and break on failure
- SDL_assert((SDLTest_AssertCheck(assertCondition, logMessage)));
+ char logMessage[SDLTEST_MAX_LOGMESSAGE_LENGTH];
+
+ /* Print assert description into a buffer */
+ SDL_memset(logMessage, 0, SDLTEST_MAX_LOGMESSAGE_LENGTH);
+ va_start(list, assertDescription);
+ SDL_vsnprintf(logMessage, SDLTEST_MAX_LOGMESSAGE_LENGTH - 1, assertDescription, list);
+ va_end(list);
+
+ /* Log, then assert and break on failure */
+ SDL_assert((SDLTest_AssertCheck(assertCondition, logMessage)));
}
/*
@@ -65,27 +65,27 @@ void SDLTest_Assert(int assertCondition, const char *assertDescription, ...)
int SDLTest_AssertCheck(int assertCondition, const char *assertDescription, ...)
{
va_list list;
- char logMessage[SDLTEST_MAX_LOGMESSAGE_LENGTH];
-
- // Print assert description into a buffer
- SDL_memset(logMessage, 0, SDLTEST_MAX_LOGMESSAGE_LENGTH);
- va_start(list, assertDescription);
- SDL_vsnprintf(logMessage, SDLTEST_MAX_LOGMESSAGE_LENGTH - 1, assertDescription, list);
- va_end(list);
-
- // Log pass or fail message
- if (assertCondition == ASSERT_FAIL)
- {
- SDLTest_AssertsFailed++;
- SDLTest_LogError(SDLTest_AssertCheckFormat, logMessage, "Failed");
- }
- else
- {
- SDLTest_AssertsPassed++;
- SDLTest_Log(SDLTest_AssertCheckFormat, logMessage, "Passed");
- }
-
- return assertCondition;
+ char logMessage[SDLTEST_MAX_LOGMESSAGE_LENGTH];
+
+ /* Print assert description into a buffer */
+ SDL_memset(logMessage, 0, SDLTEST_MAX_LOGMESSAGE_LENGTH);
+ va_start(list, assertDescription);
+ SDL_vsnprintf(logMessage, SDLTEST_MAX_LOGMESSAGE_LENGTH - 1, assertDescription, list);
+ va_end(list);
+
+ /* Log pass or fail message */
+ if (assertCondition == ASSERT_FAIL)
+ {
+ SDLTest_AssertsFailed++;
+ SDLTest_LogError(SDLTest_AssertCheckFormat, logMessage, "Failed");
+ }
+ else
+ {
+ SDLTest_AssertsPassed++;
+ SDLTest_Log(SDLTest_AssertCheckFormat, logMessage, "Passed");
+ }
+
+ return assertCondition;
}
/*
@@ -94,17 +94,17 @@ int SDLTest_AssertCheck(int assertCondition, const char *assertDescription, ...)
void SDLTest_AssertPass(const char *assertDescription, ...)
{
va_list list;
- char logMessage[SDLTEST_MAX_LOGMESSAGE_LENGTH];
-
- // Print assert description into a buffer
- SDL_memset(logMessage, 0, SDLTEST_MAX_LOGMESSAGE_LENGTH);
- va_start(list, assertDescription);
- SDL_vsnprintf(logMessage, SDLTEST_MAX_LOGMESSAGE_LENGTH - 1, assertDescription, list);
- va_end(list);
-
- // Log pass message
- SDLTest_AssertsPassed++;
- SDLTest_Log(SDLTest_AssertCheckFormat, logMessage, "Pass");
+ char logMessage[SDLTEST_MAX_LOGMESSAGE_LENGTH];
+
+ /* Print assert description into a buffer */
+ SDL_memset(logMessage, 0, SDLTEST_MAX_LOGMESSAGE_LENGTH);
+ va_start(list, assertDescription);
+ SDL_vsnprintf(logMessage, SDLTEST_MAX_LOGMESSAGE_LENGTH - 1, assertDescription, list);
+ va_end(list);
+
+ /* Log pass message */
+ SDLTest_AssertsPassed++;
+ SDLTest_Log(SDLTest_AssertCheckFormat, logMessage, "Pass");
}
/*
@@ -112,25 +112,25 @@ void SDLTest_AssertPass(const char *assertDescription, ...)
*/
void SDLTest_ResetAssertSummary()
{
- SDLTest_AssertsPassed = 0;
- SDLTest_AssertsFailed = 0;
+ SDLTest_AssertsPassed = 0;
+ SDLTest_AssertsFailed = 0;
}
/*
- * Logs summary of all assertions (total, pass, fail) since last reset
+ * Logs summary of all assertions (total, pass, fail) since last reset
* as INFO (failed==0) or ERROR (failed > 0).
*/
void SDLTest_LogAssertSummary()
{
- Uint32 totalAsserts = SDLTest_AssertsPassed + SDLTest_AssertsFailed;
- if (SDLTest_AssertsFailed == 0)
- {
- SDLTest_Log(SDLTest_AssertSummaryFormat, totalAsserts, SDLTest_AssertsPassed, SDLTest_AssertsFailed);
- }
- else
- {
- SDLTest_LogError(SDLTest_AssertSummaryFormat, totalAsserts, SDLTest_AssertsPassed, SDLTest_AssertsFailed);
- }
+ Uint32 totalAsserts = SDLTest_AssertsPassed + SDLTest_AssertsFailed;
+ if (SDLTest_AssertsFailed == 0)
+ {
+ SDLTest_Log(SDLTest_AssertSummaryFormat, totalAsserts, SDLTest_AssertsPassed, SDLTest_AssertsFailed);
+ }
+ else
+ {
+ SDLTest_LogError(SDLTest_AssertSummaryFormat, totalAsserts, SDLTest_AssertsPassed, SDLTest_AssertsFailed);
+ }
}
/*
@@ -138,13 +138,13 @@ void SDLTest_LogAssertSummary()
*/
int SDLTest_AssertSummaryToTestResult()
{
- if (SDLTest_AssertsFailed > 0) {
- return TEST_RESULT_FAILED;
- } else {
- if (SDLTest_AssertsPassed > 0) {
- return TEST_RESULT_PASSED;
- } else {
- return TEST_RESULT_NO_ASSERT;
- }
- }
+ if (SDLTest_AssertsFailed > 0) {
+ return TEST_RESULT_FAILED;
+ } else {
+ if (SDLTest_AssertsPassed > 0) {
+ return TEST_RESULT_PASSED;
+ } else {
+ return TEST_RESULT_NO_ASSERT;
+ }
+ }
}
diff --git a/src/test/SDL_test_common.c b/src/test/SDL_test_common.c
index b5fdc3f5b9..cd028c7bf1 100644
--- a/src/test/SDL_test_common.c
+++ b/src/test/SDL_test_common.c
@@ -405,7 +405,7 @@ SDLTest_CommonArg(SDLTest_CommonState * state, int index)
return -1;
}
if (SDL_strcmp(argv[index], "-NSDocumentRevisionsDebugMode") == 0) {
- /* Debug flag sent by Xcode */
+ /* Debug flag sent by Xcode */
return 2;
}
return 0;
@@ -892,7 +892,7 @@ SDLTest_PrintEvent(SDL_Event * event)
{
if (event->type == SDL_MOUSEMOTION) {
/* Mouse motion is really spammy */
- //return;
+ return;
}
fprintf(stderr, "SDL EVENT: ");
@@ -1097,7 +1097,7 @@ SDLTest_ScreenShot(SDL_Renderer *renderer)
}
}
-static void
+static void
FullscreenTo(int index, int windowId)
{
Uint32 flags;
@@ -1151,12 +1151,12 @@ SDLTest_CommonEvent(SDLTest_CommonState * state, SDL_Event * event, int *done)
}
break;
case SDL_WINDOWEVENT_CLOSE:
- {
+ {
SDL_Window *window = SDL_GetWindowFromID(event->window.windowID);
if (window) {
- SDL_DestroyWindow(window);
- }
- }
+ SDL_DestroyWindow(window);
+ }
+ }
break;
}
break;
@@ -1298,7 +1298,7 @@ SDLTest_CommonEvent(SDLTest_CommonState * state, SDL_Event * event, int *done)
}
}
break;
- case SDLK_0:
+ case SDLK_0:
if (event->key.keysym.mod & KMOD_CTRL) {
SDL_Window *window = SDL_GetWindowFromID(event->key.windowID);
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_INFORMATION, "Test Message", "You're awesome!", window);
@@ -1335,7 +1335,7 @@ SDLTest_CommonEvent(SDLTest_CommonState * state, SDL_Event * event, int *done)
break;
case SDL_MOUSEMOTION:
lastEvent = event->motion;
- break;
+ break;
}
}
diff --git a/src/test/SDL_test_compare.c b/src/test/SDL_test_compare.c
index e7ac424d9f..33f237311b 100644
--- a/src/test/SDL_test_compare.c
+++ b/src/test/SDL_test_compare.c
@@ -22,7 +22,7 @@
/*
Based on automated SDL_Surface tests originally written by Edgar Simo 'bobbens'.
-
+
Rewritten for test lib by Andreas Schiffler.
*/
@@ -62,7 +62,7 @@ int SDLTest_CompareSurfaces(SDL_Surface *surface, SDL_Surface *referenceSurface,
if (allowable_error<0) {
allowable_error = 0;
}
-
+
SDL_LockSurface( surface );
SDL_LockSurface( referenceSurface );
@@ -82,7 +82,7 @@ int SDLTest_CompareSurfaces(SDL_Surface *surface, SDL_Surface *referenceSurface,
dist += (R-Rd)*(R-Rd);
dist += (G-Gd)*(G-Gd);
dist += (B-Bd)*(B-Bd);
-
+
/* Allow some difference in blending accuracy */
if (dist > allowable_error) {
ret++;
diff --git a/src/test/SDL_test_crc32.c b/src/test/SDL_test_crc32.c
index 5329319e63..d6685c347b 100644
--- a/src/test/SDL_test_crc32.c
+++ b/src/test/SDL_test_crc32.c
@@ -21,7 +21,7 @@
/*
- Used by the test execution component.
+ Used by the test execution component.
Original source code contributed by A. Schiffler for GSOC project.
*/
@@ -39,10 +39,10 @@ int SDLTest_Crc32Init(SDLTest_Crc32Context *crcContext)
/* Sanity check context pointer */
if (crcContext==NULL) {
return -1;
- }
-
+ }
+
/*
- * Build auxiliary table for parallel byte-at-a-time CRC-32
+ * Build auxiliary table for parallel byte-at-a-time CRC-32
*/
#ifdef ORIGINAL_METHOD
for (i = 0; i < 256; ++i) {
@@ -64,7 +64,7 @@ int SDLTest_Crc32Init(SDLTest_Crc32Context *crcContext)
crcContext->crc32_table[i] = c;
}
#endif
-
+
return 0;
}
@@ -75,15 +75,15 @@ int SDLTest_Crc32Calc(SDLTest_Crc32Context * crcContext, CrcUint8 *inBuf, CrcUin
if (SDLTest_Crc32CalcStart(crcContext,crc32)) {
return -1;
}
-
+
if (SDLTest_Crc32CalcBuffer(crcContext, inBuf, inLen, crc32)) {
return -1;
}
-
+
if (SDLTest_Crc32CalcEnd(crcContext, crc32)) {
return -1;
}
-
+
return 0;
}
@@ -95,10 +95,10 @@ int SDLTest_Crc32CalcStart(SDLTest_Crc32Context * crcContext, CrcUint32 *crc32)
if (crcContext==NULL) {
*crc32=0;
return -1;
- }
+ }
/*
- * Preload shift register, per CRC-32 spec
+ * Preload shift register, per CRC-32 spec
*/
*crc32 = 0xffffffff;
@@ -113,10 +113,10 @@ int SDLTest_Crc32CalcEnd(SDLTest_Crc32Context * crcContext, CrcUint32 *crc32)
if (crcContext==NULL) {
*crc32=0;
return -1;
- }
-
+ }
+
/*
- * Return complement, per CRC-32 spec
+ * Return complement, per CRC-32 spec
*/
*crc32 = (~(*crc32));
@@ -134,24 +134,24 @@ int SDLTest_Crc32CalcBuffer(SDLTest_Crc32Context * crcContext, CrcUint8 *inBuf,
*crc32=0;
return -1;
}
-
+
if (inBuf==NULL) {
return -1;
}
/*
- * Calculate CRC from data
+ * Calculate CRC from data
*/
crc = *crc32;
for (p = inBuf; inLen > 0; ++p, --inLen) {
-#ifdef ORIGINAL_METHOD
+#ifdef ORIGINAL_METHOD
crc = (crc << 8) ^ crcContext->crc32_table[(crc >> 24) ^ *p];
#else
crc = ((crc >> 8) & 0x00FFFFFF) ^ crcContext->crc32_table[ (crc ^ *p) & 0xFF ];
-#endif
- }
+#endif
+ }
*crc32 = crc;
-
+
return 0;
}
@@ -159,7 +159,7 @@ int SDLTest_Crc32Done(SDLTest_Crc32Context * crcContext)
{
if (crcContext==NULL) {
return -1;
- }
+ }
return 0;
}
diff --git a/src/test/SDL_test_font.c b/src/test/SDL_test_font.c
index dcb3f04643..144bcad02a 100644
--- a/src/test/SDL_test_font.c
+++ b/src/test/SDL_test_font.c
@@ -32,3077 +32,3077 @@
static unsigned char SDLTest_FontData[SDL_TESTFONTDATAMAX] = {
- /*
- * 0 0x00 '^@'
- */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
-
- /*
- * 1 0x01 '^A'
- */
- 0x7e, /* 01111110 */
- 0x81, /* 10000001 */
- 0xa5, /* 10100101 */
- 0x81, /* 10000001 */
- 0xbd, /* 10111101 */
- 0x99, /* 10011001 */
- 0x81, /* 10000001 */
- 0x7e, /* 01111110 */
-
- /*
- * 2 0x02 '^B'
- */
- 0x7e, /* 01111110 */
- 0xff, /* 11111111 */
- 0xdb, /* 11011011 */
- 0xff, /* 11111111 */
- 0xc3, /* 11000011 */
- 0xe7, /* 11100111 */
- 0xff, /* 11111111 */
- 0x7e, /* 01111110 */
-
- /*
- * 3 0x03 '^C'
- */
- 0x6c, /* 01101100 */
- 0xfe, /* 11111110 */
- 0xfe, /* 11111110 */
- 0xfe, /* 11111110 */
- 0x7c, /* 01111100 */
- 0x38, /* 00111000 */
- 0x10, /* 00010000 */
- 0x00, /* 00000000 */
-
- /*
- * 4 0x04 '^D'
- */
- 0x10, /* 00010000 */
- 0x38, /* 00111000 */
- 0x7c, /* 01111100 */
- 0xfe, /* 11111110 */
- 0x7c, /* 01111100 */
- 0x38, /* 00111000 */
- 0x10, /* 00010000 */
- 0x00, /* 00000000 */
-
- /*
- * 5 0x05 '^E'
- */
- 0x38, /* 00111000 */
- 0x7c, /* 01111100 */
- 0x38, /* 00111000 */
- 0xfe, /* 11111110 */
- 0xfe, /* 11111110 */
- 0xd6, /* 11010110 */
- 0x10, /* 00010000 */
- 0x38, /* 00111000 */
-
- /*
- * 6 0x06 '^F'
- */
- 0x10, /* 00010000 */
- 0x38, /* 00111000 */
- 0x7c, /* 01111100 */
- 0xfe, /* 11111110 */
- 0xfe, /* 11111110 */
- 0x7c, /* 01111100 */
- 0x10, /* 00010000 */
- 0x38, /* 00111000 */
-
- /*
- * 7 0x07 '^G'
- */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x18, /* 00011000 */
- 0x3c, /* 00111100 */
- 0x3c, /* 00111100 */
- 0x18, /* 00011000 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
-
- /*
- * 8 0x08 '^H'
- */
- 0xff, /* 11111111 */
- 0xff, /* 11111111 */
- 0xe7, /* 11100111 */
- 0xc3, /* 11000011 */
- 0xc3, /* 11000011 */
- 0xe7, /* 11100111 */
- 0xff, /* 11111111 */
- 0xff, /* 11111111 */
-
- /*
- * 9 0x09 '^I'
- */
- 0x00, /* 00000000 */
- 0x3c, /* 00111100 */
- 0x66, /* 01100110 */
- 0x42, /* 01000010 */
- 0x42, /* 01000010 */
- 0x66, /* 01100110 */
- 0x3c, /* 00111100 */
- 0x00, /* 00000000 */
-
- /*
- * 10 0x0a '^J'
- */
- 0xff, /* 11111111 */
- 0xc3, /* 11000011 */
- 0x99, /* 10011001 */
- 0xbd, /* 10111101 */
- 0xbd, /* 10111101 */
- 0x99, /* 10011001 */
- 0xc3, /* 11000011 */
- 0xff, /* 11111111 */
-
- /*
- * 11 0x0b '^K'
- */
- 0x0f, /* 00001111 */
- 0x07, /* 00000111 */
- 0x0f, /* 00001111 */
- 0x7d, /* 01111101 */
- 0xcc, /* 11001100 */
- 0xcc, /* 11001100 */
- 0xcc, /* 11001100 */
- 0x78, /* 01111000 */
-
- /*
- * 12 0x0c '^L'
- */
- 0x3c, /* 00111100 */
- 0x66, /* 01100110 */
- 0x66, /* 01100110 */
- 0x66, /* 01100110 */
- 0x3c, /* 00111100 */
- 0x18, /* 00011000 */
- 0x7e, /* 01111110 */
- 0x18, /* 00011000 */
-
- /*
- * 13 0x0d '^M'
- */
- 0x3f, /* 00111111 */
- 0x33, /* 00110011 */
- 0x3f, /* 00111111 */
- 0x30, /* 00110000 */
- 0x30, /* 00110000 */
- 0x70, /* 01110000 */
- 0xf0, /* 11110000 */
- 0xe0, /* 11100000 */
-
- /*
- * 14 0x0e '^N'
- */
- 0x7f, /* 01111111 */
- 0x63, /* 01100011 */
- 0x7f, /* 01111111 */
- 0x63, /* 01100011 */
- 0x63, /* 01100011 */
- 0x67, /* 01100111 */
- 0xe6, /* 11100110 */
- 0xc0, /* 11000000 */
-
- /*
- * 15 0x0f '^O'
- */
- 0x18, /* 00011000 */
- 0xdb, /* 11011011 */
- 0x3c, /* 00111100 */
- 0xe7, /* 11100111 */
- 0xe7, /* 11100111 */
- 0x3c, /* 00111100 */
- 0xdb, /* 11011011 */
- 0x18, /* 00011000 */
-
- /*
- * 16 0x10 '^P'
- */
- 0x80, /* 10000000 */
- 0xe0, /* 11100000 */
- 0xf8, /* 11111000 */
- 0xfe, /* 11111110 */
- 0xf8, /* 11111000 */
- 0xe0, /* 11100000 */
- 0x80, /* 10000000 */
- 0x00, /* 00000000 */
-
- /*
- * 17 0x11 '^Q'
- */
- 0x02, /* 00000010 */
- 0x0e, /* 00001110 */
- 0x3e, /* 00111110 */
- 0xfe, /* 11111110 */
- 0x3e, /* 00111110 */
- 0x0e, /* 00001110 */
- 0x02, /* 00000010 */
- 0x00, /* 00000000 */
-
- /*
- * 18 0x12 '^R'
- */
- 0x18, /* 00011000 */
- 0x3c, /* 00111100 */
- 0x7e, /* 01111110 */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
- 0x7e, /* 01111110 */
- 0x3c, /* 00111100 */
- 0x18, /* 00011000 */
-
- /*
- * 19 0x13 '^S'
- */
- 0x66, /* 01100110 */
- 0x66, /* 01100110 */
- 0x66, /* 01100110 */
- 0x66, /* 01100110 */
- 0x66, /* 01100110 */
- 0x00, /* 00000000 */
- 0x66, /* 01100110 */
- 0x00, /* 00000000 */
-
- /*
- * 20 0x14 '^T'
- */
- 0x7f, /* 01111111 */
- 0xdb, /* 11011011 */
- 0xdb, /* 11011011 */
- 0x7b, /* 01111011 */
- 0x1b, /* 00011011 */
- 0x1b, /* 00011011 */
- 0x1b, /* 00011011 */
- 0x00, /* 00000000 */
-
- /*
- * 21 0x15 '^U'
- */
- 0x3e, /* 00111110 */
- 0x61, /* 01100001 */
- 0x3c, /* 00111100 */
- 0x66, /* 01100110 */
- 0x66, /* 01100110 */
- 0x3c, /* 00111100 */
- 0x86, /* 10000110 */
- 0x7c, /* 01111100 */
-
- /*
- * 22 0x16 '^V'
- */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x7e, /* 01111110 */
- 0x7e, /* 01111110 */
- 0x7e, /* 01111110 */
- 0x00, /* 00000000 */
-
- /*
- * 23 0x17 '^W'
- */
- 0x18, /* 00011000 */
- 0x3c, /* 00111100 */
- 0x7e, /* 01111110 */
- 0x18, /* 00011000 */
- 0x7e, /* 01111110 */
- 0x3c, /* 00111100 */
- 0x18, /* 00011000 */
- 0xff, /* 11111111 */
-
- /*
- * 24 0x18 '^X'
- */
- 0x18, /* 00011000 */
- 0x3c, /* 00111100 */
- 0x7e, /* 01111110 */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
- 0x00, /* 00000000 */
-
- /*
- * 25 0x19 '^Y'
- */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
- 0x7e, /* 01111110 */
- 0x3c, /* 00111100 */
- 0x18, /* 00011000 */
- 0x00, /* 00000000 */
-
- /*
- * 26 0x1a '^Z'
- */
- 0x00, /* 00000000 */
- 0x18, /* 00011000 */
- 0x0c, /* 00001100 */
- 0xfe, /* 11111110 */
- 0x0c, /* 00001100 */
- 0x18, /* 00011000 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
-
- /*
- * 27 0x1b '^['
- */
- 0x00, /* 00000000 */
- 0x30, /* 00110000 */
- 0x60, /* 01100000 */
- 0xfe, /* 11111110 */
- 0x60, /* 01100000 */
- 0x30, /* 00110000 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
-
- /*
- * 28 0x1c '^\'
- */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0xc0, /* 11000000 */
- 0xc0, /* 11000000 */
- 0xc0, /* 11000000 */
- 0xfe, /* 11111110 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
-
- /*
- * 29 0x1d '^]'
- */
- 0x00, /* 00000000 */
- 0x24, /* 00100100 */
- 0x66, /* 01100110 */
- 0xff, /* 11111111 */
- 0x66, /* 01100110 */
- 0x24, /* 00100100 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
-
- /*
- * 30 0x1e '^^'
- */
- 0x00, /* 00000000 */
- 0x18, /* 00011000 */
- 0x3c, /* 00111100 */
- 0x7e, /* 01111110 */
- 0xff, /* 11111111 */
- 0xff, /* 11111111 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
-
- /*
- * 31 0x1f '^_'
- */
- 0x00, /* 00000000 */
- 0xff, /* 11111111 */
- 0xff, /* 11111111 */
- 0x7e, /* 01111110 */
- 0x3c, /* 00111100 */
- 0x18, /* 00011000 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
-
- /*
- * 32 0x20 ' '
- */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
-
- /*
- * 33 0x21 '!'
- */
- 0x18, /* 00011000 */
- 0x3c, /* 00111100 */
- 0x3c, /* 00111100 */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
- 0x00, /* 00000000 */
- 0x18, /* 00011000 */
- 0x00, /* 00000000 */
-
- /*
- * 34 0x22 '"'
- */
- 0x66, /* 01100110 */
- 0x66, /* 01100110 */
- 0x24, /* 00100100 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
-
- /*
- * 35 0x23 '#'
- */
- 0x6c, /* 01101100 */
- 0x6c, /* 01101100 */
- 0xfe, /* 11111110 */
- 0x6c, /* 01101100 */
- 0xfe, /* 11111110 */
- 0x6c, /* 01101100 */
- 0x6c, /* 01101100 */
- 0x00, /* 00000000 */
-
- /*
- * 36 0x24 '$'
- */
- 0x18, /* 00011000 */
- 0x3e, /* 00111110 */
- 0x60, /* 01100000 */
- 0x3c, /* 00111100 */
- 0x06, /* 00000110 */
- 0x7c, /* 01111100 */
- 0x18, /* 00011000 */
- 0x00, /* 00000000 */
-
- /*
- * 37 0x25 '%'
- */
- 0x00, /* 00000000 */
- 0xc6, /* 11000110 */
- 0xcc, /* 11001100 */
- 0x18, /* 00011000 */
- 0x30, /* 00110000 */
- 0x66, /* 01100110 */
- 0xc6, /* 11000110 */
- 0x00, /* 00000000 */
-
- /*
- * 38 0x26 '&'
- */
- 0x38, /* 00111000 */
- 0x6c, /* 01101100 */
- 0x38, /* 00111000 */
- 0x76, /* 01110110 */
- 0xdc, /* 11011100 */
- 0xcc, /* 11001100 */
- 0x76, /* 01110110 */
- 0x00, /* 00000000 */
-
- /*
- * 39 0x27 '''
- */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
- 0x30, /* 00110000 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
-
- /*
- * 40 0x28 '('
- */
- 0x0c, /* 00001100 */
- 0x18, /* 00011000 */
- 0x30, /* 00110000 */
- 0x30, /* 00110000 */
- 0x30, /* 00110000 */
- 0x18, /* 00011000 */
- 0x0c, /* 00001100 */
- 0x00, /* 00000000 */
-
- /*
- * 41 0x29 ')'
- */
- 0x30, /* 00110000 */
- 0x18, /* 00011000 */
- 0x0c, /* 00001100 */
- 0x0c, /* 00001100 */
- 0x0c, /* 00001100 */
- 0x18, /* 00011000 */
- 0x30, /* 00110000 */
- 0x00, /* 00000000 */
-
- /*
- * 42 0x2a '*'
- */
- 0x00, /* 00000000 */
- 0x66, /* 01100110 */
- 0x3c, /* 00111100 */
- 0xff, /* 11111111 */
- 0x3c, /* 00111100 */
- 0x66, /* 01100110 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
-
- /*
- * 43 0x2b '+'
- */
- 0x00, /* 00000000 */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
- 0x7e, /* 01111110 */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
-
- /*
- * 44 0x2c ','
- */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
- 0x30, /* 00110000 */
-
- /*
- * 45 0x2d '-'
- */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x7e, /* 01111110 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
-
- /*
- * 46 0x2e '.'
- */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
- 0x00, /* 00000000 */
-
- /*
- * 47 0x2f '/'
- */
- 0x06, /* 00000110 */
- 0x0c, /* 00001100 */
- 0x18, /* 00011000 */
- 0x30, /* 00110000 */
- 0x60, /* 01100000 */
- 0xc0, /* 11000000 */
- 0x80, /* 10000000 */
- 0x00, /* 00000000 */
-
- /*
- * 48 0x30 '0'
- */
- 0x38, /* 00111000 */
- 0x6c, /* 01101100 */
- 0xc6, /* 11000110 */
- 0xd6, /* 11010110 */
- 0xc6, /* 11000110 */
- 0x6c, /* 01101100 */
- 0x38, /* 00111000 */
- 0x00, /* 00000000 */
-
- /*
- * 49 0x31 '1'
- */
- 0x18, /* 00011000 */
- 0x38, /* 00111000 */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
- 0x7e, /* 01111110 */
- 0x00, /* 00000000 */
-
- /*
- * 50 0x32 '2'
- */
- 0x7c, /* 01111100 */
- 0xc6, /* 11000110 */
- 0x06, /* 00000110 */
- 0x1c, /* 00011100 */
- 0x30, /* 00110000 */
- 0x66, /* 01100110 */
- 0xfe, /* 11111110 */
- 0x00, /* 00000000 */
-
- /*
- * 51 0x33 '3'
- */
- 0x7c, /* 01111100 */
- 0xc6, /* 11000110 */
- 0x06, /* 00000110 */
- 0x3c, /* 00111100 */
- 0x06, /* 00000110 */
- 0xc6, /* 11000110 */
- 0x7c, /* 01111100 */
- 0x00, /* 00000000 */
-
- /*
- * 52 0x34 '4'
- */
- 0x1c, /* 00011100 */
- 0x3c, /* 00111100 */
- 0x6c, /* 01101100 */
- 0xcc, /* 11001100 */
- 0xfe, /* 11111110 */
- 0x0c, /* 00001100 */
- 0x1e, /* 00011110 */
- 0x00, /* 00000000 */
-
- /*
- * 53 0x35 '5'
- */
- 0xfe, /* 11111110 */
- 0xc0, /* 11000000 */
- 0xc0, /* 11000000 */
- 0xfc, /* 11111100 */
- 0x06, /* 00000110 */
- 0xc6, /* 11000110 */
- 0x7c, /* 01111100 */
- 0x00, /* 00000000 */
-
- /*
- * 54 0x36 '6'
- */
- 0x38, /* 00111000 */
- 0x60, /* 01100000 */
- 0xc0, /* 11000000 */
- 0xfc, /* 11111100 */
- 0xc6, /* 11000110 */
- 0xc6, /* 11000110 */
- 0x7c, /* 01111100 */
- 0x00, /* 00000000 */
-
- /*
- * 55 0x37 '7'
- */
- 0xfe, /* 11111110 */
- 0xc6, /* 11000110 */
- 0x0c, /* 00001100 */
- 0x18, /* 00011000 */
- 0x30, /* 00110000 */
- 0x30, /* 00110000 */
- 0x30, /* 00110000 */
- 0x00, /* 00000000 */
-
- /*
- * 56 0x38 '8'
- */
- 0x7c, /* 01111100 */
- 0xc6, /* 11000110 */
- 0xc6, /* 11000110 */
- 0x7c, /* 01111100 */
- 0xc6, /* 11000110 */
- 0xc6, /* 11000110 */
- 0x7c, /* 01111100 */
- 0x00, /* 00000000 */
-
- /*
- * 57 0x39 '9'
- */
- 0x7c, /* 01111100 */
- 0xc6, /* 11000110 */
- 0xc6, /* 11000110 */
- 0x7e, /* 01111110 */
- 0x06, /* 00000110 */
- 0x0c, /* 00001100 */
- 0x78, /* 01111000 */
- 0x00, /* 00000000 */
-
- /*
- * 58 0x3a ':'
- */
- 0x00, /* 00000000 */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
- 0x00, /* 00000000 */
-
- /*
- * 59 0x3b ';'
- */
- 0x00, /* 00000000 */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
- 0x30, /* 00110000 */
-
- /*
- * 60 0x3c '<'
- */
- 0x06, /* 00000110 */
- 0x0c, /* 00001100 */
- 0x18, /* 00011000 */
- 0x30, /* 00110000 */
- 0x18, /* 00011000 */
- 0x0c, /* 00001100 */
- 0x06, /* 00000110 */
- 0x00, /* 00000000 */
-
- /*
- * 61 0x3d '='
- */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x7e, /* 01111110 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x7e, /* 01111110 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
-
- /*
- * 62 0x3e '>'
- */
- 0x60, /* 01100000 */
- 0x30, /* 00110000 */
- 0x18, /* 00011000 */
- 0x0c, /* 00001100 */
- 0x18, /* 00011000 */
- 0x30, /* 00110000 */
- 0x60, /* 01100000 */
- 0x00, /* 00000000 */
-
- /*
- * 63 0x3f '?'
- */
- 0x7c, /* 01111100 */
- 0xc6, /* 11000110 */
- 0x0c, /* 00001100 */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
- 0x00, /* 00000000 */
- 0x18, /* 00011000 */
- 0x00, /* 00000000 */
-
- /*
- * 64 0x40 '@'
- */
- 0x7c, /* 01111100 */
- 0xc6, /* 11000110 */
- 0xde, /* 11011110 */
- 0xde, /* 11011110 */
- 0xde, /* 11011110 */
- 0xc0, /* 11000000 */
- 0x78, /* 01111000 */
- 0x00, /* 00000000 */
-
- /*
- * 65 0x41 'A'
- */
- 0x38, /* 00111000 */
- 0x6c, /* 01101100 */
- 0xc6, /* 11000110 */
- 0xfe, /* 11111110 */
- 0xc6, /* 11000110 */
- 0xc6, /* 11000110 */
- 0xc6, /* 11000110 */
- 0x00, /* 00000000 */
-
- /*
- * 66 0x42 'B'
- */
- 0xfc, /* 11111100 */
- 0x66, /* 01100110 */
- 0x66, /* 01100110 */
- 0x7c, /* 01111100 */
- 0x66, /* 01100110 */
- 0x66, /* 01100110 */
- 0xfc, /* 11111100 */
- 0x00, /* 00000000 */
-
- /*
- * 67 0x43 'C'
- */
- 0x3c, /* 00111100 */
- 0x66, /* 01100110 */
- 0xc0, /* 11000000 */
- 0xc0, /* 11000000 */
- 0xc0, /* 11000000 */
- 0x66, /* 01100110 */
- 0x3c, /* 00111100 */
- 0x00, /* 00000000 */
-
- /*
- * 68 0x44 'D'
- */
- 0xf8, /* 11111000 */
- 0x6c, /* 01101100 */
- 0x66, /* 01100110 */
- 0x66, /* 01100110 */
- 0x66, /* 01100110 */
- 0x6c, /* 01101100 */
- 0xf8, /* 11111000 */
- 0x00, /* 00000000 */
-
- /*
- * 69 0x45 'E'
- */
- 0xfe, /* 11111110 */
- 0x62, /* 01100010 */
- 0x68, /* 01101000 */
- 0x78, /* 01111000 */
- 0x68, /* 01101000 */
- 0x62, /* 01100010 */
- 0xfe, /* 11111110 */
- 0x00, /* 00000000 */
-
- /*
- * 70 0x46 'F'
- */
- 0xfe, /* 11111110 */
- 0x62, /* 01100010 */
- 0x68, /* 01101000 */
- 0x78, /* 01111000 */
- 0x68, /* 01101000 */
- 0x60, /* 01100000 */
- 0xf0, /* 11110000 */
- 0x00, /* 00000000 */
-
- /*
- * 71 0x47 'G'
- */
- 0x3c, /* 00111100 */
- 0x66, /* 01100110 */
- 0xc0, /* 11000000 */
- 0xc0, /* 11000000 */
- 0xce, /* 11001110 */
- 0x66, /* 01100110 */
- 0x3a, /* 00111010 */
- 0x00, /* 00000000 */
-
- /*
- * 72 0x48 'H'
- */
- 0xc6, /* 11000110 */
- 0xc6, /* 11000110 */
- 0xc6, /* 11000110 */
- 0xfe, /* 11111110 */
- 0xc6, /* 11000110 */
- 0xc6, /* 11000110 */
- 0xc6, /* 11000110 */
- 0x00, /* 00000000 */
-
- /*
- * 73 0x49 'I'
- */
- 0x3c, /* 00111100 */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
- 0x3c, /* 00111100 */
- 0x00, /* 00000000 */
-
- /*
- * 74 0x4a 'J'
- */
- 0x1e, /* 00011110 */
- 0x0c, /* 00001100 */
- 0x0c, /* 00001100 */
- 0x0c, /* 00001100 */
- 0xcc, /* 11001100 */
- 0xcc, /* 11001100 */
- 0x78, /* 01111000 */
- 0x00, /* 00000000 */
-
- /*
- * 75 0x4b 'K'
- */
- 0xe6, /* 11100110 */
- 0x66, /* 01100110 */
- 0x6c, /* 01101100 */
- 0x78, /* 01111000 */
- 0x6c, /* 01101100 */
- 0x66, /* 01100110 */
- 0xe6, /* 11100110 */
- 0x00, /* 00000000 */
-
- /*
- * 76 0x4c 'L'
- */
- 0xf0, /* 11110000 */
- 0x60, /* 01100000 */
- 0x60, /* 01100000 */
- 0x60, /* 01100000 */
- 0x62, /* 01100010 */
- 0x66, /* 01100110 */
- 0xfe, /* 11111110 */
- 0x00, /* 00000000 */
-
- /*
- * 77 0x4d 'M'
- */
- 0xc6, /* 11000110 */
- 0xee, /* 11101110 */
- 0xfe, /* 11111110 */
- 0xfe, /* 11111110 */
- 0xd6, /* 11010110 */
- 0xc6, /* 11000110 */
- 0xc6, /* 11000110 */
- 0x00, /* 00000000 */
-
- /*
- * 78 0x4e 'N'
- */
- 0xc6, /* 11000110 */
- 0xe6, /* 11100110 */
- 0xf6, /* 11110110 */
- 0xde, /* 11011110 */
- 0xce, /* 11001110 */
- 0xc6, /* 11000110 */
- 0xc6, /* 11000110 */
- 0x00, /* 00000000 */
-
- /*
- * 79 0x4f 'O'
- */
- 0x7c, /* 01111100 */
- 0xc6, /* 11000110 */
- 0xc6, /* 11000110 */
- 0xc6, /* 11000110 */
- 0xc6, /* 11000110 */
- 0xc6, /* 11000110 */
- 0x7c, /* 01111100 */
- 0x00, /* 00000000 */
-
- /*
- * 80 0x50 'P'
- */
- 0xfc, /* 11111100 */
- 0x66, /* 01100110 */
- 0x66, /* 01100110 */
- 0x7c, /* 01111100 */
- 0x60, /* 01100000 */
- 0x60, /* 01100000 */
- 0xf0, /* 11110000 */
- 0x00, /* 00000000 */
-
- /*
- * 81 0x51 'Q'
- */
- 0x7c, /* 01111100 */
- 0xc6, /* 11000110 */
- 0xc6, /* 11000110 */
- 0xc6, /* 11000110 */
- 0xc6, /* 11000110 */
- 0xce, /* 11001110 */
- 0x7c, /* 01111100 */
- 0x0e, /* 00001110 */
-
- /*
- * 82 0x52 'R'
- */
- 0xfc, /* 11111100 */
- 0x66, /* 01100110 */
- 0x66, /* 01100110 */
- 0x7c, /* 01111100 */
- 0x6c, /* 01101100 */
- 0x66, /* 01100110 */
- 0xe6, /* 11100110 */
- 0x00, /* 00000000 */
-
- /*
- * 83 0x53 'S'
- */
- 0x3c, /* 00111100 */
- 0x66, /* 01100110 */
- 0x30, /* 00110000 */
- 0x18, /* 00011000 */
- 0x0c, /* 00001100 */
- 0x66, /* 01100110 */
- 0x3c, /* 00111100 */
- 0x00, /* 00000000 */
-
- /*
- * 84 0x54 'T'
- */
- 0x7e, /* 01111110 */
- 0x7e, /* 01111110 */
- 0x5a, /* 01011010 */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
- 0x3c, /* 00111100 */
- 0x00, /* 00000000 */
-
- /*
- * 85 0x55 'U'
- */
- 0xc6, /* 11000110 */
- 0xc6, /* 11000110 */
- 0xc6, /* 11000110 */
- 0xc6, /* 11000110 */
- 0xc6, /* 11000110 */
- 0xc6, /* 11000110 */
- 0x7c, /* 01111100 */
- 0x00, /* 00000000 */
-
- /*
- * 86 0x56 'V'
- */
- 0xc6, /* 11000110 */
- 0xc6, /* 11000110 */
- 0xc6, /* 11000110 */
- 0xc6, /* 11000110 */
- 0xc6, /* 11000110 */
- 0x6c, /* 01101100 */
- 0x38, /* 00111000 */
- 0x00, /* 00000000 */
-
- /*
- * 87 0x57 'W'
- */
- 0xc6, /* 11000110 */
- 0xc6, /* 11000110 */
- 0xc6, /* 11000110 */
- 0xd6, /* 11010110 */
- 0xd6, /* 11010110 */
- 0xfe, /* 11111110 */
- 0x6c, /* 01101100 */
- 0x00, /* 00000000 */
-
- /*
- * 88 0x58 'X'
- */
- 0xc6, /* 11000110 */
- 0xc6, /* 11000110 */
- 0x6c, /* 01101100 */
- 0x38, /* 00111000 */
- 0x6c, /* 01101100 */
- 0xc6, /* 11000110 */
- 0xc6, /* 11000110 */
- 0x00, /* 00000000 */
-
- /*
- * 89 0x59 'Y'
- */
- 0x66, /* 01100110 */
- 0x66, /* 01100110 */
- 0x66, /* 01100110 */
- 0x3c, /* 00111100 */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
- 0x3c, /* 00111100 */
- 0x00, /* 00000000 */
-
- /*
- * 90 0x5a 'Z'
- */
- 0xfe, /* 11111110 */
- 0xc6, /* 11000110 */
- 0x8c, /* 10001100 */
- 0x18, /* 00011000 */
- 0x32, /* 00110010 */
- 0x66, /* 01100110 */
- 0xfe, /* 11111110 */
- 0x00, /* 00000000 */
-
- /*
- * 91 0x5b '['
- */
- 0x3c, /* 00111100 */
- 0x30, /* 00110000 */
- 0x30, /* 00110000 */
- 0x30, /* 00110000 */
- 0x30, /* 00110000 */
- 0x30, /* 00110000 */
- 0x3c, /* 00111100 */
- 0x00, /* 00000000 */
-
- /*
- * 92 0x5c '\'
- */
- 0xc0, /* 11000000 */
- 0x60, /* 01100000 */
- 0x30, /* 00110000 */
- 0x18, /* 00011000 */
- 0x0c, /* 00001100 */
- 0x06, /* 00000110 */
- 0x02, /* 00000010 */
- 0x00, /* 00000000 */
-
- /*
- * 93 0x5d ']'
- */
- 0x3c, /* 00111100 */
- 0x0c, /* 00001100 */
- 0x0c, /* 00001100 */
- 0x0c, /* 00001100 */
- 0x0c, /* 00001100 */
- 0x0c, /* 00001100 */
- 0x3c, /* 00111100 */
- 0x00, /* 00000000 */
-
- /*
- * 94 0x5e '^'
- */
- 0x10, /* 00010000 */
- 0x38, /* 00111000 */
- 0x6c, /* 01101100 */
- 0xc6, /* 11000110 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
-
- /*
- * 95 0x5f '_'
- */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0xff, /* 11111111 */
-
- /*
- * 96 0x60 '`'
- */
- 0x30, /* 00110000 */
- 0x18, /* 00011000 */
- 0x0c, /* 00001100 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
-
- /*
- * 97 0x61 'a'
- */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x78, /* 01111000 */
- 0x0c, /* 00001100 */
- 0x7c, /* 01111100 */
- 0xcc, /* 11001100 */
- 0x76, /* 01110110 */
- 0x00, /* 00000000 */
-
- /*
- * 98 0x62 'b'
- */
- 0xe0, /* 11100000 */
- 0x60, /* 01100000 */
- 0x7c, /* 01111100 */
- 0x66, /* 01100110 */
- 0x66, /* 01100110 */
- 0x66, /* 01100110 */
- 0xdc, /* 11011100 */
- 0x00, /* 00000000 */
-
- /*
- * 99 0x63 'c'
- */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x7c, /* 01111100 */
- 0xc6, /* 11000110 */
- 0xc0, /* 11000000 */
- 0xc6, /* 11000110 */
- 0x7c, /* 01111100 */
- 0x00, /* 00000000 */
-
- /*
- * 100 0x64 'd'
- */
- 0x1c, /* 00011100 */
- 0x0c, /* 00001100 */
- 0x7c, /* 01111100 */
- 0xcc, /* 11001100 */
- 0xcc, /* 11001100 */
- 0xcc, /* 11001100 */
- 0x76, /* 01110110 */
- 0x00, /* 00000000 */
-
- /*
- * 101 0x65 'e'
- */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x7c, /* 01111100 */
- 0xc6, /* 11000110 */
- 0xfe, /* 11111110 */
- 0xc0, /* 11000000 */
- 0x7c, /* 01111100 */
- 0x00, /* 00000000 */
-
- /*
- * 102 0x66 'f'
- */
- 0x3c, /* 00111100 */
- 0x66, /* 01100110 */
- 0x60, /* 01100000 */
- 0xf8, /* 11111000 */
- 0x60, /* 01100000 */
- 0x60, /* 01100000 */
- 0xf0, /* 11110000 */
- 0x00, /* 00000000 */
-
- /*
- * 103 0x67 'g'
- */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x76, /* 01110110 */
- 0xcc, /* 11001100 */
- 0xcc, /* 11001100 */
- 0x7c, /* 01111100 */
- 0x0c, /* 00001100 */
- 0xf8, /* 11111000 */
-
- /*
- * 104 0x68 'h'
- */
- 0xe0, /* 11100000 */
- 0x60, /* 01100000 */
- 0x6c, /* 01101100 */
- 0x76, /* 01110110 */
- 0x66, /* 01100110 */
- 0x66, /* 01100110 */
- 0xe6, /* 11100110 */
- 0x00, /* 00000000 */
-
- /*
- * 105 0x69 'i'
- */
- 0x18, /* 00011000 */
- 0x00, /* 00000000 */
- 0x38, /* 00111000 */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
- 0x3c, /* 00111100 */
- 0x00, /* 00000000 */
-
- /*
- * 106 0x6a 'j'
- */
- 0x06, /* 00000110 */
- 0x00, /* 00000000 */
- 0x06, /* 00000110 */
- 0x06, /* 00000110 */
- 0x06, /* 00000110 */
- 0x66, /* 01100110 */
- 0x66, /* 01100110 */
- 0x3c, /* 00111100 */
-
- /*
- * 107 0x6b 'k'
- */
- 0xe0, /* 11100000 */
- 0x60, /* 01100000 */
- 0x66, /* 01100110 */
- 0x6c, /* 01101100 */
- 0x78, /* 01111000 */
- 0x6c, /* 01101100 */
- 0xe6, /* 11100110 */
- 0x00, /* 00000000 */
-
- /*
- * 108 0x6c 'l'
- */
- 0x38, /* 00111000 */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
- 0x3c, /* 00111100 */
- 0x00, /* 00000000 */
-
- /*
- * 109 0x6d 'm'
- */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0xec, /* 11101100 */
- 0xfe, /* 11111110 */
- 0xd6, /* 11010110 */
- 0xd6, /* 11010110 */
- 0xd6, /* 11010110 */
- 0x00, /* 00000000 */
-
- /*
- * 110 0x6e 'n'
- */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0xdc, /* 11011100 */
- 0x66, /* 01100110 */
- 0x66, /* 01100110 */
- 0x66, /* 01100110 */
- 0x66, /* 01100110 */
- 0x00, /* 00000000 */
-
- /*
- * 111 0x6f 'o'
- */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x7c, /* 01111100 */
- 0xc6, /* 11000110 */
- 0xc6, /* 11000110 */
- 0xc6, /* 11000110 */
- 0x7c, /* 01111100 */
- 0x00, /* 00000000 */
-
- /*
- * 112 0x70 'p'
- */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0xdc, /* 11011100 */
- 0x66, /* 01100110 */
- 0x66, /* 01100110 */
- 0x7c, /* 01111100 */
- 0x60, /* 01100000 */
- 0xf0, /* 11110000 */
-
- /*
- * 113 0x71 'q'
- */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x76, /* 01110110 */
- 0xcc, /* 11001100 */
- 0xcc, /* 11001100 */
- 0x7c, /* 01111100 */
- 0x0c, /* 00001100 */
- 0x1e, /* 00011110 */
-
- /*
- * 114 0x72 'r'
- */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0xdc, /* 11011100 */
- 0x76, /* 01110110 */
- 0x60, /* 01100000 */
- 0x60, /* 01100000 */
- 0xf0, /* 11110000 */
- 0x00, /* 00000000 */
-
- /*
- * 115 0x73 's'
- */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x7e, /* 01111110 */
- 0xc0, /* 11000000 */
- 0x7c, /* 01111100 */
- 0x06, /* 00000110 */
- 0xfc, /* 11111100 */
- 0x00, /* 00000000 */
-
- /*
- * 116 0x74 't'
- */
- 0x30, /* 00110000 */
- 0x30, /* 00110000 */
- 0xfc, /* 11111100 */
- 0x30, /* 00110000 */
- 0x30, /* 00110000 */
- 0x36, /* 00110110 */
- 0x1c, /* 00011100 */
- 0x00, /* 00000000 */
-
- /*
- * 117 0x75 'u'
- */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0xcc, /* 11001100 */
- 0xcc, /* 11001100 */
- 0xcc, /* 11001100 */
- 0xcc, /* 11001100 */
- 0x76, /* 01110110 */
- 0x00, /* 00000000 */
-
- /*
- * 118 0x76 'v'
- */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0xc6, /* 11000110 */
- 0xc6, /* 11000110 */
- 0xc6, /* 11000110 */
- 0x6c, /* 01101100 */
- 0x38, /* 00111000 */
- 0x00, /* 00000000 */
-
- /*
- * 119 0x77 'w'
- */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0xc6, /* 11000110 */
- 0xd6, /* 11010110 */
- 0xd6, /* 11010110 */
- 0xfe, /* 11111110 */
- 0x6c, /* 01101100 */
- 0x00, /* 00000000 */
-
- /*
- * 120 0x78 'x'
- */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0xc6, /* 11000110 */
- 0x6c, /* 01101100 */
- 0x38, /* 00111000 */
- 0x6c, /* 01101100 */
- 0xc6, /* 11000110 */
- 0x00, /* 00000000 */
-
- /*
- * 121 0x79 'y'
- */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0xc6, /* 11000110 */
- 0xc6, /* 11000110 */
- 0xc6, /* 11000110 */
- 0x7e, /* 01111110 */
- 0x06, /* 00000110 */
- 0xfc, /* 11111100 */
-
- /*
- * 122 0x7a 'z'
- */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x7e, /* 01111110 */
- 0x4c, /* 01001100 */
- 0x18, /* 00011000 */
- 0x32, /* 00110010 */
- 0x7e, /* 01111110 */
- 0x00, /* 00000000 */
-
- /*
- * 123 0x7b '{'
- */
- 0x0e, /* 00001110 */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
- 0x70, /* 01110000 */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
- 0x0e, /* 00001110 */
- 0x00, /* 00000000 */
-
- /*
- * 124 0x7c '|'
- */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
- 0x00, /* 00000000 */
-
- /*
- * 125 0x7d '}'
- */
- 0x70, /* 01110000 */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
- 0x0e, /* 00001110 */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
- 0x70, /* 01110000 */
- 0x00, /* 00000000 */
-
- /*
- * 126 0x7e '~'
- */
- 0x76, /* 01110110 */
- 0xdc, /* 11011100 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
-
- /*
- * 127 0x7f ''
- */
- 0x00, /* 00000000 */
- 0x10, /* 00010000 */
- 0x38, /* 00111000 */
- 0x6c, /* 01101100 */
- 0xc6, /* 11000110 */
- 0xc6, /* 11000110 */
- 0xfe, /* 11111110 */
- 0x00, /* 00000000 */
-
- /*
- * 128 0x80 '€'
- */
- 0x7c, /* 01111100 */
- 0xc6, /* 11000110 */
- 0xc0, /* 11000000 */
- 0xc0, /* 11000000 */
- 0xc6, /* 11000110 */
- 0x7c, /* 01111100 */
- 0x0c, /* 00001100 */
- 0x78, /* 01111000 */
-
- /*
- * 129 0x81 ''
- */
- 0xcc, /* 11001100 */
- 0x00, /* 00000000 */
- 0xcc, /* 11001100 */
- 0xcc, /* 11001100 */
- 0xcc, /* 11001100 */
- 0xcc, /* 11001100 */
- 0x76, /* 01110110 */
- 0x00, /* 00000000 */
-
- /*
- * 130 0x82 '‚'
- */
- 0x0c, /* 00001100 */
- 0x18, /* 00011000 */
- 0x7c, /* 01111100 */
- 0xc6, /* 11000110 */
- 0xfe, /* 11111110 */
- 0xc0, /* 11000000 */
- 0x7c, /* 01111100 */
- 0x00, /* 00000000 */
-
- /*
- * 131 0x83 'ƒ'
- */
- 0x7c, /* 01111100 */
- 0x82, /* 10000010 */
- 0x78, /* 01111000 */
- 0x0c, /* 00001100 */
- 0x7c, /* 01111100 */
- 0xcc, /* 11001100 */
- 0x76, /* 01110110 */
- 0x00, /* 00000000 */
-
- /*
- * 132 0x84 '„'
- */
- 0xc6, /* 11000110 */
- 0x00, /* 00000000 */
- 0x78, /* 01111000 */
- 0x0c, /* 00001100 */
- 0x7c, /* 01111100 */
- 0xcc, /* 11001100 */
- 0x76, /* 01110110 */
- 0x00, /* 00000000 */
-
- /*
- * 133 0x85 '…'
- */
- 0x30, /* 00110000 */
- 0x18, /* 00011000 */
- 0x78, /* 01111000 */
- 0x0c, /* 00001100 */
- 0x7c, /* 01111100 */
- 0xcc, /* 11001100 */
- 0x76, /* 01110110 */
- 0x00, /* 00000000 */
-
- /*
- * 134 0x86 '†'
- */
- 0x30, /* 00110000 */
- 0x30, /* 00110000 */
- 0x78, /* 01111000 */
- 0x0c, /* 00001100 */
- 0x7c, /* 01111100 */
- 0xcc, /* 11001100 */
- 0x76, /* 01110110 */
- 0x00, /* 00000000 */
-
- /*
- * 135 0x87 '‡'
- */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x7e, /* 01111110 */
- 0xc0, /* 11000000 */
- 0xc0, /* 11000000 */
- 0x7e, /* 01111110 */
- 0x0c, /* 00001100 */
- 0x38, /* 00111000 */
-
- /*
- * 136 0x88 'ˆ'
- */
- 0x7c, /* 01111100 */
- 0x82, /* 10000010 */
- 0x7c, /* 01111100 */
- 0xc6, /* 11000110 */
- 0xfe, /* 11111110 */
- 0xc0, /* 11000000 */
- 0x7c, /* 01111100 */
- 0x00, /* 00000000 */
-
- /*
- * 137 0x89 '‰'
- */
- 0xc6, /* 11000110 */
- 0x00, /* 00000000 */
- 0x7c, /* 01111100 */
- 0xc6, /* 11000110 */
- 0xfe, /* 11111110 */
- 0xc0, /* 11000000 */
- 0x7c, /* 01111100 */
- 0x00, /* 00000000 */
-
- /*
- * 138 0x8a 'Š'
- */
- 0x30, /* 00110000 */
- 0x18, /* 00011000 */
- 0x7c, /* 01111100 */
- 0xc6, /* 11000110 */
- 0xfe, /* 11111110 */
- 0xc0, /* 11000000 */
- 0x7c, /* 01111100 */
- 0x00, /* 00000000 */
-
- /*
- * 139 0x8b '‹'
- */
- 0x66, /* 01100110 */
- 0x00, /* 00000000 */
- 0x38, /* 00111000 */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
- 0x3c, /* 00111100 */
- 0x00, /* 00000000 */
-
- /*
- * 140 0x8c 'Œ'
- */
- 0x7c, /* 01111100 */
- 0x82, /* 10000010 */
- 0x38, /* 00111000 */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
- 0x3c, /* 00111100 */
- 0x00, /* 00000000 */
-
- /*
- * 141 0x8d ''
- */
- 0x30, /* 00110000 */
- 0x18, /* 00011000 */
- 0x00, /* 00000000 */
- 0x38, /* 00111000 */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
- 0x3c, /* 00111100 */
- 0x00, /* 00000000 */
-
- /*
- * 142 0x8e 'Ž'
- */
- 0xc6, /* 11000110 */
- 0x38, /* 00111000 */
- 0x6c, /* 01101100 */
- 0xc6, /* 11000110 */
- 0xfe, /* 11111110 */
- 0xc6, /* 11000110 */
- 0xc6, /* 11000110 */
- 0x00, /* 00000000 */
-
- /*
- * 143 0x8f ''
- */
- 0x38, /* 00111000 */
- 0x6c, /* 01101100 */
- 0x7c, /* 01111100 */
- 0xc6, /* 11000110 */
- 0xfe, /* 11111110 */
- 0xc6, /* 11000110 */
- 0xc6, /* 11000110 */
- 0x00, /* 00000000 */
-
- /*
- * 144 0x90 ''
- */
- 0x18, /* 00011000 */
- 0x30, /* 00110000 */
- 0xfe, /* 11111110 */
- 0xc0, /* 11000000 */
- 0xf8, /* 11111000 */
- 0xc0, /* 11000000 */
- 0xfe, /* 11111110 */
- 0x00, /* 00000000 */
-
- /*
- * 145 0x91 '‘'
- */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x7e, /* 01111110 */
- 0x18, /* 00011000 */
- 0x7e, /* 01111110 */
- 0xd8, /* 11011000 */
- 0x7e, /* 01111110 */
- 0x00, /* 00000000 */
-
- /*
- * 146 0x92 '’'
- */
- 0x3e, /* 00111110 */
- 0x6c, /* 01101100 */
- 0xcc, /* 11001100 */
- 0xfe, /* 11111110 */
- 0xcc, /* 11001100 */
- 0xcc, /* 11001100 */
- 0xce, /* 11001110 */
- 0x00, /* 00000000 */
-
- /*
- * 147 0x93 '“'
- */
- 0x7c, /* 01111100 */
- 0x82, /* 10000010 */
- 0x7c, /* 01111100 */
- 0xc6, /* 11000110 */
- 0xc6, /* 11000110 */
- 0xc6, /* 11000110 */
- 0x7c, /* 01111100 */
- 0x00, /* 00000000 */
-
- /*
- * 148 0x94 '”'
- */
- 0xc6, /* 11000110 */
- 0x00, /* 00000000 */
- 0x7c, /* 01111100 */
- 0xc6, /* 11000110 */
- 0xc6, /* 11000110 */
- 0xc6, /* 11000110 */
- 0x7c, /* 01111100 */
- 0x00, /* 00000000 */
-
- /*
- * 149 0x95 '•'
- */
- 0x30, /* 00110000 */
- 0x18, /* 00011000 */
- 0x7c, /* 01111100 */
- 0xc6, /* 11000110 */
- 0xc6, /* 11000110 */
- 0xc6, /* 11000110 */
- 0x7c, /* 01111100 */
- 0x00, /* 00000000 */
-
- /*
- * 150 0x96 '–'
- */
- 0x78, /* 01111000 */
- 0x84, /* 10000100 */
- 0x00, /* 00000000 */
- 0xcc, /* 11001100 */
- 0xcc, /* 11001100 */
- 0xcc, /* 11001100 */
- 0x76, /* 01110110 */
- 0x00, /* 00000000 */
-
- /*
- * 151 0x97 '—'
- */
- 0x60, /* 01100000 */
- 0x30, /* 00110000 */
- 0xcc, /* 11001100 */
- 0xcc, /* 11001100 */
- 0xcc, /* 11001100 */
- 0xcc, /* 11001100 */
- 0x76, /* 01110110 */
- 0x00, /* 00000000 */
-
- /*
- * 152 0x98 '˜'
- */
- 0xc6, /* 11000110 */
- 0x00, /* 00000000 */
- 0xc6, /* 11000110 */
- 0xc6, /* 11000110 */
- 0xc6, /* 11000110 */
- 0x7e, /* 01111110 */
- 0x06, /* 00000110 */
- 0xfc, /* 11111100 */
-
- /*
- * 153 0x99 '™'
- */
- 0xc6, /* 11000110 */
- 0x38, /* 00111000 */
- 0x6c, /* 01101100 */
- 0xc6, /* 11000110 */
- 0xc6, /* 11000110 */
- 0x6c, /* 01101100 */
- 0x38, /* 00111000 */
- 0x00, /* 00000000 */
-
- /*
- * 154 0x9a 'š'
- */
- 0xc6, /* 11000110 */
- 0x00, /* 00000000 */
- 0xc6, /* 11000110 */
- 0xc6, /* 11000110 */
- 0xc6, /* 11000110 */
- 0xc6, /* 11000110 */
- 0x7c, /* 01111100 */
- 0x00, /* 00000000 */
-
- /*
- * 155 0x9b '›'
- */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
- 0x7e, /* 01111110 */
- 0xc0, /* 11000000 */
- 0xc0, /* 11000000 */
- 0x7e, /* 01111110 */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
-
- /*
- * 156 0x9c 'œ'
- */
- 0x38, /* 00111000 */
- 0x6c, /* 01101100 */
- 0x64, /* 01100100 */
- 0xf0, /* 11110000 */
- 0x60, /* 01100000 */
- 0x66, /* 01100110 */
- 0xfc, /* 11111100 */
- 0x00, /* 00000000 */
-
- /*
- * 157 0x9d ''
- */
- 0x66, /* 01100110 */
- 0x66, /* 01100110 */
- 0x3c, /* 00111100 */
- 0x7e, /* 01111110 */
- 0x18, /* 00011000 */
- 0x7e, /* 01111110 */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
-
- /*
- * 158 0x9e 'ž'
- */
- 0xf8, /* 11111000 */
- 0xcc, /* 11001100 */
- 0xcc, /* 11001100 */
- 0xfa, /* 11111010 */
- 0xc6, /* 11000110 */
- 0xcf, /* 11001111 */
- 0xc6, /* 11000110 */
- 0xc7, /* 11000111 */
-
- /*
- * 159 0x9f 'Ÿ'
- */
- 0x0e, /* 00001110 */
- 0x1b, /* 00011011 */
- 0x18, /* 00011000 */
- 0x3c, /* 00111100 */
- 0x18, /* 00011000 */
- 0xd8, /* 11011000 */
- 0x70, /* 01110000 */
- 0x00, /* 00000000 */
-
- /*
- * 160 0xa0 ' '
- */
- 0x18, /* 00011000 */
- 0x30, /* 00110000 */
- 0x78, /* 01111000 */
- 0x0c, /* 00001100 */
- 0x7c, /* 01111100 */
- 0xcc, /* 11001100 */
- 0x76, /* 01110110 */
- 0x00, /* 00000000 */
-
- /*
- * 161 0xa1 '¡'
- */
- 0x0c, /* 00001100 */
- 0x18, /* 00011000 */
- 0x00, /* 00000000 */
- 0x38, /* 00111000 */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
- 0x3c, /* 00111100 */
- 0x00, /* 00000000 */
-
- /*
- * 162 0xa2 '¢'
- */
- 0x0c, /* 00001100 */
- 0x18, /* 00011000 */
- 0x7c, /* 01111100 */
- 0xc6, /* 11000110 */
- 0xc6, /* 11000110 */
- 0xc6, /* 11000110 */
- 0x7c, /* 01111100 */
- 0x00, /* 00000000 */
-
- /*
- * 163 0xa3 '£'
- */
- 0x18, /* 00011000 */
- 0x30, /* 00110000 */
- 0xcc, /* 11001100 */
- 0xcc, /* 11001100 */
- 0xcc, /* 11001100 */
- 0xcc, /* 11001100 */
- 0x76, /* 01110110 */
- 0x00, /* 00000000 */
-
- /*
- * 164 0xa4 '¤'
- */
- 0x76, /* 01110110 */
- 0xdc, /* 11011100 */
- 0x00, /* 00000000 */
- 0xdc, /* 11011100 */
- 0x66, /* 01100110 */
- 0x66, /* 01100110 */
- 0x66, /* 01100110 */
- 0x00, /* 00000000 */
-
- /*
- * 165 0xa5 '¥'
- */
- 0x76, /* 01110110 */
- 0xdc, /* 11011100 */
- 0x00, /* 00000000 */
- 0xe6, /* 11100110 */
- 0xf6, /* 11110110 */
- 0xde, /* 11011110 */
- 0xce, /* 11001110 */
- 0x00, /* 00000000 */
-
- /*
- * 166 0xa6 '¦'
- */
- 0x3c, /* 00111100 */
- 0x6c, /* 01101100 */
- 0x6c, /* 01101100 */
- 0x3e, /* 00111110 */
- 0x00, /* 00000000 */
- 0x7e, /* 01111110 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
-
- /*
- * 167 0xa7 '§'
- */
- 0x38, /* 00111000 */
- 0x6c, /* 01101100 */
- 0x6c, /* 01101100 */
- 0x38, /* 00111000 */
- 0x00, /* 00000000 */
- 0x7c, /* 01111100 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
-
- /*
- * 168 0xa8 '¨'
- */
- 0x18, /* 00011000 */
- 0x00, /* 00000000 */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
- 0x30, /* 00110000 */
- 0x63, /* 01100011 */
- 0x3e, /* 00111110 */
- 0x00, /* 00000000 */
-
- /*
- * 169 0xa9 '©'
- */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0xfe, /* 11111110 */
- 0xc0, /* 11000000 */
- 0xc0, /* 11000000 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
-
- /*
- * 170 0xaa 'ª'
- */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0xfe, /* 11111110 */
- 0x06, /* 00000110 */
- 0x06, /* 00000110 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
-
- /*
- * 171 0xab '«'
- */
- 0x63, /* 01100011 */
- 0xe6, /* 11100110 */
- 0x6c, /* 01101100 */
- 0x7e, /* 01111110 */
- 0x33, /* 00110011 */
- 0x66, /* 01100110 */
- 0xcc, /* 11001100 */
- 0x0f, /* 00001111 */
-
- /*
- * 172 0xac '¬'
- */
- 0x63, /* 01100011 */
- 0xe6, /* 11100110 */
- 0x6c, /* 01101100 */
- 0x7a, /* 01111010 */
- 0x36, /* 00110110 */
- 0x6a, /* 01101010 */
- 0xdf, /* 11011111 */
- 0x06, /* 00000110 */
-
- /*
- * 173 0xad '­'
- */
- 0x18, /* 00011000 */
- 0x00, /* 00000000 */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
- 0x3c, /* 00111100 */
- 0x3c, /* 00111100 */
- 0x18, /* 00011000 */
- 0x00, /* 00000000 */
-
- /*
- * 174 0xae '®'
- */
- 0x00, /* 00000000 */
- 0x33, /* 00110011 */
- 0x66, /* 01100110 */
- 0xcc, /* 11001100 */
- 0x66, /* 01100110 */
- 0x33, /* 00110011 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
-
- /*
- * 175 0xaf '¯'
- */
- 0x00, /* 00000000 */
- 0xcc, /* 11001100 */
- 0x66, /* 01100110 */
- 0x33, /* 00110011 */
- 0x66, /* 01100110 */
- 0xcc, /* 11001100 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
-
- /*
- * 176 0xb0 '°'
- */
- 0x22, /* 00100010 */
- 0x88, /* 10001000 */
- 0x22, /* 00100010 */
- 0x88, /* 10001000 */
- 0x22, /* 00100010 */
- 0x88, /* 10001000 */
- 0x22, /* 00100010 */
- 0x88, /* 10001000 */
-
- /*
- * 177 0xb1 '±'
- */
- 0x55, /* 01010101 */
- 0xaa, /* 10101010 */
- 0x55, /* 01010101 */
- 0xaa, /* 10101010 */
- 0x55, /* 01010101 */
- 0xaa, /* 10101010 */
- 0x55, /* 01010101 */
- 0xaa, /* 10101010 */
-
- /*
- * 178 0xb2 '²'
- */
- 0x77, /* 01110111 */
- 0xdd, /* 11011101 */
- 0x77, /* 01110111 */
- 0xdd, /* 11011101 */
- 0x77, /* 01110111 */
- 0xdd, /* 11011101 */
- 0x77, /* 01110111 */
- 0xdd, /* 11011101 */
-
- /*
- * 179 0xb3 '³'
- */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
-
- /*
- * 180 0xb4 '´'
- */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
- 0xf8, /* 11111000 */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
-
- /*
- * 181 0xb5 'µ'
- */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
- 0xf8, /* 11111000 */
- 0x18, /* 00011000 */
- 0xf8, /* 11111000 */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
-
- /*
- * 182 0xb6 '¶'
- */
- 0x36, /* 00110110 */
- 0x36, /* 00110110 */
- 0x36, /* 00110110 */
- 0x36, /* 00110110 */
- 0xf6, /* 11110110 */
- 0x36, /* 00110110 */
- 0x36, /* 00110110 */
- 0x36, /* 00110110 */
-
- /*
- * 183 0xb7 '·'
- */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0xfe, /* 11111110 */
- 0x36, /* 00110110 */
- 0x36, /* 00110110 */
- 0x36, /* 00110110 */
-
- /*
- * 184 0xb8 '¸'
- */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0xf8, /* 11111000 */
- 0x18, /* 00011000 */
- 0xf8, /* 11111000 */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
-
- /*
- * 185 0xb9 '¹'
- */
- 0x36, /* 00110110 */
- 0x36, /* 00110110 */
- 0xf6, /* 11110110 */
- 0x06, /* 00000110 */
- 0xf6, /* 11110110 */
- 0x36, /* 00110110 */
- 0x36, /* 00110110 */
- 0x36, /* 00110110 */
-
- /*
- * 186 0xba 'º'
- */
- 0x36, /* 00110110 */
- 0x36, /* 00110110 */
- 0x36, /* 00110110 */
- 0x36, /* 00110110 */
- 0x36, /* 00110110 */
- 0x36, /* 00110110 */
- 0x36, /* 00110110 */
- 0x36, /* 00110110 */
-
- /*
- * 187 0xbb '»'
- */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0xfe, /* 11111110 */
- 0x06, /* 00000110 */
- 0xf6, /* 11110110 */
- 0x36, /* 00110110 */
- 0x36, /* 00110110 */
- 0x36, /* 00110110 */
-
- /*
- * 188 0xbc '¼'
- */
- 0x36, /* 00110110 */
- 0x36, /* 00110110 */
- 0xf6, /* 11110110 */
- 0x06, /* 00000110 */
- 0xfe, /* 11111110 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
-
- /*
- * 189 0xbd '½'
- */
- 0x36, /* 00110110 */
- 0x36, /* 00110110 */
- 0x36, /* 00110110 */
- 0x36, /* 00110110 */
- 0xfe, /* 11111110 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
-
- /*
- * 190 0xbe '¾'
- */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
- 0xf8, /* 11111000 */
- 0x18, /* 00011000 */
- 0xf8, /* 11111000 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
-
- /*
- * 191 0xbf '¿'
- */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0xf8, /* 11111000 */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
-
- /*
- * 192 0xc0 'À'
- */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
- 0x1f, /* 00011111 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
-
- /*
- * 193 0xc1 'Á'
- */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
- 0xff, /* 11111111 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
-
- /*
- * 194 0xc2 'Â'
- */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0xff, /* 11111111 */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
-
- /*
- * 195 0xc3 'Ã'
- */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
- 0x1f, /* 00011111 */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
-
- /*
- * 196 0xc4 'Ä'
- */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0xff, /* 11111111 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
-
- /*
- * 197 0xc5 'Å'
- */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
- 0xff, /* 11111111 */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
-
- /*
- * 198 0xc6 'Æ'
- */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
- 0x1f, /* 00011111 */
- 0x18, /* 00011000 */
- 0x1f, /* 00011111 */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
-
- /*
- * 199 0xc7 'Ç'
- */
- 0x36, /* 00110110 */
- 0x36, /* 00110110 */
- 0x36, /* 00110110 */
- 0x36, /* 00110110 */
- 0x37, /* 00110111 */
- 0x36, /* 00110110 */
- 0x36, /* 00110110 */
- 0x36, /* 00110110 */
-
- /*
- * 200 0xc8 'È'
- */
- 0x36, /* 00110110 */
- 0x36, /* 00110110 */
- 0x37, /* 00110111 */
- 0x30, /* 00110000 */
- 0x3f, /* 00111111 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
-
- /*
- * 201 0xc9 'É'
- */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x3f, /* 00111111 */
- 0x30, /* 00110000 */
- 0x37, /* 00110111 */
- 0x36, /* 00110110 */
- 0x36, /* 00110110 */
- 0x36, /* 00110110 */
-
- /*
- * 202 0xca 'Ê'
- */
- 0x36, /* 00110110 */
- 0x36, /* 00110110 */
- 0xf7, /* 11110111 */
- 0x00, /* 00000000 */
- 0xff, /* 11111111 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
-
- /*
- * 203 0xcb 'Ë'
- */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0xff, /* 11111111 */
- 0x00, /* 00000000 */
- 0xf7, /* 11110111 */
- 0x36, /* 00110110 */
- 0x36, /* 00110110 */
- 0x36, /* 00110110 */
-
- /*
- * 204 0xcc 'Ì'
- */
- 0x36, /* 00110110 */
- 0x36, /* 00110110 */
- 0x37, /* 00110111 */
- 0x30, /* 00110000 */
- 0x37, /* 00110111 */
- 0x36, /* 00110110 */
- 0x36, /* 00110110 */
- 0x36, /* 00110110 */
-
- /*
- * 205 0xcd 'Í'
- */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0xff, /* 11111111 */
- 0x00, /* 00000000 */
- 0xff, /* 11111111 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
-
- /*
- * 206 0xce 'Î'
- */
- 0x36, /* 00110110 */
- 0x36, /* 00110110 */
- 0xf7, /* 11110111 */
- 0x00, /* 00000000 */
- 0xf7, /* 11110111 */
- 0x36, /* 00110110 */
- 0x36, /* 00110110 */
- 0x36, /* 00110110 */
-
- /*
- * 207 0xcf 'Ï'
- */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
- 0xff, /* 11111111 */
- 0x00, /* 00000000 */
- 0xff, /* 11111111 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
-
- /*
- * 208 0xd0 'Ð'
- */
- 0x36, /* 00110110 */
- 0x36, /* 00110110 */
- 0x36, /* 00110110 */
- 0x36, /* 00110110 */
- 0xff, /* 11111111 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
-
- /*
- * 209 0xd1 'Ñ'
- */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0xff, /* 11111111 */
- 0x00, /* 00000000 */
- 0xff, /* 11111111 */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
-
- /*
- * 210 0xd2 'Ò'
- */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0xff, /* 11111111 */
- 0x36, /* 00110110 */
- 0x36, /* 00110110 */
- 0x36, /* 00110110 */
-
- /*
- * 211 0xd3 'Ó'
- */
- 0x36, /* 00110110 */
- 0x36, /* 00110110 */
- 0x36, /* 00110110 */
- 0x36, /* 00110110 */
- 0x3f, /* 00111111 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
-
- /*
- * 212 0xd4 'Ô'
- */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
- 0x1f, /* 00011111 */
- 0x18, /* 00011000 */
- 0x1f, /* 00011111 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
-
- /*
- * 213 0xd5 'Õ'
- */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x1f, /* 00011111 */
- 0x18, /* 00011000 */
- 0x1f, /* 00011111 */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
-
- /*
- * 214 0xd6 'Ö'
- */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x3f, /* 00111111 */
- 0x36, /* 00110110 */
- 0x36, /* 00110110 */
- 0x36, /* 00110110 */
-
- /*
- * 215 0xd7 '×'
- */
- 0x36, /* 00110110 */
- 0x36, /* 00110110 */
- 0x36, /* 00110110 */
- 0x36, /* 00110110 */
- 0xff, /* 11111111 */
- 0x36, /* 00110110 */
- 0x36, /* 00110110 */
- 0x36, /* 00110110 */
-
- /*
- * 216 0xd8 'Ø'
- */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
- 0xff, /* 11111111 */
- 0x18, /* 00011000 */
- 0xff, /* 11111111 */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
-
- /*
- * 217 0xd9 'Ù'
- */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
- 0xf8, /* 11111000 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
-
- /*
- * 218 0xda 'Ú'
- */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x1f, /* 00011111 */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
-
- /*
- * 219 0xdb 'Û'
- */
- 0xff, /* 11111111 */
- 0xff, /* 11111111 */
- 0xff, /* 11111111 */
- 0xff, /* 11111111 */
- 0xff, /* 11111111 */
- 0xff, /* 11111111 */
- 0xff, /* 11111111 */
- 0xff, /* 11111111 */
-
- /*
- * 220 0xdc 'Ü'
- */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0xff, /* 11111111 */
- 0xff, /* 11111111 */
- 0xff, /* 11111111 */
- 0xff, /* 11111111 */
-
- /*
- * 221 0xdd 'Ý'
- */
- 0xf0, /* 11110000 */
- 0xf0, /* 11110000 */
- 0xf0, /* 11110000 */
- 0xf0, /* 11110000 */
- 0xf0, /* 11110000 */
- 0xf0, /* 11110000 */
- 0xf0, /* 11110000 */
- 0xf0, /* 11110000 */
-
- /*
- * 222 0xde 'Þ'
- */
- 0x0f, /* 00001111 */
- 0x0f, /* 00001111 */
- 0x0f, /* 00001111 */
- 0x0f, /* 00001111 */
- 0x0f, /* 00001111 */
- 0x0f, /* 00001111 */
- 0x0f, /* 00001111 */
- 0x0f, /* 00001111 */
-
- /*
- * 223 0xdf 'ß'
- */
- 0xff, /* 11111111 */
- 0xff, /* 11111111 */
- 0xff, /* 11111111 */
- 0xff, /* 11111111 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
-
- /*
- * 224 0xe0 'à'
- */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x76, /* 01110110 */
- 0xdc, /* 11011100 */
- 0xc8, /* 11001000 */
- 0xdc, /* 11011100 */
- 0x76, /* 01110110 */
- 0x00, /* 00000000 */
-
- /*
- * 225 0xe1 'á'
- */
- 0x78, /* 01111000 */
- 0xcc, /* 11001100 */
- 0xcc, /* 11001100 */
- 0xd8, /* 11011000 */
- 0xcc, /* 11001100 */
- 0xc6, /* 11000110 */
- 0xcc, /* 11001100 */
- 0x00, /* 00000000 */
-
- /*
- * 226 0xe2 'â'
- */
- 0xfe, /* 11111110 */
- 0xc6, /* 11000110 */
- 0xc0, /* 11000000 */
- 0xc0, /* 11000000 */
- 0xc0, /* 11000000 */
- 0xc0, /* 11000000 */
- 0xc0, /* 11000000 */
- 0x00, /* 00000000 */
-
- /*
- * 227 0xe3 'ã'
- */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0xfe, /* 11111110 */
- 0x6c, /* 01101100 */
- 0x6c, /* 01101100 */
- 0x6c, /* 01101100 */
- 0x6c, /* 01101100 */
- 0x00, /* 00000000 */
-
- /*
- * 228 0xe4 'ä'
- */
- 0xfe, /* 11111110 */
- 0xc6, /* 11000110 */
- 0x60, /* 01100000 */
- 0x30, /* 00110000 */
- 0x60, /* 01100000 */
- 0xc6, /* 11000110 */
- 0xfe, /* 11111110 */
- 0x00, /* 00000000 */
-
- /*
- * 229 0xe5 'å'
- */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x7e, /* 01111110 */
- 0xd8, /* 11011000 */
- 0xd8, /* 11011000 */
- 0xd8, /* 11011000 */
- 0x70, /* 01110000 */
- 0x00, /* 00000000 */
-
- /*
- * 230 0xe6 'æ'
- */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x66, /* 01100110 */
- 0x66, /* 01100110 */
- 0x66, /* 01100110 */
- 0x66, /* 01100110 */
- 0x7c, /* 01111100 */
- 0xc0, /* 11000000 */
-
- /*
- * 231 0xe7 'ç'
- */
- 0x00, /* 00000000 */
- 0x76, /* 01110110 */
- 0xdc, /* 11011100 */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
- 0x00, /* 00000000 */
-
- /*
- * 232 0xe8 'è'
- */
- 0x7e, /* 01111110 */
- 0x18, /* 00011000 */
- 0x3c, /* 00111100 */
- 0x66, /* 01100110 */
- 0x66, /* 01100110 */
- 0x3c, /* 00111100 */
- 0x18, /* 00011000 */
- 0x7e, /* 01111110 */
-
- /*
- * 233 0xe9 'é'
- */
- 0x38, /* 00111000 */
- 0x6c, /* 01101100 */
- 0xc6, /* 11000110 */
- 0xfe, /* 11111110 */
- 0xc6, /* 11000110 */
- 0x6c, /* 01101100 */
- 0x38, /* 00111000 */
- 0x00, /* 00000000 */
-
- /*
- * 234 0xea 'ê'
- */
- 0x38, /* 00111000 */
- 0x6c, /* 01101100 */
- 0xc6, /* 11000110 */
- 0xc6, /* 11000110 */
- 0x6c, /* 01101100 */
- 0x6c, /* 01101100 */
- 0xee, /* 11101110 */
- 0x00, /* 00000000 */
-
- /*
- * 235 0xeb 'ë'
- */
- 0x0e, /* 00001110 */
- 0x18, /* 00011000 */
- 0x0c, /* 00001100 */
- 0x3e, /* 00111110 */
- 0x66, /* 01100110 */
- 0x66, /* 01100110 */
- 0x3c, /* 00111100 */
- 0x00, /* 00000000 */
-
- /*
- * 236 0xec 'ì'
- */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x7e, /* 01111110 */
- 0xdb, /* 11011011 */
- 0xdb, /* 11011011 */
- 0x7e, /* 01111110 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
-
- /*
- * 237 0xed 'í'
- */
- 0x06, /* 00000110 */
- 0x0c, /* 00001100 */
- 0x7e, /* 01111110 */
- 0xdb, /* 11011011 */
- 0xdb, /* 11011011 */
- 0x7e, /* 01111110 */
- 0x60, /* 01100000 */
- 0xc0, /* 11000000 */
-
- /*
- * 238 0xee 'î'
- */
- 0x1e, /* 00011110 */
- 0x30, /* 00110000 */
- 0x60, /* 01100000 */
- 0x7e, /* 01111110 */
- 0x60, /* 01100000 */
- 0x30, /* 00110000 */
- 0x1e, /* 00011110 */
- 0x00, /* 00000000 */
-
- /*
- * 239 0xef 'ï'
- */
- 0x00, /* 00000000 */
- 0x7c, /* 01111100 */
- 0xc6, /* 11000110 */
- 0xc6, /* 11000110 */
- 0xc6, /* 11000110 */
- 0xc6, /* 11000110 */
- 0xc6, /* 11000110 */
- 0x00, /* 00000000 */
-
- /*
- * 240 0xf0 'ð'
- */
- 0x00, /* 00000000 */
- 0xfe, /* 11111110 */
- 0x00, /* 00000000 */
- 0xfe, /* 11111110 */
- 0x00, /* 00000000 */
- 0xfe, /* 11111110 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
-
- /*
- * 241 0xf1 'ñ'
- */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
- 0x7e, /* 01111110 */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
- 0x00, /* 00000000 */
- 0x7e, /* 01111110 */
- 0x00, /* 00000000 */
-
- /*
- * 242 0xf2 'ò'
- */
- 0x30, /* 00110000 */
- 0x18, /* 00011000 */
- 0x0c, /* 00001100 */
- 0x18, /* 00011000 */
- 0x30, /* 00110000 */
- 0x00, /* 00000000 */
- 0x7e, /* 01111110 */
- 0x00, /* 00000000 */
-
- /*
- * 243 0xf3 'ó'
- */
- 0x0c, /* 00001100 */
- 0x18, /* 00011000 */
- 0x30, /* 00110000 */
- 0x18, /* 00011000 */
- 0x0c, /* 00001100 */
- 0x00, /* 00000000 */
- 0x7e, /* 01111110 */
- 0x00, /* 00000000 */
-
- /*
- * 244 0xf4 'ô'
- */
- 0x0e, /* 00001110 */
- 0x1b, /* 00011011 */
- 0x1b, /* 00011011 */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
-
- /*
- * 245 0xf5 'õ'
- */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
- 0xd8, /* 11011000 */
- 0xd8, /* 11011000 */
- 0x70, /* 01110000 */
-
- /*
- * 246 0xf6 'ö'
- */
- 0x00, /* 00000000 */
- 0x18, /* 00011000 */
- 0x00, /* 00000000 */
- 0x7e, /* 01111110 */
- 0x00, /* 00000000 */
- 0x18, /* 00011000 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
-
- /*
- * 247 0xf7 '÷'
- */
- 0x00, /* 00000000 */
- 0x76, /* 01110110 */
- 0xdc, /* 11011100 */
- 0x00, /* 00000000 */
- 0x76, /* 01110110 */
- 0xdc, /* 11011100 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
-
- /*
- * 248 0xf8 'ø'
- */
- 0x38, /* 00111000 */
- 0x6c, /* 01101100 */
- 0x6c, /* 01101100 */
- 0x38, /* 00111000 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
-
- /*
- * 249 0xf9 'ù'
- */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x18, /* 00011000 */
- 0x18, /* 00011000 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
-
- /*
- * 250 0xfa 'ú'
- */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x18, /* 00011000 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
-
- /*
- * 251 0xfb 'û'
- */
- 0x0f, /* 00001111 */
- 0x0c, /* 00001100 */
- 0x0c, /* 00001100 */
- 0x0c, /* 00001100 */
- 0xec, /* 11101100 */
- 0x6c, /* 01101100 */
- 0x3c, /* 00111100 */
- 0x1c, /* 00011100 */
-
- /*
- * 252 0xfc 'ü'
- */
- 0x6c, /* 01101100 */
- 0x36, /* 00110110 */
- 0x36, /* 00110110 */
- 0x36, /* 00110110 */
- 0x36, /* 00110110 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
-
- /*
- * 253 0xfd 'ý'
- */
- 0x78, /* 01111000 */
- 0x0c, /* 00001100 */
- 0x18, /* 00011000 */
- 0x30, /* 00110000 */
- 0x7c, /* 01111100 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
-
- /*
- * 254 0xfe 'þ'
- */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x3c, /* 00111100 */
- 0x3c, /* 00111100 */
- 0x3c, /* 00111100 */
- 0x3c, /* 00111100 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
-
- /*
- * 255 0xff ' '
- */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
+ /*
+ * 0 0x00 '^@'
+ */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 1 0x01 '^A'
+ */
+ 0x7e, /* 01111110 */
+ 0x81, /* 10000001 */
+ 0xa5, /* 10100101 */
+ 0x81, /* 10000001 */
+ 0xbd, /* 10111101 */
+ 0x99, /* 10011001 */
+ 0x81, /* 10000001 */
+ 0x7e, /* 01111110 */
+
+ /*
+ * 2 0x02 '^B'
+ */
+ 0x7e, /* 01111110 */
+ 0xff, /* 11111111 */
+ 0xdb, /* 11011011 */
+ 0xff, /* 11111111 */
+ 0xc3, /* 11000011 */
+ 0xe7, /* 11100111 */
+ 0xff, /* 11111111 */
+ 0x7e, /* 01111110 */
+
+ /*
+ * 3 0x03 '^C'
+ */
+ 0x6c, /* 01101100 */
+ 0xfe, /* 11111110 */
+ 0xfe, /* 11111110 */
+ 0xfe, /* 11111110 */
+ 0x7c, /* 01111100 */
+ 0x38, /* 00111000 */
+ 0x10, /* 00010000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 4 0x04 '^D'
+ */
+ 0x10, /* 00010000 */
+ 0x38, /* 00111000 */
+ 0x7c, /* 01111100 */
+ 0xfe, /* 11111110 */
+ 0x7c, /* 01111100 */
+ 0x38, /* 00111000 */
+ 0x10, /* 00010000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 5 0x05 '^E'
+ */
+ 0x38, /* 00111000 */
+ 0x7c, /* 01111100 */
+ 0x38, /* 00111000 */
+ 0xfe, /* 11111110 */
+ 0xfe, /* 11111110 */
+ 0xd6, /* 11010110 */
+ 0x10, /* 00010000 */
+ 0x38, /* 00111000 */
+
+ /*
+ * 6 0x06 '^F'
+ */
+ 0x10, /* 00010000 */
+ 0x38, /* 00111000 */
+ 0x7c, /* 01111100 */
+ 0xfe, /* 11111110 */
+ 0xfe, /* 11111110 */
+ 0x7c, /* 01111100 */
+ 0x10, /* 00010000 */
+ 0x38, /* 00111000 */
+
+ /*
+ * 7 0x07 '^G'
+ */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x18, /* 00011000 */
+ 0x3c, /* 00111100 */
+ 0x3c, /* 00111100 */
+ 0x18, /* 00011000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 8 0x08 '^H'
+ */
+ 0xff, /* 11111111 */
+ 0xff, /* 11111111 */
+ 0xe7, /* 11100111 */
+ 0xc3, /* 11000011 */
+ 0xc3, /* 11000011 */
+ 0xe7, /* 11100111 */
+ 0xff, /* 11111111 */
+ 0xff, /* 11111111 */
+
+ /*
+ * 9 0x09 '^I'
+ */
+ 0x00, /* 00000000 */
+ 0x3c, /* 00111100 */
+ 0x66, /* 01100110 */
+ 0x42, /* 01000010 */
+ 0x42, /* 01000010 */
+ 0x66, /* 01100110 */
+ 0x3c, /* 00111100 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 10 0x0a '^J'
+ */
+ 0xff, /* 11111111 */
+ 0xc3, /* 11000011 */
+ 0x99, /* 10011001 */
+ 0xbd, /* 10111101 */
+ 0xbd, /* 10111101 */
+ 0x99, /* 10011001 */
+ 0xc3, /* 11000011 */
+ 0xff, /* 11111111 */
+
+ /*
+ * 11 0x0b '^K'
+ */
+ 0x0f, /* 00001111 */
+ 0x07, /* 00000111 */
+ 0x0f, /* 00001111 */
+ 0x7d, /* 01111101 */
+ 0xcc, /* 11001100 */
+ 0xcc, /* 11001100 */
+ 0xcc, /* 11001100 */
+ 0x78, /* 01111000 */
+
+ /*
+ * 12 0x0c '^L'
+ */
+ 0x3c, /* 00111100 */
+ 0x66, /* 01100110 */
+ 0x66, /* 01100110 */
+ 0x66, /* 01100110 */
+ 0x3c, /* 00111100 */
+ 0x18, /* 00011000 */
+ 0x7e, /* 01111110 */
+ 0x18, /* 00011000 */
+
+ /*
+ * 13 0x0d '^M'
+ */
+ 0x3f, /* 00111111 */
+ 0x33, /* 00110011 */
+ 0x3f, /* 00111111 */
+ 0x30, /* 00110000 */
+ 0x30, /* 00110000 */
+ 0x70, /* 01110000 */
+ 0xf0, /* 11110000 */
+ 0xe0, /* 11100000 */
+
+ /*
+ * 14 0x0e '^N'
+ */
+ 0x7f, /* 01111111 */
+ 0x63, /* 01100011 */
+ 0x7f, /* 01111111 */
+ 0x63, /* 01100011 */
+ 0x63, /* 01100011 */
+ 0x67, /* 01100111 */
+ 0xe6, /* 11100110 */
+ 0xc0, /* 11000000 */
+
+ /*
+ * 15 0x0f '^O'
+ */
+ 0x18, /* 00011000 */
+ 0xdb, /* 11011011 */
+ 0x3c, /* 00111100 */
+ 0xe7, /* 11100111 */
+ 0xe7, /* 11100111 */
+ 0x3c, /* 00111100 */
+ 0xdb, /* 11011011 */
+ 0x18, /* 00011000 */
+
+ /*
+ * 16 0x10 '^P'
+ */
+ 0x80, /* 10000000 */
+ 0xe0, /* 11100000 */
+ 0xf8, /* 11111000 */
+ 0xfe, /* 11111110 */
+ 0xf8, /* 11111000 */
+ 0xe0, /* 11100000 */
+ 0x80, /* 10000000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 17 0x11 '^Q'
+ */
+ 0x02, /* 00000010 */
+ 0x0e, /* 00001110 */
+ 0x3e, /* 00111110 */
+ 0xfe, /* 11111110 */
+ 0x3e, /* 00111110 */
+ 0x0e, /* 00001110 */
+ 0x02, /* 00000010 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 18 0x12 '^R'
+ */
+ 0x18, /* 00011000 */
+ 0x3c, /* 00111100 */
+ 0x7e, /* 01111110 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x7e, /* 01111110 */
+ 0x3c, /* 00111100 */
+ 0x18, /* 00011000 */
+
+ /*
+ * 19 0x13 '^S'
+ */
+ 0x66, /* 01100110 */
+ 0x66, /* 01100110 */
+ 0x66, /* 01100110 */
+ 0x66, /* 01100110 */
+ 0x66, /* 01100110 */
+ 0x00, /* 00000000 */
+ 0x66, /* 01100110 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 20 0x14 '^T'
+ */
+ 0x7f, /* 01111111 */
+ 0xdb, /* 11011011 */
+ 0xdb, /* 11011011 */
+ 0x7b, /* 01111011 */
+ 0x1b, /* 00011011 */
+ 0x1b, /* 00011011 */
+ 0x1b, /* 00011011 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 21 0x15 '^U'
+ */
+ 0x3e, /* 00111110 */
+ 0x61, /* 01100001 */
+ 0x3c, /* 00111100 */
+ 0x66, /* 01100110 */
+ 0x66, /* 01100110 */
+ 0x3c, /* 00111100 */
+ 0x86, /* 10000110 */
+ 0x7c, /* 01111100 */
+
+ /*
+ * 22 0x16 '^V'
+ */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x7e, /* 01111110 */
+ 0x7e, /* 01111110 */
+ 0x7e, /* 01111110 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 23 0x17 '^W'
+ */
+ 0x18, /* 00011000 */
+ 0x3c, /* 00111100 */
+ 0x7e, /* 01111110 */
+ 0x18, /* 00011000 */
+ 0x7e, /* 01111110 */
+ 0x3c, /* 00111100 */
+ 0x18, /* 00011000 */
+ 0xff, /* 11111111 */
+
+ /*
+ * 24 0x18 '^X'
+ */
+ 0x18, /* 00011000 */
+ 0x3c, /* 00111100 */
+ 0x7e, /* 01111110 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 25 0x19 '^Y'
+ */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x7e, /* 01111110 */
+ 0x3c, /* 00111100 */
+ 0x18, /* 00011000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 26 0x1a '^Z'
+ */
+ 0x00, /* 00000000 */
+ 0x18, /* 00011000 */
+ 0x0c, /* 00001100 */
+ 0xfe, /* 11111110 */
+ 0x0c, /* 00001100 */
+ 0x18, /* 00011000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 27 0x1b '^['
+ */
+ 0x00, /* 00000000 */
+ 0x30, /* 00110000 */
+ 0x60, /* 01100000 */
+ 0xfe, /* 11111110 */
+ 0x60, /* 01100000 */
+ 0x30, /* 00110000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 28 0x1c '^\'
+ */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0xc0, /* 11000000 */
+ 0xc0, /* 11000000 */
+ 0xc0, /* 11000000 */
+ 0xfe, /* 11111110 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 29 0x1d '^]'
+ */
+ 0x00, /* 00000000 */
+ 0x24, /* 00100100 */
+ 0x66, /* 01100110 */
+ 0xff, /* 11111111 */
+ 0x66, /* 01100110 */
+ 0x24, /* 00100100 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 30 0x1e '^^'
+ */
+ 0x00, /* 00000000 */
+ 0x18, /* 00011000 */
+ 0x3c, /* 00111100 */
+ 0x7e, /* 01111110 */
+ 0xff, /* 11111111 */
+ 0xff, /* 11111111 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 31 0x1f '^_'
+ */
+ 0x00, /* 00000000 */
+ 0xff, /* 11111111 */
+ 0xff, /* 11111111 */
+ 0x7e, /* 01111110 */
+ 0x3c, /* 00111100 */
+ 0x18, /* 00011000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 32 0x20 ' '
+ */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 33 0x21 '!'
+ */
+ 0x18, /* 00011000 */
+ 0x3c, /* 00111100 */
+ 0x3c, /* 00111100 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x00, /* 00000000 */
+ 0x18, /* 00011000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 34 0x22 '"'
+ */
+ 0x66, /* 01100110 */
+ 0x66, /* 01100110 */
+ 0x24, /* 00100100 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 35 0x23 '#'
+ */
+ 0x6c, /* 01101100 */
+ 0x6c, /* 01101100 */
+ 0xfe, /* 11111110 */
+ 0x6c, /* 01101100 */
+ 0xfe, /* 11111110 */
+ 0x6c, /* 01101100 */
+ 0x6c, /* 01101100 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 36 0x24 '$'
+ */
+ 0x18, /* 00011000 */
+ 0x3e, /* 00111110 */
+ 0x60, /* 01100000 */
+ 0x3c, /* 00111100 */
+ 0x06, /* 00000110 */
+ 0x7c, /* 01111100 */
+ 0x18, /* 00011000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 37 0x25 '%'
+ */
+ 0x00, /* 00000000 */
+ 0xc6, /* 11000110 */
+ 0xcc, /* 11001100 */
+ 0x18, /* 00011000 */
+ 0x30, /* 00110000 */
+ 0x66, /* 01100110 */
+ 0xc6, /* 11000110 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 38 0x26 '&'
+ */
+ 0x38, /* 00111000 */
+ 0x6c, /* 01101100 */
+ 0x38, /* 00111000 */
+ 0x76, /* 01110110 */
+ 0xdc, /* 11011100 */
+ 0xcc, /* 11001100 */
+ 0x76, /* 01110110 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 39 0x27 '''
+ */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x30, /* 00110000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 40 0x28 '('
+ */
+ 0x0c, /* 00001100 */
+ 0x18, /* 00011000 */
+ 0x30, /* 00110000 */
+ 0x30, /* 00110000 */
+ 0x30, /* 00110000 */
+ 0x18, /* 00011000 */
+ 0x0c, /* 00001100 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 41 0x29 ')'
+ */
+ 0x30, /* 00110000 */
+ 0x18, /* 00011000 */
+ 0x0c, /* 00001100 */
+ 0x0c, /* 00001100 */
+ 0x0c, /* 00001100 */
+ 0x18, /* 00011000 */
+ 0x30, /* 00110000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 42 0x2a '*'
+ */
+ 0x00, /* 00000000 */
+ 0x66, /* 01100110 */
+ 0x3c, /* 00111100 */
+ 0xff, /* 11111111 */
+ 0x3c, /* 00111100 */
+ 0x66, /* 01100110 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 43 0x2b '+'
+ */
+ 0x00, /* 00000000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x7e, /* 01111110 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 44 0x2c ','
+ */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x30, /* 00110000 */
+
+ /*
+ * 45 0x2d '-'
+ */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x7e, /* 01111110 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 46 0x2e '.'
+ */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 47 0x2f '/'
+ */
+ 0x06, /* 00000110 */
+ 0x0c, /* 00001100 */
+ 0x18, /* 00011000 */
+ 0x30, /* 00110000 */
+ 0x60, /* 01100000 */
+ 0xc0, /* 11000000 */
+ 0x80, /* 10000000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 48 0x30 '0'
+ */
+ 0x38, /* 00111000 */
+ 0x6c, /* 01101100 */
+ 0xc6, /* 11000110 */
+ 0xd6, /* 11010110 */
+ 0xc6, /* 11000110 */
+ 0x6c, /* 01101100 */
+ 0x38, /* 00111000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 49 0x31 '1'
+ */
+ 0x18, /* 00011000 */
+ 0x38, /* 00111000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x7e, /* 01111110 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 50 0x32 '2'
+ */
+ 0x7c, /* 01111100 */
+ 0xc6, /* 11000110 */
+ 0x06, /* 00000110 */
+ 0x1c, /* 00011100 */
+ 0x30, /* 00110000 */
+ 0x66, /* 01100110 */
+ 0xfe, /* 11111110 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 51 0x33 '3'
+ */
+ 0x7c, /* 01111100 */
+ 0xc6, /* 11000110 */
+ 0x06, /* 00000110 */
+ 0x3c, /* 00111100 */
+ 0x06, /* 00000110 */
+ 0xc6, /* 11000110 */
+ 0x7c, /* 01111100 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 52 0x34 '4'
+ */
+ 0x1c, /* 00011100 */
+ 0x3c, /* 00111100 */
+ 0x6c, /* 01101100 */
+ 0xcc, /* 11001100 */
+ 0xfe, /* 11111110 */
+ 0x0c, /* 00001100 */
+ 0x1e, /* 00011110 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 53 0x35 '5'
+ */
+ 0xfe, /* 11111110 */
+ 0xc0, /* 11000000 */
+ 0xc0, /* 11000000 */
+ 0xfc, /* 11111100 */
+ 0x06, /* 00000110 */
+ 0xc6, /* 11000110 */
+ 0x7c, /* 01111100 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 54 0x36 '6'
+ */
+ 0x38, /* 00111000 */
+ 0x60, /* 01100000 */
+ 0xc0, /* 11000000 */
+ 0xfc, /* 11111100 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0x7c, /* 01111100 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 55 0x37 '7'
+ */
+ 0xfe, /* 11111110 */
+ 0xc6, /* 11000110 */
+ 0x0c, /* 00001100 */
+ 0x18, /* 00011000 */
+ 0x30, /* 00110000 */
+ 0x30, /* 00110000 */
+ 0x30, /* 00110000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 56 0x38 '8'
+ */
+ 0x7c, /* 01111100 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0x7c, /* 01111100 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0x7c, /* 01111100 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 57 0x39 '9'
+ */
+ 0x7c, /* 01111100 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0x7e, /* 01111110 */
+ 0x06, /* 00000110 */
+ 0x0c, /* 00001100 */
+ 0x78, /* 01111000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 58 0x3a ':'
+ */
+ 0x00, /* 00000000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 59 0x3b ';'
+ */
+ 0x00, /* 00000000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x30, /* 00110000 */
+
+ /*
+ * 60 0x3c '<'
+ */
+ 0x06, /* 00000110 */
+ 0x0c, /* 00001100 */
+ 0x18, /* 00011000 */
+ 0x30, /* 00110000 */
+ 0x18, /* 00011000 */
+ 0x0c, /* 00001100 */
+ 0x06, /* 00000110 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 61 0x3d '='
+ */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x7e, /* 01111110 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x7e, /* 01111110 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 62 0x3e '>'
+ */
+ 0x60, /* 01100000 */
+ 0x30, /* 00110000 */
+ 0x18, /* 00011000 */
+ 0x0c, /* 00001100 */
+ 0x18, /* 00011000 */
+ 0x30, /* 00110000 */
+ 0x60, /* 01100000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 63 0x3f '?'
+ */
+ 0x7c, /* 01111100 */
+ 0xc6, /* 11000110 */
+ 0x0c, /* 00001100 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x00, /* 00000000 */
+ 0x18, /* 00011000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 64 0x40 '@'
+ */
+ 0x7c, /* 01111100 */
+ 0xc6, /* 11000110 */
+ 0xde, /* 11011110 */
+ 0xde, /* 11011110 */
+ 0xde, /* 11011110 */
+ 0xc0, /* 11000000 */
+ 0x78, /* 01111000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 65 0x41 'A'
+ */
+ 0x38, /* 00111000 */
+ 0x6c, /* 01101100 */
+ 0xc6, /* 11000110 */
+ 0xfe, /* 11111110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 66 0x42 'B'
+ */
+ 0xfc, /* 11111100 */
+ 0x66, /* 01100110 */
+ 0x66, /* 01100110 */
+ 0x7c, /* 01111100 */
+ 0x66, /* 01100110 */
+ 0x66, /* 01100110 */
+ 0xfc, /* 11111100 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 67 0x43 'C'
+ */
+ 0x3c, /* 00111100 */
+ 0x66, /* 01100110 */
+ 0xc0, /* 11000000 */
+ 0xc0, /* 11000000 */
+ 0xc0, /* 11000000 */
+ 0x66, /* 01100110 */
+ 0x3c, /* 00111100 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 68 0x44 'D'
+ */
+ 0xf8, /* 11111000 */
+ 0x6c, /* 01101100 */
+ 0x66, /* 01100110 */
+ 0x66, /* 01100110 */
+ 0x66, /* 01100110 */
+ 0x6c, /* 01101100 */
+ 0xf8, /* 11111000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 69 0x45 'E'
+ */
+ 0xfe, /* 11111110 */
+ 0x62, /* 01100010 */
+ 0x68, /* 01101000 */
+ 0x78, /* 01111000 */
+ 0x68, /* 01101000 */
+ 0x62, /* 01100010 */
+ 0xfe, /* 11111110 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 70 0x46 'F'
+ */
+ 0xfe, /* 11111110 */
+ 0x62, /* 01100010 */
+ 0x68, /* 01101000 */
+ 0x78, /* 01111000 */
+ 0x68, /* 01101000 */
+ 0x60, /* 01100000 */
+ 0xf0, /* 11110000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 71 0x47 'G'
+ */
+ 0x3c, /* 00111100 */
+ 0x66, /* 01100110 */
+ 0xc0, /* 11000000 */
+ 0xc0, /* 11000000 */
+ 0xce, /* 11001110 */
+ 0x66, /* 01100110 */
+ 0x3a, /* 00111010 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 72 0x48 'H'
+ */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xfe, /* 11111110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 73 0x49 'I'
+ */
+ 0x3c, /* 00111100 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x3c, /* 00111100 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 74 0x4a 'J'
+ */
+ 0x1e, /* 00011110 */
+ 0x0c, /* 00001100 */
+ 0x0c, /* 00001100 */
+ 0x0c, /* 00001100 */
+ 0xcc, /* 11001100 */
+ 0xcc, /* 11001100 */
+ 0x78, /* 01111000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 75 0x4b 'K'
+ */
+ 0xe6, /* 11100110 */
+ 0x66, /* 01100110 */
+ 0x6c, /* 01101100 */
+ 0x78, /* 01111000 */
+ 0x6c, /* 01101100 */
+ 0x66, /* 01100110 */
+ 0xe6, /* 11100110 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 76 0x4c 'L'
+ */
+ 0xf0, /* 11110000 */
+ 0x60, /* 01100000 */
+ 0x60, /* 01100000 */
+ 0x60, /* 01100000 */
+ 0x62, /* 01100010 */
+ 0x66, /* 01100110 */
+ 0xfe, /* 11111110 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 77 0x4d 'M'
+ */
+ 0xc6, /* 11000110 */
+ 0xee, /* 11101110 */
+ 0xfe, /* 11111110 */
+ 0xfe, /* 11111110 */
+ 0xd6, /* 11010110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 78 0x4e 'N'
+ */
+ 0xc6, /* 11000110 */
+ 0xe6, /* 11100110 */
+ 0xf6, /* 11110110 */
+ 0xde, /* 11011110 */
+ 0xce, /* 11001110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 79 0x4f 'O'
+ */
+ 0x7c, /* 01111100 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0x7c, /* 01111100 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 80 0x50 'P'
+ */
+ 0xfc, /* 11111100 */
+ 0x66, /* 01100110 */
+ 0x66, /* 01100110 */
+ 0x7c, /* 01111100 */
+ 0x60, /* 01100000 */
+ 0x60, /* 01100000 */
+ 0xf0, /* 11110000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 81 0x51 'Q'
+ */
+ 0x7c, /* 01111100 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xce, /* 11001110 */
+ 0x7c, /* 01111100 */
+ 0x0e, /* 00001110 */
+
+ /*
+ * 82 0x52 'R'
+ */
+ 0xfc, /* 11111100 */
+ 0x66, /* 01100110 */
+ 0x66, /* 01100110 */
+ 0x7c, /* 01111100 */
+ 0x6c, /* 01101100 */
+ 0x66, /* 01100110 */
+ 0xe6, /* 11100110 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 83 0x53 'S'
+ */
+ 0x3c, /* 00111100 */
+ 0x66, /* 01100110 */
+ 0x30, /* 00110000 */
+ 0x18, /* 00011000 */
+ 0x0c, /* 00001100 */
+ 0x66, /* 01100110 */
+ 0x3c, /* 00111100 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 84 0x54 'T'
+ */
+ 0x7e, /* 01111110 */
+ 0x7e, /* 01111110 */
+ 0x5a, /* 01011010 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x3c, /* 00111100 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 85 0x55 'U'
+ */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0x7c, /* 01111100 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 86 0x56 'V'
+ */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0x6c, /* 01101100 */
+ 0x38, /* 00111000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 87 0x57 'W'
+ */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xd6, /* 11010110 */
+ 0xd6, /* 11010110 */
+ 0xfe, /* 11111110 */
+ 0x6c, /* 01101100 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 88 0x58 'X'
+ */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0x6c, /* 01101100 */
+ 0x38, /* 00111000 */
+ 0x6c, /* 01101100 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 89 0x59 'Y'
+ */
+ 0x66, /* 01100110 */
+ 0x66, /* 01100110 */
+ 0x66, /* 01100110 */
+ 0x3c, /* 00111100 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x3c, /* 00111100 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 90 0x5a 'Z'
+ */
+ 0xfe, /* 11111110 */
+ 0xc6, /* 11000110 */
+ 0x8c, /* 10001100 */
+ 0x18, /* 00011000 */
+ 0x32, /* 00110010 */
+ 0x66, /* 01100110 */
+ 0xfe, /* 11111110 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 91 0x5b '['
+ */
+ 0x3c, /* 00111100 */
+ 0x30, /* 00110000 */
+ 0x30, /* 00110000 */
+ 0x30, /* 00110000 */
+ 0x30, /* 00110000 */
+ 0x30, /* 00110000 */
+ 0x3c, /* 00111100 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 92 0x5c '\'
+ */
+ 0xc0, /* 11000000 */
+ 0x60, /* 01100000 */
+ 0x30, /* 00110000 */
+ 0x18, /* 00011000 */
+ 0x0c, /* 00001100 */
+ 0x06, /* 00000110 */
+ 0x02, /* 00000010 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 93 0x5d ']'
+ */
+ 0x3c, /* 00111100 */
+ 0x0c, /* 00001100 */
+ 0x0c, /* 00001100 */
+ 0x0c, /* 00001100 */
+ 0x0c, /* 00001100 */
+ 0x0c, /* 00001100 */
+ 0x3c, /* 00111100 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 94 0x5e '^'
+ */
+ 0x10, /* 00010000 */
+ 0x38, /* 00111000 */
+ 0x6c, /* 01101100 */
+ 0xc6, /* 11000110 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 95 0x5f '_'
+ */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0xff, /* 11111111 */
+
+ /*
+ * 96 0x60 '`'
+ */
+ 0x30, /* 00110000 */
+ 0x18, /* 00011000 */
+ 0x0c, /* 00001100 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 97 0x61 'a'
+ */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x78, /* 01111000 */
+ 0x0c, /* 00001100 */
+ 0x7c, /* 01111100 */
+ 0xcc, /* 11001100 */
+ 0x76, /* 01110110 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 98 0x62 'b'
+ */
+ 0xe0, /* 11100000 */
+ 0x60, /* 01100000 */
+ 0x7c, /* 01111100 */
+ 0x66, /* 01100110 */
+ 0x66, /* 01100110 */
+ 0x66, /* 01100110 */
+ 0xdc, /* 11011100 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 99 0x63 'c'
+ */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x7c, /* 01111100 */
+ 0xc6, /* 11000110 */
+ 0xc0, /* 11000000 */
+ 0xc6, /* 11000110 */
+ 0x7c, /* 01111100 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 100 0x64 'd'
+ */
+ 0x1c, /* 00011100 */
+ 0x0c, /* 00001100 */
+ 0x7c, /* 01111100 */
+ 0xcc, /* 11001100 */
+ 0xcc, /* 11001100 */
+ 0xcc, /* 11001100 */
+ 0x76, /* 01110110 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 101 0x65 'e'
+ */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x7c, /* 01111100 */
+ 0xc6, /* 11000110 */
+ 0xfe, /* 11111110 */
+ 0xc0, /* 11000000 */
+ 0x7c, /* 01111100 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 102 0x66 'f'
+ */
+ 0x3c, /* 00111100 */
+ 0x66, /* 01100110 */
+ 0x60, /* 01100000 */
+ 0xf8, /* 11111000 */
+ 0x60, /* 01100000 */
+ 0x60, /* 01100000 */
+ 0xf0, /* 11110000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 103 0x67 'g'
+ */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x76, /* 01110110 */
+ 0xcc, /* 11001100 */
+ 0xcc, /* 11001100 */
+ 0x7c, /* 01111100 */
+ 0x0c, /* 00001100 */
+ 0xf8, /* 11111000 */
+
+ /*
+ * 104 0x68 'h'
+ */
+ 0xe0, /* 11100000 */
+ 0x60, /* 01100000 */
+ 0x6c, /* 01101100 */
+ 0x76, /* 01110110 */
+ 0x66, /* 01100110 */
+ 0x66, /* 01100110 */
+ 0xe6, /* 11100110 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 105 0x69 'i'
+ */
+ 0x18, /* 00011000 */
+ 0x00, /* 00000000 */
+ 0x38, /* 00111000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x3c, /* 00111100 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 106 0x6a 'j'
+ */
+ 0x06, /* 00000110 */
+ 0x00, /* 00000000 */
+ 0x06, /* 00000110 */
+ 0x06, /* 00000110 */
+ 0x06, /* 00000110 */
+ 0x66, /* 01100110 */
+ 0x66, /* 01100110 */
+ 0x3c, /* 00111100 */
+
+ /*
+ * 107 0x6b 'k'
+ */
+ 0xe0, /* 11100000 */
+ 0x60, /* 01100000 */
+ 0x66, /* 01100110 */
+ 0x6c, /* 01101100 */
+ 0x78, /* 01111000 */
+ 0x6c, /* 01101100 */
+ 0xe6, /* 11100110 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 108 0x6c 'l'
+ */
+ 0x38, /* 00111000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x3c, /* 00111100 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 109 0x6d 'm'
+ */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0xec, /* 11101100 */
+ 0xfe, /* 11111110 */
+ 0xd6, /* 11010110 */
+ 0xd6, /* 11010110 */
+ 0xd6, /* 11010110 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 110 0x6e 'n'
+ */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0xdc, /* 11011100 */
+ 0x66, /* 01100110 */
+ 0x66, /* 01100110 */
+ 0x66, /* 01100110 */
+ 0x66, /* 01100110 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 111 0x6f 'o'
+ */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x7c, /* 01111100 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0x7c, /* 01111100 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 112 0x70 'p'
+ */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0xdc, /* 11011100 */
+ 0x66, /* 01100110 */
+ 0x66, /* 01100110 */
+ 0x7c, /* 01111100 */
+ 0x60, /* 01100000 */
+ 0xf0, /* 11110000 */
+
+ /*
+ * 113 0x71 'q'
+ */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x76, /* 01110110 */
+ 0xcc, /* 11001100 */
+ 0xcc, /* 11001100 */
+ 0x7c, /* 01111100 */
+ 0x0c, /* 00001100 */
+ 0x1e, /* 00011110 */
+
+ /*
+ * 114 0x72 'r'
+ */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0xdc, /* 11011100 */
+ 0x76, /* 01110110 */
+ 0x60, /* 01100000 */
+ 0x60, /* 01100000 */
+ 0xf0, /* 11110000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 115 0x73 's'
+ */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x7e, /* 01111110 */
+ 0xc0, /* 11000000 */
+ 0x7c, /* 01111100 */
+ 0x06, /* 00000110 */
+ 0xfc, /* 11111100 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 116 0x74 't'
+ */
+ 0x30, /* 00110000 */
+ 0x30, /* 00110000 */
+ 0xfc, /* 11111100 */
+ 0x30, /* 00110000 */
+ 0x30, /* 00110000 */
+ 0x36, /* 00110110 */
+ 0x1c, /* 00011100 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 117 0x75 'u'
+ */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0xcc, /* 11001100 */
+ 0xcc, /* 11001100 */
+ 0xcc, /* 11001100 */
+ 0xcc, /* 11001100 */
+ 0x76, /* 01110110 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 118 0x76 'v'
+ */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0x6c, /* 01101100 */
+ 0x38, /* 00111000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 119 0x77 'w'
+ */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0xc6, /* 11000110 */
+ 0xd6, /* 11010110 */
+ 0xd6, /* 11010110 */
+ 0xfe, /* 11111110 */
+ 0x6c, /* 01101100 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 120 0x78 'x'
+ */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0xc6, /* 11000110 */
+ 0x6c, /* 01101100 */
+ 0x38, /* 00111000 */
+ 0x6c, /* 01101100 */
+ 0xc6, /* 11000110 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 121 0x79 'y'
+ */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0x7e, /* 01111110 */
+ 0x06, /* 00000110 */
+ 0xfc, /* 11111100 */
+
+ /*
+ * 122 0x7a 'z'
+ */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x7e, /* 01111110 */
+ 0x4c, /* 01001100 */
+ 0x18, /* 00011000 */
+ 0x32, /* 00110010 */
+ 0x7e, /* 01111110 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 123 0x7b '{'
+ */
+ 0x0e, /* 00001110 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x70, /* 01110000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x0e, /* 00001110 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 124 0x7c '|'
+ */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 125 0x7d '}'
+ */
+ 0x70, /* 01110000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x0e, /* 00001110 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x70, /* 01110000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 126 0x7e '~'
+ */
+ 0x76, /* 01110110 */
+ 0xdc, /* 11011100 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 127 0x7f ''
+ */
+ 0x00, /* 00000000 */
+ 0x10, /* 00010000 */
+ 0x38, /* 00111000 */
+ 0x6c, /* 01101100 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xfe, /* 11111110 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 128 0x80 '€'
+ */
+ 0x7c, /* 01111100 */
+ 0xc6, /* 11000110 */
+ 0xc0, /* 11000000 */
+ 0xc0, /* 11000000 */
+ 0xc6, /* 11000110 */
+ 0x7c, /* 01111100 */
+ 0x0c, /* 00001100 */
+ 0x78, /* 01111000 */
+
+ /*
+ * 129 0x81 ''
+ */
+ 0xcc, /* 11001100 */
+ 0x00, /* 00000000 */
+ 0xcc, /* 11001100 */
+ 0xcc, /* 11001100 */
+ 0xcc, /* 11001100 */
+ 0xcc, /* 11001100 */
+ 0x76, /* 01110110 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 130 0x82 '‚'
+ */
+ 0x0c, /* 00001100 */
+ 0x18, /* 00011000 */
+ 0x7c, /* 01111100 */
+ 0xc6, /* 11000110 */
+ 0xfe, /* 11111110 */
+ 0xc0, /* 11000000 */
+ 0x7c, /* 01111100 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 131 0x83 'ƒ'
+ */
+ 0x7c, /* 01111100 */
+ 0x82, /* 10000010 */
+ 0x78, /* 01111000 */
+ 0x0c, /* 00001100 */
+ 0x7c, /* 01111100 */
+ 0xcc, /* 11001100 */
+ 0x76, /* 01110110 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 132 0x84 '„'
+ */
+ 0xc6, /* 11000110 */
+ 0x00, /* 00000000 */
+ 0x78, /* 01111000 */
+ 0x0c, /* 00001100 */
+ 0x7c, /* 01111100 */
+ 0xcc, /* 11001100 */
+ 0x76, /* 01110110 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 133 0x85 '…'
+ */
+ 0x30, /* 00110000 */
+ 0x18, /* 00011000 */
+ 0x78, /* 01111000 */
+ 0x0c, /* 00001100 */
+ 0x7c, /* 01111100 */
+ 0xcc, /* 11001100 */
+ 0x76, /* 01110110 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 134 0x86 '†'
+ */
+ 0x30, /* 00110000 */
+ 0x30, /* 00110000 */
+ 0x78, /* 01111000 */
+ 0x0c, /* 00001100 */
+ 0x7c, /* 01111100 */
+ 0xcc, /* 11001100 */
+ 0x76, /* 01110110 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 135 0x87 '‡'
+ */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x7e, /* 01111110 */
+ 0xc0, /* 11000000 */
+ 0xc0, /* 11000000 */
+ 0x7e, /* 01111110 */
+ 0x0c, /* 00001100 */
+ 0x38, /* 00111000 */
+
+ /*
+ * 136 0x88 'ˆ'
+ */
+ 0x7c, /* 01111100 */
+ 0x82, /* 10000010 */
+ 0x7c, /* 01111100 */
+ 0xc6, /* 11000110 */
+ 0xfe, /* 11111110 */
+ 0xc0, /* 11000000 */
+ 0x7c, /* 01111100 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 137 0x89 '‰'
+ */
+ 0xc6, /* 11000110 */
+ 0x00, /* 00000000 */
+ 0x7c, /* 01111100 */
+ 0xc6, /* 11000110 */
+ 0xfe, /* 11111110 */
+ 0xc0, /* 11000000 */
+ 0x7c, /* 01111100 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 138 0x8a 'Š'
+ */
+ 0x30, /* 00110000 */
+ 0x18, /* 00011000 */
+ 0x7c, /* 01111100 */
+ 0xc6, /* 11000110 */
+ 0xfe, /* 11111110 */
+ 0xc0, /* 11000000 */
+ 0x7c, /* 01111100 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 139 0x8b '‹'
+ */
+ 0x66, /* 01100110 */
+ 0x00, /* 00000000 */
+ 0x38, /* 00111000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x3c, /* 00111100 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 140 0x8c 'Œ'
+ */
+ 0x7c, /* 01111100 */
+ 0x82, /* 10000010 */
+ 0x38, /* 00111000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x3c, /* 00111100 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 141 0x8d ''
+ */
+ 0x30, /* 00110000 */
+ 0x18, /* 00011000 */
+ 0x00, /* 00000000 */
+ 0x38, /* 00111000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x3c, /* 00111100 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 142 0x8e 'Ž'
+ */
+ 0xc6, /* 11000110 */
+ 0x38, /* 00111000 */
+ 0x6c, /* 01101100 */
+ 0xc6, /* 11000110 */
+ 0xfe, /* 11111110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 143 0x8f ''
+ */
+ 0x38, /* 00111000 */
+ 0x6c, /* 01101100 */
+ 0x7c, /* 01111100 */
+ 0xc6, /* 11000110 */
+ 0xfe, /* 11111110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 144 0x90 ''
+ */
+ 0x18, /* 00011000 */
+ 0x30, /* 00110000 */
+ 0xfe, /* 11111110 */
+ 0xc0, /* 11000000 */
+ 0xf8, /* 11111000 */
+ 0xc0, /* 11000000 */
+ 0xfe, /* 11111110 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 145 0x91 '‘'
+ */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x7e, /* 01111110 */
+ 0x18, /* 00011000 */
+ 0x7e, /* 01111110 */
+ 0xd8, /* 11011000 */
+ 0x7e, /* 01111110 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 146 0x92 '’'
+ */
+ 0x3e, /* 00111110 */
+ 0x6c, /* 01101100 */
+ 0xcc, /* 11001100 */
+ 0xfe, /* 11111110 */
+ 0xcc, /* 11001100 */
+ 0xcc, /* 11001100 */
+ 0xce, /* 11001110 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 147 0x93 '“'
+ */
+ 0x7c, /* 01111100 */
+ 0x82, /* 10000010 */
+ 0x7c, /* 01111100 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0x7c, /* 01111100 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 148 0x94 '”'
+ */
+ 0xc6, /* 11000110 */
+ 0x00, /* 00000000 */
+ 0x7c, /* 01111100 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0x7c, /* 01111100 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 149 0x95 '•'
+ */
+ 0x30, /* 00110000 */
+ 0x18, /* 00011000 */
+ 0x7c, /* 01111100 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0x7c, /* 01111100 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 150 0x96 '–'
+ */
+ 0x78, /* 01111000 */
+ 0x84, /* 10000100 */
+ 0x00, /* 00000000 */
+ 0xcc, /* 11001100 */
+ 0xcc, /* 11001100 */
+ 0xcc, /* 11001100 */
+ 0x76, /* 01110110 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 151 0x97 '—'
+ */
+ 0x60, /* 01100000 */
+ 0x30, /* 00110000 */
+ 0xcc, /* 11001100 */
+ 0xcc, /* 11001100 */
+ 0xcc, /* 11001100 */
+ 0xcc, /* 11001100 */
+ 0x76, /* 01110110 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 152 0x98 '˜'
+ */
+ 0xc6, /* 11000110 */
+ 0x00, /* 00000000 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0x7e, /* 01111110 */
+ 0x06, /* 00000110 */
+ 0xfc, /* 11111100 */
+
+ /*
+ * 153 0x99 '™'
+ */
+ 0xc6, /* 11000110 */
+ 0x38, /* 00111000 */
+ 0x6c, /* 01101100 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0x6c, /* 01101100 */
+ 0x38, /* 00111000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 154 0x9a 'š'
+ */
+ 0xc6, /* 11000110 */
+ 0x00, /* 00000000 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0x7c, /* 01111100 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 155 0x9b '›'
+ */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x7e, /* 01111110 */
+ 0xc0, /* 11000000 */
+ 0xc0, /* 11000000 */
+ 0x7e, /* 01111110 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+
+ /*
+ * 156 0x9c 'œ'
+ */
+ 0x38, /* 00111000 */
+ 0x6c, /* 01101100 */
+ 0x64, /* 01100100 */
+ 0xf0, /* 11110000 */
+ 0x60, /* 01100000 */
+ 0x66, /* 01100110 */
+ 0xfc, /* 11111100 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 157 0x9d ''
+ */
+ 0x66, /* 01100110 */
+ 0x66, /* 01100110 */
+ 0x3c, /* 00111100 */
+ 0x7e, /* 01111110 */
+ 0x18, /* 00011000 */
+ 0x7e, /* 01111110 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+
+ /*
+ * 158 0x9e 'ž'
+ */
+ 0xf8, /* 11111000 */
+ 0xcc, /* 11001100 */
+ 0xcc, /* 11001100 */
+ 0xfa, /* 11111010 */
+ 0xc6, /* 11000110 */
+ 0xcf, /* 11001111 */
+ 0xc6, /* 11000110 */
+ 0xc7, /* 11000111 */
+
+ /*
+ * 159 0x9f 'Ÿ'
+ */
+ 0x0e, /* 00001110 */
+ 0x1b, /* 00011011 */
+ 0x18, /* 00011000 */
+ 0x3c, /* 00111100 */
+ 0x18, /* 00011000 */
+ 0xd8, /* 11011000 */
+ 0x70, /* 01110000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 160 0xa0 ' '
+ */
+ 0x18, /* 00011000 */
+ 0x30, /* 00110000 */
+ 0x78, /* 01111000 */
+ 0x0c, /* 00001100 */
+ 0x7c, /* 01111100 */
+ 0xcc, /* 11001100 */
+ 0x76, /* 01110110 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 161 0xa1 '¡'
+ */
+ 0x0c, /* 00001100 */
+ 0x18, /* 00011000 */
+ 0x00, /* 00000000 */
+ 0x38, /* 00111000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x3c, /* 00111100 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 162 0xa2 '¢'
+ */
+ 0x0c, /* 00001100 */
+ 0x18, /* 00011000 */
+ 0x7c, /* 01111100 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0x7c, /* 01111100 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 163 0xa3 '£'
+ */
+ 0x18, /* 00011000 */
+ 0x30, /* 00110000 */
+ 0xcc, /* 11001100 */
+ 0xcc, /* 11001100 */
+ 0xcc, /* 11001100 */
+ 0xcc, /* 11001100 */
+ 0x76, /* 01110110 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 164 0xa4 '¤'
+ */
+ 0x76, /* 01110110 */
+ 0xdc, /* 11011100 */
+ 0x00, /* 00000000 */
+ 0xdc, /* 11011100 */
+ 0x66, /* 01100110 */
+ 0x66, /* 01100110 */
+ 0x66, /* 01100110 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 165 0xa5 '¥'
+ */
+ 0x76, /* 01110110 */
+ 0xdc, /* 11011100 */
+ 0x00, /* 00000000 */
+ 0xe6, /* 11100110 */
+ 0xf6, /* 11110110 */
+ 0xde, /* 11011110 */
+ 0xce, /* 11001110 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 166 0xa6 '¦'
+ */
+ 0x3c, /* 00111100 */
+ 0x6c, /* 01101100 */
+ 0x6c, /* 01101100 */
+ 0x3e, /* 00111110 */
+ 0x00, /* 00000000 */
+ 0x7e, /* 01111110 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 167 0xa7 '§'
+ */
+ 0x38, /* 00111000 */
+ 0x6c, /* 01101100 */
+ 0x6c, /* 01101100 */
+ 0x38, /* 00111000 */
+ 0x00, /* 00000000 */
+ 0x7c, /* 01111100 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 168 0xa8 '¨'
+ */
+ 0x18, /* 00011000 */
+ 0x00, /* 00000000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x30, /* 00110000 */
+ 0x63, /* 01100011 */
+ 0x3e, /* 00111110 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 169 0xa9 '©'
+ */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0xfe, /* 11111110 */
+ 0xc0, /* 11000000 */
+ 0xc0, /* 11000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 170 0xaa 'ª'
+ */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0xfe, /* 11111110 */
+ 0x06, /* 00000110 */
+ 0x06, /* 00000110 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 171 0xab '«'
+ */
+ 0x63, /* 01100011 */
+ 0xe6, /* 11100110 */
+ 0x6c, /* 01101100 */
+ 0x7e, /* 01111110 */
+ 0x33, /* 00110011 */
+ 0x66, /* 01100110 */
+ 0xcc, /* 11001100 */
+ 0x0f, /* 00001111 */
+
+ /*
+ * 172 0xac '¬'
+ */
+ 0x63, /* 01100011 */
+ 0xe6, /* 11100110 */
+ 0x6c, /* 01101100 */
+ 0x7a, /* 01111010 */
+ 0x36, /* 00110110 */
+ 0x6a, /* 01101010 */
+ 0xdf, /* 11011111 */
+ 0x06, /* 00000110 */
+
+ /*
+ * 173 0xad '­'
+ */
+ 0x18, /* 00011000 */
+ 0x00, /* 00000000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x3c, /* 00111100 */
+ 0x3c, /* 00111100 */
+ 0x18, /* 00011000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 174 0xae '®'
+ */
+ 0x00, /* 00000000 */
+ 0x33, /* 00110011 */
+ 0x66, /* 01100110 */
+ 0xcc, /* 11001100 */
+ 0x66, /* 01100110 */
+ 0x33, /* 00110011 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 175 0xaf '¯'
+ */
+ 0x00, /* 00000000 */
+ 0xcc, /* 11001100 */
+ 0x66, /* 01100110 */
+ 0x33, /* 00110011 */
+ 0x66, /* 01100110 */
+ 0xcc, /* 11001100 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 176 0xb0 '°'
+ */
+ 0x22, /* 00100010 */
+ 0x88, /* 10001000 */
+ 0x22, /* 00100010 */
+ 0x88, /* 10001000 */
+ 0x22, /* 00100010 */
+ 0x88, /* 10001000 */
+ 0x22, /* 00100010 */
+ 0x88, /* 10001000 */
+
+ /*
+ * 177 0xb1 '±'
+ */
+ 0x55, /* 01010101 */
+ 0xaa, /* 10101010 */
+ 0x55, /* 01010101 */
+ 0xaa, /* 10101010 */
+ 0x55, /* 01010101 */
+ 0xaa, /* 10101010 */
+ 0x55, /* 01010101 */
+ 0xaa, /* 10101010 */
+
+ /*
+ * 178 0xb2 '²'
+ */
+ 0x77, /* 01110111 */
+ 0xdd, /* 11011101 */
+ 0x77, /* 01110111 */
+ 0xdd, /* 11011101 */
+ 0x77, /* 01110111 */
+ 0xdd, /* 11011101 */
+ 0x77, /* 01110111 */
+ 0xdd, /* 11011101 */
+
+ /*
+ * 179 0xb3 '³'
+ */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+
+ /*
+ * 180 0xb4 '´'
+ */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0xf8, /* 11111000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+
+ /*
+ * 181 0xb5 'µ'
+ */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0xf8, /* 11111000 */
+ 0x18, /* 00011000 */
+ 0xf8, /* 11111000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+
+ /*
+ * 182 0xb6 '¶'
+ */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0xf6, /* 11110110 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+
+ /*
+ * 183 0xb7 '·'
+ */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0xfe, /* 11111110 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+
+ /*
+ * 184 0xb8 '¸'
+ */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0xf8, /* 11111000 */
+ 0x18, /* 00011000 */
+ 0xf8, /* 11111000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+
+ /*
+ * 185 0xb9 '¹'
+ */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0xf6, /* 11110110 */
+ 0x06, /* 00000110 */
+ 0xf6, /* 11110110 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+
+ /*
+ * 186 0xba 'º'
+ */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+
+ /*
+ * 187 0xbb '»'
+ */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0xfe, /* 11111110 */
+ 0x06, /* 00000110 */
+ 0xf6, /* 11110110 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+
+ /*
+ * 188 0xbc '¼'
+ */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0xf6, /* 11110110 */
+ 0x06, /* 00000110 */
+ 0xfe, /* 11111110 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 189 0xbd '½'
+ */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0xfe, /* 11111110 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 190 0xbe '¾'
+ */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0xf8, /* 11111000 */
+ 0x18, /* 00011000 */
+ 0xf8, /* 11111000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 191 0xbf '¿'
+ */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0xf8, /* 11111000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+
+ /*
+ * 192 0xc0 'À'
+ */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x1f, /* 00011111 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 193 0xc1 'Á'
+ */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0xff, /* 11111111 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 194 0xc2 'Â'
+ */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0xff, /* 11111111 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+
+ /*
+ * 195 0xc3 'Ã'
+ */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x1f, /* 00011111 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+
+ /*
+ * 196 0xc4 'Ä'
+ */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0xff, /* 11111111 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 197 0xc5 'Å'
+ */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0xff, /* 11111111 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+
+ /*
+ * 198 0xc6 'Æ'
+ */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x1f, /* 00011111 */
+ 0x18, /* 00011000 */
+ 0x1f, /* 00011111 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+
+ /*
+ * 199 0xc7 'Ç'
+ */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0x37, /* 00110111 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+
+ /*
+ * 200 0xc8 'È'
+ */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0x37, /* 00110111 */
+ 0x30, /* 00110000 */
+ 0x3f, /* 00111111 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 201 0xc9 'É'
+ */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x3f, /* 00111111 */
+ 0x30, /* 00110000 */
+ 0x37, /* 00110111 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+
+ /*
+ * 202 0xca 'Ê'
+ */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0xf7, /* 11110111 */
+ 0x00, /* 00000000 */
+ 0xff, /* 11111111 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 203 0xcb 'Ë'
+ */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0xff, /* 11111111 */
+ 0x00, /* 00000000 */
+ 0xf7, /* 11110111 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+
+ /*
+ * 204 0xcc 'Ì'
+ */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0x37, /* 00110111 */
+ 0x30, /* 00110000 */
+ 0x37, /* 00110111 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+
+ /*
+ * 205 0xcd 'Í'
+ */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0xff, /* 11111111 */
+ 0x00, /* 00000000 */
+ 0xff, /* 11111111 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 206 0xce 'Î'
+ */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0xf7, /* 11110111 */
+ 0x00, /* 00000000 */
+ 0xf7, /* 11110111 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+
+ /*
+ * 207 0xcf 'Ï'
+ */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0xff, /* 11111111 */
+ 0x00, /* 00000000 */
+ 0xff, /* 11111111 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 208 0xd0 'Ð'
+ */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0xff, /* 11111111 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 209 0xd1 'Ñ'
+ */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0xff, /* 11111111 */
+ 0x00, /* 00000000 */
+ 0xff, /* 11111111 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+
+ /*
+ * 210 0xd2 'Ò'
+ */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0xff, /* 11111111 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+
+ /*
+ * 211 0xd3 'Ó'
+ */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0x3f, /* 00111111 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 212 0xd4 'Ô'
+ */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x1f, /* 00011111 */
+ 0x18, /* 00011000 */
+ 0x1f, /* 00011111 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 213 0xd5 'Õ'
+ */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x1f, /* 00011111 */
+ 0x18, /* 00011000 */
+ 0x1f, /* 00011111 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+
+ /*
+ * 214 0xd6 'Ö'
+ */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x3f, /* 00111111 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+
+ /*
+ * 215 0xd7 '×'
+ */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0xff, /* 11111111 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+
+ /*
+ * 216 0xd8 'Ø'
+ */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0xff, /* 11111111 */
+ 0x18, /* 00011000 */
+ 0xff, /* 11111111 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+
+ /*
+ * 217 0xd9 'Ù'
+ */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0xf8, /* 11111000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 218 0xda 'Ú'
+ */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x1f, /* 00011111 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+
+ /*
+ * 219 0xdb 'Û'
+ */
+ 0xff, /* 11111111 */
+ 0xff, /* 11111111 */
+ 0xff, /* 11111111 */
+ 0xff, /* 11111111 */
+ 0xff, /* 11111111 */
+ 0xff, /* 11111111 */
+ 0xff, /* 11111111 */
+ 0xff, /* 11111111 */
+
+ /*
+ * 220 0xdc 'Ü'
+ */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0xff, /* 11111111 */
+ 0xff, /* 11111111 */
+ 0xff, /* 11111111 */
+ 0xff, /* 11111111 */
+
+ /*
+ * 221 0xdd 'Ý'
+ */
+ 0xf0, /* 11110000 */
+ 0xf0, /* 11110000 */
+ 0xf0, /* 11110000 */
+ 0xf0, /* 11110000 */
+ 0xf0, /* 11110000 */
+ 0xf0, /* 11110000 */
+ 0xf0, /* 11110000 */
+ 0xf0, /* 11110000 */
+
+ /*
+ * 222 0xde 'Þ'
+ */
+ 0x0f, /* 00001111 */
+ 0x0f, /* 00001111 */
+ 0x0f, /* 00001111 */
+ 0x0f, /* 00001111 */
+ 0x0f, /* 00001111 */
+ 0x0f, /* 00001111 */
+ 0x0f, /* 00001111 */
+ 0x0f, /* 00001111 */
+
+ /*
+ * 223 0xdf 'ß'
+ */
+ 0xff, /* 11111111 */
+ 0xff, /* 11111111 */
+ 0xff, /* 11111111 */
+ 0xff, /* 11111111 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 224 0xe0 'à'
+ */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x76, /* 01110110 */
+ 0xdc, /* 11011100 */
+ 0xc8, /* 11001000 */
+ 0xdc, /* 11011100 */
+ 0x76, /* 01110110 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 225 0xe1 'á'
+ */
+ 0x78, /* 01111000 */
+ 0xcc, /* 11001100 */
+ 0xcc, /* 11001100 */
+ 0xd8, /* 11011000 */
+ 0xcc, /* 11001100 */
+ 0xc6, /* 11000110 */
+ 0xcc, /* 11001100 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 226 0xe2 'â'
+ */
+ 0xfe, /* 11111110 */
+ 0xc6, /* 11000110 */
+ 0xc0, /* 11000000 */
+ 0xc0, /* 11000000 */
+ 0xc0, /* 11000000 */
+ 0xc0, /* 11000000 */
+ 0xc0, /* 11000000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 227 0xe3 'ã'
+ */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0xfe, /* 11111110 */
+ 0x6c, /* 01101100 */
+ 0x6c, /* 01101100 */
+ 0x6c, /* 01101100 */
+ 0x6c, /* 01101100 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 228 0xe4 'ä'
+ */
+ 0xfe, /* 11111110 */
+ 0xc6, /* 11000110 */
+ 0x60, /* 01100000 */
+ 0x30, /* 00110000 */
+ 0x60, /* 01100000 */
+ 0xc6, /* 11000110 */
+ 0xfe, /* 11111110 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 229 0xe5 'å'
+ */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x7e, /* 01111110 */
+ 0xd8, /* 11011000 */
+ 0xd8, /* 11011000 */
+ 0xd8, /* 11011000 */
+ 0x70, /* 01110000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 230 0xe6 'æ'
+ */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x66, /* 01100110 */
+ 0x66, /* 01100110 */
+ 0x66, /* 01100110 */
+ 0x66, /* 01100110 */
+ 0x7c, /* 01111100 */
+ 0xc0, /* 11000000 */
+
+ /*
+ * 231 0xe7 'ç'
+ */
+ 0x00, /* 00000000 */
+ 0x76, /* 01110110 */
+ 0xdc, /* 11011100 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 232 0xe8 'è'
+ */
+ 0x7e, /* 01111110 */
+ 0x18, /* 00011000 */
+ 0x3c, /* 00111100 */
+ 0x66, /* 01100110 */
+ 0x66, /* 01100110 */
+ 0x3c, /* 00111100 */
+ 0x18, /* 00011000 */
+ 0x7e, /* 01111110 */
+
+ /*
+ * 233 0xe9 'é'
+ */
+ 0x38, /* 00111000 */
+ 0x6c, /* 01101100 */
+ 0xc6, /* 11000110 */
+ 0xfe, /* 11111110 */
+ 0xc6, /* 11000110 */
+ 0x6c, /* 01101100 */
+ 0x38, /* 00111000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 234 0xea 'ê'
+ */
+ 0x38, /* 00111000 */
+ 0x6c, /* 01101100 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0x6c, /* 01101100 */
+ 0x6c, /* 01101100 */
+ 0xee, /* 11101110 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 235 0xeb 'ë'
+ */
+ 0x0e, /* 00001110 */
+ 0x18, /* 00011000 */
+ 0x0c, /* 00001100 */
+ 0x3e, /* 00111110 */
+ 0x66, /* 01100110 */
+ 0x66, /* 01100110 */
+ 0x3c, /* 00111100 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 236 0xec 'ì'
+ */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x7e, /* 01111110 */
+ 0xdb, /* 11011011 */
+ 0xdb, /* 11011011 */
+ 0x7e, /* 01111110 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 237 0xed 'í'
+ */
+ 0x06, /* 00000110 */
+ 0x0c, /* 00001100 */
+ 0x7e, /* 01111110 */
+ 0xdb, /* 11011011 */
+ 0xdb, /* 11011011 */
+ 0x7e, /* 01111110 */
+ 0x60, /* 01100000 */
+ 0xc0, /* 11000000 */
+
+ /*
+ * 238 0xee 'î'
+ */
+ 0x1e, /* 00011110 */
+ 0x30, /* 00110000 */
+ 0x60, /* 01100000 */
+ 0x7e, /* 01111110 */
+ 0x60, /* 01100000 */
+ 0x30, /* 00110000 */
+ 0x1e, /* 00011110 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 239 0xef 'ï'
+ */
+ 0x00, /* 00000000 */
+ 0x7c, /* 01111100 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 240 0xf0 'ð'
+ */
+ 0x00, /* 00000000 */
+ 0xfe, /* 11111110 */
+ 0x00, /* 00000000 */
+ 0xfe, /* 11111110 */
+ 0x00, /* 00000000 */
+ 0xfe, /* 11111110 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 241 0xf1 'ñ'
+ */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x7e, /* 01111110 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x00, /* 00000000 */
+ 0x7e, /* 01111110 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 242 0xf2 'ò'
+ */
+ 0x30, /* 00110000 */
+ 0x18, /* 00011000 */
+ 0x0c, /* 00001100 */
+ 0x18, /* 00011000 */
+ 0x30, /* 00110000 */
+ 0x00, /* 00000000 */
+ 0x7e, /* 01111110 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 243 0xf3 'ó'
+ */
+ 0x0c, /* 00001100 */
+ 0x18, /* 00011000 */
+ 0x30, /* 00110000 */
+ 0x18, /* 00011000 */
+ 0x0c, /* 00001100 */
+ 0x00, /* 00000000 */
+ 0x7e, /* 01111110 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 244 0xf4 'ô'
+ */
+ 0x0e, /* 00001110 */
+ 0x1b, /* 00011011 */
+ 0x1b, /* 00011011 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+
+ /*
+ * 245 0xf5 'õ'
+ */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0xd8, /* 11011000 */
+ 0xd8, /* 11011000 */
+ 0x70, /* 01110000 */
+
+ /*
+ * 246 0xf6 'ö'
+ */
+ 0x00, /* 00000000 */
+ 0x18, /* 00011000 */
+ 0x00, /* 00000000 */
+ 0x7e, /* 01111110 */
+ 0x00, /* 00000000 */
+ 0x18, /* 00011000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 247 0xf7 '÷'
+ */
+ 0x00, /* 00000000 */
+ 0x76, /* 01110110 */
+ 0xdc, /* 11011100 */
+ 0x00, /* 00000000 */
+ 0x76, /* 01110110 */
+ 0xdc, /* 11011100 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 248 0xf8 'ø'
+ */
+ 0x38, /* 00111000 */
+ 0x6c, /* 01101100 */
+ 0x6c, /* 01101100 */
+ 0x38, /* 00111000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 249 0xf9 'ù'
+ */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x18, /* 00011000 */
+ 0x18, /* 00011000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 250 0xfa 'ú'
+ */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x18, /* 00011000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 251 0xfb 'û'
+ */
+ 0x0f, /* 00001111 */
+ 0x0c, /* 00001100 */
+ 0x0c, /* 00001100 */
+ 0x0c, /* 00001100 */
+ 0xec, /* 11101100 */
+ 0x6c, /* 01101100 */
+ 0x3c, /* 00111100 */
+ 0x1c, /* 00011100 */
+
+ /*
+ * 252 0xfc 'ü'
+ */
+ 0x6c, /* 01101100 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0x36, /* 00110110 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 253 0xfd 'ý'
+ */
+ 0x78, /* 01111000 */
+ 0x0c, /* 00001100 */
+ 0x18, /* 00011000 */
+ 0x30, /* 00110000 */
+ 0x7c, /* 01111100 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 254 0xfe 'þ'
+ */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x3c, /* 00111100 */
+ 0x3c, /* 00111100 */
+ 0x3c, /* 00111100 */
+ 0x3c, /* 00111100 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+
+ /*
+ * 255 0xff ' '
+ */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
};
@@ -3116,123 +3116,123 @@ static SDL_Texture *SDLTest_CharTextureCache[256];
int SDLTest_DrawCharacter(SDL_Renderer *renderer, int x, int y, char c)
{
- const Uint32 charWidth = 8;
- const Uint32 charHeight = 8;
- const Uint32 charSize = 8;
- SDL_Rect srect;
- SDL_Rect drect;
- int result;
- Uint32 ix, iy;
- const unsigned char *charpos;
- Uint8 *curpos;
- Uint8 patt, mask;
- Uint8 *linepos;
- Uint32 pitch;
- SDL_Surface *character;
- Uint32 ci;
- Uint8 r, g, b, a;
-
- /*
- * Setup source rectangle
- */
- srect.x = 0;
- srect.y = 0;
- srect.w = charWidth;
- srect.h = charHeight;
-
- /*
- * Setup destination rectangle
- */
- drect.x = x;
- drect.y = y;
- drect.w = charWidth;
- drect.h = charHeight;
-
- /* Character index in cache */
- ci = (unsigned char)c;
-
- /*
- * Create new charWidth x charHeight bitmap surface if not already present.
- */
- if (SDLTest_CharTextureCache[ci] == NULL) {
- /*
- * Redraw character into surface
- */
- character = SDL_CreateRGBSurface(SDL_SWSURFACE,
- charWidth, charHeight, 32,
- 0xFF000000, 0x00FF0000, 0x0000FF00, 0x000000FF);
- if (character == NULL) {
- return (-1);
- }
-
- charpos = SDLTest_FontData + ci * charSize;
- linepos = (Uint8 *)character->pixels;
- pitch = character->pitch;
-
- /*
- * Drawing loop
- */
- patt = 0;
- for (iy = 0; iy < charWidth; iy++) {
- mask = 0x00;
- curpos = linepos;
- for (ix = 0; ix < charWidth; ix++) {
- if (!(mask >>= 1)) {
- patt = *charpos++;
- mask = 0x80;
- }
- if (patt & mask) {
- *(Uint32 *)curpos = 0xffffffff;
- } else {
- *(Uint32 *)curpos = 0;
- }
- curpos += 4;
- }
- linepos += pitch;
- }
-
- /* Convert temp surface into texture */
- SDLTest_CharTextureCache[ci] = SDL_CreateTextureFromSurface(renderer, character);
- SDL_FreeSurface(character);
-
- /*
- * Check pointer
- */
- if (SDLTest_CharTextureCache[ci] == NULL) {
- return (-1);
- }
- }
-
- /*
- * Set color
- */
- result = 0;
- result |= SDL_GetRenderDrawColor(renderer, &r, &g, &b, &a);
- result |= SDL_SetTextureColorMod(SDLTest_CharTextureCache[ci], r, g, b);
- result |= SDL_SetTextureAlphaMod(SDLTest_CharTextureCache[ci], a);
-
- /*
- * Draw texture onto destination
- */
- result |= SDL_RenderCopy(renderer, SDLTest_CharTextureCache[ci], &srect, &drect);
-
- return (result);
+ const Uint32 charWidth = 8;
+ const Uint32 charHeight = 8;
+ const Uint32 charSize = 8;
+ SDL_Rect srect;
+ SDL_Rect drect;
+ int result;
+ Uint32 ix, iy;
+ const unsigned char *charpos;
+ Uint8 *curpos;
+ Uint8 patt, mask;
+ Uint8 *linepos;
+ Uint32 pitch;
+ SDL_Surface *character;
+ Uint32 ci;
+ Uint8 r, g, b, a;
+
+ /*
+ * Setup source rectangle
+ */
+ srect.x = 0;
+ srect.y = 0;
+ srect.w = charWidth;
+ srect.h = charHeight;
+
+ /*
+ * Setup destination rectangle
+ */
+ drect.x = x;
+ drect.y = y;
+ drect.w = charWidth;
+ drect.h = charHeight;
+
+ /* Character index in cache */
+ ci = (unsigned char)c;
+
+ /*
+ * Create new charWidth x charHeight bitmap surface if not already present.
+ */
+ if (SDLTest_CharTextureCache[ci] == NULL) {
+ /*
+ * Redraw character into surface
+ */
+ character = SDL_CreateRGBSurface(SDL_SWSURFACE,
+ charWidth, charHeight, 32,
+ 0xFF000000, 0x00FF0000, 0x0000FF00, 0x000000FF);
+ if (character == NULL) {
+ return (-1);
+ }
+
+ charpos = SDLTest_FontData + ci * charSize;
+ linepos = (Uint8 *)character->pixels;
+ pitch = character->pitch;
+
+ /*
+ * Drawing loop
+ */
+ patt = 0;
+ for (iy = 0; iy < charWidth; iy++) {
+ mask = 0x00;
+ curpos = linepos;
+ for (ix = 0; ix < charWidth; ix++) {
+ if (!(mask >>= 1)) {
+ patt = *charpos++;
+ mask = 0x80;
+ }
+ if (patt & mask) {
+ *(Uint32 *)curpos = 0xffffffff;
+ } else {
+ *(Uint32 *)curpos = 0;
+ }
+ curpos += 4;
+ }
+ linepos += pitch;
+ }
+
+ /* Convert temp surface into texture */
+ SDLTest_CharTextureCache[ci] = SDL_CreateTextureFromSurface(renderer, character);
+ SDL_FreeSurface(character);
+
+ /*
+ * Check pointer
+ */
+ if (SDLTest_CharTextureCache[ci] == NULL) {
+ return (-1);
+ }
+ }
+
+ /*
+ * Set color
+ */
+ result = 0;
+ result |= SDL_GetRenderDrawColor(renderer, &r, &g, &b, &a);
+ result |= SDL_SetTextureColorMod(SDLTest_CharTextureCache[ci], r, g, b);
+ result |= SDL_SetTextureAlphaMod(SDLTest_CharTextureCache[ci], a);
+
+ /*
+ * Draw texture onto destination
+ */
+ result |= SDL_RenderCopy(renderer, SDLTest_CharTextureCache[ci], &srect, &drect);
+
+ return (result);
}
int SDLTest_DrawString(SDL_Renderer * renderer, int x, int y, const char *s)
{
- const Uint32 charWidth = 8;
- int result = 0;
- int curx = x;
- int cury = y;
- const char *curchar = s;
-
- while (*curchar && !result) {
- result |= SDLTest_DrawCharacter(renderer, curx, cury, *curchar);
- curx += charWidth;
- curchar++;
- }
-
- return (result);
+ const Uint32 charWidth = 8;
+ int result = 0;
+ int curx = x;
+ int cury = y;
+ const char *curchar = s;
+
+ while (*curchar && !result) {
+ result |= SDLTest_DrawCharacter(renderer, curx, cury, *curchar);
+ curx += charWidth;
+ curchar++;
+ }
+
+ return (result);
}
diff --git a/src/test/SDL_test_fuzzer.c b/src/test/SDL_test_fuzzer.c
index dcbace68c5..8a27fd0117 100644
--- a/src/test/SDL_test_fuzzer.c
+++ b/src/test/SDL_test_fuzzer.c
@@ -19,10 +19,10 @@
3. This notice may not be removed or altered from any source distribution.
*/
-/*
+/*
Data generators for fuzzing test data in a reproducible way.
-
+
*/
#include "SDL_config.h"
@@ -43,7 +43,7 @@
#include "SDL_test.h"
-/**
+/**
* Counter for fuzzer invocations
*/
static int fuzzerInvocationCounter = 0;
@@ -60,93 +60,93 @@ static SDLTest_RandomContext rndContext;
void
SDLTest_FuzzerInit(Uint64 execKey)
{
- Uint32 a = (execKey >> 32) & 0x00000000FFFFFFFF;
- Uint32 b = execKey & 0x00000000FFFFFFFF;
- SDL_memset((void *)&rndContext, 0, sizeof(SDLTest_RandomContext));
- SDLTest_RandomInit(&rndContext, a, b);
- fuzzerInvocationCounter = 0;
+ Uint32 a = (execKey >> 32) & 0x00000000FFFFFFFF;
+ Uint32 b = execKey & 0x00000000FFFFFFFF;
+ SDL_memset((void *)&rndContext, 0, sizeof(SDLTest_RandomContext));
+ SDLTest_RandomInit(&rndContext, a, b);
+ fuzzerInvocationCounter = 0;
}
int
SDLTest_GetFuzzerInvocationCount()
{
- return fuzzerInvocationCounter;
+ return fuzzerInvocationCounter;
}
Uint8
SDLTest_RandomUint8()
{
- fuzzerInvocationCounter++;
+ fuzzerInvocationCounter++;
- return (Uint8) SDLTest_RandomInt(&rndContext) & 0x000000FF;
+ return (Uint8) SDLTest_RandomInt(&rndContext) & 0x000000FF;
}
Sint8
SDLTest_RandomSint8()
{
- fuzzerInvocationCounter++;
+ fuzzerInvocationCounter++;
- return (Sint8) SDLTest_RandomInt(&rndContext) & 0x000000FF;
+ return (Sint8) SDLTest_RandomInt(&rndContext) & 0x000000FF;
}
Uint16
SDLTest_RandomUint16()
{
- fuzzerInvocationCounter++;
+ fuzzerInvocationCounter++;
- return (Uint16) SDLTest_RandomInt(&rndContext) & 0x0000FFFF;
+ return (Uint16) SDLTest_RandomInt(&rndContext) & 0x0000FFFF;
}
Sint16
SDLTest_RandomSint16()
{
- fuzzerInvocationCounter++;
+ fuzzerInvocationCounter++;
- return (Sint16) SDLTest_RandomInt(&rndContext) & 0x0000FFFF;
+ return (Sint16) SDLTest_RandomInt(&rndContext) & 0x0000FFFF;
}
Sint32
SDLTest_RandomSint32()
{
- fuzzerInvocationCounter++;
+ fuzzerInvocationCounter++;
- return (Sint32) SDLTest_RandomInt(&rndContext);
+ return (Sint32) SDLTest_RandomInt(&rndContext);
}
Uint32
SDLTest_RandomUint32()
{
- fuzzerInvocationCounter++;
+ fuzzerInvocationCounter++;
- return (Uint32) SDLTest_RandomInt(&rndContext);
+ return (Uint32) SDLTest_RandomInt(&rndContext);
}
Uint64
SDLTest_RandomUint64()
{
- Uint64 value = 0;
- Uint32 *vp = (void *)&value;
+ Uint64 value = 0;
+ Uint32 *vp = (void *)&value;
- fuzzerInvocationCounter++;
+ fuzzerInvocationCounter++;
- vp[0] = SDLTest_RandomSint32();
- vp[1] = SDLTest_RandomSint32();
+ vp[0] = SDLTest_RandomSint32();
+ vp[1] = SDLTest_RandomSint32();
- return value;
+ return value;
}
Sint64
SDLTest_RandomSint64()
{
- Uint64 value = 0;
- Uint32 *vp = (void *)&value;
+ Uint64 value = 0;
+ Uint32 *vp = (void *)&value;
- fuzzerInvocationCounter++;
+ fuzzerInvocationCounter++;
- vp[0] = SDLTest_RandomSint32();
- vp[1] = SDLTest_RandomSint32();
+ vp[0] = SDLTest_RandomSint32();
+ vp[1] = SDLTest_RandomSint32();
- return value;
+ return value;
}
@@ -154,23 +154,23 @@ SDLTest_RandomSint64()
Sint32
SDLTest_RandomIntegerInRange(Sint32 pMin, Sint32 pMax)
{
- Sint64 min = pMin;
- Sint64 max = pMax;
- Sint64 temp;
- Sint64 number;
-
- if(pMin > pMax) {
- temp = min;
- min = max;
- max = temp;
- } else if(pMin == pMax) {
- return (Sint32)min;
- }
-
- number = SDLTest_RandomUint32();
- /* invocation count increment in preceeding call */
-
- return (Sint32)((number % ((max + 1) - min)) + min);
+ Sint64 min = pMin;
+ Sint64 max = pMax;
+ Sint64 temp;
+ Sint64 number;
+
+ if(pMin > pMax) {
+ temp = min;
+ min = max;
+ max = temp;
+ } else if(pMin == pMax) {
+ return (Sint32)min;
+ }
+
+ number = SDLTest_RandomUint32();
+ /* invocation count increment in preceeding call */
+
+ return (Sint32)((number % ((max + 1) - min)) + min);
}
/*!
@@ -189,7 +189,7 @@ SDLTest_RandomIntegerInRange(Sint32 pMin, Sint32 pMax)
* Generator works the same for other types of unsigned integers.
*
* \param maxValue The biggest value that is acceptable for this data type.
- * For instance, for Uint8 -> 255, Uint16 -> 65536 etc.
+ * For instance, for Uint8 -> 255, Uint16 -> 65536 etc.
* \param boundary1 defines lower boundary
* \param boundary2 defines upper boundary
* \param validDomain Generate only for valid domain (for the data type)
@@ -200,107 +200,107 @@ Uint64
SDLTest_GenerateUnsignedBoundaryValues(const Uint64 maxValue, Uint64 boundary1, Uint64 boundary2, SDL_bool validDomain)
{
Uint64 b1, b2;
- Uint64 delta;
- Uint64 tempBuf[4];
- Uint8 index;
-
+ Uint64 delta;
+ Uint64 tempBuf[4];
+ Uint8 index;
+
/* Maybe swap */
- if (boundary1 > boundary2) {
- b1 = boundary2;
- b2 = boundary1;
- } else {
- b1 = boundary1;
- b2 = boundary2;
+ if (boundary1 > boundary2) {
+ b1 = boundary2;
+ b2 = boundary1;
+ } else {
+ b1 = boundary1;
+ b2 = boundary2;
}
- index = 0;
- if (validDomain == SDL_TRUE) {
- if (b1 == b2) {
- return b1;
- }
-
- /* Generate up to 4 values within bounds */
- delta = b2 - b1;
- if (delta < 4) {
- do {
- tempBuf[index] = b1 + index;
- index++;
+ index = 0;
+ if (validDomain == SDL_TRUE) {
+ if (b1 == b2) {
+ return b1;
+ }
+
+ /* Generate up to 4 values within bounds */
+ delta = b2 - b1;
+ if (delta < 4) {
+ do {
+ tempBuf[index] = b1 + index;
+ index++;
} while (index < delta);
- } else {
- tempBuf[index] = b1;
- index++;
- tempBuf[index] = b1 + 1;
- index++;
- tempBuf[index] = b2 - 1;
- index++;
- tempBuf[index] = b2;
- index++;
- }
- } else {
- /* Generate up to 2 values outside of bounds */
- if (b1 > 0) {
- tempBuf[index] = b1 - 1;
- index++;
- }
-
- if (b2 < maxValue) {
- tempBuf[index] = b2 + 1;
- index++;
- }
- }
-
- if (index == 0) {
- /* There are no valid boundaries */
- SDL_Unsupported();
- return 0;
- }
-
- return tempBuf[SDLTest_RandomUint8() % index];
+ } else {
+ tempBuf[index] = b1;
+ index++;
+ tempBuf[index] = b1 + 1;
+ index++;
+ tempBuf[index] = b2 - 1;
+ index++;
+ tempBuf[index] = b2;
+ index++;
+ }
+ } else {
+ /* Generate up to 2 values outside of bounds */
+ if (b1 > 0) {
+ tempBuf[index] = b1 - 1;
+ index++;
+ }
+
+ if (b2 < maxValue) {
+ tempBuf[index] = b2 + 1;
+ index++;
+ }
+ }
+
+ if (index == 0) {
+ /* There are no valid boundaries */
+ SDL_Unsupported();
+ return 0;
+ }
+
+ return tempBuf[SDLTest_RandomUint8() % index];
}
Uint8
SDLTest_RandomUint8BoundaryValue(Uint8 boundary1, Uint8 boundary2, SDL_bool validDomain)
{
- /* max value for Uint8 */
- const Uint64 maxValue = UCHAR_MAX;
- return (Uint8)SDLTest_GenerateUnsignedBoundaryValues(maxValue,
- (Uint64) boundary1, (Uint64) boundary2,
- validDomain);
+ /* max value for Uint8 */
+ const Uint64 maxValue = UCHAR_MAX;
+ return (Uint8)SDLTest_GenerateUnsignedBoundaryValues(maxValue,
+ (Uint64) boundary1, (Uint64) boundary2,
+ validDomain);
}
Uint16
SDLTest_RandomUint16BoundaryValue(Uint16 boundary1, Uint16 boundary2, SDL_bool validDomain)
{
- /* max value for Uint16 */
- const Uint64 maxValue = USHRT_MAX;
- return (Uint16)SDLTest_GenerateUnsignedBoundaryValues(maxValue,
- (Uint64) boundary1, (Uint64) boundary2,
- validDomain);
+ /* max value for Uint16 */
+ const Uint64 maxValue = USHRT_MAX;
+ return (Uint16)SDLTest_GenerateUnsignedBoundaryValues(maxValue,
+ (Uint64) boundary1, (Uint64) boundary2,
+ validDomain);
}
Uint32
SDLTest_RandomUint32BoundaryValue(Uint32 boundary1, Uint32 boundary2, SDL_bool validDomain)
{
- /* max value for Uint32 */
- #if ((ULONG_MAX) == (UINT_MAX))
- const Uint64 maxValue = ULONG_MAX;
+ /* max value for Uint32 */
+ #if ((ULONG_MAX) == (UINT_MAX))
+ const Uint64 maxValue = ULONG_MAX;
#else
- const Uint64 maxValue = UINT_MAX;
+ const Uint64 maxValue = UINT_MAX;
#endif
- return (Uint32)SDLTest_GenerateUnsignedBoundaryValues(maxValue,
- (Uint64) boundary1, (Uint64) boundary2,
- validDomain);
+ return (Uint32)SDLTest_GenerateUnsignedBoundaryValues(maxValue,
+ (Uint64) boundary1, (Uint64) boundary2,
+ validDomain);
}
Uint64
SDLTest_RandomUint64BoundaryValue(Uint64 boundary1, Uint64 boundary2, SDL_bool validDomain)
{
- /* max value for Uint64 */
- const Uint64 maxValue = ULLONG_MAX;
- return SDLTest_GenerateUnsignedBoundaryValues(maxValue,
- (Uint64) boundary1, (Uint64) boundary2,
- validDomain);
+ /* max value for Uint64 */
+ const Uint64 maxValue = ULLONG_MAX;
+ return SDLTest_GenerateUnsignedBoundaryValues(maxValue,
+ (Uint64) boundary1, (Uint64) boundary2,
+ validDomain);
}
/*!
@@ -319,9 +319,9 @@ SDLTest_RandomUint64BoundaryValue(Uint64 boundary1, Uint64 boundary2, SDL_bool v
* Generator works the same for other types of signed integers.
*
* \param minValue The smallest value that is acceptable for this data type.
- * For instance, for Uint8 -> -127, etc.
+ * For instance, for Uint8 -> -127, etc.
* \param maxValue The biggest value that is acceptable for this data type.
- * For instance, for Uint8 -> 127, etc.
+ * For instance, for Uint8 -> 127, etc.
* \param boundary1 defines lower boundary
* \param boundary2 defines upper boundary
* \param validDomain Generate only for valid domain (for the data type)
@@ -332,118 +332,118 @@ Sint64
SDLTest_GenerateSignedBoundaryValues(const Sint64 minValue, const Sint64 maxValue, Sint64 boundary1, Sint64 boundary2, SDL_bool validDomain)
{
Sint64 b1, b2;
- Sint64 delta;
- Sint64 tempBuf[4];
- Uint8 index;
-
+ Sint64 delta;
+ Sint64 tempBuf[4];
+ Uint8 index;
+
/* Maybe swap */
- if (boundary1 > boundary2) {
- b1 = boundary2;
- b2 = boundary1;
- } else {
- b1 = boundary1;
- b2 = boundary2;
+ if (boundary1 > boundary2) {
+ b1 = boundary2;
+ b2 = boundary1;
+ } else {
+ b1 = boundary1;
+ b2 = boundary2;
}
- index = 0;
- if (validDomain == SDL_TRUE) {
- if (b1 == b2) {
- return b1;
- }
-
- /* Generate up to 4 values within bounds */
- delta = b2 - b1;
- if (delta < 4) {
- do {
- tempBuf[index] = b1 + index;
- index++;
+ index = 0;
+ if (validDomain == SDL_TRUE) {
+ if (b1 == b2) {
+ return b1;
+ }
+
+ /* Generate up to 4 values within bounds */
+ delta = b2 - b1;
+ if (delta < 4) {
+ do {
+ tempBuf[index] = b1 + index;
+ index++;
} while (index < delta);
- } else {
- tempBuf[index] = b1;
- index++;
- tempBuf[index] = b1 + 1;
- index++;
- tempBuf[index] = b2 - 1;
- index++;
- tempBuf[index] = b2;
- index++;
- }
- } else {
- /* Generate up to 2 values outside of bounds */
- if (b1 > minValue) {
- tempBuf[index] = b1 - 1;
- index++;
- }
-
- if (b2 < maxValue) {
- tempBuf[index] = b2 + 1;
- index++;
- }
- }
-
- if (index == 0) {
- /* There are no valid boundaries */
- SDL_Unsupported();
- return minValue;
- }
-
- return tempBuf[SDLTest_RandomUint8() % index];
+ } else {
+ tempBuf[index] = b1;
+ index++;
+ tempBuf[index] = b1 + 1;
+ index++;
+ tempBuf[index] = b2 - 1;
+ index++;
+ tempBuf[index] = b2;
+ index++;
+ }
+ } else {
+ /* Generate up to 2 values outside of bounds */
+ if (b1 > minValue) {
+ tempBuf[index] = b1 - 1;
+ index++;
+ }
+
+ if (b2 < maxValue) {
+ tempBuf[index] = b2 + 1;
+ index++;
+ }
+ }
+
+ if (index == 0) {
+ /* There are no valid boundaries */
+ SDL_Unsupported();
+ return minValue;
+ }
+
+ return tempBuf[SDLTest_RandomUint8() % index];
}
Sint8
SDLTest_RandomSint8BoundaryValue(Sint8 boundary1, Sint8 boundary2, SDL_bool validDomain)
{
- /* min & max values for Sint8 */
- const Sint64 maxValue = SCHAR_MAX;
- const Sint64 minValue = SCHAR_MIN;
- return (Sint8)SDLTest_GenerateSignedBoundaryValues(minValue, maxValue,
- (Sint64) boundary1, (Sint64) boundary2,
- validDomain);
+ /* min & max values for Sint8 */
+ const Sint64 maxValue = SCHAR_MAX;
+ const Sint64 minValue = SCHAR_MIN;
+ return (Sint8)SDLTest_GenerateSignedBoundaryValues(minValue, maxValue,
+ (Sint64) boundary1, (Sint64) boundary2,
+ validDomain);
}
Sint16
SDLTest_RandomSint16BoundaryValue(Sint16 boundary1, Sint16 boundary2, SDL_bool validDomain)
{
- /* min & max values for Sint16 */
- const Sint64 maxValue = SHRT_MAX;
- const Sint64 minValue = SHRT_MIN;
- return (Sint16)SDLTest_GenerateSignedBoundaryValues(minValue, maxValue,
- (Sint64) boundary1, (Sint64) boundary2,
- validDomain);
+ /* min & max values for Sint16 */
+ const Sint64 maxValue = SHRT_MAX;
+ const Sint64 minValue = SHRT_MIN;
+ return (Sint16)SDLTest_GenerateSignedBoundaryValues(minValue, maxValue,
+ (Sint64) boundary1, (Sint64) boundary2,
+ validDomain);
}
Sint32
SDLTest_RandomSint32BoundaryValue(Sint32 boundary1, Sint32 boundary2, SDL_bool validDomain)
{
- /* min & max values for Sint32 */
- #if ((ULONG_MAX) == (UINT_MAX))
- const Sint64 maxValue = LONG_MAX;
- const Sint64 minValue = LONG_MIN;
+ /* min & max values for Sint32 */
+ #if ((ULONG_MAX) == (UINT_MAX))
+ const Sint64 maxValue = LONG_MAX;
+ const Sint64 minValue = LONG_MIN;
#else
- const Sint64 maxValue = INT_MAX;
- const Sint64 minValue = INT_MIN;
+ const Sint64 maxValue = INT_MAX;
+ const Sint64 minValue = INT_MIN;
#endif
- return (Sint32)SDLTest_GenerateSignedBoundaryValues(minValue, maxValue,
- (Sint64) boundary1, (Sint64) boundary2,
- validDomain);
+ return (Sint32)SDLTest_GenerateSignedBoundaryValues(minValue, maxValue,
+ (Sint64) boundary1, (Sint64) boundary2,
+ validDomain);
}
Sint64
SDLTest_RandomSint64BoundaryValue(Sint64 boundary1, Sint64 boundary2, SDL_bool validDomain)
{
- /* min & max values for Sint64 */
- const Sint64 maxValue = LLONG_MAX;
- const Sint64 minValue = LLONG_MIN;
- return SDLTest_GenerateSignedBoundaryValues(minValue, maxValue,
- boundary1, boundary2,
- validDomain);
+ /* min & max values for Sint64 */
+ const Sint64 maxValue = LLONG_MAX;
+ const Sint64 minValue = LLONG_MIN;
+ return SDLTest_GenerateSignedBoundaryValues(minValue, maxValue,
+ boundary1, boundary2,
+ validDomain);
}
float
SDLTest_RandomUnitFloat()
{
- return (float) SDLTest_RandomUint32() / UINT_MAX;
+ return (float) SDLTest_RandomUint32() / UINT_MAX;
}
float
@@ -455,70 +455,70 @@ SDLTest_RandomFloat()
double
SDLTest_RandomUnitDouble()
{
- return (double) (SDLTest_RandomUint64() >> 11) * (1.0/9007199254740992.0);
+ return (double) (SDLTest_RandomUint64() >> 11) * (1.0/9007199254740992.0);
}
double
SDLTest_RandomDouble()
{
- double r = 0.0;
- double s = 1.0;
- do {
- s /= UINT_MAX + 1.0;
- r += (double)SDLTest_RandomInt(&rndContext) * s;
- } while (s > DBL_EPSILON);
-
- fuzzerInvocationCounter++;
-
- return r;
+ double r = 0.0;
+ double s = 1.0;
+ do {
+ s /= UINT_MAX + 1.0;
+ r += (double)SDLTest_RandomInt(&rndContext) * s;
+ } while (s > DBL_EPSILON);
+
+ fuzzerInvocationCounter++;
+
+ return r;
}
char *
SDLTest_RandomAsciiString()
{
- return SDLTest_RandomAsciiStringWithMaximumLength(255);
+ return SDLTest_RandomAsciiStringWithMaximumLength(255);
}
char *
SDLTest_RandomAsciiStringWithMaximumLength(int maxLength)
{
- int size;
+ int size;
- if(maxLength < 1) {
+ if(maxLength < 1) {
SDL_InvalidParamError("maxLength");
- return NULL;
- }
+ return NULL;
+ }
+
+ size = (SDLTest_RandomUint32() % (maxLength + 1));
- size = (SDLTest_RandomUint32() % (maxLength + 1));
-
- return SDLTest_RandomAsciiStringOfSize(size);
+ return SDLTest_RandomAsciiStringOfSize(size);
}
char *
SDLTest_RandomAsciiStringOfSize(int size)
{
- char *string;
- int counter;
+ char *string;
+ int counter;
- if(size < 1) {
+ if(size < 1) {
SDL_InvalidParamError("size");
- return NULL;
- }
+ return NULL;
+ }
- string = (char *)SDL_malloc((size + 1) * sizeof(char));
- if (string==NULL) {
- return NULL;
+ string = (char *)SDL_malloc((size + 1) * sizeof(char));
+ if (string==NULL) {
+ return NULL;
}
- for(counter = 0; counter < size; ++counter) {
- string[counter] = (char)SDLTest_RandomIntegerInRange(32, 126);
- }
+ for(counter = 0; counter < size; ++counter) {
+ string[counter] = (char)SDLTest_RandomIntegerInRange(32, 126);
+ }
- string[counter] = '\0';
+ string[counter] = '\0';
- fuzzerInvocationCounter++;
+ fuzzerInvocationCounter++;
- return string;
+ return string;
}
diff --git a/src/test/SDL_test_harness.c b/src/test/SDL_test_harness.c
index d3c0266cf9..291874566f 100644
--- a/src/test/SDL_test_harness.c
+++ b/src/test/SDL_test_harness.c
@@ -53,45 +53,45 @@ static Uint32 SDLTest_TestCaseTimeout = 3600;
char *
SDLTest_GenerateRunSeed(const int length)
{
- char *seed = NULL;
- SDLTest_RandomContext randomContext;
- int counter;
-
- /* Sanity check input */
- if (length <= 0) {
- SDLTest_LogError("The length of the harness seed must be >0.");
- return NULL;
- }
-
- /* Allocate output buffer */
- seed = (char *)SDL_malloc((length + 1) * sizeof(char));
- if (seed == NULL) {
- SDLTest_LogError("SDL_malloc for run seed output buffer failed.");
- return NULL;
- }
-
- /* Generate a random string of alphanumeric characters */
- SDLTest_RandomInitTime(&randomContext);
- for (counter = 0; counter < length - 1; ++counter) {
- unsigned int number = SDLTest_Random(&randomContext);
- char ch = (char) (number % (91 - 48)) + 48;
- if (ch >= 58 && ch <= 64) {
- ch = 65;
- }
- seed[counter] = ch;
- }
- seed[counter] = '\0';
-
- return seed;
+ char *seed = NULL;
+ SDLTest_RandomContext randomContext;
+ int counter;
+
+ /* Sanity check input */
+ if (length <= 0) {
+ SDLTest_LogError("The length of the harness seed must be >0.");
+ return NULL;
+ }
+
+ /* Allocate output buffer */
+ seed = (char *)SDL_malloc((length + 1) * sizeof(char));
+ if (seed == NULL) {
+ SDLTest_LogError("SDL_malloc for run seed output buffer failed.");
+ return NULL;
+ }
+
+ /* Generate a random string of alphanumeric characters */
+ SDLTest_RandomInitTime(&randomContext);
+ for (counter = 0; counter < length - 1; ++counter) {
+ unsigned int number = SDLTest_Random(&randomContext);
+ char ch = (char) (number % (91 - 48)) + 48;
+ if (ch >= 58 && ch <= 64) {
+ ch = 65;
+ }
+ seed[counter] = ch;
+ }
+ seed[counter] = '\0';
+
+ return seed;
}
/**
* Generates an execution key for the fuzzer.
*
-* \param runSeed The run seed to use
-* \param suiteName The name of the test suite
-* \param testName The name of the test
-* \param iteration The iteration count
+* \param runSeed The run seed to use
+* \param suiteName The name of the test suite
+* \param testName The name of the test
+* \param iteration The iteration count
*
* \returns The generated execution key to initialize the fuzzer with.
*
@@ -99,61 +99,61 @@ SDLTest_GenerateRunSeed(const int length)
Uint64
SDLTest_GenerateExecKey(char *runSeed, char *suiteName, char *testName, int iteration)
{
- SDLTest_Md5Context md5Context;
- Uint64 *keys;
- char iterationString[16];
- Uint32 runSeedLength;
- Uint32 suiteNameLength;
- Uint32 testNameLength;
- Uint32 iterationStringLength;
- Uint32 entireStringLength;
- char *buffer;
-
- if (runSeed == NULL || SDL_strlen(runSeed)==0) {
- SDLTest_LogError("Invalid runSeed string.");
- return -1;
- }
-
- if (suiteName == NULL || SDL_strlen(suiteName)==0) {
- SDLTest_LogError("Invalid suiteName string.");
- return -1;
- }
-
- if (testName == NULL || SDL_strlen(testName)==0) {
- SDLTest_LogError("Invalid testName string.");
- return -1;
- }
-
- if (iteration <= 0) {
- SDLTest_LogError("Invalid iteration count.");
- return -1;
- }
-
- /* Convert iteration number into a string */
- SDL_memset(iterationString, 0, sizeof(iterationString));
- SDL_snprintf(iterationString, sizeof(iterationString) - 1, "%d", iteration);
-
- /* Combine the parameters into single string */
- runSeedLength = SDL_strlen(runSeed);
- suiteNameLength = SDL_strlen(suiteName);
- testNameLength = SDL_strlen(testName);
- iterationStringLength = SDL_strlen(iterationString);
- entireStringLength = runSeedLength + suiteNameLength + testNameLength + iterationStringLength + 1;
- buffer = (char *)SDL_malloc(entireStringLength);
- if (buffer == NULL) {
- SDLTest_LogError("SDL_malloc failed to allocate buffer for execKey generation.");
- return 0;
- }
- SDL_snprintf(buffer, entireStringLength, "%s%s%s%d", runSeed, suiteName, testName, iteration);
-
- /* Hash string and use half of the digest as 64bit exec key */
- SDLTest_Md5Init(&md5Context);
- SDLTest_Md5Update(&md5Context, (unsigned char *)buffer, entireStringLength);
- SDLTest_Md5Final(&md5Context);
- SDL_free(buffer);
- keys = (Uint64 *)md5Context.digest;
-
- return keys[0];
+ SDLTest_Md5Context md5Context;
+ Uint64 *keys;
+ char iterationString[16];
+ Uint32 runSeedLength;
+ Uint32 suiteNameLength;
+ Uint32 testNameLength;
+ Uint32 iterationStringLength;
+ Uint32 entireStringLength;
+ char *buffer;
+
+ if (runSeed == NULL || SDL_strlen(runSeed)==0) {
+ SDLTest_LogError("Invalid runSeed string.");
+ return -1;
+ }
+
+ if (suiteName == NULL || SDL_strlen(suiteName)==0) {
+ SDLTest_LogError("Invalid suiteName string.");
+ return -1;
+ }
+
+ if (testName == NULL || SDL_strlen(testName)==0) {
+ SDLTest_LogError("Invalid testName string.");
+ return -1;
+ }
+
+ if (iteration <= 0) {
+ SDLTest_LogError("Invalid iteration count.");
+ return -1;
+ }
+
+ /* Convert iteration number into a string */
+ SDL_memset(iterationString, 0, sizeof(iterationString));
+ SDL_snprintf(iterationString, sizeof(iterationString) - 1, "%d", iteration);
+
+ /* Combine the parameters into single string */
+ runSeedLength = SDL_strlen(runSeed);
+ suiteNameLength = SDL_strlen(suiteName);
+ testNameLength = SDL_strlen(testName);
+ iterationStringLength = SDL_strlen(iterationString);
+ entireStringLength = runSeedLength + suiteNameLength + testNameLength + iterationStringLength + 1;
+ buffer = (char *)SDL_malloc(entireStringLength);
+ if (buffer == NULL) {
+ SDLTest_LogError("SDL_malloc failed to allocate buffer for execKey generation.");
+ return 0;
+ }
+ SDL_snprintf(buffer, entireStringLength, "%s%s%s%d", runSeed, suiteName, testName, iteration);
+
+ /* Hash string and use half of the digest as 64bit exec key */
+ SDLTest_Md5Init(&md5Context);
+ SDLTest_Md5Update(&md5Context, (unsigned char *)buffer, entireStringLength);
+ SDLTest_Md5Final(&md5Context);
+ SDL_free(buffer);
+ keys = (Uint64 *)md5Context.digest;
+
+ return keys[0];
}
/**
@@ -163,52 +163,52 @@ SDLTest_GenerateExecKey(char *runSeed, char *suiteName, char *testName, int iter
*
* \param timeout Timeout interval in seconds.
* \param callback Function that will be called after timeout has elapsed.
-*
+*
* \return Timer id or -1 on failure.
*/
SDL_TimerID
SDLTest_SetTestTimeout(int timeout, void (*callback)())
{
- Uint32 timeoutInMilliseconds;
- SDL_TimerID timerID;
-
- if (callback == NULL) {
- SDLTest_LogError("Timeout callback can't be NULL");
- return -1;
- }
-
- if (timeout < 0) {
- SDLTest_LogError("Timeout value must be bigger than zero.");
- return -1;
- }
-
- /* Init SDL timer if not initialized before */
- if (SDL_WasInit(SDL_INIT_TIMER) == 0) {
- if (SDL_InitSubSystem(SDL_INIT_TIMER)) {
- SDLTest_LogError("Failed to init timer subsystem: %s", SDL_GetError());
- return -1;
- }
- }
-
- /* Set timer */
- timeoutInMilliseconds = timeout * 1000;
- timerID = SDL_AddTimer(timeoutInMilliseconds, (SDL_TimerCallback)callback, 0x0);
- if (timerID == 0) {
- SDLTest_LogError("Creation of SDL timer failed: %s", SDL_GetError());
- return -1;
- }
-
- return timerID;
+ Uint32 timeoutInMilliseconds;
+ SDL_TimerID timerID;
+
+ if (callback == NULL) {
+ SDLTest_LogError("Timeout callback can't be NULL");
+ return -1;
+ }
+
+ if (timeout < 0) {
+ SDLTest_LogError("Timeout value must be bigger than zero.");
+ return -1;
+ }
+
+ /* Init SDL timer if not initialized before */
+ if (SDL_WasInit(SDL_INIT_TIMER) == 0) {
+ if (SDL_InitSubSystem(SDL_INIT_TIMER)) {
+ SDLTest_LogError("Failed to init timer subsystem: %s", SDL_GetError());
+ return -1;
+ }
+ }
+
+ /* Set timer */
+ timeoutInMilliseconds = timeout * 1000;
+ timerID = SDL_AddTimer(timeoutInMilliseconds, (SDL_TimerCallback)callback, 0x0);
+ if (timerID == 0) {
+ SDLTest_LogError("Creation of SDL timer failed: %s", SDL_GetError());
+ return -1;
+ }
+
+ return timerID;
}
/**
* \brief Timeout handler. Aborts test run and exits harness process.
*/
void
- SDLTest_BailOut()
+ SDLTest_BailOut()
{
- SDLTest_LogError("TestCaseTimeout timer expired. Aborting test run.");
- exit(TEST_ABORTED); /* bail out from the test */
+ SDLTest_LogError("TestCaseTimeout timer expired. Aborting test run.");
+ exit(TEST_ABORTED); /* bail out from the test */
}
/**
@@ -223,127 +223,127 @@ void
int
SDLTest_RunTest(SDLTest_TestSuiteReference *testSuite, SDLTest_TestCaseReference *testCase, Uint64 execKey)
{
- SDL_TimerID timer = 0;
- int testCaseResult = 0;
- int testResult = 0;
- int fuzzerCount;
-
- if (testSuite==NULL || testCase==NULL || testSuite->name==NULL || testCase->name==NULL)
- {
- SDLTest_LogError("Setup failure: testSuite or testCase references NULL");
- return TEST_RESULT_SETUP_FAILURE;
- }
-
- if (!testCase->enabled)
- {
- SDLTest_Log((char *)SDLTest_FinalResultFormat, "Test", testCase->name, "Skipped (Disabled)");
- return TEST_RESULT_SKIPPED;
- }
-
-
- /* Initialize fuzzer */
- SDLTest_FuzzerInit(execKey);
-
- /* Reset assert tracker */
- SDLTest_ResetAssertSummary();
-
- /* Set timeout timer */
- timer = SDLTest_SetTestTimeout(SDLTest_TestCaseTimeout, SDLTest_BailOut);
-
- /* Maybe run suite initalizer function */
- if (testSuite->testSetUp) {
- testSuite->testSetUp(0x0);
- if (SDLTest_AssertSummaryToTestResult() == TEST_RESULT_FAILED) {
- SDLTest_LogError((char *)SDLTest_FinalResultFormat, "Suite Setup", testSuite->name, "Failed");
- return TEST_RESULT_SETUP_FAILURE;
- }
- }
-
- /* Run test case function */
- testCaseResult = testCase->testCase(0x0);
-
- /* Convert test execution result into harness result */
- if (testCaseResult == TEST_SKIPPED) {
- /* Test was programatically skipped */
- testResult = TEST_RESULT_SKIPPED;
- } else if (testCaseResult == TEST_STARTED) {
- /* Test did not return a TEST_COMPLETED value; assume it failed */
- testResult = TEST_RESULT_FAILED;
- } else if (testCaseResult == TEST_ABORTED) {
- /* Test was aborted early; assume it failed */
- testResult = TEST_RESULT_FAILED;
- } else {
- /* Perform failure analysis based on asserts */
- testResult = SDLTest_AssertSummaryToTestResult();
- }
-
- /* Maybe run suite cleanup function (ignore failed asserts) */
- if (testSuite->testTearDown) {
- testSuite->testTearDown(0x0);
- }
-
- /* Cancel timeout timer */
- if (timer) {
- SDL_RemoveTimer(timer);
- }
-
- /* Report on asserts and fuzzer usage */
- fuzzerCount = SDLTest_GetFuzzerInvocationCount();
- if (fuzzerCount > 0) {
- SDLTest_Log("Fuzzer invocations: %d", fuzzerCount);
- }
-
- /* Final log based on test execution result */
- if (testCaseResult == TEST_SKIPPED) {
- /* Test was programatically skipped */
- SDLTest_Log((char *)SDLTest_FinalResultFormat, "Test", testCase->name, "Skipped (Programmatically)");
- } else if (testCaseResult == TEST_STARTED) {
- /* Test did not return a TEST_COMPLETED value; assume it failed */
- SDLTest_LogError((char *)SDLTest_FinalResultFormat, "Test", testCase->name, "Failed (test started, but did not return TEST_COMPLETED)");
- } else if (testCaseResult == TEST_ABORTED) {
- /* Test was aborted early; assume it failed */
- SDLTest_LogError((char *)SDLTest_FinalResultFormat, "Test", testCase->name, "Failed (Aborted)");
- } else {
- SDLTest_LogAssertSummary();
- }
-
- return testResult;
+ SDL_TimerID timer = 0;
+ int testCaseResult = 0;
+ int testResult = 0;
+ int fuzzerCount;
+
+ if (testSuite==NULL || testCase==NULL || testSuite->name==NULL || testCase->name==NULL)
+ {
+ SDLTest_LogError("Setup failure: testSuite or testCase references NULL");
+ return TEST_RESULT_SETUP_FAILURE;
+ }
+
+ if (!testCase->enabled)
+ {
+ SDLTest_Log((char *)SDLTest_FinalResultFormat, "Test", testCase->name, "Skipped (Disabled)");
+ return TEST_RESULT_SKIPPED;
+ }
+
+
+ /* Initialize fuzzer */
+ SDLTest_FuzzerInit(execKey);
+
+ /* Reset assert tracker */
+ SDLTest_ResetAssertSummary();
+
+ /* Set timeout timer */
+ timer = SDLTest_SetTestTimeout(SDLTest_TestCaseTimeout, SDLTest_BailOut);
+
+ /* Maybe run suite initalizer function */
+ if (testSuite->testSetUp) {
+ testSuite->testSetUp(0x0);
+ if (SDLTest_AssertSummaryToTestResult() == TEST_RESULT_FAILED) {
+ SDLTest_LogError((char *)SDLTest_FinalResultFormat, "Suite Setup", testSuite->name, "Failed");
+ return TEST_RESULT_SETUP_FAILURE;
+ }
+ }
+
+ /* Run test case function */
+ testCaseResult = testCase->testCase(0x0);
+
+ /* Convert test execution result into harness result */
+ if (testCaseResult == TEST_SKIPPED) {
+ /* Test was programatically skipped */
+ testResult = TEST_RESULT_SKIPPED;
+ } else if (testCaseResult == TEST_STARTED) {
+ /* Test did not return a TEST_COMPLETED value; assume it failed */
+ testResult = TEST_RESULT_FAILED;
+ } else if (testCaseResult == TEST_ABORTED) {
+ /* Test was aborted early; assume it failed */
+ testResult = TEST_RESULT_FAILED;
+ } else {
+ /* Perform failure analysis based on asserts */
+ testResult = SDLTest_AssertSummaryToTestResult();
+ }
+
+ /* Maybe run suite cleanup function (ignore failed asserts) */
+ if (testSuite->testTearDown) {
+ testSuite->testTearDown(0x0);
+ }
+
+ /* Cancel timeout timer */
+ if (timer) {
+ SDL_RemoveTimer(timer);
+ }
+
+ /* Report on asserts and fuzzer usage */
+ fuzzerCount = SDLTest_GetFuzzerInvocationCount();
+ if (fuzzerCount > 0) {
+ SDLTest_Log("Fuzzer invocations: %d", fuzzerCount);
+ }
+
+ /* Final log based on test execution result */
+ if (testCaseResult == TEST_SKIPPED) {
+ /* Test was programatically skipped */
+ SDLTest_Log((char *)SDLTest_FinalResultFormat, "Test", testCase->name, "Skipped (Programmatically)");
+ } else if (testCaseResult == TEST_STARTED) {
+ /* Test did not return a TEST_COMPLETED value; assume it failed */
+ SDLTest_LogError((char *)SDLTest_FinalResultFormat, "Test", testCase->name, "Failed (test started, but did not return TEST_COMPLETED)");
+ } else if (testCaseResult == TEST_ABORTED) {
+ /* Test was aborted early; assume it failed */
+ SDLTest_LogError((char *)SDLTest_FinalResultFormat, "Test", testCase->name, "Failed (Aborted)");
+ } else {
+ SDLTest_LogAssertSummary();
+ }
+
+ return testResult;
}
/* Prints summary of all suites/tests contained in the given reference */
void SDLTest_LogTestSuiteSummary(SDLTest_TestSuiteReference *testSuites)
{
- int suiteCounter;
- int testCounter;
- SDLTest_TestSuiteReference *testSuite;
- SDLTest_TestCaseReference *testCase;
-
- /* Loop over all suites */
- suiteCounter = 0;
- while(&testSuites[suiteCounter]) {
- testSuite=&testSuites[suiteCounter];
- suiteCounter++;
- SDLTest_Log("Test Suite %i - %s\n", suiteCounter,
- (testSuite->name) ? testSuite->name : SDLTest_InvalidNameFormat);
-
- /* Loop over all test cases */
- testCounter = 0;
- while(testSuite->testCases[testCounter])
- {
- testCase=(SDLTest_TestCaseReference *)testSuite->testCases[testCounter];
- testCounter++;
- SDLTest_Log(" Test Case %i - %s: %s", testCounter,
- (testCase->name) ? testCase->name : SDLTest_InvalidNameFormat,
- (testCase->description) ? testCase->description : SDLTest_InvalidNameFormat);
- }
- }
+ int suiteCounter;
+ int testCounter;
+ SDLTest_TestSuiteReference *testSuite;
+ SDLTest_TestCaseReference *testCase;
+
+ /* Loop over all suites */
+ suiteCounter = 0;
+ while(&testSuites[suiteCounter]) {
+ testSuite=&testSuites[suiteCounter];
+ suiteCounter++;
+ SDLTest_Log("Test Suite %i - %s\n", suiteCounter,
+ (testSuite->name) ? testSuite->name : SDLTest_InvalidNameFormat);
+
+ /* Loop over all test cases */
+ testCounter = 0;
+ while(testSuite->testCases[testCounter])
+ {
+ testCase=(SDLTest_TestCaseReference *)testSuite->testCases[testCounter];
+ testCounter++;
+ SDLTest_Log(" Test Case %i - %s: %s", testCounter,
+ (testCase->name) ? testCase->name : SDLTest_InvalidNameFormat,
+ (testCase->description) ? testCase->description : SDLTest_InvalidNameFormat);
+ }
+ }
}
/* Gets a timer value in seconds */
float GetClock()
{
- float currentClock = (float)clock();
- return currentClock / (float)CLOCKS_PER_SEC;
+ float currentClock = (float)clock();
+ return currentClock / (float)CLOCKS_PER_SEC;
}
/**
@@ -362,274 +362,274 @@ float GetClock()
*/
int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *userRunSeed, Uint64 userExecKey, const char *filter, int testIterations)
{
- int suiteCounter;
- int testCounter;
- int iterationCounter;
- SDLTest_TestSuiteReference *testSuite;
- SDLTest_TestCaseReference *testCase;
- const char *runSeed = NULL;
- char *currentSuiteName;
- char *currentTestName;
- Uint64 execKey;
- float runStartSeconds;
- float suiteStartSeconds;
- float testStartSeconds;
- float runEndSeconds;
- float suiteEndSeconds;
- float testEndSeconds;
- float runtime;
- int suiteFilter = 0;
- char *suiteFilterName = NULL;
- int testFilter = 0;
- char *testFilterName = NULL;
- int testResult = 0;
- int runResult = 0;
- Uint32 totalTestFailedCount = 0;
- Uint32 totalTestPassedCount = 0;
- Uint32 totalTestSkippedCount = 0;
- Uint32 testFailedCount = 0;
- Uint32 testPassedCount = 0;
- Uint32 testSkippedCount = 0;
- Uint32 countSum = 0;
- char *logFormat = (char *)SDLTest_LogSummaryFormat;
-
- /* Sanitize test iterations */
- if (testIterations < 1) {
- testIterations = 1;
- }
-
- /* Generate run see if we don't have one already */
- if (userRunSeed == NULL || SDL_strlen(userRunSeed) == 0) {
- runSeed = SDLTest_GenerateRunSeed(16);
- if (runSeed == NULL) {
- SDLTest_LogError("Generating a random seed failed");
- return 2;
- }
- } else {
- runSeed = userRunSeed;
- }
-
-
- /* Reset per-run counters */
- totalTestFailedCount = 0;
- totalTestPassedCount = 0;
- totalTestSkippedCount = 0;
-
- /* Take time - run start */
- runStartSeconds = GetClock();
-
- /* Log run with fuzzer parameters */
- SDLTest_Log("::::: Test Run /w seed '%s' started\n", runSeed);
-
- /* Initialize filtering */
- if (filter != NULL && SDL_strlen(filter) > 0) {
- /* Loop over all suites to check if we have a filter match */
- suiteCounter = 0;
- while (testSuites[suiteCounter] && suiteFilter == 0) {
- testSuite=(SDLTest_TestSuiteReference *)testSuites[suiteCounter];
- suiteCounter++;
- if (testSuite->name != NULL && SDL_strcmp(filter, testSuite->name) == 0) {
- /* Matched a suite name */
- suiteFilter = 1;
- suiteFilterName = testSuite->name;
- SDLTest_Log("Filtering: running only suite '%s'", suiteFilterName);
- break;
- }
-
- /* Within each suite, loop over all test cases to check if we have a filter match */
- testCounter = 0;
- while (testSuite->testCases[testCounter] && testFilter == 0)
- {
- testCase=(SDLTest_TestCaseReference *)testSuite->testCases[testCounter];
- testCounter++;
- if (testCase->name != NULL && SDL_strcmp(filter, testCase->name) == 0) {
- /* Matched a test name */
- suiteFilter = 1;
- suiteFilterName = testSuite->name;
- testFilter = 1;
- testFilterName = testCase->name;
- SDLTest_Log("Filtering: running only test '%s' in suite '%s'", testFilterName, suiteFilterName);
- break;
- }
- }
- }
-
- if (suiteFilter == 0 && testFilter == 0) {
- SDLTest_LogError("Filter '%s' did not match any test suite/case.", filter);
- SDLTest_Log("Exit code: 2");
- return 2;
- }
- }
-
- /* Loop over all suites */
- suiteCounter = 0;
- while(testSuites[suiteCounter]) {
- testSuite=(SDLTest_TestSuiteReference *)testSuites[suiteCounter];
- currentSuiteName = (char *)((testSuite->name) ? testSuite->name : SDLTest_InvalidNameFormat);
- suiteCounter++;
-
- /* Filter suite if flag set and we have a name */
- if (suiteFilter == 1 && suiteFilterName != NULL && testSuite->name != NULL &&
- SDL_strcmp(suiteFilterName, testSuite->name) != 0) {
- /* Skip suite */
- SDLTest_Log("===== Test Suite %i: '%s' skipped\n",
- suiteCounter,
- currentSuiteName);
- } else {
-
- /* Reset per-suite counters */
- testFailedCount = 0;
- testPassedCount = 0;
- testSkippedCount = 0;
-
- /* Take time - suite start */
- suiteStartSeconds = GetClock();
-
- /* Log suite started */
- SDLTest_Log("===== Test Suite %i: '%s' started\n",
- suiteCounter,
- currentSuiteName);
-
- /* Loop over all test cases */
- testCounter = 0;
- while(testSuite->testCases[testCounter])
- {
- testCase=(SDLTest_TestCaseReference *)testSuite->testCases[testCounter];
- currentTestName = (char *)((testCase->name) ? testCase->name : SDLTest_InvalidNameFormat);
- testCounter++;
-
- /* Filter tests if flag set and we have a name */
- if (testFilter == 1 && testFilterName != NULL && testCase->name != NULL &&
- SDL_strcmp(testFilterName, testCase->name) != 0) {
- /* Skip test */
- SDLTest_Log("===== Test Case %i.%i: '%s' skipped\n",
- suiteCounter,
- testCounter,
- currentTestName);
- } else {
- /* Override 'disabled' flag if we specified a test filter (i.e. force run for debugging) */
- if (testFilter == 1 && !testCase->enabled) {
- SDLTest_Log("Force run of disabled test since test filter was set");
- testCase->enabled = 1;
- }
-
- /* Take time - test start */
- testStartSeconds = GetClock();
-
- /* Log test started */
- SDLTest_Log("----- Test Case %i.%i: '%s' started",
- suiteCounter,
- testCounter,
- currentTestName);
- if (testCase->description != NULL && SDL_strlen(testCase->description)>0) {
- SDLTest_Log("Test Description: '%s'",
- (testCase->description) ? testCase->description : SDLTest_InvalidNameFormat);
- }
-
- /* Loop over all iterations */
- iterationCounter = 0;
- while(iterationCounter < testIterations)
- {
- iterationCounter++;
-
- if (userExecKey != 0) {
- execKey = userExecKey;
- } else {
- execKey = SDLTest_GenerateExecKey((char *)runSeed, testSuite->name, testCase->name, iterationCounter);
- }
-
- SDLTest_Log("Test Iteration %i: execKey %llu", iterationCounter, execKey);
- testResult = SDLTest_RunTest(testSuite, testCase, execKey);
-
- if (testResult == TEST_RESULT_PASSED) {
- testPassedCount++;
- totalTestPassedCount++;
- } else if (testResult == TEST_RESULT_SKIPPED) {
- testSkippedCount++;
- totalTestSkippedCount++;
- } else {
- testFailedCount++;
- totalTestFailedCount++;
- }
- }
-
- /* Take time - test end */
- testEndSeconds = GetClock();
- runtime = testEndSeconds - testStartSeconds;
- if (runtime < 0.0f) runtime = 0.0f;
-
- if (testIterations > 1) {
- /* Log test runtime */
- SDLTest_Log("Runtime of %i iterations: %.1f sec", testIterations, runtime);
- SDLTest_Log("Average Test runtime: %.5f sec", runtime / (float)testIterations);
- } else {
- /* Log test runtime */
- SDLTest_Log("Total Test runtime: %.1f sec", runtime);
- }
-
- /* Log final test result */
- switch (testResult) {
- case TEST_RESULT_PASSED:
- SDLTest_Log((char *)SDLTest_FinalResultFormat, "Test", currentTestName, "Passed");
- break;
- case TEST_RESULT_FAILED:
- SDLTest_LogError((char *)SDLTest_FinalResultFormat, "Test", currentTestName, "Failed");
- break;
- case TEST_RESULT_NO_ASSERT:
- SDLTest_LogError((char *)SDLTest_FinalResultFormat,"Test", currentTestName, "No Asserts");
- break;
- }
-
- }
- }
-
- /* Take time - suite end */
- suiteEndSeconds = GetClock();
- runtime = suiteEndSeconds - suiteStartSeconds;
- if (runtime < 0.0f) runtime = 0.0f;
-
- /* Log suite runtime */
- SDLTest_Log("Total Suite runtime: %.1f sec", runtime);
-
- /* Log summary and final Suite result */
- countSum = testPassedCount + testFailedCount + testSkippedCount;
- if (testFailedCount == 0)
- {
- SDLTest_Log(logFormat, "Suite", countSum, testPassedCount, testFailedCount, testSkippedCount);
- SDLTest_Log((char *)SDLTest_FinalResultFormat, "Suite", currentSuiteName, "Passed");
- }
- else
- {
- SDLTest_LogError(logFormat, "Suite", countSum, testPassedCount, testFailedCount, testSkippedCount);
- SDLTest_LogError((char *)SDLTest_FinalResultFormat, "Suite", currentSuiteName, "Failed");
- }
-
- }
- }
-
- /* Take time - run end */
- runEndSeconds = GetClock();
- runtime = runEndSeconds - runStartSeconds;
- if (runtime < 0.0f) runtime = 0.0f;
-
- /* Log total runtime */
- SDLTest_Log("Total Run runtime: %.1f sec", runtime);
-
- /* Log summary and final run result */
- countSum = totalTestPassedCount + totalTestFailedCount + totalTestSkippedCount;
- if (totalTestFailedCount == 0)
- {
- runResult = 0;
- SDLTest_Log(logFormat, "Run", countSum, totalTestPassedCount, totalTestFailedCount, totalTestSkippedCount);
- SDLTest_Log((char *)SDLTest_FinalResultFormat, "Run /w seed", runSeed, "Passed");
- }
- else
- {
- runResult = 1;
- SDLTest_LogError(logFormat, "Run", countSum, totalTestPassedCount, totalTestFailedCount, totalTestSkippedCount);
- SDLTest_LogError((char *)SDLTest_FinalResultFormat, "Run /w seed", runSeed, "Failed");
- }
-
- SDLTest_Log("Exit code: %d", runResult);
- return runResult;
+ int suiteCounter;
+ int testCounter;
+ int iterationCounter;
+ SDLTest_TestSuiteReference *testSuite;
+ SDLTest_TestCaseReference *testCase;
+ const char *runSeed = NULL;
+ char *currentSuiteName;
+ char *currentTestName;
+ Uint64 execKey;
+ float runStartSeconds;
+ float suiteStartSeconds;
+ float testStartSeconds;
+ float runEndSeconds;
+ float suiteEndSeconds;
+ float testEndSeconds;
+ float runtime;
+ int suiteFilter = 0;
+ char *suiteFilterName = NULL;
+ int testFilter = 0;
+ char *testFilterName = NULL;
+ int testResult = 0;
+ int runResult = 0;
+ Uint32 totalTestFailedCount = 0;
+ Uint32 totalTestPassedCount = 0;
+ Uint32 totalTestSkippedCount = 0;
+ Uint32 testFailedCount = 0;
+ Uint32 testPassedCount = 0;
+ Uint32 testSkippedCount = 0;
+ Uint32 countSum = 0;
+ char *logFormat = (char *)SDLTest_LogSummaryFormat;
+
+ /* Sanitize test iterations */
+ if (testIterations < 1) {
+ testIterations = 1;
+ }
+
+ /* Generate run see if we don't have one already */
+ if (userRunSeed == NULL || SDL_strlen(userRunSeed) == 0) {
+ runSeed = SDLTest_GenerateRunSeed(16);
+ if (runSeed == NULL) {
+ SDLTest_LogError("Generating a random seed failed");
+ return 2;
+ }
+ } else {
+ runSeed = userRunSeed;
+ }
+
+
+ /* Reset per-run counters */
+ totalTestFailedCount = 0;
+ totalTestPassedCount = 0;
+ totalTestSkippedCount = 0;
+
+ /* Take time - run start */
+ runStartSeconds = GetClock();
+
+ /* Log run with fuzzer parameters */
+ SDLTest_Log("::::: Test Run /w seed '%s' started\n", runSeed);
+
+ /* Initialize filtering */
+ if (filter != NULL && SDL_strlen(filter) > 0) {
+ /* Loop over all suites to check if we have a filter match */
+ suiteCounter = 0;
+ while (testSuites[suiteCounter] && suiteFilter == 0) {
+ testSuite=(SDLTest_TestSuiteReference *)testSuites[suiteCounter];
+ suiteCounter++;
+ if (testSuite->name != NULL && SDL_strcmp(filter, testSuite->name) == 0) {
+ /* Matched a suite name */
+ suiteFilter = 1;
+ suiteFilterName = testSuite->name;
+ SDLTest_Log("Filtering: running only suite '%s'", suiteFilterName);
+ break;
+ }
+
+ /* Within each suite, loop over all test cases to check if we have a filter match */
+ testCounter = 0;
+ while (testSuite->testCases[testCounter] && testFilter == 0)
+ {
+ testCase=(SDLTest_TestCaseReference *)testSuite->testCases[testCounter];
+ testCounter++;
+ if (testCase->name != NULL && SDL_strcmp(filter, testCase->name) == 0) {
+ /* Matched a test name */
+ suiteFilter = 1;
+ suiteFilterName = testSuite->name;
+ testFilter = 1;
+ testFilterName = testCase->name;
+ SDLTest_Log("Filtering: running only test '%s' in suite '%s'", testFilterName, suiteFilterName);
+ break;
+ }
+ }
+ }
+
+ if (suiteFilter == 0 && testFilter == 0) {
+ SDLTest_LogError("Filter '%s' did not match any test suite/case.", filter);
+ SDLTest_Log("Exit code: 2");
+ return 2;
+ }
+ }
+
+ /* Loop over all suites */
+ suiteCounter = 0;
+ while(testSuites[suiteCounter]) {
+ testSuite=(SDLTest_TestSuiteReference *)testSuites[suiteCounter];
+ currentSuiteName = (char *)((testSuite->name) ? testSuite->name : SDLTest_InvalidNameFormat);
+ suiteCounter++;
+
+ /* Filter suite if flag set and we have a name */
+ if (suiteFilter == 1 && suiteFilterName != NULL && testSuite->name != NULL &&
+ SDL_strcmp(suiteFilterName, testSuite->name) != 0) {
+ /* Skip suite */
+ SDLTest_Log("===== Test Suite %i: '%s' skipped\n",
+ suiteCounter,
+ currentSuiteName);
+ } else {
+
+ /* Reset per-suite counters */
+ testFailedCount = 0;
+ testPassedCount = 0;
+ testSkippedCount = 0;
+
+ /* Take time - suite start */
+ suiteStartSeconds = GetClock();
+
+ /* Log suite started */
+ SDLTest_Log("===== Test Suite %i: '%s' started\n",
+ suiteCounter,
+ currentSuiteName);
+
+ /* Loop over all test cases */
+ testCounter = 0;
+ while(testSuite->testCases[testCounter])
+ {
+ testCase=(SDLTest_TestCaseReference *)testSuite->testCases[testCounter];
+ currentTestName = (char *)((testCase->name) ? testCase->name : SDLTest_InvalidNameFormat);
+ testCounter++;
+
+ /* Filter tests if flag set and we have a name */
+ if (testFilter == 1 && testFilterName != NULL && testCase->name != NULL &&
+ SDL_strcmp(testFilterName, testCase->name) != 0) {
+ /* Skip test */
+ SDLTest_Log("===== Test Case %i.%i: '%s' skipped\n",
+ suiteCounter,
+ testCounter,
+ currentTestName);
+ } else {
+ /* Override 'disabled' flag if we specified a test filter (i.e. force run for debugging) */
+ if (testFilter == 1 && !testCase->enabled) {
+ SDLTest_Log("Force run of disabled test since test filter was set");
+ testCase->enabled = 1;
+ }
+
+ /* Take time - test start */
+ testStartSeconds = GetClock();
+
+ /* Log test started */
+ SDLTest_Log("----- Test Case %i.%i: '%s' started",
+ suiteCounter,
+ testCounter,
+ currentTestName);
+ if (testCase->description != NULL && SDL_strlen(testCase->description)>0) {
+ SDLTest_Log("Test Description: '%s'",
+ (testCase->description) ? testCase->description : SDLTest_InvalidNameFormat);
+ }
+
+ /* Loop over all iterations */
+ iterationCounter = 0;
+ while(iterationCounter < testIterations)
+ {
+ iterationCounter++;
+
+ if (userExecKey != 0) {
+ execKey = userExecKey;
+ } else {
+ execKey = SDLTest_GenerateExecKey((char *)runSeed, testSuite->name, testCase->name, iterationCounter);
+ }
+
+ SDLTest_Log("Test Iteration %i: execKey %llu", iterationCounter, execKey);
+ testResult = SDLTest_RunTest(testSuite, testCase, execKey);
+
+ if (testResult == TEST_RESULT_PASSED) {
+ testPassedCount++;
+ totalTestPassedCount++;
+ } else if (testResult == TEST_RESULT_SKIPPED) {
+ testSkippedCount++;
+ totalTestSkippedCount++;
+ } else {
+ testFailedCount++;
+ totalTestFailedCount++;
+ }
+ }
+
+ /* Take time - test end */
+ testEndSeconds = GetClock();
+ runtime = testEndSeconds - testStartSeconds;
+ if (runtime < 0.0f) runtime = 0.0f;
+
+ if (testIterations > 1) {
+ /* Log test runtime */
+ SDLTest_Log("Runtime of %i iterations: %.1f sec", testIterations, runtime);
+ SDLTest_Log("Average Test runtime: %.5f sec", runtime / (float)testIterations);
+ } else {
+ /* Log test runtime */
+ SDLTest_Log("Total Test runtime: %.1f sec", runtime);
+ }
+
+ /* Log final test result */
+ switch (testResult) {
+ case TEST_RESULT_PASSED:
+ SDLTest_Log((char *)SDLTest_FinalResultFormat, "Test", currentTestName, "Passed");
+ break;
+ case TEST_RESULT_FAILED:
+ SDLTest_LogError((char *)SDLTest_FinalResultFormat, "Test", currentTestName, "Failed");
+ break;
+ case TEST_RESULT_NO_ASSERT:
+ SDLTest_LogError((char *)SDLTest_FinalResultFormat,"Test", currentTestName, "No Asserts");
+ break;
+ }
+
+ }
+ }
+
+ /* Take time - suite end */
+ suiteEndSeconds = GetClock();
+ runtime = suiteEndSeconds - suiteStartSeconds;
+ if (runtime < 0.0f) runtime = 0.0f;
+
+ /* Log suite runtime */
+ SDLTest_Log("Total Suite runtime: %.1f sec", runtime);
+
+ /* Log summary and final Suite result */
+ countSum = testPassedCount + testFailedCount + testSkippedCount;
+ if (testFailedCount == 0)
+ {
+ SDLTest_Log(logFormat, "Suite", countSum, testPassedCount, testFailedCount, testSkippedCount);
+ SDLTest_Log((char *)SDLTest_FinalResultFormat, "Suite", currentSuiteName, "Passed");
+ }
+ else
+ {
+ SDLTest_LogError(logFormat, "Suite", countSum, testPassedCount, testFailedCount, testSkippedCount);
+ SDLTest_LogError((char *)SDLTest_FinalResultFormat, "Suite", currentSuiteName, "Failed");
+ }
+
+ }
+ }
+
+ /* Take time - run end */
+ runEndSeconds = GetClock();
+ runtime = runEndSeconds - runStartSeconds;
+ if (runtime < 0.0f) runtime = 0.0f;
+
+ /* Log total runtime */
+ SDLTest_Log("Total Run runtime: %.1f sec", runtime);
+
+ /* Log summary and final run result */
+ countSum = totalTestPassedCount + totalTestFailedCount + totalTestSkippedCount;
+ if (totalTestFailedCount == 0)
+ {
+ runResult = 0;
+ SDLTest_Log(logFormat, "Run", countSum, totalTestPassedCount, totalTestFailedCount, totalTestSkippedCount);
+ SDLTest_Log((char *)SDLTest_FinalResultFormat, "Run /w seed", runSeed, "Passed");
+ }
+ else
+ {
+ runResult = 1;
+ SDLTest_LogError(logFormat, "Run", countSum, totalTestPassedCount, totalTestFailedCount, totalTestSkippedCount);
+ SDLTest_LogError((char *)SDLTest_FinalResultFormat, "Run /w seed", runSeed, "Failed");
+ }
+
+ SDLTest_Log("Exit code: %d", runResult);
+ return runResult;
}
diff --git a/src/test/SDL_test_imageBlit.c b/src/test/SDL_test_imageBlit.c
index 2608e4fa89..d1d12952c2 100644
--- a/src/test/SDL_test_imageBlit.c
+++ b/src/test/SDL_test_imageBlit.c
@@ -540,11 +540,11 @@ const SDLTest_SurfaceImage_t SDLTest_imageBlit = {
*/
SDL_Surface *SDLTest_ImageBlit()
{
- SDL_Surface *surface = SDL_CreateRGBSurfaceFrom(
+ SDL_Surface *surface = SDL_CreateRGBSurfaceFrom(
(void*)SDLTest_imageBlit.pixel_data,
- SDLTest_imageBlit.width,
- SDLTest_imageBlit.height,
- SDLTest_imageBlit.bytes_per_pixel * 8,
+ SDLTest_imageBlit.width,
+ SDLTest_imageBlit.height,
+ SDLTest_imageBlit.bytes_per_pixel * 8,
SDLTest_imageBlit.width * SDLTest_imageBlit.bytes_per_pixel,
#if (SDL_BYTEORDER == SDL_BIG_ENDIAN)
0xff000000, /* Red bit mask. */
@@ -1023,11 +1023,11 @@ const SDLTest_SurfaceImage_t SDLTest_imageBlitColor = {
*/
SDL_Surface *SDLTest_ImageBlitColor()
{
- SDL_Surface *surface = SDL_CreateRGBSurfaceFrom(
+ SDL_Surface *surface = SDL_CreateRGBSurfaceFrom(
(void*)SDLTest_imageBlitColor.pixel_data,
- SDLTest_imageBlitColor.width,
- SDLTest_imageBlitColor.height,
- SDLTest_imageBlitColor.bytes_per_pixel * 8,
+ SDLTest_imageBlitColor.width,
+ SDLTest_imageBlitColor.height,
+ SDLTest_imageBlitColor.bytes_per_pixel * 8,
SDLTest_imageBlitColor.width * SDLTest_imageBlitColor.bytes_per_pixel,
#if (SDL_BYTEORDER == SDL_BIG_ENDIAN)
0xff000000, /* Red bit mask. */
@@ -1535,10 +1535,10 @@ const SDLTest_SurfaceImage_t SDLTest_imageBlitAlpha = {
*/
SDL_Surface *SDLTest_ImageBlitAlpha()
{
- SDL_Surface *surface = SDL_CreateRGBSurfaceFrom(
+ SDL_Surface *surface = SDL_CreateRGBSurfaceFrom(
(void*)SDLTest_imageBlitAlpha.pixel_data,
- SDLTest_imageBlitAlpha.width,
- SDLTest_imageBlitAlpha.height,
+ SDLTest_imageBlitAlpha.width,
+ SDLTest_imageBlitAlpha.height,
SDLTest_imageBlitAlpha.bytes_per_pixel * 8,
SDLTest_imageBlitAlpha.width * SDLTest_imageBlitAlpha.bytes_per_pixel,
#if (SDL_BYTEORDER == SDL_BIG_ENDIAN)
diff --git a/src/test/SDL_test_imageBlitBlend.c b/src/test/SDL_test_imageBlitBlend.c
index 8a48595333..06dbfabd4a 100644
--- a/src/test/SDL_test_imageBlitBlend.c
+++ b/src/test/SDL_test_imageBlitBlend.c
@@ -580,11 +580,11 @@ const SDLTest_SurfaceImage_t SDLTest_imageBlitBlendAdd = {
*/
SDL_Surface *SDLTest_ImageBlitBlendAdd()
{
- SDL_Surface *surface = SDL_CreateRGBSurfaceFrom(
+ SDL_Surface *surface = SDL_CreateRGBSurfaceFrom(
(void*)SDLTest_imageBlitBlendAdd.pixel_data,
- SDLTest_imageBlitBlendAdd.width,
- SDLTest_imageBlitBlendAdd.height,
- SDLTest_imageBlitBlendAdd.bytes_per_pixel * 8,
+ SDLTest_imageBlitBlendAdd.width,
+ SDLTest_imageBlitBlendAdd.height,
+ SDLTest_imageBlitBlendAdd.bytes_per_pixel * 8,
SDLTest_imageBlitBlendAdd.width * SDLTest_imageBlitBlendAdd.bytes_per_pixel,
#if (SDL_BYTEORDER == SDL_BIG_ENDIAN)
0xff000000, /* Red bit mask. */
@@ -1110,11 +1110,11 @@ const SDLTest_SurfaceImage_t SDLTest_imageBlitBlend = {
*/
SDL_Surface *SDLTest_ImageBlitBlend()
{
- SDL_Surface *surface = SDL_CreateRGBSurfaceFrom(
+ SDL_Surface *surface = SDL_CreateRGBSurfaceFrom(
(void*)SDLTest_imageBlitBlend.pixel_data,
- SDLTest_imageBlitBlend.width,
- SDLTest_imageBlitBlend.height,
- SDLTest_imageBlitBlend.bytes_per_pixel * 8,
+ SDLTest_imageBlitBlend.width,
+ SDLTest_imageBlitBlend.height,
+ SDLTest_imageBlitBlend.bytes_per_pixel * 8,
SDLTest_imageBlitBlend.width * SDLTest_imageBlitBlend.bytes_per_pixel,
#if (SDL_BYTEORDER == SDL_BIG_ENDIAN)
0xff000000, /* Red bit mask. */
@@ -1540,11 +1540,11 @@ const SDLTest_SurfaceImage_t SDLTest_imageBlitBlendMod = {
*/
SDL_Surface *SDLTest_ImageBlitBlendMod()
{
- SDL_Surface *surface = SDL_CreateRGBSurfaceFrom(
+ SDL_Surface *surface = SDL_CreateRGBSurfaceFrom(
(void*)SDLTest_imageBlitBlendMod.pixel_data,
- SDLTest_imageBlitBlendMod.width,
- SDLTest_imageBlitBlendMod.height,
- SDLTest_imageBlitBlendMod.bytes_per_pixel * 8,
+ SDLTest_imageBlitBlendMod.width,
+ SDLTest_imageBlitBlendMod.height,
+ SDLTest_imageBlitBlendMod.bytes_per_pixel * 8,
SDLTest_imageBlitBlendMod.width * SDLTest_imageBlitBlendMod.bytes_per_pixel,
#if (SDL_BYTEORDER == SDL_BIG_ENDIAN)
0xff000000, /* Red bit mask. */
@@ -2353,11 +2353,11 @@ const SDLTest_SurfaceImage_t SDLTest_imageBlitBlendNone = {
*/
SDL_Surface *SDLTest_ImageBlitBlendNone()
{
- SDL_Surface *surface = SDL_CreateRGBSurfaceFrom(
+ SDL_Surface *surface = SDL_CreateRGBSurfaceFrom(
(void*)SDLTest_imageBlitBlendNone.pixel_data,
- SDLTest_imageBlitBlendNone.width,
- SDLTest_imageBlitBlendNone.height,
- SDLTest_imageBlitBlendNone.bytes_per_pixel * 8,
+ SDLTest_imageBlitBlendNone.width,
+ SDLTest_imageBlitBlendNone.height,
+ SDLTest_imageBlitBlendNone.bytes_per_pixel * 8,
SDLTest_imageBlitBlendNone.width * SDLTest_imageBlitBlendNone.bytes_per_pixel,
#if (SDL_BYTEORDER == SDL_BIG_ENDIAN)
0xff000000, /* Red bit mask. */
@@ -2821,11 +2821,11 @@ const SDLTest_SurfaceImage_t SDLTest_imageBlitBlendAll = {
*/
SDL_Surface *SDLTest_ImageBlitBlendAll()
{
- SDL_Surface *surface = SDL_CreateRGBSurfaceFrom(
+ SDL_Surface *surface = SDL_CreateRGBSurfaceFrom(
(void*)SDLTest_imageBlitBlendAll.pixel_data,
- SDLTest_imageBlitBlendAll.width,
- SDLTest_imageBlitBlendAll.height,
- SDLTest_imageBlitBlendAll.bytes_per_pixel * 8,
+ SDLTest_imageBlitBlendAll.width,
+ SDLTest_imageBlitBlendAll.height,
+ SDLTest_imageBlitBlendAll.bytes_per_pixel * 8,
SDLTest_imageBlitBlendAll.width * SDLTest_imageBlitBlendAll.bytes_per_pixel,
#if (SDL_BYTEORDER == SDL_BIG_ENDIAN)
0xff000000, /* Red bit mask. */
diff --git a/src/test/SDL_test_imageFace.c b/src/test/SDL_test_imageFace.c
index 2dd7ea762a..46c117a4f6 100644
--- a/src/test/SDL_test_imageFace.c
+++ b/src/test/SDL_test_imageFace.c
@@ -223,11 +223,11 @@ const SDLTest_SurfaceImage_t SDLTest_imageFace = {
*/
SDL_Surface *SDLTest_ImageFace()
{
- SDL_Surface *surface = SDL_CreateRGBSurfaceFrom(
+ SDL_Surface *surface = SDL_CreateRGBSurfaceFrom(
(void*)SDLTest_imageFace.pixel_data,
- SDLTest_imageFace.width,
- SDLTest_imageFace.height,
- SDLTest_imageFace.bytes_per_pixel * 8,
+ SDLTest_imageFace.width,
+ SDLTest_imageFace.height,
+ SDLTest_imageFace.bytes_per_pixel * 8,
SDLTest_imageFace.width * SDLTest_imageFace.bytes_per_pixel,
#if (SDL_BYTEORDER == SDL_BIG_ENDIAN)
0xff000000, /* Red bit mask. */
diff --git a/src/test/SDL_test_imagePrimitives.c b/src/test/SDL_test_imagePrimitives.c
index 1913538547..93b99d6922 100644
--- a/src/test/SDL_test_imagePrimitives.c
+++ b/src/test/SDL_test_imagePrimitives.c
@@ -490,11 +490,11 @@ const SDLTest_SurfaceImage_t SDLTest_imagePrimitives = {
*/
SDL_Surface *SDLTest_ImagePrimitives()
{
- SDL_Surface *surface = SDL_CreateRGBSurfaceFrom(
+ SDL_Surface *surface = SDL_CreateRGBSurfaceFrom(
(void*)SDLTest_imagePrimitives.pixel_data,
- SDLTest_imagePrimitives.width,
+ SDLTest_imagePrimitives.width,
SDLTest_imagePrimitives.height,
- SDLTest_imagePrimitives.bytes_per_pixel * 8,
+ SDLTest_imagePrimitives.bytes_per_pixel * 8,
SDLTest_imagePrimitives.width * SDLTest_imagePrimitives.bytes_per_pixel,
#if (SDL_BYTEORDER == SDL_BIG_ENDIAN)
0xff000000, /* Red bit mask. */
diff --git a/src/test/SDL_test_imagePrimitivesBlend.c b/src/test/SDL_test_imagePrimitivesBlend.c
index 705e5c9bc0..ce9adc51a9 100644
--- a/src/test/SDL_test_imagePrimitivesBlend.c
+++ b/src/test/SDL_test_imagePrimitivesBlend.c
@@ -672,11 +672,11 @@ const SDLTest_SurfaceImage_t SDLTest_imagePrimitivesBlend = {
*/
SDL_Surface *SDLTest_ImagePrimitivesBlend()
{
- SDL_Surface *surface = SDL_CreateRGBSurfaceFrom(
+ SDL_Surface *surface = SDL_CreateRGBSurfaceFrom(
(void*)SDLTest_imagePrimitivesBlend.pixel_data,
- SDLTest_imagePrimitivesBlend.width,
- SDLTest_imagePrimitivesBlend.height,
- SDLTest_imagePrimitivesBlend.bytes_per_pixel * 8,
+ SDLTest_imagePrimitivesBlend.width,
+ SDLTest_imagePrimitivesBlend.height,
+ SDLTest_imagePrimitivesBlend.bytes_per_pixel * 8,
SDLTest_imagePrimitivesBlend.width * SDLTest_imagePrimitivesBlend.bytes_per_pixel,
#if (SDL_BYTEORDER == SDL_BIG_ENDIAN)
0xff000000, /* Red bit mask. */
diff --git a/src/test/SDL_test_log.c b/src/test/SDL_test_log.c
index 4d19012dc0..d184396a30 100644
--- a/src/test/SDL_test_log.c
+++ b/src/test/SDL_test_log.c
@@ -21,11 +21,11 @@
/*
- Used by the test framework and test cases.
+ Used by the test framework and test cases.
*/
-// quiet windows compiler warnings
+/* quiet windows compiler warnings */
#define _CRT_SECURE_NO_WARNINGS
#include "SDL_config.h"
@@ -50,18 +50,18 @@
*
* \return Ascii representation of the timestamp in localtime in the format '08/23/01 14:55:02'
*/
-char *SDLTest_TimestampToString(const time_t timestamp)
+char *SDLTest_TimestampToString(const time_t timestamp)
{
- time_t copy;
- static char buffer[64];
- struct tm *local;
+ time_t copy;
+ static char buffer[64];
+ struct tm *local;
- SDL_memset(buffer, 0, sizeof(buffer));\
- copy = timestamp;
- local = localtime(&copy);
- strftime(buffer, sizeof(buffer), "%x %X", local);
+ SDL_memset(buffer, 0, sizeof(buffer));\
+ copy = timestamp;
+ local = localtime(&copy);
+ strftime(buffer, sizeof(buffer), "%x %X", local);
- return buffer;
+ return buffer;
}
/*
@@ -69,17 +69,17 @@ char *SDLTest_TimestampToString(const time_t timestamp)
*/
void SDLTest_Log(const char *fmt, ...)
{
- va_list list;
- char logMessage[SDLTEST_MAX_LOGMESSAGE_LENGTH];
+ va_list list;
+ char logMessage[SDLTEST_MAX_LOGMESSAGE_LENGTH];
- // Print log message into a buffer
- SDL_memset(logMessage, 0, SDLTEST_MAX_LOGMESSAGE_LENGTH);
- va_start(list, fmt);
- SDL_vsnprintf(logMessage, SDLTEST_MAX_LOGMESSAGE_LENGTH - 1, fmt, list);
- va_end(list);
+ /* Print log message into a buffer */
+ SDL_memset(logMessage, 0, SDLTEST_MAX_LOGMESSAGE_LENGTH);
+ va_start(list, fmt);
+ SDL_vsnprintf(logMessage, SDLTEST_MAX_LOGMESSAGE_LENGTH - 1, fmt, list);
+ va_end(list);
- // Log with timestamp and newline
- SDL_LogMessage(SDL_LOG_CATEGORY_TEST, SDL_LOG_PRIORITY_INFO, " %s: %s", SDLTest_TimestampToString(time(0)), logMessage);
+ /* Log with timestamp and newline */
+ SDL_LogMessage(SDL_LOG_CATEGORY_TEST, SDL_LOG_PRIORITY_INFO, " %s: %s", SDLTest_TimestampToString(time(0)), logMessage);
}
/*
@@ -87,15 +87,15 @@ void SDLTest_Log(const char *fmt, ...)
*/
void SDLTest_LogError(const char *fmt, ...)
{
- va_list list;
- char logMessage[SDLTEST_MAX_LOGMESSAGE_LENGTH];
+ va_list list;
+ char logMessage[SDLTEST_MAX_LOGMESSAGE_LENGTH];
- // Print log message into a buffer
- SDL_memset(logMessage, 0, SDLTEST_MAX_LOGMESSAGE_LENGTH);
- va_start(list, fmt);
- SDL_vsnprintf(logMessage, SDLTEST_MAX_LOGMESSAGE_LENGTH - 1, fmt, list);
- va_end(list);
+ /* Print log message into a buffer */
+ SDL_memset(logMessage, 0, SDLTEST_MAX_LOGMESSAGE_LENGTH);
+ va_start(list, fmt);
+ SDL_vsnprintf(logMessage, SDLTEST_MAX_LOGMESSAGE_LENGTH - 1, fmt, list);
+ va_end(list);
- // Log with timestamp and newline
- SDL_LogMessage(SDL_LOG_CATEGORY_TEST, SDL_LOG_PRIORITY_ERROR, "%s: %s", SDLTest_TimestampToString(time(0)), logMessage);
+ /* Log with timestamp and newline */
+ SDL_LogMessage(SDL_LOG_CATEGORY_TEST, SDL_LOG_PRIORITY_ERROR, "%s: %s", SDLTest_TimestampToString(time(0)), logMessage);
}
diff --git a/src/test/SDL_test_md5.c b/src/test/SDL_test_md5.c
index 6d4d7d04be..3f42ed3566 100644
--- a/src/test/SDL_test_md5.c
+++ b/src/test/SDL_test_md5.c
@@ -102,7 +102,7 @@ static unsigned char MD5PADDING[64] = {
(a) += (b); \
}
-/*
+/*
The routine MD5Init initializes the message-digest context
mdContext. All fields are set to zero.
*/
@@ -122,14 +122,14 @@ void SDLTest_Md5Init(SDLTest_Md5Context * mdContext)
mdContext->buf[3] = (MD5UINT4) 0x10325476;
}
-/*
+/*
The routine MD5Update updates the message-digest context to
account for the presence of each of the characters inBuf[0..inLen-1]
in the message whose digest is being computed.
*/
void SDLTest_Md5Update(SDLTest_Md5Context * mdContext, unsigned char *inBuf,
- unsigned int inLen)
+ unsigned int inLen)
{
MD5UINT4 in[16];
int mdi;
@@ -139,12 +139,12 @@ void SDLTest_Md5Update(SDLTest_Md5Context * mdContext, unsigned char *inBuf,
if (inBuf == NULL || inLen < 1) return;
/*
- * compute number of bytes mod 64
+ * compute number of bytes mod 64
*/
mdi = (int) ((mdContext->i[0] >> 3) & 0x3F);
/*
- * update number of bits
+ * update number of bits
*/
if ((mdContext->i[0] + ((MD5UINT4) inLen << 3)) < mdContext->i[0])
mdContext->i[1]++;
@@ -153,26 +153,26 @@ void SDLTest_Md5Update(SDLTest_Md5Context * mdContext, unsigned char *inBuf,
while (inLen--) {
/*
- * add new character to buffer, increment mdi
+ * add new character to buffer, increment mdi
*/
mdContext->in[mdi++] = *inBuf++;
/*
- * transform if necessary
+ * transform if necessary
*/
if (mdi == 0x40) {
for (i = 0, ii = 0; i < 16; i++, ii += 4)
- in[i] = (((MD5UINT4) mdContext->in[ii + 3]) << 24) |
- (((MD5UINT4) mdContext->in[ii + 2]) << 16) |
- (((MD5UINT4) mdContext->in[ii + 1]) << 8) |
- ((MD5UINT4) mdContext->in[ii]);
+ in[i] = (((MD5UINT4) mdContext->in[ii + 3]) << 24) |
+ (((MD5UINT4) mdContext->in[ii + 2]) << 16) |
+ (((MD5UINT4) mdContext->in[ii + 1]) << 8) |
+ ((MD5UINT4) mdContext->in[ii]);
SDLTest_Md5Transform(mdContext->buf, in);
mdi = 0;
}
}
}
-/*
+/*
The routine MD5Final terminates the message-digest computation and
ends with the desired message digest in mdContext->digest[0...15].
*/
@@ -187,24 +187,24 @@ void SDLTest_Md5Final(SDLTest_Md5Context * mdContext)
if (mdContext == NULL) return;
/*
- * save number of bits
+ * save number of bits
*/
in[14] = mdContext->i[0];
in[15] = mdContext->i[1];
/*
- * compute number of bytes mod 64
+ * compute number of bytes mod 64
*/
mdi = (int) ((mdContext->i[0] >> 3) & 0x3F);
/*
- * pad out to 56 mod 64
+ * pad out to 56 mod 64
*/
padLen = (mdi < 56) ? (56 - mdi) : (120 - mdi);
SDLTest_Md5Update(mdContext, MD5PADDING, padLen);
/*
- * append length in bits and transform
+ * append length in bits and transform
*/
for (i = 0, ii = 0; i < 14; i++, ii += 4)
in[i] = (((MD5UINT4) mdContext->in[ii + 3]) << 24) |
@@ -214,7 +214,7 @@ void SDLTest_Md5Final(SDLTest_Md5Context * mdContext)
SDLTest_Md5Transform(mdContext->buf, in);
/*
- * store buffer in digest
+ * store buffer in digest
*/
for (i = 0, ii = 0; i < 4; i++, ii += 4) {
mdContext->digest[ii] = (unsigned char) (mdContext->buf[i] & 0xFF);
@@ -234,100 +234,100 @@ static void SDLTest_Md5Transform(MD5UINT4 * buf, MD5UINT4 * in)
MD5UINT4 a = buf[0], b = buf[1], c = buf[2], d = buf[3];
/*
- * Round 1
+ * Round 1
*/
#define S11 7
#define S12 12
#define S13 17
#define S14 22
- FF(a, b, c, d, in[0], S11, 3614090360u); /* 1 */
- FF(d, a, b, c, in[1], S12, 3905402710u); /* 2 */
- FF(c, d, a, b, in[2], S13, 606105819u); /* 3 */
- FF(b, c, d, a, in[3], S14, 3250441966u); /* 4 */
- FF(a, b, c, d, in[4], S11, 4118548399u); /* 5 */
- FF(d, a, b, c, in[5], S12, 1200080426u); /* 6 */
- FF(c, d, a, b, in[6], S13, 2821735955u); /* 7 */
- FF(b, c, d, a, in[7], S14, 4249261313u); /* 8 */
- FF(a, b, c, d, in[8], S11, 1770035416u); /* 9 */
- FF(d, a, b, c, in[9], S12, 2336552879u); /* 10 */
- FF(c, d, a, b, in[10], S13, 4294925233u); /* 11 */
- FF(b, c, d, a, in[11], S14, 2304563134u); /* 12 */
- FF(a, b, c, d, in[12], S11, 1804603682u); /* 13 */
- FF(d, a, b, c, in[13], S12, 4254626195u); /* 14 */
- FF(c, d, a, b, in[14], S13, 2792965006u); /* 15 */
- FF(b, c, d, a, in[15], S14, 1236535329u); /* 16 */
+ FF(a, b, c, d, in[0], S11, 3614090360u); /* 1 */
+ FF(d, a, b, c, in[1], S12, 3905402710u); /* 2 */
+ FF(c, d, a, b, in[2], S13, 606105819u); /* 3 */
+ FF(b, c, d, a, in[3], S14, 3250441966u); /* 4 */
+ FF(a, b, c, d, in[4], S11, 4118548399u); /* 5 */
+ FF(d, a, b, c, in[5], S12, 1200080426u); /* 6 */
+ FF(c, d, a, b, in[6], S13, 2821735955u); /* 7 */
+ FF(b, c, d, a, in[7], S14, 4249261313u); /* 8 */
+ FF(a, b, c, d, in[8], S11, 1770035416u); /* 9 */
+ FF(d, a, b, c, in[9], S12, 2336552879u); /* 10 */
+ FF(c, d, a, b, in[10], S13, 4294925233u); /* 11 */
+ FF(b, c, d, a, in[11], S14, 2304563134u); /* 12 */
+ FF(a, b, c, d, in[12], S11, 1804603682u); /* 13 */
+ FF(d, a, b, c, in[13], S12, 4254626195u); /* 14 */
+ FF(c, d, a, b, in[14], S13, 2792965006u); /* 15 */
+ FF(b, c, d, a, in[15], S14, 1236535329u); /* 16 */
/*
- * Round 2
+ * Round 2
*/
#define S21 5
#define S22 9
#define S23 14
#define S24 20
- GG(a, b, c, d, in[1], S21, 4129170786u); /* 17 */
- GG(d, a, b, c, in[6], S22, 3225465664u); /* 18 */
- GG(c, d, a, b, in[11], S23, 643717713u); /* 19 */
- GG(b, c, d, a, in[0], S24, 3921069994u); /* 20 */
- GG(a, b, c, d, in[5], S21, 3593408605u); /* 21 */
- GG(d, a, b, c, in[10], S22, 38016083u); /* 22 */
- GG(c, d, a, b, in[15], S23, 3634488961u); /* 23 */
- GG(b, c, d, a, in[4], S24, 3889429448u); /* 24 */
- GG(a, b, c, d, in[9], S21, 568446438u); /* 25 */
- GG(d, a, b, c, in[14], S22, 3275163606u); /* 26 */
- GG(c, d, a, b, in[3], S23, 4107603335u); /* 27 */
- GG(b, c, d, a, in[8], S24, 1163531501u); /* 28 */
- GG(a, b, c, d, in[13], S21, 2850285829u); /* 29 */
- GG(d, a, b, c, in[2], S22, 4243563512u); /* 30 */
- GG(c, d, a, b, in[7], S23, 1735328473u); /* 31 */
- GG(b, c, d, a, in[12], S24, 2368359562u); /* 32 */
+ GG(a, b, c, d, in[1], S21, 4129170786u); /* 17 */
+ GG(d, a, b, c, in[6], S22, 3225465664u); /* 18 */
+ GG(c, d, a, b, in[11], S23, 643717713u); /* 19 */
+ GG(b, c, d, a, in[0], S24, 3921069994u); /* 20 */
+ GG(a, b, c, d, in[5], S21, 3593408605u); /* 21 */
+ GG(d, a, b, c, in[10], S22, 38016083u); /* 22 */
+ GG(c, d, a, b, in[15], S23, 3634488961u); /* 23 */
+ GG(b, c, d, a, in[4], S24, 3889429448u); /* 24 */
+ GG(a, b, c, d, in[9], S21, 568446438u); /* 25 */
+ GG(d, a, b, c, in[14], S22, 3275163606u); /* 26 */
+ GG(c, d, a, b, in[3], S23, 4107603335u); /* 27 */
+ GG(b, c, d, a, in[8], S24, 1163531501u); /* 28 */
+ GG(a, b, c, d, in[13], S21, 2850285829u); /* 29 */
+ GG(d, a, b, c, in[2], S22, 4243563512u); /* 30 */
+ GG(c, d, a, b, in[7], S23, 1735328473u); /* 31 */
+ GG(b, c, d, a, in[12], S24, 2368359562u); /* 32 */
/*
- * Round 3
+ * Round 3
*/
#define S31 4
#define S32 11
#define S33 16
#define S34 23
- HH(a, b, c, d, in[5], S31, 4294588738u); /* 33 */
- HH(d, a, b, c, in[8], S32, 2272392833u); /* 34 */
- HH(c, d, a, b, in[11], S33, 1839030562u); /* 35 */
- HH(b, c, d, a, in[14], S34, 4259657740u); /* 36 */
- HH(a, b, c, d, in[1], S31, 2763975236u); /* 37 */
- HH(d, a, b, c, in[4], S32, 1272893353u); /* 38 */
- HH(c, d, a, b, in[7], S33, 4139469664u); /* 39 */
- HH(b, c, d, a, in[10], S34, 3200236656u); /* 40 */
- HH(a, b, c, d, in[13], S31, 681279174u); /* 41 */
- HH(d, a, b, c, in[0], S32, 3936430074u); /* 42 */
- HH(c, d, a, b, in[3], S33, 3572445317u); /* 43 */
- HH(b, c, d, a, in[6], S34, 76029189u); /* 44 */
- HH(a, b, c, d, in[9], S31, 3654602809u); /* 45 */
- HH(d, a, b, c, in[12], S32, 3873151461u); /* 46 */
- HH(c, d, a, b, in[15], S33, 530742520u); /* 47 */
- HH(b, c, d, a, in[2], S34, 3299628645u); /* 48 */
+ HH(a, b, c, d, in[5], S31, 4294588738u); /* 33 */
+ HH(d, a, b, c, in[8], S32, 2272392833u); /* 34 */
+ HH(c, d, a, b, in[11], S33, 1839030562u); /* 35 */
+ HH(b, c, d, a, in[14], S34, 4259657740u); /* 36 */
+ HH(a, b, c, d, in[1], S31, 2763975236u); /* 37 */
+ HH(d, a, b, c, in[4], S32, 1272893353u); /* 38 */
+ HH(c, d, a, b, in[7], S33, 4139469664u); /* 39 */
+ HH(b, c, d, a, in[10], S34, 3200236656u); /* 40 */
+ HH(a, b, c, d, in[13], S31, 681279174u); /* 41 */
+ HH(d, a, b, c, in[0], S32, 3936430074u); /* 42 */
+ HH(c, d, a, b, in[3], S33, 3572445317u); /* 43 */
+ HH(b, c, d, a, in[6], S34, 76029189u); /* 44 */
+ HH(a, b, c, d, in[9], S31, 3654602809u); /* 45 */
+ HH(d, a, b, c, in[12], S32, 3873151461u); /* 46 */
+ HH(c, d, a, b, in[15], S33, 530742520u); /* 47 */
+ HH(b, c, d, a, in[2], S34, 3299628645u); /* 48 */
/*
- * Round 4
+ * Round 4
*/
#define S41 6
#define S42 10
#define S43 15
#define S44 21
- II(a, b, c, d, in[0], S41, 4096336452u); /* 49 */
- II(d, a, b, c, in[7], S42, 1126891415u); /* 50 */
- II(c, d, a, b, in[14], S43, 2878612391u); /* 51 */
- II(b, c, d, a, in[5], S44, 4237533241u); /* 52 */
- II(a, b, c, d, in[12], S41, 1700485571u); /* 53 */
- II(d, a, b, c, in[3], S42, 2399980690u); /* 54 */
- II(c, d, a, b, in[10], S43, 4293915773u); /* 55 */
- II(b, c, d, a, in[1], S44, 2240044497u); /* 56 */
- II(a, b, c, d, in[8], S41, 1873313359u); /* 57 */
- II(d, a, b, c, in[15], S42, 4264355552u); /* 58 */
- II(c, d, a, b, in[6], S43, 2734768916u); /* 59 */
- II(b, c, d, a, in[13], S44, 1309151649u); /* 60 */
- II(a, b, c, d, in[4], S41, 4149444226u); /* 61 */
- II(d, a, b, c, in[11], S42, 3174756917u); /* 62 */
- II(c, d, a, b, in[2], S43, 718787259u); /* 63 */
- II(b, c, d, a, in[9], S44, 3951481745u); /* 64 */
+ II(a, b, c, d, in[0], S41, 4096336452u); /* 49 */
+ II(d, a, b, c, in[7], S42, 1126891415u); /* 50 */
+ II(c, d, a, b, in[14], S43, 2878612391u); /* 51 */
+ II(b, c, d, a, in[5], S44, 4237533241u); /* 52 */
+ II(a, b, c, d, in[12], S41, 1700485571u); /* 53 */
+ II(d, a, b, c, in[3], S42, 2399980690u); /* 54 */
+ II(c, d, a, b, in[10], S43, 4293915773u); /* 55 */
+ II(b, c, d, a, in[1], S44, 2240044497u); /* 56 */
+ II(a, b, c, d, in[8], S41, 1873313359u); /* 57 */
+ II(d, a, b, c, in[15], S42, 4264355552u); /* 58 */
+ II(c, d, a, b, in[6], S43, 2734768916u); /* 59 */
+ II(b, c, d, a, in[13], S44, 1309151649u); /* 60 */
+ II(a, b, c, d, in[4], S41, 4149444226u); /* 61 */
+ II(d, a, b, c, in[11], S42, 3174756917u); /* 62 */
+ II(c, d, a, b, in[2], S43, 718787259u); /* 63 */
+ II(b, c, d, a, in[9], S44, 3951481745u); /* 64 */
buf[0] += a;
buf[1] += b;
diff --git a/src/test/SDL_test_random.c b/src/test/SDL_test_random.c
index 8b305c50eb..2c70dbd47d 100644
--- a/src/test/SDL_test_random.c
+++ b/src/test/SDL_test_random.c
@@ -23,14 +23,14 @@
A portable "32-bit Multiply with carry" random number generator.
- Used by the fuzzer component.
+ Used by the fuzzer component.
Original source code contributed by A. Schiffler for GSOC project.
*/
#include "SDL_config.h"
-#include <stdlib.h>
+#include <stdlib.h>
#include <stdio.h>
#include <time.h>
@@ -41,13 +41,13 @@
void SDLTest_RandomInit(SDLTest_RandomContext * rndContext, unsigned int xi, unsigned int ci)
{
if (rndContext==NULL) return;
-
+
/*
* Choose a value for 'a' from this list
* 1791398085 1929682203 1683268614 1965537969 1675393560
* 1967773755 1517746329 1447497129 1655692410 1606218150
* 2051013963 1075433238 1557985959 1781943330 1893513180
- * 1631296680 2131995753 2083801278 1873196400 1554115554
+ * 1631296680 2131995753 2083801278 1873196400 1554115554
*/
rndContext->a = 1655692410;
rndContext->x = 30903;
@@ -65,9 +65,9 @@ void SDLTest_RandomInit(SDLTest_RandomContext * rndContext, unsigned int xi, uns
void SDLTest_RandomInitTime(SDLTest_RandomContext * rndContext)
{
int a, b;
-
+
if (rndContext==NULL) return;
-
+
srand((unsigned int)time(NULL));
a=rand();
srand(clock());
@@ -82,7 +82,7 @@ unsigned int SDLTest_Random(SDLTest_RandomContext * rndContext)
unsigned int xh, xl;
if (rndContext==NULL) return -1;
-
+
xh = rndContext->x >> 16, xl = rndContext->x & 65535;
rndContext->x = rndContext->x * rndContext->a + rndContext->c;
rndContext->c =
diff --git a/src/thread/SDL_thread.c b/src/thread/SDL_thread.c
index e20f672ffb..61e252c17f 100644
--- a/src/thread/SDL_thread.c
+++ b/src/thread/SDL_thread.c
@@ -28,7 +28,7 @@
#include "SDL_systhread.h"
#include "../SDL_error_c.h"
-#define ARRAY_CHUNKSIZE 32
+#define ARRAY_CHUNKSIZE 32
/* The array of threads currently active in the application
(except the main thread)
The manipulation of an array here is safer than using a linked list.
diff --git a/src/thread/psp/SDL_syssem.c b/src/thread/psp/SDL_syssem.c
index 22ecc5f6b9..8eff409e0b 100644
--- a/src/thread/psp/SDL_syssem.c
+++ b/src/thread/psp/SDL_syssem.c
@@ -31,42 +31,42 @@
#include <pspkerror.h>
struct SDL_semaphore {
- SceUID semid;
+ SceUID semid;
};
/* Create a semaphore */
SDL_sem *SDL_CreateSemaphore(Uint32 initial_value)
{
- SDL_sem *sem;
-
- sem = (SDL_sem *) malloc(sizeof(*sem));
- if (sem != NULL) {
- /* TODO: Figure out the limit on the maximum value. */
- sem->semid = sceKernelCreateSema("SDL sema", 0, initial_value, 255, NULL);
- if (sem->semid < 0) {
- SDL_SetError("Couldn't create semaphore");
- free(sem);
- sem = NULL;
- }
- } else {
- SDL_OutOfMemory();
- }
-
- return sem;
+ SDL_sem *sem;
+
+ sem = (SDL_sem *) malloc(sizeof(*sem));
+ if (sem != NULL) {
+ /* TODO: Figure out the limit on the maximum value. */
+ sem->semid = sceKernelCreateSema("SDL sema", 0, initial_value, 255, NULL);
+ if (sem->semid < 0) {
+ SDL_SetError("Couldn't create semaphore");
+ free(sem);
+ sem = NULL;
+ }
+ } else {
+ SDL_OutOfMemory();
+ }
+
+ return sem;
}
/* Free the semaphore */
void SDL_DestroySemaphore(SDL_sem *sem)
{
- if (sem != NULL) {
- if (sem->semid > 0) {
- sceKernelDeleteSema(sem->semid);
- sem->semid = 0;
- }
-
- free(sem);
- }
+ if (sem != NULL) {
+ if (sem->semid > 0) {
+ sceKernelDeleteSema(sem->semid);
+ sem->semid = 0;
+ }
+
+ free(sem);
+ }
}
/* TODO: This routine is a bit overloaded.
@@ -75,30 +75,30 @@ void SDL_DestroySemaphore(SDL_sem *sem)
* is specified, convert it to microseconds. */
int SDL_SemWaitTimeout(SDL_sem *sem, Uint32 timeout)
{
- Uint32 *pTimeout;
+ Uint32 *pTimeout;
unsigned int res;
- if (sem == NULL) {
- SDL_SetError("Passed a NULL sem");
- return 0;
- }
-
- if (timeout == 0) {
- res = sceKernelPollSema(sem->semid, 1);
- if (res < 0) {
- return SDL_MUTEX_TIMEDOUT;
- }
- return 0;
- }
-
- if (timeout == SDL_MUTEX_MAXWAIT) {
- pTimeout = NULL;
- } else {
- timeout *= 1000; /* Convert to microseconds. */
- pTimeout = &timeout;
- }
-
- res = sceKernelWaitSema(sem->semid, 1, pTimeout);
+ if (sem == NULL) {
+ SDL_SetError("Passed a NULL sem");
+ return 0;
+ }
+
+ if (timeout == 0) {
+ res = sceKernelPollSema(sem->semid, 1);
+ if (res < 0) {
+ return SDL_MUTEX_TIMEDOUT;
+ }
+ return 0;
+ }
+
+ if (timeout == SDL_MUTEX_MAXWAIT) {
+ pTimeout = NULL;
+ } else {
+ timeout *= 1000; /* Convert to microseconds. */
+ pTimeout = &timeout;
+ }
+
+ res = sceKernelWaitSema(sem->semid, 1, pTimeout);
switch (res) {
case SCE_KERNEL_ERROR_OK:
return 0;
@@ -106,50 +106,50 @@ int SDL_SemWaitTimeout(SDL_sem *sem, Uint32 timeout)
return SDL_MUTEX_TIMEDOUT;
default:
return SDL_SetError("WaitForSingleObject() failed");
- }
+ }
}
int SDL_SemTryWait(SDL_sem *sem)
{
- return SDL_SemWaitTimeout(sem, 0);
+ return SDL_SemWaitTimeout(sem, 0);
}
int SDL_SemWait(SDL_sem *sem)
{
- return SDL_SemWaitTimeout(sem, SDL_MUTEX_MAXWAIT);
+ return SDL_SemWaitTimeout(sem, SDL_MUTEX_MAXWAIT);
}
/* Returns the current count of the semaphore */
Uint32 SDL_SemValue(SDL_sem *sem)
{
- SceKernelSemaInfo info;
+ SceKernelSemaInfo info;
- if (sem == NULL) {
- SDL_SetError("Passed a NULL sem");
- return 0;
- }
+ if (sem == NULL) {
+ SDL_SetError("Passed a NULL sem");
+ return 0;
+ }
- if (sceKernelReferSemaStatus(sem->semid, &info) >= 0) {
- return info.currentCount;
- }
+ if (sceKernelReferSemaStatus(sem->semid, &info) >= 0) {
+ return info.currentCount;
+ }
- return 0;
+ return 0;
}
int SDL_SemPost(SDL_sem *sem)
{
- int res;
+ int res;
- if (sem == NULL) {
- return SDL_SetError("Passed a NULL sem");
- }
+ if (sem == NULL) {
+ return SDL_SetError("Passed a NULL sem");
+ }
- res = sceKernelSignalSema(sem->semid, 1);
- if (res < 0) {
- return SDL_SetError("sceKernelSignalSema() failed");
- }
+ res = sceKernelSignalSema(sem->semid, 1);
+ if (res < 0) {
+ return SDL_SetError("sceKernelSignalSema() failed");
+ }
- return 0;
+ return 0;
}
/* vim: ts=4 sw=4
diff --git a/src/thread/psp/SDL_systhread.c b/src/thread/psp/SDL_systhread.c
index 57b932084e..05a2341fe0 100644
--- a/src/thread/psp/SDL_systhread.c
+++ b/src/thread/psp/SDL_systhread.c
@@ -35,57 +35,57 @@
static int ThreadEntry(SceSize args, void *argp)
{
- SDL_RunThread(*(void **) argp);
- return 0;
+ SDL_RunThread(*(void **) argp);
+ return 0;
}
int SDL_SYS_CreateThread(SDL_Thread *thread, void *args)
{
- SceKernelThreadInfo status;
- int priority = 32;
-
- /* Set priority of new thread to the same as the current thread */
- status.size = sizeof(SceKernelThreadInfo);
- if (sceKernelReferThreadStatus(sceKernelGetThreadId(), &status) == 0) {
- priority = status.currentPriority;
- }
-
- thread->handle = sceKernelCreateThread("SDL thread", ThreadEntry,
- priority, 0x8000,
- PSP_THREAD_ATTR_VFPU, NULL);
- if (thread->handle < 0) {
- return SDL_SetError("sceKernelCreateThread() failed");
- }
-
- sceKernelStartThread(thread->handle, 4, &args);
- return 0;
+ SceKernelThreadInfo status;
+ int priority = 32;
+
+ /* Set priority of new thread to the same as the current thread */
+ status.size = sizeof(SceKernelThreadInfo);
+ if (sceKernelReferThreadStatus(sceKernelGetThreadId(), &status) == 0) {
+ priority = status.currentPriority;
+ }
+
+ thread->handle = sceKernelCreateThread("SDL thread", ThreadEntry,
+ priority, 0x8000,
+ PSP_THREAD_ATTR_VFPU, NULL);
+ if (thread->handle < 0) {
+ return SDL_SetError("sceKernelCreateThread() failed");
+ }
+
+ sceKernelStartThread(thread->handle, 4, &args);
+ return 0;
}
void SDL_SYS_SetupThread(const char *name)
{
- /* Do nothing. */
+ /* Do nothing. */
}
SDL_threadID SDL_ThreadID(void)
{
- return (SDL_threadID) sceKernelGetThreadId();
+ return (SDL_threadID) sceKernelGetThreadId();
}
void SDL_SYS_WaitThread(SDL_Thread *thread)
{
- sceKernelWaitThreadEnd(thread->handle, NULL);
- sceKernelDeleteThread(thread->handle);
+ sceKernelWaitThreadEnd(thread->handle, NULL);
+ sceKernelDeleteThread(thread->handle);
}
void SDL_SYS_KillThread(SDL_Thread *thread)
-{
- sceKernelTerminateDeleteThread(thread->handle);
+{
+ sceKernelTerminateDeleteThread(thread->handle);
}
int SDL_SYS_SetThreadPriority(SDL_ThreadPriority priority)
-{
+{
int value;
-
+
if (priority == SDL_THREAD_PRIORITY_LOW) {
value = 19;
} else if (priority == SDL_THREAD_PRIORITY_HIGH) {
@@ -93,7 +93,7 @@ int SDL_SYS_SetThreadPriority(SDL_ThreadPriority priority)
} else {
value = 0;
}
-
+
return sceKernelChangeThreadPriority(sceKernelGetThreadId(),value);
}
diff --git a/src/thread/pthread/SDL_systhread.c b/src/thread/pthread/SDL_systhread.c
index 62436936ef..c967ca7f30 100644
--- a/src/thread/pthread/SDL_systhread.c
+++ b/src/thread/pthread/SDL_systhread.c
@@ -34,7 +34,7 @@
#include <sys/resource.h>
#include <sys/syscall.h>
#include <unistd.h>
-#endif // __LINUX__
+#endif /* __LINUX__ */
#if defined(__LINUX__) || defined(__MACOSX__) || defined(__IPHONEOS__)
#include <dlfcn.h>
diff --git a/src/thread/windows/SDL_systhread.c b/src/thread/windows/SDL_systhread.c
index 6ae9cdb8f6..ada3654136 100644
--- a/src/thread/windows/SDL_systhread.c
+++ b/src/thread/windows/SDL_systhread.c
@@ -36,7 +36,7 @@
/* Cygwin gcc-3 ... MingW64 (even with a i386 host) does this like MSVC. */
#if (defined(__MINGW32__) && (__GNUC__ < 4))
typedef unsigned long (__cdecl *pfnSDL_CurrentBeginThread) (void *, unsigned,
- unsigned (__stdcall *func)(void *), void *arg,
+ unsigned (__stdcall *func)(void *), void *arg,
unsigned, unsigned *threadID);
typedef void (__cdecl *pfnSDL_CurrentEndThread)(unsigned code);
@@ -118,9 +118,9 @@ SDL_SYS_CreateThread(SDL_Thread * thread, void *args)
if (!pThreadParms) {
return SDL_OutOfMemory();
}
- // Save the function which we will have to call to clear the RTL of calling app!
+ /* Save the function which we will have to call to clear the RTL of calling app! */
pThreadParms->pfnCurrentEndThread = pfnEndThread;
- // Also save the real parameters we have to pass to thread function
+ /* Also save the real parameters we have to pass to thread function */
pThreadParms->args = args;
if (pfnBeginThread) {
diff --git a/src/timer/SDL_timer.c b/src/timer/SDL_timer.c
index 5e542f0832..5b6550c1ca 100644
--- a/src/timer/SDL_timer.c
+++ b/src/timer/SDL_timer.c
@@ -336,7 +336,7 @@ SDL_AddTimer(Uint32 interval, SDL_TimerCallback callback, void *param)
timer->interval = interval;
timer->scheduled = SDL_GetTicks() + interval;
timer->canceled = SDL_FALSE;
-
+
entry = (SDL_TimerMap *)SDL_malloc(sizeof(*entry));
if (!entry) {
SDL_free(timer);
diff --git a/src/timer/SDL_timer_c.h b/src/timer/SDL_timer_c.h
index c759bcd847..1574853108 100644
--- a/src/timer/SDL_timer_c.h
+++ b/src/timer/SDL_timer_c.h
@@ -23,8 +23,8 @@
/* Useful functions and variables from SDL_timer.c */
#include "SDL_timer.h"
-#define ROUND_RESOLUTION(X) \
- (((X+TIMER_RESOLUTION-1)/TIMER_RESOLUTION)*TIMER_RESOLUTION)
+#define ROUND_RESOLUTION(X) \
+ (((X+TIMER_RESOLUTION-1)/TIMER_RESOLUTION)*TIMER_RESOLUTION)
extern void SDL_InitTicks(void);
extern int SDL_TimerInit(void);
diff --git a/src/timer/psp/SDL_systimer.c b/src/timer/psp/SDL_systimer.c
index cfb0aeb252..59bb4df1c3 100644
--- a/src/timer/psp/SDL_systimer.c
+++ b/src/timer/psp/SDL_systimer.c
@@ -32,17 +32,17 @@ static struct timeval start;
void SDL_StartTicks(void)
{
- gettimeofday(&start, NULL);
+ gettimeofday(&start, NULL);
}
Uint32 SDL_GetTicks(void)
{
- struct timeval now;
- Uint32 ticks;
+ struct timeval now;
+ Uint32 ticks;
- gettimeofday(&now, NULL);
- ticks=(now.tv_sec-start.tv_sec)*1000+(now.tv_usec-start.tv_usec)/1000;
- return(ticks);
+ gettimeofday(&now, NULL);
+ ticks=(now.tv_sec-start.tv_sec)*1000+(now.tv_usec-start.tv_usec)/1000;
+ return(ticks);
}
Uint64
@@ -59,10 +59,10 @@ SDL_GetPerformanceFrequency(void)
void SDL_Delay(Uint32 ms)
{
- const Uint32 max_delay = 0xffffffffUL / 1000;
- if(ms > max_delay)
- ms = max_delay;
- sceKernelDelayThreadCB(ms * 1000);
+ const Uint32 max_delay = 0xffffffffUL / 1000;
+ if(ms > max_delay)
+ ms = max_delay;
+ sceKernelDelayThreadCB(ms * 1000);
}
/* vim: ts=4 sw=4
diff --git a/src/timer/unix/SDL_systimer.c b/src/timer/unix/SDL_systimer.c
index c61b8b9666..514ac2267f 100644
--- a/src/timer/unix/SDL_systimer.c
+++ b/src/timer/unix/SDL_systimer.c
@@ -85,7 +85,7 @@ SDL_GetTicks(void)
#if HAVE_CLOCK_GETTIME
struct timespec now;
clock_gettime(CLOCK_MONOTONIC, &now);
- ticks =
+ ticks =
(now.tv_sec - start_ts.tv_sec) * 1000 + (now.tv_nsec -
start_ts.tv_nsec) / 1000000;
#elif defined(__APPLE__)
diff --git a/src/timer/windows/SDL_systimer.c b/src/timer/windows/SDL_systimer.c
index 9d1711b962..33097634ec 100644
--- a/src/timer/windows/SDL_systimer.c
+++ b/src/timer/windows/SDL_systimer.c
@@ -27,7 +27,7 @@
#include "SDL_timer.h"
-#define TIME_WRAP_VALUE (~(DWORD)0)
+#define TIME_WRAP_VALUE (~(DWORD)0)
/* The first (low-resolution) ticks value of the application */
static DWORD start;
@@ -48,7 +48,7 @@ SDL_StartTicks(void)
#ifdef USE_GETTICKCOUNT
start = GetTickCount();
#else
- /* QueryPerformanceCounter has had problems in the past, but lots of games
+ /* QueryPerformanceCounter has had problems in the past, but lots of games
use it, so we'll rely on it here.
*/
if (QueryPerformanceFrequency(&hires_ticks_per_second) == TRUE) {
diff --git a/src/video/SDL_RLEaccel.c b/src/video/SDL_RLEaccel.c
index 965a706f59..e1f12d13b0 100644
--- a/src/video/SDL_RLEaccel.c
+++ b/src/video/SDL_RLEaccel.c
@@ -71,7 +71,7 @@
* For 32-bit targets, each pixel has the target RGB format but with
* the alpha value occupying the highest 8 bits. The <skip> and <run>
* counts are 16 bit.
- *
+ *
* For 16-bit targets, each pixel has the target RGB format, but with
* the middle component (usually green) shifted 16 steps to the left,
* and the hole filled with the 5 most significant bits of the alpha value.
@@ -97,20 +97,20 @@
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#endif
-#define PIXEL_COPY(to, from, len, bpp) \
-do { \
- if(bpp == 4) { \
- SDL_memcpy4(to, from, (size_t)(len)); \
- } else { \
- SDL_memcpy(to, from, (size_t)(len) * (bpp)); \
- } \
+#define PIXEL_COPY(to, from, len, bpp) \
+do { \
+ if(bpp == 4) { \
+ SDL_memcpy4(to, from, (size_t)(len)); \
+ } else { \
+ SDL_memcpy(to, from, (size_t)(len) * (bpp)); \
+ } \
} while(0)
/*
* Various colorkey blit methods, for opaque and per-surface alpha
*/
-#define OPAQUE_BLIT(to, from, length, bpp, alpha) \
+#define OPAQUE_BLIT(to, from, length, bpp, alpha) \
PIXEL_COPY(to, from, length, bpp)
/*
@@ -120,22 +120,22 @@ do { \
* of each component, so the bits from the multiplication don't collide.
* This can be used for any RGB permutation of course.
*/
-#define ALPHA_BLIT32_888(to, from, length, bpp, alpha) \
- do { \
- int i; \
- Uint32 *src = (Uint32 *)(from); \
- Uint32 *dst = (Uint32 *)(to); \
- for(i = 0; i < (int)(length); i++) { \
- Uint32 s = *src++; \
- Uint32 d = *dst; \
- Uint32 s1 = s & 0xff00ff; \
- Uint32 d1 = d & 0xff00ff; \
- d1 = (d1 + ((s1 - d1) * alpha >> 8)) & 0xff00ff; \
- s &= 0xff00; \
- d &= 0xff00; \
- d = (d + ((s - d) * alpha >> 8)) & 0xff00; \
- *dst++ = d1 | d; \
- } \
+#define ALPHA_BLIT32_888(to, from, length, bpp, alpha) \
+ do { \
+ int i; \
+ Uint32 *src = (Uint32 *)(from); \
+ Uint32 *dst = (Uint32 *)(to); \
+ for(i = 0; i < (int)(length); i++) { \
+ Uint32 s = *src++; \
+ Uint32 d = *dst; \
+ Uint32 s1 = s & 0xff00ff; \
+ Uint32 d1 = d & 0xff00ff; \
+ d1 = (d1 + ((s1 - d1) * alpha >> 8)) & 0xff00ff; \
+ s &= 0xff00; \
+ d &= 0xff00; \
+ d = (d + ((s - d) * alpha >> 8)) & 0xff00; \
+ *dst++ = d1 | d; \
+ } \
} while(0)
/*
@@ -144,98 +144,98 @@ do { \
* components at the same time. Since the smallest gap is here just
* 5 bits, we have to scale alpha down to 5 bits as well.
*/
-#define ALPHA_BLIT16_565(to, from, length, bpp, alpha) \
- do { \
- int i; \
- Uint16 *src = (Uint16 *)(from); \
- Uint16 *dst = (Uint16 *)(to); \
- Uint32 ALPHA = alpha >> 3; \
- for(i = 0; i < (int)(length); i++) { \
- Uint32 s = *src++; \
- Uint32 d = *dst; \
- s = (s | s << 16) & 0x07e0f81f; \
- d = (d | d << 16) & 0x07e0f81f; \
- d += (s - d) * ALPHA >> 5; \
- d &= 0x07e0f81f; \
- *dst++ = (Uint16)(d | d >> 16); \
- } \
+#define ALPHA_BLIT16_565(to, from, length, bpp, alpha) \
+ do { \
+ int i; \
+ Uint16 *src = (Uint16 *)(from); \
+ Uint16 *dst = (Uint16 *)(to); \
+ Uint32 ALPHA = alpha >> 3; \
+ for(i = 0; i < (int)(length); i++) { \
+ Uint32 s = *src++; \
+ Uint32 d = *dst; \
+ s = (s | s << 16) & 0x07e0f81f; \
+ d = (d | d << 16) & 0x07e0f81f; \
+ d += (s - d) * ALPHA >> 5; \
+ d &= 0x07e0f81f; \
+ *dst++ = (Uint16)(d | d >> 16); \
+ } \
} while(0)
-#define ALPHA_BLIT16_555(to, from, length, bpp, alpha) \
- do { \
- int i; \
- Uint16 *src = (Uint16 *)(from); \
- Uint16 *dst = (Uint16 *)(to); \
- Uint32 ALPHA = alpha >> 3; \
- for(i = 0; i < (int)(length); i++) { \
- Uint32 s = *src++; \
- Uint32 d = *dst; \
- s = (s | s << 16) & 0x03e07c1f; \
- d = (d | d << 16) & 0x03e07c1f; \
- d += (s - d) * ALPHA >> 5; \
- d &= 0x03e07c1f; \
- *dst++ = (Uint16)(d | d >> 16); \
- } \
+#define ALPHA_BLIT16_555(to, from, length, bpp, alpha) \
+ do { \
+ int i; \
+ Uint16 *src = (Uint16 *)(from); \
+ Uint16 *dst = (Uint16 *)(to); \
+ Uint32 ALPHA = alpha >> 3; \
+ for(i = 0; i < (int)(length); i++) { \
+ Uint32 s = *src++; \
+ Uint32 d = *dst; \
+ s = (s | s << 16) & 0x03e07c1f; \
+ d = (d | d << 16) & 0x03e07c1f; \
+ d += (s - d) * ALPHA >> 5; \
+ d &= 0x03e07c1f; \
+ *dst++ = (Uint16)(d | d >> 16); \
+ } \
} while(0)
/*
* The general slow catch-all function, for remaining depths and formats
*/
-#define ALPHA_BLIT_ANY(to, from, length, bpp, alpha) \
- do { \
- int i; \
- Uint8 *src = from; \
- Uint8 *dst = to; \
- for(i = 0; i < (int)(length); i++) { \
- Uint32 s, d; \
- unsigned rs, gs, bs, rd, gd, bd; \
- switch(bpp) { \
- case 2: \
- s = *(Uint16 *)src; \
- d = *(Uint16 *)dst; \
- break; \
- case 3: \
- if(SDL_BYTEORDER == SDL_BIG_ENDIAN) { \
- s = (src[0] << 16) | (src[1] << 8) | src[2]; \
- d = (dst[0] << 16) | (dst[1] << 8) | dst[2]; \
- } else { \
- s = (src[2] << 16) | (src[1] << 8) | src[0]; \
- d = (dst[2] << 16) | (dst[1] << 8) | dst[0]; \
- } \
- break; \
- case 4: \
- s = *(Uint32 *)src; \
- d = *(Uint32 *)dst; \
- break; \
- } \
- RGB_FROM_PIXEL(s, fmt, rs, gs, bs); \
- RGB_FROM_PIXEL(d, fmt, rd, gd, bd); \
- rd += (rs - rd) * alpha >> 8; \
- gd += (gs - gd) * alpha >> 8; \
- bd += (bs - bd) * alpha >> 8; \
- PIXEL_FROM_RGB(d, fmt, rd, gd, bd); \
- switch(bpp) { \
- case 2: \
- *(Uint16 *)dst = (Uint16)d; \
- break; \
- case 3: \
- if(SDL_BYTEORDER == SDL_BIG_ENDIAN) { \
- dst[0] = (Uint8)(d >> 16); \
- dst[1] = (Uint8)(d >> 8); \
- dst[2] = (Uint8)(d); \
- } else { \
- dst[0] = (Uint8)d; \
- dst[1] = (Uint8)(d >> 8); \
- dst[2] = (Uint8)(d >> 16); \
- } \
- break; \
- case 4: \
- *(Uint32 *)dst = d; \
- break; \
- } \
- src += bpp; \
- dst += bpp; \
- } \
+#define ALPHA_BLIT_ANY(to, from, length, bpp, alpha) \
+ do { \
+ int i; \
+ Uint8 *src = from; \
+ Uint8 *dst = to; \
+ for(i = 0; i < (int)(length); i++) { \
+ Uint32 s, d; \
+ unsigned rs, gs, bs, rd, gd, bd; \
+ switch(bpp) { \
+ case 2: \
+ s = *(Uint16 *)src; \
+ d = *(Uint16 *)dst; \
+ break; \
+ case 3: \
+ if(SDL_BYTEORDER == SDL_BIG_ENDIAN) { \
+ s = (src[0] << 16) | (src[1] << 8) | src[2]; \
+ d = (dst[0] << 16) | (dst[1] << 8) | dst[2]; \
+ } else { \
+ s = (src[2] << 16) | (src[1] << 8) | src[0]; \
+ d = (dst[2] << 16) | (dst[1] << 8) | dst[0]; \
+ } \
+ break; \
+ case 4: \
+ s = *(Uint32 *)src; \
+ d = *(Uint32 *)dst; \
+ break; \
+ } \
+ RGB_FROM_PIXEL(s, fmt, rs, gs, bs); \
+ RGB_FROM_PIXEL(d, fmt, rd, gd, bd); \
+ rd += (rs - rd) * alpha >> 8; \
+ gd += (gs - gd) * alpha >> 8; \
+ bd += (bs - bd) * alpha >> 8; \
+ PIXEL_FROM_RGB(d, fmt, rd, gd, bd); \
+ switch(bpp) { \
+ case 2: \
+ *(Uint16 *)dst = (Uint16)d; \
+ break; \
+ case 3: \
+ if(SDL_BYTEORDER == SDL_BIG_ENDIAN) { \
+ dst[0] = (Uint8)(d >> 16); \
+ dst[1] = (Uint8)(d >> 8); \
+ dst[2] = (Uint8)(d); \
+ } else { \
+ dst[0] = (Uint8)d; \
+ dst[1] = (Uint8)(d >> 8); \
+ dst[2] = (Uint8)(d >> 16); \
+ } \
+ break; \
+ case 4: \
+ *(Uint32 *)dst = d; \
+ break; \
+ } \
+ src += bpp; \
+ dst += bpp; \
+ } \
} while(0)
/*
@@ -246,17 +246,17 @@ do { \
* First zero the lowest bit of each component, which gives us room to
* add them. Then shift right and add the sum of the lowest bits.
*/
-#define ALPHA_BLIT32_888_50(to, from, length, bpp, alpha) \
- do { \
- int i; \
- Uint32 *src = (Uint32 *)(from); \
- Uint32 *dst = (Uint32 *)(to); \
- for(i = 0; i < (int)(length); i++) { \
- Uint32 s = *src++; \
- Uint32 d = *dst; \
- *dst++ = (((s & 0x00fefefe) + (d & 0x00fefefe)) >> 1) \
- + (s & d & 0x00010101); \
- } \
+#define ALPHA_BLIT32_888_50(to, from, length, bpp, alpha) \
+ do { \
+ int i; \
+ Uint32 *src = (Uint32 *)(from); \
+ Uint32 *dst = (Uint32 *)(to); \
+ for(i = 0; i < (int)(length); i++) { \
+ Uint32 s = *src++; \
+ Uint32 d = *dst; \
+ *dst++ = (((s & 0x00fefefe) + (d & 0x00fefefe)) >> 1) \
+ + (s & d & 0x00010101); \
+ } \
} while(0)
/*
@@ -265,116 +265,116 @@ do { \
*/
/* helper: blend a single 16 bit pixel at 50% */
-#define BLEND16_50(dst, src, mask) \
- do { \
- Uint32 s = *src++; \
- Uint32 d = *dst; \
- *dst++ = (Uint16)((((s & mask) + (d & mask)) >> 1) + \
- (s & d & (~mask & 0xffff))); \
+#define BLEND16_50(dst, src, mask) \
+ do { \
+ Uint32 s = *src++; \
+ Uint32 d = *dst; \
+ *dst++ = (Uint16)((((s & mask) + (d & mask)) >> 1) + \
+ (s & d & (~mask & 0xffff))); \
} while(0)
/* basic 16bpp blender. mask is the pixels to keep when adding. */
-#define ALPHA_BLIT16_50(to, from, length, bpp, alpha, mask) \
- do { \
- unsigned n = (length); \
- Uint16 *src = (Uint16 *)(from); \
- Uint16 *dst = (Uint16 *)(to); \
- if(((uintptr_t)src ^ (uintptr_t)dst) & 3) { \
- /* source and destination not in phase, blit one by one */ \
- while(n--) \
- BLEND16_50(dst, src, mask); \
- } else { \
- if((uintptr_t)src & 3) { \
- /* first odd pixel */ \
- BLEND16_50(dst, src, mask); \
- n--; \
- } \
- for(; n > 1; n -= 2) { \
- Uint32 s = *(Uint32 *)src; \
- Uint32 d = *(Uint32 *)dst; \
- *(Uint32 *)dst = ((s & (mask | mask << 16)) >> 1) \
- + ((d & (mask | mask << 16)) >> 1) \
- + (s & d & (~(mask | mask << 16))); \
- src += 2; \
- dst += 2; \
- } \
- if(n) \
- BLEND16_50(dst, src, mask); /* last odd pixel */ \
- } \
+#define ALPHA_BLIT16_50(to, from, length, bpp, alpha, mask) \
+ do { \
+ unsigned n = (length); \
+ Uint16 *src = (Uint16 *)(from); \
+ Uint16 *dst = (Uint16 *)(to); \
+ if(((uintptr_t)src ^ (uintptr_t)dst) & 3) { \
+ /* source and destination not in phase, blit one by one */ \
+ while(n--) \
+ BLEND16_50(dst, src, mask); \
+ } else { \
+ if((uintptr_t)src & 3) { \
+ /* first odd pixel */ \
+ BLEND16_50(dst, src, mask); \
+ n--; \
+ } \
+ for(; n > 1; n -= 2) { \
+ Uint32 s = *(Uint32 *)src; \
+ Uint32 d = *(Uint32 *)dst; \
+ *(Uint32 *)dst = ((s & (mask | mask << 16)) >> 1) \
+ + ((d & (mask | mask << 16)) >> 1) \
+ + (s & d & (~(mask | mask << 16))); \
+ src += 2; \
+ dst += 2; \
+ } \
+ if(n) \
+ BLEND16_50(dst, src, mask); /* last odd pixel */ \
+ } \
} while(0)
-#define ALPHA_BLIT16_565_50(to, from, length, bpp, alpha) \
+#define ALPHA_BLIT16_565_50(to, from, length, bpp, alpha) \
ALPHA_BLIT16_50(to, from, length, bpp, alpha, 0xf7de)
-#define ALPHA_BLIT16_555_50(to, from, length, bpp, alpha) \
+#define ALPHA_BLIT16_555_50(to, from, length, bpp, alpha) \
ALPHA_BLIT16_50(to, from, length, bpp, alpha, 0xfbde)
-#define CHOOSE_BLIT(blitter, alpha, fmt) \
- do { \
- if(alpha == 255) { \
- switch(fmt->BytesPerPixel) { \
- case 1: blitter(1, Uint8, OPAQUE_BLIT); break; \
- case 2: blitter(2, Uint8, OPAQUE_BLIT); break; \
- case 3: blitter(3, Uint8, OPAQUE_BLIT); break; \
- case 4: blitter(4, Uint16, OPAQUE_BLIT); break; \
- } \
- } else { \
- switch(fmt->BytesPerPixel) { \
- case 1: \
- /* No 8bpp alpha blitting */ \
- break; \
- \
- case 2: \
- switch(fmt->Rmask | fmt->Gmask | fmt->Bmask) { \
- case 0xffff: \
- if(fmt->Gmask == 0x07e0 \
- || fmt->Rmask == 0x07e0 \
- || fmt->Bmask == 0x07e0) { \
- if(alpha == 128) \
- blitter(2, Uint8, ALPHA_BLIT16_565_50); \
- else { \
- blitter(2, Uint8, ALPHA_BLIT16_565); \
- } \
- } else \
- goto general16; \
- break; \
- \
- case 0x7fff: \
- if(fmt->Gmask == 0x03e0 \
- || fmt->Rmask == 0x03e0 \
- || fmt->Bmask == 0x03e0) { \
- if(alpha == 128) \
- blitter(2, Uint8, ALPHA_BLIT16_555_50); \
- else { \
- blitter(2, Uint8, ALPHA_BLIT16_555); \
- } \
- break; \
- } \
- /* fallthrough */ \
- \
- default: \
- general16: \
- blitter(2, Uint8, ALPHA_BLIT_ANY); \
- } \
- break; \
- \
- case 3: \
- blitter(3, Uint8, ALPHA_BLIT_ANY); \
- break; \
- \
- case 4: \
- if((fmt->Rmask | fmt->Gmask | fmt->Bmask) == 0x00ffffff \
- && (fmt->Gmask == 0xff00 || fmt->Rmask == 0xff00 \
- || fmt->Bmask == 0xff00)) { \
- if(alpha == 128) \
- blitter(4, Uint16, ALPHA_BLIT32_888_50); \
- else \
- blitter(4, Uint16, ALPHA_BLIT32_888); \
- } else \
- blitter(4, Uint16, ALPHA_BLIT_ANY); \
- break; \
- } \
- } \
+#define CHOOSE_BLIT(blitter, alpha, fmt) \
+ do { \
+ if(alpha == 255) { \
+ switch(fmt->BytesPerPixel) { \
+ case 1: blitter(1, Uint8, OPAQUE_BLIT); break; \
+ case 2: blitter(2, Uint8, OPAQUE_BLIT); break; \
+ case 3: blitter(3, Uint8, OPAQUE_BLIT); break; \
+ case 4: blitter(4, Uint16, OPAQUE_BLIT); break; \
+ } \
+ } else { \
+ switch(fmt->BytesPerPixel) { \
+ case 1: \
+ /* No 8bpp alpha blitting */ \
+ break; \
+ \
+ case 2: \
+ switch(fmt->Rmask | fmt->Gmask | fmt->Bmask) { \
+ case 0xffff: \
+ if(fmt->Gmask == 0x07e0 \
+ || fmt->Rmask == 0x07e0 \
+ || fmt->Bmask == 0x07e0) { \
+ if(alpha == 128) \
+ blitter(2, Uint8, ALPHA_BLIT16_565_50); \
+ else { \
+ blitter(2, Uint8, ALPHA_BLIT16_565); \
+ } \
+ } else \
+ goto general16; \
+ break; \
+ \
+ case 0x7fff: \
+ if(fmt->Gmask == 0x03e0 \
+ || fmt->Rmask == 0x03e0 \
+ || fmt->Bmask == 0x03e0) { \
+ if(alpha == 128) \
+ blitter(2, Uint8, ALPHA_BLIT16_555_50); \
+ else { \
+ blitter(2, Uint8, ALPHA_BLIT16_555); \
+ } \
+ break; \
+ } \
+ /* fallthrough */ \
+ \
+ default: \
+ general16: \
+ blitter(2, Uint8, ALPHA_BLIT_ANY); \
+ } \
+ break; \
+ \
+ case 3: \
+ blitter(3, Uint8, ALPHA_BLIT_ANY); \
+ break; \
+ \
+ case 4: \
+ if((fmt->Rmask | fmt->Gmask | fmt->Bmask) == 0x00ffffff \
+ && (fmt->Gmask == 0xff00 || fmt->Rmask == 0xff00 \
+ || fmt->Bmask == 0xff00)) { \
+ if(alpha == 128) \
+ blitter(4, Uint16, ALPHA_BLIT32_888_50); \
+ else \
+ blitter(4, Uint16, ALPHA_BLIT32_888); \
+ } else \
+ blitter(4, Uint16, ALPHA_BLIT_ANY); \
+ break; \
+ } \
+ } \
} while(0)
/*
@@ -387,48 +387,48 @@ RLEClipBlit(int w, Uint8 * srcbuf, SDL_Surface * dst,
{
SDL_PixelFormat *fmt = dst->format;
-#define RLECLIPBLIT(bpp, Type, do_blit) \
- do { \
- int linecount = srcrect->h; \
- int ofs = 0; \
- int left = srcrect->x; \
- int right = left + srcrect->w; \
- dstbuf -= left * bpp; \
- for(;;) { \
- int run; \
- ofs += *(Type *)srcbuf; \
- run = ((Type *)srcbuf)[1]; \
- srcbuf += 2 * sizeof(Type); \
- if(run) { \
- /* clip to left and right borders */ \
- if(ofs < right) { \
- int start = 0; \
- int len = run; \
- int startcol; \
- if(left - ofs > 0) { \
- start = left - ofs; \
- len -= start; \
- if(len <= 0) \
- goto nocopy ## bpp ## do_blit; \
- } \
- startcol = ofs + start; \
- if(len > right - startcol) \
- len = right - startcol; \
- do_blit(dstbuf + startcol * bpp, srcbuf + start * bpp, \
- len, bpp, alpha); \
- } \
- nocopy ## bpp ## do_blit: \
- srcbuf += run * bpp; \
- ofs += run; \
- } else if(!ofs) \
- break; \
- if(ofs == w) { \
- ofs = 0; \
- dstbuf += dst->pitch; \
- if(!--linecount) \
- break; \
- } \
- } \
+#define RLECLIPBLIT(bpp, Type, do_blit) \
+ do { \
+ int linecount = srcrect->h; \
+ int ofs = 0; \
+ int left = srcrect->x; \
+ int right = left + srcrect->w; \
+ dstbuf -= left * bpp; \
+ for(;;) { \
+ int run; \
+ ofs += *(Type *)srcbuf; \
+ run = ((Type *)srcbuf)[1]; \
+ srcbuf += 2 * sizeof(Type); \
+ if(run) { \
+ /* clip to left and right borders */ \
+ if(ofs < right) { \
+ int start = 0; \
+ int len = run; \
+ int startcol; \
+ if(left - ofs > 0) { \
+ start = left - ofs; \
+ len -= start; \
+ if(len <= 0) \
+ goto nocopy ## bpp ## do_blit; \
+ } \
+ startcol = ofs + start; \
+ if(len > right - startcol) \
+ len = right - startcol; \
+ do_blit(dstbuf + startcol * bpp, srcbuf + start * bpp, \
+ len, bpp, alpha); \
+ } \
+ nocopy ## bpp ## do_blit: \
+ srcbuf += run * bpp; \
+ ofs += run; \
+ } else if(!ofs) \
+ break; \
+ if(ofs == w) { \
+ ofs = 0; \
+ dstbuf += dst->pitch; \
+ if(!--linecount) \
+ break; \
+ } \
+ } \
} while(0)
CHOOSE_BLIT(RLECLIPBLIT, alpha, fmt);
@@ -469,23 +469,23 @@ SDL_RLEBlit(SDL_Surface * src, SDL_Rect * srcrect,
int ofs = 0;
if (vskip) {
-#define RLESKIP(bpp, Type) \
- for(;;) { \
- int run; \
- ofs += *(Type *)srcbuf; \
- run = ((Type *)srcbuf)[1]; \
- srcbuf += sizeof(Type) * 2; \
- if(run) { \
- srcbuf += run * bpp; \
- ofs += run; \
- } else if(!ofs) \
- goto done; \
- if(ofs == w) { \
- ofs = 0; \
- if(!--vskip) \
- break; \
- } \
- }
+#define RLESKIP(bpp, Type) \
+ for(;;) { \
+ int run; \
+ ofs += *(Type *)srcbuf; \
+ run = ((Type *)srcbuf)[1]; \
+ srcbuf += sizeof(Type) * 2; \
+ if(run) { \
+ srcbuf += run * bpp; \
+ ofs += run; \
+ } else if(!ofs) \
+ goto done; \
+ if(ofs == w) { \
+ ofs = 0; \
+ if(!--vskip) \
+ break; \
+ } \
+ }
switch (src->format->BytesPerPixel) {
case 1:
@@ -514,29 +514,29 @@ SDL_RLEBlit(SDL_Surface * src, SDL_Rect * srcrect,
} else {
SDL_PixelFormat *fmt = src->format;
-#define RLEBLIT(bpp, Type, do_blit) \
- do { \
- int linecount = srcrect->h; \
- int ofs = 0; \
- for(;;) { \
- unsigned run; \
- ofs += *(Type *)srcbuf; \
- run = ((Type *)srcbuf)[1]; \
- srcbuf += 2 * sizeof(Type); \
- if(run) { \
- do_blit(dstbuf + ofs * bpp, srcbuf, run, bpp, alpha); \
- srcbuf += run * bpp; \
- ofs += run; \
- } else if(!ofs) \
- break; \
- if(ofs == w) { \
- ofs = 0; \
- dstbuf += dst->pitch; \
- if(!--linecount) \
- break; \
- } \
- } \
- } while(0)
+#define RLEBLIT(bpp, Type, do_blit) \
+ do { \
+ int linecount = srcrect->h; \
+ int ofs = 0; \
+ for(;;) { \
+ unsigned run; \
+ ofs += *(Type *)srcbuf; \
+ run = ((Type *)srcbuf)[1]; \
+ srcbuf += 2 * sizeof(Type); \
+ if(run) { \
+ do_blit(dstbuf + ofs * bpp, srcbuf, run, bpp, alpha); \
+ srcbuf += run * bpp; \
+ ofs += run; \
+ } else if(!ofs) \
+ break; \
+ if(ofs == w) { \
+ ofs = 0; \
+ dstbuf += dst->pitch; \
+ if(!--linecount) \
+ break; \
+ } \
+ } \
+ } while(0)
CHOOSE_BLIT(RLEBLIT, alpha, fmt);
@@ -562,46 +562,46 @@ SDL_RLEBlit(SDL_Surface * src, SDL_Rect * srcrect,
* For 32bpp pixels, we have made sure the alpha is stored in the top
* 8 bits, so proceed as usual
*/
-#define BLIT_TRANSL_888(src, dst) \
- do { \
- Uint32 s = src; \
- Uint32 d = dst; \
- unsigned alpha = s >> 24; \
- Uint32 s1 = s & 0xff00ff; \
- Uint32 d1 = d & 0xff00ff; \
- d1 = (d1 + ((s1 - d1) * alpha >> 8)) & 0xff00ff; \
- s &= 0xff00; \
- d &= 0xff00; \
- d = (d + ((s - d) * alpha >> 8)) & 0xff00; \
- dst = d1 | d | 0xff000000; \
+#define BLIT_TRANSL_888(src, dst) \
+ do { \
+ Uint32 s = src; \
+ Uint32 d = dst; \
+ unsigned alpha = s >> 24; \
+ Uint32 s1 = s & 0xff00ff; \
+ Uint32 d1 = d & 0xff00ff; \
+ d1 = (d1 + ((s1 - d1) * alpha >> 8)) & 0xff00ff; \
+ s &= 0xff00; \
+ d &= 0xff00; \
+ d = (d + ((s - d) * alpha >> 8)) & 0xff00; \
+ dst = d1 | d | 0xff000000; \
} while(0)
/*
* For 16bpp pixels, we have stored the 5 most significant alpha bits in
* bits 5-10. As before, we can process all 3 RGB components at the same time.
*/
-#define BLIT_TRANSL_565(src, dst) \
- do { \
- Uint32 s = src; \
- Uint32 d = dst; \
- unsigned alpha = (s & 0x3e0) >> 5; \
- s &= 0x07e0f81f; \
- d = (d | d << 16) & 0x07e0f81f; \
- d += (s - d) * alpha >> 5; \
- d &= 0x07e0f81f; \
- dst = (Uint16)(d | d >> 16); \
+#define BLIT_TRANSL_565(src, dst) \
+ do { \
+ Uint32 s = src; \
+ Uint32 d = dst; \
+ unsigned alpha = (s & 0x3e0) >> 5; \
+ s &= 0x07e0f81f; \
+ d = (d | d << 16) & 0x07e0f81f; \
+ d += (s - d) * alpha >> 5; \
+ d &= 0x07e0f81f; \
+ dst = (Uint16)(d | d >> 16); \
} while(0)
-#define BLIT_TRANSL_555(src, dst) \
- do { \
- Uint32 s = src; \
- Uint32 d = dst; \
- unsigned alpha = (s & 0x3e0) >> 5; \
- s &= 0x03e07c1f; \
- d = (d | d << 16) & 0x03e07c1f; \
- d += (s - d) * alpha >> 5; \
- d &= 0x03e07c1f; \
- dst = (Uint16)(d | d >> 16); \
+#define BLIT_TRANSL_555(src, dst) \
+ do { \
+ Uint32 s = src; \
+ Uint32 d = dst; \
+ unsigned alpha = (s & 0x3e0) >> 5; \
+ s &= 0x03e07c1f; \
+ d = (d | d << 16) & 0x03e07c1f; \
+ d += (s - d) * alpha >> 5; \
+ d &= 0x03e07c1f; \
+ dst = (Uint16)(d | d >> 16); \
} while(0)
/* used to save the destination format in the encoding. Designed to be
@@ -635,72 +635,72 @@ RLEAlphaClipBlit(int w, Uint8 * srcbuf, SDL_Surface * dst,
* Ctype the translucent count type, and do_blend the macro
* to blend one pixel.
*/
-#define RLEALPHACLIPBLIT(Ptype, Ctype, do_blend) \
- do { \
- int linecount = srcrect->h; \
- int left = srcrect->x; \
- int right = left + srcrect->w; \
- dstbuf -= left * sizeof(Ptype); \
- do { \
- int ofs = 0; \
- /* blit opaque pixels on one line */ \
- do { \
- unsigned run; \
- ofs += ((Ctype *)srcbuf)[0]; \
- run = ((Ctype *)srcbuf)[1]; \
- srcbuf += 2 * sizeof(Ctype); \
- if(run) { \
- /* clip to left and right borders */ \
- int cofs = ofs; \
- int crun = run; \
- if(left - cofs > 0) { \
- crun -= left - cofs; \
- cofs = left; \
- } \
- if(crun > right - cofs) \
- crun = right - cofs; \
- if(crun > 0) \
- PIXEL_COPY(dstbuf + cofs * sizeof(Ptype), \
- srcbuf + (cofs - ofs) * sizeof(Ptype), \
- (unsigned)crun, sizeof(Ptype)); \
- srcbuf += run * sizeof(Ptype); \
- ofs += run; \
- } else if(!ofs) \
- return; \
- } while(ofs < w); \
- /* skip padding if necessary */ \
- if(sizeof(Ptype) == 2) \
- srcbuf += (uintptr_t)srcbuf & 2; \
- /* blit translucent pixels on the same line */ \
- ofs = 0; \
- do { \
- unsigned run; \
- ofs += ((Uint16 *)srcbuf)[0]; \
- run = ((Uint16 *)srcbuf)[1]; \
- srcbuf += 4; \
- if(run) { \
- /* clip to left and right borders */ \
- int cofs = ofs; \
- int crun = run; \
- if(left - cofs > 0) { \
- crun -= left - cofs; \
- cofs = left; \
- } \
- if(crun > right - cofs) \
- crun = right - cofs; \
- if(crun > 0) { \
- Ptype *dst = (Ptype *)dstbuf + cofs; \
- Uint32 *src = (Uint32 *)srcbuf + (cofs - ofs); \
- int i; \
- for(i = 0; i < crun; i++) \
- do_blend(src[i], dst[i]); \
- } \
- srcbuf += run * 4; \
- ofs += run; \
- } \
- } while(ofs < w); \
- dstbuf += dst->pitch; \
- } while(--linecount); \
+#define RLEALPHACLIPBLIT(Ptype, Ctype, do_blend) \
+ do { \
+ int linecount = srcrect->h; \
+ int left = srcrect->x; \
+ int right = left + srcrect->w; \
+ dstbuf -= left * sizeof(Ptype); \
+ do { \
+ int ofs = 0; \
+ /* blit opaque pixels on one line */ \
+ do { \
+ unsigned run; \
+ ofs += ((Ctype *)srcbuf)[0]; \
+ run = ((Ctype *)srcbuf)[1]; \
+ srcbuf += 2 * sizeof(Ctype); \
+ if(run) { \
+ /* clip to left and right borders */ \
+ int cofs = ofs; \
+ int crun = run; \
+ if(left - cofs > 0) { \
+ crun -= left - cofs; \
+ cofs = left; \
+ } \
+ if(crun > right - cofs) \
+ crun = right - cofs; \
+ if(crun > 0) \
+ PIXEL_COPY(dstbuf + cofs * sizeof(Ptype), \
+ srcbuf + (cofs - ofs) * sizeof(Ptype), \
+ (unsigned)crun, sizeof(Ptype)); \
+ srcbuf += run * sizeof(Ptype); \
+ ofs += run; \
+ } else if(!ofs) \
+ return; \
+ } while(ofs < w); \
+ /* skip padding if necessary */ \
+ if(sizeof(Ptype) == 2) \
+ srcbuf += (uintptr_t)srcbuf & 2; \
+ /* blit translucent pixels on the same line */ \
+ ofs = 0; \
+ do { \
+ unsigned run; \
+ ofs += ((Uint16 *)srcbuf)[0]; \
+ run = ((Uint16 *)srcbuf)[1]; \
+ srcbuf += 4; \
+ if(run) { \
+ /* clip to left and right borders */ \
+ int cofs = ofs; \
+ int crun = run; \
+ if(left - cofs > 0) { \
+ crun -= left - cofs; \
+ cofs = left; \
+ } \
+ if(crun > right - cofs) \
+ crun = right - cofs; \
+ if(crun > 0) { \
+ Ptype *dst = (Ptype *)dstbuf + cofs; \
+ Uint32 *src = (Uint32 *)srcbuf + (cofs - ofs); \
+ int i; \
+ for(i = 0; i < crun; i++) \
+ do_blend(src[i], dst[i]); \
+ } \
+ srcbuf += run * 4; \
+ ofs += run; \
+ } \
+ } while(ofs < w); \
+ dstbuf += dst->pitch; \
+ } while(--linecount); \
} while(0)
switch (df->BytesPerPixel) {
@@ -804,50 +804,50 @@ SDL_RLEAlphaBlit(SDL_Surface * src, SDL_Rect * srcrect,
* Ctype the translucent count type, and do_blend the
* macro to blend one pixel.
*/
-#define RLEALPHABLIT(Ptype, Ctype, do_blend) \
- do { \
- int linecount = srcrect->h; \
- do { \
- int ofs = 0; \
- /* blit opaque pixels on one line */ \
- do { \
- unsigned run; \
- ofs += ((Ctype *)srcbuf)[0]; \
- run = ((Ctype *)srcbuf)[1]; \
- srcbuf += 2 * sizeof(Ctype); \
- if(run) { \
- PIXEL_COPY(dstbuf + ofs * sizeof(Ptype), srcbuf, \
- run, sizeof(Ptype)); \
- srcbuf += run * sizeof(Ptype); \
- ofs += run; \
- } else if(!ofs) \
- goto done; \
- } while(ofs < w); \
- /* skip padding if necessary */ \
- if(sizeof(Ptype) == 2) \
- srcbuf += (uintptr_t)srcbuf & 2; \
- /* blit translucent pixels on the same line */ \
- ofs = 0; \
- do { \
- unsigned run; \
- ofs += ((Uint16 *)srcbuf)[0]; \
- run = ((Uint16 *)srcbuf)[1]; \
- srcbuf += 4; \
- if(run) { \
- Ptype *dst = (Ptype *)dstbuf + ofs; \
- unsigned i; \
- for(i = 0; i < run; i++) { \
- Uint32 src = *(Uint32 *)srcbuf; \
- do_blend(src, *dst); \
- srcbuf += 4; \
- dst++; \
- } \
- ofs += run; \
- } \
- } while(ofs < w); \
- dstbuf += dst->pitch; \
- } while(--linecount); \
- } while(0)
+#define RLEALPHABLIT(Ptype, Ctype, do_blend) \
+ do { \
+ int linecount = srcrect->h; \
+ do { \
+ int ofs = 0; \
+ /* blit opaque pixels on one line */ \
+ do { \
+ unsigned run; \
+ ofs += ((Ctype *)srcbuf)[0]; \
+ run = ((Ctype *)srcbuf)[1]; \
+ srcbuf += 2 * sizeof(Ctype); \
+ if(run) { \
+ PIXEL_COPY(dstbuf + ofs * sizeof(Ptype), srcbuf, \
+ run, sizeof(Ptype)); \
+ srcbuf += run * sizeof(Ptype); \
+ ofs += run; \
+ } else if(!ofs) \
+ goto done; \
+ } while(ofs < w); \
+ /* skip padding if necessary */ \
+ if(sizeof(Ptype) == 2) \
+ srcbuf += (uintptr_t)srcbuf & 2; \
+ /* blit translucent pixels on the same line */ \
+ ofs = 0; \
+ do { \
+ unsigned run; \
+ ofs += ((Uint16 *)srcbuf)[0]; \
+ run = ((Uint16 *)srcbuf)[1]; \
+ srcbuf += 4; \
+ if(run) { \
+ Ptype *dst = (Ptype *)dstbuf + ofs; \
+ unsigned i; \
+ for(i = 0; i < run; i++) { \
+ Uint32 src = *(Uint32 *)srcbuf; \
+ do_blend(src, *dst); \
+ srcbuf += 4; \
+ dst++; \
+ } \
+ ofs += run; \
+ } \
+ } while(ofs < w); \
+ dstbuf += dst->pitch; \
+ } while(--linecount); \
+ } while(0)
switch (df->BytesPerPixel) {
case 2:
@@ -1012,7 +1012,7 @@ uncopy_32(Uint32 * dst, void *src, int n,
#define ISOPAQUE(pixel, fmt) ((((pixel) & fmt->Amask) >> fmt->Ashift) == 255)
-#define ISTRANSL(pixel, fmt) \
+#define ISTRANSL(pixel, fmt) \
((unsigned)((((pixel) & fmt->Amask) >> fmt->Ashift) - 1U) < 254U)
/* convert surface to be quickly alpha-blittable onto dest, if possible */
@@ -1117,20 +1117,20 @@ RLEAlphaSurface(SDL_Surface * surface)
Uint8 *lastline = dst; /* end of last non-blank line */
/* opaque counts are 8 or 16 bits, depending on target depth */
-#define ADD_OPAQUE_COUNTS(n, m) \
- if(df->BytesPerPixel == 4) { \
- ((Uint16 *)dst)[0] = n; \
- ((Uint16 *)dst)[1] = m; \
- dst += 4; \
- } else { \
- dst[0] = n; \
- dst[1] = m; \
- dst += 2; \
- }
+#define ADD_OPAQUE_COUNTS(n, m) \
+ if(df->BytesPerPixel == 4) { \
+ ((Uint16 *)dst)[0] = n; \
+ ((Uint16 *)dst)[1] = m; \
+ dst += 4; \
+ } else { \
+ dst[0] = n; \
+ dst[1] = m; \
+ dst += 2; \
+ }
/* translucent counts are always 16 bit */
-#define ADD_TRANSL_COUNTS(n, m) \
- (((Uint16 *)dst)[0] = n, ((Uint16 *)dst)[1] = m, dst += 4)
+#define ADD_TRANSL_COUNTS(n, m) \
+ (((Uint16 *)dst)[0] = n, ((Uint16 *)dst)[1] = m, dst += 4)
for (y = 0; y < h; y++) {
int runstart, skipstart;
@@ -1312,16 +1312,16 @@ RLEColorkeySurface(SDL_Surface * surface)
w = surface->w;
h = surface->h;
-#define ADD_COUNTS(n, m) \
- if(bpp == 4) { \
- ((Uint16 *)dst)[0] = n; \
- ((Uint16 *)dst)[1] = m; \
- dst += 4; \
- } else { \
- dst[0] = n; \
- dst[1] = m; \
- dst += 2; \
- }
+#define ADD_COUNTS(n, m) \
+ if(bpp == 4) { \
+ ((Uint16 *)dst)[0] = n; \
+ ((Uint16 *)dst)[1] = m; \
+ dst += 4; \
+ } else { \
+ dst[0] = n; \
+ dst[1] = m; \
+ dst += 2; \
+ }
for (y = 0; y < h; y++) {
int x = 0;
diff --git a/src/video/SDL_blit.h b/src/video/SDL_blit.h
index e9965561a9..7243e61937 100644
--- a/src/video/SDL_blit.h
+++ b/src/video/SDL_blit.h
@@ -118,289 +118,289 @@ extern SDL_BlitFunc SDL_CalculateBlitA(SDL_Surface * surface);
#endif
/* Load pixel of the specified format from a buffer and get its R-G-B values */
-#define RGB_FROM_PIXEL(Pixel, fmt, r, g, b) \
-{ \
- r = SDL_expand_byte[fmt->Rloss][((Pixel&fmt->Rmask)>>fmt->Rshift)]; \
- g = SDL_expand_byte[fmt->Gloss][((Pixel&fmt->Gmask)>>fmt->Gshift)]; \
- b = SDL_expand_byte[fmt->Bloss][((Pixel&fmt->Bmask)>>fmt->Bshift)]; \
+#define RGB_FROM_PIXEL(Pixel, fmt, r, g, b) \
+{ \
+ r = SDL_expand_byte[fmt->Rloss][((Pixel&fmt->Rmask)>>fmt->Rshift)]; \
+ g = SDL_expand_byte[fmt->Gloss][((Pixel&fmt->Gmask)>>fmt->Gshift)]; \
+ b = SDL_expand_byte[fmt->Bloss][((Pixel&fmt->Bmask)>>fmt->Bshift)]; \
}
-#define RGB_FROM_RGB565(Pixel, r, g, b) \
-{ \
- r = SDL_expand_byte[3][((Pixel&0xF800)>>11)]; \
- g = SDL_expand_byte[2][((Pixel&0x07E0)>>5)]; \
- b = SDL_expand_byte[3][(Pixel&0x001F)]; \
+#define RGB_FROM_RGB565(Pixel, r, g, b) \
+{ \
+ r = SDL_expand_byte[3][((Pixel&0xF800)>>11)]; \
+ g = SDL_expand_byte[2][((Pixel&0x07E0)>>5)]; \
+ b = SDL_expand_byte[3][(Pixel&0x001F)]; \
}
-#define RGB_FROM_RGB555(Pixel, r, g, b) \
-{ \
- r = SDL_expand_byte[3][((Pixel&0x7C00)>>10)]; \
- g = SDL_expand_byte[3][((Pixel&0x03E0)>>5)]; \
- b = SDL_expand_byte[3][(Pixel&0x001F)]; \
+#define RGB_FROM_RGB555(Pixel, r, g, b) \
+{ \
+ r = SDL_expand_byte[3][((Pixel&0x7C00)>>10)]; \
+ g = SDL_expand_byte[3][((Pixel&0x03E0)>>5)]; \
+ b = SDL_expand_byte[3][(Pixel&0x001F)]; \
}
-#define RGB_FROM_RGB888(Pixel, r, g, b) \
-{ \
- r = ((Pixel&0xFF0000)>>16); \
- g = ((Pixel&0xFF00)>>8); \
- b = (Pixel&0xFF); \
+#define RGB_FROM_RGB888(Pixel, r, g, b) \
+{ \
+ r = ((Pixel&0xFF0000)>>16); \
+ g = ((Pixel&0xFF00)>>8); \
+ b = (Pixel&0xFF); \
}
-#define RETRIEVE_RGB_PIXEL(buf, bpp, Pixel) \
-do { \
- switch (bpp) { \
- case 2: \
- Pixel = *((Uint16 *)(buf)); \
- break; \
- \
- case 3: { \
- Uint8 *B = (Uint8 *)(buf); \
- if (SDL_BYTEORDER == SDL_LIL_ENDIAN) { \
- Pixel = B[0] + (B[1] << 8) + (B[2] << 16); \
- } else { \
- Pixel = (B[0] << 16) + (B[1] << 8) + B[2]; \
- } \
- } \
- break; \
- \
- case 4: \
- Pixel = *((Uint32 *)(buf)); \
- break; \
- \
- default: \
- Pixel = 0; /* stop gcc complaints */ \
- break; \
- } \
+#define RETRIEVE_RGB_PIXEL(buf, bpp, Pixel) \
+do { \
+ switch (bpp) { \
+ case 2: \
+ Pixel = *((Uint16 *)(buf)); \
+ break; \
+ \
+ case 3: { \
+ Uint8 *B = (Uint8 *)(buf); \
+ if (SDL_BYTEORDER == SDL_LIL_ENDIAN) { \
+ Pixel = B[0] + (B[1] << 8) + (B[2] << 16); \
+ } else { \
+ Pixel = (B[0] << 16) + (B[1] << 8) + B[2]; \
+ } \
+ } \
+ break; \
+ \
+ case 4: \
+ Pixel = *((Uint32 *)(buf)); \
+ break; \
+ \
+ default: \
+ Pixel = 0; /* stop gcc complaints */ \
+ break; \
+ } \
} while (0)
-#define DISEMBLE_RGB(buf, bpp, fmt, Pixel, r, g, b) \
-do { \
- switch (bpp) { \
- case 2: \
- Pixel = *((Uint16 *)(buf)); \
- RGB_FROM_PIXEL(Pixel, fmt, r, g, b); \
- break; \
- \
- case 3: { \
+#define DISEMBLE_RGB(buf, bpp, fmt, Pixel, r, g, b) \
+do { \
+ switch (bpp) { \
+ case 2: \
+ Pixel = *((Uint16 *)(buf)); \
+ RGB_FROM_PIXEL(Pixel, fmt, r, g, b); \
+ break; \
+ \
+ case 3: { \
Pixel = 0; \
- if (SDL_BYTEORDER == SDL_LIL_ENDIAN) { \
- r = *((buf)+fmt->Rshift/8); \
- g = *((buf)+fmt->Gshift/8); \
- b = *((buf)+fmt->Bshift/8); \
- } else { \
- r = *((buf)+2-fmt->Rshift/8); \
- g = *((buf)+2-fmt->Gshift/8); \
- b = *((buf)+2-fmt->Bshift/8); \
- } \
- } \
- break; \
- \
- case 4: \
- Pixel = *((Uint32 *)(buf)); \
- RGB_FROM_PIXEL(Pixel, fmt, r, g, b); \
- break; \
- \
- default: \
- /* stop gcc complaints */ \
- Pixel = 0; \
+ if (SDL_BYTEORDER == SDL_LIL_ENDIAN) { \
+ r = *((buf)+fmt->Rshift/8); \
+ g = *((buf)+fmt->Gshift/8); \
+ b = *((buf)+fmt->Bshift/8); \
+ } else { \
+ r = *((buf)+2-fmt->Rshift/8); \
+ g = *((buf)+2-fmt->Gshift/8); \
+ b = *((buf)+2-fmt->Bshift/8); \
+ } \
+ } \
+ break; \
+ \
+ case 4: \
+ Pixel = *((Uint32 *)(buf)); \
+ RGB_FROM_PIXEL(Pixel, fmt, r, g, b); \
+ break; \
+ \
+ default: \
+ /* stop gcc complaints */ \
+ Pixel = 0; \
r = g = b = 0; \
- break; \
- } \
+ break; \
+ } \
} while (0)
/* Assemble R-G-B values into a specified pixel format and store them */
-#define PIXEL_FROM_RGB(Pixel, fmt, r, g, b) \
-{ \
- Pixel = ((r>>fmt->Rloss)<<fmt->Rshift)| \
- ((g>>fmt->Gloss)<<fmt->Gshift)| \
- ((b>>fmt->Bloss)<<fmt->Bshift)| \
- fmt->Amask; \
+#define PIXEL_FROM_RGB(Pixel, fmt, r, g, b) \
+{ \
+ Pixel = ((r>>fmt->Rloss)<<fmt->Rshift)| \
+ ((g>>fmt->Gloss)<<fmt->Gshift)| \
+ ((b>>fmt->Bloss)<<fmt->Bshift)| \
+ fmt->Amask; \
}
-#define RGB565_FROM_RGB(Pixel, r, g, b) \
-{ \
- Pixel = ((r>>3)<<11)|((g>>2)<<5)|(b>>3); \
+#define RGB565_FROM_RGB(Pixel, r, g, b) \
+{ \
+ Pixel = ((r>>3)<<11)|((g>>2)<<5)|(b>>3); \
}
-#define RGB555_FROM_RGB(Pixel, r, g, b) \
-{ \
- Pixel = ((r>>3)<<10)|((g>>3)<<5)|(b>>3); \
+#define RGB555_FROM_RGB(Pixel, r, g, b) \
+{ \
+ Pixel = ((r>>3)<<10)|((g>>3)<<5)|(b>>3); \
}
-#define RGB888_FROM_RGB(Pixel, r, g, b) \
-{ \
- Pixel = (r<<16)|(g<<8)|b; \
+#define RGB888_FROM_RGB(Pixel, r, g, b) \
+{ \
+ Pixel = (r<<16)|(g<<8)|b; \
}
-#define ARGB8888_FROM_RGBA(Pixel, r, g, b, a) \
-{ \
- Pixel = (a<<24)|(r<<16)|(g<<8)|b; \
+#define ARGB8888_FROM_RGBA(Pixel, r, g, b, a) \
+{ \
+ Pixel = (a<<24)|(r<<16)|(g<<8)|b; \
}
-#define RGBA8888_FROM_RGBA(Pixel, r, g, b, a) \
-{ \
- Pixel = (r<<24)|(g<<16)|(b<<8)|a; \
+#define RGBA8888_FROM_RGBA(Pixel, r, g, b, a) \
+{ \
+ Pixel = (r<<24)|(g<<16)|(b<<8)|a; \
}
-#define ABGR8888_FROM_RGBA(Pixel, r, g, b, a) \
-{ \
- Pixel = (a<<24)|(b<<16)|(g<<8)|r; \
+#define ABGR8888_FROM_RGBA(Pixel, r, g, b, a) \
+{ \
+ Pixel = (a<<24)|(b<<16)|(g<<8)|r; \
}
-#define BGRA8888_FROM_RGBA(Pixel, r, g, b, a) \
-{ \
- Pixel = (b<<24)|(g<<16)|(r<<8)|a; \
+#define BGRA8888_FROM_RGBA(Pixel, r, g, b, a) \
+{ \
+ Pixel = (b<<24)|(g<<16)|(r<<8)|a; \
}
-#define ASSEMBLE_RGB(buf, bpp, fmt, r, g, b) \
-{ \
- switch (bpp) { \
- case 2: { \
- Uint16 Pixel; \
- \
- PIXEL_FROM_RGB(Pixel, fmt, r, g, b); \
- *((Uint16 *)(buf)) = Pixel; \
- } \
- break; \
- \
- case 3: { \
- if (SDL_BYTEORDER == SDL_LIL_ENDIAN) { \
- *((buf)+fmt->Rshift/8) = r; \
- *((buf)+fmt->Gshift/8) = g; \
- *((buf)+fmt->Bshift/8) = b; \
- } else { \
- *((buf)+2-fmt->Rshift/8) = r; \
- *((buf)+2-fmt->Gshift/8) = g; \
- *((buf)+2-fmt->Bshift/8) = b; \
- } \
- } \
- break; \
- \
- case 4: { \
- Uint32 Pixel; \
- \
- PIXEL_FROM_RGB(Pixel, fmt, r, g, b); \
- *((Uint32 *)(buf)) = Pixel; \
- } \
- break; \
- } \
+#define ASSEMBLE_RGB(buf, bpp, fmt, r, g, b) \
+{ \
+ switch (bpp) { \
+ case 2: { \
+ Uint16 Pixel; \
+ \
+ PIXEL_FROM_RGB(Pixel, fmt, r, g, b); \
+ *((Uint16 *)(buf)) = Pixel; \
+ } \
+ break; \
+ \
+ case 3: { \
+ if (SDL_BYTEORDER == SDL_LIL_ENDIAN) { \
+ *((buf)+fmt->Rshift/8) = r; \
+ *((buf)+fmt->Gshift/8) = g; \
+ *((buf)+fmt->Bshift/8) = b; \
+ } else { \
+ *((buf)+2-fmt->Rshift/8) = r; \
+ *((buf)+2-fmt->Gshift/8) = g; \
+ *((buf)+2-fmt->Bshift/8) = b; \
+ } \
+ } \
+ break; \
+ \
+ case 4: { \
+ Uint32 Pixel; \
+ \
+ PIXEL_FROM_RGB(Pixel, fmt, r, g, b); \
+ *((Uint32 *)(buf)) = Pixel; \
+ } \
+ break; \
+ } \
}
/* FIXME: Should we rescale alpha into 0..255 here? */
-#define RGBA_FROM_PIXEL(Pixel, fmt, r, g, b, a) \
-{ \
- r = SDL_expand_byte[fmt->Rloss][((Pixel&fmt->Rmask)>>fmt->Rshift)]; \
- g = SDL_expand_byte[fmt->Gloss][((Pixel&fmt->Gmask)>>fmt->Gshift)]; \
- b = SDL_expand_byte[fmt->Bloss][((Pixel&fmt->Bmask)>>fmt->Bshift)]; \
- a = SDL_expand_byte[fmt->Aloss][((Pixel&fmt->Amask)>>fmt->Ashift)]; \
+#define RGBA_FROM_PIXEL(Pixel, fmt, r, g, b, a) \
+{ \
+ r = SDL_expand_byte[fmt->Rloss][((Pixel&fmt->Rmask)>>fmt->Rshift)]; \
+ g = SDL_expand_byte[fmt->Gloss][((Pixel&fmt->Gmask)>>fmt->Gshift)]; \
+ b = SDL_expand_byte[fmt->Bloss][((Pixel&fmt->Bmask)>>fmt->Bshift)]; \
+ a = SDL_expand_byte[fmt->Aloss][((Pixel&fmt->Amask)>>fmt->Ashift)]; \
}
-#define RGBA_FROM_8888(Pixel, fmt, r, g, b, a) \
-{ \
- r = (Pixel&fmt->Rmask)>>fmt->Rshift; \
- g = (Pixel&fmt->Gmask)>>fmt->Gshift; \
- b = (Pixel&fmt->Bmask)>>fmt->Bshift; \
- a = (Pixel&fmt->Amask)>>fmt->Ashift; \
+#define RGBA_FROM_8888(Pixel, fmt, r, g, b, a) \
+{ \
+ r = (Pixel&fmt->Rmask)>>fmt->Rshift; \
+ g = (Pixel&fmt->Gmask)>>fmt->Gshift; \
+ b = (Pixel&fmt->Bmask)>>fmt->Bshift; \
+ a = (Pixel&fmt->Amask)>>fmt->Ashift; \
}
-#define RGBA_FROM_RGBA8888(Pixel, r, g, b, a) \
-{ \
- r = (Pixel>>24); \
- g = ((Pixel>>16)&0xFF); \
- b = ((Pixel>>8)&0xFF); \
- a = (Pixel&0xFF); \
+#define RGBA_FROM_RGBA8888(Pixel, r, g, b, a) \
+{ \
+ r = (Pixel>>24); \
+ g = ((Pixel>>16)&0xFF); \
+ b = ((Pixel>>8)&0xFF); \
+ a = (Pixel&0xFF); \
}
-#define RGBA_FROM_ARGB8888(Pixel, r, g, b, a) \
-{ \
- r = ((Pixel>>16)&0xFF); \
- g = ((Pixel>>8)&0xFF); \
- b = (Pixel&0xFF); \
- a = (Pixel>>24); \
+#define RGBA_FROM_ARGB8888(Pixel, r, g, b, a) \
+{ \
+ r = ((Pixel>>16)&0xFF); \
+ g = ((Pixel>>8)&0xFF); \
+ b = (Pixel&0xFF); \
+ a = (Pixel>>24); \
}
-#define RGBA_FROM_ABGR8888(Pixel, r, g, b, a) \
-{ \
- r = (Pixel&0xFF); \
- g = ((Pixel>>8)&0xFF); \
- b = ((Pixel>>16)&0xFF); \
- a = (Pixel>>24); \
+#define RGBA_FROM_ABGR8888(Pixel, r, g, b, a) \
+{ \
+ r = (Pixel&0xFF); \
+ g = ((Pixel>>8)&0xFF); \
+ b = ((Pixel>>16)&0xFF); \
+ a = (Pixel>>24); \
}
-#define RGBA_FROM_BGRA8888(Pixel, r, g, b, a) \
-{ \
- r = ((Pixel>>8)&0xFF); \
- g = ((Pixel>>16)&0xFF); \
- b = (Pixel>>24); \
- a = (Pixel&0xFF); \
+#define RGBA_FROM_BGRA8888(Pixel, r, g, b, a) \
+{ \
+ r = ((Pixel>>8)&0xFF); \
+ g = ((Pixel>>16)&0xFF); \
+ b = (Pixel>>24); \
+ a = (Pixel&0xFF); \
}
-#define DISEMBLE_RGBA(buf, bpp, fmt, Pixel, r, g, b, a) \
-do { \
- switch (bpp) { \
- case 2: \
- Pixel = *((Uint16 *)(buf)); \
- RGBA_FROM_PIXEL(Pixel, fmt, r, g, b, a); \
- break; \
- \
- case 3: { \
+#define DISEMBLE_RGBA(buf, bpp, fmt, Pixel, r, g, b, a) \
+do { \
+ switch (bpp) { \
+ case 2: \
+ Pixel = *((Uint16 *)(buf)); \
+ RGBA_FROM_PIXEL(Pixel, fmt, r, g, b, a); \
+ break; \
+ \
+ case 3: { \
Pixel = 0; \
- if (SDL_BYTEORDER == SDL_LIL_ENDIAN) { \
- r = *((buf)+fmt->Rshift/8); \
- g = *((buf)+fmt->Gshift/8); \
- b = *((buf)+fmt->Bshift/8); \
- } else { \
- r = *((buf)+2-fmt->Rshift/8); \
- g = *((buf)+2-fmt->Gshift/8); \
- b = *((buf)+2-fmt->Bshift/8); \
- } \
- a = 0xFF; \
- } \
- break; \
- \
- case 4: \
- Pixel = *((Uint32 *)(buf)); \
- RGBA_FROM_PIXEL(Pixel, fmt, r, g, b, a); \
- break; \
- \
- default: \
- /* stop gcc complaints */ \
- Pixel = 0; \
+ if (SDL_BYTEORDER == SDL_LIL_ENDIAN) { \
+ r = *((buf)+fmt->Rshift/8); \
+ g = *((buf)+fmt->Gshift/8); \
+ b = *((buf)+fmt->Bshift/8); \
+ } else { \
+ r = *((buf)+2-fmt->Rshift/8); \
+ g = *((buf)+2-fmt->Gshift/8); \
+ b = *((buf)+2-fmt->Bshift/8); \
+ } \
+ a = 0xFF; \
+ } \
+ break; \
+ \
+ case 4: \
+ Pixel = *((Uint32 *)(buf)); \
+ RGBA_FROM_PIXEL(Pixel, fmt, r, g, b, a); \
+ break; \
+ \
+ default: \
+ /* stop gcc complaints */ \
+ Pixel = 0; \
r = g = b = a = 0; \
- break; \
- } \
+ break; \
+ } \
} while (0)
/* FIXME: this isn't correct, especially for Alpha (maximum != 255) */
-#define PIXEL_FROM_RGBA(Pixel, fmt, r, g, b, a) \
-{ \
- Pixel = ((r>>fmt->Rloss)<<fmt->Rshift)| \
- ((g>>fmt->Gloss)<<fmt->Gshift)| \
- ((b>>fmt->Bloss)<<fmt->Bshift)| \
- ((a>>fmt->Aloss)<<fmt->Ashift); \
+#define PIXEL_FROM_RGBA(Pixel, fmt, r, g, b, a) \
+{ \
+ Pixel = ((r>>fmt->Rloss)<<fmt->Rshift)| \
+ ((g>>fmt->Gloss)<<fmt->Gshift)| \
+ ((b>>fmt->Bloss)<<fmt->Bshift)| \
+ ((a>>fmt->Aloss)<<fmt->Ashift); \
}
-#define ASSEMBLE_RGBA(buf, bpp, fmt, r, g, b, a) \
-{ \
- switch (bpp) { \
- case 2: { \
- Uint16 Pixel; \
- \
- PIXEL_FROM_RGBA(Pixel, fmt, r, g, b, a); \
- *((Uint16 *)(buf)) = Pixel; \
- } \
- break; \
- \
- case 3: { \
- if (SDL_BYTEORDER == SDL_LIL_ENDIAN) { \
- *((buf)+fmt->Rshift/8) = r; \
- *((buf)+fmt->Gshift/8) = g; \
- *((buf)+fmt->Bshift/8) = b; \
- } else { \
- *((buf)+2-fmt->Rshift/8) = r; \
- *((buf)+2-fmt->Gshift/8) = g; \
- *((buf)+2-fmt->Bshift/8) = b; \
- } \
- } \
- break; \
- \
- case 4: { \
- Uint32 Pixel; \
- \
- PIXEL_FROM_RGBA(Pixel, fmt, r, g, b, a); \
- *((Uint32 *)(buf)) = Pixel; \
- } \
- break; \
- } \
+#define ASSEMBLE_RGBA(buf, bpp, fmt, r, g, b, a) \
+{ \
+ switch (bpp) { \
+ case 2: { \
+ Uint16 Pixel; \
+ \
+ PIXEL_FROM_RGBA(Pixel, fmt, r, g, b, a); \
+ *((Uint16 *)(buf)) = Pixel; \
+ } \
+ break; \
+ \
+ case 3: { \
+ if (SDL_BYTEORDER == SDL_LIL_ENDIAN) { \
+ *((buf)+fmt->Rshift/8) = r; \
+ *((buf)+fmt->Gshift/8) = g; \
+ *((buf)+fmt->Bshift/8) = b; \
+ } else { \
+ *((buf)+2-fmt->Rshift/8) = r; \
+ *((buf)+2-fmt->Gshift/8) = g; \
+ *((buf)+2-fmt->Bshift/8) = b; \
+ } \
+ } \
+ break; \
+ \
+ case 4: { \
+ Uint32 Pixel; \
+ \
+ PIXEL_FROM_RGBA(Pixel, fmt, r, g, b, a); \
+ *((Uint32 *)(buf)) = Pixel; \
+ } \
+ break; \
+ } \
}
/* Blend the RGB values of two Pixels based on a source alpha value */
-#define ALPHA_BLEND(sR, sG, sB, A, dR, dG, dB) \
-do { \
- dR = ((((int)(sR-dR)*(int)A)/255)+dR); \
- dG = ((((int)(sG-dG)*(int)A)/255)+dG); \
- dB = ((((int)(sB-dB)*(int)A)/255)+dB); \
+#define ALPHA_BLEND(sR, sG, sB, A, dR, dG, dB) \
+do { \
+ dR = ((((int)(sR-dR)*(int)A)/255)+dR); \
+ dG = ((((int)(sG-dG)*(int)A)/255)+dG); \
+ dB = ((((int)(sB-dB)*(int)A)/255)+dB); \
} while(0)
@@ -413,75 +413,75 @@ do { \
#ifdef USE_DUFFS_LOOP
/* 8-times unrolled loop */
-#define DUFFS_LOOP8(pixel_copy_increment, width) \
-{ int n = (width+7)/8; \
- switch (width & 7) { \
- case 0: do { pixel_copy_increment; \
- case 7: pixel_copy_increment; \
- case 6: pixel_copy_increment; \
- case 5: pixel_copy_increment; \
- case 4: pixel_copy_increment; \
- case 3: pixel_copy_increment; \
- case 2: pixel_copy_increment; \
- case 1: pixel_copy_increment; \
- } while ( --n > 0 ); \
- } \
+#define DUFFS_LOOP8(pixel_copy_increment, width) \
+{ int n = (width+7)/8; \
+ switch (width & 7) { \
+ case 0: do { pixel_copy_increment; \
+ case 7: pixel_copy_increment; \
+ case 6: pixel_copy_increment; \
+ case 5: pixel_copy_increment; \
+ case 4: pixel_copy_increment; \
+ case 3: pixel_copy_increment; \
+ case 2: pixel_copy_increment; \
+ case 1: pixel_copy_increment; \
+ } while ( --n > 0 ); \
+ } \
}
/* 4-times unrolled loop */
-#define DUFFS_LOOP4(pixel_copy_increment, width) \
-{ int n = (width+3)/4; \
- switch (width & 3) { \
- case 0: do { pixel_copy_increment; \
- case 3: pixel_copy_increment; \
- case 2: pixel_copy_increment; \
- case 1: pixel_copy_increment; \
- } while (--n > 0); \
- } \
+#define DUFFS_LOOP4(pixel_copy_increment, width) \
+{ int n = (width+3)/4; \
+ switch (width & 3) { \
+ case 0: do { pixel_copy_increment; \
+ case 3: pixel_copy_increment; \
+ case 2: pixel_copy_increment; \
+ case 1: pixel_copy_increment; \
+ } while (--n > 0); \
+ } \
}
/* Use the 8-times version of the loop by default */
-#define DUFFS_LOOP(pixel_copy_increment, width) \
- DUFFS_LOOP8(pixel_copy_increment, width)
+#define DUFFS_LOOP(pixel_copy_increment, width) \
+ DUFFS_LOOP8(pixel_copy_increment, width)
/* Special version of Duff's device for even more optimization */
-#define DUFFS_LOOP_124(pixel_copy_increment1, \
- pixel_copy_increment2, \
- pixel_copy_increment4, width) \
-{ int n = width; \
- if (n & 1) { \
- pixel_copy_increment1; n -= 1; \
- } \
- if (n & 2) { \
- pixel_copy_increment2; n -= 2; \
- } \
- if (n) { \
- n = (n+7)/ 8; \
- switch (n & 4) { \
- case 0: do { pixel_copy_increment4; \
- case 4: pixel_copy_increment4; \
- } while (--n > 0); \
- } \
- } \
+#define DUFFS_LOOP_124(pixel_copy_increment1, \
+ pixel_copy_increment2, \
+ pixel_copy_increment4, width) \
+{ int n = width; \
+ if (n & 1) { \
+ pixel_copy_increment1; n -= 1; \
+ } \
+ if (n & 2) { \
+ pixel_copy_increment2; n -= 2; \
+ } \
+ if (n) { \
+ n = (n+7)/ 8; \
+ switch (n & 4) { \
+ case 0: do { pixel_copy_increment4; \
+ case 4: pixel_copy_increment4; \
+ } while (--n > 0); \
+ } \
+ } \
}
#else
/* Don't use Duff's device to unroll loops */
-#define DUFFS_LOOP(pixel_copy_increment, width) \
-{ int n; \
- for ( n=width; n > 0; --n ) { \
- pixel_copy_increment; \
- } \
+#define DUFFS_LOOP(pixel_copy_increment, width) \
+{ int n; \
+ for ( n=width; n > 0; --n ) { \
+ pixel_copy_increment; \
+ } \
}
-#define DUFFS_LOOP8(pixel_copy_increment, width) \
- DUFFS_LOOP(pixel_copy_increment, width)
-#define DUFFS_LOOP4(pixel_copy_increment, width) \
- DUFFS_LOOP(pixel_copy_increment, width)
-#define DUFFS_LOOP_124(pixel_copy_increment1, \
- pixel_copy_increment2, \
- pixel_copy_increment4, width) \
- DUFFS_LOOP(pixel_copy_increment1, width)
+#define DUFFS_LOOP8(pixel_copy_increment, width) \
+ DUFFS_LOOP(pixel_copy_increment, width)
+#define DUFFS_LOOP4(pixel_copy_increment, width) \
+ DUFFS_LOOP(pixel_copy_increment, width)
+#define DUFFS_LOOP_124(pixel_copy_increment1, \
+ pixel_copy_increment2, \
+ pixel_copy_increment4, width) \
+ DUFFS_LOOP(pixel_copy_increment1, width)
#endif /* USE_DUFFS_LOOP */
diff --git a/src/video/SDL_bmp.c b/src/video/SDL_bmp.c
index 5b861dd93d..7ee65d85d7 100644
--- a/src/video/SDL_bmp.c
+++ b/src/video/SDL_bmp.c
@@ -20,14 +20,14 @@
*/
#include "SDL_config.h"
-/*
+/*
Code to load and save surfaces in Windows BMP format.
Why support BMP format? Well, it's a native format for Windows, and
most image processing programs can read and write it. It would be nice
to be able to have at least one image format that we can natively load
and save, and since PNG is so complex that it would bloat the library,
- BMP is a good alternative.
+ BMP is a good alternative.
This code currently supports Win32 DIBs in uncompressed 8 and 24 bpp.
*/
@@ -40,10 +40,10 @@
/* Compression encodings for BMP files */
#ifndef BI_RGB
-#define BI_RGB 0
-#define BI_RLE8 1
-#define BI_RLE4 2
-#define BI_BITFIELDS 3
+#define BI_RGB 0
+#define BI_RLE8 1
+#define BI_RLE4 2
+#define BI_BITFIELDS 3
#endif
@@ -439,7 +439,7 @@ SDL_SaveBMP_RW(SDL_Surface * saveme, SDL_RWops * dst, int freedst)
/* If the surface has a colorkey or alpha channel we'll save a
32-bit BMP with alpha channel, otherwise save a 24-bit BMP. */
if (save32bit) {
- SDL_InitFormat(&format,
+ SDL_InitFormat(&format,
#if SDL_BYTEORDER == SDL_LIL_ENDIAN
SDL_PIXELFORMAT_ARGB8888
#else
diff --git a/src/video/SDL_pixels.c b/src/video/SDL_pixels.c
index 271a17d3c6..c472c38b5e 100644
--- a/src/video/SDL_pixels.c
+++ b/src/video/SDL_pixels.c
@@ -139,7 +139,7 @@ SDL_PixelFormatEnumToMasks(Uint32 format, int *bpp, Uint32 * Rmask,
SDL_SetError("FOURCC pixel formats are not supported");
return SDL_FALSE;
}
-
+
/* Initialize the values here */
if (SDL_BYTESPERPIXEL(format) <= 2) {
*bpp = SDL_BITSPERPIXEL(format);
@@ -615,7 +615,7 @@ SDL_Palette *
SDL_AllocPalette(int ncolors)
{
SDL_Palette *palette;
-
+
/* Input validation */
if (ncolors < 1) {
SDL_InvalidParamError("ncolors");
@@ -741,7 +741,7 @@ SDL_DitherColors(SDL_Color * colors, int bpp)
}
}
-/*
+/*
* Calculate the pad-aligned scanline width of a surface
*/
int
@@ -1055,7 +1055,7 @@ SDL_MapSurface(SDL_Surface * src, SDL_Surface * dst)
while we're still pointing at it.
A better method would be for the destination surface to keep
- track of surfaces that are mapped to it and automatically
+ track of surfaces that are mapped to it and automatically
invalidate them when it is freed, but this will do for now.
*/
++map->dst->refcount;
@@ -1090,7 +1090,7 @@ void
SDL_CalculateGammaRamp(float gamma, Uint16 * ramp)
{
int i;
-
+
/* Input validation */
if (gamma < 0.0f ) {
SDL_InvalidParamError("gamma");
diff --git a/src/video/SDL_rect.c b/src/video/SDL_rect.c
index 045d3f1cff..8dcb5b6519 100644
--- a/src/video/SDL_rect.c
+++ b/src/video/SDL_rect.c
@@ -85,7 +85,7 @@ SDL_IntersectRect(const SDL_Rect * A, const SDL_Rect * B, SDL_Rect * result)
SDL_InvalidParamError("B");
return SDL_FALSE;
}
-
+
if (!result) {
SDL_InvalidParamError("result");
return SDL_FALSE;
@@ -97,7 +97,7 @@ SDL_IntersectRect(const SDL_Rect * A, const SDL_Rect * B, SDL_Rect * result)
result->h = 0;
return SDL_FALSE;
}
-
+
/* Horizontal intersection */
Amin = A->x;
Amax = Amin + A->w;
@@ -139,7 +139,7 @@ SDL_UnionRect(const SDL_Rect * A, const SDL_Rect * B, SDL_Rect * result)
SDL_InvalidParamError("B");
return;
}
-
+
if (!result) {
SDL_InvalidParamError("result");
return;
@@ -155,14 +155,14 @@ SDL_UnionRect(const SDL_Rect * A, const SDL_Rect * B, SDL_Rect * result)
*result = *B;
return;
}
- } else {
+ } else {
if (SDL_RectEmpty(B)) {
/* A not empty, B empty */
*result = *A;
return;
- }
+ }
}
-
+
/* Horizontal union */
Amin = A->x;
Amax = Amin + A->w;
@@ -219,7 +219,7 @@ SDL_EnclosePoints(const SDL_Point * points, int count, const SDL_Rect * clip,
if (SDL_RectEmpty(clip)) {
return SDL_FALSE;
}
-
+
for (i = 0; i < count; ++i) {
x = points[i].x;
y = points[i].y;
@@ -259,7 +259,7 @@ SDL_EnclosePoints(const SDL_Point * points, int count, const SDL_Rect * clip,
if (result == NULL) {
return SDL_TRUE;
}
-
+
/* No clipping, always add the first point */
minx = maxx = points[0].x;
miny = maxy = points[0].y;
@@ -330,22 +330,22 @@ SDL_IntersectRectAndLine(const SDL_Rect * rect, int *X1, int *Y1, int *X2,
SDL_InvalidParamError("rect");
return SDL_FALSE;
}
-
+
if (!X1) {
SDL_InvalidParamError("X1");
return SDL_FALSE;
}
-
+
if (!Y1) {
SDL_InvalidParamError("Y1");
return SDL_FALSE;
}
-
+
if (!X2) {
SDL_InvalidParamError("X2");
return SDL_FALSE;
}
-
+
if (!Y2) {
SDL_InvalidParamError("Y2");
return SDL_FALSE;
@@ -355,7 +355,7 @@ SDL_IntersectRectAndLine(const SDL_Rect * rect, int *X1, int *Y1, int *X2,
if (SDL_RectEmpty(rect)) {
return SDL_FALSE;
}
-
+
x1 = *X1;
y1 = *Y1;
x2 = *X2;
diff --git a/src/video/SDL_shape.c b/src/video/SDL_shape.c
index c3094802d1..e9876e4104 100644
--- a/src/video/SDL_shape.c
+++ b/src/video/SDL_shape.c
@@ -30,7 +30,8 @@
#include "SDL_shape_internals.h"
SDL_Window*
-SDL_CreateShapedWindow(const char *title,unsigned int x,unsigned int y,unsigned int w,unsigned int h,Uint32 flags) {
+SDL_CreateShapedWindow(const char *title,unsigned int x,unsigned int y,unsigned int w,unsigned int h,Uint32 flags)
+{
SDL_Window *result = NULL;
result = SDL_CreateWindow(title,-1000,-1000,w,h,(flags | SDL_WINDOW_BORDERLESS) & (~SDL_WINDOW_FULLSCREEN) & (~SDL_WINDOW_RESIZABLE) /*& (~SDL_WINDOW_SHOWN)*/);
if(result != NULL) {
@@ -53,7 +54,8 @@ SDL_CreateShapedWindow(const char *title,unsigned int x,unsigned int y,unsigned
}
SDL_bool
-SDL_IsShapedWindow(const SDL_Window *window) {
+SDL_IsShapedWindow(const SDL_Window *window)
+{
if(window == NULL)
return SDL_FALSE;
else
@@ -62,7 +64,8 @@ SDL_IsShapedWindow(const SDL_Window *window) {
/* REQUIRES that bitmap point to a w-by-h bitmap with ppb pixels-per-byte. */
void
-SDL_CalculateShapeBitmap(SDL_WindowShapeMode mode,SDL_Surface *shape,Uint8* bitmap,Uint8 ppb) {
+SDL_CalculateShapeBitmap(SDL_WindowShapeMode mode,SDL_Surface *shape,Uint8* bitmap,Uint8 ppb)
+{
int x = 0;
int y = 0;
Uint8 r = 0,g = 0,b = 0,alpha = 0;
@@ -163,34 +166,35 @@ RecursivelyCalculateShapeTree(SDL_WindowShapeMode mode,SDL_Surface* mask,SDL_Rec
last_opaque = pixel_opaque;
if(last_opaque != pixel_opaque) {
result->kind = QuadShape;
- //These will stay the same.
+ /* These will stay the same. */
next.w = dimensions.w / 2;
next.h = dimensions.h / 2;
- //These will change from recursion to recursion.
+ /* These will change from recursion to recursion. */
next.x = dimensions.x;
next.y = dimensions.y;
result->data.children.upleft = (struct SDL_ShapeTree *)RecursivelyCalculateShapeTree(mode,mask,next);
next.x += next.w;
- //Unneeded: next.y = dimensions.y;
+ /* Unneeded: next.y = dimensions.y; */
result->data.children.upright = (struct SDL_ShapeTree *)RecursivelyCalculateShapeTree(mode,mask,next);
next.x = dimensions.x;
next.y += next.h;
result->data.children.downleft = (struct SDL_ShapeTree *)RecursivelyCalculateShapeTree(mode,mask,next);
next.x += next.w;
- //Unneeded: next.y = dimensions.y + dimensions.h /2;
+ /* Unneeded: next.y = dimensions.y + dimensions.h /2; */
result->data.children.downright = (struct SDL_ShapeTree *)RecursivelyCalculateShapeTree(mode,mask,next);
return result;
}
}
}
- //If we never recursed, all the pixels in this quadrant have the same "value".
+ /* If we never recursed, all the pixels in this quadrant have the same "value". */
result->kind = (last_opaque == SDL_TRUE ? OpaqueShape : TransparentShape);
result->data.shape = dimensions;
return result;
}
SDL_ShapeTree*
-SDL_CalculateShapeTree(SDL_WindowShapeMode mode,SDL_Surface* shape) {
+SDL_CalculateShapeTree(SDL_WindowShapeMode mode,SDL_Surface* shape)
+{
SDL_Rect dimensions = {0,0,shape->w,shape->h};
SDL_ShapeTree* result = NULL;
if(SDL_MUSTLOCK(shape))
@@ -202,7 +206,8 @@ SDL_CalculateShapeTree(SDL_WindowShapeMode mode,SDL_Surface* shape) {
}
void
-SDL_TraverseShapeTree(SDL_ShapeTree *tree,SDL_TraversalFunction function,void* closure) {
+SDL_TraverseShapeTree(SDL_ShapeTree *tree,SDL_TraversalFunction function,void* closure)
+{
SDL_assert(tree != NULL);
if(tree->kind == QuadShape) {
SDL_TraverseShapeTree((SDL_ShapeTree *)tree->data.children.upleft,function,closure);
@@ -215,7 +220,8 @@ SDL_TraverseShapeTree(SDL_ShapeTree *tree,SDL_TraversalFunction function,void* c
}
void
-SDL_FreeShapeTree(SDL_ShapeTree** shape_tree) {
+SDL_FreeShapeTree(SDL_ShapeTree** shape_tree)
+{
if((*shape_tree)->kind == QuadShape) {
SDL_FreeShapeTree((SDL_ShapeTree **)&(*shape_tree)->data.children.upleft);
SDL_FreeShapeTree((SDL_ShapeTree **)&(*shape_tree)->data.children.upright);
@@ -227,15 +233,16 @@ SDL_FreeShapeTree(SDL_ShapeTree** shape_tree) {
}
int
-SDL_SetWindowShape(SDL_Window *window,SDL_Surface *shape,SDL_WindowShapeMode *shape_mode) {
+SDL_SetWindowShape(SDL_Window *window,SDL_Surface *shape,SDL_WindowShapeMode *shape_mode)
+{
int result;
if(window == NULL || !SDL_IsShapedWindow(window))
- //The window given was not a shapeable window.
+ /* The window given was not a shapeable window. */
return SDL_NONSHAPEABLE_WINDOW;
if(shape == NULL)
- //Invalid shape argument.
+ /* Invalid shape argument. */
return SDL_INVALID_SHAPE_ARGUMENT;
-
+
if(shape_mode != NULL)
window->shaper->mode = *shape_mode;
result = SDL_GetVideoDevice()->shape_driver.SetWindowShape(window->shaper,shape,shape_mode);
@@ -249,21 +256,23 @@ SDL_SetWindowShape(SDL_Window *window,SDL_Surface *shape,SDL_WindowShapeMode *sh
}
static SDL_bool
-SDL_WindowHasAShape(SDL_Window *window) {
+SDL_WindowHasAShape(SDL_Window *window)
+{
if (window == NULL || !SDL_IsShapedWindow(window))
return SDL_FALSE;
return window->shaper->hasshape;
}
int
-SDL_GetShapedWindowMode(SDL_Window *window,SDL_WindowShapeMode *shape_mode) {
+SDL_GetShapedWindowMode(SDL_Window *window,SDL_WindowShapeMode *shape_mode)
+{
if(window != NULL && SDL_IsShapedWindow(window)) {
if(shape_mode == NULL) {
if(SDL_WindowHasAShape(window))
- //The window given has a shape.
+ /* The window given has a shape. */
return 0;
else
- //The window given is shapeable but lacks a shape.
+ /* The window given is shapeable but lacks a shape. */
return SDL_WINDOW_LACKS_SHAPE;
}
else {
@@ -272,6 +281,6 @@ SDL_GetShapedWindowMode(SDL_Window *window,SDL_WindowShapeMode *shape_mode) {
}
}
else
- //The window given is not a valid shapeable window.
+ /* The window given is not a valid shapeable window. */
return SDL_NONSHAPEABLE_WINDOW;
}
diff --git a/src/video/SDL_surface.c b/src/video/SDL_surface.c
index 94ce6eacc4..d1c57119cc 100644
--- a/src/video/SDL_surface.c
+++ b/src/video/SDL_surface.c
@@ -473,13 +473,13 @@ SDL_GetClipRect(SDL_Surface * surface, SDL_Rect * rect)
}
}
-/*
+/*
* Set up a blit between two surfaces -- split into three parts:
- * The upper part, SDL_UpperBlit(), performs clipping and rectangle
+ * The upper part, SDL_UpperBlit(), performs clipping and rectangle
* verification. The lower part is a pointer to a low level
* accelerated blitting function.
*
- * These parts are separated out and each used internally by this
+ * These parts are separated out and each used internally by this
* library in the optimimum places. They are exported so that if
* you know exactly what you are doing, you can optimize your code
* by calling the one(s) you need.
@@ -738,7 +738,7 @@ SDL_LowerBlitScaled(SDL_Surface * src, SDL_Rect * srcrect,
src->map->info.flags |= SDL_COPY_NEAREST;
if ( !(src->map->info.flags & complex_copy_flags) &&
- src->format->format == dst->format->format &&
+ src->format->format == dst->format->format &&
!SDL_ISPIXELFORMAT_INDEXED(src->format->format) ) {
return SDL_SoftStretch( src, &final_src, dst, &final_dst );
} else {
@@ -785,7 +785,7 @@ SDL_UnlockSurface(SDL_Surface * surface)
}
}
-/*
+/*
* Convert a surface into the specified pixel format.
*/
SDL_Surface *
@@ -854,7 +854,7 @@ SDL_ConvertSurface(SDL_Surface * surface, SDL_PixelFormat * format,
SDL_bool set_colorkey_by_color = SDL_FALSE;
if (surface->format->palette) {
- if (format->palette &&
+ if (format->palette &&
surface->format->palette->ncolors <= format->palette->ncolors &&
(SDL_memcmp(surface->format->palette->colors, format->palette->colors,
surface->format->palette->ncolors * sizeof(SDL_Color)) == 0)) {
@@ -917,7 +917,7 @@ SDL_ConvertSurfaceFormat(SDL_Surface * surface, Uint32 pixel_format,
*/
static __inline__ SDL_bool
SDL_CreateSurfaceOnStack(int width, int height, Uint32 pixel_format,
- void * pixels, int pitch, SDL_Surface * surface,
+ void * pixels, int pitch, SDL_Surface * surface,
SDL_PixelFormat * format, SDL_BlitMap * blitmap)
{
if (SDL_ISPIXELFORMAT_INDEXED(pixel_format)) {
diff --git a/src/video/SDL_sysvideo.h b/src/video/SDL_sysvideo.h
index 63f088fffe..45ca745075 100644
--- a/src/video/SDL_sysvideo.h
+++ b/src/video/SDL_sysvideo.h
@@ -35,19 +35,19 @@ typedef struct SDL_VideoDevice SDL_VideoDevice;
/* Define the SDL window-shaper structure */
struct SDL_WindowShaper
-{
+{
/* The window associated with the shaper */
SDL_Window *window;
-
+
/* The user's specified coordinates for the window, for once we give it a shape. */
Uint32 userx,usery;
-
+
/* The parameters for shape calculation. */
SDL_WindowShapeMode mode;
-
+
/* Has this window been assigned a shape? */
SDL_bool hasshape;
-
+
void *driverdata;
};
@@ -82,7 +82,7 @@ struct SDL_Window
SDL_Rect windowed;
SDL_DisplayMode fullscreen_mode;
-
+
float brightness;
Uint16 *gamma;
Uint16 *saved_gamma; /* (just offset into gamma) */
@@ -128,7 +128,7 @@ struct SDL_VideoDisplay
struct SDL_SysWMinfo;
/* Define the SDL video driver structure */
-#define _THIS SDL_VideoDevice *_this
+#define _THIS SDL_VideoDevice *_this
struct SDL_VideoDevice
{
diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c
index 034486e632..57cc934dfc 100644
--- a/src/video/SDL_video.c
+++ b/src/video/SDL_video.c
@@ -416,7 +416,7 @@ SDL_VideoInit(const char *driver_name)
if (_this != NULL) {
SDL_VideoQuit();
}
-
+
#if !SDL_TIMERS_DISABLED
SDL_InitTicks();
#endif
@@ -1013,12 +1013,12 @@ int
SDL_GetWindowDisplayMode(SDL_Window * window, SDL_DisplayMode * mode)
{
SDL_DisplayMode fullscreen_mode;
- SDL_VideoDisplay *display;
+ SDL_VideoDisplay *display;
if (!mode) {
return SDL_InvalidParamError("mode");
}
-
+
CHECK_WINDOW_MAGIC(window, -1);
fullscreen_mode = window->fullscreen_mode;
@@ -1028,15 +1028,15 @@ SDL_GetWindowDisplayMode(SDL_Window * window, SDL_DisplayMode * mode)
if (!fullscreen_mode.h) {
fullscreen_mode.h = window->h;
}
-
- display = SDL_GetDisplayForWindow(window);
- /* if in desktop size mode, just return the size of the desktop */
- if ( ( window->flags & SDL_WINDOW_FULLSCREEN_DESKTOP ) == SDL_WINDOW_FULLSCREEN_DESKTOP )
- {
- fullscreen_mode = display->desktop_mode;
- }
- else if (!SDL_GetClosestDisplayModeForDisplay(SDL_GetDisplayForWindow(window),
+ display = SDL_GetDisplayForWindow(window);
+
+ /* if in desktop size mode, just return the size of the desktop */
+ if ( ( window->flags & SDL_WINDOW_FULLSCREEN_DESKTOP ) == SDL_WINDOW_FULLSCREEN_DESKTOP )
+ {
+ fullscreen_mode = display->desktop_mode;
+ }
+ else if (!SDL_GetClosestDisplayModeForDisplay(SDL_GetDisplayForWindow(window),
&fullscreen_mode,
&fullscreen_mode)) {
return SDL_SetError("Couldn't find display mode match");
@@ -1110,13 +1110,13 @@ SDL_UpdateFullscreenMode(SDL_Window * window, SDL_bool fullscreen)
resized = SDL_FALSE;
}
- /* only do the mode change if we want exclusive fullscreen */
- if ( ( window->flags & SDL_WINDOW_FULLSCREEN_DESKTOP ) != SDL_WINDOW_FULLSCREEN_DESKTOP )
- SDL_SetDisplayModeForDisplay(display, &fullscreen_mode);
- else
- SDL_SetDisplayModeForDisplay(display, NULL);
+ /* only do the mode change if we want exclusive fullscreen */
+ if ( ( window->flags & SDL_WINDOW_FULLSCREEN_DESKTOP ) != SDL_WINDOW_FULLSCREEN_DESKTOP )
+ SDL_SetDisplayModeForDisplay(display, &fullscreen_mode);
+ else
+ SDL_SetDisplayModeForDisplay(display, NULL);
+
-
if (_this->SetWindowFullscreen) {
_this->SetWindowFullscreen(_this, other, display, SDL_TRUE);
}
@@ -1251,7 +1251,7 @@ SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint32 flags)
SDL_SetWindowTitle(window, title);
}
SDL_FinishWindowCreation(window, flags);
-
+
/* If the window was created fullscreen, make sure the mode code matches */
SDL_UpdateFullscreenMode(window, FULLSCREEN_VISIBLE(window));
@@ -1430,7 +1430,7 @@ SDL_SetWindowData(SDL_Window * window, const char *name, void *userdata)
SDL_WindowUserData *prev, *data;
CHECK_WINDOW_MAGIC(window, NULL);
-
+
/* Input validation */
if (name == NULL || SDL_strlen(name) == 0) {
SDL_InvalidParamError("name");
@@ -1602,7 +1602,7 @@ SDL_GetWindowSize(SDL_Window * window, int *w, int *h)
}
if (h) {
*h = window->h;
- }
+ }
}
void
@@ -1617,7 +1617,7 @@ SDL_SetWindowMinimumSize(SDL_Window * window, int min_w, int min_h)
SDL_InvalidParamError("min_h");
return;
}
-
+
if (!(window->flags & SDL_WINDOW_FULLSCREEN)) {
window->min_w = min_w;
window->min_h = min_h;
@@ -1653,7 +1653,7 @@ SDL_SetWindowMaximumSize(SDL_Window * window, int max_w, int max_h)
SDL_InvalidParamError("max_h");
return;
}
-
+
if (!(window->flags & SDL_WINDOW_FULLSCREEN)) {
window->max_w = max_w;
window->max_h = max_h;
@@ -1772,14 +1772,14 @@ SDL_SetWindowFullscreen(SDL_Window * window, Uint32 flags)
{
CHECK_WINDOW_MAGIC(window, -1);
- flags &= FULLSCREEN_MASK;
-
+ flags &= FULLSCREEN_MASK;
+
if ( flags == (window->flags & FULLSCREEN_MASK) ) {
return 0;
}
-
- /* clear the previous flags and OR in the new ones */
- window->flags &= ~FULLSCREEN_MASK;
+
+ /* clear the previous flags and OR in the new ones */
+ window->flags &= ~FULLSCREEN_MASK;
window->flags |= flags;
SDL_UpdateFullscreenMode(window, FULLSCREEN_VISIBLE(window));
@@ -2065,15 +2065,15 @@ SDL_OnWindowFocusGained(SDL_Window * window)
static SDL_bool ShouldMinimizeOnFocusLoss()
{
- const char *hint = SDL_GetHint(SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS);
- if (hint) {
- if (*hint == '0') {
- return SDL_FALSE;
- } else {
- return SDL_TRUE;
- }
- }
- return SDL_TRUE;
+ const char *hint = SDL_GetHint(SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS);
+ if (hint) {
+ if (*hint == '0') {
+ return SDL_FALSE;
+ } else {
+ return SDL_TRUE;
+ }
+ }
+ return SDL_TRUE;
}
void
@@ -2086,8 +2086,8 @@ SDL_OnWindowFocusLost(SDL_Window * window)
SDL_UpdateWindowGrab(window);
/* If we're fullscreen on a single-head system and lose focus, minimize */
- if ((window->flags & SDL_WINDOW_FULLSCREEN) && ShouldMinimizeOnFocusLoss() ) {
- SDL_MinimizeWindow(window);
+ if ((window->flags & SDL_WINDOW_FULLSCREEN) && ShouldMinimizeOnFocusLoss() ) {
+ SDL_MinimizeWindow(window);
}
}
@@ -2472,27 +2472,27 @@ SDL_GL_SetAttribute(SDL_GLattr attr, int value)
break;
case SDL_GL_CONTEXT_FLAGS:
if( value & ~(SDL_GL_CONTEXT_DEBUG_FLAG |
- SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG |
- SDL_GL_CONTEXT_ROBUST_ACCESS_FLAG |
- SDL_GL_CONTEXT_RESET_ISOLATION_FLAG) ) {
- retval = SDL_SetError("Unknown OpenGL context flag %d", value);
- break;
- }
+ SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG |
+ SDL_GL_CONTEXT_ROBUST_ACCESS_FLAG |
+ SDL_GL_CONTEXT_RESET_ISOLATION_FLAG) ) {
+ retval = SDL_SetError("Unknown OpenGL context flag %d", value);
+ break;
+ }
_this->gl_config.flags = value;
break;
case SDL_GL_CONTEXT_PROFILE_MASK:
if( value != 0 &&
- value != SDL_GL_CONTEXT_PROFILE_CORE &&
- value != SDL_GL_CONTEXT_PROFILE_COMPATIBILITY &&
- value != SDL_GL_CONTEXT_PROFILE_ES ) {
- retval = SDL_SetError("Unknown OpenGL context profile %d", value);
- break;
- }
+ value != SDL_GL_CONTEXT_PROFILE_CORE &&
+ value != SDL_GL_CONTEXT_PROFILE_COMPATIBILITY &&
+ value != SDL_GL_CONTEXT_PROFILE_ES ) {
+ retval = SDL_SetError("Unknown OpenGL context profile %d", value);
+ break;
+ }
_this->gl_config.profile_mask = value;
break;
case SDL_GL_SHARE_WITH_CURRENT_CONTEXT:
_this->gl_config.share_with_current_context = value;
- break;
+ break;
default:
retval = SDL_SetError("Unknown OpenGL attribute");
break;
@@ -2779,7 +2779,7 @@ SDL_GL_DeleteContext(SDL_GLContext context)
_this->GL_DeleteContext(_this, context);
}
-#if 0 // FIXME
+#if 0 /* FIXME */
/*
* Utility function used by SDL_WM_SetIcon(); flags & 1 for color key, flags
* & 2 for alpha channel.
@@ -2790,7 +2790,7 @@ CreateMaskFromColorKeyOrAlpha(SDL_Surface * icon, Uint8 * mask, int flags)
int x, y;
Uint32 colorkey;
#define SET_MASKBIT(icon, x, y, mask) \
- mask[(y*((icon->w+7)/8))+(x/8)] &= ~(0x01<<(7-(x%8)))
+ mask[(y*((icon->w+7)/8))+(x/8)] &= ~(0x01<<(7-(x%8)))
colorkey = icon->format->colorkey;
switch (icon->format->BytesPerPixel) {
@@ -2985,18 +2985,18 @@ int
SDL_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
{
int dummybutton;
- int retval = -1;
- SDL_bool relative_mode = SDL_GetRelativeMouseMode();
- int show_cursor_prev = SDL_ShowCursor( 1 );
+ int retval = -1;
+ SDL_bool relative_mode = SDL_GetRelativeMouseMode();
+ int show_cursor_prev = SDL_ShowCursor( 1 );
- SDL_SetRelativeMouseMode( SDL_FALSE );
+ SDL_SetRelativeMouseMode( SDL_FALSE );
if (!buttonid) {
buttonid = &dummybutton;
}
if (_this && _this->ShowMessageBox) {
if (_this->ShowMessageBox(_this, messageboxdata, buttonid) == 0) {
- retval = 0;
+ retval = 0;
}
}
@@ -3022,12 +3022,12 @@ SDL_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
}
#endif
- SDL_ShowCursor( show_cursor_prev );
- SDL_SetRelativeMouseMode( relative_mode );
+ SDL_ShowCursor( show_cursor_prev );
+ SDL_SetRelativeMouseMode( relative_mode );
- if(retval == -1) {
- SDL_SetError("No message system available");
- }
+ if(retval == -1) {
+ SDL_SetError("No message system available");
+ }
return retval;
}
@@ -3056,15 +3056,15 @@ SDL_ShowSimpleMessageBox(Uint32 flags, const char *title, const char *message, S
SDL_bool
SDL_ShouldAllowTopmost(void)
{
- const char *hint = SDL_GetHint(SDL_HINT_ALLOW_TOPMOST);
- if (hint) {
- if (*hint == '0') {
- return SDL_FALSE;
- } else {
- return SDL_TRUE;
- }
- }
- return SDL_TRUE;
+ const char *hint = SDL_GetHint(SDL_HINT_ALLOW_TOPMOST);
+ if (hint) {
+ if (*hint == '0') {
+ return SDL_FALSE;
+ } else {
+ return SDL_TRUE;
+ }
+ }
+ return SDL_TRUE;
}
/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/video/android/SDL_androidkeyboard.c b/src/video/android/SDL_androidkeyboard.c
index 88b904acf0..512007a2fa 100644
--- a/src/video/android/SDL_androidkeyboard.c
+++ b/src/video/android/SDL_androidkeyboard.c
@@ -322,7 +322,7 @@ Android_SetTextInputRect(_THIS, SDL_Rect *rect)
SDL_InvalidParamError("rect");
return;
}
-
+
videodata->textRect = *rect;
}
diff --git a/src/video/android/SDL_androidtouch.c b/src/video/android/SDL_androidtouch.c
index c8d5ae6d55..1b42b5f771 100644
--- a/src/video/android/SDL_androidtouch.c
+++ b/src/video/android/SDL_androidtouch.c
@@ -36,7 +36,7 @@
#define ACTION_MOVE 2
#define ACTION_CANCEL 3
#define ACTION_OUTSIDE 4
-// The following two are deprecated but it seems they are still emitted (instead the corresponding ACTION_UP/DOWN) as of Android 3.2
+/* The following two are deprecated but it seems they are still emitted (instead the corresponding ACTION_UP/DOWN) as of Android 3.2 */
#define ACTION_POINTER_1_DOWN 5
#define ACTION_POINTER_1_UP 6
@@ -52,7 +52,7 @@ static void Android_GetWindowCoordinates(float x, float y,
*window_y = (int)(y * window_h);
}
-void Android_OnTouch(int touch_device_id_in, int pointer_finger_id_in, int action, float x, float y, float p)
+void Android_OnTouch(int touch_device_id_in, int pointer_finger_id_in, int action, float x, float y, float p)
{
SDL_TouchID touchDeviceId = 0;
SDL_FingerID fingerId = 0;
@@ -104,7 +104,7 @@ void Android_OnTouch(int touch_device_id_in, int pointer_finger_id_in, int actio
break;
default:
break;
- }
+ }
}
#endif /* SDL_VIDEO_DRIVER_ANDROID */
diff --git a/src/video/android/SDL_androidvideo.c b/src/video/android/SDL_androidvideo.c
index ebf9535f53..4b4a85196b 100644
--- a/src/video/android/SDL_androidvideo.c
+++ b/src/video/android/SDL_androidvideo.c
@@ -48,7 +48,6 @@ static void Android_VideoQuit(_THIS);
extern int Android_GL_LoadLibrary(_THIS, const char *path);
extern void *Android_GL_GetProcAddress(_THIS, const char *proc);
extern void Android_GL_UnloadLibrary(_THIS);
-//extern int *Android_GL_GetVisual(_THIS, Display * display, int screen);
extern SDL_GLContext Android_GL_CreateContext(_THIS, SDL_Window * window);
extern int Android_GL_MakeCurrent(_THIS, SDL_Window * window,
SDL_GLContext context);
@@ -60,8 +59,7 @@ extern void Android_GL_DeleteContext(_THIS, SDL_GLContext context);
/* Android driver bootstrap functions */
-// These are filled in with real values in Android_SetScreenResolution on
-// init (before SDL_main())
+/* These are filled in with real values in Android_SetScreenResolution on init (before SDL_main()) */
int Android_ScreenWidth = 0;
int Android_ScreenHeight = 0;
Uint32 Android_ScreenFormat = SDL_PIXELFORMAT_UNKNOWN;
@@ -182,7 +180,7 @@ void
Android_SetScreenResolution(int width, int height, Uint32 format)
{
Android_ScreenWidth = width;
- Android_ScreenHeight = height;
+ Android_ScreenHeight = height;
Android_ScreenFormat = format;
if (Android_Window) {
diff --git a/src/video/android/SDL_androidwindow.c b/src/video/android/SDL_androidwindow.c
index 25a0e9f6f5..b3c6cd9a47 100644
--- a/src/video/android/SDL_androidwindow.c
+++ b/src/video/android/SDL_androidwindow.c
@@ -49,7 +49,7 @@ Android_CreateWindow(_THIS, SDL_Window * window)
window->flags |= SDL_WINDOW_FULLSCREEN; /* window is always fullscreen */
window->flags &= ~SDL_WINDOW_HIDDEN;
window->flags |= SDL_WINDOW_SHOWN; /* only one window on Android */
- window->flags |= SDL_WINDOW_INPUT_FOCUS; /* always has input focus */
+ window->flags |= SDL_WINDOW_INPUT_FOCUS; /* always has input focus */
/* One window, it always has focus */
SDL_SetMouseFocus(window);
diff --git a/src/video/bwindow/SDL_BWin.h b/src/video/bwindow/SDL_BWin.h
index 9d7a273b0a..fb576da688 100644
--- a/src/video/bwindow/SDL_BWin.h
+++ b/src/video/bwindow/SDL_BWin.h
@@ -47,23 +47,23 @@ extern "C" {
enum WinCommands {
- BWIN_MOVE_WINDOW,
- BWIN_RESIZE_WINDOW,
- BWIN_SHOW_WINDOW,
- BWIN_HIDE_WINDOW,
- BWIN_MAXIMIZE_WINDOW,
- BWIN_MINIMIZE_WINDOW,
- BWIN_RESTORE_WINDOW,
- BWIN_SET_TITLE,
- BWIN_SET_BORDERED,
- BWIN_FULLSCREEN
+ BWIN_MOVE_WINDOW,
+ BWIN_RESIZE_WINDOW,
+ BWIN_SHOW_WINDOW,
+ BWIN_HIDE_WINDOW,
+ BWIN_MAXIMIZE_WINDOW,
+ BWIN_MINIMIZE_WINDOW,
+ BWIN_RESTORE_WINDOW,
+ BWIN_SET_TITLE,
+ BWIN_SET_BORDERED,
+ BWIN_FULLSCREEN
};
class SDL_BWin:public BDirectWindow
{
public:
- /* Constructor/Destructor */
+ /* Constructor/Destructor */
SDL_BWin(BRect bounds, window_look look, uint32 flags)
: BDirectWindow(bounds, "Untitled", look, B_NORMAL_WINDOW_FEEL, flags)
{
@@ -85,7 +85,7 @@ class SDL_BWin:public BDirectWindow
_bitmap = NULL;
#ifdef DRAWTHREAD
_draw_thread_id = spawn_thread(BE_DrawThread, "drawing_thread",
- B_NORMAL_PRIORITY, (void*) this);
+ B_NORMAL_PRIORITY, (void*) this);
resume_thread(_draw_thread_id);
#endif
}
@@ -95,22 +95,22 @@ class SDL_BWin:public BDirectWindow
Lock();
_connection_disabled = true;
int32 result;
-
+
#if SDL_VIDEO_OPENGL
if (_SDL_GLView) {
_SDL_GLView->UnlockGL();
- RemoveChild(_SDL_GLView); /* Why was this outside the if
- statement before? */
+ RemoveChild(_SDL_GLView); /* Why was this outside the if
+ statement before? */
}
-
-#endif
+
+#endif
Unlock();
#if SDL_VIDEO_OPENGL
if (_SDL_GLView) {
delete _SDL_GLView;
}
#endif
-
+
/* Clean up framebuffer stuff */
_buffer_locker->Lock();
#ifdef DRAWTHREAD
@@ -119,7 +119,7 @@ class SDL_BWin:public BDirectWindow
free(_clips);
delete _buffer_locker;
}
-
+
/* * * * * OpenGL functionality * * * * */
#if SDL_VIDEO_OPENGL
@@ -133,186 +133,186 @@ class SDL_BWin:public BDirectWindow
}
AddChild(_SDL_GLView);
_SDL_GLView->EnableDirectMode(true);
- _SDL_GLView->LockGL(); /* "New" GLViews are created */
+ _SDL_GLView->LockGL(); /* "New" GLViews are created */
Unlock();
return (_SDL_GLView);
}
-
+
virtual void RemoveGLView() {
- Lock();
- if(_SDL_GLView) {
- _SDL_GLView->UnlockGL();
- RemoveChild(_SDL_GLView);
- }
- Unlock();
+ Lock();
+ if(_SDL_GLView) {
+ _SDL_GLView->UnlockGL();
+ RemoveChild(_SDL_GLView);
+ }
+ Unlock();
}
-
+
virtual void SwapBuffers(void) {
- _SDL_GLView->UnlockGL();
- _SDL_GLView->LockGL();
- _SDL_GLView->SwapBuffers();
- }
+ _SDL_GLView->UnlockGL();
+ _SDL_GLView->LockGL();
+ _SDL_GLView->SwapBuffers();
+ }
#endif
-
+
/* * * * * Framebuffering* * * * */
virtual void DirectConnected(direct_buffer_info *info) {
- if(!_connected && _connection_disabled) {
- return;
- }
-
- /* Determine if the pixel buffer is usable after this update */
- _trash_window_buffer = _trash_window_buffer
- || ((info->buffer_state & B_BUFFER_RESIZED)
- || (info->buffer_state & B_BUFFER_RESET)
- || (info->driver_state == B_MODE_CHANGED));
- LockBuffer();
-
- switch(info->buffer_state & B_DIRECT_MODE_MASK) {
- case B_DIRECT_START:
- _connected = true;
-
- case B_DIRECT_MODIFY:
- if(_clips) {
- free(_clips);
- _clips = NULL;
- }
-
- _num_clips = info->clip_list_count;
- _clips = (clipping_rect *)malloc(_num_clips*sizeof(clipping_rect));
- if(_clips) {
- memcpy(_clips, info->clip_list,
- _num_clips*sizeof(clipping_rect));
-
- _bits = (uint8*) info->bits;
- _row_bytes = info->bytes_per_row;
- _bounds = info->window_bounds;
- _bytes_per_px = info->bits_per_pixel / 8;
- _buffer_dirty = true;
- }
- break;
-
- case B_DIRECT_STOP:
- _connected = false;
- break;
- }
+ if(!_connected && _connection_disabled) {
+ return;
+ }
+
+ /* Determine if the pixel buffer is usable after this update */
+ _trash_window_buffer = _trash_window_buffer
+ || ((info->buffer_state & B_BUFFER_RESIZED)
+ || (info->buffer_state & B_BUFFER_RESET)
+ || (info->driver_state == B_MODE_CHANGED));
+ LockBuffer();
+
+ switch(info->buffer_state & B_DIRECT_MODE_MASK) {
+ case B_DIRECT_START:
+ _connected = true;
+
+ case B_DIRECT_MODIFY:
+ if(_clips) {
+ free(_clips);
+ _clips = NULL;
+ }
+
+ _num_clips = info->clip_list_count;
+ _clips = (clipping_rect *)malloc(_num_clips*sizeof(clipping_rect));
+ if(_clips) {
+ memcpy(_clips, info->clip_list,
+ _num_clips*sizeof(clipping_rect));
+
+ _bits = (uint8*) info->bits;
+ _row_bytes = info->bytes_per_row;
+ _bounds = info->window_bounds;
+ _bytes_per_px = info->bits_per_pixel / 8;
+ _buffer_dirty = true;
+ }
+ break;
+
+ case B_DIRECT_STOP:
+ _connected = false;
+ break;
+ }
#if SDL_VIDEO_OPENGL
- if(_SDL_GLView) {
- _SDL_GLView->DirectConnected(info);
- }
+ if(_SDL_GLView) {
+ _SDL_GLView->DirectConnected(info);
+ }
#endif
-
-
- /* Call the base object directconnected */
- BDirectWindow::DirectConnected(info);
-
- UnlockBuffer();
-
+
+
+ /* Call the base object directconnected */
+ BDirectWindow::DirectConnected(info);
+
+ UnlockBuffer();
+
}
-
-
-
-
+
+
+
+
/* * * * * Event sending * * * * */
/* Hook functions */
virtual void FrameMoved(BPoint origin) {
- /* Post a message to the BApp so that it can handle the window event */
- BMessage msg(BAPP_WINDOW_MOVED);
- msg.AddInt32("window-x", (int)origin.x);
- msg.AddInt32("window-y", (int)origin.y);
- _PostWindowEvent(msg);
-
- /* Perform normal hook operations */
- BDirectWindow::FrameMoved(origin);
+ /* Post a message to the BApp so that it can handle the window event */
+ BMessage msg(BAPP_WINDOW_MOVED);
+ msg.AddInt32("window-x", (int)origin.x);
+ msg.AddInt32("window-y", (int)origin.y);
+ _PostWindowEvent(msg);
+
+ /* Perform normal hook operations */
+ BDirectWindow::FrameMoved(origin);
}
-
+
virtual void FrameResized(float width, float height) {
- /* Post a message to the BApp so that it can handle the window event */
- BMessage msg(BAPP_WINDOW_RESIZED);
-
- msg.AddInt32("window-w", (int)width + 1);
- msg.AddInt32("window-h", (int)height + 1);
- _PostWindowEvent(msg);
-
- /* Perform normal hook operations */
- BDirectWindow::FrameResized(width, height);
+ /* Post a message to the BApp so that it can handle the window event */
+ BMessage msg(BAPP_WINDOW_RESIZED);
+
+ msg.AddInt32("window-w", (int)width + 1);
+ msg.AddInt32("window-h", (int)height + 1);
+ _PostWindowEvent(msg);
+
+ /* Perform normal hook operations */
+ BDirectWindow::FrameResized(width, height);
}
- virtual bool QuitRequested() {
- BMessage msg(BAPP_WINDOW_CLOSE_REQUESTED);
- _PostWindowEvent(msg);
+ virtual bool QuitRequested() {
+ BMessage msg(BAPP_WINDOW_CLOSE_REQUESTED);
+ _PostWindowEvent(msg);
- /* We won't allow a quit unless asked by DestroyWindow() */
- return false;
+ /* We won't allow a quit unless asked by DestroyWindow() */
+ return false;
}
-
+
virtual void WindowActivated(bool active) {
- BMessage msg(BAPP_KEYBOARD_FOCUS); /* Mouse focus sold separately */
- _PostWindowEvent(msg);
+ BMessage msg(BAPP_KEYBOARD_FOCUS); /* Mouse focus sold separately */
+ _PostWindowEvent(msg);
}
-
+
virtual void Zoom(BPoint origin,
- float width,
- float height) {
- BMessage msg(BAPP_MAXIMIZE); /* Closest thing to maximization Haiku has */
- _PostWindowEvent(msg);
-
- /* Before the window zooms, record its size */
- if( !_prev_frame )
- _prev_frame = new BRect(Frame());
-
- /* Perform normal hook operations */
- BDirectWindow::Zoom(origin, width, height);
+ float width,
+ float height) {
+ BMessage msg(BAPP_MAXIMIZE); /* Closest thing to maximization Haiku has */
+ _PostWindowEvent(msg);
+
+ /* Before the window zooms, record its size */
+ if( !_prev_frame )
+ _prev_frame = new BRect(Frame());
+
+ /* Perform normal hook operations */
+ BDirectWindow::Zoom(origin, width, height);
}
-
+
/* Member functions */
virtual void Show() {
- while(IsHidden()) {
- BDirectWindow::Show();
- }
- _shown = true;
+ while(IsHidden()) {
+ BDirectWindow::Show();
+ }
+ _shown = true;
- BMessage msg(BAPP_SHOW);
- _PostWindowEvent(msg);
+ BMessage msg(BAPP_SHOW);
+ _PostWindowEvent(msg);
}
-
+
virtual void Hide() {
- BDirectWindow::Hide();
- _shown = false;
+ BDirectWindow::Hide();
+ _shown = false;
- BMessage msg(BAPP_HIDE);
- _PostWindowEvent(msg);
+ BMessage msg(BAPP_HIDE);
+ _PostWindowEvent(msg);
}
virtual void Minimize(bool minimize) {
- BDirectWindow::Minimize(minimize);
- int32 minState = (minimize ? BAPP_MINIMIZE : BAPP_RESTORE);
-
- BMessage msg(minState);
- _PostWindowEvent(msg);
+ BDirectWindow::Minimize(minimize);
+ int32 minState = (minimize ? BAPP_MINIMIZE : BAPP_RESTORE);
+
+ BMessage msg(minState);
+ _PostWindowEvent(msg);
}
-
-
+
+
/* BView message interruption */
virtual void DispatchMessage(BMessage * msg, BHandler * target)
{
- BPoint where; /* Used by mouse moved */
- int32 buttons; /* Used for mouse button events */
- int32 key; /* Used for key events */
-
+ BPoint where; /* Used by mouse moved */
+ int32 buttons; /* Used for mouse button events */
+ int32 key; /* Used for key events */
+
switch (msg->what) {
case B_MOUSE_MOVED:
int32 transit;
if (msg->FindPoint("where", &where) == B_OK
&& msg->FindInt32("be:transit", &transit) == B_OK) {
- _MouseMotionEvent(where, transit);
+ _MouseMotionEvent(where, transit);
}
-
+
/* FIXME: Apparently a button press/release event might be dropped
if made before before a different button is released. Does
B_MOUSE_MOVED have the data needed to check if a mouse button
state has changed? */
if (msg->FindInt32("buttons", &buttons) == B_OK) {
- _MouseButtonEvent(buttons);
+ _MouseButtonEvent(buttons);
}
break;
@@ -321,32 +321,32 @@ class SDL_BWin:public BDirectWindow
/* _MouseButtonEvent() detects any and all buttons that may have
changed state, as well as that button's new state */
if (msg->FindInt32("buttons", &buttons) == B_OK) {
- _MouseButtonEvent(buttons);
+ _MouseButtonEvent(buttons);
}
break;
case B_MOUSE_WHEEL_CHANGED:
- float x, y;
- if (msg->FindFloat("be:wheel_delta_x", &x) == B_OK
- && msg->FindFloat("be:wheel_delta_y", &y) == B_OK) {
- _MouseWheelEvent((int)x, (int)y);
- }
- break;
+ float x, y;
+ if (msg->FindFloat("be:wheel_delta_x", &x) == B_OK
+ && msg->FindFloat("be:wheel_delta_y", &y) == B_OK) {
+ _MouseWheelEvent((int)x, (int)y);
+ }
+ break;
case B_KEY_DOWN:
case B_UNMAPPED_KEY_DOWN: /* modifier keys are unmapped */
- if (msg->FindInt32("key", &key) == B_OK) {
- _KeyEvent((SDL_Scancode)key, SDL_PRESSED);
- }
- break;
+ if (msg->FindInt32("key", &key) == B_OK) {
+ _KeyEvent((SDL_Scancode)key, SDL_PRESSED);
+ }
+ break;
case B_KEY_UP:
case B_UNMAPPED_KEY_UP: /* modifier keys are unmapped */
- if (msg->FindInt32("key", &key) == B_OK) {
- _KeyEvent(key, SDL_RELEASED);
+ if (msg->FindInt32("key", &key) == B_OK) {
+ _KeyEvent(key, SDL_RELEASED);
}
break;
-
+
default:
/* move it after switch{} so it's always handled
that way we keep BeOS feautures like:
@@ -359,263 +359,263 @@ class SDL_BWin:public BDirectWindow
BDirectWindow::DispatchMessage(msg, target);
}
-
+
/* Handle command messages */
virtual void MessageReceived(BMessage* message) {
- switch (message->what) {
- /* Handle commands from SDL */
- case BWIN_SET_TITLE:
- _SetTitle(message);
- break;
- case BWIN_MOVE_WINDOW:
- _MoveTo(message);
- break;
- case BWIN_RESIZE_WINDOW:
- _ResizeTo(message);
- break;
- case BWIN_SET_BORDERED:
- _SetBordered(message);
- break;
- case BWIN_SHOW_WINDOW:
- Show();
- break;
- case BWIN_HIDE_WINDOW:
- Hide();
- break;
- case BWIN_MAXIMIZE_WINDOW:
- BWindow::Zoom();
- break;
- case BWIN_MINIMIZE_WINDOW:
- Minimize(true);
- break;
- case BWIN_RESTORE_WINDOW:
- _Restore();
- break;
- case BWIN_FULLSCREEN:
- _SetFullScreen(message);
- break;
- default:
- /* Perform normal message handling */
- BDirectWindow::MessageReceived(message);
- break;
- }
+ switch (message->what) {
+ /* Handle commands from SDL */
+ case BWIN_SET_TITLE:
+ _SetTitle(message);
+ break;
+ case BWIN_MOVE_WINDOW:
+ _MoveTo(message);
+ break;
+ case BWIN_RESIZE_WINDOW:
+ _ResizeTo(message);
+ break;
+ case BWIN_SET_BORDERED:
+ _SetBordered(message);
+ break;
+ case BWIN_SHOW_WINDOW:
+ Show();
+ break;
+ case BWIN_HIDE_WINDOW:
+ Hide();
+ break;
+ case BWIN_MAXIMIZE_WINDOW:
+ BWindow::Zoom();
+ break;
+ case BWIN_MINIMIZE_WINDOW:
+ Minimize(true);
+ break;
+ case BWIN_RESTORE_WINDOW:
+ _Restore();
+ break;
+ case BWIN_FULLSCREEN:
+ _SetFullScreen(message);
+ break;
+ default:
+ /* Perform normal message handling */
+ BDirectWindow::MessageReceived(message);
+ break;
+ }
}
-
-
-
- /* Accessor methods */
- bool IsShown() { return _shown; }
- int32 GetID() { return _id; }
- uint32 GetRowBytes() { return _row_bytes; }
- int32 GetFbX() { return _bounds.left; }
- int32 GetFbY() { return _bounds.top; }
- bool ConnectionEnabled() { return !_connection_disabled; }
- bool Connected() { return _connected; }
- clipping_rect *GetClips() { return _clips; }
- int32 GetNumClips() { return _num_clips; }
- uint8* GetBufferPx() { return _bits; }
- int32 GetBytesPerPx() { return _bytes_per_px; }
- bool CanTrashWindowBuffer() { return _trash_window_buffer; }
- bool BufferExists() { return _buffer_created; }
- bool BufferIsDirty() { return _buffer_dirty; }
- BBitmap *GetBitmap() { return _bitmap; }
+
+
+
+ /* Accessor methods */
+ bool IsShown() { return _shown; }
+ int32 GetID() { return _id; }
+ uint32 GetRowBytes() { return _row_bytes; }
+ int32 GetFbX() { return _bounds.left; }
+ int32 GetFbY() { return _bounds.top; }
+ bool ConnectionEnabled() { return !_connection_disabled; }
+ bool Connected() { return _connected; }
+ clipping_rect *GetClips() { return _clips; }
+ int32 GetNumClips() { return _num_clips; }
+ uint8* GetBufferPx() { return _bits; }
+ int32 GetBytesPerPx() { return _bytes_per_px; }
+ bool CanTrashWindowBuffer() { return _trash_window_buffer; }
+ bool BufferExists() { return _buffer_created; }
+ bool BufferIsDirty() { return _buffer_dirty; }
+ BBitmap *GetBitmap() { return _bitmap; }
#if SDL_VIDEO_OPENGL
- BGLView *GetGLView() { return _SDL_GLView; }
+ BGLView *GetGLView() { return _SDL_GLView; }
#endif
-
- /* Setter methods */
- void SetID(int32 id) { _id = id; }
- void SetBufferExists(bool bufferExists) { _buffer_created = bufferExists; }
- void LockBuffer() { _buffer_locker->Lock(); }
- void UnlockBuffer() { _buffer_locker->Unlock(); }
- void SetBufferDirty(bool bufferDirty) { _buffer_dirty = bufferDirty; }
- void SetTrashBuffer(bool trash) { _trash_window_buffer = trash; }
- void SetBitmap(BBitmap *bitmap) { _bitmap = bitmap; }
-
-
+
+ /* Setter methods */
+ void SetID(int32 id) { _id = id; }
+ void SetBufferExists(bool bufferExists) { _buffer_created = bufferExists; }
+ void LockBuffer() { _buffer_locker->Lock(); }
+ void UnlockBuffer() { _buffer_locker->Unlock(); }
+ void SetBufferDirty(bool bufferDirty) { _buffer_dirty = bufferDirty; }
+ void SetTrashBuffer(bool trash) { _trash_window_buffer = trash; }
+ void SetBitmap(BBitmap *bitmap) { _bitmap = bitmap; }
+
+
private:
- /* Event redirection */
+ /* Event redirection */
void _MouseMotionEvent(BPoint &where, int32 transit) {
- if(transit == B_EXITED_VIEW) {
- /* Change mouse focus */
- if(_mouse_focused) {
- _MouseFocusEvent(false);
- }
- } else {
- /* Change mouse focus */
- if (!_mouse_focused) {
- _MouseFocusEvent(true);
- }
- BMessage msg(BAPP_MOUSE_MOVED);
- msg.AddInt32("x", (int)where.x);
- msg.AddInt32("y", (int)where.y);
-
- _PostWindowEvent(msg);
- }
+ if(transit == B_EXITED_VIEW) {
+ /* Change mouse focus */
+ if(_mouse_focused) {
+ _MouseFocusEvent(false);
+ }
+ } else {
+ /* Change mouse focus */
+ if (!_mouse_focused) {
+ _MouseFocusEvent(true);
+ }
+ BMessage msg(BAPP_MOUSE_MOVED);
+ msg.AddInt32("x", (int)where.x);
+ msg.AddInt32("y", (int)where.y);
+
+ _PostWindowEvent(msg);
+ }
}
-
+
void _MouseFocusEvent(bool focusGained) {
- _mouse_focused = focusGained;
- BMessage msg(BAPP_MOUSE_FOCUS);
- msg.AddBool("focusGained", focusGained);
- _PostWindowEvent(msg);
-
+ _mouse_focused = focusGained;
+ BMessage msg(BAPP_MOUSE_FOCUS);
+ msg.AddBool("focusGained", focusGained);
+ _PostWindowEvent(msg);
+
//FIXME: Why were these here?
// if false: be_app->SetCursor(B_HAND_CURSOR);
// if true: SDL_SetCursor(NULL);
}
-
+
void _MouseButtonEvent(int32 buttons) {
- int32 buttonStateChange = buttons ^ _last_buttons;
-
- /* Make sure at least one button has changed state */
- if( !(buttonStateChange) ) {
- return;
- }
-
- /* Add any mouse button events */
- if(buttonStateChange & B_PRIMARY_MOUSE_BUTTON) {
- _SendMouseButton(SDL_BUTTON_LEFT, buttons &
- B_PRIMARY_MOUSE_BUTTON);
- }
- if(buttonStateChange & B_SECONDARY_MOUSE_BUTTON) {
- _SendMouseButton(SDL_BUTTON_RIGHT, buttons &
- B_PRIMARY_MOUSE_BUTTON);
- }
- if(buttonStateChange & B_TERTIARY_MOUSE_BUTTON) {
- _SendMouseButton(SDL_BUTTON_MIDDLE, buttons &
- B_PRIMARY_MOUSE_BUTTON);
- }
-
- _last_buttons = buttons;
+ int32 buttonStateChange = buttons ^ _last_buttons;
+
+ /* Make sure at least one button has changed state */
+ if( !(buttonStateChange) ) {
+ return;
+ }
+
+ /* Add any mouse button events */
+ if(buttonStateChange & B_PRIMARY_MOUSE_BUTTON) {
+ _SendMouseButton(SDL_BUTTON_LEFT, buttons &
+ B_PRIMARY_MOUSE_BUTTON);
+ }
+ if(buttonStateChange & B_SECONDARY_MOUSE_BUTTON) {
+ _SendMouseButton(SDL_BUTTON_RIGHT, buttons &
+ B_PRIMARY_MOUSE_BUTTON);
+ }
+ if(buttonStateChange & B_TERTIARY_MOUSE_BUTTON) {
+ _SendMouseButton(SDL_BUTTON_MIDDLE, buttons &
+ B_PRIMARY_MOUSE_BUTTON);
+ }
+
+ _last_buttons = buttons;
}
-
+
void _SendMouseButton(int32 button, int32 state) {
- BMessage msg(BAPP_MOUSE_BUTTON);
- msg.AddInt32("button-id", button);
- msg.AddInt32("button-state", state);
- _PostWindowEvent(msg);
+ BMessage msg(BAPP_MOUSE_BUTTON);
+ msg.AddInt32("button-id", button);
+ msg.AddInt32("button-state", state);
+ _PostWindowEvent(msg);
}
-
+
void _MouseWheelEvent(int32 x, int32 y) {
- /* Create a message to pass along to the BeApp thread */
- BMessage msg(BAPP_MOUSE_WHEEL);
- msg.AddInt32("xticks", x);
- msg.AddInt32("yticks", y);
- _PostWindowEvent(msg);
+ /* Create a message to pass along to the BeApp thread */
+ BMessage msg(BAPP_MOUSE_WHEEL);
+ msg.AddInt32("xticks", x);
+ msg.AddInt32("yticks", y);
+ _PostWindowEvent(msg);
}
-
+
void _KeyEvent(int32 keyCode, int32 keyState) {
- /* Create a message to pass along to the BeApp thread */
- BMessage msg(BAPP_KEY);
- msg.AddInt32("key-state", keyState);
- msg.AddInt32("key-scancode", keyCode);
- be_app->PostMessage(&msg);
- /* Apparently SDL only uses the scancode */
+ /* Create a message to pass along to the BeApp thread */
+ BMessage msg(BAPP_KEY);
+ msg.AddInt32("key-state", keyState);
+ msg.AddInt32("key-scancode", keyCode);
+ be_app->PostMessage(&msg);
+ /* Apparently SDL only uses the scancode */
}
-
+
void _RepaintEvent() {
- /* Force a repaint: Call the SDL exposed event */
- BMessage msg(BAPP_REPAINT);
- _PostWindowEvent(msg);
+ /* Force a repaint: Call the SDL exposed event */
+ BMessage msg(BAPP_REPAINT);
+ _PostWindowEvent(msg);
}
void _PostWindowEvent(BMessage &msg) {
- msg.AddInt32("window-id", _id);
- be_app->PostMessage(&msg);
+ msg.AddInt32("window-id", _id);
+ be_app->PostMessage(&msg);
}
-
- /* Command methods (functions called upon by SDL) */
+
+ /* Command methods (functions called upon by SDL) */
void _SetTitle(BMessage *msg) {
- const char *title;
- if(
- msg->FindString("window-title", &title) != B_OK
- ) {
- return;
- }
- SetTitle(title);
+ const char *title;
+ if(
+ msg->FindString("window-title", &title) != B_OK
+ ) {
+ return;
+ }
+ SetTitle(title);
}
-
+
void _MoveTo(BMessage *msg) {
- int32 x, y;
- if(
- msg->FindInt32("window-x", &x) != B_OK ||
- msg->FindInt32("window-y", &y) != B_OK
- ) {
- return;
- }
- MoveTo(x, y);
+ int32 x, y;
+ if(
+ msg->FindInt32("window-x", &x) != B_OK ||
+ msg->FindInt32("window-y", &y) != B_OK
+ ) {
+ return;
+ }
+ MoveTo(x, y);
}
-
+
void _ResizeTo(BMessage *msg) {
- int32 w, h;
- if(
- msg->FindInt32("window-w", &w) != B_OK ||
- msg->FindInt32("window-h", &h) != B_OK
- ) {
- return;
- }
- ResizeTo(w, h);
+ int32 w, h;
+ if(
+ msg->FindInt32("window-w", &w) != B_OK ||
+ msg->FindInt32("window-h", &h) != B_OK
+ ) {
+ return;
+ }
+ ResizeTo(w, h);
}
void _SetBordered(BMessage *msg) {
- bool bEnabled;
- if(msg->FindBool("window-border", &bEnabled) != B_OK) {
- return;
- }
- SetLook(bEnabled ? B_BORDERED_WINDOW_LOOK : B_NO_BORDER_WINDOW_LOOK);
+ bool bEnabled;
+ if(msg->FindBool("window-border", &bEnabled) != B_OK) {
+ return;
+ }
+ SetLook(bEnabled ? B_BORDERED_WINDOW_LOOK : B_NO_BORDER_WINDOW_LOOK);
}
void _Restore() {
- if(IsMinimized()) {
- Minimize(false);
- } else if(IsHidden()) {
- Show();
- } else if(_prev_frame != NULL) { /* Zoomed */
- MoveTo(_prev_frame->left, _prev_frame->top);
- ResizeTo(_prev_frame->Width(), _prev_frame->Height());
- }
+ if(IsMinimized()) {
+ Minimize(false);
+ } else if(IsHidden()) {
+ Show();
+ } else if(_prev_frame != NULL) { /* Zoomed */
+ MoveTo(_prev_frame->left, _prev_frame->top);
+ ResizeTo(_prev_frame->Width(), _prev_frame->Height());
+ }
}
void _SetFullScreen(BMessage *msg) {
- bool fullscreen;
- if(
- msg->FindBool("fullscreen", &fullscreen) != B_OK
- ) {
- return;
- }
- SetFullScreen(fullscreen);
+ bool fullscreen;
+ if(
+ msg->FindBool("fullscreen", &fullscreen) != B_OK
+ ) {
+ return;
+ }
+ SetFullScreen(fullscreen);
}
-
+
/* Members */
#if SDL_VIDEO_OPENGL
BGLView * _SDL_GLView;
#endif
-
+
int32 _last_buttons;
- int32 _id; /* Window id used by SDL_BApp */
- bool _mouse_focused; /* Does this window have mouse focus? */
+ int32 _id; /* Window id used by SDL_BApp */
+ bool _mouse_focused; /* Does this window have mouse focus? */
bool _shown;
bool _inhibit_resize;
-
- BRect *_prev_frame; /* Previous position and size of the window */
-
+
+ BRect *_prev_frame; /* Previous position and size of the window */
+
/* Framebuffer members */
- bool _connected,
- _connection_disabled,
- _buffer_created,
- _buffer_dirty,
- _trash_window_buffer;
- uint8 *_bits;
- uint32 _row_bytes;
- clipping_rect _bounds;
- BLocker *_buffer_locker;
+ bool _connected,
+ _connection_disabled,
+ _buffer_created,
+ _buffer_dirty,
+ _trash_window_buffer;
+ uint8 *_bits;
+ uint32 _row_bytes;
+ clipping_rect _bounds;
+ BLocker *_buffer_locker;
clipping_rect *_clips;
- int32 _num_clips;
- int32 _bytes_per_px;
- thread_id _draw_thread_id;
-
- BBitmap *_bitmap;
+ int32 _num_clips;
+ int32 _bytes_per_px;
+ thread_id _draw_thread_id;
+
+ BBitmap *_bitmap;
};
diff --git a/src/video/bwindow/SDL_bevents.h b/src/video/bwindow/SDL_bevents.h
index 66284283af..a83d03b526 100644
--- a/src/video/bwindow/SDL_bevents.h
+++ b/src/video/bwindow/SDL_bevents.h
@@ -17,7 +17,7 @@
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
-*/
+*/
#ifndef SDL_BEVENTS_H
#define SDL_BEVENTS_H
diff --git a/src/video/bwindow/SDL_bmodes.cc b/src/video/bwindow/SDL_bmodes.cc
index 2e8f4b577c..41894fb788 100644
--- a/src/video/bwindow/SDL_bmodes.cc
+++ b/src/video/bwindow/SDL_bmodes.cc
@@ -275,7 +275,7 @@ void BE_GetDisplayModes(_THIS, SDL_VideoDisplay *display) {
bscreen.GetMode(&this_bmode);
for(i = 0; i < count; ++i) {
- //FIXME: Apparently there are errors with colorspace changes
+ // FIXME: Apparently there are errors with colorspace changes
if (bmodes[i].space == this_bmode.space) {
_BDisplayModeToSdlDisplayMode(&bmodes[i], &mode);
SDL_AddDisplayMode(display, &mode);
diff --git a/src/video/bwindow/SDL_bmodes.h b/src/video/bwindow/SDL_bmodes.h
index 5e723a801e..9ca04d087c 100644
--- a/src/video/bwindow/SDL_bmodes.h
+++ b/src/video/bwindow/SDL_bmodes.h
@@ -34,10 +34,10 @@ extern int32 BE_BPPToSDLPxFormat(int32 bpp);
extern int BE_InitModes(_THIS);
extern int BE_QuitModes(_THIS);
extern int BE_GetDisplayBounds(_THIS, SDL_VideoDisplay *display,
- SDL_Rect *rect);
+ SDL_Rect *rect);
extern void BE_GetDisplayModes(_THIS, SDL_VideoDisplay *display);
extern int BE_SetDisplayMode(_THIS, SDL_VideoDisplay *display,
- SDL_DisplayMode *mode);
+ SDL_DisplayMode *mode);
#ifdef __cplusplus
}
diff --git a/src/video/bwindow/SDL_bopengl.h b/src/video/bwindow/SDL_bopengl.h
index 35a3b204c8..f0279ba66e 100644
--- a/src/video/bwindow/SDL_bopengl.h
+++ b/src/video/bwindow/SDL_bopengl.h
@@ -29,13 +29,13 @@ extern "C" {
#include "../SDL_sysvideo.h"
-extern int BE_GL_LoadLibrary(_THIS, const char *path); //FIXME
-extern void *BE_GL_GetProcAddress(_THIS, const char *proc); //FIXME
-extern void BE_GL_UnloadLibrary(_THIS); //TODO
+extern int BE_GL_LoadLibrary(_THIS, const char *path); //FIXME
+extern void *BE_GL_GetProcAddress(_THIS, const char *proc); //FIXME
+extern void BE_GL_UnloadLibrary(_THIS); //TODO
extern int BE_GL_MakeCurrent(_THIS, SDL_Window * window,
SDL_GLContext context);
-extern int BE_GL_SetSwapInterval(_THIS, int interval); //TODO
-extern int BE_GL_GetSwapInterval(_THIS); //TODO
+extern int BE_GL_SetSwapInterval(_THIS, int interval); //TODO
+extern int BE_GL_GetSwapInterval(_THIS); //TODO
extern void BE_GL_SwapWindow(_THIS, SDL_Window * window);
extern SDL_GLContext BE_GL_CreateContext(_THIS, SDL_Window * window);
extern void BE_GL_DeleteContext(_THIS, SDL_GLContext context);
diff --git a/src/video/cocoa/SDL_cocoaclipboard.m b/src/video/cocoa/SDL_cocoaclipboard.m
index fd499260aa..27d2227698 100644
--- a/src/video/cocoa/SDL_cocoaclipboard.m
+++ b/src/video/cocoa/SDL_cocoaclipboard.m
@@ -99,8 +99,8 @@ Cocoa_HasClipboardText(_THIS)
SDL_bool result = SDL_FALSE;
char *text = Cocoa_GetClipboardText(_this);
if (text) {
- result = (SDL_strlen(text)>0) ? SDL_TRUE : SDL_FALSE;
- SDL_free(text);
+ result = (SDL_strlen(text)>0) ? SDL_TRUE : SDL_FALSE;
+ SDL_free(text);
}
return result;
}
diff --git a/src/video/cocoa/SDL_cocoaevents.m b/src/video/cocoa/SDL_cocoaevents.m
index 7df95bbd09..e952a9e9f3 100644
--- a/src/video/cocoa/SDL_cocoaevents.m
+++ b/src/video/cocoa/SDL_cocoaevents.m
@@ -68,7 +68,7 @@ GetApplicationName(void)
dict = (NSDictionary *)CFBundleGetInfoDictionary(CFBundleGetMainBundle());
if (dict)
appName = [dict objectForKey: @"CFBundleName"];
-
+
if (![appName length])
appName = [[NSProcessInfo processInfo] processName];
@@ -84,14 +84,14 @@ CreateApplicationMenus(void)
NSMenu *serviceMenu;
NSMenu *windowMenu;
NSMenuItem *menuItem;
-
+
/* Create the main menu bar */
[NSApp setMainMenu:[[NSMenu alloc] init]];
/* Create the application menu */
appName = GetApplicationName();
appleMenu = [[NSMenu alloc] initWithTitle:@""];
-
+
/* Add menu items */
title = [@"About " stringByAppendingString:appName];
[appleMenu addItemWithTitle:title action:@selector(orderFrontStandardAboutPanel:) keyEquivalent:@""];
@@ -123,7 +123,7 @@ CreateApplicationMenus(void)
title = [@"Quit " stringByAppendingString:appName];
[appleMenu addItemWithTitle:title action:@selector(terminate:) keyEquivalent:@"q"];
-
+
/* Put menu into the menubar */
menuItem = [[NSMenuItem alloc] initWithTitle:@"" action:nil keyEquivalent:@""];
[menuItem setSubmenu:appleMenu];
@@ -137,10 +137,10 @@ CreateApplicationMenus(void)
/* Create the window menu */
windowMenu = [[NSMenu alloc] initWithTitle:@"Window"];
-
+
/* Add menu items */
[windowMenu addItemWithTitle:@"Minimize" action:@selector(performMiniaturize:) keyEquivalent:@"m"];
-
+
[windowMenu addItemWithTitle:@"Zoom" action:@selector(performZoom:) keyEquivalent:@""];
/* Put menu into the menubar */
@@ -148,7 +148,7 @@ CreateApplicationMenus(void)
[menuItem setSubmenu:windowMenu];
[[NSApp mainMenu] addItem:menuItem];
[menuItem release];
-
+
/* Tell the application object that this is now the window menu */
[NSApp setWindowsMenu:windowMenu];
[windowMenu release];
@@ -203,7 +203,7 @@ Cocoa_PumpEvents(_THIS)
if ( event == nil ) {
break;
}
-
+
switch ([event type]) {
case NSLeftMouseDown:
case NSOtherMouseDown:
diff --git a/src/video/cocoa/SDL_cocoakeyboard.m b/src/video/cocoa/SDL_cocoakeyboard.m
index 63f4bf9425..705b0358da 100644
--- a/src/video/cocoa/SDL_cocoakeyboard.m
+++ b/src/video/cocoa/SDL_cocoakeyboard.m
@@ -29,7 +29,7 @@
#include <Carbon/Carbon.h>
-//#define DEBUG_IME NSLog
+/*#define DEBUG_IME NSLog */
#define DEBUG_IME(...)
#ifndef NX_DEVICERCTLKEYMASK
@@ -93,9 +93,10 @@
- (void) doCommandBySelector:(SEL) myselector
{
- // No need to do anything since we are not using Cocoa
- // selectors to handle special keys, instead we use SDL
- // key events to do the same job.
+ /* No need to do anything since we are not using Cocoa
+ selectors to handle special keys, instead we use SDL
+ key events to do the same job.
+ */
}
- (BOOL) hasMarkedText
@@ -181,18 +182,20 @@
return (long) self;
}
-// This method returns the index for character that is
-// nearest to thePoint. thPoint is in screen coordinate system.
+/* This method returns the index for character that is
+ * nearest to thePoint. thPoint is in screen coordinate system.
+ */
- (NSUInteger) characterIndexForPoint:(NSPoint) thePoint
{
DEBUG_IME(@"characterIndexForPoint: (%g, %g)", thePoint.x, thePoint.y);
return 0;
}
-// This method is the key to attribute extension.
-// We could add new attributes through this method.
-// NSInputServer examines the return value of this
-// method & constructs appropriate attributed string.
+/* This method is the key to attribute extension.
+ * We could add new attributes through this method.
+ * NSInputServer examines the return value of this
+ * method & constructs appropriate attributed string.
+ */
- (NSArray *) validAttributesForMarkedText
{
return [NSArray array];
@@ -200,7 +203,7 @@
@end
-/* This is the original behavior, before support was added for
+/* This is the original behavior, before support was added for
* differentiating between left and right versions of the keys.
*/
static void
@@ -239,7 +242,7 @@ DoUnsidedModifiers(unsigned short scancode,
}
}
-/* This is a helper function for HandleModifierSide. This
+/* This is a helper function for HandleModifierSide. This
* function reverts back to behavior before the distinction between
* sides was made.
*/
@@ -250,13 +253,13 @@ HandleNonDeviceModifier(unsigned int device_independent_mask,
SDL_Scancode scancode)
{
unsigned int oldMask, newMask;
-
- /* Isolate just the bits we care about in the depedent bits so we can
+
+ /* Isolate just the bits we care about in the depedent bits so we can
* figure out what changed
- */
+ */
oldMask = oldMods & device_independent_mask;
newMask = newMods & device_independent_mask;
-
+
if (oldMask && oldMask != newMask) {
SDL_SendKeyboardKey(SDL_RELEASED, scancode);
} else if (newMask && oldMask != newMask) {
@@ -264,24 +267,24 @@ HandleNonDeviceModifier(unsigned int device_independent_mask,
}
}
-/* This is a helper function for HandleModifierSide.
+/* This is a helper function for HandleModifierSide.
* This function sets the actual SDL_PrivateKeyboard event.
*/
static void
HandleModifierOneSide(unsigned int oldMods, unsigned int newMods,
- SDL_Scancode scancode,
+ SDL_Scancode scancode,
unsigned int sided_device_dependent_mask)
{
unsigned int old_dep_mask, new_dep_mask;
- /* Isolate just the bits we care about in the depedent bits so we can
+ /* Isolate just the bits we care about in the depedent bits so we can
* figure out what changed
- */
+ */
old_dep_mask = oldMods & sided_device_dependent_mask;
new_dep_mask = newMods & sided_device_dependent_mask;
/* We now know that this side bit flipped. But we don't know if
- * it went pressed to released or released to pressed, so we must
+ * it went pressed to released or released to pressed, so we must
* find out which it is.
*/
if (new_dep_mask && old_dep_mask != new_dep_mask) {
@@ -292,23 +295,23 @@ HandleModifierOneSide(unsigned int oldMods, unsigned int newMods,
}
/* This is a helper function for DoSidedModifiers.
- * This function will figure out if the modifier key is the left or right side,
- * e.g. left-shift vs right-shift.
+ * This function will figure out if the modifier key is the left or right side,
+ * e.g. left-shift vs right-shift.
*/
static void
-HandleModifierSide(int device_independent_mask,
- unsigned int oldMods, unsigned int newMods,
- SDL_Scancode left_scancode,
+HandleModifierSide(int device_independent_mask,
+ unsigned int oldMods, unsigned int newMods,
+ SDL_Scancode left_scancode,
SDL_Scancode right_scancode,
- unsigned int left_device_dependent_mask,
+ unsigned int left_device_dependent_mask,
unsigned int right_device_dependent_mask)
{
unsigned int device_dependent_mask = (left_device_dependent_mask |
right_device_dependent_mask);
unsigned int diff_mod;
-
- /* On the basis that the device independent mask is set, but there are
- * no device dependent flags set, we'll assume that we can't detect this
+
+ /* On the basis that the device independent mask is set, but there are
+ * no device dependent flags set, we'll assume that we can't detect this
* keyboard and revert to the unsided behavior.
*/
if ((device_dependent_mask & newMods) == 0) {
@@ -321,7 +324,7 @@ HandleModifierSide(int device_independent_mask,
diff_mod = (device_dependent_mask & oldMods) ^
(device_dependent_mask & newMods);
if (diff_mod) {
- /* A change in state was found. Isolate the left and right bits
+ /* A change in state was found. Isolate the left and right bits
* to handle them separately just in case the values can simulataneously
* change or if the bits don't both exist.
*/
@@ -333,38 +336,38 @@ HandleModifierSide(int device_independent_mask,
}
}
}
-
+
/* This is a helper function for DoSidedModifiers.
- * This function will release a key press in the case that
- * it is clear that the modifier has been released (i.e. one side
+ * This function will release a key press in the case that
+ * it is clear that the modifier has been released (i.e. one side
* can't still be down).
*/
static void
-ReleaseModifierSide(unsigned int device_independent_mask,
+ReleaseModifierSide(unsigned int device_independent_mask,
unsigned int oldMods, unsigned int newMods,
- SDL_Scancode left_scancode,
+ SDL_Scancode left_scancode,
SDL_Scancode right_scancode,
- unsigned int left_device_dependent_mask,
+ unsigned int left_device_dependent_mask,
unsigned int right_device_dependent_mask)
{
unsigned int device_dependent_mask = (left_device_dependent_mask |
right_device_dependent_mask);
- /* On the basis that the device independent mask is set, but there are
- * no device dependent flags set, we'll assume that we can't detect this
+ /* On the basis that the device independent mask is set, but there are
+ * no device dependent flags set, we'll assume that we can't detect this
* keyboard and revert to the unsided behavior.
*/
if ((device_dependent_mask & oldMods) == 0) {
- /* In this case, we can't detect the keyboard, so use the left side
- * to represent both, and release it.
+ /* In this case, we can't detect the keyboard, so use the left side
+ * to represent both, and release it.
*/
SDL_SendKeyboardKey(SDL_RELEASED, left_scancode);
return;
}
- /*
+ /*
* This could have been done in an if-else case because at this point,
- * we know that all keys have been released when calling this function.
+ * we know that all keys have been released when calling this function.
* But I'm being paranoid so I want to handle each separately,
* so I hope this doesn't cause other problems.
*/
@@ -384,7 +387,7 @@ HandleCapsLock(unsigned short scancode,
unsigned int oldMods, unsigned int newMods)
{
unsigned int oldMask, newMask;
-
+
oldMask = oldMods & NSAlphaShiftKeyMask;
newMask = newMods & NSAlphaShiftKeyMask;
@@ -402,14 +405,14 @@ HandleCapsLock(unsigned short scancode,
}
}
-/* This function will handle the modifier keys and also determine the
+/* This function will handle the modifier keys and also determine the
* correct side of the key.
*/
static void
DoSidedModifiers(unsigned short scancode,
unsigned int oldMods, unsigned int newMods)
{
- /* Set up arrays for the key syms for the left and right side. */
+ /* Set up arrays for the key syms for the left and right side. */
const SDL_Scancode left_mapping[] = {
SDL_SCANCODE_LSHIFT,
SDL_SCANCODE_LCTRL,
@@ -422,8 +425,8 @@ DoSidedModifiers(unsigned short scancode,
SDL_SCANCODE_RALT,
SDL_SCANCODE_RGUI
};
- /* Set up arrays for the device dependent masks with indices that
- * correspond to the _mapping arrays
+ /* Set up arrays for the device dependent masks with indices that
+ * correspond to the _mapping arrays
*/
const unsigned int left_device_mapping[] = { NX_DEVICELSHIFTKEYMASK, NX_DEVICELCTLKEYMASK, NX_DEVICELALTKEYMASK, NX_DEVICELCMDKEYMASK };
const unsigned int right_device_mapping[] = { NX_DEVICERSHIFTKEYMASK, NX_DEVICERCTLKEYMASK, NX_DEVICERALTKEYMASK, NX_DEVICERCMDKEYMASK };
@@ -436,10 +439,10 @@ DoSidedModifiers(unsigned short scancode,
/* Iterate through the bits, testing each against the old modifiers */
for (i = 0, bit = NSShiftKeyMask; bit <= NSCommandKeyMask; bit <<= 1, ++i) {
unsigned int oldMask, newMask;
-
+
oldMask = oldMods & bit;
newMask = newMods & bit;
-
+
/* If the bit is set, we must always examine it because the left
* and right side keys may alternate or both may be pressed.
*/
@@ -465,11 +468,11 @@ HandleModifiers(_THIS, unsigned short scancode, unsigned int modifierFlags)
SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
if (modifierFlags == data->modifierFlags) {
- return;
+ return;
}
- /*
- * Starting with Panther (10.3.0), the ability to distinguish between
+ /*
+ * Starting with Panther (10.3.0), the ability to distinguish between
* left side and right side modifiers is available.
*/
if (data->osversion >= 0x1030) {
@@ -611,7 +614,7 @@ Cocoa_InitKeyboard(_THIS)
SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
UpdateKeymap(data);
-
+
/* Set our own names for the platform-dependent but layout-independent keys */
/* This key is NumLock on the MacBook keyboard. :) */
/*SDL_SetScancodeName(SDL_SCANCODE_NUMLOCKCLEAR, "Clear");*/
@@ -640,7 +643,7 @@ Cocoa_StartTextInput(_THIS)
if (![[data->fieldEdit superview] isEqual: parentView])
{
- // DEBUG_IME(@"add fieldEdit to window contentView");
+ /* DEBUG_IME(@"add fieldEdit to window contentView"); */
[data->fieldEdit removeFromSuperview];
[parentView addSubview: data->fieldEdit];
[[NSApp keyWindow] makeFirstResponder: data->fieldEdit];
@@ -669,8 +672,8 @@ Cocoa_SetTextInputRect(_THIS, SDL_Rect *rect)
SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
if (!rect) {
- SDL_InvalidParamError("rect");
- return;
+ SDL_InvalidParamError("rect");
+ return;
}
[data->fieldEdit setInputRect: rect];
diff --git a/src/video/cocoa/SDL_cocoamodes.m b/src/video/cocoa/SDL_cocoamodes.m
index 563226c2ab..ad6ece279b 100644
--- a/src/video/cocoa/SDL_cocoamodes.m
+++ b/src/video/cocoa/SDL_cocoamodes.m
@@ -55,8 +55,8 @@ static inline void Cocoa_ToggleMenuBar(const BOOL show)
#endif
#if MAC_OS_X_VERSION_MAX_ALLOWED < 1050
-/*
- Add methods to get at private members of NSScreen.
+/*
+ Add methods to get at private members of NSScreen.
Since there is a bug in Apple's screen switching code
that does not update this variable when switching
to fullscreen, we'll set it manually (but only for the
@@ -226,7 +226,7 @@ Cocoa_GetDisplayName(CGDirectDisplayID displayID)
NSDictionary *deviceInfo = (NSDictionary *)IODisplayCreateInfoDictionary(CGDisplayIOServicePort(displayID), kIODisplayOnlyPreferredName);
NSDictionary *localizedNames = [deviceInfo objectForKey:[NSString stringWithUTF8String:kDisplayProductName]];
const char* displayName = NULL;
-
+
if ([localizedNames count] > 0) {
displayName = SDL_strdup([[localizedNames objectForKey:[[localizedNames allKeys] objectAtIndex:0]] UTF8String]);
}
@@ -304,7 +304,7 @@ Cocoa_InitModes(_THIS)
displaydata->display = displays[i];
SDL_zero(display);
- // this returns a stddup'ed string
+ /* this returns a stddup'ed string */
display.name = (char *)Cocoa_GetDisplayName(displays[i]);
if (!GetDisplayMode (_this, moderef, &mode)) {
Cocoa_ReleaseDisplayMode(_this, moderef);
diff --git a/src/video/cocoa/SDL_cocoamouse.m b/src/video/cocoa/SDL_cocoamouse.m
index 4a6c581d55..fd76bb5849 100644
--- a/src/video/cocoa/SDL_cocoamouse.m
+++ b/src/video/cocoa/SDL_cocoamouse.m
@@ -153,7 +153,7 @@ Cocoa_CreateSystemCursor(SDL_SystemCursor id)
if (nscursor) {
cursor = SDL_calloc(1, sizeof(*cursor));
if (cursor) {
- // We'll free it later, so retain it here
+ /* We'll free it later, so retain it here */
[nscursor retain];
cursor->driverdata = nscursor;
}
diff --git a/src/video/cocoa/SDL_cocoashape.h b/src/video/cocoa/SDL_cocoashape.h
index fc867a0819..3b656c1a94 100644
--- a/src/video/cocoa/SDL_cocoashape.h
+++ b/src/video/cocoa/SDL_cocoashape.h
@@ -30,10 +30,10 @@
#include "../SDL_shape_internals.h"
typedef struct {
- NSGraphicsContext* context;
- SDL_bool saved;
-
- SDL_ShapeTree* shape;
+ NSGraphicsContext* context;
+ SDL_bool saved;
+
+ SDL_ShapeTree* shape;
} SDL_ShapeData;
extern SDL_WindowShaper* Cocoa_CreateShaper(SDL_Window* window);
diff --git a/src/video/cocoa/SDL_cocoashape.m b/src/video/cocoa/SDL_cocoashape.m
index 8f2fa47dcc..3cde7d0485 100644
--- a/src/video/cocoa/SDL_cocoashape.m
+++ b/src/video/cocoa/SDL_cocoashape.m
@@ -42,13 +42,13 @@ Cocoa_CreateShaper(SDL_Window* window) {
result->mode.parameters.binarizationCutoff = 1;
result->userx = result->usery = 0;
window->shaper = result;
-
+
SDL_ShapeData* data = malloc(sizeof(SDL_ShapeData));
result->driverdata = data;
data->context = [windata->nswindow graphicsContext];
data->saved = SDL_FALSE;
data->shape = NULL;
-
+
int resized_properly = Cocoa_ResizeWindowShape(window);
SDL_assert(resized_properly == 0);
return result;
@@ -72,26 +72,26 @@ ConvertRects(SDL_ShapeTree* tree,void* closure) {
int
Cocoa_SetWindowShape(SDL_WindowShaper *shaper,SDL_Surface *shape,SDL_WindowShapeMode *shape_mode) {
SDL_ShapeData* data = (SDL_ShapeData*)shaper->driverdata;
- SDL_WindowData* windata = (SDL_WindowData*)shaper->window->driverdata;
- SDL_CocoaClosure closure;
- NSAutoreleasePool *pool = NULL;
+ SDL_WindowData* windata = (SDL_WindowData*)shaper->window->driverdata;
+ SDL_CocoaClosure closure;
+ NSAutoreleasePool *pool = NULL;
if(data->saved == SDL_TRUE) {
[data->context restoreGraphicsState];
data->saved = SDL_FALSE;
}
-
+
//[data->context saveGraphicsState];
//data->saved = SDL_TRUE;
- [NSGraphicsContext setCurrentContext:data->context];
-
+ [NSGraphicsContext setCurrentContext:data->context];
+
[[NSColor clearColor] set];
NSRectFill([[windata->nswindow contentView] frame]);
data->shape = SDL_CalculateShapeTree(*shape_mode,shape);
-
- pool = [[NSAutoreleasePool alloc] init];
+
+ pool = [[NSAutoreleasePool alloc] init];
closure.view = [windata->nswindow contentView];
closure.path = [[NSBezierPath bezierPath] autorelease];
- closure.window = shaper->window;
+ closure.window = shaper->window;
SDL_TraverseShapeTree(data->shape,&ConvertRects,&closure);
[closure.path addClip];
diff --git a/src/video/cocoa/SDL_cocoavideo.m b/src/video/cocoa/SDL_cocoavideo.m
index 6502a3fd71..5600222ae8 100644
--- a/src/video/cocoa/SDL_cocoavideo.m
+++ b/src/video/cocoa/SDL_cocoavideo.m
@@ -110,11 +110,11 @@ Cocoa_CreateDevice(int devindex)
device->SetWindowGrab = Cocoa_SetWindowGrab;
device->DestroyWindow = Cocoa_DestroyWindow;
device->GetWindowWMInfo = Cocoa_GetWindowWMInfo;
-
+
device->shape_driver.CreateShaper = Cocoa_CreateShaper;
device->shape_driver.SetWindowShape = Cocoa_SetWindowShape;
device->shape_driver.ResizeWindowShape = Cocoa_ResizeWindowShape;
-
+
#if SDL_VIDEO_OPENGL_CGL
device->GL_LoadLibrary = Cocoa_GL_LoadLibrary;
device->GL_GetProcAddress = Cocoa_GL_GetProcAddress;
@@ -173,7 +173,7 @@ Cocoa_CreateImage(SDL_Surface * surface)
int i;
NSImage *img;
- converted = SDL_ConvertSurfaceFormat(surface,
+ converted = SDL_ConvertSurfaceFormat(surface,
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
SDL_PIXELFORMAT_RGBA8888,
#else
diff --git a/src/video/cocoa/SDL_cocoawindow.m b/src/video/cocoa/SDL_cocoawindow.m
index f6d54a78d0..d0f825cbac 100644
--- a/src/video/cocoa/SDL_cocoawindow.m
+++ b/src/video/cocoa/SDL_cocoawindow.m
@@ -67,9 +67,10 @@ static __inline__ void ConvertNSRect(NSRect *r)
[window setDelegate:self];
}
- // Haven't found a delegate / notification that triggers when the window is
- // ordered out (is not visible any more). You can be ordered out without
- // minimizing, so DidMiniaturize doesn't work. (e.g. -[NSWindow orderOut:])
+ /* Haven't found a delegate / notification that triggers when the window is
+ * ordered out (is not visible any more). You can be ordered out without
+ * minimizing, so DidMiniaturize doesn't work. (e.g. -[NSWindow orderOut:])
+ */
[window addObserver:self
forKeyPath:@"visible"
options:NSKeyValueObservingOptionNew
@@ -274,27 +275,29 @@ static __inline__ void ConvertNSRect(NSRect *r)
}
}
-// We'll respond to key events by doing nothing so we don't beep.
-// We could handle key messages here, but we lose some in the NSApp dispatch,
-// where they get converted to action messages, etc.
+/* We'll respond to key events by doing nothing so we don't beep.
+ * We could handle key messages here, but we lose some in the NSApp dispatch,
+ * where they get converted to action messages, etc.
+ */
- (void)flagsChanged:(NSEvent *)theEvent
{
- //Cocoa_HandleKeyEvent(SDL_GetVideoDevice(), theEvent);
+ /*Cocoa_HandleKeyEvent(SDL_GetVideoDevice(), theEvent);*/
}
- (void)keyDown:(NSEvent *)theEvent
{
- //Cocoa_HandleKeyEvent(SDL_GetVideoDevice(), theEvent);
+ /*Cocoa_HandleKeyEvent(SDL_GetVideoDevice(), theEvent);*/
}
- (void)keyUp:(NSEvent *)theEvent
{
- //Cocoa_HandleKeyEvent(SDL_GetVideoDevice(), theEvent);
+ /*Cocoa_HandleKeyEvent(SDL_GetVideoDevice(), theEvent);*/
}
-// We'll respond to selectors by doing nothing so we don't beep.
-// The escape key gets converted to a "cancel" selector, etc.
+/* We'll respond to selectors by doing nothing so we don't beep.
+ * The escape key gets converted to a "cancel" selector, etc.
+ */
- (void)doCommandBySelector:(SEL)aSelector
{
- //NSLog(@"doCommandBySelector: %@\n", NSStringFromSelector(aSelector));
+ /*NSLog(@"doCommandBySelector: %@\n", NSStringFromSelector(aSelector));*/
}
- (void)mouseDown:(NSEvent *)theEvent
@@ -472,7 +475,7 @@ static __inline__ void ConvertNSRect(NSRect *r)
if (SDL_AddTouch(touchId, "") < 0) {
return;
}
- }
+ }
const SDL_FingerID fingerId = (SDL_FingerID)(intptr_t)[touch identity];
float x = [touch normalizedPosition].x;
@@ -550,18 +553,18 @@ GetWindowStyle(SDL_Window * window)
{
unsigned int style;
- if (window->flags & SDL_WINDOW_FULLSCREEN) {
+ if (window->flags & SDL_WINDOW_FULLSCREEN) {
style = NSBorderlessWindowMask;
- } else {
- if (window->flags & SDL_WINDOW_BORDERLESS) {
- style = NSBorderlessWindowMask;
- } else {
- style = (NSTitledWindowMask|NSClosableWindowMask|NSMiniaturizableWindowMask);
- }
- if (window->flags & SDL_WINDOW_RESIZABLE) {
- style |= NSResizableWindowMask;
- }
- }
+ } else {
+ if (window->flags & SDL_WINDOW_BORDERLESS) {
+ style = NSBorderlessWindowMask;
+ } else {
+ style = (NSTitledWindowMask|NSClosableWindowMask|NSMiniaturizableWindowMask);
+ }
+ if (window->flags & SDL_WINDOW_RESIZABLE) {
+ style |= NSResizableWindowMask;
+ }
+ }
return style;
}
@@ -688,7 +691,7 @@ Cocoa_CreateWindow(_THIS, SDL_Window * window)
}
nswindow = [[SDLWindow alloc] initWithContentRect:rect styleMask:style backing:NSBackingStoreBuffered defer:NO screen:screen];
- // Create a default view for this window
+ /* Create a default view for this window */
rect = [nswindow contentRectForFrameRect:[nswindow frame]];
NSView *contentView = [[SDLView alloc] initWithFrame:rect];
[nswindow setContentView: contentView];
@@ -804,13 +807,13 @@ Cocoa_SetWindowMinimumSize(_THIS, SDL_Window * window)
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
SDL_WindowData *windata = (SDL_WindowData *) window->driverdata;
-
+
NSSize minSize;
minSize.width = window->min_w;
minSize.height = window->min_h;
-
+
[windata->nswindow setContentMinSize:minSize];
-
+
[pool release];
}
@@ -819,13 +822,13 @@ Cocoa_SetWindowMaximumSize(_THIS, SDL_Window * window)
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
SDL_WindowData *windata = (SDL_WindowData *) window->driverdata;
-
+
NSSize maxSize;
maxSize.width = window->max_w;
maxSize.height = window->max_h;
-
+
[windata->nswindow setContentMaxSize:maxSize];
-
+
[pool release];
}
@@ -937,7 +940,7 @@ Cocoa_SetWindowBordered(_THIS, SDL_Window * window, SDL_bool bordered)
if ([nswindow respondsToSelector:@selector(setStyleMask:)]) {
[nswindow setStyleMask:GetWindowStyle(window)];
if (bordered) {
- Cocoa_SetWindowTitle(_this, window); // this got blanked out.
+ Cocoa_SetWindowTitle(_this, window); /* this got blanked out. */
}
}
[pool release];
@@ -1090,17 +1093,17 @@ Cocoa_SetWindowGrab(_THIS, SDL_Window * window, SDL_bool grabbed)
cgpoint.y = window->y + y;
CGDisplayMoveCursorToPoint(kCGDirectMainDisplay, cgpoint);
}
-
+
if ( window->flags & SDL_WINDOW_FULLSCREEN ) {
- SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
-
- if (SDL_ShouldAllowTopmost() && (window->flags & SDL_WINDOW_INPUT_FOCUS)) {
- /* OpenGL is rendering to the window, so make it visible! */
- [data->nswindow setLevel:CGShieldingWindowLevel()];
- } else {
- [data->nswindow setLevel:kCGNormalWindowLevel];
- }
- }
+ SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
+
+ if (SDL_ShouldAllowTopmost() && (window->flags & SDL_WINDOW_INPUT_FOCUS)) {
+ /* OpenGL is rendering to the window, so make it visible! */
+ [data->nswindow setLevel:CGShieldingWindowLevel()];
+ } else {
+ [data->nswindow setLevel:kCGNormalWindowLevel];
+ }
+ }
}
void
diff --git a/src/video/directfb/SDL_DirectFB_WM.c b/src/video/directfb/SDL_DirectFB_WM.c
index 84e76ca1cc..8241d9b3d2 100644
--- a/src/video/directfb/SDL_DirectFB_WM.c
+++ b/src/video/directfb/SDL_DirectFB_WM.c
@@ -81,24 +81,24 @@ LoadFont(_THIS, SDL_Window * window)
SDL_DFB_DEVICEDATA(_this);
SDL_DFB_WINDOWDATA(window);
- if (windata->font != NULL) {
- SDL_DFB_RELEASE(windata->font);
- windata->font = NULL;
- SDL_DFB_CHECK(windata->window_surface->SetFont(windata->window_surface, windata->font));
- }
-
- if (windata->theme.font != NULL)
- {
+ if (windata->font != NULL) {
+ SDL_DFB_RELEASE(windata->font);
+ windata->font = NULL;
+ SDL_DFB_CHECK(windata->window_surface->SetFont(windata->window_surface, windata->font));
+ }
+
+ if (windata->theme.font != NULL)
+ {
DFBFontDescription fdesc;
- SDL_zero(fdesc);
- fdesc.flags = DFDESC_HEIGHT;
- fdesc.height = windata->theme.font_size;
- SDL_DFB_CHECK(devdata->
- dfb->CreateFont(devdata->dfb, windata->theme.font,
- &fdesc, &windata->font));
- SDL_DFB_CHECK(windata->window_surface->SetFont(windata->window_surface, windata->font));
- }
+ SDL_zero(fdesc);
+ fdesc.flags = DFDESC_HEIGHT;
+ fdesc.height = windata->theme.font_size;
+ SDL_DFB_CHECK(devdata->
+ dfb->CreateFont(devdata->dfb, windata->theme.font,
+ &fdesc, &windata->font));
+ SDL_DFB_CHECK(windata->window_surface->SetFont(windata->window_surface, windata->font));
+ }
}
static void
@@ -130,8 +130,8 @@ DirectFB_WM_RedrawLayout(_THIS, SDL_Window * window)
SDL_DFB_CHECK(s->SetDrawingFlags(s, DSDRAW_NOFX));
SDL_DFB_CHECK(s->SetBlittingFlags(s, DSBLIT_NOFX));
- LoadFont(_this, window);
- //s->SetDrawingFlags(s, DSDRAW_BLEND);
+ LoadFont(_this, window);
+ /*s->SetDrawingFlags(s, DSDRAW_BLEND); */
s->SetColor(s, COLOR_EXPAND(t->frame_color));
/* top */
for (i = 0; i < t->top_size; i++)
@@ -162,7 +162,7 @@ DirectFB_WM_RedrawLayout(_THIS, SDL_Window * window)
/* Caption */
if (window->title) {
- s->SetColor(s, COLOR_EXPAND(t->font_color));
+ s->SetColor(s, COLOR_EXPAND(t->font_color));
DrawCraption(_this, s, (x - w) / 2, t->top_size + d, window->title);
}
/* Icon */
@@ -184,7 +184,7 @@ DFBResult
DirectFB_WM_GetClientSize(_THIS, SDL_Window * window, int *cw, int *ch)
{
SDL_DFB_WINDOWDATA(window);
- IDirectFBWindow *dfbwin = windata->dfbwin;
+ IDirectFBWindow *dfbwin = windata->dfbwin;
SDL_DFB_CHECK(dfbwin->GetSize(dfbwin, cw, ch));
dfbwin->GetSize(dfbwin, cw, ch);
@@ -203,8 +203,8 @@ DirectFB_WM_AdjustWindowLayout(SDL_Window * window, int flags, int w, int h)
if (!windata->is_managed)
windata->theme = theme_none;
else if (flags & SDL_WINDOW_BORDERLESS)
- //desc.caps |= DWCAPS_NODECORATION;)
- windata->theme = theme_none;
+ /*desc.caps |= DWCAPS_NODECORATION;) */
+ windata->theme = theme_none;
else if (flags & SDL_WINDOW_FULLSCREEN) {
windata->theme = theme_none;
} else if (flags & SDL_WINDOW_MAXIMIZED) {
@@ -289,8 +289,8 @@ DirectFB_WM_ProcessEvent(_THIS, SDL_Window * window, DFBWindowEvent * evt)
{
SDL_DFB_DEVICEDATA(_this);
SDL_DFB_WINDOWDATA(window);
- DFB_WindowData *gwindata = ((devdata->grabbed_window) ? (DFB_WindowData *) ((devdata->grabbed_window)->driverdata) : NULL);
- IDirectFBWindow *dfbwin = windata->dfbwin;
+ DFB_WindowData *gwindata = ((devdata->grabbed_window) ? (DFB_WindowData *) ((devdata->grabbed_window)->driverdata) : NULL);
+ IDirectFBWindow *dfbwin = windata->dfbwin;
DFBWindowOptions wopts;
if (!windata->is_managed)
@@ -306,29 +306,29 @@ DirectFB_WM_ProcessEvent(_THIS, SDL_Window * window, DFBWindowEvent * evt)
case WM_POS_NONE:
return 0;
case WM_POS_CLOSE:
- windata->wm_grab = WM_POS_NONE;
+ windata->wm_grab = WM_POS_NONE;
SDL_SendWindowEvent(window, SDL_WINDOWEVENT_CLOSE, 0,
0);
return 1;
case WM_POS_MAX:
- windata->wm_grab = WM_POS_NONE;
- if (window->flags & SDL_WINDOW_MAXIMIZED) {
- SDL_RestoreWindow(window);
- } else {
- SDL_MaximizeWindow(window);
- }
+ windata->wm_grab = WM_POS_NONE;
+ if (window->flags & SDL_WINDOW_MAXIMIZED) {
+ SDL_RestoreWindow(window);
+ } else {
+ SDL_MaximizeWindow(window);
+ }
return 1;
case WM_POS_CAPTION:
- if (!(wopts & DWOP_KEEP_STACKING)) {
- DirectFB_RaiseWindow(_this, window);
- }
- if (window->flags & SDL_WINDOW_MAXIMIZED)
- return 1;
+ if (!(wopts & DWOP_KEEP_STACKING)) {
+ DirectFB_RaiseWindow(_this, window);
+ }
+ if (window->flags & SDL_WINDOW_MAXIMIZED)
+ return 1;
/* fall through */
default:
windata->wm_grab = pos;
if (gwindata != NULL)
- SDL_DFB_CHECK(gwindata->dfbwin->UngrabPointer(gwindata->dfbwin));
+ SDL_DFB_CHECK(gwindata->dfbwin->UngrabPointer(gwindata->dfbwin));
SDL_DFB_CHECK(dfbwin->GrabPointer(dfbwin));
windata->wm_lastx = evt->cx;
windata->wm_lasty = evt->cy;
@@ -343,21 +343,21 @@ DirectFB_WM_ProcessEvent(_THIS, SDL_Window * window, DFBWindowEvent * evt)
int dx = evt->cx - windata->wm_lastx;
int dy = evt->cy - windata->wm_lasty;
- if (!(wopts & DWOP_KEEP_SIZE)) {
+ if (!(wopts & DWOP_KEEP_SIZE)) {
int cw, ch;
- if ((windata->wm_grab & (WM_POS_BOTTOM | WM_POS_RIGHT)) == WM_POS_BOTTOM)
- dx = 0;
- else if ((windata->wm_grab & (WM_POS_BOTTOM | WM_POS_RIGHT)) == WM_POS_RIGHT)
- dy = 0;
- SDL_DFB_CHECK(dfbwin->GetSize(dfbwin, &cw, &ch));
-
- /* necessary to trigger an event - ugly*/
- SDL_DFB_CHECK(dfbwin->DisableEvents(dfbwin, DWET_ALL));
- SDL_DFB_CHECK(dfbwin->Resize(dfbwin, cw + dx + 1, ch + dy));
- SDL_DFB_CHECK(dfbwin->EnableEvents(dfbwin, DWET_ALL));
-
- SDL_DFB_CHECK(dfbwin->Resize(dfbwin, cw + dx, ch + dy));
- }
+ if ((windata->wm_grab & (WM_POS_BOTTOM | WM_POS_RIGHT)) == WM_POS_BOTTOM)
+ dx = 0;
+ else if ((windata->wm_grab & (WM_POS_BOTTOM | WM_POS_RIGHT)) == WM_POS_RIGHT)
+ dy = 0;
+ SDL_DFB_CHECK(dfbwin->GetSize(dfbwin, &cw, &ch));
+
+ /* necessary to trigger an event - ugly*/
+ SDL_DFB_CHECK(dfbwin->DisableEvents(dfbwin, DWET_ALL));
+ SDL_DFB_CHECK(dfbwin->Resize(dfbwin, cw + dx + 1, ch + dy));
+ SDL_DFB_CHECK(dfbwin->EnableEvents(dfbwin, DWET_ALL));
+
+ SDL_DFB_CHECK(dfbwin->Resize(dfbwin, cw + dx, ch + dy));
+ }
}
SDL_DFB_CHECK(dfbwin->UngrabPointer(dfbwin));
if (gwindata != NULL)
@@ -370,34 +370,34 @@ DirectFB_WM_ProcessEvent(_THIS, SDL_Window * window, DFBWindowEvent * evt)
if (!windata->wm_grab)
return 0;
if (evt->buttons & DIBM_LEFT) {
- int dx = evt->cx - windata->wm_lastx;
+ int dx = evt->cx - windata->wm_lastx;
int dy = evt->cy - windata->wm_lasty;
if (windata->wm_grab & WM_POS_CAPTION) {
- if (!(wopts & DWOP_KEEP_POSITION))
- SDL_DFB_CHECK(dfbwin->Move(dfbwin, dx, dy));
+ if (!(wopts & DWOP_KEEP_POSITION))
+ SDL_DFB_CHECK(dfbwin->Move(dfbwin, dx, dy));
}
if (windata->wm_grab & (WM_POS_RIGHT | WM_POS_BOTTOM)) {
- if (!(wopts & DWOP_KEEP_SIZE)) {
- int cw, ch;
+ if (!(wopts & DWOP_KEEP_SIZE)) {
+ int cw, ch;
- /* Make sure all events are disabled for this operation ! */
- SDL_DFB_CHECK(dfbwin->DisableEvents(dfbwin, DWET_ALL));
+ /* Make sure all events are disabled for this operation ! */
+ SDL_DFB_CHECK(dfbwin->DisableEvents(dfbwin, DWET_ALL));
- if ((windata->wm_grab & (WM_POS_BOTTOM | WM_POS_RIGHT)) == WM_POS_BOTTOM)
- dx = 0;
- else if ((windata->wm_grab & (WM_POS_BOTTOM | WM_POS_RIGHT)) == WM_POS_RIGHT)
- dy = 0;
+ if ((windata->wm_grab & (WM_POS_BOTTOM | WM_POS_RIGHT)) == WM_POS_BOTTOM)
+ dx = 0;
+ else if ((windata->wm_grab & (WM_POS_BOTTOM | WM_POS_RIGHT)) == WM_POS_RIGHT)
+ dy = 0;
- SDL_DFB_CHECK(dfbwin->GetSize(dfbwin, &cw, &ch));
- SDL_DFB_CHECK(dfbwin->Resize(dfbwin, cw + dx, ch + dy));
+ SDL_DFB_CHECK(dfbwin->GetSize(dfbwin, &cw, &ch));
+ SDL_DFB_CHECK(dfbwin->Resize(dfbwin, cw + dx, ch + dy));
- SDL_DFB_CHECK(dfbwin->EnableEvents(dfbwin, DWET_ALL));
- }
+ SDL_DFB_CHECK(dfbwin->EnableEvents(dfbwin, DWET_ALL));
+ }
}
- windata->wm_lastx = evt->cx;
- windata->wm_lasty = evt->cy;
- return 1;
+ windata->wm_lastx = evt->cx;
+ windata->wm_lasty = evt->cy;
+ return 1;
}
break;
case DWET_KEYDOWN:
diff --git a/src/video/directfb/SDL_DirectFB_dyn.c b/src/video/directfb/SDL_DirectFB_dyn.c
index 4969092522..cbbfa175b1 100644
--- a/src/video/directfb/SDL_DirectFB_dyn.c
+++ b/src/video/directfb/SDL_DirectFB_dyn.c
@@ -32,7 +32,7 @@
#define DFB_SYM(ret, name, args, al, func) ret (*name) args;
static struct _SDL_DirectFB_Symbols
{
- DFB_SYMS
+ DFB_SYMS
const unsigned int *directfb_major_version;
const unsigned int *directfb_minor_version;
const unsigned int *directfb_micro_version;
diff --git a/src/video/directfb/SDL_DirectFB_dyn.h b/src/video/directfb/SDL_DirectFB_dyn.h
index de90961a62..52658b01ff 100644
--- a/src/video/directfb/SDL_DirectFB_dyn.h
+++ b/src/video/directfb/SDL_DirectFB_dyn.h
@@ -23,15 +23,15 @@
#define _SDL_DirectFB_dyn_h
#define DFB_SYMS \
- DFB_SYM(DFBResult, DirectFBError, (const char *msg, DFBResult result), (msg, result), return) \
- DFB_SYM(DFBResult, DirectFBErrorFatal, (const char *msg, DFBResult result), (msg, result), return) \
- DFB_SYM(const char *, DirectFBErrorString, (DFBResult result), (result), return) \
- DFB_SYM(const char *, DirectFBUsageString, ( void ), (), return) \
- DFB_SYM(DFBResult, DirectFBInit, (int *argc, char *(*argv[]) ), (argc, argv), return) \
- DFB_SYM(DFBResult, DirectFBSetOption, (const char *name, const char *value), (name, value), return) \
- DFB_SYM(DFBResult, DirectFBCreate, (IDirectFB **interface), (interface), return) \
- DFB_SYM(const char *, DirectFBCheckVersion, (unsigned int required_major, unsigned int required_minor, unsigned int required_micro), \
- (required_major, required_minor, required_micro), return)
+ DFB_SYM(DFBResult, DirectFBError, (const char *msg, DFBResult result), (msg, result), return) \
+ DFB_SYM(DFBResult, DirectFBErrorFatal, (const char *msg, DFBResult result), (msg, result), return) \
+ DFB_SYM(const char *, DirectFBErrorString, (DFBResult result), (result), return) \
+ DFB_SYM(const char *, DirectFBUsageString, ( void ), (), return) \
+ DFB_SYM(DFBResult, DirectFBInit, (int *argc, char *(*argv[]) ), (argc, argv), return) \
+ DFB_SYM(DFBResult, DirectFBSetOption, (const char *name, const char *value), (name, value), return) \
+ DFB_SYM(DFBResult, DirectFBCreate, (IDirectFB **interface), (interface), return) \
+ DFB_SYM(const char *, DirectFBCheckVersion, (unsigned int required_major, unsigned int required_minor, unsigned int required_micro), \
+ (required_major, required_minor, required_micro), return)
int SDL_DirectFB_LoadLibrary(void);
void SDL_DirectFB_UnLoadLibrary(void);
diff --git a/src/video/directfb/SDL_DirectFB_events.c b/src/video/directfb/SDL_DirectFB_events.c
index 8ee0b90859..ffb15c3625 100644
--- a/src/video/directfb/SDL_DirectFB_events.c
+++ b/src/video/directfb/SDL_DirectFB_events.c
@@ -52,11 +52,11 @@
#endif
typedef struct _cb_data cb_data;
-struct _cb_data
+struct _cb_data
{
- DFB_DeviceData *devdata;
- int sys_ids;
- int sys_kbd;
+ DFB_DeviceData *devdata;
+ int sys_ids;
+ int sys_kbd;
};
/* The translation tables from a DirectFB keycode to a SDL keysym */
@@ -74,7 +74,7 @@ static int DirectFB_TranslateButton(DFBInputDeviceButtonIdentifier button);
static void UnicodeToUtf8( Uint16 w , char *utf8buf)
{
unsigned char *utf8s = (unsigned char *) utf8buf;
-
+
if ( w < 0x0080 ) {
utf8s[0] = ( unsigned char ) w;
utf8s[1] = 0;
@@ -82,14 +82,14 @@ static void UnicodeToUtf8( Uint16 w , char *utf8buf)
else if ( w < 0x0800 ) {
utf8s[0] = 0xc0 | (( w ) >> 6 );
utf8s[1] = 0x80 | (( w ) & 0x3f );
- utf8s[2] = 0;
+ utf8s[2] = 0;
}
else {
utf8s[0] = 0xe0 | (( w ) >> 12 );
utf8s[1] = 0x80 | (( ( w ) >> 6 ) & 0x3f );
utf8s[2] = 0x80 | (( w ) & 0x3f );
utf8s[3] = 0;
- }
+ }
}
static void
@@ -132,7 +132,7 @@ MotionAllMice(_THIS, int x, int y)
SDL_Mouse *mouse = SDL_GetMouse(index);
mouse->x = mouse->last_x = x;
mouse->y = mouse->last_y = y;
- //SDL_SendMouseMotion(devdata->mouse_id[index], 0, x, y, 0);
+ /*SDL_SendMouseMotion(devdata->mouse_id[index], 0, x, y, 0);*/
}
#endif
}
@@ -215,7 +215,7 @@ ProcessWindowEvent(_THIS, SDL_Window *sdlwin, DFBWindowEvent * evt)
SDL_SendMouseMotion_ex(sdlwin, devdata->mouse_id[0], 0,
evt->x, evt->y, 0);
} else {
- /* relative movements are not exact!
+ /* relative movements are not exact!
* This code should limit the number of events sent.
* However it kills MAME axis recognition ... */
static int cnt = 0;
@@ -232,10 +232,10 @@ ProcessWindowEvent(_THIS, SDL_Window *sdlwin, DFBWindowEvent * evt)
case DWET_KEYDOWN:
if (!devdata->use_linux_input) {
DirectFB_TranslateKey(_this, evt, &keysym);
- //printf("Scancode %d %d %d\n", keysym.scancode, evt->key_code, evt->key_id);
+ /*printf("Scancode %d %d %d\n", keysym.scancode, evt->key_code, evt->key_id);*/
SDL_SendKeyboardKey_ex(0, SDL_PRESSED, keysym.scancode);
if (SDL_EventState(SDL_TEXTINPUT, SDL_QUERY)) {
- SDL_zero(text);
+ SDL_zero(text);
UnicodeToUtf8(keysym.unicode, text);
if (*text) {
SDL_SendKeyboardText_ex(0, text);
@@ -262,7 +262,7 @@ ProcessWindowEvent(_THIS, SDL_Window *sdlwin, DFBWindowEvent * evt)
}
/* fall throught */
case DWET_SIZE:
- // FIXME: what about < 0
+ /* FIXME: what about < 0 */
evt->w -= (windata->theme.right_size + windata->theme.left_size);
evt->h -=
(windata->theme.top_size + windata->theme.bottom_size +
@@ -286,7 +286,7 @@ ProcessWindowEvent(_THIS, SDL_Window *sdlwin, DFBWindowEvent * evt)
case DWET_ENTER:
/* SDL_DirectFB_ReshowCursor(_this, 0); */
FocusAllMice(_this, sdlwin);
- // FIXME: when do we really enter ?
+ /* FIXME: when do we really enter ? */
if (ClientXY(windata, &evt->x, &evt->y))
MotionAllMice(_this, evt->x, evt->y);
SDL_SendWindowEvent(sdlwin, SDL_WINDOWEVENT_ENTER, 0, 0);
@@ -367,7 +367,7 @@ ProcessInputEvent(_THIS, DFBInputEvent * ievt)
case DIET_KEYPRESS:
kbd_idx = KbdIndex(_this, ievt->device_id);
DirectFB_TranslateKeyInputEvent(_this, ievt, &keysym);
- //printf("Scancode %d %d %d\n", keysym.scancode, evt->key_code, evt->key_id);
+ /*printf("Scancode %d %d %d\n", keysym.scancode, evt->key_code, evt->key_id); */
SDL_SendKeyboardKey_ex(kbd_idx, SDL_PRESSED, keysym.scancode);
if (SDL_EventState(SDL_TEXTINPUT, SDL_QUERY)) {
SDL_zero(text);
@@ -435,7 +435,7 @@ DirectFB_PumpEventsWindow(_THIS)
while (devdata->events->GetEvent(devdata->events,
DFB_EVENT(&ievt)) == DFB_OK) {
- if (SDL_GetEventState(SDL_SYSWMEVENT) == SDL_ENABLE) {
+ if (SDL_GetEventState(SDL_SYSWMEVENT) == SDL_ENABLE) {
SDL_SysWMmsg wmmsg;
SDL_VERSION(&wmmsg.version);
wmmsg.subsystem = SDL_SYSWM_DIRECTFB;
@@ -584,8 +584,8 @@ DirectFB_TranslateKey(_THIS, DFBWindowEvent * evt, SDL_Keysym * keysym)
keysym->scancode = SDL_SCANCODE_UNKNOWN;
if (kbd->map && evt->key_code >= kbd->map_adjust &&
- evt->key_code < kbd->map_size + kbd->map_adjust)
- keysym->scancode = kbd->map[evt->key_code - kbd->map_adjust];
+ evt->key_code < kbd->map_size + kbd->map_adjust)
+ keysym->scancode = kbd->map[evt->key_code - kbd->map_adjust];
if (keysym->scancode == SDL_SCANCODE_UNKNOWN ||
devdata->keyboard[kbd_idx].is_generic) {
@@ -615,8 +615,8 @@ DirectFB_TranslateKeyInputEvent(_THIS, DFBInputEvent * evt,
keysym->scancode = SDL_SCANCODE_UNKNOWN;
if (kbd->map && evt->key_code >= kbd->map_adjust &&
- evt->key_code < kbd->map_size + kbd->map_adjust)
- keysym->scancode = kbd->map[evt->key_code - kbd->map_adjust];
+ evt->key_code < kbd->map_size + kbd->map_adjust)
+ keysym->scancode = kbd->map[evt->key_code - kbd->map_adjust];
if (keysym->scancode == SDL_SCANCODE_UNKNOWN || devdata->keyboard[kbd_idx].is_generic) {
if (evt->key_id - DIKI_UNKNOWN < SDL_arraysize(oskeymap))
@@ -653,26 +653,26 @@ static DFBEnumerationResult
EnumKeyboards(DFBInputDeviceID device_id,
DFBInputDeviceDescription desc, void *callbackdata)
{
- cb_data *cb = callbackdata;
+ cb_data *cb = callbackdata;
DFB_DeviceData *devdata = cb->devdata;
#if USE_MULTI_API
SDL_Keyboard keyboard;
#endif
SDL_Keycode keymap[SDL_NUM_SCANCODES];
- if (!cb->sys_kbd) {
- if (cb->sys_ids) {
- if (device_id >= 0x10)
- return DFENUM_OK;
- } else {
- if (device_id < 0x10)
- return DFENUM_OK;
- }
- } else {
- if (device_id != DIDID_KEYBOARD)
- return DFENUM_OK;
- }
-
+ if (!cb->sys_kbd) {
+ if (cb->sys_ids) {
+ if (device_id >= 0x10)
+ return DFENUM_OK;
+ } else {
+ if (device_id < 0x10)
+ return DFENUM_OK;
+ }
+ } else {
+ if (device_id != DIDID_KEYBOARD)
+ return DFENUM_OK;
+ }
+
if ((desc.caps & DIDTF_KEYBOARD)) {
#if USE_MULTI_API
SDL_zero(keyboard);
@@ -682,17 +682,17 @@ EnumKeyboards(DFBInputDeviceID device_id,
devdata->keyboard[devdata->num_keyboard].is_generic = 0;
if (!strncmp("X11", desc.name, 3))
{
- devdata->keyboard[devdata->num_keyboard].map = xfree86_scancode_table2;
- devdata->keyboard[devdata->num_keyboard].map_size = SDL_arraysize(xfree86_scancode_table2);
- devdata->keyboard[devdata->num_keyboard].map_adjust = 8;
+ devdata->keyboard[devdata->num_keyboard].map = xfree86_scancode_table2;
+ devdata->keyboard[devdata->num_keyboard].map_size = SDL_arraysize(xfree86_scancode_table2);
+ devdata->keyboard[devdata->num_keyboard].map_adjust = 8;
} else {
- devdata->keyboard[devdata->num_keyboard].map = linux_scancode_table;
- devdata->keyboard[devdata->num_keyboard].map_size = SDL_arraysize(linux_scancode_table);
- devdata->keyboard[devdata->num_keyboard].map_adjust = 0;
+ devdata->keyboard[devdata->num_keyboard].map = linux_scancode_table;
+ devdata->keyboard[devdata->num_keyboard].map_size = SDL_arraysize(linux_scancode_table);
+ devdata->keyboard[devdata->num_keyboard].map_adjust = 0;
}
- SDL_DFB_LOG("Keyboard %d - %s\n", device_id, desc.name);
-
+ SDL_DFB_LOG("Keyboard %d - %s\n", device_id, desc.name);
+
SDL_GetDefaultKeymap(keymap);
#if USE_MULTI_API
SDL_SetKeymap(devdata->num_keyboard, 0, keymap, SDL_NUM_SCANCODES);
@@ -701,8 +701,8 @@ EnumKeyboards(DFBInputDeviceID device_id,
#endif
devdata->num_keyboard++;
- if (cb->sys_kbd)
- return DFENUM_CANCEL;
+ if (cb->sys_kbd)
+ return DFENUM_CANCEL;
}
return DFENUM_OK;
}
@@ -711,15 +711,15 @@ void
DirectFB_InitKeyboard(_THIS)
{
SDL_DFB_DEVICEDATA(_this);
- cb_data cb;
-
+ cb_data cb;
+
DirectFB_InitOSKeymap(_this, &oskeymap[0], SDL_arraysize(oskeymap));
devdata->num_keyboard = 0;
cb.devdata = devdata;
-
+
if (devdata->use_linux_input) {
- cb.sys_kbd = 0;
+ cb.sys_kbd = 0;
cb.sys_ids = 0;
SDL_DFB_CHECK(devdata->dfb->
EnumInputDevices(devdata->dfb, EnumKeyboards, &cb));
@@ -730,7 +730,7 @@ DirectFB_InitKeyboard(_THIS)
&cb));
}
} else {
- cb.sys_kbd = 1;
+ cb.sys_kbd = 1;
SDL_DFB_CHECK(devdata->dfb->EnumInputDevices(devdata->dfb,
EnumKeyboards,
&cb));
@@ -740,7 +740,7 @@ DirectFB_InitKeyboard(_THIS)
void
DirectFB_QuitKeyboard(_THIS)
{
- //SDL_DFB_DEVICEDATA(_this);
+ /*SDL_DFB_DEVICEDATA(_this); */
SDL_KeyboardQuit();
diff --git a/src/video/directfb/SDL_DirectFB_modes.c b/src/video/directfb/SDL_DirectFB_modes.c
index d3a7a54fac..c6d1bb49c3 100644
--- a/src/video/directfb/SDL_DirectFB_modes.c
+++ b/src/video/directfb/SDL_DirectFB_modes.c
@@ -137,7 +137,7 @@ DirectFB_SetContext(_THIS, SDL_Window *window)
SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window);
DFB_DisplayData *dispdata = (DFB_DisplayData *) display->driverdata;
- /* FIXME: should we handle the error */
+ /* FIXME: should we handle the error */
if (dispdata->vidIDinuse)
SDL_DFB_CHECK(dispdata->vidlayer->SwitchContext(dispdata->vidlayer,
DFB_TRUE));
@@ -220,7 +220,7 @@ DirectFB_InitModes(_THIS)
SDL_DFB_CHECKERR(layer->GetConfiguration(layer, &dlc));
mode.format = DirectFB_DFBToSDLPixelFormat(dlc.pixelformat);
-
+
if (mode.format == SDL_PIXELFORMAT_UNKNOWN) {
SDL_DFB_ERR("Unknown dfb pixelformat %x !\n", dlc.pixelformat);
goto error;
@@ -309,7 +309,7 @@ DirectFB_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mod
{
/*
* FIXME: video mode switch is currently broken for 1.2.0
- *
+ *
*/
SDL_DFB_DEVICEDATA(_this);
diff --git a/src/video/directfb/SDL_DirectFB_modes.h b/src/video/directfb/SDL_DirectFB_modes.h
index d9defec320..6e439cdc90 100644
--- a/src/video/directfb/SDL_DirectFB_modes.h
+++ b/src/video/directfb/SDL_DirectFB_modes.h
@@ -31,19 +31,19 @@
typedef struct _DFB_DisplayData DFB_DisplayData;
struct _DFB_DisplayData
{
- IDirectFBDisplayLayer *layer;
- DFBSurfacePixelFormat pixelformat;
- /* FIXME: support for multiple video layer.
- * However, I do not know any card supporting
+ IDirectFBDisplayLayer *layer;
+ DFBSurfacePixelFormat pixelformat;
+ /* FIXME: support for multiple video layer.
+ * However, I do not know any card supporting
* more than one
*/
- DFBDisplayLayerID vidID;
- IDirectFBDisplayLayer *vidlayer;
+ DFBDisplayLayerID vidID;
+ IDirectFBDisplayLayer *vidlayer;
- int vidIDinuse;
+ int vidIDinuse;
- int cw;
- int ch;
+ int cw;
+ int ch;
};
diff --git a/src/video/directfb/SDL_DirectFB_mouse.c b/src/video/directfb/SDL_DirectFB_mouse.c
index 2377c877a2..fb5ed4e7b0 100644
--- a/src/video/directfb/SDL_DirectFB_mouse.c
+++ b/src/video/directfb/SDL_DirectFB_mouse.c
@@ -115,12 +115,12 @@ DirectFB_CreateDefaultCursor(void)
{
for (j = 0; j < 32; j++)
{
- switch (arrow[i][j])
- {
- case ' ': dest[j] = 0x00000000; break;
- case '.': dest[j] = 0xffffffff; break;
- case 'X': dest[j] = 0xff000000; break;
- }
+ switch (arrow[i][j])
+ {
+ case ' ': dest[j] = 0x00000000; break;
+ case '.': dest[j] = 0xffffffff; break;
+ case 'X': dest[j] = 0xff000000; break;
+ }
}
dest += (pitch >> 2);
}
diff --git a/src/video/directfb/SDL_DirectFB_mouse.h b/src/video/directfb/SDL_DirectFB_mouse.h
index b65f9fddbf..906f1fb5e2 100644
--- a/src/video/directfb/SDL_DirectFB_mouse.h
+++ b/src/video/directfb/SDL_DirectFB_mouse.h
@@ -30,8 +30,8 @@ typedef struct _DFB_CursorData DFB_CursorData;
struct _DFB_CursorData
{
IDirectFBSurface *surf;
- int hotx;
- int hoty;
+ int hotx;
+ int hoty;
};
#define SDL_DFB_CURSORDATA(curs) DFB_CursorData *curdata = (DFB_CursorData *) ((curs) ? (curs)->driverdata : NULL)
diff --git a/src/video/directfb/SDL_DirectFB_opengl.c b/src/video/directfb/SDL_DirectFB_opengl.c
index c325f42316..fac05e6f2c 100644
--- a/src/video/directfb/SDL_DirectFB_opengl.c
+++ b/src/video/directfb/SDL_DirectFB_opengl.c
@@ -40,7 +40,7 @@ struct SDL_GLDriverData
int gl_active; /* to stop switching drivers while we have a valid context */
int initialized;
DirectFB_GLContext *firstgl; /* linked list */
-
+
/* OpenGL */
void (*glFinish) (void);
void (*glFlush) (void);
@@ -49,13 +49,13 @@ struct SDL_GLDriverData
#define OPENGL_REQUIRS_DLOPEN
#if defined(OPENGL_REQUIRS_DLOPEN) && defined(SDL_LOADSO_DLOPEN)
#include <dlfcn.h>
-#define GL_LoadObject(X) dlopen(X, (RTLD_NOW|RTLD_GLOBAL))
-#define GL_LoadFunction dlsym
-#define GL_UnloadObject dlclose
+#define GL_LoadObject(X) dlopen(X, (RTLD_NOW|RTLD_GLOBAL))
+#define GL_LoadFunction dlsym
+#define GL_UnloadObject dlclose
#else
-#define GL_LoadObject SDL_LoadObject
-#define GL_LoadFunction SDL_LoadFunction
-#define GL_UnloadObject SDL_UnloadObject
+#define GL_LoadObject SDL_LoadObject
+#define GL_LoadFunction SDL_LoadFunction
+#define GL_UnloadObject SDL_UnloadObject
#endif
static void DirectFB_GL_UnloadLibrary(_THIS);
@@ -107,8 +107,6 @@ DirectFB_GL_Shutdown(_THIS)
int
DirectFB_GL_LoadLibrary(_THIS, const char *path)
{
- //SDL_DFB_DEVICEDATA(_this);
-
void *handle = NULL;
SDL_DFB_DEBUG("Loadlibrary : %s\n", path);
@@ -181,7 +179,6 @@ DirectFB_GL_GetProcAddress(_THIS, const char *proc)
SDL_GLContext
DirectFB_GL_CreateContext(_THIS, SDL_Window * window)
{
- //SDL_DFB_DEVICEDATA(_this);
SDL_DFB_WINDOWDATA(window);
DirectFB_GLContext *context;
@@ -195,7 +192,7 @@ DirectFB_GL_CreateContext(_THIS, SDL_Window * window)
context->is_locked = 0;
context->sdl_window = window;
-
+
context->next = _this->gl_data->firstgl;
_this->gl_data->firstgl = context;
@@ -215,7 +212,6 @@ DirectFB_GL_CreateContext(_THIS, SDL_Window * window)
int
DirectFB_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context)
{
- //SDL_DFB_WINDOWDATA(window);
DirectFB_GLContext *ctx = (DirectFB_GLContext *) context;
DirectFB_GLContext *p;
@@ -225,7 +221,7 @@ DirectFB_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context)
SDL_DFB_CHECKERR(p->context->Unlock(p->context));
p->is_locked = 0;
}
-
+
}
if (ctx != NULL) {
@@ -253,7 +249,6 @@ DirectFB_GL_GetSwapInterval(_THIS)
void
DirectFB_GL_SwapWindow(_THIS, SDL_Window * window)
{
- //SDL_DFB_DEVICEDATA(_this);
SDL_DFB_WINDOWDATA(window);
DFBRegion region;
DirectFB_GLContext *p;
@@ -270,20 +265,14 @@ DirectFB_GL_SwapWindow(_THIS, SDL_Window * window)
devdata->glFlush();
#endif
- for (p = _this->gl_data->firstgl; p != NULL; p = p->next)
+ for (p = _this->gl_data->firstgl; p != NULL; p = p->next)
if (p->sdl_window == window && p->is_locked)
{
SDL_DFB_CHECKERR(p->context->Unlock(p->context));
p->is_locked = 0;
- }
+ }
SDL_DFB_CHECKERR(windata->window_surface->Flip(windata->window_surface,NULL, DSFLIP_PIPELINE |DSFLIP_BLIT | DSFLIP_ONSYNC ));
-
- //if (windata->gl_context) {
- //SDL_DFB_CHECKERR(windata->surface->Flip(windata->surface,NULL, DSFLIP_ONSYNC));
- //SDL_DFB_CHECKERR(windata->gl_context->context->Lock(windata->gl_context->context));
- //}
-
return;
error:
return;
@@ -313,14 +302,14 @@ void
DirectFB_GL_FreeWindowContexts(_THIS, SDL_Window * window)
{
DirectFB_GLContext *p;
-
- for (p = _this->gl_data->firstgl; p != NULL; p = p->next)
- if (p->sdl_window == window)
- {
- if (p->is_locked)
- SDL_DFB_CHECK(p->context->Unlock(p->context));
- SDL_DFB_RELEASE(p->context);
- }
+
+ for (p = _this->gl_data->firstgl; p != NULL; p = p->next)
+ if (p->sdl_window == window)
+ {
+ if (p->is_locked)
+ SDL_DFB_CHECK(p->context->Unlock(p->context));
+ SDL_DFB_RELEASE(p->context);
+ }
}
void
@@ -328,15 +317,15 @@ DirectFB_GL_ReAllocWindowContexts(_THIS, SDL_Window * window)
{
DirectFB_GLContext *p;
- for (p = _this->gl_data->firstgl; p != NULL; p = p->next)
- if (p->sdl_window == window)
- {
+ for (p = _this->gl_data->firstgl; p != NULL; p = p->next)
+ if (p->sdl_window == window)
+ {
SDL_DFB_WINDOWDATA(window);
- SDL_DFB_CHECK(windata->surface->GetGL(windata->surface,
- &p->context));
- if (p->is_locked)
- SDL_DFB_CHECK(p->context->Lock(p->context));
- }
+ SDL_DFB_CHECK(windata->surface->GetGL(windata->surface,
+ &p->context));
+ if (p->is_locked)
+ SDL_DFB_CHECK(p->context->Lock(p->context));
+ }
}
void
@@ -344,9 +333,9 @@ DirectFB_GL_DestroyWindowContexts(_THIS, SDL_Window * window)
{
DirectFB_GLContext *p;
- for (p = _this->gl_data->firstgl; p != NULL; p = p->next)
- if (p->sdl_window == window)
- DirectFB_GL_DeleteContext(_this, p);
+ for (p = _this->gl_data->firstgl; p != NULL; p = p->next)
+ if (p->sdl_window == window)
+ DirectFB_GL_DeleteContext(_this, p);
}
#endif
diff --git a/src/video/directfb/SDL_DirectFB_opengl.h b/src/video/directfb/SDL_DirectFB_opengl.h
index 53d1572aa4..efb11f766a 100644
--- a/src/video/directfb/SDL_DirectFB_opengl.h
+++ b/src/video/directfb/SDL_DirectFB_opengl.h
@@ -32,11 +32,11 @@
typedef struct _DirectFB_GLContext DirectFB_GLContext;
struct _DirectFB_GLContext
{
- IDirectFBGL *context;
- DirectFB_GLContext *next;
-
- SDL_Window *sdl_window;
- int is_locked;
+ IDirectFBGL *context;
+ DirectFB_GLContext *next;
+
+ SDL_Window *sdl_window;
+ int is_locked;
};
/* OpenGL functions */
diff --git a/src/video/directfb/SDL_DirectFB_render.c b/src/video/directfb/SDL_DirectFB_render.c
index 07aa77d111..958793db7e 100644
--- a/src/video/directfb/SDL_DirectFB_render.c
+++ b/src/video/directfb/SDL_DirectFB_render.c
@@ -21,7 +21,6 @@
#include "SDL_config.h"
#if SDL_VIDEO_DRIVER_DIRECTFB
-//#include "SDL_DirectFB_video.h"
#include "SDL_DirectFB_window.h"
#include "SDL_DirectFB_modes.h"
@@ -30,8 +29,6 @@
#include "../SDL_sysvideo.h"
#include "../../render/SDL_sysrender.h"
-//#include "../SDL_rect_c.h"
-//#include "../SDL_yuv_sw_c.h"
#ifndef DFB_VERSION_ATLEAST
@@ -242,7 +239,7 @@ SetBlendMode(DirectFB_RenderData * data, int blendMode,
{
IDirectFBSurface *destsurf = data->target;
- //FIXME: check for format change
+ /* FIXME: check for format change */
if (1 || data->lastBlendMode != blendMode) {
switch (blendMode) {
case SDL_BLENDMODE_NONE:
@@ -269,9 +266,9 @@ SetBlendMode(DirectFB_RenderData * data, int blendMode,
case SDL_BLENDMODE_ADD:
data->blitFlags = DSBLIT_BLEND_ALPHACHANNEL;
data->drawFlags = DSDRAW_BLEND;
- // FIXME: SRCALPHA kills performance on radeon ...
- // It will be cheaper to copy the surface to
- // a temporay surface and premultiply
+ /* FIXME: SRCALPHA kills performance on radeon ... */
+ * It will be cheaper to copy the surface to a temporary surface and premultiply
+ */
if (source && TextureHasAlpha(source))
SDL_DFB_CHECK(destsurf->SetSrcBlendFunction(destsurf, DSBF_SRCALPHA));
else
@@ -281,9 +278,6 @@ SetBlendMode(DirectFB_RenderData * data, int blendMode,
case SDL_BLENDMODE_MOD:
data->blitFlags = DSBLIT_BLEND_ALPHACHANNEL;
data->drawFlags = DSDRAW_BLEND;
- //SDL_DFB_CHECK(destsurf->SetSrcBlendFunction(destsurf, DSBF_DESTCOLOR));
- //SDL_DFB_CHECK(destsurf->SetDstBlendFunction(destsurf, DSBF_ZERO));
- //data->glBlendFunc(GL_ZERO, GL_SRC_COLOR);
SDL_DFB_CHECK(destsurf->SetSrcBlendFunction(destsurf, DSBF_ZERO));
SDL_DFB_CHECK(destsurf->SetDstBlendFunction(destsurf, DSBF_SRCCOLOR));
@@ -332,8 +326,8 @@ DirectFB_WindowEvent(SDL_Renderer * renderer, const SDL_WindowEvent *event)
if (event->event == SDL_WINDOWEVENT_SIZE_CHANGED) {
/* Rebind the context to the window area and update matrices */
- //SDL_CurrentContext = NULL;
- //data->updateSize = SDL_TRUE;
+ /*SDL_CurrentContext = NULL; */
+ /*data->updateSize = SDL_TRUE; */
renddata->size_changed = SDL_TRUE;
}
}
@@ -362,7 +356,6 @@ DirectFB_CreateRenderer(SDL_Window * window, Uint32 flags)
SDL_Renderer *renderer = NULL;
DirectFB_RenderData *data = NULL;
DFBSurfaceCapabilities scaps;
- //char *p;
SDL_DFB_ALLOC_CLEAR(renderer, sizeof(*renderer));
SDL_DFB_ALLOC_CLEAR(data, sizeof(*data));
@@ -386,7 +379,7 @@ DirectFB_CreateRenderer(SDL_Window * window, Uint32 flags)
/* FIXME: Yet to be tested */
renderer->RenderReadPixels = DirectFB_RenderReadPixels;
- //renderer->RenderWritePixels = DirectFB_RenderWritePixels;
+ /*renderer->RenderWritePixels = DirectFB_RenderWritePixels; */
renderer->DestroyTexture = DirectFB_DestroyTexture;
renderer->DestroyRenderer = DirectFB_DestroyRenderer;
@@ -458,7 +451,6 @@ DirectFB_ActivateRenderer(SDL_Renderer * renderer)
SDL_DFB_WINDOWDATA(window);
if (renddata->size_changed /*|| windata->wm_needs_redraw*/) {
- //DirectFB_AdjustWindowSurface(window);
renddata->size_changed = SDL_FALSE;
}
}
@@ -467,7 +459,6 @@ DirectFB_ActivateRenderer(SDL_Renderer * renderer)
static int
DirectFB_AcquireVidLayer(SDL_Renderer * renderer, SDL_Texture * texture)
{
- //SDL_DFB_RENDERERDATA(renderer);
SDL_Window *window = renderer->window;
SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window);
SDL_DFB_DEVICEDATA(display->device);
@@ -586,7 +577,7 @@ DirectFB_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
* Creating a new palette does not help.
*/
DFBPaletteDescription pal_desc;
- pal_desc.flags = DPDESC_SIZE; // | DPDESC_ENTRIES
+ pal_desc.flags = DPDESC_SIZE; /* | DPDESC_ENTRIES */
pal_desc.size = 256;
SDL_DFB_CHECKERR(devdata->dfb->CreatePalette(devdata->dfb, &pal_desc,&data->palette));
SDL_DFB_CHECKERR(data->surface->SetPalette(data->surface, data->palette));
@@ -710,7 +701,7 @@ DirectFB_SetTextureBlendMode(SDL_Renderer * renderer, SDL_Texture * texture)
{
switch (texture->blendMode) {
case SDL_BLENDMODE_NONE:
- //case SDL_BLENDMODE_MASK:
+ /*case SDL_BLENDMODE_MASK: */
case SDL_BLENDMODE_BLEND:
case SDL_BLENDMODE_ADD:
case SDL_BLENDMODE_MOD:
@@ -726,7 +717,7 @@ DirectFB_SetDrawBlendMode(SDL_Renderer * renderer)
{
switch (renderer->blendMode) {
case SDL_BLENDMODE_NONE:
- //case SDL_BLENDMODE_MASK:
+ /*case SDL_BLENDMODE_MASK: */
case SDL_BLENDMODE_BLEND:
case SDL_BLENDMODE_ADD:
case SDL_BLENDMODE_MOD:
@@ -778,7 +769,7 @@ DirectFB_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
int row;
size_t length;
int bpp = DFB_BYTES_PER_PIXEL(DirectFB_SDLToDFBPixelFormat(texture->format));
- // FIXME: SDL_BYTESPERPIXEL(texture->format) broken for yuv yv12 3 planes
+ /* FIXME: SDL_BYTESPERPIXEL(texture->format) broken for yuv yv12 3 planes */
DirectFB_ActivateRenderer(renderer);
@@ -925,7 +916,7 @@ PrepareDraw(SDL_Renderer * renderer)
switch (renderer->blendMode) {
case SDL_BLENDMODE_NONE:
- //case SDL_BLENDMODE_MASK:
+ /*case SDL_BLENDMODE_MASK: */
case SDL_BLENDMODE_BLEND:
break;
case SDL_BLENDMODE_ADD:
@@ -1035,7 +1026,7 @@ DirectFB_RenderFillRects(SDL_Renderer * renderer, const SDL_FRect * rects, int c
destsurf->GetClip(destsurf, &clip_region);
for (i=0; i<count; i++) {
- SDL_Rect dst = {rects[i].x, rects[i].y, rects[i].w, rects[i].h};
+ SDL_Rect dst = {rects[i].x, rects[i].y, rects[i].w, rects[i].h};
dst.x += clip_region.x1;
dst.y += clip_region.y1;
SDL_DFB_CHECKERR(destsurf->FillRectangle(destsurf, dst.x, dst.y,
@@ -1137,7 +1128,7 @@ DirectFB_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture,
SDL_DFB_CHECKERR(destsurf->
SetColor(destsurf, r, g, b, alpha));
- // ???? flags |= DSBLIT_SRC_PREMULTCOLOR;
+ /* ???? flags |= DSBLIT_SRC_PREMULTCOLOR; */
SetBlendMode(data, texture->blendMode, texturedata);
@@ -1208,7 +1199,6 @@ DirectFB_DestroyTexture(SDL_Renderer * renderer, SDL_Texture * texture)
if (!data) {
return;
}
- //SDL_FreeDirtyRects(&data->dirty);
SDL_DFB_RELEASE(data->palette);
SDL_DFB_RELEASE(data->surface);
if (data->display) {
diff --git a/src/video/directfb/SDL_DirectFB_shape.c b/src/video/directfb/SDL_DirectFB_shape.c
index 01ac744493..13c3d703ef 100644
--- a/src/video/directfb/SDL_DirectFB_shape.c
+++ b/src/video/directfb/SDL_DirectFB_shape.c
@@ -57,20 +57,20 @@ int
DirectFB_ResizeWindowShape(SDL_Window* window) {
SDL_ShapeData* data = window->shaper->driverdata;
SDL_assert(data != NULL);
-
- if (window->x != -1000)
+
+ if (window->x != -1000)
{
- window->shaper->userx = window->x;
- window->shaper->usery = window->y;
+ window->shaper->userx = window->x;
+ window->shaper->usery = window->y;
}
SDL_SetWindowPosition(window,-1000,-1000);
-
+
return 0;
}
-
+
int
DirectFB_SetWindowShape(SDL_WindowShaper *shaper,SDL_Surface *shape,SDL_WindowShapeMode *shape_mode) {
-
+
if(shaper == NULL || shape == NULL || shaper->driverdata == NULL)
return -1;
if(shape->format->Amask == 0 && SDL_SHAPEMODEALPHA(shape_mode->mode))
@@ -81,10 +81,10 @@ DirectFB_SetWindowShape(SDL_WindowShaper *shaper,SDL_Surface *shape,SDL_WindowSh
{
SDL_VideoDisplay *display = SDL_GetDisplayForWindow(shaper->window);
SDL_DFB_DEVICEDATA(display->device);
- Uint32 *pixels;
- Sint32 pitch;
- Uint32 h,w;
- Uint8 *src, *bitmap;
+ Uint32 *pixels;
+ Sint32 pitch;
+ Uint32 h,w;
+ Uint8 *src, *bitmap;
DFBSurfaceDescription dsc;
SDL_ShapeData *data = shaper->driverdata;
@@ -103,32 +103,32 @@ DirectFB_SetWindowShape(SDL_WindowShaper *shaper,SDL_Surface *shape,SDL_WindowSh
SDL_DFB_ALLOC_CLEAR(bitmap, shape->w * shape->h);
SDL_CalculateShapeBitmap(shaper->mode,shape,bitmap,1);
- src = bitmap;
+ src = bitmap;
SDL_DFB_CHECK(data->surface->Lock(data->surface, DSLF_WRITE | DSLF_READ, (void **) &pixels, &pitch));
- h = shaper->window->h;
- while (h--) {
- for (w = 0; w < shaper->window->w; w++) {
- if (*src)
- pixels[w] = 0xFFFFFFFF;
- else
- pixels[w] = 0;
- src++;
-
- }
- pixels += (pitch >> 2);
- }
+ h = shaper->window->h;
+ while (h--) {
+ for (w = 0; w < shaper->window->w; w++) {
+ if (*src)
+ pixels[w] = 0xFFFFFFFF;
+ else
+ pixels[w] = 0;
+ src++;
+
+ }
+ pixels += (pitch >> 2);
+ }
SDL_DFB_CHECK(data->surface->Unlock(data->surface));
- SDL_DFB_FREE(bitmap);
+ SDL_DFB_FREE(bitmap);
- /* FIXME: Need to call this here - Big ?? */
- DirectFB_WM_RedrawLayout(SDL_GetDisplayForWindow(shaper->window)->device, shaper->window);
+ /* FIXME: Need to call this here - Big ?? */
+ DirectFB_WM_RedrawLayout(SDL_GetDisplayForWindow(shaper->window)->device, shaper->window);
}
-
+
return 0;
error:
- return -1;
+ return -1;
}
#endif /* SDL_VIDEO_DRIVER_DIRECTFB */
diff --git a/src/video/directfb/SDL_DirectFB_shape.h b/src/video/directfb/SDL_DirectFB_shape.h
index b405bdea2a..a99778533a 100644
--- a/src/video/directfb/SDL_DirectFB_shape.h
+++ b/src/video/directfb/SDL_DirectFB_shape.h
@@ -28,12 +28,12 @@
#include "SDL_shape.h"
typedef struct {
- IDirectFBSurface *surface;
+ IDirectFBSurface *surface;
} SDL_ShapeData;
extern SDL_Window* DirectFB_CreateShapedWindow(const char *title,unsigned int x,unsigned int y,unsigned int w,unsigned int h,Uint32 flags);
extern SDL_WindowShaper* DirectFB_CreateShaper(SDL_Window* window);
extern int DirectFB_ResizeWindowShape(SDL_Window* window);
-extern int DirectFB_SetWindowShape(SDL_WindowShaper *shaper,SDL_Surface *shape,SDL_WindowShapeMode *shapeMode);
+extern int DirectFB_SetWindowShape(SDL_WindowShaper *shaper,SDL_Surface *shape,SDL_WindowShapeMode *shapeMode);
#endif /* _SDL_DirectFB_shape_h */
diff --git a/src/video/directfb/SDL_DirectFB_video.c b/src/video/directfb/SDL_DirectFB_video.c
index 3f9bba2ba5..d20b5f122d 100644
--- a/src/video/directfb/SDL_DirectFB_video.c
+++ b/src/video/directfb/SDL_DirectFB_video.c
@@ -148,13 +148,13 @@ DirectFB_CreateDevice(int devindex)
#endif
- /* Shaped window support */
- device->shape_driver.CreateShaper = DirectFB_CreateShaper;
- device->shape_driver.SetWindowShape = DirectFB_SetWindowShape;
- device->shape_driver.ResizeWindowShape = DirectFB_ResizeWindowShape;
-
+ /* Shaped window support */
+ device->shape_driver.CreateShaper = DirectFB_CreateShaper;
+ device->shape_driver.SetWindowShape = DirectFB_SetWindowShape;
+ device->shape_driver.ResizeWindowShape = DirectFB_ResizeWindowShape;
+
device->free = DirectFB_DeleteDevice;
-
+
return device;
error:
if (device)
@@ -235,19 +235,19 @@ DirectFB_VideoInit(_THIS)
DirectFBSetOption("disable-module", "x11input");
}
- /* FIXME: Reenable as default once multi kbd/mouse interface is sorted out */
- devdata->use_linux_input = readBoolEnv(DFBENV_USE_LINUX_INPUT, 0); /* default: on */
+ /* FIXME: Reenable as default once multi kbd/mouse interface is sorted out */
+ devdata->use_linux_input = readBoolEnv(DFBENV_USE_LINUX_INPUT, 0); /* default: on */
if (!devdata->use_linux_input)
{
- SDL_DFB_LOG("Disabling linxu input\n");
+ SDL_DFB_LOG("Disabling linxu input\n");
DirectFBSetOption("disable-module", "linux_input");
}
-
+
SDL_DFB_CHECKERR(DirectFBCreate(&dfb));
DirectFB_DeviceInformation(dfb);
-
+
devdata->use_yuv_underlays = readBoolEnv(DFBENV_USE_YUV_UNDERLAY, 0); /* default: off */
devdata->use_yuv_direct = readBoolEnv(DFBENV_USE_YUV_DIRECT, 0); /* default is off! */
@@ -317,7 +317,7 @@ DirectFB_VideoQuit(_THIS)
static const struct {
DFBSurfacePixelFormat dfb;
Uint32 sdl;
-} pixelformat_tab[] =
+} pixelformat_tab[] =
{
{ DSPF_RGB32, SDL_PIXELFORMAT_RGB888 }, /* 24 bit RGB (4 byte, nothing@24, red 8@16, green 8@8, blue 8@0) */
{ DSPF_ARGB, SDL_PIXELFORMAT_ARGB8888 }, /* 32 bit ARGB (4 byte, alpha 8@24, red 8@16, green 8@8, blue 8@0) */
@@ -342,38 +342,38 @@ static const struct {
{ DSPF_UNKNOWN, SDL_PIXELFORMAT_BGR555 },
#endif
- /* Pfff ... nonmatching formats follow */
-
+ /* Pfff ... nonmatching formats follow */
+
{ DSPF_ALUT44, SDL_PIXELFORMAT_UNKNOWN }, /* 8 bit ALUT (1 byte, alpha 4@4, color lookup 4@0) */
- { DSPF_A8, SDL_PIXELFORMAT_UNKNOWN }, /* 8 bit alpha (1 byte, alpha 8@0), e.g. anti-aliased glyphs */
- { DSPF_AiRGB, SDL_PIXELFORMAT_UNKNOWN }, /* 32 bit ARGB (4 byte, inv. alpha 8@24, red 8@16, green 8@8, blue 8@0) */
- { DSPF_A1, SDL_PIXELFORMAT_UNKNOWN }, /* 1 bit alpha (1 byte/ 8 pixel, most significant bit used first) */
- { DSPF_NV12, SDL_PIXELFORMAT_UNKNOWN }, /* 12 bit YUV (8 bit Y plane followed by one 16 bit quarter size CbCr [15:0] plane) */
- { DSPF_NV16, SDL_PIXELFORMAT_UNKNOWN }, /* 16 bit YUV (8 bit Y plane followed by one 16 bit half width CbCr [15:0] plane) */
- { DSPF_ARGB2554, SDL_PIXELFORMAT_UNKNOWN }, /* 16 bit ARGB (2 byte, alpha 2@14, red 5@9, green 5@4, blue 4@0) */
- { DSPF_NV21, SDL_PIXELFORMAT_UNKNOWN }, /* 12 bit YUV (8 bit Y plane followed by one 16 bit quarter size CrCb [15:0] plane) */
- { DSPF_AYUV, SDL_PIXELFORMAT_UNKNOWN }, /* 32 bit AYUV (4 byte, alpha 8@24, Y 8@16, Cb 8@8, Cr 8@0) */
- { DSPF_A4, SDL_PIXELFORMAT_UNKNOWN }, /* 4 bit alpha (1 byte/ 2 pixel, more significant nibble used first) */
- { DSPF_ARGB1666, SDL_PIXELFORMAT_UNKNOWN }, /* 1 bit alpha (3 byte/ alpha 1@18, red 6@16, green 6@6, blue 6@0) */
- { DSPF_ARGB6666, SDL_PIXELFORMAT_UNKNOWN }, /* 6 bit alpha (3 byte/ alpha 6@18, red 6@16, green 6@6, blue 6@0) */
- { DSPF_RGB18, SDL_PIXELFORMAT_UNKNOWN }, /* 6 bit RGB (3 byte/ red 6@16, green 6@6, blue 6@0) */
- { DSPF_LUT2, SDL_PIXELFORMAT_UNKNOWN }, /* 2 bit LUT (1 byte/ 4 pixel, 2 bit color and alpha lookup from palette) */
+ { DSPF_A8, SDL_PIXELFORMAT_UNKNOWN }, /* 8 bit alpha (1 byte, alpha 8@0), e.g. anti-aliased glyphs */
+ { DSPF_AiRGB, SDL_PIXELFORMAT_UNKNOWN }, /* 32 bit ARGB (4 byte, inv. alpha 8@24, red 8@16, green 8@8, blue 8@0) */
+ { DSPF_A1, SDL_PIXELFORMAT_UNKNOWN }, /* 1 bit alpha (1 byte/ 8 pixel, most significant bit used first) */
+ { DSPF_NV12, SDL_PIXELFORMAT_UNKNOWN }, /* 12 bit YUV (8 bit Y plane followed by one 16 bit quarter size CbCr [15:0] plane) */
+ { DSPF_NV16, SDL_PIXELFORMAT_UNKNOWN }, /* 16 bit YUV (8 bit Y plane followed by one 16 bit half width CbCr [15:0] plane) */
+ { DSPF_ARGB2554, SDL_PIXELFORMAT_UNKNOWN }, /* 16 bit ARGB (2 byte, alpha 2@14, red 5@9, green 5@4, blue 4@0) */
+ { DSPF_NV21, SDL_PIXELFORMAT_UNKNOWN }, /* 12 bit YUV (8 bit Y plane followed by one 16 bit quarter size CrCb [15:0] plane) */
+ { DSPF_AYUV, SDL_PIXELFORMAT_UNKNOWN }, /* 32 bit AYUV (4 byte, alpha 8@24, Y 8@16, Cb 8@8, Cr 8@0) */
+ { DSPF_A4, SDL_PIXELFORMAT_UNKNOWN }, /* 4 bit alpha (1 byte/ 2 pixel, more significant nibble used first) */
+ { DSPF_ARGB1666, SDL_PIXELFORMAT_UNKNOWN }, /* 1 bit alpha (3 byte/ alpha 1@18, red 6@16, green 6@6, blue 6@0) */
+ { DSPF_ARGB6666, SDL_PIXELFORMAT_UNKNOWN }, /* 6 bit alpha (3 byte/ alpha 6@18, red 6@16, green 6@6, blue 6@0) */
+ { DSPF_RGB18, SDL_PIXELFORMAT_UNKNOWN }, /* 6 bit RGB (3 byte/ red 6@16, green 6@6, blue 6@0) */
+ { DSPF_LUT2, SDL_PIXELFORMAT_UNKNOWN }, /* 2 bit LUT (1 byte/ 4 pixel, 2 bit color and alpha lookup from palette) */
#if (DFB_VERSION_ATLEAST(1,3,0))
- { DSPF_RGBA4444, SDL_PIXELFORMAT_UNKNOWN }, /* 16 bit RGBA (2 byte, red 4@12, green 4@8, blue 4@4, alpha 4@0) */
+ { DSPF_RGBA4444, SDL_PIXELFORMAT_UNKNOWN }, /* 16 bit RGBA (2 byte, red 4@12, green 4@8, blue 4@4, alpha 4@0) */
#endif
#if (DFB_VERSION_ATLEAST(1,4,3))
- { DSPF_RGBA5551, SDL_PIXELFORMAT_UNKNOWN }, /* 16 bit RGBA (2 byte, red 5@11, green 5@6, blue 5@1, alpha 1@0) */
- { DSPF_YUV444P, SDL_PIXELFORMAT_UNKNOWN }, /* 24 bit full YUV planar (8 bit Y plane followed by an 8 bit Cb and an 8 bit Cr plane) */
- { DSPF_ARGB8565, SDL_PIXELFORMAT_UNKNOWN }, /* 24 bit ARGB (3 byte, alpha 8@16, red 5@11, green 6@5, blue 5@0) */
- { DSPF_AVYU, SDL_PIXELFORMAT_UNKNOWN }, /* 32 bit AVYU 4:4:4 (4 byte, alpha 8@24, Cr 8@16, Y 8@8, Cb 8@0) */
- { DSPF_VYU, SDL_PIXELFORMAT_UNKNOWN }, /* 24 bit VYU 4:4:4 (3 byte, Cr 8@16, Y 8@8, Cb 8@0) */
+ { DSPF_RGBA5551, SDL_PIXELFORMAT_UNKNOWN }, /* 16 bit RGBA (2 byte, red 5@11, green 5@6, blue 5@1, alpha 1@0) */
+ { DSPF_YUV444P, SDL_PIXELFORMAT_UNKNOWN }, /* 24 bit full YUV planar (8 bit Y plane followed by an 8 bit Cb and an 8 bit Cr plane) */
+ { DSPF_ARGB8565, SDL_PIXELFORMAT_UNKNOWN }, /* 24 bit ARGB (3 byte, alpha 8@16, red 5@11, green 6@5, blue 5@0) */
+ { DSPF_AVYU, SDL_PIXELFORMAT_UNKNOWN }, /* 32 bit AVYU 4:4:4 (4 byte, alpha 8@24, Cr 8@16, Y 8@8, Cb 8@0) */
+ { DSPF_VYU, SDL_PIXELFORMAT_UNKNOWN }, /* 24 bit VYU 4:4:4 (3 byte, Cr 8@16, Y 8@8, Cb 8@0) */
#endif
-
+
{ DSPF_UNKNOWN, SDL_PIXELFORMAT_INDEX1LSB },
{ DSPF_UNKNOWN, SDL_PIXELFORMAT_INDEX1MSB },
- { DSPF_UNKNOWN, SDL_PIXELFORMAT_INDEX4LSB },
+ { DSPF_UNKNOWN, SDL_PIXELFORMAT_INDEX4LSB },
{ DSPF_UNKNOWN, SDL_PIXELFORMAT_INDEX4MSB },
{ DSPF_UNKNOWN, SDL_PIXELFORMAT_BGR24 },
{ DSPF_UNKNOWN, SDL_PIXELFORMAT_BGR888 },
@@ -384,14 +384,14 @@ static const struct {
{ DSPF_UNKNOWN, SDL_PIXELFORMAT_ABGR4444 },
{ DSPF_UNKNOWN, SDL_PIXELFORMAT_ABGR1555 },
{ DSPF_UNKNOWN, SDL_PIXELFORMAT_BGR565 },
- { DSPF_UNKNOWN, SDL_PIXELFORMAT_YVYU }, /**< Packed mode: Y0+V0+Y1+U0 (1 pla */
+ { DSPF_UNKNOWN, SDL_PIXELFORMAT_YVYU }, /**< Packed mode: Y0+V0+Y1+U0 (1 pla */
};
Uint32
DirectFB_DFBToSDLPixelFormat(DFBSurfacePixelFormat pixelformat)
{
int i;
-
+
for (i=0; pixelformat_tab[i].dfb != DSPF_UNKNOWN; i++)
if (pixelformat_tab[i].dfb == pixelformat)
{
@@ -404,7 +404,7 @@ DFBSurfacePixelFormat
DirectFB_SDLToDFBPixelFormat(Uint32 format)
{
int i;
-
+
for (i=0; pixelformat_tab[i].dfb != DSPF_UNKNOWN; i++)
if (pixelformat_tab[i].sdl == format)
{
@@ -415,11 +415,11 @@ DirectFB_SDLToDFBPixelFormat(Uint32 format)
void DirectFB_SetSupportedPixelFormats(SDL_RendererInfo* ri)
{
- int i, j;
+ int i, j;
for (i=0, j=0; pixelformat_tab[i].dfb != DSPF_UNKNOWN; i++)
- if (pixelformat_tab[i].sdl != SDL_PIXELFORMAT_UNKNOWN)
- ri->texture_formats[j++] = pixelformat_tab[i].sdl;
+ if (pixelformat_tab[i].sdl != SDL_PIXELFORMAT_UNKNOWN)
+ ri->texture_formats[j++] = pixelformat_tab[i].sdl;
ri->num_texture_formats = j;
}
diff --git a/src/video/directfb/SDL_DirectFB_video.h b/src/video/directfb/SDL_DirectFB_video.h
index 4980f7a5c8..53fcdcfb9b 100644
--- a/src/video/directfb/SDL_DirectFB_video.h
+++ b/src/video/directfb/SDL_DirectFB_video.h
@@ -33,14 +33,14 @@
#include "SDL_log.h"
-#define DFB_VERSIONNUM(X, Y, Z) \
- ((X)*1000 + (Y)*100 + (Z))
+#define DFB_VERSIONNUM(X, Y, Z) \
+ ((X)*1000 + (Y)*100 + (Z))
#define DFB_COMPILEDVERSION \
- DFB_VERSIONNUM(DIRECTFB_MAJOR_VERSION, DIRECTFB_MINOR_VERSION, DIRECTFB_MICRO_VERSION)
+ DFB_VERSIONNUM(DIRECTFB_MAJOR_VERSION, DIRECTFB_MINOR_VERSION, DIRECTFB_MICRO_VERSION)
#define DFB_VERSION_ATLEAST(X, Y, Z) \
- (DFB_COMPILEDVERSION >= DFB_VERSIONNUM(X, Y, Z))
+ (DFB_COMPILEDVERSION >= DFB_VERSIONNUM(X, Y, Z))
#if (DFB_VERSION_ATLEAST(1,0,0))
#ifdef SDL_VIDEO_OPENGL
@@ -51,10 +51,10 @@
#endif
/* Set below to 1 to compile with (old) multi mice/keyboard api. Code left in
- * in case we see this again ...
+ * in case we see this again ...
*/
-#define USE_MULTI_API (0)
+#define USE_MULTI_API (0)
/* Support for LUT8/INDEX8 pixel format.
* This is broken in DirectFB 1.4.3. It works in 1.4.0 and 1.4.5
@@ -62,18 +62,18 @@
*/
#if (DFB_COMPILEDVERSION == DFB_VERSIONNUM(1, 4, 3))
-#define ENABLE_LUT8 (0)
+#define ENABLE_LUT8 (0)
#else
-#define ENABLE_LUT8 (1)
+#define ENABLE_LUT8 (1)
#endif
#define DIRECTFB_DEBUG 1
-#define DFBENV_USE_YUV_UNDERLAY "SDL_DIRECTFB_YUV_UNDERLAY" /* Default: off */
-#define DFBENV_USE_YUV_DIRECT "SDL_DIRECTFB_YUV_DIRECT" /* Default: off */
-#define DFBENV_USE_X11_CHECK "SDL_DIRECTFB_X11_CHECK" /* Default: on */
-#define DFBENV_USE_LINUX_INPUT "SDL_DIRECTFB_LINUX_INPUT" /* Default: on */
-#define DFBENV_USE_WM "SDL_DIRECTFB_WM" /* Default: off */
+#define DFBENV_USE_YUV_UNDERLAY "SDL_DIRECTFB_YUV_UNDERLAY" /* Default: off */
+#define DFBENV_USE_YUV_DIRECT "SDL_DIRECTFB_YUV_DIRECT" /* Default: off */
+#define DFBENV_USE_X11_CHECK "SDL_DIRECTFB_X11_CHECK" /* Default: on */
+#define DFBENV_USE_LINUX_INPUT "SDL_DIRECTFB_LINUX_INPUT" /* Default: on */
+#define DFBENV_USE_WM "SDL_DIRECTFB_WM" /* Default: off */
#define SDL_DFB_RELEASE(x) do { if ( (x) != NULL ) { SDL_DFB_CHECK(x->Release(x)); x = NULL; } } while (0)
#define SDL_DFB_FREE(x) do { if ( (x) != NULL ) { SDL_free(x); x = NULL; } } while (0)
@@ -89,11 +89,11 @@
#define SDL_DFB_DEBUG(x...) SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, x)
static inline DFBResult sdl_dfb_check(DFBResult ret, const char *src_file, int src_line) {
- if (ret != DFB_OK) {
- SDL_DFB_LOG("%s (%d):%s", src_file, src_line, DirectFBErrorString (ret) );
- SDL_SetError("%s:%s", SDL_DFB_CONTEXT, DirectFBErrorString (ret) );
- }
- return ret;
+ if (ret != DFB_OK) {
+ SDL_DFB_LOG("%s (%d):%s", src_file, src_line, DirectFBErrorString (ret) );
+ SDL_SetError("%s:%s", SDL_DFB_CONTEXT, DirectFBErrorString (ret) );
+ }
+ return ret;
}
#define SDL_DFB_CHECK(x...) do { sdl_dfb_check( x, __FILE__, __LINE__); } while (0)
@@ -113,9 +113,9 @@ static inline DFBResult sdl_dfb_check(DFBResult ret, const char *src_file, int s
do { \
r = SDL_calloc (n, s); \
if (!(r)) { \
- SDL_DFB_ERR("Out of memory"); \
+ SDL_DFB_ERR("Out of memory"); \
SDL_OutOfMemory(); \
- goto error; \
+ goto error; \
} \
} while (0)
@@ -130,10 +130,10 @@ static inline DFBResult sdl_dfb_check(DFBResult ret, const char *src_file, int s
typedef struct _DFB_KeyboardData DFB_KeyboardData;
struct _DFB_KeyboardData
{
- const SDL_Scancode *map; /* keyboard scancode map */
- int map_size; /* size of map */
- int map_adjust; /* index adjust */
- int is_generic; /* generic keyboard */
+ const SDL_Scancode *map; /* keyboard scancode map */
+ int map_size; /* size of map */
+ int map_adjust; /* index adjust */
+ int is_generic; /* generic keyboard */
int id;
};
@@ -142,21 +142,21 @@ struct _DFB_DeviceData
{
int initialized;
- IDirectFB *dfb;
- int num_mice;
- int mouse_id[0x100];
- int num_keyboard;
- DFB_KeyboardData keyboard[10];
- SDL_Window *firstwin;
+ IDirectFB *dfb;
+ int num_mice;
+ int mouse_id[0x100];
+ int num_keyboard;
+ DFB_KeyboardData keyboard[10];
+ SDL_Window *firstwin;
- int use_yuv_underlays;
- int use_yuv_direct;
- int use_linux_input;
- int has_own_wm;
+ int use_yuv_underlays;
+ int use_yuv_direct;
+ int use_linux_input;
+ int has_own_wm;
- /* window grab */
- SDL_Window *grabbed_window;
+ /* window grab */
+ SDL_Window *grabbed_window;
/* global events */
IDirectFBEventBuffer *events;
diff --git a/src/video/directfb/SDL_DirectFB_window.c b/src/video/directfb/SDL_DirectFB_window.c
index 1ba4cfe601..cdcb4cce61 100644
--- a/src/video/directfb/SDL_DirectFB_window.c
+++ b/src/video/directfb/SDL_DirectFB_window.c
@@ -57,10 +57,10 @@ DirectFB_CreateWindow(_THIS, SDL_Window * window)
SDL_DFB_CHECKERR(dispdata->layer->SetCooperativeLevel(dispdata->layer,
DLSCL_ADMINISTRATIVE));
#endif
- /* FIXME ... ughh, ugly */
- if (window->x == -1000 && window->y == -1000)
- bshaped = 1;
-
+ /* FIXME ... ughh, ugly */
+ if (window->x == -1000 && window->y == -1000)
+ bshaped = 1;
+
/* Fill the window description. */
x = window->x;
y = window->y;
@@ -68,21 +68,21 @@ DirectFB_CreateWindow(_THIS, SDL_Window * window)
DirectFB_WM_AdjustWindowLayout(window, window->flags, window->w, window->h);
/* Create Window */
- desc.caps = 0;
+ desc.caps = 0;
desc.flags =
DWDESC_WIDTH | DWDESC_HEIGHT | DWDESC_POSX | DWDESC_POSY | DWDESC_SURFACE_CAPS;
if (bshaped) {
- desc.flags |= DWDESC_CAPS;
- desc.caps |= DWCAPS_ALPHACHANNEL;
+ desc.flags |= DWDESC_CAPS;
+ desc.caps |= DWCAPS_ALPHACHANNEL;
}
else
{
- desc.flags |= DWDESC_PIXELFORMAT;
+ desc.flags |= DWDESC_PIXELFORMAT;
}
if (!(window->flags & SDL_WINDOW_BORDERLESS))
- desc.caps |= DWCAPS_NODECORATION;
+ desc.caps |= DWCAPS_NODECORATION;
desc.posx = x;
desc.posy = y;
@@ -116,7 +116,7 @@ DirectFB_CreateWindow(_THIS, SDL_Window * window)
wopts |= DWOP_KEEP_POSITION | DWOP_KEEP_STACKING | DWOP_KEEP_SIZE;
SDL_DFB_CHECK(windata->dfbwin->SetStackingClass(windata->dfbwin, DWSC_UPPER));
}
-
+
if (bshaped) {
wopts |= DWOP_SHAPED | DWOP_ALPHACHANNEL;
wopts &= ~DWOP_OPAQUE_REGION;
@@ -155,7 +155,7 @@ DirectFB_CreateWindow(_THIS, SDL_Window * window)
SDL_DFB_CHECK(windata->dfbwin->RaiseToTop(windata->dfbwin));
/* remember parent */
- //windata->sdlwin = window;
+ /*windata->sdlwin = window; */
/* Add to list ... */
@@ -168,7 +168,7 @@ DirectFB_CreateWindow(_THIS, SDL_Window * window)
return 0;
error:
- SDL_DFB_RELEASE(windata->surface);
+ SDL_DFB_RELEASE(windata->surface);
SDL_DFB_RELEASE(windata->dfbwin);
return -1;
}
@@ -275,7 +275,7 @@ DirectFB_SetWindowSize(_THIS, SDL_Window * window)
if (cw != window->w || ch != window->h) {
- DirectFB_WM_AdjustWindowLayout(window, window->flags, window->w, window->h);
+ DirectFB_WM_AdjustWindowLayout(window, window->flags, window->w, window->h);
SDL_DFB_CHECKERR(windata->dfbwin->Resize(windata->dfbwin,
windata->size.w,
windata->size.h));
@@ -367,7 +367,7 @@ DirectFB_RestoreWindow(_THIS, SDL_Window * window)
/* Window layout */
DirectFB_WM_AdjustWindowLayout(window, window->flags & ~(SDL_WINDOW_MAXIMIZED | SDL_WINDOW_MINIMIZED),
- windata->restore.w, windata->restore.h);
+ windata->restore.w, windata->restore.h);
SDL_DFB_CHECK(windata->dfbwin->Resize(windata->dfbwin, windata->restore.w,
windata->restore.h));
SDL_DFB_CHECK(windata->dfbwin->MoveTo(windata->dfbwin, windata->restore.x,
@@ -393,8 +393,8 @@ DirectFB_SetWindowGrab(_THIS, SDL_Window * window, SDL_bool grabbed)
if ((window->flags & SDL_WINDOW_INPUT_GRABBED)) {
if (gwindata != NULL)
{
- SDL_DFB_CHECK(gwindata->dfbwin->UngrabPointer(gwindata->dfbwin));
- SDL_DFB_CHECK(gwindata->dfbwin->UngrabKeyboard(gwindata->dfbwin));
+ SDL_DFB_CHECK(gwindata->dfbwin->UngrabPointer(gwindata->dfbwin));
+ SDL_DFB_CHECK(gwindata->dfbwin->UngrabKeyboard(gwindata->dfbwin));
}
SDL_DFB_CHECK(windata->dfbwin->GrabPointer(windata->dfbwin));
SDL_DFB_CHECK(windata->dfbwin->GrabKeyboard(windata->dfbwin));
@@ -418,22 +418,22 @@ DirectFB_DestroyWindow(_THIS, SDL_Window * window)
SDL_DFB_CHECK(windata->dfbwin->UngrabKeyboard(windata->dfbwin));
#if SDL_DIRECTFB_OPENGL
- DirectFB_GL_DestroyWindowContexts(_this, window);
+ DirectFB_GL_DestroyWindowContexts(_this, window);
#endif
- if (window->shaper)
- {
- SDL_ShapeData *data = window->shaper->driverdata;
- SDL_DFB_CHECK(data->surface->ReleaseSource(data->surface));
- SDL_DFB_RELEASE(data->surface);
- SDL_DFB_FREE(data);
- SDL_DFB_FREE(window->shaper);
- }
+ if (window->shaper)
+ {
+ SDL_ShapeData *data = window->shaper->driverdata;
+ SDL_DFB_CHECK(data->surface->ReleaseSource(data->surface));
+ SDL_DFB_RELEASE(data->surface);
+ SDL_DFB_FREE(data);
+ SDL_DFB_FREE(window->shaper);
+ }
SDL_DFB_CHECK(windata->window_surface->SetFont(windata->window_surface, NULL));
SDL_DFB_CHECK(windata->surface->ReleaseSource(windata->surface));
SDL_DFB_CHECK(windata->window_surface->ReleaseSource(windata->window_surface));
- SDL_DFB_RELEASE(windata->icon);
+ SDL_DFB_RELEASE(windata->icon);
SDL_DFB_RELEASE(windata->font);
SDL_DFB_RELEASE(windata->eventbuffer);
SDL_DFB_RELEASE(windata->surface);
@@ -494,7 +494,7 @@ DirectFB_AdjustWindowSurface(SDL_Window * window)
if (adjust) {
#if SDL_DIRECTFB_OPENGL
- DirectFB_GL_FreeWindowContexts(SDL_GetVideoDevice(), window);
+ DirectFB_GL_FreeWindowContexts(SDL_GetVideoDevice(), window);
#endif
#if (DFB_VERSION_ATLEAST(1,2,1))
@@ -521,9 +521,9 @@ DirectFB_AdjustWindowSurface(SDL_Window * window)
&windata->client, &windata->surface));
#endif
DirectFB_WM_RedrawLayout(SDL_GetVideoDevice(), window);
-
+
#if SDL_DIRECTFB_OPENGL
- DirectFB_GL_ReAllocWindowContexts(SDL_GetVideoDevice(), window);
+ DirectFB_GL_ReAllocWindowContexts(SDL_GetVideoDevice(), window);
#endif
}
error:
diff --git a/src/video/directfb/SDL_DirectFB_window.h b/src/video/directfb/SDL_DirectFB_window.h
index 43a08d3087..a4a1cc8403 100644
--- a/src/video/directfb/SDL_DirectFB_window.h
+++ b/src/video/directfb/SDL_DirectFB_window.h
@@ -30,28 +30,28 @@
typedef struct _DFB_WindowData DFB_WindowData;
struct _DFB_WindowData
{
- IDirectFBSurface *window_surface; /* window surface */
- IDirectFBSurface *surface; /* client drawing surface */
- IDirectFBWindow *dfbwin;
- IDirectFBEventBuffer *eventbuffer;
- //SDL_Window *sdlwin;
- SDL_Window *next;
- Uint8 opacity;
- DFBRectangle client;
- DFBDimension size;
- DFBRectangle restore;
+ IDirectFBSurface *window_surface; /* window surface */
+ IDirectFBSurface *surface; /* client drawing surface */
+ IDirectFBWindow *dfbwin;
+ IDirectFBEventBuffer *eventbuffer;
+ /*SDL_Window *sdlwin; */
+ SDL_Window *next;
+ Uint8 opacity;
+ DFBRectangle client;
+ DFBDimension size;
+ DFBRectangle restore;
/* WM extras */
- int is_managed;
- int wm_needs_redraw;
- IDirectFBSurface *icon;
- IDirectFBFont *font;
- DFB_Theme theme;
+ int is_managed;
+ int wm_needs_redraw;
+ IDirectFBSurface *icon;
+ IDirectFBFont *font;
+ DFB_Theme theme;
/* WM moving and sizing */
- int wm_grab;
- int wm_lastx;
- int wm_lasty;
+ int wm_grab;
+ int wm_lastx;
+ int wm_lasty;
};
extern int DirectFB_CreateWindow(_THIS, SDL_Window * window);
diff --git a/src/video/pandora/SDL_pandora.c b/src/video/pandora/SDL_pandora.c
index 77d12b79cb..17c761bd69 100644
--- a/src/video/pandora/SDL_pandora.c
+++ b/src/video/pandora/SDL_pandora.c
@@ -38,7 +38,7 @@
/* WIZ declarations */
#include "GLES/gl.h"
#ifdef WIZ_GLES_LITE
-static NativeWindowType hNativeWnd = 0; // A handle to the window we will create.
+static NativeWindowType hNativeWnd = 0; /* A handle to the window we will create. */
#endif
static SDL_bool PND_initialized = SDL_FALSE;
@@ -343,7 +343,7 @@ PND_gl_loadlibrary(_THIS, const char *path)
/* Already linked with GF library which provides egl* subset of */
/* functions, use Common profile of OpenGL ES library by default */
#ifdef WIZ_GLES_LITE
- path = "/lib/libopengles_lite.so";
+ path = "/lib/libopengles_lite.so";
#else
path = "/usr/lib/libGLES_CM.so";
#endif
@@ -628,21 +628,21 @@ PND_gl_createcontext(_THIS, SDL_Window * window)
#ifdef WIZ_GLES_LITE
if( !hNativeWnd ) {
- hNativeWnd = (NativeWindowType)malloc(16*1024);
+ hNativeWnd = (NativeWindowType)malloc(16*1024);
- if(!hNativeWnd)
- printf( "Error : Wiz framebuffer allocatation failed\n" );
- else
- printf( "SDL13: Wiz framebuffer allocated: %X\n", hNativeWnd );
+ if(!hNativeWnd)
+ printf( "Error : Wiz framebuffer allocatation failed\n" );
+ else
+ printf( "SDL13: Wiz framebuffer allocated: %X\n", hNativeWnd );
}
else {
- printf( "SDL13: Wiz framebuffer already allocated: %X\n", hNativeWnd );
+ printf( "SDL13: Wiz framebuffer already allocated: %X\n", hNativeWnd );
}
wdata->gles_surface =
- eglCreateWindowSurface(phdata->egl_display,
- wdata->gles_configs[wdata->gles_config],
- hNativeWnd, NULL );
+ eglCreateWindowSurface(phdata->egl_display,
+ wdata->gles_configs[wdata->gles_config],
+ hNativeWnd, NULL );
#else
wdata->gles_surface =
eglCreateWindowSurface(phdata->egl_display,
@@ -838,9 +838,9 @@ PND_gl_deletecontext(_THIS, SDL_GLContext context)
#ifdef WIZ_GLES_LITE
if( hNativeWnd != 0 )
{
- free(hNativeWnd);
- hNativeWnd = 0;
- printf( "SDL13: Wiz framebuffer released\n" );
+ free(hNativeWnd);
+ hNativeWnd = 0;
+ printf( "SDL13: Wiz framebuffer released\n" );
}
#endif
diff --git a/src/video/psp/SDL_pspevents.c b/src/video/psp/SDL_pspevents.c
index e418daae28..54cd4e7d8a 100644
--- a/src/video/psp/SDL_pspevents.c
+++ b/src/video/psp/SDL_pspevents.c
@@ -47,236 +47,236 @@ static SDL_sem *event_sem = NULL;
static SDL_Thread *thread = NULL;
static int running = 0;
static struct {
- enum PspHprmKeys id;
- SDL_Keycode sym;
+ enum PspHprmKeys id;
+ SDL_Keycode sym;
} keymap_psp[] = {
- { PSP_HPRM_PLAYPAUSE, SDLK_F10 },
- { PSP_HPRM_FORWARD, SDLK_F11 },
- { PSP_HPRM_BACK, SDLK_F12 },
- { PSP_HPRM_VOL_UP, SDLK_F13 },
- { PSP_HPRM_VOL_DOWN, SDLK_F14 },
- { PSP_HPRM_HOLD, SDLK_F15 }
+ { PSP_HPRM_PLAYPAUSE, SDLK_F10 },
+ { PSP_HPRM_FORWARD, SDLK_F11 },
+ { PSP_HPRM_BACK, SDLK_F12 },
+ { PSP_HPRM_VOL_UP, SDLK_F13 },
+ { PSP_HPRM_VOL_DOWN, SDLK_F14 },
+ { PSP_HPRM_HOLD, SDLK_F15 }
};
int EventUpdate(void *data)
{
- while (running) {
+ while (running) {
SDL_SemWait(event_sem);
- sceHprmPeekCurrentKey(&hprm);
+ sceHprmPeekCurrentKey(&hprm);
SDL_SemPost(event_sem);
/* Delay 1/60th of a second */
- sceKernelDelayThread(1000000 / 60);
+ sceKernelDelayThread(1000000 / 60);
}
return 0;
}
void PSP_PumpEvents(_THIS)
{
- int i;
- enum PspHprmKeys keys;
- enum PspHprmKeys changed;
- static enum PspHprmKeys old_keys = 0;
- SDL_Keysym sym;
-
- SDL_SemWait(event_sem);
- keys = hprm;
- SDL_SemPost(event_sem);
-
- /* HPRM Keyboard */
- changed = old_keys ^ keys;
- old_keys = keys;
- if(changed) {
- for(i=0; i<sizeof(keymap_psp)/sizeof(keymap_psp[0]); i++) {
- if(changed & keymap_psp[i].id) {
- sym.scancode = keymap_psp[i].id;
- sym.sym = keymap_psp[i].sym;
-
- /* out of date
- SDL_PrivateKeyboard((keys & keymap_psp[i].id) ?
- SDL_PRESSED : SDL_RELEASED,
- &sym);
+ int i;
+ enum PspHprmKeys keys;
+ enum PspHprmKeys changed;
+ static enum PspHprmKeys old_keys = 0;
+ SDL_Keysym sym;
+
+ SDL_SemWait(event_sem);
+ keys = hprm;
+ SDL_SemPost(event_sem);
+
+ /* HPRM Keyboard */
+ changed = old_keys ^ keys;
+ old_keys = keys;
+ if(changed) {
+ for(i=0; i<sizeof(keymap_psp)/sizeof(keymap_psp[0]); i++) {
+ if(changed & keymap_psp[i].id) {
+ sym.scancode = keymap_psp[i].id;
+ sym.sym = keymap_psp[i].sym;
+
+ /* out of date
+ SDL_PrivateKeyboard((keys & keymap_psp[i].id) ?
+ SDL_PRESSED : SDL_RELEASED,
+ &sym);
*/
- SDL_SendKeyboardKey((keys & keymap_psp[i].id) ?
- SDL_PRESSED : SDL_RELEASED, SDL_GetScancodeFromKey(keymap_psp[i].sym));
- }
- }
- }
+ SDL_SendKeyboardKey((keys & keymap_psp[i].id) ?
+ SDL_PRESSED : SDL_RELEASED, SDL_GetScancodeFromKey(keymap_psp[i].sym));
+ }
+ }
+ }
#ifdef PSPIRKEYB
- if (irkbd_ready) {
- unsigned char buffer[255];
- int i, length, count;
- SIrKeybScanCodeData *scanData;
-
- if(pspIrKeybReadinput(buffer, &length) >= 0) {
- if((length % sizeof(SIrKeybScanCodeData)) == 0){
- count = length / sizeof(SIrKeybScanCodeData);
- for( i=0; i < count; i++ ) {
- unsigned char raw, pressed;
- scanData=(SIrKeybScanCodeData*) buffer+i;
- raw = scanData->raw;
- pressed = scanData->pressed;
- sym.scancode = raw;
- sym.sym = keymap[raw];
- /* 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]);
-
- }
- }
- }
- }
+ if (irkbd_ready) {
+ unsigned char buffer[255];
+ int i, length, count;
+ SIrKeybScanCodeData *scanData;
+
+ if(pspIrKeybReadinput(buffer, &length) >= 0) {
+ if((length % sizeof(SIrKeybScanCodeData)) == 0){
+ count = length / sizeof(SIrKeybScanCodeData);
+ for( i=0; i < count; i++ ) {
+ unsigned char raw, pressed;
+ scanData=(SIrKeybScanCodeData*) buffer+i;
+ raw = scanData->raw;
+ pressed = scanData->pressed;
+ sym.scancode = raw;
+ sym.sym = keymap[raw];
+ /* 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]);
+
+ }
+ }
+ }
+ }
#endif
- sceKernelDelayThread(0);
+ sceKernelDelayThread(0);
- return;
+ return;
}
void PSP_InitOSKeymap(_THIS)
{
#ifdef PSPIRKEYB
- int i;
- for (i=0; i<SDL_TABLESIZE(keymap); ++i)
- keymap[i] = SDLK_UNKNOWN;
-
- keymap[KEY_ESC] = SDLK_ESCAPE;
-
- keymap[KEY_F1] = SDLK_F1;
- keymap[KEY_F2] = SDLK_F2;
- keymap[KEY_F3] = SDLK_F3;
- keymap[KEY_F4] = SDLK_F4;
- keymap[KEY_F5] = SDLK_F5;
- keymap[KEY_F6] = SDLK_F6;
- keymap[KEY_F7] = SDLK_F7;
- keymap[KEY_F8] = SDLK_F8;
- keymap[KEY_F9] = SDLK_F9;
- keymap[KEY_F10] = SDLK_F10;
- keymap[KEY_F11] = SDLK_F11;
- keymap[KEY_F12] = SDLK_F12;
- keymap[KEY_F13] = SDLK_PRINT;
- keymap[KEY_F14] = SDLK_PAUSE;
-
- keymap[KEY_GRAVE] = SDLK_BACKQUOTE;
- keymap[KEY_1] = SDLK_1;
- keymap[KEY_2] = SDLK_2;
- keymap[KEY_3] = SDLK_3;
- keymap[KEY_4] = SDLK_4;
- keymap[KEY_5] = SDLK_5;
- keymap[KEY_6] = SDLK_6;
- keymap[KEY_7] = SDLK_7;
- keymap[KEY_8] = SDLK_8;
- keymap[KEY_9] = SDLK_9;
- keymap[KEY_0] = SDLK_0;
- keymap[KEY_MINUS] = SDLK_MINUS;
- keymap[KEY_EQUAL] = SDLK_EQUALS;
- keymap[KEY_BACKSPACE] = SDLK_BACKSPACE;
-
- keymap[KEY_TAB] = SDLK_TAB;
- keymap[KEY_Q] = SDLK_q;
- keymap[KEY_W] = SDLK_w;
- keymap[KEY_E] = SDLK_e;
- keymap[KEY_R] = SDLK_r;
- keymap[KEY_T] = SDLK_t;
- keymap[KEY_Y] = SDLK_y;
- keymap[KEY_U] = SDLK_u;
- keymap[KEY_I] = SDLK_i;
- keymap[KEY_O] = SDLK_o;
- keymap[KEY_P] = SDLK_p;
- keymap[KEY_LEFTBRACE] = SDLK_LEFTBRACKET;
- keymap[KEY_RIGHTBRACE] = SDLK_RIGHTBRACKET;
- keymap[KEY_ENTER] = SDLK_RETURN;
-
- keymap[KEY_CAPSLOCK] = SDLK_CAPSLOCK;
- keymap[KEY_A] = SDLK_a;
- keymap[KEY_S] = SDLK_s;
- keymap[KEY_D] = SDLK_d;
- keymap[KEY_F] = SDLK_f;
- keymap[KEY_G] = SDLK_g;
- keymap[KEY_H] = SDLK_h;
- keymap[KEY_J] = SDLK_j;
- keymap[KEY_K] = SDLK_k;
- keymap[KEY_L] = SDLK_l;
- keymap[KEY_SEMICOLON] = SDLK_SEMICOLON;
- keymap[KEY_APOSTROPHE] = SDLK_QUOTE;
- keymap[KEY_BACKSLASH] = SDLK_BACKSLASH;
-
- keymap[KEY_Z] = SDLK_z;
- keymap[KEY_X] = SDLK_x;
- keymap[KEY_C] = SDLK_c;
- keymap[KEY_V] = SDLK_v;
- keymap[KEY_B] = SDLK_b;
- keymap[KEY_N] = SDLK_n;
- keymap[KEY_M] = SDLK_m;
- keymap[KEY_COMMA] = SDLK_COMMA;
- keymap[KEY_DOT] = SDLK_PERIOD;
- keymap[KEY_SLASH] = SDLK_SLASH;
-
- keymap[KEY_SPACE] = SDLK_SPACE;
-
- keymap[KEY_UP] = SDLK_UP;
- keymap[KEY_DOWN] = SDLK_DOWN;
- keymap[KEY_LEFT] = SDLK_LEFT;
- keymap[KEY_RIGHT] = SDLK_RIGHT;
-
- keymap[KEY_HOME] = SDLK_HOME;
- keymap[KEY_END] = SDLK_END;
- keymap[KEY_INSERT] = SDLK_INSERT;
- keymap[KEY_DELETE] = SDLK_DELETE;
-
- keymap[KEY_NUMLOCK] = SDLK_NUMLOCK;
- keymap[KEY_LEFTMETA] = SDLK_LSUPER;
-
- keymap[KEY_KPSLASH] = SDLK_KP_DIVIDE;
- keymap[KEY_KPASTERISK] = SDLK_KP_MULTIPLY;
- keymap[KEY_KPMINUS] = SDLK_KP_MINUS;
- keymap[KEY_KPPLUS] = SDLK_KP_PLUS;
- keymap[KEY_KPDOT] = SDLK_KP_PERIOD;
- keymap[KEY_KPEQUAL] = SDLK_KP_EQUALS;
-
- keymap[KEY_LEFTCTRL] = SDLK_LCTRL;
- keymap[KEY_RIGHTCTRL] = SDLK_RCTRL;
- keymap[KEY_LEFTALT] = SDLK_LALT;
- keymap[KEY_RIGHTALT] = SDLK_RALT;
- keymap[KEY_LEFTSHIFT] = SDLK_LSHIFT;
- keymap[KEY_RIGHTSHIFT] = SDLK_RSHIFT;
+ int i;
+ for (i=0; i<SDL_TABLESIZE(keymap); ++i)
+ keymap[i] = SDLK_UNKNOWN;
+
+ keymap[KEY_ESC] = SDLK_ESCAPE;
+
+ keymap[KEY_F1] = SDLK_F1;
+ keymap[KEY_F2] = SDLK_F2;
+ keymap[KEY_F3] = SDLK_F3;
+ keymap[KEY_F4] = SDLK_F4;
+ keymap[KEY_F5] = SDLK_F5;
+ keymap[KEY_F6] = SDLK_F6;
+ keymap[KEY_F7] = SDLK_F7;
+ keymap[KEY_F8] = SDLK_F8;
+ keymap[KEY_F9] = SDLK_F9;
+ keymap[KEY_F10] = SDLK_F10;
+ keymap[KEY_F11] = SDLK_F11;
+ keymap[KEY_F12] = SDLK_F12;
+ keymap[KEY_F13] = SDLK_PRINT;
+ keymap[KEY_F14] = SDLK_PAUSE;
+
+ keymap[KEY_GRAVE] = SDLK_BACKQUOTE;
+ keymap[KEY_1] = SDLK_1;
+ keymap[KEY_2] = SDLK_2;
+ keymap[KEY_3] = SDLK_3;
+ keymap[KEY_4] = SDLK_4;
+ keymap[KEY_5] = SDLK_5;
+ keymap[KEY_6] = SDLK_6;
+ keymap[KEY_7] = SDLK_7;
+ keymap[KEY_8] = SDLK_8;
+ keymap[KEY_9] = SDLK_9;
+ keymap[KEY_0] = SDLK_0;
+ keymap[KEY_MINUS] = SDLK_MINUS;
+ keymap[KEY_EQUAL] = SDLK_EQUALS;
+ keymap[KEY_BACKSPACE] = SDLK_BACKSPACE;
+
+ keymap[KEY_TAB] = SDLK_TAB;
+ keymap[KEY_Q] = SDLK_q;
+ keymap[KEY_W] = SDLK_w;
+ keymap[KEY_E] = SDLK_e;
+ keymap[KEY_R] = SDLK_r;
+ keymap[KEY_T] = SDLK_t;
+ keymap[KEY_Y] = SDLK_y;
+ keymap[KEY_U] = SDLK_u;
+ keymap[KEY_I] = SDLK_i;
+ keymap[KEY_O] = SDLK_o;
+ keymap[KEY_P] = SDLK_p;
+ keymap[KEY_LEFTBRACE] = SDLK_LEFTBRACKET;
+ keymap[KEY_RIGHTBRACE] = SDLK_RIGHTBRACKET;
+ keymap[KEY_ENTER] = SDLK_RETURN;
+
+ keymap[KEY_CAPSLOCK] = SDLK_CAPSLOCK;
+ keymap[KEY_A] = SDLK_a;
+ keymap[KEY_S] = SDLK_s;
+ keymap[KEY_D] = SDLK_d;
+ keymap[KEY_F] = SDLK_f;
+ keymap[KEY_G] = SDLK_g;
+ keymap[KEY_H] = SDLK_h;
+ keymap[KEY_J] = SDLK_j;
+ keymap[KEY_K] = SDLK_k;
+ keymap[KEY_L] = SDLK_l;
+ keymap[KEY_SEMICOLON] = SDLK_SEMICOLON;
+ keymap[KEY_APOSTROPHE] = SDLK_QUOTE;
+ keymap[KEY_BACKSLASH] = SDLK_BACKSLASH;
+
+ keymap[KEY_Z] = SDLK_z;
+ keymap[KEY_X] = SDLK_x;
+ keymap[KEY_C] = SDLK_c;
+ keymap[KEY_V] = SDLK_v;
+ keymap[KEY_B] = SDLK_b;
+ keymap[KEY_N] = SDLK_n;
+ keymap[KEY_M] = SDLK_m;
+ keymap[KEY_COMMA] = SDLK_COMMA;
+ keymap[KEY_DOT] = SDLK_PERIOD;
+ keymap[KEY_SLASH] = SDLK_SLASH;
+
+ keymap[KEY_SPACE] = SDLK_SPACE;
+
+ keymap[KEY_UP] = SDLK_UP;
+ keymap[KEY_DOWN] = SDLK_DOWN;
+ keymap[KEY_LEFT] = SDLK_LEFT;
+ keymap[KEY_RIGHT] = SDLK_RIGHT;
+
+ keymap[KEY_HOME] = SDLK_HOME;
+ keymap[KEY_END] = SDLK_END;
+ keymap[KEY_INSERT] = SDLK_INSERT;
+ keymap[KEY_DELETE] = SDLK_DELETE;
+
+ keymap[KEY_NUMLOCK] = SDLK_NUMLOCK;
+ keymap[KEY_LEFTMETA] = SDLK_LSUPER;
+
+ keymap[KEY_KPSLASH] = SDLK_KP_DIVIDE;
+ keymap[KEY_KPASTERISK] = SDLK_KP_MULTIPLY;
+ keymap[KEY_KPMINUS] = SDLK_KP_MINUS;
+ keymap[KEY_KPPLUS] = SDLK_KP_PLUS;
+ keymap[KEY_KPDOT] = SDLK_KP_PERIOD;
+ keymap[KEY_KPEQUAL] = SDLK_KP_EQUALS;
+
+ keymap[KEY_LEFTCTRL] = SDLK_LCTRL;
+ keymap[KEY_RIGHTCTRL] = SDLK_RCTRL;
+ keymap[KEY_LEFTALT] = SDLK_LALT;
+ keymap[KEY_RIGHTALT] = SDLK_RALT;
+ keymap[KEY_LEFTSHIFT] = SDLK_LSHIFT;
+ keymap[KEY_RIGHTSHIFT] = SDLK_RSHIFT;
#endif
}
void PSP_EventInit(_THIS)
{
#ifdef PSPIRKEYB
- int outputmode = PSP_IRKBD_OUTPUT_MODE_SCANCODE;
- int ret = pspIrKeybInit(IRKBD_CONFIG_FILE, 0);
- if (ret == PSP_IRKBD_RESULT_OK) {
- pspIrKeybOutputMode(outputmode);
- irkbd_ready = 1;
- } else {
- irkbd_ready = 0;
- }
+ int outputmode = PSP_IRKBD_OUTPUT_MODE_SCANCODE;
+ int ret = pspIrKeybInit(IRKBD_CONFIG_FILE, 0);
+ if (ret == PSP_IRKBD_RESULT_OK) {
+ pspIrKeybOutputMode(outputmode);
+ irkbd_ready = 1;
+ } else {
+ irkbd_ready = 0;
+ }
#endif
- /* Start thread to read data */
- if((event_sem = SDL_CreateSemaphore(1)) == NULL) {
- SDL_SetError("Can't create input semaphore\n");
- return;
- }
- running = 1;
- if((thread = SDL_CreateThread(EventUpdate, "PSPInputThread",NULL)) == NULL) {
- SDL_SetError("Can't create input thread\n");
- return;
- }
+ /* Start thread to read data */
+ if((event_sem = SDL_CreateSemaphore(1)) == NULL) {
+ SDL_SetError("Can't create input semaphore\n");
+ return;
+ }
+ running = 1;
+ if((thread = SDL_CreateThread(EventUpdate, "PSPInputThread",NULL)) == NULL) {
+ SDL_SetError("Can't create input thread\n");
+ return;
+ }
}
void PSP_EventQuit(_THIS)
{
- running = 0;
- SDL_WaitThread(thread, NULL);
- SDL_DestroySemaphore(event_sem);
+ running = 0;
+ SDL_WaitThread(thread, NULL);
+ SDL_DestroySemaphore(event_sem);
#ifdef PSPIRKEYB
- if (irkbd_ready) {
- pspIrKeybFinish();
- irkbd_ready = 0;
- }
+ if (irkbd_ready) {
+ pspIrKeybFinish();
+ irkbd_ready = 0;
+ }
#endif
}
diff --git a/src/video/psp/SDL_pspevents_c.h b/src/video/psp/SDL_pspevents_c.h
index c930487112..e02c11db3b 100644
--- a/src/video/psp/SDL_pspevents_c.h
+++ b/src/video/psp/SDL_pspevents_c.h
@@ -21,7 +21,7 @@
#include "SDL_pspvideo.h"
-/* Variables and functions exported by SDL_sysevents.c to other parts
+/* Variables and functions exported by SDL_sysevents.c to other parts
of the native video subsystem (SDL_sysvideo.c)
*/
extern void PSP_InitOSKeymap(_THIS);
diff --git a/src/video/psp/SDL_pspgl.c b/src/video/psp/SDL_pspgl.c
index 247496d969..fbbc20cc4b 100644
--- a/src/video/psp/SDL_pspgl.c
+++ b/src/video/psp/SDL_pspgl.c
@@ -29,44 +29,44 @@
/*****************************************************************************/
/* SDL OpenGL/OpenGL ES functions */
/*****************************************************************************/
-#define EGLCHK(stmt) \
- do { \
- EGLint err; \
- \
- stmt; \
- err = eglGetError(); \
- if (err != EGL_SUCCESS) { \
- SDL_SetError("EGL error %d", err); \
- return 0; \
- } \
- } while (0)
+#define EGLCHK(stmt) \
+ do { \
+ EGLint err; \
+ \
+ stmt; \
+ err = eglGetError(); \
+ if (err != EGL_SUCCESS) { \
+ SDL_SetError("EGL error %d", err); \
+ return 0; \
+ } \
+ } while (0)
int
PSP_GL_LoadLibrary(_THIS, const char *path)
{
if (!_this->gl_config.driver_loaded) {
- _this->gl_config.driver_loaded = 1;
+ _this->gl_config.driver_loaded = 1;
}
return 0;
}
-/* pspgl doesn't provide this call, so stub it out since SDL requires it.
+/* pspgl doesn't provide this call, so stub it out since SDL requires it.
#define GLSTUB(func,params) void func params {}
-
+
GLSTUB(glOrtho,(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top,
- GLdouble zNear, GLdouble zFar))
+ GLdouble zNear, GLdouble zFar))
*/
void *
PSP_GL_GetProcAddress(_THIS, const char *proc)
{
- return eglGetProcAddress(proc);
+ return eglGetProcAddress(proc);
}
void
PSP_GL_UnloadLibrary(_THIS)
{
- eglTerminate(_this->gl_data->display);
+ eglTerminate(_this->gl_data->display);
}
static EGLint width = 480;
@@ -78,64 +78,64 @@ PSP_GL_CreateContext(_THIS, SDL_Window * window)
SDL_WindowData *wdata = (SDL_WindowData *) window->driverdata;
- EGLint attribs[32];
- EGLDisplay display;
- EGLContext context;
- EGLSurface surface;
- EGLConfig config;
- EGLint num_configs;
- int i;
-
-
- /* EGL init taken from glutCreateWindow() in PSPGL's glut.c. */
- EGLCHK(display = eglGetDisplay(0));
- EGLCHK(eglInitialize(display, NULL, NULL));
- wdata->uses_gles = SDL_TRUE;
- window->flags |= SDL_WINDOW_FULLSCREEN;
-
- /* Setup the config based on SDL's current values. */
- i = 0;
- attribs[i++] = EGL_RED_SIZE;
- attribs[i++] = _this->gl_config.red_size;
- attribs[i++] = EGL_GREEN_SIZE;
- attribs[i++] = _this->gl_config.green_size;
- attribs[i++] = EGL_BLUE_SIZE;
- attribs[i++] = _this->gl_config.blue_size;
- attribs[i++] = EGL_DEPTH_SIZE;
- attribs[i++] = _this->gl_config.depth_size;
-
- if (_this->gl_config.alpha_size)
- {
- attribs[i++] = EGL_ALPHA_SIZE;
- attribs[i++] = _this->gl_config.alpha_size;
- }
- if (_this->gl_config.stencil_size)
- {
- attribs[i++] = EGL_STENCIL_SIZE;
- attribs[i++] = _this->gl_config.stencil_size;
- }
-
- attribs[i++] = EGL_NONE;
-
- EGLCHK(eglChooseConfig(display, attribs, &config, 1, &num_configs));
-
- if (num_configs == 0)
- {
- SDL_SetError("No valid EGL configs for requested mode");
- return 0;
- }
-
- EGLCHK(eglGetConfigAttrib(display, config, EGL_WIDTH, &width));
- EGLCHK(eglGetConfigAttrib(display, config, EGL_HEIGHT, &height));
-
- EGLCHK(context = eglCreateContext(display, config, NULL, NULL));
- EGLCHK(surface = eglCreateWindowSurface(display, config, 0, NULL));
- EGLCHK(eglMakeCurrent(display, surface, surface, context));
-
- _this->gl_data->display = display;
- _this->gl_data->context = context;
- _this->gl_data->surface = surface;
-
+ EGLint attribs[32];
+ EGLDisplay display;
+ EGLContext context;
+ EGLSurface surface;
+ EGLConfig config;
+ EGLint num_configs;
+ int i;
+
+
+ /* EGL init taken from glutCreateWindow() in PSPGL's glut.c. */
+ EGLCHK(display = eglGetDisplay(0));
+ EGLCHK(eglInitialize(display, NULL, NULL));
+ wdata->uses_gles = SDL_TRUE;
+ window->flags |= SDL_WINDOW_FULLSCREEN;
+
+ /* Setup the config based on SDL's current values. */
+ i = 0;
+ attribs[i++] = EGL_RED_SIZE;
+ attribs[i++] = _this->gl_config.red_size;
+ attribs[i++] = EGL_GREEN_SIZE;
+ attribs[i++] = _this->gl_config.green_size;
+ attribs[i++] = EGL_BLUE_SIZE;
+ attribs[i++] = _this->gl_config.blue_size;
+ attribs[i++] = EGL_DEPTH_SIZE;
+ attribs[i++] = _this->gl_config.depth_size;
+
+ if (_this->gl_config.alpha_size)
+ {
+ attribs[i++] = EGL_ALPHA_SIZE;
+ attribs[i++] = _this->gl_config.alpha_size;
+ }
+ if (_this->gl_config.stencil_size)
+ {
+ attribs[i++] = EGL_STENCIL_SIZE;
+ attribs[i++] = _this->gl_config.stencil_size;
+ }
+
+ attribs[i++] = EGL_NONE;
+
+ EGLCHK(eglChooseConfig(display, attribs, &config, 1, &num_configs));
+
+ if (num_configs == 0)
+ {
+ SDL_SetError("No valid EGL configs for requested mode");
+ return 0;
+ }
+
+ EGLCHK(eglGetConfigAttrib(display, config, EGL_WIDTH, &width));
+ EGLCHK(eglGetConfigAttrib(display, config, EGL_HEIGHT, &height));
+
+ EGLCHK(context = eglCreateContext(display, config, NULL, NULL));
+ EGLCHK(surface = eglCreateWindowSurface(display, config, 0, NULL));
+ EGLCHK(eglMakeCurrent(display, surface, surface, context));
+
+ _this->gl_data->display = display;
+ _this->gl_data->context = context;
+ _this->gl_data->surface = surface;
+
return context;
}
@@ -143,18 +143,18 @@ PSP_GL_CreateContext(_THIS, SDL_Window * window)
int
PSP_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context)
{
- if (!eglMakeCurrent(_this->gl_data->display, _this->gl_data->surface,
- _this->gl_data->surface, _this->gl_data->context))
- {
- return SDL_SetError("Unable to make EGL context current");
- }
+ if (!eglMakeCurrent(_this->gl_data->display, _this->gl_data->surface,
+ _this->gl_data->surface, _this->gl_data->context))
+ {
+ return SDL_SetError("Unable to make EGL context current");
+ }
return 0;
}
int
PSP_GL_SetSwapInterval(_THIS, int interval)
{
- EGLBoolean status;
+ EGLBoolean status;
status = eglSwapInterval(_this->gl_data->display, interval);
if (status == EGL_TRUE) {
/* Return success to upper level */
diff --git a/src/video/psp/SDL_pspgl_c.h b/src/video/psp/SDL_pspgl_c.h
index 73235ef684..8b20d1544c 100644
--- a/src/video/psp/SDL_pspgl_c.h
+++ b/src/video/psp/SDL_pspgl_c.h
@@ -30,9 +30,9 @@
typedef struct SDL_GLDriverData {
- EGLDisplay display;
- EGLContext context;
- EGLSurface surface;
+ EGLDisplay display;
+ EGLContext context;
+ EGLSurface surface;
uint32_t swapinterval;
}SDL_GLDriverData;
diff --git a/src/video/psp/SDL_pspmouse.c b/src/video/psp/SDL_pspmouse.c
index 8f0ffdc7dc..002a518b4d 100644
--- a/src/video/psp/SDL_pspmouse.c
+++ b/src/video/psp/SDL_pspmouse.c
@@ -31,5 +31,5 @@
/* The implementation dependent data for the window manager cursor */
struct WMcursor {
- int unused;
+ int unused;
};
diff --git a/src/video/psp/SDL_pspvideo.c b/src/video/psp/SDL_pspvideo.c
index d84e69b92d..ed5ab1c96c 100644
--- a/src/video/psp/SDL_pspvideo.c
+++ b/src/video/psp/SDL_pspvideo.c
@@ -51,7 +51,7 @@ PSP_Available(void)
static void
PSP_Destroy(SDL_VideoDevice * device)
{
-// SDL_VideoData *phdata = (SDL_VideoData *) device->driverdata;
+/* SDL_VideoData *phdata = (SDL_VideoData *) device->driverdata; */
if (device->driverdata != NULL) {
device->driverdata = NULL;
@@ -87,15 +87,15 @@ PSP_Create()
SDL_free(device);
return NULL;
}
-
- gldata = (SDL_GLDriverData *) SDL_calloc(1, sizeof(SDL_GLDriverData));
+
+ gldata = (SDL_GLDriverData *) SDL_calloc(1, sizeof(SDL_GLDriverData));
if (gldata == NULL) {
SDL_OutOfMemory();
SDL_free(device);
return NULL;
- }
+ }
device->gl_data = gldata;
-
+
device->driverdata = phdata;
phdata->egl_initialized = SDL_TRUE;
@@ -136,11 +136,11 @@ PSP_Create()
device->GL_GetSwapInterval = PSP_GL_GetSwapInterval;
device->GL_SwapWindow = PSP_GL_SwapWindow;
device->GL_DeleteContext = PSP_GL_DeleteContext;
- device->HasScreenKeyboardSupport = PSP_HasScreenKeyboardSupport;
- device->ShowScreenKeyboard = PSP_ShowScreenKeyboard;
- device->HideScreenKeyboard = PSP_HideScreenKeyboard;
- device->IsScreenKeyboardShown = PSP_IsScreenKeyboardShown;
-
+ device->HasScreenKeyboardSupport = PSP_HasScreenKeyboardSupport;
+ device->ShowScreenKeyboard = PSP_ShowScreenKeyboard;
+ device->HideScreenKeyboard = PSP_HideScreenKeyboard;
+ device->IsScreenKeyboardShown = PSP_IsScreenKeyboardShown;
+
device->PumpEvents = PSP_PumpEvents;
return device;
@@ -163,15 +163,14 @@ PSP_VideoInit(_THIS)
SDL_DisplayMode current_mode;
SDL_zero(current_mode);
-
+
current_mode.w = 480;
current_mode.h = 272;
-
+
current_mode.refresh_rate = 60;
- // 32 bpp for default
- // current_mode.format = SDL_PIXELFORMAT_RGBA8888;
+ /* 32 bpp for default */
current_mode.format = SDL_PIXELFORMAT_ABGR8888;
-
+
current_mode.driverdata = NULL;
SDL_zero(display);
@@ -201,23 +200,21 @@ PSP_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode)
{
return 0;
}
-#define EGLCHK(stmt) \
- do { \
- EGLint err; \
- \
- stmt; \
- err = eglGetError(); \
- if (err != EGL_SUCCESS) { \
- SDL_SetError("EGL error %d", err); \
- return 0; \
- } \
- } while (0)
-
+#define EGLCHK(stmt) \
+ do { \
+ EGLint err; \
+ \
+ stmt; \
+ err = eglGetError(); \
+ if (err != EGL_SUCCESS) { \
+ SDL_SetError("EGL error %d", err); \
+ return 0; \
+ } \
+ } while (0)
+
int
PSP_CreateWindow(_THIS, SDL_Window * window)
{
-// SDL_VideoData *phdata = (SDL_VideoData *) _this->driverdata;
-
SDL_WindowData *wdata;
/* Allocate window internal data */
@@ -288,8 +285,6 @@ PSP_SetWindowGrab(_THIS, SDL_Window * window, SDL_bool grabbed)
void
PSP_DestroyWindow(_THIS, SDL_Window * window)
{
-
-// eglTerminate(_this->gl_data->display);
}
/*****************************************************************************/
@@ -324,7 +319,7 @@ void PSP_HideScreenKeyboard(_THIS, SDL_Window *window)
}
SDL_bool PSP_IsScreenKeyboardShown(_THIS, SDL_Window *window)
{
- return SDL_FALSE;
+ return SDL_FALSE;
}
diff --git a/src/video/psp/SDL_pspvideo.h b/src/video/psp/SDL_pspvideo.h
index 4c8a8cda44..d4ab32bfe6 100644
--- a/src/video/psp/SDL_pspvideo.h
+++ b/src/video/psp/SDL_pspvideo.h
@@ -31,7 +31,7 @@ typedef struct SDL_VideoData
{
SDL_bool egl_initialized; /* OpenGL ES device initialization status */
uint32_t egl_refcount; /* OpenGL ES reference count */
-
+
} SDL_VideoData;
@@ -46,7 +46,7 @@ typedef struct SDL_DisplayData
typedef struct SDL_WindowData
{
SDL_bool uses_gles; /* if true window must support OpenGL ES */
-
+
} SDL_WindowData;
@@ -96,7 +96,7 @@ SDL_bool PSP_HasScreenKeyboardSupport(_THIS);
void PSP_ShowScreenKeyboard(_THIS, SDL_Window *window);
void PSP_HideScreenKeyboard(_THIS, SDL_Window *window);
SDL_bool PSP_IsScreenKeyboardShown(_THIS, SDL_Window *window);
-
+
#endif /* __SDL_PANDORA_H__ */
/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/video/uikit/SDL_uikitappdelegate.m b/src/video/uikit/SDL_uikitappdelegate.m
index 11e74025ed..d13c2bbce1 100644
--- a/src/video/uikit/SDL_uikitappdelegate.m
+++ b/src/video/uikit/SDL_uikitappdelegate.m
@@ -117,7 +117,7 @@ static void SDL_IdleTimerDisabledChanged(const char *name, const char *oldValue,
if (self->splashLandscape) {
[self->splashLandscape retain];
}
-
+
[self updateSplashImage:[[UIApplication sharedApplication] statusBarOrientation]];
return self;
@@ -126,8 +126,8 @@ static void SDL_IdleTimerDisabledChanged(const char *name, const char *oldValue,
- (NSUInteger)supportedInterfaceOrientations
{
NSUInteger orientationMask = UIInterfaceOrientationMaskAll;
-
- // Don't allow upside-down orientation on the phone, so answering calls is in the natural orientation
+
+ /* Don't allow upside-down orientation on the phone, so answering calls is in the natural orientation */
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
orientationMask &= ~UIInterfaceOrientationMaskPortraitUpsideDown;
}
@@ -148,7 +148,7 @@ static void SDL_IdleTimerDisabledChanged(const char *name, const char *oldValue,
- (void)updateSplashImage:(UIInterfaceOrientation)interfaceOrientation
{
UIImage *image;
-
+
if (UIInterfaceOrientationIsLandscape(interfaceOrientation)) {
image = self->splashLandscape;
} else {
@@ -199,9 +199,10 @@ static void SDL_IdleTimerDisabledChanged(const char *name, const char *oldValue,
}
/* exit, passing the return status from the user's application */
- // We don't actually exit to support applications that do setup in
- // their main function and then allow the Cocoa event loop to run.
- // exit(exit_status);
+ /* We don't actually exit to support applications that do setup in
+ * their main function and then allow the Cocoa event loop to run.
+ */
+ /* exit(exit_status); */
}
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
diff --git a/src/video/uikit/SDL_uikitmessagebox.m b/src/video/uikit/SDL_uikitmessagebox.m
index 26c218b015..5ec7e8b470 100644
--- a/src/video/uikit/SDL_uikitmessagebox.m
+++ b/src/video/uikit/SDL_uikitmessagebox.m
@@ -49,7 +49,7 @@ static SDL_bool s_showingMessageBox = SDL_FALSE;
return nil;
}
self->clickedButtonIndex = buttonIndex;
-
+
return self;
}
@@ -58,7 +58,7 @@ static SDL_bool s_showingMessageBox = SDL_FALSE;
*clickedButtonIndex = buttonIndex;
}
-@end // UIKit_UIAlertViewDelegate
+@end /* UIKit_UIAlertViewDelegate */
SDL_bool
@@ -71,7 +71,7 @@ int
UIKit_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
{
int clicked;
-
+
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
UIAlertView* alert = [[UIAlertView alloc] init];
@@ -86,13 +86,13 @@ UIKit_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
[alert addButtonWithTitle:[[NSString alloc] initWithUTF8String:buttons[i].text]];
}
- // Set up for showing the alert
+ /* Set up for showing the alert */
clicked = messageboxdata->numbuttons;
[alert show];
-
- // Run the main event loop until the alert has finished
- // Note that this needs to be done on the main thread
+
+ /* Run the main event loop until the alert has finished */
+ /* Note that this needs to be done on the main thread */
s_showingMessageBox = SDL_TRUE;
while (clicked == messageboxdata->numbuttons) {
[[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate distantFuture]];
@@ -100,7 +100,7 @@ UIKit_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
s_showingMessageBox = SDL_FALSE;
*buttonid = messageboxdata->buttons[clicked].buttonid;
-
+
[alert.delegate release];
[alert release];
diff --git a/src/video/uikit/SDL_uikitmodes.m b/src/video/uikit/SDL_uikitmodes.m
index 87c3cc1e5b..f093a81c6c 100644
--- a/src/video/uikit/SDL_uikitmodes.m
+++ b/src/video/uikit/SDL_uikitmodes.m
@@ -34,22 +34,22 @@ UIKit_AllocateDisplayModeData(SDL_DisplayMode * mode,
UIScreenMode * uiscreenmode, CGFloat scale)
{
SDL_DisplayModeData *data = NULL;
-
+
if (uiscreenmode != nil) {
/* Allocate the display mode data */
data = (SDL_DisplayModeData *) SDL_malloc(sizeof(*data));
if (!data) {
return SDL_OutOfMemory();
}
-
+
data->uiscreenmode = uiscreenmode;
[data->uiscreenmode retain];
-
+
data->scale = scale;
}
-
+
mode->driverdata = data;
-
+
return 0;
}
@@ -57,7 +57,7 @@ static void
UIKit_FreeDisplayModeData(SDL_DisplayMode * mode)
{
if (!SDL_UIKit_supports_multiple_displays) {
- // Not on at least iPhoneOS 3.2 (versions prior to iPad).
+ /* Not on at least iPhoneOS 3.2 (versions prior to iPad). */
SDL_assert(mode->driverdata == NULL);
} else if (mode->driverdata != NULL) {
SDL_DisplayModeData *data = (SDL_DisplayModeData *)mode->driverdata;
@@ -73,13 +73,13 @@ UIKit_AddSingleDisplayMode(SDL_VideoDisplay * display, int w, int h,
{
SDL_DisplayMode mode;
SDL_zero(mode);
-
+
mode.format = SDL_PIXELFORMAT_ABGR8888;
mode.refresh_rate = 0;
if (UIKit_AllocateDisplayModeData(&mode, uiscreenmode, scale) < 0) {
return -1;
}
-
+
mode.w = w;
mode.h = h;
if (SDL_AddDisplayMode(display, &mode)) {
@@ -97,14 +97,14 @@ UIKit_AddDisplayMode(SDL_VideoDisplay * display, int w, int h, CGFloat scale,
if (UIKit_AddSingleDisplayMode(display, w, h, uiscreenmode, scale) < 0) {
return -1;
}
-
+
if (addRotation) {
- // Add the rotated version
+ /* Add the rotated version */
if (UIKit_AddSingleDisplayMode(display, h, w, uiscreenmode, scale) < 0) {
return -1;
}
}
-
+
return 0;
}
@@ -113,25 +113,26 @@ UIKit_AddDisplay(UIScreen *uiscreen)
{
CGSize size = [uiscreen bounds].size;
- // Make sure the width/height are oriented correctly
+ /* Make sure the width/height are oriented correctly */
if (UIKit_IsDisplayLandscape(uiscreen) != (size.width > size.height)) {
CGFloat height = size.width;
size.width = size.height;
size.height = height;
}
- // When dealing with UIKit all coordinates are specified in terms of
- // what Apple refers to as points. On earlier devices without the
- // so called "Retina" display, there is a one to one mapping between
- // points and pixels. In other cases [UIScreen scale] indicates the
- // relationship between points and pixels. Since SDL has no notion
- // of points, we must compensate in all cases where dealing with such
- // units.
+ /* When dealing with UIKit all coordinates are specified in terms of
+ * what Apple refers to as points. On earlier devices without the
+ * so called "Retina" display, there is a one to one mapping between
+ * points and pixels. In other cases [UIScreen scale] indicates the
+ * relationship between points and pixels. Since SDL has no notion
+ * of points, we must compensate in all cases where dealing with such
+ * units.
+ */
CGFloat scale;
if ([UIScreen instancesRespondToSelector:@selector(scale)]) {
- scale = [uiscreen scale]; // iOS >= 4.0
+ scale = [uiscreen scale]; /* iOS >= 4.0 */
} else {
- scale = 1.0f; // iOS < 4.0
+ scale = 1.0f; /* iOS < 4.0 */
}
SDL_VideoDisplay display;
@@ -140,14 +141,15 @@ UIKit_AddDisplay(UIScreen *uiscreen)
mode.format = SDL_PIXELFORMAT_ABGR8888;
mode.w = (int)(size.width * scale);
mode.h = (int)(size.height * scale);
-
+
UIScreenMode * uiscreenmode = nil;
- // UIScreenMode showed up in 3.2 (the iPad and later). We're
- // misusing this supports_multiple_displays flag here for that.
+ /* UIScreenMode showed up in 3.2 (the iPad and later). We're
+ * misusing this supports_multiple_displays flag here for that.
+ */
if (SDL_UIKit_supports_multiple_displays) {
uiscreenmode = [uiscreen currentMode];
}
-
+
if (UIKit_AllocateDisplayModeData(&mode, uiscreenmode, scale) < 0) {
return -1;
}
@@ -162,14 +164,14 @@ UIKit_AddDisplay(UIScreen *uiscreen)
UIKit_FreeDisplayModeData(&display.desktop_mode);
return SDL_OutOfMemory();
}
-
+
[uiscreen retain];
data->uiscreen = uiscreen;
data->scale = scale;
-
+
display.driverdata = data;
SDL_AddVideoDisplay(&display);
-
+
return 0;
}
@@ -187,20 +189,21 @@ UIKit_IsDisplayLandscape(UIScreen *uiscreen)
int
UIKit_InitModes(_THIS)
{
- // this tells us whether we are running on ios >= 3.2
+ /* this tells us whether we are running on ios >= 3.2 */
SDL_UIKit_supports_multiple_displays = [UIScreen instancesRespondToSelector:@selector(currentMode)];
- // Add the main screen.
+ /* Add the main screen. */
if (UIKit_AddDisplay([UIScreen mainScreen]) < 0) {
return -1;
}
- // If this is iPhoneOS < 3.2, all devices are one screen, 320x480 pixels.
- // The iPad added both a larger main screen and the ability to use
- // external displays. So, add the other displays (screens in UI speak).
+ /* If this is iPhoneOS < 3.2, all devices are one screen, 320x480 pixels. */
+ /* The iPad added both a larger main screen and the ability to use
+ * external displays. So, add the other displays (screens in UI speak).
+ */
if (SDL_UIKit_supports_multiple_displays) {
for (UIScreen *uiscreen in [UIScreen screens]) {
- // Only add the other screens
+ /* Only add the other screens */
if (uiscreen != [UIScreen mainScreen]) {
if (UIKit_AddDisplay(uiscreen) < 0) {
return -1;
@@ -222,27 +225,28 @@ UIKit_GetDisplayModes(_THIS, SDL_VideoDisplay * display)
SDL_bool addRotation = (data->uiscreen == [UIScreen mainScreen]);
if (SDL_UIKit_supports_multiple_displays) {
- // availableModes showed up in 3.2 (the iPad and later). We should only
- // land here for at least that version of the OS.
+ /* availableModes showed up in 3.2 (the iPad and later). We should only
+ * land here for at least that version of the OS.
+ */
for (UIScreenMode *uimode in [data->uiscreen availableModes]) {
CGSize size = [uimode size];
int w = (int)size.width;
int h = (int)size.height;
-
- // Make sure the width/height are oriented correctly
+
+ /* Make sure the width/height are oriented correctly */
if (isLandscape != (w > h)) {
int tmp = w;
w = h;
h = tmp;
}
- // Add the native screen resolution.
+ /* Add the native screen resolution. */
UIKit_AddDisplayMode(display, w, h, data->scale, uimode, addRotation);
if (data->scale != 1.0f) {
- // Add the native screen resolution divided by its scale.
- // This is so devices capable of e.g. 640x960 also advertise
- // 320x480.
+ /* Add the native screen resolution divided by its scale.
+ * This is so devices capable of e.g. 640x960 also advertise 320x480.
+ */
UIKit_AddDisplayMode(display,
(int)(size.width / data->scale),
(int)(size.height / data->scale),
@@ -254,7 +258,7 @@ UIKit_GetDisplayModes(_THIS, SDL_VideoDisplay * display)
int w = (int)size.width;
int h = (int)size.height;
- // Make sure the width/height are oriented correctly
+ /* Make sure the width/height are oriented correctly */
if (isLandscape != (w > h)) {
int tmp = w;
w = h;
@@ -262,7 +266,7 @@ UIKit_GetDisplayModes(_THIS, SDL_VideoDisplay * display)
}
UIKit_AddDisplayMode(display, w, h, 1.0f, nil, addRotation);
- }
+ }
}
int
@@ -271,7 +275,7 @@ UIKit_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode)
SDL_DisplayData *data = (SDL_DisplayData *) display->driverdata;
if (!SDL_UIKit_supports_multiple_displays) {
- // Not on at least iPhoneOS 3.2 (versions prior to iPad).
+ /* Not on at least iPhoneOS 3.2 (versions prior to iPad). */
SDL_assert(mode->driverdata == NULL);
} else {
SDL_DisplayModeData *modedata = (SDL_DisplayModeData *)mode->driverdata;
@@ -295,7 +299,7 @@ UIKit_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode)
void
UIKit_QuitModes(_THIS)
{
- // Release Objective-C objects, so higher level doesn't free() them.
+ /* Release Objective-C objects, so higher level doesn't free() them. */
int i, j;
for (i = 0; i < _this->num_displays; i++) {
SDL_VideoDisplay *display = &_this->displays[i];
diff --git a/src/video/uikit/SDL_uikitopengles.m b/src/video/uikit/SDL_uikitopengles.m
index 4fc1a2773c..a7d370f2b6 100644
--- a/src/video/uikit/SDL_uikitopengles.m
+++ b/src/video/uikit/SDL_uikitopengles.m
@@ -80,7 +80,7 @@ UIKit_GL_LoadLibrary(_THIS, const char *path)
void UIKit_GL_SwapWindow(_THIS, SDL_Window * window)
{
#if SDL_POWER_UIKIT
- // Check once a frame to see if we should turn off the battery monitor.
+ /* Check once a frame to see if we should turn off the battery monitor. */
SDL_UIKit_UpdateBatteryMonitoring();
#endif
@@ -134,8 +134,8 @@ SDL_GLContext UIKit_GL_CreateContext(_THIS, SDL_Window * window)
[view->viewcontroller retain];
}
[uiwindow addSubview: view];
-
- // The view controller needs to be the root in order to control rotation on iOS 6.0
+
+ /* The view controller needs to be the root in order to control rotation on iOS 6.0 */
if (uiwindow.rootViewController == nil) {
uiwindow.rootViewController = view->viewcontroller;
}
diff --git a/src/video/uikit/SDL_uikitopenglview.m b/src/video/uikit/SDL_uikitopenglview.m
index 16ac872d97..6ca5162d98 100644
--- a/src/video/uikit/SDL_uikitopenglview.m
+++ b/src/video/uikit/SDL_uikitopenglview.m
@@ -165,9 +165,10 @@
- (void)startAnimation
{
- // CADisplayLink is API new to iPhone SDK 3.1. Compiling against earlier versions will result in a warning, but can be dismissed
- // if the system version runtime check for CADisplayLink exists in -initWithCoder:.
-
+ /* CADisplayLink is API new to iPhone SDK 3.1.
+ * Compiling against earlier versions will result in a warning, but can be dismissed
+ * if the system version runtime check for CADisplayLink exists in -initWithCoder:.
+ */
displayLink = [NSClassFromString(@"CADisplayLink") displayLinkWithTarget:self selector:@selector(doLoop:)];
[displayLink setFrameInterval:animationInterval];
[displayLink addToRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
@@ -181,7 +182,7 @@
- (void)doLoop:(id)sender
{
- // Don't run the game loop while a messagebox is up
+ /* Don't run the game loop while a messagebox is up */
if (!UIKit_ShowingMessageBox()) {
animationCallback(animationCallbackParam);
}
diff --git a/src/video/uikit/SDL_uikitvideo.h b/src/video/uikit/SDL_uikitvideo.h
index c8418faa47..8969e91e96 100644
--- a/src/video/uikit/SDL_uikitvideo.h
+++ b/src/video/uikit/SDL_uikitvideo.h
@@ -26,7 +26,7 @@
#include "../SDL_sysvideo.h"
#ifndef __IPHONE_6_0
-// This enum isn't available in older SDKs, but we use it for our own purposes on iOS 5.1 and for the system on iOS 6.0
+/* This enum isn't available in older SDKs, but we use it for our own purposes on iOS 5.1 and for the system on iOS 6.0 */
enum UIInterfaceOrientationMask
{
UIInterfaceOrientationMaskPortrait = (1 << UIInterfaceOrientationPortrait),
@@ -37,7 +37,7 @@ enum UIInterfaceOrientationMask
UIInterfaceOrientationMaskAll = (UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskLandscapeLeft | UIInterfaceOrientationMaskLandscapeRight | UIInterfaceOrientationMaskPortraitUpsideDown),
UIInterfaceOrientationMaskAllButUpsideDown = (UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskLandscapeLeft | UIInterfaceOrientationMaskLandscapeRight),
};
-#endif // !__IPHONE_6_0
+#endif /* !__IPHONE_6_0 */
#endif /* _SDL_uikitvideo_h */
diff --git a/src/video/uikit/SDL_uikitview.m b/src/video/uikit/SDL_uikitview.m
index ec37f1880f..e808962ef2 100644
--- a/src/video/uikit/SDL_uikitview.m
+++ b/src/video/uikit/SDL_uikitview.m
@@ -63,11 +63,11 @@
{
CGPoint point = [touch locationInView: self];
- // Get the display scale and apply that to the input coordinates
+ /* Get the display scale and apply that to the input coordinates */
SDL_Window *window = self->viewcontroller.window;
SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window);
SDL_DisplayModeData *displaymodedata = (SDL_DisplayModeData *) display->current_mode.driverdata;
-
+
if (normalize) {
CGRect bounds = [self bounds];
point.x /= bounds.size.width;
@@ -99,9 +99,10 @@
CGPoint locationInView = [self touchLocation:touch shouldNormalize:YES];
#ifdef IPHONE_TOUCH_EFFICIENT_DANGEROUS
- // FIXME: TODO: Using touch as the fingerId is potentially dangerous
- // It is also much more efficient than storing the UITouch pointer
- // and comparing it to the incoming event.
+ /* FIXME: TODO: Using touch as the fingerId is potentially dangerous
+ * It is also much more efficient than storing the UITouch pointer
+ * and comparing it to the incoming event.
+ */
SDL_SendTouch(touchId, (SDL_FingerID)((size_t)touch),
SDL_TRUE, locationInView.x, locationInView.y, 1.0f);
#else
diff --git a/src/video/uikit/SDL_uikitviewcontroller.m b/src/video/uikit/SDL_uikitviewcontroller.m
index 896a76f0e5..157b70aa00 100644
--- a/src/video/uikit/SDL_uikitviewcontroller.m
+++ b/src/video/uikit/SDL_uikitviewcontroller.m
@@ -51,7 +51,7 @@
- (void)loadView
{
- // do nothing.
+ /* do nothing. */
}
- (void)viewDidLayoutSubviews
@@ -62,10 +62,10 @@
SDL_DisplayModeData *displaymodedata = (SDL_DisplayModeData *) display->current_mode.driverdata;
const CGSize size = data->view.bounds.size;
int w, h;
-
+
w = (int)(size.width * displaymodedata->scale);
h = (int)(size.height * displaymodedata->scale);
-
+
SDL_SendWindowEvent(self->window, SDL_WINDOWEVENT_RESIZED, w, h);
}
}
@@ -73,7 +73,7 @@
- (NSUInteger)supportedInterfaceOrientations
{
NSUInteger orientationMask = 0;
-
+
const char *orientationsCString;
if ((orientationsCString = SDL_GetHint(SDL_HINT_ORIENTATIONS)) != NULL) {
BOOL rotate = NO;
@@ -81,7 +81,7 @@
encoding:NSUTF8StringEncoding];
NSArray *orientations = [orientationsNSString componentsSeparatedByCharactersInSet:
[NSCharacterSet characterSetWithCharactersInString:@" "]];
-
+
if ([orientations containsObject:@"LandscapeLeft"]) {
orientationMask |= UIInterfaceOrientationMaskLandscapeLeft;
}
@@ -94,9 +94,9 @@
if ([orientations containsObject:@"PortraitUpsideDown"]) {
orientationMask |= UIInterfaceOrientationMaskPortraitUpsideDown;
}
-
+
} else if (self->window->flags & SDL_WINDOW_RESIZABLE) {
- orientationMask = UIInterfaceOrientationMaskAll; // any orientation is okay.
+ orientationMask = UIInterfaceOrientationMaskAll; /* any orientation is okay. */
} else {
if (self->window->w >= self->window->h) {
orientationMask |= UIInterfaceOrientationMaskLandscape;
@@ -105,8 +105,8 @@
orientationMask |= (UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskPortraitUpsideDown);
}
}
-
- // Don't allow upside-down orientation on the phone, so answering calls is in the natural orientation
+
+ /* Don't allow upside-down orientation on the phone, so answering calls is in the natural orientation */
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
orientationMask &= ~UIInterfaceOrientationMaskPortraitUpsideDown;
}
diff --git a/src/video/uikit/SDL_uikitwindow.m b/src/video/uikit/SDL_uikitwindow.m
index a009f59762..6be691518d 100644
--- a/src/video/uikit/SDL_uikitwindow.m
+++ b/src/video/uikit/SDL_uikitwindow.m
@@ -76,7 +76,7 @@ static int SetupWindowData(_THIS, SDL_Window *window, UIWindow *uiwindow, SDL_bo
int width = (int)(bounds.size.width * displaymodedata->scale);
int height = (int)(bounds.size.height * displaymodedata->scale);
- // Make sure the width/height are oriented correctly
+ /* Make sure the width/height are oriented correctly */
if (UIKit_IsDisplayLandscape(displaydata->uiscreen) != (width > height)) {
int temp = width;
width = height;
@@ -93,30 +93,32 @@ static int SetupWindowData(_THIS, SDL_Window *window, UIWindow *uiwindow, SDL_bo
window->flags &= ~SDL_WINDOW_HIDDEN;
window->flags |= SDL_WINDOW_SHOWN;
- // SDL_WINDOW_BORDERLESS controls whether status bar is hidden.
- // This is only set if the window is on the main screen. Other screens
- // just force the window to have the borderless flag.
+ /* SDL_WINDOW_BORDERLESS controls whether status bar is hidden.
+ * This is only set if the window is on the main screen. Other screens
+ * just force the window to have the borderless flag.
+ */
if (displaydata->uiscreen == [UIScreen mainScreen]) {
- window->flags |= SDL_WINDOW_INPUT_FOCUS; // always has input focus
-
+ window->flags |= SDL_WINDOW_INPUT_FOCUS; /* always has input focus */
+
if ([UIApplication sharedApplication].statusBarHidden) {
window->flags |= SDL_WINDOW_BORDERLESS;
} else {
window->flags &= ~SDL_WINDOW_BORDERLESS;
}
} else {
- window->flags &= ~SDL_WINDOW_RESIZABLE; // window is NEVER resizeable
- window->flags &= ~SDL_WINDOW_INPUT_FOCUS; // never has input focus
- window->flags |= SDL_WINDOW_BORDERLESS; // never has a status bar.
+ window->flags &= ~SDL_WINDOW_RESIZABLE; /* window is NEVER resizeable */
+ window->flags &= ~SDL_WINDOW_INPUT_FOCUS; /* never has input focus */
+ window->flags |= SDL_WINDOW_BORDERLESS; /* never has a status bar. */
}
- // The View Controller will handle rotating the view when the
- // device orientation changes. This will trigger resize events, if
- // appropriate.
+ /* The View Controller will handle rotating the view when the
+ * device orientation changes. This will trigger resize events, if
+ * appropriate.
+ */
SDL_uikitviewcontroller *controller;
controller = [SDL_uikitviewcontroller alloc];
data->viewcontroller = [controller initWithSDLWindow:window];
- [data->viewcontroller setTitle:@"SDL App"]; // !!! FIXME: hook up SDL_SetWindowTitle()
+ [data->viewcontroller setTitle:@"SDL App"]; /* !!! FIXME: hook up SDL_SetWindowTitle() */
return 0;
}
@@ -128,7 +130,7 @@ UIKit_CreateWindow(_THIS, SDL_Window *window)
SDL_DisplayData *data = (SDL_DisplayData *) display->driverdata;
const BOOL external = ([UIScreen mainScreen] != data->uiscreen);
- // SDL currently puts this window at the start of display's linked list. We rely on this.
+ /* SDL currently puts this window at the start of display's linked list. We rely on this. */
SDL_assert(_this->windows == window);
/* We currently only handle a single window per display on iOS */
@@ -136,9 +138,10 @@ UIKit_CreateWindow(_THIS, SDL_Window *window)
return SDL_SetError("Only one window allowed per display.");
}
- // If monitor has a resolution of 0x0 (hasn't been explicitly set by the
- // user, so it's in standby), try to force the display to a resolution
- // that most closely matches the desired window size.
+ /* If monitor has a resolution of 0x0 (hasn't been explicitly set by the
+ * user, so it's in standby), try to force the display to a resolution
+ * that most closely matches the desired window size.
+ */
if (SDL_UIKit_supports_multiple_displays) {
const CGSize origsize = [[data->uiscreen currentMode] size];
if ((origsize.width == 0.0f) && (origsize.height == 0.0f)) {
@@ -158,14 +161,15 @@ UIKit_CreateWindow(_THIS, SDL_Window *window)
SDL_DisplayModeData *modedata = (SDL_DisplayModeData *)bestmode->driverdata;
[data->uiscreen setCurrentMode:modedata->uiscreenmode];
- // desktop_mode doesn't change here (the higher level will
- // use it to set all the screens back to their defaults
- // upon window destruction, SDL_Quit(), etc.
+ /* desktop_mode doesn't change here (the higher level will
+ * use it to set all the screens back to their defaults
+ * upon window destruction, SDL_Quit(), etc.
+ */
display->current_mode = *bestmode;
}
}
}
-
+
if (data->uiscreen == [UIScreen mainScreen]) {
if (window->flags & (SDL_WINDOW_FULLSCREEN|SDL_WINDOW_BORDERLESS)) {
[UIApplication sharedApplication].statusBarHidden = YES;
@@ -173,7 +177,7 @@ UIKit_CreateWindow(_THIS, SDL_Window *window)
[UIApplication sharedApplication].statusBarHidden = NO;
}
}
-
+
if (!(window->flags & SDL_WINDOW_RESIZABLE)) {
if (window->w > window->h) {
if (!UIKit_IsDisplayLandscape(data->uiscreen)) {
@@ -187,14 +191,15 @@ UIKit_CreateWindow(_THIS, SDL_Window *window)
}
/* ignore the size user requested, and make a fullscreen window */
- // !!! FIXME: can we have a smaller view?
+ /* !!! FIXME: can we have a smaller view? */
UIWindow *uiwindow = [UIWindow alloc];
uiwindow = [uiwindow initWithFrame:[data->uiscreen bounds]];
- // put the window on an external display if appropriate. This implicitly
- // does [uiwindow setframe:[uiscreen bounds]], so don't do it on the
- // main display, where we land by default, as that would eat the
- // status bar real estate.
+ /* put the window on an external display if appropriate. This implicitly
+ * does [uiwindow setframe:[uiscreen bounds]], so don't do it on the
+ * main display, where we land by default, as that would eat the
+ * status bar real estate.
+ */
if (external) {
[uiwindow setScreen:data->uiscreen];
}
@@ -227,10 +232,11 @@ UIKit_HideWindow(_THIS, SDL_Window * window)
void
UIKit_RaiseWindow(_THIS, SDL_Window * window)
{
- // We don't currently offer a concept of "raising" the SDL window, since
- // we only allow one per display, in the iOS fashion.
- // However, we use this entry point to rebind the context to the view
- // during OnWindowRestored processing.
+ /* We don't currently offer a concept of "raising" the SDL window, since
+ * we only allow one per display, in the iOS fashion.
+ * However, we use this entry point to rebind the context to the view
+ * during OnWindowRestored processing.
+ */
_this->GL_MakeCurrent(_this, _this->current_glwin, _this->current_glctx);
}
diff --git a/src/video/windows/SDL_vkeys.h b/src/video/windows/SDL_vkeys.h
index 2e835f543f..ca24e8ff9f 100644
--- a/src/video/windows/SDL_vkeys.h
+++ b/src/video/windows/SDL_vkeys.h
@@ -20,57 +20,57 @@
*/
#ifndef VK_0
-#define VK_0 '0'
-#define VK_1 '1'
-#define VK_2 '2'
-#define VK_3 '3'
-#define VK_4 '4'
-#define VK_5 '5'
-#define VK_6 '6'
-#define VK_7 '7'
-#define VK_8 '8'
-#define VK_9 '9'
-#define VK_A 'A'
-#define VK_B 'B'
-#define VK_C 'C'
-#define VK_D 'D'
-#define VK_E 'E'
-#define VK_F 'F'
-#define VK_G 'G'
-#define VK_H 'H'
-#define VK_I 'I'
-#define VK_J 'J'
-#define VK_K 'K'
-#define VK_L 'L'
-#define VK_M 'M'
-#define VK_N 'N'
-#define VK_O 'O'
-#define VK_P 'P'
-#define VK_Q 'Q'
-#define VK_R 'R'
-#define VK_S 'S'
-#define VK_T 'T'
-#define VK_U 'U'
-#define VK_V 'V'
-#define VK_W 'W'
-#define VK_X 'X'
-#define VK_Y 'Y'
-#define VK_Z 'Z'
+#define VK_0 '0'
+#define VK_1 '1'
+#define VK_2 '2'
+#define VK_3 '3'
+#define VK_4 '4'
+#define VK_5 '5'
+#define VK_6 '6'
+#define VK_7 '7'
+#define VK_8 '8'
+#define VK_9 '9'
+#define VK_A 'A'
+#define VK_B 'B'
+#define VK_C 'C'
+#define VK_D 'D'
+#define VK_E 'E'
+#define VK_F 'F'
+#define VK_G 'G'
+#define VK_H 'H'
+#define VK_I 'I'
+#define VK_J 'J'
+#define VK_K 'K'
+#define VK_L 'L'
+#define VK_M 'M'
+#define VK_N 'N'
+#define VK_O 'O'
+#define VK_P 'P'
+#define VK_Q 'Q'
+#define VK_R 'R'
+#define VK_S 'S'
+#define VK_T 'T'
+#define VK_U 'U'
+#define VK_V 'V'
+#define VK_W 'W'
+#define VK_X 'X'
+#define VK_Y 'Y'
+#define VK_Z 'Z'
#endif /* VK_0 */
/* These keys haven't been defined, but were experimentally determined */
-#define VK_SEMICOLON 0xBA
-#define VK_EQUALS 0xBB
-#define VK_COMMA 0xBC
-#define VK_MINUS 0xBD
-#define VK_PERIOD 0xBE
-#define VK_SLASH 0xBF
-#define VK_GRAVE 0xC0
-#define VK_LBRACKET 0xDB
-#define VK_BACKSLASH 0xDC
-#define VK_RBRACKET 0xDD
-#define VK_APOSTROPHE 0xDE
-#define VK_BACKTICK 0xDF
-#define VK_OEM_102 0xE2
+#define VK_SEMICOLON 0xBA
+#define VK_EQUALS 0xBB
+#define VK_COMMA 0xBC
+#define VK_MINUS 0xBD
+#define VK_PERIOD 0xBE
+#define VK_SLASH 0xBF
+#define VK_GRAVE 0xC0
+#define VK_LBRACKET 0xDB
+#define VK_BACKSLASH 0xDC
+#define VK_RBRACKET 0xDD
+#define VK_APOSTROPHE 0xDE
+#define VK_BACKTICK 0xDF
+#define VK_OEM_102 0xE2
/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/video/windows/SDL_windowsclipboard.c b/src/video/windows/SDL_windowsclipboard.c
index 4f0c87a817..83bf0caa35 100644
--- a/src/video/windows/SDL_windowsclipboard.c
+++ b/src/video/windows/SDL_windowsclipboard.c
@@ -137,7 +137,7 @@ WIN_HasClipboardText(_THIS)
if (text) {
result = (SDL_strlen(text)>0) ? SDL_TRUE : SDL_FALSE;
SDL_free(text);
- }
+ }
return result;
}
diff --git a/src/video/windows/SDL_windowsevents.c b/src/video/windows/SDL_windowsevents.c
index f384295328..b30b8364b3 100644
--- a/src/video/windows/SDL_windowsevents.c
+++ b/src/video/windows/SDL_windowsevents.c
@@ -36,7 +36,7 @@
/*#define WMMSG_DEBUG*/
#ifdef WMMSG_DEBUG
-#include <stdio.h>
+#include <stdio.h>
#include "wmmsg.h"
#endif
@@ -46,7 +46,7 @@
#define VK_ENTER 10 /* Keypad Enter ... no VKEY defined? */
#ifndef VK_OEM_NEC_EQUAL
-#define VK_OEM_NEC_EQUAL 0x92
+#define VK_OEM_NEC_EQUAL 0x92
#endif
/* Make sure XBUTTON stuff is defined that isn't in older Platform SDKs... */
@@ -66,192 +66,192 @@
#define WM_TOUCH 0x0240
#endif
-static SDL_Scancode
+static SDL_Scancode
WindowsScanCodeToSDLScanCode( LPARAM lParam, WPARAM wParam )
{
- SDL_Scancode code;
- char bIsExtended;
- int nScanCode = ( lParam >> 16 ) & 0xFF;
-
- /* 0x45 here to work around both pause and numlock sharing the same scancode, so use the VK key to tell them apart */
- if ( nScanCode == 0 || nScanCode == 0x45 )
- {
- switch( wParam )
- {
- case VK_CLEAR: return SDL_SCANCODE_CLEAR;
- case VK_MODECHANGE: return SDL_SCANCODE_MODE;
- case VK_SELECT: return SDL_SCANCODE_SELECT;
- case VK_EXECUTE: return SDL_SCANCODE_EXECUTE;
- case VK_HELP: return SDL_SCANCODE_HELP;
- case VK_PAUSE: return SDL_SCANCODE_PAUSE;
- case VK_NUMLOCK: return SDL_SCANCODE_NUMLOCKCLEAR;
-
- case VK_F13: return SDL_SCANCODE_F13;
- case VK_F14: return SDL_SCANCODE_F14;
- case VK_F15: return SDL_SCANCODE_F15;
- case VK_F16: return SDL_SCANCODE_F16;
- case VK_F17: return SDL_SCANCODE_F17;
- case VK_F18: return SDL_SCANCODE_F18;
- case VK_F19: return SDL_SCANCODE_F19;
- case VK_F20: return SDL_SCANCODE_F20;
- case VK_F21: return SDL_SCANCODE_F21;
- case VK_F22: return SDL_SCANCODE_F22;
- case VK_F23: return SDL_SCANCODE_F23;
- case VK_F24: return SDL_SCANCODE_F24;
-
- case VK_OEM_NEC_EQUAL: return SDL_SCANCODE_KP_EQUALS;
- case VK_BROWSER_BACK: return SDL_SCANCODE_AC_BACK;
- case VK_BROWSER_FORWARD: return SDL_SCANCODE_AC_FORWARD;
- case VK_BROWSER_REFRESH: return SDL_SCANCODE_AC_REFRESH;
- case VK_BROWSER_STOP: return SDL_SCANCODE_AC_STOP;
- case VK_BROWSER_SEARCH: return SDL_SCANCODE_AC_SEARCH;
- case VK_BROWSER_FAVORITES: return SDL_SCANCODE_AC_BOOKMARKS;
- case VK_BROWSER_HOME: return SDL_SCANCODE_AC_HOME;
- case VK_VOLUME_MUTE: return SDL_SCANCODE_AUDIOMUTE;
- case VK_VOLUME_DOWN: return SDL_SCANCODE_VOLUMEDOWN;
- case VK_VOLUME_UP: return SDL_SCANCODE_VOLUMEUP;
-
- case VK_MEDIA_NEXT_TRACK: return SDL_SCANCODE_AUDIONEXT;
- case VK_MEDIA_PREV_TRACK: return SDL_SCANCODE_AUDIOPREV;
- case VK_MEDIA_STOP: return SDL_SCANCODE_AUDIOSTOP;
- case VK_MEDIA_PLAY_PAUSE: return SDL_SCANCODE_AUDIOPLAY;
- case VK_LAUNCH_MAIL: return SDL_SCANCODE_MAIL;
- case VK_LAUNCH_MEDIA_SELECT: return SDL_SCANCODE_MEDIASELECT;
-
- case VK_OEM_102: return SDL_SCANCODE_NONUSBACKSLASH;
-
- case VK_ATTN: return SDL_SCANCODE_SYSREQ;
- case VK_CRSEL: return SDL_SCANCODE_CRSEL;
- case VK_EXSEL: return SDL_SCANCODE_EXSEL;
- case VK_OEM_CLEAR: return SDL_SCANCODE_CLEAR;
-
- case VK_LAUNCH_APP1: return SDL_SCANCODE_APP1;
- case VK_LAUNCH_APP2: return SDL_SCANCODE_APP2;
-
- default: return SDL_SCANCODE_UNKNOWN;
- }
- }
-
- if ( nScanCode > 127 )
- return SDL_SCANCODE_UNKNOWN;
-
- code = windows_scancode_table[nScanCode];
-
- bIsExtended = ( lParam & ( 1 << 24 ) ) != 0;
- if ( !bIsExtended )
- {
- switch ( code )
- {
- case SDL_SCANCODE_HOME:
- return SDL_SCANCODE_KP_7;
- case SDL_SCANCODE_UP:
- return SDL_SCANCODE_KP_8;
- case SDL_SCANCODE_PAGEUP:
- return SDL_SCANCODE_KP_9;
- case SDL_SCANCODE_LEFT:
- return SDL_SCANCODE_KP_4;
- case SDL_SCANCODE_RIGHT:
- return SDL_SCANCODE_KP_6;
- case SDL_SCANCODE_END:
- return SDL_SCANCODE_KP_1;
- case SDL_SCANCODE_DOWN:
- return SDL_SCANCODE_KP_2;
- case SDL_SCANCODE_PAGEDOWN:
- return SDL_SCANCODE_KP_3;
- case SDL_SCANCODE_INSERT:
- return SDL_SCANCODE_KP_0;
- case SDL_SCANCODE_DELETE:
- return SDL_SCANCODE_KP_PERIOD;
- case SDL_SCANCODE_PRINTSCREEN:
- return SDL_SCANCODE_KP_MULTIPLY;
- default:
- break;
- }
- }
- else
- {
- switch ( code )
- {
- case SDL_SCANCODE_RETURN:
- return SDL_SCANCODE_KP_ENTER;
- case SDL_SCANCODE_LALT:
- return SDL_SCANCODE_RALT;
- case SDL_SCANCODE_LCTRL:
- return SDL_SCANCODE_RCTRL;
- case SDL_SCANCODE_SLASH:
- return SDL_SCANCODE_KP_DIVIDE;
- case SDL_SCANCODE_CAPSLOCK:
- return SDL_SCANCODE_KP_PLUS;
+ SDL_Scancode code;
+ char bIsExtended;
+ int nScanCode = ( lParam >> 16 ) & 0xFF;
+
+ /* 0x45 here to work around both pause and numlock sharing the same scancode, so use the VK key to tell them apart */
+ if ( nScanCode == 0 || nScanCode == 0x45 )
+ {
+ switch( wParam )
+ {
+ case VK_CLEAR: return SDL_SCANCODE_CLEAR;
+ case VK_MODECHANGE: return SDL_SCANCODE_MODE;
+ case VK_SELECT: return SDL_SCANCODE_SELECT;
+ case VK_EXECUTE: return SDL_SCANCODE_EXECUTE;
+ case VK_HELP: return SDL_SCANCODE_HELP;
+ case VK_PAUSE: return SDL_SCANCODE_PAUSE;
+ case VK_NUMLOCK: return SDL_SCANCODE_NUMLOCKCLEAR;
+
+ case VK_F13: return SDL_SCANCODE_F13;
+ case VK_F14: return SDL_SCANCODE_F14;
+ case VK_F15: return SDL_SCANCODE_F15;
+ case VK_F16: return SDL_SCANCODE_F16;
+ case VK_F17: return SDL_SCANCODE_F17;
+ case VK_F18: return SDL_SCANCODE_F18;
+ case VK_F19: return SDL_SCANCODE_F19;
+ case VK_F20: return SDL_SCANCODE_F20;
+ case VK_F21: return SDL_SCANCODE_F21;
+ case VK_F22: return SDL_SCANCODE_F22;
+ case VK_F23: return SDL_SCANCODE_F23;
+ case VK_F24: return SDL_SCANCODE_F24;
+
+ case VK_OEM_NEC_EQUAL: return SDL_SCANCODE_KP_EQUALS;
+ case VK_BROWSER_BACK: return SDL_SCANCODE_AC_BACK;
+ case VK_BROWSER_FORWARD: return SDL_SCANCODE_AC_FORWARD;
+ case VK_BROWSER_REFRESH: return SDL_SCANCODE_AC_REFRESH;
+ case VK_BROWSER_STOP: return SDL_SCANCODE_AC_STOP;
+ case VK_BROWSER_SEARCH: return SDL_SCANCODE_AC_SEARCH;
+ case VK_BROWSER_FAVORITES: return SDL_SCANCODE_AC_BOOKMARKS;
+ case VK_BROWSER_HOME: return SDL_SCANCODE_AC_HOME;
+ case VK_VOLUME_MUTE: return SDL_SCANCODE_AUDIOMUTE;
+ case VK_VOLUME_DOWN: return SDL_SCANCODE_VOLUMEDOWN;
+ case VK_VOLUME_UP: return SDL_SCANCODE_VOLUMEUP;
+
+ case VK_MEDIA_NEXT_TRACK: return SDL_SCANCODE_AUDIONEXT;
+ case VK_MEDIA_PREV_TRACK: return SDL_SCANCODE_AUDIOPREV;
+ case VK_MEDIA_STOP: return SDL_SCANCODE_AUDIOSTOP;
+ case VK_MEDIA_PLAY_PAUSE: return SDL_SCANCODE_AUDIOPLAY;
+ case VK_LAUNCH_MAIL: return SDL_SCANCODE_MAIL;
+ case VK_LAUNCH_MEDIA_SELECT: return SDL_SCANCODE_MEDIASELECT;
+
+ case VK_OEM_102: return SDL_SCANCODE_NONUSBACKSLASH;
+
+ case VK_ATTN: return SDL_SCANCODE_SYSREQ;
+ case VK_CRSEL: return SDL_SCANCODE_CRSEL;
+ case VK_EXSEL: return SDL_SCANCODE_EXSEL;
+ case VK_OEM_CLEAR: return SDL_SCANCODE_CLEAR;
+
+ case VK_LAUNCH_APP1: return SDL_SCANCODE_APP1;
+ case VK_LAUNCH_APP2: return SDL_SCANCODE_APP2;
+
+ default: return SDL_SCANCODE_UNKNOWN;
+ }
+ }
+
+ if ( nScanCode > 127 )
+ return SDL_SCANCODE_UNKNOWN;
+
+ code = windows_scancode_table[nScanCode];
+
+ bIsExtended = ( lParam & ( 1 << 24 ) ) != 0;
+ if ( !bIsExtended )
+ {
+ switch ( code )
+ {
+ case SDL_SCANCODE_HOME:
+ return SDL_SCANCODE_KP_7;
+ case SDL_SCANCODE_UP:
+ return SDL_SCANCODE_KP_8;
+ case SDL_SCANCODE_PAGEUP:
+ return SDL_SCANCODE_KP_9;
+ case SDL_SCANCODE_LEFT:
+ return SDL_SCANCODE_KP_4;
+ case SDL_SCANCODE_RIGHT:
+ return SDL_SCANCODE_KP_6;
+ case SDL_SCANCODE_END:
+ return SDL_SCANCODE_KP_1;
+ case SDL_SCANCODE_DOWN:
+ return SDL_SCANCODE_KP_2;
+ case SDL_SCANCODE_PAGEDOWN:
+ return SDL_SCANCODE_KP_3;
+ case SDL_SCANCODE_INSERT:
+ return SDL_SCANCODE_KP_0;
+ case SDL_SCANCODE_DELETE:
+ return SDL_SCANCODE_KP_PERIOD;
+ case SDL_SCANCODE_PRINTSCREEN:
+ return SDL_SCANCODE_KP_MULTIPLY;
default:
break;
- }
- }
+ }
+ }
+ else
+ {
+ switch ( code )
+ {
+ case SDL_SCANCODE_RETURN:
+ return SDL_SCANCODE_KP_ENTER;
+ case SDL_SCANCODE_LALT:
+ return SDL_SCANCODE_RALT;
+ case SDL_SCANCODE_LCTRL:
+ return SDL_SCANCODE_RCTRL;
+ case SDL_SCANCODE_SLASH:
+ return SDL_SCANCODE_KP_DIVIDE;
+ case SDL_SCANCODE_CAPSLOCK:
+ return SDL_SCANCODE_KP_PLUS;
+ default:
+ break;
+ }
+ }
- return code;
+ return code;
}
-void
+void
WIN_CheckWParamMouseButton( SDL_bool bwParamMousePressed, SDL_bool bSDLMousePressed, SDL_WindowData *data, Uint8 button )
{
- if ( bwParamMousePressed && !bSDLMousePressed )
- {
- SDL_SendMouseButton(data->window, 0, SDL_PRESSED, button);
- }
- else if ( !bwParamMousePressed && bSDLMousePressed )
- {
- SDL_SendMouseButton(data->window, 0, SDL_RELEASED, button);
- }
+ if ( bwParamMousePressed && !bSDLMousePressed )
+ {
+ SDL_SendMouseButton(data->window, 0, SDL_PRESSED, button);
+ }
+ else if ( !bwParamMousePressed && bSDLMousePressed )
+ {
+ SDL_SendMouseButton(data->window, 0, SDL_RELEASED, button);
+ }
}
/*
* Some windows systems fail to send a WM_LBUTTONDOWN sometimes, but each mouse move contains the current button state also
* so this funciton reconciles our view of the world with the current buttons reported by windows
*/
-void
+void
WIN_CheckWParamMouseButtons( WPARAM wParam, SDL_WindowData *data )
{
- if ( wParam != data->mouse_button_flags )
- {
- Uint32 mouseFlags = SDL_GetMouseState( NULL, NULL );
- WIN_CheckWParamMouseButton( (wParam & MK_LBUTTON), (mouseFlags & SDL_BUTTON_LMASK), data, SDL_BUTTON_LEFT );
- WIN_CheckWParamMouseButton( (wParam & MK_MBUTTON), (mouseFlags & SDL_BUTTON_MMASK), data, SDL_BUTTON_MIDDLE );
- WIN_CheckWParamMouseButton( (wParam & MK_RBUTTON), (mouseFlags & SDL_BUTTON_RMASK), data, SDL_BUTTON_RIGHT );
- WIN_CheckWParamMouseButton( (wParam & MK_XBUTTON1), (mouseFlags & SDL_BUTTON_X1MASK), data, SDL_BUTTON_X1 );
- WIN_CheckWParamMouseButton( (wParam & MK_XBUTTON2), (mouseFlags & SDL_BUTTON_X2MASK), data, SDL_BUTTON_X2 );
- data->mouse_button_flags = wParam;
- }
+ if ( wParam != data->mouse_button_flags )
+ {
+ Uint32 mouseFlags = SDL_GetMouseState( NULL, NULL );
+ WIN_CheckWParamMouseButton( (wParam & MK_LBUTTON), (mouseFlags & SDL_BUTTON_LMASK), data, SDL_BUTTON_LEFT );
+ WIN_CheckWParamMouseButton( (wParam & MK_MBUTTON), (mouseFlags & SDL_BUTTON_MMASK), data, SDL_BUTTON_MIDDLE );
+ WIN_CheckWParamMouseButton( (wParam & MK_RBUTTON), (mouseFlags & SDL_BUTTON_RMASK), data, SDL_BUTTON_RIGHT );
+ WIN_CheckWParamMouseButton( (wParam & MK_XBUTTON1), (mouseFlags & SDL_BUTTON_X1MASK), data, SDL_BUTTON_X1 );
+ WIN_CheckWParamMouseButton( (wParam & MK_XBUTTON2), (mouseFlags & SDL_BUTTON_X2MASK), data, SDL_BUTTON_X2 );
+ data->mouse_button_flags = wParam;
+ }
}
-void
+void
WIN_CheckRawMouseButtons( ULONG rawButtons, SDL_WindowData *data )
{
- if ( rawButtons != data->mouse_button_flags )
- {
- Uint32 mouseFlags = SDL_GetMouseState( NULL, NULL );
- if ( (rawButtons & RI_MOUSE_BUTTON_1_DOWN) )
- WIN_CheckWParamMouseButton( (rawButtons & RI_MOUSE_BUTTON_1_DOWN), (mouseFlags & SDL_BUTTON_LMASK), data, SDL_BUTTON_LEFT );
- if ( (rawButtons & RI_MOUSE_BUTTON_1_UP) )
- WIN_CheckWParamMouseButton( !(rawButtons & RI_MOUSE_BUTTON_1_UP), (mouseFlags & SDL_BUTTON_LMASK), data, SDL_BUTTON_LEFT );
- if ( (rawButtons & RI_MOUSE_BUTTON_2_DOWN) )
- WIN_CheckWParamMouseButton( (rawButtons & RI_MOUSE_BUTTON_2_DOWN), (mouseFlags & SDL_BUTTON_RMASK), data, SDL_BUTTON_RIGHT );
- if ( (rawButtons & RI_MOUSE_BUTTON_2_UP) )
- WIN_CheckWParamMouseButton( !(rawButtons & RI_MOUSE_BUTTON_2_UP), (mouseFlags & SDL_BUTTON_RMASK), data, SDL_BUTTON_RIGHT );
- if ( (rawButtons & RI_MOUSE_BUTTON_3_DOWN) )
- WIN_CheckWParamMouseButton( (rawButtons & RI_MOUSE_BUTTON_3_DOWN), (mouseFlags & SDL_BUTTON_MMASK), data, SDL_BUTTON_MIDDLE );
- if ( (rawButtons & RI_MOUSE_BUTTON_3_UP) )
- WIN_CheckWParamMouseButton( !(rawButtons & RI_MOUSE_BUTTON_3_UP), (mouseFlags & SDL_BUTTON_MMASK), data, SDL_BUTTON_MIDDLE );
- if ( (rawButtons & RI_MOUSE_BUTTON_4_DOWN) )
- WIN_CheckWParamMouseButton( (rawButtons & RI_MOUSE_BUTTON_4_DOWN), (mouseFlags & SDL_BUTTON_X1MASK), data, SDL_BUTTON_X1 );
- if ( (rawButtons & RI_MOUSE_BUTTON_4_UP) )
- WIN_CheckWParamMouseButton( !(rawButtons & RI_MOUSE_BUTTON_4_UP), (mouseFlags & SDL_BUTTON_X1MASK), data, SDL_BUTTON_X1 );
- if ( (rawButtons & RI_MOUSE_BUTTON_5_DOWN) )
- WIN_CheckWParamMouseButton( (rawButtons & RI_MOUSE_BUTTON_5_DOWN), (mouseFlags & SDL_BUTTON_X2MASK), data, SDL_BUTTON_X2 );
- if ( (rawButtons & RI_MOUSE_BUTTON_5_UP) )
- WIN_CheckWParamMouseButton( !(rawButtons & RI_MOUSE_BUTTON_5_UP), (mouseFlags & SDL_BUTTON_X2MASK), data, SDL_BUTTON_X2 );
- data->mouse_button_flags = rawButtons;
- }
+ if ( rawButtons != data->mouse_button_flags )
+ {
+ Uint32 mouseFlags = SDL_GetMouseState( NULL, NULL );
+ if ( (rawButtons & RI_MOUSE_BUTTON_1_DOWN) )
+ WIN_CheckWParamMouseButton( (rawButtons & RI_MOUSE_BUTTON_1_DOWN), (mouseFlags & SDL_BUTTON_LMASK), data, SDL_BUTTON_LEFT );
+ if ( (rawButtons & RI_MOUSE_BUTTON_1_UP) )
+ WIN_CheckWParamMouseButton( !(rawButtons & RI_MOUSE_BUTTON_1_UP), (mouseFlags & SDL_BUTTON_LMASK), data, SDL_BUTTON_LEFT );
+ if ( (rawButtons & RI_MOUSE_BUTTON_2_DOWN) )
+ WIN_CheckWParamMouseButton( (rawButtons & RI_MOUSE_BUTTON_2_DOWN), (mouseFlags & SDL_BUTTON_RMASK), data, SDL_BUTTON_RIGHT );
+ if ( (rawButtons & RI_MOUSE_BUTTON_2_UP) )
+ WIN_CheckWParamMouseButton( !(rawButtons & RI_MOUSE_BUTTON_2_UP), (mouseFlags & SDL_BUTTON_RMASK), data, SDL_BUTTON_RIGHT );
+ if ( (rawButtons & RI_MOUSE_BUTTON_3_DOWN) )
+ WIN_CheckWParamMouseButton( (rawButtons & RI_MOUSE_BUTTON_3_DOWN), (mouseFlags & SDL_BUTTON_MMASK), data, SDL_BUTTON_MIDDLE );
+ if ( (rawButtons & RI_MOUSE_BUTTON_3_UP) )
+ WIN_CheckWParamMouseButton( !(rawButtons & RI_MOUSE_BUTTON_3_UP), (mouseFlags & SDL_BUTTON_MMASK), data, SDL_BUTTON_MIDDLE );
+ if ( (rawButtons & RI_MOUSE_BUTTON_4_DOWN) )
+ WIN_CheckWParamMouseButton( (rawButtons & RI_MOUSE_BUTTON_4_DOWN), (mouseFlags & SDL_BUTTON_X1MASK), data, SDL_BUTTON_X1 );
+ if ( (rawButtons & RI_MOUSE_BUTTON_4_UP) )
+ WIN_CheckWParamMouseButton( !(rawButtons & RI_MOUSE_BUTTON_4_UP), (mouseFlags & SDL_BUTTON_X1MASK), data, SDL_BUTTON_X1 );
+ if ( (rawButtons & RI_MOUSE_BUTTON_5_DOWN) )
+ WIN_CheckWParamMouseButton( (rawButtons & RI_MOUSE_BUTTON_5_DOWN), (mouseFlags & SDL_BUTTON_X2MASK), data, SDL_BUTTON_X2 );
+ if ( (rawButtons & RI_MOUSE_BUTTON_5_UP) )
+ WIN_CheckWParamMouseButton( !(rawButtons & RI_MOUSE_BUTTON_5_UP), (mouseFlags & SDL_BUTTON_X2MASK), data, SDL_BUTTON_X2 );
+ data->mouse_button_flags = rawButtons;
+ }
}
LRESULT CALLBACK
@@ -280,8 +280,8 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
}
#ifdef WMMSG_DEBUG
- {
- FILE *log = fopen("wmmsg.txt", "a");
+ {
+ FILE *log = fopen("wmmsg.txt", "a");
fprintf(log, "Received windows message: %p ", hwnd);
if (msg > MAX_WMMSG) {
fprintf(log, "%d", msg);
@@ -314,8 +314,8 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
minimized = HIWORD(wParam);
if (!minimized && (LOWORD(wParam) != WA_INACTIVE)) {
- Uint32 mouseFlags;
- SHORT keyState;
+ Uint32 mouseFlags;
+ SHORT keyState;
SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_SHOWN, 0, 0);
SDL_SendWindowEvent(data->window,
@@ -327,40 +327,40 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
if (SDL_GetKeyboardFocus() != data->window) {
SDL_SetKeyboardFocus(data->window);
}
- /* mouse buttons may have changed state here, we need
- to resync them, but we will get a WM_MOUSEMOVE right away which will fix
- things up if in non raw mode also
- */
- mouseFlags = SDL_GetMouseState( NULL, NULL );
-
- keyState = GetAsyncKeyState( VK_LBUTTON );
- WIN_CheckWParamMouseButton( ( keyState & 0x8000 ), (mouseFlags & SDL_BUTTON_LMASK), data, SDL_BUTTON_LEFT );
- keyState = GetAsyncKeyState( VK_RBUTTON );
- WIN_CheckWParamMouseButton( ( keyState & 0x8000 ), (mouseFlags & SDL_BUTTON_RMASK), data, SDL_BUTTON_RIGHT );
- keyState = GetAsyncKeyState( VK_MBUTTON );
- WIN_CheckWParamMouseButton( ( keyState & 0x8000 ), (mouseFlags & SDL_BUTTON_MMASK), data, SDL_BUTTON_MIDDLE );
- keyState = GetAsyncKeyState( VK_XBUTTON1 );
- WIN_CheckWParamMouseButton( ( keyState & 0x8000 ), (mouseFlags & SDL_BUTTON_X1MASK), data, SDL_BUTTON_X1 );
- keyState = GetAsyncKeyState( VK_XBUTTON2 );
- WIN_CheckWParamMouseButton( ( keyState & 0x8000 ), (mouseFlags & SDL_BUTTON_X2MASK), data, SDL_BUTTON_X2 );
- data->mouse_button_flags = 0;
-
- if(SDL_GetMouse()->relative_mode) {
- LONG cx, cy;
- RECT rect;
- GetWindowRect(hwnd, &rect);
-
- cx = (rect.left + rect.right) / 2;
- cy = (rect.top + rect.bottom) / 2;
-
- /* Make an absurdly small clip rect */
- rect.left = cx-1;
- rect.right = cx+1;
- rect.top = cy-1;
- rect.bottom = cy+1;
-
- ClipCursor(&rect);
- }
+ /* mouse buttons may have changed state here, we need
+ to resync them, but we will get a WM_MOUSEMOVE right away which will fix
+ things up if in non raw mode also
+ */
+ mouseFlags = SDL_GetMouseState( NULL, NULL );
+
+ keyState = GetAsyncKeyState( VK_LBUTTON );
+ WIN_CheckWParamMouseButton( ( keyState & 0x8000 ), (mouseFlags & SDL_BUTTON_LMASK), data, SDL_BUTTON_LEFT );
+ keyState = GetAsyncKeyState( VK_RBUTTON );
+ WIN_CheckWParamMouseButton( ( keyState & 0x8000 ), (mouseFlags & SDL_BUTTON_RMASK), data, SDL_BUTTON_RIGHT );
+ keyState = GetAsyncKeyState( VK_MBUTTON );
+ WIN_CheckWParamMouseButton( ( keyState & 0x8000 ), (mouseFlags & SDL_BUTTON_MMASK), data, SDL_BUTTON_MIDDLE );
+ keyState = GetAsyncKeyState( VK_XBUTTON1 );
+ WIN_CheckWParamMouseButton( ( keyState & 0x8000 ), (mouseFlags & SDL_BUTTON_X1MASK), data, SDL_BUTTON_X1 );
+ keyState = GetAsyncKeyState( VK_XBUTTON2 );
+ WIN_CheckWParamMouseButton( ( keyState & 0x8000 ), (mouseFlags & SDL_BUTTON_X2MASK), data, SDL_BUTTON_X2 );
+ data->mouse_button_flags = 0;
+
+ if(SDL_GetMouse()->relative_mode) {
+ LONG cx, cy;
+ RECT rect;
+ GetWindowRect(hwnd, &rect);
+
+ cx = (rect.left + rect.right) / 2;
+ cy = (rect.top + rect.bottom) / 2;
+
+ /* Make an absurdly small clip rect */
+ rect.left = cx-1;
+ rect.right = cx+1;
+ rect.top = cy-1;
+ rect.bottom = cy+1;
+
+ ClipCursor(&rect);
+ }
/*
* FIXME: Update keyboard state
@@ -379,65 +379,65 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
returnCode = 0;
break;
- case WM_MOUSEMOVE:
- if( !SDL_GetMouse()->relative_mode )
- SDL_SendMouseMotion(data->window, 0, 0, LOWORD(lParam), HIWORD(lParam));
- /* don't break here, fall through to check the wParam like the button presses */
- case WM_LBUTTONUP:
- case WM_RBUTTONUP:
- case WM_MBUTTONUP:
- case WM_XBUTTONUP:
- case WM_LBUTTONDOWN:
- case WM_RBUTTONDOWN:
- case WM_MBUTTONDOWN:
- case WM_XBUTTONDOWN:
- if( !SDL_GetMouse()->relative_mode )
- WIN_CheckWParamMouseButtons( wParam, data );
- break;
-
- case WM_INPUT:
- {
- HRAWINPUT hRawInput = (HRAWINPUT)lParam;
- RAWINPUT inp;
- UINT size = sizeof(inp);
-
- if(!SDL_GetMouse()->relative_mode)
- break;
-
- GetRawInputData(hRawInput, RID_INPUT, &inp, &size, sizeof(RAWINPUTHEADER));
-
- /* Mouse data */
- if(inp.header.dwType == RIM_TYPEMOUSE)
- {
- RAWMOUSE* mouse = &inp.data.mouse;
-
- if((mouse->usFlags & 0x01) == MOUSE_MOVE_RELATIVE)
- {
- SDL_SendMouseMotion(data->window, 0, 1, (int)mouse->lLastX, (int)mouse->lLastY);
- }
- else
- {
- // synthesize relative moves from the abs position
- static SDL_Point initialMousePoint;
- if ( initialMousePoint.x == 0 && initialMousePoint.y == 0 )
- {
- initialMousePoint.x = mouse->lLastX;
- initialMousePoint.y = mouse->lLastY;
- }
-
- SDL_SendMouseMotion(data->window, 0, 1, (int)(mouse->lLastX-initialMousePoint.x), (int)(mouse->lLastY-initialMousePoint.y) );
-
- initialMousePoint.x = mouse->lLastX;
- initialMousePoint.y = mouse->lLastY;
- }
- WIN_CheckRawMouseButtons( mouse->usButtonFlags, data );
- }
- break;
- }
+ case WM_MOUSEMOVE:
+ if( !SDL_GetMouse()->relative_mode )
+ SDL_SendMouseMotion(data->window, 0, 0, LOWORD(lParam), HIWORD(lParam));
+ /* don't break here, fall through to check the wParam like the button presses */
+ case WM_LBUTTONUP:
+ case WM_RBUTTONUP:
+ case WM_MBUTTONUP:
+ case WM_XBUTTONUP:
+ case WM_LBUTTONDOWN:
+ case WM_RBUTTONDOWN:
+ case WM_MBUTTONDOWN:
+ case WM_XBUTTONDOWN:
+ if( !SDL_GetMouse()->relative_mode )
+ WIN_CheckWParamMouseButtons( wParam, data );
+ break;
+
+ case WM_INPUT:
+ {
+ HRAWINPUT hRawInput = (HRAWINPUT)lParam;
+ RAWINPUT inp;
+ UINT size = sizeof(inp);
+
+ if(!SDL_GetMouse()->relative_mode)
+ break;
+
+ GetRawInputData(hRawInput, RID_INPUT, &inp, &size, sizeof(RAWINPUTHEADER));
+
+ /* Mouse data */
+ if(inp.header.dwType == RIM_TYPEMOUSE)
+ {
+ RAWMOUSE* mouse = &inp.data.mouse;
+
+ if((mouse->usFlags & 0x01) == MOUSE_MOVE_RELATIVE)
+ {
+ SDL_SendMouseMotion(data->window, 0, 1, (int)mouse->lLastX, (int)mouse->lLastY);
+ }
+ else
+ {
+ /* synthesize relative moves from the abs position */
+ static SDL_Point initialMousePoint;
+ if ( initialMousePoint.x == 0 && initialMousePoint.y == 0 )
+ {
+ initialMousePoint.x = mouse->lLastX;
+ initialMousePoint.y = mouse->lLastY;
+ }
+
+ SDL_SendMouseMotion(data->window, 0, 1, (int)(mouse->lLastX-initialMousePoint.x), (int)(mouse->lLastY-initialMousePoint.y) );
+
+ initialMousePoint.x = mouse->lLastX;
+ initialMousePoint.y = mouse->lLastY;
+ }
+ WIN_CheckRawMouseButtons( mouse->usButtonFlags, data );
+ }
+ break;
+ }
case WM_MOUSEWHEEL:
{
- // FIXME: This may need to accumulate deltas up to WHEEL_DELTA
+ /* FIXME: This may need to accumulate deltas up to WHEEL_DELTA */
short motion = GET_WHEEL_DELTA_WPARAM(wParam) / WHEEL_DELTA;
SDL_SendMouseWheel(data->window, 0, 0, motion);
@@ -447,14 +447,14 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
#ifdef WM_MOUSELEAVE
case WM_MOUSELEAVE:
if (SDL_GetMouseFocus() == data->window) {
- if (!SDL_GetMouse()->relative_mode) {
- POINT cursorPos;
- GetCursorPos(&cursorPos);
- ScreenToClient(hwnd, &cursorPos);
- SDL_SendMouseMotion(data->window, 0, 0, cursorPos.x, cursorPos.y);
- }
-
- SDL_SetMouseFocus(NULL);
+ if (!SDL_GetMouse()->relative_mode) {
+ POINT cursorPos;
+ GetCursorPos(&cursorPos);
+ ScreenToClient(hwnd, &cursorPos);
+ SDL_SendMouseMotion(data->window, 0, 0, cursorPos.x, cursorPos.y);
+ }
+
+ SDL_SetMouseFocus(NULL);
}
returnCode = 0;
break;
@@ -463,8 +463,8 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
case WM_SYSKEYDOWN:
case WM_KEYDOWN:
{
- SDL_Scancode code = WindowsScanCodeToSDLScanCode( lParam, wParam );
- if ( code != SDL_SCANCODE_UNKNOWN ) {
+ SDL_Scancode code = WindowsScanCodeToSDLScanCode( lParam, wParam );
+ if ( code != SDL_SCANCODE_UNKNOWN ) {
SDL_SendKeyboardKey(SDL_PRESSED, code );
}
}
@@ -529,7 +529,7 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
int max_w, max_h;
int style;
BOOL menu;
- BOOL constrain_max_size;
+ BOOL constrain_max_size;
/* If we allow resizing, let the resize happen naturally */
if (SDL_IsShapedWindow(data->window))
@@ -545,7 +545,7 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
SDL_GetWindowMinimumSize(data->window, &min_w, &min_h);
SDL_GetWindowMaximumSize(data->window, &max_w, &max_h);
- /* Store in min_w and min_h difference between current size and minimal
+ /* Store in min_w and min_h difference between current size and minimal
size so we don't need to call AdjustWindowRectEx twice */
min_w -= w;
min_h -= h;
@@ -680,56 +680,56 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
returnCode = 0;
break;
- case WM_TOUCH:
- {
- UINT i, num_inputs = LOWORD(wParam);
- PTOUCHINPUT inputs = SDL_stack_alloc(TOUCHINPUT, num_inputs);
- if (data->videodata->GetTouchInputInfo((HTOUCHINPUT)lParam, num_inputs, inputs, sizeof(TOUCHINPUT))) {
- RECT rect;
- float x, y;
-
- if (!GetClientRect(hwnd, &rect) ||
- (rect.right == rect.left && rect.bottom == rect.top)) {
- break;
- }
- ClientToScreen(hwnd, (LPPOINT) & rect);
- ClientToScreen(hwnd, (LPPOINT) & rect + 1);
- rect.top *= 100;
- rect.left *= 100;
- rect.bottom *= 100;
- rect.right *= 100;
-
- for (i = 0; i < num_inputs; ++i) {
- PTOUCHINPUT input = &inputs[i];
-
- const SDL_TouchID touchId = (SDL_TouchID)input->hSource;
- if (!SDL_GetTouch(touchId)) {
- if (SDL_AddTouch(touchId, "") < 0) {
- continue;
- }
- }
-
- // Get the normalized coordinates for the window
- x = (float)(input->x - rect.left)/(rect.right - rect.left);
- y = (float)(input->y - rect.top)/(rect.bottom - rect.top);
-
- if (input->dwFlags & TOUCHEVENTF_DOWN) {
- SDL_SendTouch(touchId, input->dwID, SDL_TRUE, x, y, 1.0f);
- }
- if (input->dwFlags & TOUCHEVENTF_MOVE) {
- SDL_SendTouchMotion(touchId, input->dwID, x, y, 1.0f);
- }
- if (input->dwFlags & TOUCHEVENTF_UP) {
- SDL_SendTouch(touchId, input->dwID, SDL_FALSE, x, y, 1.0f);
- }
- }
- }
- SDL_stack_free(inputs);
-
- data->videodata->CloseTouchInputHandle((HTOUCHINPUT)lParam);
- return 0;
- }
- break;
+ case WM_TOUCH:
+ {
+ UINT i, num_inputs = LOWORD(wParam);
+ PTOUCHINPUT inputs = SDL_stack_alloc(TOUCHINPUT, num_inputs);
+ if (data->videodata->GetTouchInputInfo((HTOUCHINPUT)lParam, num_inputs, inputs, sizeof(TOUCHINPUT))) {
+ RECT rect;
+ float x, y;
+
+ if (!GetClientRect(hwnd, &rect) ||
+ (rect.right == rect.left && rect.bottom == rect.top)) {
+ break;
+ }
+ ClientToScreen(hwnd, (LPPOINT) & rect);
+ ClientToScreen(hwnd, (LPPOINT) & rect + 1);
+ rect.top *= 100;
+ rect.left *= 100;
+ rect.bottom *= 100;
+ rect.right *= 100;
+
+ for (i = 0; i < num_inputs; ++i) {
+ PTOUCHINPUT input = &inputs[i];
+
+ const SDL_TouchID touchId = (SDL_TouchID)input->hSource;
+ if (!SDL_GetTouch(touchId)) {
+ if (SDL_AddTouch(touchId, "") < 0) {
+ continue;
+ }
+ }
+
+ /* Get the normalized coordinates for the window */
+ x = (float)(input->x - rect.left)/(rect.right - rect.left);
+ y = (float)(input->y - rect.top)/(rect.bottom - rect.top);
+
+ if (input->dwFlags & TOUCHEVENTF_DOWN) {
+ SDL_SendTouch(touchId, input->dwID, SDL_TRUE, x, y, 1.0f);
+ }
+ if (input->dwFlags & TOUCHEVENTF_MOVE) {
+ SDL_SendTouchMotion(touchId, input->dwID, x, y, 1.0f);
+ }
+ if (input->dwFlags & TOUCHEVENTF_UP) {
+ SDL_SendTouch(touchId, input->dwID, SDL_FALSE, x, y, 1.0f);
+ }
+ }
+ }
+ SDL_stack_free(inputs);
+
+ data->videodata->CloseTouchInputHandle((HTOUCHINPUT)lParam);
+ return 0;
+ }
+ break;
case WM_DROPFILES:
{
diff --git a/src/video/windows/SDL_windowsframebuffer.c b/src/video/windows/SDL_windowsframebuffer.c
index 5a2a9ef003..93af4c5e83 100644
--- a/src/video/windows/SDL_windowsframebuffer.c
+++ b/src/video/windows/SDL_windowsframebuffer.c
@@ -77,7 +77,7 @@ int WIN_CreateWindowFramebuffer(_THIS, SDL_Window * window, Uint32 * format, voi
/* Fill in the size information */
*pitch = (((window->w * SDL_BYTESPERPIXEL(*format)) + 3) & ~3);
info->bmiHeader.biWidth = window->w;
- info->bmiHeader.biHeight = -window->h; /* negative for topdown bitmap */
+ info->bmiHeader.biHeight = -window->h; /* negative for topdown bitmap */
info->bmiHeader.biSizeImage = window->h * (*pitch);
data->mdc = CreateCompatibleDC(data->hdc);
diff --git a/src/video/windows/SDL_windowskeyboard.c b/src/video/windows/SDL_windowskeyboard.c
index 74f078f865..5bb9d42177 100644
--- a/src/video/windows/SDL_windowskeyboard.c
+++ b/src/video/windows/SDL_windowskeyboard.c
@@ -187,12 +187,12 @@ void
WIN_SetTextInputRect(_THIS, SDL_Rect *rect)
{
SDL_VideoData *videodata = (SDL_VideoData *)_this->driverdata;
-
+
if (!rect) {
SDL_InvalidParamError("rect");
return;
}
-
+
videodata->ime_rect = *rect;
}
@@ -1031,7 +1031,7 @@ STDMETHODIMP UIElementSink_BeginUIElement(TSFSink *sink, DWORD dwUIElementId, BO
}
preading->lpVtbl->Release(preading);
}
- else if (SUCCEEDED(element->lpVtbl->QueryInterface(element, &IID_ITfCandidateListUIElement, (LPVOID *)&pcandlist))) {
+ else if (SUCCEEDED(element->lpVtbl->QueryInterface(element, &IID_ITfCandidateListUIElement, (LPVOID *)&pcandlist))) {
videodata->ime_candref++;
UILess_GetCandidateList(videodata, pcandlist);
pcandlist->lpVtbl->Release(pcandlist);
@@ -1058,7 +1058,7 @@ STDMETHODIMP UIElementSink_UpdateUIElement(TSFSink *sink, DWORD dwUIElementId)
}
preading->lpVtbl->Release(preading);
}
- else if (SUCCEEDED(element->lpVtbl->QueryInterface(element, &IID_ITfCandidateListUIElement, (LPVOID *)&pcandlist))) {
+ else if (SUCCEEDED(element->lpVtbl->QueryInterface(element, &IID_ITfCandidateListUIElement, (LPVOID *)&pcandlist))) {
UILess_GetCandidateList(videodata, pcandlist);
pcandlist->lpVtbl->Release(pcandlist);
}
@@ -1512,7 +1512,7 @@ void IME_Present(SDL_VideoData *videodata)
if (videodata->ime_dirty)
IME_Render(videodata);
- // FIXME: Need to show the IME bitmap
+ /* FIXME: Need to show the IME bitmap */
}
#endif /* SDL_DISABLE_WINDOWS_IME */
diff --git a/src/video/windows/SDL_windowsmessagebox.c b/src/video/windows/SDL_windowsmessagebox.c
index 18504cb3c5..bbe79237fc 100644
--- a/src/video/windows/SDL_windowsmessagebox.c
+++ b/src/video/windows/SDL_windowsmessagebox.c
@@ -36,28 +36,28 @@
typedef struct
{
- WORD dlgVer;
- WORD signature;
- DWORD helpID;
- DWORD exStyle;
- DWORD style;
- WORD cDlgItems;
- short x;
- short y;
- short cx;
- short cy;
+ WORD dlgVer;
+ WORD signature;
+ DWORD helpID;
+ DWORD exStyle;
+ DWORD style;
+ WORD cDlgItems;
+ short x;
+ short y;
+ short cx;
+ short cy;
} DLGTEMPLATEEX;
typedef struct
{
- DWORD helpID;
- DWORD exStyle;
- DWORD style;
- short x;
- short y;
- short cx;
- short cy;
- DWORD id;
+ DWORD helpID;
+ DWORD exStyle;
+ DWORD style;
+ short x;
+ short y;
+ short cx;
+ short cy;
+ DWORD id;
} DLGITEMTEMPLATEEX;
#pragma pack(pop)
@@ -76,7 +76,7 @@ static INT_PTR MessageBoxDialogProc(HWND hDlg, UINT iMessage, WPARAM wParam, LPA
switch ( iMessage ) {
case WM_COMMAND:
/* Return the ID of the button that was pushed */
- EndDialog(hDlg, LOWORD(wParam));
+ EndDialog(hDlg, LOWORD(wParam));
return TRUE;
default:
@@ -108,7 +108,7 @@ static SDL_bool ExpandDialogSpace(WIN_DialogData *dialog, size_t space)
}
return SDL_TRUE;
}
-
+
static SDL_bool AlignDialogData(WIN_DialogData *dialog, size_t size)
{
size_t padding = (dialog->used % size);
@@ -166,7 +166,7 @@ static int s_BaseUnitsX;
static int s_BaseUnitsY;
static void Vec2ToDLU(short *x, short *y)
{
- SDL_assert(s_BaseUnitsX != 0); // we init in WIN_ShowMessageBox(), which is the only public function...
+ SDL_assert(s_BaseUnitsX != 0); /* we init in WIN_ShowMessageBox(), which is the only public function... */
*x = MulDiv(*x, 4, s_BaseUnitsX);
*y = MulDiv(*y, 8, s_BaseUnitsY);
@@ -265,37 +265,37 @@ static WIN_DialogData *CreateDialogData(int w, int h, const char *caption)
return NULL;
}
- // No menu
+ /* No menu */
WordToPass = 0;
if (!AddDialogData(dialog, &WordToPass, 2)) {
FreeDialogData(dialog);
return NULL;
}
- // No custom class
+ /* No custom class */
if (!AddDialogData(dialog, &WordToPass, 2)) {
FreeDialogData(dialog);
return NULL;
}
- // title
+ /* title */
if (!AddDialogString(dialog, caption)) {
FreeDialogData(dialog);
return NULL;
}
- // Font stuff
+ /* Font stuff */
{
- //
- // We want to use the system messagebox font.
- //
+ /*
+ * We want to use the system messagebox font.
+ */
BYTE ToPass;
-
+
NONCLIENTMETRICSA NCM;
NCM.cbSize = sizeof(NCM);
SystemParametersInfoA(SPI_GETNONCLIENTMETRICS, 0, &NCM, 0);
-
- // Font size - convert to logical font size for dialog parameter.
+
+ /* Font size - convert to logical font size for dialog parameter. */
{
HDC ScreenDC = GetDC(0);
WordToPass = (WORD)(-72 * NCM.lfMessageFont.lfHeight / GetDeviceCaps(ScreenDC, LOGPIXELSY));
@@ -307,28 +307,28 @@ static WIN_DialogData *CreateDialogData(int w, int h, const char *caption)
return NULL;
}
- // Font weight
+ /* Font weight */
WordToPass = (WORD)NCM.lfMessageFont.lfWeight;
if (!AddDialogData(dialog, &WordToPass, 2)) {
FreeDialogData(dialog);
return NULL;
}
- // italic?
+ /* italic? */
ToPass = NCM.lfMessageFont.lfItalic;
if (!AddDialogData(dialog, &ToPass, 1)) {
FreeDialogData(dialog);
return NULL;
}
- // charset?
+ /* charset? */
ToPass = NCM.lfMessageFont.lfCharSet;
if (!AddDialogData(dialog, &ToPass, 1)) {
FreeDialogData(dialog);
return NULL;
}
- // font typeface.
+ /* font typeface. */
if (!AddDialogString(dialog, NCM.lfMessageFont.lfFaceName)) {
FreeDialogData(dialog);
return NULL;
@@ -355,44 +355,44 @@ WIN_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
const int ButtonHeight = 26;
const int TextMargin = 16;
const int ButtonMargin = 12;
-
-
- // Jan 25th, 2013 - dant@fleetsa.com
- //
- //
- // I've tried to make this more reasonable, but I've run in to a lot
- // of nonsense.
- //
- // The original issue is the code was written in pixels and not
- // dialog units (DLUs). All DialogBox functions use DLUs, which
- // vary based on the selected font (yay).
- //
- // According to MSDN, the most reliable way to convert is via
- // MapDialogUnits, which requires an HWND, which we don't have
- // at time of template creation.
- //
- // We do however have:
- // The system font (DLU width 8 for me)
- // The font we select for the dialog (DLU width 6 for me)
- //
- // Based on experimentation, *neither* of these return the value
- // actually used. Stepping in to MapDialogUnits(), the conversion
- // is fairly clear, and uses 7 for me.
- //
- // As a result, some of this is hacky to ensure the sizing is
- // somewhat correct.
- //
- // Honestly, a long term solution is to use CreateWindow, not CreateDialog.
- //
-
- //
- // In order to get text dimensions we need to have a DC with the desired font.
- // I'm assuming a dialog box in SDL is rare enough we can to the create.
- //
+
+
+ /* Jan 25th, 2013 - dant@fleetsa.com
+ *
+ *
+ * I've tried to make this more reasonable, but I've run in to a lot
+ * of nonsense.
+ *
+ * The original issue is the code was written in pixels and not
+ * dialog units (DLUs). All DialogBox functions use DLUs, which
+ * vary based on the selected font (yay).
+ *
+ * According to MSDN, the most reliable way to convert is via
+ * MapDialogUnits, which requires an HWND, which we don't have
+ * at time of template creation.
+ *
+ * We do however have:
+ * The system font (DLU width 8 for me)
+ * The font we select for the dialog (DLU width 6 for me)
+ *
+ * Based on experimentation, *neither* of these return the value
+ * actually used. Stepping in to MapDialogUnits(), the conversion
+ * is fairly clear, and uses 7 for me.
+ *
+ * As a result, some of this is hacky to ensure the sizing is
+ * somewhat correct.
+ *
+ * Honestly, a long term solution is to use CreateWindow, not CreateDialog.
+ *
+
+ *
+ * In order to get text dimensions we need to have a DC with the desired font.
+ * I'm assuming a dialog box in SDL is rare enough we can to the create.
+ */
HDC FontDC = CreateCompatibleDC(0);
-
+
{
- // Create a duplicate of the font used in system message boxes.
+ /* Create a duplicate of the font used in system message boxes. */
LOGFONT lf;
NONCLIENTMETRICS NCM;
NCM.cbSize = sizeof(NCM);
@@ -401,40 +401,40 @@ WIN_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
DialogFont = CreateFontIndirect(&lf);
}
- // Select the font in to our DC
+ /* Select the font in to our DC */
SelectObject(FontDC, DialogFont);
{
- // Get the metrics to try and figure our DLU conversion.
+ /* Get the metrics to try and figure our DLU conversion. */
GetTextMetrics(FontDC, &TM);
s_BaseUnitsX = TM.tmAveCharWidth + 1;
s_BaseUnitsY = TM.tmHeight;
}
-
- // Measure the *pixel* size of the string.
+
+ /* Measure the *pixel* size of the string. */
wmessage = WIN_UTF8ToString(messageboxdata->message);
SDL_zero(TextSize);
Size.cx = DrawText(FontDC, wmessage, -1, &TextSize, DT_CALCRECT);
- // Add some padding for hangs, etc.
+ /* Add some padding for hangs, etc. */
TextSize.right += 2;
TextSize.bottom += 2;
- // Done with the DC, and the string
+ /* Done with the DC, and the string */
DeleteDC(FontDC);
SDL_free(wmessage);
- // Increase the size of the dialog by some border spacing around the text.
+ /* Increase the size of the dialog by some border spacing around the text. */
Size.cx = TextSize.right - TextSize.left;
Size.cy = TextSize.bottom - TextSize.top;
Size.cx += TextMargin * 2;
Size.cy += TextMargin * 2;
- // Ensure the size is wide enough for all of the buttons.
+ /* Ensure the size is wide enough for all of the buttons. */
if (Size.cx < messageboxdata->numbuttons * (ButtonWidth + ButtonMargin) + ButtonMargin)
Size.cx = messageboxdata->numbuttons * (ButtonWidth + ButtonMargin) + ButtonMargin;
- // Add vertical space for the buttons and border.
+ /* Add vertical space for the buttons and border. */
Size.cy += ButtonHeight + TextMargin;
dialog = CreateDialogData(Size.cx, Size.cy, messageboxdata->title);
@@ -447,7 +447,7 @@ WIN_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
return -1;
}
- // Align the buttons to the right/bottom.
+ /* Align the buttons to the right/bottom. */
x = Size.cx - ButtonWidth - ButtonMargin;
y = Size.cy - ButtonHeight - ButtonMargin;
for (i = 0; i < messageboxdata->numbuttons; ++i) {
diff --git a/src/video/windows/SDL_windowsmouse.c b/src/video/windows/SDL_windowsmouse.c
index d762bdf388..d61c8b6bb0 100644
--- a/src/video/windows/SDL_windowsmouse.c
+++ b/src/video/windows/SDL_windowsmouse.c
@@ -180,44 +180,44 @@ static int
WIN_SetRelativeMouseMode(SDL_bool enabled)
{
RAWINPUTDEVICE rawMouse = { 0x01, 0x02, 0, NULL }; /* Mouse: UsagePage = 1, Usage = 2 */
- HWND hWnd;
- hWnd = GetActiveWindow();
+ HWND hWnd;
+ hWnd = GetActiveWindow();
- rawMouse.hwndTarget = hWnd;
- if(!enabled) {
- rawMouse.dwFlags |= RIDEV_REMOVE;
- rawMouse.hwndTarget = NULL;
- }
+ rawMouse.hwndTarget = hWnd;
+ if(!enabled) {
+ rawMouse.dwFlags |= RIDEV_REMOVE;
+ rawMouse.hwndTarget = NULL;
+ }
- /* (Un)register raw input for mice */
- if(RegisterRawInputDevices(&rawMouse, 1, sizeof(RAWINPUTDEVICE)) == FALSE) {
+ /* (Un)register raw input for mice */
+ if(RegisterRawInputDevices(&rawMouse, 1, sizeof(RAWINPUTDEVICE)) == FALSE) {
- /* Only return an error when registering. If we unregister and fail, then
- it's probably that we unregistered twice. That's OK. */
- if(enabled) {
- return SDL_Unsupported();
- }
- }
+ /* Only return an error when registering. If we unregister and fail, then
+ it's probably that we unregistered twice. That's OK. */
+ if(enabled) {
+ return SDL_Unsupported();
+ }
+ }
- if(enabled) {
- LONG cx, cy;
- RECT rect;
- GetWindowRect(hWnd, &rect);
+ if(enabled) {
+ LONG cx, cy;
+ RECT rect;
+ GetWindowRect(hWnd, &rect);
- cx = (rect.left + rect.right) / 2;
- cy = (rect.top + rect.bottom) / 2;
+ cx = (rect.left + rect.right) / 2;
+ cy = (rect.top + rect.bottom) / 2;
- /* Make an absurdly small clip rect */
- rect.left = cx-1;
- rect.right = cx+1;
- rect.top = cy-1;
- rect.bottom = cy+1;
+ /* Make an absurdly small clip rect */
+ rect.left = cx-1;
+ rect.right = cx+1;
+ rect.top = cy-1;
+ rect.bottom = cy+1;
- ClipCursor(&rect);
- }
- else
- ClipCursor(NULL);
+ ClipCursor(&rect);
+ }
+ else
+ ClipCursor(NULL);
return 0;
}
@@ -228,7 +228,7 @@ WIN_InitMouse(_THIS)
SDL_Mouse *mouse = SDL_GetMouse();
mouse->CreateCursor = WIN_CreateCursor;
- mouse->CreateSystemCursor = WIN_CreateSystemCursor;
+ mouse->CreateSystemCursor = WIN_CreateSystemCursor;
mouse->ShowCursor = WIN_ShowCursor;
mouse->FreeCursor = WIN_FreeCursor;
mouse->WarpMouse = WIN_WarpMouse;
diff --git a/src/video/windows/SDL_windowsopengl.c b/src/video/windows/SDL_windowsopengl.c
index 97cbaffc42..573b08796d 100644
--- a/src/video/windows/SDL_windowsopengl.c
+++ b/src/video/windows/SDL_windowsopengl.c
@@ -503,7 +503,7 @@ WIN_GL_SetupWindow(_THIS, SDL_Window * window)
}
if (!pixel_format && _this->gl_config.accelerated != 1) {
iAttr[-1] = WGL_NO_ACCELERATION_ARB;
- pixel_format = WIN_GL_ChoosePixelFormatARB(_this, iAttribs, fAttribs);
+ pixel_format = WIN_GL_ChoosePixelFormatARB(_this, iAttribs, fAttribs);
}
if (!pixel_format) {
pixel_format = WIN_GL_ChoosePixelFormat(hdc, &pfd);
@@ -530,13 +530,13 @@ WIN_GL_CreateContext(_THIS, SDL_Window * window)
}
if (_this->gl_config.major_version < 3 &&
- _this->gl_config.profile_mask == 0 &&
- _this->gl_config.flags == 0) {
+ _this->gl_config.profile_mask == 0 &&
+ _this->gl_config.flags == 0) {
/* Create legacy context */
context = _this->gl_data->wglCreateContext(hdc);
- if( share_context != 0 ) {
+ if( share_context != 0 ) {
_this->gl_data->wglShareLists(share_context, context);
- }
+ }
} else {
PFNWGLCREATECONTEXTATTRIBSARBPROC wglCreateContextAttribsARB;
HGLRC temp_context = _this->gl_data->wglCreateContext(hdc);
@@ -558,27 +558,27 @@ WIN_GL_CreateContext(_THIS, SDL_Window * window)
SDL_SetError("GL 3.x is not supported");
context = temp_context;
} else {
- /* max 8 attributes plus terminator */
+ /* max 8 attributes plus terminator */
int attribs[9] = {
WGL_CONTEXT_MAJOR_VERSION_ARB, _this->gl_config.major_version,
WGL_CONTEXT_MINOR_VERSION_ARB, _this->gl_config.minor_version,
0
};
- int iattr = 4;
+ int iattr = 4;
- /* SDL profile bits match WGL profile bits */
- if( _this->gl_config.profile_mask != 0 ) {
- attribs[iattr++] = WGL_CONTEXT_PROFILE_MASK_ARB;
- attribs[iattr++] = _this->gl_config.profile_mask;
- }
+ /* SDL profile bits match WGL profile bits */
+ if( _this->gl_config.profile_mask != 0 ) {
+ attribs[iattr++] = WGL_CONTEXT_PROFILE_MASK_ARB;
+ attribs[iattr++] = _this->gl_config.profile_mask;
+ }
- /* SDL flags match WGL flags */
- if( _this->gl_config.flags != 0 ) {
- attribs[iattr++] = WGL_CONTEXT_FLAGS_ARB;
- attribs[iattr++] = _this->gl_config.flags;
- }
+ /* SDL flags match WGL flags */
+ if( _this->gl_config.flags != 0 ) {
+ attribs[iattr++] = WGL_CONTEXT_FLAGS_ARB;
+ attribs[iattr++] = _this->gl_config.flags;
+ }
- attribs[iattr++] = 0;
+ attribs[iattr++] = 0;
/* Create the GL 3.x context */
context = wglCreateContextAttribsARB(hdc, share_context, attribs);
diff --git a/src/video/windows/SDL_windowsshape.c b/src/video/windows/SDL_windowsshape.c
index 5e32861754..fdbcdfc76f 100644
--- a/src/video/windows/SDL_windowsshape.c
+++ b/src/video/windows/SDL_windowsshape.c
@@ -36,12 +36,12 @@ Win32_CreateShaper(SDL_Window * window) {
result->userx = result->usery = 0;
result->driverdata = (SDL_ShapeData*)SDL_malloc(sizeof(SDL_ShapeData));
((SDL_ShapeData*)result->driverdata)->mask_tree = NULL;
- //Put some driver-data here.
+ /* Put some driver-data here. */
window->shaper = result;
resized_properly = Win32_ResizeWindowShape(window);
if (resized_properly != 0)
return NULL;
-
+
return result;
}
@@ -49,15 +49,15 @@ void
CombineRectRegions(SDL_ShapeTree* node,void* closure) {
HRGN mask_region = *((HRGN*)closure),temp_region = NULL;
if(node->kind == OpaqueShape) {
- //Win32 API regions exclude their outline, so we widen the region by one pixel in each direction to include the real outline.
+ /* Win32 API regions exclude their outline, so we widen the region by one pixel in each direction to include the real outline. */
temp_region = CreateRectRgn(node->data.shape.x,node->data.shape.y,node->data.shape.x + node->data.shape.w + 1,node->data.shape.y + node->data.shape.h + 1);
if(mask_region != NULL) {
CombineRgn(mask_region,mask_region,temp_region,RGN_OR);
DeleteObject(temp_region);
- }
- else
+ }
+ else
*((HRGN*)closure) = temp_region;
- }
+ }
}
int
@@ -77,12 +77,12 @@ Win32_SetWindowShape(SDL_WindowShaper *shaper,SDL_Surface *shape,SDL_WindowShape
if(data->mask_tree != NULL)
SDL_FreeShapeTree(&data->mask_tree);
data->mask_tree = SDL_CalculateShapeTree(*shape_mode,shape);
-
+
SDL_TraverseShapeTree(data->mask_tree,&CombineRectRegions,&mask_region);
- SDL_assert(mask_region != NULL);
+ SDL_assert(mask_region != NULL);
SetWindowRgn(((SDL_WindowData *)(shaper->window->driverdata))->hwnd, mask_region, TRUE);
-
+
return 0;
}
@@ -95,15 +95,15 @@ Win32_ResizeWindowShape(SDL_Window *window) {
data = (SDL_ShapeData *)window->shaper->driverdata;
if (data == NULL)
return -1;
-
+
if(data->mask_tree != NULL)
SDL_FreeShapeTree(&data->mask_tree);
if(window->shaper->hasshape == SDL_TRUE) {
window->shaper->userx = window->x;
window->shaper->usery = window->y;
SDL_SetWindowPosition(window,-1000,-1000);
- }
-
+ }
+
return 0;
}
diff --git a/src/video/windows/SDL_windowsshape.h b/src/video/windows/SDL_windowsshape.h
index 3b73425e56..06aaea11e7 100644
--- a/src/video/windows/SDL_windowsshape.h
+++ b/src/video/windows/SDL_windowsshape.h
@@ -30,7 +30,7 @@
#include "../SDL_shape_internals.h"
typedef struct {
- SDL_ShapeTree *mask_tree;
+ SDL_ShapeTree *mask_tree;
} SDL_ShapeData;
extern SDL_WindowShaper* Win32_CreateShaper(SDL_Window * window);
diff --git a/src/video/windows/SDL_windowsvideo.c b/src/video/windows/SDL_windowsvideo.c
index 7b46d27517..883cafae4f 100644
--- a/src/video/windows/SDL_windowsvideo.c
+++ b/src/video/windows/SDL_windowsvideo.c
@@ -51,9 +51,9 @@ WIN_DeleteDevice(SDL_VideoDevice * device)
SDL_VideoData *data = (SDL_VideoData *) device->driverdata;
SDL_UnregisterApp();
- if (data->userDLL) {
- SDL_UnloadObject(data->userDLL);
- }
+ if (data->userDLL) {
+ SDL_UnloadObject(data->userDLL);
+ }
SDL_free(device->driverdata);
SDL_free(device);
@@ -83,12 +83,12 @@ WIN_CreateDevice(int devindex)
}
device->driverdata = data;
- data->userDLL = SDL_LoadObject("USER32.DLL");
- if (data->userDLL) {
- data->CloseTouchInputHandle = (BOOL (WINAPI *)( HTOUCHINPUT )) SDL_LoadFunction(data->userDLL, "CloseTouchInputHandle");
- data->GetTouchInputInfo = (BOOL (WINAPI *)( HTOUCHINPUT, UINT, PTOUCHINPUT, int )) SDL_LoadFunction(data->userDLL, "GetTouchInputInfo");
- data->RegisterTouchWindow = (BOOL (WINAPI *)( HWND, ULONG )) SDL_LoadFunction(data->userDLL, "RegisterTouchWindow");
- }
+ data->userDLL = SDL_LoadObject("USER32.DLL");
+ if (data->userDLL) {
+ data->CloseTouchInputHandle = (BOOL (WINAPI *)( HTOUCHINPUT )) SDL_LoadFunction(data->userDLL, "CloseTouchInputHandle");
+ data->GetTouchInputInfo = (BOOL (WINAPI *)( HTOUCHINPUT, UINT, PTOUCHINPUT, int )) SDL_LoadFunction(data->userDLL, "GetTouchInputInfo");
+ data->RegisterTouchWindow = (BOOL (WINAPI *)( HWND, ULONG )) SDL_LoadFunction(data->userDLL, "RegisterTouchWindow");
+ }
/* Set the function pointers */
device->VideoInit = WIN_VideoInit;
@@ -122,11 +122,11 @@ WIN_CreateDevice(int devindex)
device->UpdateWindowFramebuffer = WIN_UpdateWindowFramebuffer;
device->DestroyWindowFramebuffer = WIN_DestroyWindowFramebuffer;
device->OnWindowEnter = WIN_OnWindowEnter;
-
+
device->shape_driver.CreateShaper = Win32_CreateShaper;
device->shape_driver.SetWindowShape = Win32_SetWindowShape;
device->shape_driver.ResizeWindowShape = Win32_ResizeWindowShape;
-
+
#if SDL_VIDEO_OPENGL_WGL
device->GL_LoadLibrary = WIN_GL_LoadLibrary;
device->GL_GetProcAddress = WIN_GL_GetProcAddress;
diff --git a/src/video/windows/SDL_windowsvideo.h b/src/video/windows/SDL_windowsvideo.h
index 199a8ba8f1..0943708b57 100644
--- a/src/video/windows/SDL_windowsvideo.h
+++ b/src/video/windows/SDL_windowsvideo.h
@@ -51,8 +51,8 @@
#if WINVER < 0x0601
/* Touch input definitions */
-#define TWF_FINETOUCH 1
-#define TWF_WANTPALM 2
+#define TWF_FINETOUCH 1
+#define TWF_WANTPALM 2
#define TOUCHEVENTF_MOVE 0x0001
#define TOUCHEVENTF_DOWN 0x0002
@@ -61,16 +61,16 @@
DECLARE_HANDLE(HTOUCHINPUT);
typedef struct _TOUCHINPUT {
- LONG x;
- LONG y;
- HANDLE hSource;
- DWORD dwID;
- DWORD dwFlags;
- DWORD dwMask;
- DWORD dwTime;
- ULONG_PTR dwExtraInfo;
- DWORD cxContact;
- DWORD cyContact;
+ LONG x;
+ LONG y;
+ HANDLE hSource;
+ DWORD dwID;
+ DWORD dwFlags;
+ DWORD dwMask;
+ DWORD dwTime;
+ ULONG_PTR dwExtraInfo;
+ DWORD cxContact;
+ DWORD cyContact;
} TOUCHINPUT, *PTOUCHINPUT;
#endif /* WINVER < 0x0601 */
@@ -78,7 +78,7 @@ typedef struct _TOUCHINPUT {
typedef BOOL (*PFNSHFullScreen)(HWND, DWORD);
typedef void (*PFCoordTransform)(SDL_Window*, POINT*);
-typedef struct
+typedef struct
{
void **lpVtbl;
int refcount;
@@ -115,13 +115,13 @@ typedef struct SDL_VideoData
{
int render;
- DWORD clipboard_count;
+ DWORD clipboard_count;
- /* Touch input functions */
- void* userDLL;
- BOOL (WINAPI *CloseTouchInputHandle)( HTOUCHINPUT );
- BOOL (WINAPI *GetTouchInputInfo)( HTOUCHINPUT, UINT, PTOUCHINPUT, int );
- BOOL (WINAPI *RegisterTouchWindow)( HWND, ULONG );
+ /* Touch input functions */
+ void* userDLL;
+ BOOL (WINAPI *CloseTouchInputHandle)( HTOUCHINPUT );
+ BOOL (WINAPI *GetTouchInputInfo)( HTOUCHINPUT, UINT, PTOUCHINPUT, int );
+ BOOL (WINAPI *RegisterTouchWindow)( HWND, ULONG );
SDL_bool ime_com_initialized;
struct ITfThreadMgr *ime_threadmgr;
diff --git a/src/video/windows/SDL_windowswindow.c b/src/video/windows/SDL_windowswindow.c
index 97db15fb27..1e41182e41 100644
--- a/src/video/windows/SDL_windowswindow.c
+++ b/src/video/windows/SDL_windowswindow.c
@@ -201,7 +201,7 @@ WIN_CreateWindow(_THIS, SDL_Window * window)
DWORD style = STYLE_BASIC;
int x, y;
int w, h;
-
+
style |= GetWindowStyle(window);
/* Figure out what the window area will be */
@@ -352,7 +352,7 @@ WIN_SetWindowPositionInternal(_THIS, SDL_Window * window, UINT flags)
/* Figure out what the window area will be */
if ( SDL_ShouldAllowTopmost() && (window->flags & (SDL_WINDOW_FULLSCREEN|SDL_WINDOW_INPUT_FOCUS)) == (SDL_WINDOW_FULLSCREEN|SDL_WINDOW_INPUT_FOCUS )) {
- top = HWND_TOPMOST;
+ top = HWND_TOPMOST;
} else {
top = HWND_NOTOPMOST;
}
@@ -403,11 +403,11 @@ WIN_RaiseWindow(_THIS, SDL_Window * window)
HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd;
HWND top;
- if ( SDL_ShouldAllowTopmost() && (window->flags & (SDL_WINDOW_FULLSCREEN|SDL_WINDOW_INPUT_FOCUS)) == (SDL_WINDOW_FULLSCREEN|SDL_WINDOW_INPUT_FOCUS )) {
- top = HWND_TOPMOST;
- } else {
- top = HWND_NOTOPMOST;
- }
+ if ( SDL_ShouldAllowTopmost() && (window->flags & (SDL_WINDOW_FULLSCREEN|SDL_WINDOW_INPUT_FOCUS)) == (SDL_WINDOW_FULLSCREEN|SDL_WINDOW_INPUT_FOCUS )) {
+ top = HWND_TOPMOST;
+ } else {
+ top = HWND_NOTOPMOST;
+ }
SetWindowPos(hwnd, top, 0, 0, 0, 0, (SWP_NOMOVE | SWP_NOSIZE));
}
@@ -464,11 +464,11 @@ WIN_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display,
int x, y;
int w, h;
- if ( SDL_ShouldAllowTopmost() && (window->flags & (SDL_WINDOW_FULLSCREEN|SDL_WINDOW_INPUT_FOCUS)) == (SDL_WINDOW_FULLSCREEN|SDL_WINDOW_INPUT_FOCUS )) {
- top = HWND_TOPMOST;
- } else {
- top = HWND_NOTOPMOST;
- }
+ if ( SDL_ShouldAllowTopmost() && (window->flags & (SDL_WINDOW_FULLSCREEN|SDL_WINDOW_INPUT_FOCUS)) == (SDL_WINDOW_FULLSCREEN|SDL_WINDOW_INPUT_FOCUS )) {
+ top = HWND_TOPMOST;
+ } else {
+ top = HWND_NOTOPMOST;
+ }
style = GetWindowLong(hwnd, GWL_STYLE);
style &= ~STYLE_MASK;
@@ -550,22 +550,22 @@ WIN_SetWindowGrab(_THIS, SDL_Window * window, SDL_bool grabbed)
ClipCursor(NULL);
}
- if ( window->flags & SDL_WINDOW_FULLSCREEN )
- {
- HWND top;
- SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
- HWND hwnd = data->hwnd;
- UINT flags = SWP_NOMOVE | SWP_NOSIZE;
-
- if ( SDL_ShouldAllowTopmost() && (window->flags & SDL_WINDOW_INPUT_FOCUS ) ) {
- top = HWND_TOPMOST;
- } else {
- top = HWND_NOTOPMOST;
- flags |= SWP_NOZORDER;
- }
-
- SetWindowPos(hwnd, top, 0, 0, 0, 0, flags);
- }
+ if ( window->flags & SDL_WINDOW_FULLSCREEN )
+ {
+ HWND top;
+ SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
+ HWND hwnd = data->hwnd;
+ UINT flags = SWP_NOMOVE | SWP_NOSIZE;
+
+ if ( SDL_ShouldAllowTopmost() && (window->flags & SDL_WINDOW_INPUT_FOCUS ) ) {
+ top = HWND_TOPMOST;
+ } else {
+ top = HWND_NOTOPMOST;
+ flags |= SWP_NOZORDER;
+ }
+
+ SetWindowPos(hwnd, top, 0, 0, 0, 0, flags);
+ }
}
void
diff --git a/src/video/windows/wmmsg.h b/src/video/windows/wmmsg.h
index 0c36cf82c6..2cc7a843f6 100644
--- a/src/video/windows/wmmsg.h
+++ b/src/video/windows/wmmsg.h
@@ -1,5 +1,5 @@
-#define MAX_WMMSG (sizeof(wmtab)/sizeof(wmtab[0]))
+#define MAX_WMMSG (sizeof(wmtab)/sizeof(wmtab[0]))
char *wmtab[] = {
"WM_NULL",
diff --git a/src/video/x11/SDL_x11clipboard.c b/src/video/x11/SDL_x11clipboard.c
index 0c3b000e03..bdeb4da8a9 100644
--- a/src/video/x11/SDL_x11clipboard.c
+++ b/src/video/x11/SDL_x11clipboard.c
@@ -139,7 +139,7 @@ X11_GetClipboardText(_THIS)
if (!text) {
text = SDL_strdup("");
}
-
+
return text;
}
@@ -151,7 +151,7 @@ X11_HasClipboardText(_THIS)
if (text) {
result = (SDL_strlen(text)>0) ? SDL_TRUE : SDL_FALSE;
SDL_free(text);
- }
+ }
return result;
}
diff --git a/src/video/x11/SDL_x11dyn.c b/src/video/x11/SDL_x11dyn.c
index dbd7d7c13a..ab0eafb4da 100644
--- a/src/video/x11/SDL_x11dyn.c
+++ b/src/video/x11/SDL_x11dyn.c
@@ -107,9 +107,9 @@ X11_GetSym(const char *fnname, int *pHasModule)
/* Define all the function pointers and wrappers... */
#define SDL_X11_MODULE(modname)
#define SDL_X11_SYM(rc,fn,params,args,ret) \
- typedef rc (*SDL_DYNX11FN_##fn) params; \
- static SDL_DYNX11FN_##fn p##fn = NULL; \
- rc fn params { ret p##fn args ; }
+ typedef rc (*SDL_DYNX11FN_##fn) params; \
+ static SDL_DYNX11FN_##fn p##fn = NULL; \
+ rc fn params { ret p##fn args ; }
#include "SDL_x11sym.h"
#undef SDL_X11_MODULE
#undef SDL_X11_SYM
diff --git a/src/video/x11/SDL_x11events.c b/src/video/x11/SDL_x11events.c
index e26f64ca38..757abd93c7 100644
--- a/src/video/x11/SDL_x11events.c
+++ b/src/video/x11/SDL_x11events.c
@@ -42,29 +42,29 @@
#include <stdio.h>
typedef struct {
- unsigned char *data;
- int format, count;
- Atom type;
+ unsigned char *data;
+ int format, count;
+ Atom type;
} SDL_x11Prop;
/* Reads property
Must call XFree on results
*/
-static void X11_ReadProperty(SDL_x11Prop *p, Display *disp, Window w, Atom prop)
+static void X11_ReadProperty(SDL_x11Prop *p, Display *disp, Window w, Atom prop)
{
unsigned char *ret=NULL;
Atom type;
int fmt;
unsigned long count;
unsigned long bytes_left;
- int bytes_fetch = 0;
-
+ int bytes_fetch = 0;
+
do {
if (ret != 0) XFree(ret);
XGetWindowProperty(disp, w, prop, 0, bytes_fetch, False, AnyPropertyType, &type, &fmt, &count, &bytes_left, &ret);
bytes_fetch += bytes_left;
} while (bytes_left != 0);
-
+
p->data=ret;
p->format=fmt;
p->count=count;
@@ -124,7 +124,7 @@ static SDL_bool X11_IsWheelEvent(Display * display,XEvent * event,int * ticks)
/* according to the xlib docs, no specific mouse wheel events exist.
however, mouse wheel events trigger a button press and a button release
immediately. thus, checking if the same button was released at the same
- time as it was pressed, should be an adequate hack to derive a mouse
+ time as it was pressed, should be an adequate hack to derive a mouse
wheel event. */
XPeekEvent(display,&peekevent);
if ((peekevent.type == ButtonRelease) &&
@@ -501,7 +501,7 @@ X11_DispatchEvent(_THIS)
case ClientMessage:{
int xdnd_version=0;
-
+
if (xevent.xclient.message_type == videodata->XdndEnter) {
SDL_bool use_list = xevent.xclient.data.l[1] & 1;
data->xdnd_source = xevent.xclient.data.l[0];
@@ -519,7 +519,7 @@ X11_DispatchEvent(_THIS)
}
}
else if (xevent.xclient.message_type == videodata->XdndPosition) {
-
+
/* reply with status */
XClientMessageEvent m;
memset(&m, 0, sizeof(XClientMessageEvent));
@@ -533,7 +533,7 @@ X11_DispatchEvent(_THIS)
m.data.l[2] = 0; /* specify an empty rectangle */
m.data.l[3] = 0;
m.data.l[4] = videodata->XdndActionCopy; /* we only accept copying anyway */
-
+
XSendEvent(display, xevent.xclient.data.l[0], False, NoEventMask, (XEvent*)&m);
XFlush(display);
}
@@ -554,9 +554,9 @@ X11_DispatchEvent(_THIS)
} else {
/* convert */
if(xdnd_version >= 1) {
- XConvertSelection(display, videodata->XdndSelection, data->xdnd_req, videodata->PRIMARY, data->xwindow, xevent.xclient.data.l[2]);
+ XConvertSelection(display, videodata->XdndSelection, data->xdnd_req, videodata->PRIMARY, data->xwindow, xevent.xclient.data.l[2]);
} else {
- XConvertSelection(display, videodata->XdndSelection, data->xdnd_req, videodata->PRIMARY, data->xwindow, CurrentTime);
+ XConvertSelection(display, videodata->XdndSelection, data->xdnd_req, videodata->PRIMARY, data->xwindow, CurrentTime);
}
}
}
@@ -596,7 +596,7 @@ X11_DispatchEvent(_THIS)
break;
case MotionNotify:{
- SDL_Mouse *mouse = SDL_GetMouse();
+ SDL_Mouse *mouse = SDL_GetMouse();
if(!mouse->relative_mode) {
#ifdef DEBUG_MOTION
printf("window %p: X11 motion: %d,%d\n", xevent.xmotion.x, xevent.xmotion.y);
@@ -775,7 +775,7 @@ X11_DispatchEvent(_THIS)
/* read data */
SDL_x11Prop p;
X11_ReadProperty(&p, display, data->xwindow, videodata->PRIMARY);
-
+
if(p.format==8) {
SDL_bool expect_lf = SDL_FALSE;
char *start = NULL;
@@ -807,9 +807,9 @@ X11_DispatchEvent(_THIS)
scan++;
}
}
-
+
XFree(p.data);
-
+
/* send reply */
XClientMessageEvent m;
memset(&m, 0, sizeof(XClientMessageEvent));
@@ -822,13 +822,13 @@ X11_DispatchEvent(_THIS)
m.data.l[1] = 1;
m.data.l[2] = videodata->XdndActionCopy;
XSendEvent(display, data->xdnd_source, False, NoEventMask, (XEvent*)&m);
-
+
XSync(display, False);
-
+
} else {
videodata->selection_waiting = SDL_FALSE;
}
-
+
}
break;
@@ -915,7 +915,7 @@ X11_PumpEvents(_THIS)
data->screensaver_activity = now;
}
- }
+ }
/* Keep processing pending events */
while (X11_Pending(data->display)) {
diff --git a/src/video/x11/SDL_x11framebuffer.c b/src/video/x11/SDL_x11framebuffer.c
index 0c8febe4af..4dfe0d174d 100644
--- a/src/video/x11/SDL_x11framebuffer.c
+++ b/src/video/x11/SDL_x11framebuffer.c
@@ -111,7 +111,7 @@ X11_CreateWindowFramebuffer(_THIS, SDL_Window * window, Uint32 * format,
if (!shm_error) {
data->ximage = XShmCreateImage(display, data->visual,
vinfo.depth, ZPixmap,
- shminfo->shmaddr, shminfo,
+ shminfo->shmaddr, shminfo,
window->w, window->h);
if (!data->ximage) {
XShmDetach(display, shminfo);
@@ -133,7 +133,7 @@ X11_CreateWindowFramebuffer(_THIS, SDL_Window * window, Uint32 * format,
}
data->ximage = XCreateImage(display, data->visual,
- vinfo.depth, ZPixmap, 0, (char *)(*pixels),
+ vinfo.depth, ZPixmap, 0, (char *)(*pixels),
window->w, window->h, 32, 0);
if (!data->ximage) {
SDL_free(*pixels);
diff --git a/src/video/x11/SDL_x11messagebox.c b/src/video/x11/SDL_x11messagebox.c
index 47cac1c664..38867f06aa 100644
--- a/src/video/x11/SDL_x11messagebox.c
+++ b/src/video/x11/SDL_x11messagebox.c
@@ -700,8 +700,8 @@ X11_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
int fds[2];
int status = 0;
- /* Need to flush here in case someone has turned grab off and it hasn't gone through yet, etc. */
- XFlush(data->display);
+ /* Need to flush here in case someone has turned grab off and it hasn't gone through yet, etc. */
+ XFlush(data->display);
if (pipe(fds) == -1) {
return X11_ShowMessageBoxImpl(messageboxdata, buttonid); /* oh well. */
diff --git a/src/video/x11/SDL_x11modes.c b/src/video/x11/SDL_x11modes.c
index 60363b4919..b1da7370fc 100644
--- a/src/video/x11/SDL_x11modes.c
+++ b/src/video/x11/SDL_x11modes.c
@@ -577,7 +577,7 @@ X11_InitModes(_THIS)
unsigned long nitems, bytes_after;
Atom actual_type;
- if (props[i] == EDID) {
+ if (props[i] == EDID) {
if (XRRGetOutputProperty(data->display,
res->outputs[output], props[i],
0, 100, False, False,
diff --git a/src/video/x11/SDL_x11mouse.c b/src/video/x11/SDL_x11mouse.c
index 1d021b7b6a..441ecdfe37 100644
--- a/src/video/x11/SDL_x11mouse.c
+++ b/src/video/x11/SDL_x11mouse.c
@@ -194,8 +194,8 @@ X11_CreatePixmapCursor(SDL_Surface * surface, int hot_x, int hot_y)
surface->w, surface->h);
cursor = XCreatePixmapCursor(display, data_pixmap, mask_pixmap,
&fg, &bg, hot_x, hot_y);
- XFreePixmap(display, data_pixmap);
- XFreePixmap(display, mask_pixmap);
+ XFreePixmap(display, data_pixmap);
+ XFreePixmap(display, mask_pixmap);
return cursor;
}
@@ -236,8 +236,8 @@ X11_CreateSystemCursor(SDL_SystemCursor id)
default:
SDL_assert(0);
return NULL;
- // X Font Cursors reference:
- // http://tronche.com/gui/x/xlib/appendix/b/
+ /* X Font Cursors reference: */
+ /* http://tronche.com/gui/x/xlib/appendix/b/ */
case SDL_SYSTEM_CURSOR_ARROW: shape = XC_left_ptr; break;
case SDL_SYSTEM_CURSOR_IBEAM: shape = XC_xterm; break;
case SDL_SYSTEM_CURSOR_WAIT: shape = XC_watch; break;
@@ -336,7 +336,7 @@ X11_InitMouse(_THIS)
SDL_Mouse *mouse = SDL_GetMouse();
mouse->CreateCursor = X11_CreateCursor;
- mouse->CreateSystemCursor = X11_CreateSystemCursor;
+ mouse->CreateSystemCursor = X11_CreateSystemCursor;
mouse->ShowCursor = X11_ShowCursor;
mouse->FreeCursor = X11_FreeCursor;
mouse->WarpMouse = X11_WarpMouse;
diff --git a/src/video/x11/SDL_x11opengl.c b/src/video/x11/SDL_x11opengl.c
index 8e6614bef8..1e1078eff2 100644
--- a/src/video/x11/SDL_x11opengl.c
+++ b/src/video/x11/SDL_x11opengl.c
@@ -33,13 +33,13 @@
#if defined(__IRIX__)
/* IRIX doesn't have a GL library versioning system */
-#define DEFAULT_OPENGL "libGL.so"
+#define DEFAULT_OPENGL "libGL.so"
#elif defined(__MACOSX__)
-#define DEFAULT_OPENGL "/usr/X11R6/lib/libGL.1.dylib"
+#define DEFAULT_OPENGL "/usr/X11R6/lib/libGL.1.dylib"
#elif defined(__QNXNTO__)
-#define DEFAULT_OPENGL "libGL.so.3"
+#define DEFAULT_OPENGL "libGL.so.3"
#else
-#define DEFAULT_OPENGL "libGL.so.1"
+#define DEFAULT_OPENGL "libGL.so.1"
#endif
#ifndef GLX_NONE_EXT
@@ -118,13 +118,13 @@ typedef GLXContext(*PFNGLXCREATECONTEXTATTRIBSARBPROC) (Display * dpy,
#define OPENGL_REQUIRES_DLOPEN
#if defined(OPENGL_REQUIRES_DLOPEN) && defined(SDL_LOADSO_DLOPEN)
#include <dlfcn.h>
-#define GL_LoadObject(X) dlopen(X, (RTLD_NOW|RTLD_GLOBAL))
-#define GL_LoadFunction dlsym
-#define GL_UnloadObject dlclose
+#define GL_LoadObject(X) dlopen(X, (RTLD_NOW|RTLD_GLOBAL))
+#define GL_LoadFunction dlsym
+#define GL_UnloadObject dlclose
#else
-#define GL_LoadObject SDL_LoadObject
-#define GL_LoadFunction SDL_LoadFunction
-#define GL_UnloadObject SDL_UnloadObject
+#define GL_LoadObject SDL_LoadObject
+#define GL_LoadFunction SDL_LoadFunction
+#define GL_UnloadObject SDL_UnloadObject
#endif
static void X11_GL_InitExtensions(_THIS);
@@ -369,21 +369,21 @@ X11_GL_InitExtensions(_THIS)
}
/* glXChooseVisual and glXChooseFBConfig have some small differences in
- * the attribute encoding, it can be chosen with the for_FBConfig parameter.
+ * the attribute encoding, it can be chosen with the for_FBConfig parameter.
*/
-int
+int
X11_GL_GetAttributes(_THIS, Display * display, int screen, int * attribs, int size, Bool for_FBConfig)
{
int i = 0;
- const int MAX_ATTRIBUTES = 64;
+ const int MAX_ATTRIBUTES = 64;
- /* assert buffer is large enough to hold all SDL attributes. */
+ /* assert buffer is large enough to hold all SDL attributes. */
SDL_assert(size >= MAX_ATTRIBUTES);
/* Setup our GLX attributes according to the gl_config. */
if( for_FBConfig ) {
attribs[i++] = GLX_RENDER_TYPE;
- attribs[i++] = GLX_RGBA_BIT;
+ attribs[i++] = GLX_RGBA_BIT;
} else {
attribs[i++] = GLX_RGBA;
}
@@ -401,8 +401,8 @@ X11_GL_GetAttributes(_THIS, Display * display, int screen, int * attribs, int si
if (_this->gl_config.double_buffer) {
attribs[i++] = GLX_DOUBLEBUFFER;
- if( for_FBConfig )
- attribs[i++] = True;
+ if( for_FBConfig )
+ attribs[i++] = True;
}
attribs[i++] = GLX_DEPTH_SIZE;
@@ -435,8 +435,8 @@ X11_GL_GetAttributes(_THIS, Display * display, int screen, int * attribs, int si
if (_this->gl_config.stereo) {
attribs[i++] = GLX_STEREO;
- if( for_FBConfig )
- attribs[i++] = True;
+ if( for_FBConfig )
+ attribs[i++] = True;
}
if (_this->gl_config.multisamplebuffers) {
@@ -467,7 +467,7 @@ X11_GL_GetAttributes(_THIS, Display * display, int screen, int * attribs, int si
attribs[i++] = None;
SDL_assert(i <= MAX_ATTRIBUTES);
-
+
return i;
}
@@ -631,7 +631,7 @@ X11_GL_CreateContext(_THIS, SDL_Window * window)
}
XSync(display, False);
XSetErrorHandler(handler);
-
+
if (!context) {
SDL_SetError("Could not create GL context");
return NULL;
@@ -664,7 +664,7 @@ X11_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context)
return 0;
}
-/*
+/*
0 is a valid argument to glxSwapInterval(MESA|EXT) and setting it to 0
will undo the effect of a previous call with a value that is greater
than zero (or at least that is what the docs say). OTOH, 0 is an invalid
diff --git a/src/video/x11/SDL_x11opengles.c b/src/video/x11/SDL_x11opengles.c
index 279c58c348..218421b32c 100644
--- a/src/video/x11/SDL_x11opengles.c
+++ b/src/video/x11/SDL_x11opengles.c
@@ -32,11 +32,11 @@
#define DEFAULT_OGL_ES "libGLESv1_CM.so"
#define LOAD_FUNC(NAME) \
- *((void**)&_this->gles_data->NAME) = dlsym(handle, #NAME); \
- if (!_this->gles_data->NAME) \
- { \
- return SDL_SetError("Could not retrieve EGL function " #NAME); \
- }
+ *((void**)&_this->gles_data->NAME) = dlsym(handle, #NAME); \
+ if (!_this->gles_data->NAME) \
+ { \
+ return SDL_SetError("Could not retrieve EGL function " #NAME); \
+ }
/* GLES implementation of SDL OpenGL support */
@@ -54,7 +54,7 @@ X11_GLES_GetProcAddress(_THIS, const char *proc)
return retval;
}
}
-
+
handle = _this->gl_config.dll_handle;
#if defined(__OpenBSD__) && !defined(__ELF__)
#undef dlsym(x,y);
@@ -379,7 +379,7 @@ X11_GLES_SetSwapInterval(_THIS, int interval)
status = _this->gles_data->eglSwapInterval(_this->gles_data->egl_display, interval);
if (status == EGL_TRUE) {
_this->gles_data->egl_swapinterval = interval;
- return 0;
+ return 0;
}
return SDL_SetError("Unable to set the EGL swap interval");
@@ -406,7 +406,7 @@ void
X11_GLES_DeleteContext(_THIS, SDL_GLContext context)
{
/* Clean up GLES and EGL */
- if (!_this->gles_data) {
+ if (!_this->gles_data) {
return;
}
diff --git a/src/video/x11/SDL_x11shape.c b/src/video/x11/SDL_x11shape.c
index e1e68934e1..cea2807221 100644
--- a/src/video/x11/SDL_x11shape.c
+++ b/src/video/x11/SDL_x11shape.c
@@ -61,7 +61,7 @@ int
X11_ResizeWindowShape(SDL_Window* window) {
SDL_ShapeData* data = window->shaper->driverdata;
SDL_assert(data != NULL);
-
+
unsigned int bitmapsize = window->w / 8;
if(window->w % 8 > 0)
bitmapsize += 1;
@@ -76,14 +76,14 @@ X11_ResizeWindowShape(SDL_Window* window) {
}
}
memset(data->bitmap,0,data->bitmapsize);
-
+
window->shaper->userx = window->x;
window->shaper->usery = window->y;
SDL_SetWindowPosition(window,-1000,-1000);
-
+
return 0;
}
-
+
int
X11_SetWindowShape(SDL_WindowShaper *shaper,SDL_Surface *shape,SDL_WindowShapeMode *shape_mode) {
if(shaper == NULL || shape == NULL || shaper->driverdata == NULL)
@@ -95,13 +95,13 @@ X11_SetWindowShape(SDL_WindowShaper *shaper,SDL_Surface *shape,SDL_WindowShapeMo
if(shape->w != shaper->window->w || shape->h != shaper->window->h)
return -3;
SDL_ShapeData *data = shaper->driverdata;
-
+
/* Assume that shaper->alphacutoff already has a value, because SDL_SetWindowShape() should have given it one. */
SDL_CalculateShapeBitmap(shaper->mode,shape,data->bitmap,8);
-
+
SDL_WindowData *windowdata = (SDL_WindowData*)(shaper->window->driverdata);
Pixmap shapemask = XCreateBitmapFromData(windowdata->videodata->display,windowdata->xwindow,data->bitmap,shaper->window->w,shaper->window->h);
-
+
XShapeCombineMask(windowdata->videodata->display,windowdata->xwindow, ShapeBounding, 0, 0,shapemask, ShapeSet);
XSync(windowdata->videodata->display,False);
diff --git a/src/video/x11/SDL_x11shape.h b/src/video/x11/SDL_x11shape.h
index d7c3892831..96b4a8b0ab 100644
--- a/src/video/x11/SDL_x11shape.h
+++ b/src/video/x11/SDL_x11shape.h
@@ -28,13 +28,13 @@
#include "../SDL_sysvideo.h"
typedef struct {
- void* bitmap;
- Uint32 bitmapsize;
+ void* bitmap;
+ Uint32 bitmapsize;
} SDL_ShapeData;
extern SDL_Window* X11_CreateShapedWindow(const char *title,unsigned int x,unsigned int y,unsigned int w,unsigned int h,Uint32 flags);
extern SDL_WindowShaper* X11_CreateShaper(SDL_Window* window);
extern int X11_ResizeWindowShape(SDL_Window* window);
-extern int X11_SetWindowShape(SDL_WindowShaper *shaper,SDL_Surface *shape,SDL_WindowShapeMode *shapeMode);
+extern int X11_SetWindowShape(SDL_WindowShaper *shaper,SDL_Surface *shape,SDL_WindowShapeMode *shapeMode);
#endif /* _SDL_x11shape_h */
diff --git a/src/video/x11/SDL_x11video.c b/src/video/x11/SDL_x11video.c
index 4794241e9a..d12f87a7bc 100644
--- a/src/video/x11/SDL_x11video.c
+++ b/src/video/x11/SDL_x11video.c
@@ -32,7 +32,7 @@
#include "SDL_x11video.h"
#include "SDL_x11framebuffer.h"
#include "SDL_x11shape.h"
-#include "SDL_x11touch.h"
+#include "SDL_x11touch.h"
#include "SDL_x11xinput2.h"
#if SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2
diff --git a/src/video/x11/SDL_x11video.h b/src/video/x11/SDL_x11video.h
index 9411b7b7e1..68a0413263 100644
--- a/src/video/x11/SDL_x11video.h
+++ b/src/video/x11/SDL_x11video.h
@@ -110,9 +110,9 @@ typedef struct SDL_VideoData
Atom XdndDrop;
Atom XdndFinished;
Atom XdndSelection;
-
+
SDL_Scancode key_layout[256];
- SDL_bool selection_waiting;
+ SDL_bool selection_waiting;
#if SDL_USE_LIBDBUS
DBusConnection *dbus;
diff --git a/src/video/x11/SDL_x11window.c b/src/video/x11/SDL_x11window.c
index 6403ac4b43..eda47f7ef0 100644
--- a/src/video/x11/SDL_x11window.c
+++ b/src/video/x11/SDL_x11window.c
@@ -349,7 +349,7 @@ X11_CreateWindow(_THIS, SDL_Window * window)
if (window->flags & SDL_WINDOW_OPENGL) {
XVisualInfo *vinfo;
-#if SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2
+#if SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2
if (_this->gl_config.use_egl == 1) {
vinfo = X11_GLES_GetVisual(_this, display, screen);
} else
@@ -532,7 +532,7 @@ X11_CreateWindow(_THIS, SDL_Window * window)
PropModeReplace,
(unsigned char *)&_NET_WM_WINDOW_TYPE_NORMAL, 1);
-
+
{
Atom protocols[] = {
data->WM_DELETE_WINDOW, /* Allow window to be deleted by the WM */
@@ -565,7 +565,7 @@ X11_CreateWindow(_THIS, SDL_Window * window)
XdndAware = XInternAtom(display, "XdndAware", False);
XChangeProperty(display, w, XdndAware, XA_ATOM, 32,
PropModeReplace,
- (unsigned char*)&xdnd_version, 1);
+ (unsigned char*)&xdnd_version, 1);
XFlush(display);
@@ -836,7 +836,7 @@ X11_ShowWindow(_THIS, SDL_Window * window)
if (!X11_IsWindowMapped(_this, window)) {
XMapRaised(display, data->xwindow);
/* Blocking wait for "MapNotify" event.
- * We use XIfEvent because XWindowEvent takes a mask rather than a type,
+ * We use XIfEvent because XWindowEvent takes a mask rather than a type,
* and XCheckTypedWindowEvent doesn't block */
XIfEvent(display, &event, &isMapNotify, (XPointer)&data->xwindow);
XFlush(display);
@@ -853,7 +853,7 @@ X11_HideWindow(_THIS, SDL_Window * window)
if (X11_IsWindowMapped(_this, window)) {
XUnmapWindow(display, data->xwindow);
/* Blocking wait for "UnmapNotify" event */
- XIfEvent(display, &event, &isUnmapNotify, (XPointer)&data->xwindow);
+ XIfEvent(display, &event, &isUnmapNotify, (XPointer)&data->xwindow);
XFlush(display);
}
}
@@ -922,7 +922,7 @@ X11_MinimizeWindow(_THIS, SDL_Window * window)
SDL_DisplayData *displaydata =
(SDL_DisplayData *) SDL_GetDisplayForWindow(window)->driverdata;
Display *display = data->videodata->display;
-
+
XIconifyWindow(display, data->xwindow, displaydata->screen);
XFlush(display);
}
@@ -934,7 +934,7 @@ SetWindowActive(_THIS, SDL_Window * window)
SDL_DisplayData *displaydata =
(SDL_DisplayData *) SDL_GetDisplayForWindow(window)->driverdata;
Display *display = data->videodata->display;
- Atom _NET_ACTIVE_WINDOW = data->videodata->_NET_ACTIVE_WINDOW;
+ Atom _NET_ACTIVE_WINDOW = data->videodata->_NET_ACTIVE_WINDOW;
if (X11_IsWindowMapped(_this, window)) {
XEvent e;
@@ -945,13 +945,13 @@ SetWindowActive(_THIS, SDL_Window * window)
e.xclient.format = 32;
e.xclient.window = data->xwindow;
e.xclient.data.l[0] = 1; /* source indication. 1 = application */
- e.xclient.data.l[1] = CurrentTime;
- e.xclient.data.l[2] = 0;
+ e.xclient.data.l[1] = CurrentTime;
+ e.xclient.data.l[2] = 0;
XSendEvent(display, RootWindow(display, displaydata->screen), 0,
SubstructureNotifyMask | SubstructureRedirectMask, &e);
- XFlush(display);
+ XFlush(display);
}
}
@@ -959,7 +959,7 @@ void
X11_RestoreWindow(_THIS, SDL_Window * window)
{
SetWindowMaximized(_this, window, SDL_FALSE);
- SetWindowActive(_this, window);
+ SetWindowActive(_this, window);
X11_ShowWindow(_this, window);
}
diff --git a/src/video/x11/SDL_x11xinput2.c b/src/video/x11/SDL_x11xinput2.c
index 2bd466a540..1b86c67740 100644
--- a/src/video/x11/SDL_x11xinput2.c
+++ b/src/video/x11/SDL_x11xinput2.c
@@ -39,7 +39,7 @@ static int xinput2_multitouch_supported = 0;
/* Opcode returned XQueryExtension
* It will be used in event processing
* to know that the event came from
- * this extension */
+ * this extension */
static int xinput2_opcode;
static void parse_valuators(const double *input_values,unsigned char *mask,int mask_len,
@@ -61,7 +61,7 @@ static void parse_valuators(const double *input_values,unsigned char *mask,int m
}
#endif /* SDL_VIDEO_DRIVER_X11_XINPUT2 */
-void
+void
X11_InitXinput2(_THIS)
{
#if SDL_VIDEO_DRIVER_X11_XINPUT2
@@ -78,8 +78,8 @@ X11_InitXinput2(_THIS)
/*
* Initialize XInput 2
* According to http://who-t.blogspot.com/2009/05/xi2-recipes-part-1.html its better
- * to inform Xserver what version of Xinput we support.The server will store the version we support.
- * "As XI2 progresses it becomes important that you use this call as the server may treat the client
+ * to inform Xserver what version of Xinput we support.The server will store the version we support.
+ * "As XI2 progresses it becomes important that you use this call as the server may treat the client
* differently depending on the supported version".
*
* FIXME:event and err are not needed but if not passed XQueryExtension returns SegmentationFault
@@ -114,14 +114,14 @@ X11_InitXinput2(_THIS)
eventmask.mask = mask;
XISetMask(mask, XI_RawMotion);
-
+
if (XISelectEvents(data->display,DefaultRootWindow(data->display),&eventmask,1) != Success) {
- return;
+ return;
}
#endif
}
-int
+int
X11_HandleXinput2Event(SDL_VideoData *videodata,XGenericEventCookie *cookie)
{
#if SDL_VIDEO_DRIVER_X11_XINPUT2
@@ -172,7 +172,7 @@ X11_HandleXinput2Event(SDL_VideoData *videodata,XGenericEventCookie *cookie)
return 0;
}
-void
+void
X11_InitXinput2Multitouch(_THIS)
{
#if SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH
@@ -202,7 +202,7 @@ X11_InitXinput2Multitouch(_THIS)
#endif
}
-void
+void
X11_Xinput2SelectTouch(_THIS, SDL_Window *window)
{
#if SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH
@@ -222,13 +222,13 @@ X11_Xinput2SelectTouch(_THIS, SDL_Window *window)
XISetMask(mask, XI_TouchBegin);
XISetMask(mask, XI_TouchUpdate);
XISetMask(mask, XI_TouchEnd);
-
+
XISelectEvents(data->display,window_data->xwindow,&eventmask,1);
#endif
}
-int
+int
X11_Xinput2IsInitialized()
{
#if SDL_VIDEO_DRIVER_X11_XINPUT2
diff --git a/src/video/x11/SDL_x11xinput2.h b/src/video/x11/SDL_x11xinput2.h
index e74018f9c9..56a4b906c3 100644
--- a/src/video/x11/SDL_x11xinput2.h
+++ b/src/video/x11/SDL_x11xinput2.h
@@ -24,11 +24,11 @@
#define _SDL_x11xinput2_h
#ifndef SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS
-/*Define XGenericEventCookie as forward declaration when
+/*Define XGenericEventCookie as forward declaration when
*xinput2 is not available in order to compile*/
struct XGenericEventCookie;
typedef struct XGenericEventCookie XGenericEventCookie;
-#endif
+#endif
extern void X11_InitXinput2(_THIS);
extern void X11_InitXinput2Multitouch(_THIS);