diff --git a/include/eepp/window/cinputfinger.hpp b/include/eepp/window/cinputfinger.hpp index 5293a84d2..724c6c539 100644 --- a/include/eepp/window/cinputfinger.hpp +++ b/include/eepp/window/cinputfinger.hpp @@ -13,14 +13,14 @@ class cInputFinger { cInputFinger(); Int64 id; - Uint16 x; - Uint16 y; - Uint16 pressure; - Uint16 xdelta; - Uint16 ydelta; - Uint16 last_x; - Uint16 last_y; - Uint16 last_pressure; + Int32 x; + Int32 y; + float pressure; + float xdelta; + float ydelta; + Int32 last_x; + Int32 last_y; + float last_pressure; bool down; bool was_down; diff --git a/include/eepp/window/inputevent.hpp b/include/eepp/window/inputevent.hpp index 9794e7c80..b9e5b59a4 100644 --- a/include/eepp/window/inputevent.hpp +++ b/include/eepp/window/inputevent.hpp @@ -56,12 +56,11 @@ class InputEvent { Uint32 timestamp; Int64 touchId; /** The touch device id */ Int64 fingerId; /** The finger id */ - Uint8 state; /** The current button state */ - Uint16 x; /** The x coordinate of the touch */ - Uint16 y; /** The y coordinate of the touch */ - Int16 dx; /** Change in x coordinate during this motion event */ - Int16 dy; /** Change in y coordinate during this motion event */ - Uint16 pressure; /** The pressure of the touch */ + float x; /** The x coordinate of the touch. Normalized in the range 0...1 */ + float y; /** The y coordinate of the touch. Normalized in the range 0...1 */ + float dx; /** Change in x coordinate during this motion event. Normalized in the range 0...1 */ + float dy; /** Change in y coordinate during this motion event. Normalized in the range 0...1 */ + float pressure; /** The pressure of the touch. Normalized in the range 0...1 */ }; /** Keyboard text editing event */ diff --git a/projects/android-project/src/org/libsdl/app/SDLActivity.java b/projects/android-project/src/org/libsdl/app/SDLActivity.java index ec3cb233e..8035d11be 100644 --- a/projects/android-project/src/org/libsdl/app/SDLActivity.java +++ b/projects/android-project/src/org/libsdl/app/SDLActivity.java @@ -3,8 +3,8 @@ package org.libsdl.app; import javax.microedition.khronos.egl.EGL10; import javax.microedition.khronos.egl.EGLConfig; import javax.microedition.khronos.egl.EGLContext; -import javax.microedition.khronos.opengles.GL10; -import javax.microedition.khronos.egl.*; +import javax.microedition.khronos.egl.EGLDisplay; +import javax.microedition.khronos.egl.EGLSurface; import android.app.*; import android.content.*; @@ -17,52 +17,47 @@ import android.widget.AbsoluteLayout; import android.os.*; import android.util.Log; import android.graphics.*; -import android.text.method.*; -import android.text.*; import android.media.*; import android.hardware.*; -import android.content.pm.ApplicationInfo; -import android.content.pm.PackageManager; -import android.content.pm.PackageManager.NameNotFoundException; - -import java.lang.*; /** SDL Activity */ public class SDLActivity extends Activity { + private static final String TAG = "SDL"; // Keep track of the paused state - public static boolean mIsPaused; + public static boolean mIsPaused = false; // Main components - private static SDLActivity mSingleton; - private static SDLSurface mSurface; - private static View mTextEdit; - private static ViewGroup mLayout; + protected static SDLActivity mSingleton; + protected static SDLSurface mSurface; + protected static View mTextEdit; + protected static ViewGroup mLayout; // This is what SDL runs in. It invokes SDL_main(), eventually - private static Thread mSDLThread; + protected static Thread mSDLThread; // Audio - private static Thread mAudioThread; - private static AudioTrack mAudioTrack; + protected static Thread mAudioThread; + protected static AudioTrack mAudioTrack; - // EGL private objects - private static EGLContext mEGLContext; - private static EGLSurface mEGLSurface; - private static EGLDisplay mEGLDisplay; - private static EGLConfig mEGLConfig; - private static int mGLMajor, mGLMinor; + // EGL objects + protected static EGLContext mEGLContext; + protected static EGLSurface mEGLSurface; + protected static EGLDisplay mEGLDisplay; + protected static EGLConfig mEGLConfig; + protected static int mGLMajor, mGLMinor; // Load the .so static { - System.loadLibrary("openal"); + System.loadLibrary("openal"); System.loadLibrary("main"); } // Setup + @Override protected void onCreate(Bundle savedInstanceState) { //Log.v("SDL", "onCreate()"); super.onCreate(savedInstanceState); @@ -70,9 +65,6 @@ public class SDLActivity extends Activity { // So we can call stuff from static callbacks mSingleton = this; - // Keep track of the paused state - mIsPaused = false; - // Set up the surface mSurface = new SDLSurface(getApplication()); @@ -80,23 +72,31 @@ public class SDLActivity extends Activity { mLayout.addView(mSurface); setContentView(mLayout); - - SurfaceHolder holder = mSurface.getHolder(); } // Events - /*protected void onPause() { + @Override + protected void onPause() { Log.v("SDL", "onPause()"); super.onPause(); // Don't call SDLActivity.nativePause(); here, it will be called by SDLSurface::surfaceDestroyed } + @Override protected void onResume() { Log.v("SDL", "onResume()"); super.onResume(); // Don't call SDLActivity.nativeResume(); here, it will be called via SDLSurface::surfaceChanged->SDLActivity::startApp - }*/ + } + @Override + public void onLowMemory() { + Log.v("SDL", "onLowMemory()"); + super.onLowMemory(); + SDLActivity.nativeLowMemory(); + } + + @Override protected void onDestroy() { super.onDestroy(); Log.v("SDL", "onDestroy()"); @@ -121,36 +121,72 @@ public class SDLActivity extends Activity { static final int COMMAND_UNUSED = 2; static final int COMMAND_TEXTEDIT_HIDE = 3; - // Handler for the messages - Handler commandHandler = new Handler() { + protected static final int COMMAND_USER = 0x8000; + + /** + * This method is called by SDL if SDL did not handle a message itself. + * This happens if a received message contains an unsupported command. + * Method can be overwritten to handle Messages in a different class. + * @param command the command of the message. + * @param param the parameter of the message. May be null. + * @return if the message was handled in overridden method. + */ + protected boolean onUnhandledMessage(int command, Object param) { + return false; + } + + /** + * A Handler class for Messages from native SDL applications. + * It uses current Activities as target (e.g. for the title). + * static to prevent implicit references to enclosing object. + */ + protected static class SDLCommandHandler extends Handler { @Override public void handleMessage(Message msg) { + Context context = getContext(); + if (context == null) { + Log.e(TAG, "error handling message, getContext() returned null"); + return; + } switch (msg.arg1) { case COMMAND_CHANGE_TITLE: - setTitle((String)msg.obj); + if (context instanceof Activity) { + ((Activity) context).setTitle((String)msg.obj); + } else { + Log.e(TAG, "error handling message, getContext() returned no Activity"); + } break; case COMMAND_TEXTEDIT_HIDE: if (mTextEdit != null) { mTextEdit.setVisibility(View.GONE); - InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); + InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(mTextEdit.getWindowToken(), 0); } break; + + default: + if ((context instanceof SDLActivity) && !((SDLActivity) context).onUnhandledMessage(msg.arg1, msg.obj)) { + Log.e(TAG, "error handling message, command is " + msg.arg1); + } } } - }; + } + + // Handler for the messages + Handler commandHandler = new SDLCommandHandler(); // Send a message from the SDLMain thread - void sendCommand(int command, Object data) { + boolean sendCommand(int command, Object data) { Message msg = commandHandler.obtainMessage(); msg.arg1 = command; msg.obj = data; - commandHandler.sendMessage(msg); + return commandHandler.sendMessage(msg); } // C functions we call - public static native void nativeInit(String apkPath); + public static native void nativeInit(); + public static native void nativeLowMemory(); public static native void nativeQuit(); public static native void nativePause(); public static native void nativeResume(); @@ -166,21 +202,21 @@ public class SDLActivity extends Activity { // Java functions called from C - public static boolean createGLContext(int majorVersion, int minorVersion) { - return initEGL(majorVersion, minorVersion); + public static boolean createGLContext(int majorVersion, int minorVersion, int[] attribs) { + return initEGL(majorVersion, minorVersion, attribs); } public static void flipBuffers() { flipEGL(); } - public static void setActivityTitle(String title) { + public static boolean setActivityTitle(String title) { // Called from SDLMain() thread and can't directly affect the view - mSingleton.sendCommand(COMMAND_CHANGE_TITLE, title); + return mSingleton.sendCommand(COMMAND_CHANGE_TITLE, title); } - public static void sendMessage(int command, int param) { - mSingleton.sendCommand(command, Integer.valueOf(param)); + public static boolean sendMessage(int command, int param) { + return mSingleton.sendCommand(command, Integer.valueOf(param)); } public static Context getContext() { @@ -205,7 +241,7 @@ public class SDLActivity extends Activity { } } - static class ShowTextInputHandler implements Runnable { + static class ShowTextInputTask implements Runnable { /* * This is used to regulate the pan&scan method to have some offset from * the bottom edge of the input region and the top edge of an input @@ -215,13 +251,14 @@ public class SDLActivity extends Activity { public int x, y, w, h; - public ShowTextInputHandler(int x, int y, int w, int h) { + public ShowTextInputTask(int x, int y, int w, int h) { this.x = x; this.y = y; this.w = w; this.h = h; } + @Override public void run() { AbsoluteLayout.LayoutParams params = new AbsoluteLayout.LayoutParams( w, h + HEIGHT_PADDING, x, y); @@ -240,17 +277,16 @@ public class SDLActivity extends Activity { InputMethodManager imm = (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE); imm.showSoftInput(mTextEdit, 0); } - } - public static void showTextInput(int x, int y, int w, int h) { + public static boolean showTextInput(int x, int y, int w, int h) { // Transfer the task to the main thread as a Runnable - mSingleton.commandHandler.post(new ShowTextInputHandler(x, y, w, h)); + return mSingleton.commandHandler.post(new ShowTextInputTask(x, y, w, h)); } // EGL functions - public static boolean initEGL(int majorVersion, int minorVersion) { + public static boolean initEGL(int majorVersion, int minorVersion, int[] attribs) { try { if (SDLActivity.mEGLDisplay == null) { Log.v("SDL", "Starting up OpenGL ES " + majorVersion + "." + minorVersion); @@ -262,22 +298,9 @@ public class SDLActivity extends Activity { int[] version = new int[2]; egl.eglInitialize(dpy, version); - int EGL_OPENGL_ES_BIT = 1; - int EGL_OPENGL_ES2_BIT = 4; - int renderableType = 0; - if (majorVersion == 2) { - renderableType = EGL_OPENGL_ES2_BIT; - } else if (majorVersion == 1) { - renderableType = EGL_OPENGL_ES_BIT; - } - int[] configSpec = { - //EGL10.EGL_DEPTH_SIZE, 16, - EGL10.EGL_RENDERABLE_TYPE, renderableType, - EGL10.EGL_NONE - }; EGLConfig[] configs = new EGLConfig[1]; int[] num_config = new int[1]; - if (!egl.eglChooseConfig(dpy, configSpec, configs, 1, num_config) || num_config[0] == 0) { + if (!egl.eglChooseConfig(dpy, attribs, configs, 1, num_config) || num_config[0] == 0) { Log.e("SDL", "No EGL config available"); return false; } @@ -365,14 +388,12 @@ public class SDLActivity extends Activity { } // Audio - private static Object buf; - - public static Object audioInit(int sampleRate, boolean is16Bit, boolean isStereo, int desiredFrames) { + public static void audioInit(int sampleRate, boolean is16Bit, boolean isStereo, int desiredFrames) { int channelConfig = isStereo ? AudioFormat.CHANNEL_CONFIGURATION_STEREO : AudioFormat.CHANNEL_CONFIGURATION_MONO; int audioFormat = is16Bit ? AudioFormat.ENCODING_PCM_16BIT : AudioFormat.ENCODING_PCM_8BIT; int frameSize = (isStereo ? 2 : 1) * (is16Bit ? 2 : 1); - Log.v("SDL", "SDL audio: wanted " + (isStereo ? "stereo" : "mono") + " " + (is16Bit ? "16-bit" : "8-bit") + " " + ((float)sampleRate / 1000f) + "kHz, " + desiredFrames + " frames buffer"); + Log.v("SDL", "SDL audio: wanted " + (isStereo ? "stereo" : "mono") + " " + (is16Bit ? "16-bit" : "8-bit") + " " + (sampleRate / 1000f) + "kHz, " + desiredFrames + " frames buffer"); // Let the user pick a larger buffer if they really want -- but ye // gods they probably shouldn't, the minimums are horrifyingly high @@ -384,18 +405,12 @@ public class SDLActivity extends Activity { audioStartThread(); - Log.v("SDL", "SDL audio: got " + ((mAudioTrack.getChannelCount() >= 2) ? "stereo" : "mono") + " " + ((mAudioTrack.getAudioFormat() == AudioFormat.ENCODING_PCM_16BIT) ? "16-bit" : "8-bit") + " " + ((float)mAudioTrack.getSampleRate() / 1000f) + "kHz, " + desiredFrames + " frames buffer"); - - if (is16Bit) { - buf = new short[desiredFrames * (isStereo ? 2 : 1)]; - } else { - buf = new byte[desiredFrames * (isStereo ? 2 : 1)]; - } - return buf; + Log.v("SDL", "SDL audio: got " + ((mAudioTrack.getChannelCount() >= 2) ? "stereo" : "mono") + " " + ((mAudioTrack.getAudioFormat() == AudioFormat.ENCODING_PCM_16BIT) ? "16-bit" : "8-bit") + " " + (mAudioTrack.getSampleRate() / 1000f) + "kHz, " + desiredFrames + " frames buffer"); } public static void audioStartThread() { mAudioThread = new Thread(new Runnable() { + @Override public void run() { mAudioTrack.play(); nativeRunAudioThread(); @@ -437,7 +452,7 @@ public class SDLActivity extends Activity { // Nom nom } } else { - Log.w("SDL", "SDL audio: error return from write(short)"); + Log.w("SDL", "SDL audio: error return from write(byte)"); return; } } @@ -466,20 +481,10 @@ public class SDLActivity extends Activity { Simple nativeInit() runnable */ class SDLMain implements Runnable { + @Override public void run() { // Runs SDL_main() - // return apk file path (or null on error) - String apkFilePath = null; - ApplicationInfo appInfo = null; - PackageManager packMgmr = SDLActivity.getContext().getPackageManager(); - try { - appInfo = packMgmr.getApplicationInfo("org.libsdl.app", 0); - } catch (NameNotFoundException e) { - e.printStackTrace(); - throw new RuntimeException("Unable to locate assets, aborting..."); - } - apkFilePath = appInfo.sourceDir; - SDLActivity.nativeInit(apkFilePath); + SDLActivity.nativeInit(); //Log.v("SDL", "SDL thread terminated"); } @@ -496,10 +501,10 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback, View.OnKeyListener, View.OnTouchListener, SensorEventListener { // Sensors - private static SensorManager mSensorManager; + protected static SensorManager mSensorManager; // Keep track of the surface size to normalize touch events - private static float mWidth, mHeight; + protected static float mWidth, mHeight; // Startup public SDLSurface(Context context) { @@ -512,7 +517,7 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback, setOnKeyListener(this); setOnTouchListener(this); - mSensorManager = (SensorManager)context.getSystemService("sensor"); + mSensorManager = (SensorManager)context.getSystemService(Context.SENSOR_SERVICE); // Some arbitrary defaults to avoid a potential division by zero mWidth = 1.0f; @@ -520,6 +525,7 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback, } // Called when we have a valid drawing surface + @Override public void surfaceCreated(SurfaceHolder holder) { Log.v("SDL", "surfaceCreated()"); holder.setType(SurfaceHolder.SURFACE_TYPE_GPU); @@ -527,6 +533,7 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback, } // Called when we lose the surface + @Override public void surfaceDestroyed(SurfaceHolder holder) { Log.v("SDL", "surfaceDestroyed()"); if (!SDLActivity.mIsPaused) { @@ -537,11 +544,12 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback, } // Called when the surface is resized + @Override public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) { Log.v("SDL", "surfaceChanged()"); - int sdlFormat = 0x85151002; // SDL_PIXELFORMAT_RGB565 by default + int sdlFormat = 0x15151002; // SDL_PIXELFORMAT_RGB565 by default switch (format) { case PixelFormat.A_8: Log.v("SDL", "pixel format A_8"); @@ -554,40 +562,40 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback, break; case PixelFormat.RGBA_4444: Log.v("SDL", "pixel format RGBA_4444"); - sdlFormat = 0x85421002; // SDL_PIXELFORMAT_RGBA4444 + sdlFormat = 0x15421002; // SDL_PIXELFORMAT_RGBA4444 break; case PixelFormat.RGBA_5551: Log.v("SDL", "pixel format RGBA_5551"); - sdlFormat = 0x85441002; // SDL_PIXELFORMAT_RGBA5551 + sdlFormat = 0x15441002; // SDL_PIXELFORMAT_RGBA5551 break; case PixelFormat.RGBA_8888: Log.v("SDL", "pixel format RGBA_8888"); - sdlFormat = 0x86462004; // SDL_PIXELFORMAT_RGBA8888 + sdlFormat = 0x16462004; // SDL_PIXELFORMAT_RGBA8888 break; case PixelFormat.RGBX_8888: Log.v("SDL", "pixel format RGBX_8888"); - sdlFormat = 0x86262004; // SDL_PIXELFORMAT_RGBX8888 + sdlFormat = 0x16261804; // SDL_PIXELFORMAT_RGBX8888 break; case PixelFormat.RGB_332: Log.v("SDL", "pixel format RGB_332"); - sdlFormat = 0x84110801; // SDL_PIXELFORMAT_RGB332 + sdlFormat = 0x14110801; // SDL_PIXELFORMAT_RGB332 break; case PixelFormat.RGB_565: Log.v("SDL", "pixel format RGB_565"); - sdlFormat = 0x85151002; // SDL_PIXELFORMAT_RGB565 + sdlFormat = 0x15151002; // SDL_PIXELFORMAT_RGB565 break; case PixelFormat.RGB_888: Log.v("SDL", "pixel format RGB_888"); // Not sure this is right, maybe SDL_PIXELFORMAT_RGB24 instead? - sdlFormat = 0x86161804; // SDL_PIXELFORMAT_RGB888 + sdlFormat = 0x16161804; // SDL_PIXELFORMAT_RGB888 break; default: Log.v("SDL", "pixel format unknown " + format); break; } - mWidth = (float) width; - mHeight = (float) height; + mWidth = width; + mHeight = height; SDLActivity.onNativeResize(width, height, sdlFormat); Log.v("SDL", "Window size:" + width + "x"+height); @@ -595,12 +603,12 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback, } // unused + @Override public void onDraw(Canvas canvas) {} - - // Key events + @Override public boolean onKey(View v, int keyCode, KeyEvent event) { if (event.getAction() == KeyEvent.ACTION_DOWN) { @@ -618,12 +626,12 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback, } // Touch events + @Override public boolean onTouch(View v, MotionEvent event) { - { final int touchDevId = event.getDeviceId(); final int pointerCount = event.getPointerCount(); // touchId, pointerId, action, x, y, pressure - int actionPointerIndex = (event.getAction() & MotionEvent.ACTION_POINTER_ID_MASK) >> MotionEvent. ACTION_POINTER_ID_SHIFT; /* API 8: event.getActionIndex(); */ + int actionPointerIndex = (event.getAction() & MotionEvent.ACTION_POINTER_ID_MASK) >> MotionEvent.ACTION_POINTER_ID_SHIFT; /* API 8: event.getActionIndex(); */ int pointerFingerId = event.getPointerId(actionPointerIndex); int action = (event.getAction() & MotionEvent.ACTION_MASK); /* API 8: event.getActionMasked(); */ @@ -644,7 +652,6 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback, } else { SDLActivity.onNativeTouch(touchDevId, pointerFingerId, action, x, y, p); } - } return true; } @@ -661,10 +668,12 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback, } } + @Override public void onAccuracyChanged(Sensor sensor, int accuracy) { // TODO } + @Override public void onSensorChanged(SensorEvent event) { if (event.sensor.getType() == Sensor.TYPE_ACCELEROMETER) { SDLActivity.onNativeAccel(event.values[0] / SensorManager.GRAVITY_EARTH, @@ -693,6 +702,7 @@ class DummyEdit extends View implements View.OnKeyListener { return true; } + @Override public boolean onKey(View v, int keyCode, KeyEvent event) { // This handles the hardware keyboard input @@ -741,7 +751,9 @@ class SDLInputConnection extends BaseInputConnection { */ int keyCode = event.getKeyCode(); if (event.getAction() == KeyEvent.ACTION_DOWN) { - + if (event.isPrintingKey()) { + commitText(String.valueOf((char) event.getUnicodeChar()), 1); + } SDLActivity.onNativeKeyDown(keyCode); return true; } else if (event.getAction() == KeyEvent.ACTION_UP) { diff --git a/projects/linux/ee.creator.user b/projects/linux/ee.creator.user index bc0140274..919072144 100644 --- a/projects/linux/ee.creator.user +++ b/projects/linux/ee.creator.user @@ -1,6 +1,6 @@ - + ProjectExplorer.Project.ActiveTarget diff --git a/projects/linux/ee.files b/projects/linux/ee.files index deebcce41..defabaee0 100644 --- a/projects/linux/ee.files +++ b/projects/linux/ee.files @@ -558,7 +558,6 @@ ../../src/eepp/graphics/cframebufferfbo.hpp ../../src/eepp/graphics/renderer/rendererhelper.hpp ../../include/eepp/graphics/packerhelper.hpp -../../src/eepp/window/backend/SDL2/cbackendsdl.cpp ../../include/eepp/system/filesystem.hpp ../../src/eepp/system/filesystem.cpp ../../include/eepp/graphics/glhelper.hpp @@ -608,3 +607,4 @@ ../../src/eepp/helper/SOIL2/src/SOIL2/stbi_ext.h ../../src/eepp/audio/csoundfile.hpp ../../src/eepp/audio/openal.hpp +../../src/eepp/window/backend/SDL2/cbackendsdl2.cpp diff --git a/src/eepp/helper/SDL2/include/SDL.h b/src/eepp/helper/SDL2/include/SDL.h index e5d3ecd33..878ab1d3c 100644 --- a/src/eepp/helper/SDL2/include/SDL.h +++ b/src/eepp/helper/SDL2/include/SDL.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,49 +21,42 @@ /** * \file SDL.h - * + * * Main include header for the SDL library */ /** * \mainpage Simple DirectMedia Layer (SDL) - * + * * http://www.libsdl.org/ - * + * * \section intro_sec Introduction - * + * * This is the Simple DirectMedia Layer, a general API that provides low * level access to audio, keyboard, mouse, joystick, 3D hardware via OpenGL, * and 2D framebuffer across multiple platforms. - * + * * SDL is written in C, but works with C++ natively, and has bindings to * several other languages, including Ada, C#, Eiffel, Erlang, Euphoria, * Guile, Haskell, Java, Lisp, Lua, ML, Objective C, Pascal, Perl, PHP, * Pike, Pliant, Python, Ruby, and Smalltalk. - * - * This library is distributed under GNU LGPL version 2, which can be + * + * This library is distributed under the zlib license, which can be * found in the file "COPYING". This license allows you to use SDL - * freely in commercial programs as long as you link with the dynamic - * library. - * + * freely for any purpose as long as you retain the copyright notice. + * * The best way to learn how to use SDL is to check out the header files in * the "include" subdirectory and the programs in the "test" subdirectory. * The header files and test programs are well commented and always up to date. - * More documentation is available in HTML format in "docs/index.html", and - * a documentation wiki is available online at: - * http://www.libsdl.org/cgi/docwiki.cgi - * - * The test programs in the "test" subdirectory are in the public domain. - * - * Frequently asked questions are answered online: - * http://www.libsdl.org/faq.php - * + * More documentation and FAQs are available online at: + * http://wiki.libsdl.org/ + * * If you need help with the library, or just want to discuss SDL related * issues, you can join the developers mailing list: - * http://www.libsdl.org/mailing-list.php - * + * http://www.libsdl.org/mailing-list.php + * * Enjoy! - * Sam Lantinga (slouken@libsdl.org) + * Sam Lantinga (slouken@libsdl.org) */ #ifndef _SDL_H @@ -79,7 +72,9 @@ #include "SDL_endian.h" #include "SDL_error.h" #include "SDL_events.h" +#include "SDL_joystick.h" #include "SDL_gamecontroller.h" +#include "SDL_haptic.h" #include "SDL_hints.h" #include "SDL_loadso.h" #include "SDL_log.h" @@ -97,16 +92,14 @@ #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus -/* *INDENT-OFF* */ extern "C" { -/* *INDENT-ON* */ #endif /* As of version 0.5, SDL is loaded dynamically into the application */ /** * \name SDL_INIT_* - * + * * These are the flags which may be passed to SDL_Init(). You should * specify the subsystems which you will be using in your application. */ @@ -116,9 +109,12 @@ extern "C" { #define SDL_INIT_VIDEO 0x00000020 #define SDL_INIT_JOYSTICK 0x00000200 #define SDL_INIT_HAPTIC 0x00001000 -#define SDL_INIT_GAMECONTROLLER 0x00002000 /**< turn on game controller also implicitly does JOYSTICK */ +#define SDL_INIT_GAMECONTROLLER 0x00002000 /**< turn on game controller also implicitly does JOYSTICK */ #define SDL_INIT_NOPARACHUTE 0x00100000 /**< Don't catch fatal signals */ -#define SDL_INIT_EVERYTHING 0x0000FFFF +#define SDL_INIT_EVERYTHING ( \ + SDL_INIT_TIMER | SDL_INIT_AUDIO | SDL_INIT_VIDEO | \ + SDL_INIT_JOYSTICK | SDL_INIT_HAPTIC | SDL_INIT_GAMECONTROLLER \ + ) /*@}*/ /** @@ -141,7 +137,7 @@ extern DECLSPEC void SDLCALL SDL_QuitSubSystem(Uint32 flags); /** * This function returns a mask of the specified subsystems which have * previously been initialized. - * + * * If \c flags is 0, it returns a mask of all initialized subsystems. */ extern DECLSPEC Uint32 SDLCALL SDL_WasInit(Uint32 flags); @@ -154,9 +150,7 @@ extern DECLSPEC void SDLCALL SDL_Quit(void); /* Ends C function definitions when using C++ */ #ifdef __cplusplus -/* *INDENT-OFF* */ } -/* *INDENT-ON* */ #endif #include "close_code.h" diff --git a/src/eepp/helper/SDL2/include/SDL2 b/src/eepp/helper/SDL2/include/SDL2 deleted file mode 120000 index 945c9b46d..000000000 --- a/src/eepp/helper/SDL2/include/SDL2 +++ /dev/null @@ -1 +0,0 @@ -. \ No newline at end of file diff --git a/src/eepp/helper/SDL2/include/SDL_assert.h b/src/eepp/helper/SDL2/include/SDL_assert.h index ab5d3a0d3..5a6afc5e2 100644 --- a/src/eepp/helper/SDL2/include/SDL_assert.h +++ b/src/eepp/helper/SDL2/include/SDL_assert.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -27,9 +27,7 @@ #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus -/* *INDENT-OFF* */ extern "C" { -/* *INDENT-ON* */ #endif #ifndef SDL_ASSERT_LEVEL @@ -91,8 +89,6 @@ disable assertions. #define SDL_disabled_assert(condition) \ do { (void) sizeof ((condition)); } while (0) -#if (SDL_ASSERT_LEVEL > 0) - typedef enum { SDL_ASSERTION_RETRY, /**< Retry the assert immediately. */ @@ -113,6 +109,8 @@ typedef struct SDL_assert_data const struct SDL_assert_data *next; } SDL_assert_data; +#if (SDL_ASSERT_LEVEL > 0) + /* Never call this directly. Use the SDL_assert* macros. */ extern DECLSPEC SDL_assert_state SDLCALL SDL_ReportAssertion(SDL_assert_data *, const char *, @@ -187,7 +185,7 @@ typedef SDL_assert_state (SDLCALL *SDL_AssertionHandler)( * This callback is NOT reset to SDL's internal handler upon SDL_Quit()! * * \return SDL_assert_state value of how to handle the assertion failure. - * + * * \param handler Callback function, called when an assertion fails. * \param userdata A pointer passed to the callback as-is. */ @@ -230,9 +228,7 @@ extern DECLSPEC void SDLCALL SDL_ResetAssertionReport(void); /* Ends C function definitions when using C++ */ #ifdef __cplusplus -/* *INDENT-OFF* */ } -/* *INDENT-ON* */ #endif #include "close_code.h" diff --git a/src/eepp/helper/SDL2/include/SDL_atomic.h b/src/eepp/helper/SDL2/include/SDL_atomic.h index 4b737f548..78498ff9d 100644 --- a/src/eepp/helper/SDL2/include/SDL_atomic.h +++ b/src/eepp/helper/SDL2/include/SDL_atomic.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,25 +21,25 @@ /** * \file SDL_atomic.h - * + * * Atomic operations. - * + * * IMPORTANT: * If you are not an expert in concurrent lockless programming, you should * only be using the atomic lock and reference counting functions in this * file. In all other cases you should be protecting your data structures * with full mutexes. - * + * * The list of "safe" functions to use are: * SDL_AtomicLock() * SDL_AtomicUnlock() * SDL_AtomicIncRef() * SDL_AtomicDecRef() - * + * * Seriously, here be dragons! * ^^^^^^^^^^^^^^^^^^^^^^^^^^^ * - * You can find out a little more about lockless programming and the + * You can find out a little more about lockless programming and the * subtle issues that can arise here: * http://msdn.microsoft.com/en-us/library/ee418650%28v=vs.85%29.aspx * @@ -72,14 +72,12 @@ /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus -/* *INDENT-OFF* */ extern "C" { -/* *INDENT-ON* */ #endif /** * \name SDL AtomicLock - * + * * The atomic locks are efficient spinlocks using CPU instructions, * but are vulnerable to starvation and can spin forever if a thread * holding a lock has been terminated. For this reason you should @@ -98,7 +96,7 @@ typedef int SDL_SpinLock; /** * \brief Try to lock a spin lock by setting it to a non-zero value. - * + * * \param lock Points to the lock. * * \return SDL_TRUE if the lock succeeded, SDL_FALSE if the lock is already held. @@ -107,7 +105,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_AtomicTryLock(SDL_SpinLock *lock); /** * \brief Lock a spin lock by setting it to a non-zero value. - * + * * \param lock Points to the lock. */ extern DECLSPEC void SDLCALL SDL_AtomicLock(SDL_SpinLock *lock); @@ -126,7 +124,7 @@ extern DECLSPEC void SDLCALL SDL_AtomicUnlock(SDL_SpinLock *lock); * The compiler barrier prevents the compiler from reordering * reads and writes to globally visible variables across the call. */ -#ifdef _MSC_VER +#if defined(_MSC_VER) && (_MSC_VER > 1200) void _ReadWriteBarrier(void); #pragma intrinsic(_ReadWriteBarrier) #define SDL_CompilerBarrier() _ReadWriteBarrier() @@ -134,7 +132,7 @@ void _ReadWriteBarrier(void); #define SDL_CompilerBarrier() __asm__ __volatile__ ("" : : : "memory") #else #define SDL_CompilerBarrier() \ -({ SDL_SpinLock _tmp = 0; SDL_AtomicLock(&_tmp); SDL_AtomicUnlock(&_tmp); }) +{ SDL_SpinLock _tmp = 0; SDL_AtomicLock(&_tmp); SDL_AtomicUnlock(&_tmp); } #endif /* Platform specific optimized versions of the atomic functions, @@ -196,9 +194,8 @@ typedef struct { int value; } SDL_atomic_t; * \note If you don't know what this function is for, you shouldn't use it! */ #ifndef SDL_AtomicCAS -#define SDL_AtomicCAS SDL_AtomicCAS_ +extern DECLSPEC SDL_bool SDLCALL SDL_AtomicCAS(SDL_atomic_t *a, int oldval, int newval); #endif -extern DECLSPEC SDL_bool SDLCALL SDL_AtomicCAS_(SDL_atomic_t *a, int oldval, int newval); /** * \brief Set an atomic variable to a value. @@ -206,7 +203,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_AtomicCAS_(SDL_atomic_t *a, int oldval, int * \return The previous value of the atomic variable. */ #ifndef SDL_AtomicSet -static __inline__ int SDL_AtomicSet(SDL_atomic_t *a, int v) +SDL_FORCE_INLINE int SDL_AtomicSet(SDL_atomic_t *a, int v) { int value; do { @@ -220,7 +217,7 @@ static __inline__ int SDL_AtomicSet(SDL_atomic_t *a, int v) * \brief Get the value of an atomic variable */ #ifndef SDL_AtomicGet -static __inline__ int SDL_AtomicGet(SDL_atomic_t *a) +SDL_FORCE_INLINE int SDL_AtomicGet(SDL_atomic_t *a) { int value = a->value; SDL_CompilerBarrier(); @@ -236,7 +233,7 @@ static __inline__ int SDL_AtomicGet(SDL_atomic_t *a) * \note This same style can be used for any number operation */ #ifndef SDL_AtomicAdd -static __inline__ int SDL_AtomicAdd(SDL_atomic_t *a, int v) +SDL_FORCE_INLINE int SDL_AtomicAdd(SDL_atomic_t *a, int v) { int value; do { @@ -271,9 +268,8 @@ static __inline__ int SDL_AtomicAdd(SDL_atomic_t *a, int v) * \note If you don't know what this function is for, you shouldn't use it! */ #ifndef SDL_AtomicCASPtr -#define SDL_AtomicCASPtr SDL_AtomicCASPtr_ +extern DECLSPEC SDL_bool SDLCALL SDL_AtomicCASPtr(void* *a, void *oldval, void *newval); #endif -extern DECLSPEC SDL_bool SDLCALL SDL_AtomicCASPtr_(void* *a, void *oldval, void *newval); /** * \brief Set a pointer to a value atomically. @@ -281,7 +277,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_AtomicCASPtr_(void* *a, void *oldval, void * \return The previous value of the pointer. */ #ifndef SDL_AtomicSetPtr -static __inline__ void* SDL_AtomicSetPtr(void* *a, void* v) +SDL_FORCE_INLINE void* SDL_AtomicSetPtr(void* *a, void* v) { void* value; do { @@ -295,7 +291,7 @@ static __inline__ void* SDL_AtomicSetPtr(void* *a, void* v) * \brief Get the value of a pointer atomically. */ #ifndef SDL_AtomicGetPtr -static __inline__ void* SDL_AtomicGetPtr(void* *a) +SDL_FORCE_INLINE void* SDL_AtomicGetPtr(void* *a) { void* value = *a; SDL_CompilerBarrier(); @@ -306,9 +302,7 @@ static __inline__ void* SDL_AtomicGetPtr(void* *a) /* Ends C function definitions when using C++ */ #ifdef __cplusplus -/* *INDENT-OFF* */ } -/* *INDENT-ON* */ #endif #include "close_code.h" diff --git a/src/eepp/helper/SDL2/include/SDL_audio.h b/src/eepp/helper/SDL2/include/SDL_audio.h index c443ac1f7..9e5a997ae 100644 --- a/src/eepp/helper/SDL2/include/SDL_audio.h +++ b/src/eepp/helper/SDL2/include/SDL_audio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,7 +21,7 @@ /** * \file SDL_audio.h - * + * * Access to the raw audio mixing buffer for the SDL library. */ @@ -38,17 +38,15 @@ #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus -/* *INDENT-OFF* */ extern "C" { -/* *INDENT-ON* */ #endif /** * \brief Audio format flags. - * + * * These are what the 16 bits in SDL_AudioFormat currently mean... * (Unspecified bits are always zero). - * + * * \verbatim ++-----------------------sample is signed if set || @@ -60,7 +58,7 @@ extern "C" { || || || | | 15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00 \endverbatim - * + * * There are macros in SDL 2.0 and later to query these bits. */ typedef Uint16 SDL_AudioFormat; @@ -82,42 +80,38 @@ typedef Uint16 SDL_AudioFormat; #define SDL_AUDIO_ISLITTLEENDIAN(x) (!SDL_AUDIO_ISBIGENDIAN(x)) #define SDL_AUDIO_ISUNSIGNED(x) (!SDL_AUDIO_ISSIGNED(x)) -/** +/** * \name Audio format flags * * Defaults to LSB byte order. */ /*@{*/ -#define AUDIO_U8 0x0008 /**< Unsigned 8-bit samples */ -#define AUDIO_S8 0x8008 /**< Signed 8-bit samples */ -#define AUDIO_U16LSB 0x0010 /**< Unsigned 16-bit samples */ -#define AUDIO_S16LSB 0x8010 /**< Signed 16-bit samples */ -#define AUDIO_U16MSB 0x1010 /**< As above, but big-endian byte order */ -#define AUDIO_S16MSB 0x9010 /**< As above, but big-endian byte order */ -#define AUDIO_U16 AUDIO_U16LSB -#define AUDIO_S16 AUDIO_S16LSB +#define AUDIO_U8 0x0008 /**< Unsigned 8-bit samples */ +#define AUDIO_S8 0x8008 /**< Signed 8-bit samples */ +#define AUDIO_U16LSB 0x0010 /**< Unsigned 16-bit samples */ +#define AUDIO_S16LSB 0x8010 /**< Signed 16-bit samples */ +#define AUDIO_U16MSB 0x1010 /**< As above, but big-endian byte order */ +#define AUDIO_S16MSB 0x9010 /**< As above, but big-endian byte order */ +#define AUDIO_U16 AUDIO_U16LSB +#define AUDIO_S16 AUDIO_S16LSB /*@}*/ /** * \name int32 support - * - * New to SDL 1.3. */ /*@{*/ -#define AUDIO_S32LSB 0x8020 /**< 32-bit integer samples */ -#define AUDIO_S32MSB 0x9020 /**< As above, but big-endian byte order */ -#define AUDIO_S32 AUDIO_S32LSB +#define AUDIO_S32LSB 0x8020 /**< 32-bit integer samples */ +#define AUDIO_S32MSB 0x9020 /**< As above, but big-endian byte order */ +#define AUDIO_S32 AUDIO_S32LSB /*@}*/ /** * \name float32 support - * - * New to SDL 1.3. */ /*@{*/ -#define AUDIO_F32LSB 0x8120 /**< 32-bit floating point samples */ -#define AUDIO_F32MSB 0x9120 /**< As above, but big-endian byte order */ -#define AUDIO_F32 AUDIO_F32LSB +#define AUDIO_F32LSB 0x8120 /**< 32-bit floating point samples */ +#define AUDIO_F32MSB 0x9120 /**< As above, but big-endian byte order */ +#define AUDIO_F32 AUDIO_F32LSB /*@}*/ /** @@ -125,21 +119,21 @@ typedef Uint16 SDL_AudioFormat; */ /*@{*/ #if SDL_BYTEORDER == SDL_LIL_ENDIAN -#define AUDIO_U16SYS AUDIO_U16LSB -#define AUDIO_S16SYS AUDIO_S16LSB -#define AUDIO_S32SYS AUDIO_S32LSB -#define AUDIO_F32SYS AUDIO_F32LSB +#define AUDIO_U16SYS AUDIO_U16LSB +#define AUDIO_S16SYS AUDIO_S16LSB +#define AUDIO_S32SYS AUDIO_S32LSB +#define AUDIO_F32SYS AUDIO_F32LSB #else -#define AUDIO_U16SYS AUDIO_U16MSB -#define AUDIO_S16SYS AUDIO_S16MSB -#define AUDIO_S32SYS AUDIO_S32MSB -#define AUDIO_F32SYS AUDIO_F32MSB +#define AUDIO_U16SYS AUDIO_U16MSB +#define AUDIO_S16SYS AUDIO_S16MSB +#define AUDIO_S32SYS AUDIO_S32MSB +#define AUDIO_F32SYS AUDIO_F32MSB #endif /*@}*/ -/** +/** * \name Allow change flags - * + * * Which audio format changes are allowed when opening a device. */ /*@{*/ @@ -209,7 +203,7 @@ typedef struct SDL_AudioCVT /** * \name Driver discovery functions - * + * * These functions return the list of built in audio drivers, in the * order that they are normally initialized by default. */ @@ -220,9 +214,9 @@ extern DECLSPEC const char *SDLCALL SDL_GetAudioDriver(int index); /** * \name Initialization and cleanup - * + * * \internal These functions are used internally, and should not be used unless - * you have a specific need to specify the audio driver you want to + * you have a specific need to specify the audio driver you want to * use. You should normally use SDL_Init() or SDL_InitSubSystem(). */ /*@{*/ @@ -242,20 +236,20 @@ extern DECLSPEC const char *SDLCALL SDL_GetCurrentAudioDriver(void); * structure pointed to by \c obtained. If \c obtained is NULL, the audio * data passed to the callback function will be guaranteed to be in the * requested format, and will be automatically converted to the hardware - * audio format if necessary. This function returns -1 if it failed + * audio format if necessary. This function returns -1 if it failed * to open the audio device, or couldn't set up the audio thread. - * + * * When filling in the desired audio spec structure, * - \c desired->freq should be the desired audio frequency in samples-per- * second. * - \c desired->format should be the desired audio format. - * - \c desired->samples is the desired size of the audio buffer, in - * samples. This number should be a power of two, and may be adjusted by + * - \c desired->samples is the desired size of the audio buffer, in + * samples. This number should be a power of two, and may be adjusted by * the audio driver to a value more suitable for the hardware. Good values - * seem to range between 512 and 8096 inclusive, depending on the - * application and CPU speed. Smaller values yield faster response time, - * but can lead to underflow if the application is doing heavy processing - * and cannot fill the audio buffer in time. A stereo sample consists of + * seem to range between 512 and 8096 inclusive, depending on the + * application and CPU speed. Smaller values yield faster response time, + * but can lead to underflow if the application is doing heavy processing + * and cannot fill the audio buffer in time. A stereo sample consists of * both right and left channels in LR ordering. * Note that the number of samples is directly related to time by the * following formula: \code ms = (samples*1000)/freq \endcode @@ -271,7 +265,7 @@ extern DECLSPEC const char *SDLCALL SDL_GetCurrentAudioDriver(void); * and SDL_UnlockAudio() in your code. * - \c desired->userdata is passed as the first parameter to your callback * function. - * + * * The audio device starts out playing silence when it's opened, and should * be enabled for playing by calling \c SDL_PauseAudio(0) when you are ready * for your audio callback function to be called. Since the audio driver @@ -283,7 +277,7 @@ extern DECLSPEC int SDLCALL SDL_OpenAudio(SDL_AudioSpec * desired, /** * SDL Audio Device IDs. - * + * * A successful call to SDL_OpenAudio() is always device id 1, and legacy * SDL audio APIs assume you want this device ID. SDL_OpenAudioDevice() calls * always returns devices >= 2 on success. The legacy calls are good both @@ -299,7 +293,7 @@ typedef Uint32 SDL_AudioDeviceID; * not an error. For example, if SDL is set up to talk to a remote audio * server, it can't list every one available on the Internet, but it will * still allow a specific host to be specified to SDL_OpenAudioDevice(). - * + * * In many common cases, when this function returns a value <= 0, it can still * successfully open the default device (NULL for first argument of * SDL_OpenAudioDevice()). @@ -313,7 +307,7 @@ extern DECLSPEC int SDLCALL SDL_GetNumAudioDevices(int iscapture); * The values returned by this function reflect the latest call to * SDL_GetNumAudioDevices(); recall that function to redetect available * hardware. - * + * * The string returned by this function is UTF-8 encoded, read-only, and * managed internally. You are not to free it. If you need to keep the * string for any length of time, you should make your own copy of it, as it @@ -326,14 +320,14 @@ extern DECLSPEC const char *SDLCALL SDL_GetAudioDeviceName(int index, /** * Open a specific audio device. Passing in a device name of NULL requests * the most reasonable default (and is equivalent to calling SDL_OpenAudio()). - * + * * The device name is a UTF-8 string reported by SDL_GetAudioDeviceName(), but * some drivers allow arbitrary and driver-specific strings, such as a * hostname/IP address for a remote audio server, or a filename in the * diskaudio driver. - * + * * \return 0 on error, a valid device ID that is >= 2 on success. - * + * * SDL_OpenAudio(), unlike this function, always acts on device ID 1. */ extern DECLSPEC SDL_AudioDeviceID SDLCALL SDL_OpenAudioDevice(const char @@ -351,7 +345,7 @@ extern DECLSPEC SDL_AudioDeviceID SDLCALL SDL_OpenAudioDevice(const char /** * \name Audio state - * + * * Get the current audio state. */ /*@{*/ @@ -369,7 +363,7 @@ SDL_GetAudioDeviceStatus(SDL_AudioDeviceID dev); /** * \name Pause audio functions - * + * * These functions pause and unpause the audio callback processing. * They should be called with a parameter of 0 after opening the audio * device to start playing sound. This is so you can safely initialize @@ -387,18 +381,18 @@ extern DECLSPEC void SDLCALL SDL_PauseAudioDevice(SDL_AudioDeviceID dev, * that source if \c freesrc is non-zero. For example, to load a WAVE file, * you could do: * \code - * SDL_LoadWAV_RW(SDL_RWFromFile("sample.wav", "rb"), 1, ...); + * SDL_LoadWAV_RW(SDL_RWFromFile("sample.wav", "rb"), 1, ...); * \endcode * * If this function succeeds, it returns the given SDL_AudioSpec, * filled with the audio data format of the wave data, and sets * \c *audio_buf to a malloc()'d buffer containing the audio data, * and sets \c *audio_len to the length of that audio buffer, in bytes. - * You need to free the audio buffer with SDL_FreeWAV() when you are + * You need to free the audio buffer with SDL_FreeWAV() when you are * done with it. * - * This function returns NULL and sets the SDL error message if the - * wave file cannot be opened, uses an unknown data format, or is + * This function returns NULL and sets the SDL error message if the + * wave file cannot be opened, uses an unknown data format, or is * corrupt. Currently raw and MS-ADPCM WAVE files are supported. */ extern DECLSPEC SDL_AudioSpec *SDLCALL SDL_LoadWAV_RW(SDL_RWops * src, @@ -407,12 +401,12 @@ extern DECLSPEC SDL_AudioSpec *SDLCALL SDL_LoadWAV_RW(SDL_RWops * src, Uint8 ** audio_buf, Uint32 * audio_len); -/** +/** * Loads a WAV from a file. * Compatibility convenience function. */ #define SDL_LoadWAV(file, spec, audio_buf, audio_len) \ - SDL_LoadWAV_RW(SDL_RWFromFile(file, "rb"),1, spec,audio_buf,audio_len) + SDL_LoadWAV_RW(SDL_RWFromFile(file, "rb"),1, spec,audio_buf,audio_len) /** * This function frees data previously allocated with SDL_LoadWAV_RW() @@ -424,7 +418,7 @@ extern DECLSPEC void SDLCALL SDL_FreeWAV(Uint8 * audio_buf); * and rate, and initializes the \c cvt structure with information needed * by SDL_ConvertAudio() to convert a buffer of audio data from one format * to the other. - * + * * \return -1 if the format conversion is not supported, 0 if there's * no conversion needed, or 1 if the audio filter is set up. */ @@ -441,7 +435,7 @@ extern DECLSPEC int SDLCALL SDL_BuildAudioCVT(SDL_AudioCVT * cvt, * created an audio buffer \c cvt->buf, and filled it with \c cvt->len bytes of * audio data in the source format, this function will convert it in-place * to the desired format. - * + * * The data conversion may expand the size of the audio data, so the buffer * \c cvt->buf should be allocated after the \c cvt structure is initialized by * SDL_BuildAudioCVT(), and should be \c cvt->len*cvt->len_mult bytes long. @@ -471,9 +465,9 @@ extern DECLSPEC void SDLCALL SDL_MixAudioFormat(Uint8 * dst, /** * \name Audio lock functions - * + * * The lock manipulated by these functions protects the callback function. - * During a SDL_LockAudio()/SDL_UnlockAudio() pair, you can be guaranteed that + * During a SDL_LockAudio()/SDL_UnlockAudio() pair, you can be guaranteed that * the callback function is not running. Do not call these from the callback * function or you will cause deadlock. */ @@ -498,9 +492,7 @@ extern DECLSPEC int SDLCALL SDL_AudioDeviceConnected(SDL_AudioDeviceID dev); /* Ends C function definitions when using C++ */ #ifdef __cplusplus -/* *INDENT-OFF* */ } -/* *INDENT-ON* */ #endif #include "close_code.h" diff --git a/src/eepp/helper/SDL2/include/SDL_bits.h b/src/eepp/helper/SDL2/include/SDL_bits.h new file mode 100644 index 000000000..942bc1744 --- /dev/null +++ b/src/eepp/helper/SDL2/include/SDL_bits.h @@ -0,0 +1,90 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2013 Sam Lantinga + + 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 + appreciated but is not required. + 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. +*/ + +/** + * \file SDL_bits.h + * + * Functions for fiddling with bits and bitmasks. + */ + +#ifndef _SDL_bits_h +#define _SDL_bits_h + +#include "SDL_stdinc.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/** + * \file SDL_bits.h + */ + +/** + * Get the index of the most significant bit. Result is undefined when called + * with 0. This operation can also be stated as "count leading zeroes" and + * "log base 2". + * + * \return Index of the most significant bit. + */ +SDL_FORCE_INLINE Sint8 +SDL_MostSignificantBitIndex32(Uint32 x) +{ +#if defined(__GNUC__) && __GNUC__ >= 4 + /* Count Leading Zeroes builtin in GCC. + * http://gcc.gnu.org/onlinedocs/gcc-4.3.4/gcc/Other-Builtins.html + */ + return 31 - __builtin_clz(x); +#else + /* Based off of Bit Twiddling Hacks by Sean Eron Anderson + * , released in the public domain. + * http://graphics.stanford.edu/~seander/bithacks.html#IntegerLog + */ + const Uint32 b[] = {0x2, 0xC, 0xF0, 0xFF00, 0xFFFF0000}; + const Uint8 S[] = {1, 2, 4, 8, 16}; + + Uint8 msbIndex = 0; + int i; + + for (i = 4; i >= 0; i--) + { + if (x & b[i]) + { + x >>= S[i]; + msbIndex |= S[i]; + } + } + + return msbIndex; +#endif +} + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* _SDL_bits_h */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/eepp/helper/SDL2/include/SDL_blendmode.h b/src/eepp/helper/SDL2/include/SDL_blendmode.h index 54b24ae9a..37c475aef 100644 --- a/src/eepp/helper/SDL2/include/SDL_blendmode.h +++ b/src/eepp/helper/SDL2/include/SDL_blendmode.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,7 +21,7 @@ /** * \file SDL_blendmode.h - * + * * Header file declaring the SDL_BlendMode enumeration */ @@ -31,9 +31,7 @@ #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus -/* *INDENT-OFF* */ extern "C" { -/* *INDENT-ON* */ #endif /** @@ -49,9 +47,7 @@ typedef enum /* Ends C function definitions when using C++ */ #ifdef __cplusplus -/* *INDENT-OFF* */ } -/* *INDENT-ON* */ #endif #include "close_code.h" diff --git a/src/eepp/helper/SDL2/include/SDL_clipboard.h b/src/eepp/helper/SDL2/include/SDL_clipboard.h index 8a4d1b382..1f5742d16 100644 --- a/src/eepp/helper/SDL2/include/SDL_clipboard.h +++ b/src/eepp/helper/SDL2/include/SDL_clipboard.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -33,9 +33,7 @@ #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus -/* *INDENT-OFF* */ extern "C" { -/* *INDENT-ON* */ #endif /* Function prototypes */ @@ -64,9 +62,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasClipboardText(void); /* Ends C function definitions when using C++ */ #ifdef __cplusplus -/* *INDENT-OFF* */ } -/* *INDENT-ON* */ #endif #include "close_code.h" diff --git a/src/eepp/helper/SDL2/include/SDL_config.h b/src/eepp/helper/SDL2/include/SDL_config.h index 43f314a2e..7440940ad 100644 --- a/src/eepp/helper/SDL2/include/SDL_config.h +++ b/src/eepp/helper/SDL2/include/SDL_config.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -27,18 +27,18 @@ /** * \file SDL_config.h */ - + /* Add any platform that doesn't build using the configure system. */ #if defined(__WIN32__) #include "SDL_config_windows.h" #elif defined(__MACOSX__) #include "SDL_config_macosx.h" -#elif defined(__IPHONEOS__) +#elif defined(__IPHONEOS__) #include "SDL_config_iphoneos.h" #elif defined(__ANDROID__) #include "SDL_config_android.h" -#elif defined(__NINTENDODS__) -#include "SDL_config_nintendods.h" +#elif defined(__PSP__) +#include "SDL_config_psp.h" #else /* This is a minimal configuration just to get SDL running on new platforms */ #include "SDL_config_minimal.h" diff --git a/src/eepp/helper/SDL2/include/SDL_config.h.cmake b/src/eepp/helper/SDL2/include/SDL_config.h.cmake index d5ae1d815..c3b9bc708 100644 --- a/src/eepp/helper/SDL2/include/SDL_config.h.cmake +++ b/src/eepp/helper/SDL2/include/SDL_config.h.cmake @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -66,6 +66,7 @@ #cmakedefine HAVE_ALTIVEC_H 1 #cmakedefine HAVE_PTHREAD_NP_H 1 #cmakedefine HAVE_LIBUDEV_H 1 +#cmakedefine HAVE_DBUS_DBUS_H 1 /* C library functions */ #cmakedefine HAVE_MALLOC 1 @@ -194,7 +195,6 @@ #cmakedefine SDL_AUDIO_DRIVER_ESD_DYNAMIC @SDL_AUDIO_DRIVER_ESD_DYNAMIC@ #cmakedefine SDL_AUDIO_DRIVER_NAS @SDL_AUDIO_DRIVER_NAS@ #cmakedefine SDL_AUDIO_DRIVER_NAS_DYNAMIC @SDL_AUDIO_DRIVER_NAS_DYNAMIC@ -#cmakedefine SDL_AUDIO_DRIVER_NDS @SDL_AUDIO_DRIVER_NDS@ #cmakedefine SDL_AUDIO_DRIVER_OSS @SDL_AUDIO_DRIVER_OSS@ #cmakedefine SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H @SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H@ #cmakedefine SDL_AUDIO_DRIVER_PAUDIO @SDL_AUDIO_DRIVER_PAUDIO@ @@ -212,7 +212,6 @@ #cmakedefine SDL_JOYSTICK_DUMMY @SDL_JOYSTICK_DUMMY@ #cmakedefine SDL_JOYSTICK_IOKIT @SDL_JOYSTICK_IOKIT@ #cmakedefine SDL_JOYSTICK_LINUX @SDL_JOYSTICK_LINUX@ -#cmakedefine SDL_JOYSTICK_NDS @SDL_JOYSTICK_NDS@ #cmakedefine SDL_JOYSTICK_WINMM @SDL_JOYSTICK_WINMM@ #cmakedefine SDL_JOYSTICK_USBHID @SDL_JOYSTICK_USBHID@ #cmakedefine SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H @SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H@ @@ -230,7 +229,6 @@ /* Enable various threading systems */ #cmakedefine SDL_THREAD_BEOS @SDL_THREAD_BEOS@ -#cmakedefine SDL_THREAD_NDS @SDL_THREAD_NDS@ #cmakedefine SDL_THREAD_PTHREAD @SDL_THREAD_PTHREAD@ #cmakedefine SDL_THREAD_PTHREAD_RECURSIVE_MUTEX @SDL_THREAD_PTHREAD_RECURSIVE_MUTEX@ #cmakedefine SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP @SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP@ @@ -239,7 +237,6 @@ /* Enable various timer systems */ #cmakedefine SDL_TIMER_BEOS @SDL_TIMER_BEOS@ #cmakedefine SDL_TIMER_DUMMY @SDL_TIMER_DUMMY@ -#cmakedefine SDL_TIMER_NDS @SDL_TIMER_NDS@ #cmakedefine SDL_TIMER_UNIX @SDL_TIMER_UNIX@ #cmakedefine SDL_TIMER_WINDOWS @SDL_TIMER_WINDOWS@ #cmakedefine SDL_TIMER_WINCE @SDL_TIMER_WINCE@ @@ -250,7 +247,6 @@ #cmakedefine SDL_VIDEO_DRIVER_DIRECTFB @SDL_VIDEO_DRIVER_DIRECTFB@ #cmakedefine SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC @SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC@ #cmakedefine SDL_VIDEO_DRIVER_DUMMY @SDL_VIDEO_DRIVER_DUMMY@ -#cmakedefine SDL_VIDEO_DRIVER_NDS @SDL_VIDEO_DRIVER_NDS@ #cmakedefine SDL_VIDEO_DRIVER_WINDOWS @SDL_VIDEO_DRIVER_WINDOWS@ #cmakedefine SDL_VIDEO_DRIVER_X11 @SDL_VIDEO_DRIVER_X11@ #cmakedefine SDL_VIDEO_DRIVER_X11_DYNAMIC @SDL_VIDEO_DRIVER_X11_DYNAMIC@ @@ -294,7 +290,6 @@ #cmakedefine SDL_POWER_WINDOWS @SDL_POWER_WINDOWS@ #cmakedefine SDL_POWER_MACOSX @SDL_POWER_MACOSX@ #cmakedefine SDL_POWER_BEOS @SDL_POWER_BEOS@ -#cmakedefine SDL_POWER_NINTENDODS @SDL_POWER_NINTENDODS@ #cmakedefine SDL_POWER_HARDWIRED @SDL_POWER_HARDWIRED@ /* Enable assembly routines */ diff --git a/src/eepp/helper/SDL2/include/SDL_config.h.in b/src/eepp/helper/SDL2/include/SDL_config.h.in index bcf443d48..bd2be4b2f 100644 --- a/src/eepp/helper/SDL2/include/SDL_config.h.in +++ b/src/eepp/helper/SDL2/include/SDL_config.h.in @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -71,6 +71,7 @@ #undef HAVE_ALTIVEC_H #undef HAVE_PTHREAD_NP_H #undef HAVE_LIBUDEV_H +#undef HAVE_DBUS_DBUS_H /* C library functions */ #undef HAVE_MALLOC @@ -197,7 +198,6 @@ #undef SDL_AUDIO_DRIVER_ESD_DYNAMIC #undef SDL_AUDIO_DRIVER_NAS #undef SDL_AUDIO_DRIVER_NAS_DYNAMIC -#undef SDL_AUDIO_DRIVER_NDS #undef SDL_AUDIO_DRIVER_OSS #undef SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H #undef SDL_AUDIO_DRIVER_PAUDIO @@ -215,7 +215,6 @@ #undef SDL_JOYSTICK_DUMMY #undef SDL_JOYSTICK_IOKIT #undef SDL_JOYSTICK_LINUX -#undef SDL_JOYSTICK_NDS #undef SDL_JOYSTICK_WINMM #undef SDL_JOYSTICK_USBHID #undef SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H @@ -233,7 +232,6 @@ /* Enable various threading systems */ #undef SDL_THREAD_BEOS -#undef SDL_THREAD_NDS #undef SDL_THREAD_PTHREAD #undef SDL_THREAD_PTHREAD_RECURSIVE_MUTEX #undef SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP @@ -242,7 +240,6 @@ /* Enable various timer systems */ #undef SDL_TIMER_BEOS #undef SDL_TIMER_DUMMY -#undef SDL_TIMER_NDS #undef SDL_TIMER_UNIX #undef SDL_TIMER_WINDOWS @@ -252,7 +249,6 @@ #undef SDL_VIDEO_DRIVER_DIRECTFB #undef SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC #undef SDL_VIDEO_DRIVER_DUMMY -#undef SDL_VIDEO_DRIVER_NDS #undef SDL_VIDEO_DRIVER_WINDOWS #undef SDL_VIDEO_DRIVER_X11 #undef SDL_VIDEO_DRIVER_X11_DYNAMIC @@ -296,7 +292,6 @@ #undef SDL_POWER_WINDOWS #undef SDL_POWER_MACOSX #undef SDL_POWER_BEOS -#undef SDL_POWER_NINTENDODS #undef SDL_POWER_HARDWIRED /* Enable assembly routines */ diff --git a/src/eepp/helper/SDL2/include/SDL_config_android.h b/src/eepp/helper/SDL2/include/SDL_config_android.h index 2a8588f23..bbc40b4a9 100644 --- a/src/eepp/helper/SDL2/include/SDL_config_android.h +++ b/src/eepp/helper/SDL2/include/SDL_config_android.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -26,101 +26,101 @@ /** * \file SDL_config_android.h - * + * * This is a configuration that can be used to build SDL for Android */ #include -#define HAVE_ALLOCA_H 1 -#define HAVE_SYS_TYPES_H 1 -#define HAVE_STDIO_H 1 -#define STDC_HEADERS 1 -#define HAVE_STRING_H 1 -#define HAVE_INTTYPES_H 1 -#define HAVE_STDINT_H 1 -#define HAVE_CTYPE_H 1 -#define HAVE_MATH_H 1 -#define HAVE_SIGNAL_H 1 +#define HAVE_ALLOCA_H 1 +#define HAVE_SYS_TYPES_H 1 +#define HAVE_STDIO_H 1 +#define STDC_HEADERS 1 +#define HAVE_STRING_H 1 +#define HAVE_INTTYPES_H 1 +#define HAVE_STDINT_H 1 +#define HAVE_CTYPE_H 1 +#define HAVE_MATH_H 1 +#define HAVE_SIGNAL_H 1 /* C library functions */ -#define HAVE_MALLOC 1 -#define HAVE_CALLOC 1 -#define HAVE_REALLOC 1 -#define HAVE_FREE 1 -#define HAVE_ALLOCA 1 -#define HAVE_GETENV 1 -#define HAVE_SETENV 1 -#define HAVE_PUTENV 1 -#define HAVE_SETENV 1 -#define HAVE_UNSETENV 1 -#define HAVE_QSORT 1 -#define HAVE_ABS 1 -#define HAVE_BCOPY 1 -#define HAVE_MEMSET 1 -#define HAVE_MEMCPY 1 -#define HAVE_MEMMOVE 1 -#define HAVE_MEMCMP 1 -#define HAVE_STRLEN 1 -#define HAVE_STRLCPY 1 -#define HAVE_STRLCAT 1 -#define HAVE_STRDUP 1 -#define HAVE_STRCHR 1 -#define HAVE_STRRCHR 1 -#define HAVE_STRSTR 1 -#define HAVE_STRTOL 1 -#define HAVE_STRTOUL 1 -#define HAVE_STRTOLL 1 -#define HAVE_STRTOULL 1 -#define HAVE_STRTOD 1 -#define HAVE_ATOI 1 -#define HAVE_ATOF 1 -#define HAVE_STRCMP 1 -#define HAVE_STRNCMP 1 -#define HAVE_STRCASECMP 1 +#define HAVE_MALLOC 1 +#define HAVE_CALLOC 1 +#define HAVE_REALLOC 1 +#define HAVE_FREE 1 +#define HAVE_ALLOCA 1 +#define HAVE_GETENV 1 +#define HAVE_SETENV 1 +#define HAVE_PUTENV 1 +#define HAVE_SETENV 1 +#define HAVE_UNSETENV 1 +#define HAVE_QSORT 1 +#define HAVE_ABS 1 +#define HAVE_BCOPY 1 +#define HAVE_MEMSET 1 +#define HAVE_MEMCPY 1 +#define HAVE_MEMMOVE 1 +#define HAVE_MEMCMP 1 +#define HAVE_STRLEN 1 +#define HAVE_STRLCPY 1 +#define HAVE_STRLCAT 1 +#define HAVE_STRDUP 1 +#define HAVE_STRCHR 1 +#define HAVE_STRRCHR 1 +#define HAVE_STRSTR 1 +#define HAVE_STRTOL 1 +#define HAVE_STRTOUL 1 +#define HAVE_STRTOLL 1 +#define HAVE_STRTOULL 1 +#define HAVE_STRTOD 1 +#define HAVE_ATOI 1 +#define HAVE_ATOF 1 +#define HAVE_STRCMP 1 +#define HAVE_STRNCMP 1 +#define HAVE_STRCASECMP 1 #define HAVE_STRNCASECMP 1 -#define HAVE_SSCANF 1 -#define HAVE_SNPRINTF 1 -#define HAVE_VSNPRINTF 1 -#define HAVE_M_PI 1 -#define HAVE_ATAN 1 -#define HAVE_ATAN2 1 -#define HAVE_CEIL 1 -#define HAVE_COPYSIGN 1 -#define HAVE_COS 1 -#define HAVE_COSF 1 -#define HAVE_FABS 1 -#define HAVE_FLOOR 1 -#define HAVE_LOG 1 -#define HAVE_POW 1 -#define HAVE_SCALBN 1 -#define HAVE_SIN 1 -#define HAVE_SINF 1 -#define HAVE_SQRT 1 -#define HAVE_SIGACTION 1 -#define HAVE_SETJMP 1 -#define HAVE_NANOSLEEP 1 -#define HAVE_SYSCONF 1 +#define HAVE_SSCANF 1 +#define HAVE_SNPRINTF 1 +#define HAVE_VSNPRINTF 1 +#define HAVE_M_PI 1 +#define HAVE_ATAN 1 +#define HAVE_ATAN2 1 +#define HAVE_CEIL 1 +#define HAVE_COPYSIGN 1 +#define HAVE_COS 1 +#define HAVE_COSF 1 +#define HAVE_FABS 1 +#define HAVE_FLOOR 1 +#define HAVE_LOG 1 +#define HAVE_POW 1 +#define HAVE_SCALBN 1 +#define HAVE_SIN 1 +#define HAVE_SINF 1 +#define HAVE_SQRT 1 +#define HAVE_SIGACTION 1 +#define HAVE_SETJMP 1 +#define HAVE_NANOSLEEP 1 +#define HAVE_SYSCONF 1 #define SIZEOF_VOIDP 4 /* Enable various audio drivers */ -#define SDL_AUDIO_DRIVER_ANDROID 1 -#define SDL_AUDIO_DRIVER_DUMMY 1 +#define SDL_AUDIO_DRIVER_ANDROID 1 +#define SDL_AUDIO_DRIVER_DUMMY 1 /* Enable various input drivers */ -#define SDL_JOYSTICK_ANDROID 1 -#define SDL_HAPTIC_DUMMY 1 +#define SDL_JOYSTICK_ANDROID 1 +#define SDL_HAPTIC_DUMMY 1 /* Enable various shared object loading systems */ -#define SDL_LOADSO_DLOPEN 1 +#define SDL_LOADSO_DLOPEN 1 /* Enable various threading systems */ -#define SDL_THREAD_PTHREAD 1 -#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX 1 +#define SDL_THREAD_PTHREAD 1 +#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX 1 /* Enable various timer systems */ -#define SDL_TIMER_UNIX 1 +#define SDL_TIMER_UNIX 1 /* Enable various video drivers */ #define SDL_VIDEO_DRIVER_ANDROID 1 diff --git a/src/eepp/helper/SDL2/include/SDL_config_iphoneos.h b/src/eepp/helper/SDL2/include/SDL_config_iphoneos.h index a0fe5fc36..b27b18973 100644 --- a/src/eepp/helper/SDL2/include/SDL_config_iphoneos.h +++ b/src/eepp/helper/SDL2/include/SDL_config_iphoneos.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -30,109 +30,109 @@ #define SIZEOF_VOIDP 4 #endif -#define HAVE_GCC_ATOMICS 1 +#define HAVE_GCC_ATOMICS 1 -#define HAVE_ALLOCA_H 1 -#define HAVE_SYS_TYPES_H 1 -#define HAVE_STDIO_H 1 -#define STDC_HEADERS 1 -#define HAVE_STRING_H 1 -#define HAVE_INTTYPES_H 1 -#define HAVE_STDINT_H 1 -#define HAVE_CTYPE_H 1 -#define HAVE_MATH_H 1 -#define HAVE_SIGNAL_H 1 +#define HAVE_ALLOCA_H 1 +#define HAVE_SYS_TYPES_H 1 +#define HAVE_STDIO_H 1 +#define STDC_HEADERS 1 +#define HAVE_STRING_H 1 +#define HAVE_INTTYPES_H 1 +#define HAVE_STDINT_H 1 +#define HAVE_CTYPE_H 1 +#define HAVE_MATH_H 1 +#define HAVE_SIGNAL_H 1 /* C library functions */ -#define HAVE_MALLOC 1 -#define HAVE_CALLOC 1 -#define HAVE_REALLOC 1 -#define HAVE_FREE 1 -#define HAVE_ALLOCA 1 -#define HAVE_GETENV 1 -#define HAVE_SETENV 1 -#define HAVE_PUTENV 1 -#define HAVE_SETENV 1 -#define HAVE_UNSETENV 1 -#define HAVE_QSORT 1 -#define HAVE_ABS 1 -#define HAVE_BCOPY 1 -#define HAVE_MEMSET 1 -#define HAVE_MEMCPY 1 -#define HAVE_MEMMOVE 1 -#define HAVE_MEMCMP 1 -#define HAVE_STRLEN 1 -#define HAVE_STRLCPY 1 -#define HAVE_STRLCAT 1 -#define HAVE_STRDUP 1 -#define HAVE_STRCHR 1 -#define HAVE_STRRCHR 1 -#define HAVE_STRSTR 1 -#define HAVE_STRTOL 1 -#define HAVE_STRTOUL 1 -#define HAVE_STRTOLL 1 -#define HAVE_STRTOULL 1 -#define HAVE_STRTOD 1 -#define HAVE_ATOI 1 -#define HAVE_ATOF 1 -#define HAVE_STRCMP 1 -#define HAVE_STRNCMP 1 -#define HAVE_STRCASECMP 1 +#define HAVE_MALLOC 1 +#define HAVE_CALLOC 1 +#define HAVE_REALLOC 1 +#define HAVE_FREE 1 +#define HAVE_ALLOCA 1 +#define HAVE_GETENV 1 +#define HAVE_SETENV 1 +#define HAVE_PUTENV 1 +#define HAVE_SETENV 1 +#define HAVE_UNSETENV 1 +#define HAVE_QSORT 1 +#define HAVE_ABS 1 +#define HAVE_BCOPY 1 +#define HAVE_MEMSET 1 +#define HAVE_MEMCPY 1 +#define HAVE_MEMMOVE 1 +#define HAVE_MEMCMP 1 +#define HAVE_STRLEN 1 +#define HAVE_STRLCPY 1 +#define HAVE_STRLCAT 1 +#define HAVE_STRDUP 1 +#define HAVE_STRCHR 1 +#define HAVE_STRRCHR 1 +#define HAVE_STRSTR 1 +#define HAVE_STRTOL 1 +#define HAVE_STRTOUL 1 +#define HAVE_STRTOLL 1 +#define HAVE_STRTOULL 1 +#define HAVE_STRTOD 1 +#define HAVE_ATOI 1 +#define HAVE_ATOF 1 +#define HAVE_STRCMP 1 +#define HAVE_STRNCMP 1 +#define HAVE_STRCASECMP 1 #define HAVE_STRNCASECMP 1 -#define HAVE_SSCANF 1 -#define HAVE_SNPRINTF 1 -#define HAVE_VSNPRINTF 1 -#define HAVE_M_PI 1 -#define HAVE_ATAN 1 -#define HAVE_ATAN2 1 -#define HAVE_CEIL 1 -#define HAVE_COPYSIGN 1 -#define HAVE_COS 1 -#define HAVE_COSF 1 -#define HAVE_FABS 1 -#define HAVE_FLOOR 1 -#define HAVE_LOG 1 -#define HAVE_POW 1 -#define HAVE_SCALBN 1 -#define HAVE_SIN 1 -#define HAVE_SINF 1 -#define HAVE_SQRT 1 -#define HAVE_SIGACTION 1 -#define HAVE_SETJMP 1 -#define HAVE_NANOSLEEP 1 -#define HAVE_SYSCONF 1 +#define HAVE_SSCANF 1 +#define HAVE_SNPRINTF 1 +#define HAVE_VSNPRINTF 1 +#define HAVE_M_PI 1 +#define HAVE_ATAN 1 +#define HAVE_ATAN2 1 +#define HAVE_CEIL 1 +#define HAVE_COPYSIGN 1 +#define HAVE_COS 1 +#define HAVE_COSF 1 +#define HAVE_FABS 1 +#define HAVE_FLOOR 1 +#define HAVE_LOG 1 +#define HAVE_POW 1 +#define HAVE_SCALBN 1 +#define HAVE_SIN 1 +#define HAVE_SINF 1 +#define HAVE_SQRT 1 +#define HAVE_SIGACTION 1 +#define HAVE_SETJMP 1 +#define HAVE_NANOSLEEP 1 +#define HAVE_SYSCONF 1 #define HAVE_SYSCTLBYNAME 1 /* enable iPhone version of Core Audio driver */ #define SDL_AUDIO_DRIVER_COREAUDIO 1 /* Enable the dummy audio driver (src/audio/dummy/\*.c) */ -#define SDL_AUDIO_DRIVER_DUMMY 1 +#define SDL_AUDIO_DRIVER_DUMMY 1 /* Enable the stub haptic driver (src/haptic/dummy/\*.c) */ -#define SDL_HAPTIC_DISABLED 1 +#define SDL_HAPTIC_DISABLED 1 /* Enable Unix style SO loading */ /* Technically this works, but it violates the iPhone developer agreement */ /* #define SDL_LOADSO_DLOPEN 1 */ /* Enable the stub shared object loader (src/loadso/dummy/\*.c) */ -#define SDL_LOADSO_DISABLED 1 +#define SDL_LOADSO_DISABLED 1 /* Enable various threading systems */ -#define SDL_THREAD_PTHREAD 1 -#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX 1 +#define SDL_THREAD_PTHREAD 1 +#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX 1 /* Enable various timer systems */ -#define SDL_TIMER_UNIX 1 +#define SDL_TIMER_UNIX 1 /* Supported video drivers */ -#define SDL_VIDEO_DRIVER_UIKIT 1 -#define SDL_VIDEO_DRIVER_DUMMY 1 +#define SDL_VIDEO_DRIVER_UIKIT 1 +#define SDL_VIDEO_DRIVER_DUMMY 1 /* enable OpenGL ES */ -#define SDL_VIDEO_OPENGL_ES 1 -#define SDL_VIDEO_RENDER_OGL_ES 1 -#define SDL_VIDEO_RENDER_OGL_ES2 1 +#define SDL_VIDEO_OPENGL_ES 1 +#define SDL_VIDEO_RENDER_OGL_ES 1 +#define SDL_VIDEO_RENDER_OGL_ES2 1 /* Enable system power support */ #define SDL_POWER_UIKIT 1 diff --git a/src/eepp/helper/SDL2/include/SDL_config_macosx.h b/src/eepp/helper/SDL2/include/SDL_config_macosx.h index ca43dc83e..a2d227478 100644 --- a/src/eepp/helper/SDL2/include/SDL_config_macosx.h +++ b/src/eepp/helper/SDL2/include/SDL_config_macosx.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -30,107 +30,107 @@ /* This is a set of defines to configure the SDL features */ #ifdef __LP64__ - #define SIZEOF_VOIDP 8 + #define SIZEOF_VOIDP 8 #else - #define SIZEOF_VOIDP 4 + #define SIZEOF_VOIDP 4 #endif /* Useful headers */ /* If we specified an SDK or have a post-PowerPC chip, then alloca.h exists. */ #if ( (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (!defined(__POWERPC__)) ) -#define HAVE_ALLOCA_H 1 +#define HAVE_ALLOCA_H 1 #endif -#define HAVE_SYS_TYPES_H 1 -#define HAVE_STDIO_H 1 -#define STDC_HEADERS 1 -#define HAVE_STRING_H 1 -#define HAVE_INTTYPES_H 1 -#define HAVE_STDINT_H 1 -#define HAVE_CTYPE_H 1 -#define HAVE_MATH_H 1 -#define HAVE_SIGNAL_H 1 +#define HAVE_SYS_TYPES_H 1 +#define HAVE_STDIO_H 1 +#define STDC_HEADERS 1 +#define HAVE_STRING_H 1 +#define HAVE_INTTYPES_H 1 +#define HAVE_STDINT_H 1 +#define HAVE_CTYPE_H 1 +#define HAVE_MATH_H 1 +#define HAVE_SIGNAL_H 1 /* C library functions */ -#define HAVE_MALLOC 1 -#define HAVE_CALLOC 1 -#define HAVE_REALLOC 1 -#define HAVE_FREE 1 -#define HAVE_ALLOCA 1 -#define HAVE_GETENV 1 -#define HAVE_SETENV 1 -#define HAVE_PUTENV 1 -#define HAVE_UNSETENV 1 -#define HAVE_QSORT 1 -#define HAVE_ABS 1 -#define HAVE_BCOPY 1 -#define HAVE_MEMSET 1 -#define HAVE_MEMCPY 1 -#define HAVE_MEMMOVE 1 -#define HAVE_MEMCMP 1 -#define HAVE_STRLEN 1 -#define HAVE_STRLCPY 1 -#define HAVE_STRLCAT 1 -#define HAVE_STRDUP 1 -#define HAVE_STRCHR 1 -#define HAVE_STRRCHR 1 -#define HAVE_STRSTR 1 -#define HAVE_STRTOL 1 -#define HAVE_STRTOUL 1 -#define HAVE_STRTOLL 1 -#define HAVE_STRTOULL 1 -#define HAVE_STRTOD 1 -#define HAVE_ATOI 1 -#define HAVE_ATOF 1 -#define HAVE_STRCMP 1 -#define HAVE_STRNCMP 1 -#define HAVE_STRCASECMP 1 +#define HAVE_MALLOC 1 +#define HAVE_CALLOC 1 +#define HAVE_REALLOC 1 +#define HAVE_FREE 1 +#define HAVE_ALLOCA 1 +#define HAVE_GETENV 1 +#define HAVE_SETENV 1 +#define HAVE_PUTENV 1 +#define HAVE_UNSETENV 1 +#define HAVE_QSORT 1 +#define HAVE_ABS 1 +#define HAVE_BCOPY 1 +#define HAVE_MEMSET 1 +#define HAVE_MEMCPY 1 +#define HAVE_MEMMOVE 1 +#define HAVE_MEMCMP 1 +#define HAVE_STRLEN 1 +#define HAVE_STRLCPY 1 +#define HAVE_STRLCAT 1 +#define HAVE_STRDUP 1 +#define HAVE_STRCHR 1 +#define HAVE_STRRCHR 1 +#define HAVE_STRSTR 1 +#define HAVE_STRTOL 1 +#define HAVE_STRTOUL 1 +#define HAVE_STRTOLL 1 +#define HAVE_STRTOULL 1 +#define HAVE_STRTOD 1 +#define HAVE_ATOI 1 +#define HAVE_ATOF 1 +#define HAVE_STRCMP 1 +#define HAVE_STRNCMP 1 +#define HAVE_STRCASECMP 1 #define HAVE_STRNCASECMP 1 -#define HAVE_SSCANF 1 -#define HAVE_SNPRINTF 1 -#define HAVE_VSNPRINTF 1 -#define HAVE_CEIL 1 -#define HAVE_COPYSIGN 1 -#define HAVE_COS 1 -#define HAVE_COSF 1 -#define HAVE_FABS 1 -#define HAVE_FLOOR 1 -#define HAVE_LOG 1 -#define HAVE_POW 1 -#define HAVE_SCALBN 1 -#define HAVE_SIN 1 -#define HAVE_SINF 1 -#define HAVE_SQRT 1 -#define HAVE_SIGACTION 1 -#define HAVE_SETJMP 1 -#define HAVE_NANOSLEEP 1 -#define HAVE_SYSCONF 1 +#define HAVE_SSCANF 1 +#define HAVE_SNPRINTF 1 +#define HAVE_VSNPRINTF 1 +#define HAVE_CEIL 1 +#define HAVE_COPYSIGN 1 +#define HAVE_COS 1 +#define HAVE_COSF 1 +#define HAVE_FABS 1 +#define HAVE_FLOOR 1 +#define HAVE_LOG 1 +#define HAVE_POW 1 +#define HAVE_SCALBN 1 +#define HAVE_SIN 1 +#define HAVE_SINF 1 +#define HAVE_SQRT 1 +#define HAVE_SIGACTION 1 +#define HAVE_SETJMP 1 +#define HAVE_NANOSLEEP 1 +#define HAVE_SYSCONF 1 #define HAVE_SYSCTLBYNAME 1 #define HAVE_ATAN 1 #define HAVE_ATAN2 1 /* Enable various audio drivers */ -#define SDL_AUDIO_DRIVER_COREAUDIO 1 -#define SDL_AUDIO_DRIVER_DISK 1 -#define SDL_AUDIO_DRIVER_DUMMY 1 +#define SDL_AUDIO_DRIVER_COREAUDIO 1 +#define SDL_AUDIO_DRIVER_DISK 1 +#define SDL_AUDIO_DRIVER_DUMMY 1 /* Enable various input drivers */ -#define SDL_JOYSTICK_IOKIT 1 -#define SDL_HAPTIC_IOKIT 1 +#define SDL_JOYSTICK_IOKIT 1 +#define SDL_HAPTIC_IOKIT 1 /* Enable various shared object loading systems */ -#define SDL_LOADSO_DLOPEN 1 +#define SDL_LOADSO_DLOPEN 1 /* Enable various threading systems */ -#define SDL_THREAD_PTHREAD 1 -#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX 1 +#define SDL_THREAD_PTHREAD 1 +#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX 1 /* Enable various timer systems */ -#define SDL_TIMER_UNIX 1 +#define SDL_TIMER_UNIX 1 /* Enable various video drivers */ -#define SDL_VIDEO_DRIVER_COCOA 1 -#define SDL_VIDEO_DRIVER_DUMMY 1 -#define SDL_VIDEO_DRIVER_X11 0 +#define SDL_VIDEO_DRIVER_COCOA 1 +#define SDL_VIDEO_DRIVER_DUMMY 1 +#undef SDL_VIDEO_DRIVER_X11 #define SDL_VIDEO_DRIVER_X11_DYNAMIC "/usr/X11R6/lib/libX11.6.dylib" #define SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT "/usr/X11R6/lib/libXext.6.dylib" #define SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA "/usr/X11R6/lib/libXinerama.1.dylib" @@ -157,27 +157,27 @@ #endif #ifndef SDL_VIDEO_RENDER_OGL -#define SDL_VIDEO_RENDER_OGL 1 +#define SDL_VIDEO_RENDER_OGL 1 #endif /* Enable OpenGL support */ #ifndef SDL_VIDEO_OPENGL -#define SDL_VIDEO_OPENGL 1 +#define SDL_VIDEO_OPENGL 1 #endif #ifndef SDL_VIDEO_OPENGL_CGL -#define SDL_VIDEO_OPENGL_CGL 1 +#define SDL_VIDEO_OPENGL_CGL 1 #endif #ifndef SDL_VIDEO_OPENGL_GLX -#define SDL_VIDEO_OPENGL_GLX 1 +#define SDL_VIDEO_OPENGL_GLX 1 #endif /* Enable system power support */ #define SDL_POWER_MACOSX 1 /* Enable assembly routines */ -#define SDL_ASSEMBLY_ROUTINES 1 +#define SDL_ASSEMBLY_ROUTINES 1 #ifdef __ppc__ -#define SDL_ALTIVEC_BLITTERS 1 +#define SDL_ALTIVEC_BLITTERS 1 #endif #endif /* _SDL_config_macosx_h */ diff --git a/src/eepp/helper/SDL2/include/SDL_config_minimal.h b/src/eepp/helper/SDL2/include/SDL_config_minimal.h index 7fef16442..cadfcaa5e 100644 --- a/src/eepp/helper/SDL2/include/SDL_config_minimal.h +++ b/src/eepp/helper/SDL2/include/SDL_config_minimal.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -26,7 +26,7 @@ /** * \file SDL_config_minimal.h - * + * * This is the minimal configuration that can be used to build SDL. */ @@ -51,24 +51,24 @@ typedef unsigned long uintptr_t; #endif /* Enable the dummy audio driver (src/audio/dummy/\*.c) */ -#define SDL_AUDIO_DRIVER_DUMMY 1 +#define SDL_AUDIO_DRIVER_DUMMY 1 /* Enable the stub joystick driver (src/joystick/dummy/\*.c) */ -#define SDL_JOYSTICK_DISABLED 1 +#define SDL_JOYSTICK_DISABLED 1 /* Enable the stub haptic driver (src/haptic/dummy/\*.c) */ -#define SDL_HAPTIC_DISABLED 1 +#define SDL_HAPTIC_DISABLED 1 /* Enable the stub shared object loader (src/loadso/dummy/\*.c) */ -#define SDL_LOADSO_DISABLED 1 +#define SDL_LOADSO_DISABLED 1 /* Enable the stub thread support (src/thread/generic/\*.c) */ -#define SDL_THREADS_DISABLED 1 +#define SDL_THREADS_DISABLED 1 /* Enable the stub timer support (src/timer/dummy/\*.c) */ -#define SDL_TIMERS_DISABLED 1 +#define SDL_TIMERS_DISABLED 1 /* Enable the dummy video driver (src/video/dummy/\*.c) */ -#define SDL_VIDEO_DRIVER_DUMMY 1 +#define SDL_VIDEO_DRIVER_DUMMY 1 #endif /* _SDL_config_minimal_h */ diff --git a/src/eepp/helper/SDL2/include/SDL_config_nintendods.h b/src/eepp/helper/SDL2/include/SDL_config_nintendods.h deleted file mode 100644 index 97c2d0871..000000000 --- a/src/eepp/helper/SDL2/include/SDL_config_nintendods.h +++ /dev/null @@ -1,129 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga - - 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 - appreciated but is not required. - 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_config_nintendods_h -#define _SDL_config_nintendods_h - -#include "SDL_platform.h" - -/* This is a set of defines to configure the SDL features */ - -#if !defined(_STDINT_H_) && (!defined(HAVE_STDINT_H) || !_HAVE_STDINT_H) -typedef signed char int8_t; -typedef unsigned char uint8_t; -typedef signed short int16_t; -typedef unsigned short uint16_t; -typedef signed int int32_t; -typedef unsigned int uint32_t; -typedef signed long long int64_t; -typedef unsigned long long uint64_t; - -/* LiF: __PTRDIFF_TYPE__ was causing errors of conflicting typedefs with the - shipping with devkitARM. copied a similar ifdef from it. */ -#ifndef __PTRDIFF_TYPE__ -typedef unsigned long uintptr_t; -#else -typedef unsigned __PTRDIFF_TYPE__ uintptr_t; -#endif -#endif /* !_STDINT_H_ && !HAVE_STDINT_H */ - -#define SIZEOF_VOIDP 4 - -/* Useful headers */ -#define HAVE_SYS_TYPES_H 1 -#define HAVE_STDIO_H 1 -#define STDC_HEADERS 1 -#define HAVE_STRING_H 1 -#define HAVE_CTYPE_H 1 - -/* C library functions */ -#define HAVE_MALLOC 1 -#define HAVE_CALLOC 1 -#define HAVE_REALLOC 1 -#define HAVE_FREE 1 -#define HAVE_ALLOCA 1 -#define HAVE_GETENV 1 -#define HAVE_SETENV 1 -#define HAVE_PUTENV 1 -#define HAVE_QSORT 1 -#define HAVE_ABS 1 -#define HAVE_BCOPY 1 -#define HAVE_MEMSET 1 -#define HAVE_MEMCPY 1 -#define HAVE_MEMMOVE 1 -#define HAVE_MEMCMP 1 -#define HAVE_STRLEN 1 -#define HAVE_STRDUP 1 -#define HAVE_INDEX 1 -#define HAVE_RINDEX 1 -#define HAVE_STRCHR 1 -#define HAVE_STRRCHR 1 -#define HAVE_STRSTR 1 -#define HAVE_STRTOL 1 -#define HAVE_STRTOD 1 -#define HAVE_ATOI 1 -#define HAVE_ATOF 1 -#define HAVE_STRCMP 1 -#define HAVE_STRNCMP 1 -#define HAVE_STRICMP 1 -#define HAVE_STRCASECMP 1 -#define HAVE_SSCANF 1 -#define HAVE_SNPRINTF 1 -#define HAVE_VSNPRINTF 1 - -/* DS isn't that sophisticated */ -#define LACKS_SYS_MMAN_H 1 - -/* Enable various audio drivers */ -#define SDL_AUDIO_DRIVER_NDS 1 -/*#define SDL_AUDIO_DRIVER_DUMMY 1 TODO: uncomment this later*/ - -/* Enable various input drivers */ -#define SDL_JOYSTICK_NDS 1 -/*#define SDL_JOYSTICK_DUMMY 1 TODO: uncomment this later*/ - -/* DS has no dynamic linking afaik */ -#define SDL_LOADSO_DISABLED 1 - -/* Enable various threading systems */ -/*#define SDL_THREAD_NDS 1*/ -#define SDL_THREADS_DISABLED 1 - -/* Enable various timer systems */ -#define SDL_TIMER_NDS 1 - -/* Enable various video drivers */ -#define SDL_VIDEO_DRIVER_NDS 1 -#ifdef USE_HW_RENDERER -#define SDL_VIDEO_RENDER_NDS 1 -#else -#define SDL_VIDEO_RENDER_NDS 0 -#endif - -/* Enable system power support */ -#define SDL_POWER_NINTENDODS 1 - -/* Enable haptic support */ -#define SDL_HAPTIC_NDS 1 - -#define SDL_BYTEORDER SDL_LIL_ENDIAN - -#endif /* _SDL_config_nintendods_h */ diff --git a/src/eepp/helper/SDL2/include/SDL_config_pandora.h b/src/eepp/helper/SDL2/include/SDL_config_pandora.h index 69451c4f3..b93a1bc1a 100644 --- a/src/eepp/helper/SDL2/include/SDL_config_pandora.h +++ b/src/eepp/helper/SDL2/include/SDL_config_pandora.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -57,7 +57,7 @@ #define HAVE_FREE 1 #define HAVE_ALLOCA 1 #define HAVE_GETENV 1 -#define HAVE_SETENV 1 +#define HAVE_SETENV 1 #define HAVE_PUTENV 1 #define HAVE_UNSETENV 1 #define HAVE_QSORT 1 diff --git a/src/eepp/helper/SDL2/include/SDL_config_psp.h b/src/eepp/helper/SDL2/include/SDL_config_psp.h new file mode 100644 index 000000000..bf456f688 --- /dev/null +++ b/src/eepp/helper/SDL2/include/SDL_config_psp.h @@ -0,0 +1,136 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2013 Sam Lantinga + + 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 + appreciated but is not required. + 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_config_psp_h +#define _SDL_config_psp_h + +#include "SDL_platform.h" + + + +#ifdef __GNUC__ +#define HAVE_GCC_SYNC_LOCK_TEST_AND_SET 1 +#endif + +#define HAVE_GCC_ATOMICS 1 + +#define HAVE_ALLOCA_H 1 +#define HAVE_SYS_TYPES_H 1 +#define HAVE_STDIO_H 1 +#define STDC_HEADERS 1 +#define HAVE_STRING_H 1 +#define HAVE_INTTYPES_H 1 +#define HAVE_STDINT_H 1 +#define HAVE_CTYPE_H 1 +#define HAVE_MATH_H 1 +#define HAVE_SIGNAL_H 1 + +/* C library functions */ +#define HAVE_MALLOC 1 +#define HAVE_CALLOC 1 +#define HAVE_REALLOC 1 +#define HAVE_FREE 1 +#define HAVE_ALLOCA 1 +#define HAVE_GETENV 1 +#define HAVE_SETENV 1 +#define HAVE_PUTENV 1 +#define HAVE_SETENV 1 +#define HAVE_UNSETENV 1 +#define HAVE_QSORT 1 +#define HAVE_ABS 1 +#define HAVE_BCOPY 1 +#define HAVE_MEMSET 1 +#define HAVE_MEMCPY 1 +#define HAVE_MEMMOVE 1 +#define HAVE_MEMCMP 1 +#define HAVE_STRLEN 1 +#define HAVE_STRLCPY 1 +#define HAVE_STRLCAT 1 +#define HAVE_STRDUP 1 +#define HAVE_STRCHR 1 +#define HAVE_STRRCHR 1 +#define HAVE_STRSTR 1 +#define HAVE_STRTOL 1 +#define HAVE_STRTOUL 1 +#define HAVE_STRTOLL 1 +#define HAVE_STRTOULL 1 +#define HAVE_STRTOD 1 +#define HAVE_ATOI 1 +#define HAVE_ATOF 1 +#define HAVE_STRCMP 1 +#define HAVE_STRNCMP 1 +#define HAVE_STRCASECMP 1 +#define HAVE_STRNCASECMP 1 +#define HAVE_SSCANF 1 +#define HAVE_SNPRINTF 1 +#define HAVE_VSNPRINTF 1 +#define HAVE_M_PI 1 +#define HAVE_ATAN 1 +#define HAVE_ATAN2 1 +#define HAVE_CEIL 1 +#define HAVE_COPYSIGN 1 +#define HAVE_COS 1 +#define HAVE_COSF 1 +#define HAVE_FABS 1 +#define HAVE_FLOOR 1 +#define HAVE_LOG 1 +#define HAVE_POW 1 +#define HAVE_SCALBN 1 +#define HAVE_SIN 1 +#define HAVE_SINF 1 +#define HAVE_SQRT 1 +#define HAVE_SETJMP 1 +#define HAVE_NANOSLEEP 1 +//#define HAVE_SYSCONF 1 +//#define HAVE_SIGACTION 1 + + +/* PSP isn't that sophisticated */ +#define LACKS_SYS_MMAN_H 1 + +/* Enable the stub thread support (src/thread/psp/\*.c) */ +#define SDL_THREAD_PSP 1 + +/* Enable the stub timer support (src/timer/psp/\*.c) */ +#define SDL_TIMERS_PSP 1 + +/* Enable the stub joystick driver (src/joystick/psp/\*.c) */ +#define SDL_JOYSTICK_PSP 1 + +/* Enable the stub audio driver (src/audio/psp/\*.c) */ +#define SDL_AUDIO_DRIVER_PSP 1 + +/* PSP video dirver */ +#define SDL_VIDEO_DRIVER_PSP 1 + +/* PSP render dirver */ +#define SDL_VIDEO_RENDER_PSP 1 + +#define SDL_POWER_PSP 1 + +/* PSP doesn't have haptic device (src/haptic/dummy/\*.c) */ +#define SDL_HAPTIC_DISABLED 1 + +/* PSP can't load shared object (src/loadso/dummy/\*.c) */ +#define SDL_LOADSO_DISABLED 1 + + +#endif /* _SDL_config_psp_h */ diff --git a/src/eepp/helper/SDL2/include/SDL_config_windows.h b/src/eepp/helper/SDL2/include/SDL_config_windows.h index e8d3ffb97..0b7621564 100644 --- a/src/eepp/helper/SDL2/include/SDL_config_windows.h +++ b/src/eepp/helper/SDL2/include/SDL_config_windows.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -28,7 +28,7 @@ #if !defined(_STDINT_H_) && (!defined(HAVE_STDINT_H) || !_HAVE_STDINT_H) #if defined(__GNUC__) || defined(__DMC__) || defined(__WATCOMC__) -#define HAVE_STDINT_H 1 +#define HAVE_STDINT_H 1 #elif defined(_MSC_VER) typedef signed __int8 int8_t; typedef unsigned __int8 uint8_t; @@ -76,8 +76,7 @@ typedef unsigned int uintptr_t; # define SIZEOF_VOIDP 4 #endif -/* Enabled for SDL 1.2 (binary compatibility) */ -//#define HAVE_LIBC 1 +/* This is disabled by default to avoid C runtime dependencies and manifest requirements */ #ifdef HAVE_LIBC /* Useful headers */ #define HAVE_STDIO_H 1 @@ -136,54 +135,47 @@ typedef unsigned int uintptr_t; #define HAVE_SINF 1 #define HAVE_SQRT 1 #else -#define HAVE_STDARG_H 1 -#define HAVE_STDDEF_H 1 +#define HAVE_STDARG_H 1 +#define HAVE_STDDEF_H 1 #endif /* Enable various audio drivers */ -#define SDL_AUDIO_DRIVER_DSOUND 1 -#ifndef __GNUC__ -#define SDL_AUDIO_DRIVER_XAUDIO2 1 -#endif -#define SDL_AUDIO_DRIVER_WINMM 1 -#define SDL_AUDIO_DRIVER_DISK 1 -#define SDL_AUDIO_DRIVER_DUMMY 1 +#define SDL_AUDIO_DRIVER_DSOUND 1 +#define SDL_AUDIO_DRIVER_XAUDIO2 1 +#define SDL_AUDIO_DRIVER_WINMM 1 +#define SDL_AUDIO_DRIVER_DISK 1 +#define SDL_AUDIO_DRIVER_DUMMY 1 /* Enable various input drivers */ -#define SDL_JOYSTICK_DINPUT 1 -#ifdef __GNUC__ -/* There isn't a compatible dinput.h for mingw as far as I know */ -#define SDL_HAPTIC_DISABLED 1 -#else -#define SDL_HAPTIC_DINPUT 1 -#endif +#define SDL_JOYSTICK_DINPUT 1 +#define SDL_HAPTIC_DINPUT 1 /* Enable various shared object loading systems */ -#define SDL_LOADSO_WINDOWS 1 +#define SDL_LOADSO_WINDOWS 1 /* Enable various threading systems */ -#define SDL_THREAD_WINDOWS 1 +#define SDL_THREAD_WINDOWS 1 /* Enable various timer systems */ -#define SDL_TIMER_WINDOWS 1 +#define SDL_TIMER_WINDOWS 1 /* Enable various video drivers */ -#define SDL_VIDEO_DRIVER_DUMMY 1 -#define SDL_VIDEO_DRIVER_WINDOWS 1 +#define SDL_VIDEO_DRIVER_DUMMY 1 +#define SDL_VIDEO_DRIVER_WINDOWS 1 #ifndef SDL_VIDEO_RENDER_D3D -#define SDL_VIDEO_RENDER_D3D 1 +#define SDL_VIDEO_RENDER_D3D 1 #endif /* Enable OpenGL support */ #ifndef SDL_VIDEO_OPENGL -#define SDL_VIDEO_OPENGL 1 +#define SDL_VIDEO_OPENGL 1 #endif #ifndef SDL_VIDEO_OPENGL_WGL -#define SDL_VIDEO_OPENGL_WGL 1 +#define SDL_VIDEO_OPENGL_WGL 1 #endif #ifndef SDL_VIDEO_RENDER_OGL -#define SDL_VIDEO_RENDER_OGL 1 +#define SDL_VIDEO_RENDER_OGL 1 #endif /* Enable system power support */ @@ -191,7 +183,7 @@ typedef unsigned int uintptr_t; /* Enable assembly routines (Win64 doesn't have inline asm) */ #ifndef _WIN64 -#define SDL_ASSEMBLY_ROUTINES 1 +#define SDL_ASSEMBLY_ROUTINES 1 #endif #endif /* _SDL_config_windows_h */ diff --git a/src/eepp/helper/SDL2/include/SDL_config_wiz.h b/src/eepp/helper/SDL2/include/SDL_config_wiz.h index e2c675e0d..9be04d92a 100644 --- a/src/eepp/helper/SDL2/include/SDL_config_wiz.h +++ b/src/eepp/helper/SDL2/include/SDL_config_wiz.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -51,7 +51,7 @@ #define HAVE_FREE 1 #define HAVE_ALLOCA 1 #define HAVE_GETENV 1 -#define HAVE_SETENV 1 +#define HAVE_SETENV 1 #define HAVE_PUTENV 1 #define HAVE_UNSETENV 1 #define HAVE_QSORT 1 diff --git a/src/eepp/helper/SDL2/include/SDL_copying.h b/src/eepp/helper/SDL2/include/SDL_copying.h index 189aceeb5..3a8fb758a 100644 --- a/src/eepp/helper/SDL2/include/SDL_copying.h +++ b/src/eepp/helper/SDL2/include/SDL_copying.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/include/SDL_cpuinfo.h b/src/eepp/helper/SDL2/include/SDL_cpuinfo.h index 22d04a7ca..dde3074f0 100644 --- a/src/eepp/helper/SDL2/include/SDL_cpuinfo.h +++ b/src/eepp/helper/SDL2/include/SDL_cpuinfo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,7 +21,7 @@ /** * \file SDL_cpuinfo.h - * + * * CPU feature detection for SDL. */ @@ -66,9 +66,7 @@ #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus -/* *INDENT-OFF* */ extern "C" { -/* *INDENT-ON* */ #endif /* This is a guess for the cacheline size used for padding. @@ -139,9 +137,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE42(void); /* Ends C function definitions when using C++ */ #ifdef __cplusplus -/* *INDENT-OFF* */ } -/* *INDENT-ON* */ #endif #include "close_code.h" diff --git a/src/eepp/helper/SDL2/include/SDL_endian.h b/src/eepp/helper/SDL2/include/SDL_endian.h index 571fd994d..c58edcca0 100644 --- a/src/eepp/helper/SDL2/include/SDL_endian.h +++ b/src/eepp/helper/SDL2/include/SDL_endian.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,7 +21,7 @@ /** * \file SDL_endian.h - * + * * Functions for reading and writing endian-specific values */ @@ -34,8 +34,8 @@ * \name The two types of endianness */ /*@{*/ -#define SDL_LIL_ENDIAN 1234 -#define SDL_BIG_ENDIAN 4321 +#define SDL_LIL_ENDIAN 1234 +#define SDL_BIG_ENDIAN 4321 /*@}*/ #ifndef SDL_BYTEORDER /* Not defined in SDL_config.h? */ @@ -48,9 +48,9 @@ (defined(__MIPS__) && defined(__MISPEB__)) || \ defined(__ppc__) || defined(__POWERPC__) || defined(_M_PPC) || \ defined(__sparc__) -#define SDL_BYTEORDER SDL_BIG_ENDIAN +#define SDL_BYTEORDER SDL_BIG_ENDIAN #else -#define SDL_BYTEORDER SDL_LIL_ENDIAN +#define SDL_BYTEORDER SDL_LIL_ENDIAN #endif #endif /* __linux __ */ #endif /* !SDL_BYTEORDER */ @@ -59,36 +59,29 @@ #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus -/* *INDENT-OFF* */ extern "C" { -/* *INDENT-ON* */ #endif /** * \file SDL_endian.h - * - * Uses inline functions for compilers that support them, and static - * functions for those that do not. Because these functions become - * static for compilers that do not support inline functions, this - * header should only be included in files that actually use them. */ #if defined(__GNUC__) && defined(__i386__) && \ !(__GNUC__ == 2 && __GNUC_MINOR__ == 95 /* broken gcc version */) -static __inline__ Uint16 +SDL_FORCE_INLINE Uint16 SDL_Swap16(Uint16 x) { __asm__("xchgb %b0,%h0": "=q"(x):"0"(x)); return x; } #elif defined(__GNUC__) && defined(__x86_64__) -static __inline__ Uint16 +SDL_FORCE_INLINE Uint16 SDL_Swap16(Uint16 x) { __asm__("xchgb %b0,%h0": "=Q"(x):"0"(x)); return x; } #elif defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__)) -static __inline__ Uint16 +SDL_FORCE_INLINE Uint16 SDL_Swap16(Uint16 x) { int result; @@ -97,14 +90,14 @@ SDL_Swap16(Uint16 x) return (Uint16)result; } #elif defined(__GNUC__) && (defined(__M68000__) || defined(__M68020__)) && !defined(__mcoldfire__) -static __inline__ Uint16 +SDL_FORCE_INLINE Uint16 SDL_Swap16(Uint16 x) { __asm__("rorw #8,%0": "=d"(x): "0"(x):"cc"); return x; } #else -static __inline__ Uint16 +SDL_FORCE_INLINE Uint16 SDL_Swap16(Uint16 x) { return SDL_static_cast(Uint16, ((x << 8) | (x >> 8))); @@ -112,21 +105,21 @@ SDL_Swap16(Uint16 x) #endif #if defined(__GNUC__) && defined(__i386__) -static __inline__ Uint32 +SDL_FORCE_INLINE Uint32 SDL_Swap32(Uint32 x) { __asm__("bswap %0": "=r"(x):"0"(x)); return x; } #elif defined(__GNUC__) && defined(__x86_64__) -static __inline__ Uint32 +SDL_FORCE_INLINE Uint32 SDL_Swap32(Uint32 x) { __asm__("bswapl %0": "=r"(x):"0"(x)); return x; } #elif defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__)) -static __inline__ Uint32 +SDL_FORCE_INLINE Uint32 SDL_Swap32(Uint32 x) { Uint32 result; @@ -137,14 +130,14 @@ SDL_Swap32(Uint32 x) return result; } #elif defined(__GNUC__) && (defined(__M68000__) || defined(__M68020__)) && !defined(__mcoldfire__) -static __inline__ Uint32 +SDL_FORCE_INLINE Uint32 SDL_Swap32(Uint32 x) { __asm__("rorw #8,%0\n\tswap %0\n\trorw #8,%0": "=d"(x): "0"(x):"cc"); return x; } #else -static __inline__ Uint32 +SDL_FORCE_INLINE Uint32 SDL_Swap32(Uint32 x) { return SDL_static_cast(Uint32, ((x << 24) | ((x << 8) & 0x00FF0000) | @@ -153,7 +146,7 @@ SDL_Swap32(Uint32 x) #endif #if defined(__GNUC__) && defined(__i386__) -static __inline__ Uint64 +SDL_FORCE_INLINE Uint64 SDL_Swap64(Uint64 x) { union @@ -171,14 +164,14 @@ SDL_Swap64(Uint64 x) return v.u; } #elif defined(__GNUC__) && defined(__x86_64__) -static __inline__ Uint64 +SDL_FORCE_INLINE Uint64 SDL_Swap64(Uint64 x) { __asm__("bswapq %0": "=r"(x):"0"(x)); return x; } #else -static __inline__ Uint64 +SDL_FORCE_INLINE Uint64 SDL_Swap64(Uint64 x) { Uint32 hi, lo; @@ -195,7 +188,7 @@ SDL_Swap64(Uint64 x) #endif -static __inline__ float +SDL_FORCE_INLINE float SDL_SwapFloat(float x) { union @@ -215,31 +208,29 @@ SDL_SwapFloat(float x) */ /*@{*/ #if SDL_BYTEORDER == SDL_LIL_ENDIAN -#define SDL_SwapLE16(X) (X) -#define SDL_SwapLE32(X) (X) -#define SDL_SwapLE64(X) (X) -#define SDL_SwapFloatLE(X) (X) -#define SDL_SwapBE16(X) SDL_Swap16(X) -#define SDL_SwapBE32(X) SDL_Swap32(X) -#define SDL_SwapBE64(X) SDL_Swap64(X) -#define SDL_SwapFloatBE(X) SDL_SwapFloat(X) +#define SDL_SwapLE16(X) (X) +#define SDL_SwapLE32(X) (X) +#define SDL_SwapLE64(X) (X) +#define SDL_SwapFloatLE(X) (X) +#define SDL_SwapBE16(X) SDL_Swap16(X) +#define SDL_SwapBE32(X) SDL_Swap32(X) +#define SDL_SwapBE64(X) SDL_Swap64(X) +#define SDL_SwapFloatBE(X) SDL_SwapFloat(X) #else -#define SDL_SwapLE16(X) SDL_Swap16(X) -#define SDL_SwapLE32(X) SDL_Swap32(X) -#define SDL_SwapLE64(X) SDL_Swap64(X) -#define SDL_SwapFloatLE(X) SDL_SwapFloat(X) -#define SDL_SwapBE16(X) (X) -#define SDL_SwapBE32(X) (X) -#define SDL_SwapBE64(X) (X) -#define SDL_SwapFloatBE(X) (X) +#define SDL_SwapLE16(X) SDL_Swap16(X) +#define SDL_SwapLE32(X) SDL_Swap32(X) +#define SDL_SwapLE64(X) SDL_Swap64(X) +#define SDL_SwapFloatLE(X) SDL_SwapFloat(X) +#define SDL_SwapBE16(X) (X) +#define SDL_SwapBE32(X) (X) +#define SDL_SwapBE64(X) (X) +#define SDL_SwapFloatBE(X) (X) #endif /*@}*//*Swap to native*/ /* Ends C function definitions when using C++ */ #ifdef __cplusplus -/* *INDENT-OFF* */ } -/* *INDENT-ON* */ #endif #include "close_code.h" diff --git a/src/eepp/helper/SDL2/include/SDL_error.h b/src/eepp/helper/SDL2/include/SDL_error.h index 16e5f08d1..229b26802 100644 --- a/src/eepp/helper/SDL2/include/SDL_error.h +++ b/src/eepp/helper/SDL2/include/SDL_error.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,7 +21,7 @@ /** * \file SDL_error.h - * + * * Simple error message routines for SDL. */ @@ -33,25 +33,25 @@ #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus -/* *INDENT-OFF* */ extern "C" { -/* *INDENT-ON* */ #endif /* Public functions */ -extern DECLSPEC void SDLCALL SDL_SetError(const char *fmt, ...); +/* SDL_SetError() unconditionally returns -1. */ +extern DECLSPEC int SDLCALL SDL_SetError(const char *fmt, ...); extern DECLSPEC const char *SDLCALL SDL_GetError(void); extern DECLSPEC void SDLCALL SDL_ClearError(void); /** * \name Internal error functions - * - * \internal + * + * \internal * Private error reporting function - used internally. */ /*@{*/ -#define SDL_OutOfMemory() SDL_Error(SDL_ENOMEM) -#define SDL_Unsupported() SDL_Error(SDL_UNSUPPORTED) +#define SDL_OutOfMemory() SDL_Error(SDL_ENOMEM) +#define SDL_Unsupported() SDL_Error(SDL_UNSUPPORTED) +#define SDL_InvalidParamError(param) SDL_SetError("Parameter '%s' is invalid", (param)) typedef enum { SDL_ENOMEM, @@ -61,14 +61,13 @@ typedef enum SDL_UNSUPPORTED, SDL_LASTERROR } SDL_errorcode; -extern DECLSPEC void SDLCALL SDL_Error(SDL_errorcode code); +/* SDL_Error() unconditionally returns -1. */ +extern DECLSPEC int SDLCALL SDL_Error(SDL_errorcode code); /*@}*//*Internal error functions*/ /* Ends C function definitions when using C++ */ #ifdef __cplusplus -/* *INDENT-OFF* */ } -/* *INDENT-ON* */ #endif #include "close_code.h" diff --git a/src/eepp/helper/SDL2/include/SDL_events.h b/src/eepp/helper/SDL2/include/SDL_events.h index a47c4aec4..ae0b0f166 100644 --- a/src/eepp/helper/SDL2/include/SDL_events.h +++ b/src/eepp/helper/SDL2/include/SDL_events.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,7 +21,7 @@ /** * \file SDL_events.h - * + * * Include file for SDL event handling. */ @@ -42,14 +42,12 @@ #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus -/* *INDENT-OFF* */ extern "C" { -/* *INDENT-ON* */ #endif /* General keyboard/mouse state definitions */ -#define SDL_RELEASED 0 -#define SDL_PRESSED 1 +#define SDL_RELEASED 0 +#define SDL_PRESSED 1 /** * \brief The types of events that can be delivered. @@ -61,6 +59,32 @@ typedef enum /* Application events */ SDL_QUIT = 0x100, /**< User-requested quit */ + /* These application events have special meaning on iOS, see README.iOS for details */ + SDL_APP_TERMINATING, /**< The application is being terminated by the OS + Called on iOS in applicationWillTerminate() + Called on Android in onDestroy() + */ + SDL_APP_LOWMEMORY, /**< The application is low on memory, free memory if possible. + Called on iOS in applicationDidReceiveMemoryWarning() + Called on Android in onLowMemory() + */ + SDL_APP_WILLENTERBACKGROUND, /**< The application is about to enter the background + Called on iOS in applicationWillResignActive() + Called on Android in onPause() + */ + SDL_APP_DIDENTERBACKGROUND, /**< The application did enter the background and may not get CPU for some time + Called on iOS in applicationDidEnterBackground() + Called on Android in onPause() + */ + SDL_APP_WILLENTERFOREGROUND, /**< The application is about to enter the foreground + Called on iOS in applicationWillEnterForeground() + Called on Android in onResume() + */ + SDL_APP_DIDENTERFOREGROUND, /**< The application is now interactive + Called on iOS in applicationDidBecomeActive() + Called on Android in onResume() + */ + /* Window events */ SDL_WINDOWEVENT = 0x200, /**< Window state change */ SDL_SYSWMEVENT, /**< System specific event */ @@ -77,14 +101,6 @@ typedef enum SDL_MOUSEBUTTONUP, /**< Mouse button released */ SDL_MOUSEWHEEL, /**< Mouse wheel motion */ - /* Tablet or multiple mice input device events */ - SDL_INPUTMOTION = 0x500, /**< Input moved */ - SDL_INPUTBUTTONDOWN, /**< Input button pressed */ - SDL_INPUTBUTTONUP, /**< Input button released */ - SDL_INPUTWHEEL, /**< Input wheel motion */ - SDL_INPUTPROXIMITYIN, /**< Input pen entered proximity */ - SDL_INPUTPROXIMITYOUT, /**< Input pen left proximity */ - /* Joystick events */ SDL_JOYAXISMOTION = 0x600, /**< Joystick axis motion */ SDL_JOYBALLMOTION, /**< Joystick trackball motion */ @@ -94,19 +110,18 @@ typedef enum SDL_JOYDEVICEADDED, /**< A new joystick has been inserted into the system */ SDL_JOYDEVICEREMOVED, /**< An opened joystick has been removed */ - /* Game controller events */ - SDL_CONTROLLERAXISMOTION = 0x650, /**< Game controller axis motion */ - SDL_CONTROLLERBUTTONDOWN, /**< Game controller button pressed */ - SDL_CONTROLLERBUTTONUP, /**< Game controller button released */ - SDL_CONTROLLERDEVICEADDED, /**< A new Game controller has been inserted into the system */ - SDL_CONTROLLERDEVICEREMOVED, /**< An opened Game controller has been removed */ + /* Game controller events */ + SDL_CONTROLLERAXISMOTION = 0x650, /**< Game controller axis motion */ + SDL_CONTROLLERBUTTONDOWN, /**< Game controller button pressed */ + SDL_CONTROLLERBUTTONUP, /**< Game controller button released */ + SDL_CONTROLLERDEVICEADDED, /**< A new Game controller has been inserted into the system */ + SDL_CONTROLLERDEVICEREMOVED, /**< An opened Game controller has been removed */ + SDL_CONTROLLERDEVICEREMAPPED, /**< The controller mapping was updated */ /* Touch events */ SDL_FINGERDOWN = 0x700, SDL_FINGERUP, SDL_FINGERMOTION, - SDL_TOUCHBUTTONDOWN, - SDL_TOUCHBUTTONUP, /* Gesture events */ SDL_DOLLARGESTURE = 0x800, @@ -130,6 +145,15 @@ typedef enum SDL_LASTEVENT = 0xFFFF } SDL_EventType; +/** + * \brief Fields shared by every event + */ +typedef struct SDL_CommonEvent +{ + Uint32 type; + Uint32 timestamp; +} SDL_CommonEvent; + /** * \brief Window state change event data (event.window.*) */ @@ -142,8 +166,8 @@ typedef struct SDL_WindowEvent Uint8 padding1; Uint8 padding2; Uint8 padding3; - int data1; /**< event dependent data */ - int data2; /**< event dependent data */ + Sint32 data1; /**< event dependent data */ + Sint32 data2; /**< event dependent data */ } SDL_WindowEvent; /** @@ -171,8 +195,8 @@ typedef struct SDL_TextEditingEvent Uint32 timestamp; Uint32 windowID; /**< The window with keyboard focus, if any */ char text[SDL_TEXTEDITINGEVENT_TEXT_SIZE]; /**< The editing text */ - int start; /**< The start cursor of selected editing text */ - int length; /**< The length of selected editing text */ + Sint32 start; /**< The start cursor of selected editing text */ + Sint32 length; /**< The length of selected editing text */ } SDL_TextEditingEvent; @@ -196,14 +220,12 @@ typedef struct SDL_MouseMotionEvent Uint32 type; /**< ::SDL_MOUSEMOTION */ Uint32 timestamp; Uint32 windowID; /**< The window with mouse focus, if any */ - Uint8 state; /**< The current button state */ - Uint8 padding1; - Uint8 padding2; - Uint8 padding3; - int x; /**< X coordinate, relative to window */ - int y; /**< Y coordinate, relative to window */ - int xrel; /**< The relative motion in the X direction */ - int yrel; /**< The relative motion in the Y direction */ + Uint32 which; /**< The mouse instance id, or SDL_TOUCH_MOUSEID */ + Uint32 state; /**< The current button state */ + Sint32 x; /**< X coordinate, relative to window */ + Sint32 y; /**< Y coordinate, relative to window */ + Sint32 xrel; /**< The relative motion in the X direction */ + Sint32 yrel; /**< The relative motion in the Y direction */ } SDL_MouseMotionEvent; /** @@ -214,12 +236,13 @@ typedef struct SDL_MouseButtonEvent Uint32 type; /**< ::SDL_MOUSEBUTTONDOWN or ::SDL_MOUSEBUTTONUP */ Uint32 timestamp; Uint32 windowID; /**< The window with mouse focus, if any */ + Uint32 which; /**< The mouse instance id, or SDL_TOUCH_MOUSEID */ Uint8 button; /**< The mouse button index */ Uint8 state; /**< ::SDL_PRESSED or ::SDL_RELEASED */ Uint8 padding1; Uint8 padding2; - int x; /**< X coordinate, relative to window */ - int y; /**< Y coordinate, relative to window */ + Sint32 x; /**< X coordinate, relative to window */ + Sint32 y; /**< Y coordinate, relative to window */ } SDL_MouseButtonEvent; /** @@ -230,8 +253,9 @@ typedef struct SDL_MouseWheelEvent Uint32 type; /**< ::SDL_MOUSEWHEEL */ Uint32 timestamp; Uint32 windowID; /**< The window with mouse focus, if any */ - int x; /**< The amount scrolled horizontally */ - int y; /**< The amount scrolled vertically */ + Uint32 which; /**< The mouse instance id, or SDL_TOUCH_MOUSEID */ + Sint32 x; /**< The amount scrolled horizontally */ + Sint32 y; /**< The amount scrolled vertically */ } SDL_MouseWheelEvent; /** @@ -241,11 +265,13 @@ typedef struct SDL_JoyAxisEvent { Uint32 type; /**< ::SDL_JOYAXISMOTION */ Uint32 timestamp; - Uint8 which; /**< The joystick instance id */ + SDL_JoystickID which; /**< The joystick instance id */ Uint8 axis; /**< The joystick axis index */ Uint8 padding1; Uint8 padding2; - int value; /**< The axis value (range: -32768 to 32767) */ + Uint8 padding3; + Sint16 value; /**< The axis value (range: -32768 to 32767) */ + Uint16 padding4; } SDL_JoyAxisEvent; /** @@ -255,12 +281,13 @@ typedef struct SDL_JoyBallEvent { Uint32 type; /**< ::SDL_JOYBALLMOTION */ Uint32 timestamp; - Uint8 which; /**< The joystick instance id */ + SDL_JoystickID which; /**< The joystick instance id */ Uint8 ball; /**< The joystick trackball index */ Uint8 padding1; Uint8 padding2; - int xrel; /**< The relative motion in the X direction */ - int yrel; /**< The relative motion in the Y direction */ + Uint8 padding3; + Sint16 xrel; /**< The relative motion in the X direction */ + Sint16 yrel; /**< The relative motion in the Y direction */ } SDL_JoyBallEvent; /** @@ -270,16 +297,17 @@ typedef struct SDL_JoyHatEvent { Uint32 type; /**< ::SDL_JOYHATMOTION */ Uint32 timestamp; - Uint8 which; /**< The joystick instance id */ + SDL_JoystickID which; /**< The joystick instance id */ Uint8 hat; /**< The joystick hat index */ Uint8 value; /**< The hat position value. * \sa ::SDL_HAT_LEFTUP ::SDL_HAT_UP ::SDL_HAT_RIGHTUP * \sa ::SDL_HAT_LEFT ::SDL_HAT_CENTERED ::SDL_HAT_RIGHT * \sa ::SDL_HAT_LEFTDOWN ::SDL_HAT_DOWN ::SDL_HAT_RIGHTDOWN - * + * * Note that zero means the POV is centered. */ Uint8 padding1; + Uint8 padding2; } SDL_JoyHatEvent; /** @@ -289,10 +317,11 @@ typedef struct SDL_JoyButtonEvent { Uint32 type; /**< ::SDL_JOYBUTTONDOWN or ::SDL_JOYBUTTONUP */ Uint32 timestamp; - Uint8 which; /**< The joystick instance id */ + SDL_JoystickID which; /**< The joystick instance id */ Uint8 button; /**< The joystick button index */ Uint8 state; /**< ::SDL_PRESSED or ::SDL_RELEASED */ Uint8 padding1; + Uint8 padding2; } SDL_JoyButtonEvent; /** @@ -300,9 +329,9 @@ typedef struct SDL_JoyButtonEvent */ typedef struct SDL_JoyDeviceEvent { - Uint32 type; /**< ::SDL_JOYDEVICEADDED or ::SDL_JOYDEVICEREMOVED */ - Uint32 timestamp; - Uint32 which; /**< The joystick device index for ADD, instance_id for REMOVE*/ + Uint32 type; /**< ::SDL_JOYDEVICEADDED or ::SDL_JOYDEVICEREMOVED */ + Uint32 timestamp; + Sint32 which; /**< The joystick device index for the ADDED event, instance id for the REMOVED event */ } SDL_JoyDeviceEvent; @@ -313,9 +342,13 @@ typedef struct SDL_ControllerAxisEvent { Uint32 type; /**< ::SDL_CONTROLLERAXISMOTION */ Uint32 timestamp; - Uint8 which; /**< The joystick instance id */ - SDL_CONTROLLER_AXIS axis; /**< The joystick axis index */ - int value; /**< The axis value (range: -32768 to 32767) */ + SDL_JoystickID which; /**< The joystick instance id */ + Uint8 axis; /**< The controller axis (SDL_GameControllerAxis) */ + Uint8 padding1; + Uint8 padding2; + Uint8 padding3; + Sint16 value; /**< The axis value (range: -32768 to 32767) */ + Uint16 padding4; } SDL_ControllerAxisEvent; @@ -326,9 +359,11 @@ typedef struct SDL_ControllerButtonEvent { Uint32 type; /**< ::SDL_CONTROLLERBUTTONDOWN or ::SDL_CONTROLLERBUTTONUP */ Uint32 timestamp; - Uint8 which; /**< The joystick instance id */ - SDL_CONTROLLER_BUTTON button; /**< The joystick button index */ + SDL_JoystickID which; /**< The joystick instance id */ + Uint8 button; /**< The controller button (SDL_GameControllerButton) */ Uint8 state; /**< ::SDL_PRESSED or ::SDL_RELEASED */ + Uint8 padding1; + Uint8 padding2; } SDL_ControllerButtonEvent; @@ -337,51 +372,29 @@ typedef struct SDL_ControllerButtonEvent */ typedef struct SDL_ControllerDeviceEvent { - Uint32 type; /**< ::SDL_CONTROLLERDEVICEADDED or ::SDL_CONTROLLERDEVICEREMOVED */ - Uint32 timestamp; - Uint32 which; /**< The joystick device index for ADD, instance_id for REMOVE*/ + Uint32 type; /**< ::SDL_CONTROLLERDEVICEADDED, ::SDL_CONTROLLERDEVICEREMOVED, or ::SDL_CONTROLLERDEVICEREMAPPED */ + Uint32 timestamp; + Sint32 which; /**< The joystick device index for the ADDED event, instance id for the REMOVED or REMAPPED event */ } SDL_ControllerDeviceEvent; /** - * \brief Touch finger motion/finger event structure (event.tfinger.*) + * \brief Touch finger event structure (event.tfinger.*) */ typedef struct SDL_TouchFingerEvent { - Uint32 type; /**< ::SDL_FINGERMOTION OR - SDL_FINGERDOWN OR SDL_FINGERUP*/ + Uint32 type; /**< ::SDL_FINGERMOTION or ::SDL_FINGERDOWN or ::SDL_FINGERUP */ Uint32 timestamp; - Uint32 windowID; /**< The window with mouse focus, if any */ - SDL_TouchID touchId; /**< The touch device id */ + SDL_TouchID touchId; /**< The touch device id */ SDL_FingerID fingerId; - Uint8 state; /**< The current button state */ - Uint8 padding1; - Uint8 padding2; - Uint8 padding3; - Uint16 x; - Uint16 y; - Sint16 dx; - Sint16 dy; - Uint16 pressure; + float x; /**< Normalized in the range 0...1 */ + float y; /**< Normalized in the range 0...1 */ + float dx; /**< Normalized in the range 0...1 */ + float dy; /**< Normalized in the range 0...1 */ + float pressure; /**< Normalized in the range 0...1 */ } SDL_TouchFingerEvent; -/** - * \brief Touch finger motion/finger event structure (event.tbutton.*) - */ -typedef struct SDL_TouchButtonEvent -{ - Uint32 type; /**< ::SDL_TOUCHBUTTONUP OR SDL_TOUCHBUTTONDOWN */ - Uint32 timestamp; - Uint32 windowID; /**< The window with mouse focus, if any */ - SDL_TouchID touchId; /**< The touch device index */ - Uint8 state; /**< The current button state */ - Uint8 button; /**< The button changing state */ - Uint8 padding1; - Uint8 padding2; -} SDL_TouchButtonEvent; - - /** * \brief Multiple Finger Gesture Event (event.mgesture.*) */ @@ -389,31 +402,27 @@ typedef struct SDL_MultiGestureEvent { Uint32 type; /**< ::SDL_MULTIGESTURE */ Uint32 timestamp; - Uint32 windowID; /**< The window with mouse focus, if any */ - SDL_TouchID touchId; /**< The touch device index */ + SDL_TouchID touchId; /**< The touch device index */ float dTheta; float dDist; - float x; /* currently 0...1. Change to screen coords? */ - float y; + float x; + float y; Uint16 numFingers; Uint16 padding; } SDL_MultiGestureEvent; + /* (event.dgesture.*) */ typedef struct SDL_DollarGestureEvent { Uint32 type; /**< ::SDL_DOLLARGESTURE */ Uint32 timestamp; - Uint32 windowID; /**< The window with mouse focus, if any */ - SDL_TouchID touchId; /**< The touch device index */ + SDL_TouchID touchId; /**< The touch device id */ SDL_GestureID gestureId; Uint32 numFingers; float error; - /* - //TODO: Enable to give location? - float x; //currently 0...1. Change to screen coords? - float y; - */ + float x; /**< Normalized center of gesture */ + float y; /**< Normalized center of gesture */ } SDL_DollarGestureEvent; @@ -439,6 +448,14 @@ typedef struct SDL_QuitEvent Uint32 timestamp; } SDL_QuitEvent; +/** + * \brief OS Specific event + */ +typedef struct SDL_OSEvent +{ + Uint32 type; /**< ::SDL_QUIT */ + Uint32 timestamp; +} SDL_OSEvent; /** * \brief A user-defined event type (event.user.*) @@ -448,7 +465,7 @@ typedef struct SDL_UserEvent Uint32 type; /**< ::SDL_USEREVENT through ::SDL_NUMEVENTS-1 */ Uint32 timestamp; Uint32 windowID; /**< The associated window if any */ - int code; /**< User defined event code */ + Sint32 code; /**< User defined event code */ void *data1; /**< User defined data pointer */ void *data2; /**< User defined data pointer */ } SDL_UserEvent; @@ -476,6 +493,7 @@ typedef struct SDL_SysWMEvent typedef union SDL_Event { Uint32 type; /**< Event type, shared with all events */ + SDL_CommonEvent common; /**< Common event data */ SDL_WindowEvent window; /**< Window event data */ SDL_KeyboardEvent key; /**< Keyboard event data */ SDL_TextEditingEvent edit; /**< Text editing event data */ @@ -488,16 +506,15 @@ typedef union SDL_Event SDL_JoyHatEvent jhat; /**< Joystick hat event data */ SDL_JoyButtonEvent jbutton; /**< Joystick button event data */ SDL_JoyDeviceEvent jdevice; /**< Joystick device change event data */ - SDL_ControllerAxisEvent caxis; /**< Game Controller button event data */ - SDL_ControllerButtonEvent cbutton; /**< Game Controller button event data */ - SDL_ControllerDeviceEvent cdevice; /**< Game Controller device event data */ + SDL_ControllerAxisEvent caxis; /**< Game Controller axis event data */ + SDL_ControllerButtonEvent cbutton; /**< Game Controller button event data */ + SDL_ControllerDeviceEvent cdevice; /**< Game Controller device event data */ SDL_QuitEvent quit; /**< Quit request event data */ SDL_UserEvent user; /**< Custom event data */ SDL_SysWMEvent syswm; /**< System dependent window event data */ SDL_TouchFingerEvent tfinger; /**< Touch finger event data */ - SDL_TouchButtonEvent tbutton; /**< Touch button event data */ - SDL_MultiGestureEvent mgesture; /**< Multi Finger Gesture data */ - SDL_DollarGestureEvent dgesture; /**< Multi Finger Gesture data */ + SDL_MultiGestureEvent mgesture; /**< Gesture event data */ + SDL_DollarGestureEvent dgesture; /**< Gesture event data */ SDL_DropEvent drop; /**< Drag and drop event data */ /* This is necessary for ABI compatibility between Visual C++ and GCC @@ -515,9 +532,9 @@ typedef union SDL_Event /** * Pumps the event loop, gathering events from the input devices. - * + * * This function updates the event queue and internal input device state. - * + * * This should only be run in the thread that sets the video mode. */ extern DECLSPEC void SDLCALL SDL_PumpEvents(void); @@ -532,20 +549,20 @@ typedef enum /** * Checks the event queue for messages and optionally returns them. - * + * * If \c action is ::SDL_ADDEVENT, up to \c numevents events will be added to * the back of the event queue. - * + * * If \c action is ::SDL_PEEKEVENT, up to \c numevents events at the front * of the event queue, within the specified minimum and maximum type, * will be returned and will not be removed from the queue. - * - * If \c action is ::SDL_GETEVENT, up to \c numevents events at the front + * + * If \c action is ::SDL_GETEVENT, up to \c numevents events at the front * of the event queue, within the specified minimum and maximum type, * will be returned and will be removed from the queue. - * + * * \return The number of events actually stored, or -1 if there was an error. - * + * * This function is thread-safe. */ extern DECLSPEC int SDLCALL SDL_PeepEvents(SDL_Event * events, int numevents, @@ -567,40 +584,41 @@ extern DECLSPEC void SDLCALL SDL_FlushEvents(Uint32 minType, Uint32 maxType); /** * \brief Polls for currently pending events. - * + * * \return 1 if there are any pending events, or 0 if there are none available. - * - * \param event If not NULL, the next event is removed from the queue and + * + * \param event If not NULL, the next event is removed from the queue and * stored in that area. */ extern DECLSPEC int SDLCALL SDL_PollEvent(SDL_Event * event); /** * \brief Waits indefinitely for the next available event. - * + * * \return 1, or 0 if there was an error while waiting for events. - * - * \param event If not NULL, the next event is removed from the queue and + * + * \param event If not NULL, the next event is removed from the queue and * stored in that area. */ extern DECLSPEC int SDLCALL SDL_WaitEvent(SDL_Event * event); /** - * \brief Waits until the specified timeout (in milliseconds) for the next + * \brief Waits until the specified timeout (in milliseconds) for the next * available event. - * + * * \return 1, or 0 if there was an error while waiting for events. - * - * \param event If not NULL, the next event is removed from the queue and + * + * \param event If not NULL, the next event is removed from the queue and * stored in that area. + * \param timeout The timeout (in milliseconds) to wait for next event. */ extern DECLSPEC int SDLCALL SDL_WaitEventTimeout(SDL_Event * event, int timeout); /** * \brief Add an event to the event queue. - * - * \return 1 on success, 0 if the event was filtered, or -1 if the event queue + * + * \return 1 on success, 0 if the event was filtered, or -1 if the event queue * was full or there was some other error. */ extern DECLSPEC int SDLCALL SDL_PushEvent(SDL_Event * event); @@ -610,20 +628,20 @@ typedef int (SDLCALL * SDL_EventFilter) (void *userdata, SDL_Event * event); /** * Sets up a filter to process all events before they change internal state and * are posted to the internal event queue. - * - * The filter is protypted as: + * + * The filter is prototyped as: * \code * int SDL_EventFilter(void *userdata, SDL_Event * event); * \endcode * * If the filter returns 1, then the event will be added to the internal queue. - * If it returns 0, then the event will be dropped from the queue, but the + * If it returns 0, then the event will be dropped from the queue, but the * internal state will still be updated. This allows selective filtering of * dynamically arriving events. - * - * \warning Be very careful of what you do in the event filter function, as + * + * \warning Be very careful of what you do in the event filter function, as * it may run in a different thread! - * + * * There is one caveat when dealing with the ::SDL_QUITEVENT event type. The * event filter is only called when the window manager desires to close the * application window. If the event filter returns 1, then the window will @@ -662,18 +680,18 @@ extern DECLSPEC void SDLCALL SDL_FilterEvents(SDL_EventFilter filter, void *userdata); /*@{*/ -#define SDL_QUERY -1 -#define SDL_IGNORE 0 -#define SDL_DISABLE 0 -#define SDL_ENABLE 1 +#define SDL_QUERY -1 +#define SDL_IGNORE 0 +#define SDL_DISABLE 0 +#define SDL_ENABLE 1 /** * This function allows you to set the state of processing certain events. - * - If \c state is set to ::SDL_IGNORE, that event will be automatically + * - If \c state is set to ::SDL_IGNORE, that event will be automatically * dropped from the event queue and will not event be filtered. - * - If \c state is set to ::SDL_ENABLE, that event will be processed + * - If \c state is set to ::SDL_ENABLE, that event will be processed * normally. - * - If \c state is set to ::SDL_QUERY, SDL_EventState() will return the + * - If \c state is set to ::SDL_QUERY, SDL_EventState() will return the * current processing state of the specified event. */ extern DECLSPEC Uint8 SDLCALL SDL_EventState(Uint32 type, int state); @@ -691,9 +709,7 @@ extern DECLSPEC Uint32 SDLCALL SDL_RegisterEvents(int numevents); /* Ends C function definitions when using C++ */ #ifdef __cplusplus -/* *INDENT-OFF* */ } -/* *INDENT-ON* */ #endif #include "close_code.h" diff --git a/src/eepp/helper/SDL2/include/SDL_gamecontroller.h b/src/eepp/helper/SDL2/include/SDL_gamecontroller.h index 0fde9d6f9..b2e35fb89 100644 --- a/src/eepp/helper/SDL2/include/SDL_gamecontroller.h +++ b/src/eepp/helper/SDL2/include/SDL_gamecontroller.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,7 +21,7 @@ /** * \file SDL_gamecontroller.h - * + * * Include file for SDL game controller event handling */ @@ -35,9 +35,7 @@ #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus -/* *INDENT-OFF* */ extern "C" { -/* *INDENT-ON* */ #endif /** @@ -53,67 +51,84 @@ struct _SDL_GameController; typedef struct _SDL_GameController SDL_GameController; -typedef enum +typedef enum { - SDL_CONTROLLER_BINDTYPE_NONE = 0, - SDL_CONTROLLER_BINDTYPE_BUTTON, - SDL_CONTROLLER_BINDTYPE_AXIS, - SDL_CONTROLLER_BINDTYPE_HAT, -} SDL_CONTROLLER_BINDTYPE; -/** - * get the sdl joystick layer binding for this controller button/axis mapping - */ -struct _SDL_GameControllerHatBind -{ - int hat; - int hat_mask; -}; + SDL_CONTROLLER_BINDTYPE_NONE = 0, + SDL_CONTROLLER_BINDTYPE_BUTTON, + SDL_CONTROLLER_BINDTYPE_AXIS, + SDL_CONTROLLER_BINDTYPE_HAT +} SDL_GameControllerBindType; -typedef struct _SDL_GameControllerButtonBind +/** + * Get the SDL joystick layer binding for this controller button/axis mapping + */ +typedef struct SDL_GameControllerButtonBind { - SDL_CONTROLLER_BINDTYPE m_eBindType; - union - { - int button; - int axis; - struct _SDL_GameControllerHatBind hat; - }; + SDL_GameControllerBindType bindType; + union + { + int button; + int axis; + struct { + int hat; + int hat_mask; + } hat; + } value; } SDL_GameControllerButtonBind; /** * To count the number of game controllers in the system for the following: - * int nJoysticks = SDL_NumJoysticks(); - * int nGameControllers = 0; - * for ( int i = 0; i < nJoysticks; i++ ) { - * if ( SDL_IsGameController(i) ) { - * nGameControllers++; - * } + * int nJoysticks = SDL_NumJoysticks(); + * int nGameControllers = 0; + * for ( int i = 0; i < nJoysticks; i++ ) { + * if ( SDL_IsGameController(i) ) { + * nGameControllers++; + * } * } * - * Using the SDL_HINT_GAMECONTROLLERCONFIG hint you can add support for controllers SDL is unaware of or cause an existing controller to have a different binding. The format is: - * guid,name,mappings + * Using the SDL_HINT_GAMECONTROLLERCONFIG hint or the SDL_GameControllerAddMapping you can add support for controllers SDL is unaware of or cause an existing controller to have a different binding. The format is: + * guid,name,mappings * * Where GUID is the string value from SDL_JoystickGetGUIDString(), name is the human readable string for the device and mappings are controller mappings to joystick ones. * Under Windows there is a reserved GUID of "xinput" that covers any XInput devices. - * The mapping format for joystick is: - * bX - a joystick button, index X - * hX.Y - hat X with value Y - * aX - axis X of the joystick + * The mapping format for joystick is: + * bX - a joystick button, index X + * hX.Y - hat X with value Y + * aX - axis X of the joystick * Buttons can be used as a controller axis and vice versa. * * This string shows an example of a valid mapping for a controller - * "341a3608000000000000504944564944,Aferglow 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", + * "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", * */ +/** + * Add or update an existing mapping configuration + * + * \return 1 if mapping is added, 0 if updated, -1 on error + */ +extern DECLSPEC int SDLCALL SDL_GameControllerAddMapping( const char* mappingString ); + +/** + * Get a mapping string for a GUID + * + * \return the mapping string. Must be freed with SDL_free. Returns NULL if no mapping is available + */ +extern DECLSPEC char * SDLCALL SDL_GameControllerMappingForGUID( SDL_JoystickGUID guid ); + +/** + * Get a mapping string for an open GameController + * + * \return the mapping string. Must be freed with SDL_free. Returns NULL if no mapping is available + */ +extern DECLSPEC char * SDLCALL SDL_GameControllerMapping( SDL_GameController * gamecontroller ); /** * Is the joystick on this index supported by the game controller interface? - * returns 1 if supported, 0 otherwise. */ -extern DECLSPEC int SDLCALL SDL_IsGameController(int joystick_index); +extern DECLSPEC SDL_bool SDLCALL SDL_IsGameController(int joystick_index); /** @@ -124,11 +139,11 @@ extern DECLSPEC int SDLCALL SDL_IsGameController(int joystick_index); extern DECLSPEC const char *SDLCALL SDL_GameControllerNameForIndex(int joystick_index); /** - * Open a game controller for use. - * The index passed as an argument refers to the N'th game controller on the system. + * Open a game controller for use. + * The index passed as an argument refers to the N'th game controller on the system. * This index is the value which will identify this controller in future controller * events. - * + * * \return A controller identifier, or NULL if an error occurred. */ extern DECLSPEC SDL_GameController *SDLCALL SDL_GameControllerOpen(int joystick_index); @@ -136,119 +151,141 @@ extern DECLSPEC SDL_GameController *SDLCALL SDL_GameControllerOpen(int joystick_ /** * Return the name for this currently opened controller */ -extern DECLSPEC const char *SDLCALL SDL_GameControllerName(SDL_GameController * gamecontroller); - +extern DECLSPEC const char *SDLCALL SDL_GameControllerName(SDL_GameController *gamecontroller); + /** - * Returns 1 if the controller has been opened and currently connected, or 0 if it has not. + * Returns SDL_TRUE if the controller has been opened and currently connected, + * or SDL_FALSE if it has not. */ -extern DECLSPEC int SDLCALL SDL_GameControllerGetAttached(SDL_GameController * gamecontroller); +extern DECLSPEC SDL_bool SDLCALL SDL_GameControllerGetAttached(SDL_GameController *gamecontroller); /** * Get the underlying joystick object used by a controller */ -extern DECLSPEC SDL_Joystick *SDLCALL SDL_GameControllerGetJoystick(SDL_GameController * gamecontroller); +extern DECLSPEC SDL_Joystick *SDLCALL SDL_GameControllerGetJoystick(SDL_GameController *gamecontroller); /** * Enable/disable controller event polling. - * + * * If controller events are disabled, you must call SDL_GameControllerUpdate() * yourself and check the state of the controller when you want controller * information. - * + * * The state can be one of ::SDL_QUERY, ::SDL_ENABLE or ::SDL_IGNORE. */ extern DECLSPEC int SDLCALL SDL_GameControllerEventState(int state); /** - * The list of axii available from a controller + * Update the current state of the open game controllers. + * + * This is called automatically by the event loop if any game controller + * events are enabled. */ -typedef enum +extern DECLSPEC void SDLCALL SDL_GameControllerUpdate(void); + + +/** + * The list of axes available from a controller + */ +typedef enum { - SDL_CONTROLLER_AXIS_INVALID = -1, - SDL_CONTROLLER_AXIS_LEFTX, - SDL_CONTROLLER_AXIS_LEFTY, - SDL_CONTROLLER_AXIS_RIGHTX, - SDL_CONTROLLER_AXIS_RIGHTY, - SDL_CONTROLLER_AXIS_TRIGGERLEFT, - SDL_CONTROLLER_AXIS_TRIGGERRIGHT, - SDL_CONTROLLER_AXIS_MAX -} SDL_CONTROLLER_AXIS; + SDL_CONTROLLER_AXIS_INVALID = -1, + SDL_CONTROLLER_AXIS_LEFTX, + SDL_CONTROLLER_AXIS_LEFTY, + SDL_CONTROLLER_AXIS_RIGHTX, + SDL_CONTROLLER_AXIS_RIGHTY, + SDL_CONTROLLER_AXIS_TRIGGERLEFT, + SDL_CONTROLLER_AXIS_TRIGGERRIGHT, + SDL_CONTROLLER_AXIS_MAX +} SDL_GameControllerAxis; /** * turn this string into a axis mapping */ -extern DECLSPEC SDL_CONTROLLER_AXIS SDLCALL SDL_GameControllerGetAxisFromString(const char *pchString); +extern DECLSPEC SDL_GameControllerAxis SDLCALL SDL_GameControllerGetAxisFromString(const char *pchString); /** - * get the sdl joystick layer binding for this controller button mapping + * turn this axis enum into a string mapping */ -extern DECLSPEC SDL_GameControllerButtonBind SDLCALL SDL_GameControllerGetBindForAxis(SDL_GameController * gamecontroller, SDL_CONTROLLER_AXIS button); +extern DECLSPEC const char* SDLCALL SDL_GameControllerGetStringForAxis(SDL_GameControllerAxis axis); + +/** + * Get the SDL joystick layer binding for this controller button mapping + */ +extern DECLSPEC SDL_GameControllerButtonBind SDLCALL +SDL_GameControllerGetBindForAxis(SDL_GameController *gamecontroller, + SDL_GameControllerAxis axis); /** * Get the current state of an axis control on a game controller. - * + * * The state is a value ranging from -32768 to 32767. - * + * * The axis indices start at index 0. */ -extern DECLSPEC Sint16 SDLCALL SDL_GameControllerGetAxis(SDL_GameController * gamecontroller, - SDL_CONTROLLER_AXIS axis); +extern DECLSPEC Sint16 SDLCALL +SDL_GameControllerGetAxis(SDL_GameController *gamecontroller, + SDL_GameControllerAxis axis); /** * The list of buttons available from a controller */ typedef enum { - SDL_CONTROLLER_BUTTON_INVALID = -1, - SDL_CONTROLLER_BUTTON_A, - SDL_CONTROLLER_BUTTON_B, - SDL_CONTROLLER_BUTTON_X, - SDL_CONTROLLER_BUTTON_Y, - SDL_CONTROLLER_BUTTON_BACK, - SDL_CONTROLLER_BUTTON_GUIDE, - SDL_CONTROLLER_BUTTON_START, - SDL_CONTROLLER_BUTTON_LEFTSTICK, - SDL_CONTROLLER_BUTTON_RIGHTSTICK, - SDL_CONTROLLER_BUTTON_LEFTSHOULDER, - SDL_CONTROLLER_BUTTON_RIGHTSHOULDER, - SDL_CONTROLLER_BUTTON_DPAD_UP, - SDL_CONTROLLER_BUTTON_DPAD_DOWN, - SDL_CONTROLLER_BUTTON_DPAD_LEFT, - SDL_CONTROLLER_BUTTON_DPAD_RIGHT, - SDL_CONTROLLER_BUTTON_MAX -} SDL_CONTROLLER_BUTTON; + SDL_CONTROLLER_BUTTON_INVALID = -1, + SDL_CONTROLLER_BUTTON_A, + SDL_CONTROLLER_BUTTON_B, + SDL_CONTROLLER_BUTTON_X, + SDL_CONTROLLER_BUTTON_Y, + SDL_CONTROLLER_BUTTON_BACK, + SDL_CONTROLLER_BUTTON_GUIDE, + SDL_CONTROLLER_BUTTON_START, + SDL_CONTROLLER_BUTTON_LEFTSTICK, + SDL_CONTROLLER_BUTTON_RIGHTSTICK, + SDL_CONTROLLER_BUTTON_LEFTSHOULDER, + SDL_CONTROLLER_BUTTON_RIGHTSHOULDER, + SDL_CONTROLLER_BUTTON_DPAD_UP, + SDL_CONTROLLER_BUTTON_DPAD_DOWN, + SDL_CONTROLLER_BUTTON_DPAD_LEFT, + SDL_CONTROLLER_BUTTON_DPAD_RIGHT, + SDL_CONTROLLER_BUTTON_MAX +} SDL_GameControllerButton; /** * turn this string into a button mapping */ -extern DECLSPEC SDL_CONTROLLER_BUTTON SDLCALL SDL_GameControllerGetButtonFromString(const char *pchString); - +extern DECLSPEC SDL_GameControllerButton SDLCALL SDL_GameControllerGetButtonFromString(const char *pchString); /** - * get the sdl joystick layer binding for this controller button mapping + * turn this button enum into a string mapping */ -extern DECLSPEC SDL_GameControllerButtonBind SDLCALL SDL_GameControllerGetBindForButton(SDL_GameController * gamecontroller, SDL_CONTROLLER_BUTTON button); +extern DECLSPEC const char* SDLCALL SDL_GameControllerGetStringForButton(SDL_GameControllerButton button); + +/** + * Get the SDL joystick layer binding for this controller button mapping + */ +extern DECLSPEC SDL_GameControllerButtonBind SDLCALL +SDL_GameControllerGetBindForButton(SDL_GameController *gamecontroller, + SDL_GameControllerButton button); /** * Get the current state of a button on a game controller. - * + * * The button indices start at index 0. */ -extern DECLSPEC Uint8 SDLCALL SDL_GameControllerGetButton(SDL_GameController * gamecontroller, - SDL_CONTROLLER_BUTTON button); +extern DECLSPEC Uint8 SDLCALL SDL_GameControllerGetButton(SDL_GameController *gamecontroller, + SDL_GameControllerButton button); /** * Close a controller previously opened with SDL_GameControllerOpen(). */ -extern DECLSPEC void SDLCALL SDL_GameControllerClose(SDL_GameController * gamecontrollerk); +extern DECLSPEC void SDLCALL SDL_GameControllerClose(SDL_GameController *gamecontroller); /* Ends C function definitions when using C++ */ #ifdef __cplusplus -/* *INDENT-OFF* */ } -/* *INDENT-ON* */ #endif #include "close_code.h" diff --git a/src/eepp/helper/SDL2/include/SDL_gesture.h b/src/eepp/helper/SDL2/include/SDL_gesture.h index 8ef2205ad..21f10ead7 100644 --- a/src/eepp/helper/SDL2/include/SDL_gesture.h +++ b/src/eepp/helper/SDL2/include/SDL_gesture.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,7 +21,7 @@ /** * \file SDL_gesture.h - * + * * Include file for SDL gesture event handling. */ @@ -38,9 +38,7 @@ #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus -/* *INDENT-OFF* */ extern "C" { -/* *INDENT-ON* */ #endif typedef Sint64 SDL_GestureID; @@ -80,9 +78,7 @@ extern DECLSPEC int SDLCALL SDL_LoadDollarTemplates(SDL_TouchID touchId, SDL_RWo /* Ends C function definitions when using C++ */ #ifdef __cplusplus -/* *INDENT-OFF* */ } -/* *INDENT-ON* */ #endif #include "close_code.h" diff --git a/src/eepp/helper/SDL2/include/SDL_haptic.h b/src/eepp/helper/SDL2/include/SDL_haptic.h index e0267007b..a06c310b0 100644 --- a/src/eepp/helper/SDL2/include/SDL_haptic.h +++ b/src/eepp/helper/SDL2/include/SDL_haptic.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,10 +21,10 @@ /** * \file SDL_haptic.h - * + * * \brief The SDL Haptic subsystem allows you to control haptic (force feedback) * devices. - * + * * The basic usage is as follows: * - Initialize the Subsystem (::SDL_INIT_HAPTIC). * - Open a Haptic Device. @@ -119,16 +119,14 @@ #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus -/* *INDENT-OFF* */ extern "C" { - /* *INDENT-ON* */ #endif /* __cplusplus */ /** * \typedef SDL_Haptic - * + * * \brief The haptic structure used to identify an SDL haptic. - * + * * \sa SDL_HapticOpen * \sa SDL_HapticOpenFromJoystick * \sa SDL_HapticClose @@ -139,7 +137,7 @@ typedef struct _SDL_Haptic SDL_Haptic; /** * \name Haptic features - * + * * Different haptic features a device can have. */ /*@{*/ @@ -153,68 +151,68 @@ typedef struct _SDL_Haptic SDL_Haptic; * \brief Constant effect supported. * * Constant haptic effect. - * + * * \sa SDL_HapticCondition */ #define SDL_HAPTIC_CONSTANT (1<<0) /** * \brief Sine wave effect supported. - * + * * Periodic haptic effect that simulates sine waves. - * + * * \sa SDL_HapticPeriodic */ #define SDL_HAPTIC_SINE (1<<1) /** * \brief Square wave effect supported. - * + * * Periodic haptic effect that simulates square waves. - * + * * \sa SDL_HapticPeriodic */ #define SDL_HAPTIC_SQUARE (1<<2) /** * \brief Triangle wave effect supported. - * + * * Periodic haptic effect that simulates triangular waves. - * + * * \sa SDL_HapticPeriodic */ #define SDL_HAPTIC_TRIANGLE (1<<3) /** * \brief Sawtoothup wave effect supported. - * + * * Periodic haptic effect that simulates saw tooth up waves. - * + * * \sa SDL_HapticPeriodic */ #define SDL_HAPTIC_SAWTOOTHUP (1<<4) /** * \brief Sawtoothdown wave effect supported. - * + * * Periodic haptic effect that simulates saw tooth down waves. - * + * * \sa SDL_HapticPeriodic */ #define SDL_HAPTIC_SAWTOOTHDOWN (1<<5) /** * \brief Ramp effect supported. - * + * * Ramp haptic effect. - * + * * \sa SDL_HapticRamp */ #define SDL_HAPTIC_RAMP (1<<6) /** * \brief Spring effect supported - uses axes position. - * + * * Condition haptic effect that simulates a spring. Effect is based on the * axes position. * @@ -224,17 +222,17 @@ typedef struct _SDL_Haptic SDL_Haptic; /** * \brief Damper effect supported - uses axes velocity. - * + * * Condition haptic effect that simulates dampening. Effect is based on the * axes velocity. - * + * * \sa SDL_HapticCondition */ #define SDL_HAPTIC_DAMPER (1<<8) /** * \brief Inertia effect supported - uses axes acceleration. - * + * * Condition haptic effect that simulates inertia. Effect is based on the axes * acceleration. * @@ -244,17 +242,17 @@ typedef struct _SDL_Haptic SDL_Haptic; /** * \brief Friction effect supported - uses axes movement. - * - * Condition haptic effect that simulates friction. Effect is based on the + * + * Condition haptic effect that simulates friction. Effect is based on the * axes movement. - * + * * \sa SDL_HapticCondition */ #define SDL_HAPTIC_FRICTION (1<<10) /** * \brief Custom effect is supported. - * + * * User defined custom haptic effect. */ #define SDL_HAPTIC_CUSTOM (1<<11) @@ -265,34 +263,34 @@ typedef struct _SDL_Haptic SDL_Haptic; /** * \brief Device can set global gain. - * + * * Device supports setting the global gain. - * + * * \sa SDL_HapticSetGain */ #define SDL_HAPTIC_GAIN (1<<12) /** * \brief Device can set autocenter. - * + * * Device supports setting autocenter. - * + * * \sa SDL_HapticSetAutocenter */ #define SDL_HAPTIC_AUTOCENTER (1<<13) /** * \brief Device can be queried for effect status. - * + * * Device can be queried for effect status. - * + * * \sa SDL_HapticGetEffectStatus */ #define SDL_HAPTIC_STATUS (1<<14) /** * \brief Device can be paused. - * + * * \sa SDL_HapticPause * \sa SDL_HapticUnpause */ @@ -306,21 +304,21 @@ typedef struct _SDL_Haptic SDL_Haptic; /** * \brief Uses polar coordinates for the direction. - * + * * \sa SDL_HapticDirection */ #define SDL_HAPTIC_POLAR 0 /** * \brief Uses cartesian coordinates for the direction. - * + * * \sa SDL_HapticDirection */ #define SDL_HAPTIC_CARTESIAN 1 /** * \brief Uses spherical coordinates for the direction. - * + * * \sa SDL_HapticDirection */ #define SDL_HAPTIC_SPHERICAL 2 @@ -343,7 +341,7 @@ typedef struct _SDL_Haptic SDL_Haptic; /** * \brief Structure that represents a haptic direction. - * + * * Directions can be specified by: * - ::SDL_HAPTIC_POLAR : Specified by polar coordinates. * - ::SDL_HAPTIC_CARTESIAN : Specified by cartesian coordinates. @@ -361,8 +359,8 @@ typedef struct _SDL_Haptic SDL_Haptic; | | |'-----'| |__|~')_____(' [ COMPUTER ] - - + + North (0,-1) ^ | @@ -372,22 +370,22 @@ typedef struct _SDL_Haptic SDL_Haptic; | v South (0,1) - - + + [ USER ] \|||/ (o o) ---ooO-(_)-Ooo--- \endverbatim - * - * If type is ::SDL_HAPTIC_POLAR, direction is encoded by hundredths of a + * + * If type is ::SDL_HAPTIC_POLAR, direction is encoded by hundredths of a * degree starting north and turning clockwise. ::SDL_HAPTIC_POLAR only uses * the first \c dir parameter. The cardinal directions would be: * - North: 0 (0 degrees) * - East: 9000 (90 degrees) * - South: 18000 (180 degrees) * - West: 27000 (270 degrees) - * + * * If type is ::SDL_HAPTIC_CARTESIAN, direction is encoded by three positions * (X axis, Y axis and Z axis (with 3 axes)). ::SDL_HAPTIC_CARTESIAN uses * the first three \c dir parameters. The cardinal directions would be: @@ -395,13 +393,13 @@ typedef struct _SDL_Haptic SDL_Haptic; * - East: -1, 0, 0 * - South: 0, 1, 0 * - West: 1, 0, 0 - * + * * The Z axis represents the height of the effect if supported, otherwise * it's unused. In cartesian encoding (1, 2) would be the same as (2, 4), you * can use any multiple you want, only the direction matters. - * + * * If type is ::SDL_HAPTIC_SPHERICAL, direction is encoded by two rotations. - * The first two \c dir parameters are used. The \c dir parameters are as + * The first two \c dir parameters are used. The \c dir parameters are as * follows (all values are in hundredths of degrees): * - Degrees from (1, 0) rotated towards (0, 1). * - Degrees towards (0, 0, 1) (device needs at least 3 axes). @@ -411,17 +409,17 @@ typedef struct _SDL_Haptic SDL_Haptic; * from the south means the user will have to pull the stick to counteract): * \code * SDL_HapticDirection direction; - * + * * // Cartesian directions * direction.type = SDL_HAPTIC_CARTESIAN; // Using cartesian direction encoding. * direction.dir[0] = 0; // X position * direction.dir[1] = 1; // Y position * // Assuming the device has 2 axes, we don't need to specify third parameter. - * + * * // Polar directions * direction.type = SDL_HAPTIC_POLAR; // We'll be using polar direction encoding. * direction.dir[0] = 18000; // Polar only uses first parameter - * + * * // Spherical coordinates * direction.type = SDL_HAPTIC_SPHERICAL; // Spherical encoding * direction.dir[0] = 9000; // Since we only have two axes we don't need more parameters. @@ -442,12 +440,12 @@ typedef struct SDL_HapticDirection /** * \brief A structure containing a template for a Constant effect. - * + * * The struct is exclusive to the ::SDL_HAPTIC_CONSTANT effect. - * + * * A constant effect applies a constant force in the specified direction * to the joystick. - * + * * \sa SDL_HAPTIC_CONSTANT * \sa SDL_HapticEffect */ @@ -477,25 +475,25 @@ typedef struct SDL_HapticConstant /** * \brief A structure containing a template for a Periodic effect. - * + * * The struct handles the following effects: * - ::SDL_HAPTIC_SINE * - ::SDL_HAPTIC_SQUARE * - ::SDL_HAPTIC_TRIANGLE * - ::SDL_HAPTIC_SAWTOOTHUP * - ::SDL_HAPTIC_SAWTOOTHDOWN - * + * * A periodic effect consists in a wave-shaped effect that repeats itself * over time. The type determines the shape of the wave and the parameters * determine the dimensions of the wave. - * - * Phase is given by hundredth of a cyle meaning that giving the phase a value - * of 9000 will displace it 25% of it's period. Here are sample values: + * + * Phase is given by hundredth of a cycle meaning that giving the phase a value + * of 9000 will displace it 25% of its period. Here are sample values: * - 0: No phase displacement. - * - 9000: Displaced 25% of it's period. - * - 18000: Displaced 50% of it's period. - * - 27000: Displaced 75% of it's period. - * - 36000: Displaced 100% of it's period, same as 0, but 0 is preffered. + * - 9000: Displaced 25% of its period. + * - 18000: Displaced 50% of its period. + * - 27000: Displaced 75% of its period. + * - 36000: Displaced 100% of its period, same as 0, but 0 is preferred. * * Examples: * \verbatim @@ -503,28 +501,28 @@ typedef struct SDL_HapticConstant __ __ __ __ / \ / \ / \ / / \__/ \__/ \__/ - + SDL_HAPTIC_SQUARE __ __ __ __ __ | | | | | | | | | | | |__| |__| |__| |__| | - + SDL_HAPTIC_TRIANGLE /\ /\ /\ /\ /\ / \ / \ / \ / \ / / \/ \/ \/ \/ - + SDL_HAPTIC_SAWTOOTHUP /| /| /| /| /| /| /| / | / | / | / | / | / | / | / |/ |/ |/ |/ |/ |/ | - + SDL_HAPTIC_SAWTOOTHDOWN \ |\ |\ |\ |\ |\ |\ | \ | \ | \ | \ | \ | \ | \ | \| \| \| \| \| \| \| \endverbatim - * + * * \sa SDL_HAPTIC_SINE * \sa SDL_HAPTIC_SQUARE * \sa SDL_HAPTIC_TRIANGLE @@ -563,21 +561,21 @@ typedef struct SDL_HapticPeriodic /** * \brief A structure containing a template for a Condition effect. - * + * * The struct handles the following effects: * - ::SDL_HAPTIC_SPRING: Effect based on axes position. * - ::SDL_HAPTIC_DAMPER: Effect based on axes velocity. * - ::SDL_HAPTIC_INERTIA: Effect based on axes acceleration. * - ::SDL_HAPTIC_FRICTION: Effect based on axes movement. - * + * * Direction is handled by condition internals instead of a direction member. * The condition effect specific members have three parameters. The first * refers to the X axis, the second refers to the Y axis and the third * refers to the Z axis. The right terms refer to the positive side of the - * axis and the left terms refer to the negative side of the axis. Please + * axis and the left terms refer to the negative side of the axis. Please * refer to the ::SDL_HapticDirection diagram for which side is positive and * which is negative. - * + * * \sa SDL_HapticDirection * \sa SDL_HAPTIC_SPRING * \sa SDL_HAPTIC_DAMPER @@ -611,14 +609,14 @@ typedef struct SDL_HapticCondition /** * \brief A structure containing a template for a Ramp effect. - * + * * This struct is exclusively for the ::SDL_HAPTIC_RAMP effect. - * + * * The ramp effect starts at start strength and ends at end strength. * It augments in linear fashion. If you use attack and fade with a ramp - * they effects get added to the ramp effect making the effect become + * the effects get added to the ramp effect making the effect become * quadratic instead of linear. - * + * * \sa SDL_HAPTIC_RAMP * \sa SDL_HapticEffect */ @@ -649,14 +647,14 @@ typedef struct SDL_HapticRamp /** * \brief A structure containing a template for the ::SDL_HAPTIC_CUSTOM effect. - * + * * A custom force feedback effect is much like a periodic effect, where the - * application can define it's exact shape. You will have to allocate the + * application can define its exact shape. You will have to allocate the * data yourself. Data should consist of channels * samples Uint16 samples. - * + * * If channels is one, the effect is rotated using the defined direction. * Otherwise it uses the samples in data for the different axes. - * + * * \sa SDL_HAPTIC_CUSTOM * \sa SDL_HapticEffect */ @@ -689,34 +687,34 @@ typedef struct SDL_HapticCustom /** * \brief The generic template for any haptic effect. - * + * * All values max at 32767 (0x7FFF). Signed values also can be negative. * Time values unless specified otherwise are in milliseconds. - * - * You can also pass ::SDL_HAPTIC_INFINITY to length instead of a 0-32767 - * value. Neither delay, interval, attack_length nor fade_length support + * + * You can also pass ::SDL_HAPTIC_INFINITY to length instead of a 0-32767 + * value. Neither delay, interval, attack_length nor fade_length support * ::SDL_HAPTIC_INFINITY. Fade will also not be used since effect never ends. - * + * * Additionally, the ::SDL_HAPTIC_RAMP effect does not support a duration of * ::SDL_HAPTIC_INFINITY. - * + * * Button triggers may not be supported on all devices, it is advised to not * use them if possible. Buttons start at index 1 instead of index 0 like - * they joystick. - * + * the joystick. + * * If both attack_length and fade_level are 0, the envelope is not used, * otherwise both values are used. - * + * * Common parts: * \code * // Replay - All effects have this * Uint32 length; // Duration of effect (ms). * Uint16 delay; // Delay before starting effect. - * + * * // Trigger - All effects have this * Uint16 button; // Button that triggers effect. * Uint16 interval; // How soon before effect can be triggered again. - * + * * // Envelope - All effects except condition effects have this * Uint16 attack_length; // Duration of the attack (ms). * Uint16 attack_level; // Level at the start of the attack. @@ -734,18 +732,18 @@ typedef struct SDL_HapticCustom | / \ | / \ | / \ - | / \ + | / \ | attack_level --> | \ | | | <--- fade_level | +--------------------------------------------------> Time [--] [---] attack_length fade_length - + [------------------][-----------------------] delay length \endverbatim - * + * * Note either the attack_level or the fade_level may be above the actual * effect level. * @@ -769,19 +767,19 @@ typedef union SDL_HapticEffect /* Function prototypes */ /** - * \brief Count the number of joysticks attached to the system. - * + * \brief Count the number of haptic devices attached to the system. + * * \return Number of haptic devices detected on the system. */ extern DECLSPEC int SDLCALL SDL_NumHaptics(void); /** * \brief Get the implementation dependent name of a Haptic device. - * + * * This can be called before any joysticks are opened. * If no name can be found, this function returns NULL. - * - * \param device_index Index of the device to get it's name. + * + * \param device_index Index of the device to get its name. * \return Name of the device or NULL on error. * * \sa SDL_NumHaptics @@ -790,11 +788,11 @@ extern DECLSPEC const char *SDLCALL SDL_HapticName(int device_index); /** * \brief Opens a Haptic device for usage. - * - * The index passed as an argument refers to the N'th Haptic device on this + * + * The index passed as an argument refers to the N'th Haptic device on this * system. * - * When opening a haptic device, it's gain will be set to maximum and + * When opening a haptic device, its gain will be set to maximum and * autocenter will be disabled. To modify these values use * SDL_HapticSetGain() and SDL_HapticSetAutocenter(). * @@ -814,10 +812,10 @@ extern DECLSPEC SDL_Haptic *SDLCALL SDL_HapticOpen(int device_index); /** * \brief Checks if the haptic device at index has been opened. - * + * * \param device_index Index to check to see if it has been opened. * \return 1 if it has been opened or 0 if it hasn't. - * + * * \sa SDL_HapticOpen * \sa SDL_HapticIndex */ @@ -825,10 +823,10 @@ extern DECLSPEC int SDLCALL SDL_HapticOpened(int device_index); /** * \brief Gets the index of a haptic device. - * + * * \param haptic Haptic device to get the index of. * \return The index of the haptic device or -1 on error. - * + * * \sa SDL_HapticOpen * \sa SDL_HapticOpened */ @@ -836,18 +834,18 @@ extern DECLSPEC int SDLCALL SDL_HapticIndex(SDL_Haptic * haptic); /** * \brief Gets whether or not the current mouse has haptic capabilities. - * + * * \return SDL_TRUE if the mouse is haptic, SDL_FALSE if it isn't. - * + * * \sa SDL_HapticOpenFromMouse */ extern DECLSPEC int SDLCALL SDL_MouseIsHaptic(void); /** * \brief Tries to open a haptic device from the current mouse. - * + * * \return The haptic device identifier or NULL on error. - * + * * \sa SDL_MouseIsHaptic * \sa SDL_HapticOpen */ @@ -855,29 +853,29 @@ extern DECLSPEC SDL_Haptic *SDLCALL SDL_HapticOpenFromMouse(void); /** * \brief Checks to see if a joystick has haptic features. - * + * * \param joystick Joystick to test for haptic capabilities. * \return 1 if the joystick is haptic, 0 if it isn't * or -1 if an error ocurred. - * + * * \sa SDL_HapticOpenFromJoystick */ extern DECLSPEC int SDLCALL SDL_JoystickIsHaptic(SDL_Joystick * joystick); /** * \brief Opens a Haptic device for usage from a Joystick device. - * - * You must still close the haptic device seperately. It will not be closed + * + * You must still close the haptic device seperately. It will not be closed * with the joystick. - * + * * When opening from a joystick you should first close the haptic device before * closing the joystick device. If not, on some implementations the haptic * device will also get unallocated and you'll be unable to use force feedback * on that device. - * + * * \param joystick Joystick to create a haptic device from. * \return A valid haptic device identifier on success or NULL on error. - * + * * \sa SDL_HapticOpen * \sa SDL_HapticClose */ @@ -886,34 +884,34 @@ extern DECLSPEC SDL_Haptic *SDLCALL SDL_HapticOpenFromJoystick(SDL_Joystick * /** * \brief Closes a Haptic device previously opened with SDL_HapticOpen(). - * + * * \param haptic Haptic device to close. */ extern DECLSPEC void SDLCALL SDL_HapticClose(SDL_Haptic * haptic); /** * \brief Returns the number of effects a haptic device can store. - * + * * On some platforms this isn't fully supported, and therefore is an - * aproximation. Always check to see if your created effect was actually + * approximation. Always check to see if your created effect was actually * created and do not rely solely on SDL_HapticNumEffects(). - * + * * \param haptic The haptic device to query effect max. * \return The number of effects the haptic device can store or * -1 on error. - * + * * \sa SDL_HapticNumEffectsPlaying * \sa SDL_HapticQuery */ extern DECLSPEC int SDLCALL SDL_HapticNumEffects(SDL_Haptic * haptic); /** - * \brief Returns the number of effects a haptic device can play at the same + * \brief Returns the number of effects a haptic device can play at the same * time. - * - * This is not supported on all platforms, but will always return a value. - * Added here for the sake of completness. - * + * + * This is not supported on all platforms, but will always return a value. + * Added here for the sake of completeness. + * * \param haptic The haptic device to query maximum playing effects. * \return The number of effects the haptic device can play at the same time * or -1 on error. @@ -925,17 +923,17 @@ extern DECLSPEC int SDLCALL SDL_HapticNumEffectsPlaying(SDL_Haptic * haptic); /** * \brief Gets the haptic devices supported features in bitwise matter. - * - * Example: + * + * Example: * \code * if (SDL_HapticQueryEffects(haptic) & SDL_HAPTIC_CONSTANT) { * printf("We have constant haptic effect!"); * } * \endcode - * + * * \param haptic The haptic device to query. * \return Haptic features in bitwise manner (OR'd). - * + * * \sa SDL_HapticNumEffects * \sa SDL_HapticEffectSupported */ @@ -944,18 +942,18 @@ extern DECLSPEC unsigned int SDLCALL SDL_HapticQuery(SDL_Haptic * haptic); /** * \brief Gets the number of haptic axes the device has. - * + * * \sa SDL_HapticDirection */ extern DECLSPEC int SDLCALL SDL_HapticNumAxes(SDL_Haptic * haptic); /** * \brief Checks to see if effect is supported by haptic. - * + * * \param haptic Haptic device to check on. * \param effect Effect to check to see if it is supported. * \return SDL_TRUE if effect is supported, SDL_FALSE if it isn't or -1 on error. - * + * * \sa SDL_HapticQuery * \sa SDL_HapticNewEffect */ @@ -965,11 +963,11 @@ extern DECLSPEC int SDLCALL SDL_HapticEffectSupported(SDL_Haptic * haptic, /** * \brief Creates a new haptic effect on the device. - * + * * \param haptic Haptic device to create the effect on. * \param effect Properties of the effect to create. * \return The id of the effect on success or -1 on error. - * + * * \sa SDL_HapticUpdateEffect * \sa SDL_HapticRunEffect * \sa SDL_HapticDestroyEffect @@ -979,17 +977,17 @@ extern DECLSPEC int SDLCALL SDL_HapticNewEffect(SDL_Haptic * haptic, /** * \brief Updates the properties of an effect. - * + * * Can be used dynamically, although behaviour when dynamically changing * direction may be strange. Specifically the effect may reupload itself * and start playing from the start. You cannot change the type either when * running SDL_HapticUpdateEffect(). - * + * * \param haptic Haptic device that has the effect. * \param effect Effect to update. * \param data New effect properties to use. * \return The id of the effect on success or -1 on error. - * + * * \sa SDL_HapticNewEffect * \sa SDL_HapticRunEffect * \sa SDL_HapticDestroyEffect @@ -999,19 +997,19 @@ extern DECLSPEC int SDLCALL SDL_HapticUpdateEffect(SDL_Haptic * haptic, SDL_HapticEffect * data); /** - * \brief Runs the haptic effect on it's assosciated haptic device. - * + * \brief Runs the haptic effect on its associated haptic device. + * * If iterations are ::SDL_HAPTIC_INFINITY, it'll run the effect over and over * repeating the envelope (attack and fade) every time. If you only want the * effect to last forever, set ::SDL_HAPTIC_INFINITY in the effect's length * parameter. - * + * * \param haptic Haptic device to run the effect on. * \param effect Identifier of the haptic effect to run. * \param iterations Number of iterations to run the effect. Use * ::SDL_HAPTIC_INFINITY for infinity. * \return 0 on success or -1 on error. - * + * * \sa SDL_HapticStopEffect * \sa SDL_HapticDestroyEffect * \sa SDL_HapticGetEffectStatus @@ -1021,12 +1019,12 @@ extern DECLSPEC int SDLCALL SDL_HapticRunEffect(SDL_Haptic * haptic, Uint32 iterations); /** - * \brief Stops the haptic effect on it's assosciated haptic device. - * + * \brief Stops the haptic effect on its associated haptic device. + * * \param haptic Haptic device to stop the effect on. * \param effect Identifier of the effect to stop. * \return 0 on success or -1 on error. - * + * * \sa SDL_HapticRunEffect * \sa SDL_HapticDestroyEffect */ @@ -1035,13 +1033,13 @@ extern DECLSPEC int SDLCALL SDL_HapticStopEffect(SDL_Haptic * haptic, /** * \brief Destroys a haptic effect on the device. - * - * This will stop the effect if it's running. Effects are automatically + * + * This will stop the effect if it's running. Effects are automatically * destroyed when the device is closed. - * + * * \param haptic Device to destroy the effect on. * \param effect Identifier of the effect to destroy. - * + * * \sa SDL_HapticNewEffect */ extern DECLSPEC void SDLCALL SDL_HapticDestroyEffect(SDL_Haptic * haptic, @@ -1049,14 +1047,14 @@ extern DECLSPEC void SDLCALL SDL_HapticDestroyEffect(SDL_Haptic * haptic, /** * \brief Gets the status of the current effect on the haptic device. - * + * * Device must support the ::SDL_HAPTIC_STATUS feature. - * + * * \param haptic Haptic device to query the effect status on. - * \param effect Identifier of the effect to query it's status. + * \param effect Identifier of the effect to query its status. * \return 0 if it isn't playing, ::SDL_HAPTIC_PLAYING if it is playing * or -1 on error. - * + * * \sa SDL_HapticRunEffect * \sa SDL_HapticStopEffect */ @@ -1065,26 +1063,26 @@ extern DECLSPEC int SDLCALL SDL_HapticGetEffectStatus(SDL_Haptic * haptic, /** * \brief Sets the global gain of the device. - * + * * Device must support the ::SDL_HAPTIC_GAIN feature. - * - * The user may specify the maxmimum gain by setting the environment variable + * + * The user may specify the maximum gain by setting the environment variable * ::SDL_HAPTIC_GAIN_MAX which should be between 0 and 100. All calls to * SDL_HapticSetGain() will scale linearly using ::SDL_HAPTIC_GAIN_MAX as the * maximum. - * + * * \param haptic Haptic device to set the gain on. * \param gain Value to set the gain to, should be between 0 and 100. * \return 0 on success or -1 on error. - * + * * \sa SDL_HapticQuery */ extern DECLSPEC int SDLCALL SDL_HapticSetGain(SDL_Haptic * haptic, int gain); /** * \brief Sets the global autocenter of the device. - * - * Autocenter should be between 0 and 100. Setting it to 0 will disable + * + * Autocenter should be between 0 and 100. Setting it to 0 will disable * autocentering. * * Device must support the ::SDL_HAPTIC_AUTOCENTER feature. @@ -1092,7 +1090,7 @@ extern DECLSPEC int SDLCALL SDL_HapticSetGain(SDL_Haptic * haptic, int gain); * \param haptic Haptic device to set autocentering on. * \param autocenter Value to set autocenter to, 0 disables autocentering. * \return 0 on success or -1 on error. - * + * * \sa SDL_HapticQuery */ extern DECLSPEC int SDLCALL SDL_HapticSetAutocenter(SDL_Haptic * haptic, @@ -1100,35 +1098,35 @@ extern DECLSPEC int SDLCALL SDL_HapticSetAutocenter(SDL_Haptic * haptic, /** * \brief Pauses a haptic device. - * - * Device must support the ::SDL_HAPTIC_PAUSE feature. Call + * + * Device must support the ::SDL_HAPTIC_PAUSE feature. Call * SDL_HapticUnpause() to resume playback. - * + * * Do not modify the effects nor add new ones while the device is paused. * That can cause all sorts of weird errors. - * + * * \param haptic Haptic device to pause. * \return 0 on success or -1 on error. - * + * * \sa SDL_HapticUnpause */ extern DECLSPEC int SDLCALL SDL_HapticPause(SDL_Haptic * haptic); /** * \brief Unpauses a haptic device. - * + * * Call to unpause after SDL_HapticPause(). - * + * * \param haptic Haptic device to pause. * \return 0 on success or -1 on error. - * + * * \sa SDL_HapticPause */ extern DECLSPEC int SDLCALL SDL_HapticUnpause(SDL_Haptic * haptic); /** * \brief Stops all the currently playing effects on a haptic device. - * + * * \param haptic Haptic device to stop. * \return 0 on success or -1 on error. */ @@ -1164,7 +1162,7 @@ extern DECLSPEC int SDLCALL SDL_HapticRumbleInit(SDL_Haptic * haptic); * * \param haptic Haptic device to play rumble effect on. * \param strength Strength of the rumble to play as a 0-1 float value. - * \param length Length of the rumble to play in miliseconds. + * \param length Length of the rumble to play in milliseconds. * \return 0 on success or -1 on error. * * \sa SDL_HapticRumbleSupported @@ -1189,9 +1187,7 @@ extern DECLSPEC int SDLCALL SDL_HapticRumbleStop(SDL_Haptic * haptic); /* Ends C function definitions when using C++ */ #ifdef __cplusplus -/* *INDENT-OFF* */ } -/* *INDENT-ON* */ #endif #include "close_code.h" diff --git a/src/eepp/helper/SDL2/include/SDL_hints.h b/src/eepp/helper/SDL2/include/SDL_hints.h index 8b2fcb91c..c96d88745 100644 --- a/src/eepp/helper/SDL2/include/SDL_hints.h +++ b/src/eepp/helper/SDL2/include/SDL_hints.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,7 +21,7 @@ /** * \file SDL_hints.h - * + * * Official documentation for SDL configuration variables * * This file contains functions to set and get configuration hints, @@ -44,13 +44,11 @@ #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus -/* *INDENT-OFF* */ extern "C" { -/* *INDENT-ON* */ #endif /** - * \brief A variable controlling how 3D acceleration is used to accelerate the SDL 1.2 screen surface. + * \brief A variable controlling how 3D acceleration is used to accelerate the SDL 1.2 screen surface. * * SDL can try to accelerate the SDL 1.2 screen surface by using streaming * textures with a 3D rendering engine. This variable controls whether and @@ -163,6 +161,13 @@ extern "C" { */ #define SDL_HINT_GRAB_KEYBOARD "SDL_GRAB_KEYBOARD" +/** + * \brief Minimize your SDL_Window if it loses key focus when in Fullscreen mode. Defaults to true. + * + */ +#define SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS "SDL_VIDEO_MINIMIZE_ON_FOCUS_LOSS" + + /** * \brief A variable controlling whether the idle timer is disabled on iOS. * @@ -176,7 +181,7 @@ extern "C" { * "1" - Disable idle timer */ #define SDL_HINT_IDLE_TIMER_DISABLED "SDL_IOS_IDLE_TIMER_DISABLED" - + /** * \brief A variable controlling which orientations are allowed on iOS. * @@ -189,14 +194,39 @@ extern "C" { #define SDL_HINT_ORIENTATIONS "SDL_IOS_ORIENTATIONS" +/** + * \brief A variable that lets you disable the detection and use of Xinput gamepad devices + * + * The variable can be set to the following values: + * "0" - Disable XInput timer (only uses direct input) + * "1" - Enable XInput timer (the default) + */ +#define SDL_HINT_XINPUT_ENABLED "SDL_XINPUT_ENABLED" + + /** * \brief A variable that lets you manually hint extra gamecontroller db entries * - * The variable expected newline delimited rows of gamecontroller config data, see SDL_gamecontroller.h + * The variable should be newline delimited rows of gamecontroller config data, see SDL_gamecontroller.h + * + * This hint must be set before calling SDL_Init(SDL_INIT_GAMECONTROLLER) + * You can update mappings after the system is initialized with SDL_GameControllerMappingForGUID() and SDL_GameControllerAddMapping() */ #define SDL_HINT_GAMECONTROLLERCONFIG "SDL_GAMECONTROLLERCONFIG" +/** + * \brief If set to 0 then never set the top most bit on a SDL Window, even if the video mode expects it. + * This is a debugging aid for developers and not expected to be used by end users. The default is "1" + * + * This variable can be set to the following values: + * "0" - don't allow topmost + * "1" - allow topmost + */ +#define SDL_HINT_ALLOW_TOPMOST "SDL_ALLOW_TOPMOST" + + + /** * \brief An enumeration of hint priorities */ @@ -214,7 +244,7 @@ typedef enum * The priority controls the behavior when setting a hint that already * has a value. Hints will replace existing hints of their priority and * lower. Environment variables are considered to have override priority. - * + * * \return SDL_TRUE if the hint was set, SDL_FALSE otherwise */ extern DECLSPEC SDL_bool SDLCALL SDL_SetHintWithPriority(const char *name, @@ -223,7 +253,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_SetHintWithPriority(const char *name, /** * \brief Set a hint with normal priority - * + * * \return SDL_TRUE if the hint was set, SDL_FALSE otherwise */ extern DECLSPEC SDL_bool SDLCALL SDL_SetHint(const char *name, @@ -232,7 +262,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_SetHint(const char *name, /** * \brief Get a hint - * + * * \return The string value of a hint variable. */ extern DECLSPEC const char * SDLCALL SDL_GetHint(const char *name); @@ -247,9 +277,7 @@ extern DECLSPEC void SDLCALL SDL_ClearHints(void); /* Ends C function definitions when using C++ */ #ifdef __cplusplus -/* *INDENT-OFF* */ } -/* *INDENT-ON* */ #endif #include "close_code.h" diff --git a/src/eepp/helper/SDL2/include/SDL_input.h b/src/eepp/helper/SDL2/include/SDL_input.h deleted file mode 100644 index 95dc3b0fb..000000000 --- a/src/eepp/helper/SDL2/include/SDL_input.h +++ /dev/null @@ -1,87 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga - - 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 - appreciated but is not required. - 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. -*/ - -/** - * \file SDL_input.h - * - * Include file for lowlevel SDL input device handling. - * - * This talks about individual devices, and not the system cursor. If you - * just want to know when the user moves the pointer somewhere in your - * window, this is NOT the API you want. This one handles things like - * multi-touch, drawing tablets, and multiple, separate mice. - * - * The other API is in SDL_mouse.h - */ - -#ifndef _SDL_input_h -#define _SDL_input_h - -#include "SDL_stdinc.h" -#include "SDL_error.h" -#include "SDL_video.h" - -#include "begin_code.h" -/* Set up for C function definitions, even when using C++ */ -#ifdef __cplusplus -/* *INDENT-OFF* */ -extern "C" { -/* *INDENT-ON* */ -#endif - - -/* Function prototypes */ - -/* !!! FIXME: real documentation - * - Redetect devices - * - This invalidates all existing device information from previous queries! - * - There is an implicit (re)detect upon SDL_Init(). - */ -extern DECLSPEC int SDLCALL SDL_RedetectInputDevices(void); - -/** - * \brief Get the number of mouse input devices available. - */ -extern DECLSPEC int SDLCALL SDL_GetNumInputDevices(void); - -/** - * \brief Gets the name of a device with the given index. - * - * \param index is the index of the device, whose name is to be returned. - * - * \return the name of the device with the specified index - */ -extern DECLSPEC const char *SDLCALL SDL_GetInputDeviceName(int index); - - -extern DECLSPEC int SDLCALL SDL_IsDeviceDisconnected(int index); - -/* Ends C function definitions when using C++ */ -#ifdef __cplusplus -/* *INDENT-OFF* */ -} -/* *INDENT-ON* */ -#endif -#include "close_code.h" - -#endif /* _SDL_mouse_h */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/eepp/helper/SDL2/include/SDL_joystick.h b/src/eepp/helper/SDL2/include/SDL_joystick.h index 4214cef4f..f568f9bd8 100644 --- a/src/eepp/helper/SDL2/include/SDL_joystick.h +++ b/src/eepp/helper/SDL2/include/SDL_joystick.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,7 +21,7 @@ /** * \file SDL_joystick.h - * + * * Include file for SDL joystick event handling * * The term "device_index" identifies currently plugged in joystick devices between 0 and SDL_NumJoysticks, with the exact joystick @@ -30,7 +30,7 @@ * The term "instance_id" is the current instantiation of a joystick device in the system, if the joystick is removed and then re-inserted * then it will get a new instance_id, instance_id's are monotonically increasing identifiers of a joystick plugged in. * - * The term JoystickGUID is a stable 128-bit identifier for a joystick device that does not change over time, it identifies class of + * The term JoystickGUID is a stable 128-bit identifier for a joystick device that does not change over time, it identifies class of * the device (a X360 wired controller for example). This identifier is platform dependent. * * @@ -45,9 +45,7 @@ #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus -/* *INDENT-OFF* */ extern "C" { -/* *INDENT-ON* */ #endif /** @@ -64,10 +62,10 @@ typedef struct _SDL_Joystick SDL_Joystick; /* A structure that encodes the stable unique id for a joystick device */ typedef struct { - Uint8 data[16]; + Uint8 data[16]; } SDL_JoystickGUID; -typedef int SDL_JoystickID; +typedef Sint32 SDL_JoystickID; /* Function prototypes */ @@ -84,11 +82,11 @@ extern DECLSPEC int SDLCALL SDL_NumJoysticks(void); extern DECLSPEC const char *SDLCALL SDL_JoystickNameForIndex(int device_index); /** - * Open a joystick for use. - * The index passed as an argument refers tothe N'th joystick on the system. + * Open a joystick for use. + * The index passed as an argument refers tothe N'th joystick on the system. * This index is the value which will identify this joystick in future joystick * events. - * + * * \return A joystick identifier, or NULL if an error occurred. */ extern DECLSPEC SDL_Joystick *SDLCALL SDL_JoystickOpen(int device_index); @@ -98,7 +96,7 @@ extern DECLSPEC SDL_Joystick *SDLCALL SDL_JoystickOpen(int device_index); * If no name can be found, this function returns NULL. */ extern DECLSPEC const char *SDLCALL SDL_JoystickName(SDL_Joystick * joystick); - + /** * Return the GUID for the joystick at this index */ @@ -126,7 +124,7 @@ extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetGUIDFromString(const cha extern DECLSPEC SDL_bool SDLCALL SDL_JoystickGetAttached(SDL_Joystick * joystick); /** - * Get the instance ID of an opened joystick. + * Get the instance ID of an opened joystick or -1 if the joystick is invalid. */ extern DECLSPEC SDL_JoystickID SDLCALL SDL_JoystickInstanceID(SDL_Joystick * joystick); @@ -137,7 +135,7 @@ extern DECLSPEC int SDLCALL SDL_JoystickNumAxes(SDL_Joystick * joystick); /** * Get the number of trackballs on a joystick. - * + * * Joystick trackballs have only relative motion events associated * with them and their state cannot be polled. */ @@ -155,7 +153,7 @@ extern DECLSPEC int SDLCALL SDL_JoystickNumButtons(SDL_Joystick * joystick); /** * Update the current state of the open joysticks. - * + * * This is called automatically by the event loop if any joystick * events are enabled. */ @@ -163,20 +161,20 @@ extern DECLSPEC void SDLCALL SDL_JoystickUpdate(void); /** * Enable/disable joystick event polling. - * + * * If joystick events are disabled, you must call SDL_JoystickUpdate() * yourself and check the state of the joystick when you want joystick * information. - * + * * The state can be one of ::SDL_QUERY, ::SDL_ENABLE or ::SDL_IGNORE. */ extern DECLSPEC int SDLCALL SDL_JoystickEventState(int state); /** * Get the current state of an axis control on a joystick. - * + * * The state is a value ranging from -32768 to 32767. - * + * * The axis indices start at index 0. */ extern DECLSPEC Sint16 SDLCALL SDL_JoystickGetAxis(SDL_Joystick * joystick, @@ -186,22 +184,22 @@ extern DECLSPEC Sint16 SDLCALL SDL_JoystickGetAxis(SDL_Joystick * joystick, * \name Hat positions */ /*@{*/ -#define SDL_HAT_CENTERED 0x00 -#define SDL_HAT_UP 0x01 -#define SDL_HAT_RIGHT 0x02 -#define SDL_HAT_DOWN 0x04 -#define SDL_HAT_LEFT 0x08 -#define SDL_HAT_RIGHTUP (SDL_HAT_RIGHT|SDL_HAT_UP) -#define SDL_HAT_RIGHTDOWN (SDL_HAT_RIGHT|SDL_HAT_DOWN) -#define SDL_HAT_LEFTUP (SDL_HAT_LEFT|SDL_HAT_UP) -#define SDL_HAT_LEFTDOWN (SDL_HAT_LEFT|SDL_HAT_DOWN) +#define SDL_HAT_CENTERED 0x00 +#define SDL_HAT_UP 0x01 +#define SDL_HAT_RIGHT 0x02 +#define SDL_HAT_DOWN 0x04 +#define SDL_HAT_LEFT 0x08 +#define SDL_HAT_RIGHTUP (SDL_HAT_RIGHT|SDL_HAT_UP) +#define SDL_HAT_RIGHTDOWN (SDL_HAT_RIGHT|SDL_HAT_DOWN) +#define SDL_HAT_LEFTUP (SDL_HAT_LEFT|SDL_HAT_UP) +#define SDL_HAT_LEFTDOWN (SDL_HAT_LEFT|SDL_HAT_DOWN) /*@}*/ /** * Get the current state of a POV hat on a joystick. * * The hat indices start at index 0. - * + * * \return The return value is one of the following positions: * - ::SDL_HAT_CENTERED * - ::SDL_HAT_UP @@ -218,9 +216,9 @@ extern DECLSPEC Uint8 SDLCALL SDL_JoystickGetHat(SDL_Joystick * joystick, /** * Get the ball axis change since the last poll. - * + * * \return 0, or -1 if you passed it invalid parameters. - * + * * The ball indices start at index 0. */ extern DECLSPEC int SDLCALL SDL_JoystickGetBall(SDL_Joystick * joystick, @@ -228,7 +226,7 @@ extern DECLSPEC int SDLCALL SDL_JoystickGetBall(SDL_Joystick * joystick, /** * Get the current state of a button on a joystick. - * + * * The button indices start at index 0. */ extern DECLSPEC Uint8 SDLCALL SDL_JoystickGetButton(SDL_Joystick * joystick, @@ -242,9 +240,7 @@ extern DECLSPEC void SDLCALL SDL_JoystickClose(SDL_Joystick * joystick); /* Ends C function definitions when using C++ */ #ifdef __cplusplus -/* *INDENT-OFF* */ } -/* *INDENT-ON* */ #endif #include "close_code.h" diff --git a/src/eepp/helper/SDL2/include/SDL_keyboard.h b/src/eepp/helper/SDL2/include/SDL_keyboard.h index 19ca8b4a5..9b44df322 100644 --- a/src/eepp/helper/SDL2/include/SDL_keyboard.h +++ b/src/eepp/helper/SDL2/include/SDL_keyboard.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,7 +21,7 @@ /** * \file SDL_keyboard.h - * + * * Include file for SDL keyboard event handling */ @@ -36,9 +36,7 @@ #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus -/* *INDENT-OFF* */ extern "C" { -/* *INDENT-ON* */ #endif /** @@ -61,11 +59,11 @@ extern DECLSPEC SDL_Window * SDLCALL SDL_GetKeyboardFocus(void); /** * \brief Get a snapshot of the current state of the keyboard. - * + * * \param numkeys if non-NULL, receives the length of the returned array. - * + * * \return An array of key states. Indexes into this array are obtained by using ::SDL_Scancode values. - * + * * \b Example: * \code * Uint8 *state = SDL_GetKeyboardState(NULL); @@ -83,7 +81,7 @@ extern DECLSPEC SDL_Keymod SDLCALL SDL_GetModState(void); /** * \brief Set the current key modifier state for the keyboard. - * + * * \note This does not change the keyboard state, only the key modifier flags. */ extern DECLSPEC void SDLCALL SDL_SetModState(SDL_Keymod modstate); @@ -91,9 +89,9 @@ extern DECLSPEC void SDLCALL SDL_SetModState(SDL_Keymod modstate); /** * \brief Get the key code corresponding to the given scancode according * to the current keyboard layout. - * + * * See ::SDL_Keycode for details. - * + * * \sa SDL_GetKeyName() */ extern DECLSPEC SDL_Keycode SDLCALL SDL_GetKeyFromScancode(SDL_Scancode scancode); @@ -101,16 +99,16 @@ extern DECLSPEC SDL_Keycode SDLCALL SDL_GetKeyFromScancode(SDL_Scancode scancode /** * \brief Get the scancode corresponding to the given key code according to the * current keyboard layout. - * + * * See ::SDL_Scancode for details. - * + * * \sa SDL_GetScancodeName() */ extern DECLSPEC SDL_Scancode SDLCALL SDL_GetScancodeFromKey(SDL_Keycode key); /** * \brief Get a human-readable name for a scancode. - * + * * \return A pointer to the name for the scancode. * If the scancode doesn't have a name, this function returns * an empty string (""). @@ -121,7 +119,7 @@ extern DECLSPEC const char *SDLCALL SDL_GetScancodeName(SDL_Scancode scancode); /** * \brief Get a scancode from a human-readable name - * + * * \return scancode, or SDL_SCANCODE_UNKNOWN if the name wasn't recognized * * \sa SDL_Scancode @@ -130,19 +128,19 @@ extern DECLSPEC SDL_Scancode SDLCALL SDL_GetScancodeFromName(const char *name); /** * \brief Get a human-readable name for a key. - * + * * \return A pointer to a UTF-8 string that stays valid at least until the next - * call to this function. If you need it around any longer, you must - * copy it. If the key doesn't have a name, this function returns an + * call to this function. If you need it around any longer, you must + * copy it. If the key doesn't have a name, this function returns an * empty string (""). - * + * * \sa SDL_Key */ extern DECLSPEC const char *SDLCALL SDL_GetKeyName(SDL_Keycode key); /** * \brief Get a key code from a human-readable name - * + * * \return key code, or SDLK_UNKNOWN if the name wasn't recognized * * \sa SDL_Keycode @@ -152,7 +150,7 @@ extern DECLSPEC SDL_Keycode SDLCALL SDL_GetKeyFromName(const char *name); /** * \brief Start accepting Unicode text input events. * This function will show the on-screen keyboard if supported. - * + * * \sa SDL_StopTextInput() * \sa SDL_SetTextInputRect() * \sa SDL_HasScreenKeyboardSupport() @@ -170,7 +168,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_IsTextInputActive(void); /** * \brief Stop receiving any text input events. * This function will hide the on-screen keyboard if supported. - * + * * \sa SDL_StartTextInput() * \sa SDL_HasScreenKeyboardSupport() */ @@ -179,38 +177,36 @@ extern DECLSPEC void SDLCALL SDL_StopTextInput(void); /** * \brief Set the rectangle used to type Unicode text inputs. * This is used as a hint for IME and on-screen keyboard placement. - * + * * \sa SDL_StartTextInput() */ extern DECLSPEC void SDLCALL SDL_SetTextInputRect(SDL_Rect *rect); /** * \brief Returns whether the platform has some screen keyboard support. - * + * * \return SDL_TRUE if some keyboard support is available else SDL_FALSE. - * + * * \note Not all screen keyboard functions are supported on all platforms. - * + * * \sa SDL_IsScreenKeyboardShown() */ -extern DECLSPEC SDL_bool SDLCALL SDL_HasScreenKeyboardSupport(); +extern DECLSPEC SDL_bool SDLCALL SDL_HasScreenKeyboardSupport(void); /** * \brief Returns whether the screen keyboard is shown for given window. - * + * * \param window The window for which screen keyboard should be queried. - * + * * \return SDL_TRUE if screen keyboard is shown else SDL_FALSE. - * + * * \sa SDL_HasScreenKeyboardSupport() */ extern DECLSPEC SDL_bool SDLCALL SDL_IsScreenKeyboardShown(SDL_Window *window); /* Ends C function definitions when using C++ */ #ifdef __cplusplus -/* *INDENT-OFF* */ } -/* *INDENT-ON* */ #endif #include "close_code.h" diff --git a/src/eepp/helper/SDL2/include/SDL_keycode.h b/src/eepp/helper/SDL2/include/SDL_keycode.h index a020b1610..de584e126 100644 --- a/src/eepp/helper/SDL2/include/SDL_keycode.h +++ b/src/eepp/helper/SDL2/include/SDL_keycode.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,7 +21,7 @@ /** * \file SDL_keycode.h - * + * * Defines constants which identify keyboard keys and modifiers. */ @@ -33,7 +33,7 @@ /** * \brief The SDL virtual key representation. - * + * * Values of this type are used to represent keyboard keys using the current * layout of the keyboard. These values include Unicode values representing * the unmodified character that would be generated by pressing the key, or @@ -42,7 +42,7 @@ typedef Sint32 SDL_Keycode; #define SDLK_SCANCODE_MASK (1<<30) -#define SDL_SCANCODE_TO_KEYCODE(X) (X | SDLK_SCANCODE_MASK) +#define SDL_SCANCODE_TO_KEYCODE(X) (X | SDLK_SCANCODE_MASK) enum { @@ -85,7 +85,7 @@ enum SDLK_GREATER = '>', SDLK_QUESTION = '?', SDLK_AT = '@', - /* + /* Skip uppercase letters */ SDLK_LEFTBRACKET = '[', @@ -331,10 +331,10 @@ typedef enum KMOD_RESERVED = 0x8000 } SDL_Keymod; -#define KMOD_CTRL (KMOD_LCTRL|KMOD_RCTRL) -#define KMOD_SHIFT (KMOD_LSHIFT|KMOD_RSHIFT) -#define KMOD_ALT (KMOD_LALT|KMOD_RALT) -#define KMOD_GUI (KMOD_LGUI|KMOD_RGUI) +#define KMOD_CTRL (KMOD_LCTRL|KMOD_RCTRL) +#define KMOD_SHIFT (KMOD_LSHIFT|KMOD_RSHIFT) +#define KMOD_ALT (KMOD_LALT|KMOD_RALT) +#define KMOD_GUI (KMOD_LGUI|KMOD_RGUI) #endif /* _SDL_keycode_h */ diff --git a/src/eepp/helper/SDL2/include/SDL_loadso.h b/src/eepp/helper/SDL2/include/SDL_loadso.h index 7366ab856..790d0a724 100644 --- a/src/eepp/helper/SDL2/include/SDL_loadso.h +++ b/src/eepp/helper/SDL2/include/SDL_loadso.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -24,7 +24,7 @@ * * System dependent library loading routines * - * Some things to keep in mind: + * Some things to keep in mind: * \li These functions only work on C function names. Other languages may * have name mangling and intrinsic language support that varies from * compiler to compiler. @@ -47,9 +47,7 @@ #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus -/* *INDENT-OFF* */ extern "C" { -/* *INDENT-ON* */ #endif /** @@ -74,9 +72,7 @@ extern DECLSPEC void SDLCALL SDL_UnloadObject(void *handle); /* Ends C function definitions when using C++ */ #ifdef __cplusplus -/* *INDENT-OFF* */ } -/* *INDENT-ON* */ #endif #include "close_code.h" diff --git a/src/eepp/helper/SDL2/include/SDL_log.h b/src/eepp/helper/SDL2/include/SDL_log.h index e61c44ce7..79ae4cde4 100644 --- a/src/eepp/helper/SDL2/include/SDL_log.h +++ b/src/eepp/helper/SDL2/include/SDL_log.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,7 +21,7 @@ /** * \file SDL_log.h - * + * * Simple log messages with categories and priorities. * * By default logs are quiet, but if you're debugging SDL you might want: @@ -42,9 +42,7 @@ #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus -/* *INDENT-OFF* */ extern "C" { -/* *INDENT-ON* */ #endif @@ -60,7 +58,7 @@ extern "C" { * * By default the application category is enabled at the INFO level, * the assert category is enabled at the WARN level, test is enabled - * at the VERBOSE level and all other categories are enabled at the + * at the VERBOSE level and all other categories are enabled at the * CRITICAL level. */ enum @@ -204,9 +202,7 @@ extern DECLSPEC void SDLCALL SDL_LogSetOutputFunction(SDL_LogOutputFunction call /* Ends C function definitions when using C++ */ #ifdef __cplusplus -/* *INDENT-OFF* */ } -/* *INDENT-ON* */ #endif #include "close_code.h" diff --git a/src/eepp/helper/SDL2/include/SDL_main.h b/src/eepp/helper/SDL2/include/SDL_main.h index b9d252b26..59bd20167 100644 --- a/src/eepp/helper/SDL2/include/SDL_main.h +++ b/src/eepp/helper/SDL2/include/SDL_main.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -26,7 +26,7 @@ /** * \file SDL_main.h - * + * * Redefine main() on some platforms so that it is called by SDL. */ @@ -37,7 +37,7 @@ #endif #ifdef __cplusplus -#define C_LINKAGE "C" +#define C_LINKAGE "C" #else #define C_LINKAGE #endif /* __cplusplus */ @@ -58,7 +58,7 @@ */ #ifdef SDL_MAIN_NEEDED -#define main SDL_main +#define main SDL_main #endif /** @@ -69,9 +69,7 @@ extern C_LINKAGE int SDL_main(int argc, char *argv[]); #include "begin_code.h" #ifdef __cplusplus -/* *INDENT-OFF* */ extern "C" { -/* *INDENT-ON* */ #endif #ifdef __WIN32__ @@ -87,9 +85,7 @@ extern DECLSPEC void SDLCALL SDL_UnregisterApp(void); #ifdef __cplusplus -/* *INDENT-OFF* */ } -/* *INDENT-ON* */ #endif #include "close_code.h" diff --git a/src/eepp/helper/SDL2/include/SDL_messagebox.h b/src/eepp/helper/SDL2/include/SDL_messagebox.h index 684e71ab2..cb1a1ccff 100644 --- a/src/eepp/helper/SDL2/include/SDL_messagebox.h +++ b/src/eepp/helper/SDL2/include/SDL_messagebox.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -28,9 +28,7 @@ #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus -/* *INDENT-OFF* */ extern "C" { -/* *INDENT-ON* */ #endif /** @@ -58,7 +56,7 @@ typedef enum typedef struct { Uint32 flags; /**< ::SDL_MessageBoxButtonFlags */ - int buttonid; /**< User defined button id (value returned via SDL_MessageBox) */ + int buttonid; /**< User defined button id (value returned via SDL_ShowMessageBox) */ const char * text; /**< The UTF-8 button text */ } SDL_MessageBoxButtonData; @@ -107,7 +105,8 @@ typedef struct /** * \brief Create a modal message box. * - * \param messagebox The SDL_MessageBox structure with title, text, etc. + * \param messageboxdata The SDL_MessageBoxData structure with title, text, etc. + * \param buttonid The pointer to which user id of hit button should be copied. * * \return -1 on error, otherwise 0 and buttonid contains user id of button * hit or -1 if dialog was closed. @@ -136,9 +135,7 @@ extern DECLSPEC int SDLCALL SDL_ShowSimpleMessageBox(Uint32 flags, const char *t /* Ends C function definitions when using C++ */ #ifdef __cplusplus -/* *INDENT-OFF* */ } -/* *INDENT-ON* */ #endif #include "close_code.h" diff --git a/src/eepp/helper/SDL2/include/SDL_mouse.h b/src/eepp/helper/SDL2/include/SDL_mouse.h index e0cb8e625..36c29e90a 100644 --- a/src/eepp/helper/SDL2/include/SDL_mouse.h +++ b/src/eepp/helper/SDL2/include/SDL_mouse.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,24 +21,8 @@ /** * \file SDL_mouse.h - * + * * Include file for SDL mouse event handling. - * - * Please note that this ONLY discusses "mice" with the notion of the - * desktop GUI. You (usually) have one system cursor, and the OS hides - * the hardware details from you. If you plug in 10 mice, all ten move that - * one cursor. For many applications and games, this is perfect, and this - * API has served hundreds of SDL programs well since its birth. - * - * It's not the whole picture, though. If you want more lowlevel control, - * SDL offers a different API, that gives you visibility into each input - * device, multi-touch interfaces, etc. - * - * Those two APIs are incompatible, and you usually should not use both - * at the same time. But for legacy purposes, this API refers to a "mouse" - * when it actually means the system pointer and not a physical mouse. - * - * The other API is in SDL_input.h */ #ifndef _SDL_mouse_h @@ -51,9 +35,7 @@ #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus -/* *INDENT-OFF* */ extern "C" { -/* *INDENT-ON* */ #endif typedef struct SDL_Cursor SDL_Cursor; /* Implementation dependent */ @@ -63,18 +45,18 @@ typedef struct SDL_Cursor SDL_Cursor; /* Implementation dependent */ */ typedef enum { - SDL_SYSTEM_CURSOR_ARROW, // Arrow - SDL_SYSTEM_CURSOR_IBEAM, // I-beam - SDL_SYSTEM_CURSOR_WAIT, // Wait - SDL_SYSTEM_CURSOR_CROSSHAIR, // Crosshair - SDL_SYSTEM_CURSOR_WAITARROW, // Small wait cursor (or Wait if not available) - SDL_SYSTEM_CURSOR_SIZENWSE, // Double arrow pointing northwest and southeast - SDL_SYSTEM_CURSOR_SIZENESW, // Double arrow pointing northeast and southwest - SDL_SYSTEM_CURSOR_SIZEWE, // Double arrow pointing west and east - SDL_SYSTEM_CURSOR_SIZENS, // Double arrow pointing north and south - SDL_SYSTEM_CURSOR_SIZEALL, // Four pointed arrow pointing north, south, east, and west - SDL_SYSTEM_CURSOR_NO, // Slashed circle or crossbones - SDL_SYSTEM_CURSOR_HAND, // Hand + SDL_SYSTEM_CURSOR_ARROW, /**< Arrow */ + SDL_SYSTEM_CURSOR_IBEAM, /**< I-beam */ + SDL_SYSTEM_CURSOR_WAIT, /**< Wait */ + SDL_SYSTEM_CURSOR_CROSSHAIR, /**< Crosshair */ + SDL_SYSTEM_CURSOR_WAITARROW, /**< Small wait cursor (or Wait if not available) */ + SDL_SYSTEM_CURSOR_SIZENWSE, /**< Double arrow pointing northwest and southeast */ + SDL_SYSTEM_CURSOR_SIZENESW, /**< Double arrow pointing northeast and southwest */ + SDL_SYSTEM_CURSOR_SIZEWE, /**< Double arrow pointing west and east */ + SDL_SYSTEM_CURSOR_SIZENS, /**< Double arrow pointing north and south */ + SDL_SYSTEM_CURSOR_SIZEALL, /**< Four pointed arrow pointing north, south, east, and west */ + SDL_SYSTEM_CURSOR_NO, /**< Slashed circle or crossbones */ + SDL_SYSTEM_CURSOR_HAND, /**< Hand */ SDL_NUM_SYSTEM_CURSORS } SDL_SystemCursor; @@ -87,7 +69,7 @@ extern DECLSPEC SDL_Window * SDLCALL SDL_GetMouseFocus(void); /** * \brief Retrieve the current state of the mouse. - * + * * The current button state is returned as a button bitmask, which can * be tested using the SDL_BUTTON(X) macros, and x and y are set to the * mouse cursor position relative to the focus window for the currently @@ -106,11 +88,11 @@ extern DECLSPEC Uint32 SDLCALL SDL_GetRelativeMouseState(int *x, int *y); /** * \brief Moves the mouse to the given position within the window. - * + * * \param window The window to move the mouse into, or NULL for the current mouse focus * \param x The x coordinate within the window * \param y The y coordinate within the window - * + * * \note This function generates a mouse motion event */ extern DECLSPEC void SDLCALL SDL_WarpMouseInWindow(SDL_Window * window, @@ -118,25 +100,25 @@ extern DECLSPEC void SDLCALL SDL_WarpMouseInWindow(SDL_Window * window, /** * \brief Set relative mouse mode. - * + * * \param enabled Whether or not to enable relative mode * * \return 0 on success, or -1 if relative mode is not supported. - * + * * While the mouse is in relative mode, the cursor is hidden, and the * driver will try to report continuous motion in the current window. * Only relative motion events will be delivered, the mouse position * will not change. - * + * * \note This function will flush any pending mouse motion. - * + * * \sa SDL_GetRelativeMouseMode() */ extern DECLSPEC int SDLCALL SDL_SetRelativeMouseMode(SDL_bool enabled); /** * \brief Query whether relative mouse mode is enabled. - * + * * \sa SDL_SetRelativeMouseMode() */ extern DECLSPEC SDL_bool SDLCALL SDL_GetRelativeMouseMode(void); @@ -144,19 +126,19 @@ extern DECLSPEC SDL_bool SDLCALL SDL_GetRelativeMouseMode(void); /** * \brief Create a cursor, using the specified bitmap data and * mask (in MSB format). - * + * * The cursor width must be a multiple of 8 bits. - * + * * The cursor is created in black and white according to the following: * * * * * - * *
data mask resulting pixel on screen
0 1 White
1 1 Black
0 0 Transparent
1 0 Inverted color if possible, black + *
1 0 Inverted color if possible, black * if not.
- * + * * \sa SDL_FreeCursor() */ extern DECLSPEC SDL_Cursor *SDLCALL SDL_CreateCursor(const Uint8 * data, @@ -166,7 +148,7 @@ extern DECLSPEC SDL_Cursor *SDLCALL SDL_CreateCursor(const Uint8 * data, /** * \brief Create a color cursor. - * + * * \sa SDL_FreeCursor() */ extern DECLSPEC SDL_Cursor *SDLCALL SDL_CreateColorCursor(SDL_Surface *surface, @@ -190,19 +172,24 @@ extern DECLSPEC void SDLCALL SDL_SetCursor(SDL_Cursor * cursor); */ extern DECLSPEC SDL_Cursor *SDLCALL SDL_GetCursor(void); +/** + * \brief Return the default cursor. + */ +extern DECLSPEC SDL_Cursor *SDLCALL SDL_GetDefaultCursor(void); + /** * \brief Frees a cursor created with SDL_CreateCursor(). - * + * * \sa SDL_CreateCursor() */ extern DECLSPEC void SDLCALL SDL_FreeCursor(SDL_Cursor * cursor); /** * \brief Toggle whether or not the cursor is shown. - * - * \param toggle 1 to show the cursor, 0 to hide it, -1 to query the current + * + * \param toggle 1 to show the cursor, 0 to hide it, -1 to query the current * state. - * + * * \return 1 if the cursor is shown, or 0 if the cursor is hidden. */ extern DECLSPEC int SDLCALL SDL_ShowCursor(int toggle); @@ -213,24 +200,22 @@ extern DECLSPEC int SDLCALL SDL_ShowCursor(int toggle); * - Button 2: Middle mouse button * - Button 3: Right mouse button */ -#define SDL_BUTTON(X) (1 << ((X)-1)) -#define SDL_BUTTON_LEFT 1 -#define SDL_BUTTON_MIDDLE 2 -#define SDL_BUTTON_RIGHT 3 -#define SDL_BUTTON_X1 4 -#define SDL_BUTTON_X2 5 -#define SDL_BUTTON_LMASK SDL_BUTTON(SDL_BUTTON_LEFT) -#define SDL_BUTTON_MMASK SDL_BUTTON(SDL_BUTTON_MIDDLE) -#define SDL_BUTTON_RMASK SDL_BUTTON(SDL_BUTTON_RIGHT) -#define SDL_BUTTON_X1MASK SDL_BUTTON(SDL_BUTTON_X1) -#define SDL_BUTTON_X2MASK SDL_BUTTON(SDL_BUTTON_X2) +#define SDL_BUTTON(X) (1 << ((X)-1)) +#define SDL_BUTTON_LEFT 1 +#define SDL_BUTTON_MIDDLE 2 +#define SDL_BUTTON_RIGHT 3 +#define SDL_BUTTON_X1 4 +#define SDL_BUTTON_X2 5 +#define SDL_BUTTON_LMASK SDL_BUTTON(SDL_BUTTON_LEFT) +#define SDL_BUTTON_MMASK SDL_BUTTON(SDL_BUTTON_MIDDLE) +#define SDL_BUTTON_RMASK SDL_BUTTON(SDL_BUTTON_RIGHT) +#define SDL_BUTTON_X1MASK SDL_BUTTON(SDL_BUTTON_X1) +#define SDL_BUTTON_X2MASK SDL_BUTTON(SDL_BUTTON_X2) /* Ends C function definitions when using C++ */ #ifdef __cplusplus -/* *INDENT-OFF* */ } -/* *INDENT-ON* */ #endif #include "close_code.h" diff --git a/src/eepp/helper/SDL2/include/SDL_mutex.h b/src/eepp/helper/SDL2/include/SDL_mutex.h index 6b5014900..3efc4a890 100644 --- a/src/eepp/helper/SDL2/include/SDL_mutex.h +++ b/src/eepp/helper/SDL2/include/SDL_mutex.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -24,7 +24,7 @@ /** * \file SDL_mutex.h - * + * * Functions to provide thread synchronization primitives. */ @@ -34,21 +34,19 @@ #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus -/* *INDENT-OFF* */ extern "C" { -/* *INDENT-ON* */ #endif /** * Synchronization functions which can time out return this value * if they time out. */ -#define SDL_MUTEX_TIMEDOUT 1 +#define SDL_MUTEX_TIMEDOUT 1 /** * This is the timeout value which corresponds to never time out. */ -#define SDL_MUTEX_MAXWAIT (~(Uint32)0) +#define SDL_MUTEX_MAXWAIT (~(Uint32)0) /** @@ -67,24 +65,31 @@ extern DECLSPEC SDL_mutex *SDLCALL SDL_CreateMutex(void); /** * Lock the mutex. - * + * * \return 0, or -1 on error. */ -#define SDL_LockMutex(m) SDL_mutexP(m) -extern DECLSPEC int SDLCALL SDL_mutexP(SDL_mutex * mutex); +#define SDL_mutexP(m) SDL_LockMutex(m) +extern DECLSPEC int SDLCALL SDL_LockMutex(SDL_mutex * mutex); + +/** + * Try to lock the mutex + * + * \return 0, SDL_MUTEX_TIMEDOUT, or -1 on error + */ +extern DECLSPEC int SDLCALL SDL_TryLockMutex(SDL_mutex * mutex); /** * Unlock the mutex. - * + * * \return 0, or -1 on error. - * + * * \warning It is an error to unlock a mutex that has not been locked by * the current thread, and doing so results in undefined behavior. */ -#define SDL_UnlockMutex(m) SDL_mutexV(m) -extern DECLSPEC int SDLCALL SDL_mutexV(SDL_mutex * mutex); +#define SDL_mutexV(m) SDL_UnlockMutex(m) +extern DECLSPEC int SDLCALL SDL_UnlockMutex(SDL_mutex * mutex); -/** +/** * Destroy a mutex. */ extern DECLSPEC void SDLCALL SDL_DestroyMutex(SDL_mutex * mutex); @@ -112,34 +117,34 @@ extern DECLSPEC SDL_sem *SDLCALL SDL_CreateSemaphore(Uint32 initial_value); extern DECLSPEC void SDLCALL SDL_DestroySemaphore(SDL_sem * sem); /** - * This function suspends the calling thread until the semaphore pointed - * to by \c sem has a positive count. It then atomically decreases the + * This function suspends the calling thread until the semaphore pointed + * to by \c sem has a positive count. It then atomically decreases the * semaphore count. */ extern DECLSPEC int SDLCALL SDL_SemWait(SDL_sem * sem); /** * Non-blocking variant of SDL_SemWait(). - * - * \return 0 if the wait succeeds, ::SDL_MUTEX_TIMEDOUT if the wait would + * + * \return 0 if the wait succeeds, ::SDL_MUTEX_TIMEDOUT if the wait would * block, and -1 on error. */ extern DECLSPEC int SDLCALL SDL_SemTryWait(SDL_sem * sem); /** * Variant of SDL_SemWait() with a timeout in milliseconds. - * - * \return 0 if the wait succeeds, ::SDL_MUTEX_TIMEDOUT if the wait does not + * + * \return 0 if the wait succeeds, ::SDL_MUTEX_TIMEDOUT if the wait does not * succeed in the allotted time, and -1 on error. - * - * \warning On some platforms this function is implemented by looping with a + * + * \warning On some platforms this function is implemented by looping with a * delay of 1 ms, and so should be avoided if possible. */ extern DECLSPEC int SDLCALL SDL_SemWaitTimeout(SDL_sem * sem, Uint32 ms); /** * Atomically increases the semaphore's count (not blocking). - * + * * \return 0, or -1 on error. */ extern DECLSPEC int SDLCALL SDL_SemPost(SDL_sem * sem); @@ -198,7 +203,7 @@ extern DECLSPEC void SDLCALL SDL_DestroyCond(SDL_cond * cond); /** * Restart one of the threads that are waiting on the condition variable. - * + * * \return 0 or -1 on error. */ extern DECLSPEC int SDLCALL SDL_CondSignal(SDL_cond * cond); @@ -212,11 +217,11 @@ extern DECLSPEC int SDLCALL SDL_CondBroadcast(SDL_cond * cond); /** * Wait on the condition variable, unlocking the provided mutex. - * + * * \warning The mutex must be locked before entering this function! - * + * * The mutex is re-locked once the condition variable is signaled. - * + * * \return 0 when it is signaled, or -1 on error. */ extern DECLSPEC int SDLCALL SDL_CondWait(SDL_cond * cond, SDL_mutex * mutex); @@ -226,7 +231,7 @@ extern DECLSPEC int SDLCALL SDL_CondWait(SDL_cond * cond, SDL_mutex * mutex); * variable is signaled, ::SDL_MUTEX_TIMEDOUT if the condition is not * signaled in the allotted time, and -1 on error. * - * \warning On some platforms this function is implemented by looping with a + * \warning On some platforms this function is implemented by looping with a * delay of 1 ms, and so should be avoided if possible. */ extern DECLSPEC int SDLCALL SDL_CondWaitTimeout(SDL_cond * cond, @@ -237,9 +242,7 @@ extern DECLSPEC int SDLCALL SDL_CondWaitTimeout(SDL_cond * cond, /* Ends C function definitions when using C++ */ #ifdef __cplusplus -/* *INDENT-OFF* */ } -/* *INDENT-ON* */ #endif #include "close_code.h" diff --git a/src/eepp/helper/SDL2/include/SDL_name.h b/src/eepp/helper/SDL2/include/SDL_name.h index 511619af5..d0469e1f2 100644 --- a/src/eepp/helper/SDL2/include/SDL_name.h +++ b/src/eepp/helper/SDL2/include/SDL_name.h @@ -6,6 +6,6 @@ #define NeedFunctionPrototypes 1 #endif -#define SDL_NAME(X) SDL_##X +#define SDL_NAME(X) SDL_##X #endif /* _SDLname_h_ */ diff --git a/src/eepp/helper/SDL2/include/SDL_opengl.h b/src/eepp/helper/SDL2/include/SDL_opengl.h index e1584ae8a..2f120aa95 100644 --- a/src/eepp/helper/SDL2/include/SDL_opengl.h +++ b/src/eepp/helper/SDL2/include/SDL_opengl.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,7 +21,7 @@ /** * \file SDL_opengl.h - * + * * This is a simple file to encapsulate the OpenGL API headers. */ @@ -40,14 +40,6 @@ #include #endif -#ifdef __HAIKU__ /* !!! FIXME: temp compiler warning fix... */ -#define NO_SDL_GLEXT 1 -#endif - -#ifdef __FreeBSD__ /* !!! FIXME: temp compiler warning fix... */ -#define NO_SDL_GLEXT 1 -#endif - #ifdef __glext_h_ /* Someone has already included glext.h */ #define NO_SDL_GLEXT @@ -67,23 +59,22 @@ /** * \file SDL_opengl.h - * + * * This file is included because glext.h is not available on some systems. * If you don't want this version included, simply define ::NO_SDL_GLEXT. - * + * * The latest version is available from: - * http://www.opengl.org/registry/ + * http://www.opengl.org/registry/ */ /** * \def NO_SDL_GLEXT - * - * Define this if you have your own version of glext.h and want to disable the + * + * Define this if you have your own version of glext.h and want to disable the * version included in SDL_opengl.h. */ #if !defined(NO_SDL_GLEXT) && !defined(GL_GLEXT_LEGACY) -/* *INDENT-OFF* */ #ifndef __glext_h_ #define __glext_h_ @@ -93,7 +84,7 @@ extern "C" { /* ** Copyright (c) 2007-2010 The Khronos Group Inc. -** +** ** Permission is hereby granted, free of charge, to any person obtaining a ** copy of this software and/or associated documentation files (the ** "Materials"), to deal in the Materials without restriction, including @@ -101,10 +92,10 @@ extern "C" { ** distribute, sublicense, and/or sell copies of the Materials, and to ** permit persons to whom the Materials are furnished to do so, subject to ** the following conditions: -** +** ** The above copyright notice and this permission notice shall be included ** in all copies or substantial portions of the Materials. -** +** ** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, ** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF ** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. @@ -11126,7 +11117,6 @@ typedef void (APIENTRYP PFNGLVDPAUUNMAPSURFACESNVPROC) (GLsizei numSurface, cons #endif #endif -/* *INDENT-ON* */ #endif /* NO_SDL_GLEXT */ #endif /* !__IPHONEOS__ */ diff --git a/src/eepp/helper/SDL2/include/SDL_opengles.h b/src/eepp/helper/SDL2/include/SDL_opengles.h index 32ee2378f..00e60f5c1 100644 --- a/src/eepp/helper/SDL2/include/SDL_opengles.h +++ b/src/eepp/helper/SDL2/include/SDL_opengles.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,7 +21,7 @@ /** * \file SDL_opengles.h - * + * * This is a simple file to encapsulate the OpenGL ES 1.X API headers. */ diff --git a/src/eepp/helper/SDL2/include/SDL_opengles2.h b/src/eepp/helper/SDL2/include/SDL_opengles2.h index e034959ae..7697626f4 100644 --- a/src/eepp/helper/SDL2/include/SDL_opengles2.h +++ b/src/eepp/helper/SDL2/include/SDL_opengles2.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,7 +21,7 @@ /** * \file SDL_opengles.h - * + * * This is a simple file to encapsulate the OpenGL ES 2.0 API headers. */ diff --git a/src/eepp/helper/SDL2/include/SDL_pixels.h b/src/eepp/helper/SDL2/include/SDL_pixels.h index 99b475f3d..5e17cba53 100644 --- a/src/eepp/helper/SDL2/include/SDL_pixels.h +++ b/src/eepp/helper/SDL2/include/SDL_pixels.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,7 +21,7 @@ /** * \file SDL_pixels.h - * + * * Header for the enumerated pixel format definitions. */ @@ -31,14 +31,12 @@ #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus -/* *INDENT-OFF* */ extern "C" { -/* *INDENT-ON* */ #endif /** * \name Transparency definitions - * + * * These define alpha as the opacity of a surface. */ /*@{*/ @@ -117,11 +115,11 @@ enum ((1 << 28) | ((type) << 24) | ((order) << 20) | ((layout) << 16) | \ ((bits) << 8) | ((bytes) << 0)) -#define SDL_PIXELFLAG(X) (((X) >> 28) & 0x0F) -#define SDL_PIXELTYPE(X) (((X) >> 24) & 0x0F) -#define SDL_PIXELORDER(X) (((X) >> 20) & 0x0F) -#define SDL_PIXELLAYOUT(X) (((X) >> 16) & 0x0F) -#define SDL_BITSPERPIXEL(X) (((X) >> 8) & 0xFF) +#define SDL_PIXELFLAG(X) (((X) >> 28) & 0x0F) +#define SDL_PIXELTYPE(X) (((X) >> 24) & 0x0F) +#define SDL_PIXELORDER(X) (((X) >> 20) & 0x0F) +#define SDL_PIXELLAYOUT(X) (((X) >> 16) & 0x0F) +#define SDL_BITSPERPIXEL(X) (((X) >> 8) & 0xFF) #define SDL_BYTESPERPIXEL(X) \ (SDL_ISPIXELFORMAT_FOURCC(X) ? \ ((((X) == SDL_PIXELFORMAT_YUY2) || \ @@ -256,7 +254,7 @@ typedef struct SDL_Color Uint8 r; Uint8 g; Uint8 b; - Uint8 unused; + Uint8 a; } SDL_Color; #define SDL_Colour SDL_Color @@ -301,9 +299,9 @@ extern DECLSPEC const char* SDLCALL SDL_GetPixelFormatName(Uint32 format); /** * \brief Convert one of the enumerated pixel formats to a bpp and RGBA masks. - * + * * \return SDL_TRUE, or SDL_FALSE if the conversion wasn't possible. - * + * * \sa SDL_MasksToPixelFormatEnum() */ extern DECLSPEC SDL_bool SDLCALL SDL_PixelFormatEnumToMasks(Uint32 format, @@ -315,10 +313,10 @@ extern DECLSPEC SDL_bool SDLCALL SDL_PixelFormatEnumToMasks(Uint32 format, /** * \brief Convert a bpp and RGBA masks to an enumerated pixel format. - * - * \return The pixel format, or ::SDL_PIXELFORMAT_UNKNOWN if the conversion + * + * \return The pixel format, or ::SDL_PIXELFORMAT_UNKNOWN if the conversion * wasn't possible. - * + * * \sa SDL_PixelFormatEnumToMasks() */ extern DECLSPEC Uint32 SDLCALL SDL_MasksToPixelFormatEnum(int bpp, @@ -338,13 +336,13 @@ extern DECLSPEC SDL_PixelFormat * SDLCALL SDL_AllocFormat(Uint32 pixel_format); extern DECLSPEC void SDLCALL SDL_FreeFormat(SDL_PixelFormat *format); /** - * \brief Create a palette structure with the specified number of color + * \brief Create a palette structure with the specified number of color * entries. - * + * * \return A new palette, or NULL if there wasn't enough memory. - * + * * \note The palette entries are initialized to white. - * + * * \sa SDL_FreePalette() */ extern DECLSPEC SDL_Palette *SDLCALL SDL_AllocPalette(int ncolors); @@ -357,12 +355,12 @@ extern DECLSPEC int SDLCALL SDL_SetPixelFormatPalette(SDL_PixelFormat * format, /** * \brief Set a range of colors in a palette. - * + * * \param palette The palette to modify. * \param colors An array of colors to copy into the palette. * \param firstcolor The index of the first palette entry to modify. * \param ncolors The number of entries to modify. - * + * * \return 0 on success, or -1 if not all of the colors could be set. */ extern DECLSPEC int SDLCALL SDL_SetPaletteColors(SDL_Palette * palette, @@ -371,14 +369,14 @@ extern DECLSPEC int SDLCALL SDL_SetPaletteColors(SDL_Palette * palette, /** * \brief Free a palette created with SDL_AllocPalette(). - * + * * \sa SDL_AllocPalette() */ extern DECLSPEC void SDLCALL SDL_FreePalette(SDL_Palette * palette); /** * \brief Maps an RGB triple to an opaque pixel value for a given pixel format. - * + * * \sa SDL_MapRGBA */ extern DECLSPEC Uint32 SDLCALL SDL_MapRGB(const SDL_PixelFormat * format, @@ -386,7 +384,7 @@ extern DECLSPEC Uint32 SDLCALL SDL_MapRGB(const SDL_PixelFormat * format, /** * \brief Maps an RGBA quadruple to a pixel value for a given pixel format. - * + * * \sa SDL_MapRGB */ extern DECLSPEC Uint32 SDLCALL SDL_MapRGBA(const SDL_PixelFormat * format, @@ -395,7 +393,7 @@ extern DECLSPEC Uint32 SDLCALL SDL_MapRGBA(const SDL_PixelFormat * format, /** * \brief Get the RGB components from a pixel of the specified format. - * + * * \sa SDL_GetRGBA */ extern DECLSPEC void SDLCALL SDL_GetRGB(Uint32 pixel, @@ -404,7 +402,7 @@ extern DECLSPEC void SDLCALL SDL_GetRGB(Uint32 pixel, /** * \brief Get the RGBA components from a pixel of the specified format. - * + * * \sa SDL_GetRGB */ extern DECLSPEC void SDLCALL SDL_GetRGBA(Uint32 pixel, @@ -420,9 +418,7 @@ extern DECLSPEC void SDLCALL SDL_CalculateGammaRamp(float gamma, Uint16 * ramp); /* Ends C function definitions when using C++ */ #ifdef __cplusplus -/* *INDENT-OFF* */ } -/* *INDENT-ON* */ #endif #include "close_code.h" diff --git a/src/eepp/helper/SDL2/include/SDL_platform.h b/src/eepp/helper/SDL2/include/SDL_platform.h index 736d1bfec..77ee437cb 100644 --- a/src/eepp/helper/SDL2/include/SDL_platform.h +++ b/src/eepp/helper/SDL2/include/SDL_platform.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,7 +21,7 @@ /** * \file SDL_platform.h - * + * * Try to get a standard set of platform defines. */ @@ -30,39 +30,39 @@ #if defined(_AIX) #undef __AIX__ -#define __AIX__ 1 +#define __AIX__ 1 #endif #if defined(__BEOS__) #undef __BEOS__ -#define __BEOS__ 1 +#define __BEOS__ 1 #endif #if defined(__HAIKU__) #undef __HAIKU__ -#define __HAIKU__ 1 +#define __HAIKU__ 1 #endif #if defined(bsdi) || defined(__bsdi) || defined(__bsdi__) #undef __BSDI__ -#define __BSDI__ 1 +#define __BSDI__ 1 #endif #if defined(_arch_dreamcast) #undef __DREAMCAST__ -#define __DREAMCAST__ 1 +#define __DREAMCAST__ 1 #endif #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) #undef __FREEBSD__ -#define __FREEBSD__ 1 +#define __FREEBSD__ 1 #endif #if defined(hpux) || defined(__hpux) || defined(__hpux__) #undef __HPUX__ -#define __HPUX__ 1 +#define __HPUX__ 1 #endif #if defined(sgi) || defined(__sgi) || defined(__sgi__) || defined(_SGI_SOURCE) #undef __IRIX__ -#define __IRIX__ 1 +#define __IRIX__ 1 #endif #if defined(linux) || defined(__linux) || defined(__linux__) #undef __LINUX__ -#define __LINUX__ 1 +#define __LINUX__ 1 #endif #if defined(ANDROID) #undef __ANDROID__ @@ -82,55 +82,51 @@ #else /* if not compiling for iPhone */ #undef __MACOSX__ -#define __MACOSX__ 1 +#define __MACOSX__ 1 #endif /* TARGET_OS_IPHONE */ #endif /* defined(__APPLE__) */ #if defined(__NetBSD__) #undef __NETBSD__ -#define __NETBSD__ 1 +#define __NETBSD__ 1 #endif #if defined(__OpenBSD__) #undef __OPENBSD__ -#define __OPENBSD__ 1 +#define __OPENBSD__ 1 #endif #if defined(__OS2__) #undef __OS2__ -#define __OS2__ 1 +#define __OS2__ 1 #endif #if defined(osf) || defined(__osf) || defined(__osf__) || defined(_OSF_SOURCE) #undef __OSF__ -#define __OSF__ 1 +#define __OSF__ 1 #endif #if defined(__QNXNTO__) #undef __QNXNTO__ -#define __QNXNTO__ 1 +#define __QNXNTO__ 1 #endif #if defined(riscos) || defined(__riscos) || defined(__riscos__) #undef __RISCOS__ -#define __RISCOS__ 1 +#define __RISCOS__ 1 #endif #if defined(__SVR4) #undef __SOLARIS__ -#define __SOLARIS__ 1 +#define __SOLARIS__ 1 #endif #if defined(WIN32) || defined(_WIN32) #undef __WIN32__ -#define __WIN32__ 1 +#define __WIN32__ 1 #endif - -#if defined(__NDS__) -#undef __NINTENDODS__ -#define __NINTENDODS__ 1 +#if defined(__PSP__) +#undef __PSP__ +#define __PSP__ 1 #endif - #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus -/* *INDENT-OFF* */ extern "C" { -/* *INDENT-ON* */ #endif /** @@ -140,9 +136,7 @@ extern DECLSPEC const char * SDLCALL SDL_GetPlatform (void); /* Ends C function definitions when using C++ */ #ifdef __cplusplus -/* *INDENT-OFF* */ } -/* *INDENT-ON* */ #endif #include "close_code.h" diff --git a/src/eepp/helper/SDL2/include/SDL_power.h b/src/eepp/helper/SDL2/include/SDL_power.h index 33413c4a8..4f70c5bb1 100644 --- a/src/eepp/helper/SDL2/include/SDL_power.h +++ b/src/eepp/helper/SDL2/include/SDL_power.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -24,7 +24,7 @@ /** * \file SDL_power.h - * + * * Header for the SDL power management routines. */ @@ -33,9 +33,7 @@ #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus -/* *INDENT-OFF* */ extern "C" { -/* *INDENT-ON* */ #endif /** @@ -53,24 +51,22 @@ typedef enum /** * \brief Get the current power supply details. - * + * * \param secs Seconds of battery life left. You can pass a NULL here if * you don't care. Will return -1 if we can't determine a * value, or we're not running on a battery. - * + * * \param pct Percentage of battery life left, between 0 and 100. You can * pass a NULL here if you don't care. Will return -1 if we * can't determine a value, or we're not running on a battery. - * + * * \return The state of the battery (if any). */ extern DECLSPEC SDL_PowerState SDLCALL SDL_GetPowerInfo(int *secs, int *pct); /* Ends C function definitions when using C++ */ #ifdef __cplusplus -/* *INDENT-OFF* */ } -/* *INDENT-ON* */ #endif #include "close_code.h" diff --git a/src/eepp/helper/SDL2/include/SDL_quit.h b/src/eepp/helper/SDL2/include/SDL_quit.h index 22262c676..485e42db0 100644 --- a/src/eepp/helper/SDL2/include/SDL_quit.h +++ b/src/eepp/helper/SDL2/include/SDL_quit.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,7 +21,7 @@ /** * \file SDL_quit.h - * + * * Include file for SDL quit event handling. */ @@ -33,11 +33,11 @@ /** * \file SDL_quit.h - * + * * An ::SDL_QUIT event is generated when the user tries to close the application * window. If it is ignored or filtered out, the window will remain open. * If it is not ignored or filtered, it is queued normally and the window - * is allowed to close. When the window is closed, screen updates will + * is allowed to close. When the window is closed, screen updates will * complete, but have no effect. * * SDL_Init() installs signal handlers for SIGINT (keyboard interrupt) @@ -46,7 +46,7 @@ * to determine the cause of an ::SDL_QUIT event, but setting a signal * handler in your application will override the default generation of * quit events for that signal. - * + * * \sa SDL_Quit() */ diff --git a/src/eepp/helper/SDL2/include/SDL_rect.h b/src/eepp/helper/SDL2/include/SDL_rect.h index 6b4dde19d..c8af7c197 100644 --- a/src/eepp/helper/SDL2/include/SDL_rect.h +++ b/src/eepp/helper/SDL2/include/SDL_rect.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,7 +21,7 @@ /** * \file SDL_rect.h - * + * * Header file for SDL_rect definition and management functions. */ @@ -36,9 +36,7 @@ #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus -/* *INDENT-OFF* */ extern "C" { -/* *INDENT-ON* */ #endif /** @@ -54,7 +52,7 @@ typedef struct /** * \brief A rectangle, with the origin at the upper left. - * + * * \sa SDL_RectEmpty * \sa SDL_RectEquals * \sa SDL_HasIntersection @@ -71,18 +69,23 @@ typedef struct SDL_Rect /** * \brief Returns true if the rectangle has no area. */ -#define SDL_RectEmpty(X) ((!(X)) || ((X)->w <= 0) || ((X)->h <= 0)) +SDL_FORCE_INLINE SDL_bool SDL_RectEmpty(const SDL_Rect *r) +{ + return ((!r) || (r->w <= 0) || (r->h <= 0)) ? SDL_TRUE : SDL_FALSE; +} /** * \brief Returns true if the two rectangles are equal. */ -#define SDL_RectEquals(A, B) (((A)) && ((B)) && \ - ((A)->x == (B)->x) && ((A)->y == (B)->y) && \ - ((A)->w == (B)->w) && ((A)->h == (B)->h)) +SDL_FORCE_INLINE SDL_bool SDL_RectEquals(const SDL_Rect *a, const SDL_Rect *b) +{ + return (a && b && (a->x == b->x) && (a->y == b->y) && + (a->w == b->w) && (a->h == b->h)) ? SDL_TRUE : SDL_FALSE; +} /** * \brief Determine whether two rectangles intersect. - * + * * \return SDL_TRUE if there is an intersection, SDL_FALSE otherwise. */ extern DECLSPEC SDL_bool SDLCALL SDL_HasIntersection(const SDL_Rect * A, @@ -90,7 +93,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasIntersection(const SDL_Rect * A, /** * \brief Calculate the intersection of two rectangles. - * + * * \return SDL_TRUE if there is an intersection, SDL_FALSE otherwise. */ extern DECLSPEC SDL_bool SDLCALL SDL_IntersectRect(const SDL_Rect * A, @@ -116,7 +119,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_EnclosePoints(const SDL_Point * points, /** * \brief Calculate the intersection of a rectangle and line segment. - * + * * \return SDL_TRUE if there is an intersection, SDL_FALSE otherwise. */ extern DECLSPEC SDL_bool SDLCALL SDL_IntersectRectAndLine(const SDL_Rect * @@ -126,9 +129,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_IntersectRectAndLine(const SDL_Rect * /* Ends C function definitions when using C++ */ #ifdef __cplusplus -/* *INDENT-OFF* */ } -/* *INDENT-ON* */ #endif #include "close_code.h" diff --git a/src/eepp/helper/SDL2/include/SDL_render.h b/src/eepp/helper/SDL2/include/SDL_render.h index 0694540b5..aa92559a3 100644 --- a/src/eepp/helper/SDL2/include/SDL_render.h +++ b/src/eepp/helper/SDL2/include/SDL_render.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,7 +21,7 @@ /** * \file SDL_render.h - * + * * Header file for SDL 2D rendering functions. * * This API supports the following features: @@ -52,9 +52,7 @@ #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus -/* *INDENT-OFF* */ extern "C" { -/* *INDENT-ON* */ #endif /** @@ -62,10 +60,10 @@ extern "C" { */ typedef enum { - SDL_RENDERER_SOFTWARE = 0x00000001, /**< The renderer is a software fallback */ - SDL_RENDERER_ACCELERATED = 0x00000002, /**< The renderer uses hardware + SDL_RENDERER_SOFTWARE = 0x00000001, /**< The renderer is a software fallback */ + SDL_RENDERER_ACCELERATED = 0x00000002, /**< The renderer uses hardware acceleration */ - SDL_RENDERER_PRESENTVSYNC = 0x00000004, /**< Present is synchronized + SDL_RENDERER_PRESENTVSYNC = 0x00000004, /**< Present is synchronized with the refresh rate */ SDL_RENDERER_TARGETTEXTURE = 0x00000008 /**< The renderer supports rendering to texture */ @@ -130,28 +128,28 @@ typedef struct SDL_Texture SDL_Texture; /* Function prototypes */ /** - * \brief Get the number of 2D rendering drivers available for the current + * \brief Get the number of 2D rendering drivers available for the current * display. - * + * * A render driver is a set of code that handles rendering and texture * management on a particular display. Normally there is only one, but * some drivers may have several available with different capabilities. - * + * * \sa SDL_GetRenderDriverInfo() * \sa SDL_CreateRenderer() */ extern DECLSPEC int SDLCALL SDL_GetNumRenderDrivers(void); /** - * \brief Get information about a specific 2D rendering driver for the current + * \brief Get information about a specific 2D rendering driver for the current * display. - * + * * \param index The index of the driver to query information about. - * \param info A pointer to an SDL_RendererInfo struct to be filled with + * \param info A pointer to an SDL_RendererInfo struct to be filled with * information on the rendering driver. - * + * * \return 0 on success, -1 if the index was out of range. - * + * * \sa SDL_CreateRenderer() */ extern DECLSPEC int SDLCALL SDL_GetRenderDriverInfo(int index, @@ -175,14 +173,14 @@ extern DECLSPEC int SDLCALL SDL_CreateWindowAndRenderer( /** * \brief Create a 2D rendering context for a window. - * + * * \param window The window where rendering is displayed. - * \param index The index of the rendering driver to initialize, or -1 to + * \param index The index of the rendering driver to initialize, or -1 to * initialize the first one supporting the requested flags. * \param flags ::SDL_RendererFlags. - * + * * \return A valid rendering context or NULL if there was an error. - * + * * \sa SDL_CreateSoftwareRenderer() * \sa SDL_GetRendererInfo() * \sa SDL_DestroyRenderer() @@ -192,11 +190,11 @@ extern DECLSPEC SDL_Renderer * SDLCALL SDL_CreateRenderer(SDL_Window * window, /** * \brief Create a 2D software rendering context for a surface. - * + * * \param surface The surface where rendering is done. - * + * * \return A valid rendering context or NULL if there was an error. - * + * * \sa SDL_CreateRenderer() * \sa SDL_DestroyRenderer() */ @@ -215,16 +213,17 @@ extern DECLSPEC int SDLCALL SDL_GetRendererInfo(SDL_Renderer * renderer, /** * \brief Create a texture for a rendering context. - * + * + * \param renderer The renderer. * \param format The format of the texture. * \param access One of the enumerated values in ::SDL_TextureAccess. * \param w The width of the texture in pixels. * \param h The height of the texture in pixels. - * - * \return The created texture is returned, or 0 if no rendering context was + * + * \return The created texture is returned, or 0 if no rendering context was * active, the format was unsupported, or the width or height were out * of range. - * + * * \sa SDL_QueryTexture() * \sa SDL_UpdateTexture() * \sa SDL_DestroyTexture() @@ -236,13 +235,14 @@ extern DECLSPEC SDL_Texture * SDLCALL SDL_CreateTexture(SDL_Renderer * renderer, /** * \brief Create a texture from an existing surface. - * + * + * \param renderer The renderer. * \param surface The surface containing pixel data used to fill the texture. - * + * * \return The created texture is returned, or 0 on error. - * + * * \note The surface is not modified or freed by this function. - * + * * \sa SDL_QueryTexture() * \sa SDL_DestroyTexture() */ @@ -250,15 +250,15 @@ extern DECLSPEC SDL_Texture * SDLCALL SDL_CreateTextureFromSurface(SDL_Renderer /** * \brief Query the attributes of a texture - * + * * \param texture A texture to be queried. - * \param format A pointer filled in with the raw format of the texture. The - * actual format may differ, but pixel transfers will use this + * \param format A pointer filled in with the raw format of the texture. The + * actual format may differ, but pixel transfers will use this * format. * \param access A pointer filled in with the actual access to the texture. * \param w A pointer filled in with the width of the texture in pixels. * \param h A pointer filled in with the height of the texture in pixels. - * + * * \return 0 on success, or -1 if the texture is not valid. */ extern DECLSPEC int SDLCALL SDL_QueryTexture(SDL_Texture * texture, @@ -267,15 +267,15 @@ extern DECLSPEC int SDLCALL SDL_QueryTexture(SDL_Texture * texture, /** * \brief Set an additional color value used in render copy operations. - * + * * \param texture The texture to update. * \param r The red color value multiplied into copy operations. * \param g The green color value multiplied into copy operations. * \param b The blue color value multiplied into copy operations. - * - * \return 0 on success, or -1 if the texture is not valid or color modulation + * + * \return 0 on success, or -1 if the texture is not valid or color modulation * is not supported. - * + * * \sa SDL_GetTextureColorMod() */ extern DECLSPEC int SDLCALL SDL_SetTextureColorMod(SDL_Texture * texture, @@ -284,14 +284,14 @@ extern DECLSPEC int SDLCALL SDL_SetTextureColorMod(SDL_Texture * texture, /** * \brief Get the additional color value used in render copy operations. - * + * * \param texture The texture to query. * \param r A pointer filled in with the current red color value. * \param g A pointer filled in with the current green color value. * \param b A pointer filled in with the current blue color value. - * + * * \return 0 on success, or -1 if the texture is not valid. - * + * * \sa SDL_SetTextureColorMod() */ extern DECLSPEC int SDLCALL SDL_GetTextureColorMod(SDL_Texture * texture, @@ -300,13 +300,13 @@ extern DECLSPEC int SDLCALL SDL_GetTextureColorMod(SDL_Texture * texture, /** * \brief Set an additional alpha value used in render copy operations. - * + * * \param texture The texture to update. * \param alpha The alpha value multiplied into copy operations. - * - * \return 0 on success, or -1 if the texture is not valid or alpha modulation + * + * \return 0 on success, or -1 if the texture is not valid or alpha modulation * is not supported. - * + * * \sa SDL_GetTextureAlphaMod() */ extern DECLSPEC int SDLCALL SDL_SetTextureAlphaMod(SDL_Texture * texture, @@ -314,12 +314,12 @@ extern DECLSPEC int SDLCALL SDL_SetTextureAlphaMod(SDL_Texture * texture, /** * \brief Get the additional alpha value used in render copy operations. - * + * * \param texture The texture to query. * \param alpha A pointer filled in with the current alpha value. - * + * * \return 0 on success, or -1 if the texture is not valid. - * + * * \sa SDL_SetTextureAlphaMod() */ extern DECLSPEC int SDLCALL SDL_GetTextureAlphaMod(SDL_Texture * texture, @@ -327,16 +327,16 @@ extern DECLSPEC int SDLCALL SDL_GetTextureAlphaMod(SDL_Texture * texture, /** * \brief Set the blend mode used for texture copy operations. - * + * * \param texture The texture to update. * \param blendMode ::SDL_BlendMode to use for texture blending. - * + * * \return 0 on success, or -1 if the texture is not valid or the blend mode is * not supported. - * + * * \note If the blend mode is not supported, the closest supported mode is * chosen. - * + * * \sa SDL_GetTextureBlendMode() */ extern DECLSPEC int SDLCALL SDL_SetTextureBlendMode(SDL_Texture * texture, @@ -344,12 +344,12 @@ extern DECLSPEC int SDLCALL SDL_SetTextureBlendMode(SDL_Texture * texture, /** * \brief Get the blend mode used for texture copy operations. - * + * * \param texture The texture to query. * \param blendMode A pointer filled in with the current blend mode. - * + * * \return 0 on success, or -1 if the texture is not valid. - * + * * \sa SDL_SetTextureBlendMode() */ extern DECLSPEC int SDLCALL SDL_GetTextureBlendMode(SDL_Texture * texture, @@ -357,15 +357,15 @@ extern DECLSPEC int SDLCALL SDL_GetTextureBlendMode(SDL_Texture * texture, /** * \brief Update the given texture rectangle with new pixel data. - * + * * \param texture The texture to update - * \param rect A pointer to the rectangle of pixels to update, or NULL to + * \param rect A pointer to the rectangle of pixels to update, or NULL to * update the entire texture. * \param pixels The raw pixel data. * \param pitch The number of bytes between rows of pixel data. - * + * * \return 0 on success, or -1 if the texture is not valid. - * + * * \note This is a fairly slow function. */ extern DECLSPEC int SDLCALL SDL_UpdateTexture(SDL_Texture * texture, @@ -374,17 +374,17 @@ extern DECLSPEC int SDLCALL SDL_UpdateTexture(SDL_Texture * texture, /** * \brief Lock a portion of the texture for write-only pixel access. - * - * \param texture The texture to lock for access, which was created with + * + * \param texture The texture to lock for access, which was created with * ::SDL_TEXTUREACCESS_STREAMING. - * \param rect A pointer to the rectangle to lock for access. If the rect + * \param rect A pointer to the rectangle to lock for access. If the rect * is NULL, the entire texture will be locked. - * \param pixels This is filled in with a pointer to the locked pixels, + * \param pixels This is filled in with a pointer to the locked pixels, * appropriately offset by the locked area. * \param pitch This is filled in with the pitch of the locked pixels. - * + * * \return 0 on success, or -1 if the texture is not valid or was not created with ::SDL_TEXTUREACCESS_STREAMING. - * + * * \sa SDL_UnlockTexture() */ extern DECLSPEC int SDLCALL SDL_LockTexture(SDL_Texture * texture, @@ -393,7 +393,7 @@ extern DECLSPEC int SDLCALL SDL_LockTexture(SDL_Texture * texture, /** * \brief Unlock a texture, uploading the changes to video memory, if needed. - * + * * \sa SDL_LockTexture() */ extern DECLSPEC void SDLCALL SDL_UnlockTexture(SDL_Texture * texture); @@ -410,6 +410,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_RenderTargetSupported(SDL_Renderer *rendere /** * \brief Set a texture as the current rendering target. * + * \param renderer The renderer. * \param texture The targeted texture, which must be created with the SDL_TEXTUREACCESS_TARGET flag, or NULL for the default render target * * \return 0 on success, or -1 on error @@ -431,6 +432,7 @@ extern DECLSPEC SDL_Texture * SDLCALL SDL_GetRenderTarget(SDL_Renderer *renderer /** * \brief Set device independent resolution for rendering * + * \param renderer The renderer for which resolution should be set. * \param w The width of the logical resolution * \param h The height of the logical resolution * @@ -442,7 +444,7 @@ extern DECLSPEC SDL_Texture * SDLCALL SDL_GetRenderTarget(SDL_Renderer *renderer * If the output display is a window, mouse events in the window will be filtered * and scaled so they seem to arrive within the logical resolution. * - * \note If this function results in scaling or subpixel drawing by the + * \note If this function results in scaling or subpixel drawing by the * rendering backend, it will be handled using the appropriate * quality hints. * @@ -455,20 +457,24 @@ extern DECLSPEC int SDLCALL SDL_RenderSetLogicalSize(SDL_Renderer * renderer, in /** * \brief Get device independent resolution for rendering * + * \param renderer The renderer from which resolution should be queried. * \param w A pointer filled with the width of the logical resolution * \param h A pointer filled with the height of the logical resolution * * \sa SDL_RenderSetLogicalSize() */ -extern DECLSPEC void SDLCALL SDL_RenderGetLogicalSize(SDL_Renderer * renderer, int *w, int *y); +extern DECLSPEC void SDLCALL SDL_RenderGetLogicalSize(SDL_Renderer * renderer, int *w, int *h); /** * \brief Set the drawing area for rendering on the current target. * + * \param renderer The renderer for which the drawing area should be set. * \param rect The rectangle representing the drawing area, or NULL to set the viewport to the entire target. * * The x,y of the viewport rect represents the origin for rendering. * + * \return 0 on success, or -1 on error + * * \note When the window is resized, the current viewport is automatically * centered within the new window size. * @@ -486,9 +492,36 @@ extern DECLSPEC int SDLCALL SDL_RenderSetViewport(SDL_Renderer * renderer, extern DECLSPEC void SDLCALL SDL_RenderGetViewport(SDL_Renderer * renderer, SDL_Rect * rect); +/** + * \brief Set the clip rectangle for the current target. + * + * \param renderer The renderer for which clip rectangle should be set. + * \param rect A pointer to the rectangle to set as the clip rectangle, or + * NULL to disable clipping. + * + * \return 0 on success, or -1 on error + * + * \sa SDL_RenderGetClipRect() + */ +extern DECLSPEC int SDLCALL SDL_RenderSetClipRect(SDL_Renderer * renderer, + const SDL_Rect * rect); + +/** + * \brief Get the clip rectangle for the current target. + * + * \param renderer The renderer from which clip rectangle should be queried. + * \param rect A pointer filled in with the current clip rectangle, or + * an empty rectangle if clipping is disabled. + * + * \sa SDL_RenderSetClipRect() + */ +extern DECLSPEC void SDLCALL SDL_RenderGetClipRect(SDL_Renderer * renderer, + SDL_Rect * rect); + /** * \brief Set the drawing scale for rendering on the current target. * + * \param renderer The renderer for which the drawing scale should be set. * \param scaleX The horizontal scaling factor * \param scaleY The vertical scaling factor * @@ -496,7 +529,7 @@ extern DECLSPEC void SDLCALL SDL_RenderGetViewport(SDL_Renderer * renderer, * before they are used by the renderer. This allows resolution * independent drawing with a single coordinate system. * - * \note If this results in scaling or subpixel drawing by the + * \note If this results in scaling or subpixel drawing by the * rendering backend, it will be handled using the appropriate * quality hints. For best results use integer scaling factors. * @@ -509,6 +542,7 @@ extern DECLSPEC int SDLCALL SDL_RenderSetScale(SDL_Renderer * renderer, /** * \brief Get the drawing scale for the current target. * + * \param renderer The renderer from which drawing scale should be queried. * \param scaleX A pointer filled in with the horizontal scaling factor * \param scaleY A pointer filled in with the vertical scaling factor * @@ -519,13 +553,14 @@ extern DECLSPEC void SDLCALL SDL_RenderGetScale(SDL_Renderer * renderer, /** * \brief Set the color used for drawing operations (Rect, Line and Clear). - * + * + * \param renderer The renderer for which drawing color should be set. * \param r The red value used to draw on the rendering target. * \param g The green value used to draw on the rendering target. * \param b The blue value used to draw on the rendering target. - * \param a The alpha value used to draw on the rendering target, usually + * \param a The alpha value used to draw on the rendering target, usually * ::SDL_ALPHA_OPAQUE (255). - * + * * \return 0 on success, or -1 on error */ extern DECLSPEC int SDL_SetRenderDrawColor(SDL_Renderer * renderer, @@ -534,13 +569,14 @@ extern DECLSPEC int SDL_SetRenderDrawColor(SDL_Renderer * renderer, /** * \brief Get the color used for drawing operations (Rect, Line and Clear). - * + * + * \param renderer The renderer from which drawing color should be queried. * \param r A pointer to the red value used to draw on the rendering target. * \param g A pointer to the green value used to draw on the rendering target. * \param b A pointer to the blue value used to draw on the rendering target. - * \param a A pointer to the alpha value used to draw on the rendering target, + * \param a A pointer to the alpha value used to draw on the rendering target, * usually ::SDL_ALPHA_OPAQUE (255). - * + * * \return 0 on success, or -1 on error */ extern DECLSPEC int SDL_GetRenderDrawColor(SDL_Renderer * renderer, @@ -549,14 +585,15 @@ extern DECLSPEC int SDL_GetRenderDrawColor(SDL_Renderer * renderer, /** * \brief Set the blend mode used for drawing operations (Fill and Line). - * + * + * \param renderer The renderer for which blend mode should be set. * \param blendMode ::SDL_BlendMode to use for blending. - * + * * \return 0 on success, or -1 on error - * - * \note If the blend mode is not supported, the closest supported mode is + * + * \note If the blend mode is not supported, the closest supported mode is * chosen. - * + * * \sa SDL_GetRenderDrawBlendMode() */ extern DECLSPEC int SDLCALL SDL_SetRenderDrawBlendMode(SDL_Renderer * renderer, @@ -564,11 +601,12 @@ extern DECLSPEC int SDLCALL SDL_SetRenderDrawBlendMode(SDL_Renderer * renderer, /** * \brief Get the blend mode used for drawing operations. - * + * + * \param renderer The renderer from which blend mode should be queried. * \param blendMode A pointer filled in with the current blend mode. - * + * * \return 0 on success, or -1 on error - * + * * \sa SDL_SetRenderDrawBlendMode() */ extern DECLSPEC int SDLCALL SDL_GetRenderDrawBlendMode(SDL_Renderer * renderer, @@ -578,15 +616,18 @@ extern DECLSPEC int SDLCALL SDL_GetRenderDrawBlendMode(SDL_Renderer * renderer, * \brief Clear the current rendering target with the drawing color * * This function clears the entire rendering target, ignoring the viewport. + * + * \return 0 on success, or -1 on error */ extern DECLSPEC int SDLCALL SDL_RenderClear(SDL_Renderer * renderer); /** * \brief Draw a point on the current rendering target. - * + * + * \param renderer The renderer which should draw a point. * \param x The x coordinate of the point. * \param y The y coordinate of the point. - * + * * \return 0 on success, or -1 on error */ extern DECLSPEC int SDLCALL SDL_RenderDrawPoint(SDL_Renderer * renderer, @@ -594,10 +635,11 @@ extern DECLSPEC int SDLCALL SDL_RenderDrawPoint(SDL_Renderer * renderer, /** * \brief Draw multiple points on the current rendering target. - * + * + * \param renderer The renderer which should draw multiple points. * \param points The points to draw * \param count The number of points to draw - * + * * \return 0 on success, or -1 on error */ extern DECLSPEC int SDLCALL SDL_RenderDrawPoints(SDL_Renderer * renderer, @@ -606,12 +648,13 @@ extern DECLSPEC int SDLCALL SDL_RenderDrawPoints(SDL_Renderer * renderer, /** * \brief Draw a line on the current rendering target. - * + * + * \param renderer The renderer which should draw a line. * \param x1 The x coordinate of the start point. * \param y1 The y coordinate of the start point. * \param x2 The x coordinate of the end point. * \param y2 The y coordinate of the end point. - * + * * \return 0 on success, or -1 on error */ extern DECLSPEC int SDLCALL SDL_RenderDrawLine(SDL_Renderer * renderer, @@ -619,10 +662,11 @@ extern DECLSPEC int SDLCALL SDL_RenderDrawLine(SDL_Renderer * renderer, /** * \brief Draw a series of connected lines on the current rendering target. - * + * + * \param renderer The renderer which should draw multiple lines. * \param points The points along the lines * \param count The number of points, drawing count-1 lines - * + * * \return 0 on success, or -1 on error */ extern DECLSPEC int SDLCALL SDL_RenderDrawLines(SDL_Renderer * renderer, @@ -631,9 +675,10 @@ extern DECLSPEC int SDLCALL SDL_RenderDrawLines(SDL_Renderer * renderer, /** * \brief Draw a rectangle on the current rendering target. - * + * + * \param renderer The renderer which should draw a rectangle. * \param rect A pointer to the destination rectangle, or NULL to outline the entire rendering target. - * + * * \return 0 on success, or -1 on error */ extern DECLSPEC int SDLCALL SDL_RenderDrawRect(SDL_Renderer * renderer, @@ -641,10 +686,11 @@ extern DECLSPEC int SDLCALL SDL_RenderDrawRect(SDL_Renderer * renderer, /** * \brief Draw some number of rectangles on the current rendering target. - * + * + * \param renderer The renderer which should draw multiple rectangles. * \param rects A pointer to an array of destination rectangles. * \param count The number of rectangles. - * + * * \return 0 on success, or -1 on error */ extern DECLSPEC int SDLCALL SDL_RenderDrawRects(SDL_Renderer * renderer, @@ -653,10 +699,11 @@ extern DECLSPEC int SDLCALL SDL_RenderDrawRects(SDL_Renderer * renderer, /** * \brief Fill a rectangle on the current rendering target with the drawing color. - * - * \param rect A pointer to the destination rectangle, or NULL for the entire + * + * \param renderer The renderer which should fill a rectangle. + * \param rect A pointer to the destination rectangle, or NULL for the entire * rendering target. - * + * * \return 0 on success, or -1 on error */ extern DECLSPEC int SDLCALL SDL_RenderFillRect(SDL_Renderer * renderer, @@ -664,10 +711,11 @@ extern DECLSPEC int SDLCALL SDL_RenderFillRect(SDL_Renderer * renderer, /** * \brief Fill some number of rectangles on the current rendering target with the drawing color. - * + * + * \param renderer The renderer which should fill multiple rectangles. * \param rects A pointer to an array of destination rectangles. * \param count The number of rectangles. - * + * * \return 0 on success, or -1 on error */ extern DECLSPEC int SDLCALL SDL_RenderFillRects(SDL_Renderer * renderer, @@ -676,13 +724,14 @@ extern DECLSPEC int SDLCALL SDL_RenderFillRects(SDL_Renderer * renderer, /** * \brief Copy a portion of the texture to the current rendering target. - * + * + * \param renderer The renderer which should copy parts of a texture. * \param texture The source texture. - * \param srcrect A pointer to the source rectangle, or NULL for the entire + * \param srcrect A pointer to the source rectangle, or NULL for the entire * texture. - * \param dstrect A pointer to the destination rectangle, or NULL for the + * \param dstrect A pointer to the destination rectangle, or NULL for the * entire rendering target. - * + * * \return 0 on success, or -1 on error */ extern DECLSPEC int SDLCALL SDL_RenderCopy(SDL_Renderer * renderer, @@ -691,8 +740,9 @@ extern DECLSPEC int SDLCALL SDL_RenderCopy(SDL_Renderer * renderer, const SDL_Rect * dstrect); /** - * \brief Copy a portion of the source texture to the current rendering target, rotating it by angle around the given center + * \brief Copy a portion of the source texture to the current rendering target, rotating it by angle around the given center * + * \param renderer The renderer which should copy parts of a texture. * \param texture The source texture. * \param srcrect A pointer to the source rectangle, or NULL for the entire * texture. @@ -700,8 +750,8 @@ extern DECLSPEC int SDLCALL SDL_RenderCopy(SDL_Renderer * renderer, * entire rendering target. * \param angle An angle in degrees that indicates the rotation that will be applied to dstrect * \param center A pointer to a point indicating the point around which dstrect will be rotated (if NULL, rotation will be done aroud dstrect.w/2, dstrect.h/2) - * \param flip A SFL_Flip value stating which flipping actions should be performed on the texture - * + * \param flip An SDL_RendererFlip value stating which flipping actions should be performed on the texture + * * \return 0 on success, or -1 on error */ extern DECLSPEC int SDLCALL SDL_RenderCopyEx(SDL_Renderer * renderer, @@ -714,16 +764,17 @@ extern DECLSPEC int SDLCALL SDL_RenderCopyEx(SDL_Renderer * renderer, /** * \brief Read pixels from the current rendering target. - * - * \param rect A pointer to the rectangle to read, or NULL for the entire + * + * \param renderer The renderer from which pixels should be read. + * \param rect A pointer to the rectangle to read, or NULL for the entire * render target. * \param format The desired format of the pixel data, or 0 to use the format * of the rendering target * \param pixels A pointer to be filled in with the pixel data * \param pitch The pitch of the pixels parameter. - * + * * \return 0 on success, or -1 if pixel reading is not supported. - * + * * \warning This is a very slow operation, and should not be used frequently. */ extern DECLSPEC int SDLCALL SDL_RenderReadPixels(SDL_Renderer * renderer, @@ -738,7 +789,7 @@ extern DECLSPEC void SDLCALL SDL_RenderPresent(SDL_Renderer * renderer); /** * \brief Destroy the specified texture. - * + * * \sa SDL_CreateTexture() * \sa SDL_CreateTextureFromSurface() */ @@ -747,7 +798,7 @@ extern DECLSPEC void SDLCALL SDL_DestroyTexture(SDL_Texture * texture); /** * \brief Destroy the rendering context for a window and free associated * textures. - * + * * \sa SDL_CreateRenderer() */ extern DECLSPEC void SDLCALL SDL_DestroyRenderer(SDL_Renderer * renderer); @@ -777,9 +828,7 @@ extern DECLSPEC int SDLCALL SDL_GL_UnbindTexture(SDL_Texture *texture); /* Ends C function definitions when using C++ */ #ifdef __cplusplus -/* *INDENT-OFF* */ } -/* *INDENT-ON* */ #endif #include "close_code.h" diff --git a/src/eepp/helper/SDL2/include/SDL_revision.h b/src/eepp/helper/SDL2/include/SDL_revision.h index d70fd694e..4f10ddd9b 100644 --- a/src/eepp/helper/SDL2/include/SDL_revision.h +++ b/src/eepp/helper/SDL2/include/SDL_revision.h @@ -1,2 +1,2 @@ -#define SDL_REVISION "hg-0:aaaaaaaaaaah" -#define SDL_REVISION_NUMBER 0 +#define SDL_REVISION "hg-7236:81ebe816a6da" +#define SDL_REVISION_NUMBER 7236 diff --git a/src/eepp/helper/SDL2/include/SDL_rwops.h b/src/eepp/helper/SDL2/include/SDL_rwops.h index dbd2a0ce0..0461ff782 100644 --- a/src/eepp/helper/SDL2/include/SDL_rwops.h +++ b/src/eepp/helper/SDL2/include/SDL_rwops.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,7 +21,7 @@ /** * \file SDL_rwops.h - * + * * This file provides a general interface for SDL to read and write * data streams. It can easily be extended to files, memory, etc. */ @@ -35,11 +35,17 @@ #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus -/* *INDENT-OFF* */ extern "C" { -/* *INDENT-ON* */ #endif +/* RWops Types */ +#define SDL_RWOPS_UNKNOWN 0 /* Unknown stream type */ +#define SDL_RWOPS_WINFILE 1 /* Win32 file */ +#define SDL_RWOPS_STDFILE 2 /* Stdio file */ +#define SDL_RWOPS_JNIFILE 3 /* Android asset */ +#define SDL_RWOPS_MEMORY 4 /* Memory stream */ +#define SDL_RWOPS_MEMORY_RO 5 /* Read-Only memory stream */ + /** * This is the read/write operation structure -- very basic. */ @@ -53,8 +59,8 @@ typedef struct SDL_RWops /** * Seek to \c offset relative to \c whence, one of stdio's whence values: * RW_SEEK_SET, RW_SEEK_CUR, RW_SEEK_END - * - * \return the final offset in the data stream. + * + * \return the final offset in the data stream, or -1 on error. */ Sint64 (SDLCALL * seek) (struct SDL_RWops * context, Sint64 offset, int whence); @@ -62,7 +68,7 @@ typedef struct SDL_RWops /** * Read up to \c maxnum objects each of size \c size from the data * stream to the area pointed at by \c ptr. - * + * * \return the number of objects read, or 0 at error or end of file. */ size_t (SDLCALL * read) (struct SDL_RWops * context, void *ptr, @@ -71,7 +77,7 @@ typedef struct SDL_RWops /** * Write exactly \c num objects each of size \c size from the area * pointed at by \c ptr to data stream. - * + * * \return the number of objects written, or 0 at error or end of file. */ size_t (SDLCALL * write) (struct SDL_RWops * context, const void *ptr, @@ -79,7 +85,7 @@ typedef struct SDL_RWops /** * Close and free an allocated SDL_RWops structure. - * + * * \return 0 if successful or -1 on write error when flushing data. */ int (SDLCALL * close) (struct SDL_RWops * context); @@ -94,8 +100,11 @@ typedef struct SDL_RWops void *inputStreamRef; void *readableByteChannelRef; void *readMethod; + void *assetFileDescriptorRef; long position; - int size; + long size; + long offset; + int fd; } androidio; #elif defined(__WIN32__) struct @@ -127,6 +136,7 @@ typedef struct SDL_RWops struct { void *data1; + void *data2; } unknown; } hidden; @@ -135,7 +145,7 @@ typedef struct SDL_RWops /** * \name RWFrom functions - * + * * Functions to create SDL_RWops structures from various data streams. */ /*@{*/ @@ -161,28 +171,28 @@ extern DECLSPEC SDL_RWops *SDLCALL SDL_RWFromConstMem(const void *mem, extern DECLSPEC SDL_RWops *SDLCALL SDL_AllocRW(void); extern DECLSPEC void SDLCALL SDL_FreeRW(SDL_RWops * area); -#define RW_SEEK_SET 0 /**< Seek from the beginning of data */ -#define RW_SEEK_CUR 1 /**< Seek relative to current read point */ -#define RW_SEEK_END 2 /**< Seek relative to the end of data */ +#define RW_SEEK_SET 0 /**< Seek from the beginning of data */ +#define RW_SEEK_CUR 1 /**< Seek relative to current read point */ +#define RW_SEEK_END 2 /**< Seek relative to the end of data */ /** * \name Read/write macros - * + * * Macros to easily read and write from an SDL_RWops structure. */ /*@{*/ -#define SDL_RWsize(ctx) (ctx)->size(ctx) -#define SDL_RWseek(ctx, offset, whence) (ctx)->seek(ctx, offset, whence) -#define SDL_RWtell(ctx) (ctx)->seek(ctx, 0, RW_SEEK_CUR) -#define SDL_RWread(ctx, ptr, size, n) (ctx)->read(ctx, ptr, size, n) -#define SDL_RWwrite(ctx, ptr, size, n) (ctx)->write(ctx, ptr, size, n) -#define SDL_RWclose(ctx) (ctx)->close(ctx) +#define SDL_RWsize(ctx) (ctx)->size(ctx) +#define SDL_RWseek(ctx, offset, whence) (ctx)->seek(ctx, offset, whence) +#define SDL_RWtell(ctx) (ctx)->seek(ctx, 0, RW_SEEK_CUR) +#define SDL_RWread(ctx, ptr, size, n) (ctx)->read(ctx, ptr, size, n) +#define SDL_RWwrite(ctx, ptr, size, n) (ctx)->write(ctx, ptr, size, n) +#define SDL_RWclose(ctx) (ctx)->close(ctx) /*@}*//*Read/write macros*/ -/** +/** * \name Read endian functions - * + * * Read an item of the specified endianness and return in native format. */ /*@{*/ @@ -195,9 +205,9 @@ extern DECLSPEC Uint64 SDLCALL SDL_ReadLE64(SDL_RWops * src); extern DECLSPEC Uint64 SDLCALL SDL_ReadBE64(SDL_RWops * src); /*@}*//*Read endian functions*/ -/** +/** * \name Write endian functions - * + * * Write an item of native format to the specified endianness. */ /*@{*/ @@ -213,9 +223,7 @@ extern DECLSPEC size_t SDLCALL SDL_WriteBE64(SDL_RWops * dst, Uint64 value); /* Ends C function definitions when using C++ */ #ifdef __cplusplus -/* *INDENT-OFF* */ } -/* *INDENT-ON* */ #endif #include "close_code.h" diff --git a/src/eepp/helper/SDL2/include/SDL_scancode.h b/src/eepp/helper/SDL2/include/SDL_scancode.h index f4f69fa9d..d3f874811 100644 --- a/src/eepp/helper/SDL2/include/SDL_scancode.h +++ b/src/eepp/helper/SDL2/include/SDL_scancode.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,7 +21,7 @@ /** * \file SDL_scancode.h - * + * * Defines keyboard scancodes. */ @@ -32,21 +32,21 @@ /** * \brief The SDL keyboard scancode representation. - * + * * Values of this type are used to represent keyboard keys, among other places * in the \link SDL_Keysym::scancode key.keysym.scancode \endlink field of the * SDL_Event structure. - * + * * The values in this enumeration are based on the USB usage page standard: - * http://www.usb.org/developers/devclass_docs/Hut1_12.pdf + * http://www.usb.org/developers/devclass_docs/Hut1_12v2.pdf */ typedef enum { SDL_SCANCODE_UNKNOWN = 0, - /** + /** * \name Usage page 0x07 - * + * * These values are from usage page 0x07 (USB keyboard page). */ /*@{*/ @@ -99,49 +99,49 @@ typedef enum SDL_SCANCODE_EQUALS = 46, SDL_SCANCODE_LEFTBRACKET = 47, SDL_SCANCODE_RIGHTBRACKET = 48, - SDL_SCANCODE_BACKSLASH = 49, /**< Located at the lower left of the return - * key on ISO keyboards and at the right end - * of the QWERTY row on ANSI keyboards. - * Produces REVERSE SOLIDUS (backslash) and - * VERTICAL LINE in a US layout, REVERSE - * SOLIDUS and VERTICAL LINE in a UK Mac - * layout, NUMBER SIGN and TILDE in a UK + SDL_SCANCODE_BACKSLASH = 49, /**< Located at the lower left of the return + * key on ISO keyboards and at the right end + * of the QWERTY row on ANSI keyboards. + * Produces REVERSE SOLIDUS (backslash) and + * VERTICAL LINE in a US layout, REVERSE + * SOLIDUS and VERTICAL LINE in a UK Mac + * layout, NUMBER SIGN and TILDE in a UK * Windows layout, DOLLAR SIGN and POUND SIGN - * in a Swiss German layout, NUMBER SIGN and - * APOSTROPHE in a German layout, GRAVE - * ACCENT and POUND SIGN in a French Mac - * layout, and ASTERISK and MICRO SIGN in a + * in a Swiss German layout, NUMBER SIGN and + * APOSTROPHE in a German layout, GRAVE + * ACCENT and POUND SIGN in a French Mac + * layout, and ASTERISK and MICRO SIGN in a * French Windows layout. */ - SDL_SCANCODE_NONUSHASH = 50, /**< ISO USB keyboards actually use this code - * instead of 49 for the same key, but all - * OSes I've seen treat the two codes + SDL_SCANCODE_NONUSHASH = 50, /**< ISO USB keyboards actually use this code + * instead of 49 for the same key, but all + * OSes I've seen treat the two codes * identically. So, as an implementor, unless - * your keyboard generates both of those + * your keyboard generates both of those * codes and your OS treats them differently, * you should generate SDL_SCANCODE_BACKSLASH - * instead of this code. As a user, you - * should not rely on this code because SDL - * will never generate it with most (all?) - * keyboards. + * instead of this code. As a user, you + * should not rely on this code because SDL + * will never generate it with most (all?) + * keyboards. */ SDL_SCANCODE_SEMICOLON = 51, SDL_SCANCODE_APOSTROPHE = 52, - SDL_SCANCODE_GRAVE = 53, /**< Located in the top left corner (on both ANSI - * and ISO keyboards). Produces GRAVE ACCENT and - * TILDE in a US Windows layout and in US and UK - * Mac layouts on ANSI keyboards, GRAVE ACCENT - * and NOT SIGN in a UK Windows layout, SECTION - * SIGN and PLUS-MINUS SIGN in US and UK Mac - * layouts on ISO keyboards, SECTION SIGN and - * DEGREE SIGN in a Swiss German layout (Mac: - * only on ISO keyboards), CIRCUMFLEX ACCENT and - * DEGREE SIGN in a German layout (Mac: only on + SDL_SCANCODE_GRAVE = 53, /**< Located in the top left corner (on both ANSI + * and ISO keyboards). Produces GRAVE ACCENT and + * TILDE in a US Windows layout and in US and UK + * Mac layouts on ANSI keyboards, GRAVE ACCENT + * and NOT SIGN in a UK Windows layout, SECTION + * SIGN and PLUS-MINUS SIGN in US and UK Mac + * layouts on ISO keyboards, SECTION SIGN and + * DEGREE SIGN in a Swiss German layout (Mac: + * only on ISO keyboards), CIRCUMFLEX ACCENT and + * DEGREE SIGN in a German layout (Mac: only on * ISO keyboards), SUPERSCRIPT TWO and TILDE in a - * French Windows layout, COMMERCIAL AT and - * NUMBER SIGN in a French Mac layout on ISO + * French Windows layout, COMMERCIAL AT and + * NUMBER SIGN in a French Mac layout on ISO * keyboards, and LESS-THAN SIGN and GREATER-THAN - * SIGN in a Swiss German, German, or French Mac + * SIGN in a Swiss German, German, or French Mac * layout on ANSI keyboards. */ SDL_SCANCODE_COMMA = 54, @@ -178,7 +178,7 @@ typedef enum SDL_SCANCODE_DOWN = 81, SDL_SCANCODE_UP = 82, - SDL_SCANCODE_NUMLOCKCLEAR = 83, /**< num lock on PC, clear on Mac keyboards + SDL_SCANCODE_NUMLOCKCLEAR = 83, /**< num lock on PC, clear on Mac keyboards */ SDL_SCANCODE_KP_DIVIDE = 84, SDL_SCANCODE_KP_MULTIPLY = 85, @@ -197,19 +197,19 @@ typedef enum SDL_SCANCODE_KP_0 = 98, SDL_SCANCODE_KP_PERIOD = 99, - SDL_SCANCODE_NONUSBACKSLASH = 100, /**< This is the additional key that ISO - * keyboards have over ANSI ones, - * located between left shift and Y. + SDL_SCANCODE_NONUSBACKSLASH = 100, /**< This is the additional key that ISO + * keyboards have over ANSI ones, + * located between left shift and Y. * Produces GRAVE ACCENT and TILDE in a * US or UK Mac layout, REVERSE SOLIDUS - * (backslash) and VERTICAL LINE in a - * US or UK Windows layout, and + * (backslash) and VERTICAL LINE in a + * US or UK Windows layout, and * LESS-THAN SIGN and GREATER-THAN SIGN * in a Swiss German, German, or French * layout. */ SDL_SCANCODE_APPLICATION = 101, /**< windows contextual menu, compose */ - SDL_SCANCODE_POWER = 102, /**< The USB document says this is a status flag, - * not a physical key - but some Mac keyboards + SDL_SCANCODE_POWER = 102, /**< The USB document says this is a status flag, + * not a physical key - but some Mac keyboards * do have a power key. */ SDL_SCANCODE_KP_EQUALS = 103, SDL_SCANCODE_F13 = 104, @@ -245,7 +245,7 @@ typedef enum SDL_SCANCODE_KP_COMMA = 133, SDL_SCANCODE_KP_EQUALSAS400 = 134, - SDL_SCANCODE_INTERNATIONAL1 = 135, /**< used on Asian keyboards, see + SDL_SCANCODE_INTERNATIONAL1 = 135, /**< used on Asian keyboards, see footnotes in USB doc */ SDL_SCANCODE_INTERNATIONAL2 = 136, SDL_SCANCODE_INTERNATIONAL3 = 137, /**< Yen */ @@ -334,16 +334,16 @@ typedef enum SDL_SCANCODE_RALT = 230, /**< alt gr, option */ SDL_SCANCODE_RGUI = 231, /**< windows, command (apple), meta */ - SDL_SCANCODE_MODE = 257, /**< I'm not sure if this is really not covered - * by any of the above, but since there's a + SDL_SCANCODE_MODE = 257, /**< I'm not sure if this is really not covered + * by any of the above, but since there's a * special KMOD_MODE for it I'm adding it here */ - + /*@}*//*Usage page 0x07*/ /** * \name Usage page 0x0C - * + * * These values are mapped from usage page 0x0C (USB consumer page). */ /*@{*/ @@ -365,31 +365,34 @@ typedef enum SDL_SCANCODE_AC_STOP = 272, SDL_SCANCODE_AC_REFRESH = 273, SDL_SCANCODE_AC_BOOKMARKS = 274, - + /*@}*//*Usage page 0x0C*/ /** * \name Walther keys - * + * * These are values that Christian Walther added (for mac keyboard?). */ /*@{*/ SDL_SCANCODE_BRIGHTNESSDOWN = 275, SDL_SCANCODE_BRIGHTNESSUP = 276, - SDL_SCANCODE_DISPLAYSWITCH = 277, /**< display mirroring/dual display + SDL_SCANCODE_DISPLAYSWITCH = 277, /**< display mirroring/dual display switch, video mode switch */ SDL_SCANCODE_KBDILLUMTOGGLE = 278, SDL_SCANCODE_KBDILLUMDOWN = 279, SDL_SCANCODE_KBDILLUMUP = 280, SDL_SCANCODE_EJECT = 281, SDL_SCANCODE_SLEEP = 282, - + + SDL_SCANCODE_APP1 = 283, + SDL_SCANCODE_APP2 = 284, + /*@}*//*Walther keys*/ /* Add any other keys here. */ - SDL_NUM_SCANCODES = 512 /**< not a key, just marks the number of scancodes + SDL_NUM_SCANCODES = 512 /**< not a key, just marks the number of scancodes for array bounds */ } SDL_Scancode; diff --git a/src/eepp/helper/SDL2/include/SDL_shape.h b/src/eepp/helper/SDL2/include/SDL_shape.h index 1208818fd..8aee96c85 100644 --- a/src/eepp/helper/SDL2/include/SDL_shape.h +++ b/src/eepp/helper/SDL2/include/SDL_shape.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -31,9 +31,7 @@ #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus -/* *INDENT-OFF* */ extern "C" { -/* *INDENT-ON* */ #endif /** \file SDL_shape.h @@ -47,28 +45,28 @@ extern "C" { /** * \brief Create a window that can be shaped with the specified position, dimensions, and flags. - * + * * \param title The title of the window, in UTF-8 encoding. - * \param x The x position of the window, ::SDL_WINDOWPOS_CENTERED, or + * \param x The x position of the window, ::SDL_WINDOWPOS_CENTERED, or * ::SDL_WINDOWPOS_UNDEFINED. - * \param y The y position of the window, ::SDL_WINDOWPOS_CENTERED, or + * \param y The y position of the window, ::SDL_WINDOWPOS_CENTERED, or * ::SDL_WINDOWPOS_UNDEFINED. * \param w The width of the window. * \param h The height of the window. - * \param flags The flags for the window, a mask of SDL_WINDOW_BORDERLESS with any of the following: + * \param flags The flags for the window, a mask of SDL_WINDOW_BORDERLESS with any of the following: * ::SDL_WINDOW_OPENGL, ::SDL_WINDOW_INPUT_GRABBED, * ::SDL_WINDOW_SHOWN, ::SDL_WINDOW_RESIZABLE, * ::SDL_WINDOW_MAXIMIZED, ::SDL_WINDOW_MINIMIZED, - * ::SDL_WINDOW_BORDERLESS is always set, and ::SDL_WINDOW_FULLSCREEN is always unset. - * + * ::SDL_WINDOW_BORDERLESS is always set, and ::SDL_WINDOW_FULLSCREEN is always unset. + * * \return The window created, or NULL if window creation failed. - * + * * \sa SDL_DestroyWindow() */ extern DECLSPEC SDL_Window * SDLCALL SDL_CreateShapedWindow(const char *title,unsigned int x,unsigned int y,unsigned int w,unsigned int h,Uint32 flags); /** - * \brief Return whether the given window is a shaped window. + * \brief Return whether the given window is a shaped window. * * \param window The window to query for being shaped. * @@ -79,31 +77,31 @@ extern DECLSPEC SDL_bool SDLCALL SDL_IsShapedWindow(const SDL_Window *window); /** \brief An enum denoting the specific type of contents present in an SDL_WindowShapeParams union. */ typedef enum { - /** \brief The default mode, a binarized alpha cutoff of 1. */ - ShapeModeDefault, - /** \brief A binarized alpha cutoff with a given integer value. */ - ShapeModeBinarizeAlpha, - /** \brief A binarized alpha cutoff with a given integer value, but with the opposite comparison. */ - ShapeModeReverseBinarizeAlpha, - /** \brief A color key is applied. */ - ShapeModeColorKey + /** \brief The default mode, a binarized alpha cutoff of 1. */ + ShapeModeDefault, + /** \brief A binarized alpha cutoff with a given integer value. */ + ShapeModeBinarizeAlpha, + /** \brief A binarized alpha cutoff with a given integer value, but with the opposite comparison. */ + ShapeModeReverseBinarizeAlpha, + /** \brief A color key is applied. */ + ShapeModeColorKey } WindowShapeMode; #define SDL_SHAPEMODEALPHA(mode) (mode == ShapeModeDefault || mode == ShapeModeBinarizeAlpha || mode == ShapeModeReverseBinarizeAlpha) /** \brief A union containing parameters for shaped windows. */ typedef union { - /** \brief a cutoff alpha value for binarization of the window shape's alpha channel. */ - Uint8 binarizationCutoff; - SDL_Color colorKey; + /** \brief a cutoff alpha value for binarization of the window shape's alpha channel. */ + Uint8 binarizationCutoff; + SDL_Color colorKey; } SDL_WindowShapeParams; /** \brief A struct that tags the SDL_WindowShapeParams union with an enum describing the type of its contents. */ typedef struct SDL_WindowShapeMode { - /** \brief The mode of these window-shape parameters. */ - WindowShapeMode mode; - /** \brief Window-shape parameters. */ - SDL_WindowShapeParams parameters; + /** \brief The mode of these window-shape parameters. */ + WindowShapeMode mode; + /** \brief Window-shape parameters. */ + SDL_WindowShapeParams parameters; } SDL_WindowShapeMode; /** @@ -138,9 +136,7 @@ extern DECLSPEC int SDLCALL SDL_GetShapedWindowMode(SDL_Window *window,SDL_Windo /* Ends C function definitions when using C++ */ #ifdef __cplusplus -/* *INDENT-OFF* */ } -/* *INDENT-ON* */ #endif #include "close_code.h" diff --git a/src/eepp/helper/SDL2/include/SDL_stdinc.h b/src/eepp/helper/SDL2/include/SDL_stdinc.h index d2002ba2e..a53044517 100644 --- a/src/eepp/helper/SDL2/include/SDL_stdinc.h +++ b/src/eepp/helper/SDL2/include/SDL_stdinc.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,7 +21,7 @@ /** * \file SDL_stdinc.h - * + * * This is a general header that includes C language support. */ @@ -30,7 +30,6 @@ #include "SDL_config.h" - #ifdef HAVE_SYS_TYPES_H #include #endif @@ -81,12 +80,12 @@ /** * The number of elements in an array. */ -#define SDL_arraysize(array) (sizeof(array)/sizeof(array[0])) -#define SDL_TABLESIZE(table) SDL_arraysize(table) +#define SDL_arraysize(array) (sizeof(array)/sizeof(array[0])) +#define SDL_TABLESIZE(table) SDL_arraysize(table) /** * \name Cast operators - * + * * Use proper C++ casts when compiled as C++ to be compatible with the option * -Wold-style-cast of GCC (and -Werror=old-style-cast in GCC 4.2 and above). */ @@ -94,9 +93,11 @@ #ifdef __cplusplus #define SDL_reinterpret_cast(type, expression) reinterpret_cast(expression) #define SDL_static_cast(type, expression) static_cast(expression) +#define SDL_const_cast(type, expression) const_cast(expression) #else #define SDL_reinterpret_cast(type, expression) ((type)(expression)) #define SDL_static_cast(type, expression) ((type)(expression)) +#define SDL_const_cast(type, expression) ((type)(expression)) #endif /*@}*//*Cast operators*/ @@ -175,14 +176,10 @@ SDL_COMPILE_TIME_ASSERT(sint64, sizeof(Sint64) == 8); enums having the size of an int must be enabled. This is "-b" for Borland C/C++ and "-ei" for Watcom C/C++ (v11). */ -/* Enable enums always int in CodeWarrior (for MPW use "-enum int") */ -#ifdef __MWERKS__ -#pragma enumsalwaysint on -#endif /** \cond */ #ifndef DOXYGEN_SHOULD_IGNORE_THIS -#if !defined(__NINTENDODS__) && !defined(__ANDROID__) +#if !defined(__ANDROID__) /* TODO: include/SDL_stdinc.h:174: error: size of array 'SDL_dummy_enum' is negative */ typedef enum { @@ -197,33 +194,7 @@ SDL_COMPILE_TIME_ASSERT(enum, sizeof(SDL_DUMMY_ENUM) == sizeof(int)); #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus -/* *INDENT-OFF* */ extern "C" { -/* *INDENT-ON* */ -#endif - -#ifdef HAVE_MALLOC -#define SDL_malloc malloc -#else -extern DECLSPEC void *SDLCALL SDL_malloc(size_t size); -#endif - -#ifdef HAVE_CALLOC -#define SDL_calloc calloc -#else -extern DECLSPEC void *SDLCALL SDL_calloc(size_t nmemb, size_t size); -#endif - -#ifdef HAVE_REALLOC -#define SDL_realloc realloc -#else -extern DECLSPEC void *SDLCALL SDL_realloc(void *mem, size_t size); -#endif - -#ifdef HAVE_FREE -#define SDL_free free -#else -extern DECLSPEC void SDLCALL SDL_free(void *mem); #endif #if defined(HAVE_ALLOCA) && !defined(alloca) @@ -256,380 +227,436 @@ char *alloca(); #define SDL_stack_free(data) SDL_free(data) #endif -#ifdef HAVE_GETENV -#define SDL_getenv getenv -#else + +/* SDL stdinc inline functions: + + The theory here is that by default we forcibly inline what we can, and your + app will use the inline version by default. However we expose a non-inline + version too, so the symbol is always available in the library even if your app + bypassed the inline version. The SDL_*_inline versions aren't guaranteed to + exist, so never call them directly; use SDL_* instead, and trust the system + to give you the right thing. + + The benefit here is that you can dlsym() these functions, which you + couldn't if you had macros, you can link against a foreign build of SDL + even if you configured differently, and you can drop the unconfigured SDL + headers into a project without #defining HAVE_MALLOC (etc) and still link. +*/ + +extern DECLSPEC void *SDLCALL SDL_malloc(size_t size); +#ifdef HAVE_MALLOC +SDL_FORCE_INLINE void *SDL_malloc_inline(size_t size) { return malloc(size); } +#define SDL_malloc SDL_malloc_inline +#endif + +extern DECLSPEC void *SDLCALL SDL_calloc(size_t nmemb, size_t size); +#ifdef HAVE_CALLOC +SDL_FORCE_INLINE void *SDL_calloc_inline(size_t nmemb, size_t size) { return calloc(nmemb, size); } +#define SDL_calloc SDL_calloc_inline +#endif + +extern DECLSPEC void *SDLCALL SDL_realloc(void *mem, size_t size); +#ifdef HAVE_REALLOC +SDL_FORCE_INLINE void *SDL_realloc_inline(void *mem, size_t size) { return realloc(mem, size); } +#define SDL_realloc SDL_realloc_inline +#endif + +extern DECLSPEC void SDLCALL SDL_free(void *mem); +#ifdef HAVE_FREE +SDL_FORCE_INLINE void SDL_free_inline(void *mem) { free(mem); } +#define SDL_free SDL_free_inline +#endif + extern DECLSPEC char *SDLCALL SDL_getenv(const char *name); +#ifdef HAVE_GETENV +SDL_FORCE_INLINE char *SDL_getenv_inline(const char *name) { return getenv(name); } +#define SDL_getenv SDL_getenv_inline #endif -/* SDL_putenv() has moved to SDL_compat. */ +extern DECLSPEC int SDLCALL SDL_setenv(const char *name, const char *value, int overwrite); #ifdef HAVE_SETENV -#define SDL_setenv setenv -#else -extern DECLSPEC int SDLCALL SDL_setenv(const char *name, const char *value, - int overwrite); +SDL_FORCE_INLINE int SDL_setenv_inline(const char *name, const char *value, int overwrite) { return setenv(name, value, overwrite); } +#define SDL_setenv SDL_setenv_inline #endif +extern DECLSPEC void SDLCALL SDL_qsort(void *base, size_t nmemb, size_t size, int (*compare) (const void *, const void *)); #ifdef HAVE_QSORT -#define SDL_qsort qsort -#else -extern DECLSPEC void SDLCALL SDL_qsort(void *base, size_t nmemb, size_t size, - int (*compare) (const void *, - const void *)); +SDL_FORCE_INLINE void SDL_qsort_inline(void *base, size_t nmemb, size_t size, int (*compare) (const void *, const void *)) { qsort(base, nmemb, size, compare); } +#define SDL_qsort SDL_qsort_inline #endif +extern DECLSPEC int SDLCALL SDL_abs(int x); #ifdef HAVE_ABS -#define SDL_abs abs +SDL_FORCE_INLINE int SDL_abs_inline(int x) { return abs(x); } #else -#define SDL_abs(X) ((X) < 0 ? -(X) : (X)) +SDL_FORCE_INLINE int SDL_abs_inline(int x) { return ((x) < 0 ? -(x) : (x)); } #endif +#define SDL_abs SDL_abs_inline -#define SDL_min(x, y) (((x) < (y)) ? (x) : (y)) -#define SDL_max(x, y) (((x) > (y)) ? (x) : (y)) +/* !!! FIXME: these have side effects. You probably shouldn't use them. */ +/* !!! FIXME: Maybe we do forceinline functions of SDL_mini, SDL_minf, etc? */ +#define SDL_min(x, y) (((x) < (y)) ? (x) : (y)) +#define SDL_max(x, y) (((x) > (y)) ? (x) : (y)) +extern DECLSPEC int SDLCALL SDL_isdigit(int x); +extern DECLSPEC int SDLCALL SDL_isspace(int x); +extern DECLSPEC int SDLCALL SDL_toupper(int x); +extern DECLSPEC int SDLCALL SDL_tolower(int x); #ifdef HAVE_CTYPE_H -#define SDL_isdigit(X) isdigit(X) -#define SDL_isspace(X) isspace(X) -#define SDL_toupper(X) toupper(X) -#define SDL_tolower(X) tolower(X) +SDL_FORCE_INLINE int SDL_isdigit_inline(int x) { return isdigit(x); } +SDL_FORCE_INLINE int SDL_isspace_inline(int x) { return isspace(x); } +SDL_FORCE_INLINE int SDL_toupper_inline(int x) { return toupper(x); } +SDL_FORCE_INLINE int SDL_tolower_inline(int x) { return tolower(x); } #else -#define SDL_isdigit(X) (((X) >= '0') && ((X) <= '9')) -#define SDL_isspace(X) (((X) == ' ') || ((X) == '\t') || ((X) == '\r') || ((X) == '\n')) -#define SDL_toupper(X) (((X) >= 'a') && ((X) <= 'z') ? ('A'+((X)-'a')) : (X)) -#define SDL_tolower(X) (((X) >= 'A') && ((X) <= 'Z') ? ('a'+((X)-'A')) : (X)) +SDL_FORCE_INLINE int SDL_isdigit_inline(int x) { return ((x) >= '0') && ((x) <= '9'); } +SDL_FORCE_INLINE int SDL_isspace_inline(int x) { return ((x) == ' ') || ((x) == '\t') || ((x) == '\r') || ((x) == '\n'); } +SDL_FORCE_INLINE int SDL_toupper_inline(int x) { return ((x) >= 'a') && ((x) <= 'z') ? ('A'+((x)-'a')) : (x); } +SDL_FORCE_INLINE int SDL_tolower_inline(int x) { return ((x) >= 'A') && ((x) <= 'Z') ? ('a'+((x)-'A')) : (x); } #endif +#define SDL_isdigit SDL_isdigit_inline +#define SDL_isspace SDL_isspace_inline +#define SDL_toupper SDL_toupper_inline +#define SDL_tolower SDL_tolower_inline -#ifdef HAVE_MEMSET -#define SDL_memset memset -#else extern DECLSPEC void *SDLCALL SDL_memset(void *dst, int c, size_t len); +#ifdef HAVE_MEMSET +SDL_FORCE_INLINE void *SDL_memset_inline(void *dst, int c, size_t len) { return memset(dst, c, len); } +#define SDL_memset SDL_memset_inline #endif -#define SDL_zero(x) SDL_memset(&(x), 0, sizeof((x))) -#define SDL_zerop(x) SDL_memset((x), 0, sizeof(*(x))) +#define SDL_zero(x) SDL_memset(&(x), 0, sizeof((x))) +#define SDL_zerop(x) SDL_memset((x), 0, sizeof(*(x))) + +/* !!! FIXME: does this _really_ beat memset() on any modern platform? */ +SDL_FORCE_INLINE void SDL_memset4(void *dst, int val, size_t len) +{ #if defined(__GNUC__) && defined(i386) -#define SDL_memset4(dst, val, len) \ -do { \ - int u0, u1, u2; \ - __asm__ __volatile__ ( \ - "cld\n\t" \ - "rep ; stosl\n\t" \ - : "=&D" (u0), "=&a" (u1), "=&c" (u2) \ - : "0" (dst), "1" (val), "2" (SDL_static_cast(Uint32, len)) \ - : "memory" ); \ -} while(0) -#endif -#ifndef SDL_memset4 -#define SDL_memset4(dst, val, len) \ -do { \ - unsigned _count = (len); \ - unsigned _n = (_count + 3) / 4; \ - Uint32 *_p = SDL_static_cast(Uint32 *, dst); \ - Uint32 _val = (val); \ - if (len == 0) break; \ - switch (_count % 4) { \ - case 0: do { *_p++ = _val; \ - case 3: *_p++ = _val; \ - case 2: *_p++ = _val; \ - case 1: *_p++ = _val; \ - } while ( --_n ); \ - } \ -} while(0) + int u0, u1, u2; + __asm__ __volatile__ ( + "cld \n\t" + "rep ; stosl \n\t" + : "=&D" (u0), "=&a" (u1), "=&c" (u2) + : "0" (dst), "1" (val), "2" (SDL_static_cast(Uint32, len)) + : "memory" + ); +/* !!! FIXME: amd64? */ +#else + size_t _n = (len + 3) / 4; + Uint32 *_p = SDL_static_cast(Uint32 *, dst); + Uint32 _val = (val); + if (len == 0) + return; + switch (len % 4) + { + case 0: do { *_p++ = _val; + case 3: *_p++ = _val; + case 2: *_p++ = _val; + case 1: *_p++ = _val; + } while ( --_n ); + } #endif +} -/* We can count on memcpy existing on Mac OS X and being well-tuned. */ + +extern DECLSPEC void *SDLCALL SDL_memcpy(void *dst, const void *src, size_t len); #if defined(__MACOSX__) -#define SDL_memcpy memcpy +SDL_FORCE_INLINE void *SDL_memcpy_inline(void *dst, const void *src, size_t len) +{ + /* We can count on memcpy existing on Mac OS X and being well-tuned. */ + return memcpy(dst, src, len); +} +#define SDL_memcpy SDL_memcpy_inline #elif defined(__GNUC__) && defined(i386) && !defined(__WIN32__) -#define SDL_memcpy(dst, src, len) \ -do { \ - int u0, u1, u2; \ - __asm__ __volatile__ ( \ - "cld\n\t" \ - "rep ; movsl\n\t" \ - "testb $2,%b4\n\t" \ - "je 1f\n\t" \ - "movsw\n" \ - "1:\ttestb $1,%b4\n\t" \ - "je 2f\n\t" \ - "movsb\n" \ - "2:" \ - : "=&c" (u0), "=&D" (u1), "=&S" (u2) \ - : "0" (SDL_static_cast(unsigned, len)/4), "q" (len), "1" (dst),"2" (src) \ - : "memory" ); \ -} while(0) +SDL_FORCE_INLINE void *SDL_memcpy_inline(void *dst, const void *src, size_t len) +{ + /* !!! FIXME: does this _really_ beat memcpy() on any modern platform? */ + /* !!! FIXME: shouldn't we just force the inputs to ecx/edi/esi instead of this tapdance with outputs? */ + /* !!! FIXME: amd64? */ + int u0, u1, u2; + __asm__ __volatile__ ( + "cld \n\t" + "rep ; movsl \n\t" + "testb $2,%b4 \n\t" + "je 1f \n\t" + "movsw \n" + "1:\ttestb $1,%b4 \n\t" + "je 2f \n\t" + "movsb \n" + "2:" + : "=&c" (u0), "=&D" (u1), "=&S" (u2) + : "0" (SDL_static_cast(unsigned, len)/4), "q" (len), "1" (dst), "2" (src) + : "memory" + ); + return dst; +} +#define SDL_memcpy SDL_memcpy_inline +#elif defined(HAVE_MEMCPY) +SDL_FORCE_INLINE void *SDL_memcpy_inline(void *dst, const void *src, size_t len) +{ + return memcpy(dst, src, len); +} +#define SDL_memcpy SDL_memcpy_inline +#elif defined(HAVE_BCOPY) /* !!! FIXME: is there _really_ ever a time where you have bcopy and not memcpy? */ +SDL_FORCE_INLINE void *SDL_memcpy_inline(void *dst, const void *src, size_t len) +{ + bcopy(src, dst, len); + return dst; +} +#define SDL_memcpy SDL_memcpy_inline #endif -#ifndef SDL_memcpy -#ifdef HAVE_MEMCPY -#define SDL_memcpy memcpy -#elif defined(HAVE_BCOPY) -#define SDL_memcpy(d, s, n) bcopy((s), (d), (n)) + + +SDL_FORCE_INLINE void *SDL_memcpy4(void *dst, const void *src, size_t dwords) +{ +#if defined(__GNUC__) && defined(i386) + /* !!! FIXME: does this _really_ beat memcpy() on any modern platform? */ + /* !!! FIXME: shouldn't we just force the inputs to ecx/edi/esi instead of this tapdance with outputs? */ + int ecx, edi, esi; + __asm__ __volatile__ ( + "cld \n\t" + "rep ; movsl \n\t" + : "=&c" (ecx), "=&D" (edi), "=&S" (esi) + : "0" (SDL_static_cast(unsigned, dwords)), "1" (dst), "2" (src) + : "memory" + ); + return dst; #else -extern DECLSPEC void *SDLCALL SDL_memcpy(void *dst, const void *src, - size_t len); -#endif -#endif - -/* We can count on memcpy existing on Mac OS X and being well-tuned. */ -#if defined(__MACOSX__) -#define SDL_memcpy4(dst, src, len) SDL_memcpy((dst), (src), (len) << 2) -#elif defined(__GNUC__) && defined(i386) -#define SDL_memcpy4(dst, src, len) \ -do { \ - int ecx, edi, esi; \ - __asm__ __volatile__ ( \ - "cld\n\t" \ - "rep ; movsl" \ - : "=&c" (ecx), "=&D" (edi), "=&S" (esi) \ - : "0" (SDL_static_cast(unsigned, len)), "1" (dst), "2" (src) \ - : "memory" ); \ -} while(0) -#endif -#ifndef SDL_memcpy4 -#define SDL_memcpy4(dst, src, len) SDL_memcpy((dst), (src), (len) << 2) + return SDL_memcpy(dst, src, dwords * 4); #endif +} +extern DECLSPEC void *SDLCALL SDL_memmove(void *dst, const void *src, size_t len); #ifdef HAVE_MEMMOVE -#define SDL_memmove memmove -#else -extern DECLSPEC void *SDLCALL SDL_memmove(void *dst, const void *src, - size_t len); +SDL_FORCE_INLINE void *SDL_memmove_inline(void *dst, const void *src, size_t len) { return memmove(dst, src, len); } +#define SDL_memmove SDL_memmove_inline #endif +extern DECLSPEC int SDLCALL SDL_memcmp(const void *s1, const void *s2, size_t len); #ifdef HAVE_MEMCMP -#define SDL_memcmp memcmp -#else -extern DECLSPEC int SDLCALL SDL_memcmp(const void *s1, const void *s2, - size_t len); +SDL_FORCE_INLINE int SDL_memcmp_inline(const void *s1, const void *s2, size_t len) { return memcmp(s1, s2, len); } +#define SDL_memcmp SDL_memcmp_inline #endif +extern DECLSPEC size_t SDLCALL SDL_strlen(const char *str); #ifdef HAVE_STRLEN -#define SDL_strlen strlen -#else -extern DECLSPEC size_t SDLCALL SDL_strlen(const char *string); +SDL_FORCE_INLINE size_t SDL_strlen_inline(const char *str) { return strlen(str); } +#define SDL_strlen SDL_strlen_inline #endif +extern DECLSPEC size_t SDLCALL SDL_wcslen(const wchar_t *wstr); #ifdef HAVE_WCSLEN -#define SDL_wcslen wcslen -#else -#if !defined(wchar_t) && defined(__NINTENDODS__) -#define wchar_t short /* TODO: figure out why libnds doesn't have this */ -#endif -extern DECLSPEC size_t SDLCALL SDL_wcslen(const wchar_t * string); +SDL_FORCE_INLINE size_t SDL_wcslen_inline(const wchar_t *wstr) { return wcslen(wstr); } +#define SDL_wcslen SDL_wcslen_inline #endif -#ifdef HAVE_WCSLCPY -#define SDL_wcslcpy wcslcpy -#else extern DECLSPEC size_t SDLCALL SDL_wcslcpy(wchar_t *dst, const wchar_t *src, size_t maxlen); +#ifdef HAVE_WCSLCPY +SDL_FORCE_INLINE size_t SDL_wcslcpy_inline(wchar_t *dst, const wchar_t *src, size_t maxlen) { return wcslcpy(dst, src, maxlen); } +#define SDL_wcslcpy SDL_wcslcpy_inline #endif -#ifdef HAVE_WCSLCAT -#define SDL_wcslcat wcslcat -#else extern DECLSPEC size_t SDLCALL SDL_wcslcat(wchar_t *dst, const wchar_t *src, size_t maxlen); +#ifdef HAVE_WCSLCAT +SDL_FORCE_INLINE size_t SDL_wcslcat_inline(wchar_t *dst, const wchar_t *src, size_t maxlen) { return wcslcat(dst, src, maxlen); } +#define SDL_wcslcat SDL_wcslcat_inline #endif - +extern DECLSPEC size_t SDLCALL SDL_strlcpy(char *dst, const char *src, size_t maxlen); #ifdef HAVE_STRLCPY -#define SDL_strlcpy strlcpy +SDL_FORCE_INLINE size_t SDL_strlcpy_inline(char *dst, const char *src, size_t maxlen) { return strlcpy(dst, src, maxlen); } +#define SDL_strlcpy SDL_strlcpy_inline #else -extern DECLSPEC size_t SDLCALL SDL_strlcpy(char *dst, const char *src, - size_t maxlen); #endif -extern DECLSPEC size_t SDLCALL SDL_utf8strlcpy(char *dst, const char *src, - size_t dst_bytes); +extern DECLSPEC size_t SDLCALL SDL_utf8strlcpy(char *dst, const char *src, size_t dst_bytes); +extern DECLSPEC size_t SDLCALL SDL_strlcat(char *dst, const char *src, size_t maxlen); #ifdef HAVE_STRLCAT -#define SDL_strlcat strlcat -#else -extern DECLSPEC size_t SDLCALL SDL_strlcat(char *dst, const char *src, - size_t maxlen); +SDL_FORCE_INLINE size_t SDL_strlcat_inline(char *dst, const char *src, size_t maxlen) { return strlcat(dst, src, maxlen); } +#define SDL_strlcat SDL_strlcat_inline #endif +extern DECLSPEC char *SDLCALL SDL_strdup(const char *str); #ifdef HAVE_STRDUP -#define SDL_strdup strdup -#else -extern DECLSPEC char *SDLCALL SDL_strdup(const char *string); +SDL_FORCE_INLINE char *SDL_strdup_inline(const char *str) { return strdup(str); } +#define SDL_strdup SDL_strdup_inline #endif +extern DECLSPEC char *SDLCALL SDL_strrev(char *str); #ifdef HAVE__STRREV -#define SDL_strrev _strrev -#else -extern DECLSPEC char *SDLCALL SDL_strrev(char *string); +SDL_FORCE_INLINE char *SDL_strrev_inline(char *str) { return _strrev(str); } +#define SDL_strrev SDL_strrev_inline #endif +extern DECLSPEC char *SDLCALL SDL_strupr(char *str); #ifdef HAVE__STRUPR -#define SDL_strupr _strupr -#else -extern DECLSPEC char *SDLCALL SDL_strupr(char *string); +SDL_FORCE_INLINE char *SDL_strupr_inline(char *str) { return _strupr(str); } +#define SDL_strupr SDL_strupr_inline #endif +extern DECLSPEC char *SDLCALL SDL_strlwr(char *str); #ifdef HAVE__STRLWR -#define SDL_strlwr _strlwr -#else -extern DECLSPEC char *SDLCALL SDL_strlwr(char *string); +SDL_FORCE_INLINE char *SDL_strlwr_inline(char *str) { return _strlwr(str); } +#define SDL_strlwr SDL_strlwr_inline #endif +extern DECLSPEC char *SDLCALL SDL_strchr(const char *str, int c); #ifdef HAVE_STRCHR -#define SDL_strchr strchr -#elif defined(HAVE_INDEX) -#define SDL_strchr index -#else -extern DECLSPEC char *SDLCALL SDL_strchr(const char *string, int c); +SDL_FORCE_INLINE char *SDL_strchr_inline(const char *str, int c) { return SDL_const_cast(char*,strchr(str, c)); } +#define SDL_strchr SDL_strchr_inline +#elif defined(HAVE_INDEX) /* !!! FIXME: is there anywhere that has this but not strchr? */ +SDL_FORCE_INLINE char *SDL_strchr_inline(const char *str, int c) { return SDL_const_cast(char*,index(str, c)); } +#define SDL_strchr SDL_strchr_inline #endif +extern DECLSPEC char *SDLCALL SDL_strrchr(const char *str, int c); #ifdef HAVE_STRRCHR -#define SDL_strrchr strrchr -#elif defined(HAVE_RINDEX) -#define SDL_strrchr rindex -#else -extern DECLSPEC char *SDLCALL SDL_strrchr(const char *string, int c); +SDL_FORCE_INLINE char *SDL_strrchr_inline(const char *str, int c) { return SDL_const_cast(char*,strrchr(str, c)); } +#define SDL_strrchr SDL_strrchr_inline +#elif defined(HAVE_RINDEX) /* !!! FIXME: is there anywhere that has this but not strrchr? */ +SDL_FORCE_INLINE char *SDL_strrchr_inline(const char *str, int c) { return SDL_const_cast(char*,rindex(str, c)); } +#define SDL_strrchr SDL_strrchr_inline #endif +extern DECLSPEC char *SDLCALL SDL_strstr(const char *haystack, const char *needle); #ifdef HAVE_STRSTR -#define SDL_strstr strstr -#else -extern DECLSPEC char *SDLCALL SDL_strstr(const char *haystack, - const char *needle); -#endif - -#ifdef HAVE_ITOA -#define SDL_itoa itoa -#else -#define SDL_itoa(value, string, radix) SDL_ltoa((long)value, string, radix) +SDL_FORCE_INLINE char *SDL_strstr_inline(const char *haystack, const char *needle) { return SDL_const_cast(char*,strstr(haystack, needle)); } +#define SDL_strstr SDL_strstr_inline #endif +extern DECLSPEC char *SDLCALL SDL_ltoa(long value, char *str, int radix); #ifdef HAVE__LTOA -#define SDL_ltoa _ltoa -#else -extern DECLSPEC char *SDLCALL SDL_ltoa(long value, char *string, int radix); +SDL_FORCE_INLINE char *SDL_ltoa_inline(long value, char *str, int radix) { return _ltoa(value, str, radix); } +#define SDL_ltoa SDL_ltoa_inline #endif -#ifdef HAVE__UITOA -#define SDL_uitoa _uitoa +extern DECLSPEC char *SDLCALL SDL_itoa(int value, char *str, int radix); +#ifdef HAVE_ITOA +SDL_FORCE_INLINE char *SDL_itoa_inline(int value, char *str, int radix) { return itoa(value, str, radix); } #else -#define SDL_uitoa(value, string, radix) SDL_ultoa((long)value, string, radix) +SDL_FORCE_INLINE char *SDL_itoa_inline(int value, char *str, int radix) { return SDL_ltoa((long)value, str, radix); } #endif +#define SDL_itoa SDL_itoa_inline +extern DECLSPEC char *SDLCALL SDL_ultoa(unsigned long value, char *str, int radix); #ifdef HAVE__ULTOA -#define SDL_ultoa _ultoa -#else -extern DECLSPEC char *SDLCALL SDL_ultoa(unsigned long value, char *string, - int radix); +SDL_FORCE_INLINE char *SDL_ultoa_inline(unsigned long value, char *str, int radix) { return _ultoa(value, str, radix); } +#define SDL_ultoa SDL_ultoa_inline #endif +extern DECLSPEC char *SDLCALL SDL_uitoa(unsigned int value, char *str, int radix); +#ifdef HAVE__UITOA +SDL_FORCE_INLINE char *SDL_uitoa_inline(unsigned int value, char *str, int radix) { return _uitoa(value, str, radix); } +#else +SDL_FORCE_INLINE char *SDL_uitoa_inline(unsigned int value, char *str, int radix) { return SDL_ultoa((unsigned long)value, str, radix); } +#endif +#define SDL_uitoa SDL_uitoa_inline + + +extern DECLSPEC long SDLCALL SDL_strtol(const char *str, char **endp, int base); #ifdef HAVE_STRTOL -#define SDL_strtol strtol -#else -extern DECLSPEC long SDLCALL SDL_strtol(const char *string, char **endp, - int base); +SDL_FORCE_INLINE long SDL_strtol_inline(const char *str, char **endp, int base) { return strtol(str, endp, base); } +#define SDL_strtol SDL_strtol_inline #endif +extern DECLSPEC unsigned long SDLCALL SDL_strtoul(const char *str, char **endp, int base); #ifdef HAVE_STRTOUL -#define SDL_strtoul strtoul -#else -extern DECLSPEC unsigned long SDLCALL SDL_strtoul(const char *string, - char **endp, int base); +SDL_FORCE_INLINE unsigned long SDLCALL SDL_strtoul_inline(const char *str, char **endp, int base) { return strtoul(str, endp, base); } +#define SDL_strtoul SDL_strtoul_inline #endif +extern DECLSPEC char *SDLCALL SDL_lltoa(Sint64 value, char *str, int radix); #ifdef HAVE__I64TOA -#define SDL_lltoa _i64toa -#else -extern DECLSPEC char *SDLCALL SDL_lltoa(Sint64 value, char *string, - int radix); +SDL_FORCE_INLINE char *SDL_lltoa_inline(Sint64 value, char *str, int radix) { return _i64toa(value, str, radix); } +#define SDL_lltoa SDL_lltoa_inline #endif +extern DECLSPEC char *SDLCALL SDL_ulltoa(Uint64 value, char *str, int radix); #ifdef HAVE__UI64TOA -#define SDL_ulltoa _ui64toa -#else -extern DECLSPEC char *SDLCALL SDL_ulltoa(Uint64 value, char *string, - int radix); +SDL_FORCE_INLINE char *SDL_ulltoa_inline(Uint64 value, char *str, int radix) { return _ui64toa(value, str, radix); } +#define SDL_ulltoa SDL_ulltoa_inline #endif +extern DECLSPEC Sint64 SDLCALL SDL_strtoll(const char *str, char **endp, int base); #ifdef HAVE_STRTOLL -#define SDL_strtoll strtoll -#else -extern DECLSPEC Sint64 SDLCALL SDL_strtoll(const char *string, char **endp, - int base); +SDL_FORCE_INLINE Sint64 SDL_strtoll_inline(const char *str, char **endp, int base) { return strtoll(str, endp, base); } +#define SDL_strtoll SDL_strtoll_inline #endif +extern DECLSPEC Uint64 SDLCALL SDL_strtoull(const char *str, char **endp, int base); #ifdef HAVE_STRTOULL -#define SDL_strtoull strtoull -#else -extern DECLSPEC Uint64 SDLCALL SDL_strtoull(const char *string, char **endp, - int base); +SDL_FORCE_INLINE Uint64 SDL_strtoull_inline(const char *str, char **endp, int base) { return strtoull(str, endp, base); } +#define SDL_strtoull SDL_strtoull_inline #endif +extern DECLSPEC double SDLCALL SDL_strtod(const char *str, char **endp); #ifdef HAVE_STRTOD -#define SDL_strtod strtod -#else -extern DECLSPEC double SDLCALL SDL_strtod(const char *string, char **endp); +SDL_FORCE_INLINE double SDL_strtod_inline(const char *str, char **endp) { return strtod(str, endp); } +#define SDL_strtod SDL_strtod_inline #endif +extern DECLSPEC int SDLCALL SDL_atoi(const char *str); #ifdef HAVE_ATOI -#define SDL_atoi atoi +SDL_FORCE_INLINE int SDL_atoi_inline(const char *str) { return atoi(str); } #else -#define SDL_atoi(X) SDL_strtol(X, NULL, 0) +SDL_FORCE_INLINE int SDL_atoi_inline(const char *str) { return SDL_strtol(str, NULL, 0); } #endif +#define SDL_atoi SDL_atoi_inline +extern DECLSPEC double SDLCALL SDL_atof(const char *str); #ifdef HAVE_ATOF -#define SDL_atof atof +SDL_FORCE_INLINE double SDL_atof_inline(const char *str) { return (double) atof(str); } #else -#define SDL_atof(X) SDL_strtod(X, NULL) +SDL_FORCE_INLINE double SDL_atof_inline(const char *str) { return SDL_strtod(str, NULL); } #endif +#define SDL_atof SDL_atof_inline + -#ifdef HAVE_STRCMP -#define SDL_strcmp strcmp -#else extern DECLSPEC int SDLCALL SDL_strcmp(const char *str1, const char *str2); +#ifdef HAVE_STRCMP +SDL_FORCE_INLINE int SDL_strcmp_inline(const char *str1, const char *str2) { return strcmp(str1, str2); } +#define SDL_strcmp SDL_strcmp_inline #endif +extern DECLSPEC int SDLCALL SDL_strncmp(const char *str1, const char *str2, size_t maxlen); #ifdef HAVE_STRNCMP -#define SDL_strncmp strncmp -#else -extern DECLSPEC int SDLCALL SDL_strncmp(const char *str1, const char *str2, - size_t maxlen); +SDL_FORCE_INLINE int SDL_strncmp_inline(const char *str1, const char *str2, size_t maxlen) { return strncmp(str1, str2, maxlen); } +#define SDL_strncmp SDL_strncmp_inline #endif +extern DECLSPEC int SDLCALL SDL_strcasecmp(const char *str1, const char *str2); #ifdef HAVE_STRCASECMP -#define SDL_strcasecmp strcasecmp +SDL_FORCE_INLINE int SDL_strcasecmp_inline(const char *str1, const char *str2) { return strcasecmp(str1, str2); } +#define SDL_strcasecmp SDL_strcasecmp_inline #elif defined(HAVE__STRICMP) -#define SDL_strcasecmp _stricmp -#else -extern DECLSPEC int SDLCALL SDL_strcasecmp(const char *str1, - const char *str2); +SDL_FORCE_INLINE int SDL_strcasecmp_inline(const char *str1, const char *str2) { return _stricmp(str1, str2); } +#define SDL_strcasecmp SDL_strcasecmp_inline #endif +extern DECLSPEC int SDLCALL SDL_strncasecmp(const char *str1, const char *str2, size_t len); #ifdef HAVE_STRNCASECMP -#define SDL_strncasecmp strncasecmp +SDL_FORCE_INLINE int SDL_strncasecmp_inline(const char *str1, const char *str2, size_t len) { return strncasecmp(str1, str2, len); } +#define SDL_strncasecmp SDL_strncasecmp_inline #elif defined(HAVE__STRNICMP) -#define SDL_strncasecmp _strnicmp -#else -extern DECLSPEC int SDLCALL SDL_strncasecmp(const char *str1, - const char *str2, size_t maxlen); +SDL_FORCE_INLINE int SDL_strncasecmp_inline(const char *str1, const char *str2, size_t len) { return _strnicmp(str1, str2, len); } +#define SDL_strncasecmp SDL_strncasecmp_inline #endif +/* Not doing SDL_*_inline functions for these, because of the varargs. */ +extern DECLSPEC int SDLCALL SDL_sscanf(const char *text, const char *fmt, ...); #ifdef HAVE_SSCANF -#define SDL_sscanf sscanf -#else -extern DECLSPEC int SDLCALL SDL_sscanf(const char *text, const char *fmt, - ...); +#define SDL_sscanf sscanf #endif +extern DECLSPEC int SDLCALL SDL_snprintf(char *text, size_t maxlen, const char *fmt, ...); #ifdef HAVE_SNPRINTF -#define SDL_snprintf snprintf -#else -extern DECLSPEC int SDLCALL SDL_snprintf(char *text, size_t maxlen, - const char *fmt, ...); +#define SDL_snprintf snprintf #endif +extern DECLSPEC int SDLCALL SDL_vsnprintf(char *text, size_t maxlen, const char *fmt, va_list ap); #ifdef HAVE_VSNPRINTF -#define SDL_vsnprintf vsnprintf -#else -extern DECLSPEC int SDLCALL SDL_vsnprintf(char *text, size_t maxlen, - const char *fmt, va_list ap); +SDL_FORCE_INLINE int SDL_vsnprintf_inline(char *text, size_t maxlen, const char *fmt, va_list ap) { return vsnprintf(text, maxlen, fmt, ap); } +#define SDL_vsnprintf SDL_vsnprintf_inline #endif #ifndef HAVE_M_PI @@ -638,106 +665,107 @@ extern DECLSPEC int SDLCALL SDL_vsnprintf(char *text, size_t maxlen, #endif #endif -#ifdef HAVE_ATAN -#define SDL_atan atan -#else extern DECLSPEC double SDLCALL SDL_atan(double x); +#ifdef HAVE_ATAN +SDL_FORCE_INLINE double SDL_atan_inline(double x) { return atan(x); } +#define SDL_atan SDL_atan_inline #endif +extern DECLSPEC double SDLCALL SDL_atan2(double x, double y); #ifdef HAVE_ATAN2 -#define SDL_atan2 atan2 -#else -extern DECLSPEC double SDLCALL SDL_atan2(double y, double x); +SDL_FORCE_INLINE double SDL_atan2_inline(double x, double y) { return atan2(x, y); } +#define SDL_atan2 SDL_atan2_inline #endif +extern DECLSPEC double SDLCALL SDL_ceil(double x); #ifdef HAVE_CEIL -#define SDL_ceil ceil +SDL_FORCE_INLINE double SDL_ceil_inline(double x) { return ceil(x); } #else -#define SDL_ceil(x) ((double)(int)((x)+0.5)) +SDL_FORCE_INLINE double SDL_ceil_inline(double x) { return (double)(int)((x)+0.5); } #endif +#define SDL_ceil SDL_ceil_inline -#ifdef HAVE_COPYSIGN -#define SDL_copysign copysign -#else extern DECLSPEC double SDLCALL SDL_copysign(double x, double y); +#ifdef HAVE_COPYSIGN +SDL_FORCE_INLINE double SDL_copysign_inline(double x, double y) { return copysign(x, y); } +#define SDL_copysign SDL_copysign_inline #endif -#ifdef HAVE_COS -#define SDL_cos cos -#else extern DECLSPEC double SDLCALL SDL_cos(double x); +#ifdef HAVE_COS +SDL_FORCE_INLINE double SDL_cos_inline(double x) { return cos(x); } +#define SDL_cos SDL_cos_inline #endif +extern DECLSPEC float SDLCALL SDL_cosf(float x); #ifdef HAVE_COSF -#define SDL_cosf cosf +SDL_FORCE_INLINE float SDL_cosf_inline(float x) { return cosf(x); } #else -#define SDL_cosf(x) (float)SDL_cos((double)x) +SDL_FORCE_INLINE float SDL_cosf_inline(float x) { return (float)SDL_cos((double)x); } #endif +#define SDL_cosf SDL_cosf_inline -#ifdef HAVE_FABS -#define SDL_fabs fabs -#else extern DECLSPEC double SDLCALL SDL_fabs(double x); +#ifdef HAVE_FABS +SDL_FORCE_INLINE double SDL_fabs_inline(double x) { return fabs(x); } +#define SDL_fabs SDL_fabs_inline #endif -#ifdef HAVE_FLOOR -#define SDL_floor floor -#else extern DECLSPEC double SDLCALL SDL_floor(double x); +#ifdef HAVE_FLOOR +SDL_FORCE_INLINE double SDL_floor_inline(double x) { return floor(x); } +#define SDL_floor SDL_floor_inline #endif -#ifdef HAVE_LOG -#define SDL_log log -#else extern DECLSPEC double SDLCALL SDL_log(double x); +#ifdef HAVE_LOG +SDL_FORCE_INLINE double SDL_log_inline(double x) { return log(x); } +#define SDL_log SDL_log_inline #endif -#ifdef HAVE_POW -#define SDL_pow pow -#else extern DECLSPEC double SDLCALL SDL_pow(double x, double y); +#ifdef HAVE_POW +SDL_FORCE_INLINE double SDL_pow_inline(double x, double y) { return pow(x, y); } +#define SDL_pow SDL_pow_inline #endif -#ifdef HAVE_SCALBN -#define SDL_scalbn scalbn -#else extern DECLSPEC double SDLCALL SDL_scalbn(double x, int n); +#ifdef HAVE_SCALBN +SDL_FORCE_INLINE double SDL_scalbn_inline(double x, int n) { return scalbn(x, n); } +#define SDL_scalbn SDL_scalbn_inline #endif -#ifdef HAVE_SIN -#define SDL_sin sin -#else extern DECLSPEC double SDLCALL SDL_sin(double x); +#ifdef HAVE_SIN +SDL_FORCE_INLINE double SDL_sin_inline(double x) { return sin(x); } +#define SDL_sin SDL_sin_inline #endif +extern DECLSPEC float SDLCALL SDL_sinf(float x); #ifdef HAVE_SINF -#define SDL_sinf sinf +SDL_FORCE_INLINE float SDL_sinf_inline(float x) { return sinf(x); } #else -#define SDL_sinf(x) (float)SDL_sin((double)x) +SDL_FORCE_INLINE float SDL_sinf_inline(float x) { return (float)SDL_sin((double)x); } #endif +#define SDL_sinf SDL_sinf_inline -#ifdef HAVE_SQRT -#define SDL_sqrt sqrt -#else extern DECLSPEC double SDLCALL SDL_sqrt(double x); +#ifdef HAVE_SQRT +SDL_FORCE_INLINE double SDL_sqrt_inline(double x) { return sqrt(x); } +#define SDL_sqrt SDL_sqrt_inline #endif /* The SDL implementation of iconv() returns these error codes */ -#define SDL_ICONV_ERROR (size_t)-1 -#define SDL_ICONV_E2BIG (size_t)-2 -#define SDL_ICONV_EILSEQ (size_t)-3 -#define SDL_ICONV_EINVAL (size_t)-4 +#define SDL_ICONV_ERROR (size_t)-1 +#define SDL_ICONV_E2BIG (size_t)-2 +#define SDL_ICONV_EILSEQ (size_t)-3 +#define SDL_ICONV_EINVAL (size_t)-4 -#if defined(HAVE_ICONV) && defined(HAVE_ICONV_H) -#define SDL_iconv_t iconv_t -#define SDL_iconv_open iconv_open -#define SDL_iconv_close iconv_close -#else +/* SDL_iconv_* are now always real symbols/types, not macros or inlined. */ typedef struct _SDL_iconv_t *SDL_iconv_t; extern DECLSPEC SDL_iconv_t SDLCALL SDL_iconv_open(const char *tocode, const char *fromcode); extern DECLSPEC int SDLCALL SDL_iconv_close(SDL_iconv_t cd); -#endif extern DECLSPEC size_t SDLCALL SDL_iconv(SDL_iconv_t cd, const char **inbuf, size_t * inbytesleft, char **outbuf, size_t * outbytesleft); @@ -749,15 +777,13 @@ extern DECLSPEC char *SDLCALL SDL_iconv_string(const char *tocode, const char *fromcode, const char *inbuf, size_t inbytesleft); -#define SDL_iconv_utf8_locale(S) SDL_iconv_string("", "UTF-8", S, SDL_strlen(S)+1) -#define SDL_iconv_utf8_ucs2(S) (Uint16 *)SDL_iconv_string("UCS-2-INTERNAL", "UTF-8", S, SDL_strlen(S)+1) -#define SDL_iconv_utf8_ucs4(S) (Uint32 *)SDL_iconv_string("UCS-4-INTERNAL", "UTF-8", S, SDL_strlen(S)+1) +#define SDL_iconv_utf8_locale(S) SDL_iconv_string("", "UTF-8", S, SDL_strlen(S)+1) +#define SDL_iconv_utf8_ucs2(S) (Uint16 *)SDL_iconv_string("UCS-2-INTERNAL", "UTF-8", S, SDL_strlen(S)+1) +#define SDL_iconv_utf8_ucs4(S) (Uint32 *)SDL_iconv_string("UCS-4-INTERNAL", "UTF-8", S, SDL_strlen(S)+1) /* Ends C function definitions when using C++ */ #ifdef __cplusplus -/* *INDENT-OFF* */ } -/* *INDENT-ON* */ #endif #include "close_code.h" diff --git a/src/eepp/helper/SDL2/include/SDL_surface.h b/src/eepp/helper/SDL2/include/SDL_surface.h index 656335423..4ebeadd8f 100644 --- a/src/eepp/helper/SDL2/include/SDL_surface.h +++ b/src/eepp/helper/SDL2/include/SDL_surface.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,7 +21,7 @@ /** * \file SDL_surface.h - * + * * Header file for ::SDL_surface definition and management functions. */ @@ -37,16 +37,14 @@ #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus -/* *INDENT-OFF* */ extern "C" { -/* *INDENT-ON* */ #endif /** * \name Surface flags - * + * * These are the currently supported flags for the ::SDL_surface. - * + * * \internal * Used internally (read-only). */ @@ -60,7 +58,7 @@ extern "C" { /** * Evaluates to true if the surface needs to be locked before access. */ -#define SDL_MUSTLOCK(S) (((S)->flags & SDL_RLEACCEL) != 0) +#define SDL_MUSTLOCK(S) (((S)->flags & SDL_RLEACCEL) != 0) /** * \brief A collection of pixels used in software blitting. @@ -101,14 +99,21 @@ typedef int (*SDL_blit) (struct SDL_Surface * src, SDL_Rect * srcrect, /** * Allocate and free an RGB surface. - * + * * If the depth is 4 or 8 bits, an empty palette is allocated for the surface. * If the depth is greater than 8 bits, the pixel format is set using the * flags '[RGB]mask'. - * + * * If the function runs out of memory, it will return NULL. - * + * * \param flags The \c flags are obsolete and should be set to 0. + * \param width The width in pixels of the surface to create. + * \param height The height in pixels of the surface to create. + * \param depth The depth in bits of the surface to create. + * \param Rmask The red mask of the surface to create. + * \param Gmask The green mask of the surface to create. + * \param Bmask The blue mask of the surface to create. + * \param Amask The alpha mask of the surface to create. */ extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurface (Uint32 flags, int width, int height, int depth, @@ -126,9 +131,9 @@ extern DECLSPEC void SDLCALL SDL_FreeSurface(SDL_Surface * surface); /** * \brief Set the palette used by a surface. - * + * * \return 0, or -1 if the surface format doesn't use a palette. - * + * * \note A single palette can be shared with many surfaces. */ extern DECLSPEC int SDLCALL SDL_SetSurfacePalette(SDL_Surface * surface, @@ -136,21 +141,21 @@ extern DECLSPEC int SDLCALL SDL_SetSurfacePalette(SDL_Surface * surface, /** * \brief Sets up a surface for directly accessing the pixels. - * + * * Between calls to SDL_LockSurface() / SDL_UnlockSurface(), you can write - * to and read from \c surface->pixels, using the pixel format stored in - * \c surface->format. Once you are done accessing the surface, you should + * to and read from \c surface->pixels, using the pixel format stored in + * \c surface->format. Once you are done accessing the surface, you should * use SDL_UnlockSurface() to release it. - * + * * Not all surfaces require locking. If SDL_MUSTLOCK(surface) evaluates * to 0, then you can read and write to the surface at any time, and the * pixel format of the surface will not change. - * + * * No operating system or library calls should be made between lock/unlock * pairs, as critical system locks may be held during this time. - * + * * SDL_LockSurface() returns 0, or -1 if the surface couldn't be locked. - * + * * \sa SDL_UnlockSurface() */ extern DECLSPEC int SDLCALL SDL_LockSurface(SDL_Surface * surface); @@ -159,11 +164,11 @@ extern DECLSPEC void SDLCALL SDL_UnlockSurface(SDL_Surface * surface); /** * Load a surface from a seekable SDL data stream (memory or file). - * + * * If \c freesrc is non-zero, the stream will be closed after being read. - * + * * The new surface should be freed with SDL_FreeSurface(). - * + * * \return the new surface, or NULL if there was an error. */ extern DECLSPEC SDL_Surface *SDLCALL SDL_LoadBMP_RW(SDL_RWops * src, @@ -171,34 +176,34 @@ extern DECLSPEC SDL_Surface *SDLCALL SDL_LoadBMP_RW(SDL_RWops * src, /** * Load a surface from a file. - * + * * Convenience macro. */ -#define SDL_LoadBMP(file) SDL_LoadBMP_RW(SDL_RWFromFile(file, "rb"), 1) +#define SDL_LoadBMP(file) SDL_LoadBMP_RW(SDL_RWFromFile(file, "rb"), 1) /** * Save a surface to a seekable SDL data stream (memory or file). - * + * * If \c freedst is non-zero, the stream will be closed after being written. - * + * * \return 0 if successful or -1 if there was an error. */ extern DECLSPEC int SDLCALL SDL_SaveBMP_RW (SDL_Surface * surface, SDL_RWops * dst, int freedst); -/** +/** * Save a surface to a file. - * + * * Convenience macro. */ #define SDL_SaveBMP(surface, file) \ - SDL_SaveBMP_RW(surface, SDL_RWFromFile(file, "wb"), 1) + SDL_SaveBMP_RW(surface, SDL_RWFromFile(file, "wb"), 1) /** * \brief Sets the RLE acceleration hint for a surface. - * + * * \return 0 on success, or -1 if the surface is not valid - * + * * \note If RLE is enabled, colorkey and alpha blending blits are much faster, * but the surface must be locked before directly accessing the pixels. */ @@ -207,11 +212,11 @@ extern DECLSPEC int SDLCALL SDL_SetSurfaceRLE(SDL_Surface * surface, /** * \brief Sets the color key (transparent pixel) in a blittable surface. - * + * * \param surface The surface to update * \param flag Non-zero to enable colorkey and 0 to disable colorkey * \param key The transparent pixel in the native surface format - * + * * \return 0 on success, or -1 if the surface is not valid * * You can pass SDL_RLEACCEL to enable RLE accelerated blits. @@ -221,12 +226,12 @@ extern DECLSPEC int SDLCALL SDL_SetColorKey(SDL_Surface * surface, /** * \brief Gets the color key (transparent pixel) in a blittable surface. - * + * * \param surface The surface to update - * \param key A pointer filled in with the transparent pixel in the native + * \param key A pointer filled in with the transparent pixel in the native * surface format - * - * \return 0 on success, or -1 if the surface is not valid or colorkey is not + * + * \return 0 on success, or -1 if the surface is not valid or colorkey is not * enabled. */ extern DECLSPEC int SDLCALL SDL_GetColorKey(SDL_Surface * surface, @@ -234,14 +239,14 @@ extern DECLSPEC int SDLCALL SDL_GetColorKey(SDL_Surface * surface, /** * \brief Set an additional color value used in blit operations. - * + * * \param surface The surface to update. * \param r The red color value multiplied into blit operations. * \param g The green color value multiplied into blit operations. * \param b The blue color value multiplied into blit operations. - * + * * \return 0 on success, or -1 if the surface is not valid. - * + * * \sa SDL_GetSurfaceColorMod() */ extern DECLSPEC int SDLCALL SDL_SetSurfaceColorMod(SDL_Surface * surface, @@ -250,14 +255,14 @@ extern DECLSPEC int SDLCALL SDL_SetSurfaceColorMod(SDL_Surface * surface, /** * \brief Get the additional color value used in blit operations. - * + * * \param surface The surface to query. * \param r A pointer filled in with the current red color value. * \param g A pointer filled in with the current green color value. * \param b A pointer filled in with the current blue color value. - * + * * \return 0 on success, or -1 if the surface is not valid. - * + * * \sa SDL_SetSurfaceColorMod() */ extern DECLSPEC int SDLCALL SDL_GetSurfaceColorMod(SDL_Surface * surface, @@ -266,12 +271,12 @@ extern DECLSPEC int SDLCALL SDL_GetSurfaceColorMod(SDL_Surface * surface, /** * \brief Set an additional alpha value used in blit operations. - * + * * \param surface The surface to update. * \param alpha The alpha value multiplied into blit operations. - * + * * \return 0 on success, or -1 if the surface is not valid. - * + * * \sa SDL_GetSurfaceAlphaMod() */ extern DECLSPEC int SDLCALL SDL_SetSurfaceAlphaMod(SDL_Surface * surface, @@ -279,12 +284,12 @@ extern DECLSPEC int SDLCALL SDL_SetSurfaceAlphaMod(SDL_Surface * surface, /** * \brief Get the additional alpha value used in blit operations. - * + * * \param surface The surface to query. * \param alpha A pointer filled in with the current alpha value. - * + * * \return 0 on success, or -1 if the surface is not valid. - * + * * \sa SDL_SetSurfaceAlphaMod() */ extern DECLSPEC int SDLCALL SDL_GetSurfaceAlphaMod(SDL_Surface * surface, @@ -292,12 +297,12 @@ extern DECLSPEC int SDLCALL SDL_GetSurfaceAlphaMod(SDL_Surface * surface, /** * \brief Set the blend mode used for blit operations. - * + * * \param surface The surface to update. * \param blendMode ::SDL_BlendMode to use for blit blending. - * + * * \return 0 on success, or -1 if the parameters are not valid. - * + * * \sa SDL_GetSurfaceBlendMode() */ extern DECLSPEC int SDLCALL SDL_SetSurfaceBlendMode(SDL_Surface * surface, @@ -305,12 +310,12 @@ extern DECLSPEC int SDLCALL SDL_SetSurfaceBlendMode(SDL_Surface * surface, /** * \brief Get the blend mode used for blit operations. - * + * * \param surface The surface to query. * \param blendMode A pointer filled in with the current blend mode. - * + * * \return 0 on success, or -1 if the surface is not valid. - * + * * \sa SDL_SetSurfaceBlendMode() */ extern DECLSPEC int SDLCALL SDL_GetSurfaceBlendMode(SDL_Surface * surface, @@ -318,14 +323,14 @@ extern DECLSPEC int SDLCALL SDL_GetSurfaceBlendMode(SDL_Surface * surface, /** * Sets the clipping rectangle for the destination surface in a blit. - * + * * If the clip rectangle is NULL, clipping will be disabled. - * + * * If the clip rectangle doesn't intersect the surface, the function will * return SDL_FALSE and blits will be completely clipped. Otherwise the * function returns SDL_TRUE and blits to the surface will be clipped to * the intersection of the surface area and the clipping rectangle. - * + * * Note that blits are automatically clipped to the edges of the source * and destination surfaces. */ @@ -334,7 +339,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_SetClipRect(SDL_Surface * surface, /** * Gets the clipping rectangle for the destination surface in a blit. - * + * * \c rect must be a pointer to a valid rectangle which will be filled * with the correct values. */ @@ -342,11 +347,11 @@ extern DECLSPEC void SDLCALL SDL_GetClipRect(SDL_Surface * surface, SDL_Rect * rect); /** - * Creates a new surface of the specified format, and then copies and maps - * the given surface to it so the blit of the converted surface will be as + * Creates a new surface of the specified format, and then copies and maps + * the given surface to it so the blit of the converted surface will be as * fast as possible. If this function fails, it returns NULL. - * - * The \c flags parameter is passed to SDL_CreateRGBSurface() and has those + * + * The \c flags parameter is passed to SDL_CreateRGBSurface() and has those * semantics. You can also pass ::SDL_RLEACCEL in the flags parameter and * SDL will try to RLE accelerate colorkey and alpha blits in the resulting * surface. @@ -358,7 +363,7 @@ extern DECLSPEC SDL_Surface *SDLCALL SDL_ConvertSurfaceFormat /** * \brief Copy a block of pixels of one format to another format - * + * * \return 0 on success, or -1 if there was an error */ extern DECLSPEC int SDLCALL SDL_ConvertPixels(int width, int height, @@ -369,12 +374,12 @@ extern DECLSPEC int SDLCALL SDL_ConvertPixels(int width, int height, /** * Performs a fast fill of the given rectangle with \c color. - * + * * If \c rect is NULL, the whole surface will be filled with \c color. - * - * The color should be a pixel of the format used by the surface, and + * + * The color should be a pixel of the format used by the surface, and * can be generated by the SDL_MapRGB() function. - * + * * \return 0 on success, or -1 on error. */ extern DECLSPEC int SDLCALL SDL_FillRect @@ -384,12 +389,12 @@ extern DECLSPEC int SDLCALL SDL_FillRects /** * Performs a fast blit from the source surface to the destination surface. - * + * * This assumes that the source and destination rectangles are * the same size. If either \c srcrect or \c dstrect are NULL, the entire * surface (\c src or \c dst) is copied. The final blit rectangles are saved * in \c srcrect and \c dstrect after all clipping is performed. - * + * * \return If the blit is successful, it returns 0, otherwise it returns -1. * * The blit function should not be called on a locked surface. @@ -404,9 +409,9 @@ extern DECLSPEC int SDLCALL SDL_FillRects SDL_SRCALPHA not set: copy RGB. if SDL_SRCCOLORKEY set, only copy the pixels matching the - RGB values of the source colour key, ignoring alpha in the + RGB values of the source color key, ignoring alpha in the comparison. - + RGB->RGBA: SDL_SRCALPHA set: alpha-blend (using the source per-surface alpha value); @@ -415,8 +420,8 @@ extern DECLSPEC int SDLCALL SDL_FillRects copy RGB, set destination alpha to source per-surface alpha value. both: if SDL_SRCCOLORKEY set, only copy the pixels matching the - source colour key. - + source color key. + RGBA->RGBA: SDL_SRCALPHA set: alpha-blend (using the source alpha channel) the RGB values; @@ -425,19 +430,19 @@ extern DECLSPEC int SDLCALL SDL_FillRects SDL_SRCALPHA not set: copy all of RGBA to the destination. if SDL_SRCCOLORKEY set, only copy the pixels matching the - RGB values of the source colour key, ignoring alpha in the + RGB values of the source color key, ignoring alpha in the comparison. - - RGB->RGB: + + RGB->RGB: SDL_SRCALPHA set: alpha-blend (using the source per-surface alpha value). SDL_SRCALPHA not set: copy RGB. both: if SDL_SRCCOLORKEY set, only copy the pixels matching the - source colour key. + source color key. \endverbatim - * + * * You should call SDL_BlitSurface() unless you know exactly how SDL * blitting works internally and how to use the other blit functions. */ @@ -462,7 +467,7 @@ extern DECLSPEC int SDLCALL SDL_LowerBlit /** * \brief Perform a fast, low quality, stretch blit between two surfaces of the * same pixel format. - * + * * \note This function uses a static buffer, and is not thread-safe. */ extern DECLSPEC int SDLCALL SDL_SoftStretch(SDL_Surface * src, @@ -491,9 +496,7 @@ extern DECLSPEC int SDLCALL SDL_LowerBlitScaled /* Ends C function definitions when using C++ */ #ifdef __cplusplus -/* *INDENT-OFF* */ } -/* *INDENT-ON* */ #endif #include "close_code.h" diff --git a/src/eepp/helper/SDL2/include/SDL_system.h b/src/eepp/helper/SDL2/include/SDL_system.h index 47e557575..5a6126157 100644 --- a/src/eepp/helper/SDL2/include/SDL_system.h +++ b/src/eepp/helper/SDL2/include/SDL_system.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,7 +21,7 @@ /** * \file SDL_system.h - * + * * Include file for platform specific SDL API functions */ @@ -38,9 +38,7 @@ #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus -/* *INDENT-OFF* */ extern "C" { -/* *INDENT-ON* */ #endif /* Platform specific functions for iOS */ @@ -62,6 +60,9 @@ extern DECLSPEC void * SDLCALL SDL_AndroidGetJNIEnv(); /* Get the SDL Activity object for the application This returns jobject, but the prototype is void* so we don't need jni.h + The jobject returned by SDL_AndroidGetActivity is a local reference. + It is the caller's responsibility to properly release it + (using LocalReferenceHolder or manually with env->DeleteLocalRef) */ extern DECLSPEC void * SDLCALL SDL_AndroidGetActivity(); @@ -95,9 +96,7 @@ extern DECLSPEC const char * SDLCALL SDL_AndroidGetExternalStoragePath(); /* Ends C function definitions when using C++ */ #ifdef __cplusplus -/* *INDENT-OFF* */ } -/* *INDENT-ON* */ #endif #include "close_code.h" diff --git a/src/eepp/helper/SDL2/include/SDL_syswm.h b/src/eepp/helper/SDL2/include/SDL_syswm.h index 9d5a45e37..539724f9e 100644 --- a/src/eepp/helper/SDL2/include/SDL_syswm.h +++ b/src/eepp/helper/SDL2/include/SDL_syswm.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,7 +21,7 @@ /** * \file SDL_syswm.h - * + * * Include file for SDL custom system window manager hooks. */ @@ -36,14 +36,12 @@ #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus -/* *INDENT-OFF* */ extern "C" { -/* *INDENT-ON* */ #endif /** * \file SDL_syswm.h - * + * * Your application has access to a special type of event ::SDL_SYSWMEVENT, * which contains window-manager specific information and arrives whenever * an unhandled window event occurs. This event is ignored by default, but @@ -84,6 +82,7 @@ struct SDL_SysWMinfo; #include #else typedef struct _NSWindow NSWindow; +typedef struct _NSView NSView; #endif #endif @@ -95,7 +94,7 @@ typedef struct _UIWindow UIWindow; #endif #endif -/** +/** * These are the various supported windowing subsystems */ typedef enum @@ -189,6 +188,7 @@ struct SDL_SysWMinfo struct { NSWindow *window; /* The Cocoa window */ + NSView *view; /* The Cocoa view */ } cocoa; #endif #if defined(SDL_VIDEO_DRIVER_UIKIT) @@ -209,14 +209,14 @@ typedef struct SDL_SysWMinfo SDL_SysWMinfo; /* Function prototypes */ /** * \brief This function allows access to driver-dependent window information. - * + * * \param window The window about which information is being requested - * \param info This structure must be initialized with the SDL version, and is + * \param info This structure must be initialized with the SDL version, and is * then filled in with information about the given window. - * - * \return SDL_TRUE if the function is implemented and the version member of + * + * \return SDL_TRUE if the function is implemented and the version member of * the \c info struct is valid, SDL_FALSE otherwise. - * + * * You typically use this function like this: * \code * SDL_SysWMinfo info; @@ -230,9 +230,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowWMInfo(SDL_Window * window, /* Ends C function definitions when using C++ */ #ifdef __cplusplus -/* *INDENT-OFF* */ } -/* *INDENT-ON* */ #endif #include "close_code.h" diff --git a/src/eepp/helper/SDL2/include/SDL_test.h b/src/eepp/helper/SDL2/include/SDL_test.h index af7613316..7e0de0894 100644 --- a/src/eepp/helper/SDL2/include/SDL_test.h +++ b/src/eepp/helper/SDL2/include/SDL_test.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,7 +21,7 @@ /** * \file SDL_test.h - * + * * Include file for SDL test framework. * * This code is a part of the SDL2_test library, not the main SDL library. @@ -40,24 +40,26 @@ #include "SDL_test_log.h" #include "SDL_test_assert.h" #include "SDL_test_harness.h" +#include "SDL_test_images.h" +#include "SDL_test_compare.h" #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus -/* *INDENT-OFF* */ extern "C" { -/* *INDENT-ON* */ #endif -/* Function prototypes */ +/* Global definitions */ -/* ADD STUFF HERE */ +/* + * Note: Maximum size of SDLTest log message is less than SDLs limit + * to ensure we can fit additional information such as the timestamp. + */ +#define SDLTEST_MAX_LOGMESSAGE_LENGTH 3584 /* Ends C function definitions when using C++ */ #ifdef __cplusplus -/* *INDENT-OFF* */ } -/* *INDENT-ON* */ #endif #include "close_code.h" diff --git a/src/eepp/helper/SDL2/include/SDL_test_assert.h b/src/eepp/helper/SDL2/include/SDL_test_assert.h index d557a76fb..beba16f5e 100644 --- a/src/eepp/helper/SDL2/include/SDL_test_assert.h +++ b/src/eepp/helper/SDL2/include/SDL_test_assert.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,13 +21,13 @@ /** * \file SDL_test_assert.h - * + * * Include file for SDL test framework. * * This code is a part of the SDL2_test library, not the main SDL library. */ -/* +/* * * Assert API for test code and test cases * @@ -39,20 +39,18 @@ #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus -/* *INDENT-OFF* */ extern "C" { -/* *INDENT-ON* */ #endif /** * \brief Fails the assert. */ -#define ASSERT_FAIL 0 +#define ASSERT_FAIL 0 /** * \brief Passes the assert. */ -#define ASSERT_PASS 1 +#define ASSERT_PASS 1 /** * \brief Assert that logs and break execution flow on failures. @@ -60,17 +58,24 @@ extern "C" { * \param assertCondition Evaluated condition or variable to assert; fail (==0) or pass (!=0). * \param assertDescription Message to log with the assert describing it. */ -void SDLTest_Assert(int assertCondition, char *assertDescription); +void SDLTest_Assert(int assertCondition, const char *assertDescription, ...); /** - * \brief Assert for test cases that logs but does not break execution flow on failures. + * \brief Assert for test cases that logs but does not break execution flow on failures. Updates assertion counters. * * \param assertCondition Evaluated condition or variable to assert; fail (==0) or pass (!=0). * \param assertDescription Message to log with the assert describing it. * - * \returns Returns the assertCondition so it can be used to externall to break execution flow if desired. + * \returns Returns the assertCondition so it can be used to externally to break execution flow if desired. */ -int SDLTest_AssertCheck(int assertCondition, char *assertDescription); +int SDLTest_AssertCheck(int assertCondition, const char *assertDescription, ...); + +/** + * \brief Explicitely pass without checking an assertion condition. Updates assertion counter. + * + * \param assertDescription Message to log with the assert describing it. + */ +void SDLTest_AssertPass(const char *assertDescription, ...); /** * \brief Resets the assert summary counters to zero. @@ -91,9 +96,7 @@ void SDLTest_LogAssertSummary(); int SDLTest_AssertSummaryToTestResult(); #ifdef __cplusplus -/* *INDENT-OFF* */ } -/* *INDENT-ON* */ #endif #include "close_code.h" diff --git a/src/eepp/helper/SDL2/include/SDL_test_common.h b/src/eepp/helper/SDL2/include/SDL_test_common.h index 5ccb1bf3f..611c54334 100644 --- a/src/eepp/helper/SDL2/include/SDL_test_common.h +++ b/src/eepp/helper/SDL2/include/SDL_test_common.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,7 +21,7 @@ /** * \file SDL_test_common.h - * + * * Include file for SDL test framework. * * This code is a part of the SDL2_test library, not the main SDL library. @@ -34,9 +34,9 @@ #include "SDL.h" -#ifdef __NDS__ -#define DEFAULT_WINDOW_WIDTH 256 -#define DEFAULT_WINDOW_HEIGHT (2*192) +#if defined(__PSP__) +#define DEFAULT_WINDOW_WIDTH 480 +#define DEFAULT_WINDOW_HEIGHT 272 #else #define DEFAULT_WINDOW_WIDTH 640 #define DEFAULT_WINDOW_HEIGHT 480 @@ -65,6 +65,10 @@ typedef struct int window_y; int window_w; int window_h; + int window_minW; + int window_minH; + int window_maxW; + int window_maxH; int depth; int refresh_rate; int num_windows; @@ -100,14 +104,13 @@ typedef struct int gl_accelerated; int gl_major_version; int gl_minor_version; + int gl_debug; } SDLTest_CommonState; #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus -/* *INDENT-OFF* */ extern "C" { -/* *INDENT-ON* */ #endif /* Function prototypes */ @@ -171,9 +174,7 @@ void SDLTest_CommonQuit(SDLTest_CommonState * state); /* Ends C function definitions when using C++ */ #ifdef __cplusplus -/* *INDENT-OFF* */ } -/* *INDENT-ON* */ #endif #include "close_code.h" diff --git a/src/eepp/helper/SDL2/include/SDL_test_compare.h b/src/eepp/helper/SDL2/include/SDL_test_compare.h new file mode 100644 index 000000000..98ca8ce81 --- /dev/null +++ b/src/eepp/helper/SDL2/include/SDL_test_compare.h @@ -0,0 +1,69 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2013 Sam Lantinga + + 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 + appreciated but is not required. + 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. +*/ + +/** + * \file SDL_test_compare.h + * + * Include file for SDL test framework. + * + * This code is a part of the SDL2_test library, not the main SDL library. + */ + +/* + + Defines comparison functions (i.e. for surfaces). + +*/ + +#ifndef _SDL_test_compare_h +#define _SDL_test_compare_h + +#include "SDL.h" + +#include "SDL_test_images.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/** + * \brief Compares a surface and with reference image data for equality + * + * \param surface Surface used in comparison + * \param referenceSurface Test Surface used in comparison + * \param allowable_error Allowable difference (squared) in blending accuracy. + * + * \returns 0 if comparison succeeded, >0 (=number of pixels where comparison failed) if comparison failed, -1 if any of the surfaces were NULL, -2 if the surface sizes differ. + */ +int SDLTest_CompareSurfaces(SDL_Surface *surface, SDL_Surface *referenceSurface, int allowable_error); + + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* _SDL_test_compare_h */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/eepp/helper/SDL2/include/SDL_test_crc32.h b/src/eepp/helper/SDL2/include/SDL_test_crc32.h index ab64df093..f0a84a48c 100644 --- a/src/eepp/helper/SDL2/include/SDL_test_crc32.h +++ b/src/eepp/helper/SDL2/include/SDL_test_crc32.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,16 +21,16 @@ /** * \file SDL_test_crc32.h - * + * * Include file for SDL test framework. * * This code is a part of the SDL2_test library, not the main SDL library. */ -/* +/* Implements CRC32 calculations (default output is Perl String::CRC32 compatible). - + */ #ifndef _SDL_test_crc32_h @@ -39,9 +39,7 @@ #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus -/* *INDENT-OFF* */ extern "C" { -/* *INDENT-ON* */ #endif @@ -50,20 +48,20 @@ extern "C" { /* Definition shared by all CRC routines */ #ifndef CrcUint32 - #define CrcUint32 unsigned int + #define CrcUint32 unsigned int #endif #ifndef CrcUint8 - #define CrcUint8 unsigned char + #define CrcUint8 unsigned char #endif #ifdef ORIGINAL_METHOD - #define CRC32_POLY 0x04c11db7 /* AUTODIN II, Ethernet, & FDDI */ + #define CRC32_POLY 0x04c11db7 /* AUTODIN II, Ethernet, & FDDI */ #else #define CRC32_POLY 0xEDB88320 /* Perl String::CRC32 compatible */ #endif -/** - * Data structure for CRC32 (checksum) computation +/** + * Data structure for CRC32 (checksum) computation */ typedef struct { CrcUint32 crc32_table[256]; /* CRC table */ @@ -71,12 +69,12 @@ extern "C" { /* ---------- Function Prototypes ------------- */ -/** +/** * /brief Initialize the CRC context * * Note: The function initializes the crc table required for all crc calculations. * - * /param crcContext pointer to context variable + * /param crcContext pointer to context variable * * /returns 0 for OK, -1 on error * @@ -86,8 +84,8 @@ extern "C" { /** * /brief calculate a crc32 from a data block - * - * /param crcContext pointer to context variable + * + * /param crcContext pointer to context variable * /param inBuf input buffer to checksum * /param inLen length of input buffer * /param crc32 pointer to Uint32 to store the final CRC into @@ -106,7 +104,7 @@ int SDLTest_Crc32CalcBuffer(SDLTest_Crc32Context * crcContext, CrcUint8 *inBuf, /** * /brief clean up CRC context * - * /param crcContext pointer to context variable + * /param crcContext pointer to context variable * * /returns 0 for OK, -1 on error * @@ -117,9 +115,7 @@ int SDLTest_Crc32Done(SDLTest_Crc32Context * crcContext); /* Ends C function definitions when using C++ */ #ifdef __cplusplus -/* *INDENT-OFF* */ } -/* *INDENT-ON* */ #endif #include "close_code.h" diff --git a/src/eepp/helper/SDL2/include/SDL_test_font.h b/src/eepp/helper/SDL2/include/SDL_test_font.h index 6d8ca5327..aa9286b4a 100644 --- a/src/eepp/helper/SDL2/include/SDL_test_font.h +++ b/src/eepp/helper/SDL2/include/SDL_test_font.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,7 +21,7 @@ /** * \file SDL_test_font.h - * + * * Include file for SDL test framework. * * This code is a part of the SDL2_test library, not the main SDL library. @@ -33,9 +33,7 @@ #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus -/* *INDENT-OFF* */ extern "C" { -/* *INDENT-ON* */ #endif /* Function prototypes */ @@ -55,9 +53,7 @@ int SDLTest_DrawString(SDL_Renderer * renderer, int x, int y, const char *s); /* Ends C function definitions when using C++ */ #ifdef __cplusplus -/* *INDENT-OFF* */ } -/* *INDENT-ON* */ #endif #include "close_code.h" diff --git a/src/eepp/helper/SDL2/include/SDL_test_fuzzer.h b/src/eepp/helper/SDL2/include/SDL_test_fuzzer.h index 8cd05f098..a528ddc5e 100644 --- a/src/eepp/helper/SDL2/include/SDL_test_fuzzer.h +++ b/src/eepp/helper/SDL2/include/SDL_test_fuzzer.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,16 +21,16 @@ /** * \file SDL_test_fuzzer.h - * + * * Include file for SDL test framework. * * This code is a part of the SDL2_test library, not the main SDL library. */ -/* +/* Data generators for fuzzing test data in a reproducible way. - + */ #ifndef _SDL_test_fuzzer_h @@ -39,9 +39,7 @@ #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus -/* *INDENT-OFF* */ extern "C" { -/* *INDENT-ON* */ #endif @@ -131,7 +129,7 @@ Sint64 SDLTest_RandomSint64(); float SDLTest_RandomUnitFloat(); /** - * \returns random double in range [0.0 - 1.0[ + * \returns random double in range [0.0 - 1.0[ */ double SDLTest_RandomUnitDouble(); @@ -158,13 +156,13 @@ double SDLTest_RandomDouble(); * RandomUint8BoundaryValue(10, 20, SDL_TRUE) returns 10, 11, 19 or 20 * RandomUint8BoundaryValue(1, 20, SDL_FALSE) returns 0 or 21 * RandomUint8BoundaryValue(0, 99, SDL_FALSE) returns 100 - * RandomUint8BoundaryValue(0, 255, SDL_FALSE) returns -1 (== error value) + * RandomUint8BoundaryValue(0, 255, SDL_FALSE) returns 0 (error set) * * \param boundary1 Lower boundary limit * \param boundary2 Upper boundary limit - * \param validDomain Should the generated boundary be valid or not? + * \param validDomain Should the generated boundary be valid (=within the bounds) or not? * - * \returns Boundary value in given range or error value (-1) + * \returns Random boundary value for the given range and domain or 0 with error set */ Uint8 SDLTest_RandomUint8BoundaryValue(Uint8 boundary1, Uint8 boundary2, SDL_bool validDomain); @@ -179,13 +177,13 @@ Uint8 SDLTest_RandomUint8BoundaryValue(Uint8 boundary1, Uint8 boundary2, SDL_boo * RandomUint16BoundaryValue(10, 20, SDL_TRUE) returns 10, 11, 19 or 20 * RandomUint16BoundaryValue(1, 20, SDL_FALSE) returns 0 or 21 * RandomUint16BoundaryValue(0, 99, SDL_FALSE) returns 100 - * RandomUint16BoundaryValue(0, 0xFFFF, SDL_FALSE) returns -1 (== error value) + * RandomUint16BoundaryValue(0, 0xFFFF, SDL_FALSE) returns 0 (error set) * * \param boundary1 Lower boundary limit * \param boundary2 Upper boundary limit - * \param validDomain Should the generated boundary be valid or not? + * \param validDomain Should the generated boundary be valid (=within the bounds) or not? * - * \returns Boundary value in given range or error value (-1) + * \returns Random boundary value for the given range and domain or 0 with error set */ Uint16 SDLTest_RandomUint16BoundaryValue(Uint16 boundary1, Uint16 boundary2, SDL_bool validDomain); @@ -200,13 +198,13 @@ Uint16 SDLTest_RandomUint16BoundaryValue(Uint16 boundary1, Uint16 boundary2, SDL * RandomUint32BoundaryValue(10, 20, SDL_TRUE) returns 10, 11, 19 or 20 * RandomUint32BoundaryValue(1, 20, SDL_FALSE) returns 0 or 21 * RandomUint32BoundaryValue(0, 99, SDL_FALSE) returns 100 - * RandomUint32BoundaryValue(0, 0xFFFFFFFF, SDL_FALSE) returns -1 (== error value) + * RandomUint32BoundaryValue(0, 0xFFFFFFFF, SDL_FALSE) returns 0 (with error set) * * \param boundary1 Lower boundary limit * \param boundary2 Upper boundary limit - * \param validDomain Should the generated boundary be valid or not? + * \param validDomain Should the generated boundary be valid (=within the bounds) or not? * - * \returns Boundary value in given range or error value (-1) + * \returns Random boundary value for the given range and domain or 0 with error set */ Uint32 SDLTest_RandomUint32BoundaryValue(Uint32 boundary1, Uint32 boundary2, SDL_bool validDomain); @@ -221,13 +219,13 @@ Uint32 SDLTest_RandomUint32BoundaryValue(Uint32 boundary1, Uint32 boundary2, SDL * RandomUint64BoundaryValue(10, 20, SDL_TRUE) returns 10, 11, 19 or 20 * RandomUint64BoundaryValue(1, 20, SDL_FALSE) returns 0 or 21 * RandomUint64BoundaryValue(0, 99, SDL_FALSE) returns 100 - * RandomUint64BoundaryValue(0, 0xFFFFFFFFFFFFFFFF, SDL_FALSE) returns -1 (== error value) + * RandomUint64BoundaryValue(0, 0xFFFFFFFFFFFFFFFF, SDL_FALSE) returns 0 (with error set) * * \param boundary1 Lower boundary limit * \param boundary2 Upper boundary limit - * \param validDomain Should the generated boundary be valid or not? + * \param validDomain Should the generated boundary be valid (=within the bounds) or not? * - * \returns Boundary value in given range or error value (-1) + * \returns Random boundary value for the given range and domain or 0 with error set */ Uint64 SDLTest_RandomUint64BoundaryValue(Uint64 boundary1, Uint64 boundary2, SDL_bool validDomain); @@ -241,14 +239,14 @@ Uint64 SDLTest_RandomUint64BoundaryValue(Uint64 boundary1, Uint64 boundary2, SDL * Usage examples: * RandomSint8BoundaryValue(-10, 20, SDL_TRUE) returns -11, -10, 19 or 20 * RandomSint8BoundaryValue(-100, -10, SDL_FALSE) returns -101 or -9 - * RandomSint8BoundaryValue(-128, 99, SDL_FALSE) returns 100 - * RandomSint8BoundaryValue(-128, 127, SDL_FALSE) returns SINT8_MIN (== error value) + * RandomSint8BoundaryValue(SINT8_MIN, 99, SDL_FALSE) returns 100 + * RandomSint8BoundaryValue(SINT8_MIN, SINT8_MAX, SDL_FALSE) returns SINT8_MIN (== error value) with error set * * \param boundary1 Lower boundary limit * \param boundary2 Upper boundary limit - * \param validDomain Should the generated boundary be valid or not? + * \param validDomain Should the generated boundary be valid (=within the bounds) or not? * - * \returns Boundary value in given range or error value (-1) + * \returns Random boundary value for the given range and domain or SINT8_MIN with error set */ Sint8 SDLTest_RandomSint8BoundaryValue(Sint8 boundary1, Sint8 boundary2, SDL_bool validDomain); @@ -263,14 +261,14 @@ Sint8 SDLTest_RandomSint8BoundaryValue(Sint8 boundary1, Sint8 boundary2, SDL_boo * Usage examples: * RandomSint16BoundaryValue(-10, 20, SDL_TRUE) returns -11, -10, 19 or 20 * RandomSint16BoundaryValue(-100, -10, SDL_FALSE) returns -101 or -9 - * RandomSint16BoundaryValue(SINT8_MIN, 99, SDL_FALSE) returns 100 - * RandomSint16BoundaryValue(SINT8_MIN, SINT8_MAX, SDL_FALSE) returns SINT16_MIN (== error value) + * RandomSint16BoundaryValue(SINT16_MIN, 99, SDL_FALSE) returns 100 + * RandomSint16BoundaryValue(SINT16_MIN, SINT16_MAX, SDL_FALSE) returns SINT16_MIN (== error value) with error set * * \param boundary1 Lower boundary limit * \param boundary2 Upper boundary limit - * \param validDomain Should the generated boundary be valid or not? + * \param validDomain Should the generated boundary be valid (=within the bounds) or not? * - * \returns Boundary value in given range or error value (-1) + * \returns Random boundary value for the given range and domain or SINT16_MIN with error set */ Sint16 SDLTest_RandomSint16BoundaryValue(Sint16 boundary1, Sint16 boundary2, SDL_bool validDomain); @@ -289,9 +287,9 @@ Sint16 SDLTest_RandomSint16BoundaryValue(Sint16 boundary1, Sint16 boundary2, SDL * * \param boundary1 Lower boundary limit * \param boundary2 Upper boundary limit - * \param validDomain Should the generated boundary be valid or not? + * \param validDomain Should the generated boundary be valid (=within the bounds) or not? * - * \returns Boundary value in given range or error value (-1) + * \returns Random boundary value for the given range and domain or SINT32_MIN with error set */ Sint32 SDLTest_RandomSint32BoundaryValue(Sint32 boundary1, Sint32 boundary2, SDL_bool validDomain); @@ -306,13 +304,13 @@ Sint32 SDLTest_RandomSint32BoundaryValue(Sint32 boundary1, Sint32 boundary2, SDL * RandomSint64BoundaryValue(-10, 20, SDL_TRUE) returns -11, -10, 19 or 20 * RandomSint64BoundaryValue(-100, -10, SDL_FALSE) returns -101 or -9 * RandomSint64BoundaryValue(SINT64_MIN, 99, SDL_FALSE) returns 100 - * RandomSint64BoundaryValue(SINT64_MIN, SINT32_MAX, SDL_FALSE) returns SINT64_MIN (== error value) + * RandomSint64BoundaryValue(SINT64_MIN, SINT64_MAX, SDL_FALSE) returns SINT64_MIN (== error value) and error set * * \param boundary1 Lower boundary limit * \param boundary2 Upper boundary limit - * \param validDomain Should the generated boundary be valid or not? + * \param validDomain Should the generated boundary be valid (=within the bounds) or not? * - * \returns Boundary value in given range or error value (-1) + * \returns Random boundary value for the given range and domain or SINT64_MIN with error set */ Sint64 SDLTest_RandomSint64BoundaryValue(Sint64 boundary1, Sint64 boundary2, SDL_bool validDomain); @@ -323,36 +321,53 @@ Sint64 SDLTest_RandomSint64BoundaryValue(Sint64 boundary1, Sint64 boundary2, SDL * If Max in smaller tham min, then the values are swapped. * Min and max are the same value, that value will be returned. * - * \returns Generated integer + * \param min Minimum inclusive value of returned random number + * \param max Maximum inclusive value of returned random number + * + * \returns Generated random integer in range */ Sint32 SDLTest_RandomIntegerInRange(Sint32 min, Sint32 max); /** - * Generates random null-terminated string. The maximum length for - * the string is 255 characters and it can contain ASCII characters - * from 1 to 127. + * Generates random null-terminated string. The minimum length for + * the string is 1 character, maximum length for the string is 255 + * characters and it can contain ASCII characters from 32 to 126. * * Note: Returned string needs to be deallocated. * - * \returns newly allocated random string + * \returns Newly allocated random string; or NULL if length was invalid or string could not be allocated. */ char * SDLTest_RandomAsciiString(); /** * Generates random null-terminated string. The maximum length for - * the string is defined by maxLenght parameter. - * String can contain ASCII characters from 1 to 127. + * the string is defined by the maxLength parameter. + * String can contain ASCII characters from 32 to 126. * * Note: Returned string needs to be deallocated. * - * \param maxLength Maximum length of the generated string + * \param maxLength The maximum length of the generated string. * - * \returns newly allocated random string + * \returns Newly allocated random string; or NULL if maxLength was invalid or string could not be allocated. */ char * SDLTest_RandomAsciiStringWithMaximumLength(int maxLength); + +/** + * Generates random null-terminated string. The length for + * the string is defined by the size parameter. + * String can contain ASCII characters from 32 to 126. + * + * Note: Returned string needs to be deallocated. + * + * \param size The length of the generated string + * + * \returns Newly allocated random string; or NULL if size was invalid or string could not be allocated. + */ +char * SDLTest_RandomAsciiStringOfSize(int size); + /** * Returns the invocation count for the fuzzer since last ...FuzzerInit. */ @@ -360,9 +375,7 @@ int SDLTest_GetFuzzerInvocationCount(); /* Ends C function definitions when using C++ */ #ifdef __cplusplus -/* *INDENT-OFF* */ } -/* *INDENT-ON* */ #endif #include "close_code.h" diff --git a/src/eepp/helper/SDL2/include/SDL_test_harness.h b/src/eepp/helper/SDL2/include/SDL_test_harness.h index cf30600e2..d2da04f1e 100644 --- a/src/eepp/helper/SDL2/include/SDL_test_harness.h +++ b/src/eepp/helper/SDL2/include/SDL_test_harness.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,7 +21,7 @@ /** * \file SDL_test_harness.h - * + * * Include file for SDL test framework. * * This code is a part of the SDL2_test library, not the main SDL library. @@ -29,7 +29,7 @@ /* Defines types for test case definitions and the test execution harness API. - + Based on original GSOC code by Markus Kauppila */ @@ -39,9 +39,7 @@ #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus -/* *INDENT-OFF* */ extern "C" { -/* *INDENT-ON* */ #endif @@ -50,22 +48,23 @@ extern "C" { #define TEST_DISABLED 0 //! Definition of all the possible test return values of the test case method -#define TEST_ABORTED -1 -#define TEST_COMPLETED 0 -#define TEST_SKIPPED 1 +#define TEST_ABORTED -1 +#define TEST_STARTED 0 +#define TEST_COMPLETED 1 +#define TEST_SKIPPED 2 //! Definition of all the possible test results for the harness -#define TEST_RESULT_PASSED 0 -#define TEST_RESULT_FAILED 1 -#define TEST_RESULT_NO_ASSERT 2 -#define TEST_RESULT_SKIPPED 3 -#define TEST_RESULT_SETUP_FAILURE 4 +#define TEST_RESULT_PASSED 0 +#define TEST_RESULT_FAILED 1 +#define TEST_RESULT_NO_ASSERT 2 +#define TEST_RESULT_SKIPPED 3 +#define TEST_RESULT_SETUP_FAILURE 4 //!< Function pointer to a test case setup function (run before every test) typedef void (*SDLTest_TestCaseSetUpFp)(void *arg); //!< Function pointer to a test case function -typedef void (*SDLTest_TestCaseFp)(void *arg); +typedef int (*SDLTest_TestCaseFp)(void *arg); //!< Function pointer to a test case teardown function (run after every test) typedef void (*SDLTest_TestCaseTearDownFp)(void *arg); @@ -74,35 +73,48 @@ typedef void (*SDLTest_TestCaseTearDownFp)(void *arg); * Holds information about a single test case. */ typedef struct SDLTest_TestCaseReference { - /*!< Func2Stress */ - SDLTest_TestCaseFp testCase; - /*!< Short name (or function name) "Func2Stress" */ - char *name; - /*!< Long name or full description "This test pushes func2() to the limit." */ - char *description; - /*!< Set to TEST_ENABLED or TEST_DISABLED (test won't be run) */ - int enabled; + /*!< Func2Stress */ + SDLTest_TestCaseFp testCase; + /*!< Short name (or function name) "Func2Stress" */ + char *name; + /*!< Long name or full description "This test pushes func2() to the limit." */ + char *description; + /*!< Set to TEST_ENABLED or TEST_DISABLED (test won't be run) */ + int enabled; } SDLTest_TestCaseReference; /** * Holds information about a test suite (multiple test cases). */ typedef struct SDLTest_TestSuiteReference { - /*!< "PlatformSuite" */ - char *name; - /*!< The function that is run before each test. NULL skips. */ - SDLTest_TestCaseSetUpFp testSetUp; - /*!< The test cases that are run as part of the suite. Last item should be NULL. */ - const SDLTest_TestCaseReference **testCases; - /*!< The function that is run after each test. NULL skips. */ - SDLTest_TestCaseTearDownFp testTearDown; + /*!< "PlatformSuite" */ + char *name; + /*!< The function that is run before each test. NULL skips. */ + SDLTest_TestCaseSetUpFp testSetUp; + /*!< The test cases that are run as part of the suite. Last item should be NULL. */ + const SDLTest_TestCaseReference **testCases; + /*!< The function that is run after each test. NULL skips. */ + SDLTest_TestCaseTearDownFp testTearDown; } SDLTest_TestSuiteReference; + +/** + * \brief Execute a test suite using the given run seed and execution key. + * + * \param testSuites Suites containing the test case. + * \param userRunSeed Custom run seed provided by user, or NULL to autogenerate one. + * \param userExecKey Custom execution key provided by user, or 0 to autogenerate one. + * \param filter Filter specification. NULL disables. Case sensitive. + * \param testIterations Number of iterations to run each test case. + * + * \returns Test run result; 0 when all tests passed, 1 if any tests failed. + */ +int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *userRunSeed, Uint64 userExecKey, const char *filter, int testIterations); + + /* Ends C function definitions when using C++ */ #ifdef __cplusplus -/* *INDENT-OFF* */ } -/* *INDENT-ON* */ #endif #include "close_code.h" diff --git a/src/eepp/helper/SDL2/include/SDL_test_images.h b/src/eepp/helper/SDL2/include/SDL_test_images.h new file mode 100644 index 000000000..21cf39ff7 --- /dev/null +++ b/src/eepp/helper/SDL2/include/SDL_test_images.h @@ -0,0 +1,78 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2013 Sam Lantinga + + 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 + appreciated but is not required. + 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. +*/ + +/** + * \file SDL_test_images.h + * + * Include file for SDL test framework. + * + * This code is a part of the SDL2_test library, not the main SDL library. + */ + +/* + + Defines some images for tests. + +*/ + +#ifndef _SDL_test_images_h +#define _SDL_test_images_h + +#include "SDL.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/** + *Type for test images. + */ +typedef struct SDLTest_SurfaceImage_s { + int width; + int height; + unsigned int bytes_per_pixel; /* 3:RGB, 4:RGBA */ + const char *pixel_data; +} SDLTest_SurfaceImage_t; + +/* Test images */ +SDL_Surface *SDLTest_ImageBlit(); +SDL_Surface *SDLTest_ImageBlitColor(); +SDL_Surface *SDLTest_ImageBlitAlpha(); +SDL_Surface *SDLTest_ImageBlitBlendAdd(); +SDL_Surface *SDLTest_ImageBlitBlend(); +SDL_Surface *SDLTest_ImageBlitBlendMod(); +SDL_Surface *SDLTest_ImageBlitBlendNone(); +SDL_Surface *SDLTest_ImageBlitBlendAll(); +SDL_Surface *SDLTest_ImageFace(); +SDL_Surface *SDLTest_ImagePrimitives(); +SDL_Surface *SDLTest_ImagePrimitivesBlend(); + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* _SDL_test_images_h */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/eepp/helper/SDL2/include/SDL_test_log.h b/src/eepp/helper/SDL2/include/SDL_test_log.h index e6b8d2b5c..a581d2e75 100644 --- a/src/eepp/helper/SDL2/include/SDL_test_log.h +++ b/src/eepp/helper/SDL2/include/SDL_test_log.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,13 +21,13 @@ /** * \file SDL_test_log.h - * + * * Include file for SDL test framework. * * This code is a part of the SDL2_test library, not the main SDL library. */ -/* +/* * * Wrapper to log in the TEST category * @@ -39,9 +39,7 @@ #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus -/* *INDENT-OFF* */ extern "C" { -/* *INDENT-ON* */ #endif /** @@ -49,20 +47,18 @@ extern "C" { * * \param fmt Message to be logged */ -void SDLTest_Log(char *fmt, ...); +void SDLTest_Log(const char *fmt, ...); /** * \brief Prints given message with a timestamp in the TEST category and the ERROR priority. * * \param fmt Message to be logged */ -void SDLTest_LogError(char *fmt, ...); +void SDLTest_LogError(const char *fmt, ...); /* Ends C function definitions when using C++ */ #ifdef __cplusplus -/* *INDENT-OFF* */ } -/* *INDENT-ON* */ #endif #include "close_code.h" diff --git a/src/eepp/helper/SDL2/include/SDL_test_md5.h b/src/eepp/helper/SDL2/include/SDL_test_md5.h index 0c4df8756..b0d4b7b04 100644 --- a/src/eepp/helper/SDL2/include/SDL_test_md5.h +++ b/src/eepp/helper/SDL2/include/SDL_test_md5.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,7 +21,7 @@ /** * \file SDL_test_md5.h - * + * * Include file for SDL test framework. * * This code is a part of the SDL2_test library, not the main SDL library. @@ -59,9 +59,7 @@ #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus -/* *INDENT-OFF* */ extern "C" { -/* *INDENT-ON* */ #endif /* ------------ Definitions --------- */ @@ -71,21 +69,21 @@ extern "C" { /* Data structure for MD5 (Message-Digest) computation */ typedef struct { - MD5UINT4 i[2]; /* number of _bits_ handled mod 2^64 */ - MD5UINT4 buf[4]; /* scratch buffer */ - unsigned char in[64]; /* input buffer */ - unsigned char digest[16]; /* actual digest after Md5Final call */ + MD5UINT4 i[2]; /* number of _bits_ handled mod 2^64 */ + MD5UINT4 buf[4]; /* scratch buffer */ + unsigned char in[64]; /* input buffer */ + unsigned char digest[16]; /* actual digest after Md5Final call */ } SDLTest_Md5Context; /* ---------- Function Prototypes ------------- */ -/** +/** * /brief initialize the context * - * /param mdContext pointer to context variable + * /param mdContext pointer to context variable * * Note: The function initializes the message-digest context - * mdContext. Call before each new use of the context - + * mdContext. Call before each new use of the context - * all fields are set to zero. */ void SDLTest_Md5Init(SDLTest_Md5Context * mdContext); @@ -93,24 +91,24 @@ extern "C" { /** * /brief update digest from variable length data - * + * * /param mdContext pointer to context variable * /param inBuf pointer to data array/string * /param inLen length of data array/string * - * Note: The function updates the message-digest context to account + * Note: The function 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); /* * /brief complete digest computation * - * /param mdContext pointer to context variable + * /param mdContext pointer to context variable * * Note: The function terminates the message-digest computation and * ends with the desired message digest in mdContext.digest[0..15]. @@ -122,9 +120,7 @@ extern "C" { /* Ends C function definitions when using C++ */ #ifdef __cplusplus -/* *INDENT-OFF* */ } -/* *INDENT-ON* */ #endif #include "close_code.h" diff --git a/src/eepp/helper/SDL2/include/SDL_test_random.h b/src/eepp/helper/SDL2/include/SDL_test_random.h index a1175b2f9..ce6192c25 100644 --- a/src/eepp/helper/SDL2/include/SDL_test_random.h +++ b/src/eepp/helper/SDL2/include/SDL_test_random.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,20 +21,20 @@ /** * \file SDL_test_random.h - * + * * Include file for SDL test framework. * * This code is a part of the SDL2_test library, not the main SDL library. */ -/* +/* - A "32-bit Multiply with carry random number generator. Very fast. - Includes a list of recommended multipliers. + A "32-bit Multiply with carry random number generator. Very fast. + Includes a list of recommended multipliers. multiply-with-carry generator: x(n) = a*x(n-1) + carry mod 2^32. period: (a*2^31)-1 - + */ #ifndef _SDL_test_random_h @@ -43,9 +43,7 @@ #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus -/* *INDENT-OFF* */ extern "C" { -/* *INDENT-ON* */ #endif /* --- Definitions */ @@ -53,7 +51,7 @@ extern "C" { /* * Macros that return a random number in a specific format. */ -#define SDLTest_RandomInt(c) ((int)SDLTest_Random(c)) +#define SDLTest_RandomInt(c) ((int)SDLTest_Random(c)) /* * Context structure for the random number generator state. @@ -70,7 +68,7 @@ extern "C" { /* --- Function prototypes */ /** - * \brief Initialize random number generator with two integers. + * \brief Initialize random number generator with two integers. * * Note: The random sequence of numbers returned by ...Random() is the * same for the same two integers and has a period of 2^31. @@ -81,10 +79,10 @@ extern "C" { * */ void SDLTest_RandomInit(SDLTest_RandomContext * rndContext, unsigned int xi, - unsigned int ci); + unsigned int ci); /** - * \brief Initialize random number generator based on current system time. + * \brief Initialize random number generator based on current system time. * * \param rndContext pointer to context structure * @@ -93,7 +91,7 @@ extern "C" { /** - * \brief Initialize random number generator based on current system time. + * \brief Initialize random number generator based on current system time. * * Note: ...RandomInit() or ...RandomInitTime() must have been called * before using this function. @@ -108,9 +106,7 @@ extern "C" { /* Ends C function definitions when using C++ */ #ifdef __cplusplus -/* *INDENT-OFF* */ } -/* *INDENT-ON* */ #endif #include "close_code.h" diff --git a/src/eepp/helper/SDL2/include/SDL_thread.h b/src/eepp/helper/SDL2/include/SDL_thread.h index 6eb720145..6015a071e 100644 --- a/src/eepp/helper/SDL2/include/SDL_thread.h +++ b/src/eepp/helper/SDL2/include/SDL_thread.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -24,7 +24,7 @@ /** * \file SDL_thread.h - * + * * Header for the SDL thread management routines. */ @@ -37,9 +37,7 @@ #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus -/* *INDENT-OFF* */ extern "C" { -/* *INDENT-ON* */ #endif /* The SDL thread structure, defined in SDL_thread.c */ @@ -67,22 +65,22 @@ typedef int (SDLCALL * SDL_ThreadFunction) (void *data); #if defined(__WIN32__) && !defined(HAVE_LIBC) /** * \file SDL_thread.h - * + * * We compile SDL into a DLL. This means, that it's the DLL which * creates a new thread for the calling process with the SDL_CreateThread() * API. There is a problem with this, that only the RTL of the SDL.DLL will - * be initialized for those threads, and not the RTL of the calling + * be initialized for those threads, and not the RTL of the calling * application! - * + * * To solve this, we make a little hack here. - * + * * We'll always use the caller's _beginthread() and _endthread() APIs to * start a new thread. This way, if it's the SDL.DLL which uses this API, * then the RTL of SDL.DLL will be used to create the new thread, and if it's * the application, then the RTL of the application will be used. - * + * * So, in short: - * Always use the _beginthread() and _endthread() of the calling runtime + * Always use the _beginthread() and _endthread() of the calling runtime * library! */ #define SDL_PASSED_BEGINTHREAD_ENDTHREAD @@ -150,7 +148,7 @@ extern DECLSPEC SDL_threadID SDLCALL SDL_ThreadID(void); /** * Get the thread identifier for the specified thread. - * + * * Equivalent to SDL_ThreadID() if the specified thread is NULL. */ extern DECLSPEC SDL_threadID SDLCALL SDL_GetThreadID(SDL_Thread * thread); @@ -162,7 +160,7 @@ extern DECLSPEC int SDLCALL SDL_SetThreadPriority(SDL_ThreadPriority priority); /** * Wait for a thread to finish. - * + * * The return code for the thread function is placed in the area * pointed to by \c status, if \c status is not NULL. */ @@ -171,9 +169,7 @@ extern DECLSPEC void SDLCALL SDL_WaitThread(SDL_Thread * thread, int *status); /* Ends C function definitions when using C++ */ #ifdef __cplusplus -/* *INDENT-OFF* */ } -/* *INDENT-ON* */ #endif #include "close_code.h" diff --git a/src/eepp/helper/SDL2/include/SDL_timer.h b/src/eepp/helper/SDL2/include/SDL_timer.h index 031662854..e065cf4f9 100644 --- a/src/eepp/helper/SDL2/include/SDL_timer.h +++ b/src/eepp/helper/SDL2/include/SDL_timer.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -24,7 +24,7 @@ /** * \file SDL_timer.h - * + * * Header for the SDL time management routines. */ @@ -34,14 +34,12 @@ #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus -/* *INDENT-OFF* */ extern "C" { -/* *INDENT-ON* */ #endif /** * \brief Get the number of milliseconds since the SDL library initialization. - * + * * \note This value wraps if the program runs for more than ~49 days. */ extern DECLSPEC Uint32 SDLCALL SDL_GetTicks(void); @@ -63,7 +61,7 @@ extern DECLSPEC void SDLCALL SDL_Delay(Uint32 ms); /** * Function prototype for the timer callback function. - * + * * The callback function is passed the current timer interval and returns * the next timer interval. If the returned value is the same as the one * passed in, the periodic alarm continues, otherwise a new alarm is @@ -97,9 +95,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_RemoveTimer(SDL_TimerID id); /* Ends C function definitions when using C++ */ #ifdef __cplusplus -/* *INDENT-OFF* */ } -/* *INDENT-ON* */ #endif #include "close_code.h" diff --git a/src/eepp/helper/SDL2/include/SDL_touch.h b/src/eepp/helper/SDL2/include/SDL_touch.h index cb1324516..9e6d7c65f 100644 --- a/src/eepp/helper/SDL2/include/SDL_touch.h +++ b/src/eepp/helper/SDL2/include/SDL_touch.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,7 +21,7 @@ /** * \file SDL_touch.h - * + * * Include file for SDL touch event handling. */ @@ -35,88 +35,49 @@ #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus -/* *INDENT-OFF* */ extern "C" { -/* *INDENT-ON* */ #endif - typedef Sint64 SDL_TouchID; typedef Sint64 SDL_FingerID; +typedef struct SDL_Finger +{ + SDL_FingerID id; + float x; + float y; + float pressure; +} SDL_Finger; -struct SDL_Finger { - SDL_FingerID id; - Uint16 x; - Uint16 y; - Uint16 pressure; - Uint16 xdelta; - Uint16 ydelta; - Uint16 last_x, last_y,last_pressure; /* the last reported coordinates */ - SDL_bool down; -}; - -typedef struct SDL_Touch SDL_Touch; -typedef struct SDL_Finger SDL_Finger; - - -struct SDL_Touch { - - /* Free the touch when it's time */ - void (*FreeTouch) (SDL_Touch * touch); - - /* data common for tablets */ - float pressure_max, pressure_min; - float x_max,x_min; - float y_max,y_min; - Uint16 xres,yres,pressureres; - float native_xres,native_yres,native_pressureres; - float tilt_x; /* for future use */ - float tilt_y; /* for future use */ - float rotation; /* for future use */ - - /* Data common to all touch */ - SDL_TouchID id; - SDL_Window *focus; - - char *name; - Uint8 buttonstate; - SDL_bool relative_mode; - SDL_bool flush_motion; - - int num_fingers; - int max_fingers; - SDL_Finger** fingers; - - void *driverdata; -}; - +/* Used as the device ID for mouse events simulated with touch input */ +#define SDL_TOUCH_MOUSEID ((Uint32)-1) /* Function prototypes */ /** - * \brief Get the touch object at the given id. - * - * + * \brief Get the number of registered touch devices. */ - extern DECLSPEC SDL_Touch* SDLCALL SDL_GetTouch(SDL_TouchID id); - - +extern DECLSPEC int SDLCALL SDL_GetNumTouchDevices(void); /** - * \brief Get the finger object of the given touch, at the given id. - * - * + * \brief Get the touch ID with the given index, or 0 if the index is invalid. */ - extern - DECLSPEC SDL_Finger* SDLCALL SDL_GetFinger(SDL_Touch *touch, SDL_FingerID id); +extern DECLSPEC SDL_TouchID SDLCALL SDL_GetTouchDevice(int index); + +/** + * \brief Get the number of active fingers for a given touch device. + */ +extern DECLSPEC int SDLCALL SDL_GetNumTouchFingers(SDL_TouchID touchID); + +/** + * \brief Get the finger object of the given touch, with the given index. + */ +extern DECLSPEC SDL_Finger * SDLCALL SDL_GetTouchFinger(SDL_TouchID touchID, int index); /* Ends C function definitions when using C++ */ #ifdef __cplusplus -/* *INDENT-OFF* */ } -/* *INDENT-ON* */ #endif #include "close_code.h" diff --git a/src/eepp/helper/SDL2/include/SDL_types.h b/src/eepp/helper/SDL2/include/SDL_types.h index 35df00b13..bb485cdb0 100644 --- a/src/eepp/helper/SDL2/include/SDL_types.h +++ b/src/eepp/helper/SDL2/include/SDL_types.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,7 +21,7 @@ /** * \file SDL_types.h - * + * * \deprecated */ diff --git a/src/eepp/helper/SDL2/include/SDL_version.h b/src/eepp/helper/SDL2/include/SDL_version.h index 3c34ab109..a9ced804d 100644 --- a/src/eepp/helper/SDL2/include/SDL_version.h +++ b/src/eepp/helper/SDL2/include/SDL_version.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,7 +21,7 @@ /** * \file SDL_version.h - * + * * This header defines the current SDL version. */ @@ -33,20 +33,18 @@ #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus -/* *INDENT-OFF* */ extern "C" { -/* *INDENT-ON* */ #endif /** * \brief Information the version of SDL in use. - * + * * Represents the library's version as three levels: major revision * (increments with massive changes, additions, and enhancements), * minor revision (increments with backwards-compatible changes to the * major revision), and patchlevel (increments with fixes to the minor * revision). - * + * * \sa SDL_VERSION * \sa SDL_GetVersion */ @@ -59,30 +57,30 @@ typedef struct SDL_version /* Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL */ -#define SDL_MAJOR_VERSION 2 -#define SDL_MINOR_VERSION 0 -#define SDL_PATCHLEVEL 0 +#define SDL_MAJOR_VERSION 2 +#define SDL_MINOR_VERSION 0 +#define SDL_PATCHLEVEL 0 /** * \brief Macro to determine SDL version program was compiled against. - * + * * This macro fills in a SDL_version structure with the version of the * library you compiled against. This is determined by what header the * compiler uses. Note that if you dynamically linked the library, you might * have a slightly newer or older version at runtime. That version can be * determined with SDL_GetVersion(), which, unlike SDL_VERSION(), * is not a macro. - * + * * \param x A pointer to a SDL_version struct to initialize. - * + * * \sa SDL_version * \sa SDL_GetVersion */ -#define SDL_VERSION(x) \ -{ \ - (x)->major = SDL_MAJOR_VERSION; \ - (x)->minor = SDL_MINOR_VERSION; \ - (x)->patch = SDL_PATCHLEVEL; \ +#define SDL_VERSION(x) \ +{ \ + (x)->major = SDL_MAJOR_VERSION; \ + (x)->minor = SDL_MINOR_VERSION; \ + (x)->patch = SDL_PATCHLEVEL; \ } /** @@ -90,23 +88,23 @@ typedef struct SDL_version * \verbatim (1,2,3) -> (1203) \endverbatim - * + * * This assumes that there will never be more than 100 patchlevels. */ -#define SDL_VERSIONNUM(X, Y, Z) \ - ((X)*1000 + (Y)*100 + (Z)) +#define SDL_VERSIONNUM(X, Y, Z) \ + ((X)*1000 + (Y)*100 + (Z)) /** * This is the version number macro for the current SDL version. */ #define SDL_COMPILEDVERSION \ - SDL_VERSIONNUM(SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL) + SDL_VERSIONNUM(SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL) /** * This macro will evaluate to true if compiled with SDL at least X.Y.Z. */ #define SDL_VERSION_ATLEAST(X, Y, Z) \ - (SDL_COMPILEDVERSION >= SDL_VERSIONNUM(X, Y, Z)) + (SDL_COMPILEDVERSION >= SDL_VERSIONNUM(X, Y, Z)) /** * \brief Get the version of SDL that is linked against your program. @@ -115,11 +113,11 @@ typedef struct SDL_version * current version will be different than the version you compiled against. * This function returns the current version, while SDL_VERSION() is a * macro that tells you what version you compiled with. - * + * * \code * SDL_version compiled; * SDL_version linked; - * + * * SDL_VERSION(&compiled); * SDL_GetVersion(&linked); * printf("We compiled against SDL version %d.%d.%d ...\n", @@ -127,9 +125,9 @@ typedef struct SDL_version * printf("But we linked against SDL version %d.%d.%d.\n", * linked.major, linked.minor, linked.patch); * \endcode - * + * * This function may be called safely at any time, even before SDL_Init(). - * + * * \sa SDL_VERSION */ extern DECLSPEC void SDLCALL SDL_GetVersion(SDL_version * ver); @@ -155,9 +153,7 @@ extern DECLSPEC int SDLCALL SDL_GetRevisionNumber(void); /* Ends C function definitions when using C++ */ #ifdef __cplusplus -/* *INDENT-OFF* */ } -/* *INDENT-ON* */ #endif #include "close_code.h" diff --git a/src/eepp/helper/SDL2/include/SDL_video.h b/src/eepp/helper/SDL2/include/SDL_video.h index 5fdba063f..66815197c 100644 --- a/src/eepp/helper/SDL2/include/SDL_video.h +++ b/src/eepp/helper/SDL2/include/SDL_video.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,7 +21,7 @@ /** * \file SDL_video.h - * + * * Header file for SDL video functions. */ @@ -36,14 +36,12 @@ #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus -/* *INDENT-OFF* */ extern "C" { -/* *INDENT-ON* */ #endif /** * \brief The structure that defines a display mode - * + * * \sa SDL_GetNumDisplayModes() * \sa SDL_GetDisplayMode() * \sa SDL_GetDesktopDisplayMode() @@ -63,7 +61,7 @@ typedef struct /** * \brief The type used to identify a window - * + * * \sa SDL_CreateWindow() * \sa SDL_CreateWindowFrom() * \sa SDL_DestroyWindow() @@ -92,7 +90,7 @@ typedef struct SDL_Window SDL_Window; /** * \brief The flags on a window - * + * * \sa SDL_GetWindowFlags() */ typedef enum @@ -108,6 +106,7 @@ typedef enum SDL_WINDOW_INPUT_GRABBED = 0x00000100, /**< window has grabbed input focus */ SDL_WINDOW_INPUT_FOCUS = 0x00000200, /**< window has input focus */ SDL_WINDOW_MOUSE_FOCUS = 0x00000400, /**< window has mouse focus */ + SDL_WINDOW_FULLSCREEN_DESKTOP = ( SDL_WINDOW_FULLSCREEN | 0x00001000 ), SDL_WINDOW_FOREIGN = 0x00000800 /**< window not created by SDL */ } SDL_WindowFlags; @@ -137,9 +136,9 @@ typedef enum SDL_WINDOWEVENT_NONE, /**< Never used */ SDL_WINDOWEVENT_SHOWN, /**< Window has been shown */ SDL_WINDOWEVENT_HIDDEN, /**< Window has been hidden */ - SDL_WINDOWEVENT_EXPOSED, /**< Window has been exposed and should be + SDL_WINDOWEVENT_EXPOSED, /**< Window has been exposed and should be redrawn */ - SDL_WINDOWEVENT_MOVED, /**< Window has been moved to data1, data2 + SDL_WINDOWEVENT_MOVED, /**< Window has been moved to data1, data2 */ SDL_WINDOWEVENT_RESIZED, /**< Window has been resized to data1xdata2 */ SDL_WINDOWEVENT_SIZE_CHANGED, /**< The window size has changed, either as a result of an API call or through the system or user changing the window size. */ @@ -151,7 +150,7 @@ typedef enum SDL_WINDOWEVENT_LEAVE, /**< Window has lost mouse focus */ SDL_WINDOWEVENT_FOCUS_GAINED, /**< Window has gained keyboard focus */ SDL_WINDOWEVENT_FOCUS_LOST, /**< Window has lost keyboard focus */ - SDL_WINDOWEVENT_CLOSE /**< The window manager requests that the + SDL_WINDOWEVENT_CLOSE /**< The window manager requests that the window be closed */ } SDL_WindowEventID; @@ -210,52 +209,52 @@ typedef enum /** * \brief Get the number of video drivers compiled into SDL - * + * * \sa SDL_GetVideoDriver() */ extern DECLSPEC int SDLCALL SDL_GetNumVideoDrivers(void); /** * \brief Get the name of a built in video driver. - * + * * \note The video drivers are presented in the order in which they are * normally checked during initialization. - * + * * \sa SDL_GetNumVideoDrivers() */ extern DECLSPEC const char *SDLCALL SDL_GetVideoDriver(int index); /** * \brief Initialize the video subsystem, optionally specifying a video driver. - * - * \param driver_name Initialize a specific driver by name, or NULL for the + * + * \param driver_name Initialize a specific driver by name, or NULL for the * default video driver. - * + * * \return 0 on success, -1 on error - * + * * This function initializes the video subsystem; setting up a connection * to the window manager, etc, and determines the available display modes * and pixel formats, but does not initialize a window or graphics mode. - * + * * \sa SDL_VideoQuit() */ extern DECLSPEC int SDLCALL SDL_VideoInit(const char *driver_name); /** * \brief Shuts down the video subsystem. - * + * * This function closes all windows, and restores the original video mode. - * + * * \sa SDL_VideoInit() */ extern DECLSPEC void SDLCALL SDL_VideoQuit(void); /** * \brief Returns the name of the currently initialized video driver. - * + * * \return The name of the current video driver or NULL if no driver * has been initialized - * + * * \sa SDL_GetNumVideoDrivers() * \sa SDL_GetVideoDriver() */ @@ -263,37 +262,46 @@ extern DECLSPEC const char *SDLCALL SDL_GetCurrentVideoDriver(void); /** * \brief Returns the number of available video displays. - * + * * \sa SDL_GetDisplayBounds() */ extern DECLSPEC int SDLCALL SDL_GetNumVideoDisplays(void); +/** + * \brief Get the name of a display in UTF-8 encoding + * + * \return The name of a display, or NULL for an invalid display index. + * + * \sa SDL_GetNumVideoDisplays() + */ +extern DECLSPEC const char * SDLCALL SDL_GetDisplayName(int displayIndex); + /** * \brief Get the desktop area represented by a display, with the primary * display located at 0,0 - * + * * \return 0 on success, or -1 if the index is out of range. - * + * * \sa SDL_GetNumVideoDisplays() */ extern DECLSPEC int SDLCALL SDL_GetDisplayBounds(int displayIndex, SDL_Rect * rect); /** * \brief Returns the number of available display modes. - * + * * \sa SDL_GetDisplayMode() */ extern DECLSPEC int SDLCALL SDL_GetNumDisplayModes(int displayIndex); /** * \brief Fill in information about a specific display mode. - * + * * \note The display modes are sorted in this priority: * \li bits per pixel -> more colors to fewer colors * \li width -> largest to smallest * \li height -> largest to smallest * \li refresh rate -> highest to lowest - * + * * \sa SDL_GetNumDisplayModes() */ extern DECLSPEC int SDLCALL SDL_GetDisplayMode(int displayIndex, int modeIndex, @@ -312,21 +320,22 @@ extern DECLSPEC int SDLCALL SDL_GetCurrentDisplayMode(int displayIndex, SDL_Disp /** * \brief Get the closest match to the requested display mode. - * + * + * \param displayIndex The index of display from which mode should be queried. * \param mode The desired display mode - * \param closest A pointer to a display mode to be filled in with the closest + * \param closest A pointer to a display mode to be filled in with the closest * match of the available display modes. - * - * \return The passed in value \c closest, or NULL if no matching video mode + * + * \return The passed in value \c closest, or NULL if no matching video mode * was available. - * + * * The available display modes are scanned, and \c closest is filled in with the - * closest mode matching the requested mode and returned. The mode format and - * refresh_rate default to the desktop mode if they are 0. The modes are - * scanned with size being first priority, format being second priority, and - * finally checking the refresh_rate. If all the available modes are too + * closest mode matching the requested mode and returned. The mode format and + * refresh_rate default to the desktop mode if they are 0. The modes are + * scanned with size being first priority, format being second priority, and + * finally checking the refresh_rate. If all the available modes are too * small, then NULL is returned. - * + * * \sa SDL_GetNumDisplayModes() * \sa SDL_GetDisplayMode() */ @@ -334,22 +343,23 @@ extern DECLSPEC SDL_DisplayMode * SDLCALL SDL_GetClosestDisplayMode(int displayI /** * \brief Get the display index associated with a window. - * + * * \return the display index of the display containing the center of the * window, or -1 on error. */ -extern DECLSPEC int SDLCALL SDL_GetWindowDisplay(SDL_Window * window); +extern DECLSPEC int SDLCALL SDL_GetWindowDisplayIndex(SDL_Window * window); /** * \brief Set the display mode used when a fullscreen window is visible. * * By default the window's dimensions and the desktop format and refresh rate * are used. - * + * + * \param window The window for which the display mode should be set. * \param mode The mode to use, or NULL for the default mode. - * + * * \return 0 on success, or -1 if setting the display mode failed. - * + * * \sa SDL_GetWindowDisplayMode() * \sa SDL_SetWindowFullscreen() */ @@ -374,22 +384,22 @@ extern DECLSPEC Uint32 SDLCALL SDL_GetWindowPixelFormat(SDL_Window * window); /** * \brief Create a window with the specified position, dimensions, and flags. - * + * * \param title The title of the window, in UTF-8 encoding. - * \param x The x position of the window, ::SDL_WINDOWPOS_CENTERED, or + * \param x The x position of the window, ::SDL_WINDOWPOS_CENTERED, or * ::SDL_WINDOWPOS_UNDEFINED. - * \param y The y position of the window, ::SDL_WINDOWPOS_CENTERED, or + * \param y The y position of the window, ::SDL_WINDOWPOS_CENTERED, or * ::SDL_WINDOWPOS_UNDEFINED. * \param w The width of the window. * \param h The height of the window. - * \param flags The flags for the window, a mask of any of the following: - * ::SDL_WINDOW_FULLSCREEN, ::SDL_WINDOW_OPENGL, - * ::SDL_WINDOW_SHOWN, ::SDL_WINDOW_BORDERLESS, - * ::SDL_WINDOW_RESIZABLE, ::SDL_WINDOW_MAXIMIZED, + * \param flags The flags for the window, a mask of any of the following: + * ::SDL_WINDOW_FULLSCREEN, ::SDL_WINDOW_OPENGL, + * ::SDL_WINDOW_SHOWN, ::SDL_WINDOW_BORDERLESS, + * ::SDL_WINDOW_RESIZABLE, ::SDL_WINDOW_MAXIMIZED, * ::SDL_WINDOW_MINIMIZED, ::SDL_WINDOW_INPUT_GRABBED. - * + * * \return The id of the window created, or zero if window creation failed. - * + * * \sa SDL_DestroyWindow() */ extern DECLSPEC SDL_Window * SDLCALL SDL_CreateWindow(const char *title, @@ -398,11 +408,11 @@ extern DECLSPEC SDL_Window * SDLCALL SDL_CreateWindow(const char *title, /** * \brief Create an SDL window from an existing native window. - * + * * \param data A pointer to driver-dependent window creation data - * + * * \return The id of the window created, or zero if window creation failed. - * + * * \sa SDL_DestroyWindow() */ extern DECLSPEC SDL_Window * SDLCALL SDL_CreateWindowFrom(const void *data); @@ -424,7 +434,7 @@ extern DECLSPEC Uint32 SDLCALL SDL_GetWindowFlags(SDL_Window * window); /** * \brief Set the title of a window, in UTF-8 format. - * + * * \sa SDL_GetWindowTitle() */ extern DECLSPEC void SDLCALL SDL_SetWindowTitle(SDL_Window * window, @@ -432,14 +442,15 @@ extern DECLSPEC void SDLCALL SDL_SetWindowTitle(SDL_Window * window, /** * \brief Get the title of a window, in UTF-8 format. - * + * * \sa SDL_SetWindowTitle() */ extern DECLSPEC const char *SDLCALL SDL_GetWindowTitle(SDL_Window * window); /** * \brief Set the icon for a window. - * + * + * \param window The window for which the icon should be set. * \param icon The icon for the window. */ extern DECLSPEC void SDLCALL SDL_SetWindowIcon(SDL_Window * window, @@ -447,7 +458,7 @@ extern DECLSPEC void SDLCALL SDL_SetWindowIcon(SDL_Window * window, /** * \brief Associate an arbitrary named pointer with a window. - * + * * \param window The window to associate with the pointer. * \param name The name of the pointer. * \param userdata The associated pointer. @@ -464,12 +475,12 @@ extern DECLSPEC void* SDLCALL SDL_SetWindowData(SDL_Window * window, /** * \brief Retrieve the data pointer associated with a window. - * + * * \param window The window to query. * \param name The name of the pointer. * * \return The value associated with 'name' - * + * * \sa SDL_SetWindowData() */ extern DECLSPEC void *SDLCALL SDL_GetWindowData(SDL_Window * window, @@ -477,15 +488,15 @@ extern DECLSPEC void *SDLCALL SDL_GetWindowData(SDL_Window * window, /** * \brief Set the position of a window. - * + * * \param window The window to reposition. * \param x The x coordinate of the window, ::SDL_WINDOWPOS_CENTERED, or ::SDL_WINDOWPOS_UNDEFINED. * \param y The y coordinate of the window, ::SDL_WINDOWPOS_CENTERED, or ::SDL_WINDOWPOS_UNDEFINED. - * + * * \note The window coordinate origin is the upper left of the display. - * + * * \sa SDL_GetWindowPosition() */ extern DECLSPEC void SDLCALL SDL_SetWindowPosition(SDL_Window * window, @@ -493,7 +504,11 @@ extern DECLSPEC void SDLCALL SDL_SetWindowPosition(SDL_Window * window, /** * \brief Get the position of a window. - * + * + * \param window The window to query. + * \param x Pointer to variable for storing the x position, may be NULL + * \param y Pointer to variable for storing the y position, may be NULL + * * \sa SDL_SetWindowPosition() */ extern DECLSPEC void SDLCALL SDL_GetWindowPosition(SDL_Window * window, @@ -501,10 +516,14 @@ extern DECLSPEC void SDLCALL SDL_GetWindowPosition(SDL_Window * window, /** * \brief Set the size of a window's client area. - * + * + * \param window The window to resize. + * \param w The width of the window, must be >0 + * \param h The height of the window, must be >0 + * * \note You can't change the size of a fullscreen window, it automatically * matches the size of the display mode. - * + * * \sa SDL_GetWindowSize() */ extern DECLSPEC void SDLCALL SDL_SetWindowSize(SDL_Window * window, int w, @@ -512,31 +531,74 @@ extern DECLSPEC void SDLCALL SDL_SetWindowSize(SDL_Window * window, int w, /** * \brief Get the size of a window's client area. - * + * + * \param window The window to query. + * \param w Pointer to variable for storing the width, may be NULL + * \param h Pointer to variable for storing the height, may be NULL + * * \sa SDL_SetWindowSize() */ extern DECLSPEC void SDLCALL SDL_GetWindowSize(SDL_Window * window, int *w, int *h); - + /** * \brief Set the minimum size of a window's client area. * + * \param window The window to set a new minimum size. + * \param min_w The minimum width of the window, must be >0 + * \param min_h The minimum height of the window, must be >0 + * * \note You can't change the minimum size of a fullscreen window, it * automatically matches the size of the display mode. * * \sa SDL_GetWindowMinimumSize() + * \sa SDL_SetWindowMaximumSize() */ extern DECLSPEC void SDLCALL SDL_SetWindowMinimumSize(SDL_Window * window, int min_w, int min_h); - + /** * \brief Get the minimum size of a window's client area. * + * \param window The window to query. + * \param w Pointer to variable for storing the minimum width, may be NULL + * \param h Pointer to variable for storing the minimum height, may be NULL + * + * \sa SDL_GetWindowMaximumSize() * \sa SDL_SetWindowMinimumSize() */ extern DECLSPEC void SDLCALL SDL_GetWindowMinimumSize(SDL_Window * window, int *w, int *h); +/** + * \brief Set the maximum size of a window's client area. + * + * \param window The window to set a new maximum size. + * \param max_w The maximum width of the window, must be >0 + * \param max_h The maximum height of the window, must be >0 + * + * \note You can't change the maximum size of a fullscreen window, it + * automatically matches the size of the display mode. + * + * \sa SDL_GetWindowMaximumSize() + * \sa SDL_SetWindowMinimumSize() + */ +extern DECLSPEC void SDLCALL SDL_SetWindowMaximumSize(SDL_Window * window, + int max_w, int max_h); + +/** + * \brief Get the maximum size of a window's client area. + * + * \param window The window to query. + * \param w Pointer to variable for storing the maximum width, may be NULL + * \param h Pointer to variable for storing the maximum height, may be NULL + * + * \sa SDL_GetWindowMinimumSize() + * \sa SDL_SetWindowMaximumSize() + */ +extern DECLSPEC void SDLCALL SDL_GetWindowMaximumSize(SDL_Window * window, + int *w, int *h); + /** * \brief Set the border state of a window. * @@ -548,7 +610,7 @@ extern DECLSPEC void SDLCALL SDL_GetWindowMinimumSize(SDL_Window * window, * \param bordered SDL_FALSE to remove border, SDL_TRUE to add border. * * \note You can't change the border state of a fullscreen window. - * + * * \sa SDL_GetWindowFlags() */ extern DECLSPEC void SDLCALL SDL_SetWindowBordered(SDL_Window * window, @@ -556,14 +618,14 @@ extern DECLSPEC void SDLCALL SDL_SetWindowBordered(SDL_Window * window, /** * \brief Show a window. - * + * * \sa SDL_HideWindow() */ extern DECLSPEC void SDLCALL SDL_ShowWindow(SDL_Window * window); /** * \brief Hide a window. - * + * * \sa SDL_ShowWindow() */ extern DECLSPEC void SDLCALL SDL_HideWindow(SDL_Window * window); @@ -575,21 +637,21 @@ extern DECLSPEC void SDLCALL SDL_RaiseWindow(SDL_Window * window); /** * \brief Make a window as large as possible. - * + * * \sa SDL_RestoreWindow() */ extern DECLSPEC void SDLCALL SDL_MaximizeWindow(SDL_Window * window); /** * \brief Minimize a window to an iconic representation. - * + * * \sa SDL_RestoreWindow() */ extern DECLSPEC void SDLCALL SDL_MinimizeWindow(SDL_Window * window); /** * \brief Restore the size and position of a minimized or maximized window. - * + * * \sa SDL_MaximizeWindow() * \sa SDL_MinimizeWindow() */ @@ -597,19 +659,19 @@ extern DECLSPEC void SDLCALL SDL_RestoreWindow(SDL_Window * window); /** * \brief Set a window's fullscreen state. - * + * * \return 0 on success, or -1 if setting the display mode failed. - * + * * \sa SDL_SetWindowDisplayMode() * \sa SDL_GetWindowDisplayMode() */ extern DECLSPEC int SDLCALL SDL_SetWindowFullscreen(SDL_Window * window, - SDL_bool fullscreen); + Uint32 flags); /** * \brief Get the SDL surface associated with the window. * - * \return The window's framebuffer surface, or NULL on error. + * \return The window's framebuffer surface, or NULL on error. * * A new surface will be created with the optimal format for the window, * if necessary. This surface will be freed when the window is destroyed. @@ -640,14 +702,15 @@ extern DECLSPEC int SDLCALL SDL_UpdateWindowSurface(SDL_Window * window); * \sa SDL_UpdateWindowSurfaceRect() */ extern DECLSPEC int SDLCALL SDL_UpdateWindowSurfaceRects(SDL_Window * window, - SDL_Rect * rects, + const SDL_Rect * rects, int numrects); /** * \brief Set a window's input grab mode. - * + * + * \param window The window for which the input grab mode should be set. * \param grabbed This is SDL_TRUE to grab input, and SDL_FALSE to release input. - * + * * \sa SDL_GetWindowGrab() */ extern DECLSPEC void SDLCALL SDL_SetWindowGrab(SDL_Window * window, @@ -655,18 +718,18 @@ extern DECLSPEC void SDLCALL SDL_SetWindowGrab(SDL_Window * window, /** * \brief Get a window's input grab mode. - * + * * \return This returns SDL_TRUE if input is grabbed, and SDL_FALSE otherwise. - * + * * \sa SDL_SetWindowGrab() */ extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowGrab(SDL_Window * window); /** * \brief Set the brightness (gamma correction) for a window. - * + * * \return 0 on success, or -1 if setting the brightness isn't supported. - * + * * \sa SDL_GetWindowBrightness() * \sa SDL_SetWindowGammaRamp() */ @@ -674,22 +737,23 @@ extern DECLSPEC int SDLCALL SDL_SetWindowBrightness(SDL_Window * window, float b /** * \brief Get the brightness (gamma correction) for a window. - * + * * \return The last brightness value passed to SDL_SetWindowBrightness() - * + * * \sa SDL_SetWindowBrightness() */ extern DECLSPEC float SDLCALL SDL_GetWindowBrightness(SDL_Window * window); /** * \brief Set the gamma ramp for a window. - * + * + * \param window The window for which the gamma ramp should be set. * \param red The translation table for the red channel, or NULL. * \param green The translation table for the green channel, or NULL. * \param blue The translation table for the blue channel, or NULL. - * + * * \return 0 on success, or -1 if gamma ramps are unsupported. - * + * * Set the gamma translation table for the red, green, and blue channels * of the video hardware. Each table is an array of 256 16-bit quantities, * representing a mapping between the input and output for that channel. @@ -705,16 +769,17 @@ extern DECLSPEC int SDLCALL SDL_SetWindowGammaRamp(SDL_Window * window, /** * \brief Get the gamma ramp for a window. - * - * \param red A pointer to a 256 element array of 16-bit quantities to hold + * + * \param window The window from which the gamma ramp should be queried. + * \param red A pointer to a 256 element array of 16-bit quantities to hold * the translation table for the red channel, or NULL. - * \param green A pointer to a 256 element array of 16-bit quantities to hold + * \param green A pointer to a 256 element array of 16-bit quantities to hold * the translation table for the green channel, or NULL. - * \param blue A pointer to a 256 element array of 16-bit quantities to hold + * \param blue A pointer to a 256 element array of 16-bit quantities to hold * the translation table for the blue channel, or NULL. - * + * * \return 0 on success, or -1 if gamma ramps are unsupported. - * + * * \sa SDL_SetWindowGammaRamp() */ extern DECLSPEC int SDLCALL SDL_GetWindowGammaRamp(SDL_Window * window, @@ -730,7 +795,7 @@ extern DECLSPEC void SDLCALL SDL_DestroyWindow(SDL_Window * window); /** * \brief Returns whether the screensaver is currently enabled (default on). - * + * * \sa SDL_EnableScreenSaver() * \sa SDL_DisableScreenSaver() */ @@ -738,7 +803,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_IsScreenSaverEnabled(void); /** * \brief Allow the screen to be blanked by a screensaver - * + * * \sa SDL_IsScreenSaverEnabled() * \sa SDL_DisableScreenSaver() */ @@ -746,7 +811,7 @@ extern DECLSPEC void SDLCALL SDL_EnableScreenSaver(void); /** * \brief Prevent the screen from being blanked by a screensaver - * + * * \sa SDL_IsScreenSaverEnabled() * \sa SDL_EnableScreenSaver() */ @@ -760,19 +825,19 @@ extern DECLSPEC void SDLCALL SDL_DisableScreenSaver(void); /** * \brief Dynamically load an OpenGL library. - * - * \param path The platform dependent OpenGL library name, or NULL to open the + * + * \param path The platform dependent OpenGL library name, or NULL to open the * default OpenGL library. - * + * * \return 0 on success, or -1 if the library couldn't be loaded. - * + * * This should be done after initializing the video driver, but before * creating any OpenGL windows. If no OpenGL library is loaded, the default * library will be loaded upon creation of the first OpenGL window. - * + * * \note If you do this, you need to retrieve all of the GL functions used in * your program from the dynamic library using SDL_GL_GetProcAddress(). - * + * * \sa SDL_GL_GetProcAddress() * \sa SDL_GL_UnloadLibrary() */ @@ -785,13 +850,13 @@ extern DECLSPEC void *SDLCALL SDL_GL_GetProcAddress(const char *proc); /** * \brief Unload the OpenGL library previously loaded by SDL_GL_LoadLibrary(). - * + * * \sa SDL_GL_LoadLibrary() */ extern DECLSPEC void SDLCALL SDL_GL_UnloadLibrary(void); /** - * \brief Return true if an OpenGL extension is supported for the current + * \brief Return true if an OpenGL extension is supported for the current * context. */ extern DECLSPEC SDL_bool SDLCALL SDL_GL_ExtensionSupported(const char @@ -808,9 +873,9 @@ extern DECLSPEC int SDLCALL SDL_GL_SetAttribute(SDL_GLattr attr, int value); extern DECLSPEC int SDLCALL SDL_GL_GetAttribute(SDL_GLattr attr, int *value); /** - * \brief Create an OpenGL context for use with an OpenGL window, and make it + * \brief Create an OpenGL context for use with an OpenGL window, and make it * current. - * + * * \sa SDL_GL_DeleteContext() */ extern DECLSPEC SDL_GLContext SDLCALL SDL_GL_CreateContext(SDL_Window * @@ -818,7 +883,7 @@ extern DECLSPEC SDL_GLContext SDLCALL SDL_GL_CreateContext(SDL_Window * /** * \brief Set up an OpenGL context for rendering into an OpenGL window. - * + * * \note The context must have been created with a compatible window. */ extern DECLSPEC int SDLCALL SDL_GL_MakeCurrent(SDL_Window * window, @@ -826,40 +891,40 @@ extern DECLSPEC int SDLCALL SDL_GL_MakeCurrent(SDL_Window * window, /** * \brief Set the swap interval for the current OpenGL context. - * + * * \param interval 0 for immediate updates, 1 for updates synchronized with the * vertical retrace. If the system supports it, you may * specify -1 to allow late swaps to happen immediately * instead of waiting for the next retrace. - * + * * \return 0 on success, or -1 if setting the swap interval is not supported. - * + * * \sa SDL_GL_GetSwapInterval() */ extern DECLSPEC int SDLCALL SDL_GL_SetSwapInterval(int interval); /** * \brief Get the swap interval for the current OpenGL context. - * - * \return 0 if there is no vertical retrace synchronization, 1 if the buffer + * + * \return 0 if there is no vertical retrace synchronization, 1 if the buffer * swap is synchronized with the vertical retrace, and -1 if late * swaps happen immediately instead of waiting for the next retrace. * If the system can't determine the swap interval, or there isn't a * valid current context, this will return 0 as a safe default. - * + * * \sa SDL_GL_SetSwapInterval() */ extern DECLSPEC int SDLCALL SDL_GL_GetSwapInterval(void); /** - * \brief Swap the OpenGL buffers for a window, if double-buffering is + * \brief Swap the OpenGL buffers for a window, if double-buffering is * supported. */ extern DECLSPEC void SDLCALL SDL_GL_SwapWindow(SDL_Window * window); /** * \brief Delete an OpenGL context. - * + * * \sa SDL_GL_CreateContext() */ extern DECLSPEC void SDLCALL SDL_GL_DeleteContext(SDL_GLContext context); @@ -869,9 +934,7 @@ extern DECLSPEC void SDLCALL SDL_GL_DeleteContext(SDL_GLContext context); /* Ends C function definitions when using C++ */ #ifdef __cplusplus -/* *INDENT-OFF* */ } -/* *INDENT-ON* */ #endif #include "close_code.h" diff --git a/src/eepp/helper/SDL2/include/begin_code.h b/src/eepp/helper/SDL2/include/begin_code.h index b45af55ea..dd1f0616d 100644 --- a/src/eepp/helper/SDL2/include/begin_code.h +++ b/src/eepp/helper/SDL2/include/begin_code.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -37,23 +37,23 @@ #ifndef DECLSPEC # if defined(__BEOS__) || defined(__HAIKU__) # if defined(__GNUC__) -# define DECLSPEC __declspec(dllexport) +# define DECLSPEC __declspec(dllexport) # else -# define DECLSPEC __declspec(export) +# define DECLSPEC __declspec(export) # endif # elif defined(__WIN32__) # ifdef __BORLANDC__ # ifdef BUILD_SDL # define DECLSPEC # else -# define DECLSPEC __declspec(dllimport) +# define DECLSPEC __declspec(dllimport) # endif # else -# define DECLSPEC __declspec(dllexport) +# define DECLSPEC __declspec(dllexport) # endif # else # if defined(__GNUC__) && __GNUC__ >= 4 -# define DECLSPEC __attribute__ ((visibility("default"))) +# define DECLSPEC __attribute__ ((visibility("default"))) # else # define DECLSPEC # endif @@ -106,7 +106,7 @@ defined(__WATCOMC__) || defined(__LCC__) || \ defined(__DECC) #ifndef __inline__ -#define __inline__ __inline +#define __inline__ __inline #endif #define SDL_INLINE_OKAY #else @@ -128,6 +128,16 @@ #define __inline__ #endif +#ifndef SDL_FORCE_INLINE +#if defined(_MSC_VER) +#define SDL_FORCE_INLINE __forceinline +#elif ( (defined(__GNUC__) && (__GNUC__ >= 4)) || defined(__clang__) ) +#define SDL_FORCE_INLINE __attribute__((always_inline)) static inline +#else +#define SDL_FORCE_INLINE static __inline__ +#endif +#endif + /* Apparently this is needed by several Windows compilers */ #if !defined(__MACH__) #ifndef NULL diff --git a/src/eepp/helper/SDL2/include/close_code.h b/src/eepp/helper/SDL2/include/close_code.h index 51586d911..4901482d5 100644 --- a/src/eepp/helper/SDL2/include/close_code.h +++ b/src/eepp/helper/SDL2/include/close_code.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,7 +21,7 @@ /** * \file close_code.h - * + * * This file reverses the effects of begin_code.h and should be included * after you finish any function and structure declarations in your headers */ diff --git a/src/eepp/helper/SDL2/java/src/org/libsdl/app/SDLActivity.java b/src/eepp/helper/SDL2/java/src/org/libsdl/app/SDLActivity.java index dc7aa3198..04bbeff15 100644 --- a/src/eepp/helper/SDL2/java/src/org/libsdl/app/SDLActivity.java +++ b/src/eepp/helper/SDL2/java/src/org/libsdl/app/SDLActivity.java @@ -3,8 +3,8 @@ package org.libsdl.app; import javax.microedition.khronos.egl.EGL10; import javax.microedition.khronos.egl.EGLConfig; import javax.microedition.khronos.egl.EGLContext; -import javax.microedition.khronos.opengles.GL10; -import javax.microedition.khronos.egl.*; +import javax.microedition.khronos.egl.EGLDisplay; +import javax.microedition.khronos.egl.EGLSurface; import android.app.*; import android.content.*; @@ -17,42 +17,38 @@ import android.widget.AbsoluteLayout; import android.os.*; import android.util.Log; import android.graphics.*; -import android.text.method.*; -import android.text.*; import android.media.*; import android.hardware.*; -import android.content.*; - -import java.lang.*; /** SDL Activity */ public class SDLActivity extends Activity { + private static final String TAG = "SDL"; // Keep track of the paused state - public static boolean mIsPaused; + public static boolean mIsPaused = false; // Main components - private static SDLActivity mSingleton; - private static SDLSurface mSurface; - private static View mTextEdit; - private static ViewGroup mLayout; + protected static SDLActivity mSingleton; + protected static SDLSurface mSurface; + protected static View mTextEdit; + protected static ViewGroup mLayout; // This is what SDL runs in. It invokes SDL_main(), eventually - private static Thread mSDLThread; + protected static Thread mSDLThread; // Audio - private static Thread mAudioThread; - private static AudioTrack mAudioTrack; + protected static Thread mAudioThread; + protected static AudioTrack mAudioTrack; - // EGL private objects - private static EGLContext mEGLContext; - private static EGLSurface mEGLSurface; - private static EGLDisplay mEGLDisplay; - private static EGLConfig mEGLConfig; - private static int mGLMajor, mGLMinor; + // EGL objects + protected static EGLContext mEGLContext; + protected static EGLSurface mEGLSurface; + protected static EGLDisplay mEGLDisplay; + protected static EGLConfig mEGLConfig; + protected static int mGLMajor, mGLMinor; // Load the .so static { @@ -64,6 +60,7 @@ public class SDLActivity extends Activity { } // Setup + @Override protected void onCreate(Bundle savedInstanceState) { //Log.v("SDL", "onCreate()"); super.onCreate(savedInstanceState); @@ -71,9 +68,6 @@ public class SDLActivity extends Activity { // So we can call stuff from static callbacks mSingleton = this; - // Keep track of the paused state - mIsPaused = false; - // Set up the surface mSurface = new SDLSurface(getApplication()); @@ -81,23 +75,31 @@ public class SDLActivity extends Activity { mLayout.addView(mSurface); setContentView(mLayout); - - SurfaceHolder holder = mSurface.getHolder(); } // Events - /*protected void onPause() { + @Override + protected void onPause() { Log.v("SDL", "onPause()"); super.onPause(); // Don't call SDLActivity.nativePause(); here, it will be called by SDLSurface::surfaceDestroyed } + @Override protected void onResume() { Log.v("SDL", "onResume()"); super.onResume(); // Don't call SDLActivity.nativeResume(); here, it will be called via SDLSurface::surfaceChanged->SDLActivity::startApp - }*/ + } + @Override + public void onLowMemory() { + Log.v("SDL", "onLowMemory()"); + super.onLowMemory(); + SDLActivity.nativeLowMemory(); + } + + @Override protected void onDestroy() { super.onDestroy(); Log.v("SDL", "onDestroy()"); @@ -122,36 +124,72 @@ public class SDLActivity extends Activity { static final int COMMAND_UNUSED = 2; static final int COMMAND_TEXTEDIT_HIDE = 3; - // Handler for the messages - Handler commandHandler = new Handler() { + protected static final int COMMAND_USER = 0x8000; + + /** + * This method is called by SDL if SDL did not handle a message itself. + * This happens if a received message contains an unsupported command. + * Method can be overwritten to handle Messages in a different class. + * @param command the command of the message. + * @param param the parameter of the message. May be null. + * @return if the message was handled in overridden method. + */ + protected boolean onUnhandledMessage(int command, Object param) { + return false; + } + + /** + * A Handler class for Messages from native SDL applications. + * It uses current Activities as target (e.g. for the title). + * static to prevent implicit references to enclosing object. + */ + protected static class SDLCommandHandler extends Handler { @Override public void handleMessage(Message msg) { + Context context = getContext(); + if (context == null) { + Log.e(TAG, "error handling message, getContext() returned null"); + return; + } switch (msg.arg1) { case COMMAND_CHANGE_TITLE: - setTitle((String)msg.obj); + if (context instanceof Activity) { + ((Activity) context).setTitle((String)msg.obj); + } else { + Log.e(TAG, "error handling message, getContext() returned no Activity"); + } break; case COMMAND_TEXTEDIT_HIDE: if (mTextEdit != null) { mTextEdit.setVisibility(View.GONE); - InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); + InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(mTextEdit.getWindowToken(), 0); } break; + + default: + if ((context instanceof SDLActivity) && !((SDLActivity) context).onUnhandledMessage(msg.arg1, msg.obj)) { + Log.e(TAG, "error handling message, command is " + msg.arg1); + } } } - }; + } + + // Handler for the messages + Handler commandHandler = new SDLCommandHandler(); // Send a message from the SDLMain thread - void sendCommand(int command, Object data) { + boolean sendCommand(int command, Object data) { Message msg = commandHandler.obtainMessage(); msg.arg1 = command; msg.obj = data; - commandHandler.sendMessage(msg); + return commandHandler.sendMessage(msg); } // C functions we call public static native void nativeInit(); + public static native void nativeLowMemory(); public static native void nativeQuit(); public static native void nativePause(); public static native void nativeResume(); @@ -167,21 +205,21 @@ public class SDLActivity extends Activity { // Java functions called from C - public static boolean createGLContext(int majorVersion, int minorVersion) { - return initEGL(majorVersion, minorVersion); + public static boolean createGLContext(int majorVersion, int minorVersion, int[] attribs) { + return initEGL(majorVersion, minorVersion, attribs); } public static void flipBuffers() { flipEGL(); } - public static void setActivityTitle(String title) { + public static boolean setActivityTitle(String title) { // Called from SDLMain() thread and can't directly affect the view - mSingleton.sendCommand(COMMAND_CHANGE_TITLE, title); + return mSingleton.sendCommand(COMMAND_CHANGE_TITLE, title); } - public static void sendMessage(int command, int param) { - mSingleton.sendCommand(command, Integer.valueOf(param)); + public static boolean sendMessage(int command, int param) { + return mSingleton.sendCommand(command, Integer.valueOf(param)); } public static Context getContext() { @@ -206,7 +244,7 @@ public class SDLActivity extends Activity { } } - static class ShowTextInputHandler implements Runnable { + static class ShowTextInputTask implements Runnable { /* * This is used to regulate the pan&scan method to have some offset from * the bottom edge of the input region and the top edge of an input @@ -216,13 +254,14 @@ public class SDLActivity extends Activity { public int x, y, w, h; - public ShowTextInputHandler(int x, int y, int w, int h) { + public ShowTextInputTask(int x, int y, int w, int h) { this.x = x; this.y = y; this.w = w; this.h = h; } + @Override public void run() { AbsoluteLayout.LayoutParams params = new AbsoluteLayout.LayoutParams( w, h + HEIGHT_PADDING, x, y); @@ -241,17 +280,16 @@ public class SDLActivity extends Activity { InputMethodManager imm = (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE); imm.showSoftInput(mTextEdit, 0); } - } - public static void showTextInput(int x, int y, int w, int h) { + public static boolean showTextInput(int x, int y, int w, int h) { // Transfer the task to the main thread as a Runnable - mSingleton.commandHandler.post(new ShowTextInputHandler(x, y, w, h)); + return mSingleton.commandHandler.post(new ShowTextInputTask(x, y, w, h)); } // EGL functions - public static boolean initEGL(int majorVersion, int minorVersion) { + public static boolean initEGL(int majorVersion, int minorVersion, int[] attribs) { try { if (SDLActivity.mEGLDisplay == null) { Log.v("SDL", "Starting up OpenGL ES " + majorVersion + "." + minorVersion); @@ -263,22 +301,9 @@ public class SDLActivity extends Activity { int[] version = new int[2]; egl.eglInitialize(dpy, version); - int EGL_OPENGL_ES_BIT = 1; - int EGL_OPENGL_ES2_BIT = 4; - int renderableType = 0; - if (majorVersion == 2) { - renderableType = EGL_OPENGL_ES2_BIT; - } else if (majorVersion == 1) { - renderableType = EGL_OPENGL_ES_BIT; - } - int[] configSpec = { - //EGL10.EGL_DEPTH_SIZE, 16, - EGL10.EGL_RENDERABLE_TYPE, renderableType, - EGL10.EGL_NONE - }; EGLConfig[] configs = new EGLConfig[1]; int[] num_config = new int[1]; - if (!egl.eglChooseConfig(dpy, configSpec, configs, 1, num_config) || num_config[0] == 0) { + if (!egl.eglChooseConfig(dpy, attribs, configs, 1, num_config) || num_config[0] == 0) { Log.e("SDL", "No EGL config available"); return false; } @@ -366,14 +391,12 @@ public class SDLActivity extends Activity { } // Audio - private static Object buf; - - public static Object audioInit(int sampleRate, boolean is16Bit, boolean isStereo, int desiredFrames) { + public static void audioInit(int sampleRate, boolean is16Bit, boolean isStereo, int desiredFrames) { int channelConfig = isStereo ? AudioFormat.CHANNEL_CONFIGURATION_STEREO : AudioFormat.CHANNEL_CONFIGURATION_MONO; int audioFormat = is16Bit ? AudioFormat.ENCODING_PCM_16BIT : AudioFormat.ENCODING_PCM_8BIT; int frameSize = (isStereo ? 2 : 1) * (is16Bit ? 2 : 1); - Log.v("SDL", "SDL audio: wanted " + (isStereo ? "stereo" : "mono") + " " + (is16Bit ? "16-bit" : "8-bit") + " " + ((float)sampleRate / 1000f) + "kHz, " + desiredFrames + " frames buffer"); + Log.v("SDL", "SDL audio: wanted " + (isStereo ? "stereo" : "mono") + " " + (is16Bit ? "16-bit" : "8-bit") + " " + (sampleRate / 1000f) + "kHz, " + desiredFrames + " frames buffer"); // Let the user pick a larger buffer if they really want -- but ye // gods they probably shouldn't, the minimums are horrifyingly high @@ -385,18 +408,12 @@ public class SDLActivity extends Activity { audioStartThread(); - Log.v("SDL", "SDL audio: got " + ((mAudioTrack.getChannelCount() >= 2) ? "stereo" : "mono") + " " + ((mAudioTrack.getAudioFormat() == AudioFormat.ENCODING_PCM_16BIT) ? "16-bit" : "8-bit") + " " + ((float)mAudioTrack.getSampleRate() / 1000f) + "kHz, " + desiredFrames + " frames buffer"); - - if (is16Bit) { - buf = new short[desiredFrames * (isStereo ? 2 : 1)]; - } else { - buf = new byte[desiredFrames * (isStereo ? 2 : 1)]; - } - return buf; + Log.v("SDL", "SDL audio: got " + ((mAudioTrack.getChannelCount() >= 2) ? "stereo" : "mono") + " " + ((mAudioTrack.getAudioFormat() == AudioFormat.ENCODING_PCM_16BIT) ? "16-bit" : "8-bit") + " " + (mAudioTrack.getSampleRate() / 1000f) + "kHz, " + desiredFrames + " frames buffer"); } public static void audioStartThread() { mAudioThread = new Thread(new Runnable() { + @Override public void run() { mAudioTrack.play(); nativeRunAudioThread(); @@ -438,7 +455,7 @@ public class SDLActivity extends Activity { // Nom nom } } else { - Log.w("SDL", "SDL audio: error return from write(short)"); + Log.w("SDL", "SDL audio: error return from write(byte)"); return; } } @@ -467,6 +484,7 @@ public class SDLActivity extends Activity { Simple nativeInit() runnable */ class SDLMain implements Runnable { + @Override public void run() { // Runs SDL_main() SDLActivity.nativeInit(); @@ -486,10 +504,10 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback, View.OnKeyListener, View.OnTouchListener, SensorEventListener { // Sensors - private static SensorManager mSensorManager; + protected static SensorManager mSensorManager; // Keep track of the surface size to normalize touch events - private static float mWidth, mHeight; + protected static float mWidth, mHeight; // Startup public SDLSurface(Context context) { @@ -502,7 +520,7 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback, setOnKeyListener(this); setOnTouchListener(this); - mSensorManager = (SensorManager)context.getSystemService("sensor"); + mSensorManager = (SensorManager)context.getSystemService(Context.SENSOR_SERVICE); // Some arbitrary defaults to avoid a potential division by zero mWidth = 1.0f; @@ -510,6 +528,7 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback, } // Called when we have a valid drawing surface + @Override public void surfaceCreated(SurfaceHolder holder) { Log.v("SDL", "surfaceCreated()"); holder.setType(SurfaceHolder.SURFACE_TYPE_GPU); @@ -517,6 +536,7 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback, } // Called when we lose the surface + @Override public void surfaceDestroyed(SurfaceHolder holder) { Log.v("SDL", "surfaceDestroyed()"); if (!SDLActivity.mIsPaused) { @@ -527,11 +547,12 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback, } // Called when the surface is resized + @Override public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) { Log.v("SDL", "surfaceChanged()"); - int sdlFormat = 0x85151002; // SDL_PIXELFORMAT_RGB565 by default + int sdlFormat = 0x15151002; // SDL_PIXELFORMAT_RGB565 by default switch (format) { case PixelFormat.A_8: Log.v("SDL", "pixel format A_8"); @@ -544,40 +565,40 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback, break; case PixelFormat.RGBA_4444: Log.v("SDL", "pixel format RGBA_4444"); - sdlFormat = 0x85421002; // SDL_PIXELFORMAT_RGBA4444 + sdlFormat = 0x15421002; // SDL_PIXELFORMAT_RGBA4444 break; case PixelFormat.RGBA_5551: Log.v("SDL", "pixel format RGBA_5551"); - sdlFormat = 0x85441002; // SDL_PIXELFORMAT_RGBA5551 + sdlFormat = 0x15441002; // SDL_PIXELFORMAT_RGBA5551 break; case PixelFormat.RGBA_8888: Log.v("SDL", "pixel format RGBA_8888"); - sdlFormat = 0x86462004; // SDL_PIXELFORMAT_RGBA8888 + sdlFormat = 0x16462004; // SDL_PIXELFORMAT_RGBA8888 break; case PixelFormat.RGBX_8888: Log.v("SDL", "pixel format RGBX_8888"); - sdlFormat = 0x86262004; // SDL_PIXELFORMAT_RGBX8888 + sdlFormat = 0x16261804; // SDL_PIXELFORMAT_RGBX8888 break; case PixelFormat.RGB_332: Log.v("SDL", "pixel format RGB_332"); - sdlFormat = 0x84110801; // SDL_PIXELFORMAT_RGB332 + sdlFormat = 0x14110801; // SDL_PIXELFORMAT_RGB332 break; case PixelFormat.RGB_565: Log.v("SDL", "pixel format RGB_565"); - sdlFormat = 0x85151002; // SDL_PIXELFORMAT_RGB565 + sdlFormat = 0x15151002; // SDL_PIXELFORMAT_RGB565 break; case PixelFormat.RGB_888: Log.v("SDL", "pixel format RGB_888"); // Not sure this is right, maybe SDL_PIXELFORMAT_RGB24 instead? - sdlFormat = 0x86161804; // SDL_PIXELFORMAT_RGB888 + sdlFormat = 0x16161804; // SDL_PIXELFORMAT_RGB888 break; default: Log.v("SDL", "pixel format unknown " + format); break; } - mWidth = (float) width; - mHeight = (float) height; + mWidth = width; + mHeight = height; SDLActivity.onNativeResize(width, height, sdlFormat); Log.v("SDL", "Window size:" + width + "x"+height); @@ -585,12 +606,12 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback, } // unused + @Override public void onDraw(Canvas canvas) {} - - // Key events + @Override public boolean onKey(View v, int keyCode, KeyEvent event) { if (event.getAction() == KeyEvent.ACTION_DOWN) { @@ -608,12 +629,12 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback, } // Touch events + @Override public boolean onTouch(View v, MotionEvent event) { - { final int touchDevId = event.getDeviceId(); final int pointerCount = event.getPointerCount(); // touchId, pointerId, action, x, y, pressure - int actionPointerIndex = (event.getAction() & MotionEvent.ACTION_POINTER_ID_MASK) >> MotionEvent. ACTION_POINTER_ID_SHIFT; /* API 8: event.getActionIndex(); */ + int actionPointerIndex = (event.getAction() & MotionEvent.ACTION_POINTER_ID_MASK) >> MotionEvent.ACTION_POINTER_ID_SHIFT; /* API 8: event.getActionIndex(); */ int pointerFingerId = event.getPointerId(actionPointerIndex); int action = (event.getAction() & MotionEvent.ACTION_MASK); /* API 8: event.getActionMasked(); */ @@ -634,7 +655,6 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback, } else { SDLActivity.onNativeTouch(touchDevId, pointerFingerId, action, x, y, p); } - } return true; } @@ -651,10 +671,12 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback, } } + @Override public void onAccuracyChanged(Sensor sensor, int accuracy) { // TODO } + @Override public void onSensorChanged(SensorEvent event) { if (event.sensor.getType() == Sensor.TYPE_ACCELEROMETER) { SDLActivity.onNativeAccel(event.values[0] / SensorManager.GRAVITY_EARTH, @@ -683,6 +705,7 @@ class DummyEdit extends View implements View.OnKeyListener { return true; } + @Override public boolean onKey(View v, int keyCode, KeyEvent event) { // This handles the hardware keyboard input @@ -731,7 +754,9 @@ class SDLInputConnection extends BaseInputConnection { */ int keyCode = event.getKeyCode(); if (event.getAction() == KeyEvent.ACTION_DOWN) { - + if (event.isPrintingKey()) { + commitText(String.valueOf((char) event.getUnicodeChar()), 1); + } SDLActivity.onNativeKeyDown(keyCode); return true; } else if (event.getAction() == KeyEvent.ACTION_UP) { diff --git a/src/eepp/helper/SDL2/src/SDL.c b/src/eepp/helper/SDL2/src/SDL.c index 0cf39ecc1..5f28373a1 100644 --- a/src/eepp/helper/SDL2/src/SDL.c +++ b/src/eepp/helper/SDL2/src/SDL.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -23,6 +23,7 @@ /* Initialization code for SDL */ #include "SDL.h" +#include "SDL_bits.h" #include "SDL_revision.h" #include "SDL_fatal.h" #include "SDL_assert_c.h" @@ -31,145 +32,157 @@ /* Initialization/Cleanup routines */ #if !SDL_TIMERS_DISABLED -extern void SDL_StartTicks(void); extern int SDL_TimerInit(void); extern void SDL_TimerQuit(void); +extern void SDL_InitTicks(void); #endif -#if defined(__WIN32__) +#if SDL_VIDEO_DRIVER_WINDOWS extern int SDL_HelperWindowCreate(void); extern int SDL_HelperWindowDestroy(void); #endif /* The initialized subsystems */ -static Uint32 SDL_initialized = 0; -static Uint32 ticks_started = 0; static SDL_bool SDL_bInMainQuit = SDL_FALSE; -static Uint8 SDL_SubsystemRefCount[ 32 ]; // keep a per subsystem init +static Uint8 SDL_SubsystemRefCount[ 32 ]; -/* helper func to return the index of the MSB in an int */ -int msb32_idx( Uint32 n) +/* Private helper to increment a subsystem's ref counter. */ +static void +SDL_PrivateSubsystemRefCountIncr(Uint32 subsystem) { - int b = 0; - if (!n) return -1; + int subsystem_index = SDL_MostSignificantBitIndex32(subsystem); + SDL_assert(SDL_SubsystemRefCount[subsystem_index] < 255); + ++SDL_SubsystemRefCount[subsystem_index]; +} -#define step(x) if (n >= ((Uint32)1) << x) b += x, n >>= x - step(16); step(8); step(4); step(2); step(1); -#undef step - return b; +/* Private helper to decrement a subsystem's ref counter. */ +static void +SDL_PrivateSubsystemRefCountDecr(Uint32 subsystem) +{ + int subsystem_index = SDL_MostSignificantBitIndex32(subsystem); + if (SDL_SubsystemRefCount[subsystem_index] > 0) { + --SDL_SubsystemRefCount[subsystem_index]; + } +} + +/* Private helper to check if a system needs init. */ +static SDL_bool +SDL_PrivateShouldInitSubsystem(Uint32 subsystem) +{ + int subsystem_index = SDL_MostSignificantBitIndex32(subsystem); + SDL_assert(SDL_SubsystemRefCount[subsystem_index] < 255); + return (SDL_SubsystemRefCount[subsystem_index] == 0); +} + +/* Private helper to check if a system needs to be quit. */ +static SDL_bool +SDL_PrivateShouldQuitSubsystem(Uint32 subsystem) { + int subsystem_index = SDL_MostSignificantBitIndex32(subsystem); + if (SDL_SubsystemRefCount[subsystem_index] == 0) { + return SDL_FALSE; + } + + /* If we're in SDL_Quit, we shut down every subsystem, even if refcount + * isn't zero. + */ + return SDL_SubsystemRefCount[subsystem_index] == 1 || SDL_bInMainQuit; } int SDL_InitSubSystem(Uint32 flags) { #if !SDL_TIMERS_DISABLED + SDL_InitTicks(); +#endif + /* Initialize the timer subsystem */ - if (!ticks_started) { - SDL_StartTicks(); - ticks_started = 1; - } - if ((flags & SDL_INIT_TIMER) ){ - SDL_SubsystemRefCount[ msb32_idx(SDL_INIT_TIMER) ]++; - SDL_assert( SDL_SubsystemRefCount[ msb32_idx(SDL_INIT_TIMER) ] < 254 ); - if ( !(SDL_initialized & SDL_INIT_TIMER)) { - if (SDL_TimerInit() < 0) { - return (-1); - } - SDL_initialized |= SDL_INIT_TIMER; - } - } -#else - if (flags & SDL_INIT_TIMER) { - SDL_SetError("SDL not built with timer support"); - return (-1); - } -#endif - -#if !SDL_VIDEO_DISABLED - /* Initialize the video/event subsystem */ - if ((flags & SDL_INIT_VIDEO) ) { - SDL_SubsystemRefCount[ msb32_idx(SDL_INIT_VIDEO) ]++; - SDL_assert( SDL_SubsystemRefCount[ msb32_idx(SDL_INIT_VIDEO) ] < 254 ); - if ( !(SDL_initialized & SDL_INIT_VIDEO)) { - if (SDL_VideoInit(NULL) < 0) { - return (-1); - } - SDL_initialized |= SDL_INIT_VIDEO; - } - } -#else - if (flags & SDL_INIT_VIDEO) { - SDL_SetError("SDL not built with video support"); - return (-1); - } -#endif - -#if !SDL_AUDIO_DISABLED - /* Initialize the audio subsystem */ - if ((flags & SDL_INIT_AUDIO) ) { - SDL_SubsystemRefCount[ msb32_idx(SDL_INIT_AUDIO) ]++; - SDL_assert( SDL_SubsystemRefCount[ msb32_idx(SDL_INIT_AUDIO) ] < 254 ); - if ( !(SDL_initialized & SDL_INIT_AUDIO)) { - if (SDL_AudioInit(NULL) < 0) { - return (-1); - } - SDL_initialized |= SDL_INIT_AUDIO; - } - } -#else - if (flags & SDL_INIT_AUDIO) { - SDL_SetError("SDL not built with audio support"); - return (-1); - } -#endif - -#if !SDL_JOYSTICK_DISABLED - /* Initialize the joystick subsystem */ - if ( ( (flags & SDL_INIT_JOYSTICK) ) || ((flags & SDL_INIT_GAMECONTROLLER) ) ) { // game controller implies joystick - SDL_SubsystemRefCount[ msb32_idx(SDL_INIT_JOYSTICK) ]++; - SDL_assert( SDL_SubsystemRefCount[ msb32_idx(SDL_INIT_JOYSTICK) ] < 254 ); - if ( !(SDL_initialized & SDL_INIT_JOYSTICK) && SDL_JoystickInit() < 0) { - return (-1); +#if !SDL_TIMERS_DISABLED + if (SDL_PrivateShouldInitSubsystem(SDL_INIT_TIMER)) { + if (SDL_TimerInit() < 0) { + return (-1); + } } - - if ((flags & SDL_INIT_GAMECONTROLLER) ) { - SDL_SubsystemRefCount[ msb32_idx(SDL_INIT_GAMECONTROLLER) ]++; - SDL_assert( SDL_SubsystemRefCount[ msb32_idx(SDL_INIT_GAMECONTROLLER) ] < 254 ); - if ( !(SDL_initialized & SDL_INIT_GAMECONTROLLER)) { - if (SDL_GameControllerInit() < 0) { - return (-1); - } - SDL_initialized |= SDL_INIT_GAMECONTROLLER; - } - } - SDL_initialized |= SDL_INIT_JOYSTICK; - } + SDL_PrivateSubsystemRefCountIncr(SDL_INIT_TIMER); #else - if (flags & SDL_INIT_JOYSTICK) { - SDL_SetError("SDL not built with joystick support"); - return (-1); - } + return SDL_SetError("SDL not built with timer support"); #endif + } + + /* Initialize the video/event subsystem */ + if ((flags & SDL_INIT_VIDEO) ){ +#if !SDL_VIDEO_DISABLED + if (SDL_PrivateShouldInitSubsystem(SDL_INIT_VIDEO)) { + if (SDL_VideoInit(NULL) < 0) { + return (-1); + } + } + SDL_PrivateSubsystemRefCountIncr(SDL_INIT_VIDEO); +#else + return SDL_SetError("SDL not built with video support"); +#endif + } + + /* Initialize the audio subsystem */ + if ((flags & SDL_INIT_AUDIO) ){ +#if !SDL_AUDIO_DISABLED + if (SDL_PrivateShouldInitSubsystem(SDL_INIT_AUDIO)) { + if (SDL_AudioInit(NULL) < 0) { + return (-1); + } + } + SDL_PrivateSubsystemRefCountIncr(SDL_INIT_AUDIO); +#else + return SDL_SetError("SDL not built with audio support"); +#endif + } + + if ((flags & SDL_INIT_GAMECONTROLLER)) { + /* Game controller implies Joystick. */ + flags |= SDL_INIT_JOYSTICK; + } + + /* Initialize the joystick subsystem */ + if ((flags & SDL_INIT_JOYSTICK) ){ +#if !SDL_JOYSTICK_DISABLED + if (SDL_PrivateShouldInitSubsystem(SDL_INIT_JOYSTICK)) { + if (SDL_JoystickInit() < 0) { + return (-1); + } + } + SDL_PrivateSubsystemRefCountIncr(SDL_INIT_JOYSTICK); +#else + return SDL_SetError("SDL not built with joystick support"); +#endif + } + + if ((flags & SDL_INIT_GAMECONTROLLER) ){ +#if !SDL_JOYSTICK_DISABLED + if (SDL_PrivateShouldInitSubsystem(SDL_INIT_GAMECONTROLLER)) { + if (SDL_GameControllerInit() < 0) { + return (-1); + } + } + SDL_PrivateSubsystemRefCountIncr(SDL_INIT_GAMECONTROLLER); +#else + return SDL_SetError("SDL not built with joystick support"); +#endif + } -#if !SDL_HAPTIC_DISABLED /* Initialize the haptic subsystem */ - if ((flags & SDL_INIT_HAPTIC) ) { - SDL_SubsystemRefCount[ msb32_idx(SDL_INIT_HAPTIC) ]++; - SDL_assert( SDL_SubsystemRefCount[ msb32_idx(SDL_INIT_HAPTIC) ] < 254 ); - if ( !(SDL_initialized & SDL_INIT_HAPTIC)) { - if (SDL_HapticInit() < 0) { - return (-1); - } - SDL_initialized |= SDL_INIT_HAPTIC; - } - } + if ((flags & SDL_INIT_HAPTIC) ){ +#if !SDL_HAPTIC_DISABLED + if (SDL_PrivateShouldInitSubsystem(SDL_INIT_HAPTIC)) { + if (SDL_HapticInit() < 0) { + return (-1); + } + } + SDL_PrivateSubsystemRefCountIncr(SDL_INIT_HAPTIC); #else - if (flags & SDL_INIT_HAPTIC) { - SDL_SetError("SDL not built with haptic (force feedback) support"); - return (-1); - } + return SDL_SetError("SDL not built with haptic (force feedback) support"); #endif + } + return (0); } @@ -183,7 +196,7 @@ SDL_Init(Uint32 flags) /* Clear the error message */ SDL_ClearError(); -#if defined(__WIN32__) +#if SDL_VIDEO_DRIVER_WINDOWS if (SDL_HelperWindowCreate() < 0) { return -1; } @@ -199,7 +212,6 @@ SDL_Init(Uint32 flags) SDL_InstallParachute(); } - SDL_memset( SDL_SubsystemRefCount, 0x0, sizeof(SDL_SubsystemRefCount) ); return (0); } @@ -208,62 +220,57 @@ SDL_QuitSubSystem(Uint32 flags) { /* Shut down requested initialized subsystems */ #if !SDL_JOYSTICK_DISABLED - if ((flags & SDL_initialized & SDL_INIT_JOYSTICK) || (flags & SDL_initialized & SDL_INIT_GAMECONTROLLER)) { - if ( (flags & SDL_initialized & SDL_INIT_GAMECONTROLLER) ) { - SDL_SubsystemRefCount[ msb32_idx(SDL_INIT_GAMECONTROLLER) ]--; - if ( SDL_bInMainQuit || SDL_SubsystemRefCount[ msb32_idx(SDL_INIT_GAMECONTROLLER) ] == 0 ) { - SDL_GameControllerQuit(); - SDL_initialized &= ~SDL_INIT_GAMECONTROLLER; - } - } + if ((flags & SDL_INIT_GAMECONTROLLER)) { + /* Game controller implies Joystick. */ + flags |= SDL_INIT_JOYSTICK; - SDL_SubsystemRefCount[ msb32_idx(SDL_INIT_JOYSTICK) ]--; - if ( SDL_bInMainQuit || SDL_SubsystemRefCount[ msb32_idx(SDL_INIT_JOYSTICK) ] == 0 ) - { - SDL_JoystickQuit(); - SDL_initialized &= ~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_PrivateSubsystemRefCountDecr(SDL_INIT_JOYSTICK); } #endif + #if !SDL_HAPTIC_DISABLED - if ((flags & SDL_initialized & SDL_INIT_HAPTIC)) { - SDL_SubsystemRefCount[ msb32_idx(SDL_INIT_HAPTIC) ]--; - if ( SDL_bInMainQuit || SDL_SubsystemRefCount[ msb32_idx(SDL_INIT_HAPTIC) ] == 0 ) - { - SDL_HapticQuit(); - SDL_initialized &= ~SDL_INIT_HAPTIC; - } + if ((flags & SDL_INIT_HAPTIC)) { + if (SDL_PrivateShouldQuitSubsystem(SDL_INIT_HAPTIC)) { + SDL_HapticQuit(); + } + SDL_PrivateSubsystemRefCountDecr(SDL_INIT_HAPTIC); } #endif + #if !SDL_AUDIO_DISABLED - if ((flags & SDL_initialized & SDL_INIT_AUDIO)) { - SDL_SubsystemRefCount[ msb32_idx(SDL_INIT_AUDIO) ]--; - if ( SDL_bInMainQuit || SDL_SubsystemRefCount[ msb32_idx(SDL_INIT_AUDIO) ] == 0 ) - { - SDL_AudioQuit(); - SDL_initialized &= ~SDL_INIT_AUDIO; - } + if ((flags & SDL_INIT_AUDIO)) { + if (SDL_PrivateShouldQuitSubsystem(SDL_INIT_AUDIO)) { + SDL_AudioQuit(); + } + SDL_PrivateSubsystemRefCountDecr(SDL_INIT_AUDIO); } #endif + #if !SDL_VIDEO_DISABLED - if ((flags & SDL_initialized & SDL_INIT_VIDEO)) { - SDL_SubsystemRefCount[ msb32_idx(SDL_INIT_VIDEO) ]--; - if ( SDL_bInMainQuit || SDL_SubsystemRefCount[ msb32_idx(SDL_INIT_VIDEO) ] == 0 ) - { - SDL_VideoQuit(); - SDL_initialized &= ~SDL_INIT_VIDEO; - } + if ((flags & SDL_INIT_VIDEO)) { + if (SDL_PrivateShouldQuitSubsystem(SDL_INIT_VIDEO)) { + SDL_VideoQuit(); + } + SDL_PrivateSubsystemRefCountDecr(SDL_INIT_VIDEO); } #endif + #if !SDL_TIMERS_DISABLED - if ((flags & SDL_initialized & SDL_INIT_TIMER)) { - SDL_SubsystemRefCount[ msb32_idx(SDL_INIT_TIMER) ]--; - if ( SDL_bInMainQuit || SDL_SubsystemRefCount[ msb32_idx(SDL_INIT_TIMER) ] == 0 ) - { - SDL_TimerQuit(); - SDL_initialized &= ~SDL_INIT_TIMER; - } + if ((flags & SDL_INIT_TIMER)) { + if (SDL_PrivateShouldQuitSubsystem(SDL_INIT_TIMER)) { + SDL_TimerQuit(); + } + SDL_PrivateSubsystemRefCountDecr(SDL_INIT_TIMER); } #endif } @@ -271,18 +278,35 @@ SDL_QuitSubSystem(Uint32 flags) Uint32 SDL_WasInit(Uint32 flags) { + int i; + int num_subsystems = SDL_arraysize(SDL_SubsystemRefCount); + Uint32 initialized = 0; + if (!flags) { flags = SDL_INIT_EVERYTHING; } - return (SDL_initialized & flags); + + num_subsystems = SDL_min(num_subsystems, SDL_MostSignificantBitIndex32(flags) + 1); + + /* Iterate over each bit in flags, and check the matching subsystem. */ + for (i = 0; i < num_subsystems; ++i) { + if ((flags & 1) && SDL_SubsystemRefCount[i] > 0) { + initialized |= (1 << i); + } + + flags >>= 1; + } + + return initialized; } void SDL_Quit(void) { - SDL_bInMainQuit = SDL_TRUE; + SDL_bInMainQuit = SDL_TRUE; + /* Quit all subsystems */ -#if defined(__WIN32__) +#if SDL_VIDEO_DRIVER_WINDOWS SDL_HelperWindowDestroy(); #endif SDL_QuitSubSystem(SDL_INIT_EVERYTHING); @@ -294,8 +318,12 @@ SDL_Quit(void) SDL_AssertionsQuit(); SDL_LogResetPriorities(); - SDL_memset( SDL_SubsystemRefCount, 0x0, sizeof(SDL_SubsystemRefCount) ); - SDL_bInMainQuit = SDL_FALSE; + /* Now that every subsystem has been quit, we reset the subsystem refcount + * and the list of initialized subsystems. + */ + SDL_memset( SDL_SubsystemRefCount, 0x0, sizeof(SDL_SubsystemRefCount) ); + + SDL_bInMainQuit = SDL_FALSE; } /* Get the library version number */ @@ -352,8 +380,6 @@ SDL_GetPlatform() return "Mac OS X"; #elif __NETBSD__ return "NetBSD"; -#elif __NDS__ - return "Nintendo DS"; #elif __OPENBSD__ return "OpenBSD"; #elif __OS2__ @@ -370,6 +396,8 @@ SDL_GetPlatform() return "Windows"; #elif __IPHONEOS__ return "iPhone OS"; +#elif __PSP__ + return "PlayStation Portable"; #else return "Unknown (see SDL_platform.h)"; #endif @@ -398,4 +426,4 @@ _DllMainCRTStartup(HANDLE hModule, #endif /* __WIN32__ */ -/* vi: set ts=4 sw=4 expandtab: */ +/* vi: set sts=4 ts=4 sw=4 expandtab: */ diff --git a/src/eepp/helper/SDL2/src/SDL_assert.c b/src/eepp/helper/SDL2/src/SDL_assert.c index 1d0fd0539..f1eb25597 100644 --- a/src/eepp/helper/SDL2/src/SDL_assert.c +++ b/src/eepp/helper/SDL2/src/SDL_assert.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -126,6 +126,12 @@ static void SDL_AbortAssertion(void) static SDL_assert_state SDL_PromptAssertion(const SDL_assert_data *data, void *userdata) { +#ifdef __WIN32__ + #define ENDLINE "\r\n" +#else + #define ENDLINE "\n" +#endif + const char *envr; SDL_assert_state state = SDL_ASSERTION_ABORT; SDL_Window *window; @@ -150,7 +156,8 @@ SDL_PromptAssertion(const SDL_assert_data *data, void *userdata) return SDL_ASSERTION_ABORT; } SDL_snprintf(message, SDL_MAX_LOG_MESSAGE, - "Assertion failure at %s (%s:%d), triggered %u %s:\r\n '%s'", + "Assertion failure at %s (%s:%d), triggered %u %s:" ENDLINE + " '%s'", data->function, data->filename, data->linenum, data->trigger_count, (data->trigger_count == 1) ? "time" : "times", data->condition); diff --git a/src/eepp/helper/SDL2/src/SDL_assert_c.h b/src/eepp/helper/SDL2/src/SDL_assert_c.h index d9d9ac341..12b1aa5e9 100644 --- a/src/eepp/helper/SDL2/src/SDL_assert_c.h +++ b/src/eepp/helper/SDL2/src/SDL_assert_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/SDL_error.c b/src/eepp/helper/SDL2/src/SDL_error.c index 306dfe2ba..98ef84ac6 100644 --- a/src/eepp/helper/SDL2/src/SDL_error.c +++ b/src/eepp/helper/SDL2/src/SDL_error.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -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 */ @@ -49,15 +49,15 @@ SDL_LookupString(const char *key) /* Public functions */ -void +int SDL_SetError(const char *fmt, ...) { va_list ap; SDL_error *error; /* Ignore call if invalid format pointer was passed */ - if (fmt == NULL) return; - + if (fmt == NULL) return -1; + /* Copy in the key, mark error as valid */ error = SDL_GetErrBuf(); error->error = 1; @@ -112,6 +112,8 @@ SDL_SetError(const char *fmt, ...) /* If we are in debug mode, print out an error message */ SDL_LogError(SDL_LOG_CATEGORY_ERROR, "%s", SDL_GetError()); + + return -1; } /* This function has a bit more overhead than most error functions @@ -216,28 +218,22 @@ SDL_ClearError(void) } /* Very common errors go here */ -void +int SDL_Error(SDL_errorcode code) { switch (code) { case SDL_ENOMEM: - SDL_SetError("Out of memory"); - break; + return SDL_SetError("Out of memory"); case SDL_EFREAD: - SDL_SetError("Error reading from datastream"); - break; + return SDL_SetError("Error reading from datastream"); case SDL_EFWRITE: - SDL_SetError("Error writing to datastream"); - break; + return SDL_SetError("Error writing to datastream"); case SDL_EFSEEK: - SDL_SetError("Error seeking in datastream"); - break; + return SDL_SetError("Error seeking in datastream"); case SDL_UNSUPPORTED: - SDL_SetError("That operation is not supported"); - break; + return SDL_SetError("That operation is not supported"); default: - SDL_SetError("Unknown SDL error"); - break; + return SDL_SetError("Unknown SDL error"); } } diff --git a/src/eepp/helper/SDL2/src/SDL_error_c.h b/src/eepp/helper/SDL2/src/SDL_error_c.h index c887faf0a..2014cc1e7 100644 --- a/src/eepp/helper/SDL2/src/SDL_error_c.h +++ b/src/eepp/helper/SDL2/src/SDL_error_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -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/eepp/helper/SDL2/src/SDL_fatal.c b/src/eepp/helper/SDL2/src/SDL_fatal.c index f68787e68..cf19e57e0 100644 --- a/src/eepp/helper/SDL2/src/SDL_fatal.c +++ b/src/eepp/helper/SDL2/src/SDL_fatal.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/SDL_fatal.h b/src/eepp/helper/SDL2/src/SDL_fatal.h index 356256fcf..3a81689b9 100644 --- a/src/eepp/helper/SDL2/src/SDL_fatal.h +++ b/src/eepp/helper/SDL2/src/SDL_fatal.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/SDL_hints.c b/src/eepp/helper/SDL2/src/SDL_hints.c index 72fd6c230..bd9404d46 100644 --- a/src/eepp/helper/SDL2/src/SDL_hints.c +++ b/src/eepp/helper/SDL2/src/SDL_hints.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -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/eepp/helper/SDL2/src/SDL_hints_c.h b/src/eepp/helper/SDL2/src/SDL_hints_c.h index 715ca67d6..232e26384 100644 --- a/src/eepp/helper/SDL2/src/SDL_hints_c.h +++ b/src/eepp/helper/SDL2/src/SDL_hints_c.h @@ -1,15 +1,15 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga - + Copyright (C) 1997-2013 Sam Lantinga + 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/eepp/helper/SDL2/src/SDL_log.c b/src/eepp/helper/SDL2/src/SDL_log.c index b4f524326..df6e1e6d4 100644 --- a/src/eepp/helper/SDL2/src/SDL_log.c +++ b/src/eepp/helper/SDL2/src/SDL_log.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -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) { @@ -299,9 +299,9 @@ SDL_LogOutput(void *userdata, int category, SDL_LogPriority priority, size_t length; LPTSTR tstr; - length = SDL_strlen(SDL_priority_prefixes[priority]) + 2 + SDL_strlen(message) + 1; + length = SDL_strlen(SDL_priority_prefixes[priority]) + 2 + SDL_strlen(message) + 1 + 1; output = SDL_stack_alloc(char, length); - SDL_snprintf(output, length, "%s: %s", SDL_priority_prefixes[priority], message); + SDL_snprintf(output, length, "%s: %s\n", SDL_priority_prefixes[priority], message); tstr = WIN_UTF8ToString(output); OutputDebugString(tstr); SDL_free(tstr); @@ -327,6 +327,19 @@ SDL_LogOutput(void *userdata, int category, SDL_LogPriority priority, return; } } +#elif defined(__PSP__) + { + 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); + } #endif #if HAVE_STDIO_H fprintf(stderr, "%s: %s\n", SDL_priority_prefixes[priority], message); diff --git a/src/eepp/helper/SDL2/src/atomic/SDL_atomic.c b/src/eepp/helper/SDL2/src/atomic/SDL_atomic.c index d8be4c89d..cd799dea7 100644 --- a/src/eepp/helper/SDL2/src/atomic/SDL_atomic.c +++ b/src/eepp/helper/SDL2/src/atomic/SDL_atomic.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -27,8 +27,10 @@ doesn't have that compiler. That way we always have a working set of atomic operations built into the library. */ - -/* +#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 @@ -38,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 @@ -69,8 +71,8 @@ leaveLock(void *a) SDL_AtomicUnlock(&locks[index]); } -SDL_bool -SDL_AtomicCAS_(SDL_atomic_t *a, int oldval, int newval) +DECLSPEC SDL_bool SDLCALL +SDL_AtomicCAS(SDL_atomic_t *a, int oldval, int newval) { SDL_bool retval = SDL_FALSE; @@ -84,8 +86,8 @@ SDL_AtomicCAS_(SDL_atomic_t *a, int oldval, int newval) return retval; } -SDL_bool -SDL_AtomicCASPtr_(void **a, void *oldval, void *newval) +DECLSPEC SDL_bool SDLCALL +SDL_AtomicCASPtr(void **a, void *oldval, void *newval) { SDL_bool retval = SDL_FALSE; diff --git a/src/eepp/helper/SDL2/src/atomic/SDL_spinlock.c b/src/eepp/helper/SDL2/src/atomic/SDL_spinlock.c index ab3c5cb31..f3aeea0e2 100644 --- a/src/eepp/helper/SDL2/src/atomic/SDL_spinlock.c +++ b/src/eepp/helper/SDL2/src/atomic/SDL_spinlock.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -41,13 +41,13 @@ SDL_AtomicTryLock(SDL_SpinLock *lock) /* Race condition on first lock... */ _spinlock_mutex = SDL_CreateMutex(); } - SDL_mutexP(_spinlock_mutex); + SDL_LockMutex(_spinlock_mutex); if (*lock == 0) { *lock = 1; - SDL_mutexV(_spinlock_mutex); + SDL_UnlockMutex(_spinlock_mutex); return SDL_TRUE; } else { - SDL_mutexV(_spinlock_mutex); + SDL_UnlockMutex(_spinlock_mutex); return SDL_FALSE; } @@ -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/eepp/helper/SDL2/src/audio/SDL_audio.c b/src/eepp/helper/SDL2/src/audio/SDL_audio.c index 8ef616a56..f6763f9b6 100644 --- a/src/eepp/helper/SDL2/src/audio/SDL_audio.c +++ b/src/eepp/helper/SDL2/src/audio/SDL_audio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -66,7 +66,7 @@ extern AudioBootStrap DART_bootstrap; extern AudioBootStrap NDSAUD_bootstrap; extern AudioBootStrap FUSIONSOUND_bootstrap; extern AudioBootStrap ANDROIDAUD_bootstrap; - +extern AudioBootStrap PSPAUD_bootstrap; /* Available audio drivers */ static const AudioBootStrap *const bootstrap[] = { @@ -121,14 +121,14 @@ static const AudioBootStrap *const bootstrap[] = { #if SDL_AUDIO_DRIVER_DUMMY &DUMMYAUD_bootstrap, #endif -#if SDL_AUDIO_DRIVER_NDS - &NDSAUD_bootstrap, -#endif #if SDL_AUDIO_DRIVER_FUSIONSOUND &FUSIONSOUND_bootstrap, #endif #if SDL_AUDIO_DRIVER_ANDROID &ANDROIDAUD_bootstrap, +#endif +#if SDL_AUDIO_DRIVER_PSP + &PSPAUD_bootstrap, #endif NULL }; @@ -191,7 +191,7 @@ SDL_AudioDeinitialize_Default(void) static int SDL_AudioOpenDevice_Default(_THIS, const char *devname, int iscapture) { - return 0; + return -1; } static void @@ -200,7 +200,7 @@ SDL_AudioLockDevice_Default(SDL_AudioDevice * device) if (device->thread && (SDL_ThreadID() == device->threadid)) { return; } - SDL_mutexP(device->mixer_lock); + SDL_LockMutex(device->mixer_lock); } static void @@ -209,7 +209,7 @@ SDL_AudioUnlockDevice_Default(SDL_AudioDevice * device) if (device->thread && (SDL_ThreadID() == device->threadid)) { return; } - SDL_mutexV(device->mixer_lock); + SDL_UnlockMutex(device->mixer_lock); } @@ -407,9 +407,9 @@ SDL_RunAudio(void *devicep) } /* Read from the callback into the _input_ stream */ - SDL_mutexP(device->mixer_lock); + SDL_LockMutex(device->mixer_lock); (*fill) (udata, istream, istream_len); - SDL_mutexV(device->mixer_lock); + SDL_UnlockMutex(device->mixer_lock); /* Convert the audio if necessary and write to the streamer */ if (device->convert.needed) { @@ -480,9 +480,9 @@ SDL_RunAudio(void *devicep) } } - SDL_mutexP(device->mixer_lock); + SDL_LockMutex(device->mixer_lock); (*fill) (udata, stream, stream_len); - SDL_mutexV(device->mixer_lock); + SDL_UnlockMutex(device->mixer_lock); /* Convert the audio if necessary */ if (device->convert.needed) { @@ -580,8 +580,8 @@ SDL_AudioInit(const char *driver_name) for (i = 0; (!initialized) && (bootstrap[i]); ++i) { /* make sure we should even try this driver before doing so... */ const AudioBootStrap *backend = bootstrap[i]; - if (((driver_name) && (SDL_strcasecmp(backend->name, driver_name))) || - ((!driver_name) && (backend->demand_only))) { + if ((driver_name && (SDL_strncasecmp(backend->name, driver_name, SDL_strlen(driver_name)) != 0)) || + (!driver_name && backend->demand_only)) { continue; } @@ -940,7 +940,7 @@ open_audio_device(const char *devname, int iscapture, ((!iscapture) && (current_audio.outputDevices == NULL)) ) SDL_GetNumAudioDevices(iscapture); - if (!current_audio.impl.OpenDevice(device, devname, iscapture)) { + if (current_audio.impl.OpenDevice(device, devname, iscapture) < 0) { close_audio_device(device); return 0; } diff --git a/src/eepp/helper/SDL2/src/audio/SDL_audio_c.h b/src/eepp/helper/SDL2/src/audio/SDL_audio_c.h index 5ce806a7a..6abae300b 100644 --- a/src/eepp/helper/SDL2/src/audio/SDL_audio_c.h +++ b/src/eepp/helper/SDL2/src/audio/SDL_audio_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/audio/SDL_audiocvt.c b/src/eepp/helper/SDL2/src/audio/SDL_audiocvt.c index b069543e0..1ccd83d74 100644 --- a/src/eepp/helper/SDL2/src/audio/SDL_audiocvt.c +++ b/src/eepp/helper/SDL2/src/audio/SDL_audiocvt.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -968,20 +968,25 @@ SDL_BuildAudioCVT(SDL_AudioCVT * cvt, * !!! FIXME: good in practice as it sounds in theory, though. */ + /* Sanity check target pointer */ + 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))) { - SDL_SetError("Invalid source format"); - return -1; + return SDL_SetError("Invalid source format"); } if ((SDL_AUDIO_BITSIZE(dst_fmt) > 16) && (!SDL_AUDIO_ISSIGNED(dst_fmt))) { - SDL_SetError("Invalid destination format"); - return -1; + return SDL_SetError("Invalid destination format"); } /* prevent possible divisions by zero, etc. */ + if ((src_channels == 0) || (dst_channels == 0)) { + return SDL_SetError("Source or destination channels is zero"); + } if ((src_rate == 0) || (dst_rate == 0)) { - SDL_SetError("Source or destination rate is zero"); - return -1; + return SDL_SetError("Source or destination rate is zero"); } #ifdef DEBUG_CONVERT printf("Build format %04x->%04x, channels %u->%u, rate %d->%d\n", diff --git a/src/eepp/helper/SDL2/src/audio/SDL_audiodev.c b/src/eepp/helper/SDL2/src/audio/SDL_audiodev.c index 2d0a62932..91b60c376 100644 --- a/src/eepp/helper/SDL2/src/audio/SDL_audiodev.c +++ b/src/eepp/helper/SDL2/src/audio/SDL_audiodev.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -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/eepp/helper/SDL2/src/audio/SDL_audiodev_c.h b/src/eepp/helper/SDL2/src/audio/SDL_audiodev_c.h index 9a4c59060..d439926b9 100644 --- a/src/eepp/helper/SDL2/src/audio/SDL_audiodev_c.h +++ b/src/eepp/helper/SDL2/src/audio/SDL_audiodev_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/audio/SDL_audiomem.h b/src/eepp/helper/SDL2/src/audio/SDL_audiomem.h index 93ffdab8b..8c027c3a5 100644 --- a/src/eepp/helper/SDL2/src/audio/SDL_audiomem.h +++ b/src/eepp/helper/SDL2/src/audio/SDL_audiomem.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -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/eepp/helper/SDL2/src/audio/SDL_audiotypecvt.c b/src/eepp/helper/SDL2/src/audio/SDL_audiotypecvt.c index c4ad21691..6245c534b 100644 --- a/src/eepp/helper/SDL2/src/audio/SDL_audiotypecvt.c +++ b/src/eepp/helper/SDL2/src/audio/SDL_audiotypecvt.c @@ -1,7 +1,7 @@ /* DO NOT EDIT! This file is generated by sdlgenaudiocvt.pl */ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/audio/SDL_mixer.c b/src/eepp/helper/SDL2/src/audio/SDL_mixer.c index 3a1a9f4a1..37907596f 100644 --- a/src/eepp/helper/SDL2/src/audio/SDL_mixer.c +++ b/src/eepp/helper/SDL2/src/audio/SDL_mixer.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -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/eepp/helper/SDL2/src/audio/SDL_sysaudio.h b/src/eepp/helper/SDL2/src/audio/SDL_sysaudio.h index 0badf53b2..83919c6e4 100644 --- a/src/eepp/helper/SDL2/src/audio/SDL_sysaudio.h +++ b/src/eepp/helper/SDL2/src/audio/SDL_sysaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -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/eepp/helper/SDL2/src/audio/SDL_wave.c b/src/eepp/helper/SDL2/src/audio/SDL_wave.c index a18c1ab42..b1bd0538c 100644 --- a/src/eepp/helper/SDL2/src/audio/SDL_wave.c +++ b/src/eepp/helper/SDL2/src/audio/SDL_wave.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -134,8 +134,7 @@ MS_ADPCM_decode(Uint8 ** audio_buf, Uint32 * audio_len) MS_ADPCM_state.wavefmt.channels * sizeof(Sint16); *audio_buf = (Uint8 *) SDL_malloc(*audio_len); if (*audio_buf == NULL) { - SDL_Error(SDL_ENOMEM); - return (-1); + return SDL_OutOfMemory(); } decoded = *audio_buf; @@ -359,8 +358,7 @@ IMA_ADPCM_decode(Uint8 ** audio_buf, Uint32 * audio_len) IMA_ADPCM_state.wavefmt.channels * sizeof(Sint16); *audio_buf = (Uint8 *) SDL_malloc(*audio_len); if (*audio_buf == NULL) { - SDL_Error(SDL_ENOMEM); - return (-1); + return SDL_OutOfMemory(); } decoded = *audio_buf; @@ -620,14 +618,12 @@ ReadChunk(SDL_RWops * src, Chunk * chunk) chunk->length = SDL_ReadLE32(src); chunk->data = (Uint8 *) SDL_malloc(chunk->length); if (chunk->data == NULL) { - SDL_Error(SDL_ENOMEM); - return (-1); + return SDL_OutOfMemory(); } if (SDL_RWread(src, chunk->data, chunk->length, 1) != 1) { - SDL_Error(SDL_EFREAD); SDL_free(chunk->data); chunk->data = NULL; - return (-1); + return SDL_Error(SDL_EFREAD); } return (chunk->length); } diff --git a/src/eepp/helper/SDL2/src/audio/SDL_wave.h b/src/eepp/helper/SDL2/src/audio/SDL_wave.h index b879d4b65..d82399cb8 100644 --- a/src/eepp/helper/SDL2/src/audio/SDL_wave.h +++ b/src/eepp/helper/SDL2/src/audio/SDL_wave.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -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/eepp/helper/SDL2/src/audio/alsa/SDL_alsa_audio.c b/src/eepp/helper/SDL2/src/audio/alsa/SDL_alsa_audio.c index 2d5f7d819..180064f31 100644 --- a/src/eepp/helper/SDL2/src/audio/alsa/SDL_alsa_audio.c +++ b/src/eepp/helper/SDL2/src/audio/alsa/SDL_alsa_audio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -155,7 +155,7 @@ static void UnloadALSALibrary(void) { if (alsa_handle != NULL) { - SDL_UnloadObject(alsa_handle); + SDL_UnloadObject(alsa_handle); alsa_handle = NULL; } } @@ -482,8 +482,7 @@ ALSA_OpenDevice(_THIS, const char *devname, int iscapture) this->hidden = (struct SDL_PrivateAudioData *) SDL_malloc((sizeof *this->hidden)); if (this->hidden == NULL) { - SDL_OutOfMemory(); - return 0; + return SDL_OutOfMemory(); } SDL_memset(this->hidden, 0, (sizeof *this->hidden)); @@ -495,9 +494,8 @@ ALSA_OpenDevice(_THIS, const char *devname, int iscapture) if (status < 0) { ALSA_CloseDevice(this); - SDL_SetError("ALSA: Couldn't open audio device: %s", - ALSA_snd_strerror(status)); - return 0; + return SDL_SetError("ALSA: Couldn't open audio device: %s", + ALSA_snd_strerror(status)); } this->hidden->pcm_handle = pcm_handle; @@ -507,9 +505,8 @@ ALSA_OpenDevice(_THIS, const char *devname, int iscapture) status = ALSA_snd_pcm_hw_params_any(pcm_handle, hwparams); if (status < 0) { ALSA_CloseDevice(this); - SDL_SetError("ALSA: Couldn't get hardware config: %s", - ALSA_snd_strerror(status)); - return 0; + return SDL_SetError("ALSA: Couldn't get hardware config: %s", + ALSA_snd_strerror(status)); } /* SDL only uses interleaved sample output */ @@ -517,9 +514,8 @@ ALSA_OpenDevice(_THIS, const char *devname, int iscapture) SND_PCM_ACCESS_RW_INTERLEAVED); if (status < 0) { ALSA_CloseDevice(this); - SDL_SetError("ALSA: Couldn't set interleaved access: %s", + return SDL_SetError("ALSA: Couldn't set interleaved access: %s", ALSA_snd_strerror(status)); - return 0; } /* Try for a closest match on audio format */ @@ -572,8 +568,7 @@ ALSA_OpenDevice(_THIS, const char *devname, int iscapture) } if (status < 0) { ALSA_CloseDevice(this); - SDL_SetError("ALSA: Couldn't find any hardware audio formats"); - return 0; + return SDL_SetError("ALSA: Couldn't find any hardware audio formats"); } this->spec.format = test_format; @@ -585,8 +580,7 @@ ALSA_OpenDevice(_THIS, const char *devname, int iscapture) status = ALSA_snd_pcm_hw_params_get_channels(hwparams, &channels); if (status < 0) { ALSA_CloseDevice(this); - SDL_SetError("ALSA: Couldn't set audio channels"); - return 0; + return SDL_SetError("ALSA: Couldn't set audio channels"); } this->spec.channels = channels; } @@ -597,9 +591,8 @@ ALSA_OpenDevice(_THIS, const char *devname, int iscapture) &rate, NULL); if (status < 0) { ALSA_CloseDevice(this); - SDL_SetError("ALSA: Couldn't set audio frequency: %s", - ALSA_snd_strerror(status)); - return 0; + return SDL_SetError("ALSA: Couldn't set audio frequency: %s", + ALSA_snd_strerror(status)); } this->spec.freq = rate; @@ -609,8 +602,7 @@ ALSA_OpenDevice(_THIS, const char *devname, int iscapture) /* Failed to set desired buffer size, do the best you can... */ if ( ALSA_set_period_size(this, hwparams, 1) < 0 ) { ALSA_CloseDevice(this); - SDL_SetError("Couldn't set hardware audio parameters: %s", ALSA_snd_strerror(status)); - return(-1); + return SDL_SetError("Couldn't set hardware audio parameters: %s", ALSA_snd_strerror(status)); } } /* Set the software parameters */ @@ -618,31 +610,27 @@ ALSA_OpenDevice(_THIS, const char *devname, int iscapture) status = ALSA_snd_pcm_sw_params_current(pcm_handle, swparams); if (status < 0) { ALSA_CloseDevice(this); - SDL_SetError("ALSA: Couldn't get software config: %s", - ALSA_snd_strerror(status)); - return 0; + return SDL_SetError("ALSA: Couldn't get software config: %s", + ALSA_snd_strerror(status)); } status = ALSA_snd_pcm_sw_params_set_avail_min(pcm_handle, swparams, this->spec.samples); if (status < 0) { ALSA_CloseDevice(this); - SDL_SetError("Couldn't set minimum available samples: %s", - ALSA_snd_strerror(status)); - return 0; + return SDL_SetError("Couldn't set minimum available samples: %s", + ALSA_snd_strerror(status)); } status = ALSA_snd_pcm_sw_params_set_start_threshold(pcm_handle, swparams, 1); if (status < 0) { ALSA_CloseDevice(this); - SDL_SetError("ALSA: Couldn't set start threshold: %s", - ALSA_snd_strerror(status)); - return 0; + return SDL_SetError("ALSA: Couldn't set start threshold: %s", + ALSA_snd_strerror(status)); } status = ALSA_snd_pcm_sw_params(pcm_handle, swparams); if (status < 0) { ALSA_CloseDevice(this); - SDL_SetError("Couldn't set software audio parameters: %s", - ALSA_snd_strerror(status)); - return 0; + return SDL_SetError("Couldn't set software audio parameters: %s", + ALSA_snd_strerror(status)); } /* Calculate the final parameters for this audio specification */ @@ -653,8 +641,7 @@ ALSA_OpenDevice(_THIS, const char *devname, int iscapture) this->hidden->mixbuf = (Uint8 *) SDL_AllocAudioMem(this->hidden->mixlen); if (this->hidden->mixbuf == NULL) { ALSA_CloseDevice(this); - SDL_OutOfMemory(); - return 0; + return SDL_OutOfMemory(); } SDL_memset(this->hidden->mixbuf, this->spec.silence, this->spec.size); @@ -662,7 +649,7 @@ ALSA_OpenDevice(_THIS, const char *devname, int iscapture) ALSA_snd_pcm_nonblock(pcm_handle, 0); /* We're ready to rock and roll. :-) */ - return 1; + return 0; } static void diff --git a/src/eepp/helper/SDL2/src/audio/alsa/SDL_alsa_audio.h b/src/eepp/helper/SDL2/src/audio/alsa/SDL_alsa_audio.h index 4c5725856..5a4bf7fcf 100644 --- a/src/eepp/helper/SDL2/src/audio/alsa/SDL_alsa_audio.h +++ b/src/eepp/helper/SDL2/src/audio/alsa/SDL_alsa_audio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -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/eepp/helper/SDL2/src/audio/android/SDL_androidaudio.c b/src/eepp/helper/SDL2/src/audio/android/SDL_androidaudio.c index 84938e7b5..45c128282 100644 --- a/src/eepp/helper/SDL2/src/audio/android/SDL_androidaudio.c +++ b/src/eepp/helper/SDL2/src/audio/android/SDL_androidaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -38,67 +38,61 @@ static int AndroidAUD_OpenDevice(_THIS, const char *devname, int iscapture) { SDL_AudioFormat test_format; - int valid_datatype = 0; - + if (iscapture) { - //TODO: implement capture - SDL_SetError("Capture not supported on Android"); - return 0; + /* TODO: implement capture */ + return SDL_SetError("Capture not supported on Android"); } if (audioDevice != NULL) { - SDL_SetError("Only one audio device at a time please!"); - return 0; + return SDL_SetError("Only one audio device at a time please!"); } audioDevice = this; this->hidden = SDL_malloc(sizeof(*(this->hidden))); if (!this->hidden) { - SDL_OutOfMemory(); - return 0; + return SDL_OutOfMemory(); } 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 :( - SDL_SetError("No compatible audio format!"); - return 0; + /* 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? - SDL_SetError("Java-side initialization failed!"); - return 0; + /* Init failed? */ + return SDL_SetError("Java-side initialization failed!"); } - return 1; + return 0; } static void @@ -117,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; } } @@ -138,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; @@ -153,7 +147,7 @@ AudioBootStrap ANDROIDAUD_bootstrap = { void Android_RunAudioThread() { - SDL_RunAudio(audioDevice); + SDL_RunAudio(audioDevice); } #endif /* SDL_AUDIO_DRIVER_ANDROID */ diff --git a/src/eepp/helper/SDL2/src/audio/android/SDL_androidaudio.h b/src/eepp/helper/SDL2/src/audio/android/SDL_androidaudio.h index f8798b2dc..383c708b7 100644 --- a/src/eepp/helper/SDL2/src/audio/android/SDL_androidaudio.h +++ b/src/eepp/helper/SDL2/src/audio/android/SDL_androidaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -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/eepp/helper/SDL2/src/audio/arts/SDL_artsaudio.c b/src/eepp/helper/SDL2/src/audio/arts/SDL_artsaudio.c index 3031ae289..ac0bb9d5d 100644 --- a/src/eepp/helper/SDL2/src/audio/arts/SDL_artsaudio.c +++ b/src/eepp/helper/SDL2/src/audio/arts/SDL_artsaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -241,8 +241,7 @@ ARTS_OpenDevice(_THIS, const char *devname, int iscapture) this->hidden = (struct SDL_PrivateAudioData *) SDL_malloc((sizeof *this->hidden)); if (this->hidden == NULL) { - SDL_OutOfMemory(); - return 0; + return SDL_OutOfMemory(); } SDL_memset(this->hidden, 0, (sizeof *this->hidden)); @@ -271,22 +270,19 @@ ARTS_OpenDevice(_THIS, const char *devname, int iscapture) } if (format == 0) { ARTS_CloseDevice(this); - SDL_SetError("Couldn't find any hardware audio formats"); - return 0; + return SDL_SetError("Couldn't find any hardware audio formats"); } this->spec.format = test_format; if ((rc = SDL_NAME(arts_init) ()) != 0) { ARTS_CloseDevice(this); - SDL_SetError("Unable to initialize ARTS: %s", - SDL_NAME(arts_error_text) (rc)); - return 0; + return SDL_SetError("Unable to initialize ARTS: %s", + SDL_NAME(arts_error_text) (rc)); } if (!ARTS_Suspend()) { ARTS_CloseDevice(this); - SDL_SetError("ARTS can not open audio device"); - return 0; + return SDL_SetError("ARTS can not open audio device"); } this->hidden->stream = SDL_NAME(arts_play_stream) (this->spec.freq, @@ -304,8 +300,7 @@ ARTS_OpenDevice(_THIS, const char *devname, int iscapture) for (frag_spec = 0; (0x01 << frag_spec) < this->spec.size; ++frag_spec); if ((0x01 << frag_spec) != this->spec.size) { ARTS_CloseDevice(this); - SDL_SetError("Fragment size must be a power of two"); - return 0; + return SDL_SetError("Fragment size must be a power of two"); } frag_spec |= 0x00020000; /* two fragments, for low latency */ @@ -326,8 +321,7 @@ ARTS_OpenDevice(_THIS, const char *devname, int iscapture) this->hidden->mixbuf = (Uint8 *) SDL_AllocAudioMem(this->hidden->mixlen); if (this->hidden->mixbuf == NULL) { ARTS_CloseDevice(this); - SDL_OutOfMemory(); - return 0; + return SDL_OutOfMemory(); } SDL_memset(this->hidden->mixbuf, this->spec.silence, this->spec.size); @@ -335,7 +329,7 @@ ARTS_OpenDevice(_THIS, const char *devname, int iscapture) this->hidden->parent = getpid(); /* We're ready to rock and roll. :-) */ - return 1; + return 0; } diff --git a/src/eepp/helper/SDL2/src/audio/arts/SDL_artsaudio.h b/src/eepp/helper/SDL2/src/audio/arts/SDL_artsaudio.h index f64ea4255..1387cc5c0 100644 --- a/src/eepp/helper/SDL2/src/audio/arts/SDL_artsaudio.h +++ b/src/eepp/helper/SDL2/src/audio/arts/SDL_artsaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -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/eepp/helper/SDL2/src/audio/baudio/SDL_beaudio.cc b/src/eepp/helper/SDL2/src/audio/baudio/SDL_beaudio.cc index 4c1eec5ea..e2edf85fb 100644 --- a/src/eepp/helper/SDL2/src/audio/baudio/SDL_beaudio.cc +++ b/src/eepp/helper/SDL2/src/audio/baudio/SDL_beaudio.cc @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -54,18 +54,18 @@ FillSound(void *device, void *stream, size_t len, if (!audio->paused) { if (audio->convert.needed) { - SDL_mutexP(audio->mixer_lock); + SDL_LockMutex(audio->mixer_lock); (*audio->spec.callback) (audio->spec.userdata, (Uint8 *) audio->convert.buf, audio->convert.len); - SDL_mutexV(audio->mixer_lock); + SDL_UnlockMutex(audio->mixer_lock); SDL_ConvertAudio(&audio->convert); SDL_memcpy(stream, audio->convert.buf, audio->convert.len_cvt); } else { - SDL_mutexP(audio->mixer_lock); + SDL_LockMutex(audio->mixer_lock); (*audio->spec.callback) (audio->spec.userdata, (Uint8 *) stream, len); - SDL_mutexV(audio->mixer_lock); + SDL_UnlockMutex(audio->mixer_lock); } } } @@ -95,8 +95,7 @@ BEOSAUDIO_OpenDevice(_THIS, const char *devname, int iscapture) /* Initialize all variables that we clean on shutdown */ _this->hidden = new SDL_PrivateAudioData; if (_this->hidden == NULL) { - SDL_OutOfMemory(); - return 0; + return SDL_OutOfMemory(); } SDL_memset(_this->hidden, 0, (sizeof *_this->hidden)); @@ -151,17 +150,16 @@ BEOSAUDIO_OpenDevice(_THIS, const char *devname, int iscapture) } } - format.buffer_size = _this->spec.samples; - if (!valid_datatype) { /* shouldn't happen, but just in case... */ BEOSAUDIO_CloseDevice(_this); - SDL_SetError("Unsupported audio format"); - return 0; + return SDL_SetError("Unsupported audio format"); } /* Calculate the final parameters for this audio specification */ SDL_CalculateAudioSpec(&_this->spec); + format.buffer_size = _this->spec.size; + /* Subscribe to the audio stream (creates a new thread) */ sigset_t omask; SDL_MaskSignals(&omask); @@ -173,12 +171,11 @@ BEOSAUDIO_OpenDevice(_THIS, const char *devname, int iscapture) _this->hidden->audio_obj->SetHasData(true); } else { BEOSAUDIO_CloseDevice(_this); - SDL_SetError("Unable to start Be audio"); - return 0; + return SDL_SetError("Unable to start Be audio"); } /* We're running! */ - return 1; + return 0; } static void diff --git a/src/eepp/helper/SDL2/src/audio/baudio/SDL_beaudio.h b/src/eepp/helper/SDL2/src/audio/baudio/SDL_beaudio.h index 0e5d8871a..61f9dec83 100644 --- a/src/eepp/helper/SDL2/src/audio/baudio/SDL_beaudio.h +++ b/src/eepp/helper/SDL2/src/audio/baudio/SDL_beaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -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/eepp/helper/SDL2/src/audio/bsd/SDL_bsdaudio.c b/src/eepp/helper/SDL2/src/audio/bsd/SDL_bsdaudio.c index 753dd2860..b63c838ad 100644 --- a/src/eepp/helper/SDL2/src/audio/bsd/SDL_bsdaudio.c +++ b/src/eepp/helper/SDL2/src/audio/bsd/SDL_bsdaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -239,8 +239,7 @@ BSDAUDIO_OpenDevice(_THIS, const char *devname, int iscapture) if (devname == NULL) { devname = SDL_GetAudioDeviceName(0, iscapture); if (devname == NULL) { - SDL_SetError("No such audio device"); - return 0; + return SDL_SetError("No such audio device"); } } @@ -248,16 +247,14 @@ BSDAUDIO_OpenDevice(_THIS, const char *devname, int iscapture) this->hidden = (struct SDL_PrivateAudioData *) SDL_malloc((sizeof *this->hidden)); if (this->hidden == NULL) { - SDL_OutOfMemory(); - return 0; + return SDL_OutOfMemory(); } SDL_memset(this->hidden, 0, (sizeof *this->hidden)); /* Open the audio device */ this->hidden->audio_fd = open(devname, flags, 0); if (this->hidden->audio_fd < 0) { - SDL_SetError("Couldn't open %s: %s", devname, strerror(errno)); - return 0; + return SDL_SetError("Couldn't open %s: %s", devname, strerror(errno)); } AUDIO_INITINFO(&info); @@ -269,8 +266,7 @@ BSDAUDIO_OpenDevice(_THIS, const char *devname, int iscapture) info.mode = AUMODE_PLAY; if (ioctl(this->hidden->audio_fd, AUDIO_SETINFO, &info) < 0) { BSDAUDIO_CloseDevice(this); - SDL_SetError("Couldn't put device into play mode"); - return 0; + return SDL_SetError("Couldn't put device into play mode"); } AUDIO_INITINFO(&info); @@ -312,8 +308,7 @@ BSDAUDIO_OpenDevice(_THIS, const char *devname, int iscapture) if (!format) { BSDAUDIO_CloseDevice(this); - SDL_SetError("No supported encoding for 0x%x", this->spec.format); - return 0; + return SDL_SetError("No supported encoding for 0x%x", this->spec.format); } this->spec.format = format; @@ -336,15 +331,14 @@ BSDAUDIO_OpenDevice(_THIS, const char *devname, int iscapture) this->hidden->mixbuf = (Uint8 *) SDL_AllocAudioMem(this->hidden->mixlen); if (this->hidden->mixbuf == NULL) { BSDAUDIO_CloseDevice(this); - SDL_OutOfMemory(); - return 0; + return SDL_OutOfMemory(); } SDL_memset(this->hidden->mixbuf, this->spec.silence, this->spec.size); BSDAUDIO_Status(this); /* We're ready to rock and roll. :-) */ - return (0); + return 0; } static int diff --git a/src/eepp/helper/SDL2/src/audio/bsd/SDL_bsdaudio.h b/src/eepp/helper/SDL2/src/audio/bsd/SDL_bsdaudio.h index dd0dfd878..b64be31b2 100644 --- a/src/eepp/helper/SDL2/src/audio/bsd/SDL_bsdaudio.h +++ b/src/eepp/helper/SDL2/src/audio/bsd/SDL_bsdaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -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/eepp/helper/SDL2/src/audio/coreaudio/SDL_coreaudio.c b/src/eepp/helper/SDL2/src/audio/coreaudio/SDL_coreaudio.c index 1747bb2cd..a35135a2f 100644 --- a/src/eepp/helper/SDL2/src/audio/coreaudio/SDL_coreaudio.c +++ b/src/eepp/helper/SDL2/src/audio/coreaudio/SDL_coreaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -280,10 +280,10 @@ outputCallback(void *inRefCon, while (remaining > 0) { if (this->hidden->bufferOffset >= this->hidden->bufferSize) { /* Generate the data */ - SDL_mutexP(this->mixer_lock); + SDL_LockMutex(this->mixer_lock); (*this->spec.callback)(this->spec.userdata, this->hidden->buffer, this->hidden->bufferSize); - SDL_mutexV(this->mixer_lock); + SDL_UnlockMutex(this->mixer_lock); this->hidden->bufferOffset = 0; } @@ -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; @@ -469,8 +469,7 @@ COREAUDIO_OpenDevice(_THIS, const char *devname, int iscapture) this->hidden = (struct SDL_PrivateAudioData *) SDL_malloc((sizeof *this->hidden)); if (this->hidden == NULL) { - SDL_OutOfMemory(); - return (0); + return SDL_OutOfMemory(); } SDL_memset(this->hidden, 0, (sizeof *this->hidden)); @@ -511,8 +510,7 @@ COREAUDIO_OpenDevice(_THIS, const char *devname, int iscapture) if (!valid_datatype) { /* shouldn't happen, but just in case... */ COREAUDIO_CloseDevice(this); - SDL_SetError("Unsupported audio format"); - return 0; + return SDL_SetError("Unsupported audio format"); } strdesc.mBytesPerFrame = @@ -522,10 +520,10 @@ COREAUDIO_OpenDevice(_THIS, const char *devname, int iscapture) if (!prepare_audiounit(this, devname, iscapture, &strdesc)) { COREAUDIO_CloseDevice(this); - return 0; /* prepare_audiounit() will call SDL_SetError()... */ + return -1; /* prepare_audiounit() will call SDL_SetError()... */ } - return 1; /* good to go. */ + return 0; /* good to go. */ } static int diff --git a/src/eepp/helper/SDL2/src/audio/coreaudio/SDL_coreaudio.h b/src/eepp/helper/SDL2/src/audio/coreaudio/SDL_coreaudio.h index e6b47c8bc..a05d4504f 100644 --- a/src/eepp/helper/SDL2/src/audio/coreaudio/SDL_coreaudio.h +++ b/src/eepp/helper/SDL2/src/audio/coreaudio/SDL_coreaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -42,7 +42,7 @@ #include /* Hidden "this" pointer for the audio functions */ -#define _THIS SDL_AudioDevice *this +#define _THIS SDL_AudioDevice *this struct SDL_PrivateAudioData { diff --git a/src/eepp/helper/SDL2/src/audio/directsound/SDL_directsound.c b/src/eepp/helper/SDL2/src/audio/directsound/SDL_directsound.c index a4ae908ae..e320056b5 100644 --- a/src/eepp/helper/SDL2/src/audio/directsound/SDL_directsound.c +++ b/src/eepp/helper/SDL2/src/audio/directsound/SDL_directsound.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -95,7 +95,7 @@ utf16_to_utf8(const WCHAR *S) (SDL_wcslen(S)+1)*sizeof(WCHAR)); } -static void +static int SetDSerror(const char *function, int code) { static const char *error; @@ -145,8 +145,7 @@ SetDSerror(const char *function, int code) SDL_snprintf(errbuf, SDL_arraysize(errbuf), "%s: %s", function, error); } - SDL_SetError("%s", errbuf); - return; + return SDL_SetError("%s", errbuf); } @@ -364,8 +363,7 @@ CreateSecondary(_THIS, HWND focus, WAVEFORMATEX * wavefmt) DSSCL_NORMAL); } if (result != DS_OK) { - SetDSerror("DirectSound SetCooperativeLevel", result); - return (-1); + return SetDSerror("DirectSound SetCooperativeLevel", result); } /* Try to create the secondary buffer */ @@ -380,16 +378,14 @@ CreateSecondary(_THIS, HWND focus, WAVEFORMATEX * wavefmt) format.dwBufferBytes = numchunks * chunksize; if ((format.dwBufferBytes < DSBSIZE_MIN) || (format.dwBufferBytes > DSBSIZE_MAX)) { - SDL_SetError("Sound buffer size must be between %d and %d", - DSBSIZE_MIN / numchunks, DSBSIZE_MAX / numchunks); - return (-1); + return SDL_SetError("Sound buffer size must be between %d and %d", + DSBSIZE_MIN / numchunks, DSBSIZE_MAX / numchunks); } format.dwReserved = 0; format.lpwfxFormat = wavefmt; result = IDirectSound_CreateSoundBuffer(sndObj, &format, sndbuf, NULL); if (result != DS_OK) { - SetDSerror("DirectSound CreateSoundBuffer", result); - return (-1); + return SetDSerror("DirectSound CreateSoundBuffer", result); } IDirectSoundBuffer_SetFormat(*sndbuf, wavefmt); @@ -452,8 +448,7 @@ DSOUND_OpenDevice(_THIS, const char *devname, int iscapture) pDirectSoundEnumerateW(FindDevGUID, &devguid); if (!devguid.found) { - SDL_SetError("DirectSound: Requested device not found"); - return 0; + return SDL_SetError("DirectSound: Requested device not found"); } guid = &devguid.guid; } @@ -462,8 +457,7 @@ DSOUND_OpenDevice(_THIS, const char *devname, int iscapture) this->hidden = (struct SDL_PrivateAudioData *) SDL_malloc((sizeof *this->hidden)); if (this->hidden == NULL) { - SDL_OutOfMemory(); - return 0; + return SDL_OutOfMemory(); } SDL_memset(this->hidden, 0, (sizeof *this->hidden)); @@ -481,8 +475,7 @@ DSOUND_OpenDevice(_THIS, const char *devname, int iscapture) if (!valid_format) { DSOUND_CloseDevice(this); - SDL_SetError("DirectSound: Unsupported audio format"); - return 0; + return SDL_SetError("DirectSound: Unsupported audio format"); } SDL_memset(&waveformat, 0, sizeof(waveformat)); @@ -502,21 +495,20 @@ DSOUND_OpenDevice(_THIS, const char *devname, int iscapture) result = pDirectSoundCreate8(guid, &this->hidden->sound, NULL); if (result != DS_OK) { DSOUND_CloseDevice(this); - SetDSerror("DirectSoundCreate", result); - return 0; + return SetDSerror("DirectSoundCreate", result); } /* Create the audio buffer to which we write */ this->hidden->num_buffers = CreateSecondary(this, NULL, &waveformat); if (this->hidden->num_buffers < 0) { DSOUND_CloseDevice(this); - return 0; + return -1; } /* The buffer will auto-start playing in DSOUND_WaitDevice() */ this->hidden->mixlen = this->spec.size; - return 1; /* good to go. */ + return 0; /* good to go. */ } diff --git a/src/eepp/helper/SDL2/src/audio/directsound/SDL_directsound.h b/src/eepp/helper/SDL2/src/audio/directsound/SDL_directsound.h index 4f00851ae..758299f14 100644 --- a/src/eepp/helper/SDL2/src/audio/directsound/SDL_directsound.h +++ b/src/eepp/helper/SDL2/src/audio/directsound/SDL_directsound.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -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/eepp/helper/SDL2/src/audio/directsound/directx.h b/src/eepp/helper/SDL2/src/audio/directsound/directx.h index 8ddfa00cb..963d2b88e 100644 --- a/src/eepp/helper/SDL2/src/audio/directsound/directx.h +++ b/src/eepp/helper/SDL2/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/eepp/helper/SDL2/src/audio/disk/SDL_diskaudio.c b/src/eepp/helper/SDL2/src/audio/disk/SDL_diskaudio.c index 1aeb7f4bf..89687ed18 100644 --- a/src/eepp/helper/SDL2/src/audio/disk/SDL_diskaudio.c +++ b/src/eepp/helper/SDL2/src/audio/disk/SDL_diskaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -110,8 +110,7 @@ DISKAUD_OpenDevice(_THIS, const char *devname, int iscapture) this->hidden = (struct SDL_PrivateAudioData *) SDL_malloc(sizeof(*this->hidden)); if (this->hidden == NULL) { - SDL_OutOfMemory(); - return 0; + return SDL_OutOfMemory(); } SDL_memset(this->hidden, 0, sizeof(*this->hidden)); @@ -119,14 +118,14 @@ DISKAUD_OpenDevice(_THIS, const char *devname, int iscapture) this->hidden->output = SDL_RWFromFile(fname, "wb"); if (this->hidden->output == NULL) { DISKAUD_CloseDevice(this); - return 0; + return -1; } /* Allocate mixing buffer */ this->hidden->mixbuf = (Uint8 *) SDL_AllocAudioMem(this->hidden->mixlen); if (this->hidden->mixbuf == NULL) { DISKAUD_CloseDevice(this); - return 0; + return -1; } SDL_memset(this->hidden->mixbuf, this->spec.silence, this->spec.size); @@ -141,7 +140,7 @@ DISKAUD_OpenDevice(_THIS, const char *devname, int iscapture) #endif /* We're ready to rock and roll. :-) */ - return 1; + return 0; } static int diff --git a/src/eepp/helper/SDL2/src/audio/disk/SDL_diskaudio.h b/src/eepp/helper/SDL2/src/audio/disk/SDL_diskaudio.h index c75ab4921..7e5b48406 100644 --- a/src/eepp/helper/SDL2/src/audio/disk/SDL_diskaudio.h +++ b/src/eepp/helper/SDL2/src/audio/disk/SDL_diskaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -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/eepp/helper/SDL2/src/audio/dsp/SDL_dspaudio.c b/src/eepp/helper/SDL2/src/audio/dsp/SDL_dspaudio.c index a67b7d525..c62a22f8a 100644 --- a/src/eepp/helper/SDL2/src/audio/dsp/SDL_dspaudio.c +++ b/src/eepp/helper/SDL2/src/audio/dsp/SDL_dspaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -89,8 +89,7 @@ DSP_OpenDevice(_THIS, const char *devname, int iscapture) if (devname == NULL) { devname = SDL_GetAudioDeviceName(0, iscapture); if (devname == NULL) { - SDL_SetError("No such audio device"); - return 0; + return SDL_SetError("No such audio device"); } } @@ -107,8 +106,7 @@ DSP_OpenDevice(_THIS, const char *devname, int iscapture) this->hidden = (struct SDL_PrivateAudioData *) SDL_malloc((sizeof *this->hidden)); if (this->hidden == NULL) { - SDL_OutOfMemory(); - return 0; + return SDL_OutOfMemory(); } SDL_memset(this->hidden, 0, (sizeof *this->hidden)); @@ -116,8 +114,7 @@ DSP_OpenDevice(_THIS, const char *devname, int iscapture) this->hidden->audio_fd = open(devname, flags, 0); if (this->hidden->audio_fd < 0) { DSP_CloseDevice(this); - SDL_SetError("Couldn't open %s: %s", devname, strerror(errno)); - return 0; + return SDL_SetError("Couldn't open %s: %s", devname, strerror(errno)); } this->hidden->mixbuf = NULL; @@ -128,8 +125,7 @@ DSP_OpenDevice(_THIS, const char *devname, int iscapture) ctlflags &= ~O_NONBLOCK; if (fcntl(this->hidden->audio_fd, F_SETFL, ctlflags) < 0) { DSP_CloseDevice(this); - SDL_SetError("Couldn't set audio blocking mode"); - return 0; + return SDL_SetError("Couldn't set audio blocking mode"); } } @@ -137,8 +133,7 @@ DSP_OpenDevice(_THIS, const char *devname, int iscapture) if (ioctl(this->hidden->audio_fd, SNDCTL_DSP_GETFMTS, &value) < 0) { perror("SNDCTL_DSP_GETFMTS"); DSP_CloseDevice(this); - SDL_SetError("Couldn't get audio format list"); - return 0; + return SDL_SetError("Couldn't get audio format list"); } /* Try for a closest match on audio format */ @@ -166,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: @@ -195,8 +190,7 @@ DSP_OpenDevice(_THIS, const char *devname, int iscapture) } if (format == 0) { DSP_CloseDevice(this); - SDL_SetError("Couldn't find any hardware audio formats"); - return 0; + return SDL_SetError("Couldn't find any hardware audio formats"); } this->spec.format = test_format; @@ -206,8 +200,7 @@ DSP_OpenDevice(_THIS, const char *devname, int iscapture) (value != format)) { perror("SNDCTL_DSP_SETFMT"); DSP_CloseDevice(this); - SDL_SetError("Couldn't set audio format"); - return 0; + return SDL_SetError("Couldn't set audio format"); } /* Set the number of channels of output */ @@ -215,8 +208,7 @@ DSP_OpenDevice(_THIS, const char *devname, int iscapture) if (ioctl(this->hidden->audio_fd, SNDCTL_DSP_CHANNELS, &value) < 0) { perror("SNDCTL_DSP_CHANNELS"); DSP_CloseDevice(this); - SDL_SetError("Cannot set the number of channels"); - return 0; + return SDL_SetError("Cannot set the number of channels"); } this->spec.channels = value; @@ -225,8 +217,7 @@ DSP_OpenDevice(_THIS, const char *devname, int iscapture) if (ioctl(this->hidden->audio_fd, SNDCTL_DSP_SPEED, &value) < 0) { perror("SNDCTL_DSP_SPEED"); DSP_CloseDevice(this); - SDL_SetError("Couldn't set audio frequency"); - return 0; + return SDL_SetError("Couldn't set audio frequency"); } this->spec.freq = value; @@ -237,8 +228,7 @@ DSP_OpenDevice(_THIS, const char *devname, int iscapture) for (frag_spec = 0; (0x01U << frag_spec) < this->spec.size; ++frag_spec); if ((0x01U << frag_spec) != this->spec.size) { DSP_CloseDevice(this); - SDL_SetError("Fragment size must be a power of two"); - return 0; + return SDL_SetError("Fragment size must be a power of two"); } frag_spec |= 0x00020000; /* two fragments, for low latency */ @@ -266,13 +256,12 @@ DSP_OpenDevice(_THIS, const char *devname, int iscapture) this->hidden->mixbuf = (Uint8 *) SDL_AllocAudioMem(this->hidden->mixlen); if (this->hidden->mixbuf == NULL) { DSP_CloseDevice(this); - SDL_OutOfMemory(); - return 0; + return SDL_OutOfMemory(); } SDL_memset(this->hidden->mixbuf, this->spec.silence, this->spec.size); /* We're ready to rock and roll. :-) */ - return 1; + return 0; } diff --git a/src/eepp/helper/SDL2/src/audio/dsp/SDL_dspaudio.h b/src/eepp/helper/SDL2/src/audio/dsp/SDL_dspaudio.h index 3d9ebf196..62ed45f18 100644 --- a/src/eepp/helper/SDL2/src/audio/dsp/SDL_dspaudio.h +++ b/src/eepp/helper/SDL2/src/audio/dsp/SDL_dspaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -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/eepp/helper/SDL2/src/audio/dummy/SDL_dummyaudio.c b/src/eepp/helper/SDL2/src/audio/dummy/SDL_dummyaudio.c index 14743464d..c3e8ea415 100644 --- a/src/eepp/helper/SDL2/src/audio/dummy/SDL_dummyaudio.c +++ b/src/eepp/helper/SDL2/src/audio/dummy/SDL_dummyaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -29,7 +29,7 @@ static int DUMMYAUD_OpenDevice(_THIS, const char *devname, int iscapture) { - return 1; /* always succeeds. */ + return 0; /* always succeeds. */ } static int diff --git a/src/eepp/helper/SDL2/src/audio/dummy/SDL_dummyaudio.h b/src/eepp/helper/SDL2/src/audio/dummy/SDL_dummyaudio.h index 32956b982..c0015a54d 100644 --- a/src/eepp/helper/SDL2/src/audio/dummy/SDL_dummyaudio.h +++ b/src/eepp/helper/SDL2/src/audio/dummy/SDL_dummyaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -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/eepp/helper/SDL2/src/audio/esd/SDL_esdaudio.c b/src/eepp/helper/SDL2/src/audio/esd/SDL_esdaudio.c index 627723561..92716f39b 100644 --- a/src/eepp/helper/SDL2/src/audio/esd/SDL_esdaudio.c +++ b/src/eepp/helper/SDL2/src/audio/esd/SDL_esdaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -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 */ @@ -228,8 +228,7 @@ ESD_OpenDevice(_THIS, const char *devname, int iscapture) this->hidden = (struct SDL_PrivateAudioData *) SDL_malloc((sizeof *this->hidden)); if (this->hidden == NULL) { - SDL_OutOfMemory(); - return 0; + return SDL_OutOfMemory(); } SDL_memset(this->hidden, 0, (sizeof *this->hidden)); this->hidden->audio_fd = -1; @@ -257,8 +256,7 @@ ESD_OpenDevice(_THIS, const char *devname, int iscapture) if (!found) { ESD_CloseDevice(this); - SDL_SetError("Couldn't find any hardware audio formats"); - return 0; + return SDL_SetError("Couldn't find any hardware audio formats"); } if (this->spec.channels == 1) { @@ -277,8 +275,7 @@ ESD_OpenDevice(_THIS, const char *devname, int iscapture) if (this->hidden->audio_fd < 0) { ESD_CloseDevice(this); - SDL_SetError("Couldn't open ESD connection"); - return 0; + return SDL_SetError("Couldn't open ESD connection"); } /* Calculate the final parameters for this audio specification */ @@ -292,8 +289,7 @@ ESD_OpenDevice(_THIS, const char *devname, int iscapture) this->hidden->mixbuf = (Uint8 *) SDL_AllocAudioMem(this->hidden->mixlen); if (this->hidden->mixbuf == NULL) { ESD_CloseDevice(this); - SDL_OutOfMemory(); - return 0; + return SDL_OutOfMemory(); } SDL_memset(this->hidden->mixbuf, this->spec.silence, this->spec.size); @@ -301,7 +297,7 @@ ESD_OpenDevice(_THIS, const char *devname, int iscapture) this->hidden->parent = getpid(); /* We're ready to rock and roll. :-) */ - return 1; + return 0; } static void diff --git a/src/eepp/helper/SDL2/src/audio/esd/SDL_esdaudio.h b/src/eepp/helper/SDL2/src/audio/esd/SDL_esdaudio.h index 9824f577a..26bea9cf0 100644 --- a/src/eepp/helper/SDL2/src/audio/esd/SDL_esdaudio.h +++ b/src/eepp/helper/SDL2/src/audio/esd/SDL_esdaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -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/eepp/helper/SDL2/src/audio/fusionsound/SDL_fsaudio.c b/src/eepp/helper/SDL2/src/audio/fusionsound/SDL_fsaudio.c index db3995969..2e468d5c6 100644 --- a/src/eepp/helper/SDL2/src/audio/fusionsound/SDL_fsaudio.c +++ b/src/eepp/helper/SDL2/src/audio/fusionsound/SDL_fsaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -37,13 +37,13 @@ #include -//#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 @@ -200,8 +200,7 @@ SDL_FS_OpenDevice(_THIS, const char *devname, int iscapture) this->hidden = (struct SDL_PrivateAudioData *) SDL_malloc((sizeof *this->hidden)); if (this->hidden == NULL) { - SDL_OutOfMemory(); - return 0; + return SDL_OutOfMemory(); } SDL_memset(this->hidden, 0, (sizeof *this->hidden)); @@ -243,8 +242,7 @@ SDL_FS_OpenDevice(_THIS, const char *devname, int iscapture) if (format == 0) { SDL_FS_CloseDevice(this); - SDL_SetError("Couldn't find any hardware audio formats"); - return 0; + return SDL_SetError("Couldn't find any hardware audio formats"); } this->spec.format = test_format; @@ -252,8 +250,7 @@ SDL_FS_OpenDevice(_THIS, const char *devname, int iscapture) ret = SDL_NAME(FusionSoundCreate) (&this->hidden->fs); if (ret) { SDL_FS_CloseDevice(this); - SDL_SetError("Unable to initialize FusionSound: %d", ret); - return 0; + return SDL_SetError("Unable to initialize FusionSound: %d", ret); } this->hidden->mixsamples = this->spec.size / bytes / this->spec.channels; @@ -272,8 +269,7 @@ SDL_FS_OpenDevice(_THIS, const char *devname, int iscapture) &this->hidden->stream); if (ret) { SDL_FS_CloseDevice(this); - SDL_SetError("Unable to create FusionSoundStream: %d", ret); - return 0; + return SDL_SetError("Unable to create FusionSoundStream: %d", ret); } /* See what we got */ @@ -294,13 +290,12 @@ SDL_FS_OpenDevice(_THIS, const char *devname, int iscapture) this->hidden->mixbuf = (Uint8 *) SDL_AllocAudioMem(this->hidden->mixlen); if (this->hidden->mixbuf == NULL) { SDL_FS_CloseDevice(this); - SDL_OutOfMemory(); - return 0; + return SDL_OutOfMemory(); } SDL_memset(this->hidden->mixbuf, this->spec.silence, this->spec.size); /* We're ready to rock and roll. :-) */ - return 1; + return 0; } diff --git a/src/eepp/helper/SDL2/src/audio/fusionsound/SDL_fsaudio.h b/src/eepp/helper/SDL2/src/audio/fusionsound/SDL_fsaudio.h index 3c997e711..7f2277501 100644 --- a/src/eepp/helper/SDL2/src/audio/fusionsound/SDL_fsaudio.h +++ b/src/eepp/helper/SDL2/src/audio/fusionsound/SDL_fsaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -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/eepp/helper/SDL2/src/audio/nas/SDL_nasaudio.c b/src/eepp/helper/SDL2/src/audio/nas/SDL_nasaudio.c index d9b6b4c2c..4e3dc0a13 100644 --- a/src/eepp/helper/SDL2/src/audio/nas/SDL_nasaudio.c +++ b/src/eepp/helper/SDL2/src/audio/nas/SDL_nasaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -288,8 +288,7 @@ NAS_OpenDevice(_THIS, const char *devname, int iscapture) this->hidden = (struct SDL_PrivateAudioData *) SDL_malloc((sizeof *this->hidden)); if (this->hidden == NULL) { - SDL_OutOfMemory(); - return 0; + return SDL_OutOfMemory(); } SDL_memset(this->hidden, 0, (sizeof *this->hidden)); @@ -304,24 +303,21 @@ NAS_OpenDevice(_THIS, const char *devname, int iscapture) } if (format == 0) { NAS_CloseDevice(this); - SDL_SetError("NAS: Couldn't find any hardware audio formats"); - return 0; + return SDL_SetError("NAS: Couldn't find any hardware audio formats"); } this->spec.format = test_format; this->hidden->aud = NAS_AuOpenServer("", 0, NULL, 0, NULL, NULL); if (this->hidden->aud == 0) { NAS_CloseDevice(this); - SDL_SetError("NAS: Couldn't open connection to NAS server"); - return 0; + return SDL_SetError("NAS: Couldn't open connection to NAS server"); } this->hidden->dev = find_device(this, this->spec.channels); if ((this->hidden->dev == AuNone) || (!(this->hidden->flow = NAS_AuCreateFlow(this->hidden->aud, 0)))) { NAS_CloseDevice(this); - SDL_SetError("NAS: Couldn't find a fitting device on NAS server"); - return 0; + return SDL_SetError("NAS: Couldn't find a fitting device on NAS server"); } buffer_size = this->spec.freq; @@ -354,13 +350,12 @@ NAS_OpenDevice(_THIS, const char *devname, int iscapture) this->hidden->mixbuf = (Uint8 *) SDL_AllocAudioMem(this->hidden->mixlen); if (this->hidden->mixbuf == NULL) { NAS_CloseDevice(this); - SDL_OutOfMemory(); - return 0; + return SDL_OutOfMemory(); } SDL_memset(this->hidden->mixbuf, this->spec.silence, this->spec.size); /* We're ready to rock and roll. :-) */ - return 1; + return 0; } static void diff --git a/src/eepp/helper/SDL2/src/audio/nas/SDL_nasaudio.h b/src/eepp/helper/SDL2/src/audio/nas/SDL_nasaudio.h index 829a80422..85bd761dd 100644 --- a/src/eepp/helper/SDL2/src/audio/nas/SDL_nasaudio.h +++ b/src/eepp/helper/SDL2/src/audio/nas/SDL_nasaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -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/eepp/helper/SDL2/src/audio/nds/SDL_ndsaudio.c b/src/eepp/helper/SDL2/src/audio/nds/SDL_ndsaudio.c deleted file mode 100644 index 8b123a94a..000000000 --- a/src/eepp/helper/SDL2/src/audio/nds/SDL_ndsaudio.c +++ /dev/null @@ -1,129 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga - - 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 - appreciated but is not required. - 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. -*/ -#include "SDL_config.h" - -#if SDL_AUDIO_DRIVER_NDS - -/* Output audio to NDS */ - -#include - -#include "SDL_audio.h" -#include "../SDL_audio_c.h" -#include "SDL_ndsaudio.h" - -static int -NDSAUD_OpenDevice(_THIS, const char *devname, int iscapture) -{ - SDL_AudioFormat test_format = SDL_FirstAudioFormat(this->spec.format); - int valid_datatype = 0; - - this->hidden = SDL_malloc(sizeof(*(this->hidden))); - if (!this->hidden) { - SDL_OutOfMemory(); - return 0; - } - SDL_memset(this->hidden, 0, (sizeof *this->hidden)); - - while ((!valid_datatype) && (test_format)) { - this->spec.format = test_format; - switch (test_format) { - case AUDIO_S8: - /*case AUDIO_S16LSB: */ - valid_datatype = 1; - break; - default: - test_format = SDL_NextAudioFormat(); - break; - } - } - -#if 0 - /* set the generic sound parameters */ - setGenericSound(22050, /* sample rate */ - 127, /* volume */ - 64, /* panning/balance */ - 0); /* sound format */ -#endif - - return 1; -} - -static void -NDSAUD_PlayDevice(_THIS) -{ -#if 0 - playGenericSound(this->hidden->mixbuf, this->hidden->mixlen); - -// sound->data = this->hidden->mixbuf;/* pointer to raw audio data */ -// sound->len = this->hidden->mixlen; /* size of raw data pointed to above */ -// sound->rate = 22050; /* sample rate = 22050Hz */ -// sound->vol = 127; /* volume [0..127] for [min..max] */ -// sound->pan = 64; /* balance [0..127] for [left..right] */ -// sound->format = 0; /* 0 for 16-bit, 1 for 8-bit */ -// playSound(sound); -#endif -} - - -static Uint8 * -NDSAUD_GetDeviceBuf(_THIS) -{ - return this->hidden->mixbuf; /* is this right? */ -} - -static void -NDSAUD_WaitDevice(_THIS) -{ - /* stub */ -} - -static void -NDSAUD_CloseDevice(_THIS) -{ - /* stub */ -} - -static int -NDSAUD_Init(SDL_AudioDriverImpl * impl) -{ - /* Set the function pointers */ - impl->OpenDevice = NDSAUD_OpenDevice; - impl->PlayDevice = NDSAUD_PlayDevice; - impl->WaitDevice = NDSAUD_WaitDevice; - impl->GetDeviceBuf = NDSAUD_GetDeviceBuf; - impl->CloseDevice = NDSAUD_CloseDevice; - - /* and the capabilities */ - impl->HasCaptureSupport = 1; - impl->OnlyHasDefaultOutputDevice = 1; - impl->OnlyHasDefaultInputDevice = 1; - - return 1; /* this audio target is available. */ -} - -AudioBootStrap NDSAUD_bootstrap = { - "nds", "SDL NDS audio driver", NDSAUD_Init, 0 /*1? */ -}; - -#endif /* SDL_AUDIO_DRIVER_NDS */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/eepp/helper/SDL2/src/audio/paudio/SDL_paudio.c b/src/eepp/helper/SDL2/src/audio/paudio/SDL_paudio.c index 02051adce..5a18b45e5 100644 --- a/src/eepp/helper/SDL2/src/audio/paudio/SDL_paudio.c +++ b/src/eepp/helper/SDL2/src/audio/paudio/SDL_paudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -48,13 +48,13 @@ #include /* 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] = { @@ -264,8 +264,7 @@ PAUDIO_OpenDevice(_THIS, const char *devname, int iscapture) this->hidden = (struct SDL_PrivateAudioData *) SDL_malloc((sizeof *this->hidden)); if (this->hidden == NULL) { - SDL_OutOfMemory(); - return 0; + return SDL_OutOfMemory(); } SDL_memset(this->hidden, 0, (sizeof *this->hidden)); @@ -274,8 +273,7 @@ PAUDIO_OpenDevice(_THIS, const char *devname, int iscapture) this->hidden->audio_fd = fd; if (fd < 0) { PAUDIO_CloseDevice(this); - SDL_SetError("Couldn't open %s: %s", audiodev, strerror(errno)); - return 0; + return SDL_SetError("Couldn't open %s: %s", audiodev, strerror(errno)); } /* @@ -284,8 +282,7 @@ PAUDIO_OpenDevice(_THIS, const char *devname, int iscapture) */ if (ioctl(fd, AUDIO_BUFFER, &paud_bufinfo) < 0) { PAUDIO_CloseDevice(this); - SDL_SetError("Couldn't get audio buffer information"); - return 0; + return SDL_SetError("Couldn't get audio buffer information"); } if (this->spec.channels > 1) @@ -399,8 +396,7 @@ PAUDIO_OpenDevice(_THIS, const char *devname, int iscapture) fprintf(stderr, "Couldn't find any hardware audio formats\n"); #endif PAUDIO_CloseDevice(this); - SDL_SetError("Couldn't find any hardware audio formats"); - return 0; + return SDL_SetError("Couldn't find any hardware audio formats"); } this->spec.format = test_format; @@ -458,8 +454,7 @@ PAUDIO_OpenDevice(_THIS, const char *devname, int iscapture) if (err != NULL) { PAUDIO_CloseDevice(this); - SDL_SetError("Paudio: %s", err); - return 0; + return SDL_SetError("Paudio: %s", err); } /* Allocate mixing buffer */ @@ -467,8 +462,7 @@ PAUDIO_OpenDevice(_THIS, const char *devname, int iscapture) this->hidden->mixbuf = (Uint8 *) SDL_AllocAudioMem(this->hidden->mixlen); if (this->hidden->mixbuf == NULL) { PAUDIO_CloseDevice(this); - SDL_OutOfMemory(); - return 0; + return SDL_OutOfMemory(); } SDL_memset(this->hidden->mixbuf, this->spec.silence, this->spec.size); @@ -506,8 +500,7 @@ PAUDIO_OpenDevice(_THIS, const char *devname, int iscapture) #ifdef DEBUG_AUDIO fprintf(stderr, "Can't start audio play\n"); #endif - SDL_SetError("Can't start audio play"); - return 0; + return SDL_SetError("Can't start audio play"); } /* Check to see if we need to use select() workaround */ @@ -518,7 +511,7 @@ PAUDIO_OpenDevice(_THIS, const char *devname, int iscapture) } /* We're ready to rock and roll. :-) */ - return 1; + return 0; } static int diff --git a/src/eepp/helper/SDL2/src/audio/paudio/SDL_paudio.h b/src/eepp/helper/SDL2/src/audio/paudio/SDL_paudio.h index 9aae5c603..7be1ed651 100644 --- a/src/eepp/helper/SDL2/src/audio/paudio/SDL_paudio.h +++ b/src/eepp/helper/SDL2/src/audio/paudio/SDL_paudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -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/eepp/helper/SDL2/src/audio/psp/SDL_pspaudio.c b/src/eepp/helper/SDL2/src/audio/psp/SDL_pspaudio.c new file mode 100644 index 000000000..4b5534a3c --- /dev/null +++ b/src/eepp/helper/SDL2/src/audio/psp/SDL_pspaudio.c @@ -0,0 +1,195 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2013 Sam Lantinga + + 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 + appreciated but is not required. + 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. +*/ + +#include +#include +#include +#include + +#include "SDL_audio.h" +#include "SDL_error.h" +#include "SDL_timer.h" +#include "../SDL_audiomem.h" +#include "../SDL_audio_c.h" +#include "../SDL_audiodev_c.h" +#include "../SDL_sysaudio.h" +#include "SDL_pspaudio.h" + +#include +#include + +/* The tag name used by PSP audio */ +#define PSPAUD_DRIVER_NAME "psp" + +static int +PSPAUD_OpenDevice(_THIS, const char *devname, int iscapture) +{ + 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) { + case AUDIO_U8: + this->spec.silence = 0x80; + break; + default: + this->spec.silence = 0x00; + break; + } + 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; +} + +static void PSPAUD_PlayDevice(_THIS) +{ + 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); + } + + 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. */ +} +static Uint8 *PSPAUD_GetDeviceBuf(_THIS) +{ + 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; + } +} +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); + } +} + + +static int +PSPAUD_Init(SDL_AudioDriverImpl * impl) +{ + + // Set the function pointers + impl->OpenDevice = PSPAUD_OpenDevice; + impl->PlayDevice = PSPAUD_PlayDevice; + impl->WaitDevice = PSPAUD_WaitDevice; + impl->GetDeviceBuf = PSPAUD_GetDeviceBuf; + impl->WaitDone = PSPAUD_WaitDevice; + impl->CloseDevice = PSPAUD_CloseDevice; + impl->ThreadInit = PSPAUD_ThreadInit; + + //PSP audio device + impl->OnlyHasDefaultOutputDevice = 1; +/* + impl->HasCaptureSupport = 1; + + impl->OnlyHasDefaultInputDevice = 1; +*/ + /* + impl->DetectDevices = DSOUND_DetectDevices; + impl->Deinitialize = DSOUND_Deinitialize; + */ + return 1; /* this audio target is available. */ +} + +AudioBootStrap PSPAUD_bootstrap = { + "psp", "PSP audio driver", PSPAUD_Init, 0 +}; + + /* SDL_AUDI*/ + + + diff --git a/src/eepp/helper/SDL2/src/audio/nds/SDL_ndsaudio.h b/src/eepp/helper/SDL2/src/audio/psp/SDL_pspaudio.h similarity index 61% rename from src/eepp/helper/SDL2/src/audio/nds/SDL_ndsaudio.h rename to src/eepp/helper/SDL2/src/audio/psp/SDL_pspaudio.h index f6bcff22e..139476c6b 100644 --- a/src/eepp/helper/SDL2/src/audio/nds/SDL_ndsaudio.h +++ b/src/eepp/helper/SDL2/src/audio/psp/SDL_pspaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -18,25 +18,28 @@ misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ -#include "SDL_config.h" -#ifndef _SDL_ndsaudio_h -#define _SDL_ndsaudio_h +#ifndef _SDL_pspaudio_h +#define _SDL_pspaudio_h #include "../SDL_sysaudio.h" -#include -/* Hidden "this" pointer for the audio functions */ -#define _THIS SDL_AudioDevice *this +/* Hidden "this" pointer for the video functions */ +#define _THIS SDL_AudioDevice *this -struct SDL_PrivateAudioData -{ - /* The file descriptor for the audio device */ - Uint8 *mixbuf; - Uint32 mixlen; - Uint32 write_delay; - Uint32 initial_calls; +#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; }; -#endif /* _SDL_ndsaudio_h */ -/* vi: set ts=4 sw=4 expandtab: */ +#endif /* _SDL_pspaudio_h */ +/* vim: ts=4 sw=4 + */ diff --git a/src/eepp/helper/SDL2/src/audio/pulseaudio/SDL_pulseaudio.c b/src/eepp/helper/SDL2/src/audio/pulseaudio/SDL_pulseaudio.c index e64fef845..c8d25a800 100644 --- a/src/eepp/helper/SDL2/src/audio/pulseaudio/SDL_pulseaudio.c +++ b/src/eepp/helper/SDL2/src/audio/pulseaudio/SDL_pulseaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -131,7 +131,7 @@ static void UnloadPulseAudioLibrary(void) { if (pulseaudio_handle != NULL) { - SDL_UnloadObject(pulseaudio_handle); + SDL_UnloadObject(pulseaudio_handle); pulseaudio_handle = NULL; } } @@ -205,6 +205,27 @@ load_pulseaudio_syms(void) } +/* Check to see if we can connect to PulseAudio */ +static SDL_bool +CheckPulseAudioAvailable() +{ + pa_simple *s; + pa_sample_spec ss; + + ss.format = PA_SAMPLE_S16NE; + ss.channels = 1; + ss.rate = 22050; + + s = PULSEAUDIO_pa_simple_new(NULL, "SDL", PA_STREAM_PLAYBACK, NULL, + "Test", &ss, NULL, NULL, NULL); + if (s) { + PULSEAUDIO_pa_simple_free(s); + return SDL_TRUE; + } else { + return SDL_FALSE; + } +} + /* This function waits until it is possible to write a full sound buffer */ static void PULSEAUDIO_WaitDevice(_THIS) @@ -316,8 +337,7 @@ PULSEAUDIO_OpenDevice(_THIS, const char *devname, int iscapture) this->hidden = (struct SDL_PrivateAudioData *) SDL_malloc((sizeof *this->hidden)); if (this->hidden == NULL) { - SDL_OutOfMemory(); - return 0; + return SDL_OutOfMemory(); } SDL_memset(this->hidden, 0, (sizeof *this->hidden)); h = this->hidden; @@ -350,8 +370,7 @@ PULSEAUDIO_OpenDevice(_THIS, const char *devname, int iscapture) } if (paspec.format == PA_SAMPLE_INVALID) { PULSEAUDIO_CloseDevice(this); - SDL_SetError("Couldn't find any hardware audio formats"); - return 0; + return SDL_SetError("Couldn't find any hardware audio formats"); } this->spec.format = test_format; @@ -366,8 +385,7 @@ PULSEAUDIO_OpenDevice(_THIS, const char *devname, int iscapture) h->mixbuf = (Uint8 *) SDL_AllocAudioMem(h->mixlen); if (h->mixbuf == NULL) { PULSEAUDIO_CloseDevice(this); - SDL_OutOfMemory(); - return 0; + return SDL_OutOfMemory(); } SDL_memset(h->mixbuf, this->spec.silence, this->spec.size); @@ -398,36 +416,31 @@ PULSEAUDIO_OpenDevice(_THIS, const char *devname, int iscapture) /* Set up a new main loop */ if (!(h->mainloop = PULSEAUDIO_pa_mainloop_new())) { PULSEAUDIO_CloseDevice(this); - SDL_SetError("pa_mainloop_new() failed"); - return 0; + return SDL_SetError("pa_mainloop_new() failed"); } h->mainloop_api = PULSEAUDIO_pa_mainloop_get_api(h->mainloop); h->context = PULSEAUDIO_pa_context_new(h->mainloop_api, NULL); if (!h->context) { PULSEAUDIO_CloseDevice(this); - SDL_SetError("pa_context_new() failed"); - return 0; + return SDL_SetError("pa_context_new() failed"); } /* Connect to the PulseAudio server */ if (PULSEAUDIO_pa_context_connect(h->context, NULL, 0, NULL) < 0) { PULSEAUDIO_CloseDevice(this); - SDL_SetError("Could not setup connection to PulseAudio"); - return 0; + return SDL_SetError("Could not setup connection to PulseAudio"); } do { if (PULSEAUDIO_pa_mainloop_iterate(h->mainloop, 1, NULL) < 0) { PULSEAUDIO_CloseDevice(this); - SDL_SetError("pa_mainloop_iterate() failed"); - return 0; + return SDL_SetError("pa_mainloop_iterate() failed"); } state = PULSEAUDIO_pa_context_get_state(h->context); if (!PA_CONTEXT_IS_GOOD(state)) { PULSEAUDIO_CloseDevice(this); - SDL_SetError("Could not connect to PulseAudio"); - return 0; + return SDL_SetError("Could not connect to PulseAudio"); } } while (state != PA_CONTEXT_READY); @@ -440,33 +453,29 @@ PULSEAUDIO_OpenDevice(_THIS, const char *devname, int iscapture) if (h->stream == NULL) { PULSEAUDIO_CloseDevice(this); - SDL_SetError("Could not set up PulseAudio stream"); - return 0; + return SDL_SetError("Could not set up PulseAudio stream"); } if (PULSEAUDIO_pa_stream_connect_playback(h->stream, NULL, &paattr, flags, NULL, NULL) < 0) { PULSEAUDIO_CloseDevice(this); - SDL_SetError("Could not connect PulseAudio stream"); - return 0; + return SDL_SetError("Could not connect PulseAudio stream"); } do { if (PULSEAUDIO_pa_mainloop_iterate(h->mainloop, 1, NULL) < 0) { PULSEAUDIO_CloseDevice(this); - SDL_SetError("pa_mainloop_iterate() failed"); - return 0; + return SDL_SetError("pa_mainloop_iterate() failed"); } state = PULSEAUDIO_pa_stream_get_state(h->stream); if (!PA_STREAM_IS_GOOD(state)) { PULSEAUDIO_CloseDevice(this); - SDL_SetError("Could not create to PulseAudio stream"); - return 0; + return SDL_SetError("Could not create to PulseAudio stream"); } } while (state != PA_STREAM_READY); /* We're ready to rock and roll. :-) */ - return 1; + return 0; } @@ -476,7 +485,6 @@ PULSEAUDIO_Deinitialize(void) UnloadPulseAudioLibrary(); } - static int PULSEAUDIO_Init(SDL_AudioDriverImpl * impl) { @@ -484,6 +492,11 @@ PULSEAUDIO_Init(SDL_AudioDriverImpl * impl) return 0; } + if (!CheckPulseAudioAvailable()) { + UnloadPulseAudioLibrary(); + return 0; + } + /* Set the function pointers */ impl->OpenDevice = PULSEAUDIO_OpenDevice; impl->PlayDevice = PULSEAUDIO_PlayDevice; diff --git a/src/eepp/helper/SDL2/src/audio/pulseaudio/SDL_pulseaudio.h b/src/eepp/helper/SDL2/src/audio/pulseaudio/SDL_pulseaudio.h index 195a446e8..cb9603991 100644 --- a/src/eepp/helper/SDL2/src/audio/pulseaudio/SDL_pulseaudio.h +++ b/src/eepp/helper/SDL2/src/audio/pulseaudio/SDL_pulseaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/audio/qsa/SDL_qsa_audio.c b/src/eepp/helper/SDL2/src/audio/qsa/SDL_qsa_audio.c index 8b1e138f5..e3877b463 100644 --- a/src/eepp/helper/SDL2/src/audio/qsa/SDL_qsa_audio.c +++ b/src/eepp/helper/SDL2/src/audio/qsa/SDL_qsa_audio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -83,10 +83,10 @@ uint32_t qsa_playback_devices; QSA_Device qsa_capture_device[QSA_MAX_DEVICES]; uint32_t qsa_capture_devices; -static inline void +static inline int QSA_SetError(const char *fn, int status) { - SDL_SetError("QSA: %s() failed: %s", fn, snd_strerror(status)); + return SDL_SetError("QSA: %s() failed: %s", fn, snd_strerror(status)); } /* card names check to apply the workarounds */ @@ -183,13 +183,13 @@ QSA_WaitDevice(_THIS) switch (selectret) { case -1: { - SDL_SetError("QSA: select() failed: %s\n", strerror(errno)); + SDL_SetError("QSA: select() failed: %s", strerror(errno)); return; } break; case 0: { - SDL_SetError("QSA: timeout on buffer waiting occured\n"); + SDL_SetError("QSA: timeout on buffer waiting occured"); this->hidden->timeout_on_wait = 1; return; } @@ -237,7 +237,7 @@ QSA_PlayDevice(_THIS) /* the audio device driver */ if ((errno == EAGAIN) && (written == 0)) { if (this->hidden->timeout_on_wait != 0) { - SDL_SetError("QSA: buffer playback timeout\n"); + SDL_SetError("QSA: buffer playback timeout"); return; } } @@ -355,8 +355,7 @@ QSA_OpenDevice(_THIS, const char *devname, int iscapture) (struct SDL_PrivateAudioData))); if (this->hidden == NULL) { - SDL_OutOfMemory(); - return 0; + return SDL_OutOfMemory(); } SDL_memset(this->hidden, 0, sizeof(struct SDL_PrivateAudioData)); @@ -384,8 +383,7 @@ QSA_OpenDevice(_THIS, const char *devname, int iscapture) device++; if (device >= qsa_playback_devices) { QSA_CloseDevice(this); - SDL_SetError("No such playback device"); - return 0; + return SDL_SetError("No such playback device"); } } while (1); } @@ -409,8 +407,7 @@ QSA_OpenDevice(_THIS, const char *devname, int iscapture) device++; if (device >= qsa_capture_devices) { QSA_CloseDevice(this); - SDL_SetError("No such capture device"); - return 0; + return SDL_SetError("No such capture device"); } } while (1); } @@ -448,8 +445,7 @@ QSA_OpenDevice(_THIS, const char *devname, int iscapture) if (status < 0) { this->hidden->audio_handle = NULL; QSA_CloseDevice(this); - QSA_SetError("snd_pcm_open", status); - return 0; + return QSA_SetError("snd_pcm_open", status); } if (!QSA_CheckBuggyCards(this, QSA_MMAP_WORKAROUND)) { @@ -459,8 +455,7 @@ QSA_OpenDevice(_THIS, const char *devname, int iscapture) PLUGIN_DISABLE_MMAP); if (status < 0) { QSA_CloseDevice(this); - QSA_SetError("snd_pcm_plugin_set_disable", status); - return 0; + return QSA_SetError("snd_pcm_plugin_set_disable", status); } } @@ -546,8 +541,7 @@ QSA_OpenDevice(_THIS, const char *devname, int iscapture) /* assumes test_format not 0 on success */ if (test_format == 0) { QSA_CloseDevice(this); - SDL_SetError("QSA: Couldn't find any hardware audio formats"); - return 0; + return SDL_SetError("QSA: Couldn't find any hardware audio formats"); } this->spec.format = test_format; @@ -565,8 +559,7 @@ QSA_OpenDevice(_THIS, const char *devname, int iscapture) status = snd_pcm_plugin_params(this->hidden->audio_handle, &cparams); if (status < 0) { QSA_CloseDevice(this); - QSA_SetError("snd_pcm_channel_params", status); - return 0; + return QSA_SetError("snd_pcm_channel_params", status); } /* Make sure channel is setup right one last time */ @@ -580,8 +573,7 @@ QSA_OpenDevice(_THIS, const char *devname, int iscapture) /* Setup an audio channel */ if (snd_pcm_plugin_setup(this->hidden->audio_handle, &csetup) < 0) { QSA_CloseDevice(this); - SDL_SetError("QSA: Unable to setup channel\n"); - return 0; + return SDL_SetError("QSA: Unable to setup channel"); } /* Calculate the final parameters for this audio specification */ @@ -604,8 +596,7 @@ QSA_OpenDevice(_THIS, const char *devname, int iscapture) (Uint8 *) SDL_AllocAudioMem(this->hidden->pcm_len); if (this->hidden->pcm_buf == NULL) { QSA_CloseDevice(this); - SDL_OutOfMemory(); - return 0; + return SDL_OutOfMemory(); } SDL_memset(this->hidden->pcm_buf, this->spec.silence, this->hidden->pcm_len); @@ -623,8 +614,7 @@ QSA_OpenDevice(_THIS, const char *devname, int iscapture) if (this->hidden->audio_fd < 0) { QSA_CloseDevice(this); - QSA_SetError("snd_pcm_file_descriptor", status); - return 0; + return QSA_SetError("snd_pcm_file_descriptor", status); } /* Prepare an audio channel */ @@ -642,12 +632,11 @@ QSA_OpenDevice(_THIS, const char *devname, int iscapture) if (status < 0) { QSA_CloseDevice(this); - QSA_SetError("snd_pcm_plugin_prepare", status); - return 0; + return QSA_SetError("snd_pcm_plugin_prepare", status); } /* We're really ready to rock and roll. :-) */ - return 1; + return 0; } static void diff --git a/src/eepp/helper/SDL2/src/audio/qsa/SDL_qsa_audio.h b/src/eepp/helper/SDL2/src/audio/qsa/SDL_qsa_audio.h index 7846485ce..1717d0878 100644 --- a/src/eepp/helper/SDL2/src/audio/qsa/SDL_qsa_audio.h +++ b/src/eepp/helper/SDL2/src/audio/qsa/SDL_qsa_audio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/audio/sdlgenaudiocvt.pl b/src/eepp/helper/SDL2/src/audio/sdlgenaudiocvt.pl index 19a8c85dd..474ce8112 100755 --- a/src/eepp/helper/SDL2/src/audio/sdlgenaudiocvt.pl +++ b/src/eepp/helper/SDL2/src/audio/sdlgenaudiocvt.pl @@ -38,7 +38,7 @@ sub outputHeader { /* DO NOT EDIT! This file is generated by sdlgenaudiocvt.pl */ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/audio/sun/SDL_sunaudio.c b/src/eepp/helper/SDL2/src/audio/sun/SDL_sunaudio.c index a62aac091..950ba444c 100644 --- a/src/eepp/helper/SDL2/src/audio/sun/SDL_sunaudio.c +++ b/src/eepp/helper/SDL2/src/audio/sun/SDL_sunaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -22,11 +22,6 @@ #if SDL_AUDIO_DRIVER_SUNAUDIO -/* I'm gambling no one uses this audio backend...we'll see who emails. :) */ -#error this code has not been updated for SDL 1.3. -#error if no one emails icculus at icculus.org and tells him that this -#error code is needed, this audio backend will eventually be removed from SDL. - /* Allow access to a raw mixing buffer */ #include @@ -51,84 +46,21 @@ #include "SDL_sunaudio.h" /* Open the audio device for playback, and don't block if busy */ -#define OPEN_FLAGS (O_WRONLY|O_NONBLOCK) -#if defined(AUDIO_GETINFO) && !defined(AUDIO_GETBUFINFO) +#if defined(AUDIO_GETINFO) && !defined(AUDIO_GETBUFINFO) #define AUDIO_GETBUFINFO AUDIO_GETINFO #endif /* Audio driver functions */ -static int DSP_OpenAudio(_THIS, SDL_AudioSpec * spec); -static void DSP_WaitAudio(_THIS); -static void DSP_PlayAudio(_THIS); -static Uint8 *DSP_GetAudioBuf(_THIS); -static void DSP_CloseAudio(_THIS); - static Uint8 snd2au(int sample); /* Audio driver bootstrap functions */ - -static int -Audio_Available(void) -{ - int fd; - int available; - - available = 0; - fd = SDL_OpenAudioPath(NULL, 0, OPEN_FLAGS, 1); - if (fd >= 0) { - available = 1; - close(fd); - } - return (available); -} - static void -Audio_DeleteDevice(SDL_AudioDevice * device) +SUNAUDIO_DetectDevices(int iscapture, SDL_AddAudioDevice addfn) { - SDL_free(device->hidden); - SDL_free(device); + SDL_EnumUnixAudioDevices(iscapture, 1, (int (*)(int fd)) NULL, addfn); } -static SDL_AudioDevice * -Audio_CreateDevice(int devindex) -{ - SDL_AudioDevice *this; - - /* Initialize all variables that we clean on shutdown */ - this = (SDL_AudioDevice *) SDL_malloc(sizeof(SDL_AudioDevice)); - if (this) { - SDL_memset(this, 0, (sizeof *this)); - this->hidden = (struct SDL_PrivateAudioData *) - SDL_malloc((sizeof *this->hidden)); - } - if ((this == NULL) || (this->hidden == NULL)) { - SDL_OutOfMemory(); - if (this) { - SDL_free(this); - } - return (0); - } - SDL_memset(this->hidden, 0, (sizeof *this->hidden)); - audio_fd = -1; - - /* Set the function pointers */ - this->OpenAudio = DSP_OpenAudio; - this->WaitAudio = DSP_WaitAudio; - this->PlayAudio = DSP_PlayAudio; - this->GetAudioBuf = DSP_GetAudioBuf; - this->CloseAudio = DSP_CloseAudio; - - this->free = Audio_DeleteDevice; - - return this; -} - -AudioBootStrap SUNAUDIO_bootstrap = { - "audio", "UNIX /dev/audio interface", - Audio_Available, Audio_CreateDevice, 0 -}; - #ifdef DEBUG_AUDIO void CheckUnderflow(_THIS) @@ -137,29 +69,29 @@ CheckUnderflow(_THIS) audio_info_t info; int left; - ioctl(audio_fd, AUDIO_GETBUFINFO, &info); - left = (written - info.play.samples); - if (written && (left == 0)) { + ioctl(this->hidden->audio_fd, AUDIO_GETBUFINFO, &info); + left = (this->hidden->written - info.play.samples); + if (this->hidden->written && (left == 0)) { fprintf(stderr, "audio underflow!\n"); } #endif } #endif -void -DSP_WaitAudio(_THIS) +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; - ioctl(audio_fd, AUDIO_GETBUFINFO, &info); - left = (written - info.play.samples); - if (left > fragsize) { + ioctl(this->hidden->audio_fd, AUDIO_GETBUFINFO, &info); + left = (this->hidden->written - info.play.samples); + if (left > this->hidden->fragsize) { Sint32 sleepy; - sleepy = ((left - fragsize) / frequency); + sleepy = ((left - this->hidden->fragsize) / this->hidden->frequency); sleepy -= SLEEP_FUDGE; if (sleepy > 0) { SDL_Delay(sleepy); @@ -169,30 +101,30 @@ DSP_WaitAudio(_THIS) fd_set fdset; FD_ZERO(&fdset); - FD_SET(audio_fd, &fdset); - select(audio_fd + 1, NULL, &fdset, NULL, NULL); + FD_SET(this->hidden->audio_fd, &fdset); + select(this->hidden->audio_fd + 1, NULL, &fdset, NULL, NULL); #endif } -void -DSP_PlayAudio(_THIS) +static void +SUNAUDIO_PlayDevice(_THIS) { /* Write the audio data */ - if (ulaw_only) { + if (this->hidden->ulaw_only) { /* Assuming that this->spec.freq >= 8000 Hz */ int accum, incr, pos; Uint8 *aubuf; accum = 0; incr = this->spec.freq / 8; - aubuf = ulaw_buf; - switch (audio_fmt & 0xFF) { + aubuf = this->hidden->ulaw_buf; + switch (this->hidden->audio_fmt & 0xFF) { case 8: { Uint8 *sndbuf; - sndbuf = mixbuf; - for (pos = 0; pos < fragsize; ++pos) { + sndbuf = this->hidden->mixbuf; + for (pos = 0; pos < this->hidden->fragsize; ++pos) { *aubuf = snd2au((0x80 - *sndbuf) * 64); accum += incr; while (accum > 0) { @@ -207,8 +139,8 @@ DSP_PlayAudio(_THIS) { Sint16 *sndbuf; - sndbuf = (Sint16 *) mixbuf; - for (pos = 0; pos < fragsize; ++pos) { + sndbuf = (Sint16 *) this->hidden->mixbuf; + for (pos = 0; pos < this->hidden->fragsize; ++pos) { *aubuf = snd2au(*sndbuf / 4); accum += incr; while (accum > 0) { @@ -223,63 +155,93 @@ DSP_PlayAudio(_THIS) #ifdef DEBUG_AUDIO CheckUnderflow(this); #endif - if (write(audio_fd, ulaw_buf, fragsize) < 0) { + if (write(this->hidden->audio_fd, this->hidden->ulaw_buf, + this->hidden->fragsize) < 0) { /* Assume fatal error, for now */ this->enabled = 0; } - written += fragsize; + this->hidden->written += this->hidden->fragsize; } else { #ifdef DEBUG_AUDIO CheckUnderflow(this); #endif - if (write(audio_fd, mixbuf, this->spec.size) < 0) { + if (write(this->hidden->audio_fd, this->hidden->mixbuf, + this->spec.size) < 0) { /* Assume fatal error, for now */ this->enabled = 0; } - written += fragsize; + this->hidden->written += this->hidden->fragsize; } } -Uint8 * -DSP_GetAudioBuf(_THIS) +static Uint8 * +SUNAUDIO_GetDeviceBuf(_THIS) { - return (mixbuf); + return (this->hidden->mixbuf); } -void -DSP_CloseAudio(_THIS) +static void +SUNAUDIO_CloseDevice(_THIS) { - if (mixbuf != NULL) { - SDL_FreeAudioMem(mixbuf); - mixbuf = NULL; + if (this->hidden != NULL) { + if (this->hidden->mixbuf != NULL) { + SDL_FreeAudioMem(this->hidden->mixbuf); + this->hidden->mixbuf = NULL; + } + if (this->hidden->ulaw_buf != NULL) { + SDL_free(this->hidden->ulaw_buf); + this->hidden->ulaw_buf = NULL; + } + if (this->hidden->audio_fd >= 0) { + close(this->hidden->audio_fd); + this->hidden->audio_fd = -1; + } + SDL_free(this->hidden); + this->hidden = NULL; } - if (ulaw_buf != NULL) { - SDL_free(ulaw_buf); - ulaw_buf = NULL; - } - close(audio_fd); } -int -DSP_OpenAudio(_THIS, SDL_AudioSpec * spec) +static int +SUNAUDIO_OpenDevice(_THIS, const char *devname, int iscapture) { - char audiodev[1024]; + const int flags = ((iscapture) ? OPEN_FLAGS_INPUT : OPEN_FLAGS_OUTPUT); + SDL_AudioFormat format = 0; + audio_info_t info; + + /* We don't care what the devname is...we'll try to open anything. */ + /* ...but default to first name in the list... */ + if (devname == NULL) { + devname = SDL_GetAudioDeviceName(0, iscapture); + if (devname == NULL) { + return SDL_SetError("No such audio device"); + } + } + + /* Initialize all variables that we clean on shutdown */ + 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)); + + /* Open the audio device */ + this->hidden->audio_fd = open(devname, flags, 0); + if (this->hidden->audio_fd < 0) { + return SDL_SetError("Couldn't open %s: %s", devname, strerror(errno)); + } + #ifdef AUDIO_SETINFO int enc; #endif - int desired_freq = spec->freq; - - /* Initialize our freeable variables, in case we fail */ - audio_fd = -1; - mixbuf = NULL; - ulaw_buf = NULL; + int desired_freq = this->spec.freq; /* Determine the audio parameters from the AudioSpec */ - switch (SDL_AUDIO_BITSIZE(spec->format)) { + switch (SDL_AUDIO_BITSIZE(this->spec.format)) { case 8: { /* Unsigned 8 bit audio data */ - spec->format = AUDIO_U8; + this->spec.format = AUDIO_U8; #ifdef AUDIO_SETINFO enc = AUDIO_ENCODING_LINEAR8; #endif @@ -288,7 +250,7 @@ DSP_OpenAudio(_THIS, SDL_AudioSpec * spec) case 16: { /* Signed 16 bit audio data */ - spec->format = AUDIO_S16SYS; + this->spec.format = AUDIO_S16SYS; #ifdef AUDIO_SETINFO enc = AUDIO_ENCODING_LINEAR; #endif @@ -298,44 +260,35 @@ DSP_OpenAudio(_THIS, SDL_AudioSpec * spec) default: { /* !!! FIXME: fallback to conversion on unsupported types! */ - SDL_SetError("Unsupported audio format"); - return (-1); + return SDL_SetError("Unsupported audio format"); } } - audio_fmt = spec->format; + this->hidden->audio_fmt = this->spec.format; - /* Open the audio device */ - audio_fd = SDL_OpenAudioPath(audiodev, sizeof(audiodev), OPEN_FLAGS, 1); - if (audio_fd < 0) { - SDL_SetError("Couldn't open %s: %s", audiodev, strerror(errno)); - return (-1); - } - - ulaw_only = 0; /* modern Suns do support linear audio */ + this->hidden->ulaw_only = 0; /* modern Suns do support linear audio */ #ifdef AUDIO_SETINFO for (;;) { audio_info_t info; AUDIO_INITINFO(&info); /* init all fields to "no change" */ /* Try to set the requested settings */ - info.play.sample_rate = spec->freq; - info.play.channels = spec->channels; + info.play.sample_rate = this->spec.freq; + info.play.channels = this->spec.channels; info.play.precision = (enc == AUDIO_ENCODING_ULAW) - ? 8 : spec->format & 0xff; + ? 8 : this->spec.format & 0xff; info.play.encoding = enc; - if (ioctl(audio_fd, AUDIO_SETINFO, &info) == 0) { + if (ioctl(this->hidden->audio_fd, AUDIO_SETINFO, &info) == 0) { /* Check to be sure we got what we wanted */ - if (ioctl(audio_fd, AUDIO_GETINFO, &info) < 0) { - SDL_SetError("Error getting audio parameters: %s", - strerror(errno)); - return -1; + if (ioctl(this->hidden->audio_fd, AUDIO_GETINFO, &info) < 0) { + return SDL_SetError("Error getting audio parameters: %s", + strerror(errno)); } if (info.play.encoding == enc - && info.play.precision == (spec->format & 0xff) - && info.play.channels == spec->channels) { + && info.play.precision == (this->spec.format & 0xff) + && info.play.channels == this->spec.channels) { /* Yow! All seems to be well! */ - spec->freq = info.play.sample_rate; + this->spec.freq = info.play.sample_rate; break; } } @@ -344,63 +297,61 @@ DSP_OpenAudio(_THIS, SDL_AudioSpec * spec) case AUDIO_ENCODING_LINEAR8: /* unsigned 8bit apparently not supported here */ enc = AUDIO_ENCODING_LINEAR; - spec->format = AUDIO_S16SYS; + this->spec.format = AUDIO_S16SYS; break; /* try again */ case AUDIO_ENCODING_LINEAR: /* linear 16bit didn't work either, resort to µ-law */ enc = AUDIO_ENCODING_ULAW; - spec->channels = 1; - spec->freq = 8000; - spec->format = AUDIO_U8; - ulaw_only = 1; + this->spec.channels = 1; + this->spec.freq = 8000; + this->spec.format = AUDIO_U8; + this->hidden->ulaw_only = 1; break; default: /* oh well... */ - SDL_SetError("Error setting audio parameters: %s", - strerror(errno)); - return -1; + return SDL_SetError("Error setting audio parameters: %s", + strerror(errno)); } } #endif /* AUDIO_SETINFO */ - written = 0; + this->hidden->written = 0; /* We can actually convert on-the-fly to U-Law */ - if (ulaw_only) { - spec->freq = desired_freq; - fragsize = (spec->samples * 1000) / (spec->freq / 8); - frequency = 8; - ulaw_buf = (Uint8 *) SDL_malloc(fragsize); - if (ulaw_buf == NULL) { - SDL_OutOfMemory(); - return (-1); + if (this->hidden->ulaw_only) { + this->spec.freq = desired_freq; + this->hidden->fragsize = (this->spec.samples * 1000) / + (this->spec.freq / 8); + this->hidden->frequency = 8; + this->hidden->ulaw_buf = (Uint8 *) SDL_malloc(this->hidden->fragsize); + if (this->hidden->ulaw_buf == NULL) { + return SDL_OutOfMemory(); } - spec->channels = 1; + this->spec.channels = 1; } else { - fragsize = spec->samples; - frequency = spec->freq / 1000; + this->hidden->fragsize = this->spec.samples; + this->hidden->frequency = this->spec.freq / 1000; } #ifdef DEBUG_AUDIO fprintf(stderr, "Audio device %s U-Law only\n", - ulaw_only ? "is" : "is not"); + this->hidden->ulaw_only ? "is" : "is not"); fprintf(stderr, "format=0x%x chan=%d freq=%d\n", - spec->format, spec->channels, spec->freq); + this->spec.format, this->spec.channels, this->spec.freq); #endif /* Update the fragment size as size in bytes */ - SDL_CalculateAudioSpec(spec); + SDL_CalculateAudioSpec(&this->spec); /* Allocate mixing buffer */ - mixbuf = (Uint8 *) SDL_AllocAudioMem(spec->size); - if (mixbuf == NULL) { - SDL_OutOfMemory(); - return (-1); + this->hidden->mixbuf = (Uint8 *) SDL_AllocAudioMem(this->spec.size); + if (this->hidden->mixbuf == NULL) { + return SDL_OutOfMemory(); } - SDL_memset(mixbuf, spec->silence, spec->size); + SDL_memset(this->hidden->mixbuf, this->spec.silence, this->spec.size); /* We're ready to rock and roll. :-) */ - return (0); + return 0; } /************************************************************************/ @@ -456,6 +407,24 @@ snd2au(int sample) return (mask & sample); } +static int +SUNAUDIO_Init(SDL_AudioDriverImpl * impl) +{ + /* Set the function pointers */ + impl->DetectDevices = SUNAUDIO_DetectDevices; + impl->OpenDevice = SUNAUDIO_OpenDevice; + impl->PlayDevice = SUNAUDIO_PlayDevice; + impl->WaitDevice = SUNAUDIO_WaitDevice; + impl->GetDeviceBuf = SUNAUDIO_GetDeviceBuf; + impl->CloseDevice = SUNAUDIO_CloseDevice; + + return 1; /* this audio target is available. */ +} + +AudioBootStrap SUNAUDIO_bootstrap = { + "audio", "UNIX /dev/audio interface", SUNAUDIO_Init, 0 +}; + #endif /* SDL_AUDIO_DRIVER_SUNAUDIO */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/eepp/helper/SDL2/src/audio/sun/SDL_sunaudio.h b/src/eepp/helper/SDL2/src/audio/sun/SDL_sunaudio.h index c90c646e6..9b92266fb 100644 --- a/src/eepp/helper/SDL2/src/audio/sun/SDL_sunaudio.h +++ b/src/eepp/helper/SDL2/src/audio/sun/SDL_sunaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -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 { @@ -42,16 +42,6 @@ struct SDL_PrivateAudioData int frequency; /* The audio frequency in KHz */ }; -/* Old variable names */ -#define audio_fd (this->hidden->audio_fd) -#define audio_fmt (this->hidden->audio_fmt) -#define mixbuf (this->hidden->mixbuf) -#define ulaw_only (this->hidden->ulaw_only) -#define ulaw_buf (this->hidden->ulaw_buf) -#define written (this->hidden->written) -#define fragsize (this->hidden->fragsize) -#define frequency (this->hidden->frequency) - #endif /* _SDL_sunaudio_h */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/eepp/helper/SDL2/src/audio/winmm/SDL_winmm.c b/src/eepp/helper/SDL2/src/audio/winmm/SDL_winmm.c index 63e48aa61..f52a3afb1 100644 --- a/src/eepp/helper/SDL2/src/audio/winmm/SDL_winmm.c +++ b/src/eepp/helper/SDL2/src/audio/winmm/SDL_winmm.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -91,7 +91,7 @@ FillSound(HWAVEOUT hwo, UINT uMsg, DWORD_PTR dwInstance, ReleaseSemaphore(this->hidden->audio_sem, 1, NULL); } -static void +static int SetMMerror(char *function, MMRESULT code) { size_t len; @@ -105,7 +105,7 @@ SetMMerror(char *function, MMRESULT code) WideCharToMultiByte(CP_ACP, 0, werrbuf, -1, errbuf + len, MAXERRORLENGTH - len, NULL, NULL); - SDL_SetError("%s", errbuf); + return SDL_SetError("%s", errbuf); } static void @@ -234,8 +234,7 @@ WINMM_OpenDevice(_THIS, const char *devname, int iscapture) } if (devId == WAVE_MAPPER) { - SDL_SetError("Requested device not found"); - return 0; + return SDL_SetError("Requested device not found"); } } @@ -243,8 +242,7 @@ WINMM_OpenDevice(_THIS, const char *devname, int iscapture) this->hidden = (struct SDL_PrivateAudioData *) SDL_malloc((sizeof *this->hidden)); if (this->hidden == NULL) { - SDL_OutOfMemory(); - return 0; + return SDL_OutOfMemory(); } SDL_memset(this->hidden, 0, (sizeof *this->hidden)); @@ -270,8 +268,7 @@ WINMM_OpenDevice(_THIS, const char *devname, int iscapture) if (!valid_datatype) { WINMM_CloseDevice(this); - SDL_SetError("Unsupported audio format"); - return 0; + return SDL_SetError("Unsupported audio format"); } /* Set basic WAVE format parameters */ @@ -309,8 +306,7 @@ WINMM_OpenDevice(_THIS, const char *devname, int iscapture) if (result != MMSYSERR_NOERROR) { WINMM_CloseDevice(this); - SetMMerror("waveOutOpen()", result); - return 0; + return SetMMerror("waveOutOpen()", result); } #ifdef SOUND_DEBUG /* Check the sound device we retrieved */ @@ -321,8 +317,7 @@ WINMM_OpenDevice(_THIS, const char *devname, int iscapture) &caps, sizeof(caps)); if (result != MMSYSERR_NOERROR) { WINMM_CloseDevice(this); - SetMMerror("waveOutGetDevCaps()", result); - return 0; + return SetMMerror("waveOutGetDevCaps()", result); } printf("Audio device: %s\n", caps.szPname); } @@ -333,8 +328,7 @@ WINMM_OpenDevice(_THIS, const char *devname, int iscapture) CreateSemaphore(NULL, NUM_BUFFERS - 1, NUM_BUFFERS, NULL); if (this->hidden->audio_sem == NULL) { WINMM_CloseDevice(this); - SDL_SetError("Couldn't create semaphore"); - return 0; + return SDL_SetError("Couldn't create semaphore"); } /* Create the sound buffers */ @@ -342,8 +336,7 @@ WINMM_OpenDevice(_THIS, const char *devname, int iscapture) (Uint8 *) SDL_malloc(NUM_BUFFERS * this->spec.size); if (this->hidden->mixbuf == NULL) { WINMM_CloseDevice(this); - SDL_OutOfMemory(); - return 0; + return SDL_OutOfMemory(); } for (i = 0; i < NUM_BUFFERS; ++i) { SDL_memset(&this->hidden->wavebuf[i], 0, @@ -357,12 +350,11 @@ WINMM_OpenDevice(_THIS, const char *devname, int iscapture) sizeof(this->hidden->wavebuf[i])); if (result != MMSYSERR_NOERROR) { WINMM_CloseDevice(this); - SetMMerror("waveOutPrepareHeader()", result); - return 0; + return SetMMerror("waveOutPrepareHeader()", result); } } - return 1; /* Ready to go! */ + return 0; /* Ready to go! */ } diff --git a/src/eepp/helper/SDL2/src/audio/winmm/SDL_winmm.h b/src/eepp/helper/SDL2/src/audio/winmm/SDL_winmm.h index a69a26438..5a0574d1e 100644 --- a/src/eepp/helper/SDL2/src/audio/winmm/SDL_winmm.h +++ b/src/eepp/helper/SDL2/src/audio/winmm/SDL_winmm.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -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/eepp/helper/SDL2/src/audio/xaudio2/SDL_xaudio2.c b/src/eepp/helper/SDL2/src/audio/xaudio2/SDL_xaudio2.c index d42d89638..a2c45ba86 100644 --- a/src/eepp/helper/SDL2/src/audio/xaudio2/SDL_xaudio2.c +++ b/src/eepp/helper/SDL2/src/audio/xaudio2/SDL_xaudio2.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -28,20 +28,25 @@ #include "../SDL_sysaudio.h" #include "SDL_assert.h" +#ifdef __GNUC__ +/* The configure script already did any necessary checking */ +# define SDL_XAUDIO2_HAS_SDK 1 +#else #include /* XAudio2 exists as of the March 2008 DirectX SDK */ #if (!defined(_DXSDK_BUILD_MAJOR) || (_DXSDK_BUILD_MAJOR < 1284)) # pragma message("Your DirectX SDK is too old. Disabling XAudio2 support.") #else # define SDL_XAUDIO2_HAS_SDK 1 #endif +#endif /* __GNUC__ */ #ifdef SDL_XAUDIO2_HAS_SDK #define INITGUID 1 -#include +#include /* Hidden "this" pointer for the audio functions */ -#define _THIS SDL_AudioDevice *this +#define _THIS SDL_AudioDevice *this struct SDL_PrivateAudioData { @@ -69,13 +74,12 @@ XAUDIO2_DetectDevices(int iscapture, SDL_AddAudioDevice addfn) IXAudio2 *ixa2 = NULL; UINT32 devcount = 0; UINT32 i = 0; - void *ptr = NULL; if (iscapture) { SDL_SetError("XAudio2: capture devices unsupported."); return; } else if (XAudio2Create(&ixa2, 0, XAUDIO2_DEFAULT_PROCESSOR) != S_OK) { - SDL_SetError("XAudio2: XAudio2Create() failed."); + SDL_SetError("XAudio2: XAudio2Create() failed at detection."); return; } else if (IXAudio2_GetDeviceCount(ixa2, &devcount) != S_OK) { SDL_SetError("XAudio2: IXAudio2::GetDeviceCount() failed."); @@ -232,24 +236,22 @@ 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) { - SDL_SetError("XAudio2: capture devices unsupported."); - return 0; + return SDL_SetError("XAudio2: capture devices unsupported."); } else if (XAudio2Create(&ixa2, 0, XAUDIO2_DEFAULT_PROCESSOR) != S_OK) { - SDL_SetError("XAudio2: XAudio2Create() failed."); - return 0; + return SDL_SetError("XAudio2: XAudio2Create() failed at open."); } if (devname != NULL) { @@ -258,8 +260,7 @@ XAUDIO2_OpenDevice(_THIS, const char *devname, int iscapture) if (IXAudio2_GetDeviceCount(ixa2, &devcount) != S_OK) { IXAudio2_Release(ixa2); - SDL_SetError("XAudio2: IXAudio2_GetDeviceCount() failed."); - return 0; + return SDL_SetError("XAudio2: IXAudio2_GetDeviceCount() failed."); } for (i = 0; i < devcount; i++) { XAUDIO2_DEVICE_DETAILS details; @@ -278,8 +279,7 @@ XAUDIO2_OpenDevice(_THIS, const char *devname, int iscapture) if (i == devcount) { IXAudio2_Release(ixa2); - SDL_SetError("XAudio2: Requested device not found."); - return 0; + return SDL_SetError("XAudio2: Requested device not found."); } } @@ -288,8 +288,7 @@ XAUDIO2_OpenDevice(_THIS, const char *devname, int iscapture) SDL_malloc((sizeof *this->hidden)); if (this->hidden == NULL) { IXAudio2_Release(ixa2); - SDL_OutOfMemory(); - return 0; + return SDL_OutOfMemory(); } SDL_memset(this->hidden, 0, (sizeof *this->hidden)); @@ -297,8 +296,7 @@ XAUDIO2_OpenDevice(_THIS, const char *devname, int iscapture) this->hidden->semaphore = CreateSemaphore(NULL, 1, 2, NULL); if (this->hidden->semaphore == NULL) { XAUDIO2_CloseDevice(this); - SDL_SetError("XAudio2: CreateSemaphore() failed!"); - return 0; + return SDL_SetError("XAudio2: CreateSemaphore() failed!"); } while ((!valid_format) && (test_format)) { @@ -316,8 +314,7 @@ XAUDIO2_OpenDevice(_THIS, const char *devname, int iscapture) if (!valid_format) { XAUDIO2_CloseDevice(this); - SDL_SetError("XAudio2: Unsupported audio format"); - return 0; + return SDL_SetError("XAudio2: Unsupported audio format"); } /* Update the fragment size as size in bytes */ @@ -328,8 +325,7 @@ XAUDIO2_OpenDevice(_THIS, const char *devname, int iscapture) this->hidden->mixbuf = (Uint8 *) SDL_malloc(2 * this->hidden->mixlen); if (this->hidden->mixbuf == NULL) { XAUDIO2_CloseDevice(this); - SDL_OutOfMemory(); - return 0; + return SDL_OutOfMemory(); } this->hidden->nextbuf = this->hidden->mixbuf; SDL_memset(this->hidden->mixbuf, 0, 2 * this->hidden->mixlen); @@ -345,8 +341,7 @@ XAUDIO2_OpenDevice(_THIS, const char *devname, int iscapture) this->spec.freq, 0, devId, NULL); if (result != S_OK) { XAUDIO2_CloseDevice(this); - SDL_SetError("XAudio2: Couldn't create mastering voice"); - return 0; + return SDL_SetError("XAudio2: Couldn't create mastering voice"); } SDL_zero(waveformat); @@ -369,8 +364,7 @@ XAUDIO2_OpenDevice(_THIS, const char *devname, int iscapture) 1.0f, &callbacks, NULL, NULL); if (result != S_OK) { XAUDIO2_CloseDevice(this); - SDL_SetError("XAudio2: Couldn't create source voice"); - return 0; + return SDL_SetError("XAudio2: Couldn't create source voice"); } this->hidden->source = source; @@ -378,18 +372,16 @@ XAUDIO2_OpenDevice(_THIS, const char *devname, int iscapture) result = IXAudio2_StartEngine(ixa2); if (result != S_OK) { XAUDIO2_CloseDevice(this); - SDL_SetError("XAudio2: Couldn't start engine"); - return 0; + return SDL_SetError("XAudio2: Couldn't start engine"); } result = IXAudio2SourceVoice_Start(source, 0, XAUDIO2_COMMIT_NOW); if (result != S_OK) { XAUDIO2_CloseDevice(this); - SDL_SetError("XAudio2: Couldn't start source voice"); - return 0; + return SDL_SetError("XAudio2: Couldn't start source voice"); } - return 1; /* good to go. */ + return 0; /* good to go. */ } static void @@ -417,7 +409,7 @@ XAUDIO2_Init(SDL_AudioDriverImpl * impl) if (XAudio2Create(&ixa2, 0, XAUDIO2_DEFAULT_PROCESSOR) != S_OK) { WIN_CoUninitialize(); - SDL_SetError("XAudio2: XAudio2Create() failed"); + SDL_SetError("XAudio2: XAudio2Create() failed at initialization"); return 0; /* not available. */ } IXAudio2_Release(ixa2); diff --git a/src/eepp/helper/SDL2/src/core/android/SDL_android.cpp b/src/eepp/helper/SDL2/src/core/android/SDL_android.cpp index 9296e9ed3..6fbb678fd 100644 --- a/src/eepp/helper/SDL2/src/core/android/SDL_android.cpp +++ b/src/eepp/helper/SDL2/src/core/android/SDL_android.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -27,6 +27,7 @@ #include "SDL_system.h" #include "SDL_android.h" +#include extern "C" { #include "../../events/SDL_events_c.h" @@ -36,6 +37,8 @@ extern "C" { #include #include +#include +#include #define LOG_TAG "SDL_android" //#define LOGI(...) __android_log_print(ANDROID_LOG_INFO,LOG_TAG,__VA_ARGS__) //#define LOGE(...) __android_log_print(ANDROID_LOG_ERROR,LOG_TAG,__VA_ARGS__) @@ -101,7 +104,7 @@ extern "C" jint JNI_OnLoad(JavaVM* vm, void* reserved) else { Android_JNI_SetupThread(); } - + return JNI_VERSION_1_4; } @@ -115,11 +118,11 @@ extern "C" void SDL_Android_Init(JNIEnv* mEnv, jclass cls) mActivityClass = (jclass)mEnv->NewGlobalRef(cls); midCreateGLContext = mEnv->GetStaticMethodID(mActivityClass, - "createGLContext","(II)Z"); + "createGLContext","(II[I)Z"); midFlipBuffers = mEnv->GetStaticMethodID(mActivityClass, "flipBuffers","()V"); - midAudioInit = mEnv->GetStaticMethodID(mActivityClass, - "audioInit", "(IZZI)Ljava/lang/Object;"); + midAudioInit = mEnv->GetStaticMethodID(mActivityClass, + "audioInit", "(IZZI)V"); midAudioWriteShortBuffer = mEnv->GetStaticMethodID(mActivityClass, "audioWriteShortBuffer", "([S)V"); midAudioWriteByteBuffer = mEnv->GetStaticMethodID(mActivityClass, @@ -178,12 +181,20 @@ extern "C" void Java_org_libsdl_app_SDLActivity_onNativeAccel( bHasNewData = true; } +// 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); } // Pause @@ -196,12 +207,20 @@ extern "C" void Java_org_libsdl_app_SDLActivity_nativePause( SDL_SendWindowEvent(Android_Window, SDL_WINDOWEVENT_FOCUS_LOST, 0, 0); SDL_SendWindowEvent(Android_Window, SDL_WINDOWEVENT_MINIMIZED, 0, 0); } + + __android_log_print(ANDROID_LOG_VERBOSE, "SDL", "nativePause()"); + SDL_SendAppEvent(SDL_APP_WILLENTERBACKGROUND); + SDL_SendAppEvent(SDL_APP_DIDENTERBACKGROUND); } // Resume extern "C" void Java_org_libsdl_app_SDLActivity_nativeResume( JNIEnv* env, jclass cls) { + __android_log_print(ANDROID_LOG_VERBOSE, "SDL", "nativeResume()"); + SDL_SendAppEvent(SDL_APP_WILLENTERFOREGROUND); + SDL_SendAppEvent(SDL_APP_DIDENTERFOREGROUND); + if (Android_Window) { /* Signal the resume semaphore so the event loop knows to resume and restore the GL Context * We can't restore the GL Context here because it needs to be done on the SDL main thread @@ -292,30 +311,54 @@ protected: }; int LocalReferenceHolder::s_active; -extern "C" SDL_bool Android_JNI_CreateContext(int majorVersion, int minorVersion) +extern "C" SDL_bool Android_JNI_CreateContext(int majorVersion, int minorVersion, + int red, int green, int blue, int alpha, + int buffer, int depth, int stencil, + int buffers, int samples) { - JNIEnv *mEnv = Android_JNI_GetEnv(); - if (mEnv->CallStaticBooleanMethod(mActivityClass, midCreateGLContext, majorVersion, minorVersion)) { - return SDL_TRUE; - } else { - return SDL_FALSE; - } + JNIEnv *env = Android_JNI_GetEnv(); + + jint attribs[] = { + EGL_RED_SIZE, red, + EGL_GREEN_SIZE, green, + EGL_BLUE_SIZE, blue, + EGL_ALPHA_SIZE, alpha, + EGL_BUFFER_SIZE, buffer, + EGL_DEPTH_SIZE, depth, + EGL_STENCIL_SIZE, stencil, + EGL_SAMPLE_BUFFERS, buffers, + EGL_SAMPLES, samples, + EGL_RENDERABLE_TYPE, (majorVersion == 1 ? EGL_OPENGL_ES_BIT : EGL_OPENGL_ES2_BIT), + EGL_NONE + }; + int len = SDL_arraysize(attribs); + + jintArray array; + + array = env->NewIntArray(len); + env->SetIntArrayRegion(array, 0, len, attribs); + + jboolean success = env->CallStaticBooleanMethod(mActivityClass, midCreateGLContext, majorVersion, minorVersion, array); + + env->DeleteLocalRef(array); + + return success ? SDL_TRUE : SDL_FALSE; } 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) { jmethodID mid; JNIEnv *mEnv = Android_JNI_GetEnv(); - mid = mEnv->GetStaticMethodID(mActivityClass,"setActivityTitle","(Ljava/lang/String;)V"); + mid = mEnv->GetStaticMethodID(mActivityClass,"setActivityTitle","(Ljava/lang/String;)Z"); if (mid) { jstring jtitle = reinterpret_cast(mEnv->NewStringUTF(title)); - mEnv->CallStaticVoidMethod(mActivityClass, mid, jtitle); + mEnv->CallStaticBooleanMethod(mActivityClass, mid, jtitle); mEnv->DeleteLocalRef(jtitle); } } @@ -395,7 +438,6 @@ extern "C" int Android_JNI_OpenAudioDevice(int sampleRate, int is16Bit, int chan { int audioBufferFrames; - int status; JNIEnv *env = Android_JNI_GetEnv(); if (!env) { @@ -403,18 +445,34 @@ extern "C" int Android_JNI_OpenAudioDevice(int sampleRate, int is16Bit, int chan } Android_JNI_SetupThread(); - __android_log_print(ANDROID_LOG_VERBOSE, "SDL", "SDL audio: opening device"); audioBuffer16Bit = is16Bit; audioBufferStereo = channelCount > 1; - audioBuffer = env->CallStaticObjectMethod(mActivityClass, midAudioInit, sampleRate, audioBuffer16Bit, audioBufferStereo, desiredBufferFrames); + env->CallStaticVoidMethod(mActivityClass, midAudioInit, sampleRate, audioBuffer16Bit, audioBufferStereo, desiredBufferFrames); + + /* 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) { + audioBuffer = env->NewGlobalRef(audioBufferLocal); + env->DeleteLocalRef(audioBufferLocal); + } + } + else { + jbyteArray audioBufferLocal = env->NewByteArray(desiredBufferFrames * (audioBufferStereo ? 2 : 1)); + if (audioBufferLocal) { + audioBuffer = env->NewGlobalRef(audioBufferLocal); + env->DeleteLocalRef(audioBufferLocal); + } + } if (audioBuffer == NULL) { - __android_log_print(ANDROID_LOG_WARN, "SDL", "SDL audio: didn't get back a good audio buffer!"); + __android_log_print(ANDROID_LOG_WARN, "SDL", "SDL audio: could not allocate an audio buffer!"); return 0; } - audioBuffer = env->NewGlobalRef(audioBuffer); jboolean isCopy = JNI_FALSE; if (audioBuffer16Bit) { @@ -427,7 +485,7 @@ extern "C" int Android_JNI_OpenAudioDevice(int sampleRate, int is16Bit, int chan if (audioBufferStereo) { audioBufferFrames /= 2; } - + return audioBufferFrames; } @@ -453,10 +511,9 @@ extern "C" void Android_JNI_WriteAudioBuffer() extern "C" void Android_JNI_CloseAudioDevice() { - int status; JNIEnv *env = Android_JNI_GetEnv(); - env->CallStaticVoidMethod(mActivityClass, midAudioQuit); + env->CallStaticVoidMethod(mActivityClass, midAudioQuit); if (audioBuffer) { env->DeleteGlobalRef(audioBuffer); @@ -466,7 +523,8 @@ extern "C" void Android_JNI_CloseAudioDevice() } // Test for an exception and call SDL_SetError with its detail if one occurs -static bool Android_JNI_ExceptionOccurred() +// If optional parameter silent is truthy then SDL_SetError() is not called. +static bool Android_JNI_ExceptionOccurred(bool silent = false) { SDL_assert(LocalReferenceHolder::IsActive()); JNIEnv *mEnv = Android_JNI_GetEnv(); @@ -478,27 +536,28 @@ static bool Android_JNI_ExceptionOccurred() // Until this happens most JNI operations have undefined behaviour mEnv->ExceptionClear(); - jclass exceptionClass = mEnv->GetObjectClass(exception); - jclass classClass = mEnv->FindClass("java/lang/Class"); + if (!silent) { + jclass exceptionClass = mEnv->GetObjectClass(exception); + jclass classClass = mEnv->FindClass("java/lang/Class"); - mid = mEnv->GetMethodID(classClass, "getName", "()Ljava/lang/String;"); - jstring exceptionName = (jstring)mEnv->CallObjectMethod(exceptionClass, mid); - const char* exceptionNameUTF8 = mEnv->GetStringUTFChars(exceptionName, 0); + mid = mEnv->GetMethodID(classClass, "getName", "()Ljava/lang/String;"); + jstring exceptionName = (jstring)mEnv->CallObjectMethod(exceptionClass, mid); + const char* exceptionNameUTF8 = mEnv->GetStringUTFChars(exceptionName, 0); - mid = mEnv->GetMethodID(exceptionClass, "getMessage", "()Ljava/lang/String;"); - jstring exceptionMessage = (jstring)mEnv->CallObjectMethod(exception, mid); + mid = mEnv->GetMethodID(exceptionClass, "getMessage", "()Ljava/lang/String;"); + jstring exceptionMessage = (jstring)mEnv->CallObjectMethod(exception, mid); - if (exceptionMessage != NULL) { - const char* exceptionMessageUTF8 = mEnv->GetStringUTFChars( - exceptionMessage, 0); - SDL_SetError("%s: %s", exceptionNameUTF8, exceptionMessageUTF8); - mEnv->ReleaseStringUTFChars(exceptionMessage, exceptionMessageUTF8); - } else { - SDL_SetError("%s", exceptionNameUTF8); + if (exceptionMessage != NULL) { + const char* exceptionMessageUTF8 = mEnv->GetStringUTFChars(exceptionMessage, 0); + SDL_SetError("%s: %s", exceptionNameUTF8, exceptionMessageUTF8); + mEnv->ReleaseStringUTFChars(exceptionMessage, exceptionMessageUTF8); + } else { + SDL_SetError("%s", exceptionNameUTF8); + } + + mEnv->ReleaseStringUTFChars(exceptionName, exceptionNameUTF8); } - mEnv->ReleaseStringUTFChars(exceptionName, exceptionNameUTF8); - return true; } @@ -517,6 +576,9 @@ static int Android_JNI_FileOpen(SDL_RWops* ctx) jclass channels; jobject readableByteChannel; jstring fileNameJString; + jobject fd; + jclass fdCls; + jfieldID descriptor; JNIEnv *mEnv = Android_JNI_GetEnv(); if (!refs.init(mEnv)) { @@ -524,61 +586,101 @@ static int Android_JNI_FileOpen(SDL_RWops* ctx) } fileNameJString = (jstring)ctx->hidden.androidio.fileNameRef; + ctx->hidden.androidio.position = 0; // context = SDLActivity.getContext(); mid = mEnv->GetStaticMethodID(mActivityClass, "getContext","()Landroid/content/Context;"); context = mEnv->CallStaticObjectMethod(mActivityClass, mid); + // assetManager = context.getAssets(); mid = mEnv->GetMethodID(mEnv->GetObjectClass(context), "getAssets", "()Landroid/content/res/AssetManager;"); assetManager = mEnv->CallObjectMethod(context, mid); - // inputStream = assetManager.open(); - mid = mEnv->GetMethodID(mEnv->GetObjectClass(assetManager), - "open", "(Ljava/lang/String;)Ljava/io/InputStream;"); + /* First let's try opening the file to obtain an AssetFileDescriptor. + * This method reads the files directly from the APKs using standard *nix calls + */ + mid = mEnv->GetMethodID(mEnv->GetObjectClass(assetManager), "openFd", "(Ljava/lang/String;)Landroid/content/res/AssetFileDescriptor;"); inputStream = mEnv->CallObjectMethod(assetManager, mid, fileNameJString); - if (Android_JNI_ExceptionOccurred()) { - goto failure; + if (Android_JNI_ExceptionOccurred(true)) { + goto fallback; } - ctx->hidden.androidio.inputStreamRef = mEnv->NewGlobalRef(inputStream); - - // Despite all the visible documentation on [Asset]InputStream claiming - // that the .available() method is not guaranteed to return the entire file - // size, comments in /samples//ApiDemos/src/com/example/ ... - // android/apis/content/ReadAsset.java imply that Android's - // AssetInputStream.available() /will/ always return the total file size - - // size = inputStream.available(); - mid = mEnv->GetMethodID(mEnv->GetObjectClass(inputStream), - "available", "()I"); - ctx->hidden.androidio.size = mEnv->CallIntMethod(inputStream, mid); - if (Android_JNI_ExceptionOccurred()) { - goto failure; + mid = mEnv->GetMethodID(mEnv->GetObjectClass(inputStream), "getStartOffset", "()J"); + ctx->hidden.androidio.offset = mEnv->CallLongMethod(inputStream, mid); + if (Android_JNI_ExceptionOccurred(true)) { + goto fallback; } - // readableByteChannel = Channels.newChannel(inputStream); - channels = mEnv->FindClass("java/nio/channels/Channels"); - mid = mEnv->GetStaticMethodID(channels, - "newChannel", - "(Ljava/io/InputStream;)Ljava/nio/channels/ReadableByteChannel;"); - readableByteChannel = mEnv->CallStaticObjectMethod( - channels, mid, inputStream); - if (Android_JNI_ExceptionOccurred()) { - goto failure; + mid = mEnv->GetMethodID(mEnv->GetObjectClass(inputStream), "getDeclaredLength", "()J"); + ctx->hidden.androidio.size = mEnv->CallLongMethod(inputStream, mid); + if (Android_JNI_ExceptionOccurred(true)) { + goto fallback; } - ctx->hidden.androidio.readableByteChannelRef = - mEnv->NewGlobalRef(readableByteChannel); + mid = mEnv->GetMethodID(mEnv->GetObjectClass(inputStream), "getFileDescriptor", "()Ljava/io/FileDescriptor;"); + fd = mEnv->CallObjectMethod(inputStream, mid); + fdCls = mEnv->GetObjectClass(fd); + descriptor = mEnv->GetFieldID(fdCls, "descriptor", "I"); + ctx->hidden.androidio.fd = mEnv->GetIntField(fd, descriptor); + ctx->hidden.androidio.assetFileDescriptorRef = mEnv->NewGlobalRef(inputStream); - // Store .read id for reading purposes - mid = mEnv->GetMethodID(mEnv->GetObjectClass(readableByteChannel), - "read", "(Ljava/nio/ByteBuffer;)I"); - ctx->hidden.androidio.readMethod = mid; + // Seek to the correct offset in the file. + lseek(ctx->hidden.androidio.fd, (off_t)ctx->hidden.androidio.offset, SEEK_SET); - ctx->hidden.androidio.position = 0; + if (false) { +fallback: + // Disabled log message because of spam on the Nexus 7 + //__android_log_print(ANDROID_LOG_DEBUG, "SDL", "Falling back to legacy InputStream method for opening file"); + + /* Try the old method using InputStream */ + ctx->hidden.androidio.assetFileDescriptorRef = NULL; + + // inputStream = assetManager.open(); + mid = mEnv->GetMethodID(mEnv->GetObjectClass(assetManager), + "open", "(Ljava/lang/String;I)Ljava/io/InputStream;"); + inputStream = mEnv->CallObjectMethod(assetManager, mid, fileNameJString, 1 /*ACCESS_RANDOM*/); + if (Android_JNI_ExceptionOccurred()) { + goto failure; + } + + ctx->hidden.androidio.inputStreamRef = mEnv->NewGlobalRef(inputStream); + + // Despite all the visible documentation on [Asset]InputStream claiming + // that the .available() method is not guaranteed to return the entire file + // size, comments in /samples//ApiDemos/src/com/example/ ... + // android/apis/content/ReadAsset.java imply that Android's + // AssetInputStream.available() /will/ always return the total file size + + // size = inputStream.available(); + mid = mEnv->GetMethodID(mEnv->GetObjectClass(inputStream), + "available", "()I"); + ctx->hidden.androidio.size = (long)mEnv->CallIntMethod(inputStream, mid); + if (Android_JNI_ExceptionOccurred()) { + goto failure; + } + + // readableByteChannel = Channels.newChannel(inputStream); + channels = mEnv->FindClass("java/nio/channels/Channels"); + mid = mEnv->GetStaticMethodID(channels, + "newChannel", + "(Ljava/io/InputStream;)Ljava/nio/channels/ReadableByteChannel;"); + readableByteChannel = mEnv->CallStaticObjectMethod( + channels, mid, inputStream); + if (Android_JNI_ExceptionOccurred()) { + goto failure; + } + + ctx->hidden.androidio.readableByteChannelRef = + mEnv->NewGlobalRef(readableByteChannel); + + // Store .read id for reading purposes + mid = mEnv->GetMethodID(mEnv->GetObjectClass(readableByteChannel), + "read", "(Ljava/nio/ByteBuffer;)I"); + ctx->hidden.androidio.readMethod = mid; + } if (false) { failure: @@ -594,6 +696,10 @@ failure: mEnv->DeleteGlobalRef((jobject)ctx->hidden.androidio.readableByteChannelRef); } + if(ctx->hidden.androidio.assetFileDescriptorRef != NULL) { + mEnv->DeleteGlobalRef((jobject)ctx->hidden.androidio.assetFileDescriptorRef); + } + } return result; @@ -618,6 +724,7 @@ extern "C" int Android_JNI_FileOpen(SDL_RWops* ctx, ctx->hidden.androidio.inputStreamRef = NULL; ctx->hidden.androidio.readableByteChannelRef = NULL; ctx->hidden.androidio.readMethod = NULL; + ctx->hidden.androidio.assetFileDescriptorRef = NULL; return Android_JNI_FileOpen(ctx); } @@ -626,40 +733,53 @@ extern "C" size_t Android_JNI_FileRead(SDL_RWops* ctx, void* buffer, size_t size, size_t maxnum) { LocalReferenceHolder refs(__FUNCTION__); - jlong bytesRemaining = (jlong) (size * maxnum); - jlong bytesMax = (jlong) (ctx->hidden.androidio.size - ctx->hidden.androidio.position); - int bytesRead = 0; - /* Don't read more bytes than those that remain in the file, otherwise we get an exception */ - if (bytesRemaining > bytesMax) bytesRemaining = bytesMax; + if (ctx->hidden.androidio.assetFileDescriptorRef) { + size_t bytesMax = size * maxnum; + if (ctx->hidden.androidio.size != -1 /*UNKNOWN_LENGTH*/ && ctx->hidden.androidio.position + bytesMax > ctx->hidden.androidio.size) { + bytesMax = ctx->hidden.androidio.size - ctx->hidden.androidio.position; + } + size_t result = read(ctx->hidden.androidio.fd, buffer, bytesMax ); + if (result > 0) { + ctx->hidden.androidio.position += result; + return result / size; + } + return 0; + } else { + jlong bytesRemaining = (jlong) (size * maxnum); + jlong bytesMax = (jlong) (ctx->hidden.androidio.size - ctx->hidden.androidio.position); + int bytesRead = 0; - JNIEnv *mEnv = Android_JNI_GetEnv(); - if (!refs.init(mEnv)) { - return -1; - } + /* Don't read more bytes than those that remain in the file, otherwise we get an exception */ + if (bytesRemaining > bytesMax) bytesRemaining = bytesMax; - jobject readableByteChannel = (jobject)ctx->hidden.androidio.readableByteChannelRef; - jmethodID readMethod = (jmethodID)ctx->hidden.androidio.readMethod; - jobject byteBuffer = mEnv->NewDirectByteBuffer(buffer, bytesRemaining); - - while (bytesRemaining > 0) { - // result = readableByteChannel.read(...); - int result = mEnv->CallIntMethod(readableByteChannel, readMethod, byteBuffer); - - if (Android_JNI_ExceptionOccurred()) { - return 0; + JNIEnv *mEnv = Android_JNI_GetEnv(); + if (!refs.init(mEnv)) { + return -1; } - if (result < 0) { - break; + jobject readableByteChannel = (jobject)ctx->hidden.androidio.readableByteChannelRef; + jmethodID readMethod = (jmethodID)ctx->hidden.androidio.readMethod; + jobject byteBuffer = mEnv->NewDirectByteBuffer(buffer, bytesRemaining); + + while (bytesRemaining > 0) { + // result = readableByteChannel.read(...); + int result = mEnv->CallIntMethod(readableByteChannel, readMethod, byteBuffer); + + if (Android_JNI_ExceptionOccurred()) { + return 0; + } + + if (result < 0) { + break; + } + + bytesRemaining -= result; + bytesRead += result; + ctx->hidden.androidio.position += result; } - - bytesRemaining -= result; - bytesRead += result; - ctx->hidden.androidio.position += result; + return bytesRead / size; } - - return bytesRead / size; } extern "C" size_t Android_JNI_FileWrite(SDL_RWops* ctx, const void* buffer, @@ -676,8 +796,7 @@ static int Android_JNI_FileClose(SDL_RWops* ctx, bool release) JNIEnv *mEnv = Android_JNI_GetEnv(); if (!refs.init(mEnv)) { - SDL_SetError("Failed to allocate enough JVM local references"); - return -1; + return SDL_SetError("Failed to allocate enough JVM local references"); } if (ctx) { @@ -685,16 +804,28 @@ static int Android_JNI_FileClose(SDL_RWops* ctx, bool release) mEnv->DeleteGlobalRef((jobject)ctx->hidden.androidio.fileNameRef); } - jobject inputStream = (jobject)ctx->hidden.androidio.inputStreamRef; + if (ctx->hidden.androidio.assetFileDescriptorRef) { + jobject inputStream = (jobject)ctx->hidden.androidio.assetFileDescriptorRef; + jmethodID mid = mEnv->GetMethodID(mEnv->GetObjectClass(inputStream), + "close", "()V"); + mEnv->CallVoidMethod(inputStream, mid); + mEnv->DeleteGlobalRef((jobject)ctx->hidden.androidio.assetFileDescriptorRef); + if (Android_JNI_ExceptionOccurred()) { + result = -1; + } + } + else { + jobject inputStream = (jobject)ctx->hidden.androidio.inputStreamRef; - // inputStream.close(); - jmethodID mid = mEnv->GetMethodID(mEnv->GetObjectClass(inputStream), - "close", "()V"); - mEnv->CallVoidMethod(inputStream, mid); - mEnv->DeleteGlobalRef((jobject)ctx->hidden.androidio.inputStreamRef); - mEnv->DeleteGlobalRef((jobject)ctx->hidden.androidio.readableByteChannelRef); - if (Android_JNI_ExceptionOccurred()) { - result = -1; + // inputStream.close(); + jmethodID mid = mEnv->GetMethodID(mEnv->GetObjectClass(inputStream), + "close", "()V"); + mEnv->CallVoidMethod(inputStream, mid); + mEnv->DeleteGlobalRef((jobject)ctx->hidden.androidio.inputStreamRef); + mEnv->DeleteGlobalRef((jobject)ctx->hidden.androidio.readableByteChannelRef); + if (Android_JNI_ExceptionOccurred()) { + result = -1; + } } if (release) { @@ -713,60 +844,83 @@ extern "C" Sint64 Android_JNI_FileSize(SDL_RWops* ctx) extern "C" Sint64 Android_JNI_FileSeek(SDL_RWops* ctx, Sint64 offset, int whence) { - Sint64 newPosition; + if (ctx->hidden.androidio.assetFileDescriptorRef) { + switch (whence) { + case RW_SEEK_SET: + if (ctx->hidden.androidio.size != -1 /*UNKNOWN_LENGTH*/ && offset > ctx->hidden.androidio.size) offset = ctx->hidden.androidio.size; + offset += ctx->hidden.androidio.offset; + break; + case RW_SEEK_CUR: + offset += ctx->hidden.androidio.position; + if (ctx->hidden.androidio.size != -1 /*UNKNOWN_LENGTH*/ && offset > ctx->hidden.androidio.size) offset = ctx->hidden.androidio.size; + offset += ctx->hidden.androidio.offset; + break; + case RW_SEEK_END: + offset = ctx->hidden.androidio.offset + ctx->hidden.androidio.size + offset; + break; + default: + return SDL_SetError("Unknown value for 'whence'"); + } + whence = SEEK_SET; - switch (whence) { - case RW_SEEK_SET: - newPosition = offset; - break; - case RW_SEEK_CUR: - newPosition = ctx->hidden.androidio.position + offset; - break; - case RW_SEEK_END: - newPosition = ctx->hidden.androidio.size + offset; - break; - default: - SDL_SetError("Unknown value for 'whence'"); - return -1; - } + off_t ret = lseek(ctx->hidden.androidio.fd, (off_t)offset, SEEK_SET); + if (ret == -1) return -1; + ctx->hidden.androidio.position = ret - ctx->hidden.androidio.offset; + } else { + Sint64 newPosition; - /* Validate the new position */ - if (newPosition < 0) { - SDL_Error(SDL_EFSEEK); - return -1; - } - if (newPosition > ctx->hidden.androidio.size) { - newPosition = ctx->hidden.androidio.size; - } - - Sint64 movement = newPosition - ctx->hidden.androidio.position; - if (movement > 0) { - unsigned char buffer[4096]; - - // The easy case where we're seeking forwards - while (movement > 0) { - Sint64 amount = sizeof (buffer); - if (amount > movement) { - amount = movement; - } - size_t result = Android_JNI_FileRead(ctx, buffer, 1, amount); - if (result <= 0) { - // Failed to read/skip the required amount, so fail - return -1; - } - - movement -= result; + switch (whence) { + case RW_SEEK_SET: + newPosition = offset; + break; + case RW_SEEK_CUR: + newPosition = ctx->hidden.androidio.position + offset; + break; + case RW_SEEK_END: + newPosition = ctx->hidden.androidio.size + offset; + break; + default: + return SDL_SetError("Unknown value for 'whence'"); } - } else if (movement < 0) { - // We can't seek backwards so we have to reopen the file and seek - // forwards which obviously isn't very efficient - Android_JNI_FileClose(ctx, false); - Android_JNI_FileOpen(ctx); - Android_JNI_FileSeek(ctx, newPosition, RW_SEEK_SET); + /* Validate the new position */ + if (newPosition < 0) { + return SDL_Error(SDL_EFSEEK); + } + if (newPosition > ctx->hidden.androidio.size) { + newPosition = ctx->hidden.androidio.size; + } + + Sint64 movement = newPosition - ctx->hidden.androidio.position; + if (movement > 0) { + unsigned char buffer[4096]; + + // The easy case where we're seeking forwards + while (movement > 0) { + Sint64 amount = sizeof (buffer); + if (amount > movement) { + amount = movement; + } + size_t result = Android_JNI_FileRead(ctx, buffer, 1, amount); + if (result <= 0) { + // Failed to read/skip the required amount, so fail + return -1; + } + + movement -= result; + } + + } else if (movement < 0) { + // We can't seek backwards so we have to reopen the file and seek + // forwards which obviously isn't very efficient + Android_JNI_FileClose(ctx, false); + Android_JNI_FileOpen(ctx); + Android_JNI_FileSeek(ctx, newPosition, RW_SEEK_SET); + } } return ctx->hidden.androidio.position; + } extern "C" int Android_JNI_FileClose(SDL_RWops* ctx) @@ -949,12 +1103,12 @@ extern "C" int Android_JNI_SendMessage(int command, int param) if (!env) { return -1; } - jmethodID mid = env->GetStaticMethodID(mActivityClass, "sendMessage", "(II)V"); + jmethodID mid = env->GetStaticMethodID(mActivityClass, "sendMessage", "(II)Z"); if (!mid) { return -1; } - env->CallStaticVoidMethod(mActivityClass, mid, command, param); - return 0; + jboolean success = env->CallStaticBooleanMethod(mActivityClass, mid, command, param); + return success ? 0 : -1; } extern "C" void Android_JNI_ShowTextInput(SDL_Rect *inputRect) @@ -964,11 +1118,11 @@ extern "C" void Android_JNI_ShowTextInput(SDL_Rect *inputRect) return; } - jmethodID mid = env->GetStaticMethodID(mActivityClass, "showTextInput", "(IIII)V"); + jmethodID mid = env->GetStaticMethodID(mActivityClass, "showTextInput", "(IIII)Z"); if (!mid) { return; } - env->CallStaticVoidMethod( mActivityClass, mid, + env->CallStaticBooleanMethod( mActivityClass, mid, inputRect->x, inputRect->y, inputRect->w, @@ -992,13 +1146,16 @@ extern "C" void *SDL_AndroidGetJNIEnv() return Android_JNI_GetEnv(); } + + extern "C" void *SDL_AndroidGetActivity() { - LocalReferenceHolder refs(__FUNCTION__); + /* See SDL_system.h for caveats on using this function. */ + jmethodID mid; JNIEnv *env = Android_JNI_GetEnv(); - if (!refs.init(env)) { + if (!env) { return NULL; } diff --git a/src/eepp/helper/SDL2/src/core/android/SDL_android.h b/src/eepp/helper/SDL2/src/core/android/SDL_android.h index d72761bfb..7eddcfac8 100644 --- a/src/eepp/helper/SDL2/src/core/android/SDL_android.h +++ b/src/eepp/helper/SDL2/src/core/android/SDL_android.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -30,7 +30,7 @@ extern "C" { #include "SDL_rect.h" /* Interface from the SDL library into the Android Java activity */ -extern SDL_bool Android_JNI_CreateContext(int majorVersion, int minorVersion); +extern SDL_bool Android_JNI_CreateContext(int majorVersion, int minorVersion, int red, int green, int blue, int alpha, int buffer, int depth, int stencil, int buffers, int samples); extern void Android_JNI_SwapWindow(); extern void Android_JNI_SetActivityTitle(const char *title); extern SDL_bool Android_JNI_GetAccelerometerValues(float values[3]); diff --git a/src/eepp/helper/SDL2/src/core/windows/SDL_windows.c b/src/eepp/helper/SDL2/src/core/windows/SDL_windows.c index 4103d98d8..e69d25793 100644 --- a/src/eepp/helper/SDL2/src/core/windows/SDL_windows.c +++ b/src/eepp/helper/SDL2/src/core/windows/SDL_windows.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -24,12 +24,12 @@ #include "SDL_error.h" #include "SDL_windows.h" +#include "SDL_assert.h" #include /* for CoInitialize/CoUninitialize */ - /* Sets an error message based on GetLastError() */ -void +int WIN_SetError(const char *prefix) { TCHAR buffer[1024]; @@ -39,6 +39,7 @@ WIN_SetError(const char *prefix) message = WIN_StringToUTF8(buffer); SDL_SetError("%s%s%s", prefix ? prefix : "", prefix ? ": " : "", message); SDL_free(message); + return -1; } HRESULT diff --git a/src/eepp/helper/SDL2/src/core/windows/SDL_windows.h b/src/eepp/helper/SDL2/src/core/windows/SDL_windows.h index c7c6f9576..440c387d3 100644 --- a/src/eepp/helper/SDL2/src/core/windows/SDL_windows.h +++ b/src/eepp/helper/SDL2/src/core/windows/SDL_windows.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -34,7 +34,6 @@ #include - /* Routines to convert from UTF8 to native Windows text */ #if UNICODE #define WIN_StringToUTF8(S) SDL_iconv_string("UTF-8", "UCS-2-INTERNAL", (char *)(S), (SDL_wcslen(S)+1)*sizeof(WCHAR)) @@ -44,8 +43,8 @@ #define WIN_UTF8ToString(S) SDL_iconv_string("ASCII", "UTF-8", (char *)(S), SDL_strlen(S)+1) #endif -/* Sets an error message based on GetLastError() */ -extern void WIN_SetError(const char *prefix); +/* Sets an error message based on GetLastError(). Always return -1. */ +extern int WIN_SetError(const char *prefix); /* Wrap up the oddities of CoInitialize() into a common function. */ extern HRESULT WIN_CoInitialize(void); diff --git a/src/eepp/helper/SDL2/src/cpuinfo/SDL_cpuinfo.c b/src/eepp/helper/SDL2/src/cpuinfo/SDL_cpuinfo.c index db258405d..30549852d 100644 --- a/src/eepp/helper/SDL2/src/cpuinfo/SDL_cpuinfo.c +++ b/src/eepp/helper/SDL2/src/cpuinfo/SDL_cpuinfo.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/events/SDL_clipboardevents.c b/src/eepp/helper/SDL2/src/events/SDL_clipboardevents.c index 2a7d0574d..99ead8f50 100644 --- a/src/eepp/helper/SDL2/src/events/SDL_clipboardevents.c +++ b/src/eepp/helper/SDL2/src/events/SDL_clipboardevents.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/events/SDL_clipboardevents_c.h b/src/eepp/helper/SDL2/src/events/SDL_clipboardevents_c.h index 689ac8e4e..4f320f041 100644 --- a/src/eepp/helper/SDL2/src/events/SDL_clipboardevents_c.h +++ b/src/eepp/helper/SDL2/src/events/SDL_clipboardevents_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/events/SDL_dropevents.c b/src/eepp/helper/SDL2/src/events/SDL_dropevents.c index 5a65e8dcc..1ce2f1c1b 100644 --- a/src/eepp/helper/SDL2/src/events/SDL_dropevents.c +++ b/src/eepp/helper/SDL2/src/events/SDL_dropevents.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/events/SDL_dropevents_c.h b/src/eepp/helper/SDL2/src/events/SDL_dropevents_c.h index 3c13d4d51..d658e447c 100644 --- a/src/eepp/helper/SDL2/src/events/SDL_dropevents_c.h +++ b/src/eepp/helper/SDL2/src/events/SDL_dropevents_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/events/SDL_events.c b/src/eepp/helper/SDL2/src/events/SDL_events.c index c6aa97415..047a07d7a 100644 --- a/src/eepp/helper/SDL2/src/events/SDL_events.c +++ b/src/eepp/helper/SDL2/src/events/SDL_events.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -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; @@ -70,9 +70,9 @@ static __inline__ SDL_bool SDL_ShouldPollJoystick() { #if !SDL_JOYSTICK_DISABLED - if (SDL_PrivateJoystickNeedsPolling() && - (!SDL_disabled_events[SDL_JOYAXISMOTION >> 8] || - SDL_JoystickEventState(SDL_QUERY))) { + if ((!SDL_disabled_events[SDL_JOYAXISMOTION >> 8] || + SDL_JoystickEventState(SDL_QUERY)) && + SDL_PrivateJoystickNeedsPolling()) { return SDL_TRUE; } #endif @@ -111,6 +111,7 @@ SDL_StopEventLoop(void) SDL_event_watchers = tmp->next; SDL_free(tmp); } + SDL_EventOK = NULL; } /* This function (and associated calls) may be called more than once */ @@ -123,12 +124,6 @@ SDL_StartEventLoop(void) FIXME: Does this introduce any other bugs with events at startup? */ - /* No filter to start with, process most event types */ - SDL_EventOK = NULL; - SDL_EventState(SDL_TEXTINPUT, SDL_DISABLE); - SDL_EventState(SDL_TEXTEDITING, SDL_DISABLE); - SDL_EventState(SDL_SYSWMEVENT, SDL_DISABLE); - /* Create the lock and set ourselves active */ #if !SDL_THREADS_DISABLED if (!SDL_EventQ.lock) { @@ -138,6 +133,12 @@ SDL_StartEventLoop(void) return (-1); } #endif /* !SDL_THREADS_DISABLED */ + + /* Process most event types */ + SDL_EventState(SDL_TEXTINPUT, SDL_DISABLE); + SDL_EventState(SDL_TEXTEDITING, SDL_DISABLE); + SDL_EventState(SDL_SYSWMEVENT, SDL_DISABLE); + SDL_EventQ.active = 1; return (0); @@ -212,7 +213,7 @@ SDL_PeepEvents(SDL_Event * events, int numevents, SDL_eventaction action, } /* Lock the event queue */ used = 0; - if (!SDL_EventQ.lock || SDL_mutexP(SDL_EventQ.lock) == 0) { + if (!SDL_EventQ.lock || SDL_LockMutex(SDL_EventQ.lock) == 0) { if (action == SDL_ADDEVENT) { for (i = 0; i < numevents; ++i) { used += SDL_AddEvent(&events[i]); @@ -242,10 +243,9 @@ SDL_PeepEvents(SDL_Event * events, int numevents, SDL_eventaction action, } } } - SDL_mutexV(SDL_EventQ.lock); + SDL_UnlockMutex(SDL_EventQ.lock); } else { - SDL_SetError("Couldn't lock event queue"); - used = -1; + return SDL_SetError("Couldn't lock event queue"); } return (used); } @@ -285,7 +285,7 @@ SDL_FlushEvents(Uint32 minType, Uint32 maxType) #endif /* Lock the event queue */ - if (SDL_mutexP(SDL_EventQ.lock) == 0) { + if (SDL_LockMutex(SDL_EventQ.lock) == 0) { int spot = SDL_EventQ.head; while (spot != SDL_EventQ.tail) { Uint32 type = SDL_EventQ.event[spot].type; @@ -295,7 +295,7 @@ SDL_FlushEvents(Uint32 minType, Uint32 maxType) spot = (spot + 1) % MAXEVENTS; } } - SDL_mutexV(SDL_EventQ.lock); + SDL_UnlockMutex(SDL_EventQ.lock); } } @@ -365,7 +365,9 @@ int SDL_PushEvent(SDL_Event * event) { SDL_EventWatcher *curr; - event->window.timestamp = SDL_GetTicks(); + + event->common.timestamp = SDL_GetTicks(); + if (SDL_EventOK && !SDL_EventOK(SDL_EventOKParam, event)) { return 0; } @@ -386,12 +388,11 @@ SDL_PushEvent(SDL_Event * event) void SDL_SetEventFilter(SDL_EventFilter filter, void *userdata) { - SDL_Event bitbucket; - /* Set filter and discard pending events */ - SDL_EventOK = filter; + SDL_EventOK = NULL; + SDL_FlushEvents(SDL_FIRSTEVENT, SDL_LASTEVENT); SDL_EventOKParam = userdata; - while (SDL_PollEvent(&bitbucket) > 0); + SDL_EventOK = filter; } SDL_bool @@ -446,7 +447,7 @@ SDL_DelEventWatch(SDL_EventFilter filter, void *userdata) void SDL_FilterEvents(SDL_EventFilter filter, void *userdata) { - if (SDL_mutexP(SDL_EventQ.lock) == 0) { + if (SDL_LockMutex(SDL_EventQ.lock) == 0) { int spot; spot = SDL_EventQ.head; @@ -458,7 +459,7 @@ SDL_FilterEvents(SDL_EventFilter filter, void *userdata) } } } - SDL_mutexV(SDL_EventQ.lock); + SDL_UnlockMutex(SDL_EventQ.lock); } Uint8 @@ -516,8 +517,20 @@ SDL_RegisterEvents(int numevents) return event_base; } -/* This is a generic event handler. - */ +int +SDL_SendAppEvent(SDL_EventType eventType) +{ + int posted; + + posted = 0; + if (SDL_GetEventState(eventType) == SDL_ENABLE) { + SDL_Event event; + event.type = eventType; + posted = (SDL_PushEvent(&event) > 0); + } + return (posted); +} + int SDL_SendSysWMEvent(SDL_SysWMmsg * message) { diff --git a/src/eepp/helper/SDL2/src/events/SDL_events_c.h b/src/eepp/helper/SDL2/src/events/SDL_events_c.h index df3a5608d..f365ee3ed 100644 --- a/src/eepp/helper/SDL2/src/events/SDL_events_c.h +++ b/src/eepp/helper/SDL2/src/events/SDL_events_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -36,6 +36,7 @@ extern int SDL_StartEventLoop(void); extern void SDL_StopEventLoop(void); extern void SDL_QuitInterrupt(void); +extern int SDL_SendAppEvent(SDL_EventType eventType); extern int SDL_SendSysWMEvent(SDL_SysWMmsg * message); extern int SDL_QuitInit(void); diff --git a/src/eepp/helper/SDL2/src/events/SDL_gesture.c b/src/eepp/helper/SDL2/src/events/SDL_gesture.c index 428badc95..f7c8c8932 100644 --- a/src/eepp/helper/SDL2/src/events/SDL_gesture.c +++ b/src/eepp/helper/SDL2/src/events/SDL_gesture.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -27,18 +27,18 @@ #include "SDL_events_c.h" #include "SDL_gesture_c.h" +#if !defined(__PSP__) #include +#endif + #include #include #include -//TODO: Replace with malloc +/* TODO: Replace with malloc */ #define MAXPATHSIZE 1024 - - - #define DOLLARNPOINTS 64 #define DOLLARSIZE 256 @@ -64,7 +64,6 @@ typedef struct { typedef struct { SDL_TouchID id; - SDL_FloatPoint res; SDL_FloatPoint centroid; SDL_DollarPath dollarPath; Uint16 numDownFingers; @@ -156,8 +155,7 @@ int SDL_SaveDollarTemplate(SDL_GestureID gestureId, SDL_RWops *src) } } } - SDL_SetError("Unknown gestureId"); - return -1; + return SDL_SetError("Unknown gestureId"); } //path is an already sampled set of points @@ -174,8 +172,7 @@ static int SDL_AddDollarGesture_one(SDL_GestureTouch* inTouch, SDL_FloatPoint* p (index + 1) * sizeof(SDL_DollarTemplate)); if (!dollarTemplate) { - SDL_OutOfMemory(); - return -1; + return SDL_OutOfMemory(); } inTouch->dollarTemplate = dollarTemplate; @@ -410,25 +407,20 @@ static float dollarRecognize(const SDL_DollarPath *path,int *bestTempl,SDL_Gestu return bestDiff; } -int SDL_GestureAddTouch(SDL_Touch* touch) +int SDL_GestureAddTouch(SDL_TouchID touchId) { SDL_GestureTouch *gestureTouch = (SDL_GestureTouch *)SDL_realloc(SDL_gestureTouch, (SDL_numGestureTouches + 1) * sizeof(SDL_GestureTouch)); if (!gestureTouch) { - SDL_OutOfMemory(); - return -1; + return SDL_OutOfMemory(); } SDL_gestureTouch = gestureTouch; - SDL_gestureTouch[SDL_numGestureTouches].res.x = touch->xres; - SDL_gestureTouch[SDL_numGestureTouches].res.y = touch->yres; SDL_gestureTouch[SDL_numGestureTouches].numDownFingers = 0; - - SDL_gestureTouch[SDL_numGestureTouches].res.x = touch->xres; - SDL_gestureTouch[SDL_numGestureTouches].id = touch->id; + SDL_gestureTouch[SDL_numGestureTouches].id = touchId; SDL_gestureTouch[SDL_numGestureTouches].numDollarTemplates = 0; @@ -468,11 +460,8 @@ static int SDL_SendGestureDollar(SDL_GestureTouch* touch, SDL_Event event; event.dgesture.type = SDL_DOLLARGESTURE; event.dgesture.touchId = touch->id; - /* - //TODO: Add this to give location of gesture? event.mgesture.x = touch->centroid.x; event.mgesture.y = touch->centroid.y; - */ event.dgesture.gestureId = gestureId; event.dgesture.error = error; //A finger came up to trigger this event. @@ -513,14 +502,8 @@ void SDL_GestureProcessEvent(SDL_Event* event) //Shouldn't be possible if (inTouch == NULL) return; - //printf("@ (%i,%i) with res: (%i,%i)\n",(int)event->tfinger.x, - // (int)event->tfinger.y, - // (int)inTouch->res.x,(int)inTouch->res.y); - - - x = ((float)event->tfinger.x)/(float)inTouch->res.x; - y = ((float)event->tfinger.y)/(float)inTouch->res.y; - + x = event->tfinger.x; + y = event->tfinger.y; //Finger Up if (event->type == SDL_FINGERUP) { @@ -569,9 +552,8 @@ void SDL_GestureProcessEvent(SDL_Event* event) } } else if (event->type == SDL_FINGERMOTION) { - float dx = ((float)event->tfinger.dx)/(float)inTouch->res.x; - float dy = ((float)event->tfinger.dy)/(float)inTouch->res.y; - //printf("dx,dy: (%f,%f)\n",dx,dy); + float dx = event->tfinger.dx; + float dy = event->tfinger.dy; #ifdef ENABLE_DOLLAR SDL_DollarPath* path = &inTouch->dollarPath; if (path->numPoints < MAXPATHSIZE) { diff --git a/src/eepp/helper/SDL2/src/events/SDL_gesture_c.h b/src/eepp/helper/SDL2/src/events/SDL_gesture_c.h index fdb84ad85..08ba2e80c 100644 --- a/src/eepp/helper/SDL2/src/events/SDL_gesture_c.h +++ b/src/eepp/helper/SDL2/src/events/SDL_gesture_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -23,12 +23,12 @@ #ifndef _SDL_gesture_c_h #define _SDL_gesture_c_h +extern int SDL_GestureAddTouch(SDL_TouchID touchId); + extern void SDL_GestureProcessEvent(SDL_Event* event); extern int SDL_RecordGesture(SDL_TouchID touchId); -extern int SDL_GestureAddTouch(SDL_Touch* touch); - #endif /* _SDL_gesture_c_h */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/eepp/helper/SDL2/src/events/SDL_keyboard.c b/src/eepp/helper/SDL2/src/events/SDL_keyboard.c index 9e2b59b1d..680091f42 100644 --- a/src/eepp/helper/SDL2/src/events/SDL_keyboard.c +++ b/src/eepp/helper/SDL2/src/events/SDL_keyboard.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -861,6 +861,11 @@ SDL_GetKeyFromScancode(SDL_Scancode scancode) { SDL_Keyboard *keyboard = &SDL_keyboard; + if (scancode < SDL_SCANCODE_UNKNOWN || scancode >= SDL_NUM_SCANCODES) { + SDL_InvalidParamError("scancode"); + return 0; + } + return keyboard->keymap[scancode]; } @@ -882,8 +887,13 @@ SDL_GetScancodeFromKey(SDL_Keycode key) const char * SDL_GetScancodeName(SDL_Scancode scancode) { - const char *name = SDL_scancode_names[scancode]; + const char *name; + if (scancode < SDL_SCANCODE_UNKNOWN || scancode >= SDL_NUM_SCANCODES) { + SDL_InvalidParamError("scancode"); + return ""; + } + name = SDL_scancode_names[scancode]; if (name) return name; else @@ -892,21 +902,24 @@ SDL_GetScancodeName(SDL_Scancode scancode) SDL_Scancode SDL_GetScancodeFromName(const char *name) { - int i; + int i; - if (!name || !*name) { - return SDL_SCANCODE_UNKNOWN; - } + 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; - } - } - 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 * @@ -951,48 +964,51 @@ SDL_GetKeyName(SDL_Keycode key) SDL_Keycode SDL_GetKeyFromName(const char *name) { - SDL_Keycode key; + SDL_Keycode key; - /* 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; - } + /* Check input */ + if (name == NULL) return SDLK_UNKNOWN; - /* 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/eepp/helper/SDL2/src/events/SDL_keyboard_c.h b/src/eepp/helper/SDL2/src/events/SDL_keyboard_c.h index 96a28ce2b..17203998b 100644 --- a/src/eepp/helper/SDL2/src/events/SDL_keyboard_c.h +++ b/src/eepp/helper/SDL2/src/events/SDL_keyboard_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/events/SDL_mouse.c b/src/eepp/helper/SDL2/src/events/SDL_mouse.c index a61f21520..5536ab73b 100644 --- a/src/eepp/helper/SDL2/src/events/SDL_mouse.c +++ b/src/eepp/helper/SDL2/src/events/SDL_mouse.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -33,6 +33,8 @@ /* The mouse state */ static SDL_Mouse SDL_mouse; +static int +SDL_PrivateSendMouseMotion(SDL_Window * window, SDL_MouseID mouseID, int relative, int x, int y); /* Public functions */ int @@ -81,7 +83,7 @@ SDL_ResetMouse(void) #endif for (i = 1; i <= sizeof(mouse->buttonstate)*8; ++i) { if (mouse->buttonstate & SDL_BUTTON(i)) { - SDL_SendMouseButton(mouse->focus, SDL_RELEASED, i); + SDL_SendMouseButton(mouse->focus, mouse->mouseID, SDL_RELEASED, i); } } SDL_assert(mouse->buttonstate == 0); @@ -96,10 +98,17 @@ SDL_SetMouseFocus(SDL_Window * window) return; } + /* Actually, this ends up being a bad idea, because most operating + systems have an implicit grab when you press the mouse button down + so you can drag things out of the window and then get the mouse up + when it happens. So, #if 0... + */ +#if 0 if (mouse->focus && !window) { /* We won't get anymore mouse messages, so reset mouse state */ SDL_ResetMouse(); } +#endif /* See if the current window has lost focus */ if (mouse->focus) { @@ -147,27 +156,39 @@ SDL_UpdateMouseFocus(SDL_Window * window, int x, int y, Uint32 buttonstate) #endif if (window == mouse->focus) { #ifdef DEBUG_MOUSE - printf("Mouse left window, synthesizing focus lost event\n"); + printf("Mouse left window, synthesizing move & focus lost event\n"); #endif + SDL_PrivateSendMouseMotion(window, mouse->mouseID, 0, x, y); SDL_SetMouseFocus(NULL); } return SDL_FALSE; } if (window != mouse->focus) { - mouse->last_x = x; - mouse->last_y = y; - #ifdef DEBUG_MOUSE - printf("Mouse entered window, synthesizing focus gain event\n"); + printf("Mouse entered window, synthesizing focus gain & move event\n"); #endif - SDL_SetMouseFocus(window); + SDL_SetMouseFocus(window); + SDL_PrivateSendMouseMotion(window, mouse->mouseID, 0, x, y); } return SDL_TRUE; } int -SDL_SendMouseMotion(SDL_Window * window, int relative, int x, int y) +SDL_SendMouseMotion(SDL_Window * window, SDL_MouseID mouseID, int relative, int x, int y) +{ + if (window && !relative) { + SDL_Mouse *mouse = SDL_GetMouse(); + if (!SDL_UpdateMouseFocus(window, x, y, mouse->buttonstate)) { + return 0; + } + } + + return SDL_PrivateSendMouseMotion(window, mouseID, relative, x, y); +} + +static int +SDL_PrivateSendMouseMotion(SDL_Window * window, SDL_MouseID mouseID, int relative, int x, int y) { SDL_Mouse *mouse = SDL_GetMouse(); int posted; @@ -175,12 +196,6 @@ SDL_SendMouseMotion(SDL_Window * window, int relative, int x, int y) int yrel; int x_max = 0, y_max = 0; - if (window && !relative) { - if (!SDL_UpdateMouseFocus(window, x, y, mouse->buttonstate)) { - return 0; - } - } - /* relative motion is calculated regarding the system cursor last position */ if (relative) { xrel = x; @@ -245,6 +260,7 @@ SDL_SendMouseMotion(SDL_Window * window, int relative, int x, int y) SDL_Event event; event.motion.type = SDL_MOUSEMOTION; event.motion.windowID = mouse->focus ? mouse->focus->id : 0; + event.motion.which = mouseID; event.motion.state = mouse->buttonstate; event.motion.x = mouse->x; event.motion.y = mouse->y; @@ -259,7 +275,7 @@ SDL_SendMouseMotion(SDL_Window * window, int relative, int x, int y) } int -SDL_SendMouseButton(SDL_Window * window, Uint8 state, Uint8 button) +SDL_SendMouseButton(SDL_Window * window, SDL_MouseID mouseID, Uint8 state, Uint8 button) { SDL_Mouse *mouse = SDL_GetMouse(); int posted; @@ -297,11 +313,12 @@ SDL_SendMouseButton(SDL_Window * window, Uint8 state, Uint8 button) if (SDL_GetEventState(type) == SDL_ENABLE) { SDL_Event event; event.type = type; + event.button.windowID = mouse->focus ? mouse->focus->id : 0; + event.button.which = mouseID; event.button.state = state; event.button.button = button; event.button.x = mouse->x; event.button.y = mouse->y; - event.button.windowID = mouse->focus ? mouse->focus->id : 0; posted = (SDL_PushEvent(&event) > 0); } @@ -314,7 +331,7 @@ SDL_SendMouseButton(SDL_Window * window, Uint8 state, Uint8 button) } int -SDL_SendMouseWheel(SDL_Window * window, int x, int y) +SDL_SendMouseWheel(SDL_Window * window, SDL_MouseID mouseID, int x, int y) { SDL_Mouse *mouse = SDL_GetMouse(); int posted; @@ -333,6 +350,7 @@ SDL_SendMouseWheel(SDL_Window * window, int x, int y) SDL_Event event; event.type = SDL_MOUSEWHEEL; event.wheel.windowID = mouse->focus ? mouse->focus->id : 0; + event.wheel.which = mouseID; event.wheel.x = x; event.wheel.y = y; posted = (SDL_PushEvent(&event) > 0); @@ -380,10 +398,16 @@ 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 (mouse->WarpMouse) { mouse->WarpMouse(window, x, y); } else { - SDL_SendMouseMotion(window, 0, x, y); + SDL_SendMouseMotion(window, mouse->mouseID, 0, x, y); } } @@ -391,14 +415,23 @@ int SDL_SetRelativeMouseMode(SDL_bool enabled) { SDL_Mouse *mouse = SDL_GetMouse(); + SDL_Window *focusWindow = SDL_GetKeyboardFocus(); + int original_x = mouse->x, original_y = mouse->y; if (enabled == mouse->relative_mode) { return 0; } if (!mouse->SetRelativeMouseMode) { - SDL_Unsupported(); - return -1; + return SDL_Unsupported(); + } + + if (enabled && focusWindow) { + /* Center it in the focused window to prevent clicks from going through + * to background windows. + */ + SDL_SetMouseFocus(focusWindow); + SDL_WarpMouseInWindow(focusWindow, focusWindow->w/2, focusWindow->h/2); } if (mouse->SetRelativeMouseMode(enabled) < 0) { @@ -410,8 +443,8 @@ SDL_SetRelativeMouseMode(SDL_bool enabled) if (enabled) { /* Save the expected mouse position */ - mouse->original_x = mouse->x; - mouse->original_y = mouse->y; + mouse->original_x = original_x; + mouse->original_y = original_y; } else if (mouse->focus) { /* Restore the expected mouse position */ SDL_WarpMouseInWindow(mouse->focus, mouse->original_x, mouse->original_y); @@ -539,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, @@ -603,6 +636,17 @@ SDL_GetCursor(void) return mouse->cur_cursor; } +SDL_Cursor * +SDL_GetDefaultCursor(void) +{ + SDL_Mouse *mouse = SDL_GetMouse(); + + if (!mouse) { + return NULL; + } + return mouse->def_cursor; +} + void SDL_FreeCursor(SDL_Cursor * cursor) { diff --git a/src/eepp/helper/SDL2/src/events/SDL_mouse_c.h b/src/eepp/helper/SDL2/src/events/SDL_mouse_c.h index 4918aea98..a8faa2e17 100644 --- a/src/eepp/helper/SDL2/src/events/SDL_mouse_c.h +++ b/src/eepp/helper/SDL2/src/events/SDL_mouse_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,6 +25,8 @@ #include "SDL_mouse.h" +typedef Uint32 SDL_MouseID; + struct SDL_Cursor { struct SDL_Cursor *next; @@ -37,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); @@ -55,6 +57,7 @@ typedef struct int (*SetRelativeMouseMode) (SDL_bool enabled); /* Data common to all mice */ + SDL_MouseID mouseID; SDL_Window *focus; int x; int y; @@ -70,6 +73,9 @@ typedef struct SDL_Cursor *def_cursor; SDL_Cursor *cur_cursor; SDL_bool cursor_shown; + + /* Driver-dependent data. */ + void *driverdata; } SDL_Mouse; @@ -86,13 +92,13 @@ extern void SDL_SetDefaultCursor(SDL_Cursor * cursor); extern void SDL_SetMouseFocus(SDL_Window * window); /* Send a mouse motion event */ -extern int SDL_SendMouseMotion(SDL_Window * window, int relative, int x, int y); +extern int SDL_SendMouseMotion(SDL_Window * window, SDL_MouseID mouseID, int relative, int x, int y); /* Send a mouse button event */ -extern int SDL_SendMouseButton(SDL_Window * window, Uint8 state, Uint8 button); +extern int SDL_SendMouseButton(SDL_Window * window, SDL_MouseID mouseID, Uint8 state, Uint8 button); /* Send a mouse wheel event */ -extern int SDL_SendMouseWheel(SDL_Window * window, int x, int y); +extern int SDL_SendMouseWheel(SDL_Window * window, SDL_MouseID mouseID, int x, int y); /* Shutdown the mouse subsystem */ extern void SDL_MouseQuit(void); diff --git a/src/eepp/helper/SDL2/src/events/SDL_quit.c b/src/eepp/helper/SDL2/src/events/SDL_quit.c index f65f69c1a..5e9f8ad85 100644 --- a/src/eepp/helper/SDL2/src/events/SDL_quit.c +++ b/src/eepp/helper/SDL2/src/events/SDL_quit.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -114,15 +114,7 @@ SDL_QuitQuit(void) int SDL_SendQuit(void) { - int posted; - - posted = 0; - if (SDL_GetEventState(SDL_QUIT) == SDL_ENABLE) { - SDL_Event event; - event.type = SDL_QUIT; - posted = (SDL_PushEvent(&event) > 0); - } - return (posted); + return SDL_SendAppEvent(SDL_QUIT); } /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/eepp/helper/SDL2/src/events/SDL_sysevents.h b/src/eepp/helper/SDL2/src/events/SDL_sysevents.h index dfdf4d64c..88df0ea09 100644 --- a/src/eepp/helper/SDL2/src/events/SDL_sysevents.h +++ b/src/eepp/helper/SDL2/src/events/SDL_sysevents.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/events/SDL_touch.c b/src/eepp/helper/SDL2/src/events/SDL_touch.c index 2e9cd10a7..3429b57d7 100644 --- a/src/eepp/helper/SDL2/src/events/SDL_touch.c +++ b/src/eepp/helper/SDL2/src/events/SDL_touch.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -22,72 +22,46 @@ /* General touch handling code for SDL */ +#include "SDL_assert.h" #include "SDL_events.h" #include "SDL_events_c.h" -#include "../video/SDL_sysvideo.h" - -#include static int SDL_num_touch = 0; -static SDL_Touch **SDL_touchPads = NULL; +static SDL_Touch **SDL_touchDevices = NULL; /* Public functions */ int SDL_TouchInit(void) { - return (0); + return (0); } -SDL_Touch * -SDL_GetTouch(SDL_TouchID id) +int +SDL_GetNumTouchDevices(void) { - int index = SDL_GetTouchIndexId(id); - if (index < 0 || index >= SDL_num_touch) { - return NULL; - } - return SDL_touchPads[index]; + return SDL_num_touch; } -SDL_Touch * -SDL_GetTouchIndex(int index) +SDL_TouchID +SDL_GetTouchDevice(int index) { if (index < 0 || index >= SDL_num_touch) { - return NULL; + SDL_SetError("Unknown touch device"); + return 0; } - return SDL_touchPads[index]; + return SDL_touchDevices[index]->id; } static int -SDL_GetFingerIndexId(SDL_Touch* touch,SDL_FingerID fingerid) -{ - int i; - for(i = 0;i < touch->num_fingers;i++) - if(touch->fingers[i]->id == fingerid) - return i; - return -1; -} - - -SDL_Finger * -SDL_GetFinger(SDL_Touch* touch,SDL_FingerID id) -{ - int index = SDL_GetFingerIndexId(touch,id); - if(index < 0 || index >= touch->num_fingers) - return NULL; - return touch->fingers[index]; -} - - -int -SDL_GetTouchIndexId(SDL_TouchID id) +SDL_GetTouchIndex(SDL_TouchID id) { int index; SDL_Touch *touch; for (index = 0; index < SDL_num_touch; ++index) { - touch = SDL_touchPads[index]; + touch = SDL_touchDevices[index]; if (touch->id == id) { return index; } @@ -95,79 +69,280 @@ SDL_GetTouchIndexId(SDL_TouchID id) return -1; } -int -SDL_AddTouch(const SDL_Touch * touch, char *name) +SDL_Touch * +SDL_GetTouch(SDL_TouchID id) { - SDL_Touch **touchPads; - int index; - size_t length; + int index = SDL_GetTouchIndex(id); + if (index < 0 || index >= SDL_num_touch) { + SDL_SetError("Unknown touch device"); + return NULL; + } + return SDL_touchDevices[index]; +} - if (SDL_GetTouchIndexId(touch->id) != -1) { - SDL_SetError("Touch ID already in use"); +static int +SDL_GetFingerIndex(const SDL_Touch * touch, SDL_FingerID fingerid) +{ + int index; + for (index = 0; index < touch->num_fingers; ++index) { + if (touch->fingers[index]->id == fingerid) { + return index; + } + } + return -1; +} + +SDL_Finger * +SDL_GetFinger(const SDL_Touch * touch, SDL_FingerID id) +{ + int index = SDL_GetFingerIndex(touch, id); + if (index < 0 || index >= touch->num_fingers) { + return NULL; + } + return touch->fingers[index]; +} + +int +SDL_GetNumTouchFingers(SDL_TouchID touchID) +{ + SDL_Touch *touch = SDL_GetTouch(touchID); + if (touch) { + return touch->num_fingers; + } + return 0; +} + +SDL_Finger * +SDL_GetTouchFinger(SDL_TouchID touchID, int index) +{ + SDL_Touch *touch = SDL_GetTouch(touchID); + if (!touch) { + return NULL; + } + if (index < 0 || index >= touch->num_fingers) { + SDL_SetError("Unknown touch finger"); + return NULL; + } + return touch->fingers[index]; +} + +int +SDL_AddTouch(SDL_TouchID touchID, const char *name) +{ + SDL_Touch **touchDevices; + int index; + + index = SDL_GetTouchIndex(touchID); + if (index >= 0) { + return index; } /* Add the touch to the list of touch */ - touchPads = (SDL_Touch **) SDL_realloc(SDL_touchPads, - (SDL_num_touch + 1) * sizeof(*touch)); - if (!touchPads) { - SDL_OutOfMemory(); - return -1; + touchDevices = (SDL_Touch **) SDL_realloc(SDL_touchDevices, + (SDL_num_touch + 1) * sizeof(*touchDevices)); + if (!touchDevices) { + return SDL_OutOfMemory(); } - SDL_touchPads = touchPads; + SDL_touchDevices = touchDevices; index = SDL_num_touch++; - SDL_touchPads[index] = (SDL_Touch *) SDL_malloc(sizeof(*SDL_touchPads[index])); - if (!SDL_touchPads[index]) { - SDL_OutOfMemory(); - return -1; + SDL_touchDevices[index] = (SDL_Touch *) SDL_malloc(sizeof(*SDL_touchDevices[index])); + if (!SDL_touchDevices[index]) { + return SDL_OutOfMemory(); } - SDL_memcpy(SDL_touchPads[index], touch, sizeof(*touch)); /* we're setting the touch properties */ - length = 0; - length = SDL_strlen(name); - SDL_touchPads[index]->focus = 0; - SDL_touchPads[index]->name = SDL_malloc((length + 2) * sizeof(char)); - SDL_strlcpy(SDL_touchPads[index]->name, name, length + 1); + SDL_touchDevices[index]->id = touchID; + SDL_touchDevices[index]->num_fingers = 0; + SDL_touchDevices[index]->max_fingers = 0; + SDL_touchDevices[index]->fingers = NULL; - SDL_touchPads[index]->num_fingers = 0; - SDL_touchPads[index]->max_fingers = 1; - SDL_touchPads[index]->fingers = (SDL_Finger **) SDL_malloc(sizeof(SDL_Finger*)); - SDL_touchPads[index]->fingers[0] = NULL; - SDL_touchPads[index]->buttonstate = 0; - SDL_touchPads[index]->relative_mode = SDL_FALSE; - SDL_touchPads[index]->flush_motion = SDL_FALSE; - - SDL_touchPads[index]->xres = (1<<(16-1)); - SDL_touchPads[index]->yres = (1<<(16-1)); - SDL_touchPads[index]->pressureres = (1<<(16-1)); - //Do I want this here? Probably - SDL_GestureAddTouch(SDL_touchPads[index]); + /* Record this touch device for gestures */ + /* We could do this on the fly in the gesture code if we wanted */ + SDL_GestureAddTouch(touchID); return index; } +static int +SDL_AddFinger(SDL_Touch *touch, SDL_FingerID fingerid, float x, float y, float pressure) +{ + SDL_Finger *finger; + + if (touch->num_fingers == touch->max_fingers) { + SDL_Finger **new_fingers; + new_fingers = (SDL_Finger **)SDL_realloc(touch->fingers, (touch->max_fingers+1)*sizeof(*touch->fingers)); + if (!new_fingers) { + return SDL_OutOfMemory(); + } + touch->fingers = new_fingers; + touch->fingers[touch->max_fingers] = (SDL_Finger *)SDL_malloc(sizeof(*finger)); + if (!touch->fingers[touch->max_fingers]) { + return SDL_OutOfMemory(); + } + touch->max_fingers++; + } + + finger = touch->fingers[touch->num_fingers++]; + finger->id = fingerid; + finger->x = x; + finger->y = y; + finger->pressure = pressure; + return 0; +} + +static int +SDL_DelFinger(SDL_Touch* touch, SDL_FingerID fingerid) +{ + SDL_Finger *temp; + + int index = SDL_GetFingerIndex(touch, fingerid); + if (index < 0) { + return -1; + } + + touch->num_fingers--; + temp = touch->fingers[index]; + touch->fingers[index] = touch->fingers[touch->num_fingers]; + touch->fingers[touch->num_fingers] = temp; + return 0; +} + +int +SDL_SendTouch(SDL_TouchID id, SDL_FingerID fingerid, + SDL_bool down, float x, float y, float pressure) +{ + int posted; + SDL_Finger *finger; + + SDL_Touch* touch = SDL_GetTouch(id); + if (!touch) { + return -1; + } + + finger = SDL_GetFinger(touch, fingerid); + if (down) { + if (finger) { + /* This finger is already down */ + return 0; + } + + if (SDL_AddFinger(touch, fingerid, x, y, pressure) < 0) { + return 0; + } + + posted = 0; + if (SDL_GetEventState(SDL_FINGERDOWN) == SDL_ENABLE) { + SDL_Event event; + event.tfinger.type = SDL_FINGERDOWN; + event.tfinger.touchId = id; + event.tfinger.fingerId = fingerid; + event.tfinger.x = x; + event.tfinger.y = y; + event.tfinger.dx = 0; + event.tfinger.dy = 0; + event.tfinger.pressure = pressure; + posted = (SDL_PushEvent(&event) > 0); + } + } else { + if (!finger) { + /* This finger is already up */ + return 0; + } + + posted = 0; + if (SDL_GetEventState(SDL_FINGERUP) == SDL_ENABLE) { + SDL_Event event; + event.tfinger.type = SDL_FINGERUP; + event.tfinger.touchId = id; + event.tfinger.fingerId = fingerid; + /* I don't trust the coordinates passed on fingerUp */ + event.tfinger.x = finger->x; + event.tfinger.y = finger->y; + event.tfinger.dx = 0; + event.tfinger.dy = 0; + event.tfinger.pressure = pressure; + posted = (SDL_PushEvent(&event) > 0); + } + + SDL_DelFinger(touch, fingerid); + } + return posted; +} + +int +SDL_SendTouchMotion(SDL_TouchID id, SDL_FingerID fingerid, + float x, float y, float pressure) +{ + SDL_Touch *touch; + SDL_Finger *finger; + int posted; + float xrel, yrel, prel; + + touch = SDL_GetTouch(id); + if (!touch) { + return -1; + } + + finger = SDL_GetFinger(touch,fingerid); + if (!finger) { + return SDL_SendTouch(id, fingerid, SDL_TRUE, x, y, pressure); + } + + xrel = x - finger->x; + yrel = y - finger->y; + prel = pressure - finger->pressure; + + /* Drop events that don't change state */ + if (!xrel && !yrel && !prel) { +#if 0 + printf("Touch event didn't change state - dropped!\n"); +#endif + return 0; + } + + /* Update internal touch coordinates */ + finger->x = x; + finger->y = y; + finger->pressure = pressure; + + /* Post the event, if desired */ + posted = 0; + if (SDL_GetEventState(SDL_FINGERMOTION) == SDL_ENABLE) { + SDL_Event event; + event.tfinger.type = SDL_FINGERMOTION; + event.tfinger.touchId = id; + event.tfinger.fingerId = fingerid; + event.tfinger.x = x; + event.tfinger.y = y; + event.tfinger.dx = xrel; + event.tfinger.dy = yrel; + event.tfinger.pressure = pressure; + posted = (SDL_PushEvent(&event) > 0); + } + return posted; +} + void SDL_DelTouch(SDL_TouchID id) { - int index = SDL_GetTouchIndexId(id); + int i; + int index = SDL_GetTouchIndex(id); SDL_Touch *touch = SDL_GetTouch(id); if (!touch) { return; } - - SDL_free(touch->name); - - if (touch->FreeTouch) { - touch->FreeTouch(touch); + for (i = 0; i < touch->max_fingers; ++i) { + SDL_free(touch->fingers[i]); } + SDL_free(touch->fingers); SDL_free(touch); SDL_num_touch--; - SDL_touchPads[index] = SDL_touchPads[SDL_num_touch]; + SDL_touchDevices[index] = SDL_touchDevices[SDL_num_touch]; } void @@ -175,401 +350,15 @@ SDL_TouchQuit(void) { int i; - for (i = SDL_num_touch-1; i > 0 ; --i) { - SDL_DelTouch(i); + for (i = SDL_num_touch; i--; ) { + SDL_DelTouch(SDL_touchDevices[i]->id); } - SDL_num_touch = 0; + SDL_assert(SDL_num_touch == 0); - if (SDL_touchPads) { - SDL_free(SDL_touchPads); - SDL_touchPads = NULL; + if (SDL_touchDevices) { + SDL_free(SDL_touchDevices); + SDL_touchDevices = NULL; } } -int -SDL_GetNumTouch(void) -{ - return SDL_num_touch; -} - -SDL_Window * -SDL_GetTouchFocusWindow(SDL_TouchID id) -{ - SDL_Touch *touch = SDL_GetTouch(id); - - if (!touch) { - return 0; - } - return touch->focus; -} - -void -SDL_SetTouchFocus(SDL_TouchID id, SDL_Window * window) -{ - int index = SDL_GetTouchIndexId(id); - SDL_Touch *touch = SDL_GetTouch(id); - int i; - SDL_bool focus; - - if (!touch || (touch->focus == window)) { - return; - } - - /* See if the current window has lost focus */ - if (touch->focus) { - focus = SDL_FALSE; - for (i = 0; i < SDL_num_touch; ++i) { - SDL_Touch *check; - if (i != index) { - check = SDL_touchPads[i]; - if (check && check->focus == touch->focus) { - focus = SDL_TRUE; - break; - } - } - } - if (!focus) { - SDL_SendWindowEvent(touch->focus, SDL_WINDOWEVENT_LEAVE, 0, 0); - } - } - - touch->focus = window; - - if (touch->focus) { - focus = SDL_FALSE; - for (i = 0; i < SDL_num_touch; ++i) { - SDL_Touch *check; - if (i != index) { - check = SDL_touchPads[i]; - if (check && check->focus == touch->focus) { - focus = SDL_TRUE; - break; - } - } - } - if (!focus) { - SDL_SendWindowEvent(touch->focus, SDL_WINDOWEVENT_ENTER, 0, 0); - } - } -} - -int -SDL_AddFinger(SDL_Touch* touch,SDL_Finger *finger) -{ - int index; - SDL_Finger **fingers; - //printf("Adding Finger...\n"); - if (SDL_GetFingerIndexId(touch,finger->id) != -1) { - SDL_SetError("Finger ID already in use"); - } - - /* Add the touch to the list of touch */ - if(touch->num_fingers >= touch->max_fingers){ - //printf("Making room for it!\n"); - fingers = (SDL_Finger **) SDL_realloc(touch->fingers, - (touch->num_fingers + 1) * sizeof(SDL_Finger *)); - touch->max_fingers = touch->num_fingers+1; - if (!fingers) { - SDL_OutOfMemory(); - return -1; - } else { - touch->max_fingers = touch->num_fingers+1; - touch->fingers = fingers; - } - } - - index = touch->num_fingers; - //printf("Max_Fingers: %i Index: %i\n",touch->max_fingers,index); - - touch->fingers[index] = (SDL_Finger *) SDL_malloc(sizeof(SDL_Finger)); - if (!touch->fingers[index]) { - SDL_OutOfMemory(); - return -1; - } - *(touch->fingers[index]) = *finger; - touch->num_fingers++; - - return index; -} - -int -SDL_DelFinger(SDL_Touch* touch,SDL_FingerID fingerid) -{ - int index = SDL_GetFingerIndexId(touch,fingerid); - SDL_Finger* finger = SDL_GetFinger(touch,fingerid); - - if (!finger) { - return -1; - } - - - SDL_free(finger); - touch->num_fingers--; - touch->fingers[index] = touch->fingers[touch->num_fingers]; - return 0; -} - - -int -SDL_SendFingerDown(SDL_TouchID id, SDL_FingerID fingerid, SDL_bool down, - float xin, float yin, float pressurein) -{ - int posted; - Uint16 x; - Uint16 y; - Uint16 pressure; - SDL_Finger *finger; - - SDL_Touch* touch = SDL_GetTouch(id); - - if(!touch) { - return SDL_TouchNotFoundError(id); - } - - - //scale to Integer coordinates - x = (Uint16)((xin+touch->x_min)*(touch->xres)/(touch->native_xres)); - y = (Uint16)((yin+touch->y_min)*(touch->yres)/(touch->native_yres)); - pressure = (Uint16)((pressurein+touch->pressure_min)*(touch->pressureres)/(touch->native_pressureres)); - - finger = SDL_GetFinger(touch,fingerid); - if(down) { - if(finger == NULL) { - SDL_Finger nf; - nf.id = fingerid; - nf.x = x; - nf.y = y; - nf.pressure = pressure; - nf.xdelta = 0; - nf.ydelta = 0; - nf.last_x = x; - nf.last_y = y; - nf.last_pressure = pressure; - nf.down = SDL_FALSE; - if(SDL_AddFinger(touch,&nf) < 0) return 0; - finger = SDL_GetFinger(touch,fingerid); - } - else if(finger->down) return 0; - if(xin < touch->x_min || yin < touch->y_min) return 0; //should defer if only a partial input - posted = 0; - if (SDL_GetEventState(SDL_FINGERDOWN) == SDL_ENABLE) { - SDL_Event event; - event.tfinger.type = SDL_FINGERDOWN; - event.tfinger.touchId = id; - event.tfinger.x = x; - event.tfinger.y = y; - event.tfinger.dx = 0; - event.tfinger.dy = 0; - event.tfinger.pressure = pressure; - event.tfinger.state = touch->buttonstate; - event.tfinger.windowID = touch->focus ? touch->focus->id : 0; - event.tfinger.fingerId = fingerid; - posted = (SDL_PushEvent(&event) > 0); - } - if(posted) finger->down = SDL_TRUE; - return posted; - } - else { - if(finger == NULL) { - SDL_SetError("Finger not found."); - return 0; - } - posted = 0; - if (SDL_GetEventState(SDL_FINGERUP) == SDL_ENABLE) { - SDL_Event event; - event.tfinger.type = SDL_FINGERUP; - event.tfinger.touchId = id; - event.tfinger.state = touch->buttonstate; - event.tfinger.windowID = touch->focus ? touch->focus->id : 0; - event.tfinger.fingerId = fingerid; - //I don't trust the coordinates passed on fingerUp - event.tfinger.x = finger->x; - event.tfinger.y = finger->y; - event.tfinger.dx = 0; - event.tfinger.dy = 0; - event.tfinger.pressure = pressure; - - if(SDL_DelFinger(touch,fingerid) < 0) return 0; - posted = (SDL_PushEvent(&event) > 0); - } - return posted; - } -} - -int -SDL_SendTouchMotion(SDL_TouchID id, SDL_FingerID fingerid, int relative, - float xin, float yin, float pressurein) -{ - SDL_Touch *touch; - SDL_Finger *finger; - int posted; - Sint16 xrel, yrel; - Uint16 x; - Uint16 y; - Uint16 pressure; - - touch = SDL_GetTouch(id); - if (!touch) { - return SDL_TouchNotFoundError(id); - } - - //scale to Integer coordinates - x = (Uint16)((xin+touch->x_min)*(touch->xres)/(touch->native_xres)); - y = (Uint16)((yin+touch->y_min)*(touch->yres)/(touch->native_yres)); - pressure = (Uint16)((pressurein+touch->pressure_min)*(touch->pressureres)/(touch->native_pressureres)); - if(touch->flush_motion) { - return 0; - } - - finger = SDL_GetFinger(touch,fingerid); - if(finger == NULL || !finger->down) { - return SDL_SendFingerDown(id,fingerid,SDL_TRUE,xin,yin,pressurein); - } else { - /* the relative motion is calculated regarding the last position */ - if (relative) { - xrel = x; - yrel = y; - x = (finger->last_x + x); - y = (finger->last_y + y); - } else { - if(xin < touch->x_min) x = finger->last_x; /*If movement is only in one axis,*/ - if(yin < touch->y_min) y = finger->last_y; /*The other is marked as -1*/ - if(pressurein < touch->pressure_min) pressure = finger->last_pressure; - xrel = x - finger->last_x; - yrel = y - finger->last_y; - //printf("xrel,yrel (%i,%i)\n",(int)xrel,(int)yrel); - } - - /* Drop events that don't change state */ - if (!xrel && !yrel) { -#if 0 - printf("Touch event didn't change state - dropped!\n"); -#endif - return 0; - } - - /* Update internal touch coordinates */ - - finger->x = x; - finger->y = y; - - /*Should scale to window? Normalize? Maintain Aspect?*/ - //SDL_GetWindowSize(touch->focus, &x_max, &y_max); - - /* make sure that the pointers find themselves inside the windows */ - /* only check if touch->xmax is set ! */ - /* - if (x_max && touch->x > x_max) { - touch->x = x_max; - } else if (touch->x < 0) { - touch->x = 0; - } - - if (y_max && touch->y > y_max) { - touch->y = y_max; - } else if (touch->y < 0) { - touch->y = 0; - } - */ - finger->xdelta = xrel; - finger->ydelta = yrel; - finger->pressure = pressure; - - - - /* Post the event, if desired */ - posted = 0; - if (SDL_GetEventState(SDL_FINGERMOTION) == SDL_ENABLE) { - SDL_Event event; - event.tfinger.type = SDL_FINGERMOTION; - event.tfinger.touchId = id; - event.tfinger.fingerId = fingerid; - event.tfinger.x = x; - event.tfinger.y = y; - event.tfinger.dx = xrel; - event.tfinger.dy = yrel; - - event.tfinger.pressure = pressure; - event.tfinger.state = touch->buttonstate; - event.tfinger.windowID = touch->focus ? touch->focus->id : 0; - posted = (SDL_PushEvent(&event) > 0); - } - finger->last_x = finger->x; - finger->last_y = finger->y; - finger->last_pressure = finger->pressure; - return posted; - } -} - -int -SDL_SendTouchButton(SDL_TouchID id, Uint8 state, Uint8 button) -{ - SDL_Touch *touch; - int posted; - Uint32 type; - - - touch = SDL_GetTouch(id); - if (!touch) { - return SDL_TouchNotFoundError(id); - } - - /* Figure out which event to perform */ - switch (state) { - case SDL_PRESSED: - if (touch->buttonstate & SDL_BUTTON(button)) { - /* Ignore this event, no state change */ - return 0; - } - type = SDL_TOUCHBUTTONDOWN; - touch->buttonstate |= SDL_BUTTON(button); - break; - case SDL_RELEASED: - if (!(touch->buttonstate & SDL_BUTTON(button))) { - /* Ignore this event, no state change */ - return 0; - } - type = SDL_TOUCHBUTTONUP; - touch->buttonstate &= ~SDL_BUTTON(button); - break; - default: - /* Invalid state -- bail */ - return 0; - } - - /* Post the event, if desired */ - posted = 0; - if (SDL_GetEventState(type) == SDL_ENABLE) { - SDL_Event event; - event.type = type; - event.tbutton.touchId = touch->id; - event.tbutton.state = state; - event.tbutton.button = button; - event.tbutton.windowID = touch->focus ? touch->focus->id : 0; - posted = (SDL_PushEvent(&event) > 0); - } - return posted; -} - -char * -SDL_GetTouchName(SDL_TouchID id) -{ - SDL_Touch *touch = SDL_GetTouch(id); - if (!touch) { - return NULL; - } - return touch->name; -} - -int SDL_TouchNotFoundError(SDL_TouchID id) { - //int i; - SDL_SetError("ERROR: Cannot send touch on non-existent device with id: %li make sure SDL_AddTouch has been called\n",id); -#if 0 - printf("ERROR: There are %i touches installed with Id's:\n",SDL_num_touch); - for(i=0;i < SDL_num_touch;i++) { - printf("ERROR: %li\n",SDL_touchPads[i]->id); - } -#endif - return 0; -} /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/eepp/helper/SDL2/src/events/SDL_touch_c.h b/src/eepp/helper/SDL2/src/events/SDL_touch_c.h index 17bbce07d..d0a2cf2f7 100644 --- a/src/eepp/helper/SDL2/src/events/SDL_touch_c.h +++ b/src/eepp/helper/SDL2/src/events/SDL_touch_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -24,55 +24,38 @@ #ifndef _SDL_touch_c_h #define _SDL_touch_c_h +typedef struct SDL_Touch +{ + SDL_TouchID id; + int num_fingers; + int max_fingers; + SDL_Finger** fingers; +} SDL_Touch; /* Initialize the touch subsystem */ extern int SDL_TouchInit(void); -/*Get the touch at an index */ -extern SDL_Touch *SDL_GetTouchIndex(int index); +/* 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 id = id */ +/* Get the touch with a given id */ extern SDL_Touch *SDL_GetTouch(SDL_TouchID id); -/*Get the finger at an index */ -extern SDL_Finger *SDL_GetFingerIndex(SDL_Touch *touch, int index); - -/* Get the finger with id = id */ -extern SDL_Finger *SDL_GetFinger(SDL_Touch *touch,SDL_FingerID id); - - -/* Add a touch, possibly reattaching at a particular index (or -1), - returning the index of the touch, or -1 if there was an error. */ -extern int SDL_AddTouch(const SDL_Touch * touch, char *name); - - -/* Remove a touch at an index, clearing the slot for later */ -extern void SDL_DelTouch(SDL_TouchID id); - -/* Set the touch focus window */ -extern void SDL_SetTouchFocus(SDL_TouchID id, SDL_Window * window); +/* 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); /* Send a touch motion event for a touch */ extern int SDL_SendTouchMotion(SDL_TouchID id, SDL_FingerID fingerid, - int relative, float x, float y, float z); + float x, float y, float pressure); -/* Send a touch down/up event for a touch */ -extern int SDL_SendFingerDown(SDL_TouchID id, SDL_FingerID fingerid, - SDL_bool down, float x, float y, float pressure); - -/* Send a touch button event for a touch */ -extern int SDL_SendTouchButton(SDL_TouchID id, Uint8 state, Uint8 button); +/* Remove a touch */ +extern void SDL_DelTouch(SDL_TouchID id); /* Shutdown the touch subsystem */ extern void SDL_TouchQuit(void); -/* Get the index of a touch device */ -extern int SDL_GetTouchIndexId(SDL_TouchID id); - -/* Print a debug message for a nonexistent touch */ -extern int SDL_TouchNotFoundError(SDL_TouchID id); - #endif /* _SDL_touch_c_h */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/eepp/helper/SDL2/src/events/SDL_windowevents.c b/src/eepp/helper/SDL2/src/events/SDL_windowevents.c index 88629c807..9011f68e1 100644 --- a/src/eepp/helper/SDL2/src/events/SDL_windowevents.c +++ b/src/eepp/helper/SDL2/src/events/SDL_windowevents.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -148,12 +148,14 @@ SDL_SendWindowEvent(SDL_Window * window, Uint8 windowevent, int data1, return 0; } window->flags |= SDL_WINDOW_MOUSE_FOCUS; + SDL_OnWindowEnter(window); break; case SDL_WINDOWEVENT_LEAVE: if (!(window->flags & SDL_WINDOW_MOUSE_FOCUS)) { return 0; } window->flags &= ~SDL_WINDOW_MOUSE_FOCUS; + SDL_OnWindowLeave(window); break; case SDL_WINDOWEVENT_FOCUS_GAINED: if (window->flags & SDL_WINDOW_INPUT_FOCUS) { @@ -194,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/eepp/helper/SDL2/src/events/SDL_windowevents_c.h b/src/eepp/helper/SDL2/src/events/SDL_windowevents_c.h index dac3e099e..0d14a0349 100644 --- a/src/eepp/helper/SDL2/src/events/SDL_windowevents_c.h +++ b/src/eepp/helper/SDL2/src/events/SDL_windowevents_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/events/blank_cursor.h b/src/eepp/helper/SDL2/src/events/blank_cursor.h index fdc4632ad..6efb4741e 100644 --- a/src/eepp/helper/SDL2/src/events/blank_cursor.h +++ b/src/eepp/helper/SDL2/src/events/blank_cursor.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -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/eepp/helper/SDL2/src/events/default_cursor.h b/src/eepp/helper/SDL2/src/events/default_cursor.h index ba68bf3c5..8c2dcfcff 100644 --- a/src/eepp/helper/SDL2/src/events/default_cursor.h +++ b/src/eepp/helper/SDL2/src/events/default_cursor.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -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/eepp/helper/SDL2/src/events/nds/SDL_ndsgesture.c b/src/eepp/helper/SDL2/src/events/nds/SDL_ndsgesture.c deleted file mode 100644 index b729c7ee8..000000000 --- a/src/eepp/helper/SDL2/src/events/nds/SDL_ndsgesture.c +++ /dev/null @@ -1,41 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga - - 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 - appreciated but is not required. - 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. -*/ - -#include "SDL_config.h" - -/* No supported under the NDS because of math operations. */ - -#include "SDL_events.h" -#include "../SDL_events_c.h" -#include "../SDL_gesture_c.h" - -int SDL_GestureAddTouch(SDL_Touch* touch) -{ - return 0; -} - -void SDL_GestureProcessEvent(SDL_Event* event) -{ - return; -} - -/* vi: set ts=4 sw=4 expandtab: */ - diff --git a/src/eepp/helper/SDL2/src/events/scancodes_darwin.h b/src/eepp/helper/SDL2/src/events/scancodes_darwin.h index 25d236f30..1935c16e4 100644 --- a/src/eepp/helper/SDL2/src/events/scancodes_darwin.h +++ b/src/eepp/helper/SDL2/src/events/scancodes_darwin.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/events/scancodes_linux.h b/src/eepp/helper/SDL2/src/events/scancodes_linux.h index 05110d625..4d819da1b 100644 --- a/src/eepp/helper/SDL2/src/events/scancodes_linux.h +++ b/src/eepp/helper/SDL2/src/events/scancodes_linux.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/events/scancodes_windows.h b/src/eepp/helper/SDL2/src/events/scancodes_windows.h index 9028e0466..7bf69b0ad 100644 --- a/src/eepp/helper/SDL2/src/events/scancodes_windows.h +++ b/src/eepp/helper/SDL2/src/events/scancodes_windows.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,267 +20,34 @@ */ #include "../../include/SDL_scancode.h" -/* Win32 virtual key code to SDL scancode mapping table - Sources: - - msdn.microsoft.com -*/ +/* Windows scancode to SDL scancode mapping table */ /* *INDENT-OFF* */ -static const SDL_Scancode windows_scancode_table[] = { - /* 0, 0x00 */ SDL_SCANCODE_UNKNOWN, - /* 1, 0x01 */ SDL_SCANCODE_UNKNOWN, - /* 2, 0x02 */ SDL_SCANCODE_UNKNOWN, - /* 3, 0x03 */ SDL_SCANCODE_UNKNOWN, - /* 4, 0x04 */ SDL_SCANCODE_UNKNOWN, - /* 5, 0x05 */ SDL_SCANCODE_UNKNOWN, - /* 6, 0x06 */ SDL_SCANCODE_UNKNOWN, - /* 7, 0x07 */ SDL_SCANCODE_UNKNOWN, - /* 8, 0x08 */ SDL_SCANCODE_BACKSPACE, - /* 9, 0x09 */ SDL_SCANCODE_TAB, - /* 10, 0x0a */ SDL_SCANCODE_KP_ENTER, /* Not a VKEY, SDL specific */ - /* 11, 0x0b */ SDL_SCANCODE_UNKNOWN, - /* 12, 0x0c */ SDL_SCANCODE_CLEAR, - /* 13, 0x0d */ SDL_SCANCODE_RETURN, - /* 14, 0x0e */ SDL_SCANCODE_UNKNOWN, - /* 15, 0x0f */ SDL_SCANCODE_UNKNOWN, - /* 16, 0x10 */ SDL_SCANCODE_UNKNOWN, - /* 17, 0x11 */ SDL_SCANCODE_UNKNOWN, - /* 18, 0x12 */ SDL_SCANCODE_APPLICATION, - /* 19, 0x13 */ SDL_SCANCODE_PAUSE, - /* 20, 0x14 */ SDL_SCANCODE_CAPSLOCK, - /* 21, 0x15 */ SDL_SCANCODE_UNKNOWN, - /* 22, 0x16 */ SDL_SCANCODE_UNKNOWN, - /* 23, 0x17 */ SDL_SCANCODE_UNKNOWN, - /* 24, 0x18 */ SDL_SCANCODE_UNKNOWN, - /* 25, 0x19 */ SDL_SCANCODE_UNKNOWN, - /* 26, 0x1a */ SDL_SCANCODE_UNKNOWN, - /* 27, 0x1b */ SDL_SCANCODE_ESCAPE, - /* 28, 0x1c */ SDL_SCANCODE_UNKNOWN, - /* 29, 0x1d */ SDL_SCANCODE_UNKNOWN, - /* 30, 0x1e */ SDL_SCANCODE_UNKNOWN, - /* 31, 0x1f */ SDL_SCANCODE_MODE, - /* 32, 0x20 */ SDL_SCANCODE_SPACE, - /* 33, 0x21 */ SDL_SCANCODE_PAGEUP, - /* 34, 0x22 */ SDL_SCANCODE_PAGEDOWN, - /* 35, 0x23 */ SDL_SCANCODE_END, - /* 36, 0x24 */ SDL_SCANCODE_HOME, - /* 37, 0x25 */ SDL_SCANCODE_LEFT, - /* 38, 0x26 */ SDL_SCANCODE_UP, - /* 39, 0x27 */ SDL_SCANCODE_RIGHT, - /* 40, 0x28 */ SDL_SCANCODE_DOWN, - /* 41, 0x29 */ SDL_SCANCODE_SELECT, - /* 42, 0x2a */ SDL_SCANCODE_UNKNOWN, /* VK_PRINT */ - /* 43, 0x2b */ SDL_SCANCODE_EXECUTE, - /* 44, 0x2c */ SDL_SCANCODE_PRINTSCREEN, - /* 45, 0x2d */ SDL_SCANCODE_INSERT, - /* 46, 0x2e */ SDL_SCANCODE_DELETE, - /* 47, 0x2f */ SDL_SCANCODE_HELP, - /* 48, 0x30 */ SDL_SCANCODE_0, - /* 49, 0x31 */ SDL_SCANCODE_1, - /* 50, 0x32 */ SDL_SCANCODE_2, - /* 51, 0x33 */ SDL_SCANCODE_3, - /* 52, 0x34 */ SDL_SCANCODE_4, - /* 53, 0x35 */ SDL_SCANCODE_5, - /* 54, 0x36 */ SDL_SCANCODE_6, - /* 55, 0x37 */ SDL_SCANCODE_7, - /* 56, 0x38 */ SDL_SCANCODE_8, - /* 57, 0x39 */ SDL_SCANCODE_9, - /* 58, 0x3a */ SDL_SCANCODE_UNKNOWN, - /* 59, 0x3b */ SDL_SCANCODE_UNKNOWN, - /* 60, 0x3c */ SDL_SCANCODE_UNKNOWN, - /* 61, 0x3d */ SDL_SCANCODE_UNKNOWN, - /* 62, 0x3e */ SDL_SCANCODE_UNKNOWN, - /* 63, 0x3f */ SDL_SCANCODE_UNKNOWN, - /* 64, 0x40 */ SDL_SCANCODE_UNKNOWN, - /* 65, 0x41 */ SDL_SCANCODE_A, - /* 66, 0x42 */ SDL_SCANCODE_B, - /* 67, 0x43 */ SDL_SCANCODE_C, - /* 68, 0x44 */ SDL_SCANCODE_D, - /* 69, 0x45 */ SDL_SCANCODE_E, - /* 70, 0x46 */ SDL_SCANCODE_F, - /* 71, 0x47 */ SDL_SCANCODE_G, - /* 72, 0x48 */ SDL_SCANCODE_H, - /* 73, 0x49 */ SDL_SCANCODE_I, - /* 74, 0x4a */ SDL_SCANCODE_J, - /* 75, 0x4b */ SDL_SCANCODE_K, - /* 76, 0x4c */ SDL_SCANCODE_L, - /* 77, 0x4d */ SDL_SCANCODE_M, - /* 78, 0x4e */ SDL_SCANCODE_N, - /* 79, 0x4f */ SDL_SCANCODE_O, - /* 80, 0x50 */ SDL_SCANCODE_P, - /* 81, 0x51 */ SDL_SCANCODE_Q, - /* 82, 0x52 */ SDL_SCANCODE_R, - /* 83, 0x53 */ SDL_SCANCODE_S, - /* 84, 0x54 */ SDL_SCANCODE_T, - /* 85, 0x55 */ SDL_SCANCODE_U, - /* 86, 0x56 */ SDL_SCANCODE_V, - /* 87, 0x57 */ SDL_SCANCODE_W, - /* 88, 0x58 */ SDL_SCANCODE_X, - /* 89, 0x59 */ SDL_SCANCODE_Y, - /* 90, 0x5a */ SDL_SCANCODE_Z, - /* 91, 0x5b */ SDL_SCANCODE_LGUI, - /* 92, 0x5c */ SDL_SCANCODE_RGUI, - /* 93, 0x5d */ SDL_SCANCODE_APPLICATION, - /* 94, 0x5e */ SDL_SCANCODE_UNKNOWN, - /* 95, 0x5f */ SDL_SCANCODE_UNKNOWN, - /* 96, 0x60 */ SDL_SCANCODE_KP_0, - /* 97, 0x61 */ SDL_SCANCODE_KP_1, - /* 98, 0x62 */ SDL_SCANCODE_KP_2, - /* 99, 0x63 */ SDL_SCANCODE_KP_3, - /* 100, 0x64 */ SDL_SCANCODE_KP_4, - /* 101, 0x65 */ SDL_SCANCODE_KP_5, - /* 102, 0x66 */ SDL_SCANCODE_KP_6, - /* 103, 0x67 */ SDL_SCANCODE_KP_7, - /* 104, 0x68 */ SDL_SCANCODE_KP_8, - /* 105, 0x69 */ SDL_SCANCODE_KP_9, - /* 106, 0x6a */ SDL_SCANCODE_KP_MULTIPLY, - /* 107, 0x6b */ SDL_SCANCODE_KP_PLUS, - /* 108, 0x6c */ SDL_SCANCODE_SEPARATOR, - /* 109, 0x6d */ SDL_SCANCODE_KP_MINUS, - /* 110, 0x6e */ SDL_SCANCODE_KP_DECIMAL, - /* 111, 0x6f */ SDL_SCANCODE_KP_DIVIDE, - /* 112, 0x70 */ SDL_SCANCODE_F1, - /* 113, 0x71 */ SDL_SCANCODE_F2, - /* 114, 0x72 */ SDL_SCANCODE_F3, - /* 115, 0x73 */ SDL_SCANCODE_F4, - /* 116, 0x74 */ SDL_SCANCODE_F5, - /* 117, 0x75 */ SDL_SCANCODE_F6, - /* 118, 0x76 */ SDL_SCANCODE_F7, - /* 119, 0x77 */ SDL_SCANCODE_F8, - /* 120, 0x78 */ SDL_SCANCODE_F9, - /* 121, 0x79 */ SDL_SCANCODE_F10, - /* 122, 0x7a */ SDL_SCANCODE_F11, - /* 123, 0x7b */ SDL_SCANCODE_F12, - /* 124, 0x7c */ SDL_SCANCODE_F13, - /* 125, 0x7d */ SDL_SCANCODE_F14, - /* 126, 0x7e */ SDL_SCANCODE_F15, - /* 127, 0x7f */ SDL_SCANCODE_F16, - /* 128, 0x80 */ SDL_SCANCODE_F17, /* or SDL_SCANCODE_AUDIONEXT */ - /* 129, 0x81 */ SDL_SCANCODE_F18, /* or SDL_SCANCODE_AUDIOPREV */ - /* 130, 0x82 */ SDL_SCANCODE_F19, /* or SDL_SCANCODE_AUDIOSTOP */ - /* 131, 0x83 */ SDL_SCANCODE_F20, /* or SDL_SCANCODE_AUDIOPLAY */ - /* 132, 0x84 */ SDL_SCANCODE_F21, /* or SDL_SCANCODE_MAIL */ - /* 133, 0x85 */ SDL_SCANCODE_F22, /* or SDL_SCANCODE_MEDIASELECT */ - /* 134, 0x86 */ SDL_SCANCODE_F23, /* or SDL_SCANCODE_WWW */ - /* 135, 0x87 */ SDL_SCANCODE_F24, /* or SDL_SCANCODE_CALCULATOR */ - /* 136, 0x88 */ SDL_SCANCODE_UNKNOWN, - /* 137, 0x89 */ SDL_SCANCODE_UNKNOWN, - /* 138, 0x8a */ SDL_SCANCODE_UNKNOWN, - /* 139, 0x8b */ SDL_SCANCODE_UNKNOWN, - /* 140, 0x8c */ SDL_SCANCODE_UNKNOWN, - /* 141, 0x8d */ SDL_SCANCODE_UNKNOWN, - /* 142, 0x8e */ SDL_SCANCODE_UNKNOWN, - /* 143, 0x8f */ SDL_SCANCODE_UNKNOWN, - /* 144, 0x90 */ SDL_SCANCODE_NUMLOCKCLEAR, - /* 145, 0x91 */ SDL_SCANCODE_SCROLLLOCK, - /* 146, 0x92 */ SDL_SCANCODE_KP_EQUALS, - /* 147, 0x93 */ SDL_SCANCODE_UNKNOWN, - /* 148, 0x94 */ SDL_SCANCODE_UNKNOWN, - /* 149, 0x95 */ SDL_SCANCODE_UNKNOWN, - /* 150, 0x96 */ SDL_SCANCODE_UNKNOWN, - /* 151, 0x97 */ SDL_SCANCODE_UNKNOWN, - /* 152, 0x98 */ SDL_SCANCODE_UNKNOWN, - /* 153, 0x99 */ SDL_SCANCODE_UNKNOWN, - /* 154, 0x9a */ SDL_SCANCODE_UNKNOWN, - /* 155, 0x9b */ SDL_SCANCODE_UNKNOWN, - /* 156, 0x9c */ SDL_SCANCODE_UNKNOWN, - /* 157, 0x9d */ SDL_SCANCODE_UNKNOWN, - /* 158, 0x9e */ SDL_SCANCODE_UNKNOWN, - /* 159, 0x9f */ SDL_SCANCODE_UNKNOWN, - /* 160, 0xa0 */ SDL_SCANCODE_LSHIFT, - /* 161, 0xa1 */ SDL_SCANCODE_RSHIFT, - /* 162, 0xa2 */ SDL_SCANCODE_LCTRL, - /* 163, 0xa3 */ SDL_SCANCODE_RCTRL, - /* 164, 0xa4 */ SDL_SCANCODE_LALT, - /* 165, 0xa5 */ SDL_SCANCODE_RALT, - /* 166, 0xa6 */ SDL_SCANCODE_AC_BACK, - /* 167, 0xa7 */ SDL_SCANCODE_AC_FORWARD, - /* 168, 0xa8 */ SDL_SCANCODE_AC_REFRESH, - /* 169, 0xa9 */ SDL_SCANCODE_AC_STOP, - /* 170, 0xaa */ SDL_SCANCODE_AC_SEARCH, - /* 171, 0xab */ SDL_SCANCODE_AC_BOOKMARKS, - /* 172, 0xac */ SDL_SCANCODE_AC_HOME, - /* 173, 0xad */ SDL_SCANCODE_AUDIOMUTE, - /* 174, 0xae */ SDL_SCANCODE_VOLUMEDOWN, - /* 175, 0xaf */ SDL_SCANCODE_VOLUMEUP, - /* 176, 0xb0 */ SDL_SCANCODE_AUDIONEXT, - /* 177, 0xb1 */ SDL_SCANCODE_AUDIOPREV, - /* 178, 0xb2 */ SDL_SCANCODE_AUDIOSTOP, - /* 179, 0xb3 */ SDL_SCANCODE_AUDIOPLAY, - /* 180, 0xb4 */ SDL_SCANCODE_MAIL, - /* 181, 0xb5 */ SDL_SCANCODE_MEDIASELECT, - /* 182, 0xb6 */ SDL_SCANCODE_UNKNOWN, /* VK_LAUNCH_APP1 */ - /* 183, 0xb7 */ SDL_SCANCODE_UNKNOWN, /* VK_LAUNCH_APP2 */ - /* 184, 0xb8 */ SDL_SCANCODE_UNKNOWN, - /* 185, 0xb9 */ SDL_SCANCODE_UNKNOWN, - /* 186, 0xba */ SDL_SCANCODE_SEMICOLON, - /* 187, 0xbb */ SDL_SCANCODE_EQUALS, - /* 188, 0xbc */ SDL_SCANCODE_COMMA, - /* 189, 0xbd */ SDL_SCANCODE_MINUS, - /* 190, 0xbe */ SDL_SCANCODE_PERIOD, - /* 191, 0xbf */ SDL_SCANCODE_SLASH, - /* 192, 0xc0 */ SDL_SCANCODE_GRAVE, - /* 193, 0xc1 */ SDL_SCANCODE_UNKNOWN, - /* 194, 0xc2 */ SDL_SCANCODE_UNKNOWN, - /* 195, 0xc3 */ SDL_SCANCODE_UNKNOWN, - /* 196, 0xc4 */ SDL_SCANCODE_UNKNOWN, - /* 197, 0xc5 */ SDL_SCANCODE_UNKNOWN, - /* 198, 0xc6 */ SDL_SCANCODE_UNKNOWN, - /* 199, 0xc7 */ SDL_SCANCODE_UNKNOWN, - /* 200, 0xc8 */ SDL_SCANCODE_UNKNOWN, - /* 201, 0xc9 */ SDL_SCANCODE_UNKNOWN, - /* 202, 0xca */ SDL_SCANCODE_UNKNOWN, - /* 203, 0xcb */ SDL_SCANCODE_UNKNOWN, - /* 204, 0xcc */ SDL_SCANCODE_UNKNOWN, - /* 205, 0xcd */ SDL_SCANCODE_UNKNOWN, - /* 206, 0xce */ SDL_SCANCODE_UNKNOWN, - /* 207, 0xcf */ SDL_SCANCODE_UNKNOWN, - /* 208, 0xd0 */ SDL_SCANCODE_UNKNOWN, - /* 209, 0xd1 */ SDL_SCANCODE_UNKNOWN, - /* 210, 0xd2 */ SDL_SCANCODE_UNKNOWN, - /* 211, 0xd3 */ SDL_SCANCODE_UNKNOWN, - /* 212, 0xd4 */ SDL_SCANCODE_UNKNOWN, - /* 213, 0xd5 */ SDL_SCANCODE_UNKNOWN, - /* 214, 0xd6 */ SDL_SCANCODE_UNKNOWN, - /* 215, 0xd7 */ SDL_SCANCODE_UNKNOWN, - /* 216, 0xd8 */ SDL_SCANCODE_UNKNOWN, - /* 217, 0xd9 */ SDL_SCANCODE_UNKNOWN, - /* 218, 0xda */ SDL_SCANCODE_UNKNOWN, - /* 219, 0xdb */ SDL_SCANCODE_LEFTBRACKET, - /* 220, 0xdc */ SDL_SCANCODE_BACKSLASH, - /* 221, 0xdd */ SDL_SCANCODE_RIGHTBRACKET, - /* 222, 0xde */ SDL_SCANCODE_APOSTROPHE, - /* 223, 0xdf */ SDL_SCANCODE_UNKNOWN, - /* 224, 0xe0 */ SDL_SCANCODE_UNKNOWN, - /* 225, 0xe1 */ SDL_SCANCODE_UNKNOWN, - /* 226, 0xe2 */ SDL_SCANCODE_NONUSBACKSLASH, - /* 227, 0xe3 */ SDL_SCANCODE_UNKNOWN, - /* 228, 0xe4 */ SDL_SCANCODE_UNKNOWN, - /* 229, 0xe5 */ SDL_SCANCODE_UNKNOWN, - /* 230, 0xe6 */ SDL_SCANCODE_UNKNOWN, - /* 231, 0xe7 */ SDL_SCANCODE_UNKNOWN, - /* 232, 0xe8 */ SDL_SCANCODE_UNKNOWN, - /* 233, 0xe9 */ SDL_SCANCODE_UNKNOWN, - /* 234, 0xea */ SDL_SCANCODE_UNKNOWN, - /* 235, 0xeb */ SDL_SCANCODE_UNKNOWN, - /* 236, 0xec */ SDL_SCANCODE_UNKNOWN, - /* 237, 0xed */ SDL_SCANCODE_UNKNOWN, - /* 238, 0xee */ SDL_SCANCODE_UNKNOWN, - /* 239, 0xef */ SDL_SCANCODE_UNKNOWN, - /* 240, 0xf0 */ SDL_SCANCODE_UNKNOWN, - /* 241, 0xf1 */ SDL_SCANCODE_UNKNOWN, - /* 242, 0xf2 */ SDL_SCANCODE_UNKNOWN, - /* 243, 0xf3 */ SDL_SCANCODE_UNKNOWN, - /* 244, 0xf4 */ SDL_SCANCODE_UNKNOWN, - /* 245, 0xf5 */ SDL_SCANCODE_UNKNOWN, - /* 246, 0xf6 */ SDL_SCANCODE_SYSREQ, - /* 247, 0xf7 */ SDL_SCANCODE_CRSEL, - /* 248, 0xf8 */ SDL_SCANCODE_EXSEL, - /* 249, 0xf9 */ SDL_SCANCODE_UNKNOWN, /* VK_EREOF */ - /* 250, 0xfa */ SDL_SCANCODE_UNKNOWN, /* VK_PLAY */ - /* 251, 0xfb */ SDL_SCANCODE_UNKNOWN, /* VK_ZOOM */ - /* 252, 0xfc */ SDL_SCANCODE_UNKNOWN, - /* 253, 0xfd */ SDL_SCANCODE_UNKNOWN, /* VK_PA1 */ - /* 254, 0xfe */ SDL_SCANCODE_CLEAR, - /* 255, 0xff */ SDL_SCANCODE_UNKNOWN, +static const SDL_Scancode windows_scancode_table[] = +{ + // 0 1 2 3 4 5 6 7 + // 8 9 A B C D E F + SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_ESCAPE, SDL_SCANCODE_1, SDL_SCANCODE_2, SDL_SCANCODE_3, SDL_SCANCODE_4, SDL_SCANCODE_5, SDL_SCANCODE_6, // 0 + SDL_SCANCODE_7, SDL_SCANCODE_8, SDL_SCANCODE_9, SDL_SCANCODE_0, SDL_SCANCODE_MINUS, SDL_SCANCODE_EQUALS, SDL_SCANCODE_BACKSPACE, SDL_SCANCODE_TAB, // 0 + + SDL_SCANCODE_Q, SDL_SCANCODE_W, SDL_SCANCODE_E, SDL_SCANCODE_R, SDL_SCANCODE_T, SDL_SCANCODE_Y, SDL_SCANCODE_U, SDL_SCANCODE_I, // 1 + SDL_SCANCODE_O, SDL_SCANCODE_P, SDL_SCANCODE_LEFTBRACKET, SDL_SCANCODE_RIGHTBRACKET, SDL_SCANCODE_RETURN, SDL_SCANCODE_LCTRL, SDL_SCANCODE_A, SDL_SCANCODE_S, // 1 + + SDL_SCANCODE_D, SDL_SCANCODE_F, SDL_SCANCODE_G, SDL_SCANCODE_H, SDL_SCANCODE_J, SDL_SCANCODE_K, SDL_SCANCODE_L, SDL_SCANCODE_SEMICOLON, // 2 + SDL_SCANCODE_APOSTROPHE, SDL_SCANCODE_GRAVE, SDL_SCANCODE_LSHIFT, SDL_SCANCODE_BACKSLASH, SDL_SCANCODE_Z, SDL_SCANCODE_X, SDL_SCANCODE_C, SDL_SCANCODE_V, // 2 + + SDL_SCANCODE_B, SDL_SCANCODE_N, SDL_SCANCODE_M, SDL_SCANCODE_COMMA, SDL_SCANCODE_PERIOD, SDL_SCANCODE_SLASH, SDL_SCANCODE_RSHIFT, SDL_SCANCODE_PRINTSCREEN,// 3 + SDL_SCANCODE_LALT, SDL_SCANCODE_SPACE, SDL_SCANCODE_CAPSLOCK, SDL_SCANCODE_F1, SDL_SCANCODE_F2, SDL_SCANCODE_F3, SDL_SCANCODE_F4, SDL_SCANCODE_F5, // 3 + + SDL_SCANCODE_F6, SDL_SCANCODE_F7, SDL_SCANCODE_F8, SDL_SCANCODE_F9, SDL_SCANCODE_F10, SDL_SCANCODE_NUMLOCKCLEAR, SDL_SCANCODE_SCROLLLOCK, SDL_SCANCODE_HOME, // 4 + SDL_SCANCODE_UP, SDL_SCANCODE_PAGEUP, SDL_SCANCODE_KP_MINUS, SDL_SCANCODE_LEFT, SDL_SCANCODE_KP_5, SDL_SCANCODE_RIGHT, SDL_SCANCODE_KP_PLUS, SDL_SCANCODE_END, // 4 + + SDL_SCANCODE_DOWN, SDL_SCANCODE_PAGEDOWN, SDL_SCANCODE_INSERT, SDL_SCANCODE_DELETE, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_NONUSBACKSLASH,SDL_SCANCODE_F11, // 5 + SDL_SCANCODE_F12, SDL_SCANCODE_PAUSE, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_LGUI, SDL_SCANCODE_RGUI, SDL_SCANCODE_APPLICATION, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, // 5 + + SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, // 6 + SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, // 6 + + SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, // 7 + SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN // 7 }; /* *INDENT-ON* */ diff --git a/src/eepp/helper/SDL2/src/events/scancodes_xfree86.h b/src/eepp/helper/SDL2/src/events/scancodes_xfree86.h index f83385042..bf958a685 100644 --- a/src/eepp/helper/SDL2/src/events/scancodes_xfree86.h +++ b/src/eepp/helper/SDL2/src/events/scancodes_xfree86.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/file/SDL_rwops.c b/src/eepp/helper/SDL2/src/file/SDL_rwops.c index 225d0a1d6..59e83c89a 100644 --- a/src/eepp/helper/SDL2/src/file/SDL_rwops.c +++ b/src/eepp/helper/SDL2/src/file/SDL_rwops.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -37,11 +37,6 @@ #include "../core/android/SDL_android.h" #endif -#ifdef __NDS__ -/* include libfat headers for fatInitDefault(). */ -#include -#endif /* __NDS__ */ - #ifdef __WIN32__ /* Functions to read/write Win32 API file pointers */ @@ -52,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) @@ -92,8 +87,7 @@ windows_file_open(SDL_RWops * context, const char *filename, const char *mode) context->hidden.windowsio.buffer.data = (char *) SDL_malloc(READAHEAD_BUFFER_SIZE); if (!context->hidden.windowsio.buffer.data) { - SDL_OutOfMemory(); - return -1; + return SDL_OutOfMemory(); } /* Do not open a dialog box if failure */ old_error_mode = @@ -129,13 +123,11 @@ windows_file_size(SDL_RWops * context) LARGE_INTEGER size; if (!context || context->hidden.windowsio.h == INVALID_HANDLE_VALUE) { - SDL_SetError("windows_file_size: invalid context/file not opened"); - return -1; + return SDL_SetError("windows_file_size: invalid context/file not opened"); } if (!GetFileSizeEx(context->hidden.windowsio.h, &size)) { - WIN_SetError("windows_file_size"); - return -1; + return WIN_SetError("windows_file_size"); } return size.QuadPart; @@ -148,8 +140,7 @@ windows_file_seek(SDL_RWops * context, Sint64 offset, int whence) LARGE_INTEGER windowsoffset; if (!context || context->hidden.windowsio.h == INVALID_HANDLE_VALUE) { - SDL_SetError("windows_file_seek: invalid context/file not opened"); - return -1; + return SDL_SetError("windows_file_seek: invalid context/file not opened"); } /* FIXME: We may be able to satisfy the seek within buffered data */ @@ -169,14 +160,12 @@ windows_file_seek(SDL_RWops * context, Sint64 offset, int whence) windowswhence = FILE_END; break; default: - SDL_SetError("windows_file_seek: Unknown value for 'whence'"); - return -1; + return SDL_SetError("windows_file_seek: Unknown value for 'whence'"); } windowsoffset.QuadPart = offset; if (!SetFilePointerEx(context->hidden.windowsio.h, windowsoffset, &windowsoffset, windowswhence)) { - WIN_SetError("windows_file_seek"); - return -1; + return WIN_SetError("windows_file_seek"); } return windowsoffset.QuadPart; } @@ -330,8 +319,7 @@ stdio_seek(SDL_RWops * context, Sint64 offset, int whence) return (ftell(context->hidden.stdio.fp)); } #endif - SDL_Error(SDL_EFSEEK); - return (-1); + return SDL_Error(SDL_EFSEEK); } static size_t SDLCALL @@ -366,8 +354,7 @@ stdio_close(SDL_RWops * context) if (context->hidden.stdio.autoclose) { /* WARNING: Check the return value here! */ if (fclose(context->hidden.stdio.fp) != 0) { - SDL_Error(SDL_EFWRITE); - status = -1; + status = SDL_Error(SDL_EFWRITE); } } SDL_FreeRW(context); @@ -400,8 +387,7 @@ mem_seek(SDL_RWops * context, Sint64 offset, int whence) newpos = context->hidden.mem.stop + offset; break; default: - SDL_SetError("Unknown value for 'whence'"); - return (-1); + return SDL_SetError("Unknown value for 'whence'"); } if (newpos < context->hidden.mem.base) { newpos = context->hidden.mem.base; @@ -451,7 +437,7 @@ static size_t SDLCALL mem_writeconst(SDL_RWops * context, const void *ptr, size_t size, size_t num) { SDL_SetError("Can't write to read-only memory"); - return (-1); + return (0); } static int SDLCALL @@ -513,6 +499,7 @@ SDL_RWFromFile(const char *file, const char *mode) rwops->read = Android_JNI_FileRead; rwops->write = Android_JNI_FileWrite; rwops->close = Android_JNI_FileClose; + rwops->type = SDL_RWOPS_JNIFILE; #elif defined(__WIN32__) rwops = SDL_AllocRW(); @@ -527,15 +514,16 @@ SDL_RWFromFile(const char *file, const char *mode) rwops->read = windows_file_read; rwops->write = windows_file_write; rwops->close = windows_file_close; + rwops->type = SDL_RWOPS_WINFILE; #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); @@ -554,13 +542,6 @@ SDL_RWFromFP(FILE * fp, SDL_bool autoclose) { SDL_RWops *rwops = NULL; -#if 0 -/*#ifdef __NDS__*/ - /* set it up so we can use stdio file function */ - fatInitDefault(); - printf("called fatInitDefault()"); -#endif /* __NDS__ */ - rwops = SDL_AllocRW(); if (rwops != NULL) { rwops->size = stdio_size; @@ -570,6 +551,7 @@ SDL_RWFromFP(FILE * fp, SDL_bool autoclose) rwops->close = stdio_close; rwops->hidden.stdio.fp = fp; rwops->hidden.stdio.autoclose = autoclose; + rwops->type = SDL_RWOPS_STDFILE; } return (rwops); } @@ -585,7 +567,15 @@ SDL_RWFromFP(void * fp, SDL_bool autoclose) SDL_RWops * SDL_RWFromMem(void *mem, int size) { - SDL_RWops *rwops; + SDL_RWops *rwops = NULL; + if (!mem) { + SDL_InvalidParamError("mem"); + return (rwops); + } + if (!size) { + SDL_InvalidParamError("size"); + return (rwops); + } rwops = SDL_AllocRW(); if (rwops != NULL) { @@ -597,6 +587,7 @@ SDL_RWFromMem(void *mem, int size) rwops->hidden.mem.base = (Uint8 *) mem; rwops->hidden.mem.here = rwops->hidden.mem.base; rwops->hidden.mem.stop = rwops->hidden.mem.base + size; + rwops->type = SDL_RWOPS_MEMORY; } return (rwops); } @@ -604,7 +595,15 @@ SDL_RWFromMem(void *mem, int size) SDL_RWops * SDL_RWFromConstMem(const void *mem, int size) { - SDL_RWops *rwops; + SDL_RWops *rwops = NULL; + if (!mem) { + SDL_InvalidParamError("mem"); + return (rwops); + } + if (!size) { + SDL_InvalidParamError("size"); + return (rwops); + } rwops = SDL_AllocRW(); if (rwops != NULL) { @@ -616,6 +615,7 @@ SDL_RWFromConstMem(const void *mem, int size) rwops->hidden.mem.base = (Uint8 *) mem; rwops->hidden.mem.here = rwops->hidden.mem.base; rwops->hidden.mem.stop = rwops->hidden.mem.base + size; + rwops->type = SDL_RWOPS_MEMORY_RO; } return (rwops); } @@ -628,6 +628,8 @@ SDL_AllocRW(void) area = (SDL_RWops *) SDL_malloc(sizeof *area); if (area == NULL) { SDL_OutOfMemory(); + } else { + area->type = SDL_RWOPS_UNKNOWN; } return (area); } diff --git a/src/eepp/helper/SDL2/src/file/cocoa/SDL_rwopsbundlesupport.m b/src/eepp/helper/SDL2/src/file/cocoa/SDL_rwopsbundlesupport.m index 39b4c0e9c..8ec0220ec 100644 --- a/src/eepp/helper/SDL2/src/file/cocoa/SDL_rwopsbundlesupport.m +++ b/src/eepp/helper/SDL2/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/eepp/helper/SDL2/src/haptic/SDL_haptic.c b/src/eepp/helper/SDL2/src/haptic/SDL_haptic.c index eca9c9632..d0b6bd25d 100644 --- a/src/eepp/helper/SDL2/src/haptic/SDL_haptic.c +++ b/src/eepp/helper/SDL2/src/haptic/SDL_haptic.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -397,7 +397,7 @@ unsigned int SDL_HapticQuery(SDL_Haptic * haptic) { if (!ValidHaptic(haptic)) { - return -1; + return 0; /* same as if no effects were supported */ } return haptic->supported; @@ -447,8 +447,7 @@ SDL_HapticNewEffect(SDL_Haptic * haptic, SDL_HapticEffect * effect) /* Check to see if effect is supported */ if (SDL_HapticEffectSupported(haptic, effect) == SDL_FALSE) { - SDL_SetError("Haptic: Effect not supported by haptic device."); - return -1; + return SDL_SetError("Haptic: Effect not supported by haptic device."); } /* See if there's a free slot */ @@ -467,8 +466,7 @@ SDL_HapticNewEffect(SDL_Haptic * haptic, SDL_HapticEffect * effect) } } - SDL_SetError("Haptic: Device has no free space left."); - return -1; + return SDL_SetError("Haptic: Device has no free space left."); } /* @@ -497,8 +495,7 @@ SDL_HapticUpdateEffect(SDL_Haptic * haptic, int effect, /* Can't change type dynamically. */ if (data->type != haptic->effects[effect].effect.type) { - SDL_SetError("Haptic: Updating effect type is illegal."); - return -1; + return SDL_SetError("Haptic: Updating effect type is illegal."); } /* Updates the effect */ @@ -579,8 +576,7 @@ SDL_HapticGetEffectStatus(SDL_Haptic * haptic, int effect) } if ((haptic->supported & SDL_HAPTIC_STATUS) == 0) { - SDL_SetError("Haptic: Device does not support status queries."); - return -1; + return SDL_SetError("Haptic: Device does not support status queries."); } return SDL_SYS_HapticGetEffectStatus(haptic, &haptic->effects[effect]); @@ -600,13 +596,11 @@ SDL_HapticSetGain(SDL_Haptic * haptic, int gain) } if ((haptic->supported & SDL_HAPTIC_GAIN) == 0) { - SDL_SetError("Haptic: Device does not support setting gain."); - return -1; + return SDL_SetError("Haptic: Device does not support setting gain."); } if ((gain < 0) || (gain > 100)) { - SDL_SetError("Haptic: Gain must be between 0 and 100."); - return -1; + return SDL_SetError("Haptic: Gain must be between 0 and 100."); } /* We use the envvar to get the maximum gain. */ @@ -644,13 +638,11 @@ SDL_HapticSetAutocenter(SDL_Haptic * haptic, int autocenter) } if ((haptic->supported & SDL_HAPTIC_AUTOCENTER) == 0) { - SDL_SetError("Haptic: Device does not support setting autocenter."); - return -1; + return SDL_SetError("Haptic: Device does not support setting autocenter."); } if ((autocenter < 0) || (autocenter > 100)) { - SDL_SetError("Haptic: Autocenter must be between 0 and 100."); - return -1; + return SDL_SetError("Haptic: Autocenter must be between 0 and 100."); } if (SDL_SYS_HapticSetAutocenter(haptic, autocenter) < 0) { @@ -671,8 +663,7 @@ SDL_HapticPause(SDL_Haptic * haptic) } if ((haptic->supported & SDL_HAPTIC_PAUSE) == 0) { - SDL_SetError("Haptic: Device does not support setting pausing."); - return -1; + return SDL_SetError("Haptic: Device does not support setting pausing."); } return SDL_SYS_HapticPause(haptic); @@ -773,8 +764,7 @@ SDL_HapticRumblePlay(SDL_Haptic * haptic, float strength, Uint32 length) } if (haptic->rumble_id < 0) { - SDL_SetError("Haptic: Rumble effect not initialized on haptic device"); - return -1; + return SDL_SetError("Haptic: Rumble effect not initialized on haptic device"); } /* Clamp strength. */ @@ -805,8 +795,7 @@ SDL_HapticRumbleStop(SDL_Haptic * haptic) } if (haptic->rumble_id < 0) { - SDL_SetError("Haptic: Rumble effect not initialized on haptic device"); - return -1; + return SDL_SetError("Haptic: Rumble effect not initialized on haptic device"); } return SDL_HapticStopEffect(haptic, haptic->rumble_id); diff --git a/src/eepp/helper/SDL2/src/haptic/SDL_haptic_c.h b/src/eepp/helper/SDL2/src/haptic/SDL_haptic_c.h index b937a2c9a..678a08f0a 100644 --- a/src/eepp/helper/SDL2/src/haptic/SDL_haptic_c.h +++ b/src/eepp/helper/SDL2/src/haptic/SDL_haptic_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/haptic/SDL_syshaptic.h b/src/eepp/helper/SDL2/src/haptic/SDL_syshaptic.h index 53871928f..ac5198ffd 100644 --- a/src/eepp/helper/SDL2/src/haptic/SDL_syshaptic.h +++ b/src/eepp/helper/SDL2/src/haptic/SDL_syshaptic.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -56,10 +56,10 @@ struct _SDL_Haptic SDL_HapticEffect rumble_effect; /* Rumble effect. */ }; -/* +/* * Scans the system for haptic devices. * - * Returns 0 on success, -1 on error. + * Returns number of devices on success, -1 on error. */ extern int SDL_SYS_HapticInit(void); diff --git a/src/eepp/helper/SDL2/src/haptic/darwin/SDL_syshaptic.c b/src/eepp/helper/SDL2/src/haptic/darwin/SDL_syshaptic.c index feb4309e7..53c5acddd 100644 --- a/src/eepp/helper/SDL2/src/haptic/darwin/SDL_syshaptic.c +++ b/src/eepp/helper/SDL2/src/haptic/darwin/SDL_syshaptic.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -35,7 +35,7 @@ #include #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 @@ -49,7 +49,7 @@ static struct char name[256]; /* Name of the device. */ io_service_t dev; /* Node we use to create the device. */ - SDL_Haptic *haptic; /* Haptic currently assosciated with it. */ + SDL_Haptic *haptic; /* Haptic currently associated with it. */ /* Usage pages for determining if it's a mouse or not. */ long usage; @@ -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 * @@ -160,20 +160,17 @@ SDL_SYS_HapticInit(void) /* Get HID devices. */ match = IOServiceMatching(kIOHIDDeviceKey); if (match == NULL) { - SDL_SetError("Haptic: Failed to get IOServiceMatching."); - return -1; + return SDL_SetError("Haptic: Failed to get IOServiceMatching."); } /* Now search I/O Registry for matching devices. */ result = IOServiceGetMatchingServices(kIOMasterPortDefault, match, &iter); if (result != kIOReturnSuccess) { - SDL_SetError("Haptic: Couldn't create a HID object iterator."); - return -1; + return SDL_SetError("Haptic: Couldn't create a HID object iterator."); } /* IOServiceGetMatchingServices consumes dictionary. */ if (!IOIteratorIsValid(iter)) { /* No iterator. */ - numhaptics = 0; return 0; } @@ -258,12 +255,11 @@ HIDGetDeviceProduct(io_service_t dev, char *name) ret = IORegistryEntryCreateCFProperties(dev, &hidProperties, kCFAllocatorDefault, kNilOptions); if ((ret != KERN_SUCCESS) || !hidProperties) { - SDL_SetError("Haptic: Unable to create CFProperties."); - return -1; + return SDL_SetError("Haptic: Unable to create CFProperties."); } /* Mac OS X currently is not mirroring all USB properties to HID page so need to look at USB device page also - * get dictionary for usb properties: step up two levels and get CF dictionary for USB properties + * get dictionary for USB properties: step up two levels and get CF dictionary for USB properties */ if ((KERN_SUCCESS == IORegistryEntryGetParentEntry(dev, kIOServicePlane, &parent1)) @@ -276,7 +272,7 @@ HIDGetDeviceProduct(io_service_t dev, char *name) if (usbProperties) { CFTypeRef refCF = 0; /* get device info - * try hid dictionary first, if fail then go to usb dictionary + * try hid dictionary first, if fail then go to USB dictionary */ @@ -290,17 +286,15 @@ HIDGetDeviceProduct(io_service_t dev, char *name) if (refCF) { if (!CFStringGetCString(refCF, name, 256, CFStringGetSystemEncoding())) { - SDL_SetError + return SDL_SetError ("Haptic: CFStringGetCString error retrieving pDevice->product."); - return -1; } } CFRelease(usbProperties); } else { - SDL_SetError + return SDL_SetError ("Haptic: IORegistryEntryCreateCFProperties failed to create usbProperties."); - return -1; } /* Release stuff. */ @@ -311,8 +305,7 @@ HIDGetDeviceProduct(io_service_t dev, char *name) SDL_SetError("Haptic: IOObjectRelease error with parent1."); } } else { - SDL_SetError("Haptic: Error getting registry entries."); - return -1; + return SDL_SetError("Haptic: Error getting registry entries."); } return 0; @@ -337,8 +330,7 @@ GetSupportedFeatures(SDL_Haptic * haptic) ret = FFDeviceGetForceFeedbackCapabilities(device, &features); if (ret != FF_OK) { - SDL_SetError("Haptic: Unable to get device's supported features."); - return -1; + return SDL_SetError("Haptic: Unable to get device's supported features."); } supported = 0; @@ -367,9 +359,8 @@ GetSupportedFeatures(SDL_Haptic * haptic) if (ret == FF_OK) supported |= SDL_HAPTIC_GAIN; else if (ret != FFERR_UNSUPPORTED) { - SDL_SetError("Haptic: Unable to get if device supports gain: %s.", - FFStrError(ret)); - return -1; + return SDL_SetError("Haptic: Unable to get if device supports gain: %s.", + FFStrError(ret)); } /* Checks if supports autocenter. */ @@ -378,10 +369,9 @@ GetSupportedFeatures(SDL_Haptic * haptic) if (ret == FF_OK) supported |= SDL_HAPTIC_AUTOCENTER; else if (ret != FFERR_UNSUPPORTED) { - SDL_SetError + return SDL_SetError ("Haptic: Unable to get if device supports autocenter: %s.", FFStrError(ret)); - return -1; } /* Check for axes, we have an artificial limit on axes */ @@ -572,7 +562,7 @@ SDL_SYS_HapticClose(SDL_Haptic * haptic) } -/* +/* * Clean up after system specific haptic stuff */ void @@ -626,8 +616,7 @@ SDL_SYS_SetDirection(FFEFFECT * effect, SDL_HapticDirection * dir, int naxes) /* Has axes. */ rglDir = SDL_malloc(sizeof(LONG) * naxes); if (rglDir == NULL) { - SDL_OutOfMemory(); - return -1; + return SDL_OutOfMemory(); } SDL_memset(rglDir, 0, sizeof(LONG) * naxes); effect->rglDirection = rglDir; @@ -655,8 +644,7 @@ SDL_SYS_SetDirection(FFEFFECT * effect, SDL_HapticDirection * dir, int naxes) return 0; default: - SDL_SetError("Haptic: Unknown direction type."); - return -1; + return SDL_SetError("Haptic: Unknown direction type."); } } @@ -696,8 +684,7 @@ SDL_SYS_ToFFEFFECT(SDL_Haptic * haptic, FFEFFECT * dest, /* Envelope. */ envelope = SDL_malloc(sizeof(FFENVELOPE)); if (envelope == NULL) { - SDL_OutOfMemory(); - return -1; + return SDL_OutOfMemory(); } SDL_memset(envelope, 0, sizeof(FFENVELOPE)); dest->lpEnvelope = envelope; @@ -708,8 +695,7 @@ SDL_SYS_ToFFEFFECT(SDL_Haptic * haptic, FFEFFECT * dest, if (dest->cAxes > 0) { axes = SDL_malloc(sizeof(DWORD) * dest->cAxes); if (axes == NULL) { - SDL_OutOfMemory(); - return -1; + return SDL_OutOfMemory(); } axes[0] = haptic->hwdata->axes[0]; /* Always at least one axis. */ if (dest->cAxes > 1) { @@ -722,14 +708,13 @@ SDL_SYS_ToFFEFFECT(SDL_Haptic * haptic, FFEFFECT * dest, } - /* The big type handling switch, even bigger then linux's version. */ + /* The big type handling switch, even bigger then Linux's version. */ switch (src->type) { case SDL_HAPTIC_CONSTANT: hap_constant = &src->constant; constant = SDL_malloc(sizeof(FFCONSTANTFORCE)); if (constant == NULL) { - SDL_OutOfMemory(); - return -1; + return SDL_OutOfMemory(); } SDL_memset(constant, 0, sizeof(FFCONSTANTFORCE)); @@ -772,8 +757,7 @@ SDL_SYS_ToFFEFFECT(SDL_Haptic * haptic, FFEFFECT * dest, hap_periodic = &src->periodic; periodic = SDL_malloc(sizeof(FFPERIODIC)); if (periodic == NULL) { - SDL_OutOfMemory(); - return -1; + return SDL_OutOfMemory(); } SDL_memset(periodic, 0, sizeof(FFPERIODIC)); @@ -818,8 +802,7 @@ SDL_SYS_ToFFEFFECT(SDL_Haptic * haptic, FFEFFECT * dest, hap_condition = &src->condition; condition = SDL_malloc(sizeof(FFCONDITION) * dest->cAxes); if (condition == NULL) { - SDL_OutOfMemory(); - return -1; + return SDL_OutOfMemory(); } SDL_memset(condition, 0, sizeof(FFCONDITION)); @@ -861,8 +844,7 @@ SDL_SYS_ToFFEFFECT(SDL_Haptic * haptic, FFEFFECT * dest, hap_ramp = &src->ramp; ramp = SDL_malloc(sizeof(FFRAMPFORCE)); if (ramp == NULL) { - SDL_OutOfMemory(); - return -1; + return SDL_OutOfMemory(); } SDL_memset(ramp, 0, sizeof(FFRAMPFORCE)); @@ -900,8 +882,7 @@ SDL_SYS_ToFFEFFECT(SDL_Haptic * haptic, FFEFFECT * dest, hap_custom = &src->custom; custom = SDL_malloc(sizeof(FFCUSTOMFORCE)); if (custom == NULL) { - SDL_OutOfMemory(); - return -1; + return SDL_OutOfMemory(); } SDL_memset(custom, 0, sizeof(FFCUSTOMFORCE)); @@ -945,8 +926,7 @@ SDL_SYS_ToFFEFFECT(SDL_Haptic * haptic, FFEFFECT * dest, default: - SDL_SetError("Haptic: Unknown effect type."); - return -1; + return SDL_SetError("Haptic: Unknown effect type."); } return 0; @@ -1151,9 +1131,8 @@ SDL_SYS_HapticRunEffect(SDL_Haptic * haptic, struct haptic_effect *effect, /* Run the effect. */ ret = FFEffectStart(effect->hweffect->ref, iter, 0); if (ret != FF_OK) { - SDL_SetError("Haptic: Unable to run the effect: %s.", - FFStrError(ret)); - return -1; + return SDL_SetError("Haptic: Unable to run the effect: %s.", + FFStrError(ret)); } return 0; @@ -1170,9 +1149,8 @@ SDL_SYS_HapticStopEffect(SDL_Haptic * haptic, struct haptic_effect *effect) ret = FFEffectStop(effect->hweffect->ref); if (ret != FF_OK) { - SDL_SetError("Haptic: Unable to stop the effect: %s.", - FFStrError(ret)); - return -1; + return SDL_SetError("Haptic: Unable to stop the effect: %s.", + FFStrError(ret)); } return 0; @@ -1237,8 +1215,7 @@ SDL_SYS_HapticSetGain(SDL_Haptic * haptic, int gain) FFDeviceSetForceFeedbackProperty(haptic->hwdata->device, FFPROP_FFGAIN, &val); if (ret != FF_OK) { - SDL_SetError("Haptic: Error setting gain: %s.", FFStrError(ret)); - return -1; + return SDL_SetError("Haptic: Error setting gain: %s.", FFStrError(ret)); } return 0; @@ -1263,9 +1240,8 @@ SDL_SYS_HapticSetAutocenter(SDL_Haptic * haptic, int autocenter) ret = FFDeviceSetForceFeedbackProperty(haptic->hwdata->device, FFPROP_AUTOCENTER, &val); if (ret != FF_OK) { - SDL_SetError("Haptic: Error setting autocenter: %s.", - FFStrError(ret)); - return -1; + return SDL_SetError("Haptic: Error setting autocenter: %s.", + FFStrError(ret)); } return 0; @@ -1283,8 +1259,7 @@ SDL_SYS_HapticPause(SDL_Haptic * haptic) ret = FFDeviceSendForceFeedbackCommand(haptic->hwdata->device, FFSFFC_PAUSE); if (ret != FF_OK) { - SDL_SetError("Haptic: Error pausing device: %s.", FFStrError(ret)); - return -1; + return SDL_SetError("Haptic: Error pausing device: %s.", FFStrError(ret)); } return 0; @@ -1302,8 +1277,7 @@ SDL_SYS_HapticUnpause(SDL_Haptic * haptic) ret = FFDeviceSendForceFeedbackCommand(haptic->hwdata->device, FFSFFC_CONTINUE); if (ret != FF_OK) { - SDL_SetError("Haptic: Error pausing device: %s.", FFStrError(ret)); - return -1; + return SDL_SetError("Haptic: Error pausing device: %s.", FFStrError(ret)); } return 0; @@ -1321,8 +1295,7 @@ SDL_SYS_HapticStopAll(SDL_Haptic * haptic) ret = FFDeviceSendForceFeedbackCommand(haptic->hwdata->device, FFSFFC_STOPALL); if (ret != FF_OK) { - SDL_SetError("Haptic: Error stopping device: %s.", FFStrError(ret)); - return -1; + return SDL_SetError("Haptic: Error stopping device: %s.", FFStrError(ret)); } return 0; diff --git a/src/eepp/helper/SDL2/src/haptic/dummy/SDL_syshaptic.c b/src/eepp/helper/SDL2/src/haptic/dummy/SDL_syshaptic.c index 1d6eade16..c34081968 100644 --- a/src/eepp/helper/SDL2/src/haptic/dummy/SDL_syshaptic.c +++ b/src/eepp/helper/SDL2/src/haptic/dummy/SDL_syshaptic.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/haptic/linux/SDL_syshaptic.c b/src/eepp/helper/SDL2/src/haptic/linux/SDL_syshaptic.c index c73a60876..92705320a 100644 --- a/src/eepp/helper/SDL2/src/haptic/linux/SDL_syshaptic.c +++ b/src/eepp/helper/SDL2/src/haptic/linux/SDL_syshaptic.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -92,9 +92,8 @@ EV_IsHaptic(int fd) /* Ask device for what it has. */ ret = 0; if (ioctl(fd, EVIOCGBIT(EV_FF, sizeof(features)), features) < 0) { - SDL_SetError("Haptic: Unable to get device's features: %s", - strerror(errno)); - return -1; + return SDL_SetError("Haptic: Unable to get device's features: %s", + strerror(errno)); } /* Convert supported features to SDL_HAPTIC platform-neutral features. */ @@ -156,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. */ @@ -309,9 +308,8 @@ SDL_SYS_HapticOpen(SDL_Haptic * haptic) /* Open the character device */ fd = open(SDL_hapticlist[haptic->index].fname, O_RDWR, 0); if (fd < 0) { - SDL_SetError("Haptic: Unable to open %s: %s", - SDL_hapticlist[haptic->index], strerror(errno)); - return -1; + return SDL_SetError("Haptic: Unable to open %s: %s", + SDL_hapticlist[haptic->index], strerror(errno)); } /* Try to create the haptic. */ @@ -340,9 +338,8 @@ SDL_SYS_HapticMouse(void) /* Open the device. */ fd = open(SDL_hapticlist[i].fname, O_RDWR, 0); if (fd < 0) { - SDL_SetError("Haptic: Unable to open %s: %s", - SDL_hapticlist[i], strerror(errno)); - return -1; + return SDL_SetError("Haptic: Unable to open %s: %s", + SDL_hapticlist[i], strerror(errno)); } /* Is it a mouse? */ @@ -374,7 +371,7 @@ SDL_SYS_JoystickIsHaptic(SDL_Joystick * joystick) int SDL_SYS_JoystickSameHaptic(SDL_Haptic * haptic, SDL_Joystick * joystick) { - /* We are assuming linux is using evdev which should trump the old + /* We are assuming Linux is using evdev which should trump the old * joystick methods. */ if (SDL_strcmp(joystick->hwdata->fname, haptic->hwdata->fname) == 0) { return 1; @@ -405,15 +402,13 @@ SDL_SYS_HapticOpenFromJoystick(SDL_Haptic * haptic, SDL_Joystick * joystick) } } if (i >= MAX_HAPTICS) { - SDL_SetError("Haptic: Joystick doesn't have Haptic capabilities"); - return -1; + return SDL_SetError("Haptic: Joystick doesn't have Haptic capabilities"); } fd = open(joystick->hwdata->fname, O_RDWR, 0); if (fd < 0) { - SDL_SetError("Haptic: Unable to open %s: %s", - joystick->hwdata->fname, strerror(errno)); - return -1; + return SDL_SetError("Haptic: Unable to open %s: %s", + joystick->hwdata->fname, strerror(errno)); } ret = SDL_SYS_HapticOpenFromFD(haptic, fd); /* Already closes on error. */ if (ret < 0) { @@ -451,7 +446,7 @@ SDL_SYS_HapticClose(SDL_Haptic * haptic) } -/* +/* * Clean up after system specific haptic stuff */ void @@ -503,49 +498,48 @@ 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: - SDL_SetError("Haptic: Unsupported direction type."); - return (Uint16) - 1; + return (Uint16) SDL_SetError("Haptic: Unsupported direction type."); } return 0; @@ -554,7 +548,7 @@ SDL_SYS_ToDirection(SDL_HapticDirection * dir) #define CLAMP(x) (((x) > 32767) ? 32767 : x) /* - * Initializes the linux effect struct from a haptic_effect. + * Initializes the Linux effect struct from a haptic_effect. * Values above 32767 (for unsigned) are unspecified so we must clamp. */ static int @@ -733,8 +727,7 @@ SDL_SYS_ToFFEffect(struct ff_effect *dest, SDL_HapticEffect * src) default: - SDL_SetError("Haptic: Unknown effect type."); - return -1; + return SDL_SetError("Haptic: Unknown effect type."); } return 0; @@ -754,8 +747,7 @@ SDL_SYS_HapticNewEffect(SDL_Haptic * haptic, struct haptic_effect *effect, effect->hweffect = (struct haptic_hweffect *) SDL_malloc(sizeof(struct haptic_hweffect)); if (effect->hweffect == NULL) { - SDL_OutOfMemory(); - return -1; + return SDL_OutOfMemory(); } /* Prepare the ff_effect */ @@ -802,9 +794,8 @@ SDL_SYS_HapticUpdateEffect(SDL_Haptic * haptic, /* See if it can be uploaded. */ if (ioctl(haptic->hwdata->fd, EVIOCSFF, &linux_effect) < 0) { - SDL_SetError("Haptic: Error updating the effect: %s", - strerror(errno)); - return -1; + return SDL_SetError("Haptic: Error updating the effect: %s", + strerror(errno)); } /* Copy the new effect into memory. */ @@ -831,8 +822,7 @@ SDL_SYS_HapticRunEffect(SDL_Haptic * haptic, struct haptic_effect *effect, run.value = (iterations > INT_MAX) ? INT_MAX : iterations; if (write(haptic->hwdata->fd, (const void *) &run, sizeof(run)) < 0) { - SDL_SetError("Haptic: Unable to run the effect: %s", strerror(errno)); - return -1; + return SDL_SetError("Haptic: Unable to run the effect: %s", strerror(errno)); } return 0; @@ -852,9 +842,8 @@ SDL_SYS_HapticStopEffect(SDL_Haptic * haptic, struct haptic_effect *effect) stop.value = 0; if (write(haptic->hwdata->fd, (const void *) &stop, sizeof(stop)) < 0) { - SDL_SetError("Haptic: Unable to stop the effect: %s", - strerror(errno)); - return -1; + return SDL_SetError("Haptic: Unable to stop the effect: %s", + strerror(errno)); } return 0; @@ -891,8 +880,7 @@ SDL_SYS_HapticGetEffectStatus(SDL_Haptic * haptic, ie.code = effect->hweffect->effect.id; if (write(haptic->hwdata->fd, &ie, sizeof(ie)) < 0) { - SDL_SetError("Haptic: Error getting device status."); - return -1; + return SDL_SetError("Haptic: Error getting device status."); } return 0; @@ -915,8 +903,7 @@ SDL_SYS_HapticSetGain(SDL_Haptic * haptic, int gain) ie.value = (0xFFFFUL * gain) / 100; if (write(haptic->hwdata->fd, &ie, sizeof(ie)) < 0) { - SDL_SetError("Haptic: Error setting gain: %s", strerror(errno)); - return -1; + return SDL_SetError("Haptic: Error setting gain: %s", strerror(errno)); } return 0; @@ -936,8 +923,7 @@ SDL_SYS_HapticSetAutocenter(SDL_Haptic * haptic, int autocenter) ie.value = (0xFFFFUL * autocenter) / 100; if (write(haptic->hwdata->fd, &ie, sizeof(ie)) < 0) { - SDL_SetError("Haptic: Error setting autocenter: %s", strerror(errno)); - return -1; + return SDL_SetError("Haptic: Error setting autocenter: %s", strerror(errno)); } return 0; @@ -977,9 +963,8 @@ SDL_SYS_HapticStopAll(SDL_Haptic * haptic) if (haptic->effects[i].hweffect != NULL) { ret = SDL_SYS_HapticStopEffect(haptic, &haptic->effects[i]); if (ret < 0) { - SDL_SetError + return SDL_SetError ("Haptic: Error while trying to stop all playing effects."); - return -1; } } } diff --git a/src/eepp/helper/SDL2/src/haptic/nds/SDL_syshaptic.c b/src/eepp/helper/SDL2/src/haptic/nds/SDL_syshaptic.c deleted file mode 100644 index ddb8ecc75..000000000 --- a/src/eepp/helper/SDL2/src/haptic/nds/SDL_syshaptic.c +++ /dev/null @@ -1,330 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga - - 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 - appreciated but is not required. - 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. -*/ -#include "SDL_config.h" - -#ifdef SDL_HAPTIC_NDS - -#include "SDL_haptic.h" -#include "../SDL_syshaptic.h" -#include "SDL_joystick.h" -#include -#include - -#define MAX_HAPTICS 1 -/* right now only the ezf3in1 (and maybe official rumble pak) are supported - and there can only be one of those in at a time (in GBA slot.) */ - -static SDL_Haptic *nds_haptic = NULL; - -struct haptic_hwdata -{ - enum - { NONE, OFFICIAL, EZF3IN1 } type; - int pos; -}; - - -void -NDS_EZF_OpenNorWrite() -{ - GBA_BUS[0x0FF0000] = 0xD200; - GBA_BUS[0x0000000] = 0x1500; - GBA_BUS[0x0010000] = 0xD200; - GBA_BUS[0x0020000] = 0x1500; - GBA_BUS[0x0E20000] = 0x1500; - GBA_BUS[0x0FE0000] = 0x1500; -} - -void -NDS_EZF_CloseNorWrite() -{ - GBA_BUS[0x0FF0000] = 0xD200; - GBA_BUS[0x0000000] = 0x1500; - GBA_BUS[0x0010000] = 0xD200; - GBA_BUS[0x0020000] = 0x1500; - GBA_BUS[0x0E20000] = 0xD200; - GBA_BUS[0x0FE0000] = 0x1500; -} - -void -NDS_EZF_ChipReset() -{ - GBA_BUS[0x0000] = 0x00F0; - GBA_BUS[0x1000] = 0x00F0; -} uint32 NDS_EZF_IsPresent() -{ - vuint16 id1, id2; - - NDS_EZF_OpenNorWrite(); - - GBA_BUS[0x0555] = 0x00AA; - GBA_BUS[0x02AA] = 0x0055; - GBA_BUS[0x0555] = 0x0090; - GBA_BUS[0x1555] = 0x00AA; - GBA_BUS[0x12AA] = 0x0055; - GBA_BUS[0x1555] = 0x0090; - id1 = GBA_BUS[0x0001]; - id2 = GBA_BUS[0x1001]; - if ((id1 != 0x227E) || (id2 != 0x227E)) { - NDS_EZF_CloseNorWrite(); - return 0; - } - id1 = GBA_BUS[0x000E]; - id2 = GBA_BUS[0x100E]; - - NDS_EZF_CloseNorWrite(); - if (id1 == 0x2218 && id2 == 0x2218) { - return 1; - } - return 0; -} -void -NDS_EZF_SetShake(u8 pos) -{ - u16 data = ((pos % 3) | 0x00F0); - GBA_BUS[0x0FF0000] = 0xD200; - GBA_BUS[0x0000000] = 0x1500; - GBA_BUS[0x0010000] = 0xD200; - GBA_BUS[0x0020000] = 0x1500; - GBA_BUS[0x0F10000] = data; - GBA_BUS[0x0FE0000] = 0x1500; - - GBA_BUS[0] = 0x0000; /* write any value for vibration. */ - GBA_BUS[0] = 0x0002; -} - -static int -SDL_SYS_LogicError(void) -{ - SDL_SetError("Logic error: No haptic devices available."); - return 0; -} - - -int -SDL_SYS_HapticInit(void) -{ - int ret = 0; - if (isRumbleInserted()) { - /* official rumble pak is present. */ - ret = 1; - printf("debug: haptic present: nintendo\n"); - } else if (NDS_EZF_IsPresent()) { - /* ezflash 3-in-1 pak is present. */ - ret = 1; - printf("debug: haptic present: ezf3in1\n"); - NDS_EZF_ChipReset(); - } else { - printf("debug: no haptic found\n"); - } - - return ret; -} - - -const char * -SDL_SYS_HapticName(int index) -{ - if (nds_haptic) { - switch (nds_haptic->hwdata->type) { - case OFFICIAL: - return "Nintendo DS Rumble Pak"; - case EZF3IN1: - return "EZFlash 3-in-1 Rumble"; - default: - return NULL; - } - } - return NULL; -} - - -int -SDL_SYS_HapticOpen(SDL_Haptic * haptic) -{ - if (!haptic) { - return -1; - } - - haptic->hwdata = SDL_malloc(sizeof(struct haptic_hwdata)); - if (!haptic->hwdata) { - SDL_OutOfMemory(); - return -1; - } - nds_haptic = haptic; - - haptic->supported = SDL_HAPTIC_CONSTANT; - - /* determine what is here, if anything */ - haptic->hwdata->type = NONE; - if (isRumbleInserted()) { - /* official rumble pak is present. */ - haptic->hwdata->type = OFFICIAL; - } else if (NDS_EZF_IsPresent()) { - /* ezflash 3-in-1 pak is present. */ - haptic->hwdata->type = EZF3IN1; - NDS_EZF_ChipReset(); - } else { - /* no haptic present */ - SDL_SYS_LogicError(); - return -1; - } - - return 0; -} - - -int -SDL_SYS_HapticMouse(void) -{ - return -1; -} - - -int -SDL_SYS_JoystickIsHaptic(SDL_Joystick * joystick) -{ - return 0; -} - - -int -SDL_SYS_HapticOpenFromJoystick(SDL_Haptic * haptic, SDL_Joystick * joystick) -{ - /*SDL_SYS_LogicError(); */ - return -1; -} - - -int -SDL_SYS_JoystickSameHaptic(SDL_Haptic * haptic, SDL_Joystick * joystick) -{ - return 0; -} - - -void -SDL_SYS_HapticClose(SDL_Haptic * haptic) -{ - return; -} - - -void -SDL_SYS_HapticQuit(void) -{ - return; -} - - -int -SDL_SYS_HapticNewEffect(SDL_Haptic * haptic, - struct haptic_effect *effect, SDL_HapticEffect * base) -{ - SDL_SYS_LogicError(); - return -1; -} - - -int -SDL_SYS_HapticUpdateEffect(SDL_Haptic * haptic, - struct haptic_effect *effect, - SDL_HapticEffect * data) -{ - SDL_SYS_LogicError(); - return -1; -} - - -int -SDL_SYS_HapticRunEffect(SDL_Haptic * haptic, struct haptic_effect *effect, - Uint32 iterations) -{ - SDL_SYS_LogicError(); - return -1; -} - - -int -SDL_SYS_HapticStopEffect(SDL_Haptic * haptic, struct haptic_effect *effect) -{ - SDL_SYS_LogicError(); - return -1; -} - - -void -SDL_SYS_HapticDestroyEffect(SDL_Haptic * haptic, struct haptic_effect *effect) -{ - SDL_SYS_LogicError(); - return; -} - - -int -SDL_SYS_HapticGetEffectStatus(SDL_Haptic * haptic, - struct haptic_effect *effect) -{ - SDL_SYS_LogicError(); - return -1; -} - - -int -SDL_SYS_HapticSetGain(SDL_Haptic * haptic, int gain) -{ - SDL_SYS_LogicError(); - return -1; -} - - -int -SDL_SYS_HapticSetAutocenter(SDL_Haptic * haptic, int autocenter) -{ - SDL_SYS_LogicError(); - return -1; -} - -int -SDL_SYS_HapticPause(SDL_Haptic * haptic) -{ - SDL_SYS_LogicError(); - return -1; -} - -int -SDL_SYS_HapticUnpause(SDL_Haptic * haptic) -{ - SDL_SYS_LogicError(); - return -1; -} - -int -SDL_SYS_HapticStopAll(SDL_Haptic * haptic) -{ - SDL_SYS_LogicError(); - return -1; -} - - - -#endif /* SDL_HAPTIC_NDS */ -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/eepp/helper/SDL2/src/haptic/windows/SDL_syshaptic.c b/src/eepp/helper/SDL2/src/haptic/windows/SDL_syshaptic.c index 28bd87582..b567ed7d7 100644 --- a/src/eepp/helper/SDL2/src/haptic/windows/SDL_syshaptic.c +++ b/src/eepp/helper/SDL2/src/haptic/windows/SDL_syshaptic.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -22,16 +22,16 @@ #ifdef SDL_HAPTIC_DINPUT +#include "SDL_assert.h" +#include "SDL_hints.h" #include "SDL_haptic.h" #include "../SDL_syshaptic.h" #include "SDL_joystick.h" #include "../../joystick/SDL_sysjoystick.h" /* For the real SDL_Joystick */ #include "../../joystick/windows/SDL_dxjoystick_c.h" /* For joystick hwdata */ - #define MAX_HAPTICS 32 - /* * List of available haptic devices. */ @@ -41,6 +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 */ } SDL_hapticlist[MAX_HAPTICS]; @@ -52,6 +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 */ }; @@ -62,6 +66,7 @@ struct haptic_hweffect { DIEFFECT effect; LPDIRECTINPUTEFFECT ref; + XINPUT_VIBRATION vibration; }; @@ -70,6 +75,7 @@ struct haptic_hweffect */ static SDL_bool coinitialized = SDL_FALSE; static LPDIRECTINPUT8 dinput = NULL; +static SDL_bool loaded_xinput = SDL_FALSE; /* @@ -81,12 +87,13 @@ extern HWND SDL_HelperWindow; /* * Prototypes. */ -static void DI_SetError(const char *str, HRESULT err); +static int DI_SetError(const char *str, HRESULT err); static int DI_GUIDIsSame(const GUID * a, const GUID * b); static int SDL_SYS_HapticOpenFromInstance(SDL_Haptic * haptic, DIDEVICEINSTANCE instance); static int SDL_SYS_HapticOpenFromDevice8(SDL_Haptic * haptic, LPDIRECTINPUTDEVICE8 device8); +static int SDL_SYS_HapticOpenFromXInput(SDL_Haptic * haptic, Uint8 userid); static DWORD DIGetTriggerButton(Uint16 button); static int SDL_SYS_SetDirection(DIEFFECT * effect, SDL_HapticDirection * dir, int naxes); @@ -100,17 +107,17 @@ static BOOL CALLBACK EnumHapticsCallback(const DIDEVICEINSTANCE * static BOOL CALLBACK DI_EffectCallback(LPCDIEFFECTINFO pei, LPVOID pv); -/* +/* * Like SDL_SetError but for DX error codes. */ -static void +static int DI_SetError(const char *str, HRESULT err) { /* SDL_SetError("Haptic: %s - %s: %s", str, DXGetErrorString8A(err), DXGetErrorDescription8A(err)); */ - SDL_SetError("Haptic error %s", str); + return SDL_SetError("Haptic error %s", str); } @@ -130,12 +137,12 @@ DI_GUIDIsSame(const GUID * a, const GUID * b) int SDL_SYS_HapticInit(void) { + const char *env = SDL_GetHint(SDL_HINT_XINPUT_ENABLED); HRESULT ret; HINSTANCE instance; if (dinput != NULL) { /* Already open. */ - SDL_SetError("Haptic: SubSystem already open."); - return -1; + return SDL_SetError("Haptic: SubSystem already open."); } /* Clear all the memory. */ @@ -145,8 +152,7 @@ SDL_SYS_HapticInit(void) ret = WIN_CoInitialize(); if (FAILED(ret)) { - DI_SetError("Coinitialize", ret); - return -1; + return DI_SetError("Coinitialize", ret); } coinitialized = SDL_TRUE; @@ -155,23 +161,20 @@ SDL_SYS_HapticInit(void) &IID_IDirectInput8, (LPVOID) & dinput); if (FAILED(ret)) { SDL_SYS_HapticQuit(); - DI_SetError("CoCreateInstance", ret); - return -1; + return DI_SetError("CoCreateInstance", ret); } /* Because we used CoCreateInstance, we need to Initialize it, first. */ instance = GetModuleHandle(NULL); if (instance == NULL) { SDL_SYS_HapticQuit(); - SDL_SetError("GetModuleHandle() failed with error code %d.", - GetLastError()); - return -1; + return SDL_SetError("GetModuleHandle() failed with error code %d.", + GetLastError()); } ret = IDirectInput8_Initialize(dinput, instance, DIRECTINPUT_VERSION); if (FAILED(ret)) { SDL_SYS_HapticQuit(); - DI_SetError("Initializing DirectInput device", ret); - return -1; + return DI_SetError("Initializing DirectInput device", ret); } /* Look for haptic devices. */ @@ -183,8 +186,31 @@ SDL_SYS_HapticInit(void) DIEDFL_ATTACHEDONLY); if (FAILED(ret)) { SDL_SYS_HapticQuit(); - DI_SetError("Enumerating DirectInput devices", ret); - return -1; + return DI_SetError("Enumerating DirectInput devices", ret); + } + + if (!env || SDL_atoi(env)) { + loaded_xinput = (WIN_LoadXInputDLL() == 0); + } + + if (loaded_xinput) { + DWORD i; + const SDL_bool bIs14OrLater = (SDL_XInputVersion >= ((1<<16)|4)); + + for (i = 0; (i < SDL_XINPUT_MAX_DEVICES) && (SDL_numhaptics < MAX_HAPTICS); i++) { + XINPUT_CAPABILITIES caps; + if (XINPUTGETCAPABILITIES(i, XINPUT_FLAG_GAMEPAD, &caps) == ERROR_SUCCESS) { + if ((!bIs14OrLater) || (caps.Flags & XINPUT_CAPS_FFB_SUPPORTED)) { + /* !!! FIXME: I'm not bothering to query for a real name right now. */ + char buf[64]; + SDL_snprintf(buf, sizeof (buf), "XInput Controller #%u", i+1); + SDL_hapticlist[SDL_numhaptics].name = SDL_strdup(buf); + SDL_hapticlist[SDL_numhaptics].bXInputHaptic = 1; + SDL_hapticlist[SDL_numhaptics].userid = (Uint8) i; + SDL_numhaptics++; + } + } + } } return SDL_numhaptics; @@ -363,6 +389,41 @@ SDL_SYS_HapticOpenFromInstance(SDL_Haptic * haptic, DIDEVICEINSTANCE instance) return -1; } +static int +SDL_SYS_HapticOpenFromXInput(SDL_Haptic * haptic, Uint8 userid) +{ + XINPUT_VIBRATION vibration = { 0, 0 }; /* stop any current vibration */ + XINPUTSETSTATE(userid, &vibration); + + /* !!! FIXME: we can probably do more than SINE if we figure out how to set up the left and right motors properly. */ + haptic->supported = SDL_HAPTIC_SINE; + + haptic->neffects = 1; + haptic->nplaying = 1; + + /* Prepare effects memory. */ + haptic->effects = (struct haptic_effect *) + SDL_malloc(sizeof(struct haptic_effect) * haptic->neffects); + if (haptic->effects == NULL) { + return SDL_OutOfMemory(); + } + /* Clear the memory */ + SDL_memset(haptic->effects, 0, + sizeof(struct haptic_effect) * haptic->neffects); + + haptic->hwdata = (struct haptic_hwdata *) SDL_malloc(sizeof(*haptic->hwdata)); + if (haptic->hwdata == NULL) { + SDL_free(haptic->effects); + haptic->effects = NULL; + return SDL_OutOfMemory(); + } + SDL_memset(haptic->hwdata, 0, sizeof(*haptic->hwdata)); + + haptic->hwdata->bXInputHaptic = 1; + haptic->hwdata->userid = userid; + + return 0; + } /* * Opens the haptic device from the file descriptor. @@ -372,7 +433,7 @@ SDL_SYS_HapticOpenFromInstance(SDL_Haptic * haptic, DIDEVICEINSTANCE instance) * - Set data format. * - Acquire exclusiveness. * - Reset actuators. - * - Get supported featuers. + * - Get supported features. */ static int SDL_SYS_HapticOpenFromDevice8(SDL_Haptic * haptic, @@ -504,9 +565,11 @@ SDL_SYS_HapticOpenFromDevice8(SDL_Haptic * haptic, int SDL_SYS_HapticOpen(SDL_Haptic * haptic) { - return SDL_SYS_HapticOpenFromInstance(haptic, - SDL_hapticlist[haptic->index]. - instance); + if (SDL_hapticlist[haptic->index].bXInputHaptic) { + return SDL_SYS_HapticOpenFromXInput(haptic, SDL_hapticlist[haptic->index].userid); + } + + return SDL_SYS_HapticOpenFromInstance(haptic, SDL_hapticlist[haptic->index].instance); } @@ -535,11 +598,9 @@ SDL_SYS_HapticMouse(void) int SDL_SYS_JoystickIsHaptic(SDL_Joystick * joystick) { - if (joystick->hwdata->Capabilities.dwFlags & DIDC_FORCEFEEDBACK) { - return SDL_TRUE; - } - - return SDL_FALSE; + const struct joystick_hwdata *hwdata = joystick->hwdata; + return ( (hwdata->bXInputHaptic) || + ((hwdata->Capabilities.dwFlags & DIDC_FORCEFEEDBACK) != 0) ); } @@ -549,25 +610,30 @@ SDL_SYS_JoystickIsHaptic(SDL_Joystick * joystick) int SDL_SYS_JoystickSameHaptic(SDL_Haptic * haptic, SDL_Joystick * joystick) { - HRESULT ret; - DIDEVICEINSTANCE hap_instance, joy_instance; - hap_instance.dwSize = sizeof(DIDEVICEINSTANCE); - joy_instance.dwSize = sizeof(DIDEVICEINSTANCE); - - /* Get the device instances. */ - ret = IDirectInputDevice8_GetDeviceInfo(haptic->hwdata->device, - &hap_instance); - if (FAILED(ret)) { - return 0; - } - ret = IDirectInputDevice8_GetDeviceInfo(joystick->hwdata->InputDevice, - &joy_instance); - if (FAILED(ret)) { - return 0; - } - - if (DI_GUIDIsSame(&hap_instance.guidInstance, &joy_instance.guidInstance)) + if ((joystick->hwdata->bXInputHaptic == haptic->hwdata->bXInputHaptic) && (haptic->hwdata->userid == joystick->hwdata->userid)) { return 1; + } else { + HRESULT ret; + DIDEVICEINSTANCE hap_instance, joy_instance; + + hap_instance.dwSize = sizeof(DIDEVICEINSTANCE); + joy_instance.dwSize = sizeof(DIDEVICEINSTANCE); + + /* Get the device instances. */ + ret = IDirectInputDevice8_GetDeviceInfo(haptic->hwdata->device, + &hap_instance); + if (FAILED(ret)) { + return 0; + } + ret = IDirectInputDevice8_GetDeviceInfo(joystick->hwdata->InputDevice, + &joy_instance); + if (FAILED(ret)) { + return 0; + } + + if (DI_GUIDIsSame(&hap_instance.guidInstance, &joy_instance.guidInstance)) + return 1; + } return 0; } @@ -585,16 +651,27 @@ SDL_SYS_HapticOpenFromJoystick(SDL_Haptic * haptic, SDL_Joystick * joystick) joy_instance.dwSize = sizeof(DIDEVICEINSTANCE); /* Since it comes from a joystick we have to try to match it with a haptic device on our haptic list. */ - for (i=0; ihwdata->InputDevice, - &joy_instance); - if (FAILED(idret)) { - return -1; + if (joystick->hwdata->bXInputDevice) { + const Uint8 userid = joystick->hwdata->userid; + for (i=0; ihwdata->bXInputHaptic); + haptic->index = i; + break; + } } - if (DI_GUIDIsSame(&SDL_hapticlist[i].instance.guidInstance, - &joy_instance.guidInstance)) { - haptic->index = i; - break; + } else { + for (i=0; ihwdata->InputDevice, + &joy_instance); + if (FAILED(idret)) { + return -1; + } + if (DI_GUIDIsSame(&SDL_hapticlist[i].instance.guidInstance, + &joy_instance.guidInstance)) { + haptic->index = i; + break; + } } } if (i >= SDL_numhaptics) { @@ -605,20 +682,22 @@ SDL_SYS_HapticOpenFromJoystick(SDL_Haptic * haptic, SDL_Joystick * joystick) haptic->hwdata = (struct haptic_hwdata *) SDL_malloc(sizeof(*haptic->hwdata)); if (haptic->hwdata == NULL) { - SDL_OutOfMemory(); - return -1; + return SDL_OutOfMemory(); } SDL_memset(haptic->hwdata, 0, sizeof(*haptic->hwdata)); /* Now open the device. */ - ret = - SDL_SYS_HapticOpenFromDevice8(haptic, joystick->hwdata->InputDevice); - if (ret < 0) { - return -1; + if (!joystick->hwdata->bXInputHaptic) { + ret = SDL_SYS_HapticOpenFromDevice8(haptic, joystick->hwdata->InputDevice); + if (ret < 0) { + return -1; + } } /* It's using the joystick device. */ haptic->hwdata->is_joystick = 1; + haptic->hwdata->bXInputHaptic = joystick->hwdata->bXInputHaptic; + haptic->hwdata->userid = joystick->hwdata->userid; return 0; } @@ -638,10 +717,12 @@ SDL_SYS_HapticClose(SDL_Haptic * haptic) haptic->neffects = 0; /* Clean up */ - IDirectInputDevice8_Unacquire(haptic->hwdata->device); - /* Only release if isn't grabbed by a joystick. */ - if (haptic->hwdata->is_joystick == 0) { - IDirectInputDevice8_Release(haptic->hwdata->device); + if (!haptic->hwdata->bXInputHaptic) { + IDirectInputDevice8_Unacquire(haptic->hwdata->device); + /* Only release if isn't grabbed by a joystick. */ + if (haptic->hwdata->is_joystick == 0) { + IDirectInputDevice8_Release(haptic->hwdata->device); + } } /* Free */ @@ -651,7 +732,7 @@ SDL_SYS_HapticClose(SDL_Haptic * haptic) } -/* +/* * Clean up after system specific haptic stuff */ void @@ -659,6 +740,11 @@ SDL_SYS_HapticQuit(void) { int i; + if (loaded_xinput) { + WIN_UnloadXInputDLL(); + loaded_xinput = SDL_FALSE; + } + for (i = 0; i < SDL_arraysize(SDL_hapticlist); ++i) { if (SDL_hapticlist[i].name) { SDL_free(SDL_hapticlist[i].name); @@ -714,8 +800,7 @@ SDL_SYS_SetDirection(DIEFFECT * effect, SDL_HapticDirection * dir, int naxes) /* Has axes. */ rglDir = SDL_malloc(sizeof(LONG) * naxes); if (rglDir == NULL) { - SDL_OutOfMemory(); - return -1; + return SDL_OutOfMemory(); } SDL_memset(rglDir, 0, sizeof(LONG) * naxes); effect->rglDirection = rglDir; @@ -743,8 +828,7 @@ SDL_SYS_SetDirection(DIEFFECT * effect, SDL_HapticDirection * dir, int naxes) return 0; default: - SDL_SetError("Haptic: Unknown direction type."); - return -1; + return SDL_SetError("Haptic: Unknown direction type."); } } @@ -780,8 +864,7 @@ SDL_SYS_ToDIEFFECT(SDL_Haptic * haptic, DIEFFECT * dest, /* Envelope. */ envelope = SDL_malloc(sizeof(DIENVELOPE)); if (envelope == NULL) { - SDL_OutOfMemory(); - return -1; + return SDL_OutOfMemory(); } SDL_memset(envelope, 0, sizeof(DIENVELOPE)); dest->lpEnvelope = envelope; @@ -792,8 +875,7 @@ SDL_SYS_ToDIEFFECT(SDL_Haptic * haptic, DIEFFECT * dest, if (dest->cAxes > 0) { axes = SDL_malloc(sizeof(DWORD) * dest->cAxes); if (axes == NULL) { - SDL_OutOfMemory(); - return -1; + return SDL_OutOfMemory(); } axes[0] = haptic->hwdata->axes[0]; /* Always at least one axis. */ if (dest->cAxes > 1) { @@ -806,14 +888,13 @@ SDL_SYS_ToDIEFFECT(SDL_Haptic * haptic, DIEFFECT * dest, } - /* The big type handling switch, even bigger then linux's version. */ + /* The big type handling switch, even bigger then Linux's version. */ switch (src->type) { case SDL_HAPTIC_CONSTANT: hap_constant = &src->constant; constant = SDL_malloc(sizeof(DICONSTANTFORCE)); if (constant == NULL) { - SDL_OutOfMemory(); - return -1; + return SDL_OutOfMemory(); } SDL_memset(constant, 0, sizeof(DICONSTANTFORCE)); @@ -856,8 +937,7 @@ SDL_SYS_ToDIEFFECT(SDL_Haptic * haptic, DIEFFECT * dest, hap_periodic = &src->periodic; periodic = SDL_malloc(sizeof(DIPERIODIC)); if (periodic == NULL) { - SDL_OutOfMemory(); - return -1; + return SDL_OutOfMemory(); } SDL_memset(periodic, 0, sizeof(DIPERIODIC)); @@ -902,8 +982,7 @@ SDL_SYS_ToDIEFFECT(SDL_Haptic * haptic, DIEFFECT * dest, hap_condition = &src->condition; condition = SDL_malloc(sizeof(DICONDITION) * dest->cAxes); if (condition == NULL) { - SDL_OutOfMemory(); - return -1; + return SDL_OutOfMemory(); } SDL_memset(condition, 0, sizeof(DICONDITION)); @@ -945,8 +1024,7 @@ SDL_SYS_ToDIEFFECT(SDL_Haptic * haptic, DIEFFECT * dest, hap_ramp = &src->ramp; ramp = SDL_malloc(sizeof(DIRAMPFORCE)); if (ramp == NULL) { - SDL_OutOfMemory(); - return -1; + return SDL_OutOfMemory(); } SDL_memset(ramp, 0, sizeof(DIRAMPFORCE)); @@ -984,8 +1062,7 @@ SDL_SYS_ToDIEFFECT(SDL_Haptic * haptic, DIEFFECT * dest, hap_custom = &src->custom; custom = SDL_malloc(sizeof(DICUSTOMFORCE)); if (custom == NULL) { - SDL_OutOfMemory(); - return -1; + return SDL_OutOfMemory(); } SDL_memset(custom, 0, sizeof(DICUSTOMFORCE)); @@ -1029,8 +1106,7 @@ SDL_SYS_ToDIEFFECT(SDL_Haptic * haptic, DIEFFECT * dest, default: - SDL_SetError("Haptic: Unknown effect type."); - return -1; + return SDL_SetError("Haptic: Unknown effect type."); } return 0; @@ -1127,9 +1203,8 @@ SDL_SYS_HapticNewEffect(SDL_Haptic * haptic, struct haptic_effect *effect, SDL_HapticEffect * base) { HRESULT ret; - - /* Get the type. */ REFGUID type = SDL_SYS_HapticEffectType(base); + if (type == NULL) { goto err_hweffect; } @@ -1142,6 +1217,13 @@ SDL_SYS_HapticNewEffect(SDL_Haptic * haptic, struct haptic_effect *effect, goto err_hweffect; } + SDL_zerop(effect->hweffect); + + if (haptic->hwdata->bXInputHaptic) { + SDL_assert(base->type == SDL_HAPTIC_SINE); /* should catch this at higher level */ + return SDL_SYS_HapticUpdateEffect(haptic, effect, base); + } + /* Get the effect. */ if (SDL_SYS_ToDIEFFECT(haptic, &effect->hweffect->effect, base) < 0) { goto err_effectdone; @@ -1181,6 +1263,24 @@ SDL_SYS_HapticUpdateEffect(SDL_Haptic * haptic, DWORD flags; 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? + */ + /* 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 + set to the same amount, as they provide different effects." */ + XINPUT_VIBRATION *vib = &effect->hweffect->vibration; + SDL_assert(data->type == SDL_HAPTIC_SINE); + vib->wLeftMotorSpeed = vib->wRightMotorSpeed = data->periodic.magnitude * 2; + return 0; + } + /* Get the effect. */ SDL_memset(&temp, 0, sizeof(DIEFFECT)); if (SDL_SYS_ToDIEFFECT(haptic, &temp, data) < 0) { @@ -1226,6 +1326,11 @@ SDL_SYS_HapticRunEffect(SDL_Haptic * haptic, struct haptic_effect *effect, HRESULT ret; DWORD iter; + if (haptic->hwdata->bXInputHaptic) { + XINPUT_VIBRATION *vib = &effect->hweffect->vibration; + return (XINPUTSETSTATE(haptic->hwdata->userid, vib) == ERROR_SUCCESS); + } + /* Check if it's infinite. */ if (iterations == SDL_HAPTIC_INFINITY) { iter = INFINITE; @@ -1235,8 +1340,7 @@ SDL_SYS_HapticRunEffect(SDL_Haptic * haptic, struct haptic_effect *effect, /* Run the effect. */ ret = IDirectInputEffect_Start(effect->hweffect->ref, iter, 0); if (FAILED(ret)) { - DI_SetError("Running the effect", ret); - return -1; + return DI_SetError("Running the effect", ret); } return 0; @@ -1251,10 +1355,14 @@ SDL_SYS_HapticStopEffect(SDL_Haptic * haptic, struct haptic_effect *effect) { HRESULT ret; + if (haptic->hwdata->bXInputHaptic) { + XINPUT_VIBRATION vibration = { 0, 0 }; + return (XINPUTSETSTATE(haptic->hwdata->userid, &vibration) == ERROR_SUCCESS); + } + ret = IDirectInputEffect_Stop(effect->hweffect->ref); if (FAILED(ret)) { - DI_SetError("Unable to stop effect", ret); - return -1; + return DI_SetError("Unable to stop effect", ret); } return 0; @@ -1269,12 +1377,16 @@ SDL_SYS_HapticDestroyEffect(SDL_Haptic * haptic, struct haptic_effect *effect) { HRESULT ret; - ret = IDirectInputEffect_Unload(effect->hweffect->ref); - if (FAILED(ret)) { - DI_SetError("Removing effect from the device", ret); + if (haptic->hwdata->bXInputHaptic) { + SDL_SYS_HapticStopEffect(haptic, effect); + } else { + ret = IDirectInputEffect_Unload(effect->hweffect->ref); + if (FAILED(ret)) { + DI_SetError("Removing effect from the device", ret); + } + SDL_SYS_HapticFreeDIEFFECT(&effect->hweffect->effect, + effect->effect.type); } - SDL_SYS_HapticFreeDIEFFECT(&effect->hweffect->effect, - effect->effect.type); SDL_free(effect->hweffect); effect->hweffect = NULL; } @@ -1292,8 +1404,7 @@ SDL_SYS_HapticGetEffectStatus(SDL_Haptic * haptic, ret = IDirectInputEffect_GetEffectStatus(effect->hweffect->ref, &status); if (FAILED(ret)) { - DI_SetError("Getting effect status", ret); - return -1; + return DI_SetError("Getting effect status", ret); } if (status == 0) @@ -1322,8 +1433,7 @@ SDL_SYS_HapticSetGain(SDL_Haptic * haptic, int gain) ret = IDirectInputDevice8_SetProperty(haptic->hwdata->device, DIPROP_FFGAIN, &dipdw.diph); if (FAILED(ret)) { - DI_SetError("Setting gain", ret); - return -1; + return DI_SetError("Setting gain", ret); } return 0; @@ -1351,8 +1461,7 @@ SDL_SYS_HapticSetAutocenter(SDL_Haptic * haptic, int autocenter) ret = IDirectInputDevice8_SetProperty(haptic->hwdata->device, DIPROP_AUTOCENTER, &dipdw.diph); if (FAILED(ret)) { - DI_SetError("Setting autocenter", ret); - return -1; + return DI_SetError("Setting autocenter", ret); } return 0; @@ -1371,8 +1480,7 @@ SDL_SYS_HapticPause(SDL_Haptic * haptic) ret = IDirectInputDevice8_SendForceFeedbackCommand(haptic->hwdata->device, DISFFC_PAUSE); if (FAILED(ret)) { - DI_SetError("Pausing the device", ret); - return -1; + return DI_SetError("Pausing the device", ret); } return 0; @@ -1391,8 +1499,7 @@ SDL_SYS_HapticUnpause(SDL_Haptic * haptic) ret = IDirectInputDevice8_SendForceFeedbackCommand(haptic->hwdata->device, DISFFC_CONTINUE); if (FAILED(ret)) { - DI_SetError("Pausing the device", ret); - return -1; + return DI_SetError("Pausing the device", ret); } return 0; @@ -1407,16 +1514,21 @@ SDL_SYS_HapticStopAll(SDL_Haptic * haptic) { HRESULT ret; + if (haptic->hwdata->bXInputHaptic) { + XINPUT_VIBRATION vibration = { 0, 0 }; + return (XINPUTSETSTATE(haptic->hwdata->userid, &vibration) == ERROR_SUCCESS); + } + /* Try to stop the effects. */ ret = IDirectInputDevice8_SendForceFeedbackCommand(haptic->hwdata->device, DISFFC_STOPALL); if (FAILED(ret)) { - DI_SetError("Stopping the device", ret); - return -1; + return DI_SetError("Stopping the device", ret); } return 0; } - #endif /* SDL_HAPTIC_DINPUT */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/eepp/helper/SDL2/src/joystick/SDL_gamecontroller.c b/src/eepp/helper/SDL2/src/joystick/SDL_gamecontroller.c index b1de6ee7a..b8718a190 100644 --- a/src/eepp/helper/SDL2/src/joystick/SDL_gamecontroller.c +++ b/src/eepp/helper/SDL2/src/joystick/SDL_gamecontroller.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -36,45 +36,53 @@ /* a list of currently opened game controllers */ static SDL_GameController *SDL_gamecontrollers = NULL; -/* keep track of the hat and mask value that transforms this hat movement into a button press */ -struct _SDL_HatAsButton +/* 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 +/** + * We are encoding the "HAT" as 0xhm. where h == hat ID and m == mask + * MAX 4 hats supported + */ +#define k_nMaxHatEntries 0x3f + 1 + /* 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 buttons[SDL_CONTROLLER_BUTTON_MAX]; + /* mapping of axis/button id to controller version */ + int axes[SDL_CONTROLLER_AXIS_MAX]; + int buttonasaxis[SDL_CONTROLLER_AXIS_MAX]; - int axesasbutton[SDL_CONTROLLER_BUTTON_MAX]; - struct _SDL_HatAsButton hatasbutton[SDL_CONTROLLER_BUTTON_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]; + + /* 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]; - // reverse mapping, joystick indices to buttons - SDL_CONTROLLER_AXIS raxes[k_nMaxReverseEntries]; - SDL_CONTROLLER_BUTTON rbuttons[k_nMaxReverseEntries]; - SDL_CONTROLLER_BUTTON raxesasbutton[k_nMaxReverseEntries]; - struct _SDL_HatAsButton rhatasbutton[k_nMaxReverseEntries]; - SDL_CONTROLLER_AXIS rbuttonasaxis[k_nMaxReverseEntries]; }; /* our hard coded list of mapping support */ typedef struct _ControllerMapping_t { - SDL_JoystickGUID guid; - char *name; - const char *mapping; - struct _ControllerMapping_t *next; + SDL_JoystickGUID guid; + char *name; + char *mapping; + struct _ControllerMapping_t *next; } ControllerMapping_t; @@ -82,17 +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,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", - "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. */ #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", + "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", + "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. */ + "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; @@ -103,293 +127,374 @@ static ControllerMapping_t *s_pXInputMapping = NULL; /* The SDL game controller structure */ struct _SDL_GameController { - SDL_Joystick *joystick; /* underlying joystick device */ - int ref_count; - 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_CONTROLLER_AXIS axis, Sint16 value); -int SDL_PrivateGameControllerButton(SDL_GameController * gamecontroller, SDL_CONTROLLER_BUTTON button, Uint8 state); +int SDL_PrivateGameControllerAxis(SDL_GameController * gamecontroller, SDL_GameControllerAxis axis, Sint16 value); +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 = 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_PrivateGameControllerAxis( controllerlist, controllerlist->mapping.raxes[event->jaxis.axis], event->jaxis.value ); - } - else if ( controllerlist->mapping.raxesasbutton[event->jaxis.axis] >= 0 ) // simlate an axis as a button - { - SDL_PrivateGameControllerButton( controllerlist, controllerlist->mapping.raxesasbutton[event->jaxis.axis], ABS(event->jaxis.value) > 32768/2 ? 1 : 0 ); - } - break; - } - controllerlist = controllerlist->next; - } - } - break; - case SDL_JOYBUTTONDOWN: - case SDL_JOYBUTTONUP: - { - SDL_GameController *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 ? 32768 : 0 ); - } - break; - } - controllerlist = controllerlist->next; - } - } - break; - case SDL_JOYHATMOTION: - { - if ( event->jhat.hat == 0 ) // BUGBUG - multiple hat support?? - { - SDL_GameController *controllerlist = SDL_gamecontrollers; - while ( controllerlist ) - { - if ( controllerlist->joystick->instance_id == event->jhat.which ) - { - static Uint8 bHatsDown = 0; - if ( event->jhat.value == 0 ) - { - if ( bHatsDown & SDL_HAT_DOWN ) - SDL_PrivateGameControllerButton( controllerlist, SDL_CONTROLLER_BUTTON_DPAD_DOWN, 0 ); - if ( bHatsDown & SDL_HAT_UP ) - SDL_PrivateGameControllerButton( controllerlist, SDL_CONTROLLER_BUTTON_DPAD_UP, 0 ); - if ( bHatsDown & SDL_HAT_LEFT ) - SDL_PrivateGameControllerButton( controllerlist, SDL_CONTROLLER_BUTTON_DPAD_LEFT, 0 ); - if ( bHatsDown & SDL_HAT_RIGHT ) - SDL_PrivateGameControllerButton( controllerlist, SDL_CONTROLLER_BUTTON_DPAD_RIGHT, 0 ); - bHatsDown = 0; - } - else if ( controllerlist->mapping.rhatasbutton[event->jhat.value].hat >= 0 ) - { - bHatsDown |= event->jhat.value; - SDL_PrivateGameControllerButton( controllerlist, controllerlist->mapping.rhatasbutton[event->jhat.value].hat, (event->jhat.value & controllerlist->mapping.rhatasbutton[event->jhat.value].mask) > 0 ? 1 : 0 ); - } - 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; - } + switch( event->type ) + { + case SDL_JOYAXISMOTION: + { + SDL_GameController *controllerlist; - return 1; + 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; } /* - * Helper function to determine pre-caclulated offset to certain joystick mappings + * Helper function to scan the mappings database for a controller with the specified GUID + */ +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; + } + return NULL; +} + +/* + * Helper function to determine pre-calculated offset to certain joystick mappings */ ControllerMapping_t *SDL_PrivateGetControllerMapping(int device_index) { #ifdef SDL_JOYSTICK_DINPUT - if ( SDL_SYS_IsXInputDeviceIndex(device_index) && s_pXInputMapping ) - { - return s_pXInputMapping; - } + if ( SDL_SYS_IsXInputDeviceIndex(device_index) && s_pXInputMapping ) + { + return s_pXInputMapping; + } + else #endif - return NULL; + { + SDL_JoystickGUID jGUID = SDL_JoystickGetDeviceGUID( device_index ); + return SDL_PrivateGetControllerMappingForGUID(&jGUID); + } + + return NULL; } +static const char* map_StringForControllerAxis[] = { + "leftx", + "lefty", + "rightx", + "righty", + "lefttrigger", + "righttrigger", + NULL +}; /* * convert a string to its enum equivalent */ -SDL_CONTROLLER_AXIS SDL_GameControllerGetAxisFromString( const char *pchString ) +SDL_GameControllerAxis SDL_GameControllerGetAxisFromString( const char *pchString ) { - if ( !pchString || !pchString[0] ) - return SDL_CONTROLLER_AXIS_INVALID; + int entry; + if ( !pchString || !pchString[0] ) + return SDL_CONTROLLER_AXIS_INVALID; - if ( !SDL_strcasecmp( pchString, "leftx" ) ) - return SDL_CONTROLLER_AXIS_LEFTX; - else if ( !SDL_strcasecmp( pchString, "lefty" ) ) - return SDL_CONTROLLER_AXIS_LEFTY; - else if ( !SDL_strcasecmp( pchString, "rightx" ) ) - return SDL_CONTROLLER_AXIS_RIGHTX; - else if ( !SDL_strcasecmp( pchString, "righty" ) ) - return SDL_CONTROLLER_AXIS_RIGHTY; - else if ( !SDL_strcasecmp( pchString, "lefttrigger" ) ) - return SDL_CONTROLLER_AXIS_TRIGGERLEFT; - else if ( !SDL_strcasecmp( pchString, "righttrigger" ) ) - return SDL_CONTROLLER_AXIS_TRIGGERRIGHT; - else - return SDL_CONTROLLER_AXIS_INVALID; + for ( entry = 0; map_StringForControllerAxis[entry]; ++entry) + { + if ( !SDL_strcasecmp( pchString, map_StringForControllerAxis[entry] ) ) + return entry; + } + return SDL_CONTROLLER_AXIS_INVALID; } +/* + * convert an enum to its string equivalent + */ +const char* SDL_GameControllerGetStringForAxis( SDL_GameControllerAxis axis ) +{ + if (axis > SDL_CONTROLLER_AXIS_INVALID && axis < SDL_CONTROLLER_AXIS_MAX) + { + return map_StringForControllerAxis[axis]; + } + return NULL; +} + +static const char* map_StringForControllerButton[] = { + "a", + "b", + "x", + "y", + "back", + "guide", + "start", + "leftstick", + "rightstick", + "leftshoulder", + "rightshoulder", + "dpup", + "dpdown", + "dpleft", + "dpright", + NULL +}; /* * convert a string to its enum equivalent */ -SDL_CONTROLLER_BUTTON SDL_GameControllerGetButtonFromString( const char *pchString ) +SDL_GameControllerButton SDL_GameControllerGetButtonFromString( const char *pchString ) { - if ( !pchString || !pchString[0] ) - return SDL_CONTROLLER_BUTTON_INVALID; + int entry; + if ( !pchString || !pchString[0] ) + return SDL_CONTROLLER_BUTTON_INVALID; - if ( !SDL_strcasecmp( pchString, "a" ) ) - return SDL_CONTROLLER_BUTTON_A; - else if ( !SDL_strcasecmp( pchString, "b" ) ) - return SDL_CONTROLLER_BUTTON_B; - else if ( !SDL_strcasecmp( pchString, "x" ) ) - return SDL_CONTROLLER_BUTTON_X; - else if ( !SDL_strcasecmp( pchString, "y" ) ) - return SDL_CONTROLLER_BUTTON_Y; - else if ( !SDL_strcasecmp( pchString, "start" ) ) - return SDL_CONTROLLER_BUTTON_START; - else if ( !SDL_strcasecmp( pchString, "guide" ) ) - return SDL_CONTROLLER_BUTTON_GUIDE; - else if ( !SDL_strcasecmp( pchString, "back" ) ) - return SDL_CONTROLLER_BUTTON_BACK; - else if ( !SDL_strcasecmp( pchString, "dpup" ) ) - return SDL_CONTROLLER_BUTTON_DPAD_UP; - else if ( !SDL_strcasecmp( pchString, "dpdown" ) ) - return SDL_CONTROLLER_BUTTON_DPAD_DOWN; - else if ( !SDL_strcasecmp( pchString, "dpleft" ) ) - return SDL_CONTROLLER_BUTTON_DPAD_LEFT; - else if ( !SDL_strcasecmp( pchString, "dpright" ) ) - return SDL_CONTROLLER_BUTTON_DPAD_RIGHT; - else if ( !SDL_strcasecmp( pchString, "leftshoulder" ) ) - return SDL_CONTROLLER_BUTTON_LEFTSHOULDER; - else if ( !SDL_strcasecmp( pchString, "rightshoulder" ) ) - return SDL_CONTROLLER_BUTTON_RIGHTSHOULDER; - else if ( !SDL_strcasecmp( pchString, "leftstick" ) ) - return SDL_CONTROLLER_BUTTON_LEFTSTICK; - else if ( !SDL_strcasecmp( pchString, "rightstick" ) ) - return SDL_CONTROLLER_BUTTON_RIGHTSTICK; - else - 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; } +/* + * convert an enum to its string equivalent + */ +const char* SDL_GameControllerGetStringForButton( SDL_GameControllerButton axis ) +{ + if (axis > SDL_CONTROLLER_BUTTON_INVALID && axis < SDL_CONTROLLER_BUTTON_MAX) + { + return map_StringForControllerButton[axis]; + } + return NULL; +} /* * given a controller button name and a joystick name update our mapping structure with it */ void SDL_PrivateGameControllerParseButton( const char *szGameButton, const char *szJoystickButton, struct _SDL_ControllerMapping *pMapping ) { - int iSDLButton = 0; - SDL_CONTROLLER_BUTTON button; - SDL_CONTROLLER_AXIS axis; - button = SDL_GameControllerGetButtonFromString( szGameButton ); - axis = SDL_GameControllerGetAxisFromString( szGameButton ); - iSDLButton = SDL_atoi( &szJoystickButton[1] ); + int iSDLButton = 0; + SDL_GameControllerButton button; + SDL_GameControllerAxis axis; + button = SDL_GameControllerGetButtonFromString( szGameButton ); + axis = SDL_GameControllerGetAxisFromString( szGameButton ); + iSDLButton = SDL_atoi( &szJoystickButton[1] ); - if ( iSDLButton >= k_nMaxReverseEntries ) - { - SDL_SetError("Button index too large: %d", iSDLButton ); - return; - } + 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?" ); + } - if ( szJoystickButton[0] == 'a' ) - { - if ( axis != SDL_CONTROLLER_AXIS_INVALID ) - { - pMapping->axes[ axis ] = iSDLButton; - pMapping->raxes[ iSDLButton ] = axis; - } - else if ( button != SDL_CONTROLLER_BUTTON_INVALID ) - { - pMapping->buttonasaxis[ button ] = iSDLButton; - pMapping->rbuttonasaxis[ iSDLButton ] = button; - } - else - { - SDL_assert( !"How did we get here?" ); - } - - } - else if ( szJoystickButton[0] == 'b' ) - { - 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 ( button != SDL_CONTROLLER_BUTTON_INVALID ) - { - pMapping->hatasbutton[ button ].hat = hat; - pMapping->hatasbutton[ button ].mask = mask; - pMapping->rhatasbutton[ mask ].hat = button; - pMapping->rhatasbutton[ mask ].mask = mask; - } - else if ( axis != SDL_CONTROLLER_AXIS_INVALID ) - { - SDL_assert( !"Support hat as axis" ); - } - 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?" ); + } + } } @@ -399,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; + 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) ); + 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 == ' ' ) - { + 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 ( *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++; - } + } + 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 ); + SDL_PrivateGameControllerParseButton( szGameButton, szJoystickButton, pMapping ); } @@ -460,34 +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; + int j; - pMapping->guid = guid; - pMapping->name = pchName; + 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; - } + /* 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->rbuttons[j] = SDL_CONTROLLER_BUTTON_INVALID; - pMapping->raxesasbutton[j] = SDL_CONTROLLER_BUTTON_INVALID; - pMapping->rhatasbutton[j].hat = -1; - pMapping->rbuttonasaxis[j] = SDL_CONTROLLER_AXIS_INVALID; - } + 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; + } - SDL_PrivateGameControllerParseControllerConfigString( pMapping, pchMapping ); + for (j = 0; j < k_nMaxHatEntries; j++) + { + pMapping->rhatasbutton[j] = SDL_CONTROLLER_BUTTON_INVALID; + } + + SDL_PrivateGameControllerParseControllerConfigString( pMapping, pchMapping ); } @@ -496,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; } @@ -518,37 +627,191 @@ char *SDL_PrivateGetControllerGUIDFromMappingString( const char *pMapping ) */ char *SDL_PrivateGetControllerNameFromMappingString( const char *pMapping ) { - const char *pFirstComma = SDL_strchr( pMapping, ',' ); - const char *pSecondComma = SDL_strchr( pFirstComma + 1, ',' ); - if ( pFirstComma && pSecondComma ) - { - char *pchName = SDL_malloc( pSecondComma - pFirstComma ); - if ( !pchName ) - { - SDL_OutOfMemory(); - return NULL; - } - SDL_memcpy( pchName, pFirstComma + 1, pSecondComma - pFirstComma ); - pchName[ pSecondComma - pFirstComma - 1 ] = 0; - return pchName; - } - return NULL; + const char *pFirstComma, *pSecondComma; + char *pchName; + + pFirstComma = SDL_strchr( pMapping, ',' ); + if ( !pFirstComma ) + return NULL; + + pSecondComma = SDL_strchr( pFirstComma + 1, ',' ); + if ( !pSecondComma ) + return NULL; + + pchName = SDL_malloc( pSecondComma - pFirstComma ); + if ( !pchName ) + { + SDL_OutOfMemory(); + return NULL; + } + SDL_memcpy( pchName, pFirstComma + 1, pSecondComma - pFirstComma ); + pchName[ pSecondComma - pFirstComma - 1 ] = 0; + return pchName; } /* * grab the button mapping string from a mapping string */ -const char *SDL_PrivateGetControllerMappingFromMappingString( const char *pMapping ) +char *SDL_PrivateGetControllerMappingFromMappingString( const char *pMapping ) { - const char *pFirstComma = SDL_strchr( pMapping, ',' ); - const char *pSecondComma = SDL_strchr( pFirstComma + 1, ',' ); - if ( pSecondComma ) - return pSecondComma + 1; // mapping is everything after the 3rd comma, no need to malloc it - else - return NULL; + const char *pFirstComma, *pSecondComma; + + pFirstComma = SDL_strchr( pMapping, ',' ); + if ( !pFirstComma ) + return NULL; + + pSecondComma = SDL_strchr( pFirstComma + 1, ',' ); + if ( !pSecondComma ) + return NULL; + + return SDL_strdup(pSecondComma + 1); /* mapping is everything after the 3rd comma */ } +void SDL_PrivateGameControllerRefreshMapping( ControllerMapping_t *pControllerMapping ) +{ + SDL_GameController *gamecontrollerlist = SDL_gamecontrollers; + while ( gamecontrollerlist ) + { + if ( !SDL_memcmp( &gamecontrollerlist->mapping.guid, &pControllerMapping->guid, sizeof(pControllerMapping->guid) ) ) + { + SDL_Event event; + event.type = SDL_CONTROLLERDEVICEREMAPPED; + event.cdevice.which = gamecontrollerlist->joystick->instance_id; + SDL_PushEvent(&event); + + /* Not really threadsafe. Should this lock access within SDL_GameControllerEventWatcher? */ + SDL_PrivateLoadButtonMapping(&gamecontrollerlist->mapping, pControllerMapping->guid, pControllerMapping->name, pControllerMapping->mapping); + } + + gamecontrollerlist = gamecontrollerlist->next; + } +} + +/* + * Add or update an entry into the Mappings Database + */ +int +SDL_GameControllerAddMapping( const char *mappingString ) +{ + char *pchGUID; + char *pchName; + char *pchMapping; + SDL_JoystickGUID jGUID; + ControllerMapping_t *pControllerMapping; +#ifdef SDL_JOYSTICK_DINPUT + SDL_bool is_xinput_mapping = SDL_FALSE; +#endif + + pchGUID = SDL_PrivateGetControllerGUIDFromMappingString( mappingString ); + if (!pchGUID) { + return -1; + } +#ifdef SDL_JOYSTICK_DINPUT + if ( !SDL_strcasecmp( pchGUID, "xinput" ) ) { + is_xinput_mapping = SDL_TRUE; + } +#endif + 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(); + } +#ifdef SDL_JOYSTICK_DINPUT + 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; + } +} + +/* + * Get the mapping string for this GUID + */ +char * +SDL_GameControllerMappingForGUID( SDL_JoystickGUID guid ) +{ + 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; +} + +/* + * Get the mapping string for this device + */ +char * +SDL_GameControllerMapping( SDL_GameController * gamecontroller ) +{ + return SDL_GameControllerMappingForGUID( gamecontroller->mapping.guid ); +} + +static void +SDL_GameControllerLoadHints() +{ + const char *hint = SDL_GetHint(SDL_HINT_GAMECONTROLLERCONFIG); + if ( hint && hint[0] ) { + int nchHints = SDL_strlen( hint ); + char *pUserMappings = SDL_malloc( nchHints + 1 ); + char *pTempMappings = pUserMappings; + SDL_memcpy( pUserMappings, hint, nchHints ); + while ( pUserMappings ) { + char *pchNewLine = NULL; + + pchNewLine = SDL_strchr( pUserMappings, '\n' ); + if ( pchNewLine ) + *pchNewLine = '\0'; + + SDL_GameControllerAddMapping( pUserMappings ); + + if ( pchNewLine ) + pUserMappings = pchNewLine + 1; + else + pUserMappings = NULL; + } + SDL_free(pTempMappings); + } +} /* * Initialize the game controller system, mostly load our DB of controller config mappings @@ -556,107 +819,25 @@ const char *SDL_PrivateGetControllerMappingFromMappingString( const char *pMappi int SDL_GameControllerInit(void) { - int i = 0; - const char *pMappingString = NULL; - s_pSupportedControllers = NULL; - pMappingString = s_ControllerMappings[i]; - while ( pMappingString ) - { - ControllerMapping_t *pControllerMapping; - char *pchGUID; - char *pchName; - const char *pchMapping; - pControllerMapping = SDL_malloc( sizeof(*pControllerMapping) ); - if ( !pControllerMapping ) - { - SDL_OutOfMemory(); - return -1; - } + int i = 0; + const char *pMappingString = NULL; + s_pSupportedControllers = NULL; + pMappingString = s_ControllerMappings[i]; + while ( pMappingString ) + { + SDL_GameControllerAddMapping( pMappingString ); - pchGUID = SDL_PrivateGetControllerGUIDFromMappingString( pMappingString ); - pchName = SDL_PrivateGetControllerNameFromMappingString( pMappingString ); - pchMapping = SDL_PrivateGetControllerMappingFromMappingString( pMappingString ); - if ( pchGUID && pchName ) - { -#ifdef SDL_JOYSTICK_DINPUT - if ( !SDL_strcasecmp( pchGUID, "xinput" ) ) - { - s_pXInputMapping = pControllerMapping; - } -#endif - pControllerMapping->guid = SDL_JoystickGetGUIDFromString( pchGUID ); - pControllerMapping->name = pchName; - pControllerMapping->mapping = pchMapping; - pControllerMapping->next = s_pSupportedControllers; - s_pSupportedControllers = pControllerMapping; + i++; + pMappingString = s_ControllerMappings[i]; + } - SDL_free( pchGUID ); - } + /* load in any user supplied config */ + SDL_GameControllerLoadHints(); - i++; - pMappingString = s_ControllerMappings[i]; - } + /* watch for joy events and fire controller ones if needed */ + SDL_AddEventWatch( SDL_GameControllerEventWatcher, NULL ); - // load in any user supplied config - { - const char *hint = SDL_GetHint(SDL_HINT_GAMECONTROLLERCONFIG); - if ( hint && hint[0] ) - { - int nchHints = SDL_strlen( hint ); - char *pUserMappings = SDL_malloc( nchHints + 1 ); - SDL_memcpy( pUserMappings, hint, nchHints ); - while ( pUserMappings ) - { - char *pchGUID; - char *pchName; - const char *pchMapping; - char *pchNewLine = NULL; - ControllerMapping_t *pControllerMapping; - - pchNewLine = SDL_strchr( pUserMappings, '\n' ); - if ( pchNewLine ) - *pchNewLine = '\0'; - - pControllerMapping = SDL_malloc( sizeof(*pControllerMapping) ); - if ( !pControllerMapping ) - { - SDL_OutOfMemory(); - return -1; - } - - pchGUID = SDL_PrivateGetControllerGUIDFromMappingString( pUserMappings ); - pchName = SDL_PrivateGetControllerNameFromMappingString( pUserMappings ); - pchMapping = SDL_PrivateGetControllerMappingFromMappingString( pUserMappings ); - - if ( pchGUID && pchName ) - { -#ifdef SDL_JOYSTICK_DINPUT - if ( !SDL_strcasecmp( pchGUID, "xinput" ) ) - { - s_pXInputMapping = pControllerMapping; - } -#endif - - pControllerMapping->guid = SDL_JoystickGetGUIDFromString( pchGUID ); - pControllerMapping->name = pchName; - pControllerMapping->mapping = pchMapping; - pControllerMapping->next = s_pSupportedControllers; - s_pSupportedControllers = pControllerMapping; - - SDL_free( pchGUID ); - } - - if ( pchNewLine ) - pUserMappings = pchNewLine + 1; - else - pUserMappings = NULL; - } - } - } - - /* watch for joy events and fire controller ones if needed */ - SDL_AddEventWatch( SDL_GameControllerEventWatcher, NULL ); - return (0); + return (0); } @@ -666,24 +847,11 @@ SDL_GameControllerInit(void) const char * SDL_GameControllerNameForIndex(int device_index) { - ControllerMapping_t *pSupportedController = SDL_PrivateGetControllerMapping(device_index); - if ( pSupportedController ) - { - return pSupportedController->name; - } - else - { - SDL_JoystickGUID jGUID = SDL_JoystickGetDeviceGUID( device_index ); - pSupportedController = s_pSupportedControllers; - while ( pSupportedController ) - { - if ( !SDL_memcmp( &jGUID, &pSupportedController->guid, sizeof(jGUID) ) ) - { - return pSupportedController->name; - } - pSupportedController = pSupportedController->next; - } - } + ControllerMapping_t *pSupportedController = SDL_PrivateGetControllerMapping(device_index); + if ( pSupportedController ) + { + return pSupportedController->name; + } return NULL; } @@ -691,32 +859,16 @@ SDL_GameControllerNameForIndex(int device_index) /* * Return 1 if the joystick at this device index is a supported controller */ -int SDL_IsGameController(int device_index) +SDL_bool +SDL_IsGameController(int device_index) { - ControllerMapping_t *pSupportedController = SDL_PrivateGetControllerMapping(device_index); - if ( pSupportedController ) - { - return 1; - } - else - { - SDL_JoystickGUID jGUID = SDL_JoystickGetDeviceGUID( device_index ); - pSupportedController = s_pSupportedControllers; - // debug code to help get the guid string for a new joystick - /* char szGUID[33]; - SDL_JoystickGetGUIDString( jGUID, szGUID, sizeof(szGUID) ); - printf( "%s\n", pchGUID ); - SDL_free( pchGUID );*/ - while ( pSupportedController ) - { - if ( !SDL_memcmp( &jGUID, &pSupportedController->guid, sizeof(jGUID) ) ) - { - return 1; - } - pSupportedController = pSupportedController->next; - } - } - return 0; + ControllerMapping_t *pSupportedController = SDL_PrivateGetControllerMapping(device_index); + if ( pSupportedController ) + { + return SDL_TRUE; + } + + return SDL_FALSE; } /* @@ -730,100 +882,93 @@ 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; } - // Create and initialize the joystick + /* 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; } - pSupportedController = SDL_PrivateGetControllerMapping(device_index); - if ( !pSupportedController ) - { - SDL_JoystickGUID jGUID; - - jGUID = SDL_JoystickGetDeviceGUID( device_index ); - pSupportedController = s_pSupportedControllers; - while ( pSupportedController ) - { - if ( !SDL_memcmp( &jGUID, &pSupportedController->guid, sizeof(jGUID) ) ) - { - break; - } - - pSupportedController = pSupportedController->next; - } - } - - if ( !pSupportedController ) - { - SDL_SetError("Couldn't find mapping for device (%d)", device_index ); - 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); } +/* + * Manually pump for controller updates. + */ +void +SDL_GameControllerUpdate(void) +{ + /* Just for API completeness; the joystick API does all the work. */ + SDL_JoystickUpdate(); +} + /* * Get the current state of an axis control on a controller */ Sint16 -SDL_GameControllerGetAxis(SDL_GameController * gamecontroller, SDL_CONTROLLER_AXIS axis) +SDL_GameControllerGetAxis(SDL_GameController * gamecontroller, SDL_GameControllerAxis axis) { - if ( !gamecontroller ) - 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; + 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; } @@ -831,47 +976,47 @@ SDL_GameControllerGetAxis(SDL_GameController * gamecontroller, SDL_CONTROLLER_AX * Get the current state of a button on a controller */ Uint8 -SDL_GameControllerGetButton(SDL_GameController * gamecontroller, SDL_CONTROLLER_BUTTON button) +SDL_GameControllerGetButton(SDL_GameController * gamecontroller, SDL_GameControllerButton button) { - if ( !gamecontroller ) - 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; - } + 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 ); - return 0; + if ( value & gamecontroller->mapping.hatasbutton[button].mask ) + return 1; + return 0; + } + + return 0; } /* * Return if the joystick in question is currently attached to the system, * \return 0 if not plugged in, 1 if still present. */ -int +SDL_bool SDL_GameControllerGetAttached( SDL_GameController * gamecontroller ) { - if ( !gamecontroller ) - return 0; + if ( !gamecontroller ) + return SDL_FALSE; - return SDL_JoystickGetAttached(gamecontroller->joystick); + return SDL_JoystickGetAttached(gamecontroller->joystick); } @@ -881,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); } @@ -893,67 +1038,67 @@ 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; } /** - * get the sdl joystick layer binding for this controller axi mapping + * Get the SDL joystick layer binding for this controller axis mapping */ -SDL_GameControllerButtonBind SDL_GameControllerGetBindForAxis( SDL_GameController * gamecontroller, SDL_CONTROLLER_AXIS axis ) +SDL_GameControllerButtonBind SDL_GameControllerGetBindForAxis(SDL_GameController * gamecontroller, SDL_GameControllerAxis axis) { - SDL_GameControllerButtonBind bind; - SDL_memset( &bind, 0x0, sizeof(bind) ); + SDL_GameControllerButtonBind bind; + SDL_memset( &bind, 0x0, sizeof(bind) ); - if ( !gamecontroller || axis == SDL_CONTROLLER_AXIS_INVALID ) - return bind; + if ( !gamecontroller || axis == SDL_CONTROLLER_AXIS_INVALID ) + return bind; - if (gamecontroller->mapping.axes[axis] >= 0 ) - { - bind.m_eBindType = SDL_CONTROLLER_BINDTYPE_AXIS; - bind.button = gamecontroller->mapping.axes[axis]; - } - else if (gamecontroller->mapping.buttonasaxis[axis] >= 0 ) - { - bind.m_eBindType = SDL_CONTROLLER_BINDTYPE_BUTTON; - bind.button = gamecontroller->mapping.buttonasaxis[axis]; - } + 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; + return bind; } /** - * get the sdl joystick layer binding for this controller button mapping + * Get the SDL joystick layer binding for this controller button mapping */ -SDL_GameControllerButtonBind SDL_GameControllerGetBindForButton( SDL_GameController * gamecontroller, SDL_CONTROLLER_BUTTON button ) +SDL_GameControllerButtonBind SDL_GameControllerGetBindForButton(SDL_GameController * gamecontroller, SDL_GameControllerButton button) { - SDL_GameControllerButtonBind bind; - SDL_memset( &bind, 0x0, sizeof(bind) ); + SDL_GameControllerButtonBind bind; + SDL_memset( &bind, 0x0, sizeof(bind) ); - if ( !gamecontroller || button == SDL_CONTROLLER_BUTTON_INVALID ) - return bind; + if ( !gamecontroller || button == SDL_CONTROLLER_BUTTON_INVALID ) + return bind; - if ( gamecontroller->mapping.buttons[button] >= 0 ) - { - bind.m_eBindType = SDL_CONTROLLER_BINDTYPE_BUTTON; - bind.button = gamecontroller->mapping.buttons[button]; - } - else if ( gamecontroller->mapping.axesasbutton[button] >= 0 ) - { - bind.m_eBindType = SDL_CONTROLLER_BINDTYPE_AXIS; - bind.axis = gamecontroller->mapping.axesasbutton[button]; - } - else if ( gamecontroller->mapping.hatasbutton[button].hat >= 0 ) - { - bind.m_eBindType = SDL_CONTROLLER_BINDTYPE_HAT; - bind.hat.hat = gamecontroller->mapping.hatasbutton[button].hat; - bind.hat.hat_mask = gamecontroller->mapping.hatasbutton[button].mask; - } + 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; + return bind; } @@ -963,40 +1108,40 @@ SDL_GameControllerButtonBind SDL_GameControllerGetBindForButton( SDL_GameControl 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; - } + 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; + } - break; - } - gamecontrollerlistprev = gamecontrollerlist; - gamecontrollerlist = gamecontrollerlist->next; - } - SDL_free(gamecontroller); } @@ -1007,23 +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); - } + } - pControllerMap = s_pSupportedControllers; - 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 ); } @@ -1031,9 +1175,9 @@ SDL_GameControllerQuit(void) * Event filter to transform joystick events into appropriate game controller ones */ int -SDL_PrivateGameControllerAxis(SDL_GameController * gamecontroller, SDL_CONTROLLER_AXIS axis, Sint16 value) +SDL_PrivateGameControllerAxis(SDL_GameController * gamecontroller, SDL_GameControllerAxis axis, Sint16 value) { - int posted; + int posted; /* translate the event, if desired */ posted = 0; @@ -1044,7 +1188,7 @@ SDL_PrivateGameControllerAxis(SDL_GameController * gamecontroller, SDL_CONTROLLE 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); @@ -1055,11 +1199,14 @@ SDL_PrivateGameControllerAxis(SDL_GameController * gamecontroller, SDL_CONTROLLE * Event filter to transform joystick events into appropriate game controller ones */ int -SDL_PrivateGameControllerButton(SDL_GameController * gamecontroller, SDL_CONTROLLER_BUTTON button, Uint8 state) +SDL_PrivateGameControllerButton(SDL_GameController * gamecontroller, SDL_GameControllerButton button, Uint8 state) { int posted; #if !SDL_EVENTS_DISABLED - SDL_Event event; + SDL_Event event; + + if ( button == SDL_CONTROLLER_BUTTON_INVALID ) + return (0); switch (state) { case SDL_PRESSED: @@ -1081,7 +1228,7 @@ SDL_PrivateGameControllerButton(SDL_GameController * gamecontroller, SDL_CONTROL 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); @@ -1098,7 +1245,7 @@ SDL_GameControllerEventState(int state) #else const Uint32 event_list[] = { SDL_CONTROLLERAXISMOTION, SDL_CONTROLLERBUTTONDOWN, SDL_CONTROLLERBUTTONUP, - SDL_CONTROLLERDEVICEADDED, SDL_CONTROLLERDEVICEREMOVED, + SDL_CONTROLLERDEVICEADDED, SDL_CONTROLLERDEVICEREMOVED, SDL_CONTROLLERDEVICEREMAPPED, }; unsigned int i; @@ -1122,5 +1269,4 @@ SDL_GameControllerEventState(int state) #endif /* SDL_EVENTS_DISABLED */ } - /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/eepp/helper/SDL2/src/joystick/SDL_joystick.c b/src/eepp/helper/SDL2/src/joystick/SDL_joystick.c index fe45a023d..0e9c3f74c 100644 --- a/src/eepp/helper/SDL2/src/joystick/SDL_joystick.c +++ b/src/eepp/helper/SDL2/src/joystick/SDL_joystick.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -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; } @@ -303,8 +303,7 @@ SDL_JoystickGetBall(SDL_Joystick * joystick, int ball, int *dx, int *dy) joystick->balls[ball].dx = 0; joystick->balls[ball].dy = 0; } else { - SDL_SetError("Joystick only has %d balls", joystick->nballs); - retval = -1; + return SDL_SetError("Joystick only has %d balls", joystick->nballs); } return (retval); } @@ -336,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); } /* @@ -365,7 +364,7 @@ SDL_JoystickName(SDL_Joystick * joystick) if (!SDL_PrivateJoystickValid(joystick)) { return (NULL); } - + return (joystick->name); } @@ -375,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; @@ -392,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) { @@ -441,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(); @@ -588,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++) @@ -618,7 +617,7 @@ SDL_JoystickUpdate(void) for (i = 0; i < joystick->nhats; i++) SDL_PrivateJoystickHat(joystick, i, SDL_HAT_CENTERED); - } + } SDL_updating_joystick = NULL; @@ -627,17 +626,20 @@ SDL_JoystickUpdate(void) SDL_JoystickClose(joystick); } - joystick = joysticknext; - } + joystick = joysticknext; + } - 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 SDL_JoystickEventState(int state) { #if SDL_EVENTS_DISABLED - return SDL_IGNORE; + return SDL_DISABLE; #else const Uint32 event_list[] = { SDL_JOYAXISMOTION, SDL_JOYBALLMOTION, SDL_JOYHATMOTION, @@ -647,7 +649,7 @@ SDL_JoystickEventState(int state) switch (state) { case SDL_QUERY: - state = SDL_IGNORE; + state = SDL_DISABLE; for (i = 0; i < SDL_arraysize(event_list); ++i) { state = SDL_EventState(event_list[i], SDL_QUERY); if (state == SDL_ENABLE) { @@ -666,111 +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_SYS_JoystickNeedsPolling() ) - { - // sys layer needs us to think - return SDL_TRUE; - } - else - { - // otherwise only do it if a joystick is opened - return SDL_joysticks != NULL; - } + 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 >= '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); + } - 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; + /* 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; + SDL_JoystickGUID guid; + int maxoutputbytes= sizeof(guid); + int len = SDL_strlen( pchGUID ); + Uint8 *p; + int i; - // Make sure it's even - len = ( len ) & ~0x1; + /* Make sure it's even */ + len = ( len ) & ~0x1; - SDL_memset( &guid, 0x00, sizeof(guid) ); + 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] ); - } + 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; + return guid; } diff --git a/src/eepp/helper/SDL2/src/joystick/SDL_joystick_c.h b/src/eepp/helper/SDL2/src/joystick/SDL_joystick_c.h index 221fffa47..38bc78553 100644 --- a/src/eepp/helper/SDL2/src/joystick/SDL_joystick_c.h +++ b/src/eepp/helper/SDL2/src/joystick/SDL_joystick_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -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/eepp/helper/SDL2/src/joystick/SDL_sysjoystick.h b/src/eepp/helper/SDL2/src/joystick/SDL_sysjoystick.h index 1821beec7..4a5019e73 100644 --- a/src/eepp/helper/SDL2/src/joystick/SDL_sysjoystick.h +++ b/src/eepp/helper/SDL2/src/joystick/SDL_sysjoystick.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -28,8 +28,8 @@ /* The SDL joystick structure */ struct _SDL_Joystick { - int instance_id; /* Device instance, monotonically increasing from 0 */ - char *name; /* Joystick name - system dependent */ + SDL_JoystickID instance_id; /* Device instance, monotonically increasing from 0 */ + char *name; /* Joystick name - system dependent */ int naxes; /* Number of axis controls on the joystick */ Sint16 *axes; /* Current axis states */ @@ -38,8 +38,7 @@ struct _SDL_Joystick Uint8 *hats; /* Current hat states */ int nballs; /* Number of trackballs on the joystick */ - struct balldelta - { + struct balldelta { int dx; int dy; } *balls; /* Current ball motion deltas */ @@ -50,10 +49,10 @@ struct _SDL_Joystick struct joystick_hwdata *hwdata; /* Driver dependent information */ int ref_count; /* Reference count for multiple opens */ - - Uint8 closed; /* 1 if this device is no longer valid */ - Uint8 uncentered; /* 1 if this device needs to have its state reset to 0 */ - struct _SDL_Joystick *next; /* pointer to next joystick we have allocated */ + + Uint8 closed; /* 1 if this device is no longer valid */ + Uint8 uncentered; /* 1 if this device needs to have its state reset to 0 */ + struct _SDL_Joystick *next; /* pointer to next joystick we have allocated */ }; /* Function to scan the system for joysticks. diff --git a/src/eepp/helper/SDL2/src/joystick/android/SDL_sysjoystick.c b/src/eepp/helper/SDL2/src/joystick/android/SDL_sysjoystick.c index 78208c0b7..adaca528e 100644 --- a/src/eepp/helper/SDL2/src/joystick/android/SDL_sysjoystick.c +++ b/src/eepp/helper/SDL2/src/joystick/android/SDL_sysjoystick.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -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/eepp/helper/SDL2/src/joystick/beos/SDL_bejoystick.cc b/src/eepp/helper/SDL2/src/joystick/beos/SDL_bejoystick.cc index 1fc35184e..4e342ed41 100644 --- a/src/eepp/helper/SDL2/src/joystick/beos/SDL_bejoystick.cc +++ b/src/eepp/helper/SDL2/src/joystick/beos/SDL_bejoystick.cc @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -125,8 +125,7 @@ extern "C" joystick->hwdata = (struct joystick_hwdata *) SDL_malloc(sizeof(*joystick->hwdata)); if (joystick->hwdata == NULL) { - SDL_OutOfMemory(); - return (-1); + return SDL_OutOfMemory(); } SDL_memset(joystick->hwdata, 0, sizeof(*joystick->hwdata)); stick = new BJoystick; @@ -134,9 +133,8 @@ extern "C" /* Open the requested joystick for use */ if (stick->Open(SDL_joyport[device_index]) == B_ERROR) { - SDL_SetError("Unable to open joystick"); SDL_SYS_JoystickClose(joystick); - return (-1); + return SDL_SetError("Unable to open joystick"); } /* Set the joystick to calibrated mode */ @@ -152,9 +150,8 @@ extern "C" joystick->hwdata->new_hats = (uint8 *) SDL_malloc(joystick->nhats * sizeof(uint8)); if (!joystick->hwdata->new_hats || !joystick->hwdata->new_axes) { - SDL_OutOfMemory(); SDL_SYS_JoystickClose(joystick); - return (-1); + return SDL_OutOfMemory(); } /* We're done! */ @@ -264,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 ) ) ); @@ -274,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/eepp/helper/SDL2/src/joystick/bsd/SDL_sysjoystick.c b/src/eepp/helper/SDL2/src/joystick/bsd/SDL_sysjoystick.c index fc2e9c3db..6d35d91b5 100644 --- a/src/eepp/helper/SDL2/src/joystick/bsd/SDL_sysjoystick.c +++ b/src/eepp/helper/SDL2/src/joystick/bsd/SDL_sysjoystick.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -76,14 +76,16 @@ #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 { -#if defined(__FREEBSD__) && (__FreeBSD_kernel_version > 800063) +#if defined(__FREEBSD__) && (__FreeBSD_kernel_version > 900000) + void *buf; /* Buffer */ +#elif defined(__FREEBSD__) && (__FreeBSD_kernel_version > 800063) struct usb_gen_descriptor *buf; /* Buffer */ #else struct usb_ctl_report *buf; /* Buffer */ @@ -149,8 +151,10 @@ static char *joydevnames[MAX_JOYS]; static int report_alloc(struct report *, struct report_desc *, int); static void report_free(struct report *); -#if defined(USBHID_UCR_DATA) +#if defined(USBHID_UCR_DATA) || (defined(__FreeBSD_kernel__) && __FreeBSD_kernel_version <= 800063) #define REP_BUF_DATA(rep) ((rep)->buf->ucr_data) +#elif (defined(__FREEBSD__) && (__FreeBSD_kernel_version > 900000)) +#define REP_BUF_DATA(rep) ((rep)->buf) #elif (defined(__FREEBSD__) && (__FreeBSD_kernel_version > 800063)) #define REP_BUF_DATA(rep) ((rep)->buf->ugd_data) #else @@ -293,17 +297,15 @@ SDL_SYS_JoystickOpen(SDL_Joystick * joy, int device_index) fd = open(path, O_RDONLY); if (fd == -1) { - SDL_SetError("%s: %s", path, strerror(errno)); - return (-1); + return SDL_SetError("%s: %s", path, strerror(errno)); } joy->instance_id = device_index; hw = (struct joystick_hwdata *) SDL_malloc(sizeof(struct joystick_hwdata)); if (hw == NULL) { - SDL_OutOfMemory(); close(fd); - return (-1); + return SDL_OutOfMemory(); } joy->hwdata = hw; hw->fd = fd; @@ -587,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 ) ) ); @@ -597,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 ) ) ); @@ -630,24 +632,26 @@ report_alloc(struct report *r, struct report_desc *rd, int repind) #endif if (len < 0) { - SDL_SetError("Negative HID report size"); - return (-1); + return SDL_SetError("Negative HID report size"); } r->size = len; if (r->size > 0) { +#if defined(__FREEBSD__) && (__FreeBSD_kernel_version > 900000) + r->buf = SDL_malloc(r->size); +#else r->buf = SDL_malloc(sizeof(*r->buf) - sizeof(REP_BUF_DATA(r)) + r->size); +#endif if (r->buf == NULL) { - SDL_OutOfMemory(); - return (-1); + return SDL_OutOfMemory(); } } else { r->buf = NULL; } r->status = SREPORT_CLEAN; - return (0); + return 0; } static void diff --git a/src/eepp/helper/SDL2/src/joystick/darwin/SDL_sysjoystick.c b/src/eepp/helper/SDL2/src/joystick/darwin/SDL_sysjoystick.c index abba9307d..97f0e393b 100644 --- a/src/eepp/helper/SDL2/src/joystick/darwin/SDL_sysjoystick.c +++ b/src/eepp/helper/SDL2/src/joystick/darwin/SDL_sysjoystick.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -64,6 +64,7 @@ static recDevice *gpDeviceList = NULL; IONotificationPortRef notificationPort = 0; /* if 1 then a device was added since the last update call */ static SDL_bool s_bDeviceAdded = SDL_FALSE; +static SDL_bool s_bDeviceRemoved = SDL_FALSE; /* static incrementing counter for new joystick devices seen on the system. Devices should start with index 0 */ static int s_joystick_instance_id = -1; @@ -126,6 +127,7 @@ HIDRemovalCallback(void *target, IOReturn result, void *refcon, void *sender) { recDevice *device = (recDevice *) refcon; device->removed = 1; + s_bDeviceRemoved = SDL_TRUE; } @@ -135,14 +137,15 @@ void JoystickDeviceWasRemovedCallback( void * refcon, io_service_t service, natu { if( messageType == kIOMessageServiceIsTerminated && refcon ) { - recDevice *device = (recDevice *) refcon; - device->removed = 1; - } + recDevice *device = (recDevice *) refcon; + device->removed = 1; + s_bDeviceRemoved = SDL_TRUE; + } } /* Create and open an interface to device, required prior to extracting values or building queues. - * Note: appliction now owns the device and must close and release it prior to exiting + * Note: application now owns the device and must close and release it prior to exiting */ static IOReturn @@ -169,7 +172,7 @@ HIDCreateOpenDeviceInterface(io_object_t hidDevice, recDevice * pDevice) &(pDevice->interface)); if (S_OK != plugInResult) HIDReportErrorNum - ("CouldnÕt query HID class device interface from plugInInterface", + ("Couldn't query HID class device interface from plugInInterface", plugInResult); (*ppPlugInInterface)->Release(ppPlugInInterface); } else @@ -183,39 +186,39 @@ 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; } -/* Closes and releases interface to device, should be done prior to exting application +/* Closes and releases interface to device, should be done prior to exiting application * Note: will have no affect if device or interface do not exist * application will "own" the device if interface is not closed * (device may have to be plug and re-plugged in different location to get it working again without a restart) @@ -240,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; } @@ -269,36 +272,36 @@ HIDGetElementInfo(CFTypeRef refElement, recElement * pElement) if (refType && CFNumberGetValue(refType, kCFNumberLongType, &number)) pElement->maxReport = pElement->max = number; /* - TODO: maybe should handle the following stuff somehow? + 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); + 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); */ } -/* examines CF dictionary vlaue in device element hierarchy to determine if it is element of interest or a collection of more elements +/* examines CF dictionary value in device element hierarchy to determine if it is element of interest or a collection of more elements * if element of interest allocate storage, add to list and retrieve element specific info * if collection then pass on to deconstruction collection into additional individual elements */ @@ -396,7 +399,7 @@ HIDAddElement(CFTypeRef refElement, recDevice * pDevice) } } -/* collects information from each array member in device element list (each array memeber = element) */ +/* collects information from each array member in device element list (each array member = element) */ static void HIDGetElementsCFArrayHandler(const void *value, void *parameter) @@ -461,100 +464,94 @@ HIDGetDeviceInfo(io_object_t hidDevice, CFMutableDictionaryRef hidProperties, io_registry_entry_t parent1, parent2; /* Mac OS X currently is not mirroring all USB properties to HID page so need to look at USB device page also - * get dictionary for usb properties: step up two levels and get CF dictionary for USB properties + * get dictionary for USB properties: step up two levels and get CF dictionary for USB properties */ - if ((KERN_SUCCESS == - IORegistryEntryGetParentEntry(hidDevice, kIOServicePlane, &parent1)) - && (KERN_SUCCESS == - IORegistryEntryGetParentEntry(parent1, kIOServicePlane, &parent2)) - && (KERN_SUCCESS == - IORegistryEntryCreateCFProperties(parent2, &usbProperties, - kCFAllocatorDefault, - kNilOptions))) { + if ((KERN_SUCCESS == IORegistryEntryGetParentEntry(hidDevice, kIOServicePlane, &parent1)) + && (KERN_SUCCESS == IORegistryEntryGetParentEntry(parent1, kIOServicePlane, &parent2)) + && (KERN_SUCCESS == IORegistryEntryCreateCFProperties(parent2, &usbProperties, kCFAllocatorDefault, kNilOptions))) { if (usbProperties) { CFTypeRef refCF = 0; /* get device info * try hid dictionary first, if fail then go to usb dictionary */ - /* get product name */ - refCF = - CFDictionaryGetValue(hidProperties, CFSTR(kIOHIDProductKey)); - if (!refCF) - refCF = - CFDictionaryGetValue(usbProperties, - CFSTR("USB Product Name")); + refCF = CFDictionaryGetValue(hidProperties, CFSTR(kIOHIDProductKey)); + if (!refCF) { + refCF = CFDictionaryGetValue(usbProperties, CFSTR("USB Product Name")); + } if (refCF) { - if (!CFStringGetCString - (refCF, pDevice->product, 256, - CFStringGetSystemEncoding())) - SDL_SetError - ("CFStringGetCString error retrieving pDevice->product."); + if (!CFStringGetCString(refCF, pDevice->product, 256, CFStringGetSystemEncoding())) { + SDL_SetError("CFStringGetCString error retrieving pDevice->product."); + } } /* get usage page and usage */ - refCF = - CFDictionaryGetValue(hidProperties, - CFSTR(kIOHIDPrimaryUsagePageKey)); + refCF = CFDictionaryGetValue(hidProperties, CFSTR(kIOHIDPrimaryUsagePageKey)); if (refCF) { - if (!CFNumberGetValue - (refCF, kCFNumberLongType, &pDevice->usagePage)) - SDL_SetError - ("CFNumberGetValue error retrieving pDevice->usagePage."); - refCF = - CFDictionaryGetValue(hidProperties, - CFSTR(kIOHIDPrimaryUsageKey)); - if (refCF) - if (!CFNumberGetValue - (refCF, kCFNumberLongType, &pDevice->usage)) - SDL_SetError - ("CFNumberGetValue error retrieving pDevice->usage."); + if (!CFNumberGetValue (refCF, kCFNumberLongType, &pDevice->usagePage)) { + SDL_SetError("CFNumberGetValue error retrieving pDevice->usagePage."); + } + + refCF = CFDictionaryGetValue(hidProperties, CFSTR(kIOHIDPrimaryUsageKey)); + if (refCF) { + if (!CFNumberGetValue (refCF, kCFNumberLongType, &pDevice->usage)) { + SDL_SetError("CFNumberGetValue error retrieving pDevice->usage."); + } + } } - 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."); - } - refCF = - CFDictionaryGetValue(hidProperties, - CFSTR(kIOHIDProductIDKey)); - if (refCF) { - if (!CFNumberGetValue - (refCF, kCFNumberLongType, &pDevice->guid.data[8])) - SDL_SetError - ("CFNumberGetValue error retrieving pDevice->guid[8]."); + if (!CFNumberGetValue(refCF, kCFNumberLongType, &pDevice->guid.data[0])) { + SDL_SetError("CFNumberGetValue error retrieving pDevice->guid[0]"); + } } - - if (NULL == refCF) { /* get top level element HID usage page or usage */ + refCF = CFDictionaryGetValue(hidProperties, CFSTR(kIOHIDProductIDKey)); + if (refCF) { + if (!CFNumberGetValue(refCF, kCFNumberLongType, &pDevice->guid.data[8])) { + SDL_SetError("CFNumberGetValue error retrieving pDevice->guid[8]"); + } + } + + /* Check to make sure we have a vendor and product ID + If we don't, use the same algorithm as the Linux code for Bluetooth devices */ + { + Uint32 *guid32 = (Uint32*)pDevice->guid.data; + if (!guid32[0] && !guid32[1]) { + const Uint16 BUS_BLUETOOTH = 0x05; + Uint16 *guid16 = (Uint16 *)guid32; + *guid16++ = BUS_BLUETOOTH; + *guid16++ = 0; + SDL_strlcpy((char*)guid16, pDevice->product, sizeof(pDevice->guid.data) - 4); + } + } + + /* If we don't have a vendor and product ID this is probably a Bluetooth device */ + + if (NULL == refCF) { /* get top level element HID usage page or usage */ /* use top level element instead */ CFTypeRef refCFTopElement = 0; - refCFTopElement = - CFDictionaryGetValue(hidProperties, - CFSTR(kIOHIDElementKey)); + refCFTopElement = CFDictionaryGetValue(hidProperties, CFSTR(kIOHIDElementKey)); { /* refCFTopElement points to an array of element dictionaries */ CFRange range = { 0, CFArrayGetCount(refCFTopElement) }; - CFArrayApplyFunction(refCFTopElement, range, - HIDTopLevelElementHandler, pDevice); + CFArrayApplyFunction(refCFTopElement, range, HIDTopLevelElementHandler, pDevice); } } CFRelease(usbProperties); - } else - SDL_SetError - ("IORegistryEntryCreateCFProperties failed to create usbProperties."); + } else { + SDL_SetError("IORegistryEntryCreateCFProperties failed to create usbProperties."); + } - if (kIOReturnSuccess != IOObjectRelease(parent2)) - SDL_SetError("IOObjectRelease error with parent2."); - if (kIOReturnSuccess != IOObjectRelease(parent1)) - SDL_SetError("IOObjectRelease error with parent1."); + if (kIOReturnSuccess != IOObjectRelease(parent2)) { + SDL_SetError("IOObjectRelease error with parent2"); + } + if (kIOReturnSuccess != IOObjectRelease(parent1)) { + SDL_SetError("IOObjectRelease error with parent1"); + } } } @@ -576,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; @@ -643,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; } @@ -703,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. @@ -727,17 +724,15 @@ 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) { - SDL_SetError("Joystick: Device list already inited."); - return -1; + return SDL_SetError("Joystick: Device list already inited."); } result = IOMasterPort(bootstrap_port, &masterPort); if (kIOReturnSuccess != result) { - SDL_SetError("Joystick: IOMasterPort error with bootstrap_port."); - return -1; + return SDL_SetError("Joystick: IOMasterPort error with bootstrap_port."); } /* Set up a matching dictionary to search I/O Registry by class name for all HID class devices. */ @@ -756,9 +751,8 @@ SDL_SYS_JoystickInit(void) CFDictionarySetValue (hidMatchDictionary, CFSTR (kIOHIDPrimaryUsagePageKey), refUsagePage); */ } else { - SDL_SetError + return SDL_SetError ("Joystick: Failed to get HID CFMutableDictionaryRef via IOServiceMatching."); - return -1; } /*/ Now search I/O Registry for matching devices. */ @@ -767,8 +761,7 @@ SDL_SYS_JoystickInit(void) &hidObjectIterator); /* Check for errors */ if (kIOReturnSuccess != result) { - SDL_SetError("Joystick: Couldn't create a HID object iterator."); - return -1; + return SDL_SetError("Joystick: Couldn't create a HID object iterator."); } if (!hidObjectIterator) { /* there are no joysticks */ gpDeviceList = NULL; @@ -781,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(); } @@ -809,16 +802,17 @@ SDL_SYS_JoystickInit(void) int SDL_SYS_NumJoysticks() { - recDevice *device = gpDeviceList; + recDevice *device = gpDeviceList; int nJoySticks = 0; - - while ( device ) - { - nJoySticks++; - device = device->pNext; - } - return nJoySticks; + while ( device ) + { + if ( !device->removed ) + nJoySticks++; + device = device->pNext; + } + + return nJoySticks; } /* Function to cause any queued joystick insertions to be processed @@ -826,40 +820,81 @@ SDL_SYS_NumJoysticks() void SDL_SYS_JoystickDetect() { - if ( s_bDeviceAdded ) - { - recDevice *device = gpDeviceList; - s_bDeviceAdded = 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 */ - } - device_index++; - device = device->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_bool SDL_SYS_JoystickNeedsPolling() { - return s_bDeviceAdded; + return s_bDeviceAdded || s_bDeviceRemoved; } /* Function to get the device-dependent name of a joystick */ @@ -871,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 @@ -881,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. @@ -902,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; } @@ -919,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. @@ -940,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; } @@ -1064,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 */ @@ -1074,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; + } } @@ -1087,17 +1122,18 @@ 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 */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/eepp/helper/SDL2/src/joystick/darwin/SDL_sysjoystick_c.h b/src/eepp/helper/SDL2/src/joystick/darwin/SDL_sysjoystick_c.h index 897779674..f99dbd8af 100644 --- a/src/eepp/helper/SDL2/src/joystick/darwin/SDL_sysjoystick_c.h +++ b/src/eepp/helper/SDL2/src/joystick/darwin/SDL_sysjoystick_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -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 */ @@ -69,7 +69,7 @@ struct joystick_hwdata long axes; /* number of axis (calculated, not reported by device) */ long buttons; /* number of buttons (calculated, not reported by device) */ long hats; /* number of hat switches (calculated, not reported by device) */ - long elements; /* number of total elements (shouldbe total of above) (calculated, not reported by device) */ + long elements; /* number of total elements (should be total of above) (calculated, not reported by device) */ recElement *firstAxis; recElement *firstButton; @@ -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/eepp/helper/SDL2/src/joystick/dummy/SDL_sysjoystick.c b/src/eepp/helper/SDL2/src/joystick/dummy/SDL_sysjoystick.c index 1bcf1ce93..7dd9153b2 100644 --- a/src/eepp/helper/SDL2/src/joystick/dummy/SDL_sysjoystick.c +++ b/src/eepp/helper/SDL2/src/joystick/dummy/SDL_sysjoystick.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -73,8 +73,7 @@ SDL_JoystickID SDL_SYS_GetInstanceIdOfDeviceIndex(int device_index) int SDL_SYS_JoystickOpen(SDL_Joystick * joystick, int device_index) { - SDL_SetError("Logic error: No joysticks available"); - return (-1); + return SDL_SetError("Logic error: No joysticks available"); } /* Function to determine is this joystick is attached to the system right now */ @@ -111,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 ) ) ); @@ -122,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/eepp/helper/SDL2/src/joystick/iphoneos/SDLUIAccelerationDelegate.h b/src/eepp/helper/SDL2/src/joystick/iphoneos/SDLUIAccelerationDelegate.h index 18cfd472e..733357b49 100644 --- a/src/eepp/helper/SDL2/src/joystick/iphoneos/SDLUIAccelerationDelegate.h +++ b/src/eepp/helper/SDL2/src/joystick/iphoneos/SDLUIAccelerationDelegate.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/joystick/iphoneos/SDLUIAccelerationDelegate.m b/src/eepp/helper/SDL2/src/joystick/iphoneos/SDLUIAccelerationDelegate.m index c203b0025..0037c585b 100644 --- a/src/eepp/helper/SDL2/src/joystick/iphoneos/SDLUIAccelerationDelegate.m +++ b/src/eepp/helper/SDL2/src/joystick/iphoneos/SDLUIAccelerationDelegate.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -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 + #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; + /* 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/eepp/helper/SDL2/src/joystick/iphoneos/SDL_sysjoystick.m b/src/eepp/helper/SDL2/src/joystick/iphoneos/SDL_sysjoystick.m index 291e96a1d..231c851cf 100644 --- a/src/eepp/helper/SDL2/src/joystick/iphoneos/SDL_sysjoystick.m +++ b/src/eepp/helper/SDL2/src/joystick/iphoneos/SDL_sysjoystick.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -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,25 +118,22 @@ 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"); - - return; + if ([[SDLUIAccelerationDelegate sharedDelegate] isRunning]) { + [[SDLUIAccelerationDelegate sharedDelegate] shutdown]; + } + SDL_SetError("No joystick open with that index"); } /* Function to perform any system-specific joystick related cleanup */ void SDL_SYS_JoystickQuit(void) { - return; } 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 ) ) ); @@ -146,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/eepp/helper/SDL2/src/joystick/linux/SDL_sysjoystick.c b/src/eepp/helper/SDL2/src/joystick/linux/SDL_sysjoystick.c index b09cbe95a..8582838a7 100644 --- a/src/eepp/helper/SDL2/src/joystick/linux/SDL_sysjoystick.c +++ b/src/eepp/helper/SDL2/src/joystick/linux/SDL_sysjoystick.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -47,6 +47,11 @@ #include "../../events/SDL_events_c.h" #endif +/* This isn't defined in older Linux kernel headers */ +#ifndef SYN_DROPPED +#define SYN_DROPPED 3 +#endif + /* * !!! FIXME: move all the udev stuff to src/core/linux, so I can reuse it * !!! FIXME: for audio hardware disconnects. @@ -57,11 +62,10 @@ #include #include #include -#include /* we never link directly to libudev. */ /* !!! FIXME: can we generalize this? ALSA, etc, do the same things. */ -static const char *udev_library = "libudev.so"; +static const char *udev_library = "libudev.so.0"; static void *udev_handle = NULL; /* !!! FIXME: this is kinda ugly. */ @@ -217,16 +221,27 @@ IsJoystick(int fd, char *namebuf, const size_t namebuflen, SDL_JoystickGUID *gui return 0; } +#ifdef DEBUG_JOYSTICK + printf("Joystick: %s, bustype = %d, vendor = 0x%x, product = 0x%x, version = %d\n", namebuf, inpid.bustype, inpid.vendor, inpid.product, inpid.version); +#endif + + SDL_memset(guid->data, 0, sizeof(guid->data)); + /* We only need 16 bits for each of these; space them out to fill 128. */ /* Byteswap so devices get same GUID on little/big endian platforms. */ *(guid16++) = SDL_SwapLE16(inpid.bustype); *(guid16++) = 0; - *(guid16++) = SDL_SwapLE16(inpid.vendor); - *(guid16++) = 0; - *(guid16++) = SDL_SwapLE16(inpid.product); - *(guid16++) = 0; - *(guid16++) = SDL_SwapLE16(inpid.version); - *(guid16++) = 0; + + if (inpid.vendor && inpid.product && inpid.version) { + *(guid16++) = SDL_SwapLE16(inpid.vendor); + *(guid16++) = 0; + *(guid16++) = SDL_SwapLE16(inpid.product); + *(guid16++) = 0; + *(guid16++) = SDL_SwapLE16(inpid.version); + *(guid16++) = 0; + } else { + SDL_strlcpy((char*)guid16, namebuf, sizeof(guid->data) - 4); + } return 1; } @@ -319,17 +334,16 @@ MaybeRemoveDevice(const char *path) if (SDL_strcmp(path, item->path) == 0) { const int retval = item->device_instance; if (item->hwdata) { - item->hwdata->removed = SDL_TRUE; + item->hwdata->item = NULL; } if (prev != NULL) { prev->next = item->next; - if (item == SDL_joylist_tail) { - SDL_joylist_tail = prev; - } } else { - SDL_assert(!SDL_joylist); - SDL_assert(!SDL_joylist_tail); - SDL_joylist = SDL_joylist_tail = NULL; + SDL_assert(SDL_joylist == item); + SDL_joylist = item->next; + } + if (item == SDL_joylist_tail) { + SDL_joylist_tail = prev; } SDL_free(item->path); SDL_free(item->name); @@ -373,8 +387,7 @@ JoystickInitWithUdev(void) SDL_assert(udev == NULL); udev = UDEV_udev_new(); if (udev == NULL) { - SDL_SetError("udev_new() failed"); - return -1; + return SDL_SetError("udev_new() failed"); } udev_mon = UDEV_udev_monitor_new_from_netlink(udev, "udev"); @@ -386,8 +399,7 @@ JoystickInitWithUdev(void) enumerate = UDEV_udev_enumerate_new(udev); if (enumerate == NULL) { - SDL_SetError("udev_enumerate_new() failed"); - return -1; + return SDL_SetError("udev_enumerate_new() failed"); } UDEV_udev_enumerate_add_match_subsystem(enumerate, "input"); @@ -498,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); @@ -515,7 +527,7 @@ void SDL_SYS_JoystickDetect() SDL_PushEvent(&event); } } - #endif // !SDL_EVENTS_DISABLED + #endif /* !SDL_EVENTS_DISABLED */ } } UDEV_udev_device_unref(dev); @@ -657,13 +669,13 @@ ConfigJoystick(SDL_Joystick * joystick, int fd) } else { joystick->hwdata->abs_correct[i].used = 1; joystick->hwdata->abs_correct[i].coef[0] = - (absinfo.maximum + absinfo.minimum) / 2 - absinfo.flat; + (absinfo.maximum + absinfo.minimum) - 2 * absinfo.flat; joystick->hwdata->abs_correct[i].coef[1] = - (absinfo.maximum + absinfo.minimum) / 2 + absinfo.flat; - t = ((absinfo.maximum - absinfo.minimum) / 2 - 2 * absinfo.flat); + (absinfo.maximum + absinfo.minimum) + 2 * absinfo.flat; + t = ((absinfo.maximum - absinfo.minimum) - 4 * absinfo.flat); if (t != 0) { joystick->hwdata->abs_correct[i].coef[2] = - (1 << 29) / t; + (1 << 28) / t; } else { joystick->hwdata->abs_correct[i].coef[2] = 0; } @@ -711,28 +723,24 @@ SDL_SYS_JoystickOpen(SDL_Joystick * joystick, int device_index) int fd = -1; if (item == NULL) { - SDL_SetError("No such device"); - return -1; + return SDL_SetError("No such device"); } fname = item->path; fd = open(fname, O_RDONLY, 0); if (fd < 0) { - SDL_SetError("Unable to open %s", fname); - return -1; + return SDL_SetError("Unable to open %s", fname); } - joystick->instance_id = device_index; + joystick->instance_id = item->device_instance; joystick->hwdata = (struct joystick_hwdata *) SDL_malloc(sizeof(*joystick->hwdata)); if (joystick->hwdata == NULL) { close(fd); - SDL_OutOfMemory(); - return (-1); + return SDL_OutOfMemory(); } SDL_memset(joystick->hwdata, 0, sizeof(*joystick->hwdata)); - joystick->hwdata->removed = SDL_FALSE; - joystick->hwdata->device_instance = item->device_instance; + joystick->hwdata->item = item; joystick->hwdata->guid = item->guid; joystick->hwdata->fd = fd; joystick->hwdata->fname = SDL_strdup(item->path); @@ -740,8 +748,7 @@ SDL_SYS_JoystickOpen(SDL_Joystick * joystick, int device_index) SDL_free(joystick->hwdata); joystick->hwdata = NULL; close(fd); - SDL_OutOfMemory(); - return (-1); + return SDL_OutOfMemory(); } SDL_assert(item->hwdata == NULL); @@ -753,13 +760,16 @@ 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 */ + joystick->hwdata->fresh = 1; + return (0); } /* Function to determine is this joystick is attached to the system right now */ SDL_bool SDL_SYS_JoystickAttached(SDL_Joystick *joystick) { - return !joystick->closed && !joystick->hwdata->removed; + return !joystick->closed && (joystick->hwdata->item != NULL); } static __inline__ void @@ -802,6 +812,7 @@ AxisCorrect(SDL_Joystick * joystick, int which, int value) correct = &joystick->hwdata->abs_correct[which]; if (correct->used) { + value *= 2; if (value > correct->coef[0]) { if (value < correct->coef[1]) { return 0; @@ -811,7 +822,7 @@ AxisCorrect(SDL_Joystick * joystick, int which, int value) value -= correct->coef[0]; } value *= correct->coef[2]; - value >>= 14; + value >>= 13; } /* Clamp and return */ @@ -823,6 +834,44 @@ AxisCorrect(SDL_Joystick * joystick, int which, int value) return value; } +static __inline__ void +PollAllValues(SDL_Joystick * joystick) +{ + struct input_absinfo absinfo; + int a, b = 0; + + /* Poll all axis */ + for (a = ABS_X; b < ABS_MAX; a++) { + switch (a) { + case ABS_HAT0X: + case ABS_HAT0Y: + case ABS_HAT1X: + case ABS_HAT1Y: + case ABS_HAT2X: + case ABS_HAT2Y: + case ABS_HAT3X: + case ABS_HAT3Y: + /* ingore hats */ + break; + default: + if (joystick->hwdata->abs_correct[b].used) { + if (ioctl(joystick->hwdata->fd, EVIOCGABS(a), &absinfo) >= 0) { + absinfo.value = AxisCorrect(joystick, b, absinfo.value); + +#ifdef DEBUG_INPUT_EVENTS + printf("Joystick : Re-read Axis %d (%d) val= %d\n", + joystick->hwdata->abs_map[b], a, absinfo.value); +#endif + SDL_PrivateJoystickAxis(joystick, + joystick->hwdata->abs_map[b], + absinfo.value); + } + } + b++; + } + } +} + static __inline__ void HandleInputEvents(SDL_Joystick * joystick) { @@ -830,6 +879,11 @@ HandleInputEvents(SDL_Joystick * joystick) int i, len; int code; + if (joystick->hwdata->fresh) { + PollAllValues(joystick); + joystick->hwdata->fresh = 0; + } + while ((len = read(joystick->hwdata->fd, events, (sizeof events))) > 0) { len /= sizeof(events[0]); for (i = 0; i < len; ++i) { @@ -880,6 +934,17 @@ HandleInputEvents(SDL_Joystick * joystick) break; } break; + case EV_SYN: + switch (code) { + case SYN_DROPPED : +#ifdef DEBUG_INPUT_EVENTS + printf("Event SYN_DROPPED detected\n"); +#endif + PollAllValues(joystick); + break; + default: + break; + } default: break; } @@ -914,6 +979,9 @@ SDL_SYS_JoystickClose(SDL_Joystick * joystick) { if (joystick->hwdata) { close(joystick->hwdata->fd); + if (joystick->hwdata->item) { + joystick->hwdata->item->hwdata = NULL; + } SDL_free(joystick->hwdata->hats); SDL_free(joystick->hwdata->balls); SDL_free(joystick->hwdata->fname); diff --git a/src/eepp/helper/SDL2/src/joystick/linux/SDL_sysjoystick_c.h b/src/eepp/helper/SDL2/src/joystick/linux/SDL_sysjoystick_c.h index 90dcfe4de..4e942b54c 100644 --- a/src/eepp/helper/SDL2/src/joystick/linux/SDL_sysjoystick_c.h +++ b/src/eepp/helper/SDL2/src/joystick/linux/SDL_sysjoystick_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,22 +21,22 @@ #include +struct SDL_joylist_item; + /* The private structure used to keep track of a joystick */ struct joystick_hwdata { int fd; - int device_instance; - SDL_bool removed; - + struct SDL_joylist_item *item; SDL_JoystickGUID guid; char *fname; /* Used in haptic subsystem */ - /* The current linux joystick driver maps hats to two axes */ + /* The current Linux joystick driver maps hats to two axes */ struct hwdata_hat { int axis[2]; } *hats; - /* The current linux joystick driver maps balls to two axes */ + /* The current Linux joystick driver maps balls to two axes */ struct hwdata_ball { int axis[2]; @@ -50,4 +50,8 @@ struct joystick_hwdata int used; int coef[3]; } abs_correct[ABS_MAX]; + + int fresh; }; + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/eepp/helper/SDL2/src/joystick/nds/SDL_sysjoystick.c b/src/eepp/helper/SDL2/src/joystick/nds/SDL_sysjoystick.c deleted file mode 100644 index a304473fb..000000000 --- a/src/eepp/helper/SDL2/src/joystick/nds/SDL_sysjoystick.c +++ /dev/null @@ -1,209 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga - - 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 - appreciated but is not required. - 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. -*/ - -#include "SDL_config.h" - -#ifdef SDL_JOYSTICK_NDS - -/* This is the system specific header for the SDL joystick API */ -#include -#include /* For the definition of NULL */ - -#include "SDL_error.h" -#include "SDL_events.h" -#include "SDL_joystick.h" -#include "../SDL_sysjoystick.h" -#include "../SDL_joystick_c.h" - -#include "../../video/nds/SDL_ndsevents_c.h" - -/* Function to scan the system for joysticks. - */ -int -SDL_SYS_JoystickInit(void) -{ - return (1); -} - -int SDL_SYS_NumJoysticks() -{ - return 1; -} - -void SDL_SYS_JoystickDetect() -{ -} - -SDL_bool SDL_SYS_JoystickNeedsPolling() -{ - return SDL_FALSE; -} - -/* Function to get the device-dependent name of a joystick */ -const char * -SDL_SYS_JoystickNameForDeviceIndex(int device_index) -{ - return "NDS builtin joypad"; -} - -/* Function to perform the mapping from device index to the instance id for this index */ -SDL_JoystickID SDL_SYS_GetInstanceIdOfDeviceIndex(int device_index) -{ - return device_index; -} - -/* Function to open a joystick for use. - The joystick to open is specified by the index field of the joystick. - This should fill the nbuttons and naxes fields of the joystick structure. - It returns 0, or -1 if there is an error. - */ -int -SDL_SYS_JoystickOpen(SDL_Joystick * joystick, int device_index) -{ - joystick->nbuttons = 8; - joystick->nhats = 0; - joystick->nballs = 0; - joystick->naxes = 2; - return 0; -} - -/* Function to determine is this joystick is attached to the system right now */ -SDL_bool SDL_SYS_JoystickAttached(SDL_Joystick *joystick) -{ - return SDL_TRUE; -} - -/* Function to update the state of a joystick - called as a device poll. - * This function shouldn't update the joystick structure directly, - * but instead should call SDL_PrivateJoystick*() to deliver events - * and update joystick device state. - */ - void -SDL_SYS_JoystickUpdate(SDL_Joystick * joystick) -{ - u32 keysd, keysu; - int magnitude = 16384; - - /*scanKeys(); - this is done in PumpEvents, because touch uses it too */ - keysd = keysDown(); - keysu = keysUp(); - - if ((keysd & KEY_UP)) { - SDL_PrivateJoystickAxis(joystick, 1, -magnitude); - } - if ((keysd & KEY_DOWN)) { - SDL_PrivateJoystickAxis(joystick, 1, magnitude); - } - if ((keysd & KEY_LEFT)) { - SDL_PrivateJoystickAxis(joystick, 0, -magnitude); - } - if ((keysd & KEY_RIGHT)) { - SDL_PrivateJoystickAxis(joystick, 0, magnitude); - } - if ((keysu & (KEY_UP | KEY_DOWN))) { - SDL_PrivateJoystickAxis(joystick, 1, 0); - } - if ((keysu & (KEY_LEFT | KEY_RIGHT))) { - SDL_PrivateJoystickAxis(joystick, 0, 0); - } - if ((keysd & KEY_A)) { - SDL_PrivateJoystickButton(joystick, 0, SDL_PRESSED); - } - if ((keysd & KEY_B)) { - SDL_PrivateJoystickButton(joystick, 1, SDL_PRESSED); - } - if ((keysd & KEY_X)) { - SDL_PrivateJoystickButton(joystick, 2, SDL_PRESSED); - } - if ((keysd & KEY_Y)) { - SDL_PrivateJoystickButton(joystick, 3, SDL_PRESSED); - } - if ((keysd & KEY_L)) { - SDL_PrivateJoystickButton(joystick, 4, SDL_PRESSED); - } - if ((keysd & KEY_R)) { - SDL_PrivateJoystickButton(joystick, 5, SDL_PRESSED); - } - if ((keysd & KEY_SELECT)) { - SDL_PrivateJoystickButton(joystick, 6, SDL_PRESSED); - } - if ((keysd & KEY_START)) { - SDL_PrivateJoystickButton(joystick, 7, SDL_PRESSED); - } - if ((keysu & KEY_A)) { - SDL_PrivateJoystickButton(joystick, 0, SDL_RELEASED); - } - if ((keysu & KEY_B)) { - SDL_PrivateJoystickButton(joystick, 1, SDL_RELEASED); - } - if ((keysu & KEY_X)) { - SDL_PrivateJoystickButton(joystick, 2, SDL_RELEASED); - } - if ((keysu & KEY_Y)) { - SDL_PrivateJoystickButton(joystick, 3, SDL_RELEASED); - } - if ((keysu & KEY_L)) { - SDL_PrivateJoystickButton(joystick, 4, SDL_RELEASED); - } - if ((keysu & KEY_R)) { - SDL_PrivateJoystickButton(joystick, 5, SDL_RELEASED); - } - if ((keysu & KEY_SELECT)) { - SDL_PrivateJoystickButton(joystick, 6, SDL_RELEASED); - } - if ((keysu & KEY_START)) { - SDL_PrivateJoystickButton(joystick, 7, SDL_RELEASED); - } -} - -/* Function to close a joystick after use */ -void -SDL_SYS_JoystickClose(SDL_Joystick * joystick) -{ -} - -/* Function to perform any system-specific joystick related cleanup */ -void -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 - const char *name = SDL_SYS_JoystickNameForDeviceIndex( device_index ); - SDL_zero( guid ); - SDL_memcpy( &guid, name, SDL_min( sizeof(guid), SDL_strlen( name ) ) ); - return guid; -} - -SDL_JoystickGUID SDL_SYS_JoystickGetGUID(SDL_Joystick * joystick) -{ - SDL_JoystickGUID guid; - // 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 ) ) ); - return guid; -} - -#endif /* SDL_JOYSTICK_NDS */ diff --git a/src/eepp/helper/SDL2/src/joystick/psp/SDL_sysjoystick.c b/src/eepp/helper/SDL2/src/joystick/psp/SDL_sysjoystick.c new file mode 100644 index 000000000..d6ca6989e --- /dev/null +++ b/src/eepp/helper/SDL2/src/joystick/psp/SDL_sysjoystick.c @@ -0,0 +1,274 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2013 Sam Lantinga + + 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 + appreciated but is not required. + 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. +*/ + +/* This is the system specific header for the SDL joystick API */ +#include +#include + +#include /* For the definition of NULL */ +#include + +#include "../SDL_sysjoystick.h" +#include "../SDL_joystick_c.h" + +#include "SDL_events.h" +#include "SDL_error.h" +#include "SDL_thread.h" +#include "SDL_mutex.h" +#include "SDL_timer.h" + +/* Current pad state */ +static SceCtrlData pad = { .Lx = 0, .Ly = 0, .Buttons = 0 }; +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 }; +static int analog_map[256]; /* Map analog inputs to -32768 -> 32767 */ + +typedef struct +{ + int x; + int y; +} point; + +/* 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 */ +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; +} + +/* 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; +} + +/* + * Collect pad data about once per frame + */ +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; +} + + + +/* Function to scan the system for joysticks. + * This function should set SDL_numjoysticks to the number of available + * joysticks. Joystick 0 should be the system default joystick. + * It should return number of joysticks, or -1 on an unrecoverable fatal error. + */ +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 SDL_SYS_NumJoysticks() +{ + return 1; +} + +void SDL_SYS_JoystickDetect() +{ +} + +SDL_bool SDL_SYS_JoystickNeedsPolling() +{ + return SDL_FALSE; +} + +/* Function to get the device-dependent name of a joystick */ +const char * SDL_SYS_JoystickNameForDeviceIndex(int device_index) +{ + return "PSP builtin joypad"; +} + +/* Function to perform the mapping from device index to the instance id for this index */ +SDL_JoystickID SDL_SYS_GetInstanceIdOfDeviceIndex(int device_index) +{ + return 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"; + + SDL_SetError("No joystick available with that index"); + return(NULL); +} + +/* Function to open a joystick for use. + The joystick to open is specified by the index field of the joystick. + This should fill the nbuttons and naxes fields of the joystick structure. + It returns 0, or -1 if there is an error. + */ +int SDL_SYS_JoystickOpen(SDL_Joystick *joystick, int device_index) +{ + joystick->nbuttons = 14; + joystick->naxes = 2; + joystick->nhats = 0; + + return 0; +} + +/* Function to determine is this joystick is attached to the system right now */ +SDL_bool SDL_SYS_JoystickAttached(SDL_Joystick *joystick) +{ + return SDL_TRUE; +} +/* Function to update the state of a joystick - called as a device poll. + * This function shouldn't update the joystick structure directly, + * but instead should call SDL_PrivateJoystick*() to deliver events + * and update joystick device state. + */ + +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; iname; + SDL_zero( guid ); + SDL_memcpy( &guid, name, SDL_min( sizeof(guid), SDL_strlen( name ) ) ); + return guid; +} + +/* vim: ts=4 sw=4 + */ diff --git a/src/eepp/helper/SDL2/src/joystick/windows/SDL_dxjoystick.c b/src/eepp/helper/SDL2/src/joystick/windows/SDL_dxjoystick.c index f63bdc41d..48d4272c1 100644 --- a/src/eepp/helper/SDL2/src/joystick/windows/SDL_dxjoystick.c +++ b/src/eepp/helper/SDL2/src/joystick/windows/SDL_dxjoystick.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -23,16 +23,17 @@ #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 * let it return 0 events. */ #include "SDL_error.h" +#include "SDL_assert.h" #include "SDL_events.h" #include "SDL_joystick.h" #include "../SDL_sysjoystick.h" @@ -42,20 +43,21 @@ #include "SDL_timer.h" #include "SDL_mutex.h" #include "SDL_events.h" +#include "SDL_hints.h" #if !SDL_EVENTS_DISABLED #include "../../events/SDL_events_c.h" #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; @@ -66,65 +68,98 @@ static SDL_bool coinitialized = SDL_FALSE; static LPDIRECTINPUT8 dinput = NULL; static SDL_bool s_bDeviceAdded = SDL_FALSE; static SDL_bool s_bDeviceRemoved = SDL_FALSE; -static int s_nInstanceID = -1; +static SDL_JoystickID s_nInstanceID = -1; static GUID *s_pKnownJoystickGUIDs = NULL; static SDL_cond *s_condJoystickThread = NULL; static SDL_mutex *s_mutexJoyStickEnum = NULL; static SDL_Thread *s_threadJoystick = NULL; static SDL_bool s_bJoystickThreadQuit = SDL_FALSE; +static SDL_bool s_bXInputEnabled = SDL_TRUE; + +XInputGetState_t SDL_XInputGetState = NULL; +XInputSetState_t SDL_XInputSetState = NULL; +XInputGetCapabilities_t SDL_XInputGetCapabilities = NULL; +DWORD SDL_XInputVersion = 0; + static HANDLE s_pXInputDLL = 0; +static int s_XInputDLLRefCount = 0; + +int +WIN_LoadXInputDLL(void) +{ + DWORD version = 0; + + if (s_pXInputDLL) { + SDL_assert(s_XInputDLLRefCount > 0); + s_XInputDLLRefCount++; + return 0; /* already loaded */ + } + + version = (1 << 16) | 4; + 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. */ + } + if (!s_pXInputDLL) { + s_pXInputDLL = LoadLibrary( L"bin\\XInput1_3.dll" ); + } + if (!s_pXInputDLL) { + return -1; + } + + SDL_assert(s_XInputDLLRefCount == 0); + SDL_XInputVersion = version; + s_XInputDLLRefCount = 1; + + /* 100 is the ordinal for _XInputGetStateEx, which returns the same struct as XinputGetState, but with extra data in wButtons for the guide button, we think... */ + SDL_XInputGetState = (XInputGetState_t)GetProcAddress( (HMODULE)s_pXInputDLL, (LPCSTR)100 ); + SDL_XInputSetState = (XInputSetState_t)GetProcAddress( (HMODULE)s_pXInputDLL, "XInputSetState" ); + SDL_XInputGetCapabilities = (XInputGetCapabilities_t)GetProcAddress( (HMODULE)s_pXInputDLL, "XInputGetCapabilities" ); + if ( !SDL_XInputGetState || !SDL_XInputSetState || !SDL_XInputGetCapabilities ) { + WIN_UnloadXInputDLL(); + return -1; + } + + return 0; +} + +void +WIN_UnloadXInputDLL(void) +{ + if ( s_pXInputDLL ) { + SDL_assert(s_XInputDLLRefCount > 0); + if (--s_XInputDLLRefCount == 0) { + FreeLibrary( s_pXInputDLL ); + s_pXInputDLL = NULL; + } + } else { + SDL_assert(s_XInputDLLRefCount == 0); + } +} + extern HRESULT(WINAPI * DInputCreate) (HINSTANCE hinst, DWORD dwVersion, LPDIRECTINPUT * ppDI, LPUNKNOWN punkOuter); struct JoyStick_DeviceData_ { - SDL_JoystickGUID guid; - DIDEVICEINSTANCE dxdevice; - char *joystickname; - Uint8 send_add_event; - int 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; }; - -/* 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 - ); - -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 - ); - -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 - ); - -XInputGetState_t PC_XInputGetState; -XInputSetState_t PC_XInputSetState; -XInputGetCapabilities_t PC_XInputGetCapabilities; - -#define XINPUTGETSTATE PC_XInputGetState -#define XINPUTSETSTATE PC_XInputSetState -#define XINPUTGETCAPABILITIES PC_XInputGetCapabilities -#define INVALID_XINPUT_USERID 255 - typedef struct JoyStick_DeviceData_ JoyStick_DeviceData; static JoyStick_DeviceData *SYS_Joystick; /* array to hold joystick ID values */ /* local prototypes */ -static void SetDIerror(const char *function, HRESULT code); +static int SetDIerror(const char *function, HRESULT code); static BOOL CALLBACK EnumJoysticksCallback(const DIDEVICEINSTANCE * pdidInstance, VOID * pContext); static BOOL CALLBACK EnumDevObjectsCallback(LPCDIDEVICEOBJECTINSTANCE dev, @@ -138,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}, @@ -317,301 +352,304 @@ const DIDATAFORMAT c_dfDIJoystick2 = { /* Convert a DirectInput return code to a text message */ -static void +static int SetDIerror(const char *function, HRESULT code) { /* - SDL_SetError("%s() [%s]: %s", function, + return SDL_SetError("%s() [%s]: %s", function, DXGetErrorString9A(code), DXGetErrorDescription9A(code)); */ - SDL_SetError("%s() DirectX error %d", function, code); + return SDL_SetError("%s() DirectX error %d", function, 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); +#ifdef _MSC_VER +/* The Windows SDK doesn't define this GUID */ DEFINE_GUID(IID_IWbemLocator, 0xdc12a687,0x737f,0x11cf,0x88,0x4d,0x00,0xaa,0x00,0x4b,0x2e,0x24); +#endif /* _MSC_VER */ -//----------------------------------------------------------------------------- -// -// 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; - SDL_memset( pDevices, 0x0, sizeof(pDevices) ); + if (!s_bXInputEnabled) + { + return SDL_FALSE; + } - // CoInit if needed - hr = CoInitialize(NULL); - bCleanupCOM = SUCCEEDED(hr); + SDL_memset( pDevices, 0x0, sizeof(pDevices) ); - // Create WMI - hr = CoCreateInstance( &CLSID_WbemLocator, - NULL, - CLSCTX_INPROC_SERVER, - &IID_IWbemLocator, - (LPVOID*) &pIWbemLocator); - if( FAILED(hr) || pIWbemLocator == NULL ) - goto LCleanup; + /* CoInit if needed */ + hr = CoInitialize(NULL); + bCleanupCOM = SUCCEEDED(hr); - 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; + /* Create WMI */ + hr = CoCreateInstance( &CLSID_WbemLocator, + NULL, + CLSCTX_INPROC_SERVER, + &IID_IWbemLocator, + (LPVOID*) &pIWbemLocator); + if( FAILED(hr) || pIWbemLocator == 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 ); + 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; - hr = IWbemServices_CreateInstanceEnum( pIWbemServices, bstrClassName, 0, NULL, &pEnumDevices ); - if( FAILED(hr) || pEnumDevices == 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; - // 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; + /* 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 ); - for( iDevice=0; iDeviceData1 ) - { - bIsXinputDevice = SDL_TRUE; - } - } - if ( pDeviceString ) - SDL_free( pDeviceString ); + /* 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; iDeviceData1 ) + { + bIsXinputDevice = SDL_TRUE; + } + } + if ( pDeviceString ) + SDL_free( pDeviceString ); + + if ( bIsXinputDevice ) + break; + } + SAFE_RELEASE( pDevices[iDevice] ); + } + } - 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 ); + 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 ( bstrNamespace ) + SysFreeString( bstrNamespace ); + if ( bstrClassName ) + SysFreeString( bstrClassName ); + if ( bstrDeviceID ) + SysFreeString( bstrDeviceID ); - if( bCleanupCOM ) - CoUninitialize(); - - return bIsXinputDevice; + if( bCleanupCOM ) + CoUninitialize(); + + return bIsXinputDevice; } static SDL_bool s_bWindowsDeviceChanged = SDL_FALSE; -/* windowproc for our joystick detect thread message only window, to detect any usb device addition/removal +/* 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; - } + 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); + 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; + HWND messageWindow = 0; + HDEVNOTIFY hNotify = 0; + DEV_BROADCAST_DEVICEINTERFACE dbh; + SDL_bool bOpenedXInputDevices[4]; + WNDCLASSEX wincl; - SDL_memset( bOpenedXInputDevices, 0x0, sizeof(bOpenedXInputDevices) ); + SDL_memset( bOpenedXInputDevices, 0x0, sizeof(bOpenedXInputDevices) ); - result = WIN_CoInitialize(); + 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); + 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)) - { - SDL_SetError("Failed to create register class for joystick autodetect.", - GetLastError()); - return -1; - } + 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 ) - { - SDL_SetError("Failed to create message window for joystick autodetect.", - GetLastError()); - return -1; - } + 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)); + SDL_memset(&dbh, 0x0, sizeof(dbh)); - dbh.dbcc_size = sizeof(dbh); - dbh.dbcc_devicetype = DBT_DEVTYP_DEVICEINTERFACE; - dbh.dbcc_classguid = GUID_DEVINTERFACE_USB_DEVICE; + 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 ) - { - SDL_SetError("Failed to create notify device for joystick autodetect.", - GetLastError()); - return -1; - } + 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 ); + 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); - } - } + while ( s_bJoystickThreadQuit == SDL_FALSE && PeekMessage(&messages, messageWindow, 0, 0, PM_NOREMOVE) ) + { + if ( GetMessage(&messages, messageWindow, 0, 0) != 0 ) { + TranslateMessage(&messages); + DispatchMessage(&messages); + } + } - // scan for any change in XInput devices - for ( userId = 0; userId < 4; userId++ ) - { - XINPUT_CAPABILITIES capabilities; - DWORD result; + 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++; + 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; - } - } + 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 */ - 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 ); - s_bDeviceRemoved = SDL_TRUE; - s_bDeviceAdded = SDL_TRUE; - s_bWindowsDeviceChanged = SDL_FALSE; - } - } - SDL_UnlockMutex( s_mutexJoyStickEnum ); + if ( hNotify ) + UnregisterDeviceNotification( hNotify ); - if ( hNotify ) - UnregisterDeviceNotification( hNotify ); + if ( messageWindow ) + DestroyWindow( messageWindow ); - if ( messageWindow ) - DestroyWindow( messageWindow ); - - UnregisterClass( wincl.lpszClassName, wincl.hInstance ); - messageWindow = 0; - WIN_CoUninitialize(); - return 1; + UnregisterClass( wincl.lpszClassName, wincl.hInstance ); + messageWindow = 0; + WIN_CoUninitialize(); + return 1; } @@ -625,11 +663,14 @@ 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; + } result = WIN_CoInitialize(); if (FAILED(result)) { - SetDIerror("CoInitialize", result); - return (-1); + return SetDIerror("CoInitialize", result); } coinitialized = SDL_TRUE; @@ -639,275 +680,255 @@ SDL_SYS_JoystickInit(void) if (FAILED(result)) { SDL_SYS_JoystickQuit(); - SetDIerror("CoCreateInstance", result); - return (-1); + return SetDIerror("CoCreateInstance", result); } /* Because we used CoCreateInstance, we need to Initialize it, first. */ instance = GetModuleHandle(NULL); if (instance == NULL) { SDL_SYS_JoystickQuit(); - SDL_SetError("GetModuleHandle() failed with error code %d.", - GetLastError()); - return (-1); + return SDL_SetError("GetModuleHandle() failed with error code %d.", GetLastError()); } result = IDirectInput8_Initialize(dinput, instance, DIRECTINPUT_VERSION); if (FAILED(result)) { SDL_SYS_JoystickQuit(); - SetDIerror("IDirectInput::Initialize", result); - return (-1); + return SetDIerror("IDirectInput::Initialize", result); } - s_mutexJoyStickEnum = SDL_CreateMutex(); - s_condJoystickThread = SDL_CreateCond(); - s_bDeviceAdded = SDL_TRUE; // force a scan of the system for joysticks this first time - SDL_SYS_JoystickDetect(); + s_mutexJoyStickEnum = SDL_CreateMutex(); + s_condJoystickThread = SDL_CreateCond(); + s_bDeviceAdded = SDL_TRUE; /* force a scan of the system for joysticks this first time */ + SDL_SYS_JoystickDetect(); - // try to load XInput support if available - s_pXInputDLL = LoadLibrary( L"XInput1_3.dll" ); - if ( !s_pXInputDLL ) - s_pXInputDLL = LoadLibrary( L"bin\\XInput1_3.dll" ); - if ( s_pXInputDLL ) - { - // 100 is the ordinal for _XInputGetStateEx, which returns the same struct as XinputGetState, but with extra data in wButtons for the guide button, we think... - PC_XInputGetState = (XInputGetState_t)GetProcAddress( (HMODULE)s_pXInputDLL, (LPCSTR)100 ); - PC_XInputSetState = (XInputSetState_t)GetProcAddress( (HMODULE)s_pXInputDLL, "XInputSetState" ); - PC_XInputGetCapabilities = (XInputGetCapabilities_t)GetProcAddress( (HMODULE)s_pXInputDLL, "XInputGetCapabilities" ); - if ( !PC_XInputGetState || !PC_XInputSetState || !PC_XInputGetCapabilities ) - { - SDL_SYS_JoystickQuit(); - SDL_SetError("GetProcAddress() failed when loading XInput.", GetLastError()); - return (-1); - } - } + 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; - } + int nJoysticks = 0; + JoyStick_DeviceData *device = SYS_Joystick; + while ( device ) + { + nJoysticks++; + device = device->pNext; + } - return nJoysticks; + 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; - } + 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; + 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; - } + 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; - } + pPrevJoystick = pNewJoystick; + pNewJoystick = pNewJoystick->pNext; + } - s_bDeviceAdded = SDL_TRUE; + s_bDeviceAdded = SDL_TRUE; - bXInputDevice = IsXInputDevice( &pdidInstance->guidProduct ); + bXInputDevice = IsXInputDevice( &pdidInstance->guidProduct ); - pNewJoystick = (JoyStick_DeviceData *)SDL_malloc( sizeof(JoyStick_DeviceData) ); + 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)); + if ( bXInputDevice ) + { + pNewJoystick->bXInputDevice = SDL_TRUE; + pNewJoystick->XInputUserId = INVALID_XINPUT_USERID; + } + else + { + pNewJoystick->bXInputDevice = SDL_FALSE; + } - 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; + SDL_memcpy(&(pNewJoystick->dxdevice), pdidInstance, + sizeof(DIDEVICEINSTANCE)); - if ( SYS_Joystick ) - { - pNewJoystick->pNext = SYS_Joystick; - } - SYS_Joystick = pNewJoystick; + 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; - s_pKnownJoystickGUIDs[ s_iNewGUID ] = pdidInstance->guidInstance; - s_iNewGUID++; + if ( SYS_Joystick ) + { + pNewJoystick->pNext = SYS_Joystick; + } + SYS_Joystick = pNewJoystick; - if ( s_iNewGUID < MAX_JOYSTICKS ) - return DIENUM_CONTINUE; // already have this joystick loaded, just keep going - else - return DIENUM_STOP; + 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; + 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_mutexP( s_mutexJoyStickEnum ); + 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 ); + if ( !s_pKnownJoystickGUIDs ) + s_pKnownJoystickGUIDs = SDL_malloc( sizeof(GUID)*MAX_JOYSTICKS ); - /* Look for joysticks, wheels, head trackers, gamepads, etc.. */ - result = IDirectInput8_EnumDevices(dinput, - DI8DEVCLASS_GAMECTRL, - EnumJoysticksCallback, - &pCurList, DIEDFL_ATTACHEDONLY); + SDL_memset( s_pKnownJoystickGUIDs, 0x0, sizeof(GUID)*MAX_JOYSTICKS ); - SDL_mutexV( s_mutexJoyStickEnum ); - } + /* Look for joysticks, wheels, head trackers, gamepads, etc.. */ + IDirectInput8_EnumDevices(dinput, + DI8DEVCLASS_GAMECTRL, + EnumJoysticksCallback, + &pCurList, DIEDFL_ATTACHEDONLY); - if ( pCurList ) - { - while ( pCurList ) - { - JoyStick_DeviceData *pListNext = NULL; + SDL_UnlockMutex( s_mutexJoyStickEnum ); + } + + if ( pCurList ) + { + while ( pCurList ) + { + JoyStick_DeviceData *pListNext = NULL; #if !SDL_EVENTS_DISABLED - SDL_Event event; - event.type = SDL_JOYDEVICEREMOVED; + 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); - } - } + 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 */ - pNewJoystick->send_add_event = 0; - } - device_index++; - pNewJoystick = pNewJoystick->pNext; - } - } + + 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); + } + } +#endif /* !SDL_EVENTS_DISABLED */ + 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. @@ -921,220 +942,213 @@ 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)); if (joystick->hwdata == NULL) { - SDL_OutOfMemory(); - return (-1); + return SDL_OutOfMemory(); } 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; + 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 ( 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 ( XINPUTGETCAPABILITIES ) - { - result = XINPUTGETCAPABILITIES( userId, XINPUT_FLAG_GAMEPAD, &capabilities ); - if ( result == ERROR_SUCCESS ) - { - 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 ( 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_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 ( !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; + } + 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; + if ( joystickdevice->bXInputDevice == SDL_FALSE ) + { + joystick->hwdata->bXInputDevice = SDL_FALSE; - result = - IDirectInput8_CreateDevice(dinput, - &(joystickdevice->dxdevice.guidInstance), &device, NULL); - if (FAILED(result)) { - SetDIerror("IDirectInput::CreateDevice", result); - return (-1); - } + 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); + /* 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)) { - SetDIerror("IDirectInputDevice8::QueryInterface", result); - return (-1); - } + if (FAILED(result)) { + return SetDIerror("IDirectInputDevice8::QueryInterface", result); + } - /* Aquire shared access. Exclusive access is required for forces, - * though. */ - result = - IDirectInputDevice8_SetCooperativeLevel(joystick->hwdata-> - InputDevice, SDL_HelperWindow, - DISCL_NONEXCLUSIVE | - DISCL_BACKGROUND); - if (FAILED(result)) { - SetDIerror("IDirectInputDevice8::SetCooperativeLevel", result); - return (-1); - } + /* 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)) { - SetDIerror("IDirectInputDevice8::SetDataFormat", result); - return (-1); - } + /* 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); + /* Get device capabilities */ + result = + IDirectInputDevice8_GetCapabilities(joystick->hwdata->InputDevice, + &joystick->hwdata->Capabilities); - if (FAILED(result)) { - SetDIerror("IDirectInputDevice8::GetCapabilities", result); - return (-1); - } + if (FAILED(result)) { + return SetDIerror("IDirectInputDevice8::GetCapabilities", result); + } - /* Force capable? */ - if (joystick->hwdata->Capabilities.dwFlags & DIDC_FORCEFEEDBACK) { + /* Force capable? */ + if (joystick->hwdata->Capabilities.dwFlags & DIDC_FORCEFEEDBACK) { - result = IDirectInputDevice8_Acquire(joystick->hwdata->InputDevice); + result = IDirectInputDevice8_Acquire(joystick->hwdata->InputDevice); - if (FAILED(result)) { - SetDIerror("IDirectInputDevice8::Acquire", result); - return (-1); - } + if (FAILED(result)) { + return SetDIerror("IDirectInputDevice8::Acquire", result); + } - /* reset all accuators. */ - result = - IDirectInputDevice8_SendForceFeedbackCommand(joystick->hwdata-> - InputDevice, - DISFFC_RESET); + /* reset all accuators. */ + result = + IDirectInputDevice8_SendForceFeedbackCommand(joystick->hwdata-> + InputDevice, + DISFFC_RESET); - /* Not necessarily supported, ignore if not supported. - if (FAILED(result)) { - SetDIerror("IDirectInputDevice8::SendForceFeedbackCommand", - result); - return (-1); - } - */ + /* Not necessarily supported, ignore if not supported. + if (FAILED(result)) { + return SetDIerror("IDirectInputDevice8::SendForceFeedbackCommand", result); + } + */ - result = IDirectInputDevice8_Unacquire(joystick->hwdata->InputDevice); + result = IDirectInputDevice8_Unacquire(joystick->hwdata->InputDevice); - if (FAILED(result)) { - SetDIerror("IDirectInputDevice8::Unacquire", result); - return (-1); - } + 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; + /* 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); + result = + IDirectInputDevice8_SetProperty(joystick->hwdata->InputDevice, + DIPROP_AUTOCENTER, &dipdw.diph); - /* Not necessarily supported, ignore if not supported. - if (FAILED(result)) { - SetDIerror("IDirectInputDevice8::SetProperty", result); - return (-1); - } - */ - } + /* 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); + /* 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); + /* 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; + 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); + /* 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)) { - SetDIerror("IDirectInputDevice8::SetProperty", result); - return (-1); - } - } + 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; } @@ -1143,48 +1157,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; + 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; + 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; + 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); + 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; + 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 HAT: + inputs[n].num = nHats; + nHats++; + break; - case AXIS: - inputs[n].num = nAxis; - nAxis++; - break; - } - } + case AXIS: + inputs[n].num = nAxis; + nAxis++; + break; + } + } } static BOOL CALLBACK @@ -1197,12 +1211,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; @@ -1210,28 +1224,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); @@ -1297,12 +1311,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) { @@ -1389,11 +1403,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; @@ -1430,7 +1444,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. @@ -1438,67 +1452,67 @@ int ButtonChanged( int ButtonsNow, int ButtonsPrev, int ButtonMask ) void SDL_SYS_JoystickUpdate_XInput(SDL_Joystick * joystick) { - HRESULT result; + HRESULT result; - if ( !XINPUTGETSTATE ) - return; + 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; - } + 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]; + /* 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) ); + 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 + 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; + joystick->hwdata->currentXInputSlot ^= 1; - } + } } @@ -1562,94 +1576,94 @@ SDL_SYS_JoystickUpdate(SDL_Joystick * joystick) { HRESULT result; - if ( joystick->closed || !joystick->hwdata ) - return; + 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->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->buffered) + SDL_SYS_JoystickUpdate_Buffered(joystick); + else + SDL_SYS_JoystickUpdate_Polled(joystick); + } - if ( joystick->hwdata->removed ) - { - joystick->closed = 1; - joystick->uncentered = 1; - } + 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; - } - } + 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); - } + } + 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; + 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; + 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 + 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; - } + SDL_DestroyMutex( s_mutexJoyStickEnum ); + SDL_DestroyCond( s_condJoystickThread ); + s_condJoystickThread= NULL; + s_mutexJoyStickEnum = NULL; + s_threadJoystick = NULL; + } if (dinput != NULL) { IDirectInput8_Release(dinput); @@ -1661,47 +1675,45 @@ 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_pXInputDLL ) - { - FreeLibrary( s_pXInputDLL ); - s_pXInputDLL = NULL; - } + if (s_bXInputEnabled) { + WIN_UnloadXInputDLL(); + } } /* 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/eepp/helper/SDL2/src/joystick/windows/SDL_dxjoystick_c.h b/src/eepp/helper/SDL2/src/joystick/windows/SDL_dxjoystick_c.h index 08e6cf1af..01cfca970 100644 --- a/src/eepp/helper/SDL2/src/joystick/windows/SDL_dxjoystick_c.h +++ b/src/eepp/helper/SDL2/src/joystick/windows/SDL_dxjoystick_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -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 @@ -34,7 +34,7 @@ #include "../../core/windows/SDL_windows.h" -#define DIRECTINPUT_VERSION 0x0800 /* Need version 7 for force feedback. Need verison 8 so IDirectInput8_EnumDevices doesn't leak like a sieve... */ +#define DIRECTINPUT_VERSION 0x0800 /* Need version 7 for force feedback. Need version 8 so IDirectInput8_EnumDevices doesn't leak like a sieve... */ #include #define COBJMACROS #include @@ -42,8 +42,67 @@ #include #include #include +#include -#define MAX_INPUTS 256 /* each joystick can have up to 256 inputs */ +/* typedef's for XInput structs we use */ +typedef struct +{ + WORD wButtons; + BYTE bLeftTrigger; + BYTE bRightTrigger; + SHORT sThumbLX; + SHORT sThumbLY; + SHORT sThumbRX; + SHORT sThumbRY; + DWORD dwPaddingReserved; +} XINPUT_GAMEPAD_EX; + +typedef struct +{ + DWORD dwPacketNumber; + XINPUT_GAMEPAD_EX Gamepad; +} XINPUT_STATE_EX; + +/* 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 */ + ); + +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 */ + ); + +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 */ + ); + +extern int WIN_LoadXInputDLL(void); +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) */ + +#define XINPUTGETSTATE SDL_XInputGetState +#define XINPUTSETSTATE SDL_XInputSetState +#define XINPUTGETCAPABILITIES SDL_XInputGetCapabilities +#define INVALID_XINPUT_USERID 255 +#define SDL_XINPUT_MAX_DEVICES 4 + +#ifndef XINPUT_CAPS_FFB_SUPPORTED +#define XINPUT_CAPS_FFB_SUPPORTED 0x0001 +#endif + + +#define MAX_INPUTS 256 /* each joystick can have up to 256 inputs */ /* local types */ @@ -62,42 +121,24 @@ typedef struct input_t Uint8 num; } input_t; -/* typedef's for XInput structs we use */ -typedef struct -{ - WORD wButtons; - BYTE bLeftTrigger; - BYTE bRightTrigger; - SHORT sThumbLX; - SHORT sThumbLY; - SHORT sThumbRX; - SHORT sThumbRY; - DWORD dwPaddingReserved; -} XINPUT_GAMEPAD_EX; - -typedef struct -{ - DWORD dwPacketNumber; - XINPUT_GAMEPAD_EX Gamepad; -} XINPUT_STATE_EX; - /* The private structure used to keep track of a joystick */ 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 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/eepp/helper/SDL2/src/joystick/windows/SDL_mmjoystick.c b/src/eepp/helper/SDL2/src/joystick/windows/SDL_mmjoystick.c index a7093601f..413053f14 100644 --- a/src/eepp/helper/SDL2/src/joystick/windows/SDL_mmjoystick.c +++ b/src/eepp/helper/SDL2/src/joystick/windows/SDL_mmjoystick.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -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<hwdata = (struct joystick_hwdata *) SDL_malloc(sizeof(*joystick->hwdata)); if (joystick->hwdata == NULL) { - SDL_OutOfMemory(); - return (-1); + return SDL_OutOfMemory(); } SDL_memset(joystick->hwdata, 0, sizeof(*joystick->hwdata)); @@ -408,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 ) ) ); @@ -418,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/eepp/helper/SDL2/src/libm/math_libm.h b/src/eepp/helper/SDL2/src/libm/math_libm.h index 23e1f73d9..6a6788255 100644 --- a/src/eepp/helper/SDL2/src/libm/math_libm.h +++ b/src/eepp/helper/SDL2/src/libm/math_libm.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/loadso/beos/SDL_sysloadso.c b/src/eepp/helper/SDL2/src/loadso/beos/SDL_sysloadso.c index 3c0a829b2..524cd715e 100644 --- a/src/eepp/helper/SDL2/src/loadso/beos/SDL_sysloadso.c +++ b/src/eepp/helper/SDL2/src/loadso/beos/SDL_sysloadso.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/loadso/dlopen/SDL_sysloadso.c b/src/eepp/helper/SDL2/src/loadso/dlopen/SDL_sysloadso.c index 5ee579b32..429727cc5 100644 --- a/src/eepp/helper/SDL2/src/loadso/dlopen/SDL_sysloadso.c +++ b/src/eepp/helper/SDL2/src/loadso/dlopen/SDL_sysloadso.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/loadso/dummy/SDL_sysloadso.c b/src/eepp/helper/SDL2/src/loadso/dummy/SDL_sysloadso.c index d89f5dbda..d890a1489 100644 --- a/src/eepp/helper/SDL2/src/loadso/dummy/SDL_sysloadso.c +++ b/src/eepp/helper/SDL2/src/loadso/dummy/SDL_sysloadso.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/loadso/windows/SDL_sysloadso.c b/src/eepp/helper/SDL2/src/loadso/windows/SDL_sysloadso.c index f07752cb8..21e7a6c54 100644 --- a/src/eepp/helper/SDL2/src/loadso/windows/SDL_sysloadso.c +++ b/src/eepp/helper/SDL2/src/loadso/windows/SDL_sysloadso.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/main/android/SDL_android_main.cpp b/src/eepp/helper/SDL2/src/main/android/SDL_android_main.cpp index 0755683e0..4581e1c3b 100644 --- a/src/eepp/helper/SDL2/src/main/android/SDL_android_main.cpp +++ b/src/eepp/helper/SDL2/src/main/android/SDL_android_main.cpp @@ -15,19 +15,15 @@ extern "C" void SDL_Android_Init(JNIEnv* env, jclass cls); // Start up the SDL app -extern "C" void Java_org_libsdl_app_SDLActivity_nativeInit(JNIEnv* env, jclass cls, jstring apkPath) +extern "C" void Java_org_libsdl_app_SDLActivity_nativeInit(JNIEnv* env, jclass cls, jobject obj) { /* This interface could expand with ABI negotiation, calbacks, etc. */ SDL_Android_Init(env, cls); - const char* str; - jboolean isCopy; - str = env->GetStringUTFChars(apkPath, &isCopy); - /* Run the application code! */ int status; char *argv[2]; - argv[0] = strdup(str); + argv[0] = strdup("SDL_app"); argv[1] = NULL; status = SDL_main(1, argv); diff --git a/src/eepp/helper/SDL2/src/main/beos/SDL_BApp.h b/src/eepp/helper/SDL2/src/main/beos/SDL_BApp.h index 2c9377716..2a64455b6 100644 --- a/src/eepp/helper/SDL2/src/main/beos/SDL_BApp.h +++ b/src/eepp/helper/SDL2/src/main/beos/SDL_BApp.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -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; + _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_MOUSE_BUTTON: + _HandleMouseButton(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; + 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, 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, 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, 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); - } + /* 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); + } - bool _GetWinID(BMessage *msg, int32 *winID) { - return msg->FindInt32("window-id", winID) == B_OK; - } + 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(); - } + /* Vector functions: Wraps vector stuff in case we need to change + implementation */ + void _SetSDLWindow(SDL_Window *win, int32 winID) { + _window_map[winID] = win; + } - void _PushBackWindow(SDL_Window *win) { - _window_map.push_back(win); - } + int32 _GetNumWindowSlots() { + return _window_map.size(); + } - /* Members */ - vector _window_map; /* Keeps track of SDL_Windows by index-id*/ + void _PopBackWindow() { + _window_map.pop_back(); + } - display_mode *_saved_mode; - BGLView *_current_context; + void _PushBackWindow(SDL_Window *win) { + _window_map.push_back(win); + } + + + /* Members */ + vector _window_map; /* Keeps track of SDL_Windows by index-id*/ + + display_mode *_saved_mode; + BGLView *_current_context; }; #endif diff --git a/src/eepp/helper/SDL2/src/main/beos/SDL_BeApp.cc b/src/eepp/helper/SDL2/src/main/beos/SDL_BeApp.cc index 7524d8939..fb622ab1d 100644 --- a/src/eepp/helper/SDL2/src/main/beos/SDL_BeApp.cc +++ b/src/eepp/helper/SDL2/src/main/beos/SDL_BeApp.cc @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "SDL_config.h" -#ifdef __BEOS__ +#if defined(__BEOS__) || defined(__HAIKU__) /* Handle the BeApp specific portions of the application */ @@ -64,8 +64,7 @@ SDL_InitBeApp(void) if (SDL_BeAppActive <= 0) { SDL_AppThread = SDL_CreateThread(StartBeApp, "SDLApplication", NULL); if (SDL_AppThread == NULL) { - SDL_SetError("Couldn't create BApplication thread"); - return (-1); + return SDL_SetError("Couldn't create BApplication thread"); } /* Change working to directory to that of executable */ diff --git a/src/eepp/helper/SDL2/src/main/beos/SDL_BeApp.h b/src/eepp/helper/SDL2/src/main/beos/SDL_BeApp.h index 60012d34a..5bc5251d3 100644 --- a/src/eepp/helper/SDL2/src/main/beos/SDL_BeApp.h +++ b/src/eepp/helper/SDL2/src/main/beos/SDL_BeApp.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/main/psp/SDL_psp_main.c b/src/eepp/helper/SDL2/src/main/psp/SDL_psp_main.c new file mode 100644 index 000000000..c60e8441b --- /dev/null +++ b/src/eepp/helper/SDL2/src/main/psp/SDL_psp_main.c @@ -0,0 +1,80 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2013 Sam Lantinga + + 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 + appreciated but is not required. + 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. +*/ + +#include "SDL_main.h" +#include +#include +#include +#include +#include +#include + +/* 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. + + You can still override other parameters in your own code if you + desire, such as PSP_HEAP_SIZE_KB, PSP_MAIN_THREAD_ATTR, + PSP_MAIN_THREAD_STACK_SIZE, etc. +*/ + +extern int SDL_main(int argc, char *argv[]); + +PSP_MODULE_INFO("SDL App", 0, 1, 1); + +int sdl_psp_exit_callback(int arg1, int arg2, void *common) +{ + 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 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 main(int argc, char *argv[]) +{ + pspDebugScreenInit(); + sdl_psp_setup_callbacks(); + + /* Register sceKernelExitGame() to be called when we exit */ + atexit(sceKernelExitGame); + + (void)SDL_main(argc, argv); + return 0; +} diff --git a/src/eepp/helper/SDL2/src/main/windows/version.rc b/src/eepp/helper/SDL2/src/main/windows/version.rc index 9f03fe72b..129a1f5dd 100644 --- a/src/eepp/helper/SDL2/src/main/windows/version.rc +++ b/src/eepp/helper/SDL2/src/main/windows/version.rc @@ -9,8 +9,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US // VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,3,0,0 - PRODUCTVERSION 1,3,0,0 + FILEVERSION 2,0,0,0 + PRODUCTVERSION 2,0,0,0 FILEFLAGSMASK 0x3fL FILEFLAGS 0x0L FILEOS 0x40004L @@ -23,12 +23,12 @@ BEGIN BEGIN VALUE "CompanyName", "\0" VALUE "FileDescription", "SDL\0" - VALUE "FileVersion", "1, 3, 0, 0\0" + VALUE "FileVersion", "2, 0, 0, 0\0" VALUE "InternalName", "SDL\0" - VALUE "LegalCopyright", "Copyright © 2012 Sam Lantinga\0" + VALUE "LegalCopyright", "Copyright © 2013 Sam Lantinga\0" VALUE "OriginalFilename", "SDL.dll\0" VALUE "ProductName", "Simple DirectMedia Layer\0" - VALUE "ProductVersion", "1, 3, 0, 0\0" + VALUE "ProductVersion", "2, 0, 0, 0\0" END END BLOCK "VarFileInfo" diff --git a/src/eepp/helper/SDL2/src/power/SDL_power.c b/src/eepp/helper/SDL2/src/power/SDL_power.c index ce7725c7c..b8f3ae40f 100644 --- a/src/eepp/helper/SDL2/src/power/SDL_power.c +++ b/src/eepp/helper/SDL2/src/power/SDL_power.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -34,9 +34,9 @@ SDL_bool SDL_GetPowerInfo_Linux_proc_apm(SDL_PowerState *, int *, int *); SDL_bool SDL_GetPowerInfo_Windows(SDL_PowerState *, int *, int *); SDL_bool SDL_GetPowerInfo_MacOSX(SDL_PowerState *, int *, int *); SDL_bool SDL_GetPowerInfo_BeOS(SDL_PowerState *, int *, int *); -SDL_bool SDL_GetPowerInfo_NintendoDS(SDL_PowerState *, int *, int *); SDL_bool SDL_GetPowerInfo_UIKit(SDL_PowerState *, int *, int *); SDL_bool SDL_GetPowerInfo_Android(SDL_PowerState *, int *, int *); +SDL_bool SDL_GetPowerInfo_PSP(SDL_PowerState *, int *, int *); #ifndef SDL_POWER_DISABLED #ifdef SDL_POWER_HARDWIRED @@ -68,15 +68,16 @@ static SDL_GetPowerInfo_Impl implementations[] = { #ifdef SDL_POWER_MACOSX /* handles Mac OS X, Darwin. */ SDL_GetPowerInfo_MacOSX, #endif -#ifdef SDL_POWER_NINTENDODS /* handles Nintendo DS. */ - SDL_GetPowerInfo_NintendoDS, -#endif #ifdef SDL_POWER_BEOS /* handles BeOS, Zeta, with euc.jp apm driver. */ SDL_GetPowerInfo_BeOS, #endif #ifdef SDL_POWER_ANDROID /* handles Android. */ SDL_GetPowerInfo_Android, #endif +#ifdef SDL_POWER_PSP /* handles PSP. */ + SDL_GetPowerInfo_PSP, +#endif + #ifdef SDL_POWER_HARDWIRED SDL_GetPowerInfo_Hardwired, #endif diff --git a/src/eepp/helper/SDL2/src/power/android/SDL_syspower.c b/src/eepp/helper/SDL2/src/power/android/SDL_syspower.c index 6c33f13d3..adedd04c7 100644 --- a/src/eepp/helper/SDL2/src/power/android/SDL_syspower.c +++ b/src/eepp/helper/SDL2/src/power/android/SDL_syspower.c @@ -1,3 +1,23 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2013 Sam Lantinga + + 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 + appreciated but is not required. + 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. +*/ #include "SDL_config.h" #ifndef SDL_POWER_DISABLED @@ -39,3 +59,5 @@ SDL_GetPowerInfo_Android(SDL_PowerState * state, int *seconds, int *percent) #endif /* SDL_POWER_ANDROID */ #endif /* SDL_POWER_DISABLED */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/eepp/helper/SDL2/src/power/beos/SDL_syspower.c b/src/eepp/helper/SDL2/src/power/beos/SDL_syspower.c index 84a9257bc..8f172cc0e 100644 --- a/src/eepp/helper/SDL2/src/power/beos/SDL_syspower.c +++ b/src/eepp/helper/SDL2/src/power/beos/SDL_syspower.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -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/eepp/helper/SDL2/src/power/linux/SDL_syspower.c b/src/eepp/helper/SDL2/src/power/linux/SDL_syspower.c index 321bbfc6f..d9616de25 100644 --- a/src/eepp/helper/SDL2/src/power/linux/SDL_syspower.c +++ b/src/eepp/helper/SDL2/src/power/linux/SDL_syspower.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -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/eepp/helper/SDL2/src/power/macosx/SDL_syspower.c b/src/eepp/helper/SDL2/src/power/macosx/SDL_syspower.c index 8de22bea4..572dcfdd0 100644 --- a/src/eepp/helper/SDL2/src/power/macosx/SDL_syspower.c +++ b/src/eepp/helper/SDL2/src/power/macosx/SDL_syspower.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/power/nds/SDL_syspower.c b/src/eepp/helper/SDL2/src/power/psp/SDL_syspower.c similarity index 56% rename from src/eepp/helper/SDL2/src/power/nds/SDL_syspower.c rename to src/eepp/helper/SDL2/src/power/psp/SDL_syspower.c index c40a1c2a4..8c791bba4 100644 --- a/src/eepp/helper/SDL2/src/power/nds/SDL_syspower.c +++ b/src/eepp/helper/SDL2/src/power/psp/SDL_syspower.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -18,27 +18,51 @@ misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ + #include "SDL_config.h" #ifndef SDL_POWER_DISABLED -#if SDL_POWER_NINTENDODS +#if SDL_POWER_PSP #include "SDL_power.h" +#include + SDL_bool -SDL_GetPowerInfo_NintendoDS(SDL_PowerState * state, int *seconds, +SDL_GetPowerInfo_PSP(SDL_PowerState * state, int *seconds, int *percent) { - /* !!! FIXME: write me. */ + int battery = scePowerIsBatteryExist(); + int plugged = scePowerIsPowerOnline(); + int charging = scePowerIsBatteryCharging(); *state = SDL_POWERSTATE_UNKNOWN; - *percent = -1; *seconds = -1; + *percent = -1; - return SDL_TRUE; /* always the definitive answer on Nintendo DS. */ + if (!battery) { + *state = SDL_POWERSTATE_NO_BATTERY; + *seconds = -1; + *percent = -1; + } else if (charging) { + *state = SDL_POWERSTATE_CHARGING; + *percent = scePowerGetBatteryLifePercent(); + *seconds = scePowerGetBatteryLifeTime()*60; + } else if (plugged) { + *state = SDL_POWERSTATE_CHARGED; + *percent = scePowerGetBatteryLifePercent(); + *seconds = scePowerGetBatteryLifeTime()*60; + } else { + *state = SDL_POWERSTATE_ON_BATTERY; + *percent = scePowerGetBatteryLifePercent(); + *seconds = scePowerGetBatteryLifeTime()*60; + } + + + return SDL_TRUE; /* always the definitive answer on PSP. */ } -#endif /* SDL_POWER_NINTENDODS */ +#endif /* SDL_POWER_PSP */ #endif /* SDL_POWER_DISABLED */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/eepp/helper/SDL2/src/power/uikit/SDL_syspower.h b/src/eepp/helper/SDL2/src/power/uikit/SDL_syspower.h index 14bc75004..ce3bc2e73 100644 --- a/src/eepp/helper/SDL2/src/power/uikit/SDL_syspower.h +++ b/src/eepp/helper/SDL2/src/power/uikit/SDL_syspower.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/power/uikit/SDL_syspower.m b/src/eepp/helper/SDL2/src/power/uikit/SDL_syspower.m index db5d11036..3364da56e 100644 --- a/src/eepp/helper/SDL2/src/power/uikit/SDL_syspower.m +++ b/src/eepp/helper/SDL2/src/power/uikit/SDL_syspower.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -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/eepp/helper/SDL2/src/power/windows/SDL_syspower.c b/src/eepp/helper/SDL2/src/power/windows/SDL_syspower.c index f3c75957a..29ddb0f8f 100644 --- a/src/eepp/helper/SDL2/src/power/windows/SDL_syspower.c +++ b/src/eepp/helper/SDL2/src/power/windows/SDL_syspower.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/render/SDL_render.c b/src/eepp/helper/SDL2/src/render/SDL_render.c index 01b4aa13b..785e0b905 100644 --- a/src/eepp/helper/SDL2/src/render/SDL_render.c +++ b/src/eepp/helper/SDL2/src/render/SDL_render.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -44,8 +44,8 @@ } -static const SDL_RenderDriver *render_drivers[] = { #if !SDL_RENDER_DISABLED +static const SDL_RenderDriver *render_drivers[] = { #if SDL_VIDEO_RENDER_D3D &D3D_RenderDriver, #endif @@ -61,12 +61,13 @@ static const SDL_RenderDriver *render_drivers[] = { #if SDL_VIDEO_RENDER_DIRECTFB &DirectFB_RenderDriver, #endif -#if SDL_VIDEO_RENDER_NDS - &NDS_RenderDriver, +#if SDL_VIDEO_RENDER_PSP + &PSP_RenderDriver, #endif &SW_RenderDriver -#endif /* !SDL_RENDER_DISABLED */ }; +#endif /* !SDL_RENDER_DISABLED */ + static char renderer_magic; static char texture_magic; @@ -75,19 +76,26 @@ static int UpdateLogicalSize(SDL_Renderer *renderer); int SDL_GetNumRenderDrivers(void) { +#if !SDL_RENDER_DISABLED return SDL_arraysize(render_drivers); +#else + return 0; +#endif } int SDL_GetRenderDriverInfo(int index, SDL_RendererInfo * info) { +#if !SDL_RENDER_DISABLED if (index < 0 || index >= SDL_GetNumRenderDrivers()) { - SDL_SetError("index must be in the range of 0 - %d", - SDL_GetNumRenderDrivers() - 1); - return -1; + return SDL_SetError("index must be in the range of 0 - %d", + SDL_GetNumRenderDrivers() - 1); } *info = render_drivers[index]->info; return 0; +#else + return SDL_SetError("SDL not built with rendering support"); +#endif } static int @@ -198,6 +206,7 @@ SDL_CreateWindowAndRenderer(int width, int height, Uint32 window_flags, SDL_Renderer * SDL_CreateRenderer(SDL_Window * window, int index, Uint32 flags) { +#if !SDL_RENDER_DISABLED SDL_Renderer *renderer = NULL; int n = SDL_GetNumRenderDrivers(); const char *hint; @@ -285,6 +294,10 @@ SDL_CreateRenderer(SDL_Window * window, int index, Uint32 flags) "Created renderer: %s", renderer->info.name); } return renderer; +#else + SDL_SetError("SDL not built with rendering support"); + return NULL; +#endif } SDL_Renderer * @@ -695,8 +708,7 @@ SDL_UpdateTextureYUV(SDL_Texture * texture, const SDL_Rect * rect, temp_pitch = (((rect->w * SDL_BYTESPERPIXEL(native->format)) + 3) & ~3); temp_pixels = SDL_malloc(rect->h * temp_pitch); if (!temp_pixels) { - SDL_OutOfMemory(); - return -1; + return SDL_OutOfMemory(); } SDL_SW_CopyYUVToRGB(texture->yuv, rect, native->format, rect->w, rect->h, temp_pixels, temp_pitch); @@ -732,8 +744,7 @@ SDL_UpdateTextureNative(SDL_Texture * texture, const SDL_Rect * rect, temp_pitch = (((rect->w * SDL_BYTESPERPIXEL(native->format)) + 3) & ~3); temp_pixels = SDL_malloc(rect->h * temp_pitch); if (!temp_pixels) { - SDL_OutOfMemory(); - return -1; + return SDL_OutOfMemory(); } SDL_ConvertPixels(rect->w, rect->h, texture->format, pixels, pitch, @@ -800,8 +811,7 @@ SDL_LockTexture(SDL_Texture * texture, const SDL_Rect * rect, CHECK_TEXTURE_MAGIC(texture, -1); if (texture->access != SDL_TEXTUREACCESS_STREAMING) { - SDL_SetError("SDL_LockTexture(): texture must be streaming"); - return -1; + return SDL_SetError("SDL_LockTexture(): texture must be streaming"); } if (!rect) { @@ -897,8 +907,7 @@ int SDL_SetRenderTarget(SDL_Renderer *renderer, SDL_Texture *texture) { if (!SDL_RenderTargetSupported(renderer)) { - SDL_Unsupported(); - return -1; + return SDL_Unsupported(); } if (texture == renderer->target) { /* Nothing to do! */ @@ -909,12 +918,10 @@ SDL_SetRenderTarget(SDL_Renderer *renderer, SDL_Texture *texture) if (texture) { CHECK_TEXTURE_MAGIC(texture, -1); if (renderer != texture->renderer) { - SDL_SetError("Texture was not created with this renderer"); - return -1; + return SDL_SetError("Texture was not created with this renderer"); } if (texture->access != SDL_TEXTUREACCESS_TARGET) { - SDL_SetError("Texture not created with SDL_TEXTUREACCESS_TARGET"); - return -1; + return SDL_SetError("Texture not created with SDL_TEXTUREACCESS_TARGET"); } if (texture->native) { /* Always render to the native texture */ @@ -925,6 +932,7 @@ SDL_SetRenderTarget(SDL_Renderer *renderer, SDL_Texture *texture) if (texture && !renderer->target) { /* Make a backup of the viewport */ renderer->viewport_backup = renderer->viewport; + renderer->clip_rect_backup = renderer->clip_rect; renderer->scale_backup = renderer->scale; renderer->logical_w_backup = renderer->logical_w; renderer->logical_h_backup = renderer->logical_h; @@ -946,6 +954,7 @@ SDL_SetRenderTarget(SDL_Renderer *renderer, SDL_Texture *texture) renderer->logical_h = 0; } else { renderer->viewport = renderer->viewport_backup; + renderer->clip_rect = renderer->clip_rect_backup; renderer->scale = renderer->scale_backup; renderer->logical_w = renderer->logical_w_backup; renderer->logical_h = renderer->logical_h_backup; @@ -953,6 +962,9 @@ SDL_SetRenderTarget(SDL_Renderer *renderer, SDL_Texture *texture) if (renderer->UpdateViewport(renderer) < 0) { return -1; } + if (renderer->UpdateClipRect(renderer) < 0) { + return -1; + } /* All set! */ return 0; @@ -979,8 +991,7 @@ UpdateLogicalSize(SDL_Renderer *renderer) SDL_GetWindowSize(renderer->window, &w, &h); } else { /* FIXME */ - SDL_SetError("Internal error: No way to get output resolution"); - return -1; + return SDL_SetError("Internal error: No way to get output resolution"); } want_aspect = (float)renderer->logical_w / renderer->logical_h; @@ -1091,6 +1102,35 @@ SDL_RenderGetViewport(SDL_Renderer * renderer, SDL_Rect * rect) } } +int +SDL_RenderSetClipRect(SDL_Renderer * renderer, const SDL_Rect * rect) +{ + CHECK_RENDERER_MAGIC(renderer, -1) + + if (rect) { + renderer->clip_rect.x = (int)SDL_floor(rect->x * renderer->scale.x); + renderer->clip_rect.y = (int)SDL_floor(rect->y * renderer->scale.y); + renderer->clip_rect.w = (int)SDL_ceil(rect->w * renderer->scale.x); + renderer->clip_rect.h = (int)SDL_ceil(rect->h * renderer->scale.y); + } else { + SDL_zero(renderer->clip_rect); + } + return renderer->UpdateClipRect(renderer); +} + +void +SDL_RenderGetClipRect(SDL_Renderer * renderer, SDL_Rect * rect) +{ + CHECK_RENDERER_MAGIC(renderer, ) + + if (rect) { + rect->x = (int)(renderer->clip_rect.x / renderer->scale.x); + rect->y = (int)(renderer->clip_rect.y / renderer->scale.y); + rect->w = (int)(renderer->clip_rect.w / renderer->scale.x); + rect->h = (int)(renderer->clip_rect.h / renderer->scale.y); + } +} + int SDL_RenderSetScale(SDL_Renderer * renderer, float scaleX, float scaleY) { @@ -1198,8 +1238,7 @@ RenderDrawPointsWithRects(SDL_Renderer * renderer, frects = SDL_stack_alloc(SDL_FRect, count); if (!frects) { - SDL_OutOfMemory(); - return -1; + return SDL_OutOfMemory(); } for (i = 0; i < count; ++i) { frects[i].x = points[i].x * renderer->scale.x; @@ -1226,8 +1265,7 @@ SDL_RenderDrawPoints(SDL_Renderer * renderer, CHECK_RENDERER_MAGIC(renderer, -1); if (!points) { - SDL_SetError("SDL_RenderDrawPoints(): Passed NULL points"); - return -1; + return SDL_SetError("SDL_RenderDrawPoints(): Passed NULL points"); } if (count < 1) { return 0; @@ -1243,8 +1281,7 @@ SDL_RenderDrawPoints(SDL_Renderer * renderer, fpoints = SDL_stack_alloc(SDL_FPoint, count); if (!fpoints) { - SDL_OutOfMemory(); - return -1; + return SDL_OutOfMemory(); } for (i = 0; i < count; ++i) { fpoints[i].x = points[i].x * renderer->scale.x; @@ -1282,8 +1319,7 @@ RenderDrawLinesWithRects(SDL_Renderer * renderer, frects = SDL_stack_alloc(SDL_FRect, count-1); if (!frects) { - SDL_OutOfMemory(); - return -1; + return SDL_OutOfMemory(); } status = 0; @@ -1309,10 +1345,10 @@ RenderDrawLinesWithRects(SDL_Renderer * renderer, frect->h = renderer->scale.y; } else { /* FIXME: We can't use a rect for this line... */ - frects[0].x = points[i].x * renderer->scale.x; - frects[0].y = points[i].y * renderer->scale.y; - frects[1].x = points[i+1].x * renderer->scale.x; - frects[1].y = points[i+1].y * renderer->scale.y; + fpoints[0].x = points[i].x * renderer->scale.x; + fpoints[0].y = points[i].y * renderer->scale.y; + fpoints[1].x = points[i+1].x * renderer->scale.x; + fpoints[1].y = points[i+1].y * renderer->scale.y; status += renderer->RenderDrawLines(renderer, fpoints, 2); } } @@ -1338,8 +1374,7 @@ SDL_RenderDrawLines(SDL_Renderer * renderer, CHECK_RENDERER_MAGIC(renderer, -1); if (!points) { - SDL_SetError("SDL_RenderDrawLines(): Passed NULL points"); - return -1; + return SDL_SetError("SDL_RenderDrawLines(): Passed NULL points"); } if (count < 2) { return 0; @@ -1355,8 +1390,7 @@ SDL_RenderDrawLines(SDL_Renderer * renderer, fpoints = SDL_stack_alloc(SDL_FPoint, count); if (!fpoints) { - SDL_OutOfMemory(); - return -1; + return SDL_OutOfMemory(); } for (i = 0; i < count; ++i) { fpoints[i].x = points[i].x * renderer->scale.x; @@ -1408,8 +1442,7 @@ SDL_RenderDrawRects(SDL_Renderer * renderer, CHECK_RENDERER_MAGIC(renderer, -1); if (!rects) { - SDL_SetError("SDL_RenderDrawRects(): Passed NULL rects"); - return -1; + return SDL_SetError("SDL_RenderDrawRects(): Passed NULL rects"); } if (count < 1) { return 0; @@ -1455,8 +1488,7 @@ SDL_RenderFillRects(SDL_Renderer * renderer, CHECK_RENDERER_MAGIC(renderer, -1); if (!rects) { - SDL_SetError("SDL_RenderFillRects(): Passed NULL rects"); - return -1; + return SDL_SetError("SDL_RenderFillRects(): Passed NULL rects"); } if (count < 1) { return 0; @@ -1468,8 +1500,7 @@ SDL_RenderFillRects(SDL_Renderer * renderer, frects = SDL_stack_alloc(SDL_FRect, count); if (!frects) { - SDL_OutOfMemory(); - return -1; + return SDL_OutOfMemory(); } for (i = 0; i < count; ++i) { frects[i].x = rects[i].x * renderer->scale.x; @@ -1497,8 +1528,7 @@ SDL_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture, CHECK_TEXTURE_MAGIC(texture, -1); if (renderer != texture->renderer) { - SDL_SetError("Texture was not created with this renderer"); - return -1; + return SDL_SetError("Texture was not created with this renderer"); } real_srcrect.x = 0; @@ -1566,14 +1596,12 @@ SDL_RenderCopyEx(SDL_Renderer * renderer, SDL_Texture * texture, CHECK_TEXTURE_MAGIC(texture, -1); if (renderer != texture->renderer) { - SDL_SetError("Texture was not created with this renderer"); - return -1; + return SDL_SetError("Texture was not created with this renderer"); } if (!renderer->RenderCopyEx) { - SDL_SetError("Renderer does not support RenderCopyEx"); - return -1; + return SDL_SetError("Renderer does not support RenderCopyEx"); } - + real_srcrect.x = 0; real_srcrect.y = 0; real_srcrect.w = texture->w; @@ -1623,8 +1651,7 @@ SDL_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect, CHECK_RENDERER_MAGIC(renderer, -1); if (!renderer->RenderReadPixels) { - SDL_Unsupported(); - return -1; + return SDL_Unsupported(); } if (!format) { @@ -1729,8 +1756,7 @@ int SDL_GL_BindTexture(SDL_Texture *texture, float *texw, float *texh) return renderer->GL_BindTexture(renderer, texture, texw, texh); } - SDL_Unsupported(); - return -1; + return SDL_Unsupported(); } int SDL_GL_UnbindTexture(SDL_Texture *texture) @@ -1743,8 +1769,7 @@ int SDL_GL_UnbindTexture(SDL_Texture *texture) return renderer->GL_UnbindTexture(renderer, texture); } - SDL_Unsupported(); - return -1; + return SDL_Unsupported(); } /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/eepp/helper/SDL2/src/render/SDL_sysrender.h b/src/eepp/helper/SDL2/src/render/SDL_sysrender.h index dff297f5e..4f0795274 100644 --- a/src/eepp/helper/SDL2/src/render/SDL_sysrender.h +++ b/src/eepp/helper/SDL2/src/render/SDL_sysrender.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -93,6 +93,7 @@ struct SDL_Renderer void (*UnlockTexture) (SDL_Renderer * renderer, SDL_Texture * texture); int (*SetRenderTarget) (SDL_Renderer * renderer, SDL_Texture * texture); int (*UpdateViewport) (SDL_Renderer * renderer); + int (*UpdateClipRect) (SDL_Renderer * renderer); int (*RenderClear) (SDL_Renderer * renderer); int (*RenderDrawPoints) (SDL_Renderer * renderer, const SDL_FPoint * points, int count); @@ -133,6 +134,10 @@ struct SDL_Renderer SDL_Rect viewport; SDL_Rect viewport_backup; + /* The clip rectangle within the window */ + SDL_Rect clip_rect; + SDL_Rect clip_rect_backup; + /* The render output coordinate scale */ SDL_FPoint scale; SDL_FPoint scale_backup; @@ -173,8 +178,8 @@ extern SDL_RenderDriver GLES_RenderDriver; #if SDL_VIDEO_RENDER_DIRECTFB extern SDL_RenderDriver DirectFB_RenderDriver; #endif -#if SDL_VIDEO_RENDER_NDS -extern SDL_RenderDriver NDS_RenderDriver; +#if SDL_VIDEO_RENDER_PSP +extern SDL_RenderDriver PSP_RenderDriver; #endif extern SDL_RenderDriver SW_RenderDriver; diff --git a/src/eepp/helper/SDL2/src/render/SDL_yuv_mmx.c b/src/eepp/helper/SDL2/src/render/SDL_yuv_mmx.c index 9d50dd6af..b223d2d28 100644 --- a/src/eepp/helper/SDL2/src/render/SDL_yuv_mmx.c +++ b/src/eepp/helper/SDL2/src/render/SDL_yuv_mmx.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -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 + "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 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 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 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 (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 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 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 + /* 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) + /* 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 + "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 + /* 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 */ + "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 + "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 + /* 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,%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 + "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 %%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 %%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/eepp/helper/SDL2/src/render/SDL_yuv_sw.c b/src/eepp/helper/SDL2/src/render/SDL_yuv_sw.c index bde5de11b..1d7e024c2 100644 --- a/src/eepp/helper/SDL2/src/render/SDL_yuv_sw.c +++ b/src/eepp/helper/SDL2/src/render/SDL_yuv_sw.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -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" @@ -896,8 +896,7 @@ SDL_SW_SetupYUVDisplay(SDL_SW_YUVTexture * swdata, Uint32 target_format) if (!SDL_PixelFormatEnumToMasks (target_format, &bpp, &Rmask, &Gmask, &Bmask, &Amask) || bpp < 15) { - SDL_SetError("Unsupported YUV destination format"); - return -1; + return SDL_SetError("Unsupported YUV destination format"); } swdata->target_format = target_format; @@ -905,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) { @@ -923,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. */ @@ -1057,8 +1056,8 @@ SDL_SW_CreateYUVTexture(Uint32 format, int w, int h) swdata->colortab = (int *) SDL_malloc(4 * 256 * sizeof(int)); swdata->rgb_2_pix = (Uint32 *) SDL_malloc(3 * 768 * sizeof(Uint32)); if (!swdata->pixels || !swdata->colortab || !swdata->rgb_2_pix) { - SDL_OutOfMemory(); SDL_SW_DestroyYUVTexture(swdata); + SDL_OutOfMemory(); return NULL; } @@ -1197,9 +1196,8 @@ SDL_SW_LockYUVTexture(SDL_SW_YUVTexture * swdata, const SDL_Rect * rect, if (rect && (rect->x != 0 || rect->y != 0 || rect->w != swdata->w || rect->h != swdata->h)) { - SDL_SetError + return SDL_SetError ("YV12 and IYUV textures only support full surface locks"); - return -1; } break; } @@ -1309,8 +1307,7 @@ SDL_SW_CopyYUVToRGB(SDL_SW_YUVTexture * swdata, const SDL_Rect * srcrect, Cb = lum + 3; break; default: - SDL_SetError("Unsupported YUV format in copy"); - return (-1); + return SDL_SetError("Unsupported YUV format in copy"); } mod = (pitch / SDL_BYTESPERPIXEL(target_format)); diff --git a/src/eepp/helper/SDL2/src/render/SDL_yuv_sw_c.h b/src/eepp/helper/SDL2/src/render/SDL_yuv_sw_c.h index 28a25514a..9debacbcf 100644 --- a/src/eepp/helper/SDL2/src/render/SDL_yuv_sw_c.h +++ b/src/eepp/helper/SDL2/src/render/SDL_yuv_sw_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/render/direct3d/SDL_render_d3d.c b/src/eepp/helper/SDL2/src/render/direct3d/SDL_render_d3d.c index 0ebb7474f..dea31f644 100644 --- a/src/eepp/helper/SDL2/src/render/direct3d/SDL_render_d3d.c +++ b/src/eepp/helper/SDL2/src/render/direct3d/SDL_render_d3d.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -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; }; @@ -186,6 +186,7 @@ static int D3D_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture, static void D3D_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture); static int D3D_SetRenderTarget(SDL_Renderer * renderer, SDL_Texture * texture); static int D3D_UpdateViewport(SDL_Renderer * renderer); +static int D3D_UpdateClipRect(SDL_Renderer * renderer); static int D3D_RenderClear(SDL_Renderer * renderer); static int D3D_RenderDrawPoints(SDL_Renderer * renderer, const SDL_FPoint * points, int count); @@ -246,7 +247,7 @@ typedef struct float u, v; } Vertex; -static void +static int D3D_SetError(const char *prefix, HRESULT result) { const char *error; @@ -322,7 +323,7 @@ D3D_SetError(const char *prefix, HRESULT result) error = "UNKNOWN"; break; } - SDL_SetError("%s: %s", prefix, error); + return SDL_SetError("%s: %s", prefix, error); } static D3DFORMAT @@ -361,14 +362,19 @@ D3D_Reset(SDL_Renderer * renderer) D3D_RenderData *data = (D3D_RenderData *) renderer->driverdata; HRESULT result; + /* Release the default render target before reset */ + if (data->defaultRenderTarget) { + IDirect3DSurface9_Release(data->defaultRenderTarget); + data->defaultRenderTarget = NULL; + } + result = IDirect3DDevice9_Reset(data->device, &data->pparams); if (FAILED(result)) { if (result == D3DERR_DEVICELOST) { /* Don't worry about it, we'll reset later... */ return 0; } else { - D3D_SetError("Reset()", result); - return -1; + return D3D_SetError("Reset()", result); } } IDirect3DDevice9_SetVertexShader(data->device, NULL); @@ -377,6 +383,7 @@ D3D_Reset(SDL_Renderer * renderer) IDirect3DDevice9_SetRenderState(data->device, D3DRS_CULLMODE, D3DCULL_NONE); IDirect3DDevice9_SetRenderState(data->device, D3DRS_LIGHTING, FALSE); + IDirect3DDevice9_GetRenderTarget(data->device, 0, &data->defaultRenderTarget); return 0; } @@ -415,8 +422,7 @@ D3D_ActivateRenderer(SDL_Renderer * renderer) result = IDirect3DDevice9_BeginScene(data->device); } if (FAILED(result)) { - D3D_SetError("BeginScene()", result); - return -1; + return D3D_SetError("BeginScene()", result); } data->beginScene = SDL_FALSE; } @@ -438,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) { @@ -469,8 +475,11 @@ D3D_CreateRenderer(SDL_Window * window, Uint32 flags) } for (d3dxVersion=50;d3dxVersion>0;d3dxVersion--) { - SDL_snprintf(d3dxDLLFile, 49, "D3DX9_%02d.dll", d3dxVersion); - data->d3dxDLL = SDL_LoadObject(d3dxDLLFile); + LPTSTR dllName; + SDL_snprintf(d3dxDLLFile, sizeof(d3dxDLLFile), "D3DX9_%02d.dll", d3dxVersion); + dllName = WIN_UTF8ToString(d3dxDLLFile); + data->d3dxDLL = (void *)LoadLibrary(dllName); /* not using SDL_LoadObject() as we want silently fail - no error message */ + SDL_free(dllName); if (data->d3dxDLL) { HRESULT (WINAPI *D3DXCreateMatrixStack) (DWORD Flags, LPD3DXMATRIXSTACK* ppStack); D3DXCreateMatrixStack = (HRESULT (WINAPI *) (DWORD, LPD3DXMATRIXSTACK*)) SDL_LoadFunction(data->d3dxDLL, "D3DXCreateMatrixStack"); @@ -487,7 +496,7 @@ D3D_CreateRenderer(SDL_Window * window, Uint32 flags) } - + if (!data->d3d || !data->matrixStack) { SDL_free(renderer); SDL_free(data); @@ -502,6 +511,7 @@ D3D_CreateRenderer(SDL_Window * window, Uint32 flags) renderer->UnlockTexture = D3D_UnlockTexture; renderer->SetRenderTarget = D3D_SetRenderTarget; renderer->UpdateViewport = D3D_UpdateViewport; + renderer->UpdateClipRect = D3D_UpdateClipRect; renderer->RenderClear = D3D_RenderClear; renderer->RenderDrawPoints = D3D_RenderDrawPoints; renderer->RenderDrawLines = D3D_RenderDrawLines; @@ -538,9 +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 { pparams.Windowed = FALSE; pparams.FullScreen_RefreshRateInHz = fullscreen_mode.refresh_rate; + } } else { pparams.Windowed = TRUE; pparams.FullScreen_RefreshRateInHz = 0; @@ -689,8 +704,7 @@ D3D_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) data = (D3D_TextureData *) SDL_calloc(1, sizeof(*data)); if (!data) { - SDL_OutOfMemory(); - return -1; + return SDL_OutOfMemory(); } data->scaleMode = GetScaleQuality(); @@ -717,8 +731,7 @@ D3D_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) PixelFormatToD3DFMT(texture->format), pool, &data->texture, NULL); if (FAILED(result)) { - D3D_SetError("CreateTexture()", result); - return -1; + return D3D_SetError("CreateTexture()", result); } return 0; @@ -752,8 +765,7 @@ D3D_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, } if (FAILED(result)) { - D3D_SetError("LockRect()", result); - return -1; + return D3D_SetError("LockRect()", result); } src = pixels; @@ -789,8 +801,7 @@ D3D_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture, result = IDirect3DTexture9_LockRect(data->texture, 0, &locked, &d3drect, 0); if (FAILED(result)) { - D3D_SetError("LockRect()", result); - return -1; + return D3D_SetError("LockRect()", result); } *pixels = locked.pBits; *pitch = locked.Pitch; @@ -805,6 +816,39 @@ D3D_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture) IDirect3DTexture9_UnlockRect(data->texture, 0); } +static int +D3D_SetRenderTarget(SDL_Renderer * renderer, SDL_Texture * texture) +{ + D3D_RenderData *data = (D3D_RenderData *) renderer->driverdata; + D3D_TextureData *texturedata; + HRESULT result; + + D3D_ActivateRenderer(renderer); + + /* Release the previous render target if it wasn't the default one */ + if (data->currentRenderTarget != NULL) { + IDirect3DSurface9_Release(data->currentRenderTarget); + data->currentRenderTarget = NULL; + } + + if (texture == NULL) { + IDirect3DDevice9_SetRenderTarget(data->device, 0, data->defaultRenderTarget); + return 0; + } + + texturedata = (D3D_TextureData *) texture->driverdata; + result = IDirect3DTexture9_GetSurfaceLevel(texturedata->texture, 0, &data->currentRenderTarget); + if(FAILED(result)) { + return D3D_SetError("GetSurfaceLevel()", result); + } + result = IDirect3DDevice9_SetRenderTarget(data->device, 0, data->currentRenderTarget); + if(FAILED(result)) { + return D3D_SetError("SetRenderTarget()", result); + } + + return 0; +} + static int D3D_UpdateViewport(SDL_Renderer * renderer) { @@ -844,37 +888,28 @@ D3D_UpdateViewport(SDL_Renderer * renderer) } static int -D3D_SetRenderTarget(SDL_Renderer * renderer, SDL_Texture * texture) +D3D_UpdateClipRect(SDL_Renderer * renderer) { + const SDL_Rect *rect = &renderer->clip_rect; D3D_RenderData *data = (D3D_RenderData *) renderer->driverdata; - D3D_TextureData *texturedata; + RECT r; HRESULT result; - D3D_ActivateRenderer(renderer); + if (!SDL_RectEmpty(rect)) { + IDirect3DDevice9_SetRenderState(data->device, D3DRS_SCISSORTESTENABLE, TRUE); + r.left = rect->x; + r.top = rect->y; + r.right = rect->w + rect->w; + r.bottom = rect->y + rect->h; - /* Release the previous render target if it wasn't the default one */ - if (data->currentRenderTarget != NULL) { - IDirect3DSurface9_Release(data->currentRenderTarget); - data->currentRenderTarget = NULL; + result = IDirect3DDevice9_SetScissorRect(data->device, &r); + if (result != D3D_OK) { + D3D_SetError("SetScissor()", result); + return -1; + } + } else { + IDirect3DDevice9_SetRenderState(data->device, D3DRS_SCISSORTESTENABLE, FALSE); } - - if (texture == NULL) { - IDirect3DDevice9_SetRenderTarget(data->device, 0, data->defaultRenderTarget); - return 0; - } - - texturedata = (D3D_TextureData *) texture->driverdata; - result = IDirect3DTexture9_GetSurfaceLevel(texturedata->texture, 0, &data->currentRenderTarget); - if(FAILED(result)) { - D3D_SetError("GetSurfaceLevel()", result); - return -1; - } - result = IDirect3DDevice9_SetRenderTarget(data->device, 0, data->currentRenderTarget); - if(FAILED(result)) { - D3D_SetError("SetRenderTarget()", result); - return -1; - } - return 0; } @@ -921,8 +956,7 @@ D3D_RenderClear(SDL_Renderer * renderer) } if (FAILED(result)) { - D3D_SetError("Clear()", result); - return -1; + return D3D_SetError("Clear()", result); } return 0; } @@ -982,8 +1016,7 @@ D3D_RenderDrawPoints(SDL_Renderer * renderer, const SDL_FPoint * points, IDirect3DDevice9_SetTexture(data->device, 0, (IDirect3DBaseTexture9 *) 0); if (FAILED(result)) { - D3D_SetError("SetTexture()", result); - return -1; + return D3D_SetError("SetTexture()", result); } color = D3DCOLOR_ARGB(renderer->a, renderer->r, renderer->g, renderer->b); @@ -1002,8 +1035,7 @@ D3D_RenderDrawPoints(SDL_Renderer * renderer, const SDL_FPoint * points, vertices, sizeof(*vertices)); SDL_stack_free(vertices); if (FAILED(result)) { - D3D_SetError("DrawPrimitiveUP()", result); - return -1; + return D3D_SetError("DrawPrimitiveUP()", result); } return 0; } @@ -1028,8 +1060,7 @@ D3D_RenderDrawLines(SDL_Renderer * renderer, const SDL_FPoint * points, IDirect3DDevice9_SetTexture(data->device, 0, (IDirect3DBaseTexture9 *) 0); if (FAILED(result)) { - D3D_SetError("SetTexture()", result); - return -1; + return D3D_SetError("SetTexture()", result); } color = D3DCOLOR_ARGB(renderer->a, renderer->r, renderer->g, renderer->b); @@ -1058,8 +1089,7 @@ D3D_RenderDrawLines(SDL_Renderer * renderer, const SDL_FPoint * points, SDL_stack_free(vertices); if (FAILED(result)) { - D3D_SetError("DrawPrimitiveUP()", result); - return -1; + return D3D_SetError("DrawPrimitiveUP()", result); } return 0; } @@ -1085,8 +1115,7 @@ D3D_RenderFillRects(SDL_Renderer * renderer, const SDL_FRect * rects, IDirect3DDevice9_SetTexture(data->device, 0, (IDirect3DBaseTexture9 *) 0); if (FAILED(result)) { - D3D_SetError("SetTexture()", result); - return -1; + return D3D_SetError("SetTexture()", result); } color = D3DCOLOR_ARGB(renderer->a, renderer->r, renderer->g, renderer->b); @@ -1131,8 +1160,7 @@ D3D_RenderFillRects(SDL_Renderer * renderer, const SDL_FRect * rects, IDirect3DDevice9_DrawPrimitiveUP(data->device, D3DPT_TRIANGLEFAN, 2, vertices, sizeof(*vertices)); if (FAILED(result)) { - D3D_SetError("DrawPrimitiveUP()", result); - return -1; + return D3D_SetError("DrawPrimitiveUP()", result); } } return 0; @@ -1209,28 +1237,24 @@ D3D_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture, IDirect3DDevice9_SetTexture(data->device, 0, (IDirect3DBaseTexture9 *) texturedata->texture); if (FAILED(result)) { - D3D_SetError("SetTexture()", result); - return -1; + return D3D_SetError("SetTexture()", result); } if (shader) { result = IDirect3DDevice9_SetPixelShader(data->device, shader); if (FAILED(result)) { - D3D_SetError("SetShader()", result); - return -1; + return D3D_SetError("SetShader()", result); } } result = IDirect3DDevice9_DrawPrimitiveUP(data->device, D3DPT_TRIANGLEFAN, 2, vertices, sizeof(*vertices)); if (FAILED(result)) { - D3D_SetError("DrawPrimitiveUP()", result); - return -1; + return D3D_SetError("DrawPrimitiveUP()", result); } if (shader) { result = IDirect3DDevice9_SetPixelShader(data->device, NULL); if (FAILED(result)) { - D3D_SetError("SetShader()", result); - return -1; + return D3D_SetError("SetShader()", result); } } return 0; @@ -1314,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)); @@ -1333,28 +1357,24 @@ D3D_RenderCopyEx(SDL_Renderer * renderer, SDL_Texture * texture, IDirect3DDevice9_SetTexture(data->device, 0, (IDirect3DBaseTexture9 *) texturedata->texture); if (FAILED(result)) { - D3D_SetError("SetTexture()", result); - return -1; + return D3D_SetError("SetTexture()", result); } if (shader) { result = IDirect3DDevice9_SetPixelShader(data->device, shader); if (FAILED(result)) { - D3D_SetError("SetShader()", result); - return -1; + return D3D_SetError("SetShader()", result); } } result = IDirect3DDevice9_DrawPrimitiveUP(data->device, D3DPT_TRIANGLEFAN, 2, vertices, sizeof(*vertices)); if (FAILED(result)) { - D3D_SetError("DrawPrimitiveUP()", result); - return -1; + return D3D_SetError("DrawPrimitiveUP()", result); } if (shader) { result = IDirect3DDevice9_SetPixelShader(data->device, NULL); if (FAILED(result)) { - D3D_SetError("SetShader()", result); - return -1; + return D3D_SetError("SetShader()", result); } } ID3DXMatrixStack_Pop(data->matrixStack); @@ -1379,30 +1399,26 @@ D3D_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect, result = IDirect3DDevice9_GetBackBuffer(data->device, 0, 0, D3DBACKBUFFER_TYPE_MONO, &backBuffer); if (FAILED(result)) { - D3D_SetError("GetBackBuffer()", result); - return -1; + return D3D_SetError("GetBackBuffer()", result); } result = IDirect3DSurface9_GetDesc(backBuffer, &desc); if (FAILED(result)) { - D3D_SetError("GetDesc()", result); IDirect3DSurface9_Release(backBuffer); - return -1; + return D3D_SetError("GetDesc()", result); } result = IDirect3DDevice9_CreateOffscreenPlainSurface(data->device, desc.Width, desc.Height, desc.Format, D3DPOOL_SYSTEMMEM, &surface, NULL); if (FAILED(result)) { - D3D_SetError("CreateOffscreenPlainSurface()", result); IDirect3DSurface9_Release(backBuffer); - return -1; + return D3D_SetError("CreateOffscreenPlainSurface()", result); } result = IDirect3DDevice9_GetRenderTargetData(data->device, backBuffer, surface); if (FAILED(result)) { - D3D_SetError("GetRenderTargetData()", result); IDirect3DSurface9_Release(surface); IDirect3DSurface9_Release(backBuffer); - return -1; + return D3D_SetError("GetRenderTargetData()", result); } d3drect.left = rect->x; @@ -1412,10 +1428,9 @@ D3D_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect, result = IDirect3DSurface9_LockRect(surface, &locked, &d3drect, D3DLOCK_READONLY); if (FAILED(result)) { - D3D_SetError("LockRect()", result); IDirect3DSurface9_Release(surface); IDirect3DSurface9_Release(backBuffer); - return -1; + return D3D_SetError("LockRect()", result); } SDL_ConvertPixels(rect->w, rect->h, @@ -1476,18 +1491,22 @@ D3D_DestroyRenderer(SDL_Renderer * renderer) D3D_RenderData *data = (D3D_RenderData *) renderer->driverdata; if (data) { - // Release the render target - IDirect3DSurface9_Release(data->defaultRenderTarget); + /* Release the render target */ + if (data->defaultRenderTarget) { + IDirect3DSurface9_Release(data->defaultRenderTarget); + data->defaultRenderTarget = NULL; + } if (data->currentRenderTarget != NULL) { IDirect3DSurface9_Release(data->currentRenderTarget); data->currentRenderTarget = NULL; } - + if (data->device) { IDirect3DDevice9_Release(data->device); } if (data->d3d) { IDirect3D9_Release(data->d3d); + ID3DXMatrixStack_Release(data->matrixStack); SDL_UnloadObject(data->d3dDLL); } SDL_free(data); diff --git a/src/eepp/helper/SDL2/src/render/nds/SDL_libgl2D.c b/src/eepp/helper/SDL2/src/render/nds/SDL_libgl2D.c deleted file mode 100644 index 7ba9be072..000000000 --- a/src/eepp/helper/SDL2/src/render/nds/SDL_libgl2D.c +++ /dev/null @@ -1,315 +0,0 @@ -/* - * Note: The Nintendo DS port to SDL uses excerpts from the libGL2D, - * with permission of the original author. The following is mostly his - * code/comments. - * - * - * Easy GL2D - * - * Relminator 2010 - * Richard Eric M. Lope BSN RN - * - * http://rel.betterwebber.com - * - * A very small and simple DS rendering lib using the 3d core to render 2D stuff - */ -#include "SDL_config.h" - -#if SDL_VIDEO_RENDER_NDS - -#include "SDL_libgl2D.h" - -/* - * Our static global variable used for Depth values since we cannot - * disable depth testing in the DS hardware This value is incremented - * for every draw call. */ -v16 g_depth; -int gCurrentTexture; - -/* - * !!! PRIVATE !!! Set orthographic projection at 1:1 correspondence - * to screen coords glOrtho expects f32 values but if we use the - * standard f32 values, we need to rescale either every vert or the - * modelview matrix by the same amount to make it work. That's gonna - * give us lots of overflows and headaches. So we "scale down" and - * use an all integer value. - */ -void SetOrtho(void) -{ - glMatrixMode(GL_PROJECTION); // set matrixmode to projection - glLoadIdentity(); // reset - glOrthof32(0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, -1 << 12, 1 << 12); // downscale projection matrix -} - -/* - * Initializes GL in 2D mode Also initializes GL in 3d mode so that we - * could combine 2D and 3D later Almost a direct copy from the DS - * example files - */ -void glScreen2D(void) -{ - // initialize gl - glInit(); - - // enable textures - glEnable(GL_TEXTURE_2D); - - // enable antialiasing - glEnable(GL_ANTIALIAS); - - // setup the rear plane - glClearColor(0, 0, 0, 31); // BG must be opaque for AA to work - glClearPolyID(63); // BG must have a unique polygon ID for AA to work - - glClearDepth(GL_MAX_DEPTH); - - // this should work the same as the normal gl call - glViewport(0,0,255,191); - - // any floating point gl call is being converted to fixed prior to being implemented - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - gluPerspective(70, 256.0 / 192.0, 1, 200); - - gluLookAt( 0.0, 0.0, 1.0, //camera possition - 0.0, 0.0, 0.0, //look at - 0.0, 1.0, 0.0); //up - - glMaterialf(GL_AMBIENT, RGB15(31,31,31)); - glMaterialf(GL_DIFFUSE, RGB15(31,31,31)); - glMaterialf(GL_SPECULAR, BIT(15) | RGB15(31,31,31)); - glMaterialf(GL_EMISSION, RGB15(31,31,31)); - - // ds uses a table for shinyness..this generates a half-ass one - glMaterialShinyness(); - - // not a real gl function and will likely change - glPolyFmt(POLY_ALPHA(31) | POLY_CULL_BACK); -} - -/* - * Sets up OpenGL for 2d rendering Call this before drawing any of - * GL2D's drawing or sprite functions. - */ -void glBegin2D(void) -{ - // save 3d perpective projection matrix - glMatrixMode(GL_PROJECTION); - glPushMatrix(); - - // save 3d modelview matrix for safety - glMatrixMode(GL_MODELVIEW); - glPushMatrix(); - - - // what?!! No glDisable(GL_DEPTH_TEST)?!!!!!! - glEnable(GL_BLEND); - glEnable(GL_TEXTURE_2D); - glDisable(GL_ANTIALIAS); // disable AA - glDisable(GL_OUTLINE); // disable edge-marking - - glColor(0x7FFF); // max color - - glPolyFmt(POLY_ALPHA(31) | POLY_CULL_NONE); // no culling - - SetOrtho(); - - glMatrixMode(GL_TEXTURE); // reset texture matrix just in case we did some funky stuff with it - glLoadIdentity(); - - glMatrixMode(GL_MODELVIEW); // reset modelview matrix. No need to scale up by << 12 - glLoadIdentity(); - - gCurrentTexture = 0; // set current texture to 0 - g_depth = 0; // set depth to 0. We need this var since we cannot disable depth testing -} - -/* - * Issue this after drawing 2d so that we don't mess the matrix stack. - * The complement of glBegin2D. - */ -void glEnd2D(void) -{ - // restore 3d matrices and set current matrix to modelview - glMatrixMode(GL_PROJECTION); - glPopMatrix(1); - glMatrixMode(GL_MODELVIEW); - glPopMatrix(1); -} - -/* - * Draws a pixel - * Parameters: - * x,y -> First coordinate of the line - * color -> RGB15/ARGB16 color - */ -void glPutPixel(int x, int y, int color) -{ - glBindTexture(0, 0); - glColor(color); - glBegin(GL_TRIANGLES); - gxVertex3i(x, y, g_depth); - gxVertex2i(x, y); - gxVertex2i(x, y); - glEnd(); - glColor(0x7FFF); - g_depth++; - gCurrentTexture = 0; -} - -/* - * Draws a line - * Parameters: - * x1,y1 -> First coordinate of the line - * x2,y2 -> Second coordinate of the line - * color -> RGB15/ARGB16 color - */ -void glLine(int x1, int y1, int x2, int y2, int color) -{ - x2++; - y2++; - - glBindTexture(0, 0); - glColor(color); - glBegin(GL_TRIANGLES); - gxVertex3i(x1, y1, g_depth); - gxVertex2i(x2, y2); - gxVertex2i(x2, y2); - glEnd(); - glColor(0x7FFF); - g_depth++; - gCurrentTexture = 0; -} - -/* - * Draws a Filled Box - * Parameters: - * x1,y1 -> Top-left corner of the box - * x2,y2 -> Bottom-Right corner of the box - * color -> RGB15/ARGB16 color -*/ -void glBoxFilled(int x1, int y1, int x2, int y2, int color) -{ - x2++; - y2++; - - glBindTexture(0, 0); - glColor(color); - glBegin(GL_QUADS); - gxVertex3i(x1, y1, g_depth); // use 3i for first vertex so that we increment HW depth - gxVertex2i(x1, y2); // no need for 3 vertices as 2i would share last depth call - gxVertex2i(x2, y2); - gxVertex2i(x2, y1); - glEnd(); - glColor(0x7FFF); - g_depth++; - gCurrentTexture = 0; -} - -/* - * - * Create a tile. - * Very rigid and prone to human error. - * - * Parameters: - * *sprite -> pointer to a glImage - * texture_width -> width/height of the texture; - * texture_height -> valid sizes are enumerated in GL_TEXTURE_TYPE_ENUM (see glTexImage2d) - * sprite_width - * sprite_height -> width/height of the picture in the texture. - * type -> The format of the texture (see glTexImage2d) - * param -> parameters for the texture (see glTexImage2d) - */ -int glLoadTile(glImage *sprite, - int texture_width, - int texture_height, - int sprite_width, - int sprite_height, - GL_TEXTURE_TYPE_ENUM type, - int param, - int pallette_width, - const u16 *palette, - const uint8 *texture) -{ - int textureID; - - glGenTextures(1, &textureID); - glBindTexture(0, textureID); - glTexImage2D(0, 0, type, texture_width, texture_height, 0, param, texture); - glColorTableEXT(0, 0, pallette_width, 0, 0, palette); - - sprite->width = sprite_width; - sprite->height = sprite_height; - sprite->textureID = textureID; - - return textureID; -} - -/* - * I made this since the scale wrappers are either the vectorized mode - * or does not permit you to scale only the axis you want to - * scale. Needed for sprite scaling. - */ -static inline void gxScalef32(s32 x, s32 y, s32 z) -{ - MATRIX_SCALE = x; - MATRIX_SCALE = y; - MATRIX_SCALE = z; -} - -/* - * I this made for future naming conflicts. - */ -static inline void gxTranslate3f32(int32 x, int32 y, int32 z) -{ - MATRIX_TRANSLATE = x; - MATRIX_TRANSLATE = y; - MATRIX_TRANSLATE = z; -} - -/* - * Draws an axis exclusive scaled sprite - * Parameters: - * x -> x position of the sprite - * y -> y position of the sprite - * scaleX -> 20.12 FP X axis scale value (1 << 12 is normal) - * scaleY -> 20.12 FP Y axis scale value (1 << 12 is normal) - * flipmode -> mode for flipping (see GL_FLIP_MODE enum) - * *spr -> pointer to a glImage - */ -void glSpriteScaleXY(int x, int y, s32 scaleX, s32 scaleY, int flipmode, const glImage *spr) -{ - const int x1 = 0; - const int y1 = 0; - const int x2 = spr->width; - const int y2 = spr->height; - const int u1 = ((flipmode & GL_FLIP_H) ? spr->width-1 : 0); - const int u2 = ((flipmode & GL_FLIP_H) ? 0 : spr->width-1); - const int v1 = ((flipmode & GL_FLIP_V) ? spr->height-1 : 0); - const int v2 = ((flipmode & GL_FLIP_V) ? 0 : spr->height-1); - - if (spr->textureID != gCurrentTexture) - { - glBindTexture(GL_TEXTURE_2D, spr->textureID); - gCurrentTexture = spr->textureID; - } - - glPushMatrix(); - - gxTranslate3f32(x, y, 0); - gxScalef32(scaleX, scaleY, 1 << 12); - - glBegin(GL_QUADS); - - gxTexcoord2i(u1, v1); gxVertex3i(x1, y1, g_depth); - gxTexcoord2i(u1, v2); gxVertex2i(x1, y2); - gxTexcoord2i(u2, v2); gxVertex2i(x2, y2); - gxTexcoord2i(u2, v1); gxVertex2i(x2, y1); - - glEnd(); - - glPopMatrix(1); - g_depth++; -} - -#endif /* SDL_VIDEO_RENDER_NDS */ diff --git a/src/eepp/helper/SDL2/src/render/nds/SDL_libgl2D.h b/src/eepp/helper/SDL2/src/render/nds/SDL_libgl2D.h deleted file mode 100644 index 4d56f0e89..000000000 --- a/src/eepp/helper/SDL2/src/render/nds/SDL_libgl2D.h +++ /dev/null @@ -1,154 +0,0 @@ -/* - * Note: The Nintendo DS port to SDL uses excerpts from the libGL2D, - * with permission of the original author. The following is mostly his - * code/comments. - * - * - * Easy GL2D - * - * Relminator 2010 - * Richard Eric M. Lope BSN RN - * - * http://rel.betterwebber.com - * - * A very small and simple DS rendering lib using the 3d core to render 2D stuff - */ -#include "SDL_config.h" - -#if SDL_VIDEO_RENDER_NDS - -#include - -/* LibGL extension(s) */ -static inline void gxTexcoord2i(t16 u, t16 v) -{ - GFX_TEX_COORD = (v << 20) | ((u << 4) & 0xFFFF); -} - -static inline void gxVertex3i(v16 x, v16 y, v16 z) -{ - GFX_VERTEX16 = (y << 16) | (x & 0xFFFF); - GFX_VERTEX16 = ((uint32)(uint16)z); -} - -static inline void gxVertex2i(v16 x, v16 y) -{ - GFX_VERTEX_XY = (y << 16) | (x & 0xFFFF); -} - -/* - * Enums selecting flipping mode. - * - * These enums are bits for flipping the sprites. - * You can "|" (or) GL_FLIP_V and GL_FLIP_H to flip - * both ways. - */ -typedef enum -{ - GL_FLIP_NONE = (1 << 0), /* No flipping */ - GL_FLIP_V = (1 << 1), /* Sprite is rendered vertically flipped */ - GL_FLIP_H = (1 << 2), /* Sprite is rendered horizontally flipped */ -} GL_FLIP_MODE; - -/* Struct for out GL-Based Images. */ -typedef struct -{ - int width; /* Width of the Sprite */ - int height; /* Height of the Sprite */ - int textureID; /* Texture handle (used in glDeleteTextures()) - The texture handle in VRAM (returned by glGenTextures()) - ie. This references the actual texture stored in VRAM. */ -} glImage; - -extern v16 g_depth; -extern int gCurrentTexture; - -/* - * Draws an Axis Exclusive Scaled Sprite - * Parameters: - * x X position of the sprite. - * y Y position of the sprite. - * scaleX 20.12 fixed-point X-Axis scale value (1 << 12 is normal). - * scaleY 20.12 fixed-point Y-Axis scale value (1 << 12 is normal). - * flipmode mode for flipping (see GL_FLIP_MODE enum). - * *spr pointer to a glImage. -*/ -void glSpriteScaleXY(int x, int y, s32 scaleX, s32 scaleY, int flipmode, const glImage *spr); - -/* Initializes our Tileset (like glInitSpriteset()) but without the use of Texture Packer auto-generated files. - * Can only be used when tiles in a tilset are of the same dimensions. - * Parameters: - * *sprite Pointer to an array of glImage. - * tile_wid Width of each tile in the texture. - * tile_hei Height of each tile in the texture. - * bmp_wid Width of of the texture or tileset. - * bmp_hei height of of the texture or tileset. - * type The format of the texture (see glTexImage2d()). - * sizeX The horizontal size of the texture; valid sizes are enumerated in GL_TEXTURE_TYPE_ENUM (see glTexImage2d()). - * sizeY The vertical size of the texture; valid sizes are enumerated in GL_TEXTURE_TYPE_ENUM (see glTexImage2d()). - * param parameters for the texture (see glTexImage2d()). - * pallette_width Length of the palette. Valid values are 4, 16, 32, 256 (if 0, then palette is removed from currently bound texture). - * *palette Pointer to the palette data to load (if NULL, then palette is removed from currently bound texture). - * *texture Pointer to the texture data to load. -*/ -int glLoadTile(glImage *sprite, - int texture_width, - int texture_height, - int sprite_width, - int sprite_height, - GL_TEXTURE_TYPE_ENUM type, - int param, - int pallette_width, - const u16 *palette, - const uint8 *texture); - -/* Initializes GL in 2D mode */ -void glScreen2D(void); - -/* - * Sets up OpenGL for 2d rendering. - * - * Call this before drawing any of GL2D's drawing or sprite functions. - */ -void glBegin2D(void); - -/* - * Issue this after drawing 2d so that we don't mess the matrix stack. - * - * The complement of glBegin2D(). - */ -void glEnd2D(void); - -/* - * Draws a Pixel - * x X position of the pixel. - * y Y position of the pixel. - * color RGB15/ARGB16 color. - */ -void glPutPixel(int x, int y, int color); - -/* - * Draws a Line - * x1,y1 Top-Left coordinate of the line. - * x2,y2 Bottom-Right coordinate of the line. - * color RGB15/ARGB16 color. - */ -void glLine(int x1, int y1, int x2, int y2, int color); - -/* - * Draws a Box - * x1,y1 Top-Left coordinate of the box. - * x2,y2 Bottom-Right coordinate of the box. - * color RGB15/ARGB16 color. -*/ -void glBox(int x1, int y1, int x2, int y2, int color); - -/* - * Draws a Filled Box - * x1,y1 Top-Left coordinate of the box. - * x2,y2 Bottom-Right coordinate of the box. - * color RGB15/ARGB16 color. - */ -void glBoxFilled(int x1, int y1, int x2, int y2, int color); - -#endif /* SDL_VIDEO_RENDER_NDS */ diff --git a/src/eepp/helper/SDL2/src/render/nds/SDL_ndsrender.c b/src/eepp/helper/SDL2/src/render/nds/SDL_ndsrender.c deleted file mode 100644 index 4666bb031..000000000 --- a/src/eepp/helper/SDL2/src/render/nds/SDL_ndsrender.c +++ /dev/null @@ -1,418 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga - - 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 - appreciated but is not required. - 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. -*/ -#include "SDL_config.h" - -#if SDL_VIDEO_RENDER_NDS - -#include -#include -#include - -#include "SDL_libgl2D.h" - -#include "SDL_video.h" -#include "../../video/SDL_sysvideo.h" -#include "SDL_render.h" -#include "../SDL_sysrender.h" -#include "SDL_log.h" - -/* Draws a partial sprite. Based on glSprite. */ -static void glSpritePartial(const SDL_Rect * srcrect, int x, int y, int flipmode, const glImage *spr) -{ - int x1 = x; - int y1 = y; - int x2 = x + srcrect->w; - int y2 = y + srcrect->h; - - int u1 = srcrect->x + ((flipmode & GL_FLIP_H) ? spr->width-1 : 0); - int u2 = srcrect->x + ((flipmode & GL_FLIP_H) ? 0 : srcrect->h); - int v1 = srcrect->y + ((flipmode & GL_FLIP_V) ? spr->height-1 : 0); - int v2 = srcrect->y + ((flipmode & GL_FLIP_V) ? 0 : srcrect->h); - - if (spr->textureID != gCurrentTexture) { - glBindTexture(GL_TEXTURE_2D, spr->textureID); - gCurrentTexture = spr->textureID; - } - - glBegin(GL_QUADS); - - gxTexcoord2i(u1, v1); gxVertex3i(x1, y1, g_depth); - gxTexcoord2i(u1, v2); gxVertex2i(x1, y2); - gxTexcoord2i(u2, v2); gxVertex2i(x2, y2); - gxTexcoord2i(u2, v1); gxVertex2i(x2, y1); - - glEnd(); - - g_depth++; -} - -/* SDL NDS renderer implementation */ - -extern SDL_RenderDriver NDS_RenderDriver; - -typedef struct -{ - /* Whether current 3D engine is on the main or sub screen. */ - int is_sub; -} NDS_RenderData; - -typedef struct -{ - glImage image[1]; -} NDS_TextureData; - -static int NDS_UpdateViewport(SDL_Renderer *renderer) -{ - /* Nothing to do. */ - return 0; -} - -static int -NDS_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture, - const SDL_Rect * srcrect, const SDL_Rect * dstrect) -{ - NDS_RenderData *data = (NDS_RenderData *) renderer->driverdata; - NDS_TextureData *txdat = (NDS_TextureData *) texture->driverdata; - int dest_y; - - if (data->is_sub) { - dest_y = dstrect->y; - } else { - dest_y = dstrect->y-SCREEN_HEIGHT; - } - - if (srcrect->w == dstrect->w && srcrect->h == dstrect->h) { - /* No scaling */ - glSpritePartial(srcrect, dstrect->x, dest_y, GL_FLIP_NONE, txdat->image); - } else { - /* Convert the scaling proportion into a 20.12 value. */ - s32 scale_w = divf32(dstrect->w << 12, texture->w << 12); - s32 scale_h = divf32(dstrect->h << 12, texture->h << 12); - - glSpriteScaleXY(dstrect->x, dest_y, scale_w, scale_h, GL_FLIP_NONE, txdat->image); - } - - return 0; -} - -static int NDS_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture) -{ - NDS_TextureData *txdat = NULL; - int i; - - SDL_Log("NDS_CreateTexture: NDS_CreateTexture.\n"); - - /* Sanity checks. */ - for (i=0; iformat == NDS_RenderDriver.info.texture_formats[i]) - break; - } - if (i == NDS_RenderDriver.info.num_texture_formats) { - SDL_SetError("Unsupported texture format (%x)", texture->format); - return -1; - } - - if (texture->w > NDS_RenderDriver.info.max_texture_width) { - SDL_SetError("Texture too large (%d)", texture->w); - return -1; - } - - if (texture->h > NDS_RenderDriver.info.max_texture_height) { - SDL_SetError("Texture too tall (%d)", texture->h); - return -1; - } - - texture->driverdata = SDL_calloc(1, sizeof(NDS_TextureData)); - txdat = (NDS_TextureData *) texture->driverdata; - if (!txdat) { - SDL_OutOfMemory(); - return -1; - } - - return 0; -} - -static void -NDS_DestroyTexture(SDL_Renderer * renderer, SDL_Texture * texture) -{ - NDS_TextureData *txdat = texture->driverdata; - - /* free anything else allocated for texture */ - SDL_free(txdat); -} - -/* size is no more than 512. */ -static int get_gltexture_size(unsigned int size) -{ - if (size > 256) - return TEXTURE_SIZE_512; - else if (size > 128) - return TEXTURE_SIZE_256; - else if (size > 64) - return TEXTURE_SIZE_128; - else if (size > 32) - return TEXTURE_SIZE_64; - else if (size > 16) - return TEXTURE_SIZE_32; - else if (size > 8) - return TEXTURE_SIZE_16; - else - return TEXTURE_SIZE_8; -} - -static int NDS_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, - const SDL_Rect * rect, const void *pixels, int pitch) -{ - NDS_TextureData *txdat = (NDS_TextureData *) texture->driverdata; - char *new_pixels = NULL; - const int gl_w = get_gltexture_size(rect->w); - const int gl_h = get_gltexture_size(rect->h); - const int w = 1 << (3+gl_w); /* Texture sizes must be a power of 2. */ - const int h = 1 << (3+gl_h); /* Texture sizes must be a power of 2. */ - - if (w != rect->w || h != rect->h) { - /* Allocate a temporary surface and copy pixels into it while - * enlarging the pitch. */ - const char *src; - char *dst; - int new_pitch = 2 * w; - int i; - - new_pixels = malloc(2 * w * h); - if (!new_pixels) - return SDL_ENOMEM; - - src = pixels; - dst = new_pixels; - for (i=0; ih; i++) { - memcpy(dst, src, pitch); - src += pitch; - dst += new_pitch; - } - } - - glLoadTile(txdat->image, - gl_w, gl_h, - rect->w, rect->h, - texture->format == SDL_PIXELFORMAT_ABGR1555 ? GL_RGBA : GL_RGB, - TEXGEN_OFF, 0, NULL, - new_pixels? new_pixels : pixels); - - if (new_pixels) - free(new_pixels); - - return 0; -} - -static int NDS_LockTexture(SDL_Renderer *renderer, SDL_Texture *texture, - const SDL_Rect *rect, void **pixels, int *pitch) -{ - SDL_Log("enter %s (todo)\n", __func__); - - return 0; -} - -static void NDS_UnlockTexture(SDL_Renderer *renderer, SDL_Texture *texture) -{ - SDL_Log("enter %s\n", __func__); - /* stub! */ -} - -static int NDS_RenderClear(SDL_Renderer *renderer) -{ - glClearColor(renderer->r >> 3, - renderer->g >> 3, - renderer->b >> 3, - renderer->a >> 3); - - return 0; -} - -static void NDS_RenderPresent(SDL_Renderer * renderer) -{ - NDS_RenderData *data = (NDS_RenderData *) renderer->driverdata; - - glEnd2D(); - - glFlush(0); - - swiWaitForVBlank(); - - /* wait for capture unit to be ready */ - while(REG_DISPCAPCNT & DCAP_ENABLE); - - /* 3D engine can only work on one screen at a time. */ - data->is_sub = !data->is_sub; - if (data->is_sub) { - lcdMainOnBottom(); - vramSetBankC(VRAM_C_LCD); - vramSetBankD(VRAM_D_SUB_SPRITE); - REG_DISPCAPCNT = DCAP_BANK(2) | DCAP_ENABLE | DCAP_SIZE(3); - } else { - lcdMainOnTop(); - vramSetBankD(VRAM_D_LCD); - vramSetBankC(VRAM_C_SUB_BG); - REG_DISPCAPCNT = DCAP_BANK(3) | DCAP_ENABLE | DCAP_SIZE(3); - } - - glBegin2D(); -} - -static int NDS_RenderDrawPoints(SDL_Renderer *renderer, const SDL_Point *points, - int count) -{ - NDS_RenderData *data = (NDS_RenderData *) renderer->driverdata; - int i; - int color = RGB15(renderer->r >> 3, - renderer->g >> 3, - renderer->b >> 3); - - for (i=0; i < count; i++) { - if (data->is_sub) { - glPutPixel(points[i].x, points[i].y, color); - } else { - glPutPixel(points[i].x, points[i].y - SCREEN_HEIGHT, color); - } - } - - return 0; -} - -static int NDS_RenderDrawLines(SDL_Renderer *renderer, const SDL_Point *points, - int count) -{ - NDS_RenderData *data = (NDS_RenderData *) renderer->driverdata; - int i; - int color = RGB15(renderer->r >> 3, - renderer->g >> 3, - renderer->b >> 3); - - for (i=0; i < count-1; i++) { - if (data->is_sub) { - glLine(points[i].x, points[i].y, points[i+1].x, points[i+1].y, color); - } else { - glLine(points[i].x, points[i].y - SCREEN_HEIGHT, - points[i+1].x, points[i+1].y - SCREEN_HEIGHT, color); - } - } - - return 0; -} - -static int NDS_RenderFillRects(SDL_Renderer *renderer, const SDL_Rect *rects, - int count) -{ - NDS_RenderData *data = (NDS_RenderData *) renderer->driverdata; - int i; - int color = RGB15(renderer->r >> 3, - renderer->g >> 3, - renderer->b >> 3); - - for (i=0; iis_sub) { - glBoxFilled(rects[i].x, rects[i].y, - rects[i].x + rects[i].w, - rects[i].y + rects[i].h, color); - } else { - glBoxFilled(rects[i].x, rects[i].y - SCREEN_HEIGHT, - rects[i].x + rects[i].w, - rects[i].y + rects[i].h - SCREEN_HEIGHT, - color); - } - } - - return 0; -} - -static SDL_Renderer * -NDS_CreateRenderer(SDL_Window * window, Uint32 flags) -{ - SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window); - SDL_DisplayMode *displayMode = &display->current_mode; - SDL_Renderer *renderer; - NDS_RenderData *data; - int bpp; - Uint32 Rmask, Gmask, Bmask, Amask; - - if (displayMode->format != SDL_PIXELFORMAT_ABGR1555) { - SDL_SetError("Unsupported pixel format (%x)", displayMode->format); - return NULL; - } - - if (!SDL_PixelFormatEnumToMasks(displayMode->format, &bpp, - &Rmask, &Gmask, &Bmask, &Amask)) { - SDL_SetError("Unknown display format"); - return NULL; - } - - renderer = (SDL_Renderer *) SDL_calloc(1, sizeof(*renderer)); - if (!renderer) { - SDL_OutOfMemory(); - return NULL; - } - - data = (NDS_RenderData *) SDL_calloc(1, sizeof(*data)); - if (!data) { - SDL_free(renderer); - SDL_OutOfMemory(); - return NULL; - } - - renderer->info = NDS_RenderDriver.info; - renderer->info.flags = SDL_RENDERER_ACCELERATED; - - renderer->CreateTexture = NDS_CreateTexture; - renderer->UpdateTexture = NDS_UpdateTexture; - renderer->LockTexture = NDS_LockTexture; - renderer->UnlockTexture = NDS_UnlockTexture; - renderer->UpdateViewport = NDS_UpdateViewport; - renderer->RenderClear = NDS_RenderClear; - renderer->RenderDrawPoints = NDS_RenderDrawPoints; - renderer->RenderDrawLines = NDS_RenderDrawLines; - renderer->RenderFillRects = NDS_RenderFillRects; - renderer->RenderCopy = NDS_RenderCopy; - /* renderer->RenderReadPixels = NDS_RenderReadPixels; - todo ? */ - renderer->RenderPresent = NDS_RenderPresent; - renderer->DestroyTexture = NDS_DestroyTexture; - /* renderer->DestroyRenderer = NDS_DestroyRenderer; - todo ? */ - - renderer->driverdata = data; - - return renderer; -} - -SDL_RenderDriver NDS_RenderDriver = { - .CreateRenderer = NDS_CreateRenderer, - .info = { - .name = "nds", - .flags = SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC, - .num_texture_formats = 2, - .texture_formats = { [0] = SDL_PIXELFORMAT_ABGR1555, - [1] = SDL_PIXELFORMAT_BGR555, - }, - .max_texture_width = 512, - .max_texture_height = 512, - } -}; - -#endif /* SDL_VIDEO_RENDER_NDS */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/eepp/helper/SDL2/src/render/opengl/SDL_glfuncs.h b/src/eepp/helper/SDL2/src/render/opengl/SDL_glfuncs.h index 03ee6b932..1fff29717 100644 --- a/src/eepp/helper/SDL2/src/render/opengl/SDL_glfuncs.h +++ b/src/eepp/helper/SDL2/src/render/opengl/SDL_glfuncs.h @@ -1,6 +1,6 @@ /* list of OpenGL functions sorted alphabetically If you need to use a GL function from the SDL video subsystem, - change it's entry from SDL_PROC_UNUSED to SDL_PROC and rebuild. + change its entry from SDL_PROC_UNUSED to SDL_PROC and rebuild. */ #define SDL_PROC_UNUSED(ret,func,params) @@ -152,7 +152,7 @@ SDL_PROC_UNUSED(void, glGetMaterialiv, SDL_PROC_UNUSED(void, glGetPixelMapfv, (GLenum map, GLfloat * values)) SDL_PROC_UNUSED(void, glGetPixelMapuiv, (GLenum map, GLuint * values)) SDL_PROC_UNUSED(void, glGetPixelMapusv, (GLenum map, GLushort * values)) -SDL_PROC_UNUSED(void, glGetPointerv, (GLenum pname, GLvoid * *params)) +SDL_PROC(void, glGetPointerv, (GLenum pname, GLvoid * *params)) SDL_PROC_UNUSED(void, glGetPolygonStipple, (GLubyte * mask)) SDL_PROC(const GLubyte *, glGetString, (GLenum name)) SDL_PROC_UNUSED(void, glGetTexEnvfv, diff --git a/src/eepp/helper/SDL2/src/render/opengl/SDL_render_gl.c b/src/eepp/helper/SDL2/src/render/opengl/SDL_render_gl.c index 9ec7115a0..6e37cf552 100644 --- a/src/eepp/helper/SDL2/src/render/opengl/SDL_render_gl.c +++ b/src/eepp/helper/SDL2/src/render/opengl/SDL_render_gl.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -56,6 +56,7 @@ static int GL_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture, static void GL_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture); static int GL_SetRenderTarget(SDL_Renderer * renderer, SDL_Texture * texture); static int GL_UpdateViewport(SDL_Renderer * renderer); +static int GL_UpdateClipRect(SDL_Renderer * renderer); static int GL_RenderClear(SDL_Renderer * renderer); static int GL_RenderDrawPoints(SDL_Renderer * renderer, const SDL_FPoint * points, int count); @@ -99,13 +100,21 @@ struct GL_FBOList typedef struct { SDL_GLContext context; + + SDL_bool debug_enabled; + SDL_bool GL_ARB_debug_output_supported; + int errors; + char **error_messages; + GLDEBUGPROCARB next_error_callback; + GLvoid *next_error_userparam; + SDL_bool GL_ARB_texture_rectangle_supported; struct { GL_Shader shader; Uint32 color; int blendMode; } current; - + SDL_bool GL_EXT_framebuffer_object_supported; GL_FBOList *framebuffers; @@ -118,7 +127,7 @@ typedef struct SDL_bool GL_ARB_multitexture_supported; PFNGLACTIVETEXTUREARBPROC glActiveTextureARB; GLint num_texture_units; - + PFNGLGENFRAMEBUFFERSEXTPROC glGenFramebuffersEXT; PFNGLDELETEFRAMEBUFFERSEXTPROC glDeleteFramebuffersEXT; PFNGLFRAMEBUFFERTEXTURE2DEXTPROC glFramebufferTexture2DEXT; @@ -146,11 +155,11 @@ typedef struct SDL_bool yuv; GLuint utexture; GLuint vtexture; - + GL_FBOList *fbo; } GL_TextureData; -static __inline__ const char* +SDL_FORCE_INLINE const char* GL_TranslateError (GLenum error) { #define GL_ERROR_TRANSLATE(e) case e: return #e; @@ -169,22 +178,65 @@ GL_TranslateError (GLenum error) #undef GL_ERROR_TRANSLATE } -static __inline__ int -GL_CheckAllErrors (const char *prefix, SDL_Renderer * renderer, const char *file, int line, const char *function) +SDL_FORCE_INLINE void +GL_ClearErrors(SDL_Renderer *renderer) +{ + GL_RenderData *data = (GL_RenderData *) renderer->driverdata; + + if (!data->debug_enabled) + { + return; + } + if (data->GL_ARB_debug_output_supported) { + if (data->errors) { + int i; + for (i = 0; i < data->errors; ++i) { + SDL_free(data->error_messages[i]); + } + SDL_free(data->error_messages); + + data->errors = 0; + data->error_messages = NULL; + } + } else { + while (data->glGetError() != GL_NO_ERROR) { + continue; + } + } +} + +SDL_FORCE_INLINE int +GL_CheckAllErrors (const char *prefix, SDL_Renderer *renderer, const char *file, int line, const char *function) { GL_RenderData *data = (GL_RenderData *) renderer->driverdata; int ret = 0; - /* check gl errors (can return multiple errors) */ - for (;;) { - GLenum error = data->glGetError(); - if (error != GL_NO_ERROR) { - if (prefix == NULL || prefix[0] == '\0') { - prefix = "generic"; + + if (!data->debug_enabled) + { + return 0; + } + if (data->GL_ARB_debug_output_supported) { + if (data->errors) { + int i; + for (i = 0; i < data->errors; ++i) { + SDL_SetError("%s: %s (%d): %s %s", prefix, file, line, function, data->error_messages[i]); + ret = -1; + } + GL_ClearErrors(renderer); + } + } else { + /* check gl errors (can return multiple errors) */ + for (;;) { + GLenum error = data->glGetError(); + if (error != GL_NO_ERROR) { + if (prefix == NULL || prefix[0] == '\0') { + prefix = "generic"; + } + SDL_SetError("%s: %s (%d): %s %s (0x%X)", prefix, file, line, function, GL_TranslateError(error), error); + ret = -1; + } else { + break; } - SDL_SetError("%s: %s (%d): %s %s (0x%X)", prefix, file, line, function, GL_TranslateError(error), error); - ret++; - } else { - break; } } return ret; @@ -208,8 +260,7 @@ GL_LoadFunctions(GL_RenderData * data) do { \ data->func = SDL_GL_GetProcAddress(#func); \ if ( ! data->func ) { \ - SDL_SetError("Couldn't load GL function %s: %s\n", #func, SDL_GetError()); \ - return -1; \ + return SDL_SetError("Couldn't load GL function %s: %s\n", #func, SDL_GetError()); \ } \ } while ( 0 ); #endif /* __SDL_NOGETPROCADDR__ */ @@ -226,6 +277,7 @@ GL_ActivateRenderer(SDL_Renderer * renderer) { GL_RenderData *data = (GL_RenderData *) renderer->driverdata; + GL_ClearErrors(renderer); if (SDL_CurrentContext != data->context) { if (SDL_GL_MakeCurrent(renderer->window, data->context) < 0) { return -1; @@ -264,8 +316,34 @@ GL_ResetState(SDL_Renderer *renderer) GL_CheckError("", renderer); } +static void APIENTRY +GL_HandleDebugMessage(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const char *message, void *userParam) +{ + SDL_Renderer *renderer = (SDL_Renderer *) userParam; + GL_RenderData *data = (GL_RenderData *) renderer->driverdata; -GL_FBOList * + if (type == GL_DEBUG_TYPE_ERROR_ARB) { + /* Record this error */ + ++data->errors; + data->error_messages = SDL_realloc(data->error_messages, data->errors * sizeof(*data->error_messages)); + if (data->error_messages) { + data->error_messages[data->errors-1] = SDL_strdup(message); + } + } + + /* If there's another error callback, pass it along, otherwise log it */ + if (data->next_error_callback) { + data->next_error_callback(source, type, id, severity, length, message, data->next_error_userparam); + } else { + if (type == GL_DEBUG_TYPE_ERROR_ARB) { + SDL_LogError(SDL_LOG_CATEGORY_RENDER, "%s", message); + } else { + SDL_LogDebug(SDL_LOG_CATEGORY_RENDER, "%s", message); + } + } +} + +static GL_FBOList * GL_GetFBO(GL_RenderData *data, Uint32 w, Uint32 h) { GL_FBOList *result = data->framebuffers; @@ -325,6 +403,7 @@ GL_CreateRenderer(SDL_Window * window, Uint32 flags) renderer->UnlockTexture = GL_UnlockTexture; renderer->SetRenderTarget = GL_SetRenderTarget; renderer->UpdateViewport = GL_UpdateViewport; + renderer->UpdateClipRect = GL_UpdateClipRect; renderer->RenderClear = GL_RenderClear; renderer->RenderDrawPoints = GL_RenderDrawPoints; renderer->RenderDrawLines = GL_RenderDrawLines; @@ -373,6 +452,23 @@ GL_CreateRenderer(SDL_Window * window, Uint32 flags) renderer->info.flags |= SDL_RENDERER_PRESENTVSYNC; } + /* Check for debug output support */ + if (SDL_GL_GetAttribute(SDL_GL_CONTEXT_FLAGS, &value) == 0 && + (value & SDL_GL_CONTEXT_DEBUG_FLAG)) { + data->debug_enabled = SDL_TRUE; + } + if (data->debug_enabled && SDL_GL_ExtensionSupported("GL_ARB_debug_output")) { + PFNGLDEBUGMESSAGECALLBACKARBPROC glDebugMessageCallbackARBFunc = (PFNGLDEBUGMESSAGECALLBACKARBPROC) SDL_GL_GetProcAddress("glDebugMessageCallbackARB"); + + data->GL_ARB_debug_output_supported = SDL_TRUE; + data->glGetPointerv(GL_DEBUG_CALLBACK_FUNCTION_ARB, (GLvoid **)&data->next_error_callback); + data->glGetPointerv(GL_DEBUG_CALLBACK_USER_PARAM_ARB, &data->next_error_userparam); + glDebugMessageCallbackARBFunc(GL_HandleDebugMessage, renderer); + + /* Make sure our callback is called when errors actually happen */ + data->glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB); + } + if (SDL_GL_ExtensionSupported("GL_ARB_texture_rectangle") || SDL_GL_ExtensionSupported("GL_EXT_texture_rectangle")) { data->GL_ARB_texture_rectangle_supported = SDL_TRUE; @@ -407,7 +503,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) @@ -441,7 +537,7 @@ GL_WindowEvent(SDL_Renderer * renderer, const SDL_WindowEvent *event) } } -static __inline__ int +SDL_FORCE_INLINE int power_of_2(int input) { int value = 1; @@ -452,7 +548,7 @@ power_of_2(int input) return value; } -static __inline__ SDL_bool +SDL_FORCE_INLINE SDL_bool convert_format(GL_RenderData *renderdata, Uint32 pixel_format, GLint* internalFormat, GLenum* format, GLenum* type) { @@ -500,15 +596,13 @@ GL_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) if (!convert_format(renderdata, texture->format, &internalFormat, &format, &type)) { - SDL_SetError("Texture format %s not supported by OpenGL", - SDL_GetPixelFormatName(texture->format)); - return -1; + return SDL_SetError("Texture format %s not supported by OpenGL", + SDL_GetPixelFormatName(texture->format)); } data = (GL_TextureData *) SDL_calloc(1, sizeof(*data)); if (!data) { - SDL_OutOfMemory(); - return -1; + return SDL_OutOfMemory(); } if (texture->access == SDL_TEXTUREACCESS_STREAMING) { @@ -522,14 +616,13 @@ GL_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) } data->pixels = SDL_calloc(1, size); if (!data->pixels) { - SDL_OutOfMemory(); SDL_free(data); - return -1; + return SDL_OutOfMemory(); } } texture->driverdata = data; - + if (texture->access == SDL_TEXTUREACCESS_TARGET) { data->fbo = GL_GetFBO(renderdata, texture->w, texture->h); } else { @@ -604,7 +697,7 @@ GL_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) texture_h, 0, format, type, NULL); } renderdata->glDisable(data->type); - if (GL_CheckError("glTexImage2D()", renderer) > 0) { + if (GL_CheckError("glTexImage2D()", renderer) < 0) { return -1; } @@ -643,8 +736,7 @@ GL_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) renderdata->glDisable(data->type); } - GL_CheckError("", renderer); - return 0; + return GL_CheckError("", renderer); } static int @@ -656,7 +748,6 @@ GL_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, GL_ActivateRenderer(renderer); - GL_CheckError("", renderer); renderdata->glEnable(data->type); renderdata->glBindTexture(data->type, data->texture); renderdata->glPixelStorei(GL_UNPACK_ALIGNMENT, 1); @@ -691,10 +782,7 @@ GL_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, data->format, data->formattype, pixels); } renderdata->glDisable(data->type); - if (GL_CheckError("glTexSubImage2D()", renderer) > 0) { - return -1; - } - return 0; + return GL_CheckError("glTexSubImage2D()", renderer); } static int @@ -704,7 +792,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; @@ -719,7 +807,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); @@ -728,12 +816,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; @@ -746,8 +834,7 @@ GL_SetRenderTarget(SDL_Renderer * renderer, SDL_Texture * texture) /* Check FBO status */ status = data->glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT); if (status != GL_FRAMEBUFFER_COMPLETE_EXT) { - SDL_SetError("glFramebufferTexture2DEXT() failed"); - return -1; + return SDL_SetError("glFramebufferTexture2DEXT() failed"); } return 0; } @@ -785,7 +872,21 @@ GL_UpdateViewport(SDL_Renderer * renderer) (GLdouble) 0, 0.0, 1.0); } - GL_CheckError("", renderer); + return GL_CheckError("", renderer); +} + +static int +GL_UpdateClipRect(SDL_Renderer * renderer) +{ + const SDL_Rect *rect = &renderer->clip_rect; + GL_RenderData *data = (GL_RenderData *) renderer->driverdata; + + if (!SDL_RectEmpty(rect)) { + data->glEnable(GL_SCISSOR_TEST); + data->glScissor(rect->x, renderer->viewport.h - rect->y - rect->h, rect->w, rect->h); + } else { + data->glDisable(GL_SCISSOR_TEST); + } return 0; } @@ -902,7 +1003,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 */ @@ -953,9 +1054,7 @@ GL_RenderDrawLines(SDL_Renderer * renderer, const SDL_FPoint * points, #endif data->glEnd(); } - GL_CheckError("", renderer); - - return 0; + return GL_CheckError("", renderer); } static int @@ -971,9 +1070,7 @@ GL_RenderFillRects(SDL_Renderer * renderer, const SDL_FRect * rects, int count) data->glRectf(rect->x, rect->y, rect->x + rect->w, rect->y + rect->h); } - GL_CheckError("", renderer); - - return 0; + return GL_CheckError("", renderer); } static int @@ -1040,9 +1137,7 @@ GL_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture, data->glDisable(texturedata->type); - GL_CheckError("", renderer); - - return 0; + return GL_CheckError("", renderer); } static int @@ -1055,6 +1150,7 @@ GL_RenderCopyEx(SDL_Renderer * renderer, SDL_Texture * texture, GLfloat minx, miny, maxx, maxy; GLfloat centerx, centery; GLfloat minu, maxu, minv, maxv; + GL_ActivateRenderer(renderer); data->glEnable(texturedata->type); @@ -1113,11 +1209,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); @@ -1129,12 +1225,10 @@ GL_RenderCopyEx(SDL_Renderer * renderer, SDL_Texture * texture, data->glVertex2f(maxx, maxy); data->glEnd(); data->glPopMatrix(); - + data->glDisable(texturedata->type); - GL_CheckError("", renderer); - - return 0; + return GL_CheckError("", renderer); } static int @@ -1157,8 +1251,7 @@ GL_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect, temp_pitch = rect->w * SDL_BYTESPERPIXEL(temp_format); temp_pixels = SDL_malloc(rect->h * temp_pitch); if (!temp_pixels) { - SDL_OutOfMemory(); - return -1; + return SDL_OutOfMemory(); } convert_format(data, temp_format, &internalFormat, &format, &type); @@ -1236,6 +1329,14 @@ GL_DestroyRenderer(SDL_Renderer * renderer) GL_RenderData *data = (GL_RenderData *) renderer->driverdata; if (data) { + GL_ClearErrors(renderer); + if (data->GL_ARB_debug_output_supported) { + PFNGLDEBUGMESSAGECALLBACKARBPROC glDebugMessageCallbackARBFunc = (PFNGLDEBUGMESSAGECALLBACKARBPROC) SDL_GL_GetProcAddress("glDebugMessageCallbackARB"); + + /* Uh oh, we don't have a safe way of removing ourselves from the callback chain, if it changed after we set our callback. */ + /* For now, just always replace the callback with the original one */ + glDebugMessageCallbackARBFunc(data->next_error_callback, data->next_error_userparam); + } if (data->shaders) { GL_DestroyShaderContext(data->shaders); } @@ -1247,8 +1348,7 @@ GL_DestroyRenderer(SDL_Renderer * renderer) GL_CheckError("", renderer); SDL_free(data->framebuffers); data->framebuffers = nextnode; - } - /* SDL_GL_MakeCurrent(0, NULL); *//* doesn't do anything */ + } SDL_GL_DeleteContext(data->context); } SDL_free(data); @@ -1256,7 +1356,9 @@ GL_DestroyRenderer(SDL_Renderer * renderer) SDL_free(renderer); } -static int GL_BindTexture (SDL_Renderer * renderer, SDL_Texture *texture, float *texw, float *texh) { +static int +GL_BindTexture (SDL_Renderer * renderer, SDL_Texture *texture, float *texw, float *texh) +{ GL_RenderData *data = (GL_RenderData *) renderer->driverdata; GL_TextureData *texturedata = (GL_TextureData *) texture->driverdata; GL_ActivateRenderer(renderer); @@ -1279,7 +1381,9 @@ static int GL_BindTexture (SDL_Renderer * renderer, SDL_Texture *texture, float return 0; } -static int GL_UnbindTexture (SDL_Renderer * renderer, SDL_Texture *texture) { +static int +GL_UnbindTexture (SDL_Renderer * renderer, SDL_Texture *texture) +{ GL_RenderData *data = (GL_RenderData *) renderer->driverdata; GL_TextureData *texturedata = (GL_TextureData *) texture->driverdata; GL_ActivateRenderer(renderer); @@ -1293,7 +1397,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/eepp/helper/SDL2/src/render/opengl/SDL_shaders_gl.c b/src/eepp/helper/SDL2/src/render/opengl/SDL_shaders_gl.c index 88876c789..1e6262191 100644 --- a/src/eepp/helper/SDL2/src/render/opengl/SDL_shaders_gl.c +++ b/src/eepp/helper/SDL2/src/render/opengl/SDL_shaders_gl.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -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"; } @@ -244,7 +244,7 @@ CompileShaderProgram(GL_ShaderContext *ctx, int index, GL_ShaderData *data) /* Set up some uniform variables */ ctx->glUseProgramObjectARB(data->program); for (i = 0; i < num_tmus_bound; ++i) { - char tex_name[5]; + char tex_name[10]; SDL_snprintf(tex_name, SDL_arraysize(tex_name), "tex%d", i); location = ctx->glGetUniformLocationARB(data->program, tex_name); if (location >= 0) { @@ -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/eepp/helper/SDL2/src/render/opengl/SDL_shaders_gl.h b/src/eepp/helper/SDL2/src/render/opengl/SDL_shaders_gl.h index 959582ac2..c4b7e0b18 100644 --- a/src/eepp/helper/SDL2/src/render/opengl/SDL_shaders_gl.h +++ b/src/eepp/helper/SDL2/src/render/opengl/SDL_shaders_gl.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/render/opengles/SDL_glesfuncs.h b/src/eepp/helper/SDL2/src/render/opengles/SDL_glesfuncs.h index aade01229..36f6fe7b6 100644 --- a/src/eepp/helper/SDL2/src/render/opengles/SDL_glesfuncs.h +++ b/src/eepp/helper/SDL2/src/render/opengles/SDL_glesfuncs.h @@ -20,6 +20,7 @@ SDL_PROC(void, glMatrixMode, (GLenum)) SDL_PROC(void, glOrthof, (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat)) SDL_PROC(void, glPixelStorei, (GLenum, GLint)) SDL_PROC(void, glReadPixels, (GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, GLvoid*)) +SDL_PROC(void, glScissor, (GLint, GLint, GLsizei, GLsizei)) SDL_PROC(void, glTexCoordPointer, (GLint, GLenum, GLsizei, const GLvoid *)) SDL_PROC(void, glTexEnvf, (GLenum, GLenum, GLfloat)) SDL_PROC(void, glTexImage2D, (GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *)) diff --git a/src/eepp/helper/SDL2/src/render/opengles/SDL_render_gles.c b/src/eepp/helper/SDL2/src/render/opengles/SDL_render_gles.c index e2612f366..bd3eedfea 100644 --- a/src/eepp/helper/SDL2/src/render/opengles/SDL_render_gles.c +++ b/src/eepp/helper/SDL2/src/render/opengles/SDL_render_gles.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -59,6 +59,7 @@ static void GLES_UnlockTexture(SDL_Renderer * renderer, static int GLES_SetRenderTarget(SDL_Renderer * renderer, SDL_Texture * texture); static int GLES_UpdateViewport(SDL_Renderer * renderer); +static int GLES_UpdateClipRect(SDL_Renderer * renderer); static int GLES_RenderClear(SDL_Renderer * renderer); static int GLES_RenderDrawPoints(SDL_Renderer * renderer, const SDL_FPoint * points, int count); @@ -135,7 +136,7 @@ typedef struct GLES_FBOList *fbo; } GLES_TextureData; -static void +static int GLES_SetError(const char *prefix, GLenum result) { const char *error; @@ -166,7 +167,7 @@ GLES_SetError(const char *prefix, GLenum result) error = "UNKNOWN"; break; } - SDL_SetError("%s: %s", prefix, error); + return SDL_SetError("%s: %s", prefix, error); } static int GLES_LoadFunctions(GLES_RenderData * data) @@ -186,10 +187,9 @@ static int GLES_LoadFunctions(GLES_RenderData * data) do { \ data->func = SDL_GL_GetProcAddress(#func); \ if ( ! data->func ) { \ - SDL_SetError("Couldn't load GLES function %s: %s\n", #func, SDL_GetError()); \ - return -1; \ + 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) { @@ -304,6 +304,7 @@ GLES_CreateRenderer(SDL_Window * window, Uint32 flags) renderer->UnlockTexture = GLES_UnlockTexture; renderer->SetRenderTarget = GLES_SetRenderTarget; renderer->UpdateViewport = GLES_UpdateViewport; + renderer->UpdateClipRect = GLES_UpdateClipRect; renderer->RenderClear = GLES_RenderClear; renderer->RenderDrawPoints = GLES_RenderDrawPoints; renderer->RenderDrawLines = GLES_RenderDrawLines; @@ -385,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) { @@ -442,23 +443,20 @@ GLES_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) type = GL_UNSIGNED_BYTE; break; default: - SDL_SetError("Texture format not supported"); - return -1; + return SDL_SetError("Texture format not supported"); } data = (GLES_TextureData *) SDL_calloc(1, sizeof(*data)); if (!data) { - SDL_OutOfMemory(); - return -1; + return SDL_OutOfMemory(); } if (texture->access == SDL_TEXTUREACCESS_STREAMING) { data->pitch = texture->w * SDL_BYTESPERPIXEL(texture->format); data->pixels = SDL_calloc(1, texture->h * data->pitch); if (!data->pixels) { - SDL_OutOfMemory(); SDL_free(data); - return -1; + return SDL_OutOfMemory(); } } @@ -495,8 +493,7 @@ GLES_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) result = renderdata->glGetError(); if (result != GL_NO_ERROR) { - GLES_SetError("glTexImage2D()", result); - return -1; + return GLES_SetError("glTexImage2D()", result); } return 0; } @@ -521,17 +518,13 @@ GLES_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, /* Reformat the texture data into a tightly packed array */ srcPitch = rect->w * SDL_BYTESPERPIXEL(texture->format); src = (Uint8 *)pixels; - if (pitch != srcPitch) - { + if (pitch != srcPitch) { blob = (Uint8 *)SDL_malloc(srcPitch * rect->h); - if (!blob) - { - SDL_OutOfMemory(); - return -1; + if (!blob) { + return SDL_OutOfMemory(); } src = blob; - for (y = 0; y < rect->h; ++y) - { + for (y = 0; y < rect->h; ++y) { SDL_memcpy(src, pixels, srcPitch); src += srcPitch; pixels = (Uint8 *)pixels + pitch; @@ -559,8 +552,7 @@ GLES_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, if (renderdata->glGetError() != GL_NO_ERROR) { - SDL_SetError("Failed to update texture"); - return -1; + return SDL_SetError("Failed to update texture"); } return 0; } @@ -613,8 +605,7 @@ GLES_SetRenderTarget(SDL_Renderer * renderer, SDL_Texture * texture) /* Check FBO status */ status = data->glCheckFramebufferStatusOES(GL_FRAMEBUFFER_OES); if (status != GL_FRAMEBUFFER_COMPLETE_OES) { - SDL_SetError("glFramebufferTexture2DOES() failed"); - return -1; + return SDL_SetError("glFramebufferTexture2DOES() failed"); } return 0; } @@ -641,6 +632,26 @@ GLES_UpdateViewport(SDL_Renderer * renderer) return 0; } +static int +GLES_UpdateClipRect(SDL_Renderer * renderer) +{ + GLES_RenderData *data = (GLES_RenderData *) renderer->driverdata; + const SDL_Rect *rect = &renderer->clip_rect; + + if (SDL_CurrentContext != data->context) { + /* We'll update the clip rect after we rebind the context */ + return 0; + } + + if (!SDL_RectEmpty(rect)) { + data->glEnable(GL_SCISSOR_TEST); + data->glScissor(rect->x, renderer->viewport.h - rect->y - rect->h, rect->w, rect->h); + } else { + data->glDisable(GL_SCISSOR_TEST); + } + return 0; +} + static void GLES_SetColor(GLES_RenderData * data, Uint8 r, Uint8 g, Uint8 b, Uint8 a) { @@ -754,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; @@ -804,7 +815,6 @@ static int GLES_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture, const SDL_Rect * srcrect, const SDL_FRect * dstrect) { - GLES_RenderData *data = (GLES_RenderData *) renderer->driverdata; GLES_TextureData *texturedata = (GLES_TextureData *) texture->driverdata; GLfloat minx, miny, maxx, maxy; @@ -910,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); @@ -930,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); @@ -1007,8 +1017,7 @@ GLES_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect, temp_pitch = rect->w * SDL_BYTESPERPIXEL(temp_format); temp_pixels = SDL_malloc(rect->h * temp_pitch); if (!temp_pixels) { - SDL_OutOfMemory(); - return -1; + return SDL_OutOfMemory(); } SDL_GetWindowSize(window, &w, &h); @@ -1091,7 +1100,8 @@ GLES_DestroyRenderer(SDL_Renderer * renderer) SDL_free(renderer); } -static int GLES_BindTexture (SDL_Renderer * renderer, SDL_Texture *texture, float *texw, float *texh) { +static int GLES_BindTexture (SDL_Renderer * renderer, SDL_Texture *texture, float *texw, float *texh) +{ GLES_RenderData *data = (GLES_RenderData *) renderer->driverdata; GLES_TextureData *texturedata = (GLES_TextureData *) texture->driverdata; GLES_ActivateRenderer(renderer); @@ -1105,7 +1115,8 @@ static int GLES_BindTexture (SDL_Renderer * renderer, SDL_Texture *texture, floa return 0; } -static int GLES_UnbindTexture (SDL_Renderer * renderer, SDL_Texture *texture) { +static int GLES_UnbindTexture (SDL_Renderer * renderer, SDL_Texture *texture) +{ GLES_RenderData *data = (GLES_RenderData *) renderer->driverdata; GLES_TextureData *texturedata = (GLES_TextureData *) texture->driverdata; GLES_ActivateRenderer(renderer); @@ -1114,7 +1125,6 @@ static int GLES_UnbindTexture (SDL_Renderer * renderer, SDL_Texture *texture) { return 0; } - #endif /* SDL_VIDEO_RENDER_OGL_ES && !SDL_RENDER_DISABLED */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/eepp/helper/SDL2/src/render/opengles2/SDL_gles2funcs.h b/src/eepp/helper/SDL2/src/render/opengles2/SDL_gles2funcs.h index 7b7d5e17d..d7cd1d515 100644 --- a/src/eepp/helper/SDL2/src/render/opengles2/SDL_gles2funcs.h +++ b/src/eepp/helper/SDL2/src/render/opengles2/SDL_gles2funcs.h @@ -30,6 +30,7 @@ SDL_PROC(GLint, glGetUniformLocation, (GLuint, const char *)) SDL_PROC(void, glLinkProgram, (GLuint)) SDL_PROC(void, glPixelStorei, (GLenum, GLint)) SDL_PROC(void, glReadPixels, (GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, GLvoid*)) +SDL_PROC(void, glScissor, (GLint, GLint, GLsizei, GLsizei)) SDL_PROC(void, glShaderBinary, (GLsizei, const GLuint *, GLenum, const void *, GLsizei)) SDL_PROC(void, glShaderSource, (GLuint, GLsizei, const char **, const GLint *)) SDL_PROC(void, glTexImage2D, (GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, const void *)) diff --git a/src/eepp/helper/SDL2/src/render/opengles2/SDL_render_gles2.c b/src/eepp/helper/SDL2/src/render/opengles2/SDL_render_gles2.c index 69b0aab8c..3933100d6 100644 --- a/src/eepp/helper/SDL2/src/render/opengles2/SDL_render_gles2.c +++ b/src/eepp/helper/SDL2/src/render/opengles2/SDL_render_gles2.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -189,8 +189,7 @@ static int GLES2_LoadFunctions(GLES2_DriverContext * data) do { \ data->func = SDL_GL_GetProcAddress(#func); \ if ( ! data->func ) { \ - SDL_SetError("Couldn't load GLES2 function %s: %s\n", #func, SDL_GetError()); \ - return -1; \ + return SDL_SetError("Couldn't load GLES2 function %s: %s\n", #func, SDL_GetError()); \ } \ } while ( 0 ); #endif /* _SDL_NOGETPROCADDR_ */ @@ -276,6 +275,26 @@ GLES2_UpdateViewport(SDL_Renderer * renderer) return 0; } +static int +GLES2_UpdateClipRect(SDL_Renderer * renderer) +{ + GLES2_DriverContext *rdata = (GLES2_DriverContext *)renderer->driverdata; + const SDL_Rect *rect = &renderer->clip_rect; + + if (SDL_CurrentContext != rdata->context) { + /* We'll update the clip rect after we rebind the context */ + return 0; + } + + if (!SDL_RectEmpty(rect)) { + rdata->glEnable(GL_SCISSOR_TEST); + rdata->glScissor(rect->x, renderer->viewport.h - rect->y - rect->h, rect->w, rect->h); + } else { + rdata->glDisable(GL_SCISSOR_TEST); + } + return 0; +} + static void GLES2_DestroyRenderer(SDL_Renderer *renderer) { @@ -372,16 +391,13 @@ GLES2_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture) type = GL_UNSIGNED_BYTE; break; default: - SDL_SetError("Texture format not supported"); - return -1; + return SDL_SetError("Texture format not supported"); } /* Allocate a texture struct */ tdata = (GLES2_TextureData *)SDL_calloc(1, sizeof(GLES2_TextureData)); - if (!tdata) - { - SDL_OutOfMemory(); - return -1; + if (!tdata) { + return SDL_OutOfMemory(); } tdata->texture = 0; tdata->texture_type = GL_TEXTURE_2D; @@ -390,15 +406,12 @@ GLES2_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture) scaleMode = GetScaleQuality(); /* Allocate a blob for image data */ - if (texture->access == SDL_TEXTUREACCESS_STREAMING) - { + if (texture->access == SDL_TEXTUREACCESS_STREAMING) { tdata->pitch = texture->w * SDL_BYTESPERPIXEL(texture->format); tdata->pixel_data = SDL_calloc(1, tdata->pitch * texture->h); - if (!tdata->pixel_data) - { - SDL_OutOfMemory(); + if (!tdata->pixel_data) { SDL_free(tdata); - return -1; + return SDL_OutOfMemory(); } } @@ -414,10 +427,9 @@ GLES2_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture) rdata->glTexImage2D(tdata->texture_type, 0, format, texture->w, texture->h, 0, format, type, NULL); if (rdata->glGetError() != GL_NO_ERROR) { - SDL_SetError("Texture creation failed"); rdata->glDeleteTextures(1, &tdata->texture); SDL_free(tdata); - return -1; + return SDL_SetError("Texture creation failed"); } texture->driverdata = tdata; @@ -497,13 +509,10 @@ GLES2_UpdateTexture(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect /* Reformat the texture data into a tightly packed array */ srcPitch = rect->w * SDL_BYTESPERPIXEL(texture->format); src = (Uint8 *)pixels; - if (pitch != srcPitch) - { + if (pitch != srcPitch) { blob = (Uint8 *)SDL_malloc(srcPitch * rect->h); - if (!blob) - { - SDL_OutOfMemory(); - return -1; + if (!blob) { + return SDL_OutOfMemory(); } src = blob; for (y = 0; y < rect->h; ++y) @@ -533,10 +542,8 @@ GLES2_UpdateTexture(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect SDL_free(blob); } - if (rdata->glGetError() != GL_NO_ERROR) - { - SDL_SetError("Failed to update texture"); - return -1; + if (rdata->glGetError() != GL_NO_ERROR) { + return SDL_SetError("Failed to update texture"); } return 0; } @@ -558,8 +565,7 @@ GLES2_SetRenderTarget(SDL_Renderer * renderer, SDL_Texture * texture) /* Check FBO status */ status = data->glCheckFramebufferStatus(GL_FRAMEBUFFER); if (status != GL_FRAMEBUFFER_COMPLETE) { - SDL_SetError("glFramebufferTexture2D() failed"); - return -1; + return SDL_SetError("glFramebufferTexture2D() failed"); } } return 0; @@ -636,9 +642,9 @@ GLES2_CacheProgram(SDL_Renderer *renderer, GLES2_ShaderCacheEntry *vertex, rdata->glGetProgramiv(entry->id, GL_LINK_STATUS, &linkSuccessful); if (rdata->glGetError() != GL_NO_ERROR || !linkSuccessful) { - SDL_SetError("Failed to link shader program"); rdata->glDeleteProgram(entry->id); SDL_free(entry); + SDL_SetError("Failed to link shader program"); return NULL; } @@ -930,10 +936,8 @@ GLES2_SetOrthographicProjection(SDL_Renderer *renderer) locProjection = rdata->current_program->uniform_locations[GLES2_UNIFORM_PROJECTION]; rdata->glGetError(); rdata->glUniformMatrix4fv(locProjection, 1, GL_FALSE, (GLfloat *)projection); - if (rdata->glGetError() != GL_NO_ERROR) - { - SDL_SetError("Failed to set orthographic projection"); - return -1; + if (rdata->glGetError() != GL_NO_ERROR) { + return SDL_SetError("Failed to set orthographic projection"); } return 0; } @@ -950,11 +954,11 @@ static int GLES2_RenderDrawLines(SDL_Renderer *renderer, const SDL_FPoint *point static int GLES2_RenderFillRects(SDL_Renderer *renderer, const SDL_FRect *rects, int count); static int GLES2_RenderCopy(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect *srcrect, const SDL_FRect *dstrect); -static int GLES2_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect, - Uint32 pixel_format, void * pixels, int pitch); static int GLES2_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); +static int GLES2_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect, + Uint32 pixel_format, void * pixels, int pitch); static void GLES2_RenderPresent(SDL_Renderer *renderer); @@ -1066,8 +1070,7 @@ GLES2_RenderDrawPoints(SDL_Renderer *renderer, const SDL_FPoint *points, int cou /* Emit the specified vertices as points */ vertices = SDL_stack_alloc(GLfloat, count * 2); - for (idx = 0; idx < count; ++idx) - { + for (idx = 0; idx < count; ++idx) { GLfloat x = points[idx].x + 0.5f; GLfloat y = points[idx].y + 0.5f; @@ -1078,10 +1081,8 @@ GLES2_RenderDrawPoints(SDL_Renderer *renderer, const SDL_FPoint *points, int cou rdata->glVertexAttribPointer(GLES2_ATTRIBUTE_POSITION, 2, GL_FLOAT, GL_FALSE, 0, vertices); rdata->glDrawArrays(GL_POINTS, 0, count); SDL_stack_free(vertices); - if (rdata->glGetError() != GL_NO_ERROR) - { - SDL_SetError("Failed to render lines"); - return -1; + if (rdata->glGetError() != GL_NO_ERROR) { + return SDL_SetError("Failed to render lines"); } return 0; } @@ -1099,8 +1100,7 @@ GLES2_RenderDrawLines(SDL_Renderer *renderer, const SDL_FPoint *points, int coun /* Emit a line strip including the specified vertices */ vertices = SDL_stack_alloc(GLfloat, count * 2); - for (idx = 0; idx < count; ++idx) - { + for (idx = 0; idx < count; ++idx) { GLfloat x = points[idx].x + 0.5f; GLfloat y = points[idx].y + 0.5f; @@ -1117,10 +1117,8 @@ GLES2_RenderDrawLines(SDL_Renderer *renderer, const SDL_FPoint *points, int coun rdata->glDrawArrays(GL_POINTS, count-1, 1); } SDL_stack_free(vertices); - if (rdata->glGetError() != GL_NO_ERROR) - { - SDL_SetError("Failed to render lines"); - return -1; + if (rdata->glGetError() != GL_NO_ERROR) { + return SDL_SetError("Failed to render lines"); } return 0; } @@ -1157,10 +1155,8 @@ GLES2_RenderFillRects(SDL_Renderer *renderer, const SDL_FRect *rects, int count) rdata->glVertexAttribPointer(GLES2_ATTRIBUTE_POSITION, 2, GL_FLOAT, GL_FALSE, 0, vertices); rdata->glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); } - if (rdata->glGetError() != GL_NO_ERROR) - { - SDL_SetError("Failed to render lines"); - return -1; + if (rdata->glGetError() != GL_NO_ERROR) { + return SDL_SetError("Failed to render lines"); } return 0; } @@ -1241,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) @@ -1258,6 +1254,8 @@ GLES2_RenderCopy(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect *s case SDL_PIXELFORMAT_RGB888: sourceType = GLES2_IMAGESOURCE_TEXTURE_RGB; break; + default: + return -1; } } if (GLES2_SelectProgram(renderer, sourceType, blendMode) < 0) @@ -1313,10 +1311,8 @@ GLES2_RenderCopy(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect *s texCoords[7] = (srcrect->y + srcrect->h) / (GLfloat)texture->h; rdata->glVertexAttribPointer(GLES2_ATTRIBUTE_TEXCOORD, 2, GL_FLOAT, GL_FALSE, 0, texCoords); rdata->glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); - if (rdata->glGetError() != GL_NO_ERROR) - { - SDL_SetError("Failed to render texture"); - return -1; + if (rdata->glGetError() != GL_NO_ERROR) { + return SDL_SetError("Failed to render texture"); } return 0; } @@ -1338,10 +1334,10 @@ 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)angle; + fAngle[0] = fAngle[1] = fAngle[2] = fAngle[3] = (GLfloat)(360.0f - angle); /* Calculate the center of rotation */ translate[0] = translate[2] = translate[4] = translate[6] = (center->x + dstrect->x); translate[1] = translate[3] = translate[5] = translate[7] = (center->y + dstrect->y); @@ -1407,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) @@ -1424,6 +1420,8 @@ GLES2_RenderCopyEx(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect case SDL_PIXELFORMAT_RGB888: sourceType = GLES2_IMAGESOURCE_TEXTURE_RGB; break; + default: + return -1; } } if (GLES2_SelectProgram(renderer, sourceType, blendMode) < 0) @@ -1478,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); @@ -1495,10 +1493,8 @@ GLES2_RenderCopyEx(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect rdata->glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); rdata->glDisableVertexAttribArray(GLES2_ATTRIBUTE_CENTER); rdata->glDisableVertexAttribArray(GLES2_ATTRIBUTE_ANGLE); - if (rdata->glGetError() != GL_NO_ERROR) - { - SDL_SetError("Failed to render texture"); - return -1; + if (rdata->glGetError() != GL_NO_ERROR) { + return SDL_SetError("Failed to render texture"); } return 0; } @@ -1521,8 +1517,7 @@ GLES2_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect, temp_pitch = rect->w * SDL_BYTESPERPIXEL(temp_format); temp_pixels = SDL_malloc(rect->h * temp_pitch); if (!temp_pixels) { - SDL_OutOfMemory(); - return -1; + return SDL_OutOfMemory(); } SDL_GetWindowSize(window, &w, &h); @@ -1576,7 +1571,6 @@ static int GLES2_BindTexture (SDL_Renderer * renderer, SDL_Texture *texture, flo GLES2_TextureData *texturedata = (GLES2_TextureData *)texture->driverdata; GLES2_ActivateRenderer(renderer); - data->glActiveTexture(GL_TEXTURE0); data->glBindTexture(texturedata->texture_type, texturedata->texture); if(texw) *texw = 1.0; @@ -1590,8 +1584,7 @@ static int GLES2_UnbindTexture (SDL_Renderer * renderer, SDL_Texture *texture) { GLES2_TextureData *texturedata = (GLES2_TextureData *)texture->driverdata; GLES2_ActivateRenderer(renderer); - data->glActiveTexture(GL_TEXTURE0); - data->glDisable(texturedata->texture_type); + data->glBindTexture(texturedata->texture_type, 0); return 0; } @@ -1735,13 +1728,14 @@ GLES2_CreateRenderer(SDL_Window *window, Uint32 flags) renderer->UnlockTexture = &GLES2_UnlockTexture; renderer->SetRenderTarget = &GLES2_SetRenderTarget; renderer->UpdateViewport = &GLES2_UpdateViewport; + renderer->UpdateClipRect = &GLES2_UpdateClipRect; renderer->RenderClear = &GLES2_RenderClear; renderer->RenderDrawPoints = &GLES2_RenderDrawPoints; renderer->RenderDrawLines = &GLES2_RenderDrawLines; renderer->RenderFillRects = &GLES2_RenderFillRects; renderer->RenderCopy = &GLES2_RenderCopy; - renderer->RenderReadPixels = &GLES2_RenderReadPixels; renderer->RenderCopyEx = &GLES2_RenderCopyEx; + renderer->RenderReadPixels = &GLES2_RenderReadPixels; renderer->RenderPresent = &GLES2_RenderPresent; renderer->DestroyTexture = &GLES2_DestroyTexture; renderer->DestroyRenderer = &GLES2_DestroyRenderer; diff --git a/src/eepp/helper/SDL2/src/render/opengles2/SDL_shaders_gles2.c b/src/eepp/helper/SDL2/src/render/opengles2/SDL_shaders_gles2.c index 423e3b1e2..fb6921fd0 100644 --- a/src/eepp/helper/SDL2/src/render/opengles2/SDL_shaders_gles2.c +++ b/src/eepp/helper/SDL2/src/render/opengles2/SDL_shaders_gles2.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -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/eepp/helper/SDL2/src/render/opengles2/SDL_shaders_gles2.h b/src/eepp/helper/SDL2/src/render/opengles2/SDL_shaders_gles2.h index 53da41a54..73f706649 100644 --- a/src/eepp/helper/SDL2/src/render/opengles2/SDL_shaders_gles2.h +++ b/src/eepp/helper/SDL2/src/render/opengles2/SDL_shaders_gles2.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/render/psp/SDL_render_psp.c b/src/eepp/helper/SDL2/src/render/psp/SDL_render_psp.c new file mode 100644 index 000000000..7ea536d14 --- /dev/null +++ b/src/eepp/helper/SDL2/src/render/psp/SDL_render_psp.c @@ -0,0 +1,1023 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2013 Sam Lantinga + + 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 + appreciated but is not required. + 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. +*/ +#include "SDL_config.h" + +#if SDL_VIDEO_RENDER_PSP + +#include "SDL_hints.h" +#include "../SDL_sysrender.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + + + +/* PSP renderer implementation, based on the PGE */ + + +extern int SDL_RecreateWindow(SDL_Window * window, Uint32 flags); + + +static SDL_Renderer *PSP_CreateRenderer(SDL_Window * window, Uint32 flags); +static void PSP_WindowEvent(SDL_Renderer * renderer, + const SDL_WindowEvent *event); +static int PSP_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture); +static int PSP_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, + const SDL_Rect * rect, const void *pixels, + int pitch); +static int PSP_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture, + const SDL_Rect * rect, void **pixels, int *pitch); +static void PSP_UnlockTexture(SDL_Renderer * renderer, + SDL_Texture * texture); +static int PSP_SetRenderTarget(SDL_Renderer * renderer, + SDL_Texture * texture); +static int PSP_UpdateViewport(SDL_Renderer * renderer); +static int PSP_RenderClear(SDL_Renderer * renderer); +static int PSP_RenderDrawPoints(SDL_Renderer * renderer, + const SDL_FPoint * points, int count); +static int PSP_RenderDrawLines(SDL_Renderer * renderer, + const SDL_FPoint * points, int count); +static int PSP_RenderFillRects(SDL_Renderer * renderer, + const SDL_FRect * rects, int count); +static int PSP_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture, + const SDL_Rect * srcrect, + const SDL_FRect * dstrect); +static int PSP_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect, + Uint32 pixel_format, void * pixels, int pitch); +static int 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); +static void PSP_RenderPresent(SDL_Renderer * renderer); +static void PSP_DestroyTexture(SDL_Renderer * renderer, + SDL_Texture * texture); +static void PSP_DestroyRenderer(SDL_Renderer * renderer); + +/* +SDL_RenderDriver PSP_RenderDriver = { + PSP_CreateRenderer, + { + "PSP", + (SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_TARGETTEXTURE), + 1, + {SDL_PIXELFORMAT_ABGR8888}, + 0, + 0} +}; +*/ +SDL_RenderDriver PSP_RenderDriver = { + .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, + } +}; + +#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) + +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)) + + +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; + +} 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. */ + +} PSP_TextureData; + +typedef struct +{ + float x, y, z; +} VertV; + + +typedef struct +{ + float u, v; + float x, y, z; + +} VertTV; + + +/* Return next power of 2 */ +static int +TextureNextPow2(unsigned int w) +{ + if(w == 0) + return 0; + + unsigned int n = 2; + + while(w > n) + n <<= 1; + + return n; +} + + +static int +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 */ + } else { + return GU_LINEAR; /* GU_LINEAR good for scaling */ + } +} + +static int +PixelFormatToPSPFMT(Uint32 format) +{ + switch (format) { + case SDL_PIXELFORMAT_BGR565: + return GU_PSM_5650; + case SDL_PIXELFORMAT_ABGR1555: + return GU_PSM_5551; + case SDL_PIXELFORMAT_ABGR4444: + return GU_PSM_4444; + case SDL_PIXELFORMAT_ABGR8888: + return GU_PSM_8888; + default: + return GU_PSM_8888; + } +} + +void +StartDrawing(SDL_Renderer * renderer) +{ + PSP_RenderData *data = (PSP_RenderData *) renderer->driverdata; + if(data->displayListAvail) + return; + + sceGuStart(GU_DIRECT, DisplayList); + data->displayListAvail = SDL_TRUE; +} + + +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; + + 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); + + int j; + + for(j = 0; j < height; j++, blockaddress += 16) + { + unsigned int *block; + + block = (unsigned int*)&data[blockaddress]; + + int i; + + for(i = 0; i < rowblocks; i++) + { + *block++ = *src++; + *block++ = *src++; + *block++ = *src++; + *block++ = *src++; + block += 28; + } + + if((j & 0x7) == 0x7) + blockaddress += rowblocksadd; + } + + free(psp_texture->data); + psp_texture->data = data; + psp_texture->swizzled = SDL_TRUE; + + 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; +} + +SDL_Renderer * +PSP_CreateRenderer(SDL_Window * window, Uint32 flags) +{ + + SDL_Renderer *renderer; + PSP_RenderData *data; + int pixelformat; + renderer = (SDL_Renderer *) SDL_calloc(1, sizeof(*renderer)); + if (!renderer) { + SDL_OutOfMemory(); + return NULL; + } + + data = (PSP_RenderData *) SDL_calloc(1, sizeof(*data)); + if (!data) { + PSP_DestroyRenderer(renderer); + SDL_OutOfMemory(); + return NULL; + } + + + renderer->WindowEvent = PSP_WindowEvent; + renderer->CreateTexture = PSP_CreateTexture; + renderer->UpdateTexture = PSP_UpdateTexture; + renderer->LockTexture = PSP_LockTexture; + renderer->UnlockTexture = PSP_UnlockTexture; + renderer->SetRenderTarget = PSP_SetRenderTarget; + renderer->UpdateViewport = PSP_UpdateViewport; + renderer->RenderClear = PSP_RenderClear; + renderer->RenderDrawPoints = PSP_RenderDrawPoints; + renderer->RenderDrawLines = PSP_RenderDrawLines; + renderer->RenderFillRects = PSP_RenderFillRects; + renderer->RenderCopy = PSP_RenderCopy; + renderer->RenderReadPixels = PSP_RenderReadPixels; + renderer->RenderCopyEx = PSP_RenderCopyEx; + renderer->RenderPresent = PSP_RenderPresent; + renderer->DestroyTexture = PSP_DestroyTexture; + renderer->DestroyRenderer = PSP_DestroyRenderer; + renderer->info = PSP_RenderDriver.info; + renderer->info.flags = SDL_RENDERER_ACCELERATED; + renderer->driverdata = data; + renderer->window = window; + + 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); + + 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); + + return renderer; +} + +static void +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(); + } + texture->driverdata = psp_texture; + + return 0; +} + + +void +TextureActivate(SDL_Texture * texture) +{ + 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); + } + + 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); +} + + +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; + 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) { + SDL_memcpy(dst, src, length*rect->h); + } else { + for (row = 0; row < rect->h; ++row) { + SDL_memcpy(dst, src, length); + src += pitch; + dst += dpitch; + } + } + + sceKernelDcacheWritebackAll(); + return 0; +} + +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; + + *pixels = + (void *) ((Uint8 *) psp_texture->data + rect->y * psp_texture->pitch + + rect->x * SDL_BYTESPERPIXEL(texture->format)); + *pitch = psp_texture->pitch; + return 0; +} + +static void +PSP_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture) +{ + PSP_TextureData *psp_texture = (PSP_TextureData *) texture->driverdata; + SDL_Rect rect; + + /* We do whole texture updates, at least for now */ + rect.x = 0; + rect.y = 0; + rect.w = texture->w; + rect.h = texture->h; + PSP_UpdateTexture(renderer, texture, &rect, psp_texture->data, psp_texture->pitch); +} + +static int +PSP_SetRenderTarget(SDL_Renderer * renderer, SDL_Texture * texture) +{ + + return 0; +} + +static int +PSP_UpdateViewport(SDL_Renderer * renderer) +{ + + return 0; +} + + +static void +PSP_SetBlendMode(SDL_Renderer * renderer, int blendMode) +{ + 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); + 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 ); + 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 ); + 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); + break; + } + data->currentBlendMode = 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); + + return 0; +} + +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); + + return 0; +} + +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); + + return 0; +} + +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); + } + + return 0; +} + + +#define PI 3.14159265358979f + +#define radToDeg(x) ((x)*180.f/PI) +#define degToRad(x) ((x)*PI/180.f) + +float MathAbs(float x) +{ + float result; + + __asm__ volatile ( + "mtv %1, S000\n" + "vabs.s S000, S000\n" + "mfv %0, S000\n" + : "=r"(result) : "r"(x)); + + 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)); +} + +void Swap(float *a, float *b) +{ + 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); + return 0; +} + +static int +PSP_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect, + Uint32 pixel_format, void * pixels, int pitch) + +{ + return 0; +} + + +static int +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; + + 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); + return 0; +} + +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(); + + 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; +} + +static void +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; + SDL_free(data); + } + SDL_free(renderer); +} + +#endif /* SDL_VIDEO_RENDER_PSP */ + +/* vi: set ts=4 sw=4 expandtab: */ + diff --git a/src/eepp/helper/SDL2/src/render/software/SDL_blendfillrect.c b/src/eepp/helper/SDL2/src/render/software/SDL_blendfillrect.c index 5b399d1f1..ea05ea64b 100644 --- a/src/eepp/helper/SDL2/src/render/software/SDL_blendfillrect.c +++ b/src/eepp/helper/SDL2/src/render/software/SDL_blendfillrect.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -159,8 +159,7 @@ SDL_BlendFillRect_RGB(SDL_Surface * dst, const SDL_Rect * rect, } return 0; default: - SDL_Unsupported(); - return -1; + return SDL_Unsupported(); } } @@ -189,8 +188,7 @@ SDL_BlendFillRect_RGBA(SDL_Surface * dst, const SDL_Rect * rect, } return 0; default: - SDL_Unsupported(); - return -1; + return SDL_Unsupported(); } } @@ -201,14 +199,12 @@ SDL_BlendFillRect(SDL_Surface * dst, const SDL_Rect * rect, SDL_Rect clipped; if (!dst) { - SDL_SetError("Passed NULL destination surface"); - return -1; + return SDL_SetError("Passed NULL destination surface"); } /* This function doesn't work on surfaces < 8 bpp */ if (dst->format->BitsPerPixel < 8) { - SDL_SetError("SDL_BlendFillRect(): Unsupported surface format"); - return -1; + return SDL_SetError("SDL_BlendFillRect(): Unsupported surface format"); } /* If 'rect' == NULL, then fill the whole surface */ @@ -274,14 +270,12 @@ SDL_BlendFillRects(SDL_Surface * dst, const SDL_Rect * rects, int count, int status = 0; if (!dst) { - SDL_SetError("Passed NULL destination surface"); - return -1; + return SDL_SetError("Passed NULL destination surface"); } /* This function doesn't work on surfaces < 8 bpp */ if (dst->format->BitsPerPixel < 8) { - SDL_SetError("SDL_BlendFillRects(): Unsupported surface format"); - return -1; + return SDL_SetError("SDL_BlendFillRects(): Unsupported surface format"); } if (blendMode == SDL_BLENDMODE_BLEND || blendMode == SDL_BLENDMODE_ADD) { diff --git a/src/eepp/helper/SDL2/src/render/software/SDL_blendfillrect.h b/src/eepp/helper/SDL2/src/render/software/SDL_blendfillrect.h index 6ea88b56a..ed7981daf 100644 --- a/src/eepp/helper/SDL2/src/render/software/SDL_blendfillrect.h +++ b/src/eepp/helper/SDL2/src/render/software/SDL_blendfillrect.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/render/software/SDL_blendline.c b/src/eepp/helper/SDL2/src/render/software/SDL_blendline.c index 3f73a64b6..2ab0231b5 100644 --- a/src/eepp/helper/SDL2/src/render/software/SDL_blendline.c +++ b/src/eepp/helper/SDL2/src/render/software/SDL_blendline.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -711,14 +711,12 @@ SDL_BlendLine(SDL_Surface * dst, int x1, int y1, int x2, int y2, BlendLineFunc func; if (!dst) { - SDL_SetError("SDL_BlendLine(): Passed NULL destination surface"); - return -1; + return SDL_SetError("SDL_BlendLine(): Passed NULL destination surface"); } func = SDL_CalculateBlendLineFunc(dst->format); if (!func) { - SDL_SetError("SDL_BlendLine(): Unsupported surface format"); - return -1; + return SDL_SetError("SDL_BlendLine(): Unsupported surface format"); } /* Perform clipping */ @@ -742,14 +740,12 @@ SDL_BlendLines(SDL_Surface * dst, const SDL_Point * points, int count, BlendLineFunc func; if (!dst) { - SDL_SetError("SDL_BlendLines(): Passed NULL destination surface"); - return -1; + return SDL_SetError("SDL_BlendLines(): Passed NULL destination surface"); } func = SDL_CalculateBlendLineFunc(dst->format); if (!func) { - SDL_SetError("SDL_BlendLines(): Unsupported surface format"); - return -1; + return SDL_SetError("SDL_BlendLines(): Unsupported surface format"); } for (i = 1; i < count; ++i) { diff --git a/src/eepp/helper/SDL2/src/render/software/SDL_blendline.h b/src/eepp/helper/SDL2/src/render/software/SDL_blendline.h index c9da31c97..813240144 100644 --- a/src/eepp/helper/SDL2/src/render/software/SDL_blendline.h +++ b/src/eepp/helper/SDL2/src/render/software/SDL_blendline.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/render/software/SDL_blendpoint.c b/src/eepp/helper/SDL2/src/render/software/SDL_blendpoint.c index 4d5ac762d..e2fa66fd8 100644 --- a/src/eepp/helper/SDL2/src/render/software/SDL_blendpoint.c +++ b/src/eepp/helper/SDL2/src/render/software/SDL_blendpoint.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -159,8 +159,7 @@ SDL_BlendPoint_RGB(SDL_Surface * dst, int x, int y, SDL_BlendMode blendMode, Uin } return 0; default: - SDL_Unsupported(); - return -1; + return SDL_Unsupported(); } } @@ -189,8 +188,7 @@ SDL_BlendPoint_RGBA(SDL_Surface * dst, int x, int y, SDL_BlendMode blendMode, Ui } return 0; default: - SDL_Unsupported(); - return -1; + return SDL_Unsupported(); } } @@ -199,14 +197,12 @@ SDL_BlendPoint(SDL_Surface * dst, int x, int y, SDL_BlendMode blendMode, Uint8 r Uint8 g, Uint8 b, Uint8 a) { if (!dst) { - SDL_SetError("Passed NULL destination surface"); - return -1; + return SDL_SetError("Passed NULL destination surface"); } /* This function doesn't work on surfaces < 8 bpp */ if (dst->format->BitsPerPixel < 8) { - SDL_SetError("SDL_BlendPoint(): Unsupported surface format"); - return -1; + return SDL_SetError("SDL_BlendPoint(): Unsupported surface format"); } /* Perform clipping */ @@ -272,14 +268,12 @@ SDL_BlendPoints(SDL_Surface * dst, const SDL_Point * points, int count, int status = 0; if (!dst) { - SDL_SetError("Passed NULL destination surface"); - return -1; + return SDL_SetError("Passed NULL destination surface"); } /* This function doesn't work on surfaces < 8 bpp */ if (dst->format->BitsPerPixel < 8) { - SDL_SetError("SDL_BlendPoints(): Unsupported surface format"); - return (-1); + return SDL_SetError("SDL_BlendPoints(): Unsupported surface format"); } if (blendMode == SDL_BLENDMODE_BLEND || blendMode == SDL_BLENDMODE_ADD) { diff --git a/src/eepp/helper/SDL2/src/render/software/SDL_blendpoint.h b/src/eepp/helper/SDL2/src/render/software/SDL_blendpoint.h index 4c1e76dc0..ec7cfa754 100644 --- a/src/eepp/helper/SDL2/src/render/software/SDL_blendpoint.h +++ b/src/eepp/helper/SDL2/src/render/software/SDL_blendpoint.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/render/software/SDL_draw.h b/src/eepp/helper/SDL2/src/render/software/SDL_draw.h index e262f7d65..c529e98ee 100644 --- a/src/eepp/helper/SDL2/src/render/software/SDL_draw.h +++ b/src/eepp/helper/SDL2/src/render/software/SDL_draw.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/render/software/SDL_drawline.c b/src/eepp/helper/SDL2/src/render/software/SDL_drawline.c index f48767784..5cda4ccca 100644 --- a/src/eepp/helper/SDL2/src/render/software/SDL_drawline.c +++ b/src/eepp/helper/SDL2/src/render/software/SDL_drawline.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -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; @@ -145,14 +144,12 @@ SDL_DrawLine(SDL_Surface * dst, int x1, int y1, int x2, int y2, Uint32 color) DrawLineFunc func; if (!dst) { - SDL_SetError("SDL_DrawLine(): Passed NULL destination surface"); - return -1; + return SDL_SetError("SDL_DrawLine(): Passed NULL destination surface"); } func = SDL_CalculateDrawLineFunc(dst->format); if (!func) { - SDL_SetError("SDL_DrawLine(): Unsupported surface format"); - return -1; + return SDL_SetError("SDL_DrawLine(): Unsupported surface format"); } /* Perform clipping */ @@ -176,14 +173,12 @@ SDL_DrawLines(SDL_Surface * dst, const SDL_Point * points, int count, DrawLineFunc func; if (!dst) { - SDL_SetError("SDL_DrawLines(): Passed NULL destination surface"); - return -1; + return SDL_SetError("SDL_DrawLines(): Passed NULL destination surface"); } func = SDL_CalculateDrawLineFunc(dst->format); if (!func) { - SDL_SetError("SDL_DrawLines(): Unsupported surface format"); - return -1; + return SDL_SetError("SDL_DrawLines(): Unsupported surface format"); } for (i = 1; i < count; ++i) { diff --git a/src/eepp/helper/SDL2/src/render/software/SDL_drawline.h b/src/eepp/helper/SDL2/src/render/software/SDL_drawline.h index 9d8a5a4ee..5b6a09849 100644 --- a/src/eepp/helper/SDL2/src/render/software/SDL_drawline.h +++ b/src/eepp/helper/SDL2/src/render/software/SDL_drawline.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/render/software/SDL_drawpoint.c b/src/eepp/helper/SDL2/src/render/software/SDL_drawpoint.c index 8c19c618b..1ae8419c1 100644 --- a/src/eepp/helper/SDL2/src/render/software/SDL_drawpoint.c +++ b/src/eepp/helper/SDL2/src/render/software/SDL_drawpoint.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -30,14 +30,12 @@ int SDL_DrawPoint(SDL_Surface * dst, int x, int y, Uint32 color) { if (!dst) { - SDL_SetError("Passed NULL destination surface"); - return -1; + return SDL_SetError("Passed NULL destination surface"); } /* This function doesn't work on surfaces < 8 bpp */ if (dst->format->BitsPerPixel < 8) { - SDL_SetError("SDL_DrawPoint(): Unsupported surface format"); - return -1; + return SDL_SetError("SDL_DrawPoint(): Unsupported surface format"); } /* Perform clipping */ @@ -55,8 +53,7 @@ SDL_DrawPoint(SDL_Surface * dst, int x, int y, Uint32 color) DRAW_FASTSETPIXELXY2(x, y); break; case 3: - SDL_Unsupported(); - return -1; + return SDL_Unsupported(); case 4: DRAW_FASTSETPIXELXY4(x, y); break; @@ -74,14 +71,12 @@ SDL_DrawPoints(SDL_Surface * dst, const SDL_Point * points, int count, int x, y; if (!dst) { - SDL_SetError("Passed NULL destination surface"); - return -1; + return SDL_SetError("Passed NULL destination surface"); } /* This function doesn't work on surfaces < 8 bpp */ if (dst->format->BitsPerPixel < 8) { - SDL_SetError("SDL_DrawPoints(): Unsupported surface format"); - return -1; + return SDL_SetError("SDL_DrawPoints(): Unsupported surface format"); } minx = dst->clip_rect.x; @@ -105,8 +100,7 @@ SDL_DrawPoints(SDL_Surface * dst, const SDL_Point * points, int count, DRAW_FASTSETPIXELXY2(x, y); break; case 3: - SDL_Unsupported(); - return -1; + return SDL_Unsupported(); case 4: DRAW_FASTSETPIXELXY4(x, y); break; diff --git a/src/eepp/helper/SDL2/src/render/software/SDL_drawpoint.h b/src/eepp/helper/SDL2/src/render/software/SDL_drawpoint.h index 56f857538..512ef6471 100644 --- a/src/eepp/helper/SDL2/src/render/software/SDL_drawpoint.h +++ b/src/eepp/helper/SDL2/src/render/software/SDL_drawpoint.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/render/software/SDL_render_sw.c b/src/eepp/helper/SDL2/src/render/software/SDL_render_sw.c index 785b6ef7b..8c84da143 100644 --- a/src/eepp/helper/SDL2/src/render/software/SDL_render_sw.c +++ b/src/eepp/helper/SDL2/src/render/software/SDL_render_sw.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -54,6 +54,7 @@ static int SW_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture, static void SW_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture); static int SW_SetRenderTarget(SDL_Renderer * renderer, SDL_Texture * texture); static int SW_UpdateViewport(SDL_Renderer * renderer); +static int SW_UpdateClipRect(SDL_Renderer * renderer); static int SW_RenderClear(SDL_Renderer * renderer); static int SW_RenderDrawPoints(SDL_Renderer * renderer, const SDL_FPoint * points, int count); @@ -151,6 +152,7 @@ SW_CreateRendererForSurface(SDL_Surface * surface) renderer->UnlockTexture = SW_UnlockTexture; renderer->SetRenderTarget = SW_SetRenderTarget; renderer->UpdateViewport = SW_UpdateViewport; + renderer->UpdateClipRect = SW_UpdateClipRect; renderer->RenderClear = SW_RenderClear; renderer->RenderDrawPoints = SW_RenderDrawPoints; renderer->RenderDrawLines = SW_RenderDrawLines; @@ -200,8 +202,7 @@ SW_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) if (!SDL_PixelFormatEnumToMasks (texture->format, &bpp, &Rmask, &Gmask, &Bmask, &Amask)) { - SDL_SetError("Unknown texture format"); - return -1; + return SDL_SetError("Unknown texture format"); } texture->driverdata = @@ -321,6 +322,20 @@ SW_UpdateViewport(SDL_Renderer * renderer) return 0; } +static int +SW_UpdateClipRect(SDL_Renderer * renderer) +{ + const SDL_Rect *rect = &renderer->clip_rect; + SDL_Surface* framebuffer = (SDL_Surface *) renderer->driverdata; + + if (!SDL_RectEmpty(rect)) { + SDL_SetClipRect(framebuffer, rect); + } else { + SDL_SetClipRect(framebuffer, NULL); + } + return 0; +} + static int SW_RenderClear(SDL_Renderer * renderer) { @@ -357,8 +372,7 @@ SW_RenderDrawPoints(SDL_Renderer * renderer, const SDL_FPoint * points, final_points = SDL_stack_alloc(SDL_Point, count); if (!final_points) { - SDL_OutOfMemory(); - return -1; + return SDL_OutOfMemory(); } if (renderer->viewport.x || renderer->viewport.y) { int x = renderer->viewport.x; @@ -407,8 +421,7 @@ SW_RenderDrawLines(SDL_Renderer * renderer, const SDL_FPoint * points, final_points = SDL_stack_alloc(SDL_Point, count); if (!final_points) { - SDL_OutOfMemory(); - return -1; + return SDL_OutOfMemory(); } if (renderer->viewport.x || renderer->viewport.y) { int x = renderer->viewport.x; @@ -456,8 +469,7 @@ SW_RenderFillRects(SDL_Renderer * renderer, const SDL_FRect * rects, int count) final_rects = SDL_stack_alloc(SDL_Rect, count); if (!final_rects) { - SDL_OutOfMemory(); - return -1; + return SDL_OutOfMemory(); } if (renderer->viewport.x || renderer->viewport.y) { int x = renderer->viewport.x; @@ -647,8 +659,7 @@ SW_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect, if (rect->x < 0 || rect->x+rect->w > surface->w || rect->y < 0 || rect->y+rect->h > surface->h) { - SDL_SetError("Tried to read outside of surface bounds"); - return -1; + return SDL_SetError("Tried to read outside of surface bounds"); } src_format = surface->format->format; diff --git a/src/eepp/helper/SDL2/src/render/software/SDL_render_sw_c.h b/src/eepp/helper/SDL2/src/render/software/SDL_render_sw_c.h index e6218eeda..7ba0a7eec 100644 --- a/src/eepp/helper/SDL2/src/render/software/SDL_render_sw_c.h +++ b/src/eepp/helper/SDL2/src/render/software/SDL_render_sw_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/render/software/SDL_rotate.c b/src/eepp/helper/SDL2/src/render/software/SDL_rotate.c index 2eae0393f..b31553587 100644 --- a/src/eepp/helper/SDL2/src/render/software/SDL_rotate.c +++ b/src/eepp/helper/SDL2/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/eepp/helper/SDL2/src/stdlib/SDL_getenv.c b/src/eepp/helper/SDL2/src/stdlib/SDL_getenv.c index 6e6477bde..9079387cd 100644 --- a/src/eepp/helper/SDL2/src/stdlib/SDL_getenv.c +++ b/src/eepp/helper/SDL2/src/stdlib/SDL_getenv.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -22,18 +22,19 @@ #include "SDL_stdinc.h" -#ifndef HAVE_GETENV - -#if defined(__WIN32__) - +#if !defined(SDL_setenv) && defined(__WIN32__) #include "../core/windows/SDL_windows.h" - /* Note this isn't thread-safe! */ - static char *SDL_envmem = NULL; /* Ugh, memory leak */ static size_t SDL_envmemlen = 0; +#endif + /* Put a variable into the environment */ +#ifdef SDL_setenv +#undef SDL_setenv +int SDL_setenv(const char *name, const char *value, int overwrite) { return SDL_setenv_inline(name, value, overwrite); } +#elif defined(__WIN32__) int SDL_setenv(const char *name, const char *value, int overwrite) { @@ -49,35 +50,34 @@ SDL_setenv(const char *name, const char *value, int overwrite) } return 0; } - -/* Retrieve a variable named "name" from the environment */ -char * -SDL_getenv(const char *name) +/* We have a real environment table, but no real setenv? Fake it w/ putenv. */ +#elif (defined(HAVE_GETENV) && defined(HAVE_PUTENV) && !defined(HAVE_SETENV)) +int +SDL_setenv(const char *name, const char *value, int overwrite) { - size_t bufferlen; + size_t len; + char *new_variable; - bufferlen = - GetEnvironmentVariableA(name, SDL_envmem, (DWORD) SDL_envmemlen); - if (bufferlen == 0) { - return NULL; - } - if (bufferlen > SDL_envmemlen) { - char *newmem = (char *) SDL_realloc(SDL_envmem, bufferlen); - if (newmem == NULL) { - return NULL; + if (getenv(name) != NULL) { + if (overwrite) { + unsetenv(name); + } else { + return 0; /* leave the existing one there. */ } - SDL_envmem = newmem; - SDL_envmemlen = bufferlen; - GetEnvironmentVariableA(name, SDL_envmem, (DWORD) SDL_envmemlen); } - return SDL_envmem; + + /* This leaks. Sorry. Get a better OS so we don't have to do this. */ + len = SDL_strlen(name) + SDL_strlen(value) + 2; + new_variable = (char *) SDL_malloc(len); + if (!new_variable) { + return (-1); + } + + SDL_snprintf(new_variable, len, "%s=%s", name, value); + return putenv(new_variable); } - #else /* roll our own */ - static char **SDL_env = (char **) 0; - -/* Put a variable into the environment */ int SDL_setenv(const char *name, const char *value, int overwrite) { @@ -140,8 +140,35 @@ SDL_setenv(const char *name, const char *value, int overwrite) } return (added ? 0 : -1); } +#endif /* Retrieve a variable named "name" from the environment */ +#ifdef SDL_getenv +#undef SDL_getenv +char *SDL_getenv(const char *name) { return SDL_getenv_inline(name); } +#elif defined(__WIN32__) +char * +SDL_getenv(const char *name) +{ + size_t bufferlen; + + bufferlen = + GetEnvironmentVariableA(name, SDL_envmem, (DWORD) SDL_envmemlen); + if (bufferlen == 0) { + return NULL; + } + if (bufferlen > SDL_envmemlen) { + char *newmem = (char *) SDL_realloc(SDL_envmem, bufferlen); + if (newmem == NULL) { + return NULL; + } + SDL_envmem = newmem; + SDL_envmemlen = bufferlen; + GetEnvironmentVariableA(name, SDL_envmem, (DWORD) SDL_envmemlen); + } + return SDL_envmem; +} +#else char * SDL_getenv(const char *name) { @@ -160,38 +187,6 @@ SDL_getenv(const char *name) } return value; } - -#endif /* __WIN32__ */ - -#endif /* !HAVE_GETENV */ - - -/* We have a real environment table, but no real setenv? Fake it w/ putenv. */ -#if (defined(HAVE_GETENV) && defined(HAVE_PUTENV) && !defined(HAVE_SETENV)) -int -SDL_setenv(const char *name, const char *value, int overwrite) -{ - size_t len; - char *new_variable; - - if (getenv(name) != NULL) { - if (overwrite) { - unsetenv(name); - } else { - return 0; /* leave the existing one there. */ - } - } - - /* This leaks. Sorry. Get a better OS so we don't have to do this. */ - len = SDL_strlen(name) + SDL_strlen(value) + 2; - new_variable = (char *) SDL_malloc(len); - if (!new_variable) { - return (-1); - } - - SDL_snprintf(new_variable, len, "%s=%s", name, value); - return putenv(new_variable); -} #endif diff --git a/src/eepp/helper/SDL2/src/stdlib/SDL_iconv.c b/src/eepp/helper/SDL2/src/stdlib/SDL_iconv.c index 89a80a2c7..4e5e51d87 100644 --- a/src/eepp/helper/SDL2/src/stdlib/SDL_iconv.c +++ b/src/eepp/helper/SDL2/src/stdlib/SDL_iconv.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -38,6 +38,20 @@ #include +SDL_COMPILE_TIME_ASSERT(iconv_t, sizeof (iconv_t) <= sizeof (SDL_iconv_t)); + +SDL_iconv_t +SDL_iconv_open(const char *tocode, const char *fromcode) +{ + return (SDL_iconv_t) ((size_t) iconv_open(tocode, fromcode)); +} + +int +SDL_iconv_close(SDL_iconv_t cd) +{ + return iconv_close((iconv_t) ((size_t) cd)); +} + size_t SDL_iconv(SDL_iconv_t cd, const char **inbuf, size_t * inbytesleft, @@ -45,9 +59,9 @@ SDL_iconv(SDL_iconv_t cd, { size_t retCode; #ifdef ICONV_INBUF_NONCONST - retCode = iconv(cd, (char **) inbuf, inbytesleft, outbuf, outbytesleft); + retCode = iconv((iconv_t) ((size_t) cd), (char **) inbuf, inbytesleft, outbuf, outbytesleft); #else - retCode = iconv(cd, inbuf, inbytesleft, outbuf, outbytesleft); + retCode = iconv((iconv_t) ((size_t) cd), inbuf, inbytesleft, outbuf, outbytesleft); #endif if (retCode == (size_t) - 1) { switch (errno) { diff --git a/src/eepp/helper/SDL2/src/stdlib/SDL_malloc.c b/src/eepp/helper/SDL2/src/stdlib/SDL_malloc.c index 142e5f59a..5f7882139 100644 --- a/src/eepp/helper/SDL2/src/stdlib/SDL_malloc.c +++ b/src/eepp/helper/SDL2/src/stdlib/SDL_malloc.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -24,7 +24,18 @@ #include "SDL_stdinc.h" -#ifndef HAVE_MALLOC +#ifdef SDL_malloc +/* expose the symbol, but use what we figured out elsewhere. */ +#undef SDL_malloc +#undef SDL_calloc +#undef SDL_realloc +#undef SDL_free +void *SDL_malloc(size_t size) { return SDL_malloc_inline(size); } +void *SDL_calloc(size_t nmemb, size_t size) { return SDL_calloc_inline(nmemb, size); } +void *SDL_realloc(void *ptr, size_t size) { return SDL_realloc_inline(ptr, size); } +void SDL_free(void *ptr) { SDL_free_inline(ptr); } + +#else /* the rest of this is a LOT of tapdancing to implement malloc. :) */ #define LACKS_SYS_TYPES_H #define LACKS_STDIO_H @@ -398,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 @@ -608,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 @@ -5228,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/eepp/helper/SDL2/src/stdlib/SDL_qsort.c b/src/eepp/helper/SDL2/src/stdlib/SDL_qsort.c index 6d56c6758..8c73419c9 100644 --- a/src/eepp/helper/SDL2/src/stdlib/SDL_qsort.c +++ b/src/eepp/helper/SDL2/src/stdlib/SDL_qsort.c @@ -51,6 +51,15 @@ #include "SDL_stdinc.h" #include "SDL_assert.h" +#ifdef SDL_qsort +#undef SDL_qsort +void +SDL_qsort(void *base, size_t nmemb, size_t size, int (*compare) (const void *, const void *)) +{ + SDL_qsort_inline(base, nmemb, size, compare); +} +#else + #ifdef assert #undef assert #endif @@ -76,9 +85,6 @@ #endif #define qsort SDL_qsort - -#ifndef HAVE_QSORT - static const char _ID[] = ""; /* How many bytes are there per word? (Must be a power of 2, @@ -466,5 +472,6 @@ qsort(void *base, size_t nmemb, size_t size, qsort_words(base, nmemb, compare); } -#endif /* !HAVE_QSORT */ +#endif /* !SDL_qsort */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/eepp/helper/SDL2/src/stdlib/SDL_stdlib.c b/src/eepp/helper/SDL2/src/stdlib/SDL_stdlib.c index 56eb5da4f..176aa240c 100644 --- a/src/eepp/helper/SDL2/src/stdlib/SDL_stdlib.c +++ b/src/eepp/helper/SDL2/src/stdlib/SDL_stdlib.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -24,6 +24,25 @@ #include "SDL_stdinc.h" +/* these are always #defined, make them real symbol in the library, too... */ +#undef SDL_ceil +#undef SDL_abs +#undef SDL_sinf +#undef SDL_cosf +#undef SDL_isdigit +#undef SDL_isspace +#undef SDL_toupper +#undef SDL_tolower +double SDL_ceil(double x) { return SDL_ceil_inline(x); } +float SDL_cosf(float x) { return SDL_cosf_inline(x); } +float SDL_sinf(float x) { return SDL_sinf_inline(x); } +int SDL_abs(int x) { return SDL_abs_inline(x); } +int SDL_isdigit(int x) { return SDL_isdigit_inline(x); } +int SDL_isspace(int x) { return SDL_isspace_inline(x); } +int SDL_toupper(int x) { return SDL_toupper_inline(x); } +int SDL_tolower(int x) { return SDL_tolower_inline(x); } + + #ifndef HAVE_LIBC /* These are some C runtime intrinsics that need to be defined */ @@ -172,7 +191,7 @@ _allmul() pop esi pop edi pop ebp - ret + ret 10h } /* *INDENT-ON* */ } diff --git a/src/eepp/helper/SDL2/src/stdlib/SDL_string.c b/src/eepp/helper/SDL2/src/stdlib/SDL_string.c index b8536e81e..f2b2f31f8 100644 --- a/src/eepp/helper/SDL2/src/stdlib/SDL_string.c +++ b/src/eepp/helper/SDL2/src/stdlib/SDL_string.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -24,6 +24,17 @@ #include "SDL_stdinc.h" +/* these are always #defined, make them real symbol in the library, too... */ +#undef SDL_itoa +#undef SDL_uitoa +#undef SDL_atoi +#undef SDL_atof +char *SDL_itoa(int value, char *str, int radix) { return SDL_itoa_inline(value, str, radix); } +char *SDL_uitoa(unsigned int value, char *str, int radix) { return SDL_uitoa_inline(value, str, radix); } +int SDL_atoi(const char *str) { return SDL_atoi_inline(str); } +double SDL_atof(const char *str) { return SDL_atof_inline(str); } + + #define SDL_isupperhex(X) (((X) >= 'A') && ((X) <= 'F')) #define SDL_islowerhex(X) (((X) >= 'a') && ((X) <= 'f')) @@ -43,7 +54,7 @@ static int UTF8_TrailingBytes(unsigned char c) return 0; } -#if !defined(HAVE_SSCANF) || !defined(HAVE_STRTOL) +#if !defined(SDL_sscanf) || !defined(SDL_strtol) static size_t SDL_ScanLong(const char *text, int radix, long *valuep) { @@ -84,7 +95,7 @@ SDL_ScanLong(const char *text, int radix, long *valuep) } #endif -#if !defined(HAVE_SSCANF) || !defined(HAVE_STRTOUL) || !defined(HAVE_STRTOD) +#if !defined(SDL_sscanf) || !defined(SDL_strtoul) || !defined(SDL_strtod) static size_t SDL_ScanUnsignedLong(const char *text, int radix, unsigned long *valuep) { @@ -116,7 +127,7 @@ SDL_ScanUnsignedLong(const char *text, int radix, unsigned long *valuep) } #endif -#ifndef HAVE_SSCANF +#ifndef SDL_sscanf static size_t SDL_ScanUintPtrT(const char *text, int radix, uintptr_t * valuep) { @@ -148,7 +159,7 @@ SDL_ScanUintPtrT(const char *text, int radix, uintptr_t * valuep) } #endif -#if !defined(HAVE_SSCANF) || !defined(HAVE_STRTOLL) +#if !defined(SDL_sscanf) || !defined(SDL_strtoll) static size_t SDL_ScanLongLong(const char *text, int radix, Sint64 * valuep) { @@ -189,7 +200,7 @@ SDL_ScanLongLong(const char *text, int radix, Sint64 * valuep) } #endif -#if !defined(HAVE_SSCANF) || !defined(HAVE_STRTOULL) +#if !defined(SDL_sscanf) || !defined(SDL_strtoull) static size_t SDL_ScanUnsignedLongLong(const char *text, int radix, Uint64 * valuep) { @@ -221,7 +232,7 @@ SDL_ScanUnsignedLongLong(const char *text, int radix, Uint64 * valuep) } #endif -#if !defined(HAVE_SSCANF) || !defined(HAVE_STRTOD) +#if !defined(SDL_sscanf) || !defined(SDL_strtod) static size_t SDL_ScanFloat(const char *text, double *valuep) { @@ -257,7 +268,11 @@ SDL_ScanFloat(const char *text, double *valuep) } #endif -#ifndef SDL_memset + +#ifdef SDL_memset +#undef SDL_memset +void *SDL_memset(void *dst, int c, size_t len) { return SDL_memset_inline(dst, c, len); } +#else void * SDL_memset(void *dst, int c, size_t len) { @@ -287,37 +302,65 @@ SDL_memset(void *dst, int c, size_t len) } #endif -#ifndef SDL_memcpy + +#ifdef SDL_memcpy +#undef SDL_memcpy +void *SDL_memcpy(void *dst, const void *src, size_t len) { return SDL_memcpy_inline(dst, src, len); } +#else void * SDL_memcpy(void *dst, const void *src, size_t len) { - size_t left = (len % 4); - Uint32 *srcp4, *dstp4; - Uint8 *srcp1, *dstp1; +#ifdef __GNUC__ + /* Presumably this is well tuned for speed. + On my machine this is twice as fast as the C code below. + */ + return __builtin_memcpy(dst, src, len); +#else + /* GCC 4.9.0 with -O3 will generate movaps instructions with the loop + using Uint32* pointers, so we need to make sure the pointers are + aligned before we loop using them. + */ + if (((intptr_t)src & 0x3) || ((intptr_t)dst & 0x3)) { + /* Do an unaligned byte copy */ + Uint8 *srcp1 = (Uint8 *)src; + Uint8 *dstp1 = (Uint8 *)dst; - srcp4 = (Uint32 *) src; - dstp4 = (Uint32 *) dst; - len /= 4; - while (len--) { - *dstp4++ = *srcp4++; + while (len--) { + *dstp1++ = *srcp1++; + } + } else { + size_t left = (len % 4); + Uint32 *srcp4, *dstp4; + Uint8 *srcp1, *dstp1; + + srcp4 = (Uint32 *) src; + dstp4 = (Uint32 *) dst; + len /= 4; + while (len--) { + *dstp4++ = *srcp4++; + } + + srcp1 = (Uint8 *) srcp4; + dstp1 = (Uint8 *) dstp4; + switch (left) { + case 3: + *dstp1++ = *srcp1++; + case 2: + *dstp1++ = *srcp1++; + case 1: + *dstp1++ = *srcp1++; + } } - - srcp1 = (Uint8 *) srcp4; - dstp1 = (Uint8 *) dstp4; - switch (left) { - case 3: - *dstp1++ = *srcp1++; - case 2: - *dstp1++ = *srcp1++; - case 1: - *dstp1++ = *srcp1++; - } - return dst; +#endif /* __GNUC__ */ } #endif -#ifndef SDL_memmove + +#ifdef SDL_memmove +#undef SDL_memmove +void *SDL_memmove(void *dst, const void *src, size_t len) { return SDL_memmove_inline(dst, src, len); } +#else void * SDL_memmove(void *dst, const void *src, size_t len) { @@ -339,7 +382,10 @@ SDL_memmove(void *dst, const void *src, size_t len) } #endif -#ifndef SDL_memcmp +#ifdef SDL_memcmp +#undef SDL_memcmp +int SDL_memcmp(const void *s1, const void *s2, size_t len) { return SDL_memcmp_inline(s1, s2, len); } +#else int SDL_memcmp(const void *s1, const void *s2, size_t len) { @@ -356,7 +402,10 @@ SDL_memcmp(const void *s1, const void *s2, size_t len) } #endif -#ifndef HAVE_STRLEN +#ifdef SDL_strlen +#undef SDL_strlen +size_t SDL_strlen(const char *string) { return SDL_strlen_inline(string); } +#else size_t SDL_strlen(const char *string) { @@ -368,7 +417,10 @@ SDL_strlen(const char *string) } #endif -#ifndef HAVE_WCSLEN +#ifdef SDL_wcslen +#undef SDL_wcslen +size_t SDL_wcslen(const wchar_t * string) { return SDL_wcslen_inline(string); } +#else size_t SDL_wcslen(const wchar_t * string) { @@ -380,7 +432,10 @@ SDL_wcslen(const wchar_t * string) } #endif -#ifndef HAVE_WCSLCPY +#ifdef SDL_wcslcpy +#undef SDL_wcslcpy +size_t SDL_wcslcpy(wchar_t *dst, const wchar_t *src, size_t maxlen) { return SDL_wcslcpy_inline(dst, src, maxlen); } +#else size_t SDL_wcslcpy(wchar_t *dst, const wchar_t *src, size_t maxlen) { @@ -394,7 +449,10 @@ SDL_wcslcpy(wchar_t *dst, const wchar_t *src, size_t maxlen) } #endif -#ifndef HAVE_WCSLCAT +#ifdef SDL_wcslcat +#undef SDL_wcslcat +size_t SDL_wcslcat(wchar_t *dst, const wchar_t *src, size_t maxlen) { return SDL_wcslcat_inline(dst, src, maxlen); } +#else size_t SDL_wcslcat(wchar_t *dst, const wchar_t *src, size_t maxlen) { @@ -407,7 +465,10 @@ SDL_wcslcat(wchar_t *dst, const wchar_t *src, size_t maxlen) } #endif -#ifndef HAVE_STRLCPY +#ifdef SDL_strlcpy +#undef SDL_strlcpy +size_t SDL_strlcpy(char *dst, const char *src, size_t maxlen) { return SDL_strlcpy_inline(dst, src, maxlen); } +#else size_t SDL_strlcpy(char *dst, const char *src, size_t maxlen) { @@ -453,7 +514,10 @@ size_t SDL_utf8strlcpy(char *dst, const char *src, size_t dst_bytes) return bytes; } -#ifndef HAVE_STRLCAT +#ifdef SDL_strlcat +#undef SDL_strlcat +size_t SDL_strlcat(char *dst, const char *src, size_t maxlen) { return SDL_strlcat_inline(dst, src, maxlen); } +#else size_t SDL_strlcat(char *dst, const char *src, size_t maxlen) { @@ -466,7 +530,10 @@ SDL_strlcat(char *dst, const char *src, size_t maxlen) } #endif -#ifndef HAVE_STRDUP +#ifdef SDL_strdup +#undef SDL_strdup +char *SDL_strdup(const char *string) { return SDL_strdup_inline(string); } +#else char * SDL_strdup(const char *string) { @@ -479,7 +546,10 @@ SDL_strdup(const char *string) } #endif -#ifndef HAVE__STRREV +#ifdef SDL_strrev +#undef SDL_strrev +char *SDL_strrev(char *string) { return SDL_strrev_inline(string); } +#else char * SDL_strrev(char *string) { @@ -496,7 +566,10 @@ SDL_strrev(char *string) } #endif -#ifndef HAVE__STRUPR +#ifdef SDL_strupr +#undef SDL_strupr +char *SDL_strupr(char *string) { return SDL_strupr_inline(string); } +#else char * SDL_strupr(char *string) { @@ -509,7 +582,10 @@ SDL_strupr(char *string) } #endif -#ifndef HAVE__STRLWR +#ifdef SDL_strlwr +#undef SDL_strlwr +char *SDL_strlwr(char *string) { return SDL_strlwr_inline(string); } +#else char * SDL_strlwr(char *string) { @@ -522,7 +598,10 @@ SDL_strlwr(char *string) } #endif -#ifndef HAVE_STRCHR +#ifdef SDL_strchr +#undef SDL_strchr +char *SDL_strchr(const char *string, int c) { return SDL_strchr_inline(string, c); } +#else char * SDL_strchr(const char *string, int c) { @@ -536,7 +615,10 @@ SDL_strchr(const char *string, int c) } #endif -#ifndef HAVE_STRRCHR +#ifdef SDL_strrchr +#undef SDL_strrchr +char *SDL_strrchr(const char *string, int c) { return SDL_strrchr_inline(string, c); } +#else char * SDL_strrchr(const char *string, int c) { @@ -551,7 +633,10 @@ SDL_strrchr(const char *string, int c) } #endif -#ifndef HAVE_STRSTR +#ifdef SDL_strstr +#undef SDL_strstr +char *SDL_strstr(const char *haystack, const char *needle) { return SDL_strstr_inline(haystack, needle); } +#else char * SDL_strstr(const char *haystack, const char *needle) { @@ -566,8 +651,8 @@ SDL_strstr(const char *haystack, const char *needle) } #endif -#if !defined(HAVE__LTOA) || !defined(HAVE__I64TOA) || \ - !defined(HAVE__ULTOA) || !defined(HAVE__UI64TOA) +#if !defined(SDL_ltoa) || !defined(SDL_lltoa) || \ + !defined(SDL_ultoa) || !defined(SDL_ulltoa) static const char ntoa_table[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', @@ -576,7 +661,10 @@ static const char ntoa_table[] = { }; #endif /* ntoa() conversion table */ -#ifndef HAVE__LTOA +#ifdef SDL_ltoa +#undef SDL_ltoa +char *SDL_ltoa(long value, char *string, int radix) { return SDL_ltoa_inline(value, string, radix); } +#else char * SDL_ltoa(long value, char *string, int radix) { @@ -607,7 +695,10 @@ SDL_ltoa(long value, char *string, int radix) } #endif -#ifndef HAVE__ULTOA +#ifdef SDL_ultoa +#undef SDL_ultoa +char *SDL_ultoa(unsigned long value, char *string, int radix) { return SDL_ultoa_inline(value, string, radix); } +#else char * SDL_ultoa(unsigned long value, char *string, int radix) { @@ -630,7 +721,10 @@ SDL_ultoa(unsigned long value, char *string, int radix) } #endif -#ifndef HAVE_STRTOL +#ifdef SDL_strtol +#undef SDL_strtol +long SDL_strtol(const char *string, char **endp, int base) { return SDL_strtol_inline(string, endp, base); } +#else long SDL_strtol(const char *string, char **endp, int base) { @@ -653,7 +747,10 @@ SDL_strtol(const char *string, char **endp, int base) } #endif -#ifndef HAVE_STRTOUL +#ifdef SDL_strtoul +#undef SDL_strtoul +unsigned long SDL_strtoul(const char *string, char **endp, int base) { return SDL_strtoul_inline(string, endp, base); } +#else unsigned long SDL_strtoul(const char *string, char **endp, int base) { @@ -676,7 +773,10 @@ SDL_strtoul(const char *string, char **endp, int base) } #endif -#ifndef HAVE__I64TOA +#ifdef SDL_lltoa +#undef SDL_lltoa +char *SDL_lltoa(Sint64 value, char *string, int radix) { return SDL_lltoa_inline(value, string, radix); } +#else char * SDL_lltoa(Sint64 value, char *string, int radix) { @@ -707,7 +807,10 @@ SDL_lltoa(Sint64 value, char *string, int radix) } #endif -#ifndef HAVE__UI64TOA +#ifdef SDL_ulltoa +#undef SDL_ulltoa +char *SDL_ulltoa(Uint64 value, char *string, int radix) { return SDL_ulltoa_inline(value, string, radix); } +#else char * SDL_ulltoa(Uint64 value, char *string, int radix) { @@ -730,7 +833,10 @@ SDL_ulltoa(Uint64 value, char *string, int radix) } #endif -#ifndef HAVE_STRTOLL +#ifdef SDL_strtoll +#undef SDL_strtoll +Sint64 SDL_strtoll(const char *string, char **endp, int base) { return SDL_strtoll_inline(string, endp, base); } +#else Sint64 SDL_strtoll(const char *string, char **endp, int base) { @@ -753,7 +859,10 @@ SDL_strtoll(const char *string, char **endp, int base) } #endif -#ifndef HAVE_STRTOULL +#ifdef SDL_strtoull +#undef SDL_strtoull +Uint64 SDL_strtoull(const char *string, char **endp, int base) { return SDL_strtoull_inline(string, endp, base); } +#else Uint64 SDL_strtoull(const char *string, char **endp, int base) { @@ -776,7 +885,10 @@ SDL_strtoull(const char *string, char **endp, int base) } #endif -#ifndef HAVE_STRTOD +#ifdef SDL_strtod +#undef SDL_strtod +double SDL_strtod(const char *string, char **endp) { return SDL_strtod_inline(string, endp); } +#else double SDL_strtod(const char *string, char **endp) { @@ -791,7 +903,10 @@ SDL_strtod(const char *string, char **endp) } #endif -#ifndef HAVE_STRCMP +#ifdef SDL_strcmp +#undef SDL_strcmp +int SDL_strcmp(const char *str1, const char *str2) { return SDL_strcmp_inline(str1, str2); } +#else int SDL_strcmp(const char *str1, const char *str2) { @@ -805,7 +920,10 @@ SDL_strcmp(const char *str1, const char *str2) } #endif -#ifndef HAVE_STRNCMP +#ifdef SDL_strncmp +#undef SDL_strncmp +int SDL_strncmp(const char *str1, const char *str2, size_t maxlen) { return SDL_strncmp_inline(str1, str2, maxlen); } +#else int SDL_strncmp(const char *str1, const char *str2, size_t maxlen) { @@ -823,7 +941,10 @@ SDL_strncmp(const char *str1, const char *str2, size_t maxlen) } #endif -#if !defined(HAVE_STRCASECMP) && !defined(HAVE__STRICMP) +#ifdef SDL_strcasecmp +#undef SDL_strcasecmp +int SDL_strcasecmp(const char *str1, const char *str2) { return SDL_strcasecmp_inline(str1, str2); } +#else int SDL_strcasecmp(const char *str1, const char *str2) { @@ -843,7 +964,10 @@ SDL_strcasecmp(const char *str1, const char *str2) } #endif -#if !defined(HAVE_STRNCASECMP) && !defined(HAVE__STRNICMP) +#ifdef SDL_strncasecmp +#undef SDL_strncasecmp +int SDL_strncasecmp(const char *str1, const char *str2, size_t maxlen) { return SDL_strncasecmp_inline(str1, str2, maxlen); } +#else int SDL_strncasecmp(const char *str1, const char *str2, size_t maxlen) { @@ -858,13 +982,29 @@ SDL_strncasecmp(const char *str1, const char *str2, size_t maxlen) ++str2; --maxlen; } - a = SDL_tolower((unsigned char) *str1); - b = SDL_tolower((unsigned char) *str2); - return (int) ((unsigned char) a - (unsigned char) b); + if (maxlen == 0) { + return 0; + } else { + a = SDL_tolower((unsigned char) *str1); + b = SDL_tolower((unsigned char) *str2); + return (int) ((unsigned char) a - (unsigned char) b); + } } #endif -#ifndef HAVE_SSCANF +#ifdef SDL_sscanf +#undef SDL_sscanf +int +SDL_sscanf(const char *text, const char *fmt, ...) +{ + int rc; + va_list ap; + va_start(ap, fmt); + rc = vsscanf(text, fmt, ap); + va_end(ap); + return rc; +} +#else int SDL_sscanf(const char *text, const char *fmt, ...) { @@ -959,8 +1099,7 @@ SDL_sscanf(const char *text, const char *fmt, ...) ++index; } if (text[index] == '0') { - if (SDL_tolower((unsigned char) text[index + 1]) - == 'x') { + if (SDL_tolower((unsigned char) text[index + 1]) == 'x') { radix = 16; } else { radix = 8; @@ -1132,7 +1271,10 @@ SDL_sscanf(const char *text, const char *fmt, ...) } #endif -#ifndef HAVE_SNPRINTF +/* just undef; the headers only define this to snprintf because of varargs. */ +#ifdef SDL_snprintf +#undef SDL_snprintf +#endif int SDL_snprintf(char *text, size_t maxlen, const char *fmt, ...) { @@ -1145,136 +1287,182 @@ SDL_snprintf(char *text, size_t maxlen, const char *fmt, ...) return retval; } -#endif -#ifndef HAVE_VSNPRINTF -static size_t -SDL_PrintLong(char *text, long value, int radix, size_t maxlen) +#ifdef SDL_vsnprintf +#undef SDL_vsnprintf +int SDL_vsnprintf(char *text, size_t maxlen, const char *fmt, va_list ap) { return SDL_vsnprintf_inline(text, maxlen, fmt, ap); } +#else + /* FIXME: implement more of the format specifiers */ +typedef struct { - char num[130]; - size_t size; + SDL_bool left_justify; + SDL_bool force_sign; + SDL_bool force_type; + SDL_bool pad_zeroes; + SDL_bool do_lowercase; + int width; + int radix; + int precision; +} SDL_FormatInfo; - SDL_ltoa(value, num, radix); - size = SDL_strlen(num); - if (size >= maxlen) { - size = maxlen - 1; - } - SDL_strlcpy(text, num, size + 1); - - return size; +static size_t +SDL_PrintString(char *text, size_t maxlen, SDL_FormatInfo *info, const char *string) +{ + return SDL_strlcpy(text, string, maxlen); } static size_t -SDL_PrintUnsignedLong(char *text, unsigned long value, int radix, - size_t maxlen) +SDL_PrintLong(char *text, size_t maxlen, SDL_FormatInfo *info, long value) { char num[130]; - size_t size; - SDL_ultoa(value, num, radix); - size = SDL_strlen(num); - if (size >= maxlen) { - size = maxlen - 1; - } - SDL_strlcpy(text, num, size + 1); - - return size; + SDL_ltoa(value, num, info ? info->radix : 10); + return SDL_PrintString(text, maxlen, info, num); } static size_t -SDL_PrintLongLong(char *text, Sint64 value, int radix, size_t maxlen) +SDL_PrintUnsignedLong(char *text, size_t maxlen, SDL_FormatInfo *info, unsigned long value) { char num[130]; - size_t size; - SDL_lltoa(value, num, radix); - size = SDL_strlen(num); - if (size >= maxlen) { - size = maxlen - 1; - } - SDL_strlcpy(text, num, size + 1); - - return size; + SDL_ultoa(value, num, info ? info->radix : 10); + return SDL_PrintString(text, maxlen, info, num); } static size_t -SDL_PrintUnsignedLongLong(char *text, Uint64 value, int radix, size_t maxlen) +SDL_PrintLongLong(char *text, size_t maxlen, SDL_FormatInfo *info, Sint64 value) { char num[130]; - size_t size; - SDL_ulltoa(value, num, radix); - size = SDL_strlen(num); - if (size >= maxlen) { - size = maxlen - 1; - } - SDL_strlcpy(text, num, size + 1); - - return size; + SDL_lltoa(value, num, info ? info->radix : 10); + return SDL_PrintString(text, maxlen, info, num); } static size_t -SDL_PrintFloat(char *text, double arg, size_t maxlen) +SDL_PrintUnsignedLongLong(char *text, size_t maxlen, SDL_FormatInfo *info, Uint64 value) { + char num[130]; + + SDL_ulltoa(value, num, info ? info->radix : 10); + return SDL_PrintString(text, maxlen, info, num); +} + +static size_t +SDL_PrintFloat(char *text, size_t maxlen, SDL_FormatInfo *info, double arg) +{ + int i, width; + size_t len; + size_t left = maxlen; char *textstart = text; + if (arg) { /* This isn't especially accurate, but hey, it's easy. :) */ - const double precision = 0.00000001; - size_t len; + double precision = 1.0; unsigned long value; if (arg < 0) { - *text++ = '-'; - --maxlen; + if (left > 1) { + *text = '-'; + --left; + } + ++text; arg = -arg; + } else if (info->force_sign) { + if (left > 1) { + *text = '+'; + --left; + } + ++text; } value = (unsigned long) arg; - len = SDL_PrintUnsignedLong(text, value, 10, maxlen); + len = SDL_PrintUnsignedLong(text, left, NULL, value); text += len; - maxlen -= len; + if (len >= left) { + left = SDL_min(left, 1); + } else { + left -= len; + } arg -= value; - if (arg > precision && maxlen) { + if (info->precision < 0) { + info->precision = 6; + } + for (i = 0; i < info->precision; ++i) { + precision *= 0.1; + } + if (info->force_type || info->precision > 0) { int mult = 10; - *text++ = '.'; - while ((arg > precision) && maxlen) { + if (left > 1) { + *text = '.'; + --left; + } + ++text; + while (info->precision-- > 0) { value = (unsigned long) (arg * mult); - len = SDL_PrintUnsignedLong(text, value, 10, maxlen); + len = SDL_PrintUnsignedLong(text, left, NULL, value); text += len; - maxlen -= len; + if (len >= left) { + left = SDL_min(left, 1); + } else { + left -= len; + } arg -= (double) value / mult; mult *= 10; } } } else { - *text++ = '0'; + if (left > 1) { + *text = '0'; + --left; + } + ++text; + if (info->force_type) { + if (left > 1) { + *text = '.'; + --left; + } + ++text; + } } - return (text - textstart); -} -static size_t -SDL_PrintString(char *text, const char *string, size_t maxlen) -{ - char *textstart = text; - while (*string && maxlen--) { - *text++ = *string++; + width = info->width - (int)(text - textstart); + if (width > 0) { + char fill = info->pad_zeroes ? '0' : ' '; + char *end = text+left-1; + len = (text - textstart); + for (len = (text - textstart); len--; ) { + if ((textstart+len+width) < end) { + *(textstart+len+width) = *(textstart+len); + } + } + len = (size_t)width; + text += len; + if (len >= left) { + left = SDL_min(left, 1); + } else { + left -= len; + } + while (len--) { + if (textstart+len < end) { + textstart[len] = fill; + } + } } + return (text - textstart); } int SDL_vsnprintf(char *text, size_t maxlen, const char *fmt, va_list ap) { + size_t left = maxlen; char *textstart = text; - if (maxlen <= 0) { - return 0; - } - --maxlen; /* For the trailing '\0' */ - while (*fmt && maxlen) { + + while (*fmt) { if (*fmt == '%') { SDL_bool done = SDL_FALSE; size_t len = 0; - SDL_bool do_lowercase = SDL_FALSE; - int radix = 10; + SDL_bool check_flag; + SDL_FormatInfo info; enum { DO_INT, @@ -1282,21 +1470,59 @@ SDL_vsnprintf(char *text, size_t maxlen, const char *fmt, va_list ap) DO_LONGLONG } inttype = DO_INT; - ++fmt; - /* FIXME: implement more of the format specifiers */ - while (*fmt == '.' || (*fmt >= '0' && *fmt <= '9')) { + SDL_zero(info); + info.radix = 10; + info.precision = -1; + + check_flag = SDL_TRUE; + while (check_flag) { ++fmt; + switch (*fmt) { + case '-': + info.left_justify = SDL_TRUE; + break; + case '+': + info.force_sign = SDL_TRUE; + break; + case '#': + info.force_type = SDL_TRUE; + break; + case '0': + info.pad_zeroes = SDL_TRUE; + break; + default: + check_flag = SDL_FALSE; + break; + } } + + if (*fmt >= '0' && *fmt <= '9') { + info.width = SDL_strtol(fmt, (char **)&fmt, 0); + } + + if (*fmt == '.') { + ++fmt; + if (*fmt >= '0' && *fmt <= '9') { + info.precision = SDL_strtol(fmt, (char **)&fmt, 0); + } else { + info.precision = 0; + } + } + while (!done) { switch (*fmt) { case '%': - *text = '%'; + if (left > 1) { + *text = '%'; + } len = 1; done = SDL_TRUE; break; case 'c': /* char is promoted to int when passed through (...) */ - *text = (char) va_arg(ap, int); + if (left > 1) { + *text = (char) va_arg(ap, int); + } len = 1; done = SDL_TRUE; break; @@ -1318,78 +1544,67 @@ SDL_vsnprintf(char *text, size_t maxlen, const char *fmt, va_list ap) case 'd': switch (inttype) { case DO_INT: - len = - SDL_PrintLong(text, - (long) va_arg(ap, int), - radix, maxlen); + len = SDL_PrintLong(text, left, &info, + (long) va_arg(ap, int)); break; case DO_LONG: - len = - SDL_PrintLong(text, va_arg(ap, long), - radix, maxlen); + len = SDL_PrintLong(text, left, &info, + va_arg(ap, long)); break; case DO_LONGLONG: - len = - SDL_PrintLongLong(text, - va_arg(ap, Sint64), - radix, maxlen); + len = SDL_PrintLongLong(text, left, &info, + va_arg(ap, Sint64)); break; } done = SDL_TRUE; break; case 'p': case 'x': - do_lowercase = SDL_TRUE; + info.do_lowercase = SDL_TRUE; /* Fall through to 'X' handling */ case 'X': - if (radix == 10) { - radix = 16; + if (info.radix == 10) { + info.radix = 16; } if (*fmt == 'p') { inttype = DO_LONG; } /* Fall through to unsigned handling */ case 'o': - if (radix == 10) { - radix = 8; + if (info.radix == 10) { + info.radix = 8; } /* Fall through to unsigned handling */ case 'u': switch (inttype) { case DO_INT: - len = SDL_PrintUnsignedLong(text, (unsigned long) - va_arg(ap, - unsigned - int), - radix, maxlen); + len = SDL_PrintUnsignedLong(text, left, &info, + (unsigned long) + va_arg(ap, unsigned int)); break; case DO_LONG: - len = - SDL_PrintUnsignedLong(text, - va_arg(ap, - unsigned - long), - radix, maxlen); + len = SDL_PrintUnsignedLong(text, left, &info, + va_arg(ap, unsigned long)); break; case DO_LONGLONG: - len = - SDL_PrintUnsignedLongLong(text, - va_arg(ap, - Uint64), - radix, maxlen); + len = SDL_PrintUnsignedLongLong(text, left, &info, + va_arg(ap, Uint64)); break; } - if (do_lowercase) { - SDL_strlwr(text); + if (info.do_lowercase) { + size_t i; + for (i = 0; i < len && i < left; ++i) { + text[i] = SDL_tolower((unsigned char)text[i]); + } } done = SDL_TRUE; break; case 'f': - len = SDL_PrintFloat(text, va_arg(ap, double), maxlen); + len = SDL_PrintFloat(text, left, &info, va_arg(ap, double)); done = SDL_TRUE; break; case 's': - len = SDL_PrintString(text, va_arg(ap, char *), maxlen); + len = SDL_PrintString(text, left, &info, va_arg(ap, char *)); done = SDL_TRUE; break; default: @@ -1399,15 +1614,25 @@ SDL_vsnprintf(char *text, size_t maxlen, const char *fmt, va_list ap) ++fmt; } text += len; - maxlen -= len; + if (len >= left) { + left = SDL_min(left, 1); + } else { + left -= len; + } } else { - *text++ = *fmt++; - --maxlen; + if (left > 1) { + *text = *fmt; + --left; + } + ++fmt; + ++text; } } - *text = '\0'; - + if (left > 0) { + *text = '\0'; + } return (int)(text - textstart); } #endif + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/eepp/helper/SDL2/src/test/SDL_test_assert.c b/src/eepp/helper/SDL2/src/test/SDL_test_assert.c index 13eda7be8..41a3df68f 100644 --- a/src/eepp/helper/SDL2/src/test/SDL_test_assert.c +++ b/src/eepp/helper/SDL2/src/test/SDL_test_assert.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,7 +21,7 @@ /* - Used by the test framework and test cases. + Used by the test framework and test cases. */ @@ -30,10 +30,10 @@ #include "SDL_test.h" /* Assert check message format */ -const char *SDLTest_AssertCheckFmt = "Assert '%s': %s"; +const char *SDLTest_AssertCheckFormat = "Assert '%s': %s"; /* Assert summary message format */ -const char *SDLTest_AssertSummaryFmt = "Assert Summary: Total=%d Passed=%d Failed=%d"; +const char *SDLTest_AssertSummaryFormat = "Assert Summary: Total=%d Passed=%d Failed=%d"; /*! \brief counts the failed asserts */ static Uint32 SDLTest_AssertsFailed = 0; @@ -44,29 +44,67 @@ static Uint32 SDLTest_AssertsPassed = 0; /* * Assert that logs and break execution flow on failures (i.e. for harness errors). */ -void SDLTest_Assert(int assertCondition, char *assertDescription) +void SDLTest_Assert(int assertCondition, const char *assertDescription, ...) { - SDL_assert((SDLTest_AssertCheck(assertCondition, 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))); } /* * Assert that logs but does not break execution flow on failures (i.e. for test cases). */ -int SDLTest_AssertCheck(int assertCondition, char *assertDescription) +int SDLTest_AssertCheck(int assertCondition, const char *assertDescription, ...) { - char *fmt = (char *)SDLTest_AssertCheckFmt; - if (assertCondition == ASSERT_FAIL) - { - SDLTest_AssertsFailed++; - SDLTest_LogError(fmt, assertDescription, "Failed"); - } - else - { - SDLTest_AssertsPassed++; - SDLTest_Log(fmt, assertDescription, "Passed"); - } + va_list list; + char logMessage[SDLTEST_MAX_LOGMESSAGE_LENGTH]; - return assertCondition; + /* 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; +} + +/* + * Explicitly passing Assert that logs (i.e. for test cases). + */ +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"); } /* @@ -74,26 +112,25 @@ int SDLTest_AssertCheck(int assertCondition, 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() { - char *fmt = (char *)SDLTest_AssertSummaryFmt; - Uint32 totalAsserts = SDLTest_AssertsPassed + SDLTest_AssertsFailed; - if (SDLTest_AssertsFailed == 0) - { - SDLTest_Log(fmt, totalAsserts, SDLTest_AssertsPassed, SDLTest_AssertsFailed); - } - else - { - SDLTest_LogError(fmt, 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); + } } /* @@ -101,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/eepp/helper/SDL2/src/test/SDL_test_common.c b/src/eepp/helper/SDL2/src/test/SDL_test_common.c index 2fe85b56c..8e0e4487c 100644 --- a/src/eepp/helper/SDL2/src/test/SDL_test_common.c +++ b/src/eepp/helper/SDL2/src/test/SDL_test_common.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -27,7 +27,7 @@ #include #define VIDEO_USAGE \ -"[--video driver] [--renderer driver] [--info all|video|modes|render|event] [--log all|error|system|audio|video|render|input] [--display N] [--fullscreen | --windows N] [--title title] [--icon icon.bmp] [--center | --position X,Y] [--geometry WxH] [--depth N] [--refresh R] [--vsync] [--noframe] [--resize] [--minimize] [--maximize] [--grab]" +"[--video driver] [--renderer driver] [--gldebug] [--info all|video|modes|render|event] [--log all|error|system|audio|video|render|input] [--display N] [--fullscreen | --fullscreen-desktop | --windows N] [--title title] [--icon icon.bmp] [--center | --position X,Y] [--geometry WxH] [--min-geometry WxH] [--max-geometry WxH] [--depth N] [--refresh R] [--vsync] [--noframe] [--resize] [--minimize] [--maximize] [--grab]" #define AUDIO_USAGE \ "[--rate N] [--format U8|S8|U16|U16LE|U16BE|S16|S16LE|S16BE] [--channels N] [--samples N]" @@ -44,11 +44,7 @@ SDLTest_CommonCreateState(char **argv, Uint32 flags) /* Initialize some defaults */ state->argv = argv; state->flags = flags; -#ifdef __NDS__ - state->window_title = ""; -#else state->window_title = argv[0]; -#endif state->window_flags = 0; state->window_x = SDL_WINDOWPOS_UNDEFINED; state->window_y = SDL_WINDOWPOS_UNDEFINED; @@ -78,6 +74,7 @@ SDLTest_CommonCreateState(char **argv, Uint32 flags) state->gl_multisamplesamples = 0; state->gl_retained_backing = 1; state->gl_accelerated = -1; + state->gl_debug = 0; return state; } @@ -87,10 +84,6 @@ SDLTest_CommonArg(SDLTest_CommonState * state, int index) { char **argv = state->argv; -#ifdef __NDS__ - return 0; -#endif - if (SDL_strcasecmp(argv[index], "--video") == 0) { ++index; if (!argv[index]) { @@ -107,6 +100,10 @@ SDLTest_CommonArg(SDLTest_CommonState * state, int index) state->renderdriver = argv[index]; return 2; } + if (SDL_strcasecmp(argv[index], "--gldebug") == 0) { + state->gl_debug = 1; + return 1; + } if (SDL_strcasecmp(argv[index], "--info") == 0) { ++index; if (!argv[index]) { @@ -192,6 +189,11 @@ SDLTest_CommonArg(SDLTest_CommonState * state, int index) state->num_windows = 1; return 1; } + if (SDL_strcasecmp(argv[index], "--fullscreen-desktop") == 0) { + state->window_flags |= SDL_WINDOW_FULLSCREEN_DESKTOP; + state->num_windows = 1; + return 1; + } if (SDL_strcasecmp(argv[index], "--windows") == 0) { ++index; if (!argv[index] || !SDL_isdigit(*argv[index])) { @@ -261,6 +263,44 @@ SDLTest_CommonArg(SDLTest_CommonState * state, int index) state->window_h = SDL_atoi(h); return 2; } + if (SDL_strcasecmp(argv[index], "--min-geometry") == 0) { + char *w, *h; + ++index; + if (!argv[index]) { + return -1; + } + w = argv[index]; + h = argv[index]; + while (*h && *h != 'x') { + ++h; + } + if (!*h) { + return -1; + } + *h++ = '\0'; + state->window_minW = SDL_atoi(w); + state->window_minH = SDL_atoi(h); + return 2; + } + if (SDL_strcasecmp(argv[index], "--max-geometry") == 0) { + char *w, *h; + ++index; + if (!argv[index]) { + return -1; + } + w = argv[index]; + h = argv[index]; + while (*h && *h != 'x') { + ++h; + } + if (!*h) { + return -1; + } + *h++ = '\0'; + state->window_maxW = SDL_atoi(w); + state->window_maxH = SDL_atoi(h); + return 2; + } if (SDL_strcasecmp(argv[index], "--depth") == 0) { ++index; if (!argv[index]) { @@ -370,7 +410,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; @@ -621,6 +661,9 @@ SDLTest_CommonInit(SDLTest_CommonState * state) SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, state->gl_major_version); SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, state->gl_minor_version); } + if (state->gl_debug) { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_FLAGS, SDL_GL_CONTEXT_DEBUG_FLAG); + } if (state->verbose & VERBOSE_MODES) { SDL_Rect bounds; @@ -631,7 +674,7 @@ SDLTest_CommonInit(SDLTest_CommonState * state) n = SDL_GetNumVideoDisplays(); fprintf(stderr, "Number of displays: %d\n", n); for (i = 0; i < n; ++i) { - fprintf(stderr, "Display %d:\n", i); + fprintf(stderr, "Display %d: %s\n", i, SDL_GetDisplayName(i)); SDL_zero(bounds); SDL_GetDisplayBounds(i, &bounds); @@ -746,6 +789,12 @@ SDLTest_CommonInit(SDLTest_CommonState * state) SDL_GetError()); return SDL_FALSE; } + if (state->window_minW || state->window_minH) { + SDL_SetWindowMinimumSize(state->windows[i], state->window_minW, state->window_minH); + } + if (state->window_maxW || state->window_maxH) { + SDL_SetWindowMaximumSize(state->windows[i], state->window_maxW, state->window_maxH); + } SDL_GetWindowSize(state->windows[i], &w, &h); if (!(state->window_flags & SDL_WINDOW_RESIZABLE) && (w != state->window_w || h != state->window_h)) { @@ -851,7 +900,7 @@ SDLTest_PrintEvent(SDL_Event * event) { if (event->type == SDL_MOUSEMOTION) { /* Mouse motion is really spammy */ - //return; + return; } fprintf(stderr, "SDL EVENT: "); @@ -1056,10 +1105,33 @@ SDLTest_ScreenShot(SDL_Renderer *renderer) } } +static void +FullscreenTo(int index, int windowId) +{ + Uint32 flags; + struct SDL_Rect rect = { 0, 0, 0, 0 }; + SDL_Window *window = SDL_GetWindowFromID(windowId); + if (!window) { + return; + } + + SDL_GetDisplayBounds( index, &rect ); + + flags = SDL_GetWindowFlags(window); + if (flags & SDL_WINDOW_FULLSCREEN) { + SDL_SetWindowFullscreen( window, SDL_FALSE ); + SDL_Delay( 15 ); + } + + SDL_SetWindowPosition( window, rect.x, rect.y ); + SDL_SetWindowFullscreen( window, SDL_TRUE ); +} + void SDLTest_CommonEvent(SDLTest_CommonState * state, SDL_Event * event, int *done) { int i; + static SDL_MouseMotionEvent lastEvent; if (state->verbose & VERBOSE_EVENT) { SDLTest_PrintEvent(event); @@ -1087,12 +1159,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; @@ -1138,6 +1210,26 @@ SDLTest_CommonEvent(SDLTest_CommonState * state, SDL_Event * event, int *done) SDL_SetClipboardText("SDL rocks!\nYou know it!"); printf("Copied text to clipboard\n"); } + if (event->key.keysym.mod & KMOD_ALT) { + /* Alt-C toggle a render clip rectangle */ + for (i = 0; i < state->num_windows; ++i) { + int w, h; + if (state->renderers[i]) { + SDL_Rect clip; + SDL_GetWindowSize(state->windows[i], &w, &h); + SDL_RenderGetClipRect(state->renderers[i], &clip); + if (SDL_RectEmpty(&clip)) { + clip.x = w/4; + clip.y = h/4; + clip.w = w/2; + clip.h = h/2; + SDL_RenderSetClipRect(state->renderers[i], &clip); + } else { + SDL_RenderSetClipRect(state->renderers[i], NULL); + } + } + } + } break; case SDLK_v: if (event->key.keysym.mod & KMOD_CTRL) { @@ -1214,15 +1306,34 @@ SDLTest_CommonEvent(SDLTest_CommonState * state, SDL_Event * event, int *done) } } break; - case SDLK_1: + 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); } break; + case SDLK_1: + if (event->key.keysym.mod & KMOD_CTRL) { + FullscreenTo(0, event->key.windowID); + } + break; + case SDLK_2: + if (event->key.keysym.mod & KMOD_CTRL) { + FullscreenTo(1, event->key.windowID); + } + break; case SDLK_ESCAPE: *done = 1; break; + case SDLK_SPACE: + { + char message[256]; + SDL_Window *window = SDL_GetWindowFromID(event->key.windowID); + + SDL_snprintf(message, sizeof(message), "(%i, %i), rel (%i, %i)\n", lastEvent.x, lastEvent.y, lastEvent.xrel, lastEvent.yrel); + SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_INFORMATION, "Last mouse position", message, window); + break; + } default: break; } @@ -1230,6 +1341,9 @@ SDLTest_CommonEvent(SDLTest_CommonState * state, SDL_Event * event, int *done) case SDL_QUIT: *done = 1; break; + case SDL_MOUSEMOTION: + lastEvent = event->motion; + break; } } diff --git a/src/eepp/helper/SDL2/src/test/SDL_test_compare.c b/src/eepp/helper/SDL2/src/test/SDL_test_compare.c new file mode 100644 index 000000000..33f237311 --- /dev/null +++ b/src/eepp/helper/SDL2/src/test/SDL_test_compare.c @@ -0,0 +1,107 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2013 Sam Lantinga + + 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 + appreciated but is not required. + 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. +*/ + +/* + + Based on automated SDL_Surface tests originally written by Edgar Simo 'bobbens'. + + Rewritten for test lib by Andreas Schiffler. + +*/ + +#include "SDL_config.h" + +#include "SDL_test.h" + + +/* Counter for _CompareSurface calls; used for filename creation when comparisons fail */ +static int _CompareSurfaceCount = 0; + +/* Compare surfaces */ +int SDLTest_CompareSurfaces(SDL_Surface *surface, SDL_Surface *referenceSurface, int allowable_error) +{ + int ret; + int i,j; + int bpp, bpp_reference; + Uint8 *p, *p_reference; + int dist; + Uint8 R, G, B, A; + Uint8 Rd, Gd, Bd, Ad; + char imageFilename[128]; + char referenceFilename[128]; + + /* Validate input surfaces */ + if (surface == NULL || referenceSurface == NULL) { + return -1; + } + + /* Make sure surface size is the same. */ + if ((surface->w != referenceSurface->w) || (surface->h != referenceSurface->h)) { + return -2; + } + + /* Sanitize input value */ + if (allowable_error<0) { + allowable_error = 0; + } + + SDL_LockSurface( surface ); + SDL_LockSurface( referenceSurface ); + + ret = 0; + bpp = surface->format->BytesPerPixel; + bpp_reference = referenceSurface->format->BytesPerPixel; + /* Compare image - should be same format. */ + for (j=0; jh; j++) { + for (i=0; iw; i++) { + p = (Uint8 *)surface->pixels + j * surface->pitch + i * bpp; + p_reference = (Uint8 *)referenceSurface->pixels + j * referenceSurface->pitch + i * bpp_reference; + + SDL_GetRGBA(*(Uint32*)p, surface->format, &R, &G, &B, &A); + SDL_GetRGBA(*(Uint32*)p_reference, referenceSurface->format, &Rd, &Gd, &Bd, &Ad); + + dist = 0; + 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++; + } + } + } + + SDL_UnlockSurface( surface ); + SDL_UnlockSurface( referenceSurface ); + + /* Save test image and reference for analysis on failures */ + _CompareSurfaceCount++; + if (ret != 0) { + SDL_snprintf(imageFilename, 127, "CompareSurfaces%04d_TestOutput.bmp", _CompareSurfaceCount); + SDL_SaveBMP(surface, imageFilename); + SDL_snprintf(referenceFilename, 127, "CompareSurfaces%04d_Reference.bmp", _CompareSurfaceCount); + SDL_SaveBMP(referenceSurface, referenceFilename); + SDLTest_LogError("Surfaces from failed comparison saved as '%s' and '%s'", imageFilename, referenceFilename); + } + + return ret; +} diff --git a/src/eepp/helper/SDL2/src/test/SDL_test_crc32.c b/src/eepp/helper/SDL2/src/test/SDL_test_crc32.c index 17c4f0f59..d6685c347 100644 --- a/src/eepp/helper/SDL2/src/test/SDL_test_crc32.c +++ b/src/eepp/helper/SDL2/src/test/SDL_test_crc32.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -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/eepp/helper/SDL2/src/test/SDL_test_font.c b/src/eepp/helper/SDL2/src/test/SDL_test_font.c index 48f4dffe6..144bcad02 100644 --- a/src/eepp/helper/SDL2/src/test/SDL_test_font.c +++ b/src/eepp/helper/SDL2/src/test/SDL_test_font.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -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; + 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 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; + /* + * Setup destination rectangle + */ + drect.x = x; + drect.y = y; + drect.w = charWidth; + drect.h = charHeight; - /* Character index in cache */ - ci = (unsigned char)c; + /* 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); - } + /* + * 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; + 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; - } + /* + * 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); + /* Convert temp surface into texture */ + SDLTest_CharTextureCache[ci] = SDL_CreateTextureFromSurface(renderer, character); + SDL_FreeSurface(character); - /* - * Check pointer - */ - if (SDLTest_CharTextureCache[ci] == NULL) { - return (-1); - } - } + /* + * 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); + /* + * 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); + /* + * Draw texture onto destination + */ + result |= SDL_RenderCopy(renderer, SDLTest_CharTextureCache[ci], &srect, &drect); - return (result); + 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; + 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++; - } + while (*curchar && !result) { + result |= SDLTest_DrawCharacter(renderer, curx, cury, *curchar); + curx += charWidth; + curchar++; + } - return (result); + return (result); } diff --git a/src/eepp/helper/SDL2/src/test/SDL_test_fuzzer.c b/src/eepp/helper/SDL2/src/test/SDL_test_fuzzer.c index a25a8c260..8a27fd011 100644 --- a/src/eepp/helper/SDL2/src/test/SDL_test_fuzzer.c +++ b/src/eepp/helper/SDL2/src/test/SDL_test_fuzzer.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,15 +19,23 @@ 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" +/* Visual Studio 2008 doesn't have stdint.h */ +#if defined(_MSC_VER) && _MSC_VER <= 1500 +#define UINT8_MAX ~(Uint8)0 +#define UINT16_MAX ~(Uint16)0 +#define UINT32_MAX ~(Uint32)0 +#define UINT64_MAX ~(Uint64)0 +#else #include +#endif #include #include #include @@ -35,10 +43,10 @@ #include "SDL_test.h" -/** - *Counter for fuzzer invocations +/** + * Counter for fuzzer invocations */ -static int fuzzerInvocationCounter; +static int fuzzerInvocationCounter = 0; /** * Context for shared random number generator @@ -52,91 +60,93 @@ static SDLTest_RandomContext rndContext; void SDLTest_FuzzerInit(Uint64 execKey) { - Uint32 a = (execKey >> 32) & 0x00000000FFFFFFFF; - Uint32 b = execKey & 0x00000000FFFFFFFF; - SDLTest_RandomInit(&rndContext, a, b); + 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_GetInvocationCount() +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; - 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; - 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; } @@ -144,494 +154,371 @@ SDLTest_RandomSint64() Sint32 SDLTest_RandomIntegerInRange(Sint32 pMin, Sint32 pMax) { - Sint64 min = pMin; - Sint64 max = pMax; - Sint64 temp; - Sint64 number; + 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; - } + if(pMin > pMax) { + temp = min; + min = max; + max = temp; + } else if(pMin == pMax) { + return (Sint32)min; + } - number = SDLTest_RandomUint32(); // invocation count increment in there + number = SDLTest_RandomUint32(); + /* invocation count increment in preceeding call */ - return (Sint32)((number % ((max + 1) - min)) + min); + return (Sint32)((number % ((max + 1) - min)) + min); } /*! - * Generates boundary values between the given boundaries. + * Generates a unsigned boundary value between the given boundaries. * Boundary values are inclusive. See the examples below. * If boundary2 < boundary1, the values are swapped. * If boundary1 == boundary2, value of boundary1 will be returned * * Generating boundary values for Uint8: - * BoundaryValues(sizeof(Uint8), 10, 20, True) -> [10,11,19,20] - * BoundaryValues(sizeof(Uint8), 10, 20, False) -> [9,21] - * BoundaryValues(sizeof(Uint8), 0, 15, True) -> [0, 1, 14, 15] - * BoundaryValues(sizeof(Uint8), 0, 15, False) -> [16] - * BoundaryValues(sizeof(Uint8), 0, 255, False) -> NULL + * BoundaryValues(UINT8_MAX, 10, 20, True) -> [10,11,19,20] + * BoundaryValues(UINT8_MAX, 10, 20, False) -> [9,21] + * BoundaryValues(UINT8_MAX, 0, 15, True) -> [0, 1, 14, 15] + * BoundaryValues(UINT8_MAX, 0, 15, False) -> [16] + * BoundaryValues(UINT8_MAX, 0, 0xFF, False) -> [0], error set * * Generator works the same for other types of unsigned integers. * - * Note: outBuffer will be allocated and needs to be freed later. - * If outbuffer != NULL, it'll be freed. - * * \param maxValue The biggest value that is acceptable for this data type. - * For instance, for Uint8 -> 255, Uint16 -> 65536 etc. - * \param pBoundary1 defines lower boundary - * \param pBoundary2 defines upper boundary + * 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) * - * \param outBuffer The generated boundary values are put here - * - * \returns Returns the number of elements in outBuffer or -1 in case of error + * \returns Returns a random boundary value for the domain or 0 in case of error */ -Uint32 -SDLTest_GenerateUnsignedBoundaryValues(const Uint64 maxValue, - Uint64 pBoundary1, Uint64 pBoundary2, SDL_bool validDomain, - Uint64 *outBuffer) +Uint64 +SDLTest_GenerateUnsignedBoundaryValues(const Uint64 maxValue, Uint64 boundary1, Uint64 boundary2, SDL_bool validDomain) { - Uint64 boundary1 = pBoundary1, boundary2 = pBoundary2; - Uint64 temp; - Uint64 tempBuf[4]; - int index; + Uint64 b1, b2; + Uint64 delta; + Uint64 tempBuf[4]; + Uint8 index; - if(outBuffer != NULL) { - SDL_free(outBuffer); - } + /* Maybe swap */ + if (boundary1 > boundary2) { + b1 = boundary2; + b2 = boundary1; + } else { + b1 = boundary1; + b2 = boundary2; + } - if(boundary1 > boundary2) { - temp = boundary1; - boundary1 = boundary2; - boundary2 = temp; - } + index = 0; + if (validDomain == SDL_TRUE) { + if (b1 == b2) { + return b1; + } - index = 0; - if(boundary1 == boundary2) { - tempBuf[index++] = boundary1; - } - else if(validDomain) { - tempBuf[index++] = boundary1; + /* 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(boundary1 < UINT64_MAX) - tempBuf[index++] = boundary1 + 1; + if (b2 < maxValue) { + tempBuf[index] = b2 + 1; + index++; + } + } - tempBuf[index++] = boundary2 - 1; - tempBuf[index++] = boundary2; - } - else { - if(boundary1 > 0) { - tempBuf[index++] = boundary1 - 1; - } + if (index == 0) { + /* There are no valid boundaries */ + SDL_Unsupported(); + return 0; + } - if(boundary2 < maxValue && boundary2 < UINT64_MAX) { - tempBuf[index++] = boundary2 + 1; - } - } - - if(index == 0) { - // There are no valid boundaries - return 0; - } - - // Create the return buffer - outBuffer = (Uint64 *)SDL_malloc(index * sizeof(Uint64)); - if(outBuffer == NULL) { - return 0; - } - - SDL_memcpy(outBuffer, tempBuf, index * sizeof(Uint64)); - - return index; + return tempBuf[SDLTest_RandomUint8() % index]; } + Uint8 SDLTest_RandomUint8BoundaryValue(Uint8 boundary1, Uint8 boundary2, SDL_bool validDomain) { - Uint64 *buffer = NULL; - Uint32 size; - Uint32 index; - Uint8 retVal; - - // max value for Uint8 - const Uint64 maxValue = UINT8_MAX; - - size = SDLTest_GenerateUnsignedBoundaryValues(maxValue, - (Uint64) boundary1, (Uint64) boundary2, - validDomain, buffer); - if (buffer == NULL || size == 0) { - return 0; - } - - index = SDLTest_RandomSint32() % size; - retVal = (Uint8)buffer[index]; - - SDL_free(buffer); - - fuzzerInvocationCounter++; - - return retVal; + /* 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) { - Uint64 *buffer = NULL; - Uint32 size; - Uint32 index; - Uint16 retVal; - - // max value for Uint16 - const Uint64 maxValue = UINT16_MAX; - - size = SDLTest_GenerateUnsignedBoundaryValues(maxValue, - (Uint64) boundary1, (Uint64) boundary2, - validDomain, buffer); - if (buffer == NULL || size == 0) { - return 0; - } - - index = SDLTest_RandomSint32() % size; - retVal = (Uint16) buffer[index]; - - SDL_free(buffer); - - fuzzerInvocationCounter++; - - return retVal; + /* 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) { - Uint64 *buffer = NULL; - Uint32 size; - Uint32 index; - Uint32 retVal; - - // max value for Uint32 - const Uint64 maxValue = UINT32_MAX; - - size = SDLTest_GenerateUnsignedBoundaryValues(maxValue, - (Uint64) boundary1, (Uint64) boundary2, - validDomain, buffer); - if (buffer == NULL || size == 0) { - return 0; - } - - index = SDLTest_RandomSint32() % size; - retVal = (Uint32) buffer[index]; - - SDL_free(buffer); - - fuzzerInvocationCounter++; - - return retVal; + /* max value for Uint32 */ + #if ((ULONG_MAX) == (UINT_MAX)) + const Uint64 maxValue = ULONG_MAX; + #else + const Uint64 maxValue = UINT_MAX; + #endif + return (Uint32)SDLTest_GenerateUnsignedBoundaryValues(maxValue, + (Uint64) boundary1, (Uint64) boundary2, + validDomain); } Uint64 SDLTest_RandomUint64BoundaryValue(Uint64 boundary1, Uint64 boundary2, SDL_bool validDomain) { - Uint64 *buffer = NULL; - Uint32 size; - Uint32 index; - Uint64 retVal; - - // max value for Uint64 - const Uint64 maxValue = UINT64_MAX; - - size = SDLTest_GenerateUnsignedBoundaryValues(maxValue, - (Uint64) boundary1, (Uint64) boundary2, - validDomain, buffer); - if (buffer == NULL || size == 0) { - return 0; - } - - index = SDLTest_RandomSint32() % size; - retVal = (Uint64) buffer[index]; - - SDL_free(buffer); - - fuzzerInvocationCounter++; - - return retVal; + /* max value for Uint64 */ + const Uint64 maxValue = ULLONG_MAX; + return SDLTest_GenerateUnsignedBoundaryValues(maxValue, + (Uint64) boundary1, (Uint64) boundary2, + validDomain); } /*! - * Generates boundary values between the given boundaries. + * Generates a signed boundary value between the given boundaries. * Boundary values are inclusive. See the examples below. * If boundary2 < boundary1, the values are swapped. * If boundary1 == boundary2, value of boundary1 will be returned * * Generating boundary values for Sint8: - * SignedBoundaryValues(sizeof(Sint8), -10, 20, True) -> [-11,-10,19,20] - * SignedBoundaryValues(sizeof(Sint8), -10, 20, False) -> [-11,21] - * SignedBoundaryValues(sizeof(Sint8), -30, -15, True) -> [-30, -29, -16, -15] - * SignedBoundaryValues(sizeof(Sint8), -128, 15, False) -> [16] - * SignedBoundaryValues(sizeof(Sint8), -128, 127, False) -> NULL + * SignedBoundaryValues(SCHAR_MIN, SCHAR_MAX, -10, 20, True) -> [-10,-9,19,20] + * SignedBoundaryValues(SCHAR_MIN, SCHAR_MAX, -10, 20, False) -> [-11,21] + * SignedBoundaryValues(SCHAR_MIN, SCHAR_MAX, -30, -15, True) -> [-30, -29, -16, -15] + * SignedBoundaryValues(SCHAR_MIN, SCHAR_MAX, -127, 15, False) -> [16] + * SignedBoundaryValues(SCHAR_MIN, SCHAR_MAX, -127, 127, False) -> [0], error set * * Generator works the same for other types of signed integers. * - * Note: outBuffer will be allocated and needs to be freed later. - * If outbuffer != NULL, it'll be freed. - * - * - * \param minValue The smallest value that is acceptable for this data type. - * For instance, for Uint8 -> -128, Uint16 -> -32,768 etc. + * \param minValue The smallest value that is acceptable for this data type. + * For instance, for Uint8 -> -127, etc. * \param maxValue The biggest value that is acceptable for this data type. - * For instance, for Uint8 -> 127, Uint16 -> 32767 etc. - * \param pBoundary1 defines lower boundary - * \param pBoundary2 defines upper boundary + * 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) * - * \param outBuffer The generated boundary values are put here - * - * \returns Returns the number of elements in outBuffer or -1 in case of error + * \returns Returns a random boundary value for the domain or 0 in case of error */ -Uint32 -SDLTest_GenerateSignedBoundaryValues(const Sint64 minValue, const Sint64 maxValue, - Sint64 pBoundary1, Sint64 pBoundary2, SDL_bool validDomain, - Sint64 *outBuffer) +Sint64 +SDLTest_GenerateSignedBoundaryValues(const Sint64 minValue, const Sint64 maxValue, Sint64 boundary1, Sint64 boundary2, SDL_bool validDomain) { - int index; - Sint64 tempBuf[4]; - Sint64 boundary1 = pBoundary1, boundary2 = pBoundary2; + Sint64 b1, b2; + Sint64 delta; + Sint64 tempBuf[4]; + Uint8 index; - if(outBuffer != NULL) { - SDL_free(outBuffer); - } + /* Maybe swap */ + if (boundary1 > boundary2) { + b1 = boundary2; + b2 = boundary1; + } else { + b1 = boundary1; + b2 = boundary2; + } - if(boundary1 > boundary2) { - Sint64 temp = boundary1; - boundary1 = boundary2; - boundary2 = temp; - } + index = 0; + if (validDomain == SDL_TRUE) { + if (b1 == b2) { + return b1; + } - index = 0; - if(boundary1 == boundary2) { - tempBuf[index++] = boundary1; - } - else if(validDomain) { - tempBuf[index++] = boundary1; + /* 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(boundary1 < LLONG_MAX) - tempBuf[index++] = boundary1 + 1; + if (b2 < maxValue) { + tempBuf[index] = b2 + 1; + index++; + } + } - if(boundary2 > LLONG_MIN) - tempBuf[index++] = boundary2 - 1; + if (index == 0) { + /* There are no valid boundaries */ + SDL_Unsupported(); + return minValue; + } - tempBuf[index++] = boundary2; - } - else { - if(boundary1 > minValue && boundary1 > LLONG_MIN) { - tempBuf[index++] = boundary1 - 1; - } - - if(boundary2 < maxValue && boundary2 < UINT64_MAX) { - tempBuf[index++] = boundary2 + 1; - } - } - - if(index == 0) { - // There are no valid boundaries - return 0; - } - - // Create the return buffer - outBuffer = (Sint64 *)SDL_malloc(index * sizeof(Sint64)); - if(outBuffer == NULL) { - return 0; - } - - SDL_memcpy((void *)outBuffer, (void *)tempBuf, index * sizeof(Sint64)); - - return (Uint32)index; + return tempBuf[SDLTest_RandomUint8() % index]; } + Sint8 SDLTest_RandomSint8BoundaryValue(Sint8 boundary1, Sint8 boundary2, SDL_bool validDomain) { - // min & max values for Sint8 - const Sint64 maxValue = CHAR_MAX; - const Sint64 minValue = CHAR_MIN; - - Sint64 *buffer = NULL; - Uint32 size; - Uint32 index; - Sint8 retVal; - - size = SDLTest_GenerateSignedBoundaryValues(minValue, maxValue, - (Sint64) boundary1, (Sint64) boundary2, - validDomain, buffer); - if (buffer == NULL || size == 0) { - return CHAR_MIN; - } - - index = SDLTest_RandomSint32() % size; - retVal = (Sint8) buffer[index]; - - SDL_free(buffer); - - fuzzerInvocationCounter++; - - return retVal; + /* 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; - Sint64 *buffer = NULL; - Uint32 size; - Uint32 index; - Sint16 retVal; - - size = SDLTest_GenerateSignedBoundaryValues(minValue, maxValue, - (Sint64) boundary1, (Sint64) boundary2, - validDomain, buffer); - if (buffer == NULL || size == 0) { - return SHRT_MIN; - } - - index = SDLTest_RandomSint32() % size; - retVal = (Sint16) buffer[index]; - - SDL_free(buffer); - - fuzzerInvocationCounter++; - - return retVal; + /* 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 - const Sint64 maxValue = INT_MAX; - const Sint64 minValue = INT_MIN; - - Sint64 *buffer = NULL; - Uint32 size; - Uint32 index; - Sint32 retVal; - - size = SDLTest_GenerateSignedBoundaryValues(minValue, maxValue, - (Sint64) boundary1, (Sint64) boundary2, - validDomain, buffer); - if (buffer == NULL || size == 0) { - return INT_MIN; - } - - index = SDLTest_RandomSint32() % size; - retVal = (Sint32) buffer[index]; - - SDL_free(buffer); - - fuzzerInvocationCounter++; - - return retVal; + /* 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; + #endif + return (Sint32)SDLTest_GenerateSignedBoundaryValues(minValue, maxValue, + (Sint64) boundary1, (Sint64) boundary2, + validDomain); } Sint64 SDLTest_RandomSint64BoundaryValue(Sint64 boundary1, Sint64 boundary2, SDL_bool validDomain) { - Sint64 *buffer = NULL; - Uint32 size; - Uint32 index; - Sint64 retVal; - - // min & max values for Sint64 - const Sint64 maxValue = LLONG_MAX; - const Sint64 minValue = LLONG_MIN; - - size = SDLTest_GenerateSignedBoundaryValues(minValue, maxValue, - (Sint64) boundary1, (Sint64) boundary2, - validDomain, buffer); - if (buffer == NULL || size == 0) { - return LLONG_MIN; - } - - index = SDLTest_RandomSint32() % size; - retVal = (Sint64) buffer[index]; - - SDL_free(buffer); - - fuzzerInvocationCounter++; - - return retVal; + /* 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 SDLTest_RandomFloat() { - return (float) (FLT_MIN + SDLTest_RandomUnitDouble() * (FLT_MAX - FLT_MIN)); + return (float) (SDLTest_RandomUnitDouble() * (double)2.0 * (double)FLT_MAX - (double)(FLT_MAX)); } 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() { - // note: fuzzerInvocationCounter is increment in the RandomAsciiStringWithMaximumLenght - return SDLTest_RandomAsciiStringWithMaximumLength(255); + return SDLTest_RandomAsciiStringWithMaximumLength(255); } char * -SDLTest_RandomAsciiStringWithMaximumLength(int maxSize) +SDLTest_RandomAsciiStringWithMaximumLength(int maxLength) { - int size; - char *string; - int counter; + int size; - fuzzerInvocationCounter++; + if(maxLength < 1) { + SDL_InvalidParamError("maxLength"); + return NULL; + } - if(maxSize < 1) { - return NULL; - } + size = (SDLTest_RandomUint32() % (maxLength + 1)); - size = (SDLTest_RandomUint32() % (maxSize + 1)) + 1; - string = (char *)SDL_malloc(size * sizeof(char)); - if (string==NULL) { - return NULL; + return SDLTest_RandomAsciiStringOfSize(size); +} + +char * +SDLTest_RandomAsciiStringOfSize(int size) +{ + char *string; + int counter; + + + if(size < 1) { + SDL_InvalidParamError("size"); + 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(1, 127); - } + for(counter = 0; counter < size; ++counter) { + string[counter] = (char)SDLTest_RandomIntegerInRange(32, 126); + } - string[counter] = '\0'; + string[counter] = '\0'; - return string; + fuzzerInvocationCounter++; + + return string; } diff --git a/src/eepp/helper/SDL2/src/test/SDL_test_harness.c b/src/eepp/helper/SDL2/src/test/SDL_test_harness.c index 15b721f86..291874566 100644 --- a/src/eepp/helper/SDL2/src/test/SDL_test_harness.c +++ b/src/eepp/helper/SDL2/src/test/SDL_test_harness.c @@ -1,22 +1,22 @@ /* - Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga +Simple DirectMedia Layer +Copyright (C) 1997-2013 Sam Lantinga - 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. +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: +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 - appreciated but is not required. - 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. +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 +appreciated but is not required. +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. */ #include "SDL_config.h" @@ -28,427 +28,608 @@ #include #include -/* Assert check message format */ -const char *SDLTest_TestCheckFmt = "Test '%s': %s"; - /* Invalid test name/description message format */ -const char *SDLTest_InvalidNameFmt = "(Invalid)"; +const char *SDLTest_InvalidNameFormat = "(Invalid)"; + +/* Log summary message format */ +const char *SDLTest_LogSummaryFormat = "%s Summary: Total=%d Passed=%d Failed=%d Skipped=%d"; + +/* Final result message format */ +const char *SDLTest_FinalResultFormat = ">>> %s '%s': %s\n"; /*! \brief Timeout for single test case execution */ static Uint32 SDLTest_TestCaseTimeout = 3600; /** - * Generates a random run seed string for the harness. The generated seed - * will contain alphanumeric characters (0-9A-Z). - * - * Note: The returned string needs to be deallocated by the caller. - * - * \param length The length of the seed string to generate - * - * \returns The generated seed string - */ +* Generates a random run seed string for the harness. The generated seed +* will contain alphanumeric characters (0-9A-Z). +* +* Note: The returned string needs to be deallocated by the caller. +* +* \param length The length of the seed string to generate +* +* \returns The generated seed string +*/ char * SDLTest_GenerateRunSeed(const int length) { - char *seed = NULL; - SDLTest_RandomContext randomContext; - int counter; + 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; - } + /* 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; - } + /* 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'; + /* 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; + 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 - * - * \returns The generated execution key to initialize the fuzzer with. - * - */ +* 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 +* +* \returns The generated execution key to initialize the fuzzer with. +* +*/ 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; + SDLTest_Md5Context md5Context; + Uint64 *keys; + char iterationString[16]; + Uint32 runSeedLength; + Uint32 suiteNameLength; + Uint32 testNameLength; + Uint32 iterationStringLength; + Uint32 entireStringLength; + char *buffer; - if (runSeed == NULL || strlen(runSeed)==0) { - SDLTest_LogError("Invalid runSeed string."); - return -1; - } + if (runSeed == NULL || SDL_strlen(runSeed)==0) { + SDLTest_LogError("Invalid runSeed string."); + return -1; + } - if (suiteName == NULL || strlen(suiteName)==0) { - SDLTest_LogError("Invalid suiteName string."); - return -1; - } + if (suiteName == NULL || SDL_strlen(suiteName)==0) { + SDLTest_LogError("Invalid suiteName string."); + return -1; + } - if (testName == NULL || strlen(testName)==0) { - SDLTest_LogError("Invalid testName 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; - } + if (iteration <= 0) { + SDLTest_LogError("Invalid iteration count."); + return -1; + } - // Convert iteration number into a string - memset(iterationString, 0, sizeof(iterationString)); - SDL_snprintf(iterationString, sizeof(iterationString) - 1, "%d", iteration); + /* 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 = strlen(runSeed); - suiteNameLength = strlen(suiteName); - testNameLength = strlen(testName); - iterationStringLength = 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); + /* 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; + /* 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]; + return keys[0]; } /** - * \brief Set timeout handler for test. - * - * Note: SDL_Init(SDL_INIT_TIMER) will be called if it wasn't done so before. - * - * \param timeout Timeout interval in seconds. - * \param callback Function that will be called after timeout has elapsed. - * - * \return Timer id or -1 on failure. - */ +* \brief Set timeout handler for test. +* +* Note: SDL_Init(SDL_INIT_TIMER) will be called if it wasn't done so before. +* +* \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; + Uint32 timeoutInMilliseconds; + SDL_TimerID timerID; - if (callback == NULL) { - SDLTest_LogError("Timeout callback can't be NULL"); - return -1; - } + 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; - } + 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; - } - } + /* 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; - } + /* 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; -} - -void -SDLTest_BailOut() -{ - SDLTest_LogError("TestCaseTimeout timer expired. Aborting test run."); - exit(TEST_ABORTED); // bail out from the test + return timerID; } /** - * \brief Execute a test using the given execution key. - * - * \param testSuite Suite containing the test case. - * \param testCase Case to execute. - * \param execKey Execution key for the fuzzer. - * - * \returns Test case result. - */ +* \brief Timeout handler. Aborts test run and exits harness process. +*/ +void + SDLTest_BailOut() +{ + SDLTest_LogError("TestCaseTimeout timer expired. Aborting test run."); + exit(TEST_ABORTED); /* bail out from the test */ +} + +/** +* \brief Execute a test using the given execution key. +* +* \param testSuite Suite containing the test case. +* \param testCase Case to execute. +* \param execKey Execution key for the fuzzer. +* +* \returns Test case result. +*/ int SDLTest_RunTest(SDLTest_TestSuiteReference *testSuite, SDLTest_TestCaseReference *testCase, Uint64 execKey) { - SDL_TimerID timer = 0; - int testResult = 0; + 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 (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_TestCheckFmt, testCase->name, "Skipped"); - return TEST_RESULT_SKIPPED; - } + 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(); + /* Initialize fuzzer */ + SDLTest_FuzzerInit(execKey); - // Set timeout timer - timer = SDLTest_SetTestTimeout(SDLTest_TestCaseTimeout, SDLTest_BailOut); + /* Reset assert tracker */ + SDLTest_ResetAssertSummary(); - // Maybe run suite initalizer function - if (testSuite->testSetUp) { - testSuite->testSetUp(0x0); - if (SDLTest_AssertSummaryToTestResult() == TEST_RESULT_FAILED) { - SDLTest_LogError((char *)SDLTest_TestCheckFmt, testSuite->name, "Failed"); - return TEST_RESULT_SETUP_FAILURE; - } - } + /* Set timeout timer */ + timer = SDLTest_SetTestTimeout(SDLTest_TestCaseTimeout, SDLTest_BailOut); - // Run test case function - testCase->testCase(0x0); - testResult = SDLTest_AssertSummaryToTestResult(); + /* 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; + } + } - // Maybe run suite cleanup function (ignore failed asserts) - if (testSuite->testTearDown) { - testSuite->testTearDown(0x0); - } + /* Run test case function */ + testCaseResult = testCase->testCase(0x0); - // Cancel timeout timer - if (timer) { - SDL_RemoveTimer(timer); - } + /* 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(); + } - // Report on asserts and fuzzer usage - SDLTest_Log("Fuzzer invocations: %d", SDLTest_GetFuzzerInvocationCount()); - SDLTest_LogAssertSummary(); + /* Maybe run suite cleanup function (ignore failed asserts) */ + if (testSuite->testTearDown) { + testSuite->testTearDown(0x0); + } - // Analyze assert count to determine final test case result - switch (testResult) { - case TEST_RESULT_PASSED: - SDLTest_LogError((char *)SDLTest_TestCheckFmt, testCase->name, "Failed"); - case TEST_RESULT_FAILED: - SDLTest_Log((char *)SDLTest_TestCheckFmt, testCase->name, "Passed"); - case TEST_RESULT_NO_ASSERT: - SDLTest_LogError((char *)SDLTest_TestCheckFmt, testCase->name, "No Asserts"); - } + /* Cancel timeout timer */ + if (timer) { + SDL_RemoveTimer(timer); + } - return testResult; + /* 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; + 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_InvalidNameFmt); + /* 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_InvalidNameFmt, - (testCase->description) ? testCase->description : SDLTest_InvalidNameFmt); - } - } + /* 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; +} /** - * \brief Execute a test using the given execution key. - * - * \param testSuites Suites containing the test case. - * \param userRunSeed Custom run seed provided by user, or NULL to autogenerate one. - * \param userExecKey Custom execution key provided by user, or 0 to autogenerate one. - * \param testIterations Number of iterations to run each test case. - * - * \returns Test run result; 0 when all tests passed, 1 if any tests failed. - */ -int -SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites, char *userRunSeed, Uint64 userExecKey, int testIterations) +* \brief Execute a test suite using the given run seend and execution key. +* +* The filter string is matched to the suite name (full comparison) to select a single suite, +* or if no suite matches, it is matched to the test names (full comparison) to select a single test. +* +* \param testSuites Suites containing the test case. +* \param userRunSeed Custom run seed provided by user, or NULL to autogenerate one. +* \param userExecKey Custom execution key provided by user, or 0 to autogenerate one. +* \param filter Filter specification. NULL disables. Case sensitive. +* \param testIterations Number of iterations to run each test case. +* +* \returns Test run result; 0 when all tests passed, 1 if any tests failed. +*/ +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; - char *runSeed = NULL; - Uint64 execKey; - Uint32 runStartTicks; - time_t runStartTimestamp; - Uint32 suiteStartTicks; - time_t suiteStartTimestamp; - Uint32 testStartTicks; - time_t testStartTimestamp; - Uint32 runEndTicks; - time_t runEndTimestamp; - Uint32 suiteEndTicks; - time_t suiteEndTimestamp; - Uint32 testEndTicks; - time_t testEndTimestamp; - int testResult; - int totalTestFailedCount, totalTestPassedCount, totalTestSkippedCount; - int testFailedCount, testPassedCount, testSkippedCount; + 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; - } + /* Sanitize test iterations */ + if (testIterations < 1) { + testIterations = 1; + } - // Generate run see if we don't have one already - if (userRunSeed == NULL || strlen(userRunSeed) == 0) { - runSeed = SDLTest_GenerateRunSeed(16); - if (runSeed == NULL) { - SDLTest_LogError("Generating a random run seed failed"); - return 2; - } - } + /* 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 = totalTestPassedCount = totalTestSkippedCount = 0; - // Take time - run start - runStartTicks = SDL_GetTicks(); - runStartTimestamp = time(0); + /* Reset per-run counters */ + totalTestFailedCount = 0; + totalTestPassedCount = 0; + totalTestSkippedCount = 0; - // TODO log run started + /* Take time - run start */ + runStartSeconds = GetClock(); - // Loop over all suites - suiteCounter = 0; - while(&testSuites[suiteCounter]) { - testSuite=&testSuites[suiteCounter]; - suiteCounter++; + /* Log run with fuzzer parameters */ + SDLTest_Log("::::: Test Run /w seed '%s' started\n", runSeed); - // Reset per-suite counters - testFailedCount = testPassedCount = testSkippedCount = 0; + /* 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; + } - // Take time - suite start - suiteStartTicks = SDL_GetTicks(); - suiteStartTimestamp = time(0); + /* 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; + } + } + } - // TODO log suite started - SDLTest_Log("Test Suite %i - %s\n", suiteCounter, - (testSuite->name) ? testSuite->name : SDLTest_InvalidNameFmt); + 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 test cases - testCounter = 0; - while(testSuite->testCases[testCounter]) - { - testCase=(SDLTest_TestCaseReference *)testSuite->testCases[testCounter]; - testCounter++; - - // Take time - test start - testStartTicks = SDL_GetTicks(); - testStartTimestamp = time(0); + /* Loop over all suites */ + suiteCounter = 0; + while(testSuites[suiteCounter]) { + testSuite=(SDLTest_TestSuiteReference *)testSuites[suiteCounter]; + currentSuiteName = (char *)((testSuite->name) ? testSuite->name : SDLTest_InvalidNameFormat); + suiteCounter++; - // TODO log test started - SDLTest_Log("Test Case %i - %s: %s", testCounter, - (testCase->name) ? testCase->name : SDLTest_InvalidNameFmt, - (testCase->description) ? testCase->description : SDLTest_InvalidNameFmt); + /* 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 { - // Loop over all iterations - iterationCounter = 0; - while(iterationCounter < testIterations) - { - iterationCounter++; + /* Reset per-suite counters */ + testFailedCount = 0; + testPassedCount = 0; + testSkippedCount = 0; - if(userExecKey != 0) { - execKey = userExecKey; - } else { - execKey = SDLTest_GenerateExecKey(runSeed, testSuite->name, testCase->name, iterationCounter); - } + /* Take time - suite start */ + suiteStartSeconds = GetClock(); - SDLTest_Log("Test Iteration %i: execKey %d", iterationCounter, execKey); - testResult = SDLTest_RunTest(testSuite, testCase, execKey); + /* Log suite started */ + SDLTest_Log("===== Test Suite %i: '%s' started\n", + suiteCounter, + currentSuiteName); - if (testResult == TEST_RESULT_PASSED) { - testPassedCount++; - totalTestPassedCount++; - } else if (testResult == TEST_RESULT_SKIPPED) { - testSkippedCount++; - totalTestSkippedCount++; - } else { - testFailedCount++; - totalTestFailedCount++; - } - } + /* 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++; - // Take time - test end - testEndTicks = SDL_GetTicks(); - testEndTimestamp = time(0); + /* 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; + } - // TODO log test ended - } + /* Take time - test start */ + testStartSeconds = GetClock(); - // Take time - suite end - suiteEndTicks = SDL_GetTicks(); - suiteEndTimestamp = time(0); + /* 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); + } - // TODO log suite ended - } + /* Loop over all iterations */ + iterationCounter = 0; + while(iterationCounter < testIterations) + { + iterationCounter++; - // Take time - run end - runEndTicks = SDL_GetTicks(); - runEndTimestamp = time(0); + if (userExecKey != 0) { + execKey = userExecKey; + } else { + execKey = SDLTest_GenerateExecKey((char *)runSeed, testSuite->name, testCase->name, iterationCounter); + } - // TODO log run ended + SDLTest_Log("Test Iteration %i: execKey %llu", iterationCounter, execKey); + testResult = SDLTest_RunTest(testSuite, testCase, execKey); - return (totalTestFailedCount ? 1 : 0); + 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/eepp/helper/SDL2/src/test/SDL_test_imageBlit.c b/src/eepp/helper/SDL2/src/test/SDL_test_imageBlit.c new file mode 100644 index 000000000..d1d12952c --- /dev/null +++ b/src/eepp/helper/SDL2/src/test/SDL_test_imageBlit.c @@ -0,0 +1,1557 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2013 Sam Lantinga + + 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 + appreciated but is not required. + 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. +*/ +#include "SDL_config.h" + +#include "SDL_test.h" + +/* GIMP RGB C-Source image dump (blit.c) */ + +const SDLTest_SurfaceImage_t SDLTest_imageBlit = { + 80, 60, 3, + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377" + "\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0" + "\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377" + "\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377" + "\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0" + "\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0" + "\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0" + "\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0" + "\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0" + "\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0" + "\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0" + "\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\0\377\377" + "\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377" + "\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377" + "\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377" + "\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377" + "\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377" + "\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\377\377\0\377\377\0\377\377\0\377\377\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0" + "\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0" + "\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377" + "\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377" + "\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0" + "\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\0\0\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\0\377\377" + "\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377" + "\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377" + "\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377" + "\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377" + "\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377" + "\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377" + "\0\0\0\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0" + "\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0" + "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0" + "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0" + "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0" + "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0" + "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0" + "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\0" + "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\377\377\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0" + "\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0" + "\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377" + "\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377" + "\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0" + "\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\0\0\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\0\377\377" + "\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377" + "\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377" + "\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377" + "\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377" + "\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377" + "\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377" + "\0\0\0\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0" + "\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0" + "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0" + "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0" + "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0" + "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0" + "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0" + "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\0" + "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\377\377\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0" + "\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0" + "\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377" + "\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377" + "\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0" + "\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\0\0\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\0\377\377" + "\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377" + "\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377" + "\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377" + "\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377" + "\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377" + "\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377" + "\0\0\0\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0" + "\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0" + "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0" + "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0" + "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0" + "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0" + "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0" + "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\0" + "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\377\377\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0" + "\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0" + "\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377" + "\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377" + "\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0" + "\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\0\0\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\0\377\377" + "\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377" + "\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377" + "\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377" + "\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377" + "\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377" + "\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377" + "\0\0\0\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0" + "\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0" + "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0" + "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0" + "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0" + "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0" + "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0" + "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\0" + "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\377\377\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0" + "\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0" + "\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377" + "\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377" + "\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0" + "\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\0\0\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\0\377\377" + "\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377" + "\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377" + "\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377" + "\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377" + "\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377" + "\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377" + "\0\0\0\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0" + "\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0" + "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0" + "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0" + "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0" + "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0" + "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0" + "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\0" + "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\377\377\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0" + "\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0" + "\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377" + "\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377" + "\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0" + "\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\0\0\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\0\377\377" + "\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377" + "\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377" + "\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377" + "\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377" + "\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377" + "\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377" + "\0\0\0\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0" + "\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0" + "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0" + "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0" + "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0" + "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0" + "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0" + "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\0" + "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\377\377\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0" + "\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0" + "\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377" + "\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377" + "\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0" + "\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\0\0\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\0\377\377" + "\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377" + "\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377" + "\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377" + "\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377" + "\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377" + "\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377" + "\0\0\0\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0" + "\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0" + "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0" + "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0" + "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0" + "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0" + "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0" + "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\0" + "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0" + "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0" + "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0" + "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0" + "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0" + "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0" + "\0\0\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\0\0\0\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\0\377\377\0\377\377\0" + "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0" + "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0" + "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0" + "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0" + "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0" + "\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377" + "\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377" + "\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377" + "\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377" + "\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377" + "\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377" + "\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\0\377\377" + "\0\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377" + "\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377" + "\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377" + "\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377" + "\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377" + "\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377" + "\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0\377\377\0\0\0\0\0\0\0\377" + "\377\0\0\0\0\377\377\0\377\377\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377" + "\0\0\0\0\377\377\0\377\377\0\377\377\0\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\0\377\377\0\377" + "\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377" + "\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377" + "\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377" + "\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377" + "\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377" + "\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\0\377\377\0\377\377\0\377\377\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377" + "\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377" + "\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377" + "\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377" + "\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377" + "\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377" + "\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\0\377\377\0\377" + "\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377" + "\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377" + "\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377" + "\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377" + "\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377" + "\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377" + "\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377" + "\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377" + "\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377" + "\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377" + "\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377" + "\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0" + "\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0" + "\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0" + "\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0" + "\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0" + "\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\0\377\377\0\377" + "\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377" + "\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377" + "\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377" + "\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377" + "\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377" + "\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0" + "\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0" + "\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0" + "\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0" + "\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0" + "\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0" + "\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0" + "\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377" + "\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377" + "\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0" + "\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377" + "\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\0\0\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\0\0\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\0\377\377" + "\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0" + "\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377" + "\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377" + "\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0" + "\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0" + "\0\377\377\0\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377" + "\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377" + "\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0" + "\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377" + "\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377" + "\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0" + "\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0" + "\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0" + "\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0" + "\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0" + "\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\0\377\377\0" + "\377\377\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\377\377\0\377\377\0\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377" + "\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0" + "\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0" + "\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377" + "\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377" + "\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0", +}; + +/** + * \brief Returns the Blit test image as SDL_Surface. + */ +SDL_Surface *SDLTest_ImageBlit() +{ + 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.bytes_per_pixel, +#if (SDL_BYTEORDER == SDL_BIG_ENDIAN) + 0xff000000, /* Red bit mask. */ + 0x00ff0000, /* Green bit mask. */ + 0x0000ff00, /* Blue bit mask. */ + 0x000000ff /* Alpha bit mask. */ +#else + 0x000000ff, /* Red bit mask. */ + 0x0000ff00, /* Green bit mask. */ + 0x00ff0000, /* Blue bit mask. */ + 0xff000000 /* Alpha bit mask. */ +#endif + ); + return surface; +} + +const SDLTest_SurfaceImage_t SDLTest_imageBlitColor = { + 80, 60, 3, + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\24\0\0\24\0\0\0\0\0\0" + "\0\0(\0\0(\0\0\0\0\0\0\0\0<\0\0<\0\0\0\0\0\0\0\0P\0\0P\0\0\0\0\0\0\0\0d\0" + "\0d\0\0\0\0\0\0\0\0x\0\0x\0\0\0\0\0\0\0\0\214\0\0\214\0\0\0\0\0\0\0\0\240" + "\0\0\240\0\0\0\0\0\0\0\0\264\0\0\264\0\0\0\0\0\0\0\0\310\0\0\310\0\0\0\0" + "\0\0\0\0\334\0\0\334\0\0\0\0\0\0\0\0\360\0\0\360\0\0\360\0\0\360\0\0\360" + "\0\0\360\0\0\360\0\0\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\24\0\0\24\0\0\24\0\0\0\0\0(\0\0" + "(\0\0(\0\0\0\0\0<\0\0<\0\0<\0\0\0\0\0P\0\0P\0\0P\0\0\0\0\0d\0\0d\0\0d\0\0" + "\0\0\0x\0\0x\0\0x\0\0\0\0\0\214\0\0\214\0\0\214\0\0\0\0\0\240\0\0\240\0\0" + "\240\0\0\0\0\0\264\0\0\264\0\0\264\0\0\0\0\0\310\0\0\310\0\0\310\0\0\0\0" + "\0\334\0\0\334\0\0\334\0\0\0\0\0\360\0\0\360\0\0\360\0\0\360\0\0\360\0\0" + "\360\0\0\360\0\0\360\0\0\360\0\0\360\0\0\360\0\0\360\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\24\0\0\24\0\0\24\0\0\0" + "\0\0(\0\0(\0\0(\0\0\0\0\0<\0\0<\0\0<\0\0\0\0\0P\0\0P\0\0P\0\0\0\0\0d\0\0" + "d\0\0d\0\0\0\0\0x\0\0x\0\0x\0\0\0\0\0\214\0\0\214\0\0\214\0\0\0\0\0\240\0" + "\0\240\0\0\240\0\0\0\0\0\264\0\0\264\0\0\264\0\0\0\0\0\310\0\0\310\0\0\310" + "\0\0\0\0\0\334\0\0\334\0\0\334\0\0\0\0\0\360\0\0\360\0\0\360\0\0\360\0\0" + "\360\0\0\360\0\0\360\0\0\360\0\0\360\0\0\360\0\0\360\0\0\360\0\0\360\0\0" + "\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\360\0\0\360\0\0\360\0\0\360\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0$\0\0$\0\0\0\0\0\0\0\0$\24\0" + "$\24\0\0\0\0\0\0\0$(\0$(\0\0\0\0\0\0\0$<\0$<\0\0\0\0\0\0\0$P\0$P\0\0\0\0" + "\0\0\0$d\0$d\0\0\0\0\0\0\0$x\0$x\0\0\0\0\0\0\0$\214\0$\214\0\0\0\0\0\0\0" + "$\240\0$\240\0\0\0\0\0\0\0$\264\0$\264\0\0\0\0\0\0\0$\310\0$\310\0\0\0\0" + "\0\0\0$\334\0$\334\0\0\0\0\0\0\0$\360\0$\360\0$\360\0$\360\0$\360\0$\360" + "\0$\360\0$\360\0\0\0\0\0\0\0\0\360\0\0\360\0\0\360\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0$\0\0$\0\0$\0\0\0\0\0$\24\0$\24\0$\24\0\0\0\0$(\0$(\0$(\0\0\0\0" + "$<\0$<\0$<\0\0\0\0$P\0$P\0$P\0\0\0\0$d\0$d\0$d\0\0\0\0$x\0$x\0$x\0\0\0\0" + "$\214\0$\214\0$\214\0\0\0\0$\240\0$\240\0$\240\0\0\0\0$\264\0$\264\0$\264" + "\0\0\0\0$\310\0$\310\0$\310\0\0\0\0$\334\0$\334\0$\334\0\0\0\0$\360\0$\360" + "\0$\360\0$\360\0$\360\0$\360\0$\360\0$\360\0$\360\0$\360\0$\360\0$\360\0" + "\0\0\0\0\360\0\0\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0$\0\0$\0\0$\0\0\0\0\0$\24\0" + "$\24\0$\24\0\0\0\0$(\0$(\0$(\0\0\0\0$<\0$<\0$<\0\0\0\0$P\0$P\0$P\0\0\0\0" + "$d\0$d\0$d\0\0\0\0$x\0$x\0$x\0\0\0\0$\214\0$\214\0$\214\0\0\0\0$\240\0$\240" + "\0$\240\0\0\0\0$\264\0$\264\0$\264\0\0\0\0$\310\0$\310\0$\310\0\0\0\0$\334" + "\0$\334\0$\334\0\0\0\0$\360\0$\360\0$\360\0$\360\0$\360\0$\360\0$\360\0$" + "\360\0$\360\0$\360\0$\360\0$\360\0$\360\0$\360\0\0\0\0\0\360\0\0\360\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0$\0\0$\0\0$\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0$\360\0$\360\0$\360\0$\360\0\0\0\0\0\360\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0$\0\0$\0\0$\0\0\0\0" + "\0\0\0\0H\0\0H\0\0\0\0\0\0\0\0H\24\0H\24\0\0\0\0\0\0\0H(\0H(\0\0\0\0\0\0" + "\0H<\0H<\0\0\0\0\0\0\0HP\0HP\0\0\0\0\0\0\0Hd\0Hd\0\0\0\0\0\0\0Hx\0Hx\0\0" + "\0\0\0\0\0H\214\0H\214\0\0\0\0\0\0\0H\240\0H\240\0\0\0\0\0\0\0H\264\0H\264" + "\0\0\0\0\0\0\0H\310\0H\310\0\0\0\0\0\0\0H\334\0H\334\0\0\0\0\0\0\0H\360\0" + "H\360\0H\360\0H\360\0H\360\0H\360\0H\360\0H\360\0\0\0\0\0\0\0$\360\0$\360" + "\0$\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0$\0\0$\0\0\0\0\0H\0\0H\0\0H\0\0\0\0\0H\24\0H\24\0H\24" + "\0\0\0\0H(\0H(\0H(\0\0\0\0H<\0H<\0H<\0\0\0\0HP\0HP\0HP\0\0\0\0Hd\0Hd\0Hd" + "\0\0\0\0Hx\0Hx\0Hx\0\0\0\0H\214\0H\214\0H\214\0\0\0\0H\240\0H\240\0H\240" + "\0\0\0\0H\264\0H\264\0H\264\0\0\0\0H\310\0H\310\0H\310\0\0\0\0H\334\0H\334" + "\0H\334\0\0\0\0H\360\0H\360\0H\360\0H\360\0H\360\0H\360\0H\360\0H\360\0H" + "\360\0H\360\0H\360\0H\360\0\0\0\0$\360\0$\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0$\0\0$\0\0\0\0\0H\0\0" + "H\0\0H\0\0\0\0\0H\24\0H\24\0H\24\0\0\0\0H(\0H(\0H(\0\0\0\0H<\0H<\0H<\0\0" + "\0\0HP\0HP\0HP\0\0\0\0Hd\0Hd\0Hd\0\0\0\0Hx\0Hx\0Hx\0\0\0\0H\214\0H\214\0" + "H\214\0\0\0\0H\240\0H\240\0H\240\0\0\0\0H\264\0H\264\0H\264\0\0\0\0H\310" + "\0H\310\0H\310\0\0\0\0H\334\0H\334\0H\334\0\0\0\0H\360\0H\360\0H\360\0H\360" + "\0H\360\0H\360\0H\360\0H\360\0H\360\0H\360\0H\360\0H\360\0H\360\0H\360\0" + "\0\0\0$\360\0$\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0$\0\0\0\0\0H\0\0H\0\0H\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0H\360\0H\360\0H\360\0H\360\0\0\0\0$\360\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0H\0\0H\0\0H\0\0\0\0\0\0\0\0l\0\0l\0\0\0\0\0\0\0\0l\24\0l\24\0\0\0\0\0\0" + "\0l(\0l(\0\0\0\0\0\0\0l<\0l<\0\0\0\0\0\0\0lP\0lP\0\0\0\0\0\0\0ld\0ld\0\0" + "\0\0\0\0\0lx\0lx\0\0\0\0\0\0\0l\214\0l\214\0\0\0\0\0\0\0l\240\0l\240\0\0" + "\0\0\0\0\0l\264\0l\264\0\0\0\0\0\0\0l\310\0l\310\0\0\0\0\0\0\0l\334\0l\334" + "\0\0\0\0\0\0\0l\360\0l\360\0l\360\0l\360\0l\360\0l\360\0l\360\0l\360\0\0" + "\0\0\0\0\0H\360\0H\360\0H\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0H\0\0H\0\0\0\0\0l\0\0l\0\0l\0\0" + "\0\0\0l\24\0l\24\0l\24\0\0\0\0l(\0l(\0l(\0\0\0\0l<\0l<\0l<\0\0\0\0lP\0lP" + "\0lP\0\0\0\0ld\0ld\0ld\0\0\0\0lx\0lx\0lx\0\0\0\0l\214\0l\214\0l\214\0\0\0" + "\0l\240\0l\240\0l\240\0\0\0\0l\264\0l\264\0l\264\0\0\0\0l\310\0l\310\0l\310" + "\0\0\0\0l\334\0l\334\0l\334\0\0\0\0l\360\0l\360\0l\360\0l\360\0l\360\0l\360" + "\0l\360\0l\360\0l\360\0l\360\0l\360\0l\360\0\0\0\0H\360\0H\360\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0H\0" + "\0H\0\0\0\0\0l\0\0l\0\0l\0\0\0\0\0l\24\0l\24\0l\24\0\0\0\0l(\0l(\0l(\0\0" + "\0\0l<\0l<\0l<\0\0\0\0lP\0lP\0lP\0\0\0\0ld\0ld\0ld\0\0\0\0lx\0lx\0lx\0\0" + "\0\0l\214\0l\214\0l\214\0\0\0\0l\240\0l\240\0l\240\0\0\0\0l\264\0l\264\0" + "l\264\0\0\0\0l\310\0l\310\0l\310\0\0\0\0l\334\0l\334\0l\334\0\0\0\0l\360" + "\0l\360\0l\360\0l\360\0l\360\0l\360\0l\360\0l\360\0l\360\0l\360\0l\360\0" + "l\360\0l\360\0l\360\0\0\0\0H\360\0H\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0H\0\0\0\0\0l\0\0l\0\0l\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0l\360\0l\360\0l\360\0l\360" + "\0\0\0\0H\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0l\0\0l\0\0l\0\0\0\0\0\0\0\0\220\0\0\220\0\0\0\0\0\0\0" + "\0\220\24\0\220\24\0\0\0\0\0\0\0\220(\0\220(\0\0\0\0\0\0\0\220<\0\220<\0" + "\0\0\0\0\0\0\220P\0\220P\0\0\0\0\0\0\0\220d\0\220d\0\0\0\0\0\0\0\220x\0\220" + "x\0\0\0\0\0\0\0\220\214\0\220\214\0\0\0\0\0\0\0\220\240\0\220\240\0\0\0\0" + "\0\0\0\220\264\0\220\264\0\0\0\0\0\0\0\220\310\0\220\310\0\0\0\0\0\0\0\220" + "\334\0\220\334\0\0\0\0\0\0\0\220\360\0\220\360\0\220\360\0\220\360\0\220" + "\360\0\220\360\0\220\360\0\220\360\0\0\0\0\0\0\0l\360\0l\360\0l\360\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0l\0\0l\0\0\0\0\0\220\0\0\220\0\0\220\0\0\0\0\0\220\24\0\220\24\0" + "\220\24\0\0\0\0\220(\0\220(\0\220(\0\0\0\0\220<\0\220<\0\220<\0\0\0\0\220" + "P\0\220P\0\220P\0\0\0\0\220d\0\220d\0\220d\0\0\0\0\220x\0\220x\0\220x\0\0" + "\0\0\220\214\0\220\214\0\220\214\0\0\0\0\220\240\0\220\240\0\220\240\0\0" + "\0\0\220\264\0\220\264\0\220\264\0\0\0\0\220\310\0\220\310\0\220\310\0\0" + "\0\0\220\334\0\220\334\0\220\334\0\0\0\0\220\360\0\220\360\0\220\360\0\220" + "\360\0\220\360\0\220\360\0\220\360\0\220\360\0\220\360\0\220\360\0\220\360" + "\0\220\360\0\0\0\0l\360\0l\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0l\0\0l\0\0\0\0\0\220\0\0\220\0\0\220" + "\0\0\0\0\0\220\24\0\220\24\0\220\24\0\0\0\0\220(\0\220(\0\220(\0\0\0\0\220" + "<\0\220<\0\220<\0\0\0\0\220P\0\220P\0\220P\0\0\0\0\220d\0\220d\0\220d\0\0" + "\0\0\220x\0\220x\0\220x\0\0\0\0\220\214\0\220\214\0\220\214\0\0\0\0\220\240" + "\0\220\240\0\220\240\0\0\0\0\220\264\0\220\264\0\220\264\0\0\0\0\220\310" + "\0\220\310\0\220\310\0\0\0\0\220\334\0\220\334\0\220\334\0\0\0\0\220\360" + "\0\220\360\0\220\360\0\220\360\0\220\360\0\220\360\0\220\360\0\220\360\0" + "\220\360\0\220\360\0\220\360\0\220\360\0\220\360\0\220\360\0\0\0\0l\360\0" + "l\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0l\0\0\0\0\0\220\0\0\220\0\0\220\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\220\360\0\220\360\0\220\360\0\220\360\0\0\0\0l\360" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\220\0\0\220\0\0\220\0\0\0\0\0\0\0\0\264\0\0\264\0\0\0\0\0\0\0\0" + "\264\24\0\264\24\0\0\0\0\0\0\0\264(\0\264(\0\0\0\0\0\0\0\264<\0\264<\0\0" + "\0\0\0\0\0\264P\0\264P\0\0\0\0\0\0\0\264d\0\264d\0\0\0\0\0\0\0\264x\0\264" + "x\0\0\0\0\0\0\0\264\214\0\264\214\0\0\0\0\0\0\0\264\240\0\264\240\0\0\0\0" + "\0\0\0\264\264\0\264\264\0\0\0\0\0\0\0\264\310\0\264\310\0\0\0\0\0\0\0\264" + "\334\0\264\334\0\0\0\0\0\0\0\264\360\0\264\360\0\264\360\0\264\360\0\264" + "\360\0\264\360\0\264\360\0\264\360\0\0\0\0\0\0\0\220\360\0\220\360\0\220" + "\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\220\0\0\220\0\0\0\0\0\264\0\0\264\0\0\264\0\0\0\0\0\264" + "\24\0\264\24\0\264\24\0\0\0\0\264(\0\264(\0\264(\0\0\0\0\264<\0\264<\0\264" + "<\0\0\0\0\264P\0\264P\0\264P\0\0\0\0\264d\0\264d\0\264d\0\0\0\0\264x\0\264" + "x\0\264x\0\0\0\0\264\214\0\264\214\0\264\214\0\0\0\0\264\240\0\264\240\0" + "\264\240\0\0\0\0\264\264\0\264\264\0\264\264\0\0\0\0\264\310\0\264\310\0" + "\264\310\0\0\0\0\264\334\0\264\334\0\264\334\0\0\0\0\264\360\0\264\360\0" + "\264\360\0\264\360\0\264\360\0\264\360\0\264\360\0\264\360\0\264\360\0\264" + "\360\0\264\360\0\264\360\0\0\0\0\220\360\0\220\360\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\220\0\0\220\0" + "\0\0\0\0\264\0\0\264\0\0\264\0\0\0\0\0\264\24\0\264\24\0\264\24\0\0\0\0\264" + "(\0\264(\0\264(\0\0\0\0\264<\0\264<\0\264<\0\0\0\0\264P\0\264P\0\264P\0\0" + "\0\0\264d\0\264d\0\264d\0\0\0\0\264x\0\264x\0\264x\0\0\0\0\264\214\0\264" + "\214\0\264\214\0\0\0\0\264\240\0\264\240\0\264\240\0\0\0\0\264\264\0\264" + "\264\0\264\264\0\0\0\0\264\310\0\264\310\0\264\310\0\0\0\0\264\334\0\264" + "\334\0\264\334\0\0\0\0\264\360\0\264\360\0\264\360\0\264\360\0\264\360\0" + "\264\360\0\264\360\0\264\360\0\264\360\0\264\360\0\264\360\0\264\360\0\264" + "\360\0\264\360\0\0\0\0\220\360\0\220\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\220\0\0\0\0\0\264\0\0\264\0\0" + "\264\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\264\360\0" + "\264\360\0\264\360\0\264\360\0\0\0\0\220\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\264\0\0\264\0\0\264" + "\0\0\0\0\0\0\0\0\330\0\0\330\0\0\0\0\0\0\0\0\330\24\0\330\24\0\0\0\0\0\0" + "\0\330(\0\330(\0\0\0\0\0\0\0\330<\0\330<\0\0\0\0\0\0\0\330P\0\330P\0\0\0" + "\0\0\0\0\330d\0\330d\0\0\0\0\0\0\0\330x\0\330x\0\0\0\0\0\0\0\330\214\0\330" + "\214\0\0\0\0\0\0\0\330\240\0\330\240\0\0\0\0\0\0\0\330\264\0\330\264\0\0" + "\0\0\0\0\0\330\310\0\330\310\0\0\0\0\0\0\0\330\334\0\330\334\0\0\0\0\0\0" + "\0\330\360\0\330\360\0\330\360\0\330\360\0\330\360\0\330\360\0\330\360\0" + "\330\360\0\0\0\0\0\0\0\264\360\0\264\360\0\264\360\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\264\0\0" + "\264\0\0\0\0\0\330\0\0\330\0\0\330\0\0\0\0\0\330\24\0\330\24\0\330\24\0\0" + "\0\0\330(\0\330(\0\330(\0\0\0\0\330<\0\330<\0\330<\0\0\0\0\330P\0\330P\0" + "\330P\0\0\0\0\330d\0\330d\0\330d\0\0\0\0\330x\0\330x\0\330x\0\0\0\0\330\214" + "\0\330\214\0\330\214\0\0\0\0\330\240\0\330\240\0\330\240\0\0\0\0\330\264" + "\0\330\264\0\330\264\0\0\0\0\330\310\0\330\310\0\330\310\0\0\0\0\330\334" + "\0\330\334\0\330\334\0\0\0\0\330\360\0\330\360\0\330\360\0\330\360\0\330" + "\360\0\330\360\0\330\360\0\330\360\0\330\360\0\330\360\0\330\360\0\330\360" + "\0\0\0\0\264\360\0\264\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\264\0\0\264\0\0\0\0\0\330\0\0\330\0\0" + "\330\0\0\0\0\0\330\24\0\330\24\0\330\24\0\0\0\0\330(\0\330(\0\330(\0\0\0" + "\0\330<\0\330<\0\330<\0\0\0\0\330P\0\330P\0\330P\0\0\0\0\330d\0\330d\0\330" + "d\0\0\0\0\330x\0\330x\0\330x\0\0\0\0\330\214\0\330\214\0\330\214\0\0\0\0" + "\330\240\0\330\240\0\330\240\0\0\0\0\330\264\0\330\264\0\330\264\0\0\0\0" + "\330\310\0\330\310\0\330\310\0\0\0\0\330\334\0\330\334\0\330\334\0\0\0\0" + "\330\360\0\330\360\0\330\360\0\330\360\0\330\360\0\330\360\0\330\360\0\330" + "\360\0\330\360\0\330\360\0\330\360\0\330\360\0\330\360\0\330\360\0\0\0\0" + "\264\360\0\264\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\264\0\0\0\0\0\330\0\0\330\0\0\330\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\330\360\0\330\360\0\330\360\0\330" + "\360\0\0\0\0\264\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\330\0\0\330\0\0\330\0\0\0\0\0\0\0\0\374\0\0" + "\374\0\0\0\0\0\0\0\0\374\24\0\374\24\0\0\0\0\0\0\0\374(\0\374(\0\0\0\0\0" + "\0\0\374<\0\374<\0\0\0\0\0\0\0\374P\0\374P\0\0\0\0\0\0\0\374d\0\374d\0\0" + "\0\0\0\0\0\374x\0\374x\0\0\0\0\0\0\0\374\214\0\374\214\0\0\0\0\0\0\0\374" + "\240\0\374\240\0\0\0\0\0\0\0\374\264\0\374\264\0\0\0\0\0\0\0\374\310\0\374" + "\310\0\0\0\0\0\0\0\374\334\0\374\334\0\0\0\0\0\0\0\374\360\0\374\360\0\374" + "\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\0\0\0\0\0\0\330" + "\360\0\330\360\0\330\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\330\0\0\330\0\0\0\0\0\374\0\0\374" + "\0\0\374\0\0\0\0\0\374\24\0\374\24\0\374\24\0\0\0\0\374(\0\374(\0\374(\0" + "\0\0\0\374<\0\374<\0\374<\0\0\0\0\374P\0\374P\0\374P\0\0\0\0\374d\0\374d" + "\0\374d\0\0\0\0\374x\0\374x\0\374x\0\0\0\0\374\214\0\374\214\0\374\214\0" + "\0\0\0\374\240\0\374\240\0\374\240\0\0\0\0\374\264\0\374\264\0\374\264\0" + "\0\0\0\374\310\0\374\310\0\374\310\0\0\0\0\374\334\0\374\334\0\374\334\0" + "\0\0\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360" + "\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\0\0\0\330\360\0\330" + "\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\330\0\0\330\0\0\0\0\0\374\0\0\374\0\0\374\0\0\0\0\0\374\24\0" + "\374\24\0\374\24\0\0\0\0\374(\0\374(\0\374(\0\0\0\0\374<\0\374<\0\374<\0" + "\0\0\0\374P\0\374P\0\374P\0\0\0\0\374d\0\374d\0\374d\0\0\0\0\374x\0\374x" + "\0\374x\0\0\0\0\374\214\0\374\214\0\374\214\0\0\0\0\374\240\0\374\240\0\374" + "\240\0\0\0\0\374\264\0\374\264\0\374\264\0\0\0\0\374\310\0\374\310\0\374" + "\310\0\0\0\0\374\334\0\374\334\0\374\334\0\0\0\0\374\360\0\374\360\0\374" + "\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360" + "\0\374\360\0\374\360\0\374\360\0\374\360\0\0\0\0\330\360\0\330\360\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\330" + "\0\0\0\0\0\374\0\0\374\0\0\374\0\0\0\0\0\374\24\0\374\24\0\374\24\0\0\0\0" + "\374(\0\374(\0\374(\0\0\0\0\374<\0\374<\0\374<\0\0\0\0\374P\0\374P\0\374" + "P\0\0\0\0\374d\0\374d\0\374d\0\0\0\0\374x\0\374x\0\374x\0\0\0\0\374\214\0" + "\374\214\0\374\214\0\0\0\0\374\240\0\374\240\0\374\240\0\0\0\0\374\264\0" + "\374\264\0\374\264\0\0\0\0\374\310\0\374\310\0\374\310\0\0\0\0\374\334\0" + "\374\334\0\374\334\0\0\0\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360" + "\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0" + "\374\360\0\374\360\0\374\360\0\374\360\0\0\0\0\330\360\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\374\0\0\374" + "\0\0\374\0\0\0\0\0\374\24\0\374\24\0\374\24\0\0\0\0\374(\0\374(\0\374(\0" + "\0\0\0\374<\0\374<\0\374<\0\0\0\0\374P\0\374P\0\374P\0\0\0\0\374d\0\374d" + "\0\374d\0\0\0\0\374x\0\374x\0\374x\0\0\0\0\374\214\0\374\214\0\374\214\0" + "\0\0\0\374\240\0\374\240\0\374\240\0\0\0\0\374\264\0\374\264\0\374\264\0" + "\0\0\0\374\310\0\374\310\0\374\310\0\0\0\0\374\334\0\374\334\0\374\334\0" + "\0\0\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360" + "\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0" + "\374\360\0\374\360\0\374\360\0\374\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\374\0\0\374\0\0\374" + "\0\0\0\0\0\374\24\0\374\24\0\374\24\0\0\0\0\374(\0\374(\0\374(\0\0\0\0\374" + "<\0\374<\0\374<\0\0\0\0\374P\0\374P\0\374P\0\0\0\0\374d\0\374d\0\374d\0\0" + "\0\0\374x\0\374x\0\374x\0\0\0\0\374\214\0\374\214\0\374\214\0\0\0\0\374\240" + "\0\374\240\0\374\240\0\0\0\0\374\264\0\374\264\0\374\264\0\0\0\0\374\310" + "\0\374\310\0\374\310\0\0\0\0\374\334\0\374\334\0\374\334\0\0\0\0\374\360" + "\0\374\360\0\374\360\0\0\0\0\0\0\0\0\0\0\0\0\0\374\360\0\374\360\0\374\360" + "\0\374\360\0\0\0\0\0\0\0\0\0\0\0\0\0\374\360\0\374\360\0\374\360\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\374\0\0\374\0\0\374\0\0\0\0\0\374\24\0\374\24\0\374\24\0\0\0\0\374(\0\374" + "(\0\374(\0\0\0\0\374<\0\374<\0\374<\0\0\0\0\374P\0\374P\0\374P\0\0\0\0\374" + "d\0\374d\0\374d\0\0\0\0\374x\0\374x\0\374x\0\0\0\0\374\214\0\374\214\0\374" + "\214\0\0\0\0\374\240\0\374\240\0\374\240\0\0\0\0\374\264\0\374\264\0\374" + "\264\0\0\0\0\374\310\0\374\310\0\374\310\0\0\0\0\374\334\0\374\334\0\374" + "\334\0\0\0\0\374\360\0\374\360\0\374\360\0\374\360\0\0\0\0\0\0\0\374\334" + "\0\0\0\0\374\360\0\374\360\0\374\360\0\374\360\0\0\0\0\0\0\0\374\334\0\0" + "\0\0\374\360\0\374\360\0\374\360\0\374\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\374\0\0\374\0\0\374\0\0\0\0" + "\0\374\24\0\374\24\0\374\24\0\0\0\0\374(\0\374(\0\374(\0\0\0\0\374<\0\374" + "<\0\374<\0\0\0\0\374P\0\374P\0\374P\0\0\0\0\374d\0\374d\0\374d\0\0\0\0\374" + "x\0\374x\0\374x\0\0\0\0\374\214\0\374\214\0\374\214\0\0\0\0\374\240\0\374" + "\240\0\374\240\0\0\0\0\374\264\0\374\264\0\374\264\0\0\0\0\374\310\0\374" + "\310\0\374\310\0\0\0\0\374\334\0\374\334\0\374\334\0\0\0\0\374\360\0\374" + "\360\0\374\360\0\374\360\0\0\0\0\0\0\0\0\0\0\0\0\0\374\360\0\374\360\0\374" + "\360\0\374\360\0\0\0\0\0\0\0\0\0\0\0\0\0\374\360\0\374\360\0\374\360\0\374" + "\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\374\0\0\374\0\0\374\0\0\0\0\0\374\24\0\374\24\0\374\24\0\0\0\0\374" + "(\0\374(\0\374(\0\0\0\0\374<\0\374<\0\374<\0\0\0\0\374P\0\374P\0\374P\0\0" + "\0\0\374d\0\374d\0\374d\0\0\0\0\374x\0\374x\0\374x\0\0\0\0\374\214\0\374" + "\214\0\374\214\0\0\0\0\374\240\0\374\240\0\374\240\0\0\0\0\374\264\0\374" + "\264\0\374\264\0\0\0\0\374\310\0\374\310\0\374\310\0\0\0\0\374\334\0\374" + "\334\0\374\334\0\0\0\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0" + "\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374" + "\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\374\0\0\374\0\0\374\0\0\0\0\0\374\24\0\374\24\0\374\24\0\0\0\0\374(\0" + "\374(\0\374(\0\0\0\0\374<\0\374<\0\374<\0\0\0\0\374P\0\374P\0\374P\0\0\0" + "\0\374d\0\374d\0\374d\0\0\0\0\374x\0\374x\0\374x\0\0\0\0\374\214\0\374\214" + "\0\374\214\0\0\0\0\374\240\0\374\240\0\374\240\0\0\0\0\374\264\0\374\264" + "\0\374\264\0\0\0\0\374\310\0\374\310\0\374\310\0\0\0\0\374\334\0\374\334" + "\0\374\334\0\0\0\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374" + "\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360" + "\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\374\0\0\374\0\0\374\0\0\0\0\0\374\24\0\374\24\0\374\24\0\0\0\0\374(\0\374" + "(\0\374(\0\0\0\0\374<\0\374<\0\374<\0\0\0\0\374P\0\374P\0\374P\0\0\0\0\374" + "d\0\374d\0\374d\0\0\0\0\374x\0\374x\0\374x\0\0\0\0\374\214\0\374\214\0\374" + "\214\0\0\0\0\374\240\0\374\240\0\374\240\0\0\0\0\374\264\0\374\264\0\374" + "\264\0\0\0\0\374\310\0\374\310\0\374\310\0\0\0\0\374\334\0\374\334\0\374" + "\334\0\0\0\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0" + "\374\360\0\374\360\0\374\360\0\0\0\0\0\0\0\374\360\0\374\360\0\374\360\0" + "\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\374\0\0\374" + "\0\0\374\0\0\0\0\0\374\24\0\374\24\0\374\24\0\0\0\0\374(\0\374(\0\374(\0" + "\0\0\0\374<\0\374<\0\374<\0\0\0\0\374P\0\374P\0\374P\0\0\0\0\374d\0\374d" + "\0\374d\0\0\0\0\374x\0\374x\0\374x\0\0\0\0\374\214\0\374\214\0\374\214\0" + "\0\0\0\374\240\0\374\240\0\374\240\0\0\0\0\374\264\0\374\264\0\374\264\0" + "\0\0\0\374\310\0\374\310\0\374\310\0\0\0\0\374\334\0\374\334\0\374\334\0" + "\0\0\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360" + "\0\374\360\0\374\360\0\0\0\0\0\0\0\374\360\0\374\360\0\374\360\0\374\360" + "\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\374\0\0\374\0\0\374" + "\0\0\0\0\0\374\24\0\374\24\0\374\24\0\0\0\0\374(\0\374(\0\374(\0\0\0\0\374" + "<\0\374<\0\374<\0\0\0\0\374P\0\374P\0\374P\0\0\0\0\374d\0\374d\0\374d\0\0" + "\0\0\374x\0\374x\0\374x\0\0\0\0\374\214\0\374\214\0\374\214\0\0\0\0\374\240" + "\0\374\240\0\374\240\0\0\0\0\374\264\0\374\264\0\374\264\0\0\0\0\374\310" + "\0\374\310\0\374\310\0\0\0\0\374\334\0\374\334\0\374\334\0\0\0\0\374\360" + "\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0" + "\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374" + "\360\0\374\360\0\374\360\0\374\360\0\374\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\374\0\0\374\0\0\374" + "\0\0\0\0\0\374\24\0\374\24\0\374\24\0\0\0\0\374(\0\374(\0\374(\0\0\0\0\374" + "<\0\374<\0\374<\0\0\0\0\374P\0\374P\0\374P\0\0\0\0\374d\0\374d\0\374d\0\0" + "\0\0\374x\0\374x\0\374x\0\0\0\0\374\214\0\374\214\0\374\214\0\0\0\0\374\240" + "\0\374\240\0\374\240\0\0\0\0\374\264\0\374\264\0\374\264\0\0\0\0\374\310" + "\0\374\310\0\374\310\0\0\0\0\374\334\0\374\334\0\374\334\0\0\0\0\374\360" + "\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0" + "\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374" + "\360\0\374\360\0\374\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\374\0\0\374\0\0\0\0\0\0\0\0\374\24" + "\0\374\24\0\0\0\0\0\0\0\374(\0\374(\0\0\0\0\0\0\0\374<\0\374<\0\0\0\0\0\0" + "\0\374P\0\374P\0\0\0\0\0\0\0\374d\0\374d\0\0\0\0\0\0\0\374x\0\374x\0\0\0" + "\0\0\0\0\374\214\0\374\214\0\0\0\0\0\0\0\374\240\0\374\240\0\0\0\0\0\0\0" + "\374\264\0\374\264\0\0\0\0\0\0\0\374\310\0\374\310\0\0\0\0\0\0\0\374\334" + "\0\374\334\0\0\0\0\0\0\0\374\360\0\374\360\0\0\0\0\0\0\0\0\0\0\374\360\0" + "\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\0" + "\0\0\0\0\0\0\0\0\374\360\0\374\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\374\0\0\374\0\0\0" + "\0\0\0\0\0\374\24\0\374\24\0\0\0\0\0\0\0\374(\0\374(\0\0\0\0\0\0\0\374<\0" + "\374<\0\0\0\0\0\0\0\374P\0\374P\0\0\0\0\0\0\0\374d\0\374d\0\0\0\0\0\0\0\374" + "x\0\374x\0\0\0\0\0\0\0\374\214\0\374\214\0\0\0\0\0\0\0\374\240\0\374\240" + "\0\0\0\0\0\0\0\374\264\0\374\264\0\0\0\0\0\0\0\374\310\0\374\310\0\0\0\0" + "\0\0\0\374\334\0\374\334\0\0\0\0\0\0\0\374\360\0\374\360\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\374\360\0\374" + "\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\374\0\0\374\0\0\0\0\0\0\0\0\374\24\0" + "\374\24\0\0\0\0\0\0\0\374(\0\374(\0\0\0\0\0\0\0\374<\0\374<\0\0\0\0\0\0\0" + "\374P\0\374P\0\0\0\0\0\0\0\374d\0\374d\0\0\0\0\0\0\0\374x\0\374x\0\0\0\0" + "\0\0\0\374\214\0\374\214\0\0\0\0\0\0\0\374\240\0\374\240\0\0\0\0\0\0\0\374" + "\264\0\374\264\0\0\0\0\0\0\0\374\310\0\374\310\0\0\0\0\0\0\0\374\334\0\374" + "\334\0\0\0\0\0\0\0\374\360\0\374\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\374\360\0\374\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\374\0\0\374\0\0\374\0\0\0\0\0\374\24\0\374\24\0\374\24\0" + "\0\0\0\374(\0\374(\0\374(\0\0\0\0\374<\0\374<\0\374<\0\0\0\0\374P\0\374P" + "\0\374P\0\0\0\0\374d\0\374d\0\374d\0\0\0\0\374x\0\374x\0\374x\0\0\0\0\374" + "\214\0\374\214\0\374\214\0\0\0\0\374\240\0\374\240\0\374\240\0\0\0\0\374" + "\264\0\374\264\0\374\264\0\0\0\0\374\310\0\374\310\0\374\310\0\0\0\0\374" + "\334\0\374\334\0\374\334\0\0\0\0\374\360\0\374\360\0\374\360\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\374\360\0\374\360\0\374\360\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\374\0\0\374\0\0\0\0\0\0\0\0" + "\374\24\0\374\24\0\0\0\0\0\0\0\374(\0\374(\0\0\0\0\0\0\0\374<\0\374<\0\0" + "\0\0\0\0\0\374P\0\374P\0\0\0\0\0\0\0\374d\0\374d\0\0\0\0\0\0\0\374x\0\374" + "x\0\0\0\0\0\0\0\374\214\0\374\214\0\0\0\0\0\0\0\374\240\0\374\240\0\0\0\0" + "\0\0\0\374\264\0\374\264\0\0\0\0\0\0\0\374\310\0\374\310\0\0\0\0\0\0\0\374" + "\334\0\374\334\0\0\0\0\0\0\0\374\360\0\374\360\0\374\360\0\374\360\0\374" + "\360\0\374\360\0\374\360\0\374\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", +}; + +/** + * \brief Returns the BlitColor test image as SDL_Surface. + */ +SDL_Surface *SDLTest_ImageBlitColor() +{ + 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.bytes_per_pixel, +#if (SDL_BYTEORDER == SDL_BIG_ENDIAN) + 0xff000000, /* Red bit mask. */ + 0x00ff0000, /* Green bit mask. */ + 0x0000ff00, /* Blue bit mask. */ + 0x000000ff /* Alpha bit mask. */ +#else + 0x000000ff, /* Red bit mask. */ + 0x0000ff00, /* Green bit mask. */ + 0x00ff0000, /* Blue bit mask. */ + 0xff000000 /* Alpha bit mask. */ +#endif + ); + return surface; +} + +const SDLTest_SurfaceImage_t SDLTest_imageBlitAlpha = { + 80, 60, 3, + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\24\24\0\24\24\0\20\20\0" + "\20\20\0""88\0""88\0**\0**\0ZZ\0ZZ\0==\0==\0yy\0yy\0II\0II\0\224\224\0\224" + "\224\0NN\0NN\0\254\254\0\254\254\0MM\0MM\0\302\302\0\302\302\0HH\0HH\0\324" + "\324\0\324\324\0>>\0>>\0\343\343\0\343\343\0""00\0""00\0\356\356\0\356\356" + "\0\40\40\0\40\40\0\367\367\0\367\367\0\16\16\0\16\16\0\374\374\0\374\374" + "\0\374\374\0\374\374\0\360\360\0\360\360\0\360\360\0\360\360\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\24\24\0\24\24\0\24\24\0\20\20\0""88\0""88\0""88\0**\0ff\0ff\0ff\0FF\0" + "\215\215\0\215\215\0\215\215\0UU\0\255\255\0\255\255\0\255\255\0[[\0\306" + "\306\0\306\306\0\306\306\0YY\0\331\331\0\331\331\0\331\331\0PP\0\350\350" + "\0\350\350\0\350\350\0DD\0\362\362\0\362\362\0\362\362\0""44\0\370\370\0" + "\370\370\0\370\370\0\"\"\0\374\374\0\374\374\0\374\374\0\16\16\0\376\376" + "\0\376\376\0\376\376\0\376\376\0\374\374\0\374\374\0\374\374\0\374\374\0" + "\360\360\0\360\360\0\360\360\0\360\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\24\24\0\24\24\0\24\24\0\20\20\0""88\0" + """88\0""88\0**\0ff\0ff\0ff\0FF\0\226\226\0\226\226\0\215\215\0UU\0\271\271" + "\0\271\271\0\255\255\0[[\0\323\323\0\323\323\0\306\306\0YY\0\345\345\0\345" + "\345\0\331\331\0PP\0\360\360\0\360\360\0\350\350\0DD\0\370\370\0\370\370" + "\0\362\362\0""44\0\374\374\0\374\374\0\370\370\0\"\"\0\376\376\0\376\376" + "\0\374\374\0\16\16\0\376\376\0\376\376\0\376\376\0\376\376\0\376\376\0\376" + "\376\0\374\374\0\374\374\0\374\374\0\374\374\0\360\360\0\360\360\0\360\360" + "\0\360\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\24\24" + "\0\24\24\0\24\24\0\20\20\0""33\0""33\0""33\0&&\0OO\0OO\0OO\0""55\0``\0``" + "\0``\0::\0``\0``\0``\0""22\0WW\0WW\0WW\0''\0II\0II\0II\0\33\33\0""99\0""9" + "9\0""99\0\20\20\0))\0))\0))\0\10\10\0\33\33\0\33\33\0\33\33\0\3\3\0\17\17" + "\0\17\17\0\17\17\0\0\0\0\7\7\0\7\7\0\7\7\0\7\7\0\2\2\0\2\2\0\2\2\0\2\2\0" + "\16\16\0\16\16\0\16\16\0\16\16\0\360\360\0\360\360\0\360\360\0\360\360\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\24\24\0\24\24\0\24\24\0\16\16" + "\0""33\0GG\0GG\0""00\0``\0\210\210\0\210\210\0TT\0\204\204\0\263\263\0\263" + "\263\0ee\0\222\222\0\315\315\0\312\312\0gg\0\216\216\0\331\331\0\327\327" + "\0cc\0\202\202\0\340\340\0\337\337\0YY\0qq\0\345\345\0\344\344\0NN\0^^\0" + "\352\352\0\352\352\0@@\0JJ\0\357\357\0\357\357\0""11\0""66\0\364\364\0\364" + "\364\0\40\40\0\"\"\0\371\371\0\371\371\0\16\16\0\16\16\0\375\375\0\375\375" + "\0\376\376\0\376\376\0\362\362\0\362\362\0\376\376\0\376\376\0\16\16\0\16" + "\16\0\360\360\0\360\360\0\360\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\24" + "\24\0\24\24\0\22\22\0\24\24\0""88\0""88\0//\0BB\0pp\0pp\0UU\0ss\0\242\242" + "\0\242\242\0oo\0\230\230\0\306\306\0\306\306\0ww\0\265\265\0\335\335\0\335" + "\335\0ss\0\313\313\0\353\353\0\353\353\0ii\0\333\333\0\364\364\0\364\364" + "\0ZZ\0\351\351\0\371\371\0\371\371\0II\0\362\362\0\374\374\0\374\374\0""6" + "6\0\370\370\0\376\376\0\376\376\0\"\"\0\374\374\0\376\376\0\376\376\0\16" + "\16\0\376\376\0\376\376\0\376\376\0\376\376\0\375\375\0\376\376\0\376\376" + "\0\376\376\0\360\360\0\360\360\0\360\360\0\360\360\0\16\16\0\360\360\0\360" + "\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\24\24\0\24\24\0\22\22\0\"\"\0""88\0" + """88\0//\0OO\0pp\0pp\0WW\0\203\203\0\242\242\0\242\242\0qq\0\256\256\0\312" + "\312\0\301\301\0||\0\313\313\0\342\342\0\325\325\0yy\0\336\336\0\360\360" + "\0\342\342\0mm\0\353\353\0\367\367\0\354\354\0\\\\\0\363\363\0\373\373\0" + "\362\362\0JJ\0\371\371\0\375\375\0\367\367\0""66\0\374\374\0\376\376\0\373" + "\373\0\"\"\0\376\376\0\376\376\0\375\375\0\16\16\0\376\376\0\376\376\0\376" + "\376\0\376\376\0\376\376\0\376\376\0\375\375\0\376\376\0\376\376\0\375\375" + "\0\360\360\0\374\374\0\360\360\0\376\376\0\16\16\0\360\360\0\360\360\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\24\24\0\22\22\0&&\0\"\"\0""88\0//\0PP\0HH\0gg\0NN" + "\0pp\0ee\0}}\0VV\0{{\0oo\0\202\202\0NN\0qq\0jj\0vv\0>>\0``\0\\\\\0cc\0,," + "\0MM\0KK\0OO\0\35\35\0::\0""99\0;;\0\21\21\0**\0))\0**\0\10\10\0\33\33\0" + "\33\33\0\33\33\0\3\3\0\17\17\0\17\17\0\17\17\0\0\0\0\7\7\0\7\7\0\7\7\0\7" + "\7\0\2\2\0\2\2\0\2\2\0\2\2\0\16\16\0\16\16\0\16\16\0\16\16\0\360\360\0\360" + "\360\0\376\376\0\376\376\0\16\16\0\360\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\22\22" + "\0&&\0&&\0\"\"\0""66\0[[\0oo\0ee\0``\0\220\220\0\270\270\0\250\250\0xx\0" + "\250\250\0\327\327\0\311\311\0zz\0\246\246\0\341\341\0\325\325\0rr\0\230" + "\230\0\343\343\0\334\334\0gg\0\205\205\0\344\344\0\340\340\0[[\0rr\0\346" + "\346\0\344\344\0NN\0^^\0\352\352\0\352\352\0AA\0JJ\0\357\357\0\357\357\0" + """11\0""66\0\364\364\0\364\364\0\40\40\0\"\"\0\371\371\0\371\371\0\16\16" + "\0\16\16\0\375\375\0\375\375\0\376\376\0\376\376\0\362\362\0\362\362\0\376" + "\376\0\376\376\0\16\16\0\16\16\0\376\376\0\376\376\0\376\376\0\16\16\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\22\22\0&&\0&&\0\37\37\0;;\0``\0``\0HH\0qq\0\237\237" + "\0\237\237\0nn\0\227\227\0\306\306\0\306\306\0}}\0\254\254\0\334\334\0\334" + "\334\0}}\0\275\275\0\347\347\0\347\347\0vv\0\316\316\0\357\357\0\357\357" + "\0ii\0\334\334\0\365\365\0\365\365\0ZZ\0\351\351\0\371\371\0\371\371\0II" + "\0\362\362\0\374\374\0\374\374\0""66\0\370\370\0\376\376\0\376\376\0\"\"" + "\0\374\374\0\376\376\0\376\376\0\16\16\0\376\376\0\376\376\0\376\376\0\376" + "\376\0\375\375\0\376\376\0\376\376\0\376\376\0\360\360\0\360\360\0\360\360" + "\0\360\360\0\16\16\0\376\376\0\376\376\0\16\16\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "&&\0&&\0##\0--\0``\0``\0TT\0cc\0\237\237\0\231\231\0||\0\223\223\0\306\306" + "\0\301\301\0\217\217\0\267\267\0\336\336\0\322\322\0\220\220\0\317\317\0" + "\352\352\0\334\334\0\202\202\0\337\337\0\362\362\0\345\345\0qq\0\353\353" + "\0\370\370\0\354\354\0^^\0\363\363\0\373\373\0\362\362\0JJ\0\371\371\0\375" + "\375\0\367\367\0""66\0\374\374\0\376\376\0\373\373\0\"\"\0\376\376\0\376" + "\376\0\375\375\0\16\16\0\376\376\0\376\376\0\376\376\0\376\376\0\376\376" + "\0\376\376\0\375\375\0\376\376\0\376\376\0\375\375\0\360\360\0\376\376\0" + "\360\360\0\376\376\0\16\16\0\376\376\0\376\376\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "&&\0##\0""77\0--\0``\0PP\0nn\0[[\0\222\222\0kk\0\211\211\0qq\0\231\231\0" + "ff\0\210\210\0uu\0\217\217\0UU\0vv\0ll\0zz\0@@\0aa\0]]\0dd\0,,\0MM\0KK\0" + "OO\0\35\35\0::\0""99\0;;\0\21\21\0**\0))\0**\0\10\10\0\33\33\0\33\33\0\33" + "\33\0\3\3\0\17\17\0\17\17\0\17\17\0\0\0\0\7\7\0\7\7\0\7\7\0\7\7\0\2\2\0\2" + "\2\0\2\2\0\2\2\0\16\16\0\16\16\0\16\16\0\16\16\0\360\360\0\360\360\0\376" + "\376\0\376\376\0\16\16\0\376\376\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0##\0""77\0""77" + "\0--\0UU\0zz\0\216\216\0ww\0}}\0\254\254\0\324\324\0\264\264\0\207\207\0" + "\266\266\0\345\345\0\316\316\0\177\177\0\254\254\0\346\346\0\326\326\0rr" + "\0\231\231\0\344\344\0\334\334\0gg\0\206\206\0\344\344\0\340\340\0[[\0rr" + "\0\346\346\0\344\344\0NN\0^^\0\352\352\0\352\352\0AA\0JJ\0\357\357\0\357" + "\357\0""11\0""66\0\364\364\0\364\364\0\40\40\0\"\"\0\371\371\0\371\371\0" + "\16\16\0\16\16\0\375\375\0\375\375\0\376\376\0\376\376\0\362\362\0\362\362" + "\0\376\376\0\376\376\0\16\16\0\16\16\0\376\376\0\376\376\0\376\376\0\16\16" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\22\22\0""77\0""77\0--\0CC\0~~\0~~\0\\\\\0||\0" + "\274\274\0\274\274\0||\0\235\235\0\325\325\0\325\325\0\204\204\0\256\256" + "\0\340\340\0\340\340\0\177\177\0\275\275\0\351\351\0\351\351\0vv\0\316\316" + "\0\360\360\0\360\360\0ii\0\334\334\0\365\365\0\365\365\0ZZ\0\351\351\0\371" + "\371\0\371\371\0II\0\362\362\0\374\374\0\374\374\0""66\0\370\370\0\376\376" + "\0\376\376\0\"\"\0\374\374\0\376\376\0\376\376\0\16\16\0\376\376\0\376\376" + "\0\376\376\0\376\376\0\375\375\0\376\376\0\376\376\0\376\376\0\360\360\0" + "\360\360\0\360\360\0\360\360\0\16\16\0\376\376\0\376\376\0\16\16\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0&&\0""77\0""22\0--\0``\0vv\0pp\0gg\0\243\243\0\255\255" + "\0\225\225\0\231\231\0\311\311\0\314\314\0\235\235\0\271\271\0\337\337\0" + "\326\326\0\224\224\0\320\320\0\352\352\0\336\336\0\204\204\0\337\337\0\362" + "\362\0\345\345\0qq\0\353\353\0\370\370\0\354\354\0^^\0\363\363\0\373\373" + "\0\362\362\0JJ\0\371\371\0\375\375\0\367\367\0""66\0\374\374\0\376\376\0" + "\373\373\0\"\"\0\376\376\0\376\376\0\375\375\0\16\16\0\376\376\0\376\376" + "\0\376\376\0\376\376\0\376\376\0\376\376\0\375\375\0\376\376\0\376\376\0" + "\375\375\0\360\360\0\376\376\0\360\360\0\376\376\0\16\16\0\376\376\0\376" + "\376\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0&&\0##\0FF\0""99\0``\0PP\0\200\200\0dd\0\222" + "\222\0kk\0\222\222\0vv\0\231\231\0ff\0\213\213\0ww\0\217\217\0UU\0xx\0mm" + "\0zz\0@@\0bb\0]]\0dd\0,,\0MM\0KK\0OO\0\35\35\0::\0""99\0;;\0\21\21\0**\0" + "))\0**\0\10\10\0\33\33\0\33\33\0\33\33\0\3\3\0\17\17\0\17\17\0\17\17\0\0" + "\0\0\7\7\0\7\7\0\7\7\0\7\7\0\2\2\0\2\2\0\2\2\0\2\2\0\16\16\0\16\16\0\16\16" + "\0\16\16\0\360\360\0\360\360\0\376\376\0\376\376\0\16\16\0\376\376\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0##\0""77\0""77\0""99\0^^\0zz\0\216\216\0\201\201\0\203" + "\203\0\254\254\0\324\324\0\271\271\0\211\211\0\266\266\0\345\345\0\317\317" + "\0\200\200\0\254\254\0\346\346\0\326\326\0ss\0\231\231\0\344\344\0\334\334" + "\0gg\0\206\206\0\344\344\0\340\340\0[[\0rr\0\346\346\0\344\344\0NN\0^^\0" + "\352\352\0\352\352\0AA\0JJ\0\357\357\0\357\357\0""11\0""66\0\364\364\0\364" + "\364\0\40\40\0\"\"\0\371\371\0\371\371\0\16\16\0\16\16\0\375\375\0\375\375" + "\0\376\376\0\376\376\0\362\362\0\362\362\0\376\376\0\376\376\0\16\16\0\16" + "\16\0\376\376\0\376\376\0\376\376\0\16\16\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\22\22" + "\0""77\0""77\0--\0MM\0\210\210\0\210\210\0\\\\\0\202\202\0\302\302\0\302" + "\302\0||\0\240\240\0\330\330\0\330\330\0\204\204\0\257\257\0\341\341\0\341" + "\341\0\177\177\0\275\275\0\351\351\0\351\351\0vv\0\316\316\0\360\360\0\360" + "\360\0ii\0\334\334\0\365\365\0\365\365\0ZZ\0\351\351\0\371\371\0\371\371" + "\0II\0\362\362\0\374\374\0\374\374\0""66\0\370\370\0\376\376\0\376\376\0" + "\"\"\0\374\374\0\376\376\0\376\376\0\16\16\0\376\376\0\376\376\0\376\376" + "\0\376\376\0\375\375\0\376\376\0\376\376\0\376\376\0\360\360\0\360\360\0" + "\360\360\0\360\360\0\16\16\0\376\376\0\376\376\0\16\16\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0&&\0""77\0""22\0--\0``\0vv\0xx\0kk\0\245\245\0\257\257\0\235\235" + "\0\234\234\0\312\312\0\315\315\0\241\241\0\272\272\0\337\337\0\326\326\0" + "\225\225\0\320\320\0\352\352\0\336\336\0\204\204\0\337\337\0\362\362\0\345" + "\345\0qq\0\353\353\0\370\370\0\354\354\0^^\0\363\363\0\373\373\0\362\362" + "\0JJ\0\371\371\0\375\375\0\367\367\0""66\0\374\374\0\376\376\0\373\373\0" + "\"\"\0\376\376\0\376\376\0\375\375\0\16\16\0\376\376\0\376\376\0\376\376" + "\0\376\376\0\376\376\0\376\376\0\375\375\0\376\376\0\376\376\0\375\375\0" + "\360\360\0\376\376\0\360\360\0\376\376\0\16\16\0\376\376\0\376\376\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0&&\0##\0FF\0""99\0``\0PP\0\200\200\0dd\0\222\222\0kk" + "\0\222\222\0vv\0\231\231\0ff\0\213\213\0ww\0\217\217\0UU\0xx\0mm\0zz\0@@" + "\0bb\0]]\0dd\0,,\0MM\0KK\0OO\0\35\35\0::\0""99\0;;\0\21\21\0**\0))\0**\0" + "\10\10\0\33\33\0\33\33\0\33\33\0\3\3\0\17\17\0\17\17\0\17\17\0\0\0\0\7\7" + "\0\7\7\0\7\7\0\7\7\0\2\2\0\2\2\0\2\2\0\2\2\0\16\16\0\16\16\0\16\16\0\16\16" + "\0\360\360\0\360\360\0\376\376\0\376\376\0\16\16\0\376\376\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0##\0""77\0""77\0""99\0^^\0zz\0\216\216\0\201\201\0\203\203\0" + "\254\254\0\324\324\0\271\271\0\211\211\0\266\266\0\345\345\0\317\317\0\200" + "\200\0\254\254\0\346\346\0\326\326\0ss\0\231\231\0\344\344\0\334\334\0gg" + "\0\206\206\0\344\344\0\340\340\0[[\0rr\0\346\346\0\344\344\0NN\0^^\0\352" + "\352\0\352\352\0AA\0JJ\0\357\357\0\357\357\0""11\0""66\0\364\364\0\364\364" + "\0\40\40\0\"\"\0\371\371\0\371\371\0\16\16\0\16\16\0\375\375\0\375\375\0" + "\376\376\0\376\376\0\362\362\0\362\362\0\376\376\0\376\376\0\16\16\0\16\16" + "\0\376\376\0\376\376\0\376\376\0\16\16\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\22\22\0" + """77\0""77\0--\0MM\0\210\210\0\210\210\0\\\\\0\202\202\0\302\302\0\302\302" + "\0||\0\240\240\0\330\330\0\330\330\0\204\204\0\257\257\0\341\341\0\341\341" + "\0\177\177\0\275\275\0\351\351\0\351\351\0vv\0\316\316\0\360\360\0\360\360" + "\0ii\0\334\334\0\365\365\0\365\365\0ZZ\0\351\351\0\371\371\0\371\371\0II" + "\0\362\362\0\374\374\0\374\374\0""66\0\370\370\0\376\376\0\376\376\0\"\"" + "\0\374\374\0\376\376\0\376\376\0\16\16\0\376\376\0\376\376\0\376\376\0\376" + "\376\0\375\375\0\376\376\0\376\376\0\376\376\0\360\360\0\360\360\0\360\360" + "\0\360\360\0\16\16\0\376\376\0\376\376\0\16\16\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "&&\0""77\0""22\0--\0``\0vv\0xx\0kk\0\245\245\0\257\257\0\235\235\0\234\234" + "\0\312\312\0\315\315\0\241\241\0\272\272\0\337\337\0\326\326\0\225\225\0" + "\320\320\0\352\352\0\336\336\0\204\204\0\337\337\0\362\362\0\345\345\0qq" + "\0\353\353\0\370\370\0\354\354\0^^\0\363\363\0\373\373\0\362\362\0JJ\0\371" + "\371\0\375\375\0\367\367\0""66\0\374\374\0\376\376\0\373\373\0\"\"\0\376" + "\376\0\376\376\0\375\375\0\16\16\0\376\376\0\376\376\0\376\376\0\376\376" + "\0\376\376\0\376\376\0\375\375\0\376\376\0\376\376\0\375\375\0\360\360\0" + "\376\376\0\360\360\0\376\376\0\16\16\0\376\376\0\376\376\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0&&\0##\0FF\0""99\0``\0PP\0\200\200\0dd\0\222\222\0kk\0\222\222" + "\0vv\0\231\231\0ff\0\213\213\0ww\0\217\217\0UU\0xx\0mm\0zz\0@@\0bb\0]]\0" + "dd\0,,\0MM\0KK\0OO\0\35\35\0::\0""99\0;;\0\21\21\0**\0))\0**\0\10\10\0\33" + "\33\0\33\33\0\33\33\0\3\3\0\17\17\0\17\17\0\17\17\0\0\0\0\7\7\0\7\7\0\7\7" + "\0\7\7\0\2\2\0\2\2\0\2\2\0\2\2\0\16\16\0\16\16\0\16\16\0\16\16\0\360\360" + "\0\360\360\0\376\376\0\376\376\0\16\16\0\376\376\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0##\0""77\0""77\0""99\0^^\0zz\0\216\216\0\201\201\0\203\203\0\254\254\0" + "\324\324\0\271\271\0\211\211\0\266\266\0\345\345\0\317\317\0\200\200\0\254" + "\254\0\346\346\0\326\326\0ss\0\231\231\0\344\344\0\334\334\0gg\0\206\206" + "\0\344\344\0\340\340\0[[\0rr\0\346\346\0\344\344\0NN\0^^\0\352\352\0\352" + "\352\0AA\0JJ\0\357\357\0\357\357\0""11\0""66\0\364\364\0\364\364\0\40\40" + "\0\"\"\0\371\371\0\371\371\0\16\16\0\16\16\0\375\375\0\375\375\0\376\376" + "\0\376\376\0\362\362\0\362\362\0\376\376\0\376\376\0\16\16\0\16\16\0\376" + "\376\0\376\376\0\376\376\0\16\16\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\22\22\0""77\0" + """77\0--\0MM\0\210\210\0\210\210\0\\\\\0\202\202\0\302\302\0\302\302\0||" + "\0\240\240\0\330\330\0\330\330\0\204\204\0\257\257\0\341\341\0\341\341\0" + "\177\177\0\275\275\0\351\351\0\351\351\0vv\0\316\316\0\360\360\0\360\360" + "\0ii\0\334\334\0\365\365\0\365\365\0ZZ\0\351\351\0\371\371\0\371\371\0II" + "\0\362\362\0\374\374\0\374\374\0""66\0\370\370\0\376\376\0\376\376\0\"\"" + "\0\374\374\0\376\376\0\376\376\0\16\16\0\376\376\0\376\376\0\376\376\0\376" + "\376\0\375\375\0\376\376\0\376\376\0\376\376\0\360\360\0\360\360\0\360\360" + "\0\360\360\0\16\16\0\376\376\0\376\376\0\16\16\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "&&\0""77\0""22\0--\0``\0vv\0xx\0kk\0\245\245\0\257\257\0\235\235\0\234\234" + "\0\312\312\0\315\315\0\241\241\0\272\272\0\337\337\0\326\326\0\225\225\0" + "\320\320\0\352\352\0\336\336\0\204\204\0\337\337\0\362\362\0\345\345\0qq" + "\0\353\353\0\370\370\0\354\354\0^^\0\363\363\0\373\373\0\362\362\0JJ\0\371" + "\371\0\375\375\0\367\367\0""66\0\374\374\0\376\376\0\373\373\0\"\"\0\376" + "\376\0\376\376\0\375\375\0\16\16\0\376\376\0\376\376\0\376\376\0\376\376" + "\0\376\376\0\376\376\0\375\375\0\376\376\0\376\376\0\375\375\0\360\360\0" + "\376\376\0\360\360\0\376\376\0\16\16\0\376\376\0\376\376\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0&&\0##\0FF\0""99\0``\0PP\0\200\200\0dd\0\222\222\0kk\0\222\222" + "\0vv\0\231\231\0ff\0\213\213\0ww\0\217\217\0UU\0xx\0mm\0zz\0@@\0bb\0]]\0" + "dd\0,,\0MM\0KK\0OO\0\35\35\0::\0""99\0;;\0\21\21\0**\0))\0**\0\10\10\0\33" + "\33\0\33\33\0\33\33\0\3\3\0\17\17\0\17\17\0\17\17\0\0\0\0\7\7\0\7\7\0\7\7" + "\0\7\7\0\2\2\0\2\2\0\2\2\0\2\2\0\16\16\0\16\16\0\16\16\0\16\16\0\360\360" + "\0\360\360\0\376\376\0\376\376\0\16\16\0\376\376\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0##\0""77\0""77\0""99\0^^\0zz\0\216\216\0\201\201\0\203\203\0\254\254\0" + "\324\324\0\271\271\0\211\211\0\266\266\0\345\345\0\317\317\0\200\200\0\254" + "\254\0\346\346\0\326\326\0ss\0\231\231\0\344\344\0\334\334\0gg\0\206\206" + "\0\344\344\0\340\340\0[[\0rr\0\346\346\0\344\344\0NN\0^^\0\352\352\0\352" + "\352\0AA\0JJ\0\357\357\0\357\357\0""11\0""66\0\364\364\0\364\364\0\40\40" + "\0\"\"\0\371\371\0\371\371\0\16\16\0\16\16\0\375\375\0\375\375\0\376\376" + "\0\376\376\0\362\362\0\362\362\0\376\376\0\376\376\0\16\16\0\16\16\0\376" + "\376\0\376\376\0\376\376\0\16\16\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\22\22\0""77\0" + """77\0--\0MM\0\210\210\0\210\210\0\\\\\0\202\202\0\302\302\0\302\302\0||" + "\0\240\240\0\330\330\0\330\330\0\204\204\0\257\257\0\341\341\0\341\341\0" + "\177\177\0\275\275\0\351\351\0\351\351\0vv\0\316\316\0\360\360\0\360\360" + "\0ii\0\334\334\0\365\365\0\365\365\0ZZ\0\351\351\0\371\371\0\371\371\0II" + "\0\362\362\0\374\374\0\374\374\0""66\0\370\370\0\376\376\0\376\376\0\"\"" + "\0\374\374\0\376\376\0\376\376\0\16\16\0\376\376\0\376\376\0\376\376\0\376" + "\376\0\375\375\0\376\376\0\376\376\0\376\376\0\360\360\0\360\360\0\360\360" + "\0\360\360\0\16\16\0\376\376\0\376\376\0\16\16\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "&&\0""77\0""22\0--\0``\0vv\0xx\0kk\0\245\245\0\257\257\0\235\235\0\234\234" + "\0\312\312\0\315\315\0\241\241\0\272\272\0\337\337\0\326\326\0\225\225\0" + "\320\320\0\352\352\0\336\336\0\204\204\0\337\337\0\362\362\0\345\345\0qq" + "\0\353\353\0\370\370\0\354\354\0^^\0\363\363\0\373\373\0\362\362\0JJ\0\371" + "\371\0\375\375\0\367\367\0""66\0\374\374\0\376\376\0\373\373\0\"\"\0\376" + "\376\0\376\376\0\375\375\0\16\16\0\376\376\0\376\376\0\376\376\0\376\376" + "\0\376\376\0\376\376\0\375\375\0\376\376\0\376\376\0\375\375\0\360\360\0" + "\376\376\0\360\360\0\376\376\0\16\16\0\376\376\0\376\376\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0&&\0##\0FF\0""99\0``\0PP\0\213\213\0mm\0\237\237\0uu\0\275\275" + "\0\232\232\0\306\306\0\204\204\0\331\331\0\272\272\0\336\336\0\205\205\0" + "\345\345\0\320\320\0\352\352\0{{\0\355\355\0\337\337\0\362\362\0mm\0\363" + "\363\0\353\353\0\370\370\0\\\\\0\367\367\0\363\363\0\373\373\0II\0\373\373" + "\0\371\371\0\375\375\0""66\0\375\375\0\374\374\0\376\376\0\"\"\0\376\376" + "\0\376\376\0\376\376\0\16\16\0\376\376\0\376\376\0\376\376\0\376\376\0\376" + "\376\0\376\376\0\376\376\0\376\376\0\375\375\0\376\376\0\375\375\0\375\375" + "\0\360\360\0\360\360\0\376\376\0\376\376\0\16\16\0\376\376\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0##\0""77\0""77\0""99\0gg\0\205\205\0\205\205\0ww\0\224\224\0" + "\310\310\0\310\310\0\247\247\0\240\240\0\354\354\0\354\354\0\306\306\0\227" + "\227\0\372\372\0\372\372\0\325\325\0\205\205\0\375\375\0\375\375\0\342\342" + "\0rr\0\376\376\0\376\376\0\354\354\0^^\0\376\376\0\376\376\0\363\363\0JJ" + "\0\376\376\0\376\376\0\370\370\0""66\0\376\376\0\376\376\0\374\374\0\"\"" + "\0\376\376\0\376\376\0\376\376\0\16\16\0\376\376\0\376\376\0\376\376\0\376" + "\376\0\376\376\0\376\376\0\376\376\0\376\376\0\376\376\0\376\376\0\375\375" + "\0\376\376\0\376\376\0\376\376\0\362\362\0\376\376\0\376\376\0\376\376\0" + "\16\16\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\22\22\0""77\0""77\0""11\0>>\0~~\0~~\0bb" + "\0__\0\261\261\0\261\261\0\212\212\0``\0\277\277\0\277\277\0\230\230\0SS" + "\0\275\275\0\275\275\0\233\233\0@@\0\273\273\0\273\273\0\240\240\0//\0\274" + "\274\0\274\274\0\252\252\0!!\0\301\301\0\301\301\0\266\266\0\25\25\0\311" + "\311\0\311\311\0\303\303\0\14\14\0\324\324\0\324\324\0\322\322\0\6\6\0\342" + "\342\0\342\342\0\341\341\0\1\1\0\361\361\0\361\361\0\361\361\0\15\15\0\15" + "\15\0\15\15\0\15\15\0\362\362\0\362\362\0\362\362\0\360\360\0\16\16\0\16" + "\16\0\16\16\0\2\2\0\376\376\0\376\376\0\376\376\0\16\16\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0&&\0""77\0""77\0\34\34\0SS\0kk\0\206\206\0BB\0\214\214\0\232\232" + "\0\302\302\0YY\0\250\250\0\255\255\0\340\340\0XX\0\264\264\0\264\264\0\355" + "\355\0SS\0\265\265\0\266\266\0\364\364\0JJ\0\270\270\0\272\272\0\371\371" + "\0AA\0\277\277\0\300\300\0\374\374\0""66\0\310\310\0\311\311\0\375\375\0" + "**\0\324\324\0\324\324\0\376\376\0\34\34\0\341\341\0\342\342\0\376\376\0" + "\15\15\0\361\361\0\361\361\0\376\376\0\361\361\0\15\15\0\15\15\0\376\376" + "\0\15\15\0\361\361\0\361\361\0\373\373\0\362\362\0\15\15\0\16\16\0\376\376" + "\0\16\16\0\361\361\0\376\376\0\376\376\0\376\376\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0&&\0&&\0""77\0))\0SS\0SS\0kk\0DD\0\205\205\0}}\0\222\222\0WW\0\241\241" + "\0\230\230\0\245\245\0XX\0\261\261\0\252\252\0\261\261\0SS\0\264\264\0\263" + "\263\0\265\265\0JJ\0\270\270\0\271\271\0\272\272\0AA\0\276\276\0\300\300" + "\0\300\300\0""66\0\310\310\0\311\311\0\311\311\0**\0\324\324\0\324\324\0" + "\324\324\0\34\34\0\341\341\0\342\342\0\342\342\0\15\15\0\361\361\0\361\361" + "\0\361\361\0\361\361\0\15\15\0\15\15\0\15\15\0\15\15\0\361\361\0\361\361" + "\0\361\361\0\362\362\0\15\15\0\16\16\0\16\16\0\16\16\0\361\361\0\376\376" + "\0\376\376\0\376\376\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0&&\0&&\0&&\0))\0pp\0cc\0cc" + "\0QQ\0\261\261\0\244\244\0\244\244\0ll\0\335\335\0\323\323\0\323\323\0ww" + "\0\364\364\0\356\356\0\356\356\0ss\0\370\370\0\371\371\0\371\371\0ii\0\372" + "\372\0\375\375\0\375\375\0YY\0\374\374\0\376\376\0\376\376\0HH\0\375\375" + "\0\376\376\0\376\376\0""66\0\376\376\0\376\376\0\376\376\0\"\"\0\376\376" + "\0\376\376\0\376\376\0\16\16\0\376\376\0\376\376\0\376\376\0\376\376\0\376" + "\376\0\376\376\0\376\376\0\376\376\0\376\376\0\376\376\0\376\376\0\376\376" + "\0\375\375\0\376\376\0\376\376\0\376\376\0\361\361\0\376\376\0\376\376\0" + "\376\376\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\24\24\0&&\0&&\0\40\40\0QQ\0pp\0pp\0KK" + "\0\215\215\0\261\261\0\261\261\0pp\0\274\274\0\337\337\0\337\337\0\200\200" + "\0\332\332\0\364\364\0\364\364\0}}\0\350\350\0\373\373\0\373\373\0oo\0\361" + "\361\0\375\375\0\375\375\0]]\0\367\367\0\376\376\0\376\376\0JJ\0\373\373" + "\0\376\376\0\376\376\0""66\0\375\375\0\376\376\0\376\376\0\"\"\0\376\376" + "\0\376\376\0\376\376\0\16\16\0\376\376\0\376\376\0\376\376\0\376\376\0\376" + "\376\0\376\376\0\376\376\0\376\376\0\376\376\0\376\376\0\376\376\0\376\376" + "\0\375\375\0\376\376\0\376\376\0\376\376\0\361\361\0\376\376\0\376\376\0" + "\360\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\24\24\0&&\0&&\0\20\20\0""88\0WW\0pp\0" + "==\0ss\0\212\212\0\252\252\0dd\0\250\250\0\264\264\0\312\312\0rr\0\313\313" + "\0\315\315\0\331\331\0rr\0\340\340\0\331\331\0\340\340\0hh\0\355\355\0\341" + "\341\0\345\345\0YY\0\366\366\0\350\350\0\352\352\0HH\0\372\372\0\356\356" + "\0\357\357\0""66\0\375\375\0\364\364\0\364\364\0\"\"\0\376\376\0\371\371" + "\0\371\371\0\16\16\0\376\376\0\375\375\0\375\375\0\376\376\0\376\376\0\361" + "\361\0\362\362\0\376\376\0\376\376\0\16\16\0\16\16\0\376\376\0\375\375\0" + "\376\376\0\375\375\0\374\374\0\360\360\0\376\376\0\376\376\0\360\360\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\24\24\0\24\24\0&&\0\40\40\0""88\0""88\0WW\0BB\0ff" + "\0ZZ\0}}\0^^\0\226\226\0\201\201\0\241\241\0nn\0\301\301\0\246\246\0\277" + "\277\0rr\0\333\333\0\301\301\0\321\321\0ii\0\353\353\0\323\323\0\335\335" + "\0[[\0\365\365\0\341\341\0\346\346\0II\0\372\372\0\353\353\0\356\356\0""6" + "6\0\375\375\0\363\363\0\364\364\0\"\"\0\376\376\0\371\371\0\371\371\0\16" + "\16\0\376\376\0\375\375\0\375\375\0\376\376\0\376\376\0\361\361\0\361\361" + "\0\376\376\0\376\376\0\16\16\0\16\16\0\376\376\0\374\374\0\375\375\0\374" + "\374\0\374\374\0\361\361\0\376\376\0\360\360\0\360\360\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\24\24\0\24\24\0\24\24\0\40\40\0HH\0""88\0""88\0BB\0~~\0ff\0ff\0" + "^^\0\256\256\0\226\226\0\226\226\0qq\0\325\325\0\277\277\0\277\277\0ss\0" + "\350\350\0\331\331\0\331\331\0jj\0\363\363\0\353\353\0\353\353\0[[\0\371" + "\371\0\365\365\0\365\365\0II\0\374\374\0\372\372\0\372\372\0""66\0\375\375" + "\0\375\375\0\375\375\0\"\"\0\376\376\0\376\376\0\376\376\0\16\16\0\376\376" + "\0\376\376\0\376\376\0\376\376\0\376\376\0\376\376\0\376\376\0\376\376\0" + "\376\376\0\376\376\0\376\376\0\376\376\0\374\374\0\374\374\0\374\374\0\376" + "\376\0\361\361\0\360\360\0\360\360\0\360\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\24\24\0\24\24\0\24\24\0\40\40\0HH\0HH\0""88\0BB\0~~\0~~\0ff\0^^\0\263" + "\263\0\263\263\0\231\231\0nn\0\330\330\0\330\330\0\274\274\0pp\0\353\353" + "\0\353\353\0\324\324\0hh\0\365\365\0\365\365\0\345\345\0ZZ\0\373\373\0\373" + "\373\0\361\361\0II\0\375\375\0\375\375\0\370\370\0""66\0\376\376\0\376\376" + "\0\374\374\0\"\"\0\376\376\0\376\376\0\376\376\0\16\16\0\376\376\0\376\376" + "\0\376\376\0\376\376\0\376\376\0\376\376\0\376\376\0\376\376\0\376\376\0" + "\376\376\0\374\374\0\374\374\0\376\376\0\376\376\0\361\361\0\360\360\0\360" + "\360\0\360\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\24\24\0\24\24\0\0\0" + "\0\0\0\0((\0HH\0\40\40\0\25\25\0QQ\0\207\207\0KK\0--\0}}\0\262\262\0bb\0" + """44\0\235\235\0\320\320\0ff\0""00\0\257\257\0\341\341\0cc\0))\0\272\272" + "\0\354\354\0ZZ\0\37\37\0\303\303\0\363\363\0OO\0\26\26\0\314\314\0\370\370" + "\0AA\0\15\15\0\326\326\0\373\373\0""22\0\6\6\0\343\343\0\375\375\0!!\0\1" + "\1\0\362\362\0\376\376\0\16\16\0\16\16\0\16\16\0\375\375\0\375\375\0\375" + "\375\0\376\376\0\362\362\0\360\360\0\361\361\0\376\376\0\14\14\0\0\0\0\0" + "\0\0\360\360\0\360\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\24\24" + "\0\24\24\0\0\0\0\0\0\0((\0((\0\0\0\0\0\0\0<<\0<<\0\0\0\0\0\0\0PP\0PP\0\10" + "\10\0\4\4\0dd\0dd\0\14\14\0\6\6\0xx\0xx\0\14\14\0\5\5\0\214\214\0\214\214" + "\0\13\13\0\4\4\0\240\240\0\240\240\0\10\10\0\2\2\0\264\264\0\264\264\0\5" + "\5\0\1\1\0\310\310\0\310\310\0\3\3\0\0\0\0\334\334\0\334\334\0\1\1\0\0\0" + "\0\360\360\0\360\360\0\0\0\0\0\0\0\0\0\0\0\0\0\1\1\0\1\1\0\0\0\0\0\0\0\14" + "\14\0\14\14\0\0\0\0\0\0\0\360\360\0\360\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\24\24\0\24\24\0\0\0\0\0\0\0((\0((\0\0\0\0\0\0" + "\0<<\0<<\0\0\0\0\0\0\0XX\0XX\0\0\0\0\0\0\0pp\0pp\0\0\0\0\0\0\0\204\204\0" + "\204\204\0\0\0\0\0\0\0\227\227\0\227\227\0\0\0\0\0\0\0\250\250\0\250\250" + "\0\0\0\0\0\0\0\271\271\0\271\271\0\0\0\0\0\0\0\313\313\0\313\313\0\0\0\0" + "\0\0\0\335\335\0\335\335\0\0\0\0\0\0\0\360\360\0\360\360\0\0\0\0\0\0\0\1" + "\1\0\1\1\0\0\0\0\0\0\0\14\14\0\14\14\0\0\0\0\0\0\0\360\360\0\360\360\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\24\24\0" + "\24\24\0\24\24\0\0\0\0((\0((\0((\0\0\0\0<<\0HH\0HH\0\10\10\0PP\0dd\0dd\0" + "\14\14\0dd\0||\0||\0\14\14\0xx\0\221\221\0\221\221\0\13\13\0\214\214\0\243" + "\243\0\243\243\0\10\10\0\240\240\0\264\264\0\264\264\0\5\5\0\264\264\0\303" + "\303\0\303\303\0\3\3\0\310\310\0\322\322\0\322\322\0\1\1\0\334\334\0\341" + "\341\0\341\341\0\0\0\0\360\360\0\361\361\0\361\361\0\1\1\0\0\0\0\14\14\0" + "\14\14\0\14\14\0\0\0\0\360\360\0\360\360\0\360\360\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\24\24\0" + "\24\24\0\20\20\0\20\20\0""88\0""88\0**\0**\0ZZ\0ZZ\0==\0==\0yy\0yy\0II\0" + "II\0\224\224\0\224\224\0NN\0NN\0\254\254\0\254\254\0MM\0MM\0\302\302\0\302" + "\302\0HH\0HH\0\324\324\0\324\324\0>>\0>>\0\343\343\0\343\343\0""00\0""00" + "\0\356\356\0\356\356\0\40\40\0\40\40\0\367\367\0\367\367\0\16\16\0\16\16" + "\0\374\374\0\374\374\0\374\374\0\374\374\0\360\360\0\360\360\0\360\360\0" + "\360\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", +}; + +/** + * \brief Returns the BlitAlpha test image as SDL_Surface. + */ +SDL_Surface *SDLTest_ImageBlitAlpha() +{ + SDL_Surface *surface = SDL_CreateRGBSurfaceFrom( + (void*)SDLTest_imageBlitAlpha.pixel_data, + 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) + 0xff000000, /* Red bit mask. */ + 0x00ff0000, /* Green bit mask. */ + 0x0000ff00, /* Blue bit mask. */ + 0x000000ff /* Alpha bit mask. */ +#else + 0x000000ff, /* Red bit mask. */ + 0x0000ff00, /* Green bit mask. */ + 0x00ff0000, /* Blue bit mask. */ + 0xff000000 /* Alpha bit mask. */ +#endif + ); + return surface; +} diff --git a/src/eepp/helper/SDL2/src/test/SDL_test_imageBlitBlend.c b/src/eepp/helper/SDL2/src/test/SDL_test_imageBlitBlend.c new file mode 100644 index 000000000..06dbfabd4 --- /dev/null +++ b/src/eepp/helper/SDL2/src/test/SDL_test_imageBlitBlend.c @@ -0,0 +1,2843 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2013 Sam Lantinga + + 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 + appreciated but is not required. + 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. +*/ +#include "SDL_config.h" + +#include "SDL_test.h" + +/* GIMP RGB C-Source image dump (alpha.c) */ + +const SDLTest_SurfaceImage_t SDLTest_imageBlitBlendAdd = { + 80, 60, 3, + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0dd\0dd\0dd\0dd\0\310\310\0\310\310\0\310\310\0\310" + "\310\0\310\310\0\310\310\0\310\310\0\310\310\0\310\310\0\310\310\0\310\310" + "\0\310\310\0\310\310\0\310\310\0\310\310\0\310\310\0\310\310\0\310\310\0" + "\310\310\0\310\310\0\310\310\0\310\310\0\310\310\0\310\310\0\310\310\0\310" + "\310\0\310\310\0\310\310\0\310\310\0\310\310\0\310\310\0\310\310\0\310\310" + "\0\310\310\0\310\310\0\310\310\0\310\310\0\310\310\0\310\310\0\310\310\0" + "\310\310\0\310\310\0\310\310\0\310\310\0\310\310\0\310\310\0\310\310\0\310" + "\310\0dd\0dd\0dd\0dd\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0dd\0dd\0dd\0dd\0\310\310\0\310\310\0\310\310\0\310\310\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\310\310" + "\0\310\310\0\310\310\0\310\310\0dd\0dd\0dd\0dd\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0dd\0dd\0dd\0dd\0\310\310\0\310\310\0\310\310\0\310\310" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\310\310\0\310\310\0\310\310\0\310\310\0dd\0dd\0dd" + "\0dd\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0dd\0dd\0dd\0dd\0\310\310\0\310\310\0" + "\310\310\0\310\310\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\310\310\0\310" + "\310\0\310\310\0\310\310\0dd\0dd\0dd\0dd\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0dd\0dd\0dd\0" + "dd\0\310\310\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\310\310\0" + "dd\0dd\0dd\0dd\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0dd\0dd\0dd\0dd\0\310\310\0\310\310\0\310\310" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\310\310\0\310\310\0\310\310\0dd\0dd\0dd\0dd\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0dd\0dd\0dd" + "\0\310\310\0\310\310\0\310\310\0\310\310\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\310" + "\310\0\310\310\0\310\310\0\310\310\0dd\0dd\0dd\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0dd\0dd\0\310\310\0\310\310" + "\0\310\310\0\310\310\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\310" + "\310\0\310\310\0\310\310\0\310\310\0dd\0dd\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0dd\0\310\310\0\310\310\0\310" + "\310\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\310\310\0\310\310\0\310\310\0dd\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0dd\0\310\310\0\310" + "\310\0\310\310\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\310\310\0\310\310\0\310\310\0dd\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\310\310" + "\0\310\310\0\310\310\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\310\310\0\310\310" + "\0\310\310\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\310\310\0\310\310\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\310\310\0\310\310\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\310\310\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\310\310\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0dd\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0dd\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\310\310\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\310" + "\310\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\310\310\0\310\310\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\310\310\0\310\310\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\310\310\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\310\310\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0dd\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0dd\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\310\310\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\310\310" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\310\310\0\310\310\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\310\310\0\310\310\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\310\310\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\310\310\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0dd\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0dd\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\310\310\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\310\310\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\310" + "\310\0\310\310\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\310" + "\310\0\310\310\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\310\310\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\310\310\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0dd\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0dd\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\310\310\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\310\310\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\310\310" + "\0\310\310\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\310\310" + "\0\310\310\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\310\310\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\310\310\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0dd\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0dd\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\310\310\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\310\310\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\310\310\0\310" + "\310\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\310\310\0\310" + "\310\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\310\310\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\310\310\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0dd\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0dd\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\310\310\0\377\377\0\377\377\0\310\310" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\310\310\0\377\377\0\377\377\0\310\310\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\310\310\0\310\310" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\310\310\0\310\310" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\310\310\0\310\310\0\310\310\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\310\310" + "\0\310\310\0\310\310\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0dd\0\310\310\0\310\310\0\310\310\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\310" + "\310\0\310\310\0\310\310\0dd\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0dd\0\310\310\0\310\310\0dd\0\310\310\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\310\310\0" + "dd\0\310\310\0\310\310\0dd\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0dd\0dd\0\310\310\0\310\310\0\310\310\0\310\310" + "\0\377\377\0\377\377\0\377\377\0\310\310\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\310\310\0\377\377\0\377\377\0\377\377\0\310\310\0\310\310\0\310" + "\310\0\310\310\0dd\0dd\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0dd\0dd\0dd\0\310\310\0\377\377\0\310\310\0\310\310" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\310\310\0\310\310\0\377\377\0\310\310\0dd" + "\0dd\0dd\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0dd\0dd\0dd\0\310\310\0\377\377\0\377\377\0\310\310\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\310\310\0\377\377\0\377\377\0\310\310\0dd\0dd\0dd\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0dd\0dd" + "\0\0\0\0\0\0\0dd\0\377\377\0\310\310\0\310\310\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\310\310\0\310\310\0\377\377\0dd\0\0" + "\0\0\0\0\0dd\0dd\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0dd\0dd\0\0\0\0\0\0\0dd\0dd\0\0\0\0\0" + "\0\0dd\0dd\0\0\0\0\0\0\0dd\0dd\0dd\0dd\0dd\0dd\0dd\0dd\0dd\0dd\0dd\0dd\0" + "dd\0dd\0dd\0dd\0dd\0dd\0dd\0dd\0dd\0dd\0dd\0dd\0dd\0dd\0dd\0dd\0dd\0dd\0" + "dd\0dd\0dd\0dd\0dd\0dd\0dd\0dd\0dd\0dd\0\0\0\0\0\0\0dd\0dd\0\0\0\0\0\0\0" + "dd\0dd\0\0\0\0\0\0\0dd\0dd\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0dd\0dd\0\0\0\0" + "\0\0\0dd\0dd\0\0\0\0\0\0\0dd\0dd\0\0\0\0\0\0\0\310\310\0\310\310\0\0\0\0" + "\0\0\0\310\310\0\310\310\0\0\0\0\0\0\0\310\310\0\310\310\0\0\0\0\0\0\0\310" + "\310\0\310\310\0\0\0\0\0\0\0\310\310\0\310\310\0\0\0\0\0\0\0\310\310\0\310" + "\310\0\0\0\0\0\0\0\310\310\0\310\310\0\0\0\0\0\0\0\310\310\0\310\310\0\0" + "\0\0\0\0\0\310\310\0\310\310\0\0\0\0\0\0\0\310\310\0\310\310\0\0\0\0\0\0" + "\0dd\0dd\0\0\0\0\0\0\0dd\0dd\0\0\0\0\0\0\0dd\0dd\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0dd\0dd\0dd\0\0\0\0dd\0dd\0dd\0\0\0\0dd\0\310\310\0\310" + "\310\0dd\0dd\0\310\310\0\310\310\0dd\0dd\0\310\310\0\310\310\0dd\0dd\0\310" + "\310\0\310\310\0dd\0dd\0\310\310\0\310\310\0dd\0dd\0\310\310\0\310\310\0" + "dd\0dd\0\310\310\0\310\310\0dd\0dd\0\310\310\0\310\310\0dd\0dd\0\310\310" + "\0\310\310\0dd\0dd\0\310\310\0\310\310\0dd\0dd\0\310\310\0\310\310\0dd\0" + "\0\0\0dd\0dd\0dd\0\0\0\0dd\0dd\0dd\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0dd\0dd\0dd\0dd\0\310\310\0\310\310\0\310\310\0\310" + "\310\0\310\310\0\310\310\0\310\310\0\310\310\0\310\310\0\310\310\0\310\310" + "\0\310\310\0\310\310\0\310\310\0\310\310\0\310\310\0\310\310\0\310\310\0" + "\310\310\0\310\310\0\310\310\0\310\310\0\310\310\0\310\310\0\310\310\0\310" + "\310\0\310\310\0\310\310\0\310\310\0\310\310\0\310\310\0\310\310\0\310\310" + "\0\310\310\0\310\310\0\310\310\0\310\310\0\310\310\0\310\310\0\310\310\0" + "\310\310\0\310\310\0\310\310\0\310\310\0\310\310\0\310\310\0\310\310\0\310" + "\310\0dd\0dd\0dd\0dd\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", +}; + +/** + * \brief Returns the BlitBlendAdd test image as SDL_Surface. + */ +SDL_Surface *SDLTest_ImageBlitBlendAdd() +{ + 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.bytes_per_pixel, +#if (SDL_BYTEORDER == SDL_BIG_ENDIAN) + 0xff000000, /* Red bit mask. */ + 0x00ff0000, /* Green bit mask. */ + 0x0000ff00, /* Blue bit mask. */ + 0x000000ff /* Alpha bit mask. */ +#else + 0x000000ff, /* Red bit mask. */ + 0x0000ff00, /* Green bit mask. */ + 0x00ff0000, /* Blue bit mask. */ + 0xff000000 /* Alpha bit mask. */ +#endif + ); + return surface; +} + +const SDLTest_SurfaceImage_t SDLTest_imageBlitBlend = { + 80, 60, 3, + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0dd\0dd\0<<\0<<\0\240\240\0\240\240\0aa\0aa\0\240" + "\240\0\240\240\0aa\0aa\0\240\240\0\240\240\0aa\0aa\0\240\240\0\240\240\0" + "aa\0aa\0\240\240\0\240\240\0aa\0aa\0\240\240\0\240\240\0aa\0aa\0\240\240" + "\0\240\240\0aa\0aa\0\240\240\0\240\240\0aa\0aa\0\240\240\0\240\240\0aa\0" + "aa\0\240\240\0\240\240\0aa\0aa\0\240\240\0\240\240\0aa\0aa\0\240\240\0\240" + "\240\0\240\240\0\240\240\0dd\0dd\0dd\0dd\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0dd\0dd\0dd\0<<\0\240\240\0\240\240\0\240\240" + "\0aa\0\305\305\0\305\305\0\305\305\0ww\0\305\305\0\305\305\0\305\305\0ww" + "\0\305\305\0\305\305\0\305\305\0ww\0\305\305\0\305\305\0\305\305\0ww\0\305" + "\305\0\305\305\0\305\305\0ww\0\305\305\0\305\305\0\305\305\0ww\0\305\305" + "\0\305\305\0\305\305\0ww\0\305\305\0\305\305\0\305\305\0ww\0\305\305\0\305" + "\305\0\305\305\0ww\0\305\305\0\305\305\0\305\305\0ww\0\305\305\0\305\305" + "\0\305\305\0\305\305\0\240\240\0\240\240\0\240\240\0\240\240\0dd\0dd\0dd" + "\0dd\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0dd\0dd\0dd\0<<\0\240\240" + "\0\240\240\0\240\240\0aa\0\305\305\0\305\305\0\305\305\0ww\0\333\333\0\333" + "\333\0\305\305\0ww\0\333\333\0\333\333\0\305\305\0ww\0\333\333\0\333\333" + "\0\305\305\0ww\0\333\333\0\333\333\0\305\305\0ww\0\333\333\0\333\333\0\305" + "\305\0ww\0\333\333\0\333\333\0\305\305\0ww\0\333\333\0\333\333\0\305\305" + "\0ww\0\333\333\0\333\333\0\305\305\0ww\0\333\333\0\333\333\0\305\305\0ww" + "\0\333\333\0\333\333\0\305\305\0\305\305\0\305\305\0\305\305\0\240\240\0" + "\240\240\0\240\240\0\240\240\0dd\0dd\0dd\0dd\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0dd\0dd\0dd\0<<\0aa\0aa\0aa\0::\0HH\0HH\0HH\0++\0PP\0PP\0PP\0""00\0PP" + "\0PP\0PP\0""00\0PP\0PP\0PP\0""00\0PP\0PP\0PP\0""00\0PP\0PP\0PP\0""00\0PP" + "\0PP\0PP\0""00\0PP\0PP\0PP\0""00\0PP\0PP\0PP\0""00\0PP\0PP\0PP\0""00\0PP" + "\0PP\0PP\0PP\0HH\0HH\0HH\0HH\0aa\0aa\0aa\0aa\0dd\0dd\0dd\0dd\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0dd\0dd\0dd\0$$\0aa\0\305\305\0\305\305\0``\0\205\205\0\351\351\0" + "\351\351\0||\0\222\222\0\321\321\0\321\321\0\177\177\0\225\225\0\324\324" + "\0\321\321\0\177\177\0\225\225\0\324\324\0\321\321\0\177\177\0\225\225\0" + "\324\324\0\321\321\0\177\177\0\225\225\0\324\324\0\321\321\0\177\177\0\225" + "\225\0\324\324\0\321\321\0\177\177\0\225\225\0\324\324\0\321\321\0\177\177" + "\0\225\225\0\324\324\0\321\321\0\177\177\0\225\225\0\324\324\0\321\321\0" + "\177\177\0\225\225\0\324\324\0\321\321\0\222\222\0\222\222\0\321\321\0\314" + "\314\0\351\351\0\351\351\0\254\254\0\236\236\0\305\305\0\305\305\0aa\0<<" + "\0dd\0dd\0dd\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0dd\0dd\0<<\0dd\0\240\240\0\240\240\0aa\0\255\255" + "\0\322\322\0\322\322\0\177\177\0\315\315\0\343\343\0\343\343\0\211\211\0" + "\313\313\0\346\346\0\346\346\0\211\211\0\313\313\0\346\346\0\346\346\0\211" + "\211\0\313\313\0\346\346\0\346\346\0\211\211\0\313\313\0\346\346\0\346\346" + "\0\211\211\0\313\313\0\346\346\0\346\346\0\211\211\0\313\313\0\346\346\0" + "\346\346\0\211\211\0\313\313\0\346\346\0\346\346\0\211\211\0\313\313\0\346" + "\346\0\346\346\0\211\211\0\313\313\0\346\346\0\346\346\0\211\211\0\320\320" + "\0\327\327\0\327\327\0\322\322\0\276\276\0\322\322\0\322\322\0\305\305\0" + "yy\0\210\210\0\210\210\0dd\0<<\0dd\0dd\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0dd\0dd\0<<\0\210\210\0\240" + "\240\0\240\240\0aa\0\266\266\0\322\322\0\322\322\0\205\205\0\327\327\0\343" + "\343\0\343\343\0\215\215\0\346\346\0\357\357\0\331\331\0\222\222\0\347\347" + "\0\357\357\0\331\331\0\222\222\0\347\347\0\357\357\0\331\331\0\222\222\0" + "\347\347\0\357\357\0\331\331\0\222\222\0\347\347\0\357\357\0\331\331\0\222" + "\222\0\347\347\0\357\357\0\331\331\0\222\222\0\347\347\0\357\357\0\331\331" + "\0\222\222\0\347\347\0\357\357\0\331\331\0\222\222\0\347\347\0\357\357\0" + "\331\331\0\222\222\0\357\357\0\346\346\0\320\320\0\351\351\0\327\327\0\343" + "\343\0\276\276\0\333\333\0\322\322\0\266\266\0yy\0\240\240\0\210\210\0\240" + "\240\0<<\0dd\0dd\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0dd\0<<\0\240\240\0\210\210\0\240\240\0aa\0ww\0nn\0\177" + "\177\0MM\0SS\0OO\0SS\0""22\0WW\0TT\0XX\0""55\0UU\0UU\0XX\0""55\0UU\0UU\0" + "XX\0""55\0UU\0UU\0XX\0""55\0UU\0UU\0XX\0""55\0UU\0UU\0XX\0""55\0UU\0UU\0" + "XX\0""55\0UU\0UU\0XX\0""55\0UU\0UU\0XX\0""55\0UU\0XX\0TT\0TT\0LL\0OO\0SS" + "\0SS\0ss\0\177\177\0nn\0nn\0yy\0\210\210\0\240\240\0\240\240\0<<\0dd\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0<<" + "\0\240\240\0\240\240\0\210\210\0HH\0\205\205\0\351\351\0\333\333\0pp\0\225" + "\225\0\371\371\0\363\363\0\202\202\0\231\231\0\330\330\0\325\325\0\203\203" + "\0\231\231\0\331\331\0\324\324\0\203\203\0\231\231\0\331\331\0\324\324\0" + "\203\203\0\231\231\0\331\331\0\324\324\0\203\203\0\231\231\0\331\331\0\324" + "\324\0\203\203\0\231\231\0\331\331\0\324\324\0\203\203\0\231\231\0\331\331" + "\0\324\324\0\203\203\0\231\231\0\331\331\0\324\324\0\203\203\0\231\231\0" + "\331\331\0\324\324\0\203\203\0\231\231\0\331\331\0\325\325\0\231\231\0\231" + "\231\0\330\330\0\323\323\0\371\371\0\371\371\0\274\274\0\257\257\0\351\351" + "\0\351\351\0\205\205\0``\0\240\240\0\240\240\0\240\240\0<<\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0<<\0\240\240" + "\0\240\240\0RR\0\207\207\0\304\304\0\304\304\0nn\0\275\275\0\343\343\0\343" + "\343\0\205\205\0\324\324\0\352\352\0\352\352\0\214\214\0\316\316\0\352\352" + "\0\352\352\0\213\213\0\316\316\0\352\352\0\352\352\0\213\213\0\316\316\0" + "\352\352\0\352\352\0\213\213\0\316\316\0\352\352\0\352\352\0\213\213\0\316" + "\316\0\352\352\0\352\352\0\213\213\0\316\316\0\352\352\0\352\352\0\213\213" + "\0\316\316\0\352\352\0\352\352\0\213\213\0\316\316\0\352\352\0\352\352\0" + "\213\213\0\316\316\0\352\352\0\352\352\0\214\214\0\324\324\0\336\336\0\336" + "\336\0\331\331\0\310\310\0\343\343\0\343\343\0\325\325\0\217\217\0\254\254" + "\0\254\254\0\207\207\0aa\0\240\240\0\240\240\0<<\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\240\240\0\240\240\0aa" + "\0\225\225\0\304\304\0\304\304\0\205\205\0\276\276\0\343\343\0\340\340\0" + "\222\222\0\333\333\0\352\352\0\351\351\0\226\226\0\347\347\0\362\362\0\333" + "\333\0\230\230\0\351\351\0\361\361\0\333\333\0\230\230\0\351\351\0\361\361" + "\0\333\333\0\230\230\0\351\351\0\361\361\0\333\333\0\230\230\0\351\351\0" + "\361\361\0\333\333\0\230\230\0\351\351\0\361\361\0\333\333\0\230\230\0\351" + "\351\0\361\361\0\333\333\0\230\230\0\351\351\0\361\361\0\333\333\0\230\230" + "\0\351\351\0\361\361\0\333\333\0\230\230\0\362\362\0\351\351\0\323\323\0" + "\366\366\0\336\336\0\351\351\0\304\304\0\351\351\0\343\343\0\304\304\0\217" + "\217\0\333\333\0\254\254\0\266\266\0aa\0\240\240\0\240\240\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\240\240\0aa" + "\0\305\305\0\225\225\0\304\304\0ww\0\205\205\0ss\0\211\211\0RR\0VV\0PP\0" + "VV\0""33\0XX\0UU\0YY\0""66\0UU\0UU\0XX\0""66\0UU\0UU\0XX\0""66\0UU\0UU\0" + "XX\0""66\0UU\0UU\0XX\0""66\0UU\0UU\0XX\0""66\0UU\0UU\0XX\0""66\0UU\0UU\0" + "XX\0""66\0UU\0UU\0XX\0""66\0UU\0YY\0UU\0UU\0MM\0QQ\0UU\0UU\0ww\0\211\211" + "\0ww\0||\0\217\217\0\254\254\0\266\266\0\305\305\0aa\0\240\240\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0aa\0\305" + "\305\0\305\305\0\225\225\0UU\0\222\222\0\366\366\0\340\340\0tt\0\231\231" + "\0\375\375\0\364\364\0\203\203\0\231\231\0\331\331\0\326\326\0\203\203\0" + "\231\231\0\331\331\0\324\324\0\203\203\0\231\231\0\331\331\0\324\324\0\203" + "\203\0\231\231\0\331\331\0\324\324\0\203\203\0\231\231\0\331\331\0\324\324" + "\0\203\203\0\231\231\0\331\331\0\324\324\0\203\203\0\231\231\0\331\331\0" + "\324\324\0\203\203\0\231\231\0\331\331\0\324\324\0\203\203\0\231\231\0\331" + "\331\0\324\324\0\203\203\0\231\231\0\331\331\0\326\326\0\231\231\0\231\231" + "\0\331\331\0\324\324\0\373\373\0\375\375\0\300\300\0\263\263\0\361\361\0" + "\366\366\0\222\222\0mm\0\266\266\0\305\305\0\305\305\0aa\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0<<\0\305\305\0" + "\305\305\0``\0\214\214\0\321\321\0\321\321\0rr\0\277\277\0\346\346\0\346" + "\346\0\206\206\0\324\324\0\353\353\0\353\353\0\215\215\0\316\316\0\353\353" + "\0\353\353\0\213\213\0\316\316\0\353\353\0\353\353\0\213\213\0\316\316\0" + "\353\353\0\353\353\0\213\213\0\316\316\0\353\353\0\353\353\0\213\213\0\316" + "\316\0\353\353\0\353\353\0\213\213\0\316\316\0\353\353\0\353\353\0\213\213" + "\0\316\316\0\353\353\0\353\353\0\213\213\0\316\316\0\353\353\0\353\353\0" + "\213\213\0\316\316\0\353\353\0\353\353\0\215\215\0\324\324\0\337\337\0\337" + "\337\0\331\331\0\312\312\0\346\346\0\346\346\0\330\330\0\224\224\0\271\271" + "\0\271\271\0\217\217\0nn\0\305\305\0\305\305\0<<\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\240\240\0\305\305\0ww" + "\0\225\225\0\304\304\0\314\314\0\222\222\0\277\277\0\343\343\0\342\342\0" + "\226\226\0\333\333\0\352\352\0\351\351\0\227\227\0\350\350\0\362\362\0\333" + "\333\0\230\230\0\351\351\0\361\361\0\333\333\0\230\230\0\351\351\0\361\361" + "\0\333\333\0\230\230\0\351\351\0\361\361\0\333\333\0\230\230\0\351\351\0" + "\361\361\0\333\333\0\230\230\0\351\351\0\361\361\0\333\333\0\230\230\0\351" + "\351\0\361\361\0\333\333\0\230\230\0\351\351\0\361\361\0\333\333\0\230\230" + "\0\351\351\0\361\361\0\333\333\0\230\230\0\362\362\0\351\351\0\323\323\0" + "\370\370\0\336\336\0\352\352\0\306\306\0\354\354\0\344\344\0\305\305\0\227" + "\227\0\343\343\0\254\254\0\266\266\0ww\0\305\305\0\240\240\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\240\240\0aa" + "\0\333\333\0\236\236\0\304\304\0ww\0\210\210\0tt\0\211\211\0RR\0VV\0PP\0" + "VV\0""33\0XX\0UU\0YY\0""66\0UU\0UU\0XX\0""66\0UU\0UU\0XX\0""66\0UU\0UU\0" + "XX\0""66\0UU\0UU\0XX\0""66\0UU\0UU\0XX\0""66\0UU\0UU\0XX\0""66\0UU\0UU\0" + "XX\0""66\0UU\0UU\0XX\0""66\0UU\0YY\0UU\0UU\0MM\0QQ\0UU\0UU\0ww\0\211\211" + "\0ww\0}}\0\217\217\0\254\254\0\276\276\0\333\333\0aa\0\240\240\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0aa\0\305" + "\305\0\305\305\0\236\236\0XX\0\222\222\0\366\366\0\341\341\0tt\0\231\231" + "\0\375\375\0\364\364\0\203\203\0\231\231\0\331\331\0\326\326\0\203\203\0" + "\231\231\0\331\331\0\324\324\0\203\203\0\231\231\0\331\331\0\324\324\0\203" + "\203\0\231\231\0\331\331\0\324\324\0\203\203\0\231\231\0\331\331\0\324\324" + "\0\203\203\0\231\231\0\331\331\0\324\324\0\203\203\0\231\231\0\331\331\0" + "\324\324\0\203\203\0\231\231\0\331\331\0\324\324\0\203\203\0\231\231\0\331" + "\331\0\324\324\0\203\203\0\231\231\0\331\331\0\326\326\0\231\231\0\231\231" + "\0\331\331\0\324\324\0\373\373\0\375\375\0\300\300\0\263\263\0\361\361\0" + "\366\366\0\222\222\0pp\0\276\276\0\305\305\0\305\305\0aa\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0<<\0\305\305\0" + "\305\305\0``\0\217\217\0\324\324\0\324\324\0rr\0\300\300\0\347\347\0\347" + "\347\0\206\206\0\324\324\0\353\353\0\353\353\0\215\215\0\316\316\0\353\353" + "\0\353\353\0\213\213\0\316\316\0\353\353\0\353\353\0\213\213\0\316\316\0" + "\353\353\0\353\353\0\213\213\0\316\316\0\353\353\0\353\353\0\213\213\0\316" + "\316\0\353\353\0\353\353\0\213\213\0\316\316\0\353\353\0\353\353\0\213\213" + "\0\316\316\0\353\353\0\353\353\0\213\213\0\316\316\0\353\353\0\353\353\0" + "\213\213\0\316\316\0\353\353\0\353\353\0\215\215\0\324\324\0\337\337\0\337" + "\337\0\332\332\0\312\312\0\347\347\0\347\347\0\330\330\0\224\224\0\274\274" + "\0\274\274\0\222\222\0nn\0\305\305\0\305\305\0<<\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\240\240\0\305\305\0ww" + "\0\225\225\0\304\304\0\314\314\0\225\225\0\300\300\0\344\344\0\342\342\0" + "\226\226\0\333\333\0\352\352\0\351\351\0\227\227\0\350\350\0\362\362\0\333" + "\333\0\230\230\0\351\351\0\361\361\0\333\333\0\230\230\0\351\351\0\361\361" + "\0\333\333\0\230\230\0\351\351\0\361\361\0\333\333\0\230\230\0\351\351\0" + "\361\361\0\333\333\0\230\230\0\351\351\0\361\361\0\333\333\0\230\230\0\351" + "\351\0\361\361\0\333\333\0\230\230\0\351\351\0\361\361\0\333\333\0\230\230" + "\0\351\351\0\361\361\0\333\333\0\230\230\0\362\362\0\351\351\0\323\323\0" + "\370\370\0\337\337\0\352\352\0\306\306\0\355\355\0\345\345\0\306\306\0\231" + "\231\0\343\343\0\254\254\0\266\266\0ww\0\305\305\0\240\240\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\240\240\0aa" + "\0\333\333\0\236\236\0\304\304\0ww\0\210\210\0tt\0\211\211\0RR\0VV\0PP\0" + "VV\0""33\0XX\0UU\0YY\0""66\0UU\0UU\0XX\0""66\0UU\0UU\0XX\0""66\0UU\0UU\0" + "XX\0""66\0UU\0UU\0XX\0""66\0UU\0UU\0XX\0""66\0UU\0UU\0XX\0""66\0UU\0UU\0" + "XX\0""66\0UU\0UU\0XX\0""66\0UU\0YY\0UU\0UU\0MM\0QQ\0UU\0UU\0ww\0\211\211" + "\0ww\0}}\0\217\217\0\254\254\0\276\276\0\333\333\0aa\0\240\240\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0aa\0\305" + "\305\0\305\305\0\236\236\0XX\0\222\222\0\366\366\0\341\341\0tt\0\231\231" + "\0\375\375\0\364\364\0\203\203\0\231\231\0\331\331\0\326\326\0\203\203\0" + "\231\231\0\331\331\0\324\324\0\203\203\0\231\231\0\331\331\0\324\324\0\203" + "\203\0\231\231\0\331\331\0\324\324\0\203\203\0\231\231\0\331\331\0\324\324" + "\0\203\203\0\231\231\0\331\331\0\324\324\0\203\203\0\231\231\0\331\331\0" + "\324\324\0\203\203\0\231\231\0\331\331\0\324\324\0\203\203\0\231\231\0\331" + "\331\0\324\324\0\203\203\0\231\231\0\331\331\0\326\326\0\231\231\0\231\231" + "\0\331\331\0\324\324\0\373\373\0\375\375\0\300\300\0\263\263\0\361\361\0" + "\366\366\0\222\222\0pp\0\276\276\0\305\305\0\305\305\0aa\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0<<\0\305\305\0" + "\305\305\0``\0\217\217\0\324\324\0\324\324\0rr\0\300\300\0\347\347\0\347" + "\347\0\206\206\0\324\324\0\353\353\0\353\353\0\215\215\0\316\316\0\353\353" + "\0\353\353\0\213\213\0\316\316\0\353\353\0\353\353\0\213\213\0\316\316\0" + "\353\353\0\353\353\0\213\213\0\316\316\0\353\353\0\353\353\0\213\213\0\316" + "\316\0\353\353\0\353\353\0\213\213\0\316\316\0\353\353\0\353\353\0\213\213" + "\0\316\316\0\353\353\0\353\353\0\213\213\0\316\316\0\353\353\0\353\353\0" + "\213\213\0\316\316\0\353\353\0\353\353\0\215\215\0\324\324\0\337\337\0\337" + "\337\0\332\332\0\312\312\0\347\347\0\347\347\0\330\330\0\224\224\0\274\274" + "\0\274\274\0\222\222\0nn\0\305\305\0\305\305\0<<\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\240\240\0\305\305\0ww" + "\0\225\225\0\304\304\0\314\314\0\225\225\0\300\300\0\344\344\0\342\342\0" + "\226\226\0\333\333\0\352\352\0\351\351\0\227\227\0\350\350\0\362\362\0\333" + "\333\0\230\230\0\351\351\0\361\361\0\333\333\0\230\230\0\351\351\0\361\361" + "\0\333\333\0\230\230\0\351\351\0\361\361\0\333\333\0\230\230\0\351\351\0" + "\361\361\0\333\333\0\230\230\0\351\351\0\361\361\0\333\333\0\230\230\0\351" + "\351\0\361\361\0\333\333\0\230\230\0\351\351\0\361\361\0\333\333\0\230\230" + "\0\351\351\0\361\361\0\333\333\0\230\230\0\362\362\0\351\351\0\323\323\0" + "\370\370\0\337\337\0\352\352\0\306\306\0\355\355\0\345\345\0\306\306\0\231" + "\231\0\343\343\0\254\254\0\266\266\0ww\0\305\305\0\240\240\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\240\240\0aa" + "\0\333\333\0\236\236\0\304\304\0ww\0\210\210\0tt\0\211\211\0RR\0VV\0PP\0" + "VV\0""33\0XX\0UU\0YY\0""66\0UU\0UU\0XX\0""66\0UU\0UU\0XX\0""66\0UU\0UU\0" + "XX\0""66\0UU\0UU\0XX\0""66\0UU\0UU\0XX\0""66\0UU\0UU\0XX\0""66\0UU\0UU\0" + "XX\0""66\0UU\0UU\0XX\0""66\0UU\0YY\0UU\0UU\0MM\0QQ\0UU\0UU\0ww\0\211\211" + "\0ww\0}}\0\217\217\0\254\254\0\276\276\0\333\333\0aa\0\240\240\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0aa\0\305" + "\305\0\305\305\0\236\236\0XX\0\222\222\0\366\366\0\341\341\0tt\0\231\231" + "\0\375\375\0\364\364\0\203\203\0\231\231\0\331\331\0\326\326\0\203\203\0" + "\231\231\0\331\331\0\324\324\0\203\203\0\231\231\0\331\331\0\324\324\0\203" + "\203\0\231\231\0\331\331\0\324\324\0\203\203\0\231\231\0\331\331\0\324\324" + "\0\203\203\0\231\231\0\331\331\0\324\324\0\203\203\0\231\231\0\331\331\0" + "\324\324\0\203\203\0\231\231\0\331\331\0\324\324\0\203\203\0\231\231\0\331" + "\331\0\324\324\0\203\203\0\231\231\0\331\331\0\326\326\0\231\231\0\231\231" + "\0\331\331\0\324\324\0\373\373\0\375\375\0\300\300\0\263\263\0\361\361\0" + "\366\366\0\222\222\0pp\0\276\276\0\305\305\0\305\305\0aa\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0<<\0\305\305\0" + "\305\305\0``\0\217\217\0\324\324\0\324\324\0rr\0\300\300\0\347\347\0\347" + "\347\0\206\206\0\324\324\0\353\353\0\353\353\0\215\215\0\316\316\0\353\353" + "\0\353\353\0\213\213\0\316\316\0\353\353\0\353\353\0\213\213\0\316\316\0" + "\353\353\0\353\353\0\213\213\0\316\316\0\353\353\0\353\353\0\213\213\0\316" + "\316\0\353\353\0\353\353\0\213\213\0\316\316\0\353\353\0\353\353\0\213\213" + "\0\316\316\0\353\353\0\353\353\0\213\213\0\316\316\0\353\353\0\353\353\0" + "\213\213\0\316\316\0\353\353\0\353\353\0\215\215\0\324\324\0\337\337\0\337" + "\337\0\332\332\0\312\312\0\347\347\0\347\347\0\330\330\0\224\224\0\274\274" + "\0\274\274\0\222\222\0nn\0\305\305\0\305\305\0<<\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\240\240\0\305\305\0ww" + "\0\225\225\0\304\304\0\314\314\0\225\225\0\300\300\0\344\344\0\342\342\0" + "\226\226\0\333\333\0\352\352\0\351\351\0\227\227\0\350\350\0\362\362\0\333" + "\333\0\230\230\0\351\351\0\361\361\0\333\333\0\230\230\0\351\351\0\361\361" + "\0\333\333\0\230\230\0\351\351\0\361\361\0\333\333\0\230\230\0\351\351\0" + "\361\361\0\333\333\0\230\230\0\351\351\0\361\361\0\333\333\0\230\230\0\351" + "\351\0\361\361\0\333\333\0\230\230\0\351\351\0\361\361\0\333\333\0\230\230" + "\0\351\351\0\361\361\0\333\333\0\230\230\0\362\362\0\351\351\0\323\323\0" + "\370\370\0\337\337\0\352\352\0\306\306\0\355\355\0\345\345\0\306\306\0\231" + "\231\0\343\343\0\254\254\0\266\266\0ww\0\305\305\0\240\240\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\240\240\0aa" + "\0\333\333\0\236\236\0\304\304\0ww\0\210\210\0tt\0\211\211\0RR\0VV\0PP\0" + "VV\0""33\0XX\0UU\0YY\0""66\0UU\0UU\0XX\0""66\0UU\0UU\0XX\0""66\0UU\0UU\0" + "XX\0""66\0UU\0UU\0XX\0""66\0UU\0UU\0XX\0""66\0UU\0UU\0XX\0""66\0UU\0UU\0" + "XX\0""66\0UU\0UU\0XX\0""66\0UU\0YY\0UU\0UU\0MM\0QQ\0UU\0UU\0ww\0\211\211" + "\0ww\0}}\0\217\217\0\254\254\0\276\276\0\333\333\0aa\0\240\240\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0aa\0\305" + "\305\0\305\305\0\236\236\0XX\0\222\222\0\366\366\0\341\341\0tt\0\231\231" + "\0\375\375\0\364\364\0\203\203\0\231\231\0\331\331\0\326\326\0\203\203\0" + "\231\231\0\331\331\0\324\324\0\203\203\0\231\231\0\331\331\0\324\324\0\203" + "\203\0\231\231\0\331\331\0\324\324\0\203\203\0\231\231\0\331\331\0\324\324" + "\0\203\203\0\231\231\0\331\331\0\324\324\0\203\203\0\231\231\0\331\331\0" + "\324\324\0\203\203\0\231\231\0\331\331\0\324\324\0\203\203\0\231\231\0\331" + "\331\0\324\324\0\203\203\0\231\231\0\331\331\0\326\326\0\231\231\0\231\231" + "\0\331\331\0\324\324\0\373\373\0\375\375\0\300\300\0\263\263\0\361\361\0" + "\366\366\0\222\222\0pp\0\276\276\0\305\305\0\305\305\0aa\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0<<\0\305\305\0" + "\305\305\0``\0\217\217\0\324\324\0\324\324\0rr\0\300\300\0\347\347\0\347" + "\347\0\206\206\0\324\324\0\353\353\0\353\353\0\215\215\0\316\316\0\353\353" + "\0\353\353\0\213\213\0\316\316\0\353\353\0\353\353\0\213\213\0\316\316\0" + "\353\353\0\353\353\0\213\213\0\316\316\0\353\353\0\353\353\0\213\213\0\316" + "\316\0\353\353\0\353\353\0\213\213\0\316\316\0\353\353\0\353\353\0\213\213" + "\0\316\316\0\353\353\0\353\353\0\213\213\0\316\316\0\353\353\0\353\353\0" + "\213\213\0\316\316\0\353\353\0\353\353\0\215\215\0\324\324\0\337\337\0\337" + "\337\0\332\332\0\312\312\0\347\347\0\347\347\0\330\330\0\224\224\0\274\274" + "\0\274\274\0\222\222\0nn\0\305\305\0\305\305\0<<\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\240\240\0\305\305\0ww" + "\0\225\225\0\304\304\0\314\314\0\225\225\0\300\300\0\344\344\0\342\342\0" + "\226\226\0\333\333\0\352\352\0\351\351\0\227\227\0\350\350\0\362\362\0\333" + "\333\0\230\230\0\351\351\0\361\361\0\333\333\0\230\230\0\351\351\0\361\361" + "\0\333\333\0\230\230\0\351\351\0\361\361\0\333\333\0\230\230\0\351\351\0" + "\361\361\0\333\333\0\230\230\0\351\351\0\361\361\0\333\333\0\230\230\0\351" + "\351\0\361\361\0\333\333\0\230\230\0\351\351\0\361\361\0\333\333\0\230\230" + "\0\351\351\0\361\361\0\333\333\0\230\230\0\362\362\0\351\351\0\323\323\0" + "\370\370\0\337\337\0\352\352\0\306\306\0\355\355\0\345\345\0\306\306\0\231" + "\231\0\343\343\0\254\254\0\266\266\0ww\0\305\305\0\240\240\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\240\240\0aa" + "\0\333\333\0\236\236\0\304\304\0ww\0\340\340\0\300\300\0\343\343\0\210\210" + "\0\354\354\0\333\333\0\352\352\0\215\215\0\361\361\0\350\350\0\362\362\0" + "\223\223\0\351\351\0\351\351\0\361\361\0\223\223\0\351\351\0\351\351\0\361" + "\361\0\223\223\0\351\351\0\351\351\0\361\361\0\223\223\0\351\351\0\351\351" + "\0\361\361\0\223\223\0\351\351\0\351\351\0\361\361\0\223\223\0\351\351\0" + "\351\351\0\361\361\0\223\223\0\351\351\0\351\351\0\361\361\0\223\223\0\351" + "\351\0\351\351\0\361\361\0\223\223\0\351\351\0\362\362\0\351\351\0\351\351" + "\0\323\323\0\336\336\0\351\351\0\351\351\0\304\304\0\343\343\0\305\305\0" + "\317\317\0\217\217\0\254\254\0\276\276\0\333\333\0aa\0\240\240\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0aa\0\305" + "\305\0\305\305\0\236\236\0\222\222\0\361\361\0\361\361\0\316\316\0\230\230" + "\0\373\373\0\373\373\0\344\344\0\231\231\0\375\375\0\375\375\0\357\357\0" + "\231\231\0\375\375\0\375\375\0\347\347\0\231\231\0\375\375\0\375\375\0\347" + "\347\0\231\231\0\375\375\0\375\375\0\347\347\0\231\231\0\375\375\0\375\375" + "\0\347\347\0\231\231\0\375\375\0\375\375\0\347\347\0\231\231\0\375\375\0" + "\375\375\0\347\347\0\231\231\0\375\375\0\375\375\0\347\347\0\231\231\0\375" + "\375\0\375\375\0\347\347\0\231\231\0\375\375\0\375\375\0\360\360\0\373\373" + "\0\375\375\0\375\375\0\347\347\0\367\367\0\373\373\0\373\373\0\326\326\0" + "\351\351\0\361\361\0\361\361\0\271\271\0\276\276\0\305\305\0\305\305\0aa" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0<<\0\305\305\0\305\305\0\236\236\0HH\0\271\271\0\271\271\0\224\224\0VV" + "\0\277\277\0\277\277\0\251\251\0DD\0\252\252\0\252\252\0\235\235\0FF\0\253" + "\253\0\253\253\0\224\224\0EE\0\253\253\0\253\253\0\224\224\0EE\0\253\253" + "\0\253\253\0\224\224\0EE\0\253\253\0\253\253\0\224\224\0EE\0\253\253\0\253" + "\253\0\224\224\0EE\0\253\253\0\253\253\0\224\224\0EE\0\253\253\0\253\253" + "\0\224\224\0EE\0\253\253\0\253\253\0\224\224\0EE\0\253\253\0\253\253\0\235" + "\235\0rr\0uu\0uu\0^^\0\272\272\0\277\277\0\277\277\0\230\230\0\205\205\0" + "\222\222\0\222\222\0MM\0\266\266\0\305\305\0\305\305\0<<\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\240\240\0\305" + "\305\0\305\305\0RR\0\236\236\0\254\254\0\361\361\0VV\0\267\267\0\263\263" + "\0\356\356\0ee\0\247\247\0\244\244\0\356\356\0^^\0\251\251\0\247\247\0\365" + "\365\0bb\0\242\242\0\247\247\0\365\365\0bb\0\242\242\0\247\247\0\365\365" + "\0bb\0\242\242\0\247\247\0\365\365\0bb\0\242\242\0\247\247\0\365\365\0bb" + "\0\242\242\0\247\247\0\365\365\0bb\0\242\242\0\247\247\0\365\365\0bb\0\242" + "\242\0\247\247\0\365\365\0bb\0\242\242\0\247\247\0\365\365\0\252\252\0ee" + "\0jj\0\345\345\0tt\0\246\246\0\251\251\0\321\321\0\272\272\0ff\0\222\222" + "\0\322\322\0ww\0\210\210\0\305\305\0\305\305\0\240\240\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\240\240\0\240\240" + "\0\305\305\0``\0\236\236\0\236\236\0\254\254\0VV\0\264\264\0\254\254\0\261" + "\261\0dd\0\246\246\0\240\240\0\243\243\0^^\0\251\251\0\246\246\0\246\246" + "\0bb\0\242\242\0\246\246\0\246\246\0bb\0\242\242\0\246\246\0\246\246\0bb" + "\0\242\242\0\246\246\0\246\246\0bb\0\242\242\0\246\246\0\246\246\0bb\0\242" + "\242\0\246\246\0\246\246\0bb\0\242\242\0\246\246\0\246\246\0bb\0\242\242" + "\0\246\246\0\246\246\0bb\0\242\242\0\246\246\0\246\246\0\251\251\0dd\0hh" + "\0hh\0pp\0\243\243\0\240\240\0\236\236\0\264\264\0cc\0\177\177\0ww\0ww\0" + "\225\225\0\305\305\0\240\240\0\240\240\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\240\240\0\240\240\0\240\240\0``" + "\0\351\351\0\333\333\0\333\333\0||\0\366\366\0\361\361\0\361\361\0\211\211" + "\0\373\373\0\371\371\0\371\371\0\221\221\0\375\375\0\374\374\0\374\374\0" + "\224\224\0\365\365\0\374\374\0\374\374\0\224\224\0\365\365\0\374\374\0\374" + "\374\0\224\224\0\365\365\0\374\374\0\374\374\0\224\224\0\365\365\0\374\374" + "\0\374\374\0\224\224\0\365\365\0\374\374\0\374\374\0\224\224\0\365\365\0" + "\374\374\0\374\374\0\224\224\0\365\365\0\374\374\0\374\374\0\224\224\0\365" + "\365\0\374\374\0\374\374\0\375\375\0\356\356\0\371\371\0\371\371\0\372\372" + "\0\340\340\0\361\361\0\361\361\0\364\364\0\307\307\0\333\333\0\333\333\0" + "\351\351\0\225\225\0\240\240\0\240\240\0\240\240\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0dd\0\240\240\0\240\240" + "\0aa\0\304\304\0\351\351\0\351\351\0\205\205\0\340\340\0\366\366\0\366\366" + "\0\222\222\0\355\355\0\373\373\0\373\373\0\227\227\0\364\364\0\375\375\0" + "\375\375\0\230\230\0\360\360\0\375\375\0\375\375\0\230\230\0\360\360\0\375" + "\375\0\375\375\0\230\230\0\360\360\0\375\375\0\375\375\0\230\230\0\360\360" + "\0\375\375\0\375\375\0\230\230\0\360\360\0\375\375\0\375\375\0\230\230\0" + "\360\360\0\375\375\0\375\375\0\230\230\0\360\360\0\375\375\0\375\375\0\230" + "\230\0\360\360\0\375\375\0\375\375\0\373\373\0\356\356\0\373\373\0\373\373" + "\0\367\367\0\340\340\0\364\364\0\364\364\0\354\354\0\304\304\0\351\351\0" + "\351\351\0\322\322\0\210\210\0\240\240\0\240\240\0dd\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0dd\0\240\240\0\240" + "\240\0<<\0\240\240\0\305\305\0\351\351\0ww\0\320\320\0\301\301\0\324\324" + "\0\211\211\0\345\345\0\316\316\0\324\324\0\217\217\0\356\356\0\323\323\0" + "\326\326\0\223\223\0\354\354\0\323\323\0\326\326\0\223\223\0\354\354\0\323" + "\323\0\326\326\0\223\223\0\354\354\0\323\323\0\326\326\0\223\223\0\354\354" + "\0\323\323\0\326\326\0\223\223\0\354\354\0\323\323\0\326\326\0\223\223\0" + "\354\354\0\323\323\0\326\326\0\223\223\0\354\354\0\323\323\0\326\326\0\223" + "\223\0\354\354\0\323\323\0\326\326\0\362\362\0\344\344\0\261\261\0\272\272" + "\0\364\364\0\340\340\0\225\225\0\205\205\0\340\340\0\276\276\0\351\351\0" + "\266\266\0\240\240\0dd\0\240\240\0\240\240\0dd\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0dd\0dd\0\240\240\0aa\0\240" + "\240\0\240\240\0\305\305\0ww\0\305\305\0\240\240\0\266\266\0\205\205\0\333" + "\333\0\266\266\0\304\304\0\215\215\0\352\352\0\305\305\0\314\314\0\222\222" + "\0\352\352\0\305\305\0\314\314\0\222\222\0\352\352\0\305\305\0\314\314\0" + "\222\222\0\352\352\0\305\305\0\314\314\0\222\222\0\352\352\0\305\305\0\314" + "\314\0\222\222\0\352\352\0\305\305\0\314\314\0\222\222\0\352\352\0\305\305" + "\0\314\314\0\222\222\0\352\352\0\305\305\0\314\314\0\222\222\0\352\352\0" + "\305\305\0\314\314\0\361\361\0\335\335\0\242\242\0\236\236\0\333\333\0\312" + "\312\0ii\0aa\0\305\305\0\255\255\0\266\266\0\240\240\0\240\240\0\210\210" + "\0\240\240\0dd\0dd\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0dd\0dd\0dd\0aa\0\305\305\0\240\240\0\240\240\0ww\0\333" + "\333\0\305\305\0\305\305\0\205\205\0\351\351\0\333\333\0\333\333\0\217\217" + "\0\363\363\0\351\351\0\351\351\0\223\223\0\357\357\0\351\351\0\351\351\0" + "\223\223\0\357\357\0\351\351\0\351\351\0\223\223\0\357\357\0\351\351\0\351" + "\351\0\223\223\0\357\357\0\351\351\0\351\351\0\223\223\0\357\357\0\351\351" + "\0\351\351\0\223\223\0\357\357\0\351\351\0\351\351\0\223\223\0\357\357\0" + "\351\351\0\351\351\0\223\223\0\357\357\0\351\351\0\351\351\0\363\363\0\345" + "\345\0\333\333\0\333\333\0\340\340\0\312\312\0\305\305\0\305\305\0\322\322" + "\0\255\255\0\240\240\0\240\240\0\305\305\0\210\210\0dd\0dd\0dd\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0dd" + "\0dd\0dd\0aa\0\305\305\0\305\305\0\240\240\0ww\0\333\333\0\333\333\0\305" + "\305\0\205\205\0\355\355\0\355\355\0\336\336\0\215\215\0\364\364\0\364\364" + "\0\335\335\0\215\215\0\364\364\0\364\364\0\335\335\0\215\215\0\364\364\0" + "\364\364\0\335\335\0\215\215\0\364\364\0\364\364\0\335\335\0\215\215\0\364" + "\364\0\364\364\0\335\335\0\215\215\0\364\364\0\364\364\0\335\335\0\215\215" + "\0\364\364\0\364\364\0\335\335\0\215\215\0\364\364\0\364\364\0\335\335\0" + "\215\215\0\364\364\0\364\364\0\335\335\0\351\351\0\355\355\0\355\355\0\312" + "\312\0\305\305\0\322\322\0\322\322\0\255\255\0\240\240\0\305\305\0\305\305" + "\0\210\210\0dd\0dd\0dd\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0dd\0dd\0\0\0\0\0\0\0dd\0\305\305\0aa" + "\0""11\0\225\225\0\351\351\0\205\205\0HH\0\254\254\0\333\333\0ww\0BB\0\264" + "\264\0\340\340\0nn\0BB\0\264\264\0\340\340\0nn\0BB\0\264\264\0\340\340\0" + "nn\0BB\0\264\264\0\340\340\0nn\0BB\0\264\264\0\340\340\0nn\0BB\0\264\264" + "\0\340\340\0nn\0BB\0\264\264\0\340\340\0nn\0BB\0\264\264\0\340\340\0nn\0" + "BB\0\264\264\0\340\340\0nn\0nn\0\205\205\0\314\314\0\266\266\0\304\304\0" + "\351\351\0\236\236\0yy\0\210\210\0\305\305\0<<\0\0\0\0\0\0\0dd\0dd\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0dd\0dd\0\0\0\0\0\0\0dd\0dd\0\0\0\0\0\0\0dd\0dd\0\0\0\0\0\0" + "\0dd\0dd\0\25\25\0\14\14\0dd\0dd\0\25\25\0\14\14\0dd\0dd\0\25\25\0\14\14" + "\0dd\0dd\0\25\25\0\14\14\0dd\0dd\0\25\25\0\14\14\0dd\0dd\0\25\25\0\14\14" + "\0dd\0dd\0\25\25\0\14\14\0dd\0dd\0\25\25\0\14\14\0dd\0dd\0\25\25\0\14\14" + "\0dd\0dd\0\25\25\0\25\25\0\0\0\0\0\0\0$$\0$$\0\0\0\0\0\0\0<<\0<<\0\0\0\0" + "\0\0\0dd\0dd\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0dd\0dd\0\0\0\0\0\0\0dd\0dd\0" + "\0\0\0\0\0\0dd\0dd\0\0\0\0\0\0\0yy\0yy\0\0\0\0\0\0\0yy\0yy\0\0\0\0\0\0\0" + "yy\0yy\0\0\0\0\0\0\0yy\0yy\0\0\0\0\0\0\0yy\0yy\0\0\0\0\0\0\0yy\0yy\0\0\0" + "\0\0\0\0yy\0yy\0\0\0\0\0\0\0yy\0yy\0\0\0\0\0\0\0yy\0yy\0\0\0\0\0\0\0yy\0" + "yy\0\0\0\0\0\0\0$$\0$$\0\0\0\0\0\0\0<<\0<<\0\0\0\0\0\0\0dd\0dd\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0dd\0dd\0dd\0\0\0\0dd\0dd\0dd\0\0\0\0dd" + "\0\210\210\0\210\210\0\25\25\0dd\0\210\210\0\210\210\0\25\25\0dd\0\210\210" + "\0\210\210\0\25\25\0dd\0\210\210\0\210\210\0\25\25\0dd\0\210\210\0\210\210" + "\0\25\25\0dd\0\210\210\0\210\210\0\25\25\0dd\0\210\210\0\210\210\0\25\25" + "\0dd\0\210\210\0\210\210\0\25\25\0dd\0\210\210\0\210\210\0\25\25\0dd\0\210" + "\210\0\210\210\0\25\25\0dd\0\210\210\0\210\210\0$$\0\0\0\0<<\0<<\0<<\0\0" + "\0\0dd\0dd\0dd\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0dd\0dd\0<<\0<<\0\240\240\0\240\240\0aa\0aa\0\240\240\0\240\240\0aa\0" + "aa\0\240\240\0\240\240\0aa\0aa\0\240\240\0\240\240\0aa\0aa\0\240\240\0\240" + "\240\0aa\0aa\0\240\240\0\240\240\0aa\0aa\0\240\240\0\240\240\0aa\0aa\0\240" + "\240\0\240\240\0aa\0aa\0\240\240\0\240\240\0aa\0aa\0\240\240\0\240\240\0" + "aa\0aa\0\240\240\0\240\240\0aa\0aa\0\240\240\0\240\240\0\240\240\0\240\240" + "\0dd\0dd\0dd\0dd\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", +}; + +/** + * \brief Returns the BlitBlend test image as SDL_Surface. + */ +SDL_Surface *SDLTest_ImageBlitBlend() +{ + 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.bytes_per_pixel, +#if (SDL_BYTEORDER == SDL_BIG_ENDIAN) + 0xff000000, /* Red bit mask. */ + 0x00ff0000, /* Green bit mask. */ + 0x0000ff00, /* Blue bit mask. */ + 0x000000ff /* Alpha bit mask. */ +#else + 0x000000ff, /* Red bit mask. */ + 0x0000ff00, /* Green bit mask. */ + 0x00ff0000, /* Blue bit mask. */ + 0xff000000 /* Alpha bit mask. */ +#endif + ); + return surface; +} + +const SDLTest_SurfaceImage_t SDLTest_imageBlitBlendMod = { + 80, 60, 3, + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", +}; + +/** + * \brief Returns the BlitBlendMod test image as SDL_Surface. + */ +SDL_Surface *SDLTest_ImageBlitBlendMod() +{ + 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.bytes_per_pixel, +#if (SDL_BYTEORDER == SDL_BIG_ENDIAN) + 0xff000000, /* Red bit mask. */ + 0x00ff0000, /* Green bit mask. */ + 0x0000ff00, /* Blue bit mask. */ + 0x000000ff /* Alpha bit mask. */ +#else + 0x000000ff, /* Red bit mask. */ + 0x0000ff00, /* Green bit mask. */ + 0x00ff0000, /* Blue bit mask. */ + 0xff000000 /* Alpha bit mask. */ +#endif + ); + return surface; +} + +const SDLTest_SurfaceImage_t SDLTest_imageBlitBlendNone = { + 80, 60, 3, + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\0\0\0\0\0\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\0\0\0\0\0\0\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\0\0\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\0\0\0\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\0\0\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\0\0\0\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\0\0\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\0\0\0\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\0\0\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\0\0\0\377" + "\377\0\377\377\0\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\0\377\377\0\377\377\0\0" + "\0\0\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\0\0\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\377\0\0\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\377\0\0\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\0\0\0\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\0\0\0\377\377\0\377\377\0\377\377\0\377\377\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\377\377\0\377\377\0\377\377\0\377\377\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\0\0\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\0\0\0\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\0\0\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\0\0\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\0\0\0\0\0\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\0\0\0\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\0\0\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\0\0\0\0\0\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\0\0\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0" + "\377\377\0\0\0\0\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\0\0\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377" + "\0\377\377\0\377\377\0\377\377\0\377\377\0\0\0\0\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\0\0\0\377\377\0\377\377" + "\0\0\0\0\0\0\0\0\0\0\377\377\0\377\377\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\0\0\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\0\0\0\377\377\0\377\377\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\0\377\377\0\0\0\0\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\0\0\0\377\377\0\377" + "\377\0\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\0\377\377\0" + "\377\377\0\0\0\0\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\0\0\0\0\0\0\377\377\0\377\377\0\377\377\0\377" + "\377\0\377\377\0\377\377\0\377\377\0\377\377\0\0\0\0\0\0\0\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377", +}; + +/** + * \brief Returns the BlitBlendNone test image as SDL_Surface. + */ +SDL_Surface *SDLTest_ImageBlitBlendNone() +{ + 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.bytes_per_pixel, +#if (SDL_BYTEORDER == SDL_BIG_ENDIAN) + 0xff000000, /* Red bit mask. */ + 0x00ff0000, /* Green bit mask. */ + 0x0000ff00, /* Blue bit mask. */ + 0x000000ff /* Alpha bit mask. */ +#else + 0x000000ff, /* Red bit mask. */ + 0x0000ff00, /* Green bit mask. */ + 0x00ff0000, /* Blue bit mask. */ + 0xff000000 /* Alpha bit mask. */ +#endif + ); + return surface; +} + +const SDLTest_SurfaceImage_t SDLTest_imageBlitBlendAll = { + 80, 60, 3, + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\4\0\0\4\0\0\0\0\0\0\0" + "\0\11\0\0\11\0\0\0\0\0\0\0\0\16\0\0\16\0\0\0\0\0\0\0\0\11\0\0\11\0\0\0\0" + "\0\0\0\0\14\0\0\14\0\0\0\0\0\0\0\0\17\0\0\17\0\0\0\0\0\0\0\0\21\0\0\21\0" + "\0\0\0\0\0\0\0K\0\0K\0\0\0\0\0\0\0\0T\0\0T\0\0\0\0\0\0\0\0^\0\0^\0\0\0\0" + "\0\0\0\0g\0\0g\0\0\0\0\0\0\0\0\317\0\0\317\0\0\317\0\0\317\0\0\317\0\0\317" + "\0\0\317\0\0\317\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\4\0\0\4\0\0\4\0\0\0\0\0\11\0\0\11\0\0\11" + "\0\0\0\0\0\16\0\0\16\0\0\16\0\0\0\0\0\22\0\0\22\0\0\11\0\0\0\0\0\14\0\0\14" + "\0\0\14\0\0\0\0\0\17\0\0\17\0\0\17\0\0\0\0\0\21\0\0\21\0\0\21\0\0\0\0\0\24" + "\0\0\24\0\0K\0\0\0\0\0T\0\0T\0\0T\0\0\0\0\0^\0\0^\0\0^\0\0\0\0\0g\0\0g\0" + "\0g\0\0\0\0\0q\0\0q\0\0\317\0\0\317\0\0\317\0\0\317\0\0\317\0\0\317\0\0\317" + "\0\0\317\0\0\317\0\0\317\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\4\0\0\4\0\0\4\0\0\0\0\0\11\0\0\11\0\0\11\0\0\0\0\0" + "\16\0\0\16\0\0\16\0\0\0\0\0\22\0\0\22\0\0\22\0\0\0\0\0\14\0\0\14\0\0\14\0" + "\0\0\0\0\17\0\0\17\0\0\17\0\0\0\0\0\21\0\0\21\0\0\21\0\0\0\0\0\24\0\0\24" + "\0\0\24\0\0\0\0\0T\0\0T\0\0T\0\0\0\0\0^\0\0^\0\0^\0\0\0\0\0g\0\0g\0\0g\0" + "\0\0\0\0q\0\0q\0\0q\0\0\317\0\0\317\0\0\317\0\0\317\0\0\317\0\0\317\0\0\317" + "\0\0\317\0\0\317\0\0\317\0\0\317\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\4\0\0\4\0\0\4\0\0\0\0\0\10\0\0\10\0\0\10\0\0\0\0\0\15" + "\0\0\15\0\0\15\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\16\0\0\16\0\0\16\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0J\0\0J\0\0J\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\317" + "\0\0\317\0\0\317\0\0\317\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\1" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\1\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\1\0\0\1\0\0\0\0\0\0\0\0\1\0\0\1\0\0\1\0\0\1" + "\0\0\4\0\0\4\0\0\0\0\0\0\0\0\7\0\0\7\0\0\0\0\0\0\0\0&\0\0&\0\0\32\0\0\32" + "\0\0&\0\0&\0\0&\0\0&\0\0C\0\0C\0\0\0\0\0\0\0\0^\0\0^\0\0\0\0\0\0\0\17\251" + "\0\17\251\0\17\251\0\17\251\0\17\251\0\17\251\0\17\251\0\17\251\0\0\0\0\0" + "\0\0\0\317\0\0\317\0\0\317\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\1\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\1\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\6\2\0\6\2\0\0\1\0\0\0\0\0\1\0\0\1\0\0\1\0\0\1\0\0\1\0\0\1\0\0" + "\17\0\0\0\0\0\4\0\0\11\0\0\11\0\0\0\0\6+\0\6+\0\0&\0\0\32\0\0&\0\0&\0\0&" + "\0\0&\0\0""5\0\0""5\0\2\210\0\0\0\0\0C\0\0|\0\0|\0\0\0\0\17\251\0\17\251" + "\0\17\251\0\17\251\0\17\251\0\17\251\0\17\251\0\17\251\0\17\251\0\17\251" + "\0$\360\0$\360\0\0\0\0\0\317\0\0\317\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\1" + "\0\0\1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\1\0\0\1\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\6\2\0\6\2\0\6\2\0\0\0\0\0\1\0\0\1\0\0\1\0\0\1\0\0\1\0\0\1" + "\0\0\1\0\0\0\0\0\17\0\0\17\0\0\4\0\0\0\0\6+\0\6+\0\6+\0\0\32\0\0&\0\0&\0" + "\0&\0\0&\0\0""5\0\0""5\0\0""5\0\0\0\0\2\210\0\2\210\0\0C\0\0\0\0\17\251\0" + "\17\251\0\17\251\0\17\251\0\17\251\0\17\251\0\17\251\0\17\251\0\17\251\0" + "\17\251\0\17\251\0$\360\0$\360\0$\360\0\0\0\0\0\317\0\0\317\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\1\0\0\1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\1\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "$\360\0$\360\0$\360\0$\360\0\0\0\0\0\317\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\1\0" + "\0\1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\14\1\0\14\1\0\14\1" + "\0\14\1\0\15\1\0\15\1\0\0\0\0\0\0\0\14\2\0\14\2\0\14\2\0\14\2\0\16\2\0\16" + "\2\0\0\0\0\0\0\0\14!\0\14!\0\14!\0\14!\0\17(\0\17(\0\0\0\0\0\0\0\14+\0\14" + "+\0\14+\0\14+\0\20""9\0\20""9\0\0\0\0\0\0\0\36\215\0\36\215\0\36\215\0\36" + "\215\0(\264\0(\264\0\0\0\0\0\0\0\36\251\0\36\251\0\36\251\0\36\251\0\36\251" + "\0\36\251\0\36\251\0\36\251\0\0\0\0\0\0\0$\360\0$\360\0$\360\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\1\0\0\1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\36\3" + "\0\36\3\0\14\1\0\14\1\0\15\1\0\15\1\0\15\1\0\0\0\0\14\2\0\14\2\0\14\2\0\14" + "\2\0\16\2\0\16\2\0\16\2\0\0\0\0\14\3\0\14\3\0\14!\0\14!\0\17(\0\17(\0\17" + "(\0\0\0\0\14+\0\14+\0\14+\0\14+\0\20""9\0\20""9\0\20""9\0\0\0\0\14""7\0\14" + """7\0\36\215\0\36\215\0(\264\0(\264\0(\264\0\0\0\0\36\251\0\36\251\0\36\251" + "\0\36\251\0\36\251\0\36\251\0\36\251\0\36\251\0\36\251\0\36\251\0H\360\0" + "H\360\0\0\0\0$\360\0$\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\1\0\0\1\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\36\3\0\36\3\0\36\3\0\14\1\0\15\1\0\15\1\0\15\1" + "\0\0\0\0\14\2\0\14\2\0\14\2\0\14\2\0\16\2\0\16\2\0\16\2\0\0\0\0\14\3\0\14" + "\3\0\14\3\0\14!\0\17(\0\17(\0\17(\0\0\0\0\14+\0\14+\0\14+\0\14+\0\20""9\0" + "\20""9\0\20""9\0\0\0\0\14""7\0\14""7\0\14""7\0\36\215\0(\264\0(\264\0(\264" + "\0\0\0\0\36\251\0\36\251\0\36\251\0\36\251\0\36\251\0\36\251\0\36\251\0\36" + "\251\0\36\251\0\36\251\0\36\251\0H\360\0H\360\0H\360\0\0\0\0$\360\0$\360" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\1\0\0\1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\13\1\0\13\1\0\13\1\0\13\1\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\11!\0" + "\11!\0\11!\0\11!\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\23n\0\23n\0\23n\0\23n\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0H\360\0H\360\0H\360\0H\360\0\0\0\0$\360\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\1\0\1\1\0\0\0\0\0\0\0\0\0\0\0\0\0\25\0\0\25\0\0\25\0\0\27\0" + "\0\13\0\0\13\0\0\1\0\0\11\0\0\4\0\0\4\0\0\0\0\0\0\0\0\25\3\0\25\3\0\0\0\0" + "\0\0\0\25\3\0\25\3\0\25\3\0\25\3\0\3\1\0\3\1\0\2\1\0\7\5\0\7\3\0\7\3\0\0" + "\0\0\0\0\0\25""4\0\25""4\0\0\0\0\0\0\0\25""4\0\25""4\0\25""4\0\25""4\0\20" + "\35\0\20\35\0\11\22\0\23F\0\34""6\0\34""6\0\0\0\0\0\0\0L\317\0L\317\0L\317" + "\0L\317\0L\317\0L\317\0L\317\0L\317\0\0\0\0\0\0\0""2\317\0""2\317\0""2\317" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\1\1\0\0\0\0\0\0\0\0\0\0\25\0\0\25" + "\0\0\25\0\0\4\0\0\5\0\0\2\0\0\1\0\0\4\0\0\14\0\0\14\0\0\0\0\0\37\7\0\37\7" + "\0\25\3\0\0\0\0\25\3\0\25\3\0\25\3\0\25\3\0\37\6\0\37\6\0\15\4\0\11\3\0\7" + "\3\0\14\10\0\14\10\0\0\0\0\25\16\0\25\16\0\25""4\0\0\0\0\25""4\0\25""4\0" + "\25""4\0\25""4\0&Q\0&Q\0&Q\0\31""5\0\34""6\0&j\0&j\0\0\0\0""5q\0""5q\0L\317" + "\0L\317\0L\317\0L\317\0L\317\0L\317\0L\317\0L\317\0L\317\0L\317\0\0\0\0""2" + "\317\0""2\317\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\1\0\0\1\1\0\0\0\0\0\0\0\25\0" + "\0\25\0\0\25\0\0\31\1\0\5\0\0\5\0\0\2\0\0\4\0\0\14\0\0\14\0\0\0\0\0\37\7" + "\0\37\7\0\37\7\0\0\0\0\25\3\0\25\3\0\25\3\0\25\3\0\37\6\0\37\6\0\37\6\0\11" + "\3\0\16\6\0\16\6\0\7\3\0\0\0\0\25\16\0\25\16\0\25\16\0\0\0\0\25""4\0\25""4" + "\0\25""4\0\25""4\0&Q\0&Q\0&Q\0\31""5\0+X\0+X\0\34""6\0\0\0\0""5q\0""5q\0" + """5q\0L\317\0L\317\0L\317\0L\317\0L\317\0L\317\0L\317\0L\317\0L\317\0L\317" + "\0L\317\0\0\0\0""2\317\0""2\317\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\1\0\0\0\0\0\0\0" + "\0\0\0\0\25\0\0\25\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0L\317\0L\317\0L\317\0L\317" + "\0\0\0\0""2\317\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\1\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0e\4\0e\4\0\0\0\0\0\0\0e\11\0e\11\0\0\0\0\0\0\0e\16\0e\16\0\0\0\0\0\0" + "\0G\11\0G\11\0\0\0\0\0\0\0G\14\0G\14\0\0\0\0\0\0\0G\17\0G\17\0\0\0\0\0\0" + "\0G\21\0G\21\0\0\0\0\0\0\0GK\0GK\0\0\0\0\0\0\0GT\0GT\0\0\0\0\0\0\0G^\0G^" + "\0\0\0\0\0\0\0Gg\0Gg\0\0\0\0\0\0\0e\317\0e\317\0e\317\0e\317\0e\317\0e\317" + "\0e\317\0e\317\0\0\0\0\0\0\0L\317\0L\317\0L\317\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\1\0\0\0\0\0\0\0\0e\4\0e\4\0e\4\0\0\0\0e\11\0e\11\0e\11\0\0\0" + "\0e\16\0e\16\0e\16\0\0\0\0e\22\0e\22\0G\11\0\0\0\0G\14\0G\14\0G\14\0\0\0" + "\0G\17\0G\17\0G\17\0\0\0\0G\21\0G\21\0G\21\0\0\0\0G\24\0G\24\0GK\0\0\0\0" + "GT\0GT\0GT\0\0\0\0G^\0G^\0G^\0\0\0\0Gg\0Gg\0Gg\0\0\0\0Gq\0Gq\0e\317\0e\317" + "\0e\317\0e\317\0e\317\0e\317\0e\317\0e\317\0e\317\0e\317\0\0\0\0L\317\0L" + "\317\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\1\0\0\0\0\0e\4\0e\4\0e\4\0\0\0" + "\0e\11\0e\11\0e\11\0\0\0\0e\16\0e\16\0e\16\0\0\0\0e\22\0e\22\0e\22\0\0\0" + "\0G\14\0G\14\0G\14\0\0\0\0G\17\0G\17\0G\17\0\0\0\0G\21\0G\21\0G\21\0\0\0" + "\0G\24\0G\24\0G\24\0\0\0\0GT\0GT\0GT\0\0\0\0G^\0G^\0G^\0\0\0\0Gg\0Gg\0Gg" + "\0\0\0\0Gq\0Gq\0Gq\0e\317\0e\317\0e\317\0e\317\0e\317\0e\317\0e\317\0e\317" + "\0e\317\0e\317\0e\317\0\0\0\0L\317\0L\317\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0e\4\0e\4\0e\4\0\0\0\0b\10\0b\10\0b\10\0\0\0\0b\15\0b\15\0b\15\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0<\16\0<\16\0<\16\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0""2J\0""2J\0""2J\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0e\317\0e\317\0e\317\0e" + "\317\0\0\0\0L\317\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\216\1\0c\0\0c\0\0\0\0\0" + "`\0\0c\0\0c\0\0\2\0\0c\1\0i\0\0i\0\0\0\0\0\0\0\0e\0\0e\0\0\0\0\0\0\0\0{\1" + "\0{\1\0f\0\0f\0\0z\1\0z\1\0z\1\0z\1\0)\4\0)\4\0\0\0\0\0\0\0Q\7\0Q\7\0\0\0" + "\0\0\0\0{&\0{&\0W\32\0W\32\0z&\0z&\0z&\0z&\0IC\0IC\0\0\0\0\0\0\0X^\0X^\0" + "\0\0\0\0\0\0\261\251\0\261\251\0\261\251\0\261\251\0\261\251\0\261\251\0" + "\261\251\0\261\251\0\0\0\0\0\0\0e\317\0e\317\0e\317\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\216\1\0c\0\0`\0\0\2\0\0c\0\0c\0\0c\0\0\12\0\0k\1\0i\0\0" + "\0\0\0\11\0\0i\0\0i\0\0\0\0\0\256\2\0\256\2\0{\1\0f\0\0z\1\0z\1\0z\1\0z\1" + "\0\221\1\0\221\1\0\221\17\0\0\0\0)\4\0c\11\0c\11\0\0\0\0\256+\0\256+\0{&" + "\0W\32\0z&\0z&\0z&\0z&\0\2415\0\2415\0\243\210\0\0\0\0IC\0{|\0{|\0\0\0\0" + "\261\251\0\261\251\0\261\251\0\261\251\0\261\251\0\261\251\0\261\251\0\261" + "\251\0\261\251\0\261\251\0\264\360\0\264\360\0\0\0\0e\317\0e\317\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\216\1\0\216\1\0`\0\0\2\0\0c\0\0c\0\0c\0\0\12\0\0" + "k\1\0k\1\0\0\0\0\11\0\0i\0\0i\0\0\0\0\0\256\2\0\256\2\0\256\2\0f\0\0z\1\0" + "z\1\0z\1\0z\1\0\221\1\0\221\1\0\221\1\0\0\0\0\221\17\0\221\17\0)\4\0\0\0" + "\0\256+\0\256+\0\256+\0W\32\0z&\0z&\0z&\0z&\0\2415\0\2415\0\2415\0\0\0\0" + "\243\210\0\243\210\0IC\0\0\0\0\261\251\0\261\251\0\261\251\0\261\251\0\261" + "\251\0\261\251\0\261\251\0\261\251\0\261\251\0\261\251\0\261\251\0\264\360" + "\0\264\360\0\264\360\0\0\0\0e\317\0e\317\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\216\1" + "\0\211\1\0c\0\0\2\0\0c\0\0c\0\0k\0\0\12\0\0k\1\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\264\360\0\264\360" + "\0\264\360\0\264\360\0\0\0\0e\317\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\211\1\0\216\1" + "\0c\0\0\2\0\0c\0\0k\0\0q\0\0\20\0\0\0\0\0\0\0\0\322\1\0\322\1\0\322\1\0\322" + "\1\0\346\1\0\346\1\0\0\0\0\0\0\0\322\2\0\322\2\0\322\2\0\322\2\0\363\2\0" + "\363\2\0\0\0\0\0\0\0\322!\0\322!\0\322!\0\322!\0\371(\0\371(\0\0\0\0\0\0" + "\0\322+\0\322+\0\322+\0\322+\0\3719\0\3719\0\0\0\0\0\0\0\325\215\0\325\215" + "\0\325\215\0\325\215\0\374\264\0\374\264\0\0\0\0\0\0\0\325\251\0\325\251" + "\0\325\251\0\325\251\0\325\251\0\325\251\0\325\251\0\325\251\0\0\0\0\0\0" + "\0\264\360\0\264\360\0\264\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\211\1\0\216" + "\1\0c\0\0\2\0\0f\0\0m\0\0m\0\0\0\0\0\325\3\0\325\3\0\322\1\0\322\1\0\346" + "\1\0\346\1\0\346\1\0\0\0\0\322\2\0\322\2\0\322\2\0\322\2\0\363\2\0\363\2" + "\0\363\2\0\0\0\0\322\3\0\322\3\0\322!\0\322!\0\371(\0\371(\0\371(\0\0\0\0" + "\322+\0\322+\0\322+\0\322+\0\3719\0\3719\0\3719\0\0\0\0\3227\0\3227\0\325" + "\215\0\325\215\0\374\264\0\374\264\0\374\264\0\0\0\0\325\251\0\325\251\0" + "\325\251\0\325\251\0\325\251\0\325\251\0\325\251\0\325\251\0\325\251\0\325" + "\251\0\330\360\0\330\360\0\0\0\0\264\360\0\264\360\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\216\1\0\216\1\0c\0\0\10\0\0m\0\0m\0\0\0\0\0\325\3\0\325\3\0\325" + "\3\0\322\1\0\346\1\0\346\1\0\346\1\0\0\0\0\322\2\0\322\2\0\322\2\0\322\2" + "\0\363\2\0\363\2\0\363\2\0\0\0\0\322\3\0\322\3\0\322\3\0\322!\0\371(\0\371" + "(\0\371(\0\0\0\0\322+\0\322+\0\322+\0\322+\0\3719\0\3719\0\3719\0\0\0\0\322" + "7\0\3227\0\3227\0\325\215\0\374\264\0\374\264\0\374\264\0\0\0\0\325\251\0" + "\325\251\0\325\251\0\325\251\0\325\251\0\325\251\0\325\251\0\325\251\0\325" + "\251\0\325\251\0\325\251\0\330\360\0\330\360\0\330\360\0\0\0\0\264\360\0" + "\264\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\216\1\0\216\1\0i\0\0\10\0\0m\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\275\1\0\275\1\0\275\1\0" + "\275\1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\244!\0\244!\0\244!\0\244!\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\213n\0\213n\0\213n\0\213n\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\330\360\0\330\360\0\330\360\0\330" + "\360\0\0\0\0\264\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\216\1\0\224\1\0i\0\0\10\0" + "\0\0\0\0\0\0\0\325\3\0\325\3\0\325\3\0\351\3\0\365\1\0\365\1\0\14\0\0\313" + "\2\0#\2\0#\2\0\0\0\0\0\0\0\371\37\0\371\37\0\0\0\0\0\0\0\371\37\0\371\37" + "\0\371\37\0\371\37\0.\17\0.\17\0#\14\0\304-\0Y!\0Y!\0\0\0\0\0\0\0\371p\0" + "\371p\0\0\0\0\0\0\0\371p\0\371p\0\371p\0\371p\0O>\0O>\0""3(\0\247\227\0\211" + "s\0\211s\0\0\0\0\0\0\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0" + "\374\360\0\374\360\0\374\360\0\0\0\0\0\0\0\330\360\0\330\360\0\330\360\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\4\0\0\224\1\0i\0\0\0\0\0\0\0\0\325\3\0\325" + "\3\0\325\3\0\17\2\0\"\2\0!\0\0\35\0\0#\2\0\342\4\0\342\4\0\0\0\0\371\37\0" + "\371\37\0\371\37\0\0\0\0\371\37\0\371\37\0\371\37\0\371\37\0\3775\0\3775" + "\0\374%\0\304\34\0Y!\0\373C\0\373C\0\0\0\0\371p\0\371p\0\371p\0\0\0\0\371" + "p\0\371p\0\371p\0\371p\0\377\256\0\377\256\0\377\256\0\247q\0\211s\0\375" + "\342\0\375\342\0\0\0\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0" + "\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\0" + "\0\0\330\360\0\330\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\12\0\0\224\1\0\0\0" + "\0\0\0\0\325\3\0\325\3\0\325\3\0\344\5\0\"\2\0\"\2\0\200\0\0#\2\0\342\4\0" + "\342\4\0\0\0\0\371\37\0\371\37\0\371\37\0\0\0\0\371\37\0\371\37\0\371\37" + "\0\371\37\0\3775\0\3775\0\3775\0\304\34\0\3732\0\3732\0Y!\0\0\0\0\371p\0" + "\371p\0\371p\0\0\0\0\371p\0\371p\0\371p\0\371p\0\377\256\0\377\256\0\377" + "\256\0\247q\0\375\274\0\375\274\0\211s\0\0\0\0\374\360\0\374\360\0\374\360" + "\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0" + "\374\360\0\374\360\0\374\360\0\374\360\0\0\0\0\330\360\0\330\360\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\12\0\0\0\0\0i\0\0\0\0\0\325\3\0\325\3\0\344\5\0\344\5" + "\0\"\2\0\36\1\0""4\2\0#\2\0\342\4\0\0\0\0\371\37\0\371\37\0\371\37\0\0\0" + "\0\371\37\0\371\37\0\371\37\0\371\37\0\3775\0\3775\0\3775\0\307)\0\3732\0" + "\3732\0\3732\0\0\0\0\371p\0\371p\0\371p\0\0\0\0\371p\0\371p\0\371p\0\371" + "p\0\377\256\0\377\256\0\377\256\0\247q\0\375\274\0\375\274\0\375\274\0\0" + "\0\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360" + "\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0" + "\374\360\0\374\360\0\0\0\0\330\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\12\0\0" + "\10\0\0\0\0\0\325\3\0\344\5\0\344\5\0\344\5\0\340\4\0\367\11\0\364\3\0#\2" + "\0\0\0\0\371\37\0\371\37\0\371\37\0\0\0\0\371\37\0\371\37\0\371\37\0\371" + "\37\0\3775\0\3775\0\3775\0\307)\0\376G\0\3732\0\3732\0\0\0\0\371p\0\371p" + "\0\371p\0\0\0\0\371p\0\371p\0\371p\0\371p\0\377\256\0\377\256\0\377\256\0" + "\247q\0\375\274\0\375\274\0\375\274\0\0\0\0\374\360\0\374\360\0\374\360\0" + "\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374" + "\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\12\0\0\10\0\0\0\0\0\0\0\0\17\2\0\17" + "\2\0\17\2\0\323\2\0\352\7\0\347\2\0\26\1\0\0\0\0\371\37\0\371\37\0\371\37" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0/\26\0/\26\0/\26\0\0\0\0""7\36\0""6\25\0" + """6\25\0\0\0\0\371p\0\371p\0\371p\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0O>\0O>\0" + "O>\0\0\0\0VK\0VK\0VK\0\0\0\0\374\360\0\374\360\0\374\360\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\374\360\0\374\360\0\374\360\0\374\360\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\374\360\0\374\360\0\374\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\5\0\0\12\0" + "\0\10\0\0\0\0\0\17\2\0\17\2\0\344\5\0\15\1\0\352\7\0\352\7\0\347\2\0\0\0" + "\0\371\37\0\371\37\0\371\37\0\0\0\0\0\0\0\0\0\0\362\4\0\0\0\0/\26\0/\26\0" + "\3775\0$\21\0""7\36\0""7\36\0\3672\0\0\0\0\371p\0\371p\0\371p\0\0\0\0\0\0" + "\0\0\0\0\370A\0\0\0\0O>\0O>\0\377\256\0""3(\0VK\0VK\0\372\264\0\0\0\0\374" + "\360\0\374\360\0\374\360\0\374\360\0\0\0\0\0\0\0\341\271\0\0\0\0\374\360" + "\0\374\360\0\374\360\0\374\360\0\0\0\0\0\0\0\343\350\0\0\0\0\374\360\0\374" + "\360\0\374\360\0\374\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\5\0\0\5\0\0\10\0\0\0\0" + "\0\17\2\0\17\2\0\17\2\0\15\1\0\352\7\0\352\7\0\347\2\0\0\0\0\371\37\0\371" + "\37\0\371\37\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0/\26\0/\26\0/\26\0$\21\0""7\36" + "\0""7\36\0""6\25\0\0\0\0\371p\0\371p\0\371p\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0O>\0O>\0O>\0""3(\0VK\0VK\0VK\0\0\0\0\374\360\0\374\360\0\374\360\0\374" + "\360\0\0\0\0\0\0\0\0\0\0\0\0\0\374\360\0\374\360\0\374\360\0\374\360\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\374\360\0\374\360\0\374\360\0\374\360\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\5\0\0\5\0\0\5\0\0\0\0\0\344\5\0\344\5\0\344\5\0\316\4\0\367" + "\11\0\367\11\0\364\3\0\0\0\0\371\37\0\371\37\0\371\37\0\0\0\0\371\37\0\371" + "\37\0\371\37\0\371\37\0\3775\0\3775\0\3775\0\307)\0\376G\0\376G\0\3732\0" + "\0\0\0\371p\0\371p\0\371p\0\0\0\0\371p\0\371p\0\371p\0\371p\0\377\256\0\377" + "\256\0\377\256\0\247q\0\375\274\0\375\274\0\375\274\0\0\0\0\374\360\0\374" + "\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360" + "\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0" + "\374\360\0\374\360\0\374\360\0\374\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\5" + "\0\0\5\0\0\5\0\0\17\2\0\344\5\0\344\5\0\316\4\0\345\11\0\367\11\0\364\3\0" + "\0\0\0\371\37\0\371\37\0\371\37\0\0\0\0\371\37\0\371\37\0\371\37\0\371\37" + "\0\3775\0\3775\0\3775\0\307)\0\376G\0\376G\0\3732\0\0\0\0\371p\0\371p\0\371" + "p\0\0\0\0\371p\0\371p\0\371p\0\371p\0\377\256\0\377\256\0\377\256\0\247q" + "\0\375\274\0\375\274\0\375\274\0\0\0\0\374\360\0\374\360\0\374\360\0\374" + "\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360" + "\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0" + "\374\360\0\374\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\5\0\0\5\0\0\0\0\0\17\2" + "\0\344\5\0\344\5\0\15\1\0$\6\0$\6\0#\2\0\0\0\0\371\37\0\371\37\0\371\37\0" + "\0\0\0\371\37\0\371\37\0\371\37\0\371\37\0\3775\0/\26\0/\26\0\307)\0\376" + "G\0[/\0Y!\0\0\0\0\371p\0\371p\0\371p\0\0\0\0\371p\0\371p\0\371p\0\371p\0" + "\377\256\0O>\0O>\0\247q\0\375\274\0\211s\0\211s\0\0\0\0\374\360\0\374\360" + "\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0" + "\0\0\0\0\0\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0" + "\374\360\0\374\360\0\374\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\5\0\0" + "\5\0\0\17\2\0\17\2\0\344\5\0\316\4\0$\6\0$\6\0#\2\0\0\0\0\371\37\0\371\37" + "\0\371\37\0\0\0\0\371\37\0\371\37\0\371\37\0\371\37\0\3775\0/\26\0/\26\0" + "\307)\0\376G\0[/\0Y!\0\0\0\0\371p\0\371p\0\371p\0\0\0\0\371p\0\371p\0\371" + "p\0\371p\0\377\256\0O>\0O>\0\247q\0\375\274\0\211s\0\211s\0\0\0\0\374\360" + "\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0" + "\374\360\0\0\0\0\0\0\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0" + "\374\360\0\374\360\0\374\360\0\374\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\5\0\0\24\2\0\17\2\0\17\2\0\316\4\0\345\11\0$\6\0#\2\0\0\0\0\371" + "\37\0\371\37\0\371\37\0\0\0\0\371\37\0\371\37\0\371\37\0\371\37\0\3775\0" + "\3775\0\3775\0\307)\0\376G\0\376G\0\3732\0\0\0\0\371p\0\371p\0\371p\0\0\0" + "\0\371p\0\371p\0\371p\0\371p\0\377\256\0\377\256\0\377\256\0\247q\0\375\274" + "\0\375\274\0\375\274\0\0\0\0\374\360\0\374\360\0\374\360\0\374\360\0\374" + "\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360" + "\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0" + "\374\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\5\0\0\24\2\0\24" + "\2\0\17\2\0\316\4\0\345\11\0\342\3\0#\2\0\0\0\0\371\37\0\371\37\0\371\37" + "\0\0\0\0\371\37\0\371\37\0\371\37\0\371\37\0\3775\0\3775\0\3775\0\307)\0" + "\376G\0\3732\0\3732\0\0\0\0\371p\0\371p\0\371p\0\0\0\0\371p\0\371p\0\371" + "p\0\371p\0\377\256\0\377\256\0\377\256\0\247q\0\375\274\0\375\274\0\375\274" + "\0\0\0\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374" + "\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360" + "\0\374\360\0\374\360\0\374\360\0\374\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\17\2\0\24\2\0\5\0\0\0\0\0\27\5\0\342\3\0\313" + "\1\0\0\0\0\371\37\0\371\37\0\0\0\0\0\0\0\0\0\0\371\37\0\0\0\0\0\0\0/\26\0" + "\3775\0\371\37\0\302\30\0\3716\0Y!\0#\14\0\0\0\0\371p\0\371p\0\0\0\0\0\0" + "\0\0\0\0\371p\0\0\0\0\0\0\0O>\0\377\256\0\371p\0\243I\0\371\224\0\211s\0" + """3(\0\0\0\0\374\360\0\374\360\0\0\0\0\0\0\0\0\0\0\374\360\0\374\360\0\374" + "\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\0\0\0\0\0\0\0\0" + "\0\374\360\0\374\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\17\2\0\17\2\0\0\0\0\0\0\0\26\1\0\26\1\0\0\0\0\0\0\0\371" + "\37\0\371\37\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0/\26\0/\26\0\0\0\0\0\0" + "\0""6\25\0""6\25\0\0\0\0\0\0\0\371p\0\371p\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0O>\0O>\0\0\0\0\0\0\0VK\0VK\0\0\0\0\0\0\0\374\360\0\374\360\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\374" + "\360\0\374\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\17\2\0\17\2\0\0\0\0\0\0\0\26\1\0\26\1\0\0\0\0\0\0" + "\0\371\37\0\371\37\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0/\26\0/\26\0\0\0" + "\0\0\0\0""6\25\0""6\25\0\0\0\0\0\0\0\371p\0\371p\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0O>\0O>\0\0\0\0\0\0\0VK\0VK\0\0\0\0\0\0\0\374\360\0\374\360" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\374\360\0" + "\374\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\17\2\0\17\2\0\16\0\0\0\0\0\26\1\0\26\1\0\26" + "\1\0\0\0\0\371\37\0\371\37\0\371\37\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0/\26\0" + "/\26\0.\17\0\0\0\0""6\25\0""6\25\0""6\25\0\0\0\0\371p\0\371p\0\371p\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0O>\0O>\0O>\0\0\0\0VK\0VK\0VK\0\0\0\0\374\360\0" + "\374\360\0\374\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\374\360\0\374\360" + "\0\374\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\16\0\0\16\0\0\14\0\0\14" + "\0\0#\2\0#\2\0\0\0\0\0\0\0\371\37\0\371\37\0\0\0\0\0\0\0\371\37\0\371\37" + "\0\371\37\0\371\37\0.\17\0.\17\0#\14\0#\14\0Y!\0Y!\0\0\0\0\0\0\0\371p\0\371" + "p\0\0\0\0\0\0\0\371p\0\371p\0\371p\0\371p\0O>\0O>\0""3(\0""3(\0\211s\0\211" + "s\0\0\0\0\0\0\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360\0\374\360" + "\0\374\360\0\374\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", +}; + +/** + * \brief Returns the BlitBlendAll test image as SDL_Surface. + */ +SDL_Surface *SDLTest_ImageBlitBlendAll() +{ + 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.bytes_per_pixel, +#if (SDL_BYTEORDER == SDL_BIG_ENDIAN) + 0xff000000, /* Red bit mask. */ + 0x00ff0000, /* Green bit mask. */ + 0x0000ff00, /* Blue bit mask. */ + 0x000000ff /* Alpha bit mask. */ +#else + 0x000000ff, /* Red bit mask. */ + 0x0000ff00, /* Green bit mask. */ + 0x00ff0000, /* Blue bit mask. */ + 0xff000000 /* Alpha bit mask. */ +#endif + ); + return surface; +} diff --git a/src/eepp/helper/SDL2/src/test/SDL_test_imageFace.c b/src/eepp/helper/SDL2/src/test/SDL_test_imageFace.c new file mode 100644 index 000000000..46c117a4f --- /dev/null +++ b/src/eepp/helper/SDL2/src/test/SDL_test_imageFace.c @@ -0,0 +1,246 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2013 Sam Lantinga + + 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 + appreciated but is not required. + 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. +*/ +#include "SDL_config.h" + +#include "SDL_test.h" + +/* GIMP RGBA C-Source image dump (face.c) */ + +const SDLTest_SurfaceImage_t SDLTest_imageFace = { + 32, 32, 4, + "\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377" + "\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377" + "\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377" + "\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0" + "\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377" + "\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377" + "\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377" + "\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0" + "\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377" + "\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377" + "\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377" + "\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0" + "\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377" + "\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377" + "\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377" + "\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0" + "\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377" + "\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377" + "\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377" + "\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0" + "\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377" + "\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377" + "\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377" + "\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0" + "\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377" + "\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377" + "\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377" + "\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0" + "\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377" + "\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377" + "\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377" + "\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0" + "\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377" + "\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377" + "\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377" + "\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0" + "\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377" + "\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377" + "\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377" + "\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0" + "\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377" + "\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377" + "\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377" + "\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0" + "\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\0" + "\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0" + "\0\377\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377" + "\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0" + "\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377" + "\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377" + "\377\0\377\377\377\0\0\0\0\377\0\0\0\377\377\377\0\377\377\377\0\377\377" + "\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377" + "\0\377\0\0\0\377\0\0\0\377\377\377\377\0\377\377\377\0\377\377\377\0\377" + "\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377" + "\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377" + "\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0" + "\0\0\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377" + "\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0" + "\377\377\377\0\377\377\377\0\377\0\0\0\377\377\377\377\0\377\377\377\0\377" + "\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377" + "\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377" + "\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\0\0\0\377\377" + "\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377" + "\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0" + "\377\377\377\0\377\377\377\0\377\377\377\0\377\0\0\0\377\377\377\377\0\377" + "\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377" + "\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377" + "\0\377\377\377\0\377\377\377\0\377\377\377\0\0\0\0\377\377\377\0\377\377" + "\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377" + "\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0" + "\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\0\0\0\377\377" + "\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377" + "\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377" + "\0\377\377\377\0\377\377\377\0\0\0\0\377\377\377\0\377\377\377\0\377\377" + "\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377" + "\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0" + "\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377" + "\0\0\0\377\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377" + "\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377" + "\0\377\377\377\0\377\377\377\0\0\0\0\377\377\377\0\377\377\377\0\377\377" + "\377\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\377\377\0\377\377\377" + "\0\377\377\377\0\377\377\377\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377" + "\377\377\0\377\377\377\0\377\377\377\0\377\0\0\0\377\377\377\377\0\377\377" + "\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377" + "\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\0\0\0\377\377" + "\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\0\0\0\377\0\0\0\377" + "\377\377\377\0\0\0\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377" + "\0\377\0\0\0\377\0\0\0\377\377\377\377\0\0\0\0\377\377\377\0\377\377\377" + "\0\377\377\377\0\377\377\377\0\377\0\0\0\377\377\377\377\0\377\377\377\0" + "\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377" + "\377\377\0\377\377\377\0\377\377\377\0\0\0\0\377\377\377\0\377\377\377\0" + "\377\377\377\0\377\377\377\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377" + "\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\0\0\0\377\0\0\0" + "\377\0\0\0\377\0\0\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377" + "\0\377\0\0\0\377\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0" + "\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377" + "\377\377\0\0\0\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0" + "\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377" + "\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377" + "\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377" + "\0\377\0\0\0\377\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0" + "\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377" + "\377\377\0\0\0\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0" + "\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377" + "\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377" + "\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377" + "\0\377\0\0\0\377\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0" + "\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377" + "\377\377\0\0\0\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0" + "\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377" + "\0\0\0\377\0\0\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0" + "\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377" + "\0\0\0\377\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377" + "\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377" + "\0\0\0\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377" + "\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\0\0\0" + "\377\0\0\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377" + "\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\0\0\0" + "\377\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377" + "\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0" + "\0\0\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377" + "\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0" + "\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377" + "\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\0" + "\0\0\377\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377" + "\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377" + "\0\377\377\377\0\0\0\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377" + "\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377" + "\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0" + "\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\0\0\0\377\377" + "\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377" + "\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377" + "\0\377\377\377\0\0\0\0\377\377\377\0\377\377\377\0\377\0\0\0\377\0\0\0\377" + "\0\0\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377" + "\0\377\377\377\0\377\377\377\0\377\377\377\0\377\0\0\0\377\0\0\0\377\0\0" + "\0\377\377\377\0\377\377\377\0\377\0\0\0\377\377\377\377\0\377\377\377\0" + "\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377" + "\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377" + "\377\0\0\0\0\377\377\377\0\377\377\377\0\377\0\0\0\377\0\0\0\377\0\0\0\377" + "\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0" + "\0\0\377\0\0\0\377\377\377\0\377\377\377\0\377\0\0\0\377\377\377\377\0\377" + "\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377" + "\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377" + "\0\377\377\377\0\377\377\377\0\377\377\377\0\0\0\0\377\377\377\0\377\377" + "\377\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0" + "\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\377\377\0\377\377\377\0\377\0\0\0" + "\377\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377" + "\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0" + "\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377" + "\377\377\0\377\377\377\0\0\0\0\377\377\377\0\377\377\377\0\377\377\377\0" + "\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\377\377" + "\0\377\377\377\0\377\377\377\0\377\0\0\0\377\377\377\377\0\377\377\377\0" + "\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377" + "\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377" + "\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377" + "\0\377\377\377\0\0\0\0\377\0\0\0\377\377\377\0\377\377\377\0\377\377\377" + "\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0" + "\377\0\0\0\377\0\0\0\377\377\377\377\0\377\377\377\0\377\377\377\0\377\377" + "\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377" + "\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0" + "\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377" + "\377\377\0\377\377\377\0\377\377\377\0\0\0\0\377\0\0\0\377\0\0\0\377\0\0" + "\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\377\377\377\0\377\377\377" + "\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0" + "\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377" + "\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377" + "\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377" + "\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0" + "\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377" + "\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377" + "\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377" + "\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0" + "\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377" + "\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377" + "\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377" + "\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0" + "\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377" + "\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377" + "\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377" + "\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0" + "\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377" + "\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377" + "\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377" + "\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0" + "\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377" + "\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377" + "\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377" + "\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0" + "\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377" + "\377\377\0\377\377\377\0", +}; + +/** + * \brief Returns the Face test image as SDL_Surface. + */ +SDL_Surface *SDLTest_ImageFace() +{ + 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.bytes_per_pixel, +#if (SDL_BYTEORDER == SDL_BIG_ENDIAN) + 0xff000000, /* Red bit mask. */ + 0x00ff0000, /* Green bit mask. */ + 0x0000ff00, /* Blue bit mask. */ + 0x000000ff /* Alpha bit mask. */ +#else + 0x000000ff, /* Red bit mask. */ + 0x0000ff00, /* Green bit mask. */ + 0x00ff0000, /* Blue bit mask. */ + 0xff000000 /* Alpha bit mask. */ +#endif + ); + return surface; +} + diff --git a/src/eepp/helper/SDL2/src/test/SDL_test_imagePrimitives.c b/src/eepp/helper/SDL2/src/test/SDL_test_imagePrimitives.c new file mode 100644 index 000000000..93b99d692 --- /dev/null +++ b/src/eepp/helper/SDL2/src/test/SDL_test_imagePrimitives.c @@ -0,0 +1,512 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2013 Sam Lantinga + + 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 + appreciated but is not required. + 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. +*/ +#include "SDL_config.h" + +#include "SDL_test.h" + +/* GIMP RGB C-Source image dump (primitives.c) */ + +const SDLTest_SurfaceImage_t SDLTest_imagePrimitives = { + 80, 60, 3, + "\5ii\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\15I\310\0\0\0\15I\310\0\0\0\15I\310\0\0\0\15" + "I\310\0\0\0\15I\310\0\0\0\15I\310\0\0\0\15I\310\0\0\0\15I\310\0\0\0\15I\310" + "\0\0\0\15I\310\0\0\0\15I\310\0\0\0\15I\310\0\0\0\15I\310\0\0\0\15I\310\0" + "\0\0\15I\310\0\0\0\15I\310\0\0\0\15I\310\0\0\0\15I\310\0\0\0\15I\310\0\0" + "\0\5ii\0\0\0\5ii\0\0\0\3\1\1\0\0\0\5\2\1\0\0\0\7\3\2\0\0\0\11\4\3\0\0\0\13" + "\5\3\0\0\0\15\6\4\0\0\0\17\7\5\0\0\0\21\10\5\0\0\0\23\11\6\0\0\0\25\12\7" + "\0\0\0\27\13\7\0\0\0\31\14\10\0\0\0\33\15\11\0\0\0\35\16\11\0\0\0\37\17\12" + "\0\0\0!\20\13\0\0\0#\21\13\0\0\0%\22\14\0\0\0'\23\15\15I\310)\24\15\15I\310" + "+\25\16\15I\310-\26\17\15I\310/\27\17\15I\3101\30\20\15I\3103\31\21\15I\310" + "5\32\21\15I\3107\33\22\15I\3109\34\23\15I\310;\35\23\15I\310=\36\24\15I\310" + "?\37\25\15I\310A\40\25\15I\310C!\26\15I\310E\"\27\15I\310G#\27\15I\310I$" + "\30\15I\310K%\31\15I\310M&\31\5iiO'\32\0\0\0\0\0\0\5ii\0\0\0\10\4\2\0\0\0" + "\14\6\4\0\0\0\20\10\5\0\0\0\24\12\6\0\0\0\30\14\10\0\0\0\34\16\11\0\0\0\40" + "\20\12\0\0\0$\22\14\0\0\0(\24\15\0\0\0,\26\16\0\0\0""0\30\20\0\0\0""4\32" + "\21\0\0\0""8\34\22\0\0\0<\36\24\0\0\0@\40\25\0\0\0D\"\26\0\0\0H$\30\0\0\0" + "L&\31\0\0\0P(\32\15I\310T*\34\15I\310X,\35\15I\310\\.\36\15I\310`0\40\15" + "I\310d2!\15I\310h4\"\15I\310l6$\15I\310p8%\15I\310t:&\15I\310x<(\15I\310" + "|>)\15I\310\200@*\15I\310\204B,\15I\310\210D-\15I\310\214F.\15I\310\220H" + "0\15I\310\224J1\15I\310\230L2\5ii\234N4\15I\310\0\0\0\0\0\0\0\0\0\5ii\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\15I" + "\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I" + "\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I" + "\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I" + "\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\5ii" + "\15I\310\15I\310\15I\310\0\0\0\0\0\0\0\0\0\0\0\0\5ii\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\15I\310\15I\310\15I\310\15" + "I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15" + "I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15" + "I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15" + "I\310\15I\310\15I\310\15I\310\15I\310\5ii\15I\310\15I\310\15I\310\15I\310" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\5ii\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15" + "I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15" + "I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15" + "I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15" + "I\310\5ii\15I\310\15I\310\15I\310\15I\310\15I\310\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\5ii\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\15" + "I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15" + "I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15" + "I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15" + "I\310\15I\310\15I\310\15I\310\15I\310\15I\310\5ii\15I\310\15I\310\15I\310" + "\15I\310\15I\310\15I\310\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\5ii\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\15I\310\15I\310\15I\310\15" + "I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15" + "I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15" + "I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15" + "I\310\15I\310\5ii\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\5ii\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15" + "I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15" + "I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15" + "I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\5ii\15I\310\15I\310" + "\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\5ii\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\15" + "I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15" + "I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15" + "I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15" + "I\310\15I\310\15I\310\5ii\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310" + "\15I\310\15I\310\15I\310\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\5ii\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d" + "\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310" + "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0" + "d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310" + "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0" + "d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\5ii\15I\310\15" + "I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\310\0d\5ii\310\0" + "d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310" + "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0" + "d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310" + "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0" + "d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310" + "\0d\310\0d\310\0d\5ii\310\0d\15I\310\15I\310\15I\310\15I\310\15I\310\15I" + "\310\15I\310\15I\310\15I\310\15I\310\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\310\0d\310\0d\5ii\310\0d\310\0d\310\0d\310\0d\310" + "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0" + "d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310" + "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0" + "d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310" + "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\5ii\310\0d\310\0d\15" + "I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15" + "I\310\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\310\0d" + "\310\0d\310\0d\5ii\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0" + "d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310" + "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0" + "d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310" + "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0" + "d\310\0d\310\0d\5ii\310\0d\310\0d\310\0d\15I\310\15I\310\15I\310\15I\310" + "\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\310\0d\310\0d\310\0d\310\0d\5ii\310" + "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0" + "d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310" + "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0" + "d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310" + "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\5ii\310\0d\310\0d\310" + "\0d\310\0d\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310" + "\15I\310\15I\310\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\310\0d\310\0d\310\0d\310\0d\310\0d\5ii\310\0d\310\0d\310\0d\310\0d\310" + "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0" + "d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310" + "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0" + "d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310" + "\0d\310\0d\5ii\310\0d\310\0d\310\0d\310\0d\310\0d\15I\310\15I\310\15I\310" + "\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\310\0d\310\0d\310\0d\310\0d" + "\310\0d\310\0d\5ii\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0" + "d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310" + "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0" + "d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310" + "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\5ii\310\0d\310\0d\310\0d\310" + "\0d\310\0d\310\0d\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310" + "\15I\310\15I\310\15I\310\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\5ii\310\0d" + "\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310" + "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0" + "d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310" + "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0" + "d\310\0d\5ii\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\15I\310\15" + "I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\310\0d\310\0d\310" + "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\5ii\310\0d\310\0d\310\0d\310\0d\310" + "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0" + "d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310" + "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0" + "d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\5ii\310\0d\310\0d\310\0d\310" + "\0d\310\0d\310\0d\310\0d\310\0d\15I\310\15I\310\15I\310\15I\310\15I\310\15" + "I\310\15I\310\15I\310\15I\310\15I\310\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0" + "d\310\0d\310\0d\5ii\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310" + "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0" + "d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310" + "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0" + "d\310\0d\5ii\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310" + "\0d\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310" + "\15I\310\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\310" + "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\5ii\310" + "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0" + "d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310" + "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0" + "d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\5ii\310\0d\310\0d\310\0d\310" + "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\15I\310\15I\310\15I\310\15" + "I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\310\0d\310\0d\310\0d\310\0d\310" + "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\5ii\310\0d\310\0d\310\0d\310" + "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0" + "d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310" + "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0" + "d\310\0d\5ii\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310" + "\0d\310\0d\310\0d\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310" + "\15I\310\15I\310\15I\310\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310" + "\0d\310\0d\310\0d\310\0d\5ii\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310" + "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0" + "d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310" + "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\5ii\310\0d\310\0d\310\0d\310" + "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\15I\310\15I\310" + "\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\310\0d\310\0d\310\0" + "d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\5" + "ii\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d" + "\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310" + "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0" + "d\310\0d\5ii\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310" + "\0d\310\0d\310\0d\310\0d\310\0d\15I\310\15I\310\15I\310\15I\310\15I\310\15" + "I\310\15I\310\15I\310\15I\310\15I\310\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0" + "d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\5ii\310\0d\310\0d\310" + "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0" + "d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310" + "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\5ii\310\0d\310\0d\310\0d\310" + "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0" + "d\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310" + "\15I\310\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\310" + "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0" + "d\310\0d\310\0d\310\0d\310\0d\5ii\310\0d\310\0d\310\0d\310\0d\310\0d\310" + "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0" + "d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310" + "\0d\310\0d\5ii\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310" + "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\15I\310\15I\310\15I\310\15" + "I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\310\0d\310\0d\310\0d\310\0d\310" + "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0" + "d\310\0d\5ii\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310" + "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0" + "d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\5ii\310\0d\310\0d\310" + "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0" + "d\310\0d\310\0d\310\0d\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15" + "I\310\15I\310\15I\310\15I\310\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d" + "\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\5ii\310\0" + "d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310" + "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0" + "d\310\0d\310\0d\5ii\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310" + "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\15I\310" + "\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\310\0d\310\0" + "d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310" + "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\5ii\310\0d\310\0d\310\0d\310\0d\310" + "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0" + "d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\5ii\310\0d\310\0d\310" + "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0" + "d\310\0d\310\0d\310\0d\310\0d\310\0d\15I\310\15I\310\15I\310\15I\310\15I" + "\310\15I\310\15I\310\15I\310\15I\310\15I\310\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\310\0d\310\0d\310\0d\310\0d\310\0d\310\0" + "d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310" + "\0d\310\0d\310\0d\5ii\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310" + "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0" + "d\310\0d\310\0d\5ii\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310" + "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0" + "d\310\0d\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310" + "\15I\310\15I\310\0\377\0\0\377\0\0\377\0\0\377\0\0\377\0\0\377\0\0\377\0" + "\0\377\0\0\377\0\0\377\0\0\377\0\0\377\0\0\377\0\0\377\0\0\377\0\0\377\0" + "\0\377\0\0\377\0\0\377\0\0\377\0\0\377\0\0\377\0\0\377\0\0\377\0\0\377\0" + "\0\377\0\0\377\0\0\377\0\0\377\0\5ii\0\377\0\0\377\0\0\377\0\0\377\0\0\377" + "\0\0\377\0\0\377\0\0\377\0\0\377\0\0\377\0""77\5\0\377\0\0\377\0\0\377\0" + "\0\377\0\0\377\0\0\377\0\0\377\0\0\377\0\0\377\0\5ii\0\377\0\0\377\0\0\377" + "\0\0\377\0\0\377\0\0\377\0\0\377\0\0\377\0\0\377\0\0\377\0\0\377\0\0\377" + "\0\0\377\0\0\377\0\0\377\0\0\377\0\0\377\0\0\377\0\0\377\0\0\377\0\0\377" + "\0\0\377\0\0\377\0\0\377\0\0\377\0\0\377\0\0\377\0\0\377\0\0\377\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\310\0d\310\0d\310" + "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0" + "d\310\0d\310\0d\310\0d\310\0d\310\0d\5ii\310\0d\310\0d\310\0d\310\0d\310" + "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d77\5\310\0d\310\0d\310\0d\310" + "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\5ii\310\0d\310\0d\310\0d\310" + "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0" + "d\310\0d\310\0d\310\0d\310\0d\15I\310\15I\310\15I\310\15I\310\15I\310\15" + "I\310\15I\310\15I\310\15I\310\15I\310\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0" + "d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\5" + "ii\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d" + "\310\0d\310\0d77\5\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0" + "d\310\0d\310\0d\310\0d\5ii\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310" + "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0" + "d\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310" + "\15I\310\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\310" + "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0" + "d\310\0d\310\0d\310\0d\310\0d\310\0d\5ii\310\0d\310\0d\310\0d\310\0d\310" + "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d77\5\310\0d\310" + "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0" + "d\5ii\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310" + "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\15I\310\15I\310\15I\310\15" + "I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\310\0d\310\0d\310\0d\310\0d\310" + "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0" + "d\5ii\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310" + "\0d\310\0d\310\0d\310\0d\310\0d77\5\310\0d\310\0d\310\0d\310\0d\310\0d\310" + "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\5ii\310\0d\310\0d\310" + "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0" + "d\310\0d\310\0d\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15" + "I\310\15I\310\15I\310\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310" + "\0d\310\0d\310\0d\310\0d\310\0d\5ii\310\0d\310\0d\310\0d\310\0d\310\0d\310" + "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d77\5\310" + "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0" + "d\310\0d\310\0d\310\0d\5ii\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310" + "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\15I\310\15I\310\15I" + "\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\310\0d\310\0d\310\0d\310" + "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\5ii\310" + "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0" + "d\310\0d\310\0d\310\0d\310\0d\310\0d77\5\310\0d\310\0d\310\0d\310\0d\310" + "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0" + "d\5ii\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310" + "\0d\310\0d\310\0d\310\0d\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310" + "\15I\310\15I\310\15I\310\15I\310\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310" + "\0d\310\0d\310\0d\310\0d\310\0d\5ii\310\0d\310\0d\310\0d\310\0d\310\0d\310" + "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0" + "d\310\0d77\5\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310" + "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\5ii\310\0d\310\0d\310" + "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\15I\310" + "\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\310\0d\310\0" + "d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\5ii\310" + "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0" + "d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d77\5\310\0d\310\0d\310" + "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0" + "d\310\0d\310\0d\310\0d\310\0d\5ii\310\0d\310\0d\310\0d\310\0d\310\0d\310" + "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\15I\310\15I\310\15I\310\15I\310\15" + "I\310\15I\310\15I\310\15I\310\15I\310\15I\310\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\310\0d\310\0d\310\0d\310\0d\310\0d\310\0" + "d\310\0d\310\0d\310\0d\310\0d\5ii\310\0d\310\0d\310\0d\310\0d\310\0d\310" + "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0" + "d\310\0d\310\0d\310\0d77\5\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310" + "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0" + "d\310\0d\5ii\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310" + "\0d\310\0d\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310" + "\15I\310\15I\310\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\5ii\310" + "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0" + "d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d77\5\310" + "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0" + "d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\5ii\310\0d\310" + "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\15I\310\15I\310\15I" + "\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\310\0d\310\0d\310\0d\310" + "\0d\310\0d\310\0d\310\0d\310\0d\5ii\310\0d\310\0d\310\0d\310\0d\310\0d\310" + "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0" + "d\310\0d\310\0d\310\0d\310\0d\310\0d77\5\310\0d\310\0d\310\0d\310\0d\310" + "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0" + "d\310\0d\310\0d\310\0d\310\0d\310\0d\5ii\310\0d\310\0d\310\0d\310\0d\310" + "\0d\310\0d\310\0d\310\0d\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310" + "\15I\310\15I\310\15I\310\15I\310\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\5i" + "i\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310" + "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0" + "d\310\0d77\5\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310" + "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0" + "d\310\0d\310\0d\5ii\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\15I" + "\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I" + "\310\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\310\0d\310" + "\0d\310\0d\310\0d\310\0d\310\0d\5ii\310\0d\310\0d\310\0d\310\0d\310\0d\310" + "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0" + "d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d77\5\310\0d\310\0d\310" + "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0" + "d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\5ii\310" + "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\15I\310\15I\310\15I\310\15I\310\15" + "I\310\15I\310\15I\310\15I\310\15I\310\15I\310\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\310\0d\310\0d\310\0d\310\0d\310\0d\5ii\310" + "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0" + "d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310" + "\0d\310\0d\310\0d77\5\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310" + "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0" + "d\310\0d\310\0d\310\0d\310\0d\310\0d\5ii\310\0d\310\0d\310\0d\310\0d\310" + "\0d\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310" + "\15I\310\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\310" + "\0d\310\0d\310\0d\310\0d\5ii\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310" + "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0" + "d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d77\5\310\0d\310" + "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0" + "d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310" + "\0d\310\0d\5ii\310\0d\310\0d\310\0d\310\0d\15I\310\15I\310\15I\310\15I\310" + "\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\310\0d\310\0d\310\0d\5ii\310\0d\310" + "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0" + "d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310" + "\0d\310\0d\310\0d\310\0d77\5\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310" + "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0" + "d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\5ii\310\0d\310" + "\0d\310\0d\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310" + "\15I\310\15I\310\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\310\0d\310\0d\5ii\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310" + "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0" + "d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d77\5\310" + "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0" + "d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310" + "\0d\310\0d\310\0d\310\0d\310\0d\5ii\310\0d\310\0d\15I\310\15I\310\15I\310" + "\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\310\0d\5ii\310\0d\310\0d\310" + "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0" + "d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310" + "\0d\310\0d\310\0d\310\0d\310\0d77\5\310\0d\310\0d\310\0d\310\0d\310\0d\310" + "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0" + "d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310" + "\0d\5ii\310\0d\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15" + "I\310\15I\310\15I\310\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\5ii\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310" + "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0" + "d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d7" + "7\5\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0" + "d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310" + "\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\310\0d\5ii\15I\310\15I\310" + "\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\5ii\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0""77\5\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I" + "\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I" + "\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I" + "\310\15I\310\15I\310\15I\310\15I\310\5ii\15I\310\15I\310\15I\310\15I\310" + "\15I\310\15I\310\15I\310\15I\310\15I\310\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\5ii\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0""77\5\15I" + "\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I" + "\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I" + "\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I" + "\310\15I\310\15I\310\5ii\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310" + "\15I\310\15I\310\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\5ii\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0""77\5\15I\310\15I\310\15I\310\15I" + "\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I" + "\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I" + "\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I" + "\310\5ii\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\5ii\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0""77\5\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I" + "\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I" + "\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I" + "\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\5ii\15I\310" + "\15I\310\15I\310\15I\310\15I\310\15I\310\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\5" + "ii\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0""77\5\15I" + "\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I" + "\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I" + "\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I" + "\310\15I\310\15I\310\15I\310\15I\310\15I\310\5ii\15I\310\15I\310\15I\310" + "\15I\310\15I\310\0\0\0\0\0\0\0\0\0\0\0\0\5ii\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0""77\5\15I\310\15I\310\15I\310\15I" + "\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I" + "\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I" + "\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I" + "\310\15I\310\15I\310\15I\310\5ii\15I\310\15I\310\15I\310\15I\310\0\0\0\0" + "\0\0\0\0\0\5ii\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0""77\5\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I" + "\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I" + "\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I" + "\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I" + "\310\15I\310\5ii\15I\310\15I\310\15I\310\0\0\0\0\0\0\5ii\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0""77\5\15I" + "\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I" + "\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I" + "\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I" + "\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\5ii" + "\15I\310\15I\310\0\0\0\5ii\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0""77\5\15I\310\15I\310\15I\310\15I" + "\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I" + "\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I" + "\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I" + "\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\5ii\15I\310\5ii\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0""77\5\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I" + "\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I" + "\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I" + "\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I\310\15I" + "\310\15I\310\15I\310\15I\310\15I\310\5ii", +}; + +/** + * \brief Returns the Primitives test image as SDL_Surface. + */ +SDL_Surface *SDLTest_ImagePrimitives() +{ + SDL_Surface *surface = SDL_CreateRGBSurfaceFrom( + (void*)SDLTest_imagePrimitives.pixel_data, + SDLTest_imagePrimitives.width, + SDLTest_imagePrimitives.height, + SDLTest_imagePrimitives.bytes_per_pixel * 8, + SDLTest_imagePrimitives.width * SDLTest_imagePrimitives.bytes_per_pixel, +#if (SDL_BYTEORDER == SDL_BIG_ENDIAN) + 0xff000000, /* Red bit mask. */ + 0x00ff0000, /* Green bit mask. */ + 0x0000ff00, /* Blue bit mask. */ + 0x000000ff /* Alpha bit mask. */ +#else + 0x000000ff, /* Red bit mask. */ + 0x0000ff00, /* Green bit mask. */ + 0x00ff0000, /* Blue bit mask. */ + 0xff000000 /* Alpha bit mask. */ +#endif + ); + return surface; +} diff --git a/src/eepp/helper/SDL2/src/test/SDL_test_imagePrimitivesBlend.c b/src/eepp/helper/SDL2/src/test/SDL_test_imagePrimitivesBlend.c new file mode 100644 index 000000000..ce9adc51a --- /dev/null +++ b/src/eepp/helper/SDL2/src/test/SDL_test_imagePrimitivesBlend.c @@ -0,0 +1,694 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2013 Sam Lantinga + + 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 + appreciated but is not required. + 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. +*/ +#include "SDL_config.h" + +#include "SDL_test.h" + +/* GIMP RGB C-Source image dump (alpha.c) */ + +const SDLTest_SurfaceImage_t SDLTest_imagePrimitivesBlend = { + 80, 60, 3, + "\260e\15\222\356/\37\313\15\36\330\17K\3745D\3471\0\20\0D\3502D\3502<\321" + ",\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\0-\0\377\377" + "\377\377\377\377\311\324\311\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\0H\0\377\377\377\377\377\377\256\307\256\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\0c\0\377\377\377\377\377\377" + "\223\300\223\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\0~\0\377\377\377\377\377\377x\277x\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\0\231\0\377\377\377\377\377\377]\303]\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\0\264\0\377\377\377\377\377" + "\377B\316B\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\0" + "\317\0\377\377\377\377\377\377'\335'\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\0\352\0\377\377\377#\262\6\260d\15\260e\15\224\357" + "/&\262\6\34\300\5.\314\22\40\315\12[\3747M\332/\27\331\12\27\331\12K\374" + "5K\3745K\3745D\3471D\3471D\3471D\3471D\3471D\3502D\3502D\3502D\3502D\350" + "2D\3502D\3502D\3502D\3502D\3502\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377,\372\27\273\3465\327" + "Q.\260d\15\213\213\40\241\3601\200\366*=\265\13?\301\25s\375\265\14\177\252+\201\210\16\245\204" + "*\377\314U\312\\,\224'\11\260i\17\244\210\40\232\2211\331\353J\215\2351\377" + "\377\276\200\2521\200\2542\375\377\310u\2661t\2702t\2702\367\377\324\325" + "\355\305h\3021h\3042h\3042\377\377\377\377\377\377\364\377\336\335\364\323" + "\335\364\323\335\364\323\\\3202\\\3202\\\3202\\\3202\\\3202\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\346\371\342\346\371\342\346" + "\371\342\346\371\342\346\371\342\346\371\342\346\371\342\377\377\377\377" + "\377\377P\3342P\3342P\3342P\3342P\3342P\3342P\3342P\3342\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\27\331\12Y\316-h\3021\243\370Cg\230\15\230\224\"\245" + "\204*\377\314U\310J\21\327Q.\260b\21\245\2041\370\343N\230\2242\331\353J" + "\214\2402\377\377\276\200\2521\200\2542\375\377\310\317\344\266u\2661t\270" + "2\377\377\377\367\377\324\325\355\305h\3021h\3042h\3042h\3042\377\377\377" + "\377\377\377\364\377\336\335\364\323\335\364\323\335\364\323\335\364\323" + "\\\3202\\\3202\\\3202\\\3202\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\346\371\342\346\371" + "\342\346\371\342\346\371\342\346\371\342\346\371\342\377\377\377\377\377" + "\377\377\377\377\377\377\377P\3342P\3342P\3342P\3342P\3342P\3342P\3342P\334" + "2\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377K\3745!\315\13d\304,p\270)\177\252+\23\13\6\232\2211\245\204" + "1\347\270O\377\277Y\324<\22\265V\24\377\330Q\244\210\40#(\13\230\224\"\331" + "\353Ju\211.\377\377\276\200\2521\210\273:\200\2542\375\377\310\20""3\6u\266" + "1t\2702\271\307\271\367\377\324\325\355\305\341\377\321h\3021h\3042\16L\7" + "h\3042\377\377\377\242\300\242\377\377\377\335\364\323\355\377\343\335\364" + "\323\335\364\323\14f\7\\\3202\\\3202>\250*\\\3202\377\377\377\377\377\377" + "\377\377\377\377\377\377$\231$\377\377\377\377\377\377s\303s\377\377\377" + "\346\371\342\376\377\372\346\371\342\346\371\342\40\257\37\346\371\342\346" + "\371\342\\\316\\\377\377\377\377\377\377\377\377\377\377\377\377P\3342\13" + "\262\7P\3342P\3342*\327%P\3342P\3342o\377Q\377\377\377\377\377\377$\352$" + "\377\377\377\377\377\377K\3745]\3749s\375<\212\373@\243\370C\274\363G\331" + "\353J\370\343N\377\330Q\377\314U\377\277Y\377\260\\\224(\11\260|\36\245\204" + "1\377\377\250\232\2211\230\224\"\215\2351\214\2402\377\377\276\312\332\250" + "\200\2521\200\2542\377\377\377\317\344\266u\2661t\2702t\2702\377\377\377" + "\377\377\377\325\355\305\325\355\305\325\355\305h\3042h\3042h\3042\377\377" + "\377\377\377\377\377\377\377\377\377\377\335\364\323\335\364\323\335\364" + "\323\335\364\323\335\364\323\\\3202\\\3202\\\3202\\\3202\\\3202\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\346\371\342\346\371\342" + "\346\371\342\346\371\342\346\371\342\346\371\342\346\371\342\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377P\3342P\3342" + "P\3342P\3342\377\377\377K\3745O\3321\\\3161h\3021t\2702~\254'\214\240%\377" + "\377\262\370\343N\377\330Q\262x1\277l1\312`1\327R.\260X\23\377\330Q\244\210" + "2\377\377\250\230\2242\377\377\262\215\2351\214\2402\377\377\377\312\332" + "\250\200\2521\200\2542\377\377\377\375\377\310\317\344\266u\2661t\2702t\270" + "2\377\377\377\377\377\377\325\355\305\325\355\305\325\355\305h\3042h\304" + "2h\3042h\3042\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\335\364\323\335\364\323\335\364\323\335\364\323\377\377\377\\\3202\\\320" + "2\\\3202\\\3202\\\3202\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\346\371\342\346\371\342\346\371\342\346" + "\371\342\346\371\342\346\371\342\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377D\3471O\3321\21\7\11c\304+\367\377\324o\2520\200\252" + "1\214\2402\235\226'\377\377\250\377\330Q!\20\11\277l1\310d2\266?\33\224(" + "\11\260|\36\257\217;\377\377\250\232\2211\34$\11\377\377\262\215\2351q\206" + "0\377\377\377\312\332\250\217\303@\200\2542\200\25420Z0\317\344\266\317\344" + "\266X\2260t\2702t\2702\377\377\377\377\377\377\325\355\305(l%\325\355\305" + "\325\355\305K\2410h\3042h\3042\377\377\377\377\377\377\377\377\3770\2200" + "\377\377\377\377\377\377t\274p\335\364\323\335\364\323\373\377\361\377\377" + "\377\377\377\377\21\213\11\\\3202\\\3202<\274/\\\3202\377\377\377\377\377" + "\377\377\377\377\377\377\3770\3060\377\377\377\377\377\377V\330V\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\3770\3410\346\371\342\346" + "\371\342>\352>\346\371\342\377\377\377D\3471P\3342\364\377\352s\375\3369\\\3202\377\377\377\377\377\377\377\377\377\377\377\377D\3502\371\377" + "\364O\3321\\\3202\364\377\336h\3042\367\377\324u\2661\200\2542\377\377\276" + "\215\2351\230\2242\307\300\213\244\2102\377\377\234\262x1\274p2\377\337\207" + "\312`1\324E\30\327T1\260|2\377\377\234\245\2041\244\2102\377\377\250\232" + "\2211\230\2242\377\377\377\310\316\231\215\2351\214\2402\377\377\377\377" + "\377\377\312\332\250\312\332\250\200\2542\200\2542\377\377\377\377\377\377" + "\317\344\266\317\344\266\317\344\266t\2702t\2702t\2702\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\325\355\305\325\355\305\325\355" + "\305\377\377\377h\3042h\3042h\3042h\3042\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\335\364\323\335\364\323\335\364\323\335\364\323\377\377\377\377\377" + "\377\377\377\377\377\377\377\\\3202\\\3202\\\3202\377\377\377D\3502\371\377" + "\364O\3321\377\377\377\\\3161h\3042\367\377\324t\2702\375\377\310\200\252" + "1\377\377\377\215\2351\230\2242\377\377\250\244\2102\377\377\234\262x1\274" + "p2\316\214_\310d2\377\310|\327T1\227/\14\377\377\377\307\260|\244\2102\377" + "\377\377\307\300\213\230\2242\230\2242\377\377\377\310\316\231\214\2402\214" + "\2402\377\377\377\377\377\377\312\332\250\312\332\250\200\2542\200\2542\377" + "\377\377\377\377\377\377\377\377\317\344\266\317\344\266\317\344\266t\270" + "2t\2702t\2702\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\325\355\305\325\355\305\325\355\305\377\377\377\377\377\377h\3042h\3042" + "h\3042\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\335\364\323\335\364" + "\323\335\364\323\335\364\323\377\377\377\377\377\377\377\377\377\377\377" + "\377D\3502\371\377\364R\3344\364\377\352\\\3161H\22Hh\3021\377\377\377o\244" + "2\200\2542\312\332\250\226\245<\377\377\262\230\2242H-/\245\2041\377\377" + "\377\233i5\274p2\277l1\331sC\377\310|\324X2*\15\3\260|2\377\377\234\206s" + "7\244\2102\377\377\250\340\337\244\230\2242\377\377\377Hc2\310\316\231\214" + "\2402n\211:\377\377\377\377\377\377\353\377\311\312\332\250\200\2542$T\16" + "\377\377\377\377\377\377\236\277\236\377\377\377\317\344\266\367\377\336" + "\377\377\377t\2702\40n\16t\2702\377\377\377\212\303\212\377\377\377\377\377" + "\377\377\377\377\325\355\305\325\355\305<\2477\377\377\377\377\377\377O\276" + "Ah\3042h\3042\237\377i\377\377\377\377\377\377H\317H\377\377\377\377\377" + "\377c\335c\377\377\377\377\377\377\377\377\377\377\377\377\335\364\323>\337" + ";\335\364\323\377\377\377D\3502\362\375\360P\3342\346\371\342\\\3202\364" + "\377\336h\3042\367\377\324t\2702\375\377\310\200\2542\377\377\276\214\240" + "2\377\377\262\232\2211\377\377\377\245\2041\377\377\377\262x1\377\377\377" + "\277l1\310d2\312`1\324X2\327T1\260|2\377\377\377\307\260|\244\2102\377\377" + "\377\307\300\213\232\2211\230\2242\377\377\377\377\377\262\310\316\231\214" + "\2402\214\2402\377\377\377\377\377\377\312\332\250\312\332\250\200\2542\200" + "\2542\200\2542\377\377\377\377\377\377\377\377\377\317\344\266\317\344\266" + "\317\344\266\377\377\377t\2702t\2702t\2702\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\325\355\305\325\355\305\325\355\305\325\355" + "\305\377\377\377\377\377\377h\3042h\3042h\3042h\3042\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377D\3502\362\375\360P\3342\346\371\342\\\3202\335" + "\364\323h\3042\325\355\305t\2702\317\344\266\377\377\377\200\2521\377\377" + "\377\215\2351\377\377\377\232\2211\377\377\377\245\2041\377\377\377\262x" + "1\377\377\377\277l1\377\377\377\312`1\377\310|\327T1\227/\14\377\377\377" + "\307\260|\244\2102\244\2102\377\377\377\307\300\213\230\2242\230\2242\377" + "\377\377\310\316\231\310\316\231\214\2402\214\2402\377\377\377\377\377\377" + "\312\332\250\312\332\250\377\377\377\200\2542\200\2542\377\377\377\377\377" + "\377\377\377\377\377\377\377\317\344\266\317\344\266\377\377\377\377\377" + "\377t\2702t\2702\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\325\355\305\325\355\305\325\355\305\377\377" + "\377\377\377\377\377\377\377h\3042h\3042h\3042\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377D\3502\362\375\360" + "T\11TO\3321\377\377\377Z\3002\377\377\377h\3042\377\377\334t\2702\375\377" + "\310*\30\20\312\332\250\214\2402\262\260\214\230\2242\307\300\213\377\377" + "\377\245\2041\377\377\377:\35\20\377\377\377\277l1\316\264w\310d2\377\310" + "|\356qL\227/\14\260|2TZ3\307\260|\244\2102\274\302\274\307\300\213\307\300" + "\213\273\301U\377\377\377\377\377\377A^2\310\316\231\214\2402o\216B\377\377" + "\377\377\377\377\366\377\324\312\332\250\312\332\250*a\20\200\2542\377\377" + "\377\230\301\230\377\377\377\377\377\377\377\377\353\317\344\266\317\344" + "\266T\253Tt\2702t\2702]\265I\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377T\306T\377\377\377\325\355\305l\324i\325\355\305\377\377" + "\377\377\377\377\377\377\377h\3042\"\254\20h\3042h\3042b\353b\377\377\377" + "\377\377\377D\3502\362\375\360\377\377\377O\3321\377\377\377\\\3202\364\377" + "\336h\3042\325\355\305t\2702\317\344\266\377\377\377\200\2521\377\377\377" + "\214\2402\377\377\262\230\2242\307\300\213\244\2102\307\260|\377\377\377" + "\262x1\377\377\377\274p2\377\337\207\310d2\377\310|\324X2\333bB\260|2\377" + "\377\377\307\260|\244\2102\244\2102\377\377\377\307\300\213\232\2211\230" + "\2242\377\377\377\377\377\377\310\316\231\310\316\231\214\2402\214\2402\377" + "\377\377\377\377\377\377\377\377\312\332\250\312\332\250\200\2542\200\254" + "2\200\2542\377\377\377\377\377\377\377\377\377\377\377\377\317\344\266\317" + "\344\266\317\344\266\377\377\377t\2702t\2702t\2702\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\325\355\305" + "\325\355\305\325\355\305\325\355\305\377\377\377\377\377\377\377\377\377" + "h\3042h\3042\377\377\377\377\377\377D\3471\377\377\377P\3342\364\377\352" + "\\\3202\335\364\323\377\377\377h\3021\377\377\377t\2702\375\377\310\200\254" + "2\312\332\250\377\377\377\215\2351\377\377\377\230\2242\377\377\250\244\210" + "2\307\260|\377\377\377\262x1\377\377\377\274p2\377\337\207\310d2\323xQ\324" + "X2\327T1\227/\14\260|2\377\377\234\307\260|\244\2102\377\377\377\377\377" + "\377\307\300\213\230\2242\230\2242\377\377\377\377\377\377\310\316\231\310" + "\316\231\214\2402\214\2402\377\377\377\377\377\377\377\377\377\312\332\250" + "\312\332\250\377\377\377\200\2542\200\2542\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\317\344\266\317\344\266\377\377\377\377\377" + "\377t\2702t\2702t\2702\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\325\355\305\325\355\305\325" + "\355\305\377\377\377\377\377\377`\0`\377\377\377D\3471\371\366\371P\3342" + "\346\371\342\377\377\377\\\3161\377\377\377'\24\22\325\355\305t\2702\276" + "\310\251\377\377\377\200\2542\377\377\316\214\2402\310\316\231`6`\230\224" + "2\377\377\250\222u<\307\260|\377\377\377\315\214L\377\377\377\274p2M,#\310" + "d2\312`1\306\304\306\324X2\333bB\325\242W\377\377\377\307\260|=9\22\244\210" + "2\377\377\377\227\234w\307\300\213\230\2242\307\322a\377\377\377\377\377" + "\377Km9\310\316\231\214\2402r\226K\377\377\377\377\377\377\377\377\377\312" + "\332\250\312\332\250`\242`\200\2542\200\2542\224\306\224\377\377\377\377" + "\377\377\377\377\377\377\377\377\317\344\266M\250D\317\344\266\377\377\377" + "\203\322\203t\2702t\2702\301\377\177\377\377\377\377\377\377`\330`\377\377" + "\377\377\377\377r\344r\377\377\377\377\377\377\377\377\377\325\355\305\377" + "\377\377\377\377\377D\3502\371\377\364P\3342\346\371\342\377\377\377\\\320" + "2\364\377\336h\3042\325\355\305\377\377\377t\2702\317\344\266\200\2542\312" + "\332\250\377\377\377\214\2402\310\316\231\230\2242\307\300\213\377\377\377" + "\244\2102\307\260|\377\377\377\200U0\220^\377\7\4/\227U[\246]\377\255Q1\377" + "\242y\10\3/\306M@\6\4/{^\377mVvmVv\6\5/h\\\377h\\\377\\U\204\12\12\360\5" + "\5/VX\377VX\377\12\12\360LR\221\12\12\360\5\6/\214\2402\377\377\377\377\377" + "\377\377\377\377\312\332\250\312\332\250\377\377\377\200\2542\200\2542\200" + "\2542\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\317\344" + "\266\317\344\266\317\344\266\377\377\377\377\377\377t\2702t\2702\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377D\3502\362\375\360P\3342\346\371" + "\342\377\377\377\\\3202\335\364\323\377\377\377h\3042\367\377\324t\2702\317" + "\344\266\377\377\377\200\2542\312\332\250\377\377\377\214\2402\377\377\262" + "\230\2242\307\300\213\377\377\377\244\2102\307\260|{^\377\200U0\220^\377" + "\7\4/\227U[\246]\377\7\3/\377\242y\236\37""2\306M0\210%\14T-2{^\377mVv\6" + "\5/\6\5/h\\\377\\U\204\\U\204\5\5/\5\5/VX\377VX\377LR\221LR\221\377\377\377" + "\214\2402\214\2402\377\377\377\377\377\377\377\377\377\312\332\250\312\332" + "\250\312\332\250\377\377\377\200\2542\200\2542\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\317\344\266\317\344\266\377" + "\377\377\377\377\377t\2702t\2702t\2702\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377D\3502\365\375\363\377\377" + "\377O\3321l\22l\\\3202\335\364\323\357\346\357h\3042\325\355\305\377\377" + "\377t\2702\317\344\266l-l\200\2521\377\377\377\204\211=\310\316\231\377\377" + "\377\262\243L\307\300\213\377\377\377E&\25mVv{^\377ySB\220^\377\7\4/\275" + "t\201\246]\377\7\3/I\37!\277Z\377\10\3/\237YQ\6\4/{^\377\236\213\247mVv\6" + "\5/,-lh\\\377\\U\204dow\5\5/\5\5/\222\251\377VX\377\310\316\231T{@\377\377" + "\377\214\2402w\240V\377\377\377\377\377\377\377\377\377\377\377\377\312\332" + "\250U\231G\377\377\377\200\2542q\270\\\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377l\317l\317\344\266\317\344\266z\330v\377\377\377" + "\377\377\377\323\377\221t\2702t\2702l\352l\377\377\377\377\377\377\377\377" + "\377D\3502\362\375\360\377\377\377P\3342\346\371\342\377\377\377\\\3202\364" + "\377\336h\3042\325\355\305\377\377\377t\2702\317\344\266\377\377\377\200" + "\2542\312\332\250\377\377\377\214\2402\310\316\231\377\377\377\230\2242\307" + "\300\213\377\377\377\6\5/mVv{^\377\200U0\220^\377\7\4/\227U[\246]\377\7\3" + "/\255RN\277Z\377\10\3/\306M@\6\4/{^\377{^\377mVv\6\5/\6\5/h\\\377h\\\377" + "\\U\204\12\12\360\5\5/\12\12\360\377\377\377\377\377\377\310\316\231\310" + "\316\231\377\377\377\214\2402\214\2402\377\377\377\377\377\377\377\377\377" + "\377\377\377\312\332\250\312\332\250\377\377\377\200\2542\200\2542\200\254" + "2\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\317\344\266\317\344\266\317\344\266\377\377\377\377\377\377t\2702t\2702" + "\377\377\377\377\377\377D\3502\362\375\360\377\377\377P\3342\346\371\342" + "\377\377\377\\\3202\335\364\323\377\377\377h\3042\325\355\305\377\377\377" + "t\2702\317\344\266\377\377\377\200\2542\312\332\250\377\377\377\214\2402" + "\310\316\231\377\377\377\230\2242\307\300\213h\\\377\6\5/mVv{^\377\200U0" + "\220^\377\7\4/\227U[\246]\377\7\3/\255RN\277Z\377\10\3/\306M@\6\4/\6\4/{" + "^\377mVvmVv\6\5/\12\12\360h\\\377\\U\204\\U\204\5\5/\230\2242\377\377\377" + "\377\377\377\377\377\377\310\316\231\310\316\231\377\377\377\214\2402\214" + "\2402\377\377\377\377\377\377\377\377\377\377\377\377\312\332\250\312\332" + "\250\377\377\377\377\377\377\200\2542\200\2542\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\317\344\266\317" + "\344\266\377\377\377\377\377\377\377\377\377\377\377\377D\3502q\10p\377\377" + "\377P\3342\335\350\332\377\377\377\\\3202\351\366\337\377\377\377h\3042d" + "!\\\377\377\377t\2702\277\302\252\377\377\377\200\2542\343\345\301\377\377" + "\377\214\2402^2H\377\377\377\230\2242\257\235\204h\\\377\6\5/\223o\234{^" + "\377\6\4/<\36""1\377\252\215j)2\211XK\377\250\203\202$2\337~c\377\242y\236" + "\37""2]#\26\306M@\6\4/ym\274{^\377mVvELn\6\5/h\\\37703x\\U\204\307\300\213" + "\204\226\\\230\2242\377\377\377\377\377\377\377\377\377\310\316\231^\212" + "H\377\377\377\214\2402}\256b\377\377\377\377\377\377\377\377\377\377\377" + "\377\312\332\250_\251O\377\377\377\377\377\377y\310j\200\2542\377\377\377" + "\377\377\377\377\377\377\377\377\377x\341x\377\377\377\377\377\377\177\350" + "|\317\344\266\377\377\377\377\377\377D\3502\362\375\360\377\377\377P\334" + "2\346\371\342\377\377\377\\\3202\335\364\323\377\377\377\377\377\377h\304" + "2\325\355\305\377\377\377t\2702\317\344\266\377\377\377\200\2542\312\332" + "\250\377\377\377\214\2402\310\316\231\377\377\377\230\2242\\U\204h\\\377" + "\6\5/mVv{^\377\6\4/\12\12\360\201Vi\220^\377\7\4/\227U[\246]\377\7\3/\255" + "RN\277Z\377\10\3/\306M@\6\4/\12\12\360{^\377mVvmVv\6\5/\12\12\360h\\\377" + "\377\377\377\307\300\213\377\377\377\230\2242\230\2242\377\377\377\377\377" + "\377\377\377\377\310\316\231\310\316\231\377\377\377\214\2402\214\2402\377" + "\377\377\377\377\377\377\377\377\377\377\377\312\332\250\312\332\250\312" + "\332\250\377\377\377\200\2542\200\2542\200\2542\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377D\350" + "2\362\375\360\377\377\377P\3342\377\377\377\346\371\342\377\377\377\\\320" + "2\335\364\323\377\377\377h\3042\325\355\305\377\377\377t\2702\317\344\266" + "\377\377\377\200\2542\377\377\377\312\332\250\377\377\377\214\2402\310\316" + "\231\377\377\377\5\5/\\U\204h\\\377\6\5/mVv{^\377\6\4/\12\12\360\201Vi\220" + "^\377\7\4/\227U[\246]\377\7\3/\255RN\277Z\377\10\3/\306M@\6\4/\6\4/{^\377" + "\12\12\360mVv\6\5/\6\5/\377\377\377\377\377\377\307\300\213\307\300\213\377" + "\377\377\230\2242\377\377\377\377\377\377\377\377\377\377\377\377\310\316" + "\231\310\316\231\377\377\377\214\2402\214\2402\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\312\332\250\312\332\250\377\377\377\377" + "\377\377\200\2542\200\2542\377\377\377\377\377\377\377\377\377\377\377\377" + "\204\0\204\377\377\377D\3502\355\364\353\377\377\377\377\377\377Y\335;\346" + "\371\342\377\377\377/\26\31\335\364\323\377\377\377k\255<\325\355\305\377" + "\377\377\377\377\377t\2702\317\344\266\2046\204\200\2542\312\332\250\340" + "\317\340\214\2402\310\316\231\377\377\377VX\377\5\5//\33Dh\\\377\6\5/tVz" + "{^\377\6\4/=0\377\201Vi\220^\377\3\1\30\227U[\246]\377?6U\255RN\277Z\377" + "\337]s\306M0\306M@\3\2\30{^\377{^\377yv}mVv\244\2102\377\377\377\377\377" + "\377\377\377\377gyG\307\300\213\230\2242\212\242h\377\377\377\377\377\377" + "\377\377\377\377\377\377\310\316\231g\230O\377\377\377\214\2402\205\274q" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377h\270V\312\332" + "\250\377\377\377\222\344\222\200\2542\200\2542\377\377\377\377\377\377\377" + "\377\377\377\377\377D\3502\362\375\360\377\377\377\377\377\377P\3342\346" + "\371\342\377\377\377\\\3202\335\364\323\377\377\377\377\377\377h\3042\325" + "\355\305\377\377\377t\2702\317\344\266\377\377\377\377\377\377\200\2542\312" + "\332\250\377\377\377\214\2402\310\316\231VX\377\12\12\360\5\5/\\U\204h\\" + "\377\6\5/mVv{^\377\6\4/\12\12\360\201Vi\220^\377\7\4/\227U[\246]\377\7\3" + "/\255RN\255RN\277Z\377\10\3/\306M@\6\4/\12\12\360{^\377\12\12\360\307\260" + "|\244\2102\244\2102\377\377\377\377\377\377\377\377\377\307\300\213\377\377" + "\377\230\2242\230\2242\377\377\377\377\377\377\377\377\377\377\377\377\310" + "\316\231\377\377\377\377\377\377\214\2402\214\2402\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\312\332\250\312\332\250\377\377\377" + "\377\377\377\200\2542\200\2542\377\377\377\377\377\377D\3502\377\377\377" + "\362\375\360\377\377\377P\3342\346\371\342\377\377\377\\\3202\377\377\377" + "\335\364\323\377\377\377h\3042\325\355\305\377\377\377\377\377\377t\2702" + "\317\344\266\377\377\377\200\2542\312\332\250\377\377\377\377\377\377\214" + "\2402LR\221VX\377\5\5/\\U\204\12\12\360h\\\377\6\5/mVv{^\377\6\4/\12\12\360" + "\201Vi\220^\377\7\4/\227U[\246]\377\7\3/\7\3/\255RN\277Z\377\10\3/\306M@" + "\6\4/\6\4/{^\377\377\377\377\307\260|\377\377\377\244\2102\377\377\377\377" + "\377\377\377\377\377\307\300\213\307\300\213\377\377\377\230\2242\377\377" + "\377\377\377\377\377\377\377\377\377\377\310\316\231\310\316\231\377\377" + "\377\377\377\377\214\2402\214\2402\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\312\332\250\312\332\250\377\377\377\377\377\377\377" + "\377\377\377\377\377D\3502\377\377\377\362\375\360\377\377\377-\17\34\346" + "\371\342\377\377\377\363\346\363\\\3202\335\364\323\377\377\377h\3042\377" + "\377\377x)o\377\377\377t\2702\301\276\255\377\377\377\377\377\377\243\273" + "U\312\332\250\377\377\377O-\34\12\12\360LR\221gU\333\5\5/\\U\204<)\377h\\" + "\377\6\5/=!B{^\377\6\4/A2\306\201Vi\220^\377I9q\227U[\246]\377]-\220\7\3" + "/\255RN\245q\304\10\3/\306M0\377\236\221\6\4/\377\377\377\220\231\220\307" + "\260|\307\260|\226\227m\244\2102\377\377\377\377\377\377\377\377\377\307" + "\300\213p\207N\230\2242\230\2242\254\316\254\377\377\377\377\377\377\377" + "\377\377\310\316\231\310\316\231\220\317\220\377\377\377\214\2402\216\316" + "\200\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377r\310^\312" + "\332\250\377\377\377\377\377\377\377\377\377D\3502\362\375\360\377\377\377" + "P\3342\377\377\377\346\371\342\377\377\377\\\3202\335\364\323\377\377\377" + "\377\377\377h\3042\325\355\305\377\377\377\377\377\377t\2702\317\344\266" + "\377\377\377\200\2542\377\377\377\312\332\250\377\377\377\5\6/LR\221\12\12" + "\360VX\377\5\5/\\U\204h\\\377\12\12\360\6\5/mVv{^\377\6\4/\12\12\360\201" + "Vi\220^\377\7\4/\227U[\12\12\360\246]\377\7\3/\255RN\277Z\377\277Z\377\10" + "\3/\306M@\260|2\260|2\377\377\377\377\377\377\307\260|\377\377\377\244\210" + "2\377\377\377\377\377\377\377\377\377\377\377\377\307\300\213\377\377\377" + "\230\2242\230\2242\377\377\377\377\377\377\377\377\377\377\377\377\310\316" + "\231\310\316\231\377\377\377\377\377\377\214\2402\214\2402\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377D\3502\362\375\360\377\377\377P\3342\377\377\377\346\371\342\377" + "\377\377\\\3202\377\377\377\335\364\323\377\377\377h\3042\325\355\305\377" + "\377\377\377\377\377t\2702\317\344\266\377\377\377\377\377\377\200\2542\312" + "\332\250\377\377\377\12\12\360\5\6/LR\221VX\377\12\12\360\5\5/\\U\204h\\" + "\377\6\5/\12\12\360mVv{^\377\6\4/\12\12\360\201Vi\220^\377\7\4/\227U[\227" + "U[\246]\377\7\3/\255RN\12\12\360\277Z\377\10\3/\333bB\377\377\377\260|2\377" + "\377\377\377\377\377\307\260|\307\260|\244\2102\244\2102\377\377\377\377" + "\377\377\377\377\377\307\300\213\307\300\213\377\377\377\230\2242\230\224" + "2\377\377\377\377\377\377\377\377\377\377\377\377\310\316\231\310\316\231" + "\377\377\377\377\377\377\214\2402\214\2402\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377)\10\36\362\375\360\377\377\377\370" + "\356\370P\3342\346\371\342\377\377\377\377\377\377\\\3202\207\"\201\377\377" + "\377\377\377\377p\250D\325\355\305\377\377\377\377\377\377t\2702\317\344" + "\266\234?\234\200\2542\377\377\377\274\260\244FS\377\5\6/;#\377LR\221VX\377" + "\3\1\34\12\12\360\\U\204{^\330\6\5/\12\12\360\257\203\270{^\377\6\4/\6\4" + "\222\201Vi\220^\377P@d\12\12\360\227U[\370\244\377\7\3/\255RNi./\277Z\377" + "\324X2\264\202w\333bB\260|2\377\377\377\377\377\377\377\377\377yvK\377\377" + "\377\244\2102\236\247|\377\377\377\377\377\377\377\377\377\307\300\213\307" + "\300\213\234\306\234\230\2242\377\377\377\256\330\256\377\377\377\377\377" + "\377\377\377\377\310\316\231\310\316\231\234\341\234\377\377\377\214\240" + "2\232\343\223\377\377\377\377\377\377\377\377\377\377\377\377D\3502\362\375" + "\360\377\377\377\377\377\377P\3342\346\371\342\377\377\377\377\377\377\\" + "\3202\335\364\323\377\377\377\377\377\377h\3042\325\355\305\377\377\377\377" + "\377\377t\2702\317\344\266\377\377\377\377\377\377\200\2542\312\332\250\12" + "\12\360FS\377\5\6/LR\221\12\12\360RW\255\3\5\35\6\11\224ZT\\d[\261\3\4\35" + "\6\11\224lVTw]\264\4\4\35\6\11\224\200VN\214]\270\4\3\35\6\11\224\226UG\242" + "\\\274\4\3\35\4\3\35\254R@\377\377\311\203U\36\203U\36\323a:my\36my\36\377" + "\377\276\377\377\276\243\255X\243\255X\236\371\236e\204\36\236\371\236\374" + "\377\273\236\371\236\236\371\236\234\275`\236\371\236^\220\36^\220\36\236" + "\371\236\352\377\267\352\377\267\236\371\236\236\371\236\310\316\231\310" + "\316\231\377\377\377\377\377\377\214\2402\377\377\377\377\377\377\377\377" + "\377D\3502\362\375\360\377\377\377\377\377\377P\3342\346\371\342\377\377" + "\377\377\377\377\\\3202\377\377\377\335\364\323\377\377\377h\3042\377\377" + "\377\325\355\305\377\377\377t\2702\377\377\377\317\344\266\377\377\377\377" + "\377\377\200\2542\346\3\4\35lVT\4\4hw]\264\4\4\35aK\244\200VN\214]\270kZ\371\4\3\35" + "\270\212Io\225o\377\377\306{a\36\253\300\253\304wB\377\377\311\377\377\377" + "\203U\36\323a:\224D(my\36\236\371\236\307\316\266\377\377\276\236\371\236" + "\377\377\343\236\371\236e\204\36Gk\25\236\371\236\374\377\273\260\334\260" + "\236\371\236\234\275`\377\377\377\377\377\377\230\2242k\207#\377\377\377" + "\377\377\377\377\377\377\377\377\377D\3502\377\377\377\362\375\360\377\377" + "\377\377\377\377P\3342\346\371\342\377\377\377\377\377\377\\\3202\377\377" + "\377\335\364\323\377\377\377\377\377\377h\3042\377\377\377\325\355\305\377" + "\377\377\377\377\377t\2702\317\344\266\377\377\3778L\377\12\12\360\5\6/<" + "L\237\12\12\360BR\252\3\5\35\6\11\224JQbRW\255\6\11\224\3\5\35ZT\\\6\11\224" + "d[\261\6\11\224\3\4\35lVT\6\11\224w]\264\4\4\35\6\11\224\200VN\214]\270\6" + "\11\224tm\36\270\212I\270\212I\377\377\306{a\36{a\36\304wB\236\371\236\377" + "\377\311\203U\36\236\371\236\323a:my\36my\36\236\371\236\377\377\276\236" + "\371\236\243\255X\243\255X\236\371\236e\204\36\236\371\236\374\377\273\374" + "\377\273\236\371\236\307\300\213\307\300\213\377\377\377\377\377\377\230" + "\2242\377\377\377\377\377\377\377\377\377D\3502\377\377\377\362\375\360\377" + "\377\377\377\377\377P\3342\377\377\377\346\371\342\377\377\377\377\377\377" + "\\\3202\335\364\323\377\377\377\377\377\377\377\377\377h\3042\325\355\305" + "\377\377\377\377\377\377t\2702\377\377\377\317\344\2668L\377\12\12\360\5" + "\6/\12\12\360 + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,27 +21,23 @@ /* - 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" #include /* va_list */ -#include +#include #include #include -#include "SDL_test.h" +#include "SDL.h" -/* - * Note: Maximum size of SDLTest log message is less than SDLs limit - * to ensure we can fit additional information such as the timestamp. - */ -#define SDLTEST_MAX_LOGMESSAGE_LENGTH 3584 +#include "SDL_test.h" /*! * Converts unix timestamp to its ascii representation in localtime @@ -52,54 +48,54 @@ * * \param timestamp A Timestamp, i.e. time(0) * - * \return Ascii representation of the timestamp in localtime + * \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[256]; - struct tm *local; + time_t copy; + static char buffer[64]; + struct tm *local; - memset(buffer, 0, sizeof(buffer));\ - copy = timestamp; - local = localtime(©); - strftime(buffer, sizeof(buffer), "%a %Y-%m-%d %H:%M:%S %Z", local); + SDL_memset(buffer, 0, sizeof(buffer));\ + copy = timestamp; + local = localtime(©); + strftime(buffer, sizeof(buffer), "%x %X", local); - return buffer; + return buffer; } /* * Prints given message with a timestamp in the TEST category and INFO priority. */ -void SDLTest_Log(char *fmt, ...) +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 - 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\n", 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); } /* * Prints given message with a timestamp in the TEST category and the ERROR priority. */ -void SDLTest_LogError(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 - 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\n", 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/eepp/helper/SDL2/src/test/SDL_test_md5.c b/src/eepp/helper/SDL2/src/test/SDL_test_md5.c index c26fa6144..3f42ed356 100644 --- a/src/eepp/helper/SDL2/src/test/SDL_test_md5.c +++ b/src/eepp/helper/SDL2/src/test/SDL_test_md5.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -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/eepp/helper/SDL2/src/test/SDL_test_random.c b/src/eepp/helper/SDL2/src/test/SDL_test_random.c index 01fa413f2..2c70dbd47 100644 --- a/src/eepp/helper/SDL2/src/test/SDL_test_random.c +++ b/src/eepp/helper/SDL2/src/test/SDL_test_random.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -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 +#include #include #include @@ -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/eepp/helper/SDL2/src/thread/SDL_systhread.h b/src/eepp/helper/SDL2/src/thread/SDL_systhread.h index 51a95a4b3..694ea7f27 100644 --- a/src/eepp/helper/SDL2/src/thread/SDL_systhread.h +++ b/src/eepp/helper/SDL2/src/thread/SDL_systhread.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/thread/SDL_thread.c b/src/eepp/helper/SDL2/src/thread/SDL_thread.c index 8b6d30ce0..61e252c17 100644 --- a/src/eepp/helper/SDL2/src/thread/SDL_thread.c +++ b/src/eepp/helper/SDL2/src/thread/SDL_thread.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -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. @@ -85,7 +85,7 @@ SDL_AddThread(SDL_Thread * thread) return; } } - SDL_mutexP(thread_lock); + SDL_LockMutex(thread_lock); /* Expand the list of threads, if necessary */ #ifdef DEBUG_THREADS @@ -118,7 +118,7 @@ SDL_DelThread(SDL_Thread * thread) if (!thread_lock) { return; } - SDL_mutexP(thread_lock); + SDL_LockMutex(thread_lock); for (i = 0; i < SDL_numthreads; ++i) { if (thread == SDL_Threads[i]) { break; @@ -164,7 +164,7 @@ SDL_GetErrBuf(void) SDL_threadID this_thread; this_thread = SDL_ThreadID(); - SDL_mutexP(thread_lock); + SDL_LockMutex(thread_lock); for (i = 0; i < SDL_numthreads; ++i) { if (this_thread == SDL_Threads[i]->threadid) { errbuf = &SDL_Threads[i]->errbuf; diff --git a/src/eepp/helper/SDL2/src/thread/SDL_thread_c.h b/src/eepp/helper/SDL2/src/thread/SDL_thread_c.h index 565eb3d0e..64fb77894 100644 --- a/src/eepp/helper/SDL2/src/thread/SDL_thread_c.h +++ b/src/eepp/helper/SDL2/src/thread/SDL_thread_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -34,8 +34,8 @@ #include "pthread/SDL_systhread_c.h" #elif SDL_THREAD_WINDOWS #include "windows/SDL_systhread_c.h" -#elif SDL_THREAD_NDS -#include "nds/SDL_systhread_c.h" +#elif SDL_THREAD_PSP +#include "psp/SDL_systhread_c.h" #else #error Need thread implementation for this platform #include "generic/SDL_systhread_c.h" diff --git a/src/eepp/helper/SDL2/src/thread/beos/SDL_syssem.c b/src/eepp/helper/SDL2/src/thread/beos/SDL_syssem.c index 7237bd5ec..9661f9012 100644 --- a/src/eepp/helper/SDL2/src/thread/beos/SDL_syssem.c +++ b/src/eepp/helper/SDL2/src/thread/beos/SDL_syssem.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -73,8 +73,7 @@ SDL_SemWaitTimeout(SDL_sem * sem, Uint32 timeout) int retval; if (!sem) { - SDL_SetError("Passed a NULL semaphore"); - return -1; + return SDL_SetError("Passed a NULL semaphore"); } tryagain: @@ -97,8 +96,7 @@ SDL_SemWaitTimeout(SDL_sem * sem, Uint32 timeout) retval = SDL_MUTEX_TIMEDOUT; break; default: - SDL_SetError("acquire_sem() failed"); - retval = -1; + retval = SDL_SetError("acquire_sem() failed"); break; } @@ -139,13 +137,11 @@ int SDL_SemPost(SDL_sem * sem) { if (!sem) { - SDL_SetError("Passed a NULL semaphore"); - return -1; + return SDL_SetError("Passed a NULL semaphore"); } if (release_sem(sem->id) != B_NO_ERROR) { - SDL_SetError("release_sem() failed"); - return -1; + return SDL_SetError("release_sem() failed"); } return 0; } diff --git a/src/eepp/helper/SDL2/src/thread/beos/SDL_systhread.c b/src/eepp/helper/SDL2/src/thread/beos/SDL_systhread.c index 9558e2937..11646f974 100644 --- a/src/eepp/helper/SDL2/src/thread/beos/SDL_systhread.c +++ b/src/eepp/helper/SDL2/src/thread/beos/SDL_systhread.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -77,8 +77,7 @@ SDL_SYS_CreateThread(SDL_Thread * thread, void *args) thread->handle = spawn_thread(RunThread, name, B_NORMAL_PRIORITY, args); if ((thread->handle == B_NO_MORE_THREADS) || (thread->handle == B_NO_MEMORY)) { - SDL_SetError("Not enough resources to create thread"); - return (-1); + return SDL_SetError("Not enough resources to create thread"); } resume_thread(thread->handle); return (0); diff --git a/src/eepp/helper/SDL2/src/thread/beos/SDL_systhread_c.h b/src/eepp/helper/SDL2/src/thread/beos/SDL_systhread_c.h index 8acc3d990..a350ab594 100644 --- a/src/eepp/helper/SDL2/src/thread/beos/SDL_systhread_c.h +++ b/src/eepp/helper/SDL2/src/thread/beos/SDL_systhread_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/thread/generic/SDL_syscond.c b/src/eepp/helper/SDL2/src/thread/generic/SDL_syscond.c index 7304badc1..f540cddb6 100644 --- a/src/eepp/helper/SDL2/src/thread/generic/SDL_syscond.c +++ b/src/eepp/helper/SDL2/src/thread/generic/SDL_syscond.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -82,8 +82,7 @@ int SDL_CondSignal(SDL_cond * cond) { if (!cond) { - SDL_SetError("Passed a NULL condition variable"); - return -1; + return SDL_SetError("Passed a NULL condition variable"); } /* If there are waiting threads not already signalled, then @@ -107,8 +106,7 @@ int SDL_CondBroadcast(SDL_cond * cond) { if (!cond) { - SDL_SetError("Passed a NULL condition variable"); - return -1; + return SDL_SetError("Passed a NULL condition variable"); } /* If there are waiting threads not already signalled, then @@ -164,8 +162,7 @@ SDL_CondWaitTimeout(SDL_cond * cond, SDL_mutex * mutex, Uint32 ms) int retval; if (!cond) { - SDL_SetError("Passed a NULL condition variable"); - return -1; + return SDL_SetError("Passed a NULL condition variable"); } /* Obtain the protection mutex, and increment the number of waiters. diff --git a/src/eepp/helper/SDL2/src/thread/generic/SDL_sysmutex.c b/src/eepp/helper/SDL2/src/thread/generic/SDL_sysmutex.c index 1a6b2715c..3e3c1fea9 100644 --- a/src/eepp/helper/SDL2/src/thread/generic/SDL_sysmutex.c +++ b/src/eepp/helper/SDL2/src/thread/generic/SDL_sysmutex.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -68,9 +68,9 @@ SDL_DestroyMutex(SDL_mutex * mutex) } } -/* Lock the semaphore */ +/* Lock the mutex */ int -SDL_mutexP(SDL_mutex * mutex) +SDL_LockMutex(SDL_mutex * mutex) { #if SDL_THREADS_DISABLED return 0; @@ -78,8 +78,7 @@ SDL_mutexP(SDL_mutex * mutex) SDL_threadID this_thread; if (mutex == NULL) { - SDL_SetError("Passed a NULL mutex"); - return -1; + return SDL_SetError("Passed a NULL mutex"); } this_thread = SDL_ThreadID(); @@ -99,6 +98,39 @@ SDL_mutexP(SDL_mutex * mutex) #endif /* SDL_THREADS_DISABLED */ } +/* try Lock the mutex */ +int +SDL_TryLockMutex(SDL_mutex * mutex) +{ +#if SDL_THREADS_DISABLED + return 0; +#else + int retval = 0; + SDL_threadID this_thread; + + if (mutex == NULL) { + return SDL_SetError("Passed a NULL mutex"); + } + + this_thread = SDL_ThreadID(); + if (mutex->owner == this_thread) { + ++mutex->recursive; + } else { + /* The order of operations is important. + We set the locking thread id after we obtain the lock + so unlocks from other threads will fail. + */ + retval = SDL_SemWait(mutex->sem); + if (retval == 0) { + mutex->owner = this_thread; + mutex->recursive = 0; + } + } + + return retval; +#endif /* SDL_THREADS_DISABLED */ +} + /* Unlock the mutex */ int SDL_mutexV(SDL_mutex * mutex) @@ -107,14 +139,12 @@ SDL_mutexV(SDL_mutex * mutex) return 0; #else if (mutex == NULL) { - SDL_SetError("Passed a NULL mutex"); - return -1; + return SDL_SetError("Passed a NULL mutex"); } /* If we don't own the mutex, we can't unlock it */ if (SDL_ThreadID() != mutex->owner) { - SDL_SetError("mutex not owned by this thread"); - return -1; + return SDL_SetError("mutex not owned by this thread"); } if (mutex->recursive) { diff --git a/src/eepp/helper/SDL2/src/thread/generic/SDL_sysmutex_c.h b/src/eepp/helper/SDL2/src/thread/generic/SDL_sysmutex_c.h index ed546b689..8d6dbdc2b 100644 --- a/src/eepp/helper/SDL2/src/thread/generic/SDL_sysmutex_c.h +++ b/src/eepp/helper/SDL2/src/thread/generic/SDL_sysmutex_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/thread/generic/SDL_syssem.c b/src/eepp/helper/SDL2/src/thread/generic/SDL_syssem.c index f99e42acd..fc4e1fcc7 100644 --- a/src/eepp/helper/SDL2/src/thread/generic/SDL_syssem.c +++ b/src/eepp/helper/SDL2/src/thread/generic/SDL_syssem.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -39,28 +39,24 @@ SDL_CreateSemaphore(Uint32 initial_value) void SDL_DestroySemaphore(SDL_sem * sem) { - return; } int SDL_SemTryWait(SDL_sem * sem) { - SDL_SetError("SDL not configured with thread support"); - return -1; + return SDL_SetError("SDL not configured with thread support"); } int SDL_SemWaitTimeout(SDL_sem * sem, Uint32 timeout) { - SDL_SetError("SDL not configured with thread support"); - return -1; + return SDL_SetError("SDL not configured with thread support"); } int SDL_SemWait(SDL_sem * sem) { - SDL_SetError("SDL not configured with thread support"); - return -1; + return SDL_SetError("SDL not configured with thread support"); } Uint32 @@ -72,8 +68,7 @@ SDL_SemValue(SDL_sem * sem) int SDL_SemPost(SDL_sem * sem) { - SDL_SetError("SDL not configured with thread support"); - return -1; + return SDL_SetError("SDL not configured with thread support"); } #else @@ -123,8 +118,8 @@ SDL_DestroySemaphore(SDL_sem * sem) } SDL_DestroyCond(sem->count_nonzero); if (sem->count_lock) { - SDL_mutexP(sem->count_lock); - SDL_mutexV(sem->count_lock); + SDL_LockMutex(sem->count_lock); + SDL_UnlockMutex(sem->count_lock); SDL_DestroyMutex(sem->count_lock); } SDL_free(sem); @@ -137,8 +132,7 @@ SDL_SemTryWait(SDL_sem * sem) int retval; if (!sem) { - SDL_SetError("Passed a NULL semaphore"); - return -1; + return SDL_SetError("Passed a NULL semaphore"); } retval = SDL_MUTEX_TIMEDOUT; @@ -158,8 +152,7 @@ SDL_SemWaitTimeout(SDL_sem * sem, Uint32 timeout) int retval; if (!sem) { - SDL_SetError("Passed a NULL semaphore"); - return -1; + return SDL_SetError("Passed a NULL semaphore"); } /* A timeout of 0 is an easy case */ @@ -207,8 +200,7 @@ int SDL_SemPost(SDL_sem * sem) { if (!sem) { - SDL_SetError("Passed a NULL semaphore"); - return -1; + return SDL_SetError("Passed a NULL semaphore"); } SDL_LockMutex(sem->count_lock); diff --git a/src/eepp/helper/SDL2/src/thread/generic/SDL_systhread.c b/src/eepp/helper/SDL2/src/thread/generic/SDL_systhread.c index ed557a461..deebc64fb 100644 --- a/src/eepp/helper/SDL2/src/thread/generic/SDL_systhread.c +++ b/src/eepp/helper/SDL2/src/thread/generic/SDL_systhread.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -28,8 +28,7 @@ int SDL_SYS_CreateThread(SDL_Thread * thread, void *args) { - SDL_SetError("Threads are not supported on this platform"); - return (-1); + return SDL_SetError("Threads are not supported on this platform"); } void diff --git a/src/eepp/helper/SDL2/src/thread/generic/SDL_systhread_c.h b/src/eepp/helper/SDL2/src/thread/generic/SDL_systhread_c.h index dd1fb6bc1..b6c99c90e 100644 --- a/src/eepp/helper/SDL2/src/thread/generic/SDL_systhread_c.h +++ b/src/eepp/helper/SDL2/src/thread/generic/SDL_systhread_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/thread/nds/SDL_syscond_c.h b/src/eepp/helper/SDL2/src/thread/nds/SDL_syscond_c.h deleted file mode 100644 index f0049a10f..000000000 --- a/src/eepp/helper/SDL2/src/thread/nds/SDL_syscond_c.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga - - 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 - appreciated but is not required. - 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. -*/ - -#ifdef SAVE_RCSID -static char rcsid = - "@(#) $Id: SDL_syscond_c.h,v 1.2 2001/04/26 16:50:18 hercules Exp $"; -#endif diff --git a/src/eepp/helper/SDL2/src/thread/nds/SDL_syssem.c b/src/eepp/helper/SDL2/src/thread/nds/SDL_syssem.c deleted file mode 100644 index eedce574d..000000000 --- a/src/eepp/helper/SDL2/src/thread/nds/SDL_syssem.c +++ /dev/null @@ -1,229 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga - - 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 - appreciated but is not required. - 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. -*/ - -#ifdef SAVE_RCSID -static char rcsid = - "@(#) $Id: SDL_syssem.c,v 1.2 2001/04/26 16:50:18 hercules Exp $"; -#endif - -/* An implementation of semaphores using mutexes and condition variables */ - -#include - -#include "SDL_error.h" -#include "SDL_timer.h" -#include "SDL_thread.h" -#include "SDL_systhread_c.h" - - -#ifdef DISABLE_THREADS - -SDL_sem * -SDL_CreateSemaphore(Uint32 initial_value) -{ - SDL_SetError("SDL not configured with thread support"); - return (SDL_sem *) 0; -} - -void -SDL_DestroySemaphore(SDL_sem * sem) -{ - return; -} - -int -SDL_SemTryWait(SDL_sem * sem) -{ - SDL_SetError("SDL not configured with thread support"); - return -1; -} - -int -SDL_SemWaitTimeout(SDL_sem * sem, Uint32 timeout) -{ - SDL_SetError("SDL not configured with thread support"); - return -1; -} - -int -SDL_SemWait(SDL_sem * sem) -{ - SDL_SetError("SDL not configured with thread support"); - return -1; -} - -Uint32 -SDL_SemValue(SDL_sem * sem) -{ - return 0; -} - -int -SDL_SemPost(SDL_sem * sem) -{ - SDL_SetError("SDL not configured with thread support"); - return -1; -} - -#else - -struct SDL_semaphore -{ - Uint32 count; - Uint32 waiters_count; - SDL_mutex *count_lock; - SDL_cond *count_nonzero; -}; - -SDL_sem * -SDL_CreateSemaphore(Uint32 initial_value) -{ - SDL_sem *sem; - - sem = (SDL_sem *) malloc(sizeof(*sem)); - if (!sem) { - SDL_OutOfMemory(); - return (0); - } - sem->count = initial_value; - sem->waiters_count = 0; - - sem->count_lock = SDL_CreateMutex(); - sem->count_nonzero = SDL_CreateCond(); - if (!sem->count_lock || !sem->count_nonzero) { - SDL_DestroySemaphore(sem); - return (0); - } - - return (sem); -} - -/* WARNING: - You cannot call this function when another thread is using the semaphore. -*/ -void -SDL_DestroySemaphore(SDL_sem * sem) -{ - if (sem) { - sem->count = 0xFFFFFFFF; - while (sem->waiters_count > 0) { - SDL_CondSignal(sem->count_nonzero); - SDL_Delay(10); - } - SDL_DestroyCond(sem->count_nonzero); - SDL_mutexP(sem->count_lock); - SDL_mutexV(sem->count_lock); - SDL_DestroyMutex(sem->count_lock); - free(sem); - } -} - -int -SDL_SemTryWait(SDL_sem * sem) -{ - int retval; - - if (!sem) { - SDL_SetError("Passed a NULL semaphore"); - return -1; - } - - retval = SDL_MUTEX_TIMEDOUT; - SDL_LockMutex(sem->count_lock); - if (sem->count > 0) { - --sem->count; - retval = 0; - } - SDL_UnlockMutex(sem->count_lock); - - return retval; -} - -int -SDL_SemWaitTimeout(SDL_sem * sem, Uint32 timeout) -{ - int retval; - - if (!sem) { - SDL_SetError("Passed a NULL semaphore"); - return -1; - } - - /* A timeout of 0 is an easy case */ - if (timeout == 0) { - return SDL_SemTryWait(sem); - } - - SDL_LockMutex(sem->count_lock); - ++sem->waiters_count; - retval = 0; - while ((sem->count == 0) && (retval != SDL_MUTEX_TIMEDOUT)) { - retval = SDL_CondWaitTimeout(sem->count_nonzero, - sem->count_lock, timeout); - } - --sem->waiters_count; - --sem->count; - SDL_UnlockMutex(sem->count_lock); - - return retval; -} - -int -SDL_SemWait(SDL_sem * sem) -{ - return SDL_SemWaitTimeout(sem, SDL_MUTEX_MAXWAIT); -} - -Uint32 -SDL_SemValue(SDL_sem * sem) -{ - Uint32 value; - - value = 0; - if (sem) { - SDL_LockMutex(sem->count_lock); - value = sem->count; - SDL_UnlockMutex(sem->count_lock); - } - return value; -} - -int -SDL_SemPost(SDL_sem * sem) -{ - if (!sem) { - SDL_SetError("Passed a NULL semaphore"); - return -1; - } - - SDL_LockMutex(sem->count_lock); - if (sem->waiters_count > 0) { - SDL_CondSignal(sem->count_nonzero); - } - ++sem->count; - SDL_UnlockMutex(sem->count_lock); - - return 0; -} - -#endif /* DISABLE_THREADS */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/eepp/helper/SDL2/src/thread/nds/SDL_syscond.c b/src/eepp/helper/SDL2/src/thread/psp/SDL_syscond.c similarity index 88% rename from src/eepp/helper/SDL2/src/thread/nds/SDL_syscond.c rename to src/eepp/helper/SDL2/src/thread/psp/SDL_syscond.c index b1ce59514..f540cddb6 100644 --- a/src/eepp/helper/SDL2/src/thread/nds/SDL_syscond.c +++ b/src/eepp/helper/SDL2/src/thread/psp/SDL_syscond.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -18,11 +18,7 @@ misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ - -#ifdef SAVE_RCSID -static char rcsid = - "@(#) $Id: SDL_syscond.c,v 1.2 2001/04/26 16:50:18 hercules Exp $"; -#endif +#include "SDL_config.h" /* An implementation of condition variables using semaphores and mutexes */ /* @@ -30,10 +26,6 @@ static char rcsid = implementation, written by Christopher Tate and Owen Smith. Thanks! */ -#include -#include - -#include "SDL_error.h" #include "SDL_thread.h" struct SDL_cond @@ -51,7 +43,7 @@ SDL_CreateCond(void) { SDL_cond *cond; - cond = (SDL_cond *) malloc(sizeof(SDL_cond)); + cond = (SDL_cond *) SDL_malloc(sizeof(SDL_cond)); if (cond) { cond->lock = SDL_CreateMutex(); cond->wait_sem = SDL_CreateSemaphore(0); @@ -81,7 +73,7 @@ SDL_DestroyCond(SDL_cond * cond) if (cond->lock) { SDL_DestroyMutex(cond->lock); } - free(cond); + SDL_free(cond); } } @@ -90,8 +82,7 @@ int SDL_CondSignal(SDL_cond * cond) { if (!cond) { - SDL_SetError("Passed a NULL condition variable"); - return -1; + return SDL_SetError("Passed a NULL condition variable"); } /* If there are waiting threads not already signalled, then @@ -115,8 +106,7 @@ int SDL_CondBroadcast(SDL_cond * cond) { if (!cond) { - SDL_SetError("Passed a NULL condition variable"); - return -1; + return SDL_SetError("Passed a NULL condition variable"); } /* If there are waiting threads not already signalled, then @@ -152,18 +142,19 @@ SDL_CondBroadcast(SDL_cond * cond) Typical use: Thread A: - SDL_LockMutex(lock); - while ( ! condition ) { - SDL_CondWait(cond); - } - SDL_UnlockMutex(lock); + SDL_LockMutex(lock); + while ( ! condition ) { + SDL_CondWait(cond, lock); + } + SDL_UnlockMutex(lock); Thread B: - SDL_LockMutex(lock); - ... - condition = true; - ... - SDL_UnlockMutex(lock); + SDL_LockMutex(lock); + ... + condition = true; + ... + SDL_CondSignal(cond); + SDL_UnlockMutex(lock); */ int SDL_CondWaitTimeout(SDL_cond * cond, SDL_mutex * mutex, Uint32 ms) @@ -171,8 +162,7 @@ SDL_CondWaitTimeout(SDL_cond * cond, SDL_mutex * mutex, Uint32 ms) int retval; if (!cond) { - SDL_SetError("Passed a NULL condition variable"); - return -1; + return SDL_SetError("Passed a NULL condition variable"); } /* Obtain the protection mutex, and increment the number of waiters. diff --git a/src/eepp/helper/SDL2/src/thread/nds/SDL_sysmutex.c b/src/eepp/helper/SDL2/src/thread/psp/SDL_sysmutex.c similarity index 81% rename from src/eepp/helper/SDL2/src/thread/nds/SDL_sysmutex.c rename to src/eepp/helper/SDL2/src/thread/psp/SDL_sysmutex.c index 4c7757157..6bb68a23d 100644 --- a/src/eepp/helper/SDL2/src/thread/nds/SDL_sysmutex.c +++ b/src/eepp/helper/SDL2/src/thread/psp/SDL_sysmutex.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -18,18 +18,10 @@ misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ - -#ifdef SAVE_RCSID -static char rcsid = - "@(#) $Id: SDL_sysmutex.c,v 1.2 2001/04/26 16:50:18 hercules Exp $"; -#endif +#include "SDL_config.h" /* An implementation of mutexes using semaphores */ -#include -#include - -#include "SDL_error.h" #include "SDL_thread.h" #include "SDL_systhread_c.h" @@ -48,14 +40,14 @@ SDL_CreateMutex(void) SDL_mutex *mutex; /* Allocate mutex memory */ - mutex = (SDL_mutex *) malloc(sizeof(*mutex)); + mutex = (SDL_mutex *) SDL_malloc(sizeof(*mutex)); if (mutex) { /* Create the mutex semaphore, with initial value 1 */ mutex->sem = SDL_CreateSemaphore(1); mutex->recursive = 0; mutex->owner = 0; if (!mutex->sem) { - free(mutex); + SDL_free(mutex); mutex = NULL; } } else { @@ -72,7 +64,7 @@ SDL_DestroyMutex(SDL_mutex * mutex) if (mutex->sem) { SDL_DestroySemaphore(mutex->sem); } - free(mutex); + SDL_free(mutex); } } @@ -80,14 +72,13 @@ SDL_DestroyMutex(SDL_mutex * mutex) int SDL_mutexP(SDL_mutex * mutex) { -#ifdef DISABLE_THREADS +#if SDL_THREADS_DISABLED return 0; #else SDL_threadID this_thread; if (mutex == NULL) { - SDL_SetError("Passed a NULL mutex"); - return -1; + return SDL_SetError("Passed a NULL mutex"); } this_thread = SDL_ThreadID(); @@ -104,25 +95,23 @@ SDL_mutexP(SDL_mutex * mutex) } return 0; -#endif /* DISABLE_THREADS */ +#endif /* SDL_THREADS_DISABLED */ } /* Unlock the mutex */ int SDL_mutexV(SDL_mutex * mutex) { -#ifdef DISABLE_THREADS +#if SDL_THREADS_DISABLED return 0; #else if (mutex == NULL) { - SDL_SetError("Passed a NULL mutex"); - return -1; + return SDL_SetError("Passed a NULL mutex"); } /* If we don't own the mutex, we can't unlock it */ if (SDL_ThreadID() != mutex->owner) { - SDL_SetError("mutex not owned by this thread"); - return -1; + return SDL_SetError("mutex not owned by this thread"); } if (mutex->recursive) { @@ -137,7 +126,7 @@ SDL_mutexV(SDL_mutex * mutex) SDL_SemPost(mutex->sem); } return 0; -#endif /* DISABLE_THREADS */ +#endif /* SDL_THREADS_DISABLED */ } /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/eepp/helper/SDL2/src/thread/nds/SDL_sysmutex_c.h b/src/eepp/helper/SDL2/src/thread/psp/SDL_sysmutex_c.h similarity index 82% rename from src/eepp/helper/SDL2/src/thread/nds/SDL_sysmutex_c.h rename to src/eepp/helper/SDL2/src/thread/psp/SDL_sysmutex_c.h index d193d037c..8d6dbdc2b 100644 --- a/src/eepp/helper/SDL2/src/thread/nds/SDL_sysmutex_c.h +++ b/src/eepp/helper/SDL2/src/thread/psp/SDL_sysmutex_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -18,8 +18,5 @@ misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ - -#ifdef SAVE_RCSID -static char rcsid = - "@(#) $Id: SDL_sysmutex_c.h,v 1.2 2001/04/26 16:50:18 hercules Exp $"; -#endif +#include "SDL_config.h" +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/eepp/helper/SDL2/src/thread/psp/SDL_syssem.c b/src/eepp/helper/SDL2/src/thread/psp/SDL_syssem.c new file mode 100644 index 000000000..8eff409e0 --- /dev/null +++ b/src/eepp/helper/SDL2/src/thread/psp/SDL_syssem.c @@ -0,0 +1,156 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2013 Sam Lantinga + + 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 + appreciated but is not required. + 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. +*/ + +/* Semaphore functions for the PSP. */ + +#include +#include + +#include "SDL_error.h" +#include "SDL_thread.h" + +#include +#include + +struct SDL_semaphore { + 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; +} + +/* Free the semaphore */ +void SDL_DestroySemaphore(SDL_sem *sem) +{ + if (sem != NULL) { + if (sem->semid > 0) { + sceKernelDeleteSema(sem->semid); + sem->semid = 0; + } + + free(sem); + } +} + +/* TODO: This routine is a bit overloaded. + * If the timeout is 0 then just poll the semaphore; if it's SDL_MUTEX_MAXWAIT, pass + * NULL to sceKernelWaitSema() so that it waits indefinitely; and if the timeout + * is specified, convert it to microseconds. */ +int SDL_SemWaitTimeout(SDL_sem *sem, Uint32 timeout) +{ + 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); + switch (res) { + case SCE_KERNEL_ERROR_OK: + return 0; + case SCE_KERNEL_ERROR_WAIT_TIMEOUT: + return SDL_MUTEX_TIMEDOUT; + default: + return SDL_SetError("WaitForSingleObject() failed"); + } +} + +int SDL_SemTryWait(SDL_sem *sem) +{ + return SDL_SemWaitTimeout(sem, 0); +} + +int SDL_SemWait(SDL_sem *sem) +{ + return SDL_SemWaitTimeout(sem, SDL_MUTEX_MAXWAIT); +} + +/* Returns the current count of the semaphore */ +Uint32 SDL_SemValue(SDL_sem *sem) +{ + SceKernelSemaInfo info; + + if (sem == NULL) { + SDL_SetError("Passed a NULL sem"); + return 0; + } + + if (sceKernelReferSemaStatus(sem->semid, &info) >= 0) { + return info.currentCount; + } + + return 0; +} + +int SDL_SemPost(SDL_sem *sem) +{ + int res; + + if (sem == NULL) { + return SDL_SetError("Passed a NULL sem"); + } + + res = sceKernelSignalSema(sem->semid, 1); + if (res < 0) { + return SDL_SetError("sceKernelSignalSema() failed"); + } + + return 0; +} + +/* vim: ts=4 sw=4 + */ diff --git a/src/eepp/helper/SDL2/src/thread/psp/SDL_systhread.c b/src/eepp/helper/SDL2/src/thread/psp/SDL_systhread.c new file mode 100644 index 000000000..05a2341fe --- /dev/null +++ b/src/eepp/helper/SDL2/src/thread/psp/SDL_systhread.c @@ -0,0 +1,102 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2013 Sam Lantinga + + 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 + appreciated but is not required. + 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. +*/ + + +/* PSP thread management routines for SDL */ + +#include +#include + +#include "SDL_error.h" +#include "SDL_thread.h" +#include "../SDL_systhread.h" +#include "../SDL_thread_c.h" +#include +#include + + +static int ThreadEntry(SceSize args, void *argp) +{ + 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; +} + +void SDL_SYS_SetupThread(const char *name) +{ + /* Do nothing. */ +} + +SDL_threadID SDL_ThreadID(void) +{ + return (SDL_threadID) sceKernelGetThreadId(); +} + +void SDL_SYS_WaitThread(SDL_Thread *thread) +{ + sceKernelWaitThreadEnd(thread->handle, NULL); + sceKernelDeleteThread(thread->handle); +} + +void SDL_SYS_KillThread(SDL_Thread *thread) +{ + 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) { + value = -20; + } else { + value = 0; + } + + return sceKernelChangeThreadPriority(sceKernelGetThreadId(),value); + +} + +/* vim: ts=4 sw=4 + */ diff --git a/src/eepp/helper/SDL2/src/thread/nds/SDL_systhread_c.h b/src/eepp/helper/SDL2/src/thread/psp/SDL_systhread_c.h similarity index 81% rename from src/eepp/helper/SDL2/src/thread/nds/SDL_systhread_c.h rename to src/eepp/helper/SDL2/src/thread/psp/SDL_systhread_c.h index 2df2fea78..a806edec9 100644 --- a/src/eepp/helper/SDL2/src/thread/nds/SDL_systhread_c.h +++ b/src/eepp/helper/SDL2/src/thread/psp/SDL_systhread_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,9 +19,6 @@ 3. This notice may not be removed or altered from any source distribution. */ -/* Stub until we implement threads on this platform */ -typedef int SYS_ThreadHandle; +#include -#ifndef DISABLE_THREADS -#define DISABLE_THREADS -#endif +typedef SceUID SYS_ThreadHandle; diff --git a/src/eepp/helper/SDL2/src/thread/pthread/SDL_syscond.c b/src/eepp/helper/SDL2/src/thread/pthread/SDL_syscond.c index 9c05bf816..1eb4f29f9 100644 --- a/src/eepp/helper/SDL2/src/thread/pthread/SDL_syscond.c +++ b/src/eepp/helper/SDL2/src/thread/pthread/SDL_syscond.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -67,14 +67,12 @@ SDL_CondSignal(SDL_cond * cond) int retval; if (!cond) { - SDL_SetError("Passed a NULL condition variable"); - return -1; + return SDL_SetError("Passed a NULL condition variable"); } retval = 0; if (pthread_cond_signal(&cond->cond) != 0) { - SDL_SetError("pthread_cond_signal() failed"); - retval = -1; + return SDL_SetError("pthread_cond_signal() failed"); } return retval; } @@ -86,14 +84,12 @@ SDL_CondBroadcast(SDL_cond * cond) int retval; if (!cond) { - SDL_SetError("Passed a NULL condition variable"); - return -1; + return SDL_SetError("Passed a NULL condition variable"); } retval = 0; if (pthread_cond_broadcast(&cond->cond) != 0) { - SDL_SetError("pthread_cond_broadcast() failed"); - retval = -1; + return SDL_SetError("pthread_cond_broadcast() failed"); } return retval; } @@ -106,8 +102,7 @@ SDL_CondWaitTimeout(SDL_cond * cond, SDL_mutex * mutex, Uint32 ms) struct timespec abstime; if (!cond) { - SDL_SetError("Passed a NULL condition variable"); - return -1; + return SDL_SetError("Passed a NULL condition variable"); } gettimeofday(&delta, NULL); @@ -131,9 +126,7 @@ SDL_CondWaitTimeout(SDL_cond * cond, SDL_mutex * mutex, Uint32 ms) case 0: break; default: - SDL_SetError("pthread_cond_timedwait() failed"); - retval = -1; - break; + retval = SDL_SetError("pthread_cond_timedwait() failed"); } return retval; } @@ -144,19 +137,12 @@ SDL_CondWaitTimeout(SDL_cond * cond, SDL_mutex * mutex, Uint32 ms) int SDL_CondWait(SDL_cond * cond, SDL_mutex * mutex) { - int retval; - if (!cond) { - SDL_SetError("Passed a NULL condition variable"); - return -1; + return SDL_SetError("Passed a NULL condition variable"); + } else if (pthread_cond_wait(&cond->cond, &mutex->id) != 0) { + return SDL_SetError("pthread_cond_wait() failed"); } - - retval = 0; - if (pthread_cond_wait(&cond->cond, &mutex->id) != 0) { - SDL_SetError("pthread_cond_wait() failed"); - retval = -1; - } - return retval; + return 0; } /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/eepp/helper/SDL2/src/thread/pthread/SDL_sysmutex.c b/src/eepp/helper/SDL2/src/thread/pthread/SDL_sysmutex.c index b0c83ce6a..bd238da36 100644 --- a/src/eepp/helper/SDL2/src/thread/pthread/SDL_sysmutex.c +++ b/src/eepp/helper/SDL2/src/thread/pthread/SDL_sysmutex.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -22,6 +22,7 @@ #define _GNU_SOURCE #include +#include #include "SDL_thread.h" @@ -78,19 +79,16 @@ SDL_DestroyMutex(SDL_mutex * mutex) /* Lock the mutex */ int -SDL_mutexP(SDL_mutex * mutex) +SDL_LockMutex(SDL_mutex * mutex) { - int retval; #if FAKE_RECURSIVE_MUTEX pthread_t this_thread; #endif if (mutex == NULL) { - SDL_SetError("Passed a NULL mutex"); - return -1; + return SDL_SetError("Passed a NULL mutex"); } - retval = 0; #if FAKE_RECURSIVE_MUTEX this_thread = pthread_self(); if (mutex->owner == this_thread) { @@ -104,30 +102,67 @@ SDL_mutexP(SDL_mutex * mutex) mutex->owner = this_thread; mutex->recursive = 0; } else { - SDL_SetError("pthread_mutex_lock() failed"); - retval = -1; + return SDL_SetError("pthread_mutex_lock() failed"); } } #else if (pthread_mutex_lock(&mutex->id) < 0) { - SDL_SetError("pthread_mutex_lock() failed"); - retval = -1; + return SDL_SetError("pthread_mutex_lock() failed"); + } +#endif + return 0; +} + +int +SDL_TryLockMutex(SDL_mutex * mutex) +{ + int retval; +#if FAKE_RECURSIVE_MUTEX + pthread_t this_thread; +#endif + + if (mutex == NULL) { + return SDL_SetError("Passed a NULL mutex"); + } + + retval = 0; +#if FAKE_RECURSIVE_MUTEX + this_thread = pthread_self(); + if (mutex->owner == this_thread) { + ++mutex->recursive; + } else { + /* The order of operations is important. + We set the locking thread id after we obtain the lock + so unlocks from other threads will fail. + */ + if (pthread_mutex_lock(&mutex->id) == 0) { + mutex->owner = this_thread; + mutex->recursive = 0; + } else if (errno == EBUSY) { + retval = SDL_MUTEX_TIMEDOUT; + } else { + retval = SDL_SetError("pthread_mutex_trylock() failed"); + } + } +#else + if (pthread_mutex_trylock(&mutex->id) != 0) { + if (errno == EBUSY) { + retval = SDL_MUTEX_TIMEDOUT; + } else { + retval = SDL_SetError("pthread_mutex_trylock() failed"); + } } #endif return retval; } int -SDL_mutexV(SDL_mutex * mutex) +SDL_UnlockMutex(SDL_mutex * mutex) { - int retval; - if (mutex == NULL) { - SDL_SetError("Passed a NULL mutex"); - return -1; + return SDL_SetError("Passed a NULL mutex"); } - retval = 0; #if FAKE_RECURSIVE_MUTEX /* We can only unlock the mutex if we own it */ if (pthread_self() == mutex->owner) { @@ -143,18 +178,16 @@ SDL_mutexV(SDL_mutex * mutex) pthread_mutex_unlock(&mutex->id); } } else { - SDL_SetError("mutex not owned by this thread"); - retval = -1; + return SDL_SetError("mutex not owned by this thread"); } #else if (pthread_mutex_unlock(&mutex->id) < 0) { - SDL_SetError("pthread_mutex_unlock() failed"); - retval = -1; + return SDL_SetError("pthread_mutex_unlock() failed"); } #endif /* FAKE_RECURSIVE_MUTEX */ - return retval; + return 0; } /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/eepp/helper/SDL2/src/thread/pthread/SDL_sysmutex_c.h b/src/eepp/helper/SDL2/src/thread/pthread/SDL_sysmutex_c.h index 5070e364b..2e2eae47e 100644 --- a/src/eepp/helper/SDL2/src/thread/pthread/SDL_sysmutex_c.h +++ b/src/eepp/helper/SDL2/src/thread/pthread/SDL_sysmutex_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/thread/pthread/SDL_syssem.c b/src/eepp/helper/SDL2/src/thread/pthread/SDL_syssem.c index 91959c1b6..4acd6bfb5 100644 --- a/src/eepp/helper/SDL2/src/thread/pthread/SDL_syssem.c +++ b/src/eepp/helper/SDL2/src/thread/pthread/SDL_syssem.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -72,8 +72,7 @@ SDL_SemTryWait(SDL_sem * sem) int retval; if (!sem) { - SDL_SetError("Passed a NULL semaphore"); - return -1; + return SDL_SetError("Passed a NULL semaphore"); } retval = SDL_MUTEX_TIMEDOUT; if (sem_trywait(&sem->sem) == 0) { @@ -88,13 +87,12 @@ SDL_SemWait(SDL_sem * sem) int retval; if (!sem) { - SDL_SetError("Passed a NULL semaphore"); - return -1; + return SDL_SetError("Passed a NULL semaphore"); } retval = sem_wait(&sem->sem); if (retval < 0) { - SDL_SetError("sem_wait() failed"); + retval = SDL_SetError("sem_wait() failed"); } return retval; } @@ -111,8 +109,7 @@ SDL_SemWaitTimeout(SDL_sem * sem, Uint32 timeout) #endif if (!sem) { - SDL_SetError("Passed a NULL semaphore"); - return -1; + return SDL_SetError("Passed a NULL semaphore"); } /* Try the easy cases first */ @@ -188,8 +185,7 @@ SDL_SemPost(SDL_sem * sem) int retval; if (!sem) { - SDL_SetError("Passed a NULL semaphore"); - return -1; + return SDL_SetError("Passed a NULL semaphore"); } retval = sem_post(&sem->sem); diff --git a/src/eepp/helper/SDL2/src/thread/pthread/SDL_systhread.c b/src/eepp/helper/SDL2/src/thread/pthread/SDL_systhread.c index fa07fbfa6..c967ca7f3 100644 --- a/src/eepp/helper/SDL2/src/thread/pthread/SDL_systhread.c +++ b/src/eepp/helper/SDL2/src/thread/pthread/SDL_systhread.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -34,7 +34,7 @@ #include #include #include -#endif // __LINUX__ +#endif /* __LINUX__ */ #if defined(__LINUX__) || defined(__MACOSX__) || defined(__IPHONEOS__) #include @@ -97,18 +97,16 @@ SDL_SYS_CreateThread(SDL_Thread * thread, void *args) /* Set the thread attributes */ if (pthread_attr_init(&type) != 0) { - SDL_SetError("Couldn't initialize pthread attributes"); - return (-1); + return SDL_SetError("Couldn't initialize pthread attributes"); } pthread_attr_setdetachstate(&type, PTHREAD_CREATE_JOINABLE); /* Create the thread and go! */ if (pthread_create(&thread->handle, &type, RunThread, args) != 0) { - SDL_SetError("Not enough resources to create thread"); - return (-1); + return SDL_SetError("Not enough resources to create thread"); } - return (0); + return 0; } void @@ -173,8 +171,7 @@ SDL_SYS_SetThreadPriority(SDL_ThreadPriority priority) /* Note that this fails if you're trying to set high priority and you don't have root permission. BUT DON'T RUN AS ROOT! */ - SDL_SetError("setpriority() failed"); - return -1; + return SDL_SetError("setpriority() failed"); } return 0; #else @@ -183,8 +180,7 @@ SDL_SYS_SetThreadPriority(SDL_ThreadPriority priority) pthread_t thread = pthread_self(); if (pthread_getschedparam(thread, &policy, &sched) < 0) { - SDL_SetError("pthread_getschedparam() failed"); - return -1; + return SDL_SetError("pthread_getschedparam() failed"); } if (priority == SDL_THREAD_PRIORITY_LOW) { sched.sched_priority = sched_get_priority_min(policy); @@ -196,8 +192,7 @@ SDL_SYS_SetThreadPriority(SDL_ThreadPriority priority) sched.sched_priority = (min_priority + (max_priority - min_priority) / 2); } if (pthread_setschedparam(thread, policy, &sched) < 0) { - SDL_SetError("pthread_setschedparam() failed"); - return -1; + return SDL_SetError("pthread_setschedparam() failed"); } return 0; #endif /* linux */ diff --git a/src/eepp/helper/SDL2/src/thread/pthread/SDL_systhread_c.h b/src/eepp/helper/SDL2/src/thread/pthread/SDL_systhread_c.h index b00be7ca5..f134b0b33 100644 --- a/src/eepp/helper/SDL2/src/thread/pthread/SDL_systhread_c.h +++ b/src/eepp/helper/SDL2/src/thread/pthread/SDL_systhread_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/thread/windows/SDL_sysmutex.c b/src/eepp/helper/SDL2/src/thread/windows/SDL_sysmutex.c index 882c9c69b..60e9c6c87 100644 --- a/src/eepp/helper/SDL2/src/thread/windows/SDL_sysmutex.c +++ b/src/eepp/helper/SDL2/src/thread/windows/SDL_sysmutex.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -64,24 +64,37 @@ SDL_DestroyMutex(SDL_mutex * mutex) /* Lock the mutex */ int -SDL_mutexP(SDL_mutex * mutex) +SDL_LockMutex(SDL_mutex * mutex) { if (mutex == NULL) { - SDL_SetError("Passed a NULL mutex"); - return -1; + return SDL_SetError("Passed a NULL mutex"); } EnterCriticalSection(&mutex->cs); return (0); } +/* TryLock the mutex */ +int +SDL_TryLockMutex(SDL_mutex * mutex) +{ + int retval = 0; + if (mutex == NULL) { + return SDL_SetError("Passed a NULL mutex"); + } + + if (TryEnterCriticalSection(&mutex->cs) == 0) { + retval = SDL_MUTEX_TIMEDOUT; + } + return retval; +} + /* Unlock the mutex */ int -SDL_mutexV(SDL_mutex * mutex) +SDL_UnlockMutex(SDL_mutex * mutex) { if (mutex == NULL) { - SDL_SetError("Passed a NULL mutex"); - return -1; + return SDL_SetError("Passed a NULL mutex"); } LeaveCriticalSection(&mutex->cs); diff --git a/src/eepp/helper/SDL2/src/thread/windows/SDL_syssem.c b/src/eepp/helper/SDL2/src/thread/windows/SDL_syssem.c index 8a958eba5..8dc72bcb9 100644 --- a/src/eepp/helper/SDL2/src/thread/windows/SDL_syssem.c +++ b/src/eepp/helper/SDL2/src/thread/windows/SDL_syssem.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -78,8 +78,7 @@ SDL_SemWaitTimeout(SDL_sem * sem, Uint32 timeout) DWORD dwMilliseconds; if (!sem) { - SDL_SetError("Passed a NULL sem"); - return -1; + return SDL_SetError("Passed a NULL sem"); } if (timeout == SDL_MUTEX_MAXWAIT) { @@ -96,8 +95,7 @@ SDL_SemWaitTimeout(SDL_sem * sem, Uint32 timeout) retval = SDL_MUTEX_TIMEDOUT; break; default: - SDL_SetError("WaitForSingleObject() failed"); - retval = -1; + retval = SDL_SetError("WaitForSingleObject() failed"); break; } return retval; @@ -130,8 +128,7 @@ int SDL_SemPost(SDL_sem * sem) { if (!sem) { - SDL_SetError("Passed a NULL sem"); - return -1; + return SDL_SetError("Passed a NULL sem"); } /* Increase the counter in the first place, because * after a successful release the semaphore may @@ -141,8 +138,7 @@ SDL_SemPost(SDL_sem * sem) InterlockedIncrement(&sem->count); if (ReleaseSemaphore(sem->id, 1, NULL) == FALSE) { InterlockedDecrement(&sem->count); /* restore */ - SDL_SetError("ReleaseSemaphore() failed"); - return -1; + return SDL_SetError("ReleaseSemaphore() failed"); } return 0; } diff --git a/src/eepp/helper/SDL2/src/thread/windows/SDL_systhread.c b/src/eepp/helper/SDL2/src/thread/windows/SDL_systhread.c index e399689dd..ada365413 100644 --- a/src/eepp/helper/SDL2/src/thread/windows/SDL_systhread.c +++ b/src/eepp/helper/SDL2/src/thread/windows/SDL_systhread.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -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); @@ -116,12 +116,11 @@ SDL_SYS_CreateThread(SDL_Thread * thread, void *args) pThreadStartParms pThreadParms = (pThreadStartParms) SDL_malloc(sizeof(tThreadStartParms)); if (!pThreadParms) { - SDL_OutOfMemory(); - return (-1); + 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) { @@ -135,10 +134,9 @@ SDL_SYS_CreateThread(SDL_Thread * thread, void *args) pThreadParms, 0, &threadid); } if (thread->handle == NULL) { - SDL_SetError("Not enough resources to create thread"); - return (-1); + return SDL_SetError("Not enough resources to create thread"); } - return (0); + return 0; } #ifdef _MSC_VER @@ -198,8 +196,7 @@ SDL_SYS_SetThreadPriority(SDL_ThreadPriority priority) value = THREAD_PRIORITY_NORMAL; } if (!SetThreadPriority(GetCurrentThread(), value)) { - WIN_SetError("SetThreadPriority()"); - return -1; + return WIN_SetError("SetThreadPriority()"); } return 0; } diff --git a/src/eepp/helper/SDL2/src/thread/windows/SDL_systhread_c.h b/src/eepp/helper/SDL2/src/thread/windows/SDL_systhread_c.h index 834fd2d3f..f9f013bb7 100644 --- a/src/eepp/helper/SDL2/src/thread/windows/SDL_systhread_c.h +++ b/src/eepp/helper/SDL2/src/thread/windows/SDL_systhread_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/timer/SDL_timer.c b/src/eepp/helper/SDL2/src/timer/SDL_timer.c index 739bd4626..5b6550c1c 100644 --- a/src/eepp/helper/SDL2/src/timer/SDL_timer.c +++ b/src/eepp/helper/SDL2/src/timer/SDL_timer.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -26,6 +26,8 @@ #include "SDL_cpuinfo.h" #include "SDL_thread.h" +extern void SDL_StartTicks(void); + /* #define DEBUG_TIMERS */ typedef struct _SDL_Timer @@ -70,6 +72,16 @@ typedef struct { static SDL_TimerData SDL_timer_data; +static Uint32 ticks_started = 0; + +void +SDL_InitTicks(void) +{ + if (!ticks_started) { + SDL_StartTicks(); + ticks_started = 1; + } +} /* The idea here is that any thread might add a timer, but a single * thread manages the active timer queue, sorted by scheduling time. @@ -324,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); @@ -334,10 +346,10 @@ SDL_AddTimer(Uint32 interval, SDL_TimerCallback callback, void *param) entry->timer = timer; entry->timerID = timer->timerID; - SDL_mutexP(data->timermap_lock); + SDL_LockMutex(data->timermap_lock); entry->next = data->timermap; data->timermap = entry; - SDL_mutexV(data->timermap_lock); + SDL_UnlockMutex(data->timermap_lock); /* Add the timer to the pending list for the timer thread */ SDL_AtomicLock(&data->lock); @@ -359,7 +371,7 @@ SDL_RemoveTimer(SDL_TimerID id) SDL_bool canceled = SDL_FALSE; /* Find the timer */ - SDL_mutexP(data->timermap_lock); + SDL_LockMutex(data->timermap_lock); prev = NULL; for (entry = data->timermap; entry; prev = entry, entry = entry->next) { if (entry->timerID == id) { @@ -371,7 +383,7 @@ SDL_RemoveTimer(SDL_TimerID id) break; } } - SDL_mutexV(data->timermap_lock); + SDL_UnlockMutex(data->timermap_lock); if (entry) { if (!entry->timer->canceled) { diff --git a/src/eepp/helper/SDL2/src/timer/SDL_timer_c.h b/src/eepp/helper/SDL2/src/timer/SDL_timer_c.h index 632869ade..157485310 100644 --- a/src/eepp/helper/SDL2/src/timer/SDL_timer_c.h +++ b/src/eepp/helper/SDL2/src/timer/SDL_timer_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -23,9 +23,10 @@ /* 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); extern void SDL_TimerQuit(void); diff --git a/src/eepp/helper/SDL2/src/timer/beos/SDL_systimer.c b/src/eepp/helper/SDL2/src/timer/beos/SDL_systimer.c index 2ad4cc3ba..edaf27501 100644 --- a/src/eepp/helper/SDL2/src/timer/beos/SDL_systimer.c +++ b/src/eepp/helper/SDL2/src/timer/beos/SDL_systimer.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/timer/dummy/SDL_systimer.c b/src/eepp/helper/SDL2/src/timer/dummy/SDL_systimer.c index a5dac55c5..2b5a9f8e3 100644 --- a/src/eepp/helper/SDL2/src/timer/dummy/SDL_systimer.c +++ b/src/eepp/helper/SDL2/src/timer/dummy/SDL_systimer.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/timer/nds/SDL_systimer.c b/src/eepp/helper/SDL2/src/timer/psp/SDL_systimer.c similarity index 59% rename from src/eepp/helper/SDL2/src/timer/nds/SDL_systimer.c rename to src/eepp/helper/SDL2/src/timer/psp/SDL_systimer.c index 7d567fde7..59bb4df1c 100644 --- a/src/eepp/helper/SDL2/src/timer/nds/SDL_systimer.c +++ b/src/eepp/helper/SDL2/src/timer/psp/SDL_systimer.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -18,37 +18,31 @@ misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ -#include "SDL_config.h" - -#ifdef SDL_TIMER_NDS - -#include -#include +#include "SDL_thread.h" #include "SDL_timer.h" +#include "SDL_error.h" +#include "../SDL_timer_c.h" +#include +#include +#include +#include -/* Will wrap after 49 days. Shouldn't be an issue. */ -static volatile Uint32 timer_ticks; +static struct timeval start; -static void -NDS_TimerInterrupt(void) +void SDL_StartTicks(void) { - timer_ticks++; + gettimeofday(&start, NULL); } -void -SDL_StartTicks(void) +Uint32 SDL_GetTicks(void) { - timer_ticks = 0; + struct timeval now; + Uint32 ticks; - /* Set timer 2 to fire every ms. */ - timerStart(2, ClockDivider_1024, TIMER_FREQ_1024(1000), NDS_TimerInterrupt); -} - -Uint32 -SDL_GetTicks(void) -{ - return timer_ticks; + gettimeofday(&now, NULL); + ticks=(now.tv_sec-start.tv_sec)*1000+(now.tv_usec-start.tv_usec)/1000; + return(ticks); } Uint64 @@ -63,16 +57,13 @@ SDL_GetPerformanceFrequency(void) return 1000; } -void -SDL_Delay(Uint32 ms) +void SDL_Delay(Uint32 ms) { - Uint32 start = SDL_GetTicks(); - while (1) { - if ((SDL_GetTicks() - start) >= ms) - break; - } + const Uint32 max_delay = 0xffffffffUL / 1000; + if(ms > max_delay) + ms = max_delay; + sceKernelDelayThreadCB(ms * 1000); } -#endif /* SDL_TIMER_NDS */ - -/* vi: set ts=4 sw=4 expandtab: */ +/* vim: ts=4 sw=4 + */ diff --git a/src/eepp/helper/SDL2/src/timer/unix/SDL_systimer.c b/src/eepp/helper/SDL2/src/timer/unix/SDL_systimer.c index f8fb067cf..514ac2267 100644 --- a/src/eepp/helper/SDL2/src/timer/unix/SDL_systimer.c +++ b/src/eepp/helper/SDL2/src/timer/unix/SDL_systimer.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -34,85 +34,113 @@ for __USE_POSIX199309 Tommi Kyntola (tommi.kyntola@ray.fi) 27/09/2005 */ +/* Reworked monotonic clock to not assume the current system has one + as not all linux kernels provide a monotonic clock (yeah recent ones + probably do) + Also added OS X Monotonic clock support + Based on work in https://github.com/ThomasHabets/monotonic_clock + */ #if HAVE_NANOSLEEP || HAVE_CLOCK_GETTIME #include #endif +#ifdef __APPLE__ +#include +#endif /* The first ticks value of the application */ -#ifdef HAVE_CLOCK_GETTIME -static struct timespec start; -#else -static struct timeval start; -#endif /* HAVE_CLOCK_GETTIME */ - +#if HAVE_CLOCK_GETTIME +static struct timespec start_ts; +#elif defined(__APPLE__) +static uint64_t start_mach; +mach_timebase_info_data_t mach_base_info; +#endif +static SDL_bool has_monotonic_time = SDL_FALSE; +static struct timeval start_tv; void SDL_StartTicks(void) { /* Set first ticks value */ #if HAVE_CLOCK_GETTIME - clock_gettime(CLOCK_MONOTONIC, &start); -#else - gettimeofday(&start, NULL); + if (clock_gettime(CLOCK_MONOTONIC, &start_ts) == 0) { + has_monotonic_time = SDL_TRUE; + } else +#elif defined(__APPLE__) + start_mach = mach_absolute_time(); + kern_return_t ret = mach_timebase_info(&mach_base_info); + if (ret == 0) { + has_monotonic_time = SDL_TRUE; + } else #endif + { + gettimeofday(&start_tv, NULL); + } } Uint32 SDL_GetTicks(void) { + Uint32 ticks; + if (has_monotonic_time) { #if HAVE_CLOCK_GETTIME - Uint32 ticks; - struct timespec now; - - clock_gettime(CLOCK_MONOTONIC, &now); - ticks = - (now.tv_sec - start.tv_sec) * 1000 + (now.tv_nsec - - start.tv_nsec) / 1000000; - return (ticks); -#else - Uint32 ticks; - struct timeval now; - - gettimeofday(&now, NULL); - ticks = - (now.tv_sec - start.tv_sec) * 1000 + (now.tv_usec - - start.tv_usec) / 1000; - return (ticks); + struct timespec now; + clock_gettime(CLOCK_MONOTONIC, &now); + ticks = + (now.tv_sec - start_ts.tv_sec) * 1000 + (now.tv_nsec - + start_ts.tv_nsec) / 1000000; +#elif defined(__APPLE__) + uint64_t now = mach_absolute_time(); + ticks = (now - start_mach) * mach_base_info.numer / mach_base_info.denom / 1000000; #endif + } else { + struct timeval now; + + gettimeofday(&now, NULL); + ticks = + (now.tv_sec - start_tv.tv_sec) * 1000 + (now.tv_usec - + start_tv.tv_usec) / 1000; + } + return (ticks); } Uint64 SDL_GetPerformanceCounter(void) { + Uint64 ticks; + if (has_monotonic_time) { #if HAVE_CLOCK_GETTIME - Uint64 ticks; - struct timespec now; + struct timespec now; - clock_gettime(CLOCK_MONOTONIC, &now); - ticks = now.tv_sec; - ticks *= 1000000000; - ticks += now.tv_nsec; - return (ticks); -#else - Uint64 ticks; - struct timeval now; - - gettimeofday(&now, NULL); - ticks = now.tv_sec; - ticks *= 1000000; - ticks += now.tv_usec; - return (ticks); + clock_gettime(CLOCK_MONOTONIC, &now); + ticks = now.tv_sec; + ticks *= 1000000000; + ticks += now.tv_nsec; +#elif defined(__APPLE__) + ticks = mach_absolute_time(); #endif + } else { + struct timeval now; + + gettimeofday(&now, NULL); + ticks = now.tv_sec; + ticks *= 1000000; + ticks += now.tv_usec; + } + return (ticks); } Uint64 SDL_GetPerformanceFrequency(void) { + if (has_monotonic_time) { #if HAVE_CLOCK_GETTIME - return 1000000000; -#else - return 1000000; + return 1000000000; +#elif defined(__APPLE__) + return mach_base_info.denom / mach_base_info.numer * 1000000; #endif + } else { + return 1000000; + } } void diff --git a/src/eepp/helper/SDL2/src/timer/windows/SDL_systimer.c b/src/eepp/helper/SDL2/src/timer/windows/SDL_systimer.c index a08c9ff31..33097634e 100644 --- a/src/eepp/helper/SDL2/src/timer/windows/SDL_systimer.c +++ b/src/eepp/helper/SDL2/src/timer/windows/SDL_systimer.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -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,13 +48,13 @@ SDL_StartTicks(void) #ifdef USE_GETTICKCOUNT start = GetTickCount(); #else -#if 0 /* Apparently there are problems with QPC on Win2K */ + /* 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) { hires_timer_available = TRUE; QueryPerformanceCounter(&hires_start_ticks); - } else -#endif - { + } else { hires_timer_available = FALSE; timeBeginPeriod(1); /* use 1 ms timer precision */ start = timeGetTime(); diff --git a/src/eepp/helper/SDL2/src/video/SDL_RLEaccel.c b/src/eepp/helper/SDL2/src/video/SDL_RLEaccel.c index 8554a5652..e1f12d13b 100644 --- a/src/eepp/helper/SDL2/src/video/SDL_RLEaccel.c +++ b/src/eepp/helper/SDL2/src/video/SDL_RLEaccel.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -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 and * 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); @@ -464,28 +464,28 @@ SDL_RLEBlit(SDL_Surface * src, SDL_Rect * srcrect, srcbuf = (Uint8 *) src->map->data; { - /* skip lines at the top if neccessary */ + /* skip lines at the top if necessary */ int vskip = srcrect->y; 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 */ @@ -1087,8 +1087,7 @@ RLEAlphaSurface(SDL_Surface * surface) maxsize += sizeof(RLEDestFormat); rlebuf = (Uint8 *) SDL_malloc(maxsize); if (!rlebuf) { - SDL_OutOfMemory(); - return -1; + return SDL_OutOfMemory(); } { /* save the destination format so we can undo the encoding later */ @@ -1118,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; @@ -1299,8 +1298,7 @@ RLEColorkeySurface(SDL_Surface * surface) rlebuf = (Uint8 *) SDL_malloc(maxsize); if (rlebuf == NULL) { - SDL_OutOfMemory(); - return (-1); + return SDL_OutOfMemory(); } /* Set up the conversion */ @@ -1314,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; @@ -1453,7 +1451,7 @@ SDL_RLESurface(SDL_Surface * surface) /* * Un-RLE a surface with pixel alpha * This may not give back exactly the image before RLE-encoding; all - * completely transparent pixels will be lost, and colour and alpha depth + * completely transparent pixels will be lost, and color and alpha depth * may have been reduced (when encoding for 16bpp targets). */ static SDL_bool @@ -1547,7 +1545,7 @@ SDL_UnRLESurface(SDL_Surface * surface, int recode) return; } - /* fill it with the background colour */ + /* fill it with the background color */ SDL_FillRect(surface, NULL, surface->map->info.colorkey); /* now render the encoded surface */ diff --git a/src/eepp/helper/SDL2/src/video/SDL_RLEaccel_c.h b/src/eepp/helper/SDL2/src/video/SDL_RLEaccel_c.h index 5e9bd30ca..986d11488 100644 --- a/src/eepp/helper/SDL2/src/video/SDL_RLEaccel_c.h +++ b/src/eepp/helper/SDL2/src/video/SDL_RLEaccel_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/video/SDL_blit.c b/src/eepp/helper/SDL2/src/video/SDL_blit.c index f63289ce0..78e449dd0 100644 --- a/src/eepp/helper/SDL2/src/video/SDL_blit.c +++ b/src/eepp/helper/SDL2/src/video/SDL_blit.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -239,9 +239,11 @@ SDL_CalculateBlit(SDL_Surface * surface) /* Choose a standard blit function */ if (map->identity && !(map->info.flags & ~SDL_COPY_RLE_DESIRED)) { blit = SDL_BlitCopy; - } else if (surface->format->BitsPerPixel < 8) { + } else if (surface->format->BitsPerPixel < 8 && + SDL_ISPIXELFORMAT_INDEXED(surface->format->format)) { blit = SDL_CalculateBlit0(surface); - } else if (surface->format->BytesPerPixel == 1) { + } else if (surface->format->BytesPerPixel == 1 && + SDL_ISPIXELFORMAT_INDEXED(surface->format->format)) { blit = SDL_CalculateBlit1(surface); } else if (map->info.flags & SDL_COPY_BLEND) { blit = SDL_CalculateBlitA(surface); @@ -260,8 +262,13 @@ SDL_CalculateBlit(SDL_Surface * surface) if (blit == NULL) #endif { - if (surface->format->BytesPerPixel > 1 - && dst->format->BytesPerPixel > 1) { + Uint32 src_format = surface->format->format; + Uint32 dst_format = dst->format->format; + + if (!SDL_ISPIXELFORMAT_INDEXED(src_format) && + !SDL_ISPIXELFORMAT_FOURCC(src_format) && + !SDL_ISPIXELFORMAT_INDEXED(dst_format) && + !SDL_ISPIXELFORMAT_FOURCC(dst_format)) { blit = SDL_Blit_Slow; } } @@ -270,11 +277,10 @@ SDL_CalculateBlit(SDL_Surface * surface) /* Make sure we have a blit function */ if (blit == NULL) { SDL_InvalidateMap(map); - SDL_SetError("Blit combination not supported"); - return (-1); + return SDL_SetError("Blit combination not supported"); } - return (0); + return 0; } /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/eepp/helper/SDL2/src/video/SDL_blit.h b/src/eepp/helper/SDL2/src/video/SDL_blit.h index 6a5983d30..7243e6193 100644 --- a/src/eepp/helper/SDL2/src/video/SDL_blit.h +++ b/src/eepp/helper/SDL2/src/video/SDL_blit.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -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)<Rshift)| \ - ((g>>fmt->Gloss)<Gshift)| \ - ((b>>fmt->Bloss)<Bshift)| \ - fmt->Amask; \ +#define PIXEL_FROM_RGB(Pixel, fmt, r, g, b) \ +{ \ + Pixel = ((r>>fmt->Rloss)<Rshift)| \ + ((g>>fmt->Gloss)<Gshift)| \ + ((b>>fmt->Bloss)<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)<Rshift)| \ - ((g>>fmt->Gloss)<Gshift)| \ - ((b>>fmt->Bloss)<Bshift)| \ - ((a>>fmt->Aloss)<Ashift); \ +#define PIXEL_FROM_RGBA(Pixel, fmt, r, g, b, a) \ +{ \ + Pixel = ((r>>fmt->Rloss)<Rshift)| \ + ((g>>fmt->Gloss)<Gshift)| \ + ((b>>fmt->Bloss)<Bshift)| \ + ((a>>fmt->Aloss)<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/eepp/helper/SDL2/src/video/SDL_blit_0.c b/src/eepp/helper/SDL2/src/video/SDL_blit_0.c index 5c2735745..12cf8607b 100644 --- a/src/eepp/helper/SDL2/src/video/SDL_blit_0.c +++ b/src/eepp/helper/SDL2/src/video/SDL_blit_0.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -443,11 +443,11 @@ BlitBtoNAlphaKey(SDL_BlitInfo * info) } static const SDL_BlitFunc bitmap_blit[] = { - NULL, BlitBto1, BlitBto2, BlitBto3, BlitBto4 + (SDL_BlitFunc) NULL, BlitBto1, BlitBto2, BlitBto3, BlitBto4 }; static const SDL_BlitFunc colorkey_blit[] = { - NULL, BlitBto1Key, BlitBto2Key, BlitBto3Key, BlitBto4Key + (SDL_BlitFunc) NULL, BlitBto1Key, BlitBto2Key, BlitBto3Key, BlitBto4Key }; SDL_BlitFunc @@ -457,7 +457,7 @@ SDL_CalculateBlit0(SDL_Surface * surface) if (surface->format->BitsPerPixel != 1) { /* We don't support sub 8-bit packed pixel modes */ - return NULL; + return (SDL_BlitFunc) NULL; } if (surface->map->dst->format->BitsPerPixel < 8) { which = 0; @@ -472,12 +472,12 @@ SDL_CalculateBlit0(SDL_Surface * surface) return colorkey_blit[which]; case SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND: - return which >= 2 ? BlitBtoNAlpha : NULL; + return which >= 2 ? BlitBtoNAlpha : (SDL_BlitFunc) NULL; case SDL_COPY_COLORKEY | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND: - return which >= 2 ? BlitBtoNAlphaKey : NULL; + return which >= 2 ? BlitBtoNAlphaKey : (SDL_BlitFunc) NULL; } - return NULL; + return (SDL_BlitFunc) NULL; } /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/eepp/helper/SDL2/src/video/SDL_blit_1.c b/src/eepp/helper/SDL2/src/video/SDL_blit_1.c index 9bdda4426..514edab01 100644 --- a/src/eepp/helper/SDL2/src/video/SDL_blit_1.c +++ b/src/eepp/helper/SDL2/src/video/SDL_blit_1.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -511,11 +511,11 @@ Blit1toNAlphaKey(SDL_BlitInfo * info) } static const SDL_BlitFunc one_blit[] = { - NULL, Blit1to1, Blit1to2, Blit1to3, Blit1to4 + (SDL_BlitFunc) NULL, Blit1to1, Blit1to2, Blit1to3, Blit1to4 }; static const SDL_BlitFunc one_blitkey[] = { - NULL, Blit1to1Key, Blit1to2Key, Blit1to3Key, Blit1to4Key + (SDL_BlitFunc) NULL, Blit1to1Key, Blit1to2Key, Blit1to3Key, Blit1to4Key }; SDL_BlitFunc @@ -541,12 +541,12 @@ SDL_CalculateBlit1(SDL_Surface * surface) /* Supporting 8bpp->8bpp alpha is doable but requires lots of tables which consume space and takes time to precompute, so is better left to the user */ - return which >= 2 ? Blit1toNAlpha : NULL; + return which >= 2 ? Blit1toNAlpha : (SDL_BlitFunc) NULL; case SDL_COPY_COLORKEY | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND: - return which >= 2 ? Blit1toNAlphaKey : NULL; + return which >= 2 ? Blit1toNAlphaKey : (SDL_BlitFunc) NULL; } - return NULL; + return (SDL_BlitFunc) NULL; } /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/eepp/helper/SDL2/src/video/SDL_blit_A.c b/src/eepp/helper/SDL2/src/video/SDL_blit_A.c index d8537ee74..002a1af92 100644 --- a/src/eepp/helper/SDL2/src/video/SDL_blit_A.c +++ b/src/eepp/helper/SDL2/src/video/SDL_blit_A.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -258,7 +258,7 @@ static void BlitRGBtoRGBSurfaceAlphaMMX(SDL_BlitInfo * info) { SDL_PixelFormat *df = info->dst_fmt; - Uint32 chanmask = df->Rmask | df->Gmask | df->Bmask; + Uint32 chanmask; unsigned alpha = info->a; if (alpha == 128 && (df->Rmask | df->Gmask | df->Bmask) == 0x00FFFFFF) { diff --git a/src/eepp/helper/SDL2/src/video/SDL_blit_N.c b/src/eepp/helper/SDL2/src/video/SDL_blit_N.c index 2d7255ada..cd127c9db 100644 --- a/src/eepp/helper/SDL2/src/video/SDL_blit_N.c +++ b/src/eepp/helper/SDL2/src/video/SDL_blit_N.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -275,7 +275,7 @@ Blit_RGB565_32Altivec(SDL_BlitInfo * info) vector unsigned int v16 = vec_add(v8, v8); vector unsigned short v2 = vec_splat_u16(2); vector unsigned short v3 = vec_splat_u16(3); - /* + /* 0x10 - 0x1f is the alpha 0x00 - 0x0e evens are the red 0x01 - 0x0f odds are zero @@ -422,7 +422,7 @@ Blit_RGB555_32Altivec(SDL_BlitInfo * info) vector unsigned int v16 = vec_add(v8, v8); vector unsigned short v1 = vec_splat_u16(1); vector unsigned short v3 = vec_splat_u16(3); - /* + /* 0x10 - 0x1f is the alpha 0x00 - 0x0e evens are the red 0x01 - 0x0f odds are zero @@ -876,18 +876,18 @@ GetBlitFeatures(void) /* This is now endian dependent */ #if SDL_BYTEORDER == SDL_LIL_ENDIAN -#define HI 1 -#define LO 0 +#define HI 1 +#define LO 0 #else /* SDL_BYTEORDER == SDL_BIG_ENDIAN */ -#define HI 0 -#define LO 1 +#define HI 0 +#define LO 1 #endif /* Special optimized blit for RGB 8-8-8 --> RGB 3-3-2 */ #define RGB888_RGB332(dst, src) { \ - dst = (Uint8)((((src)&0x00E00000)>>16)| \ - (((src)&0x0000E000)>>11)| \ - (((src)&0x000000C0)>>6)); \ + dst = (Uint8)((((src)&0x00E00000)>>16)| \ + (((src)&0x0000E000)>>11)| \ + (((src)&0x000000C0)>>6)); \ } static void Blit_RGB888_index8(SDL_BlitInfo * info) @@ -913,11 +913,11 @@ Blit_RGB888_index8(SDL_BlitInfo * info) if (map == NULL) { while (height--) { #ifdef USE_DUFFS_LOOP - /* *INDENT-OFF* */ - DUFFS_LOOP( - RGB888_RGB332(*dst++, *src); - , width); - /* *INDENT-ON* */ + /* *INDENT-OFF* */ + DUFFS_LOOP( + RGB888_RGB332(*dst++, *src); + , width); + /* *INDENT-ON* */ #else for (c = width / 4; c; --c) { /* Pack RGB into 8bit pixel */ @@ -949,13 +949,13 @@ Blit_RGB888_index8(SDL_BlitInfo * info) while (height--) { #ifdef USE_DUFFS_LOOP - /* *INDENT-OFF* */ - DUFFS_LOOP( - RGB888_RGB332(Pixel, *src); - *dst++ = map[Pixel]; - ++src; - , width); - /* *INDENT-ON* */ + /* *INDENT-OFF* */ + DUFFS_LOOP( + RGB888_RGB332(Pixel, *src); + *dst++ = map[Pixel]; + ++src; + , width); + /* *INDENT-ON* */ #else for (c = width / 4; c; --c) { /* Pack RGB into 8bit pixel */ @@ -995,17 +995,17 @@ Blit_RGB888_index8(SDL_BlitInfo * info) /* Special optimized blit for RGB 8-8-8 --> RGB 5-5-5 */ #define RGB888_RGB555(dst, src) { \ - *(Uint16 *)(dst) = (Uint16)((((*src)&0x00F80000)>>9)| \ - (((*src)&0x0000F800)>>6)| \ - (((*src)&0x000000F8)>>3)); \ + *(Uint16 *)(dst) = (Uint16)((((*src)&0x00F80000)>>9)| \ + (((*src)&0x0000F800)>>6)| \ + (((*src)&0x000000F8)>>3)); \ } #define RGB888_RGB555_TWO(dst, src) { \ - *(Uint32 *)(dst) = (((((src[HI])&0x00F80000)>>9)| \ - (((src[HI])&0x0000F800)>>6)| \ - (((src[HI])&0x000000F8)>>3))<<16)| \ - (((src[LO])&0x00F80000)>>9)| \ - (((src[LO])&0x0000F800)>>6)| \ - (((src[LO])&0x000000F8)>>3); \ + *(Uint32 *)(dst) = (((((src[HI])&0x00F80000)>>9)| \ + (((src[HI])&0x0000F800)>>6)| \ + (((src[HI])&0x000000F8)>>3))<<16)| \ + (((src[LO])&0x00F80000)>>9)| \ + (((src[LO])&0x0000F800)>>6)| \ + (((src[LO])&0x000000F8)>>3); \ } static void Blit_RGB888_RGB555(SDL_BlitInfo * info) @@ -1028,13 +1028,13 @@ Blit_RGB888_RGB555(SDL_BlitInfo * info) #ifdef USE_DUFFS_LOOP while (height--) { - /* *INDENT-OFF* */ - DUFFS_LOOP( - RGB888_RGB555(dst, src); - ++src; - ++dst; - , width); - /* *INDENT-ON* */ + /* *INDENT-OFF* */ + DUFFS_LOOP( + RGB888_RGB555(dst, src); + ++src; + ++dst; + , width); + /* *INDENT-ON* */ src += srcskip; dst += dstskip; } @@ -1119,17 +1119,17 @@ Blit_RGB888_RGB555(SDL_BlitInfo * info) /* Special optimized blit for RGB 8-8-8 --> RGB 5-6-5 */ #define RGB888_RGB565(dst, src) { \ - *(Uint16 *)(dst) = (Uint16)((((*src)&0x00F80000)>>8)| \ - (((*src)&0x0000FC00)>>5)| \ - (((*src)&0x000000F8)>>3)); \ + *(Uint16 *)(dst) = (Uint16)((((*src)&0x00F80000)>>8)| \ + (((*src)&0x0000FC00)>>5)| \ + (((*src)&0x000000F8)>>3)); \ } #define RGB888_RGB565_TWO(dst, src) { \ - *(Uint32 *)(dst) = (((((src[HI])&0x00F80000)>>8)| \ - (((src[HI])&0x0000FC00)>>5)| \ - (((src[HI])&0x000000F8)>>3))<<16)| \ - (((src[LO])&0x00F80000)>>8)| \ - (((src[LO])&0x0000FC00)>>5)| \ - (((src[LO])&0x000000F8)>>3); \ + *(Uint32 *)(dst) = (((((src[HI])&0x00F80000)>>8)| \ + (((src[HI])&0x0000FC00)>>5)| \ + (((src[HI])&0x000000F8)>>3))<<16)| \ + (((src[LO])&0x00F80000)>>8)| \ + (((src[LO])&0x0000FC00)>>5)| \ + (((src[LO])&0x000000F8)>>3); \ } static void Blit_RGB888_RGB565(SDL_BlitInfo * info) @@ -1152,13 +1152,13 @@ Blit_RGB888_RGB565(SDL_BlitInfo * info) #ifdef USE_DUFFS_LOOP while (height--) { - /* *INDENT-OFF* */ - DUFFS_LOOP( - RGB888_RGB565(dst, src); - ++src; - ++dst; - , width); - /* *INDENT-ON* */ + /* *INDENT-OFF* */ + DUFFS_LOOP( + RGB888_RGB565(dst, src); + ++src; + ++dst; + , width); + /* *INDENT-ON* */ src += srcskip; dst += dstskip; } @@ -1265,14 +1265,14 @@ Blit_RGB565_32(SDL_BlitInfo * info, const Uint32 * map) #ifdef USE_DUFFS_LOOP while (height--) { - /* *INDENT-OFF* */ - DUFFS_LOOP( - { - *dst++ = RGB565_32(dst, src, map); - src += 2; - }, - width); - /* *INDENT-ON* */ + /* *INDENT-OFF* */ + DUFFS_LOOP( + { + *dst++ = RGB565_32(dst, src, map); + src += 2; + }, + width); + /* *INDENT-ON* */ src += srcskip; dst += dstskip; } @@ -1863,9 +1863,9 @@ Blit_RGB565_BGRA8888(SDL_BlitInfo * info) /* Special optimized blit for RGB 8-8-8 --> RGB 3-3-2 */ #ifndef RGB888_RGB332 #define RGB888_RGB332(dst, src) { \ - dst = (((src)&0x00E00000)>>16)| \ - (((src)&0x0000E000)>>11)| \ - (((src)&0x000000C0)>>6); \ + dst = (((src)&0x00E00000)>>16)| \ + (((src)&0x0000E000)>>11)| \ + (((src)&0x000000C0)>>6); \ } #endif static void @@ -1892,13 +1892,13 @@ Blit_RGB888_index8_map(SDL_BlitInfo * info) #ifdef USE_DUFFS_LOOP while (height--) { - /* *INDENT-OFF* */ - DUFFS_LOOP( - RGB888_RGB332(Pixel, *src); - *dst++ = map[Pixel]; - ++src; - , width); - /* *INDENT-ON* */ + /* *INDENT-OFF* */ + DUFFS_LOOP( + RGB888_RGB332(Pixel, *src); + *dst++ = map[Pixel]; + ++src; + , width); + /* *INDENT-ON* */ src += srcskip; dst += dstskip; } @@ -1969,20 +1969,20 @@ BlitNto1(SDL_BlitInfo * info) if (map == NULL) { while (height--) { #ifdef USE_DUFFS_LOOP - /* *INDENT-OFF* */ - DUFFS_LOOP( - DISEMBLE_RGB(src, srcbpp, srcfmt, Pixel, - sR, sG, sB); - if ( 1 ) { - /* Pack RGB into 8bit pixel */ - *dst = ((sR>>5)<<(3+2))| - ((sG>>5)<<(2)) | - ((sB>>6)<<(0)) ; - } - dst++; - src += srcbpp; - , width); - /* *INDENT-ON* */ + /* *INDENT-OFF* */ + DUFFS_LOOP( + DISEMBLE_RGB(src, srcbpp, srcfmt, Pixel, + sR, sG, sB); + if ( 1 ) { + /* Pack RGB into 8bit pixel */ + *dst = ((sR>>5)<<(3+2))| + ((sG>>5)<<(2)) | + ((sB>>6)<<(0)) ; + } + dst++; + src += srcbpp; + , width); + /* *INDENT-ON* */ #else for (c = width; c; --c) { DISEMBLE_RGB(src, srcbpp, srcfmt, Pixel, sR, sG, sB); @@ -2001,20 +2001,20 @@ BlitNto1(SDL_BlitInfo * info) } else { while (height--) { #ifdef USE_DUFFS_LOOP - /* *INDENT-OFF* */ - DUFFS_LOOP( - DISEMBLE_RGB(src, srcbpp, srcfmt, Pixel, - sR, sG, sB); - if ( 1 ) { - /* Pack RGB into 8bit pixel */ - *dst = map[((sR>>5)<<(3+2))| - ((sG>>5)<<(2)) | - ((sB>>6)<<(0)) ]; - } - dst++; - src += srcbpp; - , width); - /* *INDENT-ON* */ + /* *INDENT-OFF* */ + DUFFS_LOOP( + DISEMBLE_RGB(src, srcbpp, srcfmt, Pixel, + sR, sG, sB); + if ( 1 ) { + /* Pack RGB into 8bit pixel */ + *dst = map[((sR>>5)<<(3+2))| + ((sG>>5)<<(2)) | + ((sB>>6)<<(0)) ]; + } + dst++; + src += srcbpp; + , width); + /* *INDENT-ON* */ #else for (c = width; c; --c) { DISEMBLE_RGB(src, srcbpp, srcfmt, Pixel, sR, sG, sB); @@ -2051,15 +2051,15 @@ Blit4to4MaskAlpha(SDL_BlitInfo * info) Uint32 mask = (info->a >> dstfmt->Aloss) << dstfmt->Ashift; while (height--) { - /* *INDENT-OFF* */ - DUFFS_LOOP( - { - *dst = *src | mask; - ++dst; - ++src; - }, - width); - /* *INDENT-ON* */ + /* *INDENT-OFF* */ + DUFFS_LOOP( + { + *dst = *src | mask; + ++dst; + ++src; + }, + width); + /* *INDENT-ON* */ src = (Uint32 *) ((Uint8 *) src + srcskip); dst = (Uint32 *) ((Uint8 *) dst + dstskip); } @@ -2068,15 +2068,15 @@ Blit4to4MaskAlpha(SDL_BlitInfo * info) Uint32 mask = srcfmt->Rmask | srcfmt->Gmask | srcfmt->Bmask; while (height--) { - /* *INDENT-OFF* */ - DUFFS_LOOP( - { - *dst = *src & mask; - ++dst; - ++src; - }, - width); - /* *INDENT-ON* */ + /* *INDENT-OFF* */ + DUFFS_LOOP( + { + *dst = *src & mask; + ++dst; + ++src; + }, + width); + /* *INDENT-ON* */ src = (Uint32 *) ((Uint8 *) src + srcskip); dst = (Uint32 *) ((Uint8 *) dst + dstskip); } @@ -2099,20 +2099,20 @@ BlitNtoN(SDL_BlitInfo * info) unsigned alpha = dstfmt->Amask ? info->a : 0; while (height--) { - /* *INDENT-OFF* */ - DUFFS_LOOP( - { + /* *INDENT-OFF* */ + DUFFS_LOOP( + { Uint32 Pixel; - unsigned sR; - unsigned sG; - unsigned sB; - DISEMBLE_RGB(src, srcbpp, srcfmt, Pixel, sR, sG, sB); - ASSEMBLE_RGBA(dst, dstbpp, dstfmt, sR, sG, sB, alpha); - dst += dstbpp; - src += srcbpp; - }, - width); - /* *INDENT-ON* */ + unsigned sR; + unsigned sG; + unsigned sB; + DISEMBLE_RGB(src, srcbpp, srcfmt, Pixel, sR, sG, sB); + ASSEMBLE_RGBA(dst, dstbpp, dstfmt, sR, sG, sB, alpha); + dst += dstbpp; + src += srcbpp; + }, + width); + /* *INDENT-ON* */ src += srcskip; dst += dstskip; } @@ -2170,43 +2170,43 @@ BlitNto1Key(SDL_BlitInfo * info) if (palmap == NULL) { while (height--) { - /* *INDENT-OFF* */ - DUFFS_LOOP( - { - DISEMBLE_RGB(src, srcbpp, srcfmt, Pixel, - sR, sG, sB); - if ( (Pixel & rgbmask) != ckey ) { - /* Pack RGB into 8bit pixel */ - *dst = (Uint8)(((sR>>5)<<(3+2))| - ((sG>>5)<<(2)) | - ((sB>>6)<<(0))); - } - dst++; - src += srcbpp; - }, - width); - /* *INDENT-ON* */ + /* *INDENT-OFF* */ + DUFFS_LOOP( + { + DISEMBLE_RGB(src, srcbpp, srcfmt, Pixel, + sR, sG, sB); + if ( (Pixel & rgbmask) != ckey ) { + /* Pack RGB into 8bit pixel */ + *dst = (Uint8)(((sR>>5)<<(3+2))| + ((sG>>5)<<(2)) | + ((sB>>6)<<(0))); + } + dst++; + src += srcbpp; + }, + width); + /* *INDENT-ON* */ src += srcskip; dst += dstskip; } } else { while (height--) { - /* *INDENT-OFF* */ - DUFFS_LOOP( - { - DISEMBLE_RGB(src, srcbpp, srcfmt, Pixel, - sR, sG, sB); - if ( (Pixel & rgbmask) != ckey ) { - /* Pack RGB into 8bit pixel */ - *dst = (Uint8)palmap[((sR>>5)<<(3+2))| - ((sG>>5)<<(2)) | - ((sB>>6)<<(0)) ]; - } - dst++; - src += srcbpp; - }, - width); - /* *INDENT-ON* */ + /* *INDENT-OFF* */ + DUFFS_LOOP( + { + DISEMBLE_RGB(src, srcbpp, srcfmt, Pixel, + sR, sG, sB); + if ( (Pixel & rgbmask) != ckey ) { + /* Pack RGB into 8bit pixel */ + *dst = (Uint8)palmap[((sR>>5)<<(3+2))| + ((sG>>5)<<(2)) | + ((sB>>6)<<(0)) ]; + } + dst++; + src += srcbpp; + }, + width); + /* *INDENT-ON* */ src += srcskip; dst += dstskip; } @@ -2231,17 +2231,17 @@ Blit2to2Key(SDL_BlitInfo * info) ckey &= rgbmask; while (height--) { - /* *INDENT-OFF* */ - DUFFS_LOOP( - { - if ( (*srcp & rgbmask) != ckey ) { - *dstp = *srcp; - } - dstp++; - srcp++; - }, - width); - /* *INDENT-ON* */ + /* *INDENT-OFF* */ + DUFFS_LOOP( + { + if ( (*srcp & rgbmask) != ckey ) { + *dstp = *srcp; + } + dstp++; + srcp++; + }, + width); + /* *INDENT-ON* */ srcp += srcskip; dstp += dstskip; } @@ -2268,23 +2268,23 @@ BlitNtoNKey(SDL_BlitInfo * info) ckey &= rgbmask; while (height--) { - /* *INDENT-OFF* */ - DUFFS_LOOP( - { + /* *INDENT-OFF* */ + DUFFS_LOOP( + { Uint32 Pixel; - unsigned sR; - unsigned sG; - unsigned sB; - RETRIEVE_RGB_PIXEL(src, srcbpp, Pixel); - if ( (Pixel & rgbmask) != ckey ) { + unsigned sR; + unsigned sG; + unsigned sB; + RETRIEVE_RGB_PIXEL(src, srcbpp, Pixel); + if ( (Pixel & rgbmask) != ckey ) { RGB_FROM_PIXEL(Pixel, srcfmt, sR, sG, sB); - ASSEMBLE_RGBA(dst, dstbpp, dstfmt, sR, sG, sB, alpha); - } - dst += dstbpp; - src += srcbpp; - }, - width); - /* *INDENT-ON* */ + ASSEMBLE_RGBA(dst, dstbpp, dstfmt, sR, sG, sB, alpha); + } + dst += dstbpp; + src += srcbpp; + }, + width); + /* *INDENT-ON* */ src += srcskip; dst += dstskip; } @@ -2315,18 +2315,18 @@ BlitNtoNKeyCopyAlpha(SDL_BlitInfo * info) ckey &= rgbmask; while (height--) { - /* *INDENT-OFF* */ - DUFFS_LOOP( - { - DISEMBLE_RGBA(src, srcbpp, srcfmt, Pixel, sR, sG, sB, sA); - if ( (Pixel & rgbmask) != ckey ) { - ASSEMBLE_RGBA(dst, dstbpp, dstfmt, sR, sG, sB, sA); - } - dst += dstbpp; - src += srcbpp; - }, - width); - /* *INDENT-ON* */ + /* *INDENT-OFF* */ + DUFFS_LOOP( + { + DISEMBLE_RGBA(src, srcbpp, srcfmt, Pixel, sR, sG, sB, sA); + if ( (Pixel & rgbmask) != ckey ) { + ASSEMBLE_RGBA(dst, dstbpp, dstfmt, sR, sG, sB, sA); + } + dst += dstbpp; + src += srcbpp; + }, + width); + /* *INDENT-ON* */ src += srcskip; dst += dstskip; } @@ -2436,7 +2436,6 @@ SDL_CalculateBlitN(SDL_Surface * surface) case 0: blitfun = NULL; if (dstfmt->BitsPerPixel == 8) { - /* We assume 8-bit destinations are palettized */ if ((srcfmt->BytesPerPixel == 4) && (srcfmt->Rmask == 0x00FF0000) && (srcfmt->Gmask == 0x0000FF00) && diff --git a/src/eepp/helper/SDL2/src/video/SDL_blit_auto.c b/src/eepp/helper/SDL2/src/video/SDL_blit_auto.c index dbe71f94e..f6a5284f9 100644 --- a/src/eepp/helper/SDL2/src/video/SDL_blit_auto.c +++ b/src/eepp/helper/SDL2/src/video/SDL_blit_auto.c @@ -1,7 +1,7 @@ /* DO NOT EDIT! This file is generated by sdlgenblit.pl */ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/video/SDL_blit_auto.h b/src/eepp/helper/SDL2/src/video/SDL_blit_auto.h index 0fa4f6f61..ed0115e72 100644 --- a/src/eepp/helper/SDL2/src/video/SDL_blit_auto.h +++ b/src/eepp/helper/SDL2/src/video/SDL_blit_auto.h @@ -1,7 +1,7 @@ /* DO NOT EDIT! This file is generated by sdlgenblit.pl */ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/video/SDL_blit_copy.c b/src/eepp/helper/SDL2/src/video/SDL_blit_copy.c index aa6fc8ade..6d286c31f 100644 --- a/src/eepp/helper/SDL2/src/video/SDL_blit_copy.c +++ b/src/eepp/helper/SDL2/src/video/SDL_blit_copy.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/video/SDL_blit_copy.h b/src/eepp/helper/SDL2/src/video/SDL_blit_copy.h index f1436bab4..8d02a83bb 100644 --- a/src/eepp/helper/SDL2/src/video/SDL_blit_copy.h +++ b/src/eepp/helper/SDL2/src/video/SDL_blit_copy.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/video/SDL_blit_slow.c b/src/eepp/helper/SDL2/src/video/SDL_blit_slow.c index ce1327e2d..1f4bce2ee 100644 --- a/src/eepp/helper/SDL2/src/video/SDL_blit_slow.c +++ b/src/eepp/helper/SDL2/src/video/SDL_blit_slow.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/video/SDL_blit_slow.h b/src/eepp/helper/SDL2/src/video/SDL_blit_slow.h index e298d6972..15b5c79ab 100644 --- a/src/eepp/helper/SDL2/src/video/SDL_blit_slow.h +++ b/src/eepp/helper/SDL2/src/video/SDL_blit_slow.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/video/SDL_bmp.c b/src/eepp/helper/SDL2/src/video/SDL_bmp.c index 9103fa95f..7ee65d85d 100644 --- a/src/eepp/helper/SDL2/src/video/SDL_bmp.c +++ b/src/eepp/helper/SDL2/src/video/SDL_bmp.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -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 @@ -252,14 +252,20 @@ SDL_LoadBMP_RW(SDL_RWops * src, int freesrc) SDL_RWread(src, &palette->colors[i].b, 1, 1); SDL_RWread(src, &palette->colors[i].g, 1, 1); SDL_RWread(src, &palette->colors[i].r, 1, 1); - palette->colors[i].unused = SDL_ALPHA_OPAQUE; + palette->colors[i].a = SDL_ALPHA_OPAQUE; } } else { for (i = 0; i < (int) biClrUsed; ++i) { SDL_RWread(src, &palette->colors[i].b, 1, 1); SDL_RWread(src, &palette->colors[i].g, 1, 1); SDL_RWread(src, &palette->colors[i].r, 1, 1); - SDL_RWread(src, &palette->colors[i].unused, 1, 1); + SDL_RWread(src, &palette->colors[i].a, 1, 1); + + /* According to Microsoft documentation, the fourth element + is reserved and must be zero, so we shouldn't treat it as + alpha. + */ + palette->colors[i].a = SDL_ALPHA_OPAQUE; } } } @@ -433,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 @@ -510,7 +516,7 @@ SDL_SaveBMP_RW(SDL_Surface * saveme, SDL_RWops * dst, int freedst) SDL_RWwrite(dst, &colors[i].b, 1, 1); SDL_RWwrite(dst, &colors[i].g, 1, 1); SDL_RWwrite(dst, &colors[i].r, 1, 1); - SDL_RWwrite(dst, &colors[i].unused, 1, 1); + SDL_RWwrite(dst, &colors[i].a, 1, 1); } } diff --git a/src/eepp/helper/SDL2/src/video/SDL_clipboard.c b/src/eepp/helper/SDL2/src/video/SDL_clipboard.c index 14c6c569f..83c2e346e 100644 --- a/src/eepp/helper/SDL2/src/video/SDL_clipboard.c +++ b/src/eepp/helper/SDL2/src/video/SDL_clipboard.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/video/SDL_fillrect.c b/src/eepp/helper/SDL2/src/video/SDL_fillrect.c index 41c8b75b4..a99371e05 100644 --- a/src/eepp/helper/SDL2/src/video/SDL_fillrect.c +++ b/src/eepp/helper/SDL2/src/video/SDL_fillrect.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -315,14 +315,12 @@ SDL_FillRect(SDL_Surface * dst, const SDL_Rect * rect, Uint32 color) Uint8 *pixels; if (!dst) { - SDL_SetError("Passed NULL destination surface"); - return -1; + return SDL_SetError("Passed NULL destination surface"); } /* This function doesn't work on surfaces < 8 bpp */ if (dst->format->BitsPerPixel < 8) { - SDL_SetError("SDL_FillRect(): Unsupported surface format"); - return -1; + return SDL_SetError("SDL_FillRect(): Unsupported surface format"); } /* If 'rect' == NULL, then fill the whole surface */ @@ -338,8 +336,7 @@ SDL_FillRect(SDL_Surface * dst, const SDL_Rect * rect, Uint32 color) /* Perform software fill */ if (!dst->pixels) { - SDL_SetError("SDL_FillRect(): You must lock the surface"); - return (-1); + return SDL_SetError("SDL_FillRect(): You must lock the surface"); } pixels = (Uint8 *) dst->pixels + rect->y * dst->pitch + @@ -423,8 +420,7 @@ SDL_FillRects(SDL_Surface * dst, const SDL_Rect * rects, int count, int status = 0; if (!rects) { - SDL_SetError("SDL_FillRects() passed NULL rects"); - return -1; + return SDL_SetError("SDL_FillRects() passed NULL rects"); } for (i = 0; i < count; ++i) { diff --git a/src/eepp/helper/SDL2/src/video/SDL_pixels.c b/src/eepp/helper/SDL2/src/video/SDL_pixels.c index f6a2c7693..c472c38b5 100644 --- a/src/eepp/helper/SDL2/src/video/SDL_pixels.c +++ b/src/eepp/helper/SDL2/src/video/SDL_pixels.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -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); @@ -503,6 +503,7 @@ SDL_AllocFormat(Uint32 pixel_format) } if (SDL_InitFormat(format, pixel_format) < 0) { SDL_free(format); + SDL_InvalidParamError("format"); return NULL; } @@ -585,6 +586,7 @@ SDL_FreeFormat(SDL_PixelFormat *format) SDL_PixelFormat *prev; if (!format) { + SDL_InvalidParamError("format"); return; } if (--format->refcount > 0) { @@ -614,6 +616,12 @@ SDL_AllocPalette(int ncolors) { SDL_Palette *palette; + /* Input validation */ + if (ncolors < 1) { + SDL_InvalidParamError("ncolors"); + return NULL; + } + palette = (SDL_Palette *) SDL_malloc(sizeof(*palette)); if (!palette) { SDL_OutOfMemory(); @@ -638,13 +646,11 @@ int SDL_SetPixelFormatPalette(SDL_PixelFormat * format, SDL_Palette *palette) { if (!format) { - SDL_SetError("SDL_SetPixelFormatPalette() passed NULL format"); - return -1; + return SDL_SetError("SDL_SetPixelFormatPalette() passed NULL format"); } if (palette && palette->ncolors != (1 << format->BitsPerPixel)) { - SDL_SetError("SDL_SetPixelFormatPalette() passed a palette that doesn't match the format"); - return -1; + return SDL_SetError("SDL_SetPixelFormatPalette() passed a palette that doesn't match the format"); } if (format->palette == palette) { @@ -695,6 +701,7 @@ void SDL_FreePalette(SDL_Palette * palette) { if (!palette) { + SDL_InvalidParamError("palette"); return; } if (--palette->refcount > 0) { @@ -730,11 +737,11 @@ SDL_DitherColors(SDL_Color * colors, int bpp) b |= b << 2; b |= b << 4; colors[i].b = b; - colors[i].unused = SDL_ALPHA_OPAQUE; + colors[i].a = SDL_ALPHA_OPAQUE; } } -/* +/* * Calculate the pad-aligned scanline width of a surface */ int @@ -762,12 +769,12 @@ SDL_CalculatePitch(SDL_Surface * surface) * Match an RGB value to a particular palette index */ Uint8 -SDL_FindColor(SDL_Palette * pal, Uint8 r, Uint8 g, Uint8 b) +SDL_FindColor(SDL_Palette * pal, Uint8 r, Uint8 g, Uint8 b, Uint8 a) { /* Do colorspace distance matching */ unsigned int smallest; unsigned int distance; - int rd, gd, bd; + int rd, gd, bd, ad; int i; Uint8 pixel = 0; @@ -776,7 +783,8 @@ SDL_FindColor(SDL_Palette * pal, Uint8 r, Uint8 g, Uint8 b) rd = pal->colors[i].r - r; gd = pal->colors[i].g - g; bd = pal->colors[i].b - b; - distance = (rd * rd) + (gd * gd) + (bd * bd); + ad = pal->colors[i].a - a; + distance = (rd * rd) + (gd * gd) + (bd * bd) + (ad * ad); if (distance < smallest) { pixel = i; if (distance == 0) { /* Perfect match! */ @@ -797,7 +805,7 @@ SDL_MapRGB(const SDL_PixelFormat * format, Uint8 r, Uint8 g, Uint8 b) | (g >> format->Gloss) << format->Gshift | (b >> format->Bloss) << format->Bshift | format->Amask; } else { - return SDL_FindColor(format->palette, r, g, b); + return SDL_FindColor(format->palette, r, g, b, SDL_ALPHA_OPAQUE); } } @@ -812,7 +820,7 @@ SDL_MapRGBA(const SDL_PixelFormat * format, Uint8 r, Uint8 g, Uint8 b, | (b >> format->Bloss) << format->Bshift | ((a >> format->Aloss) << format->Ashift & format->Amask); } else { - return SDL_FindColor(format->palette, r, g, b); + return SDL_FindColor(format->palette, r, g, b, a); } } @@ -858,7 +866,7 @@ SDL_GetRGBA(Uint32 pixel, const SDL_PixelFormat * format, *r = format->palette->colors[pixel].r; *g = format->palette->colors[pixel].g; *b = format->palette->colors[pixel].b; - *a = SDL_ALPHA_OPAQUE; + *a = format->palette->colors[pixel].a; } else { *r = *g = *b = *a = 0; } @@ -894,7 +902,7 @@ Map1to1(SDL_Palette * src, SDL_Palette * dst, int *identical) for (i = 0; i < src->ncolors; ++i) { map[i] = SDL_FindColor(dst, src->colors[i].r, src->colors[i].g, - src->colors[i].b); + src->colors[i].b, src->colors[i].a); } return (map); } @@ -918,10 +926,10 @@ Map1toN(SDL_PixelFormat * src, Uint8 Rmod, Uint8 Gmod, Uint8 Bmod, Uint8 Amod, /* We memory copy to the pixel map so the endianness is preserved */ for (i = 0; i < pal->ncolors; ++i) { - Uint8 A = Amod; Uint8 R = (Uint8) ((pal->colors[i].r * Rmod) / 255); Uint8 G = (Uint8) ((pal->colors[i].g * Gmod) / 255); Uint8 B = (Uint8) ((pal->colors[i].b * Bmod) / 255); + Uint8 A = (Uint8) ((pal->colors[i].a * Amod) / 255); ASSEMBLE_RGBA(&map[i * bpp], dst->BytesPerPixel, dst, R, G, B, A); } return (map); @@ -1047,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; @@ -1083,8 +1091,18 @@ SDL_CalculateGammaRamp(float gamma, Uint16 * ramp) { int i; + /* Input validation */ + if (gamma < 0.0f ) { + SDL_InvalidParamError("gamma"); + return; + } + if (ramp == NULL) { + SDL_InvalidParamError("ramp"); + return; + } + /* 0.0 gamma is all black */ - if (gamma <= 0.0f) { + if (gamma == 0.0f) { for (i = 0; i < 256; ++i) { ramp[i] = 0; } diff --git a/src/eepp/helper/SDL2/src/video/SDL_pixels_c.h b/src/eepp/helper/SDL2/src/video/SDL_pixels_c.h index 049e34851..0b5d9a006 100644 --- a/src/eepp/helper/SDL2/src/video/SDL_pixels_c.h +++ b/src/eepp/helper/SDL2/src/video/SDL_pixels_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -36,6 +36,6 @@ extern void SDL_FreeBlitMap(SDL_BlitMap * map); /* Miscellaneous functions */ extern int SDL_CalculatePitch(SDL_Surface * surface); extern void SDL_DitherColors(SDL_Color * colors, int bpp); -extern Uint8 SDL_FindColor(SDL_Palette * pal, Uint8 r, Uint8 g, Uint8 b); +extern Uint8 SDL_FindColor(SDL_Palette * pal, Uint8 r, Uint8 g, Uint8 b, Uint8 a); /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/eepp/helper/SDL2/src/video/SDL_rect.c b/src/eepp/helper/SDL2/src/video/SDL_rect.c index f6abddda5..8dcb5b651 100644 --- a/src/eepp/helper/SDL2/src/video/SDL_rect.c +++ b/src/eepp/helper/SDL2/src/video/SDL_rect.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -29,8 +29,13 @@ SDL_HasIntersection(const SDL_Rect * A, const SDL_Rect * B) { int Amin, Amax, Bmin, Bmax; - if (!A || !B) { - // TODO error message + if (!A) { + SDL_InvalidParamError("A"); + return SDL_FALSE; + } + + if (!B) { + SDL_InvalidParamError("B"); return SDL_FALSE; } @@ -71,16 +76,28 @@ SDL_IntersectRect(const SDL_Rect * A, const SDL_Rect * B, SDL_Rect * result) { int Amin, Amax, Bmin, Bmax; - if (!A || !B || !result) { - // TODO error message + if (!A) { + SDL_InvalidParamError("A"); + return SDL_FALSE; + } + + if (!B) { + SDL_InvalidParamError("B"); + return SDL_FALSE; + } + + if (!result) { + SDL_InvalidParamError("result"); return SDL_FALSE; } /* Special cases for empty rects */ if (SDL_RectEmpty(A) || SDL_RectEmpty(B)) { + result->w = 0; + result->h = 0; return SDL_FALSE; } - + /* Horizontal intersection */ Amin = A->x; Amax = Amin + A->w; @@ -113,7 +130,18 @@ SDL_UnionRect(const SDL_Rect * A, const SDL_Rect * B, SDL_Rect * result) { int Amin, Amax, Bmin, Bmax; - if (!A || !B || !result) { + if (!A) { + SDL_InvalidParamError("A"); + return; + } + + if (!B) { + SDL_InvalidParamError("B"); + return; + } + + if (!result) { + SDL_InvalidParamError("result"); return; } @@ -127,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; @@ -171,12 +199,12 @@ SDL_EnclosePoints(const SDL_Point * points, int count, const SDL_Rect * clip, int x, y, i; if (!points) { - /* TODO error message */ + SDL_InvalidParamError("points"); return SDL_FALSE; } if (count < 1) { - /* TODO error message */ + SDL_InvalidParamError("count"); return SDL_FALSE; } @@ -191,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; @@ -231,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; @@ -298,8 +326,28 @@ SDL_IntersectRectAndLine(const SDL_Rect * rect, int *X1, int *Y1, int *X2, int recty2; int outcode1, outcode2; - if (!rect || !X1 || !Y1 || !X2 || !Y2) { - // TODO error message + if (!rect) { + 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; } @@ -307,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; @@ -412,24 +460,34 @@ SDL_IntersectRectAndLine(const SDL_Rect * rect, int *X1, int *Y1, int *X2, SDL_bool SDL_GetSpanEnclosingRect(int width, int height, - int numrects, SDL_Rect * rects, SDL_Rect *span) + int numrects, const SDL_Rect * rects, SDL_Rect *span) { int i; int span_y1, span_y2; int rect_y1, rect_y2; - if (width < 1 || height < 1) { - // TODO error message + if (width < 1) { + SDL_InvalidParamError("width"); return SDL_FALSE; } - if (!rects || !span) { - // TODO error message + if (height < 1) { + SDL_InvalidParamError("height"); + return SDL_FALSE; + } + + if (!rects) { + SDL_InvalidParamError("rects"); + return SDL_FALSE; + } + + if (!span) { + SDL_InvalidParamError("span"); return SDL_FALSE; } if (numrects < 1) { - // TODO error message + SDL_InvalidParamError("numrects"); return SDL_FALSE; } diff --git a/src/eepp/helper/SDL2/src/video/SDL_rect_c.h b/src/eepp/helper/SDL2/src/video/SDL_rect_c.h index 490013ca8..a7fd49cf8 100644 --- a/src/eepp/helper/SDL2/src/video/SDL_rect_c.h +++ b/src/eepp/helper/SDL2/src/video/SDL_rect_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,6 +20,6 @@ */ #include "SDL_config.h" -extern SDL_bool SDL_GetSpanEnclosingRect(int width, int height, int numrects, SDL_Rect * rects, SDL_Rect *span); +extern SDL_bool SDL_GetSpanEnclosingRect(int width, int height, int numrects, const SDL_Rect * rects, SDL_Rect *span); /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/eepp/helper/SDL2/src/video/SDL_shape.c b/src/eepp/helper/SDL2/src/video/SDL_shape.c index 1a807258f..e9876e410 100644 --- a/src/eepp/helper/SDL2/src/video/SDL_shape.c +++ b/src/eepp/helper/SDL2/src/video/SDL_shape.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -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; @@ -71,7 +74,6 @@ SDL_CalculateShapeBitmap(SDL_WindowShapeMode mode,SDL_Surface *shape,Uint8* bitm SDL_Color key; if(SDL_MUSTLOCK(shape)) SDL_LockSurface(shape); - pixel = (Uint8*)shape->pixels; for(y = 0;yh;y++) { for(x=0;xw;x++) { alpha = 0; @@ -164,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)) @@ -203,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); @@ -216,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); @@ -228,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); @@ -250,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 { @@ -273,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/eepp/helper/SDL2/src/video/SDL_shape_internals.h b/src/eepp/helper/SDL2/src/video/SDL_shape_internals.h index eb6b1e38e..27b51241b 100644 --- a/src/eepp/helper/SDL2/src/video/SDL_shape_internals.h +++ b/src/eepp/helper/SDL2/src/video/SDL_shape_internals.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/video/SDL_stretch.c b/src/eepp/helper/SDL2/src/video/SDL_stretch.c index 8c829f9b4..69980d076 100644 --- a/src/eepp/helper/SDL2/src/video/SDL_stretch.c +++ b/src/eepp/helper/SDL2/src/video/SDL_stretch.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -54,12 +54,12 @@ #endif #if defined(_M_IX86) || defined(i386) -#define PREFIX16 0x66 -#define STORE_BYTE 0xAA -#define STORE_WORD 0xAB -#define LOAD_BYTE 0xAC -#define LOAD_WORD 0xAD -#define RETURN 0xC3 +#define PREFIX16 0x66 +#define STORE_BYTE 0xAA +#define STORE_WORD 0xAB +#define LOAD_BYTE 0xAC +#define LOAD_WORD 0xAD +#define RETURN 0xC3 #else #error Need assembly opcodes for this architecture #endif @@ -102,14 +102,12 @@ generate_rowbytes(int src_w, int dst_w, int bpp) store = STORE_WORD; break; default: - SDL_SetError("ASM stretch of %d bytes isn't supported\n", bpp); - return (-1); + return SDL_SetError("ASM stretch of %d bytes isn't supported\n", bpp); } #ifdef HAVE_MPROTECT /* Make the code writeable */ if (mprotect(copy_row, sizeof(copy_row), PROT_READ | PROT_WRITE) < 0) { - SDL_SetError("Couldn't make copy buffer writeable"); - return (-1); + return SDL_SetError("Couldn't make copy buffer writeable"); } #endif pos = 0x10000; @@ -141,8 +139,7 @@ generate_rowbytes(int src_w, int dst_w, int bpp) #ifdef HAVE_MPROTECT /* Make the code executable but not writeable */ if (mprotect(copy_row, sizeof(copy_row), PROT_READ | PROT_EXEC) < 0) { - SDL_SetError("Couldn't make copy buffer executable"); - return (-1); + return SDL_SetError("Couldn't make copy buffer executable"); } #endif last.status = 0; @@ -151,23 +148,23 @@ generate_rowbytes(int src_w, int dst_w, int bpp) #endif /* USE_ASM_STRETCH */ -#define DEFINE_COPY_ROW(name, type) \ -static void name(type *src, int src_w, type *dst, int dst_w) \ -{ \ - int i; \ - int pos, inc; \ - type pixel = 0; \ - \ - pos = 0x10000; \ - inc = (src_w << 16) / dst_w; \ - for ( i=dst_w; i>0; --i ) { \ - while ( pos >= 0x10000L ) { \ - pixel = *src++; \ - pos -= 0x10000L; \ - } \ - *dst++ = pixel; \ - pos += inc; \ - } \ +#define DEFINE_COPY_ROW(name, type) \ +static void name(type *src, int src_w, type *dst, int dst_w) \ +{ \ + int i; \ + int pos, inc; \ + type pixel = 0; \ + \ + pos = 0x10000; \ + inc = (src_w << 16) / dst_w; \ + for ( i=dst_w; i>0; --i ) { \ + while ( pos >= 0x10000L ) { \ + pixel = *src++; \ + pos -= 0x10000L; \ + } \ + *dst++ = pixel; \ + pos += inc; \ + } \ } /* *INDENT-OFF* */ DEFINE_COPY_ROW(copy_row1, Uint8) @@ -223,9 +220,8 @@ SDL_SoftStretch(SDL_Surface * src, const SDL_Rect * srcrect, #endif /* USE_ASM_STRETCH */ const int bpp = dst->format->BytesPerPixel; - if (src->format->BitsPerPixel != dst->format->BitsPerPixel) { - SDL_SetError("Only works with same format surfaces"); - return (-1); + if (src->format->format != dst->format->format) { + return SDL_SetError("Only works with same format surfaces"); } /* Verify the blit rectangles */ @@ -233,8 +229,7 @@ SDL_SoftStretch(SDL_Surface * src, const SDL_Rect * srcrect, if ((srcrect->x < 0) || (srcrect->y < 0) || ((srcrect->x + srcrect->w) > src->w) || ((srcrect->y + srcrect->h) > src->h)) { - SDL_SetError("Invalid source blit rectangle"); - return (-1); + return SDL_SetError("Invalid source blit rectangle"); } } else { full_src.x = 0; @@ -247,8 +242,7 @@ SDL_SoftStretch(SDL_Surface * src, const SDL_Rect * srcrect, if ((dstrect->x < 0) || (dstrect->y < 0) || ((dstrect->x + dstrect->w) > dst->w) || ((dstrect->y + dstrect->h) > dst->h)) { - SDL_SetError("Invalid destination blit rectangle"); - return (-1); + return SDL_SetError("Invalid destination blit rectangle"); } } else { full_dst.x = 0; @@ -262,8 +256,7 @@ SDL_SoftStretch(SDL_Surface * src, const SDL_Rect * srcrect, dst_locked = 0; if (SDL_MUSTLOCK(dst)) { if (SDL_LockSurface(dst) < 0) { - SDL_SetError("Unable to lock destination surface"); - return (-1); + return SDL_SetError("Unable to lock destination surface"); } dst_locked = 1; } @@ -274,8 +267,7 @@ SDL_SoftStretch(SDL_Surface * src, const SDL_Rect * srcrect, if (dst_locked) { SDL_UnlockSurface(dst); } - SDL_SetError("Unable to lock source surface"); - return (-1); + return SDL_SetError("Unable to lock source surface"); } src_locked = 1; } diff --git a/src/eepp/helper/SDL2/src/video/SDL_surface.c b/src/eepp/helper/SDL2/src/video/SDL_surface.c index e989a1aab..d1c57119c 100644 --- a/src/eepp/helper/SDL2/src/video/SDL_surface.c +++ b/src/eepp/helper/SDL2/src/video/SDL_surface.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -143,8 +143,7 @@ int SDL_SetSurfacePalette(SDL_Surface * surface, SDL_Palette * palette) { if (!surface) { - SDL_SetError("SDL_SetSurfacePalette() passed a NULL surface"); - return -1; + return SDL_SetError("SDL_SetSurfacePalette() passed a NULL surface"); } return SDL_SetPixelFormatPalette(surface->format, palette); } @@ -187,7 +186,21 @@ SDL_SetColorKey(SDL_Surface * surface, int flag, Uint32 key) if (flag) { surface->map->info.flags |= SDL_COPY_COLORKEY; surface->map->info.colorkey = key; + if (surface->format->palette) { + surface->format->palette->colors[surface->map->info.colorkey].a = SDL_ALPHA_TRANSPARENT; + ++surface->format->palette->version; + if (!surface->format->palette->version) { + surface->format->palette->version = 1; + } + } } else { + if (surface->format->palette) { + surface->format->palette->colors[surface->map->info.colorkey].a = SDL_ALPHA_OPAQUE; + ++surface->format->palette->version; + if (!surface->format->palette->version) { + surface->format->palette->version = 1; + } + } surface->map->info.flags &= ~SDL_COPY_COLORKEY; } if (surface->map->info.flags != flags) { @@ -388,8 +401,7 @@ SDL_SetSurfaceBlendMode(SDL_Surface * surface, SDL_BlendMode blendMode) surface->map->info.flags |= SDL_COPY_MOD; break; default: - SDL_Unsupported(); - status = -1; + status = SDL_Unsupported(); break; } @@ -461,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. @@ -504,12 +516,10 @@ SDL_UpperBlit(SDL_Surface * src, const SDL_Rect * srcrect, /* Make sure the surfaces aren't locked */ if (!src || !dst) { - SDL_SetError("SDL_UpperBlit: passed a NULL surface"); - return (-1); + return SDL_SetError("SDL_UpperBlit: passed a NULL surface"); } if (src->locked || dst->locked) { - SDL_SetError("Surfaces must not be locked during blit"); - return (-1); + return SDL_SetError("Surfaces must not be locked during blit"); } /* If the destination rectangle is NULL, use the entire dest surface */ @@ -596,12 +606,10 @@ SDL_UpperBlitScaled(SDL_Surface * src, const SDL_Rect * srcrect, /* Make sure the surfaces aren't locked */ if (!src || !dst) { - SDL_SetError("SDL_UpperBlitScaled: passed a NULL surface"); - return (-1); + return SDL_SetError("SDL_UpperBlitScaled: passed a NULL surface"); } if (src->locked || dst->locked) { - SDL_SetError("Surfaces must not be locked during blit"); - return (-1); + return SDL_SetError("Surfaces must not be locked during blit"); } /* If the destination rectangle is NULL, use the entire dest surface */ @@ -730,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 { @@ -777,7 +785,7 @@ SDL_UnlockSurface(SDL_Surface * surface) } } -/* +/* * Convert a surface into the specified pixel format. */ SDL_Surface * @@ -843,14 +851,35 @@ SDL_ConvertSurface(SDL_Surface * surface, SDL_PixelFormat * format, SDL_COPY_RLE_ALPHAKEY)); surface->map->info.flags = copy_flags; if (copy_flags & SDL_COPY_COLORKEY) { - Uint8 keyR, keyG, keyB, keyA; + SDL_bool set_colorkey_by_color = SDL_FALSE; - SDL_GetRGBA(surface->map->info.colorkey, surface->format, &keyR, - &keyG, &keyB, &keyA); - SDL_SetColorKey(convert, 1, - SDL_MapRGBA(convert->format, keyR, keyG, keyB, keyA)); - /* This is needed when converting for 3D texture upload */ - SDL_ConvertColorkeyToAlpha(convert); + if (surface->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)) { + /* The palette is identical, just set the same colorkey */ + SDL_SetColorKey(convert, 1, surface->map->info.colorkey); + } else if (format->Amask) { + /* The alpha was set in the destination from the palette */ + } else { + set_colorkey_by_color = SDL_TRUE; + } + } else { + set_colorkey_by_color = SDL_TRUE; + } + + if (set_colorkey_by_color) { + /* Set the colorkey by color, which needs to be unique */ + Uint8 keyR, keyG, keyB, keyA; + + SDL_GetRGBA(surface->map->info.colorkey, surface->format, &keyR, + &keyG, &keyB, &keyA); + SDL_SetColorKey(convert, 1, + SDL_MapRGBA(convert->format, keyR, keyG, keyB, keyA)); + /* This is needed when converting for 3D texture upload */ + SDL_ConvertColorkeyToAlpha(convert); + } } SDL_SetClipRect(convert, &surface->clip_rect); @@ -888,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)) { @@ -935,6 +964,14 @@ int SDL_ConvertPixels(int width, int height, SDL_Rect rect; void *nonconst_src = (void *) src; + /* Check to make sure we are bliting somewhere, so we don't crash */ + if (!dst) { + return SDL_InvalidParamError("dst"); + } + if (!dst_pitch) { + return SDL_InvalidParamError("dst_pitch"); + } + /* Fast path for same format copy */ if (src_format == dst_format) { int bpp; @@ -949,8 +986,7 @@ int SDL_ConvertPixels(int width, int height, bpp = 2; break; default: - SDL_SetError("Unknown FOURCC pixel format"); - return -1; + return SDL_SetError("Unknown FOURCC pixel format"); } } else { bpp = SDL_BYTESPERPIXEL(src_format); diff --git a/src/eepp/helper/SDL2/src/video/SDL_sysvideo.h b/src/eepp/helper/SDL2/src/video/SDL_sysvideo.h index 830426603..45ca74507 100644 --- a/src/eepp/helper/SDL2/src/video/SDL_sysvideo.h +++ b/src/eepp/helper/SDL2/src/video/SDL_sysvideo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -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; }; @@ -75,13 +75,14 @@ struct SDL_Window int x, y; int w, h; int min_w, min_h; + int max_w, max_h; Uint32 flags; /* Stored position and size for windowed mode */ SDL_Rect windowed; SDL_DisplayMode fullscreen_mode; - + float brightness; Uint16 *gamma; Uint16 *saved_gamma; /* (just offset into gamma) */ @@ -109,6 +110,7 @@ struct SDL_Window */ struct SDL_VideoDisplay { + char *name; int max_display_modes; int num_display_modes; SDL_DisplayMode *display_modes; @@ -126,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 { @@ -183,6 +185,7 @@ struct SDL_VideoDevice void (*SetWindowPosition) (_THIS, SDL_Window * window); void (*SetWindowSize) (_THIS, SDL_Window * window); void (*SetWindowMinimumSize) (_THIS, SDL_Window * window); + void (*SetWindowMaximumSize) (_THIS, SDL_Window * window); void (*ShowWindow) (_THIS, SDL_Window * window); void (*HideWindow) (_THIS, SDL_Window * window); void (*RaiseWindow) (_THIS, SDL_Window * window); @@ -196,8 +199,9 @@ struct SDL_VideoDevice void (*SetWindowGrab) (_THIS, SDL_Window * window, SDL_bool grabbed); void (*DestroyWindow) (_THIS, SDL_Window * window); int (*CreateWindowFramebuffer) (_THIS, SDL_Window * window, Uint32 * format, void ** pixels, int *pitch); - int (*UpdateWindowFramebuffer) (_THIS, SDL_Window * window, SDL_Rect * rects, int numrects); + int (*UpdateWindowFramebuffer) (_THIS, SDL_Window * window, const SDL_Rect * rects, int numrects); void (*DestroyWindowFramebuffer) (_THIS, SDL_Window * window); + void (*OnWindowEnter) (_THIS, SDL_Window * window); /* * * */ /* @@ -238,10 +242,10 @@ struct SDL_VideoDevice void (*SetTextInputRect) (_THIS, SDL_Rect *rect); /* Screen keyboard */ - SDL_bool (*SDL_HasScreenKeyboardSupport) (_THIS); - void (*SDL_ShowScreenKeyboard) (_THIS, SDL_Window *window); - void (*SDL_HideScreenKeyboard) (_THIS, SDL_Window *window); - SDL_bool (*SDL_IsScreenKeyboardShown) (_THIS, SDL_Window *window); + SDL_bool (*HasScreenKeyboardSupport) (_THIS); + void (*ShowScreenKeyboard) (_THIS, SDL_Window *window); + void (*HideScreenKeyboard) (_THIS, SDL_Window *window); + SDL_bool (*IsScreenKeyboardShown) (_THIS, SDL_Window *window); /* Clipboard */ int (*SetClipboardText) (_THIS, const char *text); @@ -338,15 +342,15 @@ extern VideoBootStrap BWINDOW_bootstrap; #if SDL_VIDEO_DRIVER_PANDORA extern VideoBootStrap PND_bootstrap; #endif -#if SDL_VIDEO_DRIVER_NDS -extern VideoBootStrap NDS_bootstrap; -#endif #if SDL_VIDEO_DRIVER_UIKIT extern VideoBootStrap UIKIT_bootstrap; #endif #if SDL_VIDEO_DRIVER_ANDROID extern VideoBootStrap Android_bootstrap; #endif +#if SDL_VIDEO_DRIVER_PSP +extern VideoBootStrap PSP_bootstrap; +#endif #if SDL_VIDEO_DRIVER_DUMMY extern VideoBootStrap DUMMY_bootstrap; #endif @@ -364,11 +368,15 @@ extern void SDL_OnWindowHidden(SDL_Window * window); extern void SDL_OnWindowResized(SDL_Window * window); extern void SDL_OnWindowMinimized(SDL_Window * window); extern void SDL_OnWindowRestored(SDL_Window * window); +extern void SDL_OnWindowEnter(SDL_Window * window); +extern void SDL_OnWindowLeave(SDL_Window * window); extern void SDL_OnWindowFocusGained(SDL_Window * window); extern void SDL_OnWindowFocusLost(SDL_Window * window); extern void SDL_UpdateWindowGrab(SDL_Window * window); extern SDL_Window * SDL_GetFocusWindow(void); +extern SDL_bool SDL_ShouldAllowTopmost(void); + #endif /* _SDL_sysvideo_h */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/eepp/helper/SDL2/src/video/SDL_video.c b/src/eepp/helper/SDL2/src/video/SDL_video.c index e3109481e..8023b8536 100644 --- a/src/eepp/helper/SDL2/src/video/SDL_video.c +++ b/src/eepp/helper/SDL2/src/video/SDL_video.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -29,6 +29,7 @@ #include "SDL_pixels_c.h" #include "SDL_rect_c.h" #include "../events/SDL_events_c.h" +#include "../timer/SDL_timer_c.h" #if SDL_VIDEO_OPENGL #include "SDL_opengl.h" @@ -69,15 +70,15 @@ static VideoBootStrap *bootstrap[] = { #if SDL_VIDEO_DRIVER_PANDORA &PND_bootstrap, #endif -#if SDL_VIDEO_DRIVER_NDS - &NDS_bootstrap, -#endif #if SDL_VIDEO_DRIVER_UIKIT &UIKIT_bootstrap, #endif #if SDL_VIDEO_DRIVER_ANDROID &Android_bootstrap, #endif +#if SDL_VIDEO_DRIVER_PSP + &PSP_bootstrap, +#endif #if SDL_VIDEO_DRIVER_DUMMY &DUMMY_bootstrap, #endif @@ -242,16 +243,14 @@ SDL_CreateWindowTexture(_THIS, SDL_Window * window, Uint32 * format, void ** pix } } if (!renderer) { - SDL_SetError("No hardware accelerated renderers available"); - return -1; + return SDL_SetError("No hardware accelerated renderers available"); } /* Create the data after we successfully create the renderer (bug #1116) */ data = (SDL_WindowTextureData *)SDL_calloc(1, sizeof(*data)); if (!data) { SDL_DestroyRenderer(renderer); - SDL_OutOfMemory(); - return -1; + return SDL_OutOfMemory(); } SDL_SetWindowData(window, SDL_WINDOWTEXTUREDATA, data); @@ -294,8 +293,7 @@ SDL_CreateWindowTexture(_THIS, SDL_Window * window, Uint32 * format, void ** pix data->pitch = (((window->w * data->bytes_per_pixel) + 3) & ~3); data->pixels = SDL_malloc(window->h * data->pitch); if (!data->pixels) { - SDL_OutOfMemory(); - return -1; + return SDL_OutOfMemory(); } *pixels = data->pixels; @@ -308,7 +306,7 @@ SDL_CreateWindowTexture(_THIS, SDL_Window * window, Uint32 * format, void ** pix } static int -SDL_UpdateWindowTexture(_THIS, SDL_Window * window, SDL_Rect * rects, int numrects) +SDL_UpdateWindowTexture(_THIS, SDL_Window * window, const SDL_Rect * rects, int numrects) { SDL_WindowTextureData *data; SDL_Rect rect; @@ -316,8 +314,7 @@ SDL_UpdateWindowTexture(_THIS, SDL_Window * window, SDL_Rect * rects, int numrec data = SDL_GetWindowData(window, SDL_WINDOWTEXTUREDATA); if (!data || !data->texture) { - SDL_SetError("No window texture data"); - return -1; + return SDL_SetError("No window texture data"); } /* Update a single rect that contains subrects for best DMA performance */ @@ -384,10 +381,10 @@ cmpmodes(const void *A, const void *B) return 0; } -static void +static int SDL_UninitializedVideo() { - SDL_SetError("Video subsystem has not been initialized"); + return SDL_SetError("Video subsystem has not been initialized"); } int @@ -420,6 +417,10 @@ SDL_VideoInit(const char *driver_name) SDL_VideoQuit(); } +#if !SDL_TIMERS_DISABLED + SDL_InitTicks(); +#endif + /* Start the event loop */ if (SDL_StartEventLoop() < 0 || SDL_KeyboardInit() < 0 || @@ -437,7 +438,7 @@ SDL_VideoInit(const char *driver_name) } if (driver_name != NULL) { for (i = 0; bootstrap[i]; ++i) { - if (SDL_strcasecmp(bootstrap[i]->name, driver_name) == 0) { + if (SDL_strncasecmp(bootstrap[i]->name, driver_name, SDL_strlen(driver_name)) == 0) { video = bootstrap[i]->create(index); break; } @@ -454,11 +455,9 @@ SDL_VideoInit(const char *driver_name) } if (video == NULL) { if (driver_name) { - SDL_SetError("%s not available", driver_name); - } else { - SDL_SetError("No available video device"); + return SDL_SetError("%s not available", driver_name); } - return -1; + return SDL_SetError("No available video device"); } _this = video; _this->name = bootstrap[i]->name; @@ -510,9 +509,8 @@ SDL_VideoInit(const char *driver_name) /* Make sure some displays were added */ if (_this->num_displays == 0) { - SDL_SetError("The video driver did not add any displays"); SDL_VideoQuit(); - return (-1); + return SDL_SetError("The video driver did not add any displays"); } /* Add the renderer framebuffer emulation if desired */ @@ -581,6 +579,15 @@ SDL_AddVideoDisplay(const SDL_VideoDisplay * display) displays[index] = *display; displays[index].device = _this; _this->displays = displays; + + if (display->name) { + displays[index].name = SDL_strdup(display->name); + } else { + char name[32]; + + SDL_itoa(index, name, 10); + displays[index].name = SDL_strdup(name); + } } else { SDL_OutOfMemory(); } @@ -612,6 +619,14 @@ SDL_GetIndexOfDisplay(SDL_VideoDisplay *display) return 0; } +const char * +SDL_GetDisplayName(int displayIndex) +{ + CHECK_DISPLAY_INDEX(displayIndex, NULL); + + return _this->displays[displayIndex].name; +} + int SDL_GetDisplayBounds(int displayIndex, SDL_Rect * rect) { @@ -704,9 +719,8 @@ SDL_GetDisplayMode(int displayIndex, int index, SDL_DisplayMode * mode) display = &_this->displays[displayIndex]; if (index < 0 || index >= SDL_GetNumDisplayModesForDisplay(display)) { - SDL_SetError("index must be in the range of 0 - %d", - SDL_GetNumDisplayModesForDisplay(display) - 1); - return -1; + return SDL_SetError("index must be in the range of 0 - %d", + SDL_GetNumDisplayModesForDisplay(display) - 1); } if (mode) { *mode = display->display_modes[index]; @@ -887,9 +901,8 @@ SDL_SetDisplayModeForDisplay(SDL_VideoDisplay * display, const SDL_DisplayMode * /* Get a good video mode, the closest one possible */ if (!SDL_GetClosestDisplayModeForDisplay(display, &display_mode, &display_mode)) { - SDL_SetError("No video mode large enough for %dx%d", - display_mode.w, display_mode.h); - return -1; + return SDL_SetError("No video mode large enough for %dx%d", + display_mode.w, display_mode.h); } } else { display_mode = display->desktop_mode; @@ -903,8 +916,7 @@ SDL_SetDisplayModeForDisplay(SDL_VideoDisplay * display, const SDL_DisplayMode * /* Actually change the display mode */ if (!_this->SetDisplayMode) { - SDL_SetError("Video driver doesn't support changing display mode"); - return -1; + return SDL_SetError("Video driver doesn't support changing display mode"); } if (_this->SetDisplayMode(_this, display, &display_mode) < 0) { return -1; @@ -914,7 +926,7 @@ SDL_SetDisplayModeForDisplay(SDL_VideoDisplay * display, const SDL_DisplayMode * } int -SDL_GetWindowDisplay(SDL_Window * window) +SDL_GetWindowDisplayIndex(SDL_Window * window) { int displayIndex; int i, dist; @@ -976,7 +988,7 @@ SDL_GetWindowDisplay(SDL_Window * window) SDL_VideoDisplay * SDL_GetDisplayForWindow(SDL_Window *window) { - int displayIndex = SDL_GetWindowDisplay(window); + int displayIndex = SDL_GetWindowDisplayIndex(window); if (displayIndex >= 0) { return &_this->displays[displayIndex]; } else { @@ -1001,6 +1013,11 @@ int SDL_GetWindowDisplayMode(SDL_Window * window, SDL_DisplayMode * mode) { SDL_DisplayMode fullscreen_mode; + SDL_VideoDisplay *display; + + if (!mode) { + return SDL_InvalidParamError("mode"); + } CHECK_WINDOW_MAGIC(window, -1); @@ -1012,11 +1029,17 @@ SDL_GetWindowDisplayMode(SDL_Window * window, SDL_DisplayMode * mode) fullscreen_mode.h = window->h; } - 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)) { - SDL_SetError("Couldn't find display mode match"); - return -1; + return SDL_SetError("Couldn't find display mode match"); } if (mode) { @@ -1087,7 +1110,13 @@ SDL_UpdateFullscreenMode(SDL_Window * window, SDL_bool fullscreen) resized = SDL_FALSE; } - SDL_SetDisplayModeForDisplay(display, &fullscreen_mode); + /* 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); } @@ -1140,7 +1169,7 @@ SDL_FinishWindowCreation(SDL_Window *window, Uint32 flags) SDL_MinimizeWindow(window); } if (flags & SDL_WINDOW_FULLSCREEN) { - SDL_SetWindowFullscreen(window, SDL_TRUE); + SDL_SetWindowFullscreen(window, flags); } if (flags & SDL_WINDOW_INPUT_GRABBED) { SDL_SetWindowGrab(window, SDL_TRUE); @@ -1222,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)); @@ -1263,8 +1292,7 @@ SDL_RecreateWindow(SDL_Window * window, Uint32 flags) char *title = window->title; if ((flags & SDL_WINDOW_OPENGL) && !_this->GL_CreateContext) { - SDL_SetError("No OpenGL support in video driver"); - return -1; + return SDL_SetError("No OpenGL support in video driver"); } if (window->flags & SDL_WINDOW_FOREIGN) { @@ -1291,7 +1319,9 @@ SDL_RecreateWindow(SDL_Window * window, Uint32 flags) if ((window->flags & SDL_WINDOW_OPENGL) != (flags & SDL_WINDOW_OPENGL)) { if (flags & SDL_WINDOW_OPENGL) { - SDL_GL_LoadLibrary(NULL); + if (SDL_GL_LoadLibrary(NULL) < 0) { + return -1; + } } else { SDL_GL_UnloadLibrary(); } @@ -1401,10 +1431,16 @@ SDL_SetWindowData(SDL_Window * window, const char *name, void *userdata) CHECK_WINDOW_MAGIC(window, NULL); + /* Input validation */ + if (name == NULL || SDL_strlen(name) == 0) { + SDL_InvalidParamError("name"); + return NULL; + } + /* See if the named data already exists */ prev = NULL; for (data = window->data; data; prev = data, data = data->next) { - if (SDL_strcmp(data->name, name) == 0) { + if (data->name && SDL_strcmp(data->name, name) == 0) { void *last_value = data->data; if (userdata) { @@ -1442,8 +1478,14 @@ SDL_GetWindowData(SDL_Window * window, const char *name) CHECK_WINDOW_MAGIC(window, NULL); + /* Input validation */ + if (name == NULL || SDL_strlen(name) == 0) { + SDL_InvalidParamError("name"); + return NULL; + } + for (data = window->data; data; data = data->next) { - if (SDL_strcmp(data->name, name) == 0) { + if (data->name && SDL_strcmp(data->name, name) == 0) { return data->data; } } @@ -1455,12 +1497,6 @@ SDL_SetWindowPosition(SDL_Window * window, int x, int y) { CHECK_WINDOW_MAGIC(window, ); - if (!SDL_WINDOWPOS_ISUNDEFINED(x)) { - window->x = x; - } - if (!SDL_WINDOWPOS_ISUNDEFINED(y)) { - window->y = y; - } if (SDL_WINDOWPOS_ISCENTERED(x) || SDL_WINDOWPOS_ISCENTERED(y)) { SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window); int displayIndex; @@ -1469,12 +1505,20 @@ SDL_SetWindowPosition(SDL_Window * window, int x, int y) displayIndex = SDL_GetIndexOfDisplay(display); SDL_GetDisplayBounds(displayIndex, &bounds); if (SDL_WINDOWPOS_ISCENTERED(x)) { - window->x = bounds.x + (bounds.w - window->w) / 2; + x = bounds.x + (bounds.w - window->w) / 2; } if (SDL_WINDOWPOS_ISCENTERED(y)) { - window->y = bounds.y + (bounds.h - window->h) / 2; + y = bounds.y + (bounds.h - window->h) / 2; } } + + if (!SDL_WINDOWPOS_ISUNDEFINED(x)) { + window->x = x; + } + if (!SDL_WINDOWPOS_ISUNDEFINED(y)) { + window->y = y; + } + if (!(window->flags & SDL_WINDOW_FULLSCREEN)) { if (_this->SetWindowPosition) { _this->SetWindowPosition(_this, window); @@ -1486,18 +1530,16 @@ SDL_SetWindowPosition(SDL_Window * window, int x, int y) void SDL_GetWindowPosition(SDL_Window * window, int *x, int *y) { - /* Clear the values */ - if (x) { - *x = 0; - } - if (y) { - *y = 0; - } - CHECK_WINDOW_MAGIC(window, ); /* Fullscreen windows are always at their display's origin */ if (window->flags & SDL_WINDOW_FULLSCREEN) { + if (x) { + *x = 0; + } + if (y) { + *y = 0; + } } else { if (x) { *x = window->x; @@ -1530,6 +1572,14 @@ void SDL_SetWindowSize(SDL_Window * window, int w, int h) { CHECK_WINDOW_MAGIC(window, ); + if (w <= 0) { + SDL_InvalidParamError("w"); + return; + } + if (h <= 0) { + SDL_InvalidParamError("h"); + return; + } /* FIXME: Should this change fullscreen modes? */ if (!(window->flags & SDL_WINDOW_FULLSCREEN)) { @@ -1548,22 +1598,11 @@ SDL_SetWindowSize(SDL_Window * window, int w, int h) void SDL_GetWindowSize(SDL_Window * window, int *w, int *h) { - int dummy; - - if (!w) { - w = &dummy; - } - if (!h) { - h = &dummy; - } - - *w = 0; - *h = 0; - CHECK_WINDOW_MAGIC(window, ); - - if (_this && window && window->magic == &_this->window_magic) { + if (w) { *w = window->w; + } + if (h) { *h = window->h; } } @@ -1572,7 +1611,15 @@ void SDL_SetWindowMinimumSize(SDL_Window * window, int min_w, int min_h) { CHECK_WINDOW_MAGIC(window, ); - + if (min_w <= 0) { + SDL_InvalidParamError("min_w"); + return; + } + if (min_h <= 0) { + SDL_InvalidParamError("min_h"); + return; + } + if (!(window->flags & SDL_WINDOW_FULLSCREEN)) { window->min_w = min_w; window->min_h = min_h; @@ -1587,26 +1634,51 @@ SDL_SetWindowMinimumSize(SDL_Window * window, int min_w, int min_h) void SDL_GetWindowMinimumSize(SDL_Window * window, int *min_w, int *min_h) { - int dummy; - - if (!min_w) { - min_w = &dummy; - } - if (!min_h) { - min_h = &dummy; - } - - *min_w = 0; - *min_h = 0; - CHECK_WINDOW_MAGIC(window, ); - - if (_this && window && window->magic == &_this->window_magic) { + if (min_w) { *min_w = window->min_w; + } + if (min_h) { *min_h = window->min_h; } } +void +SDL_SetWindowMaximumSize(SDL_Window * window, int max_w, int max_h) +{ + CHECK_WINDOW_MAGIC(window, ); + if (max_w <= 0) { + SDL_InvalidParamError("max_w"); + return; + } + if (max_h <= 0) { + SDL_InvalidParamError("max_h"); + return; + } + + if (!(window->flags & SDL_WINDOW_FULLSCREEN)) { + window->max_w = max_w; + window->max_h = max_h; + if (_this->SetWindowMaximumSize) { + _this->SetWindowMaximumSize(_this, window); + } + /* Ensure that window is not larger than maximal size */ + SDL_SetWindowSize(window, SDL_min(window->w, window->max_w), SDL_min(window->h, window->max_h)); + } +} + +void +SDL_GetWindowMaximumSize(SDL_Window * window, int *max_w, int *max_h) +{ + CHECK_WINDOW_MAGIC(window, ); + if (max_w) { + *max_w = window->max_w; + } + if (max_h) { + *max_h = window->max_h; + } +} + void SDL_ShowWindow(SDL_Window * window) { @@ -1696,19 +1768,22 @@ SDL_RestoreWindow(SDL_Window * window) } } +#define FULLSCREEN_MASK ( SDL_WINDOW_FULLSCREEN_DESKTOP | SDL_WINDOW_FULLSCREEN ) int -SDL_SetWindowFullscreen(SDL_Window * window, SDL_bool fullscreen) +SDL_SetWindowFullscreen(SDL_Window * window, Uint32 flags) { CHECK_WINDOW_MAGIC(window, -1); - if (!!fullscreen == !!(window->flags & SDL_WINDOW_FULLSCREEN)) { + flags &= FULLSCREEN_MASK; + + if ( flags == (window->flags & FULLSCREEN_MASK) ) { return 0; } - if (fullscreen) { - window->flags |= SDL_WINDOW_FULLSCREEN; - } else { - window->flags &= ~SDL_WINDOW_FULLSCREEN; - } + + /* clear the previous flags and OR in the new ones */ + window->flags &= ~FULLSCREEN_MASK; + window->flags |= flags; + SDL_UpdateFullscreenMode(window, FULLSCREEN_VISIBLE(window)); return 0; @@ -1772,14 +1847,13 @@ SDL_UpdateWindowSurface(SDL_Window * window) } int -SDL_UpdateWindowSurfaceRects(SDL_Window * window, SDL_Rect * rects, +SDL_UpdateWindowSurfaceRects(SDL_Window * window, const SDL_Rect * rects, int numrects) { CHECK_WINDOW_MAGIC(window, -1); if (!window->surface_valid) { - SDL_SetError("Window surface is invalid, please call SDL_GetWindowSurface() to get a new surface"); - return -1; + return SDL_SetError("Window surface is invalid, please call SDL_GetWindowSurface() to get a new surface"); } return _this->UpdateWindowFramebuffer(_this, window, rects, numrects); @@ -1817,8 +1891,7 @@ SDL_SetWindowGammaRamp(SDL_Window * window, const Uint16 * red, CHECK_WINDOW_MAGIC(window, -1); if (!_this->SetWindowGammaRamp) { - SDL_Unsupported(); - return -1; + return SDL_Unsupported(); } if (!window->gamma) { @@ -1855,8 +1928,7 @@ SDL_GetWindowGammaRamp(SDL_Window * window, Uint16 * red, window->gamma = (Uint16 *)SDL_malloc(256*6*sizeof(Uint16)); if (!window->gamma) { - SDL_OutOfMemory(); - return -1; + return SDL_OutOfMemory(); } window->saved_gamma = window->gamma + 3*256; @@ -1963,16 +2035,49 @@ SDL_OnWindowRestored(SDL_Window * window) } } +void +SDL_OnWindowEnter(SDL_Window * window) +{ + if (_this->OnWindowEnter) { + _this->OnWindowEnter(_this, window); + } +} + +void +SDL_OnWindowLeave(SDL_Window * window) +{ +} + void SDL_OnWindowFocusGained(SDL_Window * window) { + SDL_Mouse *mouse = SDL_GetMouse(); + if (window->gamma && _this->SetWindowGammaRamp) { _this->SetWindowGammaRamp(_this, window, window->gamma); } + if (mouse && mouse->relative_mode) { + SDL_SetMouseFocus(window); + SDL_WarpMouseInWindow(window, window->w/2, window->h/2); + } + SDL_UpdateWindowGrab(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; +} + void SDL_OnWindowFocusLost(SDL_Window * window) { @@ -1983,8 +2088,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) && _this->num_displays == 1) { - SDL_MinimizeWindow(window); + if ((window->flags & SDL_WINDOW_FULLSCREEN) && ShouldMinimizeOnFocusLoss() ) { + SDL_MinimizeWindow(window); } } @@ -2163,8 +2268,12 @@ SDL_VideoQuit(void) } } if (_this->displays) { + for (i = 0; i < _this->num_displays; ++i) { + SDL_free(_this->displays[i].name); + } SDL_free(_this->displays); _this->displays = NULL; + _this->num_displays = 0; } if (_this->clipboard_text) { SDL_free(_this->clipboard_text); @@ -2180,19 +2289,16 @@ SDL_GL_LoadLibrary(const char *path) int retval; if (!_this) { - SDL_UninitializedVideo(); - return -1; + return SDL_UninitializedVideo(); } if (_this->gl_config.driver_loaded) { if (path && SDL_strcmp(path, _this->gl_config.driver_path) != 0) { - SDL_SetError("OpenGL library already loaded"); - return -1; + return SDL_SetError("OpenGL library already loaded"); } retval = 0; } else { if (!_this->GL_LoadLibrary) { - SDL_SetError("No dynamic GL support in video driver"); - return -1; + return SDL_SetError("No dynamic GL support in video driver"); } retval = _this->GL_LoadLibrary(_this, path); } @@ -2241,6 +2347,12 @@ SDL_GL_UnloadLibrary(void) } } +static __inline__ SDL_bool +isAtLeastGL3(const char *verstr) +{ + return ( verstr && (SDL_atoi(verstr) >= 3) ); +} + SDL_bool SDL_GL_ExtensionSupported(const char *extension) { @@ -2260,13 +2372,43 @@ SDL_GL_ExtensionSupported(const char *extension) if (start && *start == '0') { return SDL_FALSE; } + /* Lookup the available extensions */ + glGetStringFunc = SDL_GL_GetProcAddress("glGetString"); - if (glGetStringFunc) { - extensions = (const char *) glGetStringFunc(GL_EXTENSIONS); - } else { - extensions = NULL; + if (!glGetStringFunc) { + return SDL_FALSE; } + + if (isAtLeastGL3((const char *) glGetStringFunc(GL_VERSION))) { + const GLubyte *(APIENTRY * glGetStringiFunc) (GLenum, GLuint); + void (APIENTRY * glGetIntegervFunc) (GLenum pname, GLint * params); + GLint num_exts = 0; + GLint i; + + glGetStringiFunc = SDL_GL_GetProcAddress("glGetStringi"); + glGetIntegervFunc = SDL_GL_GetProcAddress("glGetIntegerv"); + if ((!glGetStringiFunc) || (!glGetIntegervFunc)) { + return SDL_FALSE; + } + + #ifndef GL_NUM_EXTENSIONS + #define GL_NUM_EXTENSIONS 0x821D + #endif + glGetIntegervFunc(GL_NUM_EXTENSIONS, &num_exts); + for (i = 0; i < num_exts; i++) { + const char *thisext = (const char *) glGetStringiFunc(GL_EXTENSIONS, i); + if (SDL_strcmp(thisext, extension) == 0) { + return SDL_TRUE; + } + } + + return SDL_FALSE; + } + + /* Try the old way with glGetString(GL_EXTENSIONS) ... */ + + extensions = (const char *) glGetStringFunc(GL_EXTENSIONS); if (!extensions) { return SDL_FALSE; } @@ -2302,8 +2444,7 @@ SDL_GL_SetAttribute(SDL_GLattr attr, int value) int retval; if (!_this) { - SDL_UninitializedVideo(); - return -1; + return SDL_UninitializedVideo(); } retval = 0; switch (attr) { @@ -2369,38 +2510,34 @@ 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) ) { - SDL_SetError("Unknown OpenGL context flag %d", value); - retval = -1; - 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 ) { - SDL_SetError("Unknown OpenGL context profile %d", value); - retval = -1; - 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: - SDL_SetError("Unknown OpenGL attribute"); - retval = -1; + retval = SDL_SetError("Unknown OpenGL attribute"); break; } return retval; #else - SDL_Unsupported(); - return -1; + return SDL_Unsupported(); #endif /* SDL_VIDEO_OPENGL */ } @@ -2559,36 +2696,22 @@ SDL_GL_GetAttribute(SDL_GLattr attr, int *value) return 0; } default: - SDL_SetError("Unknown OpenGL attribute"); - return -1; + return SDL_SetError("Unknown OpenGL attribute"); } glGetIntegervFunc(attrib, (GLint *) value); error = glGetErrorFunc(); if (error != GL_NO_ERROR) { - switch (error) { - case GL_INVALID_ENUM: - { - SDL_SetError("OpenGL error: GL_INVALID_ENUM"); - } - break; - case GL_INVALID_VALUE: - { - SDL_SetError("OpenGL error: GL_INVALID_VALUE"); - } - break; - default: - { - SDL_SetError("OpenGL error: %08X", error); - } - break; + if (error == GL_INVALID_ENUM) { + return SDL_SetError("OpenGL error: GL_INVALID_ENUM"); + } else if (error == GL_INVALID_VALUE) { + return SDL_SetError("OpenGL error: GL_INVALID_VALUE"); } - return -1; + return SDL_SetError("OpenGL error: %08X", error); } return 0; #else - SDL_Unsupported(); - return -1; + return SDL_Unsupported(); #endif /* SDL_VIDEO_OPENGL */ } @@ -2617,14 +2740,14 @@ SDL_GL_MakeCurrent(SDL_Window * window, SDL_GLContext ctx) { int retval; - CHECK_WINDOW_MAGIC(window, -1); - - if (!(window->flags & SDL_WINDOW_OPENGL)) { - SDL_SetError("The specified window isn't an OpenGL window"); - return -1; - } if (!ctx) { window = NULL; + } else { + CHECK_WINDOW_MAGIC(window, -1); + + if (!(window->flags & SDL_WINDOW_OPENGL)) { + return SDL_SetError("The specified window isn't an OpenGL window"); + } } if ((window == _this->current_glwin) && (ctx == _this->current_glctx)) { @@ -2644,16 +2767,13 @@ int SDL_GL_SetSwapInterval(int interval) { if (!_this) { - SDL_UninitializedVideo(); - return -1; + return SDL_UninitializedVideo(); } else if (_this->current_glctx == NULL) { - SDL_SetError("No OpenGL context has been made current"); - return -1; + return SDL_SetError("No OpenGL context has been made current"); } else if (_this->GL_SetSwapInterval) { return _this->GL_SetSwapInterval(_this, interval); } else { - SDL_SetError("Setting the swap interval is not supported"); - return -1; + return SDL_SetError("Setting the swap interval is not supported"); } } @@ -2689,11 +2809,15 @@ SDL_GL_DeleteContext(SDL_GLContext context) if (!_this || !context) { return; } - _this->GL_MakeCurrent(_this, NULL, NULL); + + if (_this->current_glctx == context) { + SDL_GL_MakeCurrent(NULL, NULL); + } + _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. @@ -2704,7 +2828,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) { @@ -2819,8 +2943,8 @@ SDL_StartTextInput(void) /* Then show the on-screen keyboard, if any */ window = SDL_GetFocusWindow(); - if (window && _this && _this->SDL_ShowScreenKeyboard) { - _this->SDL_ShowScreenKeyboard(_this, window); + if (window && _this && _this->ShowScreenKeyboard) { + _this->ShowScreenKeyboard(_this, window); } /* Finally start the text input system */ @@ -2847,8 +2971,8 @@ SDL_StopTextInput(void) /* Hide the on-screen keyboard, if any */ window = SDL_GetFocusWindow(); - if (window && _this && _this->SDL_HideScreenKeyboard) { - _this->SDL_HideScreenKeyboard(_this, window); + if (window && _this && _this->HideScreenKeyboard) { + _this->HideScreenKeyboard(_this, window); } /* Finally disable text events */ @@ -2867,8 +2991,8 @@ SDL_SetTextInputRect(SDL_Rect *rect) SDL_bool SDL_HasScreenKeyboardSupport(void) { - if (_this && _this->SDL_HasScreenKeyboardSupport) { - return _this->SDL_HasScreenKeyboardSupport(_this); + if (_this && _this->HasScreenKeyboardSupport) { + return _this->HasScreenKeyboardSupport(_this); } return SDL_FALSE; } @@ -2876,8 +3000,8 @@ SDL_HasScreenKeyboardSupport(void) SDL_bool SDL_IsScreenKeyboardShown(SDL_Window *window) { - if (window && _this && _this->SDL_IsScreenKeyboardShown) { - return _this->SDL_IsScreenKeyboardShown(_this, window); + if (window && _this && _this->IsScreenKeyboardShown) { + return _this->IsScreenKeyboardShown(_this, window); } return SDL_FALSE; } @@ -2899,40 +3023,50 @@ 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 ); + + SDL_SetRelativeMouseMode( SDL_FALSE ); if (!buttonid) { buttonid = &dummybutton; } if (_this && _this->ShowMessageBox) { if (_this->ShowMessageBox(_this, messageboxdata, buttonid) == 0) { - return 0; + retval = 0; } } /* It's completely fine to call this function before video is initialized */ #if SDL_VIDEO_DRIVER_WINDOWS - if (WIN_ShowMessageBox(messageboxdata, buttonid) == 0) { - return 0; + if ((retval == -1) && (WIN_ShowMessageBox(messageboxdata, buttonid) == 0)) { + retval = 0; } #endif #if SDL_VIDEO_DRIVER_COCOA - if (Cocoa_ShowMessageBox(messageboxdata, buttonid) == 0) { - return 0; + if ((retval == -1) && (Cocoa_ShowMessageBox(messageboxdata, buttonid) == 0)) { + retval = 0; } #endif #if SDL_VIDEO_DRIVER_UIKIT - if (UIKit_ShowMessageBox(messageboxdata, buttonid) == 0) { - return 0; + if ((retval == -1) && (UIKit_ShowMessageBox(messageboxdata, buttonid) == 0)) { + retval = 0; } #endif #if SDL_VIDEO_DRIVER_X11 - if (X11_ShowMessageBox(messageboxdata, buttonid) == 0) { - return 0; + if ((retval == -1) && (X11_ShowMessageBox(messageboxdata, buttonid) == 0)) { + retval = 0; } #endif - SDL_SetError("No message system available"); - return -1; + SDL_ShowCursor( show_cursor_prev ); + SDL_SetRelativeMouseMode( relative_mode ); + + if(retval == -1) { + SDL_SetError("No message system available"); + } + return retval; } int @@ -2957,4 +3091,18 @@ SDL_ShowSimpleMessageBox(Uint32 flags, const char *title, const char *message, S return SDL_ShowMessageBox(&data, NULL); } +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; +} + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/eepp/helper/SDL2/src/video/android/SDL_androidclipboard.c b/src/eepp/helper/SDL2/src/video/android/SDL_androidclipboard.c index 031c90f8d..19a70a305 100644 --- a/src/eepp/helper/SDL2/src/video/android/SDL_androidclipboard.c +++ b/src/eepp/helper/SDL2/src/video/android/SDL_androidclipboard.c @@ -1,3 +1,23 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2013 Sam Lantinga + + 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 + appreciated but is not required. + 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. +*/ #include "SDL_config.h" #if SDL_VIDEO_DRIVER_ANDROID @@ -9,18 +29,20 @@ int Android_SetClipboardText(_THIS, const char *text) { - return Android_JNI_SetClipboardText(text); + return Android_JNI_SetClipboardText(text); } char * Android_GetClipboardText(_THIS) { - return Android_JNI_GetClipboardText(); + return Android_JNI_GetClipboardText(); } SDL_bool Android_HasClipboardText(_THIS) { - return Android_JNI_HasClipboardText(); + return Android_JNI_HasClipboardText(); } #endif /* SDL_VIDEO_DRIVER_ANDROID */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/eepp/helper/SDL2/src/video/android/SDL_androidclipboard.h b/src/eepp/helper/SDL2/src/video/android/SDL_androidclipboard.h index d1eb6632c..d1cdaf1c4 100644 --- a/src/eepp/helper/SDL2/src/video/android/SDL_androidclipboard.h +++ b/src/eepp/helper/SDL2/src/video/android/SDL_androidclipboard.h @@ -1,3 +1,23 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2013 Sam Lantinga + + 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 + appreciated but is not required. + 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. +*/ #include "SDL_config.h" #ifndef _SDL_androidclipboard_h @@ -8,3 +28,5 @@ extern char *Android_GetClipboardText(_THIS); extern SDL_bool Android_HasClipboardText(_THIS); #endif /* _SDL_androidclipboard_h */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/eepp/helper/SDL2/src/video/android/SDL_androidevents.c b/src/eepp/helper/SDL2/src/video/android/SDL_androidevents.c index d51a91ce0..528fce5c6 100644 --- a/src/eepp/helper/SDL2/src/video/android/SDL_androidevents.c +++ b/src/eepp/helper/SDL2/src/video/android/SDL_androidevents.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/video/android/SDL_androidevents.h b/src/eepp/helper/SDL2/src/video/android/SDL_androidevents.h index 791d07637..970131c71 100644 --- a/src/eepp/helper/SDL2/src/video/android/SDL_androidevents.h +++ b/src/eepp/helper/SDL2/src/video/android/SDL_androidevents.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/video/android/SDL_androidgl.c b/src/eepp/helper/SDL2/src/video/android/SDL_androidgl.c index df0dfcb55..1382b8878 100644 --- a/src/eepp/helper/SDL2/src/video/android/SDL_androidgl.c +++ b/src/eepp/helper/SDL2/src/video/android/SDL_androidgl.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -42,8 +42,7 @@ Android_GL_LoadLibrary(_THIS, const char *path) if (!Android_GLHandle) { Android_GLHandle = dlopen("libGLESv1_CM.so",RTLD_GLOBAL); if (!Android_GLHandle) { - SDL_SetError("Could not initialize GL ES library\n"); - return -1; + return SDL_SetError("Could not initialize GL ES library\n"); } } return 0; @@ -74,7 +73,16 @@ SDL_GLContext Android_GL_CreateContext(_THIS, SDL_Window * window) { if (!Android_JNI_CreateContext(_this->gl_config.major_version, - _this->gl_config.minor_version)) { + _this->gl_config.minor_version, + _this->gl_config.red_size, + _this->gl_config.green_size, + _this->gl_config.blue_size, + _this->gl_config.alpha_size, + _this->gl_config.buffer_size, + _this->gl_config.depth_size, + _this->gl_config.stencil_size, + _this->gl_config.multisamplebuffers, + _this->gl_config.multisamplesamples)) { SDL_SetError("Couldn't create OpenGL context - see Android log for details"); return NULL; } diff --git a/src/eepp/helper/SDL2/src/video/android/SDL_androidkeyboard.c b/src/eepp/helper/SDL2/src/video/android/SDL_androidkeyboard.c index b1fe43a0e..512007a2f 100644 --- a/src/eepp/helper/SDL2/src/video/android/SDL_androidkeyboard.c +++ b/src/eepp/helper/SDL2/src/video/android/SDL_androidkeyboard.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -28,8 +28,9 @@ #include "SDL_androidkeyboard.h" +#include "../../core/android/SDL_android.h" -void Android_InitKeyboard() +void Android_InitKeyboard(void) { SDL_Keycode keymap[SDL_NUM_SCANCODES]; @@ -316,6 +317,12 @@ void Android_SetTextInputRect(_THIS, SDL_Rect *rect) { SDL_VideoData *videodata = (SDL_VideoData *)_this->driverdata; + + if (!rect) { + SDL_InvalidParamError("rect"); + return; + } + videodata->textRect = *rect; } diff --git a/src/eepp/helper/SDL2/src/video/android/SDL_androidkeyboard.h b/src/eepp/helper/SDL2/src/video/android/SDL_androidkeyboard.h index 9cc7b0261..da8da9b75 100644 --- a/src/eepp/helper/SDL2/src/video/android/SDL_androidkeyboard.h +++ b/src/eepp/helper/SDL2/src/video/android/SDL_androidkeyboard.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -22,7 +22,7 @@ #include "SDL_androidvideo.h" -extern void Android_InitKeyboard(); +extern void Android_InitKeyboard(void); extern int Android_OnKeyDown(int keycode); extern int Android_OnKeyUp(int keycode); diff --git a/src/eepp/helper/SDL2/src/video/android/SDL_androidtouch.c b/src/eepp/helper/SDL2/src/video/android/SDL_androidtouch.c index 645a9071c..1b42b5f77 100644 --- a/src/eepp/helper/SDL2/src/video/android/SDL_androidtouch.c +++ b/src/eepp/helper/SDL2/src/video/android/SDL_androidtouch.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -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; @@ -63,22 +63,8 @@ void Android_OnTouch(int touch_device_id_in, int pointer_finger_id_in, int actio } touchDeviceId = (SDL_TouchID)touch_device_id_in; - if (!SDL_GetTouch(touchDeviceId)) { - SDL_Touch touch; - memset( &touch, 0, sizeof(touch) ); - touch.id = touchDeviceId; - touch.x_min = 0.0f; - touch.x_max = 1.0f; - touch.native_xres = touch.x_max - touch.x_min; - touch.y_min = 0.0f; - touch.y_max = 1.0f; - touch.native_yres = touch.y_max - touch.y_min; - touch.pressure_min = 0.0f; - touch.pressure_max = 1.0f; - touch.native_pressureres = touch.pressure_max - touch.pressure_min; - if (SDL_AddTouch(&touch, "") < 0) { - SDL_Log("error: can't add touch %s, %d", __FILE__, __LINE__); - } + if (SDL_AddTouch(touchDeviceId, "") < 0) { + SDL_Log("error: can't add touch %s, %d", __FILE__, __LINE__); } fingerId = (SDL_FingerID)pointer_finger_id_in; @@ -89,36 +75,36 @@ void Android_OnTouch(int touch_device_id_in, int pointer_finger_id_in, int actio Android_GetWindowCoordinates(x, y, &window_x, &window_y); /* send moved event */ - SDL_SendMouseMotion(NULL, 0, window_x, window_y); + SDL_SendMouseMotion(NULL, SDL_TOUCH_MOUSEID, 0, window_x, window_y); /* send mouse down event */ - SDL_SendMouseButton(NULL, SDL_PRESSED, SDL_BUTTON_LEFT); + SDL_SendMouseButton(NULL, SDL_TOUCH_MOUSEID, SDL_PRESSED, SDL_BUTTON_LEFT); leftFingerDown = fingerId; } - SDL_SendFingerDown(touchDeviceId, fingerId, SDL_TRUE, x, y, p); + SDL_SendTouch(touchDeviceId, fingerId, SDL_TRUE, x, y, p); break; case ACTION_MOVE: if (!leftFingerDown) { Android_GetWindowCoordinates(x, y, &window_x, &window_y); /* send moved event */ - SDL_SendMouseMotion(NULL, 0, window_x, window_y); + SDL_SendMouseMotion(NULL, SDL_TOUCH_MOUSEID, 0, window_x, window_y); } - SDL_SendTouchMotion(touchDeviceId, fingerId, SDL_FALSE, x, y, p); + SDL_SendTouchMotion(touchDeviceId, fingerId, x, y, p); break; case ACTION_UP: case ACTION_POINTER_1_UP: if (fingerId == leftFingerDown) { /* send mouse up */ - SDL_SendMouseButton(NULL, SDL_RELEASED, SDL_BUTTON_LEFT); + SDL_SendMouseButton(NULL, SDL_TOUCH_MOUSEID, SDL_RELEASED, SDL_BUTTON_LEFT); leftFingerDown = 0; } - SDL_SendFingerDown(touchDeviceId, fingerId, SDL_FALSE, x, y, p); + SDL_SendTouch(touchDeviceId, fingerId, SDL_FALSE, x, y, p); break; default: break; - } + } } #endif /* SDL_VIDEO_DRIVER_ANDROID */ diff --git a/src/eepp/helper/SDL2/src/video/android/SDL_androidtouch.h b/src/eepp/helper/SDL2/src/video/android/SDL_androidtouch.h index 755035fca..50a3ebdc8 100644 --- a/src/eepp/helper/SDL2/src/video/android/SDL_androidtouch.h +++ b/src/eepp/helper/SDL2/src/video/android/SDL_androidtouch.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/video/android/SDL_androidvideo.c b/src/eepp/helper/SDL2/src/video/android/SDL_androidvideo.c index 7cb62eff3..4b4a85196 100644 --- a/src/eepp/helper/SDL2/src/video/android/SDL_androidvideo.c +++ b/src/eepp/helper/SDL2/src/video/android/SDL_androidvideo.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -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; @@ -133,8 +131,8 @@ Android_CreateDevice(int devindex) device->SetTextInputRect = Android_SetTextInputRect; /* Screen keyboard */ - device->SDL_HasScreenKeyboardSupport = Android_HasScreenKeyboardSupport; - device->SDL_IsScreenKeyboardShown = Android_IsScreenKeyboardShown; + device->HasScreenKeyboardSupport = Android_HasScreenKeyboardSupport; + device->IsScreenKeyboardShown = Android_IsScreenKeyboardShown; /* Clipboard */ device->SetClipboardText = Android_SetClipboardText; @@ -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/eepp/helper/SDL2/src/video/android/SDL_androidvideo.h b/src/eepp/helper/SDL2/src/video/android/SDL_androidvideo.h index 3add56ad0..3f509ab22 100644 --- a/src/eepp/helper/SDL2/src/video/android/SDL_androidvideo.h +++ b/src/eepp/helper/SDL2/src/video/android/SDL_androidvideo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/video/android/SDL_androidwindow.c b/src/eepp/helper/SDL2/src/video/android/SDL_androidwindow.c index ba3093dca..b3c6cd9a4 100644 --- a/src/eepp/helper/SDL2/src/video/android/SDL_androidwindow.c +++ b/src/eepp/helper/SDL2/src/video/android/SDL_androidwindow.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -27,12 +27,13 @@ #include "SDL_androidvideo.h" #include "SDL_androidwindow.h" +#include "../../core/android/SDL_android.h" + int Android_CreateWindow(_THIS, SDL_Window * window) { if (Android_Window) { - SDL_SetError("Android only supports one window"); - return -1; + return SDL_SetError("Android only supports one window"); } Android_Window = window; Android_PauseSem = SDL_CreateSemaphore(0); @@ -48,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/eepp/helper/SDL2/src/video/android/SDL_androidwindow.h b/src/eepp/helper/SDL2/src/video/android/SDL_androidwindow.h index 38c30fa35..c0ef93bb0 100644 --- a/src/eepp/helper/SDL2/src/video/android/SDL_androidwindow.h +++ b/src/eepp/helper/SDL2/src/video/android/SDL_androidwindow.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/video/bwindow/SDL_BWin.h b/src/eepp/helper/SDL2/src/video/bwindow/SDL_BWin.h index da06f6cd6..fb576da68 100644 --- a/src/eepp/helper/SDL2/src/video/bwindow/SDL_BWin.h +++ b/src/eepp/helper/SDL2/src/video/bwindow/SDL_BWin.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -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; - } + 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(); + /* 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; + 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_MODIFY: + if(_clips) { + free(_clips); + _clips = NULL; + } - case B_DIRECT_STOP: - _connected = false; - break; - } + _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); + /* 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); + 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); + 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); } - + /* 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; - BMessage msg(BAPP_HIDE); - _PostWindowEvent(msg); + virtual void Hide() { + BDirectWindow::Hide(); + _shown = false; + + 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/eepp/helper/SDL2/src/video/bwindow/SDL_bclipboard.cc b/src/eepp/helper/SDL2/src/video/bwindow/SDL_bclipboard.cc index b43dbdadd..4801483c4 100644 --- a/src/eepp/helper/SDL2/src/video/bwindow/SDL_bclipboard.cc +++ b/src/eepp/helper/SDL2/src/video/bwindow/SDL_bclipboard.cc @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/video/bwindow/SDL_bclipboard.h b/src/eepp/helper/SDL2/src/video/bwindow/SDL_bclipboard.h index 0c216cf78..9ffbf9e79 100644 --- a/src/eepp/helper/SDL2/src/video/bwindow/SDL_bclipboard.h +++ b/src/eepp/helper/SDL2/src/video/bwindow/SDL_bclipboard.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/video/bwindow/SDL_bevents.cc b/src/eepp/helper/SDL2/src/video/bwindow/SDL_bevents.cc index 62d4cd87d..e01e8b274 100644 --- a/src/eepp/helper/SDL2/src/video/bwindow/SDL_bevents.cc +++ b/src/eepp/helper/SDL2/src/video/bwindow/SDL_bevents.cc @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/video/bwindow/SDL_bevents.h b/src/eepp/helper/SDL2/src/video/bwindow/SDL_bevents.h index 49e320124..a83d03b52 100644 --- a/src/eepp/helper/SDL2/src/video/bwindow/SDL_bevents.h +++ b/src/eepp/helper/SDL2/src/video/bwindow/SDL_bevents.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -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/eepp/helper/SDL2/src/video/bwindow/SDL_bframebuffer.cc b/src/eepp/helper/SDL2/src/video/bwindow/SDL_bframebuffer.cc index 4d0f39d99..6e7f8c3f2 100644 --- a/src/eepp/helper/SDL2/src/video/bwindow/SDL_bframebuffer.cc +++ b/src/eepp/helper/SDL2/src/video/bwindow/SDL_bframebuffer.cc @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -76,8 +76,7 @@ int BE_CreateWindowFramebuffer(_THIS, SDL_Window * window, true); /* Contiguous memory required */ if(bitmap->InitCheck() != B_OK) { - SDL_SetError("Could not initialize back buffer!\n"); - return -1; + return SDL_SetError("Could not initialize back buffer!\n"); } @@ -98,7 +97,7 @@ int BE_CreateWindowFramebuffer(_THIS, SDL_Window * window, int BE_UpdateWindowFramebuffer(_THIS, SDL_Window * window, - SDL_Rect * rects, int numrects) { + const SDL_Rect * rects, int numrects) { if(!window) return 0; diff --git a/src/eepp/helper/SDL2/src/video/bwindow/SDL_bframebuffer.h b/src/eepp/helper/SDL2/src/video/bwindow/SDL_bframebuffer.h index 3ffaf6a29..935f0e95a 100644 --- a/src/eepp/helper/SDL2/src/video/bwindow/SDL_bframebuffer.h +++ b/src/eepp/helper/SDL2/src/video/bwindow/SDL_bframebuffer.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -34,7 +34,7 @@ extern int BE_CreateWindowFramebuffer(_THIS, SDL_Window * window, Uint32 * format, void ** pixels, int *pitch); extern int BE_UpdateWindowFramebuffer(_THIS, SDL_Window * window, - SDL_Rect * rects, int numrects); + const SDL_Rect * rects, int numrects); extern void BE_DestroyWindowFramebuffer(_THIS, SDL_Window * window); extern int32 BE_DrawThread(void *data); diff --git a/src/eepp/helper/SDL2/src/video/bwindow/SDL_bkeyboard.cc b/src/eepp/helper/SDL2/src/video/bwindow/SDL_bkeyboard.cc index 75e3c63fb..41eb6cad0 100644 --- a/src/eepp/helper/SDL2/src/video/bwindow/SDL_bkeyboard.cc +++ b/src/eepp/helper/SDL2/src/video/bwindow/SDL_bkeyboard.cc @@ -1,23 +1,22 @@ /* - SDL - Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Simple DirectMedia Layer + Copyright (C) 1997-2013 Sam Lantinga - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. + 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. - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. + 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: - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - Sam Lantinga - slouken@libsdl.org + 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 + appreciated but is not required. + 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. */ #include "SDL_config.h" diff --git a/src/eepp/helper/SDL2/src/video/bwindow/SDL_bkeyboard.h b/src/eepp/helper/SDL2/src/video/bwindow/SDL_bkeyboard.h index c8221ef29..b170228a1 100644 --- a/src/eepp/helper/SDL2/src/video/bwindow/SDL_bkeyboard.h +++ b/src/eepp/helper/SDL2/src/video/bwindow/SDL_bkeyboard.h @@ -1,23 +1,22 @@ /* - SDL - Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Simple DirectMedia Layer + Copyright (C) 1997-2013 Sam Lantinga - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. + 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. - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. + 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: - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - Sam Lantinga - slouken@libsdl.org + 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 + appreciated but is not required. + 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_BKEYBOARD_H diff --git a/src/eepp/helper/SDL2/src/video/bwindow/SDL_bmodes.cc b/src/eepp/helper/SDL2/src/video/bwindow/SDL_bmodes.cc index d42d94c1c..41894fb78 100644 --- a/src/eepp/helper/SDL2/src/video/bwindow/SDL_bmodes.cc +++ b/src/eepp/helper/SDL2/src/video/bwindow/SDL_bmodes.cc @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -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); @@ -310,8 +310,7 @@ int BE_SetDisplayMode(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mode){ } if(bscreen.SetMode(bmode) != B_OK) { - SDL_SetError("Bad video mode\n"); - return -1; + return SDL_SetError("Bad video mode\n"); } free(bmode_list); diff --git a/src/eepp/helper/SDL2/src/video/bwindow/SDL_bmodes.h b/src/eepp/helper/SDL2/src/video/bwindow/SDL_bmodes.h index 4b9522179..9ca04d087 100644 --- a/src/eepp/helper/SDL2/src/video/bwindow/SDL_bmodes.h +++ b/src/eepp/helper/SDL2/src/video/bwindow/SDL_bmodes.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -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/eepp/helper/SDL2/src/video/bwindow/SDL_bopengl.cc b/src/eepp/helper/SDL2/src/video/bwindow/SDL_bopengl.cc index 4a241c784..5acefe2cd 100644 --- a/src/eepp/helper/SDL2/src/video/bwindow/SDL_bopengl.cc +++ b/src/eepp/helper/SDL2/src/video/bwindow/SDL_bopengl.cc @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/video/bwindow/SDL_bopengl.h b/src/eepp/helper/SDL2/src/video/bwindow/SDL_bopengl.h index 155a9d75f..f0279ba66 100644 --- a/src/eepp/helper/SDL2/src/video/bwindow/SDL_bopengl.h +++ b/src/eepp/helper/SDL2/src/video/bwindow/SDL_bopengl.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -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/eepp/helper/SDL2/src/video/bwindow/SDL_bvideo.cc b/src/eepp/helper/SDL2/src/video/bwindow/SDL_bvideo.cc index eaee88efa..19c03eed6 100644 --- a/src/eepp/helper/SDL2/src/video/bwindow/SDL_bvideo.cc +++ b/src/eepp/helper/SDL2/src/video/bwindow/SDL_bvideo.cc @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/video/bwindow/SDL_bvideo.h b/src/eepp/helper/SDL2/src/video/bwindow/SDL_bvideo.h index 6377c3e61..e0e8e07de 100644 --- a/src/eepp/helper/SDL2/src/video/bwindow/SDL_bvideo.h +++ b/src/eepp/helper/SDL2/src/video/bwindow/SDL_bvideo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/video/bwindow/SDL_bwindow.cc b/src/eepp/helper/SDL2/src/video/bwindow/SDL_bwindow.cc index bc3ae0167..c6eb3aa1a 100644 --- a/src/eepp/helper/SDL2/src/video/bwindow/SDL_bwindow.cc +++ b/src/eepp/helper/SDL2/src/video/bwindow/SDL_bwindow.cc @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/video/bwindow/SDL_bwindow.h b/src/eepp/helper/SDL2/src/video/bwindow/SDL_bwindow.h index a5c992eca..e3c0b6a3c 100644 --- a/src/eepp/helper/SDL2/src/video/bwindow/SDL_bwindow.h +++ b/src/eepp/helper/SDL2/src/video/bwindow/SDL_bwindow.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/video/cocoa/SDL_cocoaclipboard.h b/src/eepp/helper/SDL2/src/video/cocoa/SDL_cocoaclipboard.h index 6b52f86e7..74515dd94 100644 --- a/src/eepp/helper/SDL2/src/video/cocoa/SDL_cocoaclipboard.h +++ b/src/eepp/helper/SDL2/src/video/cocoa/SDL_cocoaclipboard.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/video/cocoa/SDL_cocoaclipboard.m b/src/eepp/helper/SDL2/src/video/cocoa/SDL_cocoaclipboard.m index 21a888236..27d222769 100644 --- a/src/eepp/helper/SDL2/src/video/cocoa/SDL_cocoaclipboard.m +++ b/src/eepp/helper/SDL2/src/video/cocoa/SDL_cocoaclipboard.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -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/eepp/helper/SDL2/src/video/cocoa/SDL_cocoaevents.h b/src/eepp/helper/SDL2/src/video/cocoa/SDL_cocoaevents.h index 4b6f74ea7..4057748ba 100644 --- a/src/eepp/helper/SDL2/src/video/cocoa/SDL_cocoaevents.h +++ b/src/eepp/helper/SDL2/src/video/cocoa/SDL_cocoaevents.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/video/cocoa/SDL_cocoaevents.m b/src/eepp/helper/SDL2/src/video/cocoa/SDL_cocoaevents.m index 0c42828f1..e952a9e9f 100644 --- a/src/eepp/helper/SDL2/src/video/cocoa/SDL_cocoaevents.m +++ b/src/eepp/helper/SDL2/src/video/cocoa/SDL_cocoaevents.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -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:@""]; @@ -107,6 +107,7 @@ CreateApplicationMenus(void) [menuItem setSubmenu:serviceMenu]; [NSApp setServicesMenu:serviceMenu]; + [serviceMenu release]; [appleMenu addItem:[NSMenuItem separatorItem]]; @@ -122,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]; @@ -136,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 */ @@ -147,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]; @@ -202,7 +203,7 @@ Cocoa_PumpEvents(_THIS) if ( event == nil ) { break; } - + switch ([event type]) { case NSLeftMouseDown: case NSOtherMouseDown: diff --git a/src/eepp/helper/SDL2/src/video/cocoa/SDL_cocoakeyboard.h b/src/eepp/helper/SDL2/src/video/cocoa/SDL_cocoakeyboard.h index b69488449..4343b9c39 100644 --- a/src/eepp/helper/SDL2/src/video/cocoa/SDL_cocoakeyboard.h +++ b/src/eepp/helper/SDL2/src/video/cocoa/SDL_cocoakeyboard.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/video/cocoa/SDL_cocoakeyboard.m b/src/eepp/helper/SDL2/src/video/cocoa/SDL_cocoakeyboard.m index 1714ea6db..705b0358d 100644 --- a/src/eepp/helper/SDL2/src/video/cocoa/SDL_cocoakeyboard.m +++ b/src/eepp/helper/SDL2/src/video/cocoa/SDL_cocoakeyboard.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -29,7 +29,7 @@ #include -//#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]; @@ -668,6 +671,11 @@ Cocoa_SetTextInputRect(_THIS, SDL_Rect *rect) { SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; + if (!rect) { + SDL_InvalidParamError("rect"); + return; + } + [data->fieldEdit setInputRect: rect]; } diff --git a/src/eepp/helper/SDL2/src/video/cocoa/SDL_cocoamessagebox.h b/src/eepp/helper/SDL2/src/video/cocoa/SDL_cocoamessagebox.h index 4d639060f..e1890b27a 100644 --- a/src/eepp/helper/SDL2/src/video/cocoa/SDL_cocoamessagebox.h +++ b/src/eepp/helper/SDL2/src/video/cocoa/SDL_cocoamessagebox.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/video/cocoa/SDL_cocoamessagebox.m b/src/eepp/helper/SDL2/src/video/cocoa/SDL_cocoamessagebox.m index fea487d13..ec4c55f61 100644 --- a/src/eepp/helper/SDL2/src/video/cocoa/SDL_cocoamessagebox.m +++ b/src/eepp/helper/SDL2/src/video/cocoa/SDL_cocoamessagebox.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -22,7 +22,7 @@ #if SDL_VIDEO_DRIVER_COCOA -#if defined(__APPLE__) && defined(__POWERPC__) +#if defined(__APPLE__) && defined(__POWERPC__) && !defined(__APPLE_ALTIVEC__) #include #undef bool #undef vector @@ -32,6 +32,29 @@ #include "SDL_messagebox.h" #include "SDL_cocoavideo.h" +@interface SDLMessageBoxPresenter : NSObject { +@public + NSInteger clicked; +} +@end + +@implementation SDLMessageBoxPresenter +- (id)init +{ + self = [super init]; + if (self) { + clicked = -1; + } + + return self; +} + +- (void)showAlert:(NSAlert*)alert +{ + clicked = [alert runModal]; +} +@end + /* Display a Cocoa message box */ int @@ -41,7 +64,7 @@ Cocoa_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid) NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - NSAlert* alert = [[NSAlert alloc] init]; + NSAlert* alert = [[[NSAlert alloc] init] autorelease]; if (messageboxdata->flags & SDL_MESSAGEBOX_ERROR) { [alert setAlertStyle:NSCriticalAlertStyle]; @@ -57,7 +80,7 @@ Cocoa_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid) const SDL_MessageBoxButtonData *buttons = messageboxdata->buttons; int i; for (i = 0; i < messageboxdata->numbuttons; ++i) { - NSButton *button = [alert addButtonWithTitle:[[NSString alloc] initWithUTF8String:buttons[i].text]]; + NSButton *button = [alert addButtonWithTitle:[NSString stringWithUTF8String:buttons[i].text]]; if (buttons[i].flags & SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT) { [button setKeyEquivalent:@"\r"]; } else if (buttons[i].flags & SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT) { @@ -67,14 +90,27 @@ Cocoa_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid) } } - NSInteger clicked = [alert runModal]; - clicked -= NSAlertFirstButtonReturn; - *buttonid = buttons[clicked].buttonid; - [alert release]; + SDLMessageBoxPresenter* presenter = [[[SDLMessageBoxPresenter alloc] init] autorelease]; + + [presenter performSelectorOnMainThread:@selector(showAlert:) + withObject:alert + waitUntilDone:YES]; + + int returnValue = 0; + NSInteger clicked = presenter->clicked; + if (clicked >= NSAlertFirstButtonReturn) + { + clicked -= NSAlertFirstButtonReturn; + *buttonid = buttons[clicked].buttonid; + } + else + { + returnValue = SDL_SetError("Did not get a valid `clicked button' id: %d", clicked); + } [pool release]; - return 0; + return returnValue; } #endif /* SDL_VIDEO_DRIVER_COCOA */ diff --git a/src/eepp/helper/SDL2/src/video/cocoa/SDL_cocoamodes.h b/src/eepp/helper/SDL2/src/video/cocoa/SDL_cocoamodes.h index 2b4c63646..06ed93150 100644 --- a/src/eepp/helper/SDL2/src/video/cocoa/SDL_cocoamodes.h +++ b/src/eepp/helper/SDL2/src/video/cocoa/SDL_cocoamodes.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/video/cocoa/SDL_cocoamodes.m b/src/eepp/helper/SDL2/src/video/cocoa/SDL_cocoamodes.m index 3de8d4da7..ad6ece279 100644 --- a/src/eepp/helper/SDL2/src/video/cocoa/SDL_cocoamodes.m +++ b/src/eepp/helper/SDL2/src/video/cocoa/SDL_cocoamodes.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -24,6 +24,9 @@ #include "SDL_cocoavideo.h" +/* We need this for IODisplayCreateInfoDictionary and kIODisplayOnlyPreferredName */ +#include + /* we need this for ShowMenuBar() and HideMenuBar(). */ #include @@ -52,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 @@ -81,7 +84,7 @@ IS_SNOW_LEOPARD_OR_LATER(_THIS) #endif } -static void +static int CG_SetError(const char *prefix, CGDisplayErr result) { const char *error; @@ -121,7 +124,7 @@ CG_SetError(const char *prefix, CGDisplayErr result) error = "Unknown Error"; break; } - SDL_SetError("%s: %s", prefix, error); + return SDL_SetError("%s: %s", prefix, error); } static SDL_bool @@ -217,9 +220,24 @@ Cocoa_ReleaseDisplayModeList(_THIS, CFArrayRef modelist) #endif } +static const char * +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]); + } + [deviceInfo release]; + return displayName; +} + void Cocoa_InitModes(_THIS) { + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; CGDisplayErr result; CGDirectDisplayID *displays; CGDisplayCount numDisplays; @@ -228,6 +246,7 @@ Cocoa_InitModes(_THIS) result = CGGetOnlineDisplayList(0, NULL, &numDisplays); if (result != kCGErrorSuccess) { CG_SetError("CGGetOnlineDisplayList()", result); + [pool release]; return; } displays = SDL_stack_alloc(CGDirectDisplayID, numDisplays); @@ -235,6 +254,7 @@ Cocoa_InitModes(_THIS) if (result != kCGErrorSuccess) { CG_SetError("CGGetOnlineDisplayList()", result); SDL_stack_free(displays); + [pool release]; return; } @@ -284,8 +304,11 @@ Cocoa_InitModes(_THIS) displaydata->display = displays[i]; SDL_zero(display); + /* this returns a stddup'ed string */ + display.name = (char *)Cocoa_GetDisplayName(displays[i]); if (!GetDisplayMode (_this, moderef, &mode)) { Cocoa_ReleaseDisplayMode(_this, moderef); + if (display.name) SDL_free(display.name); SDL_free(displaydata); continue; } @@ -294,9 +317,11 @@ Cocoa_InitModes(_THIS) display.current_mode = mode; display.driverdata = displaydata; SDL_AddVideoDisplay(&display); + if (display.name) SDL_free(display.name); } } SDL_stack_free(displays); + [pool release]; } int diff --git a/src/eepp/helper/SDL2/src/video/cocoa/SDL_cocoamouse.h b/src/eepp/helper/SDL2/src/video/cocoa/SDL_cocoamouse.h index 169727bde..bff8ef6dd 100644 --- a/src/eepp/helper/SDL2/src/video/cocoa/SDL_cocoamouse.h +++ b/src/eepp/helper/SDL2/src/video/cocoa/SDL_cocoamouse.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -23,11 +23,22 @@ #ifndef _SDL_cocoamouse_h #define _SDL_cocoamouse_h +#include "SDL_cocoavideo.h" + extern void Cocoa_InitMouse(_THIS); extern void Cocoa_HandleMouseEvent(_THIS, NSEvent * event); extern void Cocoa_HandleMouseWheel(SDL_Window *window, NSEvent * event); extern void Cocoa_QuitMouse(_THIS); +typedef struct { + int deltaXOffset; + int deltaYOffset; +} SDL_MouseData; + +@interface NSCursor (InvisibleCursor) ++ (NSCursor *)invisibleCursor; +@end + #endif /* _SDL_cocoamouse_h */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/eepp/helper/SDL2/src/video/cocoa/SDL_cocoamouse.m b/src/eepp/helper/SDL2/src/video/cocoa/SDL_cocoamouse.m index c56b147be..fd76bb584 100644 --- a/src/eepp/helper/SDL2/src/video/cocoa/SDL_cocoamouse.m +++ b/src/eepp/helper/SDL2/src/video/cocoa/SDL_cocoamouse.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -24,10 +24,36 @@ #include "SDL_assert.h" #include "SDL_events.h" -#include "SDL_cocoavideo.h" +#include "SDL_cocoamouse.h" #include "../../events/SDL_mouse_c.h" +@implementation NSCursor (InvisibleCursor) ++ (NSCursor *)invisibleCursor +{ + static NSCursor *invisibleCursor = NULL; + if (!invisibleCursor) { + /* RAW 16x16 transparent GIF */ + static unsigned char cursorBytes[] = { + 0x47, 0x49, 0x46, 0x38, 0x37, 0x61, 0x10, 0x00, 0x10, 0x00, 0x80, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x21, 0xF9, 0x04, + 0x01, 0x00, 0x00, 0x01, 0x00, 0x2C, 0x00, 0x00, 0x00, 0x00, 0x10, + 0x00, 0x10, 0x00, 0x00, 0x02, 0x0E, 0x8C, 0x8F, 0xA9, 0xCB, 0xED, + 0x0F, 0xA3, 0x9C, 0xB4, 0xDA, 0x8B, 0xB3, 0x3E, 0x05, 0x00, 0x3B + }; + + NSData *cursorData = [NSData dataWithBytesNoCopy:&cursorBytes[0] + length:sizeof(cursorBytes) + freeWhenDone:NO]; + NSImage *cursorImage = [[[NSImage alloc] initWithData:cursorData] autorelease]; + invisibleCursor = [[NSCursor alloc] initWithImage:cursorImage + hotSpot:NSZeroPoint]; + } + + return invisibleCursor; +} +@end + static SDL_Cursor * Cocoa_CreateDefaultCursor() @@ -127,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; } @@ -155,13 +181,15 @@ Cocoa_ShowCursor(SDL_Cursor * cursor) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - if (cursor) { - NSCursor *nscursor = (NSCursor *)cursor->driverdata; - - [nscursor set]; - [NSCursor unhide]; - } else { - [NSCursor hide]; + SDL_VideoDevice *device = SDL_GetVideoDevice(); + SDL_Window *window = (device ? device->windows : NULL); + for (; window != NULL; window = window->next) { + SDL_WindowData *driverdata = (SDL_WindowData *)window->driverdata; + if (driverdata) { + [driverdata->nswindow performSelectorOnMainThread:@selector(invalidateCursorRectsForView:) + withObject:[driverdata->nswindow contentView] + waitUntilDone:NO]; + } } [pool release]; @@ -172,11 +200,34 @@ Cocoa_ShowCursor(SDL_Cursor * cursor) static void Cocoa_WarpMouse(SDL_Window * window, int x, int y) { + SDL_Mouse *mouse = SDL_GetMouse(); CGPoint point; point.x = (float)window->x + x; point.y = (float)window->y + y; + + { + /* This makes Cocoa_HandleMouseEvent ignore this delta in the next + * movement event. + */ + SDL_MouseData *driverdata = (SDL_MouseData*)mouse->driverdata; + NSPoint location = [NSEvent mouseLocation]; + driverdata->deltaXOffset = location.x - point.x; + driverdata->deltaYOffset = point.y - location.y; + } + + /* According to the docs, this was deprecated in 10.6, but it's still + * around. The substitute requires a CGEventSource, but I'm not entirely + * sure how we'd procure the right one for this event. + */ + CGSetLocalEventsSuppressionInterval(0.0); CGWarpMouseCursorPosition(point); + CGSetLocalEventsSuppressionInterval(0.25); + + /* CGWarpMouseCursorPosition doesn't generate a window event, unlike our + * other implementations' APIs. + */ + SDL_SendMouseMotion(mouse->focus, mouse->mouseID, 0, x, y); } static int @@ -190,8 +241,7 @@ Cocoa_SetRelativeMouseMode(SDL_bool enabled) result = CGAssociateMouseAndMouseCursorPosition(YES); } if (result != kCGErrorSuccess) { - SDL_SetError("CGAssociateMouseAndMouseCursorPosition() failed"); - return -1; + return SDL_SetError("CGAssociateMouseAndMouseCursorPosition() failed"); } return 0; } @@ -201,6 +251,8 @@ Cocoa_InitMouse(_THIS) { SDL_Mouse *mouse = SDL_GetMouse(); + mouse->driverdata = SDL_calloc(1, sizeof(SDL_MouseData)); + mouse->CreateCursor = Cocoa_CreateCursor; mouse->CreateSystemCursor = Cocoa_CreateSystemCursor; mouse->ShowCursor = Cocoa_ShowCursor; @@ -221,15 +273,20 @@ Cocoa_HandleMouseEvent(_THIS, NSEvent *event) [event type] == NSLeftMouseDragged || [event type] == NSRightMouseDragged || [event type] == NSOtherMouseDragged)) { - float x = [event deltaX]; - float y = [event deltaY]; - SDL_SendMouseMotion(mouse->focus, 1, (int)x, (int)y); + SDL_MouseData *driverdata = (SDL_MouseData*)mouse->driverdata; + float x = [event deltaX] + driverdata->deltaXOffset; + float y = [event deltaY] + driverdata->deltaYOffset; + driverdata->deltaXOffset = driverdata->deltaYOffset = 0; + + SDL_SendMouseMotion(mouse->focus, mouse->mouseID, 1, (int)x, (int)y); } } void Cocoa_HandleMouseWheel(SDL_Window *window, NSEvent *event) { + SDL_Mouse *mouse = SDL_GetMouse(); + float x = [event deltaX]; float y = [event deltaY]; @@ -243,12 +300,16 @@ Cocoa_HandleMouseWheel(SDL_Window *window, NSEvent *event) } else if (y < 0) { y -= 0.9f; } - SDL_SendMouseWheel(window, (int)x, (int)y); + SDL_SendMouseWheel(window, mouse->mouseID, (int)x, (int)y); } void Cocoa_QuitMouse(_THIS) { + SDL_Mouse *mouse = SDL_GetMouse(); + if (mouse) { + SDL_free(mouse->driverdata); + } } #endif /* SDL_VIDEO_DRIVER_COCOA */ diff --git a/src/eepp/helper/SDL2/src/video/cocoa/SDL_cocoaopengl.h b/src/eepp/helper/SDL2/src/video/cocoa/SDL_cocoaopengl.h index 0891f5809..4c4005be7 100644 --- a/src/eepp/helper/SDL2/src/video/cocoa/SDL_cocoaopengl.h +++ b/src/eepp/helper/SDL2/src/video/cocoa/SDL_cocoaopengl.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/video/cocoa/SDL_cocoaopengl.m b/src/eepp/helper/SDL2/src/video/cocoa/SDL_cocoaopengl.m index 880b0c145..f52e3e91e 100644 --- a/src/eepp/helper/SDL2/src/video/cocoa/SDL_cocoaopengl.m +++ b/src/eepp/helper/SDL2/src/video/cocoa/SDL_cocoaopengl.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -35,9 +35,13 @@ #define DEFAULT_OPENGL "/System/Library/Frameworks/OpenGL.framework/Libraries/libGL.dylib" -#if MAC_OS_X_VERSION_MAX_ALLOWED < 1070 +#ifndef kCGLPFAOpenGLProfile #define kCGLPFAOpenGLProfile 99 +#endif +#ifndef kCGLOGLPVersion_Legacy #define kCGLOGLPVersion_Legacy 0x1000 +#endif +#ifndef kCGLOGLPVersion_3_2_Core #define kCGLOGLPVersion_3_2_Core 0x3200 #endif @@ -86,6 +90,7 @@ Cocoa_GL_CreateContext(_THIS, SDL_Window * window) NSOpenGLPixelFormatAttribute attr[32]; NSOpenGLPixelFormat *fmt; NSOpenGLContext *context; + NSOpenGLContext *share_context = nil; int i = 0; if (_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES) { @@ -178,7 +183,11 @@ Cocoa_GL_CreateContext(_THIS, SDL_Window * window) return NULL; } - context = [[NSOpenGLContext alloc] initWithFormat:fmt shareContext:nil]; + if (_this->gl_config.share_with_current_context) { + share_context = (NSOpenGLContext*)(_this->current_glctx); + } + + context = [[NSOpenGLContext alloc] initWithFormat:fmt shareContext:share_context]; [fmt release]; @@ -188,31 +197,6 @@ Cocoa_GL_CreateContext(_THIS, SDL_Window * window) return NULL; } - /* - * Wisdom from Apple engineer in reference to UT2003's OpenGL performance: - * "You are blowing a couple of the internal OpenGL function caches. This - * appears to be happening in the VAO case. You can tell OpenGL to up - * the cache size by issuing the following calls right after you create - * the OpenGL context. The default cache size is 16." --ryan. - */ - - #ifndef GLI_ARRAY_FUNC_CACHE_MAX - #define GLI_ARRAY_FUNC_CACHE_MAX 284 - #endif - - #ifndef GLI_SUBMIT_FUNC_CACHE_MAX - #define GLI_SUBMIT_FUNC_CACHE_MAX 280 - #endif - - { - GLint cache_max = 64; - CGLContextObj ctx = [context CGLContextObj]; - CGLSetParameter (ctx, GLI_SUBMIT_FUNC_CACHE_MAX, &cache_max); - CGLSetParameter (ctx, GLI_ARRAY_FUNC_CACHE_MAX, &cache_max); - } - - /* End Wisdom from Apple Engineer section. --ryan. */ - [pool release]; if ( Cocoa_GL_MakeCurrent(_this, window, context) < 0 ) { @@ -234,16 +218,14 @@ Cocoa_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context) SDL_WindowData *windowdata = (SDL_WindowData *)window->driverdata; NSOpenGLContext *nscontext = (NSOpenGLContext *)context; - if (window->flags & SDL_WINDOW_SHOWN) { #ifndef FULLSCREEN_TOGGLEABLE - if (window->flags & SDL_WINDOW_FULLSCREEN) { - [nscontext setFullScreen]; - } else + if (window->flags & SDL_WINDOW_FULLSCREEN) { + [nscontext setFullScreen]; + } else #endif - { - [nscontext setView:[windowdata->nswindow contentView]]; - [nscontext update]; - } + { + [nscontext setView:[windowdata->nswindow contentView]]; + [nscontext update]; } [nscontext makeCurrentContext]; } else { @@ -270,8 +252,7 @@ Cocoa_GL_SetSwapInterval(_THIS, int interval) [nscontext setValues:&value forParameter:NSOpenGLCPSwapInterval]; status = 0; } else { - SDL_SetError("No current OpenGL context"); - status = -1; + status = SDL_SetError("No current OpenGL context"); } [pool release]; @@ -307,10 +288,7 @@ Cocoa_GL_SwapWindow(_THIS, SDL_Window * window) pool = [[NSAutoreleasePool alloc] init]; /* FIXME: Do we need to get the context for the window? */ - nscontext = [NSOpenGLContext currentContext]; - if (nscontext != nil) { - [nscontext flushBuffer]; - } + [[NSOpenGLContext currentContext] flushBuffer]; [pool release]; } diff --git a/src/eepp/helper/SDL2/src/video/cocoa/SDL_cocoashape.h b/src/eepp/helper/SDL2/src/video/cocoa/SDL_cocoashape.h index 1af969d1d..3b656c1a9 100644 --- a/src/eepp/helper/SDL2/src/video/cocoa/SDL_cocoashape.h +++ b/src/eepp/helper/SDL2/src/video/cocoa/SDL_cocoashape.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -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/eepp/helper/SDL2/src/video/cocoa/SDL_cocoashape.m b/src/eepp/helper/SDL2/src/video/cocoa/SDL_cocoashape.m index afada6cc6..3cde7d048 100644 --- a/src/eepp/helper/SDL2/src/video/cocoa/SDL_cocoashape.m +++ b/src/eepp/helper/SDL2/src/video/cocoa/SDL_cocoashape.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -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/eepp/helper/SDL2/src/video/cocoa/SDL_cocoavideo.h b/src/eepp/helper/SDL2/src/video/cocoa/SDL_cocoavideo.h index b602d76ef..cde0a38cf 100644 --- a/src/eepp/helper/SDL2/src/video/cocoa/SDL_cocoavideo.h +++ b/src/eepp/helper/SDL2/src/video/cocoa/SDL_cocoavideo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/video/cocoa/SDL_cocoavideo.m b/src/eepp/helper/SDL2/src/video/cocoa/SDL_cocoavideo.m index aa832bdad..5600222ae 100644 --- a/src/eepp/helper/SDL2/src/video/cocoa/SDL_cocoavideo.m +++ b/src/eepp/helper/SDL2/src/video/cocoa/SDL_cocoavideo.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -22,7 +22,7 @@ #if SDL_VIDEO_DRIVER_COCOA -#if defined(__APPLE__) && defined(__POWERPC__) +#if defined(__APPLE__) && defined(__POWERPC__) && !defined(__APPLE_ALTIVEC__) #include #undef bool #undef vector @@ -96,6 +96,7 @@ Cocoa_CreateDevice(int devindex) device->SetWindowPosition = Cocoa_SetWindowPosition; device->SetWindowSize = Cocoa_SetWindowSize; device->SetWindowMinimumSize = Cocoa_SetWindowMinimumSize; + device->SetWindowMaximumSize = Cocoa_SetWindowMaximumSize; device->ShowWindow = Cocoa_ShowWindow; device->HideWindow = Cocoa_HideWindow; device->RaiseWindow = Cocoa_RaiseWindow; @@ -109,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; @@ -172,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 @@ -273,6 +274,8 @@ SDL_PromptAssertion_cocoa(const SDL_assert_data *data) [alert addButtonWithTitle:@"Ignore"]; [alert addButtonWithTitle:@"Always Ignore"]; const NSInteger clicked = [alert runModal]; + [alert release]; + [pool release]; if (!initialized) { diff --git a/src/eepp/helper/SDL2/src/video/cocoa/SDL_cocoawindow.h b/src/eepp/helper/SDL2/src/video/cocoa/SDL_cocoawindow.h index 9c8149ef5..180cd0e3f 100644 --- a/src/eepp/helper/SDL2/src/video/cocoa/SDL_cocoawindow.h +++ b/src/eepp/helper/SDL2/src/video/cocoa/SDL_cocoawindow.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -34,9 +34,13 @@ typedef struct SDL_WindowData SDL_WindowData; @interface Cocoa_WindowListener : NSResponder { #endif SDL_WindowData *_data; + BOOL observingVisible; + BOOL wasVisible; } -(void) listen:(SDL_WindowData *) data; +-(void) pauseVisibleObservation; +-(void) resumeVisibleObservation; -(void) close; /* Window delegate functionality */ @@ -95,6 +99,7 @@ extern void Cocoa_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon); extern void Cocoa_SetWindowPosition(_THIS, SDL_Window * window); extern void Cocoa_SetWindowSize(_THIS, SDL_Window * window); extern void Cocoa_SetWindowMinimumSize(_THIS, SDL_Window * window); +extern void Cocoa_SetWindowMaximumSize(_THIS, SDL_Window * window); extern void Cocoa_ShowWindow(_THIS, SDL_Window * window); extern void Cocoa_HideWindow(_THIS, SDL_Window * window); extern void Cocoa_RaiseWindow(_THIS, SDL_Window * window); diff --git a/src/eepp/helper/SDL2/src/video/cocoa/SDL_cocoawindow.m b/src/eepp/helper/SDL2/src/video/cocoa/SDL_cocoawindow.m index cf880325d..7e387a53e 100644 --- a/src/eepp/helper/SDL2/src/video/cocoa/SDL_cocoawindow.m +++ b/src/eepp/helper/SDL2/src/video/cocoa/SDL_cocoawindow.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -50,6 +50,8 @@ static __inline__ void ConvertNSRect(NSRect *r) NSView *view = [window contentView]; _data = data; + observingVisible = YES; + wasVisible = [window isVisible]; center = [NSNotificationCenter defaultCenter]; @@ -65,6 +67,15 @@ 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:]) + */ + [window addObserver:self + forKeyPath:@"visible" + options:NSKeyValueObservingOptionNew + context:NULL]; + [window setNextResponder:self]; [window setAcceptsMouseMovedEvents:YES]; @@ -77,6 +88,46 @@ static __inline__ void ConvertNSRect(NSRect *r) #endif } +- (void)observeValueForKeyPath:(NSString *)keyPath + ofObject:(id)object + change:(NSDictionary *)change + context:(void *)context +{ + if (!observingVisible) { + return; + } + + if (object == _data->nswindow && [keyPath isEqualToString:@"visible"]) { + int newVisibility = [[change objectForKey:@"new"] intValue]; + if (newVisibility) { + SDL_SendWindowEvent(_data->window, SDL_WINDOWEVENT_SHOWN, 0, 0); + } else { + SDL_SendWindowEvent(_data->window, SDL_WINDOWEVENT_HIDDEN, 0, 0); + } + } +} + +-(void) pauseVisibleObservation +{ + observingVisible = NO; + wasVisible = [_data->nswindow isVisible]; +} + +-(void) resumeVisibleObservation +{ + BOOL isVisible = [_data->nswindow isVisible]; + observingVisible = YES; + if (wasVisible != isVisible) { + if (isVisible) { + SDL_SendWindowEvent(_data->window, SDL_WINDOWEVENT_SHOWN, 0, 0); + } else { + SDL_SendWindowEvent(_data->window, SDL_WINDOWEVENT_HIDDEN, 0, 0); + } + + wasVisible = isVisible; + } +} + - (void)close { NSNotificationCenter *center; @@ -97,6 +148,9 @@ static __inline__ void ConvertNSRect(NSRect *r) [window setDelegate:nil]; } + [window removeObserver:self + forKeyPath:@"visible"]; + if ([window nextResponder] == self) { [window setNextResponder:nil]; } @@ -200,8 +254,7 @@ static __inline__ void ConvertNSRect(NSRect *r) y = (int)(window->h - point.y); if (x >= 0 && x < window->w && y >= 0 && y < window->h) { - SDL_SendMouseMotion(window, 0, x, y); - SDL_SetCursor(NULL); + SDL_SendMouseMotion(window, 0, 0, x, y); } } @@ -222,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 @@ -263,7 +318,7 @@ static __inline__ void ConvertNSRect(NSRect *r) button = [theEvent buttonNumber] + 1; break; } - SDL_SendMouseButton(_data->window, SDL_PRESSED, button); + SDL_SendMouseButton(_data->window, 0, SDL_PRESSED, button); } - (void)rightMouseDown:(NSEvent *)theEvent @@ -294,7 +349,7 @@ static __inline__ void ConvertNSRect(NSRect *r) button = [theEvent buttonNumber] + 1; break; } - SDL_SendMouseButton(_data->window, SDL_RELEASED, button); + SDL_SendMouseButton(_data->window, 0, SDL_RELEASED, button); } - (void)rightMouseUp:(NSEvent *)theEvent @@ -339,10 +394,17 @@ static __inline__ void ConvertNSRect(NSRect *r) cgpoint.x = window->x + x; cgpoint.y = window->y + y; + + /* According to the docs, this was deprecated in 10.6, but it's still + * around. The substitute requires a CGEventSource, but I'm not entirely + * sure how we'd procure the right one for this event. + */ + CGSetLocalEventsSuppressionInterval(0.0); CGDisplayMoveCursorToPoint(kCGDirectMainDisplay, cgpoint); + CGSetLocalEventsSuppressionInterval(0.25); } } - SDL_SendMouseMotion(window, 0, x, y); + SDL_SendMouseMotion(window, 0, 0, x, y); } - (void)mouseDragged:(NSEvent *)theEvent @@ -408,27 +470,14 @@ static __inline__ void ConvertNSRect(NSRect *r) enumerator = [touches objectEnumerator]; touch = (NSTouch*)[enumerator nextObject]; while (touch) { - const SDL_TouchID touchId = (SDL_TouchID) ((size_t) [touch device]); + const SDL_TouchID touchId = (SDL_TouchID)(intptr_t)[touch device]; if (!SDL_GetTouch(touchId)) { - SDL_Touch touch; - - touch.id = touchId; - touch.x_min = 0; - touch.x_max = 1; - touch.native_xres = touch.x_max - touch.x_min; - touch.y_min = 0; - touch.y_max = 1; - touch.native_yres = touch.y_max - touch.y_min; - touch.pressure_min = 0; - touch.pressure_max = 1; - touch.native_pressureres = touch.pressure_max - touch.pressure_min; - - if (SDL_AddTouch(&touch, "") < 0) { + if (SDL_AddTouch(touchId, "") < 0) { return; } - } + } - const SDL_FingerID fingerId = (SDL_FingerID) ((size_t) [touch identity]); + const SDL_FingerID fingerId = (SDL_FingerID)(intptr_t)[touch identity]; float x = [touch normalizedPosition].x; float y = [touch normalizedPosition].y; /* Make the origin the upper left instead of the lower left */ @@ -436,17 +485,17 @@ static __inline__ void ConvertNSRect(NSRect *r) switch (type) { case COCOA_TOUCH_DOWN: - SDL_SendFingerDown(touchId, fingerId, SDL_TRUE, x, y, 1); + SDL_SendTouch(touchId, fingerId, SDL_TRUE, x, y, 1.0f); break; case COCOA_TOUCH_UP: case COCOA_TOUCH_CANCELLED: - SDL_SendFingerDown(touchId, fingerId, SDL_FALSE, x, y, 1); + SDL_SendTouch(touchId, fingerId, SDL_FALSE, x, y, 1.0f); break; case COCOA_TOUCH_MOVE: - SDL_SendTouchMotion(touchId, fingerId, SDL_FALSE, x, y, 1); + SDL_SendTouchMotion(touchId, fingerId, x, y, 1.0f); break; } - + touch = (NSTouch*)[enumerator nextObject]; } #endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= 1060 */ @@ -473,6 +522,7 @@ static __inline__ void ConvertNSRect(NSRect *r) @end @interface SDLView : NSView + /* The default implementation doesn't pass rightMouseDown to responder chain */ - (void)rightMouseDown:(NSEvent *)theEvent; @end @@ -482,6 +532,20 @@ static __inline__ void ConvertNSRect(NSRect *r) { [[self nextResponder] rightMouseDown:theEvent]; } + +- (void)resetCursorRects +{ + [super resetCursorRects]; + SDL_Mouse *mouse = SDL_GetMouse(); + + if (mouse->cursor_shown && mouse->cur_cursor) { + [self addCursorRect:[self bounds] + cursor:mouse->cur_cursor->driverdata]; + } else { + [self addCursorRect:[self bounds] + cursor:[NSCursor invisibleCursor]]; + } +} @end static unsigned int @@ -489,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; } @@ -514,8 +578,7 @@ SetupWindowData(_THIS, SDL_Window * window, NSWindow *nswindow, SDL_bool created /* Allocate the window data */ data = (SDL_WindowData *) SDL_calloc(1, sizeof(*data)); if (!data) { - SDL_OutOfMemory(); - return -1; + return SDL_OutOfMemory(); } data->window = window; data->nswindow = nswindow; @@ -545,6 +608,7 @@ SetupWindowData(_THIS, SDL_Window * window, NSWindow *nswindow, SDL_bool created } else { window->flags &= ~SDL_WINDOW_SHOWN; } + { unsigned int style = [nswindow styleMask]; @@ -559,22 +623,30 @@ SetupWindowData(_THIS, SDL_Window * window, NSWindow *nswindow, SDL_bool created window->flags &= ~SDL_WINDOW_RESIZABLE; } } + /* isZoomed always returns true if the window is not resizable */ if ((window->flags & SDL_WINDOW_RESIZABLE) && [nswindow isZoomed]) { window->flags |= SDL_WINDOW_MAXIMIZED; } else { window->flags &= ~SDL_WINDOW_MAXIMIZED; } + if ([nswindow isMiniaturized]) { window->flags |= SDL_WINDOW_MINIMIZED; } else { window->flags &= ~SDL_WINDOW_MINIMIZED; } + if ([nswindow isKeyWindow]) { window->flags |= SDL_WINDOW_INPUT_FOCUS; SDL_SetKeyboardFocus(data->window); } + /* Prevents the window's "window device" from being destroyed when it is + * hidden. See http://www.mikeash.com/pyblog/nsopenglcontext-and-one-shot.html + */ + [nswindow setOneShot:NO]; + /* All done! */ [pool release]; window->driverdata = data; @@ -617,9 +689,10 @@ Cocoa_CreateWindow(_THIS, SDL_Window * window) rect.origin.y -= screenRect.origin.y; } } - nswindow = [[SDLWindow alloc] initWithContentRect:rect styleMask:style backing:NSBackingStoreBuffered defer:YES screen:screen]; + nswindow = [[SDLWindow alloc] initWithContentRect:rect styleMask:style backing:NSBackingStoreBuffered defer:NO screen:screen]; + [nswindow setBackgroundColor:[NSColor blackColor]]; - // 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]; @@ -735,13 +808,28 @@ 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 setMinSize:minSize]; - + + [windata->nswindow setContentMinSize:minSize]; + + [pool release]; +} + +void +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]; } @@ -749,10 +837,13 @@ void Cocoa_ShowWindow(_THIS, SDL_Window * window) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->nswindow; + SDL_WindowData *windowData = ((SDL_WindowData *) window->driverdata); + NSWindow *nswindow = windowData->nswindow; if (![nswindow isMiniaturized]) { + [windowData->listener pauseVisibleObservation]; [nswindow makeKeyAndOrderFront:nil]; + [windowData->listener resumeVisibleObservation]; } [pool release]; } @@ -771,9 +862,13 @@ void Cocoa_RaiseWindow(_THIS, SDL_Window * window) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->nswindow; + SDL_WindowData *windowData = ((SDL_WindowData *) window->driverdata); + NSWindow *nswindow = windowData->nswindow; + [windowData->listener pauseVisibleObservation]; [nswindow makeKeyAndOrderFront:nil]; + [windowData->listener resumeVisibleObservation]; + [pool release]; } @@ -825,8 +920,10 @@ Cocoa_RebuildWindow(SDL_WindowData * data, NSWindow * nswindow, unsigned style) } [data->listener close]; - data->nswindow = [[SDLWindow alloc] initWithContentRect:[[nswindow contentView] frame] styleMask:style backing:NSBackingStoreBuffered defer:YES screen:[nswindow screen]]; + data->nswindow = [[SDLWindow alloc] initWithContentRect:[[nswindow contentView] frame] styleMask:style backing:NSBackingStoreBuffered defer:NO screen:[nswindow screen]]; [data->nswindow setContentView:[nswindow contentView]]; + /* See comment in SetupWindowData. */ + [data->nswindow setOneShot:NO]; [data->listener listen:data]; [nswindow close]; @@ -844,7 +941,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]; @@ -915,14 +1012,17 @@ Cocoa_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display } #ifdef FULLSCREEN_TOGGLEABLE - if (fullscreen) { + if (SDL_ShouldAllowTopmost() && fullscreen) { /* OpenGL is rendering to the window, so make it visible! */ [nswindow setLevel:CGShieldingWindowLevel()]; } else { [nswindow setLevel:kCGNormalWindowLevel]; } #endif + + [data->listener pauseVisibleObservation]; [nswindow makeKeyAndOrderFront:nil]; + [data->listener resumeVisibleObservation]; if (window == _this->current_glwin) { [((NSOpenGLContext *) _this->current_glctx) update]; @@ -952,8 +1052,7 @@ Cocoa_SetWindowGammaRamp(_THIS, SDL_Window * window, const Uint16 * ramp) if (CGSetDisplayTransferByTable(display_id, tableSize, redTable, greenTable, blueTable) != CGDisplayNoErr) { - SDL_SetError("CGSetDisplayTransferByTable()"); - return -1; + return SDL_SetError("CGSetDisplayTransferByTable()"); } return 0; } @@ -971,8 +1070,7 @@ Cocoa_GetWindowGammaRamp(_THIS, SDL_Window * window, Uint16 * ramp) if (CGGetDisplayTransferByTable(display_id, tableSize, redTable, greenTable, blueTable, &tableCopied) != CGDisplayNoErr) { - SDL_SetError("CGGetDisplayTransferByTable()"); - return -1; + return SDL_SetError("CGGetDisplayTransferByTable()"); } for (i = 0; i < tableCopied; i++) { @@ -996,6 +1094,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]; + } + } } void @@ -1023,6 +1132,7 @@ Cocoa_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info) if (info->version.major <= SDL_MAJOR_VERSION) { info->subsystem = SDL_SYSWM_COCOA; info->info.cocoa.window = nswindow; + info->info.cocoa.view = [nswindow contentView]; return SDL_TRUE; } else { SDL_SetError("Application not compiled with SDL %d.%d\n", diff --git a/src/eepp/helper/SDL2/src/video/directfb/SDL_DirectFB_WM.c b/src/eepp/helper/SDL2/src/video/directfb/SDL_DirectFB_WM.c index 1eeff9910..8241d9b3d 100644 --- a/src/eepp/helper/SDL2/src/video/directfb/SDL_DirectFB_WM.c +++ b/src/eepp/helper/SDL2/src/video/directfb/SDL_DirectFB_WM.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -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)); + 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)); + /* 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->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/eepp/helper/SDL2/src/video/directfb/SDL_DirectFB_WM.h b/src/eepp/helper/SDL2/src/video/directfb/SDL_DirectFB_WM.h index 1d4fb03c5..4c5d539dd 100644 --- a/src/eepp/helper/SDL2/src/video/directfb/SDL_DirectFB_WM.h +++ b/src/eepp/helper/SDL2/src/video/directfb/SDL_DirectFB_WM.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/video/directfb/SDL_DirectFB_dyn.c b/src/eepp/helper/SDL2/src/video/directfb/SDL_DirectFB_dyn.c index 729e2913a..cbbfa175b 100644 --- a/src/eepp/helper/SDL2/src/video/directfb/SDL_DirectFB_dyn.c +++ b/src/eepp/helper/SDL2/src/video/directfb/SDL_DirectFB_dyn.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -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/eepp/helper/SDL2/src/video/directfb/SDL_DirectFB_dyn.h b/src/eepp/helper/SDL2/src/video/directfb/SDL_DirectFB_dyn.h index 783103b5f..52658b01f 100644 --- a/src/eepp/helper/SDL2/src/video/directfb/SDL_DirectFB_dyn.h +++ b/src/eepp/helper/SDL2/src/video/directfb/SDL_DirectFB_dyn.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -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/eepp/helper/SDL2/src/video/directfb/SDL_DirectFB_events.c b/src/eepp/helper/SDL2/src/video/directfb/SDL_DirectFB_events.c index 1ccb16b73..ffb15c362 100644 --- a/src/eepp/helper/SDL2/src/video/directfb/SDL_DirectFB_events.c +++ b/src/eepp/helper/SDL2/src/video/directfb/SDL_DirectFB_events.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -40,23 +40,23 @@ #include "SDL_DirectFB_events.h" #if USE_MULTI_API -#define SDL_SendMouseMotion_ex(w, id, relative, x, y, p) SDL_SendMouseMotion(id, relative, x, y, p) -#define SDL_SendMouseButton_ex(w, id, state, button) SDL_SendMouseButton(id, state, button) +#define SDL_SendMouseMotion_ex(w, id, relative, x, y, p) SDL_SendMouseMotion(w, id, relative, x, y, p) +#define SDL_SendMouseButton_ex(w, id, state, button) SDL_SendMouseButton(w, id, state, button) #define SDL_SendKeyboardKey_ex(id, state, scancode) SDL_SendKeyboardKey(id, state, scancode) #define SDL_SendKeyboardText_ex(id, text) SDL_SendKeyboardText(id, text) #else -#define SDL_SendMouseMotion_ex(w, id, relative, x, y, p) SDL_SendMouseMotion(w, relative, x, y) -#define SDL_SendMouseButton_ex(w, id, state, button) SDL_SendMouseButton(w, state, button) +#define SDL_SendMouseMotion_ex(w, id, relative, x, y, p) SDL_SendMouseMotion(w, id, relative, x, y) +#define SDL_SendMouseButton_ex(w, id, state, button) SDL_SendMouseButton(w, id, state, button) #define SDL_SendKeyboardKey_ex(id, state, scancode) SDL_SendKeyboardKey(state, scancode) #define SDL_SendKeyboardText_ex(id, text) SDL_SendKeyboardText(text) #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/eepp/helper/SDL2/src/video/directfb/SDL_DirectFB_events.h b/src/eepp/helper/SDL2/src/video/directfb/SDL_DirectFB_events.h index 72f4b035d..a69e6bf7c 100644 --- a/src/eepp/helper/SDL2/src/video/directfb/SDL_DirectFB_events.h +++ b/src/eepp/helper/SDL2/src/video/directfb/SDL_DirectFB_events.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/video/directfb/SDL_DirectFB_modes.c b/src/eepp/helper/SDL2/src/video/directfb/SDL_DirectFB_modes.c index ed580b38b..c6d1bb49c 100644 --- a/src/eepp/helper/SDL2/src/video/directfb/SDL_DirectFB_modes.c +++ b/src/eepp/helper/SDL2/src/video/directfb/SDL_DirectFB_modes.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -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/eepp/helper/SDL2/src/video/directfb/SDL_DirectFB_modes.h b/src/eepp/helper/SDL2/src/video/directfb/SDL_DirectFB_modes.h index 2cf1347b2..6e439cdc9 100644 --- a/src/eepp/helper/SDL2/src/video/directfb/SDL_DirectFB_modes.h +++ b/src/eepp/helper/SDL2/src/video/directfb/SDL_DirectFB_modes.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -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/eepp/helper/SDL2/src/video/directfb/SDL_DirectFB_mouse.c b/src/eepp/helper/SDL2/src/video/directfb/SDL_DirectFB_mouse.c index 4405d3cb1..fb5ed4e7b 100644 --- a/src/eepp/helper/SDL2/src/video/directfb/SDL_DirectFB_mouse.c +++ b/src/eepp/helper/SDL2/src/video/directfb/SDL_DirectFB_mouse.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -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/eepp/helper/SDL2/src/video/directfb/SDL_DirectFB_mouse.h b/src/eepp/helper/SDL2/src/video/directfb/SDL_DirectFB_mouse.h index 2dfa127f3..906f1fb5e 100644 --- a/src/eepp/helper/SDL2/src/video/directfb/SDL_DirectFB_mouse.h +++ b/src/eepp/helper/SDL2/src/video/directfb/SDL_DirectFB_mouse.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -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/eepp/helper/SDL2/src/video/directfb/SDL_DirectFB_opengl.c b/src/eepp/helper/SDL2/src/video/directfb/SDL_DirectFB_opengl.c index 3d2806bb3..fac05e6f2 100644 --- a/src/eepp/helper/SDL2/src/video/directfb/SDL_DirectFB_opengl.c +++ b/src/eepp/helper/SDL2/src/video/directfb/SDL_DirectFB_opengl.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -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 -#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); @@ -72,8 +72,7 @@ DirectFB_GL_Initialize(_THIS) sizeof(struct SDL_GLDriverData)); if (!_this->gl_data) { - SDL_OutOfMemory(); - return -1; + return SDL_OutOfMemory(); } _this->gl_data->initialized = 0; @@ -108,15 +107,12 @@ 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); if (_this->gl_data->gl_active) { - SDL_SetError("OpenGL context already created"); - return -1; + return SDL_SetError("OpenGL context already created"); } @@ -183,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; @@ -197,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; @@ -217,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; @@ -227,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) { @@ -243,8 +237,7 @@ DirectFB_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context) int DirectFB_GL_SetSwapInterval(_THIS, int interval) { - SDL_Unsupported(); - return -1; + return SDL_Unsupported(); } int @@ -256,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; @@ -273,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; @@ -316,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 @@ -331,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 @@ -347,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/eepp/helper/SDL2/src/video/directfb/SDL_DirectFB_opengl.h b/src/eepp/helper/SDL2/src/video/directfb/SDL_DirectFB_opengl.h index bb786862e..efb11f766 100644 --- a/src/eepp/helper/SDL2/src/video/directfb/SDL_DirectFB_opengl.h +++ b/src/eepp/helper/SDL2/src/video/directfb/SDL_DirectFB_opengl.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -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/eepp/helper/SDL2/src/video/directfb/SDL_DirectFB_render.c b/src/eepp/helper/SDL2/src/video/directfb/SDL_DirectFB_render.c index d1274efa0..958793db7 100644 --- a/src/eepp/helper/SDL2/src/video/directfb/SDL_DirectFB_render.c +++ b/src/eepp/helper/SDL2/src/video/directfb/SDL_DirectFB_render.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -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,26 +29,24 @@ #include "../SDL_sysvideo.h" #include "../../render/SDL_sysrender.h" -//#include "../SDL_rect_c.h" -//#include "../SDL_yuv_sw_c.h" #ifndef DFB_VERSION_ATLEAST -#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)) -#define SDL_DFB_CHECK(x) x +#define SDL_DFB_CHECK(x) x #endif /* the following is not yet tested ... */ -#define USE_DISPLAY_PALETTE (0) +#define USE_DISPLAY_PALETTE (0) #define SDL_DFB_RENDERERDATA(rend) DirectFB_RenderData *renddata = ((rend) ? (DirectFB_RenderData *) (rend)->driverdata : NULL) @@ -96,17 +93,17 @@ static void DirectFB_DirtyTexture(SDL_Renderer * renderer, const SDL_Rect * rects); static int DirectFB_SetDrawBlendMode(SDL_Renderer * renderer); static int DirectFB_RenderDrawPoints(SDL_Renderer * renderer, - const SDL_Point * points, int count); + const SDL_FPoint * points, int count); static int DirectFB_RenderDrawLines(SDL_Renderer * renderer, - const SDL_Point * points, int count); + const SDL_FPoint * points, int count); static int DirectFB_RenderDrawRects(SDL_Renderer * renderer, - const SDL_Rect ** rects, int count); + const SDL_Rect ** rects, int count); static int DirectFB_RenderFillRects(SDL_Renderer * renderer, - const SDL_Rect * rects, int count); + const SDL_FRect * rects, int count); static int DirectFB_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture, const SDL_Rect * srcrect, - const SDL_Rect * dstrect); + const SDL_FRect * dstrect); static void DirectFB_RenderPresent(SDL_Renderer * renderer); static void DirectFB_DestroyTexture(SDL_Renderer * renderer, SDL_Texture * texture); @@ -116,6 +113,8 @@ static int DirectFB_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * r static int DirectFB_RenderWritePixels(SDL_Renderer * renderer, const SDL_Rect * rect, Uint32 format, const void * pixels, int pitch); static int DirectFB_UpdateViewport(SDL_Renderer * renderer); +static int DirectFB_UpdateClipRect(SDL_Renderer * renderer); +static int DirectFB_SetRenderTarget(SDL_Renderer * renderer, SDL_Texture * texture); static int PrepareDraw(SDL_Renderer * renderer); @@ -135,7 +134,7 @@ SDL_RenderDriver DirectFB_RenderDriver = { SDL_SCALEMODE_SLOW | SDL_SCALEMODE_BEST),*/ 0, { - /* formats filled in later */ + /* formats filled in later */ }, 0, 0} @@ -149,6 +148,7 @@ typedef struct int lastBlendMode; DFBSurfaceBlittingFlags blitFlags; DFBSurfaceDrawingFlags drawFlags; + IDirectFBSurface* target; } DirectFB_RenderData; typedef struct @@ -175,6 +175,14 @@ SDLtoDFBRect(const SDL_Rect * sr, DFBRectangle * dr) dr->h = sr->h; dr->w = sr->w; } +static __inline__ void +SDLtoDFBRect_Float(const SDL_FRect * sr, DFBRectangle * dr) +{ + dr->x = sr->x; + dr->y = sr->y; + dr->h = sr->h; + dr->w = sr->w; +} static int @@ -183,7 +191,7 @@ TextureHasAlpha(DirectFB_TextureData * data) /* Drawing primitive ? */ if (!data) return 0; - + return (DFB_PIXELFORMAT_HAS_ALPHA(DirectFB_SDLToDFBPixelFormat(data->format)) ? 1 : 0); #if 0 switch (data->format) { @@ -205,29 +213,33 @@ TextureHasAlpha(DirectFB_TextureData * data) static inline IDirectFBSurface *get_dfb_surface(SDL_Window *window) { - SDL_SysWMinfo wm_info; - SDL_VERSION(&wm_info.version); - SDL_GetWindowWMInfo(window, &wm_info); + SDL_SysWMinfo wm_info; + SDL_memset(&wm_info, 0, sizeof(SDL_SysWMinfo)); - return wm_info.info.dfb.surface; + SDL_VERSION(&wm_info.version); + SDL_GetWindowWMInfo(window, &wm_info); + + return wm_info.info.dfb.surface; } static inline IDirectFBWindow *get_dfb_window(SDL_Window *window) { - SDL_SysWMinfo wm_info; - SDL_VERSION(&wm_info.version); - SDL_GetWindowWMInfo(window, &wm_info); + SDL_SysWMinfo wm_info; + SDL_memset(&wm_info, 0, sizeof(SDL_SysWMinfo)); - return wm_info.info.dfb.window; + SDL_VERSION(&wm_info.version); + SDL_GetWindowWMInfo(window, &wm_info); + + return wm_info.info.dfb.window; } static void SetBlendMode(DirectFB_RenderData * data, int blendMode, DirectFB_TextureData * source) { - IDirectFBSurface *destsurf = get_dfb_surface(data->window); + 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: @@ -254,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 @@ -266,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)); @@ -317,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; } } @@ -327,7 +336,7 @@ int DirectFB_RenderClear(SDL_Renderer * renderer) { DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata; - IDirectFBSurface *destsurf = get_dfb_surface(data->window); + IDirectFBSurface *destsurf = data->target; DirectFB_ActivateRenderer(renderer); @@ -342,12 +351,11 @@ DirectFB_RenderClear(SDL_Renderer * renderer) SDL_Renderer * DirectFB_CreateRenderer(SDL_Window * window, Uint32 flags) { - IDirectFBSurface *winsurf = get_dfb_surface(window); + IDirectFBSurface *winsurf = get_dfb_surface(window); SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window); 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)); @@ -366,18 +374,18 @@ DirectFB_CreateRenderer(SDL_Window * window, Uint32 flags) /* SetDrawColor - no needed */ renderer->RenderFillRects = DirectFB_RenderFillRects; - /* RenderDrawEllipse - no reference implementation yet */ - /* RenderFillEllipse - no reference implementation yet */ renderer->RenderCopy = DirectFB_RenderCopy; renderer->RenderPresent = DirectFB_RenderPresent; - + /* 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; renderer->UpdateViewport = DirectFB_UpdateViewport; + renderer->UpdateClipRect = DirectFB_UpdateClipRect; + renderer->SetRenderTarget = DirectFB_SetRenderTarget; #if 0 renderer->QueryTexturePixels = DirectFB_QueryTexturePixels; @@ -394,9 +402,10 @@ DirectFB_CreateRenderer(SDL_Window * window, Uint32 flags) renderer->driverdata = data; renderer->info.flags = - SDL_RENDERER_ACCELERATED; + SDL_RENDERER_ACCELERATED | SDL_RENDERER_TARGETTEXTURE; data->window = window; + data->target = winsurf; data->flipflags = DSFLIP_PIPELINE | DSFLIP_BLIT; @@ -437,14 +446,12 @@ DirectFB_CreateRenderer(SDL_Window * window, Uint32 flags) static void DirectFB_ActivateRenderer(SDL_Renderer * renderer) { - SDL_DFB_RENDERERDATA(renderer); SDL_Window *window = renderer->window; SDL_DFB_WINDOWDATA(window); if (renddata->size_changed /*|| windata->wm_needs_redraw*/) { - //DirectFB_AdjustWindowSurface(window); - renddata->size_changed = SDL_FALSE; + renddata->size_changed = SDL_FALSE; } } @@ -452,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); @@ -568,13 +574,13 @@ DirectFB_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) SDL_DFB_CHECKERR(data->surface->GetPalette(data->surface, &data->palette)); #else /* DFB has issues with blitting LUT8 surfaces. - * Creating a new palette does not help. - */ - DFBPaletteDescription pal_desc; - 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)); + * Creating a new palette does not help. + */ + DFBPaletteDescription pal_desc; + 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)); #endif } @@ -630,7 +636,7 @@ DirectFB_SetTexturePalette(SDL_Renderer * renderer, int i; if (ncolors > 256) - ncolors = 256; + ncolors = 256; for (i = 0; i < ncolors; ++i) { entries[i].r = colors[i].r; @@ -642,8 +648,7 @@ DirectFB_SetTexturePalette(SDL_Renderer * renderer, palette->SetEntries(data->palette, entries, ncolors, firstcolor)); return 0; } else { - SDL_SetError("YUV textures don't have a palette"); - return -1; + return SDL_SetError("YUV textures don't have a palette"); } error: return -1; @@ -669,12 +674,11 @@ DirectFB_GetTexturePalette(SDL_Renderer * renderer, colors[i].r = entries[i].r; colors[i].g = entries[i].g; colors[i].b = entries[i].b; - colors->unused = SDL_ALPHA_OPAQUE; + colors[i].unused = SDL_ALPHA_OPAQUE; } return 0; } else { - SDL_SetError("YUV textures don't have a palette"); - return -1; + return SDL_SetError("YUV textures don't have a palette"); } error: return -1; @@ -697,15 +701,14 @@ 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: return 0; default: - SDL_Unsupported(); texture->blendMode = SDL_BLENDMODE_NONE; - return -1; + return SDL_Unsupported(); } } @@ -714,15 +717,14 @@ 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: return 0; default: - SDL_Unsupported(); renderer->blendMode = SDL_BLENDMODE_NONE; - return -1; + return SDL_Unsupported(); } } @@ -747,10 +749,9 @@ DirectFB_SetTextureScaleMode(SDL_Renderer * renderer, SDL_Texture * texture) DSRO_SMOOTH_UPSCALE | DSRO_SMOOTH_DOWNSCALE | DSRO_ANTIALIAS; break; default: - SDL_Unsupported(); data->render_options = DSRO_NONE; texture->scaleMode = SDL_SCALEMODE_NONE; - return -1; + return SDL_Unsupported(); } #endif return 0; @@ -768,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); @@ -776,7 +777,7 @@ DirectFB_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, (texture->format == SDL_PIXELFORMAT_IYUV)) { bpp = 1; } - + SDL_DFB_CHECKERR(data->surface->Lock(data->surface, DSLF_WRITE | DSLF_READ, ((void **) &dpixels), &dpitch)); @@ -880,11 +881,28 @@ DirectFB_DirtyTexture(SDL_Renderer * renderer, SDL_Texture * texture, } #endif +static int DirectFB_SetRenderTarget(SDL_Renderer * renderer, SDL_Texture * texture) +{ + DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata; + DirectFB_TextureData *tex_data = NULL; + + DirectFB_ActivateRenderer(renderer); + if (texture) { + tex_data = (DirectFB_TextureData *) texture->driverdata; + data->target = tex_data->surface; + } else { + data->target = get_dfb_surface(data->window); + } + data->lastBlendMode = 0; + return 0; +} + + static int PrepareDraw(SDL_Renderer * renderer) { DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata; - IDirectFBSurface *destsurf = get_dfb_surface(data->window); + IDirectFBSurface *destsurf = data->target; Uint8 r, g, b, a; @@ -898,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: @@ -917,27 +935,33 @@ PrepareDraw(SDL_Renderer * renderer) } static int DirectFB_RenderDrawPoints(SDL_Renderer * renderer, - const SDL_Point * points, int count) + const SDL_FPoint * points, int count) { DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata; - IDirectFBSurface *destsurf = get_dfb_surface(data->window); + IDirectFBSurface *destsurf = data->target; + DFBRegion clip_region; int i; DirectFB_ActivateRenderer(renderer); PrepareDraw(renderer); - for (i=0; i < count; i++) - SDL_DFB_CHECKERR(destsurf->DrawLine(destsurf, points[i].x, points[i].y, points[i].x, points[i].y)); + destsurf->GetClip(destsurf, &clip_region); + for (i=0; i < count; i++) { + int x = points[i].x + clip_region.x1; + int y = points[i].y + clip_region.y1; + SDL_DFB_CHECKERR(destsurf->DrawLine(destsurf, x, y, x, y)); + } return 0; error: return -1; } static int DirectFB_RenderDrawLines(SDL_Renderer * renderer, - const SDL_Point * points, int count) + const SDL_FPoint * points, int count) { DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata; - IDirectFBSurface *destsurf = get_dfb_surface(data->window); + IDirectFBSurface *destsurf = data->target; + DFBRegion clip_region; int i; DirectFB_ActivateRenderer(renderer); @@ -948,8 +972,14 @@ static int DirectFB_RenderDrawLines(SDL_Renderer * renderer, SDL_DFB_CHECKERR(destsurf->SetRenderOptions(destsurf, DSRO_ANTIALIAS)); #endif - for (i=0; i < count - 1; i++) - SDL_DFB_CHECKERR(destsurf->DrawLine(destsurf, points[i].x, points[i].y, points[i+1].x, points[i+1].y)); + destsurf->GetClip(destsurf, &clip_region); + for (i=0; i < count - 1; i++) { + int x1 = points[i].x + clip_region.x1; + int y1 = points[i].y + clip_region.y1; + int x2 = points[i + 1].x + clip_region.x1; + int y2 = points[i + 1].y + clip_region.y1; + SDL_DFB_CHECKERR(destsurf->DrawLine(destsurf, x1, y1, x2, y2)); + } return 0; error: @@ -960,16 +990,22 @@ static int DirectFB_RenderDrawRects(SDL_Renderer * renderer, const SDL_Rect ** rects, int count) { DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata; - IDirectFBSurface *destsurf = get_dfb_surface(data->window); + IDirectFBSurface *destsurf = data->target; + DFBRegion clip_region; int i; DirectFB_ActivateRenderer(renderer); PrepareDraw(renderer); - for (i=0; iDrawRectangle(destsurf, rects[i]->x, rects[i]->y, - rects[i]->w, rects[i]->h)); + destsurf->GetClip(destsurf, &clip_region); + for (i=0; ix, rects[i]->y, rects[i]->w, rects[i]->h}; + dst.x += clip_region.x1; + dst.y += clip_region.y1; + SDL_DFB_CHECKERR(destsurf->DrawRectangle(destsurf, dst.x, dst.y, + dst.w, dst.h)); + } return 0; error: @@ -977,19 +1013,25 @@ DirectFB_RenderDrawRects(SDL_Renderer * renderer, const SDL_Rect ** rects, int c } static int -DirectFB_RenderFillRects(SDL_Renderer * renderer, const SDL_Rect * rects, int count) +DirectFB_RenderFillRects(SDL_Renderer * renderer, const SDL_FRect * rects, int count) { DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata; - IDirectFBSurface *destsurf = get_dfb_surface(data->window); + IDirectFBSurface *destsurf = data->target; + DFBRegion clip_region; int i; DirectFB_ActivateRenderer(renderer); PrepareDraw(renderer); - for (i=0; iFillRectangle(destsurf, rects[i].x, rects[i].y, - rects[i].w, rects[i].h)); + destsurf->GetClip(destsurf, &clip_region); + for (i=0; iFillRectangle(destsurf, dst.x, dst.y, + dst.w, dst.h)); + } return 0; error: @@ -998,40 +1040,46 @@ DirectFB_RenderFillRects(SDL_Renderer * renderer, const SDL_Rect * rects, int co static int DirectFB_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture, - const SDL_Rect * srcrect, const SDL_Rect * dstrect) + const SDL_Rect * srcrect, const SDL_FRect * dstrect) { DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata; - IDirectFBSurface *destsurf = get_dfb_surface(data->window); + IDirectFBSurface *destsurf = data->target; DirectFB_TextureData *texturedata = (DirectFB_TextureData *) texture->driverdata; Uint8 alpha, r, g, b; + DFBRegion clip_region; + DFBRectangle sr, dr; DirectFB_ActivateRenderer(renderer); + SDLtoDFBRect(srcrect, &sr); + SDLtoDFBRect_Float(dstrect, &dr); + + destsurf->GetClip(destsurf, &clip_region); + dr.x += clip_region.x1; + dr.y += clip_region.y1; + if (texturedata->display) { int px, py; SDL_Window *window = renderer->window; - IDirectFBWindow *dfbwin = get_dfb_window(window); + IDirectFBWindow *dfbwin = get_dfb_window(window); SDL_DFB_WINDOWDATA(window); SDL_VideoDisplay *display = texturedata->display; DFB_DisplayData *dispdata = (DFB_DisplayData *) display->driverdata; SDL_DFB_CHECKERR(dispdata-> vidlayer->SetSourceRectangle(dispdata->vidlayer, - srcrect->x, srcrect->y, - srcrect->w, - srcrect->h)); + sr.x, sr.y, sr.w, sr.h)); dfbwin->GetPosition(dfbwin, &px, &py); px += windata->client.x; py += windata->client.y; SDL_DFB_CHECKERR(dispdata-> vidlayer->SetScreenRectangle(dispdata->vidlayer, - px + dstrect->x, - py + dstrect->y, - dstrect->w, - dstrect->h)); + px + dr.x, + py + dr.y, + dr.w, + dr.h)); } else { - DFBRectangle sr, dr; DFBSurfaceBlittingFlags flags = 0; #if 0 @@ -1065,14 +1113,11 @@ DirectFB_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture, DirectFB_UpdateTexture(renderer, texture, &rect, texturedata->pixels, texturedata->pitch); } - SDLtoDFBRect(srcrect, &sr); - SDLtoDFBRect(dstrect, &dr); - alpha = r = g = b = 0xff; - if (texture->modMode & SDL_TEXTUREMODULATE_ALPHA){ - alpha = texture->a; - flags |= DSBLIT_BLEND_COLORALPHA; - } + if (texture->modMode & SDL_TEXTUREMODULATE_ALPHA){ + alpha = texture->a; + flags |= DSBLIT_BLEND_COLORALPHA; + } if (texture->modMode & SDL_TEXTUREMODULATE_COLOR) { r = texture->r; @@ -1083,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); @@ -1154,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) { @@ -1176,7 +1220,6 @@ DirectFB_DestroyRenderer(SDL_Renderer * renderer) { DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata; SDL_VideoDisplay *display = SDL_GetDisplayForWindow(data->window); - #if 0 if (display->palette) { SDL_DelPaletteWatch(display->palette, DisplayPaletteChanged, data); @@ -1192,41 +1235,65 @@ DirectFB_DestroyRenderer(SDL_Renderer * renderer) static int DirectFB_UpdateViewport(SDL_Renderer * renderer) { - IDirectFBSurface *winsurf = get_dfb_surface(renderer->window); - DFBRegion dreg; + DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata; + IDirectFBSurface *winsurf = data->target; + DFBRegion dreg; - dreg.x1 = renderer->viewport.x; - dreg.y1 = renderer->viewport.y; - dreg.x2 = dreg.x1 + renderer->viewport.w - 1; - dreg.y2 = dreg.y1 + renderer->viewport.h - 1; + dreg.x1 = renderer->viewport.x; + dreg.y1 = renderer->viewport.y; + dreg.x2 = dreg.x1 + renderer->viewport.w - 1; + dreg.y2 = dreg.y1 + renderer->viewport.h - 1; - winsurf->SetClip(winsurf, &dreg); + winsurf->SetClip(winsurf, &dreg); return 0; } +static int +DirectFB_UpdateClipRect(SDL_Renderer * renderer) +{ + const SDL_Rect *rect = &renderer->clip_rect; + DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata; + IDirectFBSurface *destsurf = get_dfb_surface(data->window); + DFBRegion region; + + if (!SDL_RectEmpty(rect)) { + region.x1 = rect->x; + region.x2 = rect->x + rect->w; + region.y1 = rect->y; + region.y2 = rect->y + rect->h; + SDL_DFB_CHECKERR(destsurf->SetClip(destsurf, ®ion)); + } else { + SDL_DFB_CHECKERR(destsurf->SetClip(destsurf, NULL)); + } + return 0; + error: + return -1; +} + static int DirectFB_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect, Uint32 format, void * pixels, int pitch) { Uint32 sdl_format; - void * laypixels; - int laypitch; - DFBSurfacePixelFormat dfb_format; - IDirectFBSurface *winsurf = get_dfb_surface(renderer->window); + void * laypixels; + int laypitch; + DFBSurfacePixelFormat dfb_format; + DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata; + IDirectFBSurface *winsurf = data->target; DirectFB_ActivateRenderer(renderer); winsurf->GetPixelFormat(winsurf, &dfb_format); sdl_format = DirectFB_DFBToSDLPixelFormat(dfb_format); winsurf->Lock(winsurf, DSLF_READ, (void **) &laypixels, &laypitch); - + laypixels += (rect->y * laypitch + rect->x * SDL_BYTESPERPIXEL(sdl_format) ); SDL_ConvertPixels(rect->w, rect->h, sdl_format, laypixels, laypitch, format, pixels, pitch); winsurf->Unlock(winsurf); - + return 0; } @@ -1238,15 +1305,15 @@ DirectFB_RenderWritePixels(SDL_Renderer * renderer, const SDL_Rect * rect, SDL_Window *window = renderer->window; SDL_DFB_WINDOWDATA(window); Uint32 sdl_format; - void * laypixels; - int laypitch; - DFBSurfacePixelFormat dfb_format; + void * laypixels; + int laypitch; + DFBSurfacePixelFormat dfb_format; SDL_DFB_CHECK(windata->surface->GetPixelFormat(windata->surface, &dfb_format)); sdl_format = DirectFB_DFBToSDLPixelFormat(dfb_format); SDL_DFB_CHECK(windata->surface->Lock(windata->surface, DSLF_WRITE, (void **) &laypixels, &laypitch)); - + laypixels += (rect->y * laypitch + rect->x * SDL_BYTESPERPIXEL(sdl_format) ); SDL_ConvertPixels(rect->w, rect->h, format, pixels, pitch, diff --git a/src/eepp/helper/SDL2/src/video/directfb/SDL_DirectFB_render.h b/src/eepp/helper/SDL2/src/video/directfb/SDL_DirectFB_render.h index bc3ce5f58..fe888af1a 100644 --- a/src/eepp/helper/SDL2/src/video/directfb/SDL_DirectFB_render.h +++ b/src/eepp/helper/SDL2/src/video/directfb/SDL_DirectFB_render.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/video/directfb/SDL_DirectFB_shape.c b/src/eepp/helper/SDL2/src/video/directfb/SDL_DirectFB_shape.c index 85b2e477c..13c3d703e 100644 --- a/src/eepp/helper/SDL2/src/video/directfb/SDL_DirectFB_shape.c +++ b/src/eepp/helper/SDL2/src/video/directfb/SDL_DirectFB_shape.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -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++; + 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); - } + } + 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/eepp/helper/SDL2/src/video/directfb/SDL_DirectFB_shape.h b/src/eepp/helper/SDL2/src/video/directfb/SDL_DirectFB_shape.h index 67fe857f2..a99778533 100644 --- a/src/eepp/helper/SDL2/src/video/directfb/SDL_DirectFB_shape.h +++ b/src/eepp/helper/SDL2/src/video/directfb/SDL_DirectFB_shape.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -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/eepp/helper/SDL2/src/video/directfb/SDL_DirectFB_video.c b/src/eepp/helper/SDL2/src/video/directfb/SDL_DirectFB_video.c index 807fc85d6..d20b5f122 100644 --- a/src/eepp/helper/SDL2/src/video/directfb/SDL_DirectFB_video.c +++ b/src/eepp/helper/SDL2/src/video/directfb/SDL_DirectFB_video.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -102,8 +102,9 @@ DirectFB_CreateDevice(int devindex) { SDL_VideoDevice *device; - if (!SDL_DirectFB_LoadLibrary()) + if (!SDL_DirectFB_LoadLibrary()) { return NULL; + } /* Initialize all variables that we clean on shutdown */ SDL_DFB_ALLOC_CLEAR(device, sizeof(SDL_VideoDevice)); @@ -147,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) @@ -234,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! */ @@ -316,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) */ @@ -341,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 }, @@ -383,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) { @@ -403,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) { @@ -414,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/eepp/helper/SDL2/src/video/directfb/SDL_DirectFB_video.h b/src/eepp/helper/SDL2/src/video/directfb/SDL_DirectFB_video.h index 4c2c9c603..53fcdcfb9 100644 --- a/src/eepp/helper/SDL2/src/video/directfb/SDL_DirectFB_video.h +++ b/src/eepp/helper/SDL2/src/video/directfb/SDL_DirectFB_video.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -31,14 +31,16 @@ #include "SDL_scancode.h" #include "SDL_render.h" -#define DFB_VERSIONNUM(X, Y, Z) \ - ((X)*1000 + (Y)*100 + (Z)) +#include "SDL_log.h" + +#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 @@ -49,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 @@ -60,19 +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 LOG_CHANNEL stdout -#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) @@ -80,30 +81,19 @@ #define SDL_DFB_CONTEXT "SDL_DirectFB" -#define SDL_DFB_ERR(x...) \ - do { \ - fprintf(LOG_CHANNEL, "%s: %s <%d>:\n\t", \ - SDL_DFB_CONTEXT, __FILE__, __LINE__ ); \ - fprintf(LOG_CHANNEL, x ); \ - } while (0) +#define SDL_DFB_ERR(x...) SDL_LogError(SDL_LOG_CATEGORY_ERROR, x) #if (DIRECTFB_DEBUG) +#define SDL_DFB_LOG(x...) SDL_LogInfo(SDL_LOG_CATEGORY_VIDEO, x) -#define SDL_DFB_LOG(x...) \ - do { \ - fprintf(LOG_CHANNEL, "%s: ", SDL_DFB_CONTEXT); \ - fprintf(LOG_CHANNEL, x ); \ - fprintf(LOG_CHANNEL, "\n"); \ - } while (0) - -#define SDL_DFB_DEBUG(x...) SDL_DFB_ERR( x ) +#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) @@ -123,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) @@ -140,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; }; @@ -152,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/eepp/helper/SDL2/src/video/directfb/SDL_DirectFB_window.c b/src/eepp/helper/SDL2/src/video/directfb/SDL_DirectFB_window.c index 541d7b36a..cdcb4cce6 100644 --- a/src/eepp/helper/SDL2/src/video/directfb/SDL_DirectFB_window.c +++ b/src/eepp/helper/SDL2/src/video/directfb/SDL_DirectFB_window.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -47,6 +47,7 @@ DirectFB_CreateWindow(_THIS, SDL_Window * window) int bshaped = 0; SDL_DFB_ALLOC_CLEAR(window->driverdata, sizeof(DFB_WindowData)); + SDL_memset(&desc, 0, sizeof(DFBWindowDescription)); windata = (DFB_WindowData *) window->driverdata; windata->is_managed = devdata->has_own_wm; @@ -56,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; @@ -67,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; @@ -89,7 +90,12 @@ DirectFB_CreateWindow(_THIS, SDL_Window * window) desc.height = windata->size.h; desc.pixelformat = dispdata->pixelformat; desc.surface_caps = DSCAPS_PREMULTIPLIED; - +#if DIRECTFB_MAJOR_VERSION == 1 && DIRECTFB_MINOR_VERSION >= 4 + if (window->flags & SDL_WINDOW_OPENGL) { + desc.surface_caps |= DSCAPS_GL; + } +#endif + /* Create the window. */ SDL_DFB_CHECKERR(dispdata->layer->CreateWindow(dispdata->layer, &desc, &windata->dfbwin)); @@ -110,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; @@ -149,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 ... */ @@ -162,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; } @@ -170,8 +176,7 @@ DirectFB_CreateWindow(_THIS, SDL_Window * window) int DirectFB_CreateWindowFrom(_THIS, SDL_Window * window, const void *data) { - SDL_Unsupported(); - return -1; + return SDL_Unsupported(); } void @@ -182,8 +187,9 @@ DirectFB_SetWindowTitle(_THIS, SDL_Window * window) if (windata->is_managed) { windata->wm_needs_redraw = 1; DirectFB_WM_RedrawLayout(_this, window); - } else + } else { SDL_Unsupported(); + } } void @@ -269,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)); @@ -361,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, @@ -378,7 +384,7 @@ DirectFB_RestoreWindow(_THIS, SDL_Window * window) } void -DirectFB_SetWindowGrab(_THIS, SDL_Window * window) +DirectFB_SetWindowGrab(_THIS, SDL_Window * window, SDL_bool grabbed) { SDL_DFB_DEVICEDATA(_this); SDL_DFB_WINDOWDATA(window); @@ -387,8 +393,8 @@ DirectFB_SetWindowGrab(_THIS, SDL_Window * window) 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)); @@ -412,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); @@ -488,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)) @@ -515,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/eepp/helper/SDL2/src/video/directfb/SDL_DirectFB_window.h b/src/eepp/helper/SDL2/src/video/directfb/SDL_DirectFB_window.h index 6a091ee87..a4a1cc840 100644 --- a/src/eepp/helper/SDL2/src/video/directfb/SDL_DirectFB_window.h +++ b/src/eepp/helper/SDL2/src/video/directfb/SDL_DirectFB_window.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -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); @@ -69,7 +69,7 @@ extern void DirectFB_RaiseWindow(_THIS, SDL_Window * window); extern void DirectFB_MaximizeWindow(_THIS, SDL_Window * window); extern void DirectFB_MinimizeWindow(_THIS, SDL_Window * window); extern void DirectFB_RestoreWindow(_THIS, SDL_Window * window); -extern void DirectFB_SetWindowGrab(_THIS, SDL_Window * window); +extern void DirectFB_SetWindowGrab(_THIS, SDL_Window * window, SDL_bool grabbed); extern void DirectFB_DestroyWindow(_THIS, SDL_Window * window); extern SDL_bool DirectFB_GetWindowWMInfo(_THIS, SDL_Window * window, struct SDL_SysWMinfo *info); diff --git a/src/eepp/helper/SDL2/src/video/dummy/SDL_nullevents.c b/src/eepp/helper/SDL2/src/video/dummy/SDL_nullevents.c index 1320be396..8315609a9 100644 --- a/src/eepp/helper/SDL2/src/video/dummy/SDL_nullevents.c +++ b/src/eepp/helper/SDL2/src/video/dummy/SDL_nullevents.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/video/dummy/SDL_nullevents_c.h b/src/eepp/helper/SDL2/src/video/dummy/SDL_nullevents_c.h index 2ec69b80b..1a8294cb8 100644 --- a/src/eepp/helper/SDL2/src/video/dummy/SDL_nullevents_c.h +++ b/src/eepp/helper/SDL2/src/video/dummy/SDL_nullevents_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/video/dummy/SDL_nullframebuffer.c b/src/eepp/helper/SDL2/src/video/dummy/SDL_nullframebuffer.c index 7b4a48e27..f3904918a 100644 --- a/src/eepp/helper/SDL2/src/video/dummy/SDL_nullframebuffer.c +++ b/src/eepp/helper/SDL2/src/video/dummy/SDL_nullframebuffer.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -58,15 +58,14 @@ int SDL_DUMMY_CreateWindowFramebuffer(_THIS, SDL_Window * window, Uint32 * forma return 0; } -int SDL_DUMMY_UpdateWindowFramebuffer(_THIS, SDL_Window * window, SDL_Rect * rects, int numrects) +int SDL_DUMMY_UpdateWindowFramebuffer(_THIS, SDL_Window * window, const SDL_Rect * rects, int numrects) { static int frame_number; SDL_Surface *surface; surface = (SDL_Surface *) SDL_GetWindowData(window, DUMMY_SURFACE); if (!surface) { - SDL_SetError("Couldn't find dummy surface for window"); - return -1; + return SDL_SetError("Couldn't find dummy surface for window"); } /* Send the data to the display */ diff --git a/src/eepp/helper/SDL2/src/video/dummy/SDL_nullframebuffer_c.h b/src/eepp/helper/SDL2/src/video/dummy/SDL_nullframebuffer_c.h index 01f802292..57dd2adbc 100644 --- a/src/eepp/helper/SDL2/src/video/dummy/SDL_nullframebuffer_c.h +++ b/src/eepp/helper/SDL2/src/video/dummy/SDL_nullframebuffer_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,7 +21,7 @@ #include "SDL_config.h" extern int SDL_DUMMY_CreateWindowFramebuffer(_THIS, SDL_Window * window, Uint32 * format, void ** pixels, int *pitch); -extern int SDL_DUMMY_UpdateWindowFramebuffer(_THIS, SDL_Window * window, SDL_Rect * rects, int numrects); +extern int SDL_DUMMY_UpdateWindowFramebuffer(_THIS, SDL_Window * window, const SDL_Rect * rects, int numrects); extern void SDL_DUMMY_DestroyWindowFramebuffer(_THIS, SDL_Window * window); /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/eepp/helper/SDL2/src/video/dummy/SDL_nullvideo.c b/src/eepp/helper/SDL2/src/video/dummy/SDL_nullvideo.c index 2c6eb0c56..21f1124b6 100644 --- a/src/eepp/helper/SDL2/src/video/dummy/SDL_nullvideo.c +++ b/src/eepp/helper/SDL2/src/video/dummy/SDL_nullvideo.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/video/dummy/SDL_nullvideo.h b/src/eepp/helper/SDL2/src/video/dummy/SDL_nullvideo.h index d2006768a..7d0a8259e 100644 --- a/src/eepp/helper/SDL2/src/video/dummy/SDL_nullvideo.h +++ b/src/eepp/helper/SDL2/src/video/dummy/SDL_nullvideo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/video/nds/SDL_ndsevents.c b/src/eepp/helper/SDL2/src/video/nds/SDL_ndsevents.c deleted file mode 100644 index 7a4669a23..000000000 --- a/src/eepp/helper/SDL2/src/video/nds/SDL_ndsevents.c +++ /dev/null @@ -1,54 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga - - 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 - appreciated but is not required. - 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. -*/ -#include "SDL_config.h" - -#if SDL_VIDEO_DRIVER_NDS - -#include -#include -#include - -#include "../../events/SDL_events_c.h" - -#include "SDL_ndsvideo.h" -#include "SDL_ndsevents_c.h" - -void -NDS_PumpEvents(_THIS) -{ - scanKeys(); - /* TODO: defer click-age */ - if (keysDown() & KEY_TOUCH) { - SDL_SendMouseButton(0, SDL_PRESSED, 0); - } else if (keysUp() & KEY_TOUCH) { - SDL_SendMouseButton(0, SDL_RELEASED, 0); - } - if (keysHeld() & KEY_TOUCH) { - touchPosition t; - - touchRead(&t); - SDL_SendMouseMotion(0, 0, t.px, t.py); - } -} - -#endif /* SDL_VIDEO_DRIVER_NDS */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/eepp/helper/SDL2/src/video/nds/SDL_ndsvideo.c b/src/eepp/helper/SDL2/src/video/nds/SDL_ndsvideo.c deleted file mode 100644 index 53ffbe413..000000000 --- a/src/eepp/helper/SDL2/src/video/nds/SDL_ndsvideo.c +++ /dev/null @@ -1,401 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga - - 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 - appreciated but is not required. - 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. -*/ -#include "SDL_config.h" - -#if SDL_VIDEO_DRIVER_NDS - -/* SDL Nintendo DS video driver implementation */ - -#include -#include -#include -#include - -#include "SDL_video.h" -#include "SDL_ndsvideo.h" -#include "SDL_ndsevents_c.h" -#include "../../render/SDL_sysrender.h" -#include "../../render/nds/SDL_libgl2D.h" -#include "SDL_log.h" - -#define NDSVID_DRIVER_NAME "nds" - -static SDL_DisplayMode display_modes[] = -{ - /* Only one screen */ - { - .format = SDL_PIXELFORMAT_ABGR1555, - .w = SCREEN_WIDTH, - .h = SCREEN_HEIGHT, - .refresh_rate = 60, - }, - - /* Aggregated display (two screens) with no gap. */ - { - .format = SDL_PIXELFORMAT_ABGR1555, - .w = SCREEN_WIDTH, - .h = 2*SCREEN_HEIGHT+SCREEN_GAP, - .refresh_rate = 60, - }, - - /* Aggregated display (two screens) with a gap. */ - { - .format = SDL_PIXELFORMAT_ABGR1555, - .w = SCREEN_WIDTH, - .h = 2*SCREEN_HEIGHT, - .refresh_rate = 60, - }, - - /* Last entry */ - { - .w = 0, - } -}; - -/* This function must not be optimized nor inlined, else the pointer - * to the message will be in the wrong register, and the emulator won't - * find the string. */ -__attribute__ ((noinline, optimize (0))) -static void NDS_DebugOutput2(const char* message) -{ -#ifdef __thumb__ - asm volatile ("swi #0xfc"); -#else - asm volatile ("swi #0xfc0000"); -#endif -} - -static void NDS_DebugOutput(void *userdata, int category, SDL_LogPriority priority, const char *message) -{ - NDS_DebugOutput2(message); -} - -/* SDL NDS driver bootstrap functions */ -static int NDS_Available(void) -{ - return 1; /* always here */ -} - -#ifndef USE_HW_RENDERER -static int NDS_CreateWindowFramebuffer(_THIS, SDL_Window *window, - Uint32 *format, void **pixels, - int *pitch) -{ - struct NDS_WindowData *wdata; - int bpp; - Uint32 Rmask, Gmask, Bmask, Amask; - const SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window); - const SDL_DisplayMode *mode = display->driverdata; - const Uint32 fmt = mode->format; - - if (fmt != SDL_PIXELFORMAT_ABGR1555) { - SDL_SetError("Unsupported pixel format (%x)", fmt); - return -1; - } - - if (!SDL_PixelFormatEnumToMasks - (fmt, &bpp, &Rmask, &Gmask, &Bmask, &Amask)) { - SDL_SetError("Unknown texture format"); - return -1; - } - - wdata = SDL_calloc(1, sizeof(struct NDS_WindowData)); - if (!wdata) { - SDL_OutOfMemory(); - return -1; - } - - if (bpp == 8) { - wdata->pixels_length = (SCREEN_HEIGHT+SCREEN_GAP+SCREEN_HEIGHT)*SCREEN_WIDTH; - } else { - wdata->pixels_length = (SCREEN_HEIGHT+SCREEN_GAP+SCREEN_HEIGHT)*SCREEN_WIDTH*2; - } - wdata->pixels = SDL_calloc(1, wdata->pixels_length); - if (!wdata->pixels) { - SDL_free(wdata); - SDL_SetError("Not enough memory"); - return -1; - } - - if (bpp == 8) { - wdata->main.bg_id = bgInit(2, BgType_Bmp8, BgSize_B8_256x256, 0, 0); - wdata->sub.bg_id = bgInitSub(3, BgType_Bmp8, BgSize_B8_256x256, 0, 0); - - wdata->main.length = SCREEN_HEIGHT*SCREEN_WIDTH; - wdata->main.pixels = wdata->pixels; - - wdata->sub.length = SCREEN_HEIGHT*SCREEN_WIDTH; - wdata->sub.pixels = (u8 *)wdata->pixels + wdata->main.length; /* or ...+SCREEN_GAP */ - - } else { - wdata->main.bg_id = bgInit(2, BgType_Bmp16, BgSize_B16_256x256, 0, 0); - wdata->sub.bg_id = bgInitSub(3, BgType_Bmp16, BgSize_B16_256x256, 0, 0); - - wdata->main.length = SCREEN_HEIGHT*SCREEN_WIDTH*2; - wdata->main.pixels = wdata->pixels; - - wdata->sub.length = SCREEN_HEIGHT*SCREEN_WIDTH*2; - wdata->sub.pixels = (u8 *)wdata->pixels + wdata->main.length; /* or ...+SCREEN_GAP */ - } - - wdata->pitch = (window->w) * ((bpp+1) / 8); - wdata->bpp = bpp; - wdata->rotate = 0; - wdata->scale.x = 0x100; - wdata->scale.y = 0x100; - wdata->scroll.x = 0; - wdata->scroll.y = 0; - - wdata->main.vram_pixels = bgGetGfxPtr(wdata->main.bg_id); - wdata->sub.vram_pixels = bgGetGfxPtr(wdata->sub.bg_id); - -#if 0 - bgSetCenter(wdata->main.bg_id, 0, 0); - bgSetRotateScale(wdata->main.bg_id, wdata->rotate, wdata->scale.x, - wdata->scale.y); - bgSetScroll(wdata->main.bg_id, wdata->scroll.x, wdata->scroll.y); -#endif - -#if 0 - bgSetCenter(wdata->sub.bg_id, 0, 0); - bgSetRotateScale(wdata->sub.bg_id, wdata->rotate, wdata->scale.x, - wdata->scale.y); - bgSetScroll(wdata->sub.bg_id, wdata->scroll.x, wdata->scroll.y); -#endif - - bgUpdate(); - - *format = fmt; - *pixels = wdata->pixels; - *pitch = wdata->pitch; - - window->driverdata = wdata; - - return 0; -} - -static int NDS_UpdateWindowFramebuffer(_THIS, SDL_Window * window, - SDL_Rect * rects, int numrects) -{ - struct NDS_WindowData *wdata = window->driverdata; - - /* Copy everything. TODO: use rects/numrects. */ - DC_FlushRange(wdata->pixels, wdata->pixels_length); - - swiWaitForVBlank(); - - dmaCopy(wdata->main.pixels, wdata->main.vram_pixels, wdata->main.length); - dmaCopy(wdata->sub.pixels, wdata->sub.vram_pixels, wdata->sub.length); - - return 0; -} - -static void NDS_DestroyWindowFramebuffer(_THIS, SDL_Window *window) -{ - struct NDS_WindowData *wdata = window->driverdata; - - SDL_free(wdata->pixels); - SDL_free(wdata); -} -#endif - -#ifdef USE_HW_RENDERER -/* Set up a 2D layer construced of bitmap sprites. This holds the - * image when rendering to the top screen. From libnds example. - */ -static void initSubSprites(void) -{ - oamInit(&oamSub, SpriteMapping_Bmp_2D_256, false); - - int x = 0; - int y = 0; - - int id = 0; - - //set up a 4x3 grid of 64x64 sprites to cover the screen - for(y = 0; y < 3; y++) - for(x = 0; x < 4; x++) - { - oamSub.oamMemory[id].attribute[0] = ATTR0_BMP | ATTR0_SQUARE | (64 * y); - oamSub.oamMemory[id].attribute[1] = ATTR1_SIZE_64 | (64 * x); - oamSub.oamMemory[id].attribute[2] = ATTR2_ALPHA(1) | (8 * 32 * y) | (8 * x); - id++; - } - - swiWaitForVBlank(); - - oamUpdate(&oamSub); -} -#endif - -static int NDS_SetDisplayMode(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mode) -{ - display->driverdata = mode->driverdata; - - powerOn(POWER_ALL_2D); - -#ifdef USE_HW_RENDERER - - videoSetMode(MODE_5_3D); - videoSetModeSub(MODE_5_2D); - - /* initialize gl2d */ - glScreen2D(); - glBegin2D(); - - vramSetBankA(VRAM_A_TEXTURE); - vramSetBankB(VRAM_B_TEXTURE ); - vramSetBankC(VRAM_C_SUB_BG_0x06200000); - vramSetBankE(VRAM_E_TEX_PALETTE); - - // sub sprites hold the bottom image when 3D directed to top - initSubSprites(); - - // sub background holds the top image when 3D directed to bottom - bgInitSub(3, BgType_Bmp16, BgSize_B16_256x256, 0, 0); -#else - - /* Select mode 5 for both screens. Can do Extended Rotation - * Background on both (BG 2 and 3). */ - videoSetMode(MODE_5_2D); - videoSetModeSub(MODE_5_2D); - - vramSetBankA(VRAM_A_MAIN_BG_0x06000000); - vramSetBankB(VRAM_B_TEXTURE ); - vramSetBankC(VRAM_C_SUB_BG_0x06200000); - vramSetBankE(VRAM_E_TEX_PALETTE); - -#endif - - return 0; -} - -void NDS_GetDisplayModes(_THIS, SDL_VideoDisplay * display) -{ - SDL_DisplayMode *mode; - - for (mode = display_modes; mode->w; mode++) { - mode->driverdata = mode; /* point back to self */ - SDL_AddDisplayMode(display, mode); - } -} - -static int NDS_VideoInit(_THIS) -{ - SDL_VideoDisplay display; - SDL_DisplayMode mode; - - SDL_zero(mode); - - mode.format = SDL_PIXELFORMAT_UNKNOWN; // should be SDL_PIXELFORMAT_ABGR1555; - mode.w = SCREEN_WIDTH; - mode.h = 2*SCREEN_HEIGHT+SCREEN_GAP; - mode.refresh_rate = 60; - - SDL_zero(display); - - display.desktop_mode = mode; - - SDL_AddVideoDisplay(&display); - - return 0; -} - -static void NDS_VideoQuit(_THIS) -{ - videoSetMode(DISPLAY_SCREEN_OFF); - videoSetModeSub(DISPLAY_SCREEN_OFF); - vramSetBankA(VRAM_A_LCD); - vramSetBankB(VRAM_B_LCD); - vramSetBankC(VRAM_C_LCD); - vramSetBankD(VRAM_D_LCD); - vramSetBankE(VRAM_E_LCD); - vramSetBankF(VRAM_F_LCD); - vramSetBankG(VRAM_G_LCD); - vramSetBankH(VRAM_H_LCD); - vramSetBankI(VRAM_I_LCD); -} - -static void NDS_DeleteDevice(SDL_VideoDevice * device) -{ - SDL_free(device); -} - -static SDL_VideoDevice *NDS_CreateDevice(int devindex) -{ - SDL_VideoDevice *device; - - fatInitDefault(); - - /* Initialize all variables that we clean on shutdown */ - device = SDL_calloc(1, sizeof(SDL_VideoDevice)); - if (!device) { - SDL_OutOfMemory(); - return NULL; - } - - device->driverdata = SDL_calloc(1, sizeof(SDL_VideoDevice)); - if (!device) { - SDL_free(device); - SDL_OutOfMemory(); - return NULL; - } - - /* Set the function pointers */ - device->VideoInit = NDS_VideoInit; - device->VideoQuit = NDS_VideoQuit; - device->GetDisplayModes = NDS_GetDisplayModes; - device->SetDisplayMode = NDS_SetDisplayMode; - device->CreateWindow = NDS_CreateWindow; -#ifndef USE_HW_RENDERER - device->CreateWindowFramebuffer = NDS_CreateWindowFramebuffer; - device->UpdateWindowFramebuffer = NDS_UpdateWindowFramebuffer; - device->DestroyWindowFramebuffer = NDS_DestroyWindowFramebuffer; -#endif - device->PumpEvents = NDS_PumpEvents; - device->free = NDS_DeleteDevice; - - /* Set the debug output. Use only under an emulator. Will crash the DS. */ -#if 0 - SDL_LogSetOutputFunction(NDS_DebugOutput, NULL); -#endif - - return device; -} - -VideoBootStrap NDS_bootstrap = { - NDSVID_DRIVER_NAME, "SDL NDS video driver", - NDS_Available, NDS_CreateDevice -}; - -double SDLCALL SDL_pow(double x, double y) -{ - static int once = 1; - if (once) { - SDL_Log("SDL_pow called but not supported on this platform"); - once = 0; - } - return 0; -} - -#endif /* SDL_VIDEO_DRIVER_NDS */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/eepp/helper/SDL2/src/video/nds/SDL_ndsvideo.h b/src/eepp/helper/SDL2/src/video/nds/SDL_ndsvideo.h deleted file mode 100644 index bf3f55ecc..000000000 --- a/src/eepp/helper/SDL2/src/video/nds/SDL_ndsvideo.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga - - 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 - appreciated but is not required. - 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. -*/ -#include "SDL_config.h" - -#ifndef _SDL_ndsvideo_h -#define _SDL_ndsvideo_h - -#include "../SDL_sysvideo.h" - -#include "SDL_ndswindow.h" - -#define SCREEN_GAP 92 /* line-equivalent gap between the 2 screens */ - -/* Per Window information. */ -struct NDS_WindowData { - struct { - int bg_id; - void *vram_pixels; /* where the pixel data is stored (a pointer into VRAM) */ - void *pixels; /* area in user frame buffer */ - int length; - } main, sub; - - int pitch, bpp; /* useful information about the texture */ - struct { - int x, y; - } scale; /* x/y stretch (24.8 fixed point) */ - - struct { - int x, y; - } scroll; /* x/y offset */ - int rotate; /* -32768 to 32767, texture rotation */ - - /* user frame buffer - todo: better way to do double buffering */ - void *pixels; - int pixels_length; -}; - - -#endif /* _SDL_ndsvideo_h */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/eepp/helper/SDL2/src/video/nds/SDL_ndswindow.c b/src/eepp/helper/SDL2/src/video/nds/SDL_ndswindow.c deleted file mode 100644 index 6915cdb0c..000000000 --- a/src/eepp/helper/SDL2/src/video/nds/SDL_ndswindow.c +++ /dev/null @@ -1,37 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga - - 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 - appreciated but is not required. - 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. -*/ -#include "SDL_config.h" - -#if SDL_VIDEO_DRIVER_NDS - -#include "SDL_ndsvideo.h" - - -int NDS_CreateWindow(_THIS, SDL_Window * window) -{ - /* Nintendo DS windows are always fullscreen */ - window->flags |= SDL_WINDOW_FULLSCREEN; - return 0; -} - -#endif /* SDL_VIDEO_DRIVER_NDS */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/eepp/helper/SDL2/src/video/pandora/SDL_pandora.c b/src/eepp/helper/SDL2/src/video/pandora/SDL_pandora.c index 46430d1bb..17c761bd6 100644 --- a/src/eepp/helper/SDL2/src/video/pandora/SDL_pandora.c +++ b/src/eepp/helper/SDL2/src/video/pandora/SDL_pandora.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -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; @@ -211,8 +211,7 @@ PND_createwindow(_THIS, SDL_Window * window) /* Allocate window internal data */ wdata = (SDL_WindowData *) SDL_calloc(1, sizeof(SDL_WindowData)); if (wdata == NULL) { - SDL_OutOfMemory(); - return -1; + return SDL_OutOfMemory(); } /* Setup driver data for this window */ @@ -230,14 +229,12 @@ PND_createwindow(_THIS, SDL_Window * window) if (phdata->egl_display == EGL_NO_DISPLAY) { phdata->egl_display = eglGetDisplay((NativeDisplayType) 0); if (phdata->egl_display == EGL_NO_DISPLAY) { - SDL_SetError("PND: Can't get connection to OpenGL ES"); - return -1; + return SDL_SetError("PND: Can't get connection to OpenGL ES"); } initstatus = eglInitialize(phdata->egl_display, NULL, NULL); if (initstatus != EGL_TRUE) { - SDL_SetError("PND: Can't init OpenGL ES library"); - return -1; + return SDL_SetError("PND: Can't init OpenGL ES library"); } } @@ -346,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 @@ -356,8 +353,7 @@ PND_gl_loadlibrary(_THIS, const char *path) _this->gl_config.dll_handle = SDL_LoadObject(path); if (!_this->gl_config.dll_handle) { /* Failed to load new GL ES library */ - SDL_SetError("PND: Failed to locate OpenGL ES library"); - return -1; + return SDL_SetError("PND: Failed to locate OpenGL ES library"); } /* Store OpenGL ES library path and name */ @@ -632,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, @@ -726,8 +722,7 @@ PND_gl_makecurrent(_THIS, SDL_Window * window, SDL_GLContext context) EGLBoolean status; if (phdata->egl_initialized != SDL_TRUE) { - SDL_SetError("PND: GF initialization failed, no OpenGL ES support"); - return -1; + return SDL_SetError("PND: GF initialization failed, no OpenGL ES support"); } if ((window == NULL) && (context == NULL)) { @@ -736,33 +731,28 @@ PND_gl_makecurrent(_THIS, SDL_Window * window, SDL_GLContext context) EGL_NO_SURFACE, EGL_NO_CONTEXT); if (status != EGL_TRUE) { /* Failed to set current GL ES context */ - SDL_SetError("PND: Can't set OpenGL ES context"); - return -1; + return SDL_SetError("PND: Can't set OpenGL ES context"); } } else { wdata = (SDL_WindowData *) window->driverdata; if (wdata->gles_surface == EGL_NO_SURFACE) { - SDL_SetError + return SDL_SetError ("PND: OpenGL ES surface is not initialized for this window"); - return -1; } if (wdata->gles_context == EGL_NO_CONTEXT) { - SDL_SetError + return SDL_SetError ("PND: OpenGL ES context is not initialized for this window"); - return -1; } if (wdata->gles_context != context) { - SDL_SetError + return SDL_SetError ("PND: OpenGL ES context is not belong to this window"); - return -1; } status = eglMakeCurrent(phdata->egl_display, wdata->gles_surface, wdata->gles_surface, wdata->gles_context); if (status != EGL_TRUE) { /* Failed to set current GL ES context */ - SDL_SetError("PND: Can't set OpenGL ES context"); - return -1; + return SDL_SetError("PND: Can't set OpenGL ES context"); } } return 0; @@ -775,8 +765,7 @@ PND_gl_setswapinterval(_THIS, int interval) EGLBoolean status; if (phdata->egl_initialized != SDL_TRUE) { - SDL_SetError("PND: EGL initialization failed, no OpenGL ES support"); - return -1; + return SDL_SetError("PND: EGL initialization failed, no OpenGL ES support"); } /* Check if OpenGL ES connection has been initialized */ @@ -791,8 +780,7 @@ PND_gl_setswapinterval(_THIS, int interval) } /* Failed to set swap interval */ - SDL_SetError("PND: Cannot set swap interval"); - return -1; + return SDL_SetError("PND: Cannot set swap interval"); } int @@ -850,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/eepp/helper/SDL2/src/video/pandora/SDL_pandora.h b/src/eepp/helper/SDL2/src/video/pandora/SDL_pandora.h index a07caf0b2..05aafda21 100644 --- a/src/eepp/helper/SDL2/src/video/pandora/SDL_pandora.h +++ b/src/eepp/helper/SDL2/src/video/pandora/SDL_pandora.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/video/pandora/SDL_pandora_events.c b/src/eepp/helper/SDL2/src/video/pandora/SDL_pandora_events.c index a27a0bfae..de0351907 100644 --- a/src/eepp/helper/SDL2/src/video/pandora/SDL_pandora_events.c +++ b/src/eepp/helper/SDL2/src/video/pandora/SDL_pandora_events.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/video/pandora/SDL_pandora_events.h b/src/eepp/helper/SDL2/src/video/pandora/SDL_pandora_events.h index cdbe5f9bd..9aee72474 100644 --- a/src/eepp/helper/SDL2/src/video/pandora/SDL_pandora_events.h +++ b/src/eepp/helper/SDL2/src/video/pandora/SDL_pandora_events.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/video/psp/SDL_pspevents.c b/src/eepp/helper/SDL2/src/video/psp/SDL_pspevents.c new file mode 100644 index 000000000..54cd4e7d8 --- /dev/null +++ b/src/eepp/helper/SDL2/src/video/psp/SDL_pspevents.c @@ -0,0 +1,284 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2013 Sam Lantinga + + 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 + appreciated but is not required. + 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. +*/ + +/* Being a null driver, there's no event stream. We just define stubs for + most of the API. */ + +#include "SDL.h" +#include "../../events/SDL_sysevents.h" +#include "../../events/SDL_events_c.h" +#include "../../events/SDL_keyboard_c.h" +#include "SDL_pspvideo.h" +#include "SDL_pspevents_c.h" +#include "SDL_thread.h" +#include "SDL_keyboard.h" +#include + +#ifdef PSPIRKEYB +#include +#include + +#define IRKBD_CONFIG_FILE NULL /* this will take ms0:/seplugins/pspirkeyb.ini */ + +static int irkbd_ready = 0; +static SDLKey keymap[256]; +#endif + +static enum PspHprmKeys hprm = 0; +static SDL_sem *event_sem = NULL; +static SDL_Thread *thread = NULL; +static int running = 0; +static struct { + 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 } +}; + +int EventUpdate(void *data) +{ + while (running) { + SDL_SemWait(event_sem); + sceHprmPeekCurrentKey(&hprm); + SDL_SemPost(event_sem); + /* Delay 1/60th of a second */ + 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= 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); + + return; +} + +void PSP_InitOSKeymap(_THIS) +{ +#ifdef PSPIRKEYB + int i; + for (i=0; i + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -18,10 +18,14 @@ misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ -#include "SDL_config.h" -#include "SDL_ndsvideo.h" +#include "SDL_pspvideo.h" -extern void NDS_PumpEvents(_THIS); +/* Variables and functions exported by SDL_sysevents.c to other parts + of the native video subsystem (SDL_sysvideo.c) +*/ +extern void PSP_InitOSKeymap(_THIS); +extern void PSP_PumpEvents(_THIS); + +/* end of SDL_pspevents_c.h ... */ -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/eepp/helper/SDL2/src/video/psp/SDL_pspgl.c b/src/eepp/helper/SDL2/src/video/psp/SDL_pspgl.c new file mode 100644 index 000000000..fbbc20cc4 --- /dev/null +++ b/src/eepp/helper/SDL2/src/video/psp/SDL_pspgl.c @@ -0,0 +1,205 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2013 Sam Lantinga + + 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 + appreciated but is not required. + 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. +*/ + +#include +#include + +#include "SDL_error.h" +#include "SDL_pspvideo.h" +#include "SDL_pspgl_c.h" + +/*****************************************************************************/ +/* 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) + +int +PSP_GL_LoadLibrary(_THIS, const char *path) +{ + if (!_this->gl_config.driver_loaded) { + _this->gl_config.driver_loaded = 1; + } + + return 0; +} + +/* 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)) +*/ +void * +PSP_GL_GetProcAddress(_THIS, const char *proc) +{ + return eglGetProcAddress(proc); +} + +void +PSP_GL_UnloadLibrary(_THIS) +{ + eglTerminate(_this->gl_data->display); +} + +static EGLint width = 480; +static EGLint height = 272; + +SDL_GLContext +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; + + + return context; +} + +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"); + } + return 0; +} + +int +PSP_GL_SetSwapInterval(_THIS, int interval) +{ + EGLBoolean status; + status = eglSwapInterval(_this->gl_data->display, interval); + if (status == EGL_TRUE) { + /* Return success to upper level */ + _this->gl_data->swapinterval = interval; + return 0; + } + /* Failed to set swap interval */ + return SDL_SetError("Unable to set the EGL swap interval"); +} + +int +PSP_GL_GetSwapInterval(_THIS) +{ + return _this->gl_data->swapinterval; +} + +void +PSP_GL_SwapWindow(_THIS, SDL_Window * window) +{ + eglSwapBuffers(_this->gl_data->display, _this->gl_data->surface); +} + +void +PSP_GL_DeleteContext(_THIS, SDL_GLContext context) +{ + SDL_VideoData *phdata = (SDL_VideoData *) _this->driverdata; + EGLBoolean status; + + if (phdata->egl_initialized != SDL_TRUE) { + SDL_SetError("PSP: GLES initialization failed, no OpenGL ES support"); + return; + } + + /* Check if OpenGL ES connection has been initialized */ + if (_this->gl_data->display != EGL_NO_DISPLAY) { + if (context != EGL_NO_CONTEXT) { + status = eglDestroyContext(_this->gl_data->display, context); + if (status != EGL_TRUE) { + /* Error during OpenGL ES context destroying */ + SDL_SetError("PSP: OpenGL ES context destroy error"); + return; + } + } + } + + return; +} + diff --git a/src/eepp/helper/SDL2/src/thread/nds/SDL_systhread.c b/src/eepp/helper/SDL2/src/video/psp/SDL_pspgl_c.h similarity index 50% rename from src/eepp/helper/SDL2/src/thread/nds/SDL_systhread.c rename to src/eepp/helper/SDL2/src/video/psp/SDL_pspgl_c.h index 0772b2ac0..8b20d1544 100644 --- a/src/eepp/helper/SDL2/src/thread/nds/SDL_systhread.c +++ b/src/eepp/helper/SDL2/src/video/psp/SDL_pspgl_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,46 +19,34 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifdef SAVE_RCSID -static char rcsid = - "@(#) $Id: SDL_systhread.c,v 1.2 2001/04/26 16:50:18 hercules Exp $"; -#endif +#ifndef _SDL_pspgl_c_h +#define _SDL_pspgl_c_h -/* Thread management routines for SDL */ -#include "SDL_error.h" -#include "SDL_thread.h" -#include "../SDL_systhread.h" +#include +#include -int -SDL_SYS_CreateThread(SDL_Thread * thread, void *args) -{ - SDL_SetError("Threads are not supported on this platform"); - return (-1); -} +#include "SDL_pspvideo.h" -void -SDL_SYS_SetupThread(const char *name) -{ - return; -} -SDL_threadID -SDL_ThreadID(void) -{ - return (0); -} +typedef struct SDL_GLDriverData { + EGLDisplay display; + EGLContext context; + EGLSurface surface; + uint32_t swapinterval; +}SDL_GLDriverData; -void -SDL_SYS_WaitThread(SDL_Thread * thread) -{ - return; -} +extern void * PSP_GL_GetProcAddress(_THIS, const char *proc); +extern int PSP_GL_MakeCurrent(_THIS,SDL_Window * window, SDL_GLContext context); +extern void PSP_GL_SwapBuffers(_THIS); -int -SDL_SYS_SetThreadPriority(SDL_ThreadPriority priority) -{ - return (0); -} +extern void PSP_GL_SwapWindow(_THIS, SDL_Window * window); +extern SDL_GLContext PSP_GL_CreateContext(_THIS, SDL_Window * window); -/* vi: set ts=4 sw=4 expandtab: */ +extern int PSP_GL_LoadLibrary(_THIS, const char *path); +extern void PSP_GL_UnloadLibrary(_THIS); +extern int PSP_GL_SetSwapInterval(_THIS, int interval); +extern int PSP_GL_GetSwapInterval(_THIS); + + +#endif /* _SDL_pspgl_c_h */ diff --git a/src/eepp/helper/SDL2/src/video/nds/SDL_ndswindow.h b/src/eepp/helper/SDL2/src/video/psp/SDL_pspmouse.c similarity index 74% rename from src/eepp/helper/SDL2/src/video/nds/SDL_ndswindow.h rename to src/eepp/helper/SDL2/src/video/psp/SDL_pspmouse.c index 73cf4d23c..002a518b4 100644 --- a/src/eepp/helper/SDL2/src/video/nds/SDL_ndswindow.h +++ b/src/eepp/helper/SDL2/src/video/psp/SDL_pspmouse.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -18,13 +18,18 @@ misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ -#include "SDL_config.h" -#ifndef _SDL_ndswindow_h -#define _SDL_ndswindow_h -extern int NDS_CreateWindow(_THIS, SDL_Window * window); +#include -#endif /* _SDL_ndswindow_h */ +#include "SDL_error.h" +#include "SDL_mouse.h" +#include "../../events/SDL_events_c.h" -/* vi: set ts=4 sw=4 expandtab: */ +#include "SDL_pspmouse_c.h" + + +/* The implementation dependent data for the window manager cursor */ +struct WMcursor { + int unused; +}; diff --git a/src/eepp/helper/SDL2/src/thread/nds/SDL_syssem_c.h b/src/eepp/helper/SDL2/src/video/psp/SDL_pspmouse_c.h similarity index 83% rename from src/eepp/helper/SDL2/src/thread/nds/SDL_syssem_c.h rename to src/eepp/helper/SDL2/src/video/psp/SDL_pspmouse_c.h index b5aa420ba..a0836a30a 100644 --- a/src/eepp/helper/SDL2/src/thread/nds/SDL_syssem_c.h +++ b/src/eepp/helper/SDL2/src/video/psp/SDL_pspmouse_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,7 +19,6 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifdef SAVE_RCSID -static char rcsid = - "@(#) $Id: SDL_syssem_c.h,v 1.2 2001/04/26 16:50:18 hercules Exp $"; -#endif +#include "SDL_pspvideo.h" + +/* Functions to be exported */ diff --git a/src/eepp/helper/SDL2/src/video/psp/SDL_pspvideo.c b/src/eepp/helper/SDL2/src/video/psp/SDL_pspvideo.c new file mode 100644 index 000000000..ed5ab1c96 --- /dev/null +++ b/src/eepp/helper/SDL2/src/video/psp/SDL_pspvideo.c @@ -0,0 +1,328 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2013 Sam Lantinga + + 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 + appreciated but is not required. + 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. +*/ + +#include "SDL_config.h" + +#if SDL_VIDEO_DRIVER_PSP + +/* SDL internals */ +#include "../SDL_sysvideo.h" +#include "SDL_version.h" +#include "SDL_syswm.h" +#include "SDL_loadso.h" +#include "SDL_events.h" +#include "../../events/SDL_mouse_c.h" +#include "../../events/SDL_keyboard_c.h" + + + +/* PSP declarations */ +#include "SDL_pspvideo.h" +#include "SDL_pspevents_c.h" +#include "SDL_pspgl_c.h" + +/* unused +static SDL_bool PSP_initialized = SDL_FALSE; +*/ +static int +PSP_Available(void) +{ + return 1; +} + +static void +PSP_Destroy(SDL_VideoDevice * device) +{ +/* SDL_VideoData *phdata = (SDL_VideoData *) device->driverdata; */ + + if (device->driverdata != NULL) { + device->driverdata = NULL; + } +} + +static SDL_VideoDevice * +PSP_Create() +{ + SDL_VideoDevice *device; + SDL_VideoData *phdata; + SDL_GLDriverData *gldata; + int status; + + /* Check if pandora could be initialized */ + status = PSP_Available(); + if (status == 0) { + /* PSP could not be used */ + return NULL; + } + + /* Initialize SDL_VideoDevice structure */ + device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice)); + if (device == NULL) { + SDL_OutOfMemory(); + return NULL; + } + + /* Initialize internal Pandora specific data */ + phdata = (SDL_VideoData *) SDL_calloc(1, sizeof(SDL_VideoData)); + if (phdata == NULL) { + SDL_OutOfMemory(); + SDL_free(device); + return NULL; + } + + 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; + + + /* Setup amount of available displays and current display */ + device->num_displays = 0; + + /* Set device free function */ + device->free = PSP_Destroy; + + /* Setup all functions which we can handle */ + device->VideoInit = PSP_VideoInit; + device->VideoQuit = PSP_VideoQuit; + device->GetDisplayModes = PSP_GetDisplayModes; + device->SetDisplayMode = PSP_SetDisplayMode; + device->CreateWindow = PSP_CreateWindow; + device->CreateWindowFrom = PSP_CreateWindowFrom; + device->SetWindowTitle = PSP_SetWindowTitle; + device->SetWindowIcon = PSP_SetWindowIcon; + device->SetWindowPosition = PSP_SetWindowPosition; + device->SetWindowSize = PSP_SetWindowSize; + device->ShowWindow = PSP_ShowWindow; + device->HideWindow = PSP_HideWindow; + device->RaiseWindow = PSP_RaiseWindow; + device->MaximizeWindow = PSP_MaximizeWindow; + device->MinimizeWindow = PSP_MinimizeWindow; + device->RestoreWindow = PSP_RestoreWindow; + device->SetWindowGrab = PSP_SetWindowGrab; + device->DestroyWindow = PSP_DestroyWindow; + device->GetWindowWMInfo = PSP_GetWindowWMInfo; + device->GL_LoadLibrary = PSP_GL_LoadLibrary; + device->GL_GetProcAddress = PSP_GL_GetProcAddress; + device->GL_UnloadLibrary = PSP_GL_UnloadLibrary; + device->GL_CreateContext = PSP_GL_CreateContext; + device->GL_MakeCurrent = PSP_GL_MakeCurrent; + device->GL_SetSwapInterval = PSP_GL_SetSwapInterval; + 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->PumpEvents = PSP_PumpEvents; + + return device; +} + +VideoBootStrap PSP_bootstrap = { + "PSP", + "PSP Video Driver", + PSP_Available, + PSP_Create +}; + +/*****************************************************************************/ +/* SDL Video and Display initialization/handling functions */ +/*****************************************************************************/ +int +PSP_VideoInit(_THIS) +{ + SDL_VideoDisplay display; + 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_ABGR8888; + + current_mode.driverdata = NULL; + + SDL_zero(display); + display.desktop_mode = current_mode; + display.current_mode = current_mode; + display.driverdata = NULL; + + SDL_AddVideoDisplay(&display); + + return 1; +} + +void +PSP_VideoQuit(_THIS) +{ + +} + +void +PSP_GetDisplayModes(_THIS, SDL_VideoDisplay * display) +{ + +} + +int +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) + +int +PSP_CreateWindow(_THIS, SDL_Window * window) +{ + SDL_WindowData *wdata; + + /* Allocate window internal data */ + wdata = (SDL_WindowData *) SDL_calloc(1, sizeof(SDL_WindowData)); + if (wdata == NULL) { + return SDL_OutOfMemory(); + } + + /* Setup driver data for this window */ + window->driverdata = wdata; + + + /* Window has been successfully created */ + return 0; +} + +int +PSP_CreateWindowFrom(_THIS, SDL_Window * window, const void *data) +{ + return -1; +} + +void +PSP_SetWindowTitle(_THIS, SDL_Window * window) +{ +} +void +PSP_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon) +{ +} +void +PSP_SetWindowPosition(_THIS, SDL_Window * window) +{ +} +void +PSP_SetWindowSize(_THIS, SDL_Window * window) +{ +} +void +PSP_ShowWindow(_THIS, SDL_Window * window) +{ +} +void +PSP_HideWindow(_THIS, SDL_Window * window) +{ +} +void +PSP_RaiseWindow(_THIS, SDL_Window * window) +{ +} +void +PSP_MaximizeWindow(_THIS, SDL_Window * window) +{ +} +void +PSP_MinimizeWindow(_THIS, SDL_Window * window) +{ +} +void +PSP_RestoreWindow(_THIS, SDL_Window * window) +{ +} +void +PSP_SetWindowGrab(_THIS, SDL_Window * window, SDL_bool grabbed) +{ + +} +void +PSP_DestroyWindow(_THIS, SDL_Window * window) +{ +} + +/*****************************************************************************/ +/* SDL Window Manager function */ +/*****************************************************************************/ +SDL_bool +PSP_GetWindowWMInfo(_THIS, SDL_Window * window, struct SDL_SysWMinfo *info) +{ + if (info->version.major <= SDL_MAJOR_VERSION) { + return SDL_TRUE; + } else { + SDL_SetError("application not compiled with SDL %d.%d\n", + SDL_MAJOR_VERSION, SDL_MINOR_VERSION); + return SDL_FALSE; + } + + /* Failed to get window manager information */ + return SDL_FALSE; +} + + +/* TO Write Me*/ +SDL_bool PSP_HasScreenKeyboardSupport(_THIS) +{ + return SDL_FALSE; +} +void PSP_ShowScreenKeyboard(_THIS, SDL_Window *window) +{ +} +void PSP_HideScreenKeyboard(_THIS, SDL_Window *window) +{ +} +SDL_bool PSP_IsScreenKeyboardShown(_THIS, SDL_Window *window) +{ + return SDL_FALSE; +} + + +#endif /* SDL_VIDEO_DRIVER_PSP */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/eepp/helper/SDL2/src/video/psp/SDL_pspvideo.h b/src/eepp/helper/SDL2/src/video/psp/SDL_pspvideo.h new file mode 100644 index 000000000..d4ab32bfe --- /dev/null +++ b/src/eepp/helper/SDL2/src/video/psp/SDL_pspvideo.h @@ -0,0 +1,102 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2013 Sam Lantinga + + 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 + appreciated but is not required. + 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_PANDORA_H__ +#define __SDL_PANDORA_H__ + +#include + +#include "SDL_config.h" +#include "../SDL_sysvideo.h" + +typedef struct SDL_VideoData +{ + SDL_bool egl_initialized; /* OpenGL ES device initialization status */ + uint32_t egl_refcount; /* OpenGL ES reference count */ + + + +} SDL_VideoData; + + +typedef struct SDL_DisplayData +{ + +} SDL_DisplayData; + + +typedef struct SDL_WindowData +{ + SDL_bool uses_gles; /* if true window must support OpenGL ES */ + +} SDL_WindowData; + + + + +/****************************************************************************/ +/* SDL_VideoDevice functions declaration */ +/****************************************************************************/ + +/* Display and window functions */ +int PSP_VideoInit(_THIS); +void PSP_VideoQuit(_THIS); +void PSP_GetDisplayModes(_THIS, SDL_VideoDisplay * display); +int PSP_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode); +int PSP_CreateWindow(_THIS, SDL_Window * window); +int PSP_CreateWindowFrom(_THIS, SDL_Window * window, const void *data); +void PSP_SetWindowTitle(_THIS, SDL_Window * window); +void PSP_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon); +void PSP_SetWindowPosition(_THIS, SDL_Window * window); +void PSP_SetWindowSize(_THIS, SDL_Window * window); +void PSP_ShowWindow(_THIS, SDL_Window * window); +void PSP_HideWindow(_THIS, SDL_Window * window); +void PSP_RaiseWindow(_THIS, SDL_Window * window); +void PSP_MaximizeWindow(_THIS, SDL_Window * window); +void PSP_MinimizeWindow(_THIS, SDL_Window * window); +void PSP_RestoreWindow(_THIS, SDL_Window * window); +void PSP_SetWindowGrab(_THIS, SDL_Window * window, SDL_bool grabbed); +void PSP_DestroyWindow(_THIS, SDL_Window * window); + +/* Window manager function */ +SDL_bool PSP_GetWindowWMInfo(_THIS, SDL_Window * window, + struct SDL_SysWMinfo *info); + +/* OpenGL/OpenGL ES functions */ +int PSP_GL_LoadLibrary(_THIS, const char *path); +void *PSP_GL_GetProcAddress(_THIS, const char *proc); +void PSP_GL_UnloadLibrary(_THIS); +SDL_GLContext PSP_GL_CreateContext(_THIS, SDL_Window * window); +int PSP_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context); +int PSP_GL_SetSwapInterval(_THIS, int interval); +int PSP_GL_GetSwapInterval(_THIS); +void PSP_GL_SwapWindow(_THIS, SDL_Window * window); +void PSP_GL_DeleteContext(_THIS, SDL_GLContext context); + +/*PSP on screen keyboard */ +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/eepp/helper/SDL2/src/video/sdlgenblit.pl b/src/eepp/helper/SDL2/src/video/sdlgenblit.pl index d4339dded..3a0561476 100755 --- a/src/eepp/helper/SDL2/src/video/sdlgenblit.pl +++ b/src/eepp/helper/SDL2/src/video/sdlgenblit.pl @@ -82,7 +82,7 @@ sub open_file { /* DO NOT EDIT! This file is generated by sdlgenblit.pl */ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/video/uikit/SDL_uikitappdelegate.h b/src/eepp/helper/SDL2/src/video/uikit/SDL_uikitappdelegate.h index a9dc3bd85..b375f2e30 100644 --- a/src/eepp/helper/SDL2/src/video/uikit/SDL_uikitappdelegate.h +++ b/src/eepp/helper/SDL2/src/video/uikit/SDL_uikitappdelegate.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/video/uikit/SDL_uikitappdelegate.m b/src/eepp/helper/SDL2/src/video/uikit/SDL_uikitappdelegate.m index 2d263dd56..d13c2bbce 100644 --- a/src/eepp/helper/SDL2/src/video/uikit/SDL_uikitappdelegate.m +++ b/src/eepp/helper/SDL2/src/video/uikit/SDL_uikitappdelegate.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -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 @@ -228,42 +229,48 @@ static void SDL_IdleTimerDisabledChanged(const char *name, const char *oldValue, - (void)applicationWillTerminate:(UIApplication *)application { - SDL_SendQuit(); - /* hack to prevent automatic termination. See SDL_uikitevents.m for details */ - longjmp(*(jump_env()), 1); + SDL_SendAppEvent(SDL_APP_TERMINATING); +} + +- (void)applicationDidReceiveMemoryWarning:(UIApplication *)application +{ + SDL_SendAppEvent(SDL_APP_LOWMEMORY); } - (void) applicationWillResignActive:(UIApplication*)application { - //NSLog(@"%@", NSStringFromSelector(_cmd)); - - // Send every window on every screen a MINIMIZED event. SDL_VideoDevice *_this = SDL_GetVideoDevice(); - if (!_this) { - return; + if (_this) { + SDL_Window *window; + for (window = _this->windows; window != nil; window = window->next) { + SDL_SendWindowEvent(window, SDL_WINDOWEVENT_FOCUS_LOST, 0, 0); + SDL_SendWindowEvent(window, SDL_WINDOWEVENT_MINIMIZED, 0, 0); + } } + SDL_SendAppEvent(SDL_APP_WILLENTERBACKGROUND); +} - SDL_Window *window; - for (window = _this->windows; window != nil; window = window->next) { - SDL_SendWindowEvent(window, SDL_WINDOWEVENT_FOCUS_LOST, 0, 0); - SDL_SendWindowEvent(window, SDL_WINDOWEVENT_MINIMIZED, 0, 0); - } +- (void) applicationDidEnterBackground:(UIApplication*)application +{ + SDL_SendAppEvent(SDL_APP_DIDENTERBACKGROUND); +} + +- (void) applicationWillEnterForeground:(UIApplication*)application +{ + SDL_SendAppEvent(SDL_APP_WILLENTERFOREGROUND); } - (void) applicationDidBecomeActive:(UIApplication*)application { - //NSLog(@"%@", NSStringFromSelector(_cmd)); + SDL_SendAppEvent(SDL_APP_DIDENTERFOREGROUND); - // Send every window on every screen a RESTORED event. SDL_VideoDevice *_this = SDL_GetVideoDevice(); - if (!_this) { - return; - } - - SDL_Window *window; - for (window = _this->windows; window != nil; window = window->next) { - SDL_SendWindowEvent(window, SDL_WINDOWEVENT_FOCUS_GAINED, 0, 0); - SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESTORED, 0, 0); + if (_this) { + SDL_Window *window; + for (window = _this->windows; window != nil; window = window->next) { + SDL_SendWindowEvent(window, SDL_WINDOWEVENT_FOCUS_GAINED, 0, 0); + SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESTORED, 0, 0); + } } } diff --git a/src/eepp/helper/SDL2/src/video/uikit/SDL_uikitevents.h b/src/eepp/helper/SDL2/src/video/uikit/SDL_uikitevents.h index 044314425..39ee4ca3e 100644 --- a/src/eepp/helper/SDL2/src/video/uikit/SDL_uikitevents.h +++ b/src/eepp/helper/SDL2/src/video/uikit/SDL_uikitevents.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/video/uikit/SDL_uikitevents.m b/src/eepp/helper/SDL2/src/video/uikit/SDL_uikitevents.m index e7f0dcc63..b3f380eb8 100644 --- a/src/eepp/helper/SDL2/src/video/uikit/SDL_uikitevents.m +++ b/src/eepp/helper/SDL2/src/video/uikit/SDL_uikitevents.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -57,25 +57,25 @@ UIKit_PumpEvents(_THIS) */ if (setjmp(*jump_env()) == 0) { /* if we're setting the jump, rather than jumping back */ - - /* Let the run loop run for a short amount of time: long enough for - touch events to get processed (which is important to get certain - elements of Game Center's GKLeaderboardViewController to respond - to touch input), but not long enough to introduce a significant - delay in the rest of the app. - */ - const CFTimeInterval seconds = 0.000002; - - /* Pump most event types. */ + + /* Let the run loop run for a short amount of time: long enough for + touch events to get processed (which is important to get certain + elements of Game Center's GKLeaderboardViewController to respond + to touch input), but not long enough to introduce a significant + delay in the rest of the app. + */ + const CFTimeInterval seconds = 0.000002; + + /* Pump most event types. */ SInt32 result; do { result = CFRunLoopRunInMode(kCFRunLoopDefaultMode, seconds, TRUE); } while (result == kCFRunLoopRunHandledSource); - - /* Make sure UIScrollView objects scroll properly. */ - do { - result = CFRunLoopRunInMode((CFStringRef)UITrackingRunLoopMode, seconds, TRUE); - } while(result == kCFRunLoopRunHandledSource); + + /* Make sure UIScrollView objects scroll properly. */ + do { + result = CFRunLoopRunInMode((CFStringRef)UITrackingRunLoopMode, seconds, TRUE); + } while(result == kCFRunLoopRunHandledSource); } } diff --git a/src/eepp/helper/SDL2/src/video/uikit/SDL_uikitmessagebox.h b/src/eepp/helper/SDL2/src/video/uikit/SDL_uikitmessagebox.h index 8c61f790a..7bee1ec17 100644 --- a/src/eepp/helper/SDL2/src/video/uikit/SDL_uikitmessagebox.h +++ b/src/eepp/helper/SDL2/src/video/uikit/SDL_uikitmessagebox.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/video/uikit/SDL_uikitmessagebox.m b/src/eepp/helper/SDL2/src/video/uikit/SDL_uikitmessagebox.m index 2ff1d0822..5ec7e8b47 100644 --- a/src/eepp/helper/SDL2/src/video/uikit/SDL_uikitmessagebox.m +++ b/src/eepp/helper/SDL2/src/video/uikit/SDL_uikitmessagebox.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -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/eepp/helper/SDL2/src/video/uikit/SDL_uikitmodes.h b/src/eepp/helper/SDL2/src/video/uikit/SDL_uikitmodes.h index 4831bac5a..249bda164 100644 --- a/src/eepp/helper/SDL2/src/video/uikit/SDL_uikitmodes.h +++ b/src/eepp/helper/SDL2/src/video/uikit/SDL_uikitmodes.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/video/uikit/SDL_uikitmodes.m b/src/eepp/helper/SDL2/src/video/uikit/SDL_uikitmodes.m index 7e1d2cfb2..f093a81c6 100644 --- a/src/eepp/helper/SDL2/src/video/uikit/SDL_uikitmodes.m +++ b/src/eepp/helper/SDL2/src/video/uikit/SDL_uikitmodes.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -34,23 +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) { - SDL_OutOfMemory(); - return -1; + return SDL_OutOfMemory(); } - + data->uiscreenmode = uiscreenmode; [data->uiscreenmode retain]; - + data->scale = scale; } - + mode->driverdata = data; - + return 0; } @@ -58,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; @@ -74,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)) { @@ -98,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; } @@ -114,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; @@ -141,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; } @@ -160,18 +161,17 @@ UIKit_AddDisplay(UIScreen *uiscreen) /* Allocate the display data */ SDL_DisplayData *data = (SDL_DisplayData *) SDL_malloc(sizeof(*data)); if (!data) { - SDL_OutOfMemory(); UIKit_FreeDisplayModeData(&display.desktop_mode); - return -1; + return SDL_OutOfMemory(); } - + [uiscreen retain]; data->uiscreen = uiscreen; data->scale = scale; - + display.driverdata = data; SDL_AddVideoDisplay(&display); - + return 0; } @@ -189,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; @@ -224,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), @@ -256,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; @@ -264,7 +266,7 @@ UIKit_GetDisplayModes(_THIS, SDL_VideoDisplay * display) } UIKit_AddDisplayMode(display, w, h, 1.0f, nil, addRotation); - } + } } int @@ -273,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; @@ -297,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/eepp/helper/SDL2/src/video/uikit/SDL_uikitopengles.h b/src/eepp/helper/SDL2/src/video/uikit/SDL_uikitopengles.h index c14faac66..cb8164842 100644 --- a/src/eepp/helper/SDL2/src/video/uikit/SDL_uikitopengles.h +++ b/src/eepp/helper/SDL2/src/video/uikit/SDL_uikitopengles.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/video/uikit/SDL_uikitopengles.m b/src/eepp/helper/SDL2/src/video/uikit/SDL_uikitopengles.m index 8517cb410..a7d370f2b 100644 --- a/src/eepp/helper/SDL2/src/video/uikit/SDL_uikitopengles.m +++ b/src/eepp/helper/SDL2/src/video/uikit/SDL_uikitopengles.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -72,8 +72,7 @@ UIKit_GL_LoadLibrary(_THIS, const char *path) and because the SDK forbids loading an external SO */ if (path != NULL) { - SDL_SetError("iPhone GL Load Library just here for compatibility"); - return -1; + return SDL_SetError("iPhone GL Load Library just here for compatibility"); } return 0; } @@ -81,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 @@ -92,8 +91,10 @@ void UIKit_GL_SwapWindow(_THIS, SDL_Window * window) } [data->view swapBuffers]; - /* we need to let the event cycle run, or the OS won't update the OpenGL view! */ - SDL_PumpEvents(); + /* You need to pump events in order for the OS to make changes visible. + We don't pump events here because we don't want iOS application events + (low memory, terminate, etc.) to happen inside low level rendering. + */ } SDL_GLContext UIKit_GL_CreateContext(_THIS, SDL_Window * window) @@ -133,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/eepp/helper/SDL2/src/video/uikit/SDL_uikitopenglview.h b/src/eepp/helper/SDL2/src/video/uikit/SDL_uikitopenglview.h index 255ff6a4a..b29cca2c5 100644 --- a/src/eepp/helper/SDL2/src/video/uikit/SDL_uikitopenglview.h +++ b/src/eepp/helper/SDL2/src/video/uikit/SDL_uikitopenglview.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/video/uikit/SDL_uikitopenglview.m b/src/eepp/helper/SDL2/src/video/uikit/SDL_uikitopenglview.m index afa4fe279..6ca5162d9 100644 --- a/src/eepp/helper/SDL2/src/video/uikit/SDL_uikitopenglview.m +++ b/src/eepp/helper/SDL2/src/video/uikit/SDL_uikitopenglview.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -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/eepp/helper/SDL2/src/video/uikit/SDL_uikitvideo.h b/src/eepp/helper/SDL2/src/video/uikit/SDL_uikitvideo.h index 1cf608b4e..8969e91e9 100644 --- a/src/eepp/helper/SDL2/src/video/uikit/SDL_uikitvideo.h +++ b/src/eepp/helper/SDL2/src/video/uikit/SDL_uikitvideo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -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/eepp/helper/SDL2/src/video/uikit/SDL_uikitvideo.m b/src/eepp/helper/SDL2/src/video/uikit/SDL_uikitvideo.m index 0c3764e01..662b10906 100644 --- a/src/eepp/helper/SDL2/src/video/uikit/SDL_uikitvideo.m +++ b/src/eepp/helper/SDL2/src/video/uikit/SDL_uikitvideo.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -63,10 +63,10 @@ UIKit_CreateDevice(int devindex) /* Initialize all variables that we clean on shutdown */ device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice)); if (!device) { - SDL_OutOfMemory(); if (device) { SDL_free(device); } + SDL_OutOfMemory(); return (0); } @@ -86,10 +86,12 @@ UIKit_CreateDevice(int devindex) /* !!! FIXME: implement SetWindowBordered */ - device->SDL_HasScreenKeyboardSupport = UIKit_HasScreenKeyboardSupport; - device->SDL_ShowScreenKeyboard = UIKit_ShowScreenKeyboard; - device->SDL_HideScreenKeyboard = UIKit_HideScreenKeyboard; - device->SDL_IsScreenKeyboardShown = UIKit_IsScreenKeyboardShown; +#if SDL_IPHONE_KEYBOARD + device->HasScreenKeyboardSupport = UIKit_HasScreenKeyboardSupport; + device->ShowScreenKeyboard = UIKit_ShowScreenKeyboard; + device->HideScreenKeyboard = UIKit_HideScreenKeyboard; + device->IsScreenKeyboardShown = UIKit_IsScreenKeyboardShown; +#endif /* OpenGL (ES) functions */ device->GL_MakeCurrent = UIKit_GL_MakeCurrent; diff --git a/src/eepp/helper/SDL2/src/video/uikit/SDL_uikitview.h b/src/eepp/helper/SDL2/src/video/uikit/SDL_uikitview.h index a1f833b04..ff8a7d2cf 100644 --- a/src/eepp/helper/SDL2/src/video/uikit/SDL_uikitview.h +++ b/src/eepp/helper/SDL2/src/video/uikit/SDL_uikitview.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -37,7 +37,7 @@ #endif SDL_TouchID touchId; - SDL_FingerID leftFingerDown; + UITouch *leftFingerDown; #ifndef IPHONE_TOUCH_EFFICIENT_DANGEROUS UITouch *finger[MAX_SIMULTANEOUS_TOUCHES]; #endif diff --git a/src/eepp/helper/SDL2/src/video/uikit/SDL_uikitview.m b/src/eepp/helper/SDL2/src/video/uikit/SDL_uikitview.m index 254a96149..e808962ef 100644 --- a/src/eepp/helper/SDL2/src/video/uikit/SDL_uikitview.m +++ b/src/eepp/helper/SDL2/src/video/uikit/SDL_uikitview.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -30,10 +30,10 @@ #if SDL_IPHONE_KEYBOARD #include "keyinfotable.h" +#endif #include "SDL_uikitappdelegate.h" #include "SDL_uikitmodes.h" #include "SDL_uikitwindow.h" -#endif @implementation SDL_uikitview @@ -52,23 +52,8 @@ self.multipleTouchEnabled = YES; - SDL_Touch touch; - touch.id = 0; //TODO: Should be -1? - - //touch.driverdata = SDL_malloc(sizeof(EventTouchData)); - //EventTouchData* data = (EventTouchData*)(touch.driverdata); - - touch.x_min = 0; - touch.x_max = 1; - touch.native_xres = touch.x_max - touch.x_min; - touch.y_min = 0; - touch.y_max = 1; - touch.native_yres = touch.y_max - touch.y_min; - touch.pressure_min = 0; - touch.pressure_max = 1; - touch.native_pressureres = touch.pressure_max - touch.pressure_min; - - touchId = SDL_AddTouch(&touch, "IPHONE SCREEN"); + touchId = 1; + SDL_AddTouch(touchId, ""); return self; @@ -78,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; @@ -104,30 +89,29 @@ CGPoint locationInView = [self touchLocation:touch shouldNormalize:NO]; /* send moved event */ - SDL_SendMouseMotion(NULL, 0, locationInView.x, locationInView.y); + SDL_SendMouseMotion(NULL, SDL_TOUCH_MOUSEID, 0, locationInView.x, locationInView.y); /* send mouse down event */ - SDL_SendMouseButton(NULL, SDL_PRESSED, SDL_BUTTON_LEFT); + SDL_SendMouseButton(NULL, SDL_TOUCH_MOUSEID, SDL_PRESSED, SDL_BUTTON_LEFT); - leftFingerDown = (SDL_FingerID)touch; + leftFingerDown = touch; } 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. - SDL_SendFingerDown(touchId, (SDL_FingerID)touch, - SDL_TRUE, locationInView.x, locationInView.y, - 1); + /* 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 int i; for(i = 0; i < MAX_SIMULTANEOUS_TOUCHES; i++) { if (finger[i] == NULL) { finger[i] = touch; - SDL_SendFingerDown(touchId, i, - SDL_TRUE, locationInView.x, locationInView.y, - 1); + SDL_SendTouch(touchId, i, + SDL_TRUE, locationInView.x, locationInView.y, 1.0f); break; } } @@ -142,24 +126,22 @@ UITouch *touch = (UITouch*)[enumerator nextObject]; while(touch) { - if ((SDL_FingerID)touch == leftFingerDown) { + if (touch == leftFingerDown) { /* send mouse up */ - SDL_SendMouseButton(NULL, SDL_RELEASED, SDL_BUTTON_LEFT); - leftFingerDown = 0; + SDL_SendMouseButton(NULL, SDL_TOUCH_MOUSEID, SDL_RELEASED, SDL_BUTTON_LEFT); + leftFingerDown = nil; } CGPoint locationInView = [self touchLocation:touch shouldNormalize:YES]; #ifdef IPHONE_TOUCH_EFFICIENT_DANGEROUS - SDL_SendFingerDown(touchId, (long)touch, - SDL_FALSE, locationInView.x, locationInView.y, - 1); + SDL_SendTouch(touchId, (long)touch, + SDL_FALSE, locationInView.x, locationInView.y, 1.0f); #else int i; for (i = 0; i < MAX_SIMULTANEOUS_TOUCHES; i++) { if (finger[i] == touch) { - SDL_SendFingerDown(touchId, i, - SDL_FALSE, locationInView.x, locationInView.y, - 1); + SDL_SendTouch(touchId, i, + SDL_FALSE, locationInView.x, locationInView.y, 1.0f); finger[i] = NULL; break; } @@ -185,25 +167,23 @@ UITouch *touch = (UITouch*)[enumerator nextObject]; while (touch) { - if ((SDL_FingerID)touch == leftFingerDown) { + if (touch == leftFingerDown) { CGPoint locationInView = [self touchLocation:touch shouldNormalize:NO]; /* send moved event */ - SDL_SendMouseMotion(NULL, 0, locationInView.x, locationInView.y); + SDL_SendMouseMotion(NULL, SDL_TOUCH_MOUSEID, 0, locationInView.x, locationInView.y); } CGPoint locationInView = [self touchLocation:touch shouldNormalize:YES]; #ifdef IPHONE_TOUCH_EFFICIENT_DANGEROUS SDL_SendTouchMotion(touchId, (long)touch, - SDL_FALSE, locationInView.x, locationInView.y, - 1); + locationInView.x, locationInView.y, 1.0f); #else int i; for (i = 0; i < MAX_SIMULTANEOUS_TOUCHES; i++) { if (finger[i] == touch) { SDL_SendTouchMotion(touchId, i, - SDL_FALSE, locationInView.x, locationInView.y, - 1); + locationInView.x, locationInView.y, 1.0f); break; } } diff --git a/src/eepp/helper/SDL2/src/video/uikit/SDL_uikitviewcontroller.h b/src/eepp/helper/SDL2/src/video/uikit/SDL_uikitviewcontroller.h index 2c4ea7efe..2bc664d6c 100644 --- a/src/eepp/helper/SDL2/src/video/uikit/SDL_uikitviewcontroller.h +++ b/src/eepp/helper/SDL2/src/video/uikit/SDL_uikitviewcontroller.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/video/uikit/SDL_uikitviewcontroller.m b/src/eepp/helper/SDL2/src/video/uikit/SDL_uikitviewcontroller.m index 3b8cb6565..157b70aa0 100644 --- a/src/eepp/helper/SDL2/src/video/uikit/SDL_uikitviewcontroller.m +++ b/src/eepp/helper/SDL2/src/video/uikit/SDL_uikitviewcontroller.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -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/eepp/helper/SDL2/src/video/uikit/SDL_uikitwindow.h b/src/eepp/helper/SDL2/src/video/uikit/SDL_uikitwindow.h index 925443453..effad90c9 100644 --- a/src/eepp/helper/SDL2/src/video/uikit/SDL_uikitwindow.h +++ b/src/eepp/helper/SDL2/src/video/uikit/SDL_uikitwindow.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/video/uikit/SDL_uikitwindow.m b/src/eepp/helper/SDL2/src/video/uikit/SDL_uikitwindow.m index ec0beda01..b3f7ac9f4 100644 --- a/src/eepp/helper/SDL2/src/video/uikit/SDL_uikitwindow.m +++ b/src/eepp/helper/SDL2/src/video/uikit/SDL_uikitwindow.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -54,8 +54,7 @@ static int SetupWindowData(_THIS, SDL_Window *window, UIWindow *uiwindow, SDL_bo /* Allocate the window data */ data = (SDL_WindowData *)SDL_malloc(sizeof(*data)); if (!data) { - SDL_OutOfMemory(); - return -1; + return SDL_OutOfMemory(); } data->uiwindow = uiwindow; data->viewcontroller = nil; @@ -77,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 +92,32 @@ static int SetupWindowData(_THIS, SDL_Window *window, UIWindow *uiwindow, SDL_bo /* only one window on iOS, always shown */ window->flags &= ~SDL_WINDOW_HIDDEN; - // 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,18 +129,18 @@ 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 */ if (window->next != NULL) { - SDL_SetError("Only one window allowed per display."); - return -1; + 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)) { @@ -159,14 +160,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; @@ -174,7 +176,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)) { @@ -188,14 +190,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]; } @@ -228,10 +231,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); } @@ -315,8 +319,7 @@ SDL_iPhoneSetAnimationCallback(SDL_Window * window, int interval, void (*callbac SDL_WindowData *data = window ? (SDL_WindowData *)window->driverdata : NULL; if (!data || !data->view) { - SDL_SetError("Invalid window or view not set"); - return -1; + return SDL_SetError("Invalid window or view not set"); } [data->view setAnimationCallback:interval callback:callback callbackParam:callbackParam]; diff --git a/src/eepp/helper/SDL2/src/video/uikit/keyinfotable.h b/src/eepp/helper/SDL2/src/video/uikit/keyinfotable.h index a3721f591..d12674b9a 100644 --- a/src/eepp/helper/SDL2/src/video/uikit/keyinfotable.h +++ b/src/eepp/helper/SDL2/src/video/uikit/keyinfotable.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/video/windows/SDL_vkeys.h b/src/eepp/helper/SDL2/src/video/windows/SDL_vkeys.h index efd48a1d8..ca24e8ff9 100644 --- a/src/eepp/helper/SDL2/src/video/windows/SDL_vkeys.h +++ b/src/eepp/helper/SDL2/src/video/windows/SDL_vkeys.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -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/eepp/helper/SDL2/src/video/windows/SDL_windowsclipboard.c b/src/eepp/helper/SDL2/src/video/windows/SDL_windowsclipboard.c index dcd7de80f..83bf0caa3 100644 --- a/src/eepp/helper/SDL2/src/video/windows/SDL_windowsclipboard.c +++ b/src/eepp/helper/SDL2/src/video/windows/SDL_windowsclipboard.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -89,8 +89,7 @@ WIN_SetClipboardText(_THIS, const char *text) EmptyClipboard(); if (!SetClipboardData(TEXT_FORMAT, hMem)) { - WIN_SetError("Couldn't set clipboard data"); - result = -1; + result = WIN_SetError("Couldn't set clipboard data"); } data->clipboard_count = GetClipboardSequenceNumber(); } @@ -98,8 +97,7 @@ WIN_SetClipboardText(_THIS, const char *text) CloseClipboard(); } else { - WIN_SetError("Couldn't open clipboard"); - result = -1; + result = WIN_SetError("Couldn't open clipboard"); } return result; } @@ -139,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/eepp/helper/SDL2/src/video/windows/SDL_windowsclipboard.h b/src/eepp/helper/SDL2/src/video/windows/SDL_windowsclipboard.h index a2ec0c32a..410e757ae 100644 --- a/src/eepp/helper/SDL2/src/video/windows/SDL_windowsclipboard.h +++ b/src/eepp/helper/SDL2/src/video/windows/SDL_windowsclipboard.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/video/windows/SDL_windowsevents.c b/src/eepp/helper/SDL2/src/video/windows/SDL_windowsevents.c index 0193062e2..b30b8364b 100644 --- a/src/eepp/helper/SDL2/src/video/windows/SDL_windowsevents.c +++ b/src/eepp/helper/SDL2/src/video/windows/SDL_windowsevents.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -28,16 +28,15 @@ #include "SDL_vkeys.h" #include "../../events/SDL_events_c.h" #include "../../events/SDL_touch_c.h" +#include "../../events/scancodes_windows.h" /* Dropfile support */ #include - - /*#define WMMSG_DEBUG*/ #ifdef WMMSG_DEBUG -#include +#include #include "wmmsg.h" #endif @@ -46,6 +45,9 @@ #define EXTENDED_KEYMASK (1<<24) #define VK_ENTER 10 /* Keypad Enter ... no VKEY defined? */ +#ifndef VK_OEM_NEC_EQUAL +#define VK_OEM_NEC_EQUAL 0x92 +#endif /* Make sure XBUTTON stuff is defined that isn't in older Platform SDKs... */ #ifndef WM_XBUTTONDOWN @@ -64,45 +66,192 @@ #define WM_TOUCH 0x0240 #endif - -static WPARAM -RemapVKEY(WPARAM wParam, LPARAM lParam) +static SDL_Scancode +WindowsScanCodeToSDLScanCode( LPARAM lParam, WPARAM wParam ) { - int i; - BYTE scancode = (BYTE) ((lParam >> 16) & 0xFF); + SDL_Scancode code; + char bIsExtended; + int nScanCode = ( lParam >> 16 ) & 0xFF; - /* Windows remaps alphabetic keys based on current layout. - We try to provide USB scancodes, so undo this mapping. - */ - if (wParam >= 'A' && wParam <= 'Z') { - if (scancode != alpha_scancodes[wParam - 'A']) { - for (i = 0; i < SDL_arraysize(alpha_scancodes); ++i) { - if (scancode == alpha_scancodes[i]) { - wParam = 'A' + i; - break; - } - } + /* 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; } } - /* Keypad keys are a little trickier, we always scan for them. - Keypad arrow keys have the same scancode as normal arrow keys, - except they don't have the extended bit (0x1000000) set. - */ - if (!(lParam & 0x1000000)) { - if (wParam == VK_DELETE) { - wParam = VK_DECIMAL; - } else { - for (i = 0; i < SDL_arraysize(keypad_scancodes); ++i) { - if (scancode == keypad_scancodes[i]) { - wParam = VK_NUMPAD0 + i; - break; - } - } + 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 wParam; + return code; +} + + +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); + } +} + +/* +* 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 +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; + } +} + + +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; + } } LRESULT CALLBACK @@ -131,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); @@ -165,6 +314,9 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) minimized = HIWORD(wParam); if (!minimized && (LOWORD(wParam) != WA_INACTIVE)) { + Uint32 mouseFlags; + SHORT keyState; + SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_SHOWN, 0, 0); SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_RESTORED, 0, 0); @@ -175,23 +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 ); - if(SDL_GetMouse()->relative_mode) { - LONG cx, cy; - RECT rect; - GetWindowRect(hwnd, &rect); + 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; - cx = (rect.left + rect.right) / 2; - cy = (rect.top + rect.bottom) / 2; + if(SDL_GetMouse()->relative_mode) { + LONG cx, cy; + RECT rect; + GetWindowRect(hwnd, &rect); - /* Make an absurdly small clip rect */ - rect.left = cx-1; - rect.right = cx+1; - rect.top = cy-1; - rect.bottom = cy+1; + cx = (rect.left + rect.right) / 2; + cy = (rect.top + rect.bottom) / 2; - ClipCursor(&rect); - } + /* 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 @@ -210,77 +379,81 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) returnCode = 0; break; - case WM_MOUSEMOVE: - if(SDL_GetMouse()->relative_mode) - break; - SDL_SendMouseMotion(data->window, 0, LOWORD(lParam), HIWORD(lParam)); - break; - - case WM_INPUT: - { - HRAWINPUT hRawInput = (HRAWINPUT)lParam; - RAWINPUT inp; - UINT size = sizeof(inp); - 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, 1, (int)mouse->lLastX, (int)mouse->lLastY); - - } - break; - } - - case WM_LBUTTONDOWN: - SDL_SendMouseButton(data->window, SDL_PRESSED, SDL_BUTTON_LEFT); - 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: - SDL_SendMouseButton(data->window, SDL_RELEASED, SDL_BUTTON_LEFT); - break; - - case WM_RBUTTONDOWN: - SDL_SendMouseButton(data->window, SDL_PRESSED, SDL_BUTTON_RIGHT); - break; - case WM_RBUTTONUP: - SDL_SendMouseButton(data->window, SDL_RELEASED, SDL_BUTTON_RIGHT); - break; - - case WM_MBUTTONDOWN: - SDL_SendMouseButton(data->window, SDL_PRESSED, SDL_BUTTON_MIDDLE); - break; - case WM_MBUTTONUP: - SDL_SendMouseButton(data->window, SDL_RELEASED, SDL_BUTTON_MIDDLE); - break; - - case WM_XBUTTONDOWN: - SDL_SendMouseButton(data->window, SDL_PRESSED, SDL_BUTTON_X1 + GET_XBUTTON_WPARAM(wParam) - 1); - returnCode = TRUE; - break; - case WM_XBUTTONUP: - SDL_SendMouseButton(data->window, SDL_RELEASED, SDL_BUTTON_X1 + GET_XBUTTON_WPARAM(wParam) - 1); - returnCode = TRUE; + 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: { - int motion = (short) HIWORD(wParam); + /* 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, motion); + SDL_SendMouseWheel(data->window, 0, 0, motion); break; } #ifdef WM_MOUSELEAVE - /* FIXME: Do we need the SDL 1.2 hack to generate WM_MOUSELEAVE now? */ 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); } returnCode = 0; @@ -290,44 +463,9 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) case WM_SYSKEYDOWN: case WM_KEYDOWN: { - wParam = RemapVKEY(wParam, lParam); - switch (wParam) { - case VK_CONTROL: - if (lParam & EXTENDED_KEYMASK) - wParam = VK_RCONTROL; - else - wParam = VK_LCONTROL; - break; - case VK_SHIFT: - /* EXTENDED trick doesn't work here */ - { - Uint8 *state = SDL_GetKeyboardState(NULL); - if (state[SDL_SCANCODE_LSHIFT] == SDL_RELEASED - && (GetKeyState(VK_LSHIFT) & 0x8000)) { - wParam = VK_LSHIFT; - } else if (state[SDL_SCANCODE_RSHIFT] == SDL_RELEASED - && (GetKeyState(VK_RSHIFT) & 0x8000)) { - wParam = VK_RSHIFT; - } else { - /* Probably a key repeat */ - wParam = 256; - } - } - break; - case VK_MENU: - if (lParam & EXTENDED_KEYMASK) - wParam = VK_RMENU; - else - wParam = VK_LMENU; - break; - case VK_RETURN: - if (lParam & EXTENDED_KEYMASK) - wParam = VK_ENTER; - break; - } - if (wParam < 256) { - SDL_SendKeyboardKey(SDL_PRESSED, - data->videodata->key_layout[wParam]); + SDL_Scancode code = WindowsScanCodeToSDLScanCode( lParam, wParam ); + if ( code != SDL_SCANCODE_UNKNOWN ) { + SDL_SendKeyboardKey(SDL_PRESSED, code ); } } returnCode = 0; @@ -336,52 +474,13 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) case WM_SYSKEYUP: case WM_KEYUP: { - wParam = RemapVKEY(wParam, lParam); - switch (wParam) { - case VK_CONTROL: - if (lParam & EXTENDED_KEYMASK) - wParam = VK_RCONTROL; - else - wParam = VK_LCONTROL; - break; - case VK_SHIFT: - /* EXTENDED trick doesn't work here */ - { - Uint8 *state = SDL_GetKeyboardState(NULL); - if (state[SDL_SCANCODE_LSHIFT] == SDL_PRESSED - && !(GetKeyState(VK_LSHIFT) & 0x8000)) { - wParam = VK_LSHIFT; - } else if (state[SDL_SCANCODE_RSHIFT] == SDL_PRESSED - && !(GetKeyState(VK_RSHIFT) & 0x8000)) { - wParam = VK_RSHIFT; - } else { - /* Probably a key repeat */ - wParam = 256; - } + SDL_Scancode code = WindowsScanCodeToSDLScanCode( lParam, wParam ); + if ( code != SDL_SCANCODE_UNKNOWN ) { + if (code == SDL_SCANCODE_PRINTSCREEN && + SDL_GetKeyboardState(NULL)[code] == SDL_RELEASED) { + SDL_SendKeyboardKey(SDL_PRESSED, code); } - break; - case VK_MENU: - if (lParam & EXTENDED_KEYMASK) - wParam = VK_RMENU; - else - wParam = VK_LMENU; - break; - case VK_RETURN: - if (lParam & EXTENDED_KEYMASK) - wParam = VK_ENTER; - break; - } - - /* Windows only reports keyup for print screen */ - if (wParam == VK_SNAPSHOT - && SDL_GetKeyboardState(NULL)[SDL_SCANCODE_PRINTSCREEN] == - SDL_RELEASED) { - SDL_SendKeyboardKey(SDL_PRESSED, - data->videodata->key_layout[wParam]); - } - if (wParam < 256) { - SDL_SendKeyboardKey(SDL_RELEASED, - data->videodata->key_layout[wParam]); + SDL_SendKeyboardKey(SDL_RELEASED, code); } } returnCode = 0; @@ -427,8 +526,10 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) int x, y; int w, h; int min_w, min_h; + int max_w, max_h; int style; BOOL menu; + BOOL constrain_max_size; /* If we allow resizing, let the resize happen naturally */ if (SDL_IsShapedWindow(data->window)) @@ -442,11 +543,19 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) /* Calculate current size of our window */ SDL_GetWindowSize(data->window, &w, &h); 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; + if (max_w && max_h) { + max_w -= w; + max_h -= h; + constrain_max_size = TRUE; + } else { + constrain_max_size = FALSE; + } size.top = 0; size.left = 0; @@ -469,6 +578,10 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) if (SDL_GetWindowFlags(data->window) & SDL_WINDOW_RESIZABLE) { info->ptMinTrackSize.x = w + min_w; info->ptMinTrackSize.y = h + min_h; + if (constrain_max_size) { + info->ptMaxTrackSize.x = w + max_w; + info->ptMaxTrackSize.y = h + max_h; + } } else { info->ptMaxSize.x = w; info->ptMaxSize.y = h; @@ -567,70 +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; + 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; + 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]; + for (i = 0; i < num_inputs; ++i) { + PTOUCHINPUT input = &inputs[i]; - const SDL_TouchID touchId = (SDL_TouchID) - ((size_t)input->hSource); - if (!SDL_GetTouch(touchId)) { - SDL_Touch touch; + const SDL_TouchID touchId = (SDL_TouchID)input->hSource; + if (!SDL_GetTouch(touchId)) { + if (SDL_AddTouch(touchId, "") < 0) { + continue; + } + } - touch.id = touchId; - touch.x_min = 0; - touch.x_max = 1; - touch.native_xres = touch.x_max - touch.x_min; - touch.y_min = 0; - touch.y_max = 1; - touch.native_yres = touch.y_max - touch.y_min; - touch.pressure_min = 0; - touch.pressure_max = 1; - touch.native_pressureres = touch.pressure_max - touch.pressure_min; + /* 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 (SDL_AddTouch(&touch, "") < 0) { - continue; - } - } + 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); - // 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_SendFingerDown(touchId, input->dwID, SDL_TRUE, x, y, 1); - } - if (input->dwFlags & TOUCHEVENTF_MOVE) { - SDL_SendTouchMotion(touchId, input->dwID, SDL_FALSE, x, y, 1); - } - if (input->dwFlags & TOUCHEVENTF_UP) { - SDL_SendFingerDown(touchId, input->dwID, SDL_FALSE, x, y, 1); - } - } - } - SDL_stack_free(inputs); - - data->videodata->CloseTouchInputHandle((HTOUCHINPUT)lParam); - return 0; - } - break; + data->videodata->CloseTouchInputHandle((HTOUCHINPUT)lParam); + return 0; + } + break; case WM_DROPFILES: { @@ -719,12 +818,11 @@ SDL_RegisterApp(char *name, Uint32 style, void *hInst) class.cbWndExtra = 0; class.cbClsExtra = 0; if (!RegisterClass(&class)) { - SDL_SetError("Couldn't register application class"); - return (-1); + return SDL_SetError("Couldn't register application class"); } app_registered = 1; - return (0); + return 0; } /* Unregisters the windowclass registered in SDL_RegisterApp above. */ diff --git a/src/eepp/helper/SDL2/src/video/windows/SDL_windowsevents.h b/src/eepp/helper/SDL2/src/video/windows/SDL_windowsevents.h index 38a847c3f..4fc146e76 100644 --- a/src/eepp/helper/SDL2/src/video/windows/SDL_windowsevents.h +++ b/src/eepp/helper/SDL2/src/video/windows/SDL_windowsevents.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/video/windows/SDL_windowsframebuffer.c b/src/eepp/helper/SDL2/src/video/windows/SDL_windowsframebuffer.c index 5efab7662..93af4c5e8 100644 --- a/src/eepp/helper/SDL2/src/video/windows/SDL_windowsframebuffer.c +++ b/src/eepp/helper/SDL2/src/video/windows/SDL_windowsframebuffer.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -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); @@ -85,15 +85,14 @@ int WIN_CreateWindowFramebuffer(_THIS, SDL_Window * window, Uint32 * format, voi SDL_stack_free(info); if (!data->hbm) { - WIN_SetError("Unable to create DIB"); - return -1; + return WIN_SetError("Unable to create DIB"); } SelectObject(data->mdc, data->hbm); return 0; } -int WIN_UpdateWindowFramebuffer(_THIS, SDL_Window * window, SDL_Rect * rects, int numrects) +int WIN_UpdateWindowFramebuffer(_THIS, SDL_Window * window, const SDL_Rect * rects, int numrects) { SDL_WindowData *data = (SDL_WindowData *) window->driverdata; diff --git a/src/eepp/helper/SDL2/src/video/windows/SDL_windowsframebuffer.h b/src/eepp/helper/SDL2/src/video/windows/SDL_windowsframebuffer.h index 33411c7f1..4d7a2ba0d 100644 --- a/src/eepp/helper/SDL2/src/video/windows/SDL_windowsframebuffer.h +++ b/src/eepp/helper/SDL2/src/video/windows/SDL_windowsframebuffer.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,7 +21,7 @@ #include "SDL_config.h" extern int WIN_CreateWindowFramebuffer(_THIS, SDL_Window * window, Uint32 * format, void ** pixels, int *pitch); -extern int WIN_UpdateWindowFramebuffer(_THIS, SDL_Window * window, SDL_Rect * rects, int numrects); +extern int WIN_UpdateWindowFramebuffer(_THIS, SDL_Window * window, const SDL_Rect * rects, int numrects); extern void WIN_DestroyWindowFramebuffer(_THIS, SDL_Window * window); /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/eepp/helper/SDL2/src/video/windows/SDL_windowskeyboard.c b/src/eepp/helper/SDL2/src/video/windows/SDL_windowskeyboard.c index 182741bdd..b9b342df0 100644 --- a/src/eepp/helper/SDL2/src/video/windows/SDL_windowskeyboard.c +++ b/src/eepp/helper/SDL2/src/video/windows/SDL_windowskeyboard.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -48,49 +48,10 @@ static void IME_Quit(SDL_VideoData *videodata); #endif /* Alphabetic scancodes for PC keyboards */ -BYTE alpha_scancodes[26] = { - 30, 48, 46, 32, 18, 33, 34, 35, 23, 36, 37, 38, 50, 49, 24, - 25, 16, 19, 31, 20, 22, 47, 17, 45, 21, 44 -}; - -BYTE keypad_scancodes[10] = { - 82, 79, 80, 81, 75, 76, 77, 71, 72, 73 -}; - void WIN_InitKeyboard(_THIS) { SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; - int i; - - /* Make sure the alpha scancodes are correct. T isn't usually remapped */ - if (MapVirtualKey('T', MAPVK_VK_TO_VSC) != alpha_scancodes['T' - 'A']) { -#if 0 - printf - ("Fixing alpha scancode map, assuming US QWERTY layout!\nPlease send the following 26 lines of output to the SDL mailing list , including a description of your keyboard hardware.\n"); -#endif - for (i = 0; i < SDL_arraysize(alpha_scancodes); ++i) { - alpha_scancodes[i] = MapVirtualKey('A' + i, MAPVK_VK_TO_VSC); -#if 0 - printf("%d = %d\n", i, alpha_scancodes[i]); -#endif - } - } - if (MapVirtualKey(VK_NUMPAD0, MAPVK_VK_TO_VSC) != keypad_scancodes[0]) { -#if 0 - printf - ("Fixing keypad scancode map!\nPlease send the following 10 lines of output to the SDL mailing list , including a description of your keyboard hardware.\n"); -#endif - for (i = 0; i < SDL_arraysize(keypad_scancodes); ++i) { - keypad_scancodes[i] = - MapVirtualKey(VK_NUMPAD0 + i, MAPVK_VK_TO_VSC); -#if 0 - printf("%d = %d\n", i, keypad_scancodes[i]); -#endif - } - } - - data->key_layout = windows_scancode_table; data->ime_com_initialized = SDL_FALSE; data->ime_threadmgr = 0; @@ -153,21 +114,35 @@ WIN_UpdateKeymap() SDL_GetDefaultKeymap(keymap); for (i = 0; i < SDL_arraysize(windows_scancode_table); i++) { - + int vk; /* Make sure this scancode is a valid character scancode */ scancode = windows_scancode_table[i]; - if (scancode == SDL_SCANCODE_UNKNOWN || keymap[scancode] >= 127) { + if (scancode == SDL_SCANCODE_UNKNOWN ) { continue; } - /* Alphabetic keys are handled specially, since Windows remaps them */ - if (i >= 'A' && i <= 'Z') { - BYTE vsc = alpha_scancodes[i - 'A']; - keymap[scancode] = MapVirtualKey(vsc, MAPVK_VSC_TO_VK) + 0x20; - } else { - keymap[scancode] = (MapVirtualKey(i, MAPVK_VK_TO_CHAR) & 0x7FFF); + /* If this key is one of the non-mappable keys, ignore it */ + /* Don't allow the number keys right above the qwerty row to translate or the top left key (grave/backquote) */ + /* Not mapping numbers fixes the French layout, giving numeric keycodes for the number keys, which is the expected behavior */ + if ((keymap[scancode] & SDLK_SCANCODE_MASK) || + scancode == SDL_SCANCODE_GRAVE || + (scancode >= SDL_SCANCODE_1 && scancode <= SDL_SCANCODE_0) ) { + continue; + } + + vk = MapVirtualKey(i, MAPVK_VSC_TO_VK); + if ( vk ) { + int ch = (MapVirtualKey( vk, MAPVK_VK_TO_CHAR ) & 0x7FFF); + if ( ch ) { + if ( ch >= 'A' && ch <= 'Z' ) { + keymap[scancode] = SDLK_a + ( ch - 'A' ); + } else { + keymap[scancode] = ch; + } + } } } + SDL_SetKeymap(0, keymap, SDL_NUM_SCANCODES); } @@ -212,6 +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; } @@ -1050,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); @@ -1077,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); } @@ -1370,7 +1351,6 @@ IME_RenderCandidateList(SDL_VideoData *videodata, HDC hdc) SIZE candsizes[MAX_CANDLIST]; SIZE maxcandsize = {0}; HBITMAP hbm = NULL; - BYTE *bits = NULL; const int candcount = SDL_min(SDL_min(MAX_CANDLIST, videodata->ime_candcount), videodata->ime_candpgsize); SDL_bool vertical = videodata->ime_candvertical; @@ -1452,7 +1432,7 @@ IME_RenderCandidateList(SDL_VideoData *videodata, HDC hdc) ; } - bits = StartDrawToBitmap(hdc, &hbm, size.cx, size.cy); + StartDrawToBitmap(hdc, &hbm, size.cx, size.cy); SelectObject(hdc, listpen); SelectObject(hdc, listbrush); @@ -1531,7 +1511,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/eepp/helper/SDL2/src/video/windows/SDL_windowskeyboard.h b/src/eepp/helper/SDL2/src/video/windows/SDL_windowskeyboard.h index 1eff39665..c79d1d0ff 100644 --- a/src/eepp/helper/SDL2/src/video/windows/SDL_windowskeyboard.h +++ b/src/eepp/helper/SDL2/src/video/windows/SDL_windowskeyboard.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -23,9 +23,6 @@ #ifndef _SDL_windowskeyboard_h #define _SDL_windowskeyboard_h -extern BYTE alpha_scancodes[26]; -extern BYTE keypad_scancodes[10]; - extern void WIN_InitKeyboard(_THIS); extern void WIN_UpdateKeymap(void); extern void WIN_QuitKeyboard(_THIS); diff --git a/src/eepp/helper/SDL2/src/video/windows/SDL_windowsmessagebox.c b/src/eepp/helper/SDL2/src/video/windows/SDL_windowsmessagebox.c index bb5eaaf24..bbe79237f 100644 --- a/src/eepp/helper/SDL2/src/video/windows/SDL_windowsmessagebox.c +++ b/src/eepp/helper/SDL2/src/video/windows/SDL_windowsmessagebox.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -26,11 +26,45 @@ #include "SDL_windowsvideo.h" +#ifndef SS_EDITCONTROL +#define SS_EDITCONTROL 0x2000 +#endif + /* Display a Windows message box */ +#pragma pack(push, 1) + typedef struct { - LPDLGTEMPLATE lpDialog; + 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; +} DLGITEMTEMPLATEEX; + +#pragma pack(pop) + +typedef struct +{ + DLGTEMPLATEEX* lpDialog; Uint8 *data; size_t size; size_t used; @@ -42,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: @@ -70,11 +104,11 @@ static SDL_bool ExpandDialogSpace(WIN_DialogData *dialog, size_t space) } dialog->data = data; dialog->size = size; - dialog->lpDialog = (LPDLGTEMPLATE)dialog->data; + dialog->lpDialog = (DLGTEMPLATEEX*)dialog->data; } return SDL_TRUE; } - + static SDL_bool AlignDialogData(WIN_DialogData *dialog, size_t size) { size_t padding = (dialog->used % size); @@ -128,21 +162,35 @@ static SDL_bool AddDialogString(WIN_DialogData *dialog, const char *string) return status; } +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... */ + + *x = MulDiv(*x, 4, s_BaseUnitsX); + *y = MulDiv(*y, 8, s_BaseUnitsY); +} + + static SDL_bool AddDialogControl(WIN_DialogData *dialog, WORD type, DWORD style, DWORD exStyle, int x, int y, int w, int h, int id, const char *caption) { - DLGITEMTEMPLATE item; + DLGITEMTEMPLATEEX item; WORD marker = 0xFFFF; WORD extraData = 0; SDL_zero(item); item.style = style; - item.dwExtendedStyle = exStyle; + item.exStyle = exStyle; item.x = x; item.y = y; item.cx = w; item.cy = h; item.id = id; + Vec2ToDLU(&item.x, &item.y); + Vec2ToDLU(&item.cx, &item.cy); + if (!AlignDialogData(dialog, sizeof(DWORD))) { return SDL_FALSE; } @@ -161,14 +209,14 @@ static SDL_bool AddDialogControl(WIN_DialogData *dialog, WORD type, DWORD style, if (!AddDialogData(dialog, &extraData, sizeof(extraData))) { return SDL_FALSE; } - ++dialog->lpDialog->cdit; + ++dialog->lpDialog->cDlgItems; return SDL_TRUE; } static SDL_bool AddDialogStatic(WIN_DialogData *dialog, int x, int y, int w, int h, const char *text) { - DWORD style = WS_VISIBLE | WS_CHILD | SS_LEFT | SS_NOPREFIX; + DWORD style = WS_VISIBLE | WS_CHILD | SS_LEFT | SS_NOPREFIX | SS_EDITCONTROL; return AddDialogControl(dialog, 0x0082, style, 0, x, y, w, h, -1, text); } @@ -194,14 +242,18 @@ static void FreeDialogData(WIN_DialogData *dialog) static WIN_DialogData *CreateDialogData(int w, int h, const char *caption) { WIN_DialogData *dialog; - DLGTEMPLATE dialogTemplate; + DLGTEMPLATEEX dialogTemplate; + WORD WordToPass; SDL_zero(dialogTemplate); - dialogTemplate.style = (WS_CAPTION | DS_CENTER); + dialogTemplate.dlgVer = 1; + dialogTemplate.signature = 0xffff; + dialogTemplate.style = (WS_CAPTION | DS_CENTER | DS_SHELLFONT); dialogTemplate.x = 0; dialogTemplate.y = 0; dialogTemplate.cx = w; dialogTemplate.cy = h; + Vec2ToDLU(&dialogTemplate.cx, &dialogTemplate.cy); dialog = (WIN_DialogData *)SDL_calloc(1, sizeof(*dialog)); if (!dialog) { @@ -213,17 +265,76 @@ static WIN_DialogData *CreateDialogData(int w, int h, const char *caption) return NULL; } - /* There is no menu or special class */ - if (!AddDialogString(dialog, "") || !AddDialogString(dialog, "")) { + /* No menu */ + WordToPass = 0; + if (!AddDialogData(dialog, &WordToPass, 2)) { FreeDialogData(dialog); return NULL; } + /* No custom class */ + if (!AddDialogData(dialog, &WordToPass, 2)) { + FreeDialogData(dialog); + return NULL; + } + + /* title */ if (!AddDialogString(dialog, caption)) { FreeDialogData(dialog); return NULL; } + /* Font stuff */ + { + /* + * 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. */ + { + HDC ScreenDC = GetDC(0); + WordToPass = (WORD)(-72 * NCM.lfMessageFont.lfHeight / GetDeviceCaps(ScreenDC, LOGPIXELSY)); + ReleaseDC(0, ScreenDC); + } + + if (!AddDialogData(dialog, &WordToPass, 2)) { + FreeDialogData(dialog); + return NULL; + } + + /* Font weight */ + WordToPass = (WORD)NCM.lfMessageFont.lfWeight; + if (!AddDialogData(dialog, &WordToPass, 2)) { + FreeDialogData(dialog); + return NULL; + } + + /* italic? */ + ToPass = NCM.lfMessageFont.lfItalic; + if (!AddDialogData(dialog, &ToPass, 1)) { + FreeDialogData(dialog); + return NULL; + } + + /* charset? */ + ToPass = NCM.lfMessageFont.lfCharSet; + if (!AddDialogData(dialog, &ToPass, 1)) { + FreeDialogData(dialog); + return NULL; + } + + /* font typeface. */ + if (!AddDialogString(dialog, NCM.lfMessageFont.lfFaceName)) { + FreeDialogData(dialog); + return NULL; + } + } + return dialog; } @@ -231,29 +342,114 @@ int WIN_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid) { WIN_DialogData *dialog; - int i, x, y, w, h, gap, which; + int i, x, y, which; const SDL_MessageBoxButtonData *buttons = messageboxdata->buttons; - - /* FIXME: Need a better algorithm for laying out the message box */ + HFONT DialogFont; + SIZE Size; + RECT TextSize; + wchar_t* wmessage; + TEXTMETRIC TM; - dialog = CreateDialogData(570, 260, messageboxdata->title); + + const int ButtonWidth = 88; + 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. + */ + HDC FontDC = CreateCompatibleDC(0); + + { + /* Create a duplicate of the font used in system message boxes. */ + LOGFONT lf; + NONCLIENTMETRICS NCM; + NCM.cbSize = sizeof(NCM); + SystemParametersInfo(SPI_GETNONCLIENTMETRICS, 0, &NCM, 0); + lf = NCM.lfMessageFont; + DialogFont = CreateFontIndirect(&lf); + } + + /* Select the font in to our DC */ + SelectObject(FontDC, DialogFont); + + { + /* 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. */ + wmessage = WIN_UTF8ToString(messageboxdata->message); + SDL_zero(TextSize); + Size.cx = DrawText(FontDC, wmessage, -1, &TextSize, DT_CALCRECT); + + /* Add some padding for hangs, etc. */ + TextSize.right += 2; + TextSize.bottom += 2; + + /* 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. */ + 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. */ + if (Size.cx < messageboxdata->numbuttons * (ButtonWidth + ButtonMargin) + ButtonMargin) + Size.cx = messageboxdata->numbuttons * (ButtonWidth + ButtonMargin) + ButtonMargin; + + /* Add vertical space for the buttons and border. */ + Size.cy += ButtonHeight + TextMargin; + + dialog = CreateDialogData(Size.cx, Size.cy, messageboxdata->title); if (!dialog) { return -1; } - w = 100; - h = 25; - gap = 10; - x = gap; - y = 50; - - if (!AddDialogStatic(dialog, x, y, 550, 100, messageboxdata->message)) { + if (!AddDialogStatic(dialog, TextMargin, TextMargin, TextSize.right - TextSize.left, TextSize.bottom - TextSize.top, messageboxdata->message)) { FreeDialogData(dialog); return -1; } - y += 110; - + /* Align the buttons to the right/bottom. */ + x = Size.cx - ButtonWidth - ButtonMargin; + y = Size.cy - ButtonHeight - ButtonMargin; for (i = 0; i < messageboxdata->numbuttons; ++i) { SDL_bool isDefault; @@ -262,15 +458,15 @@ WIN_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid) } else { isDefault = SDL_FALSE; } - if (!AddDialogButton(dialog, x, y, w, h, buttons[i].text, i, isDefault)) { + if (!AddDialogButton(dialog, x, y, ButtonWidth, ButtonHeight, buttons[i].text, i, isDefault)) { FreeDialogData(dialog); return -1; } - x += w + gap; + x -= ButtonWidth + ButtonMargin; } /* FIXME: If we have a parent window, get the Instance and HWND for them */ - which = DialogBoxIndirect(NULL, dialog->lpDialog, NULL, (DLGPROC)MessageBoxDialogProc); + which = DialogBoxIndirect(NULL, (DLGTEMPLATE*)dialog->lpDialog, NULL, (DLGPROC)MessageBoxDialogProc); *buttonid = buttons[which].buttonid; FreeDialogData(dialog); diff --git a/src/eepp/helper/SDL2/src/video/windows/SDL_windowsmessagebox.h b/src/eepp/helper/SDL2/src/video/windows/SDL_windowsmessagebox.h index 29c3eb850..8780a2e86 100644 --- a/src/eepp/helper/SDL2/src/video/windows/SDL_windowsmessagebox.h +++ b/src/eepp/helper/SDL2/src/video/windows/SDL_windowsmessagebox.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/video/windows/SDL_windowsmodes.c b/src/eepp/helper/SDL2/src/video/windows/SDL_windowsmodes.c index 9e844aa43..73cae8f37 100644 --- a/src/eepp/helper/SDL2/src/video/windows/SDL_windowsmodes.c +++ b/src/eepp/helper/SDL2/src/video/windows/SDL_windowsmodes.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -127,6 +127,7 @@ WIN_AddDisplay(LPTSTR DeviceName) SDL_VideoDisplay display; SDL_DisplayData *displaydata; SDL_DisplayMode mode; + DISPLAY_DEVICE device; #ifdef DEBUG_MODES printf("Display: %s\n", WIN_StringToUTF8(DeviceName)); @@ -143,10 +144,15 @@ WIN_AddDisplay(LPTSTR DeviceName) sizeof(displaydata->DeviceName)); SDL_zero(display); + device.cb = sizeof(device); + if (EnumDisplayDevices(DeviceName, 0, &device, 0)) { + display.name = WIN_StringToUTF8(device.DeviceString); + } display.desktop_mode = mode; display.current_mode = mode; display.driverdata = displaydata; SDL_AddVideoDisplay(&display); + SDL_free(display.name); return SDL_TRUE; } @@ -208,8 +214,7 @@ WIN_InitModes(_THIS) } } if (_this->num_displays == 0) { - SDL_SetError("No displays available"); - return -1; + return SDL_SetError("No displays available"); } return 0; } @@ -240,6 +245,7 @@ WIN_GetDisplayModes(_THIS, SDL_VideoDisplay * display) } if (SDL_ISPIXELFORMAT_INDEXED(mode.format)) { /* We don't support palettized modes now */ + SDL_free(mode.driverdata); continue; } if (mode.format != SDL_PIXELFORMAT_UNKNOWN) { @@ -247,6 +253,9 @@ WIN_GetDisplayModes(_THIS, SDL_VideoDisplay * display) SDL_free(mode.driverdata); } } + else { + SDL_free(mode.driverdata); + } } } @@ -276,8 +285,7 @@ WIN_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode) reason = "DISP_CHANGE_FAILED"; break; } - SDL_SetError("ChangeDisplaySettingsEx() failed: %s", reason); - return -1; + return SDL_SetError("ChangeDisplaySettingsEx() failed: %s", reason); } EnumDisplaySettings(displaydata->DeviceName, ENUM_CURRENT_SETTINGS, &data->DeviceMode); return 0; diff --git a/src/eepp/helper/SDL2/src/video/windows/SDL_windowsmodes.h b/src/eepp/helper/SDL2/src/video/windows/SDL_windowsmodes.h index 4d8dcc955..fd622d56c 100644 --- a/src/eepp/helper/SDL2/src/video/windows/SDL_windowsmodes.h +++ b/src/eepp/helper/SDL2/src/video/windows/SDL_windowsmodes.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/video/windows/SDL_windowsmouse.c b/src/eepp/helper/SDL2/src/video/windows/SDL_windowsmouse.c index 3b3b95f85..d61c8b6bb 100644 --- a/src/eepp/helper/SDL2/src/video/windows/SDL_windowsmouse.c +++ b/src/eepp/helper/SDL2/src/video/windows/SDL_windowsmouse.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -180,45 +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) { - SDL_Unsupported(); - return -1; - } - } + /* 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; } @@ -229,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; @@ -241,6 +240,12 @@ WIN_InitMouse(_THIS) void WIN_QuitMouse(_THIS) { + SDL_Mouse *mouse = SDL_GetMouse(); + if ( mouse->def_cursor ) { + SDL_free(mouse->def_cursor); + mouse->def_cursor = NULL; + mouse->cur_cursor = NULL; + } } #endif /* SDL_VIDEO_DRIVER_WINDOWS */ diff --git a/src/eepp/helper/SDL2/src/video/windows/SDL_windowsmouse.h b/src/eepp/helper/SDL2/src/video/windows/SDL_windowsmouse.h index e5c5b07fb..c63eee698 100644 --- a/src/eepp/helper/SDL2/src/video/windows/SDL_windowsmouse.h +++ b/src/eepp/helper/SDL2/src/video/windows/SDL_windowsmouse.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/video/windows/SDL_windowsopengl.c b/src/eepp/helper/SDL2/src/video/windows/SDL_windowsopengl.c index f6029f6e5..573b08796 100644 --- a/src/eepp/helper/SDL2/src/video/windows/SDL_windowsopengl.c +++ b/src/eepp/helper/SDL2/src/video/windows/SDL_windowsopengl.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -91,8 +91,7 @@ WIN_GL_LoadLibrary(_THIS, const char *path) char message[1024]; SDL_snprintf(message, SDL_arraysize(message), "LoadLibrary(\"%s\")", path); - WIN_SetError(message); - return -1; + return WIN_SetError(message); } SDL_strlcpy(_this->gl_config.driver_path, path, SDL_arraysize(_this->gl_config.driver_path)); @@ -103,8 +102,7 @@ WIN_GL_LoadLibrary(_THIS, const char *path) sizeof(struct SDL_GLDriverData)); if (!_this->gl_data) { - SDL_OutOfMemory(); - return -1; + return SDL_OutOfMemory(); } /* Load function pointers */ @@ -124,9 +122,8 @@ WIN_GL_LoadLibrary(_THIS, const char *path) !_this->gl_data->wglCreateContext || !_this->gl_data->wglDeleteContext || !_this->gl_data->wglMakeCurrent) { - SDL_SetError("Could not retrieve OpenGL functions"); SDL_UnloadObject(handle); - return -1; + return SDL_SetError("Could not retrieve OpenGL functions"); } return 0; @@ -506,18 +503,16 @@ 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); } if (!pixel_format) { - SDL_SetError("No matching GL pixel format available"); - return -1; + return SDL_SetError("No matching GL pixel format available"); } if (!SetPixelFormat(hdc, pixel_format, &pfd)) { - WIN_SetError("SetPixelFormat()"); - return (-1); + return WIN_SetError("SetPixelFormat()"); } return 0; } @@ -535,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); @@ -563,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); @@ -611,11 +606,9 @@ int WIN_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context) { HDC hdc; - int status; if (!_this->gl_data) { - SDL_SetError("OpenGL not initialized"); - return -1; + return SDL_SetError("OpenGL not initialized"); } if (window) { @@ -624,30 +617,24 @@ WIN_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context) hdc = NULL; } if (!_this->gl_data->wglMakeCurrent(hdc, (HGLRC) context)) { - WIN_SetError("wglMakeCurrent()"); - status = -1; - } else { - status = 0; + return WIN_SetError("wglMakeCurrent()"); } - return status; + return 0; } int WIN_GL_SetSwapInterval(_THIS, int interval) { - int retval = -1; if ((interval < 0) && (!_this->gl_data->HAS_WGL_EXT_swap_control_tear)) { - SDL_SetError("Negative swap interval unsupported in this GL"); + return SDL_SetError("Negative swap interval unsupported in this GL"); } else if (_this->gl_data->wglSwapIntervalEXT) { - if (_this->gl_data->wglSwapIntervalEXT(interval) == TRUE) { - retval = 0; - } else { - WIN_SetError("wglSwapIntervalEXT()"); + if (_this->gl_data->wglSwapIntervalEXT(interval) != TRUE) { + return WIN_SetError("wglSwapIntervalEXT()"); } } else { - SDL_Unsupported(); + return SDL_Unsupported(); } - return retval; + return 0; } int diff --git a/src/eepp/helper/SDL2/src/video/windows/SDL_windowsopengl.h b/src/eepp/helper/SDL2/src/video/windows/SDL_windowsopengl.h index 31b25ec3c..36da7ba89 100644 --- a/src/eepp/helper/SDL2/src/video/windows/SDL_windowsopengl.h +++ b/src/eepp/helper/SDL2/src/video/windows/SDL_windowsopengl.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/video/windows/SDL_windowsshape.c b/src/eepp/helper/SDL2/src/video/windows/SDL_windowsshape.c index f49ff8057..fdbcdfc76 100644 --- a/src/eepp/helper/SDL2/src/video/windows/SDL_windowsshape.c +++ b/src/eepp/helper/SDL2/src/video/windows/SDL_windowsshape.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -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/eepp/helper/SDL2/src/video/windows/SDL_windowsshape.h b/src/eepp/helper/SDL2/src/video/windows/SDL_windowsshape.h index 612c68c20..06aaea11e 100644 --- a/src/eepp/helper/SDL2/src/video/windows/SDL_windowsshape.h +++ b/src/eepp/helper/SDL2/src/video/windows/SDL_windowsshape.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -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/eepp/helper/SDL2/src/video/windows/SDL_windowsvideo.c b/src/eepp/helper/SDL2/src/video/windows/SDL_windowsvideo.c index b044e6d2a..883cafae4 100644 --- a/src/eepp/helper/SDL2/src/video/windows/SDL_windowsvideo.c +++ b/src/eepp/helper/SDL2/src/video/windows/SDL_windowsvideo.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -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); @@ -75,20 +75,20 @@ WIN_CreateDevice(int devindex) data = NULL; } if (!data) { - SDL_OutOfMemory(); if (device) { SDL_free(device); } + SDL_OutOfMemory(); return NULL; } 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; @@ -121,11 +121,12 @@ WIN_CreateDevice(int devindex) device->CreateWindowFramebuffer = WIN_CreateWindowFramebuffer; 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/eepp/helper/SDL2/src/video/windows/SDL_windowsvideo.h b/src/eepp/helper/SDL2/src/video/windows/SDL_windowsvideo.h index 2be2d2563..0943708b5 100644 --- a/src/eepp/helper/SDL2/src/video/windows/SDL_windowsvideo.h +++ b/src/eepp/helper/SDL2/src/video/windows/SDL_windowsvideo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -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,14 +115,13 @@ typedef struct SDL_VideoData { int render; - const SDL_Scancode *key_layout; - 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/eepp/helper/SDL2/src/video/windows/SDL_windowswindow.c b/src/eepp/helper/SDL2/src/video/windows/SDL_windowswindow.c index bb6a786a9..1e41182e4 100644 --- a/src/eepp/helper/SDL2/src/video/windows/SDL_windowswindow.c +++ b/src/eepp/helper/SDL2/src/video/windows/SDL_windowswindow.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -82,14 +82,13 @@ SetupWindowData(_THIS, SDL_Window * window, HWND hwnd, SDL_bool created) /* Allocate the window data */ data = (SDL_WindowData *) SDL_malloc(sizeof(*data)); if (!data) { - SDL_OutOfMemory(); - return -1; + return SDL_OutOfMemory(); } data->window = window; data->hwnd = hwnd; data->hdc = GetDC(hwnd); data->created = created; - data->mouse_pressed = SDL_FALSE; + data->mouse_button_flags = 0; data->videodata = videodata; window->driverdata = data; @@ -98,8 +97,7 @@ SetupWindowData(_THIS, SDL_Window * window, HWND hwnd, SDL_bool created) if (!SetProp(hwnd, TEXT("SDL_WindowData"), data)) { ReleaseDC(hwnd, data->hdc); SDL_free(data); - WIN_SetError("SetProp() failed"); - return -1; + return WIN_SetError("SetProp() failed"); } /* Set up the window proc function */ @@ -203,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 */ @@ -221,8 +219,7 @@ WIN_CreateWindow(_THIS, SDL_Window * window) CreateWindow(SDL_Appname, TEXT(""), style, x, y, w, h, NULL, NULL, SDL_Instance, NULL); if (!hwnd) { - WIN_SetError("Couldn't create window"); - return -1; + return WIN_SetError("Couldn't create window"); } WIN_PumpEvents(_this); @@ -354,7 +351,7 @@ WIN_SetWindowPositionInternal(_THIS, SDL_Window * window, UINT flags) int w, h; /* Figure out what the window area will be */ - if (window->flags & SDL_WINDOW_FULLSCREEN) { + 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; @@ -406,7 +403,7 @@ WIN_RaiseWindow(_THIS, SDL_Window * window) HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd; HWND top; - if (window->flags & SDL_WINDOW_FULLSCREEN) { + 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; @@ -467,11 +464,12 @@ WIN_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display, int x, y; int w, h; - if (fullscreen) { + 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; style |= GetWindowStyle(window); @@ -551,6 +549,23 @@ WIN_SetWindowGrab(_THIS, SDL_Window * window, SDL_bool grabbed) } else { 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); + } } void @@ -617,8 +632,7 @@ SDL_HelperWindowCreate(void) /* Register the class. */ SDL_HelperWindowClass = RegisterClass(&wce); if (SDL_HelperWindowClass == 0) { - WIN_SetError("Unable to create Helper Window Class"); - return -1; + return WIN_SetError("Unable to create Helper Window Class"); } /* Create the window. */ @@ -630,8 +644,7 @@ SDL_HelperWindowCreate(void) hInstance, NULL); if (SDL_HelperWindow == NULL) { UnregisterClass(SDL_HelperWindowClassName, hInstance); - WIN_SetError("Unable to create Helper Window"); - return -1; + return WIN_SetError("Unable to create Helper Window"); } return 0; @@ -665,6 +678,25 @@ SDL_HelperWindowDestroy(void) } } +void WIN_OnWindowEnter(_THIS, SDL_Window * window) +{ +#ifdef WM_MOUSELEAVE + SDL_WindowData *data = (SDL_WindowData *) window->driverdata; + TRACKMOUSEEVENT trackMouseEvent; + + if (!data || !data->hwnd) { + /* The window wasn't fully initialized */ + return; + } + + trackMouseEvent.cbSize = sizeof(TRACKMOUSEEVENT); + trackMouseEvent.dwFlags = TME_LEAVE; + trackMouseEvent.hwndTrack = data->hwnd; + + TrackMouseEvent(&trackMouseEvent); +#endif /* WM_MOUSELEAVE */ +} + #endif /* SDL_VIDEO_DRIVER_WINDOWS */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/eepp/helper/SDL2/src/video/windows/SDL_windowswindow.h b/src/eepp/helper/SDL2/src/video/windows/SDL_windowswindow.h index 542f6ea65..e85c20181 100644 --- a/src/eepp/helper/SDL2/src/video/windows/SDL_windowswindow.h +++ b/src/eepp/helper/SDL2/src/video/windows/SDL_windowswindow.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -32,7 +32,7 @@ typedef struct HBITMAP hbm; WNDPROC wndproc; SDL_bool created; - int mouse_pressed; + WPARAM mouse_button_flags; struct SDL_VideoData *videodata; } SDL_WindowData; @@ -56,6 +56,7 @@ extern void WIN_SetWindowGrab(_THIS, SDL_Window * window, SDL_bool grabbed); extern void WIN_DestroyWindow(_THIS, SDL_Window * window); extern SDL_bool WIN_GetWindowWMInfo(_THIS, SDL_Window * window, struct SDL_SysWMinfo *info); +extern void WIN_OnWindowEnter(_THIS, SDL_Window * window); #endif /* _SDL_windowswindow_h */ diff --git a/src/eepp/helper/SDL2/src/video/windows/wmmsg.h b/src/eepp/helper/SDL2/src/video/windows/wmmsg.h index 0c36cf82c..2cc7a843f 100644 --- a/src/eepp/helper/SDL2/src/video/windows/wmmsg.h +++ b/src/eepp/helper/SDL2/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/eepp/helper/SDL2/src/video/x11/SDL_x11clipboard.c b/src/eepp/helper/SDL2/src/video/x11/SDL_x11clipboard.c index 765dfa209..bdeb4da8a 100644 --- a/src/eepp/helper/SDL2/src/video/x11/SDL_x11clipboard.c +++ b/src/eepp/helper/SDL2/src/video/x11/SDL_x11clipboard.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -59,8 +59,7 @@ X11_SetClipboardText(_THIS, const char *text) /* Get the SDL window that will own the selection */ window = GetWindow(_this); if (window == None) { - SDL_SetError("Couldn't find a window to own the selection"); - return -1; + return SDL_SetError("Couldn't find a window to own the selection"); } /* Save the selection on the root window */ @@ -140,7 +139,7 @@ X11_GetClipboardText(_THIS) if (!text) { text = SDL_strdup(""); } - + return text; } @@ -152,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/eepp/helper/SDL2/src/video/x11/SDL_x11clipboard.h b/src/eepp/helper/SDL2/src/video/x11/SDL_x11clipboard.h index e658d67e4..999d163f7 100644 --- a/src/eepp/helper/SDL2/src/video/x11/SDL_x11clipboard.h +++ b/src/eepp/helper/SDL2/src/video/x11/SDL_x11clipboard.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/video/x11/SDL_x11dyn.c b/src/eepp/helper/SDL2/src/video/x11/SDL_x11dyn.c index 25b654d83..ab0eafb4d 100644 --- a/src/eepp/helper/SDL2/src/video/x11/SDL_x11dyn.c +++ b/src/eepp/helper/SDL2/src/video/x11/SDL_x11dyn.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -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 @@ -211,6 +211,12 @@ SDL_X11_LoadSymbols(void) } } #else +#define SDL_X11_MODULE(modname) SDL_X11_HAVE_##modname = 1; /* default yes */ +#define SDL_X11_SYM(a,fn,x,y,z) +#include "SDL_x11sym.h" +#undef SDL_X11_MODULE +#undef SDL_X11_SYM + #ifdef X_HAVE_UTF8_STRING pXCreateIC = XCreateIC; pXGetICValues = XGetICValues; diff --git a/src/eepp/helper/SDL2/src/video/x11/SDL_x11dyn.h b/src/eepp/helper/SDL2/src/video/x11/SDL_x11dyn.h index 5d2d9da16..2cebf3b8b 100644 --- a/src/eepp/helper/SDL2/src/video/x11/SDL_x11dyn.h +++ b/src/eepp/helper/SDL2/src/video/x11/SDL_x11dyn.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/video/x11/SDL_x11events.c b/src/eepp/helper/SDL2/src/video/x11/SDL_x11events.c index 480bb3149..025777aee 100644 --- a/src/eepp/helper/SDL2/src/video/x11/SDL_x11events.c +++ b/src/eepp/helper/SDL2/src/video/x11/SDL_x11events.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -41,12 +41,62 @@ #include -#ifdef SDL_INPUT_LINUXEV -//Touch Input/event* includes -#include -#include -#endif +typedef struct { + 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) +{ + unsigned char *ret=NULL; + Atom type; + int fmt; + unsigned long count; + unsigned long bytes_left; + 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; + p->type=type; +} + +/* Find text-uri-list in a list of targets and return it's atom + if available, else return None */ +static Atom X11_PickTarget(Display *disp, Atom list[], int list_count) +{ + Atom request = None; + char *name; + int i; + for (i=0; i < list_count && request == None; i++) { + name = XGetAtomName(disp, list[i]); + if (strcmp("text/uri-list", name)==0) request = list[i]; + XFree(name); + } + return request; +} + +/* Wrapper for X11_PickTarget for a maximum of three targets, a special + case in the Xdnd protocol */ +static Atom X11_PickTargetFromAtoms(Display *disp, Atom a0, Atom a1, Atom a2) +{ + int count=0; + Atom atom[3]; + if (a0 != None) atom[count++] = a0; + if (a1 != None) atom[count++] = a1; + if (a2 != None) atom[count++] = a2; + return X11_PickTarget(disp, atom, count); +} /*#define DEBUG_XEVENTS*/ /* Check to see if this is a repeated key. @@ -74,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) && @@ -98,14 +148,50 @@ static SDL_bool X11_IsWheelEvent(Display * display,XEvent * event,int * ticks) return SDL_FALSE; } +/* Convert URI to local filename + return filename if possible, else NULL +*/ +static char* X11_URIToLocal(char* uri) { + char *file = NULL; + + if (memcmp(uri,"file:/",6) == 0) uri += 6; /* local file? */ + else if (strstr(uri,":/") != NULL) return file; /* wrong scheme */ + + SDL_bool local = uri[0] != '/' || ( uri[0] != '\0' && uri[1] == '/' ); + + /* got a hostname? */ + if ( !local && uri[0] == '/' && uri[2] != '/' ) { + char* hostname_end = strchr( uri+1, '/' ); + if ( hostname_end != NULL ) { + char hostname[ 257 ]; + if ( gethostname( hostname, 255 ) == 0 ) { + hostname[ 256 ] = '\0'; + if ( memcmp( uri+1, hostname, hostname_end - ( uri+1 )) == 0 ) { + uri = hostname_end + 1; + local = SDL_TRUE; + } + } + } + } + if ( local ) { + file = uri; + if ( uri[1] == '/' ) { + file++; + } else { + file--; + } + } + return file; +} #if SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS static void X11_HandleGenericEvent(SDL_VideoData *videodata,XEvent event) { - XGenericEventCookie *cookie = &event.xcookie; - XGetEventData(videodata->display, cookie); - X11_HandleXinput2Event(videodata,cookie); - XFreeEventData(videodata->display,cookie); + if (XGetEventData(videodata->display, &event)) { + XGenericEventCookie *cookie = &event.xcookie; + X11_HandleXinput2Event(videodata, cookie); + XFreeEventData(videodata->display, cookie); + } } #endif /* SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS */ @@ -225,6 +311,10 @@ X11_DispatchEvent(_THIS) printf("Mode: NotifyUngrab\n"); #endif SDL_SetMouseFocus(data->window); + + if (!SDL_GetMouse()->relative_mode) { + SDL_SendMouseMotion(data->window, 0, 0, xevent.xcrossing.x, xevent.xcrossing.y); + } } break; /* Losing mouse coverage? */ @@ -239,6 +329,10 @@ X11_DispatchEvent(_THIS) if (xevent.xcrossing.mode == NotifyUngrab) printf("Mode: NotifyUngrab\n"); #endif + if (!SDL_GetMouse()->relative_mode) { + SDL_SendMouseMotion(data->window, 0, 0, xevent.xcrossing.x, xevent.xcrossing.y); + } + if (xevent.xcrossing.mode != NotifyGrab && xevent.xcrossing.mode != NotifyUngrab && xevent.xcrossing.detail != NotifyInferior) { @@ -263,7 +357,13 @@ X11_DispatchEvent(_THIS) /* We want to reset the keyboard here, because we may have missed keyboard messages after our previous FocusOut. */ - SDL_ResetKeyboard(); + /* Actually, if we do this we clear the ALT key on Unity + because it briefly takes focus for their dashboard. + + I think it's better to think the ALT key is held down + when it's not, then always lose the ALT modifier on Unity. + */ + /*SDL_ResetKeyboard();*/ } data->pending_focus = PENDING_FOCUS_IN; data->pending_focus_time = SDL_GetTicks() + PENDING_FOCUS_IN_TIME; @@ -406,7 +506,68 @@ X11_DispatchEvent(_THIS) /* Have we been requested to quit (or another client message?) */ case ClientMessage:{ - if ((xevent.xclient.message_type == videodata->WM_PROTOCOLS) && + + 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]; + xdnd_version = ( xevent.xclient.data.l[1] >> 24); + if (use_list) { + /* fetch conversion targets */ + SDL_x11Prop p; + X11_ReadProperty(&p, display, data->xdnd_source, videodata->XdndTypeList); + /* pick one */ + data->xdnd_req = X11_PickTarget(display, (Atom*)p.data, p.count); + XFree(p.data); + } else { + /* pick from list of three */ + data->xdnd_req = X11_PickTargetFromAtoms(display, xevent.xclient.data.l[2], xevent.xclient.data.l[3], xevent.xclient.data.l[4]); + } + } + else if (xevent.xclient.message_type == videodata->XdndPosition) { + + /* reply with status */ + XClientMessageEvent m; + memset(&m, 0, sizeof(XClientMessageEvent)); + m.type = ClientMessage; + m.display = xevent.xclient.display; + m.window = xevent.xclient.data.l[0]; + m.message_type = videodata->XdndStatus; + m.format=32; + m.data.l[0] = data->xwindow; + m.data.l[1] = (data->xdnd_req != None); + 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); + } + else if(xevent.xclient.message_type == videodata->XdndDrop) { + if (data->xdnd_req == None) { + /* say again - not interested! */ + XClientMessageEvent m; + memset(&m, 0, sizeof(XClientMessageEvent)); + m.type = ClientMessage; + m.display = xevent.xclient.display; + m.window = xevent.xclient.data.l[0]; + m.message_type = videodata->XdndFinished; + m.format=32; + m.data.l[0] = data->xwindow; + m.data.l[1] = 0; + m.data.l[2] = None; /* fail! */ + XSendEvent(display, xevent.xclient.data.l[0], False, NoEventMask, (XEvent*)&m); + } else { + /* convert */ + if(xdnd_version >= 1) { + 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); + } + } + } + else if ((xevent.xclient.message_type == videodata->WM_PROTOCOLS) && (xevent.xclient.format == 32) && (xevent.xclient.data.l[0] == videodata->_NET_WM_PING)) { Window root = DefaultRootWindow(display); @@ -442,30 +603,29 @@ 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); #endif - SDL_SendMouseMotion(data->window, 0, xevent.xmotion.x, xevent.xmotion.y); + SDL_SendMouseMotion(data->window, 0, 0, xevent.xmotion.x, xevent.xmotion.y); } } break; case ButtonPress:{ int ticks = 0; - if (X11_IsWheelEvent(display,&xevent,&ticks) == SDL_TRUE) { - SDL_SendMouseWheel(data->window, 0, ticks); - } - else { - SDL_SendMouseButton(data->window, SDL_PRESSED, xevent.xbutton.button); + if (X11_IsWheelEvent(display,&xevent,&ticks)) { + SDL_SendMouseWheel(data->window, 0, 0, ticks); + } else { + SDL_SendMouseButton(data->window, 0, SDL_PRESSED, xevent.xbutton.button); } } break; case ButtonRelease:{ - SDL_SendMouseButton(data->window, SDL_RELEASED, xevent.xbutton.button); + SDL_SendMouseButton(data->window, 0, SDL_RELEASED, xevent.xbutton.button); } break; @@ -590,11 +750,19 @@ X11_DispatchEvent(_THIS) XA_CUT_BUFFER0, 0, INT_MAX/4, False, req->target, &sevent.xselection.target, &seln_format, &nbytes, &overflow, &seln_data) == Success) { + Atom XA_TARGETS = XInternAtom(display, "TARGETS", 0); if (sevent.xselection.target == req->target) { XChangeProperty(display, req->requestor, req->property, sevent.xselection.target, seln_format, PropModeReplace, seln_data, nbytes); sevent.xselection.property = req->property; + } else if (XA_TARGETS == req->target) { + Atom SupportedFormats[] = { sevent.xselection.target, XA_TARGETS }; + XChangeProperty(display, req->requestor, req->property, + XA_ATOM, 32, PropModeReplace, + (unsigned char*)SupportedFormats, + sizeof(SupportedFormats)/sizeof(*SupportedFormats)); + sevent.xselection.property = req->property; } XFree(seln_data); } @@ -608,7 +776,66 @@ X11_DispatchEvent(_THIS) printf("window %p: SelectionNotify (requestor = %ld, target = %ld)\n", data, xevent.xselection.requestor, xevent.xselection.target); #endif - videodata->selection_waiting = SDL_FALSE; + Atom target = xevent.xselection.target; + if (target == data->xdnd_req) { + + /* 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; + char *scan = (char*)p.data; + char *fn; + char *uri; + int length = 0; + while (p.count--) { + if (!expect_lf) { + if (*scan==0x0D) { + expect_lf = SDL_TRUE; + } else if(start == NULL) { + start = scan; + length = 0; + } + length++; + } else { + if (*scan==0x0A && length>0) { + uri = malloc(length--); + memcpy(uri, start, length); + uri[length] = 0; + fn = X11_URIToLocal(uri); + if (fn) SDL_SendDropFile(fn); + free(uri); + } + expect_lf = SDL_FALSE; + start = NULL; + } + scan++; + } + } + + XFree(p.data); + + /* send reply */ + XClientMessageEvent m; + memset(&m, 0, sizeof(XClientMessageEvent)); + m.type = ClientMessage; + m.display = display; + m.window = data->xdnd_source; + m.message_type = videodata->XdndFinished; + m.format=32; + m.data.l[0] = data->xwindow; + 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; @@ -675,7 +902,7 @@ X11_Pending(Display * display) /* !!! FIXME: this should be exposed in a header, or something. */ int SDL_GetNumTouch(void); - +void SDL_dbus_screensaver_tickle(_THIS); void X11_PumpEvents(_THIS) @@ -688,9 +915,14 @@ X11_PumpEvents(_THIS) if (!data->screensaver_activity || (int) (now - data->screensaver_activity) >= 30000) { XResetScreenSaver(data->display); + + #if SDL_USE_LIBDBUS + SDL_dbus_screensaver_tickle(_this); + #endif + data->screensaver_activity = now; } - } + } /* Keep processing pending events */ while (X11_Pending(data->display)) { @@ -699,119 +931,8 @@ X11_PumpEvents(_THIS) /* FIXME: Only need to do this when there are pending focus changes */ X11_HandleFocusChanges(_this); - - /*Dont process evtouch events if XInput2 multitouch is supported*/ - if(X11_Xinput2IsMultitouchSupported()) { - return; - } - -#ifdef SDL_INPUT_LINUXEV - /* Process Touch events*/ - int i = 0,rd; - struct input_event ev[64]; - int size = sizeof (struct input_event); - -/* !!! FIXME: clean the tabstops out of here. */ - for(i = 0;i < SDL_GetNumTouch();++i) { - SDL_Touch* touch = SDL_GetTouchIndex(i); - if(!touch) printf("Touch %i/%i DNE\n",i,SDL_GetNumTouch()); - EventTouchData* data; - data = (EventTouchData*)(touch->driverdata); - if(data == NULL) { - printf("No driver data\n"); - continue; - } - if(data->eventStream <= 0) - printf("Error: Couldn't open stream\n"); - rd = read(data->eventStream, ev, size * 64); - if(rd >= size) { - for (i = 0; i < rd / sizeof(struct input_event); i++) { - switch (ev[i].type) { - case EV_ABS: - switch (ev[i].code) { - case ABS_X: - data->x = ev[i].value; - break; - case ABS_Y: - data->y = ev[i].value; - break; - case ABS_PRESSURE: - data->pressure = ev[i].value; - if(data->pressure < 0) data->pressure = 0; - break; - case ABS_MISC: - if(ev[i].value == 0) - data->up = SDL_TRUE; - break; - } - break; - case EV_MSC: - if(ev[i].code == MSC_SERIAL) - data->finger = ev[i].value; - break; - case EV_KEY: - if(ev[i].code == BTN_TOUCH) - if(ev[i].value == 0) - data->up = SDL_TRUE; - break; - case EV_SYN: - if(!data->down) { - data->down = SDL_TRUE; - SDL_SendFingerDown(touch->id,data->finger, - data->down, data->x, data->y, - data->pressure); - } - else if(!data->up) - SDL_SendTouchMotion(touch->id,data->finger, - SDL_FALSE, data->x,data->y, - data->pressure); - else - { - data->down = SDL_FALSE; - SDL_SendFingerDown(touch->id,data->finger, - data->down, data->x,data->y, - data->pressure); - data->x = -1; - data->y = -1; - data->pressure = -1; - data->finger = 0; - data->up = SDL_FALSE; - } - break; - } - } - } - } -#endif } -/* This is so wrong it hurts */ -#define GNOME_SCREENSAVER_HACK -#ifdef GNOME_SCREENSAVER_HACK -#include -static pid_t screensaver_inhibit_pid; -static void -gnome_screensaver_disable() -{ - screensaver_inhibit_pid = fork(); - if (screensaver_inhibit_pid == 0) { - close(0); - close(1); - close(2); - execl("/usr/bin/gnome-screensaver-command", - "gnome-screensaver-command", - "--inhibit", - "--reason", - "GNOME screensaver doesn't respect MIT-SCREEN-SAVER", NULL); - exit(2); - } -} -static void -gnome_screensaver_enable() -{ - kill(screensaver_inhibit_pid, 15); -} -#endif void X11_SuspendScreenSaver(_THIS) @@ -835,11 +956,9 @@ X11_SuspendScreenSaver(_THIS) } #endif -#ifdef GNOME_SCREENSAVER_HACK +#if SDL_USE_LIBDBUS if (_this->suspend_screensaver) { - gnome_screensaver_disable(); - } else { - gnome_screensaver_enable(); + SDL_dbus_screensaver_tickle(_this); } #endif } diff --git a/src/eepp/helper/SDL2/src/video/x11/SDL_x11events.h b/src/eepp/helper/SDL2/src/video/x11/SDL_x11events.h index 0b9af47bd..3b6117559 100644 --- a/src/eepp/helper/SDL2/src/video/x11/SDL_x11events.h +++ b/src/eepp/helper/SDL2/src/video/x11/SDL_x11events.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/video/x11/SDL_x11framebuffer.c b/src/eepp/helper/SDL2/src/video/x11/SDL_x11framebuffer.c index ca8ef33e4..4dfe0d174 100644 --- a/src/eepp/helper/SDL2/src/video/x11/SDL_x11framebuffer.c +++ b/src/eepp/helper/SDL2/src/video/x11/SDL_x11framebuffer.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -68,20 +68,17 @@ X11_CreateWindowFramebuffer(_THIS, SDL_Window * window, Uint32 * format, gcv.graphics_exposures = False; data->gc = XCreateGC(display, data->xwindow, GCGraphicsExposures, &gcv); if (!data->gc) { - SDL_SetError("Couldn't create graphics context"); - return -1; + return SDL_SetError("Couldn't create graphics context"); } /* Find out the pixel format and depth */ if (X11_GetVisualInfoFromVisual(display, data->visual, &vinfo) < 0) { - SDL_SetError("Couldn't get window visual information"); - return -1; + return SDL_SetError("Couldn't get window visual information"); } *format = X11_GetPixelFormatFromVisualInfo(display, &vinfo); if (*format == SDL_PIXELFORMAT_UNKNOWN) { - SDL_SetError("Unknown window pixel format"); - return -1; + return SDL_SetError("Unknown window pixel format"); } /* Calculate pitch */ @@ -114,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); @@ -132,23 +129,21 @@ X11_CreateWindowFramebuffer(_THIS, SDL_Window * window, Uint32 * format, *pixels = SDL_malloc(window->h*(*pitch)); if (*pixels == NULL) { - SDL_OutOfMemory(); - return -1; + return SDL_OutOfMemory(); } 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); - SDL_SetError("Couldn't create XImage"); - return -1; + return SDL_SetError("Couldn't create XImage"); } return 0; } int -X11_UpdateWindowFramebuffer(_THIS, SDL_Window * window, SDL_Rect * rects, +X11_UpdateWindowFramebuffer(_THIS, SDL_Window * window, const SDL_Rect * rects, int numrects) { SDL_WindowData *data = (SDL_WindowData *) window->driverdata; diff --git a/src/eepp/helper/SDL2/src/video/x11/SDL_x11framebuffer.h b/src/eepp/helper/SDL2/src/video/x11/SDL_x11framebuffer.h index 39d9d71ec..8e4c21ae7 100644 --- a/src/eepp/helper/SDL2/src/video/x11/SDL_x11framebuffer.h +++ b/src/eepp/helper/SDL2/src/video/x11/SDL_x11framebuffer.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,7 +25,7 @@ extern int X11_CreateWindowFramebuffer(_THIS, SDL_Window * window, Uint32 * format, void ** pixels, int *pitch); extern int X11_UpdateWindowFramebuffer(_THIS, SDL_Window * window, - SDL_Rect * rects, int numrects); + const SDL_Rect * rects, int numrects); extern void X11_DestroyWindowFramebuffer(_THIS, SDL_Window * window); /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/eepp/helper/SDL2/src/video/x11/SDL_x11keyboard.c b/src/eepp/helper/SDL2/src/video/x11/SDL_x11keyboard.c index 142b96baf..eae2f3d0f 100644 --- a/src/eepp/helper/SDL2/src/video/x11/SDL_x11keyboard.c +++ b/src/eepp/helper/SDL2/src/video/x11/SDL_x11keyboard.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/video/x11/SDL_x11keyboard.h b/src/eepp/helper/SDL2/src/video/x11/SDL_x11keyboard.h index 28a0c539c..5a0231151 100644 --- a/src/eepp/helper/SDL2/src/video/x11/SDL_x11keyboard.h +++ b/src/eepp/helper/SDL2/src/video/x11/SDL_x11keyboard.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/video/x11/SDL_x11messagebox.c b/src/eepp/helper/SDL2/src/video/x11/SDL_x11messagebox.c index e7d71e1d8..38867f06a 100644 --- a/src/eepp/helper/SDL2/src/video/x11/SDL_x11messagebox.c +++ b/src/eepp/helper/SDL2/src/video/x11/SDL_x11messagebox.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -31,7 +31,8 @@ #include -#define SDL_FORK_MESSAGEBOX 1 +#define SDL_FORK_MESSAGEBOX 0 +#define SDL_SET_LOCALE 0 #if SDL_FORK_MESSAGEBOX #include @@ -50,11 +51,11 @@ static const char g_MessageBoxFontLatin1[] = "-*-*-medium-r-normal--0-120-*-*-p- static const char g_MessageBoxFont[] = "-*-*-*-*-*-*-*-*-*-*-*-*-*-*"; static const SDL_MessageBoxColor g_default_colors[ SDL_MESSAGEBOX_COLOR_MAX ] = { - { 56, 54, 53 }, // SDL_MESSAGEBOX_COLOR_BACKGROUND, - { 209, 207, 205 }, // SDL_MESSAGEBOX_COLOR_TEXT, - { 140, 135, 129 }, // SDL_MESSAGEBOX_COLOR_BUTTON_BORDER, - { 105, 102, 99 }, // SDL_MESSAGEBOX_COLOR_BUTTON_BACKGROUND, - { 205, 202, 53 }, // SDL_MESSAGEBOX_COLOR_BUTTON_SELECTED, + { 56, 54, 53 }, /* SDL_MESSAGEBOX_COLOR_BACKGROUND, */ + { 209, 207, 205 }, /* SDL_MESSAGEBOX_COLOR_TEXT, */ + { 140, 135, 129 }, /* SDL_MESSAGEBOX_COLOR_BUTTON_BORDER, */ + { 105, 102, 99 }, /* SDL_MESSAGEBOX_COLOR_BUTTON_BACKGROUND, */ + { 205, 202, 53 }, /* SDL_MESSAGEBOX_COLOR_BUTTON_SELECTED, */ }; #define SDL_MAKE_RGB( _r, _g, _b ) ( ( ( Uint32 )( _r ) << 16 ) | \ @@ -167,8 +168,7 @@ X11_MessageBoxInit( SDL_MessageBoxDataX11 *data, const SDL_MessageBoxData * mess const SDL_MessageBoxColor *colorhints; if ( numbuttons > MAX_BUTTONS ) { - SDL_SetError("Too many buttons (%d max allowed)", MAX_BUTTONS); - return -1; + return SDL_SetError("Too many buttons (%d max allowed)", MAX_BUTTONS); } data->dialog_width = MIN_DIALOG_WIDTH; @@ -180,8 +180,7 @@ X11_MessageBoxInit( SDL_MessageBoxDataX11 *data, const SDL_MessageBoxData * mess data->display = XOpenDisplay( NULL ); if ( !data->display ) { - SDL_SetError("Couldn't open X11 display"); - return -1; + return SDL_SetError("Couldn't open X11 display"); } if (SDL_X11_HAVE_UTF8) { @@ -193,14 +192,12 @@ X11_MessageBoxInit( SDL_MessageBoxDataX11 *data, const SDL_MessageBoxData * mess XFreeStringList(missing); } if ( data->font_set == NULL ) { - SDL_SetError("Couldn't load font %s", g_MessageBoxFont); - return -1; + return SDL_SetError("Couldn't load font %s", g_MessageBoxFont); } } else { data->font_struct = XLoadQueryFont( data->display, g_MessageBoxFontLatin1 ); if ( data->font_struct == NULL ) { - SDL_SetError("Couldn't load font %s", g_MessageBoxFontLatin1); - return -1; + return SDL_SetError("Couldn't load font %s", g_MessageBoxFontLatin1); } } @@ -250,6 +247,10 @@ X11_MessageBoxInitPositions( SDL_MessageBoxDataX11 *data ) data->text_height = IntMax( data->text_height, height ); text_width_max = IntMax( text_width_max, plinedata->width ); + if (lf && (lf > text) && (lf[-1] == '\r')) { + plinedata->length--; + } + text += plinedata->length + 1; /* Break if there are no more linefeeds. */ @@ -383,8 +384,7 @@ X11_MessageBoxCreateWindow( SDL_MessageBoxDataX11 *data ) 0, CopyFromParent, InputOutput, CopyFromParent, CWEventMask, &wnd_attr ); if ( data->window == None ) { - SDL_SetError("Couldn't create X window"); - return -1; + return SDL_SetError("Couldn't create X window"); } if ( windowdata ) { @@ -515,8 +515,7 @@ X11_MessageBoxLoop( SDL_MessageBoxDataX11 *data ) ctx = XCreateGC( data->display, data->window, gcflags, &ctx_vals ); if ( ctx == None ) { - SDL_SetError("Couldn't create graphics context"); - return -1; + return SDL_SetError("Couldn't create graphics context"); } data->button_press_index = -1; /* Reset what button is currently depressed. */ @@ -641,22 +640,25 @@ X11_ShowMessageBoxImpl(const SDL_MessageBoxData *messageboxdata, int *buttonid) { int ret; SDL_MessageBoxDataX11 data; +#if SDL_SET_LOCALE char *origlocale; +#endif SDL_zero(data); if ( !SDL_X11_LoadSymbols() ) return -1; +#if SDL_SET_LOCALE origlocale = setlocale(LC_ALL, NULL); if (origlocale != NULL) { origlocale = SDL_strdup(origlocale); if (origlocale == NULL) { - SDL_OutOfMemory(); - return -1; + return SDL_OutOfMemory(); } setlocale(LC_ALL, ""); } +#endif /* This code could get called from multiple threads maybe? */ XInitThreads(); @@ -678,10 +680,12 @@ X11_ShowMessageBoxImpl(const SDL_MessageBoxData *messageboxdata, int *buttonid) X11_MessageBoxShutdown( &data ); +#if SDL_SET_LOCALE if (origlocale) { setlocale(LC_ALL, origlocale); SDL_free(origlocale); } +#endif return ret; } @@ -696,6 +700,9 @@ 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); + if (pipe(fds) == -1) { return X11_ShowMessageBoxImpl(messageboxdata, buttonid); /* oh well. */ } @@ -725,8 +732,7 @@ X11_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid) SDL_assert(rc == pid); /* not sure what to do if this fails. */ if ((rc == -1) || (!WIFEXITED(status)) || (WEXITSTATUS(status) != 0)) { - SDL_SetError("msgbox child process failed"); - return -1; + return SDL_SetError("msgbox child process failed"); } if (read(fds[0], &status, sizeof (int)) != sizeof (int)) diff --git a/src/eepp/helper/SDL2/src/video/x11/SDL_x11messagebox.h b/src/eepp/helper/SDL2/src/video/x11/SDL_x11messagebox.h index 6f01c1d1d..9b270f821 100644 --- a/src/eepp/helper/SDL2/src/video/x11/SDL_x11messagebox.h +++ b/src/eepp/helper/SDL2/src/video/x11/SDL_x11messagebox.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/video/x11/SDL_x11modes.c b/src/eepp/helper/SDL2/src/video/x11/SDL_x11modes.c index a752d5f2a..b1da7370f 100644 --- a/src/eepp/helper/SDL2/src/video/x11/SDL_x11modes.c +++ b/src/eepp/helper/SDL2/src/video/x11/SDL_x11modes.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -24,6 +24,7 @@ #include "SDL_hints.h" #include "SDL_x11video.h" +#include "edid.h" /*#define X11MODES_DEBUG*/ @@ -34,8 +35,10 @@ * I can find. For example, on Unity 3D if you show a fullscreen window while * the resolution is changing (within ~250 ms) your window will retain the * fullscreen state hint but be decorated and windowed. + * + * However, many people swear by it, so let them swear at it. :) */ -#define XRANDR_DISABLED_BY_DEFAULT +/*#define XRANDR_DISABLED_BY_DEFAULT*/ static int @@ -427,6 +430,7 @@ X11_InitModes(_THIS) SDL_DisplayMode mode; SDL_DisplayModeData *modedata; XPixmapFormatValues *pixmapFormats; + char display_name[128]; int i, n; #if SDL_VIDEO_DRIVER_X11_XINERAMA @@ -449,6 +453,7 @@ X11_InitModes(_THIS) if (!displaydata) { continue; } + display_name[0] = '\0'; mode.format = X11_GetPixelFormatFromVisualInfo(data->display, &vinfo); if (SDL_ISPIXELFORMAT_INDEXED(mode.format)) { @@ -527,6 +532,12 @@ X11_InitModes(_THIS) XRROutputInfo *output_info; XRRCrtcInfo *crtc; int output; + Atom EDID = XInternAtom(data->display, "EDID", False); + Atom *props; + int nprop; + unsigned long width_mm; + unsigned long height_mm; + int inches = 0; for (output = 0; output < res->noutput; output++) { output_info = XRRGetOutputInfo(data->display, res, res->outputs[output]); @@ -551,6 +562,54 @@ X11_InitModes(_THIS) displaydata->xrandr_output = res->outputs[output]; SetXRandRModeInfo(data->display, res, output_info, crtc->mode, &mode); + /* Get the name of this display */ + width_mm = output_info->mm_width; + height_mm = output_info->mm_height; + inches = (int)((sqrt(width_mm * width_mm + + height_mm * height_mm) / 25.4f) + 0.5f); + SDL_strlcpy(display_name, output_info->name, sizeof(display_name)); + + /* See if we can get the EDID data for the real monitor name */ + props = XRRListOutputProperties(data->display, res->outputs[output], &nprop); + for (i = 0; i < nprop; ++i) { + unsigned char *prop; + int actual_format; + unsigned long nitems, bytes_after; + Atom actual_type; + + if (props[i] == EDID) { + if (XRRGetOutputProperty(data->display, + res->outputs[output], props[i], + 0, 100, False, False, + AnyPropertyType, + &actual_type, &actual_format, + &nitems, &bytes_after, &prop) == Success ) { + MonitorInfo *info = decode_edid(prop); + if (info) { + #ifdef X11MODES_DEBUG + printf("Found EDID data for %s\n", output_info->name); + dump_monitor_info(info); + #endif + SDL_strlcpy(display_name, info->dsc_product_name, sizeof(display_name)); + free(info); + } + XFree(prop); + } + break; + } + } + if (props) { + XFree(props); + } + + if (*display_name && inches) { + size_t len = SDL_strlen(display_name); + SDL_snprintf(&display_name[len], sizeof(display_name)-len, " %d\"", inches); + } +#ifdef X11MODES_DEBUG + printf("Display name: %s\n", display_name); +#endif + XRRFreeOutputInfo(output_info); XRRFreeCrtcInfo(crtc); break; @@ -583,6 +642,9 @@ X11_InitModes(_THIS) #endif /* SDL_VIDEO_DRIVER_X11_XVIDMODE */ SDL_zero(display); + if (*display_name) { + display.name = display_name; + } display.desktop_mode = mode; display.current_mode = mode; display.driverdata = displaydata; @@ -594,8 +656,7 @@ X11_InitModes(_THIS) #endif if (_this->num_displays == 0) { - SDL_SetError("No available displays"); - return -1; + return SDL_SetError("No available displays"); } return 0; } @@ -736,23 +797,20 @@ X11_SetDisplayMode(_THIS, SDL_VideoDisplay * sdl_display, SDL_DisplayMode * mode res = XRRGetScreenResources (display, RootWindow(display, data->screen)); if (!res) { - SDL_SetError("Couldn't get XRandR screen resources"); - return -1; + return SDL_SetError("Couldn't get XRandR screen resources"); } output_info = XRRGetOutputInfo(display, res, data->xrandr_output); if (!output_info || output_info->connection == RR_Disconnected) { - SDL_SetError("Couldn't get XRandR output info"); XRRFreeScreenResources(res); - return -1; + return SDL_SetError("Couldn't get XRandR output info"); } crtc = XRRGetCrtcInfo(display, res, output_info->crtc); if (!crtc) { - SDL_SetError("Couldn't get XRandR crtc info"); XRRFreeOutputInfo(output_info); XRRFreeScreenResources(res); - return -1; + return SDL_SetError("Couldn't get XRandR crtc info"); } status = XRRSetCrtcConfig (display, res, output_info->crtc, CurrentTime, @@ -764,8 +822,7 @@ X11_SetDisplayMode(_THIS, SDL_VideoDisplay * sdl_display, SDL_DisplayMode * mode XRRFreeScreenResources(res); if (status != Success) { - SDL_SetError("XRRSetCrtcConfig failed"); - return -1; + return SDL_SetError("XRRSetCrtcConfig failed"); } } #endif /* SDL_VIDEO_DRIVER_X11_XRANDR */ @@ -803,6 +860,7 @@ X11_GetDisplayBounds(_THIS, SDL_VideoDisplay * sdl_display, SDL_Rect * rect) if (xinerama) { rect->x = xinerama[data->xinerama_screen].x_org; rect->y = xinerama[data->xinerama_screen].y_org; + XFree(xinerama); } } #endif /* SDL_VIDEO_DRIVER_X11_XINERAMA */ diff --git a/src/eepp/helper/SDL2/src/video/x11/SDL_x11modes.h b/src/eepp/helper/SDL2/src/video/x11/SDL_x11modes.h index 5e2d016e8..5d9789c91 100644 --- a/src/eepp/helper/SDL2/src/video/x11/SDL_x11modes.h +++ b/src/eepp/helper/SDL2/src/video/x11/SDL_x11modes.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/video/x11/SDL_x11mouse.c b/src/eepp/helper/SDL2/src/video/x11/SDL_x11mouse.c index 40ac0c211..441ecdfe3 100644 --- a/src/eepp/helper/SDL2/src/video/x11/SDL_x11mouse.c +++ b/src/eepp/helper/SDL2/src/video/x11/SDL_x11mouse.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -129,8 +129,14 @@ X11_CreatePixmapCursor(SDL_Surface * surface, int hot_x, int hot_y) unsigned int width_bytes = ((surface->w + 7) & ~7) / 8; data_bits = SDL_calloc(1, surface->h * width_bytes); + if (!data_bits) { + SDL_OutOfMemory(); + return None; + } + mask_bits = SDL_calloc(1, surface->h * width_bytes); - if (!data_bits || !mask_bits) { + if (!mask_bits) { + SDL_free(data_bits); SDL_OutOfMemory(); return None; } @@ -188,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; } @@ -230,9 +236,9 @@ X11_CreateSystemCursor(SDL_SystemCursor id) default: SDL_assert(0); return NULL; - // X Font Cursors reference: - // http://tronche.com/gui/x/xlib/appendix/b/ - case SDL_SYSTEM_CURSOR_ARROW: shape = XC_arrow; break; + /* 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; case SDL_SYSTEM_CURSOR_CROSSHAIR: shape = XC_tcross; break; @@ -330,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/eepp/helper/SDL2/src/video/x11/SDL_x11mouse.h b/src/eepp/helper/SDL2/src/video/x11/SDL_x11mouse.h index 0187fb7ed..ee7a14afe 100644 --- a/src/eepp/helper/SDL2/src/video/x11/SDL_x11mouse.h +++ b/src/eepp/helper/SDL2/src/video/x11/SDL_x11mouse.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/video/x11/SDL_x11opengl.c b/src/eepp/helper/SDL2/src/video/x11/SDL_x11opengl.c index 2899ac288..1e1078eff 100644 --- a/src/eepp/helper/SDL2/src/video/x11/SDL_x11opengl.c +++ b/src/eepp/helper/SDL2/src/video/x11/SDL_x11opengl.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -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 -#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); @@ -136,8 +136,7 @@ X11_GL_LoadLibrary(_THIS, const char *path) void *handle; if (_this->gl_data) { - SDL_SetError("OpenGL context already created"); - return -1; + return SDL_SetError("OpenGL context already created"); } /* If SDL_GL_CONTEXT_EGL has been changed to 1, switch over to X11_GLES functions */ @@ -154,8 +153,7 @@ X11_GL_LoadLibrary(_THIS, const char *path) _this->GL_DeleteContext = X11_GLES_DeleteContext; return X11_GLES_LoadLibrary(_this, path); #else - SDL_SetError("SDL not configured with OpenGL ES/EGL support"); - return -1; + return SDL_SetError("SDL not configured with OpenGL ES/EGL support"); #endif } @@ -183,8 +181,7 @@ X11_GL_LoadLibrary(_THIS, const char *path) sizeof(struct SDL_GLDriverData)); if (!_this->gl_data) { - SDL_OutOfMemory(); - return -1; + return SDL_OutOfMemory(); } /* Load function pointers */ @@ -216,8 +213,7 @@ X11_GL_LoadLibrary(_THIS, const char *path) !_this->gl_data->glXDestroyContext || !_this->gl_data->glXMakeCurrent || !_this->gl_data->glXSwapBuffers) { - SDL_SetError("Could not retrieve OpenGL functions"); - return -1; + return SDL_SetError("Could not retrieve OpenGL functions"); } /* Initialize extensions */ @@ -332,7 +328,7 @@ X11_GL_InitExtensions(_THIS) _this->gl_data->HAS_GLX_EXT_swap_control_tear = SDL_FALSE; if (HasExtension("GLX_EXT_swap_control", extensions)) { _this->gl_data->glXSwapIntervalEXT = - (int (*)(Display*,GLXDrawable,int)) + (void (*)(Display*,GLXDrawable,int)) X11_GL_GetProcAddress(_this, "glXSwapIntervalEXT"); if (HasExtension("GLX_EXT_swap_control_tear", extensions)) { _this->gl_data->HAS_GLX_EXT_swap_control_tear = SDL_TRUE; @@ -373,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; } @@ -405,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; @@ -439,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) { @@ -460,8 +456,8 @@ X11_GL_GetAttributes(_THIS, Display * display, int screen, int * attribs, int si GLX_SLOW_VISUAL_EXT; } - // If we're supposed to use DirectColor visuals, and we've got the EXT_visual_info - // extension, then add GLX_X_VISUAL_TYPE_EXT. + /* If we're supposed to use DirectColor visuals, and we've got the + EXT_visual_info extension, then add GLX_X_VISUAL_TYPE_EXT. */ if (X11_UseDirectColorVisuals() && _this->gl_data->HAS_GLX_EXT_visual_info) { attribs[i++] = GLX_X_VISUAL_TYPE_EXT; @@ -471,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; } @@ -496,6 +492,33 @@ X11_GL_GetVisual(_THIS, Display * display, int screen) return vinfo; } +#ifndef GLXBadContext +#define GLXBadContext 0 +#endif +#ifndef GLXBadFBConfig +#define GLXBadFBConfig 9 +#endif +#ifndef GLXBadProfileARB +#define GLXBadProfileARB 13 +#endif +static int (*handler) (Display *, XErrorEvent *) = NULL; +static int +X11_GL_CreateContextErrorHandler(Display * d, XErrorEvent * e) +{ + switch (e->error_code) { + case GLXBadContext: + case GLXBadFBConfig: + case GLXBadProfileARB: + case BadRequest: + case BadMatch: + case BadValue: + case BadAlloc: + return (0); + default: + return (handler(d, e)); + } +} + SDL_GLContext X11_GL_CreateContext(_THIS, SDL_Window * window) { @@ -516,6 +539,7 @@ X11_GL_CreateContext(_THIS, SDL_Window * window) /* We do this to create a clean separation between X and GLX errors. */ XSync(display, False); + handler = XSetErrorHandler(X11_GL_CreateContextErrorHandler); XGetWindowAttributes(display, data->xwindow, &xattr); v.screen = screen; v.visualid = XVisualIDFromVisual(xattr.visual); @@ -532,10 +556,7 @@ X11_GL_CreateContext(_THIS, SDL_Window * window) context to grab the new context creation function */ GLXContext temp_context = _this->gl_data->glXCreateContext(display, vinfo, NULL, True); - if (!temp_context) { - SDL_SetError("Could not create GL context"); - return NULL; - } else { + if (temp_context) { /* max 8 attributes plus terminator */ int attribs[9] = { GLX_CONTEXT_MAJOR_VERSION_ARB, @@ -609,6 +630,7 @@ X11_GL_CreateContext(_THIS, SDL_Window * window) XFree(vinfo); } XSync(display, False); + XSetErrorHandler(handler); if (!context) { SDL_SetError("Could not create GL context"); @@ -628,26 +650,21 @@ X11_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context) { Display *display = ((SDL_VideoData *) _this->driverdata)->display; Window drawable = - (window ? ((SDL_WindowData *) window->driverdata)->xwindow : None); + (context ? ((SDL_WindowData *) window->driverdata)->xwindow : None); GLXContext glx_context = (GLXContext) context; - int status; if (!_this->gl_data) { - SDL_SetError("OpenGL not initialized"); - return -1; + return SDL_SetError("OpenGL not initialized"); } - status = 0; if (!_this->gl_data->glXMakeCurrent(display, drawable, glx_context)) { - SDL_SetError("Unable to make GL context current"); - status = -1; + return SDL_SetError("Unable to make GL context current"); } - XSync(display, False); - return (status); + 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 @@ -667,13 +684,23 @@ X11_GL_SetSwapInterval(_THIS, int interval) Display *display = ((SDL_VideoData *) _this->driverdata)->display; const SDL_WindowData *windowdata = (SDL_WindowData *) _this->current_glwin->driverdata; + Window drawable = windowdata->xwindow; - status = _this->gl_data->glXSwapIntervalEXT(display,drawable,interval); - if (status != 0) { - SDL_SetError("glxSwapIntervalEXT failed"); - } else { - swapinterval = interval; - } + + /* + * This is a workaround for a bug in NVIDIA drivers. Bug has been reported + * and will be fixed in a future release (probably 319.xx). + * + * There's a bug where glXSetSwapIntervalEXT ignores updates because + * it has the wrong value cached. To work around it, we just run a no-op + * update to the current value. + */ + int currentInterval = X11_GL_GetSwapInterval(_this); + _this->gl_data->glXSwapIntervalEXT(display, drawable, currentInterval); + _this->gl_data->glXSwapIntervalEXT(display, drawable, interval); + + status = 0; + swapinterval = interval; } else if (_this->gl_data->glXSwapIntervalMESA) { status = _this->gl_data->glXSwapIntervalMESA(interval); if (status != 0) { diff --git a/src/eepp/helper/SDL2/src/video/x11/SDL_x11opengl.h b/src/eepp/helper/SDL2/src/video/x11/SDL_x11opengl.h index a786b773e..69ad1c2b9 100644 --- a/src/eepp/helper/SDL2/src/video/x11/SDL_x11opengl.h +++ b/src/eepp/helper/SDL2/src/video/x11/SDL_x11opengl.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -40,7 +40,7 @@ struct SDL_GLDriverData Bool(*glXMakeCurrent) (Display*,GLXDrawable,GLXContext); void (*glXSwapBuffers) (Display*, GLXDrawable); void (*glXQueryDrawable) (Display*,GLXDrawable,int,unsigned int*); - int (*glXSwapIntervalEXT) (Display*,GLXDrawable,int); + void (*glXSwapIntervalEXT) (Display*,GLXDrawable,int); int (*glXSwapIntervalSGI) (int); int (*glXSwapIntervalMESA) (int); int (*glXGetSwapIntervalMESA) (void); diff --git a/src/eepp/helper/SDL2/src/video/x11/SDL_x11opengles.c b/src/eepp/helper/SDL2/src/video/x11/SDL_x11opengles.c index 6cced5e3f..218421b32 100644 --- a/src/eepp/helper/SDL2/src/video/x11/SDL_x11opengles.c +++ b/src/eepp/helper/SDL2/src/video/x11/SDL_x11opengles.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -32,12 +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) \ - { \ - SDL_SetError("Could not retrieve EGL function " #NAME); \ - return -1; \ - } + *((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 */ @@ -55,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); @@ -95,8 +94,7 @@ X11_GLES_LoadLibrary(_THIS, const char *path) SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; if (_this->gles_data) { - SDL_SetError("OpenGL ES context already created"); - return -1; + return SDL_SetError("OpenGL ES context already created"); } /* If SDL_GL_CONTEXT_EGL has been changed to 0, switch over to X11_GL functions */ @@ -113,8 +111,7 @@ X11_GLES_LoadLibrary(_THIS, const char *path) _this->GL_DeleteContext = X11_GL_DeleteContext; return X11_GL_LoadLibrary(_this, path); #else - SDL_SetError("SDL not configured with OpenGL/GLX support"); - return -1; + return SDL_SetError("SDL not configured with OpenGL/GLX support"); #endif } @@ -136,8 +133,7 @@ X11_GLES_LoadLibrary(_THIS, const char *path) } if (handle == NULL) { - SDL_SetError("Could not load OpenGL ES/EGL library"); - return -1; + return SDL_SetError("Could not load OpenGL ES/EGL library"); } /* Unload the old driver and reset the pointers */ @@ -145,8 +141,7 @@ X11_GLES_LoadLibrary(_THIS, const char *path) _this->gles_data = (struct SDL_PrivateGLESData *) SDL_calloc(1, sizeof(SDL_PrivateGLESData)); if (!_this->gles_data) { - SDL_OutOfMemory(); - return -1; + return SDL_OutOfMemory(); } /* Load new function pointers */ @@ -168,15 +163,13 @@ X11_GLES_LoadLibrary(_THIS, const char *path) _this->gles_data->eglGetDisplay((NativeDisplayType) data->display); if (!_this->gles_data->egl_display) { - SDL_SetError("Could not get EGL display"); - return -1; + return SDL_SetError("Could not get EGL display"); } if (_this->gles_data-> eglInitialize(_this->gles_data->egl_display, NULL, NULL) != EGL_TRUE) { - SDL_SetError("Could not initialize EGL"); - return -1; + return SDL_SetError("Could not initialize EGL"); } _this->gles_data->egl_dll_handle = handle; @@ -198,8 +191,7 @@ X11_GLES_LoadLibrary(_THIS, const char *path) } if (handle == NULL) { - SDL_SetError("Could not initialize OpenGL ES library"); - return -1; + return SDL_SetError("Could not initialize OpenGL ES library"); } _this->gl_config.dll_handle = handle; @@ -321,7 +313,7 @@ X11_GLES_CreateContext(_THIS, SDL_Window * window) SDL_WindowData *data = (SDL_WindowData *) window->driverdata; Display *display = data->videodata->display; - SDL_GLContext context = 1; + SDL_GLContext context = (SDL_GLContext)1; XSync(display, False); @@ -353,54 +345,51 @@ X11_GLES_CreateContext(_THIS, SDL_Window * window) int X11_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context) { - int retval; - -// SDL_WindowData *data = (SDL_WindowData *) window->driverdata; -// Display *display = data->videodata->display; +/* + SDL_WindowData *data = (SDL_WindowData *) window->driverdata; + Display *display = data->videodata->display; +*/ if (!_this->gles_data) { - SDL_SetError("OpenGL not initialized"); - return -1; + return SDL_SetError("OpenGL not initialized"); } - retval = 1; if (!_this->gles_data->eglMakeCurrent(_this->gles_data->egl_display, _this->gles_data->egl_surface, _this->gles_data->egl_surface, _this->gles_data->egl_context)) { - SDL_SetError("Unable to make EGL context current"); - retval = -1; + return SDL_SetError("Unable to make EGL context current"); } -// XSync(display, False); - return (retval); +/* + XSync(display, False); +*/ + + return 1; } int X11_GLES_SetSwapInterval(_THIS, int interval) { if (_this->gles_data) { - SDL_SetError("OpenGL ES context not active"); - return -1; + return SDL_SetError("OpenGL ES context not active"); } EGLBoolean status; 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; } - SDL_SetError("Unable to set the EGL swap interval"); - return -1; + return SDL_SetError("Unable to set the EGL swap interval"); } int X11_GLES_GetSwapInterval(_THIS) { if (_this->gles_data) { - SDL_SetError("OpenGL ES context not active"); - return -1; + return SDL_SetError("OpenGL ES context not active"); } return _this->gles_data->egl_swapinterval; @@ -417,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/eepp/helper/SDL2/src/video/x11/SDL_x11opengles.h b/src/eepp/helper/SDL2/src/video/x11/SDL_x11opengles.h index 3806b93aa..fa1506c76 100644 --- a/src/eepp/helper/SDL2/src/video/x11/SDL_x11opengles.h +++ b/src/eepp/helper/SDL2/src/video/x11/SDL_x11opengles.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/eepp/helper/SDL2/src/video/x11/SDL_x11shape.c b/src/eepp/helper/SDL2/src/video/x11/SDL_x11shape.c index ac889bfe3..cea280722 100644 --- a/src/eepp/helper/SDL2/src/video/x11/SDL_x11shape.c +++ b/src/eepp/helper/SDL2/src/video/x11/SDL_x11shape.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -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; @@ -72,19 +72,18 @@ X11_ResizeWindowShape(SDL_Window* window) { free(data->bitmap); data->bitmap = malloc(data->bitmapsize); if(data->bitmap == NULL) { - SDL_SetError("Could not allocate memory for shaped-window bitmap."); - return -1; + return SDL_SetError("Could not allocate memory for shaped-window bitmap."); } } 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) @@ -96,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/eepp/helper/SDL2/src/video/x11/SDL_x11shape.h b/src/eepp/helper/SDL2/src/video/x11/SDL_x11shape.h index df932cbd6..96b4a8b0a 100644 --- a/src/eepp/helper/SDL2/src/video/x11/SDL_x11shape.h +++ b/src/eepp/helper/SDL2/src/video/x11/SDL_x11shape.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -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/eepp/helper/SDL2/src/video/x11/SDL_x11sym.h b/src/eepp/helper/SDL2/src/video/x11/SDL_x11sym.h index 673142e3c..b6e99aa47 100644 --- a/src/eepp/helper/SDL2/src/video/x11/SDL_x11sym.h +++ b/src/eepp/helper/SDL2/src/video/x11/SDL_x11sym.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -265,6 +265,9 @@ SDL_X11_SYM(void,XRRFreeOutputInfo,(XRROutputInfo *outputInfo),(outputInfo),) SDL_X11_SYM(XRRCrtcInfo *,XRRGetCrtcInfo,(Display *dpy, XRRScreenResources *resources, RRCrtc crtc),(dpy,resources,crtc),return) SDL_X11_SYM(void,XRRFreeCrtcInfo,(XRRCrtcInfo *crtcInfo),(crtcInfo),) SDL_X11_SYM(Status,XRRSetCrtcConfig,(Display *dpy, XRRScreenResources *resources, RRCrtc crtc, Time timestamp, int x, int y, RRMode mode, Rotation rotation, RROutput *outputs, int noutputs),(dpy,resources,crtc,timestamp,x,y,mode,rotation,outputs,noutputs),return) +SDL_X11_SYM(Atom*,XRRListOutputProperties,(Display *dpy, RROutput output, int *nprop),(dpy,output,nprop),return) +SDL_X11_SYM(XRRPropertyInfo*,XRRQueryOutputProperty,(Display *dpy,RROutput output, Atom property),(dpy,output,property),return) +SDL_X11_SYM(int,XRRGetOutputProperty,(Display *dpy,RROutput output, Atom property, long offset, long length, Bool _delete, Bool pending, Atom req_type, Atom *actual_type, int *actual_format, unsigned long *nitems, unsigned long *bytes_after, unsigned char **prop),(dpy,output,property,offset,length, _delete, pending, req_type, actual_type, actual_format, nitems, bytes_after, prop),return) #endif /* MIT-SCREEN-SAVER support */ diff --git a/src/eepp/helper/SDL2/src/video/x11/SDL_x11touch.c b/src/eepp/helper/SDL2/src/video/x11/SDL_x11touch.c index 17927e392..a6ce98160 100644 --- a/src/eepp/helper/SDL2/src/video/x11/SDL_x11touch.c +++ b/src/eepp/helper/SDL2/src/video/x11/SDL_x11touch.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -28,97 +28,12 @@ #include "../../events/SDL_touch_c.h" -#ifdef SDL_INPUT_LINUXEV -#include -#include -#endif - void X11_InitTouch(_THIS) { - /*Initilized Xinput2 multitouch - * and return in order to not initialize - * evtouch also*/ - if(X11_Xinput2IsMultitouchSupported()) { + if (X11_Xinput2IsMultitouchSupported()) { X11_InitXinput2Multitouch(_this); - return; } -#ifdef SDL_INPUT_LINUXEV - FILE *fd; - fd = fopen("/proc/bus/input/devices","r"); - if (!fd) return; - - int i = 0; - int tsfd; - char line[256]; - char tstr[256]; - int vendor = -1,product = -1,event = -1; - while(!feof(fd)) { - if(fgets(line,256,fd) <=0) continue; - if(line[0] == '\n') { - if(vendor == 1386 || vendor==1) { - sprintf(tstr,"/dev/input/event%i",event); - - tsfd = open( tstr, O_RDONLY | O_NONBLOCK ); - if ( tsfd == -1 ) - continue; /* Maybe not enough permissions ? */ - - SDL_Touch touch; - touch.pressure_max = 0; - touch.pressure_min = 0; - touch.id = event; - - touch.driverdata = SDL_malloc(sizeof(EventTouchData)); - EventTouchData* data = (EventTouchData*)(touch.driverdata); - - data->x = -1; - data->y = -1; - data->pressure = -1; - data->finger = 0; - data->up = SDL_FALSE; - data->down = SDL_FALSE; - - data->eventStream = tsfd; - ioctl (data->eventStream, EVIOCGNAME (sizeof (tstr)), tstr); - - int abs[5]; - ioctl(data->eventStream,EVIOCGABS(0),abs); - touch.x_min = abs[1]; - touch.x_max = abs[2]; - touch.native_xres = touch.x_max - touch.x_min; - ioctl(data->eventStream,EVIOCGABS(ABS_Y),abs); - touch.y_min = abs[1]; - touch.y_max = abs[2]; - touch.native_yres = touch.y_max - touch.y_min; - ioctl(data->eventStream,EVIOCGABS(ABS_PRESSURE),abs); - touch.pressure_min = abs[1]; - touch.pressure_max = abs[2]; - touch.native_pressureres = touch.pressure_max - touch.pressure_min; - - SDL_AddTouch(&touch, tstr); - } - vendor = -1; - product = -1; - event = -1; - } - else if(line[0] == 'I') { - i = 1; - while(line[i]) { - sscanf(&line[i],"Vendor=%x",&vendor); - sscanf(&line[i],"Product=%x",&product); - i++; - } - } - else if(line[0] == 'H') { - i = 1; - while(line[i]) { - sscanf(&line[i],"event%d",&event); - i++; - } - } - } - fclose(fd); -#endif } void diff --git a/src/eepp/helper/SDL2/src/video/x11/SDL_x11touch.h b/src/eepp/helper/SDL2/src/video/x11/SDL_x11touch.h index 8fe20e5b0..ac451a857 100644 --- a/src/eepp/helper/SDL2/src/video/x11/SDL_x11touch.h +++ b/src/eepp/helper/SDL2/src/video/x11/SDL_x11touch.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -23,16 +23,6 @@ #ifndef _SDL_x11touch_h #define _SDL_x11touch_h -#ifdef SDL_INPUT_LINUXEV -typedef struct EventTouchData -{ - int x,y,pressure,finger; /* Temporary Variables until sync */ - int eventStream; - SDL_bool up; - SDL_bool down; -} EventTouchData; -#endif - extern void X11_InitTouch(_THIS); extern void X11_QuitTouch(_THIS); diff --git a/src/eepp/helper/SDL2/src/video/x11/SDL_x11video.c b/src/eepp/helper/SDL2/src/video/x11/SDL_x11video.c index 52a996a53..d12f87a7b 100644 --- a/src/eepp/helper/SDL2/src/video/x11/SDL_x11video.c +++ b/src/eepp/helper/SDL2/src/video/x11/SDL_x11video.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -32,13 +32,150 @@ #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 #include "SDL_x11opengles.h" #endif +/* !!! FIXME: move dbus stuff to somewhere under src/core/linux ... */ +#if SDL_USE_LIBDBUS +/* we never link directly to libdbus. */ +#include "SDL_loadso.h" +static const char *dbus_library = "libdbus-1.so.3"; +static void *dbus_handle = NULL; + +/* !!! FIXME: this is kinda ugly. */ +static SDL_bool +load_dbus_sym(const char *fn, void **addr) +{ + *addr = SDL_LoadFunction(dbus_handle, fn); + if (*addr == NULL) { + /* Don't call SDL_SetError(): SDL_LoadFunction already did. */ + return SDL_FALSE; + } + + return SDL_TRUE; +} + +/* libdbus entry points... */ +static DBusConnection *(*DBUS_dbus_bus_get_private)(DBusBusType, DBusError *) = NULL; +static void (*DBUS_dbus_connection_set_exit_on_disconnect)(DBusConnection *, dbus_bool_t) = NULL; +static dbus_bool_t (*DBUS_dbus_connection_send)(DBusConnection *, DBusMessage *, dbus_uint32_t *) = NULL; +static void (*DBUS_dbus_connection_close)(DBusConnection *) = NULL; +static void (*DBUS_dbus_connection_unref)(DBusConnection *) = NULL; +static void (*DBUS_dbus_connection_flush)(DBusConnection *) = NULL; +static DBusMessage *(*DBUS_dbus_message_new_method_call)(const char *, const char *, const char *, const char *) = NULL; +static void (*DBUS_dbus_message_unref)(DBusMessage *) = NULL; +static void (*DBUS_dbus_error_init)(DBusError *) = NULL; +static dbus_bool_t (*DBUS_dbus_error_is_set)(const DBusError *) = NULL; +static void (*DBUS_dbus_error_free)(DBusError *) = NULL; + +static int +load_dbus_syms(void) +{ + /* cast funcs to char* first, to please GCC's strict aliasing rules. */ + #define SDL_DBUS_SYM(x) \ + if (!load_dbus_sym(#x, (void **) (char *) &DBUS_##x)) return -1 + + SDL_DBUS_SYM(dbus_bus_get_private); + SDL_DBUS_SYM(dbus_connection_set_exit_on_disconnect); + SDL_DBUS_SYM(dbus_connection_send); + SDL_DBUS_SYM(dbus_connection_close); + SDL_DBUS_SYM(dbus_connection_unref); + SDL_DBUS_SYM(dbus_connection_flush); + SDL_DBUS_SYM(dbus_message_new_method_call); + SDL_DBUS_SYM(dbus_message_unref); + SDL_DBUS_SYM(dbus_error_init); + SDL_DBUS_SYM(dbus_error_is_set); + SDL_DBUS_SYM(dbus_error_free); + + #undef SDL_DBUS_SYM + + return 0; +} + +static void +UnloadDBUSLibrary(void) +{ + if (dbus_handle != NULL) { + SDL_UnloadObject(dbus_handle); + dbus_handle = NULL; + } +} + +static int +LoadDBUSLibrary(void) +{ + int retval = 0; + if (dbus_handle == NULL) { + dbus_handle = SDL_LoadObject(dbus_library); + if (dbus_handle == NULL) { + retval = -1; + /* Don't call SDL_SetError(): SDL_LoadObject already did. */ + } else { + retval = load_dbus_syms(); + if (retval < 0) { + UnloadDBUSLibrary(); + } + } + } + + return retval; +} + +static void +X11_InitDBus(_THIS) +{ + if (LoadDBUSLibrary() != -1) { + SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; + DBusError err; + DBUS_dbus_error_init(&err); + data->dbus = DBUS_dbus_bus_get_private(DBUS_BUS_SESSION, &err); + if (DBUS_dbus_error_is_set(&err)) { + DBUS_dbus_error_free(&err); + if (data->dbus) { + DBUS_dbus_connection_unref(data->dbus); + data->dbus = NULL; + } + return; /* oh well */ + } + DBUS_dbus_connection_set_exit_on_disconnect(data->dbus, 0); + } +} + +static void +X11_QuitDBus(_THIS) +{ + SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; + if (data->dbus) { + DBUS_dbus_connection_close(data->dbus); + DBUS_dbus_connection_unref(data->dbus); + data->dbus = NULL; + } +} + +void +SDL_dbus_screensaver_tickle(_THIS) +{ + const SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; + DBusConnection *conn = data->dbus; + if (conn != NULL) { + DBusMessage *msg = DBUS_dbus_message_new_method_call("org.gnome.ScreenSaver", + "/org/gnome/ScreenSaver", + "org.gnome.ScreenSaver", + "SimulateUserActivity"); + if (msg != NULL) { + if (DBUS_dbus_connection_send(conn, msg, NULL)) { + DBUS_dbus_connection_flush(conn); + } + DBUS_dbus_message_unref(msg); + } + } +} +#endif + /* Initialization/Query functions */ static int X11_VideoInit(_THIS); static void X11_VideoQuit(_THIS); @@ -156,8 +293,8 @@ X11_CreateDevice(int devindex) return NULL; } - // Need for threading gl calls. This is also required for the proprietary nVidia - // driver to be threaded. + /* Need for threading gl calls. This is also required for the proprietary + nVidia driver to be threaded. */ XInitThreads(); /* Initialize all variables that we clean on shutdown */ @@ -168,8 +305,8 @@ X11_CreateDevice(int devindex) } data = (struct SDL_VideoData *) SDL_calloc(1, sizeof(SDL_VideoData)); if (!data) { - SDL_OutOfMemory(); SDL_free(device); + SDL_OutOfMemory(); return NULL; } device->driverdata = data; @@ -349,6 +486,7 @@ X11_CheckWindowManager(_THIS) #endif } + int X11_VideoInit(_THIS) { @@ -384,7 +522,17 @@ X11_VideoInit(_THIS) GET_ATOM(_NET_WM_ICON_NAME); GET_ATOM(_NET_WM_ICON); GET_ATOM(_NET_WM_PING); + GET_ATOM(_NET_ACTIVE_WINDOW); GET_ATOM(UTF8_STRING); + GET_ATOM(PRIMARY); + GET_ATOM(XdndEnter); + GET_ATOM(XdndPosition); + GET_ATOM(XdndStatus); + GET_ATOM(XdndTypeList); + GET_ATOM(XdndActionCopy); + GET_ATOM(XdndDrop); + GET_ATOM(XdndFinished); + GET_ATOM(XdndSelection); /* Detect the window manager */ X11_CheckWindowManager(_this); @@ -401,6 +549,11 @@ X11_VideoInit(_THIS) X11_InitMouse(_this); X11_InitTouch(_this); + +#if SDL_USE_LIBDBUS + X11_InitDBus(_this); +#endif + return 0; } @@ -422,6 +575,10 @@ X11_VideoQuit(_THIS) X11_QuitKeyboard(_this); X11_QuitMouse(_this); X11_QuitTouch(_this); + +#if SDL_USE_LIBDBUS + X11_QuitDBus(_this); +#endif } SDL_bool diff --git a/src/eepp/helper/SDL2/src/video/x11/SDL_x11video.h b/src/eepp/helper/SDL2/src/video/x11/SDL_x11video.h index 5c092048f..68a041326 100644 --- a/src/eepp/helper/SDL2/src/video/x11/SDL_x11video.h +++ b/src/eepp/helper/SDL2/src/video/x11/SDL_x11video.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -53,6 +53,11 @@ #include #endif +#ifdef HAVE_DBUS_DBUS_H +#define SDL_USE_LIBDBUS 1 +#include +#endif + #include "SDL_x11dyn.h" #include "SDL_x11clipboard.h" @@ -94,10 +99,24 @@ typedef struct SDL_VideoData Atom _NET_WM_ICON_NAME; Atom _NET_WM_ICON; Atom _NET_WM_PING; + Atom _NET_ACTIVE_WINDOW; Atom UTF8_STRING; + Atom PRIMARY; + Atom XdndEnter; + Atom XdndPosition; + Atom XdndStatus; + Atom XdndTypeList; + Atom XdndActionCopy; + 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; +#endif } SDL_VideoData; extern SDL_bool X11_UseDirectColorVisuals(void); diff --git a/src/eepp/helper/SDL2/src/video/x11/SDL_x11window.c b/src/eepp/helper/SDL2/src/video/x11/SDL_x11window.c index 308768c85..eda47f7ef 100644 --- a/src/eepp/helper/SDL2/src/video/x11/SDL_x11window.c +++ b/src/eepp/helper/SDL2/src/video/x11/SDL_x11window.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -214,13 +214,12 @@ SetupWindowData(_THIS, SDL_Window * window, Window w, BOOL created) /* Allocate the window data */ data = (SDL_WindowData *) SDL_calloc(1, sizeof(*data)); if (!data) { - SDL_OutOfMemory(); - return -1; + return SDL_OutOfMemory(); } data->window = window; data->xwindow = w; #ifdef X_HAVE_UTF8_STRING - if (SDL_X11_HAVE_UTF8) { + if (SDL_X11_HAVE_UTF8 && videodata->im) { data->ic = pXCreateIC(videodata->im, XNClientWindow, w, XNFocusWindow, w, XNInputStyle, XIMPreeditNothing | XIMStatusNothing, @@ -242,9 +241,8 @@ SetupWindowData(_THIS, SDL_Window * window, Window w, BOOL created) (numwindows + 1) * sizeof(*windowlist)); if (!windowlist) { - SDL_OutOfMemory(); SDL_free(data); - return -1; + return SDL_OutOfMemory(); } windowlist[numwindows] = data; videodata->numwindows++; @@ -344,13 +342,14 @@ X11_CreateWindow(_THIS, SDL_Window * window) Atom _NET_WM_WINDOW_TYPE; Atom _NET_WM_WINDOW_TYPE_NORMAL; Atom _NET_WM_PID; + Atom XdndAware, xdnd_version = 5; Uint32 fevent = 0; #if SDL_VIDEO_OPENGL_GLX || SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2 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 @@ -391,15 +390,13 @@ X11_CreateWindow(_THIS, SDL_Window * window) /* If we can't create a colormap, then we must die */ if (!xattr.colormap) { - SDL_SetError("Could not create writable colormap"); - return -1; + return SDL_SetError("Could not create writable colormap"); } /* OK, we got a colormap, now fill it in as best as we can */ colorcells = SDL_malloc(visual->map_entries * sizeof(XColor)); if (!colorcells) { - SDL_OutOfMemory(); - return -1; + return SDL_OutOfMemory(); } ncolors = visual->map_entries; rmax = 0xffff; @@ -464,8 +461,7 @@ X11_CreateWindow(_THIS, SDL_Window * window) (CWOverrideRedirect | CWBackPixel | CWBorderPixel | CWColormap), &xattr); if (!w) { - SDL_SetError("Couldn't create window"); - return -1; + return SDL_SetError("Couldn't create window"); } #if SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2 if ((window->flags & SDL_WINDOW_OPENGL) && (_this->gl_config.use_egl == 1)) { @@ -482,9 +478,8 @@ X11_CreateWindow(_THIS, SDL_Window * window) (NativeWindowType) w, NULL); if (_this->gles_data->egl_surface == EGL_NO_SURFACE) { - SDL_SetError("Could not create GLES window surface"); XDestroyWindow(display, w); - return -1; + return SDL_SetError("Could not create GLES window surface"); } } #endif @@ -537,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 */ @@ -567,6 +562,11 @@ X11_CreateWindow(_THIS, SDL_Window * window) PropertyChangeMask | StructureNotifyMask | KeymapStateMask | fevent)); + XdndAware = XInternAtom(display, "XdndAware", False); + XChangeProperty(display, w, XdndAware, XA_ATOM, 32, + PropModeReplace, + (unsigned char*)&xdnd_version, 1); + XFlush(display); return 0; @@ -768,37 +768,28 @@ X11_SetWindowSize(_THIS, SDL_Window * window) XFree(sizehints); /* From Pierre-Loup: - For the windowed resize problem; WMs each have their little quirks with - that. When you change the size hints, they get a ConfigureNotify event - with the WM_NORMAL_SIZE_HINTS Atom. They all save the hints then, but - they don't all resize the window right away to enforce the new hints. - Those who do properly do it are: - - - XFWM - - metacity - - KWin + WMs each have their little quirks with that. When you change the + size hints, they get a ConfigureNotify event with the + WM_NORMAL_SIZE_HINTS Atom. They all save the hints then, but they + don't all resize the window right away to enforce the new hints. - These are great. Now, others are more problematic as you could observe - first hand. Compiz/Unity only falls into the code that does it on select - actions, such as window move, raise, map, etc. + Some of them resize only after: + - A user-initiated move or resize + - A code-initiated move or resize + - Hiding & showing window (Unmap & map) - WindowMaker is even more difficult and will _only_ do it on map. - - Awesome only does it on user-initiated moves as far as I can tell. - - Your raise workaround only fixes compiz/Unity. With that all "modern" - window managers are covered. Trying to Hide/Show on windowed resize - (UnMap/Map) fixes both Unity and WindowMaker, but introduces subtle - problems with transitioning from Windowed to Fullscreen on Unity. Since - some window moves happen after the transitions to fullscreen, that forces - SDL to fall from windowed to fullscreen repeatedly and it sometimes leaves - itself in a state where the fullscreen window is slightly offset by what - used to be the window decoration titlebar. - */ + The following move & resize seems to help a lot of WMs that didn't + properly update after the hints were changed. We don't do a + hide/show, because there are supposedly subtle problems with doing so + and transitioning from windowed to fullscreen in Unity. + */ + XResizeWindow(display, data->xwindow, window->w, window->h); + XMoveWindow(display, data->xwindow, window->x, window->y); XRaiseWindow(display, data->xwindow); } else { XResizeWindow(display, data->xwindow, window->w, window->h); } + XFlush(display); } @@ -845,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); @@ -862,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); } } @@ -931,15 +922,44 @@ 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); } +static void +SetWindowActive(_THIS, SDL_Window * window) +{ + SDL_WindowData *data = (SDL_WindowData *) window->driverdata; + SDL_DisplayData *displaydata = + (SDL_DisplayData *) SDL_GetDisplayForWindow(window)->driverdata; + Display *display = data->videodata->display; + Atom _NET_ACTIVE_WINDOW = data->videodata->_NET_ACTIVE_WINDOW; + + if (X11_IsWindowMapped(_this, window)) { + XEvent e; + + SDL_zero(e); + e.xany.type = ClientMessage; + e.xclient.message_type = _NET_ACTIVE_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; + + XSendEvent(display, RootWindow(display, displaydata->screen), 0, + SubstructureNotifyMask | SubstructureRedirectMask, &e); + + XFlush(display); + } +} + void X11_RestoreWindow(_THIS, SDL_Window * window) { SetWindowMaximized(_this, window, SDL_FALSE); + SetWindowActive(_this, window); X11_ShowWindow(_this, window); } @@ -1183,15 +1203,13 @@ X11_SetWindowGammaRamp(_THIS, SDL_Window * window, const Uint16 * ramp) int i; if (visual->class != DirectColor) { - SDL_SetError("Window doesn't have DirectColor visual"); - return -1; + return SDL_SetError("Window doesn't have DirectColor visual"); } ncolors = visual->map_entries; colorcells = SDL_malloc(ncolors * sizeof(XColor)); if (!colorcells) { - SDL_OutOfMemory(); - return -1; + return SDL_OutOfMemory(); } rshift = 0; diff --git a/src/eepp/helper/SDL2/src/video/x11/SDL_x11window.h b/src/eepp/helper/SDL2/src/video/x11/SDL_x11window.h index d65e08127..b9cb750b6 100644 --- a/src/eepp/helper/SDL2/src/video/x11/SDL_x11window.h +++ b/src/eepp/helper/SDL2/src/video/x11/SDL_x11window.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -57,6 +57,8 @@ typedef struct Uint32 pending_focus_time; XConfigureEvent last_xconfigure; struct SDL_VideoData *videodata; + Atom xdnd_req; + Window xdnd_source; } SDL_WindowData; extern void X11_SetNetWMState(_THIS, Window xwindow, Uint32 flags); diff --git a/src/eepp/helper/SDL2/src/video/x11/SDL_x11xinput2.c b/src/eepp/helper/SDL2/src/video/x11/SDL_x11xinput2.c index 94f7599a5..1b86c6774 100644 --- a/src/eepp/helper/SDL2/src/video/x11/SDL_x11xinput2.c +++ b/src/eepp/helper/SDL2/src/video/x11/SDL_x11xinput2.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -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,8 +61,9 @@ static void parse_valuators(const double *input_values,unsigned char *mask,int m } #endif /* SDL_VIDEO_DRIVER_X11_XINPUT2 */ -void -X11_InitXinput2(_THIS) { +void +X11_InitXinput2(_THIS) +{ #if SDL_VIDEO_DRIVER_X11_XINPUT2 SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; @@ -77,13 +78,14 @@ 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 */ - if (!XQueryExtension(data->display, "XInputExtension", &xinput2_opcode, &event, &err)) { + if (!SDL_X11_HAVE_XINPUT2 || + !XQueryExtension(data->display, "XInputExtension", &xinput2_opcode, &event, &err)) { return; } @@ -112,17 +114,16 @@ X11_InitXinput2(_THIS) { eventmask.mask = mask; XISetMask(mask, XI_RawMotion); - + if (XISelectEvents(data->display,DefaultRootWindow(data->display),&eventmask,1) != Success) { - return; + return; } #endif } - - -int -X11_HandleXinput2Event(SDL_VideoData *videodata,XGenericEventCookie *cookie) { +int +X11_HandleXinput2Event(SDL_VideoData *videodata,XGenericEventCookie *cookie) +{ #if SDL_VIDEO_DRIVER_X11_XINPUT2 if(cookie->extension != xinput2_opcode) { return 0; @@ -139,32 +140,29 @@ X11_HandleXinput2Event(SDL_VideoData *videodata,XGenericEventCookie *cookie) { parse_valuators(rawev->raw_values,rawev->valuators.mask, rawev->valuators.mask_len,relative_cords,2); - SDL_SendMouseMotion(mouse->focus,1,(int)relative_cords[0],(int)relative_cords[1]); + SDL_SendMouseMotion(mouse->focus,mouse->mouseID,1,(int)relative_cords[0],(int)relative_cords[1]); return 1; } break; #if SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH case XI_TouchBegin: { const XIDeviceEvent *xev = (const XIDeviceEvent *) cookie->data; - SDL_SendFingerDown(xev->sourceid,xev->detail, - SDL_TRUE, (int)xev->event_x, (int)xev->event_y, - 1.0); + SDL_SendTouch(xev->sourceid,xev->detail, + SDL_TRUE, xev->event_x, xev->event_y, 1.0); return 1; } break; case XI_TouchEnd: { const XIDeviceEvent *xev = (const XIDeviceEvent *) cookie->data; - SDL_SendFingerDown(xev->sourceid,xev->detail, - SDL_FALSE, (int)xev->event_x, (int)xev->event_y, - 1.0); + SDL_SendTouch(xev->sourceid,xev->detail, + SDL_FALSE, xev->event_x, xev->event_y, 1.0); return 1; } break; case XI_TouchUpdate: { const XIDeviceEvent *xev = (const XIDeviceEvent *) cookie->data; SDL_SendTouchMotion(xev->sourceid,xev->detail, - SDL_FALSE, (int)xev->event_x, (int)xev->event_y, - 1.0); + xev->event_x, xev->event_y, 1.0); return 1; } break; @@ -174,8 +172,9 @@ X11_HandleXinput2Event(SDL_VideoData *videodata,XGenericEventCookie *cookie) { return 0; } -void -X11_InitXinput2Multitouch(_THIS) { +void +X11_InitXinput2Multitouch(_THIS) +{ #if SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; XIDeviceInfo *info; @@ -194,22 +193,8 @@ X11_InitXinput2Multitouch(_THIS) { continue; touchId = t->sourceid; - /*Add the touch*/ if (!SDL_GetTouch(touchId)) { - SDL_Touch touch; - - touch.id = touchId; - touch.x_min = 0; - touch.x_max = 1; - touch.native_xres = touch.x_max - touch.x_min; - touch.y_min = 0; - touch.y_max = 1; - touch.native_yres = touch.y_max - touch.y_min; - touch.pressure_min = 0; - touch.pressure_max = 1; - touch.native_pressureres = touch.pressure_max - touch.pressure_min; - - SDL_AddTouch(&touch,dev->name); + SDL_AddTouch(touchId, dev->name); } } } @@ -217,8 +202,9 @@ X11_InitXinput2Multitouch(_THIS) { #endif } -void -X11_Xinput2SelectTouch(_THIS, SDL_Window *window) { +void +X11_Xinput2SelectTouch(_THIS, SDL_Window *window) +{ #if SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH if (!X11_Xinput2IsMultitouchSupported()) { return; @@ -236,14 +222,15 @@ 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 -X11_Xinput2IsInitialized() { +int +X11_Xinput2IsInitialized() +{ #if SDL_VIDEO_DRIVER_X11_XINPUT2 return xinput2_initialized; #else @@ -252,7 +239,8 @@ X11_Xinput2IsInitialized() { } int -X11_Xinput2IsMultitouchSupported() { +X11_Xinput2IsMultitouchSupported() +{ #if SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH return xinput2_initialized && xinput2_multitouch_supported; #else diff --git a/src/eepp/helper/SDL2/src/video/x11/SDL_x11xinput2.h b/src/eepp/helper/SDL2/src/video/x11/SDL_x11xinput2.h index 207c100c2..56a4b906c 100644 --- a/src/eepp/helper/SDL2/src/video/x11/SDL_x11xinput2.h +++ b/src/eepp/helper/SDL2/src/video/x11/SDL_x11xinput2.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2012 Sam Lantinga + Copyright (C) 1997-2013 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -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); diff --git a/src/eepp/helper/SDL2/src/video/x11/edid-parse.c b/src/eepp/helper/SDL2/src/video/x11/edid-parse.c new file mode 100644 index 000000000..8608bf254 --- /dev/null +++ b/src/eepp/helper/SDL2/src/video/x11/edid-parse.c @@ -0,0 +1,752 @@ +/* + * Copyright 2007 Red Hat, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * on the rights to use, copy, modify, merge, publish, distribute, sub + * license, and/or sell copies of the Software, and to permit persons to whom + * the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +/* Author: Soren Sandmann */ + +#include "edid.h" +#include +#include +#include +#include + +#define TRUE 1 +#define FALSE 0 + +static int +get_bit (int in, int bit) +{ + return (in & (1 << bit)) >> bit; +} + +static int +get_bits (int in, int begin, int end) +{ + int mask = (1 << (end - begin + 1)) - 1; + + return (in >> begin) & mask; +} + +static int +decode_header (const uchar *edid) +{ + if (memcmp (edid, "\x00\xff\xff\xff\xff\xff\xff\x00", 8) == 0) + return TRUE; + return FALSE; +} + +static int +decode_vendor_and_product_identification (const uchar *edid, MonitorInfo *info) +{ + int is_model_year; + + /* Manufacturer Code */ + info->manufacturer_code[0] = get_bits (edid[0x08], 2, 6); + info->manufacturer_code[1] = get_bits (edid[0x08], 0, 1) << 3; + info->manufacturer_code[1] |= get_bits (edid[0x09], 5, 7); + info->manufacturer_code[2] = get_bits (edid[0x09], 0, 4); + info->manufacturer_code[3] = '\0'; + + info->manufacturer_code[0] += 'A' - 1; + info->manufacturer_code[1] += 'A' - 1; + info->manufacturer_code[2] += 'A' - 1; + + /* Product Code */ + info->product_code = edid[0x0b] << 8 | edid[0x0a]; + + /* Serial Number */ + info->serial_number = + edid[0x0c] | edid[0x0d] << 8 | edid[0x0e] << 16 | edid[0x0f] << 24; + + /* Week and Year */ + is_model_year = FALSE; + switch (edid[0x10]) + { + case 0x00: + info->production_week = -1; + break; + + case 0xff: + info->production_week = -1; + is_model_year = TRUE; + break; + + default: + info->production_week = edid[0x10]; + break; + } + + if (is_model_year) + { + info->production_year = -1; + info->model_year = 1990 + edid[0x11]; + } + else + { + info->production_year = 1990 + edid[0x11]; + info->model_year = -1; + } + + return TRUE; +} + +static int +decode_edid_version (const uchar *edid, MonitorInfo *info) +{ + info->major_version = edid[0x12]; + info->minor_version = edid[0x13]; + + return TRUE; +} + +static int +decode_display_parameters (const uchar *edid, MonitorInfo *info) +{ + /* Digital vs Analog */ + info->is_digital = get_bit (edid[0x14], 7); + + if (info->is_digital) + { + int bits; + + static const int bit_depth[8] = + { + -1, 6, 8, 10, 12, 14, 16, -1 + }; + + static const Interface interfaces[6] = + { + UNDEFINED, DVI, HDMI_A, HDMI_B, MDDI, DISPLAY_PORT + }; + + bits = get_bits (edid[0x14], 4, 6); + info->digital.bits_per_primary = bit_depth[bits]; + + bits = get_bits (edid[0x14], 0, 3); + + if (bits <= 5) + info->digital.interface = interfaces[bits]; + else + info->digital.interface = UNDEFINED; + } + else + { + int bits = get_bits (edid[0x14], 5, 6); + + static const double levels[][3] = + { + { 0.7, 0.3, 1.0 }, + { 0.714, 0.286, 1.0 }, + { 1.0, 0.4, 1.4 }, + { 0.7, 0.0, 0.7 }, + }; + + info->analog.video_signal_level = levels[bits][0]; + info->analog.sync_signal_level = levels[bits][1]; + info->analog.total_signal_level = levels[bits][2]; + + info->analog.blank_to_black = get_bit (edid[0x14], 4); + + info->analog.separate_hv_sync = get_bit (edid[0x14], 3); + info->analog.composite_sync_on_h = get_bit (edid[0x14], 2); + info->analog.composite_sync_on_green = get_bit (edid[0x14], 1); + + info->analog.serration_on_vsync = get_bit (edid[0x14], 0); + } + + /* Screen Size / Aspect Ratio */ + if (edid[0x15] == 0 && edid[0x16] == 0) + { + info->width_mm = -1; + info->height_mm = -1; + info->aspect_ratio = -1.0; + } + else if (edid[0x16] == 0) + { + info->width_mm = -1; + info->height_mm = -1; + info->aspect_ratio = 100.0 / (edid[0x15] + 99); + } + else if (edid[0x15] == 0) + { + info->width_mm = -1; + info->height_mm = -1; + info->aspect_ratio = 100.0 / (edid[0x16] + 99); + info->aspect_ratio = 1/info->aspect_ratio; /* portrait */ + } + else + { + info->width_mm = 10 * edid[0x15]; + info->height_mm = 10 * edid[0x16]; + } + + /* Gamma */ + if (edid[0x17] == 0xFF) + info->gamma = -1.0; + else + info->gamma = (edid[0x17] + 100.0) / 100.0; + + /* Features */ + info->standby = get_bit (edid[0x18], 7); + info->suspend = get_bit (edid[0x18], 6); + info->active_off = get_bit (edid[0x18], 5); + + if (info->is_digital) + { + info->digital.rgb444 = TRUE; + if (get_bit (edid[0x18], 3)) + info->digital.ycrcb444 = 1; + if (get_bit (edid[0x18], 4)) + info->digital.ycrcb422 = 1; + } + else + { + int bits = get_bits (edid[0x18], 3, 4); + ColorType color_type[4] = + { + MONOCHROME, RGB, OTHER_COLOR, UNDEFINED_COLOR + }; + + info->analog.color_type = color_type[bits]; + } + + info->srgb_is_standard = get_bit (edid[0x18], 2); + + /* In 1.3 this is called "has preferred timing" */ + info->preferred_timing_includes_native = get_bit (edid[0x18], 1); + + /* FIXME: In 1.3 this indicates whether the monitor accepts GTF */ + info->continuous_frequency = get_bit (edid[0x18], 0); + return TRUE; +} + +static double +decode_fraction (int high, int low) +{ + double result = 0.0; + int i; + + high = (high << 2) | low; + + for (i = 0; i < 10; ++i) + result += get_bit (high, i) * pow (2, i - 10); + + return result; +} + +static int +decode_color_characteristics (const uchar *edid, MonitorInfo *info) +{ + info->red_x = decode_fraction (edid[0x1b], get_bits (edid[0x19], 6, 7)); + info->red_y = decode_fraction (edid[0x1c], get_bits (edid[0x19], 5, 4)); + info->green_x = decode_fraction (edid[0x1d], get_bits (edid[0x19], 2, 3)); + info->green_y = decode_fraction (edid[0x1e], get_bits (edid[0x19], 0, 1)); + info->blue_x = decode_fraction (edid[0x1f], get_bits (edid[0x1a], 6, 7)); + info->blue_y = decode_fraction (edid[0x20], get_bits (edid[0x1a], 4, 5)); + info->white_x = decode_fraction (edid[0x21], get_bits (edid[0x1a], 2, 3)); + info->white_y = decode_fraction (edid[0x22], get_bits (edid[0x1a], 0, 1)); + + return TRUE; +} + +static int +decode_established_timings (const uchar *edid, MonitorInfo *info) +{ + static const Timing established[][8] = + { + { + { 800, 600, 60 }, + { 800, 600, 56 }, + { 640, 480, 75 }, + { 640, 480, 72 }, + { 640, 480, 67 }, + { 640, 480, 60 }, + { 720, 400, 88 }, + { 720, 400, 70 } + }, + { + { 1280, 1024, 75 }, + { 1024, 768, 75 }, + { 1024, 768, 70 }, + { 1024, 768, 60 }, + { 1024, 768, 87 }, + { 832, 624, 75 }, + { 800, 600, 75 }, + { 800, 600, 72 } + }, + { + { 0, 0, 0 }, + { 0, 0, 0 }, + { 0, 0, 0 }, + { 0, 0, 0 }, + { 0, 0, 0 }, + { 0, 0, 0 }, + { 0, 0, 0 }, + { 1152, 870, 75 } + }, + }; + + int i, j, idx; + + idx = 0; + for (i = 0; i < 3; ++i) + { + for (j = 0; j < 8; ++j) + { + int byte = edid[0x23 + i]; + + if (get_bit (byte, j) && established[i][j].frequency != 0) + info->established[idx++] = established[i][j]; + } + } + return TRUE; +} + +static int +decode_standard_timings (const uchar *edid, MonitorInfo *info) +{ + int i; + + for (i = 0; i < 8; i++) + { + int first = edid[0x26 + 2 * i]; + int second = edid[0x27 + 2 * i]; + + if (first != 0x01 && second != 0x01) + { + int w = 8 * (first + 31); + int h = 0; + + switch (get_bits (second, 6, 7)) + { + case 0x00: h = (w / 16) * 10; break; + case 0x01: h = (w / 4) * 3; break; + case 0x02: h = (w / 5) * 4; break; + case 0x03: h = (w / 16) * 9; break; + } + + info->standard[i].width = w; + info->standard[i].height = h; + info->standard[i].frequency = get_bits (second, 0, 5) + 60; + } + } + + return TRUE; +} + +static void +decode_lf_string (const uchar *s, int n_chars, char *result) +{ + int i; + for (i = 0; i < n_chars; ++i) + { + if (s[i] == 0x0a) + { + *result++ = '\0'; + break; + } + else if (s[i] == 0x00) + { + /* Convert embedded 0's to spaces */ + *result++ = ' '; + } + else + { + *result++ = s[i]; + } + } +} + +static void +decode_display_descriptor (const uchar *desc, + MonitorInfo *info) +{ + switch (desc[0x03]) + { + case 0xFC: + decode_lf_string (desc + 5, 13, info->dsc_product_name); + break; + case 0xFF: + decode_lf_string (desc + 5, 13, info->dsc_serial_number); + break; + case 0xFE: + decode_lf_string (desc + 5, 13, info->dsc_string); + break; + case 0xFD: + /* Range Limits */ + break; + case 0xFB: + /* Color Point */ + break; + case 0xFA: + /* Timing Identifications */ + break; + case 0xF9: + /* Color Management */ + break; + case 0xF8: + /* Timing Codes */ + break; + case 0xF7: + /* Established Timings */ + break; + case 0x10: + break; + } +} + +static void +decode_detailed_timing (const uchar *timing, + DetailedTiming *detailed) +{ + int bits; + StereoType stereo[] = + { + NO_STEREO, NO_STEREO, FIELD_RIGHT, FIELD_LEFT, + TWO_WAY_RIGHT_ON_EVEN, TWO_WAY_LEFT_ON_EVEN, + FOUR_WAY_INTERLEAVED, SIDE_BY_SIDE + }; + + detailed->pixel_clock = (timing[0x00] | timing[0x01] << 8) * 10000; + detailed->h_addr = timing[0x02] | ((timing[0x04] & 0xf0) << 4); + detailed->h_blank = timing[0x03] | ((timing[0x04] & 0x0f) << 8); + detailed->v_addr = timing[0x05] | ((timing[0x07] & 0xf0) << 4); + detailed->v_blank = timing[0x06] | ((timing[0x07] & 0x0f) << 8); + detailed->h_front_porch = timing[0x08] | get_bits (timing[0x0b], 6, 7) << 8; + detailed->h_sync = timing[0x09] | get_bits (timing[0x0b], 4, 5) << 8; + detailed->v_front_porch = + get_bits (timing[0x0a], 4, 7) | get_bits (timing[0x0b], 2, 3) << 4; + detailed->v_sync = + get_bits (timing[0x0a], 0, 3) | get_bits (timing[0x0b], 0, 1) << 4; + detailed->width_mm = timing[0x0c] | get_bits (timing[0x0e], 4, 7) << 8; + detailed->height_mm = timing[0x0d] | get_bits (timing[0x0e], 0, 3) << 8; + detailed->right_border = timing[0x0f]; + detailed->top_border = timing[0x10]; + + detailed->interlaced = get_bit (timing[0x11], 7); + + /* Stereo */ + bits = get_bits (timing[0x11], 5, 6) << 1 | get_bit (timing[0x11], 0); + detailed->stereo = stereo[bits]; + + /* Sync */ + bits = timing[0x11]; + + detailed->digital_sync = get_bit (bits, 4); + if (detailed->digital_sync) + { + detailed->digital.composite = !get_bit (bits, 3); + + if (detailed->digital.composite) + { + detailed->digital.serrations = get_bit (bits, 2); + detailed->digital.negative_vsync = FALSE; + } + else + { + detailed->digital.serrations = FALSE; + detailed->digital.negative_vsync = !get_bit (bits, 2); + } + + detailed->digital.negative_hsync = !get_bit (bits, 0); + } + else + { + detailed->analog.bipolar = get_bit (bits, 3); + detailed->analog.serrations = get_bit (bits, 2); + detailed->analog.sync_on_green = !get_bit (bits, 1); + } +} + +static int +decode_descriptors (const uchar *edid, MonitorInfo *info) +{ + int i; + int timing_idx; + + timing_idx = 0; + + for (i = 0; i < 4; ++i) + { + int index = 0x36 + i * 18; + + if (edid[index + 0] == 0x00 && edid[index + 1] == 0x00) + { + decode_display_descriptor (edid + index, info); + } + else + { + decode_detailed_timing ( + edid + index, &(info->detailed_timings[timing_idx++])); + } + } + + info->n_detailed_timings = timing_idx; + + return TRUE; +} + +static void +decode_check_sum (const uchar *edid, + MonitorInfo *info) +{ + int i; + uchar check = 0; + + for (i = 0; i < 128; ++i) + check += edid[i]; + + info->checksum = check; +} + +MonitorInfo * +decode_edid (const uchar *edid) +{ + MonitorInfo *info = calloc (1, sizeof (MonitorInfo)); + + decode_check_sum (edid, info); + + if (!decode_header (edid) || + !decode_vendor_and_product_identification (edid, info) || + !decode_edid_version (edid, info) || + !decode_display_parameters (edid, info) || + !decode_color_characteristics (edid, info) || + !decode_established_timings (edid, info) || + !decode_standard_timings (edid, info) || + !decode_descriptors (edid, info)) { + free(info); + return NULL; + } + + return info; +} + +static const char * +yesno (int v) +{ + return v? "yes" : "no"; +} + +void +dump_monitor_info (MonitorInfo *info) +{ + char *s; + int i; + + printf ("Checksum: %d (%s)\n", + info->checksum, info->checksum? "incorrect" : "correct"); + printf ("Manufacturer Code: %s\n", info->manufacturer_code); + printf ("Product Code: 0x%x\n", info->product_code); + printf ("Serial Number: %u\n", info->serial_number); + + if (info->production_week != -1) + printf ("Production Week: %d\n", info->production_week); + else + printf ("Production Week: unspecified\n"); + + if (info->production_year != -1) + printf ("Production Year: %d\n", info->production_year); + else + printf ("Production Year: unspecified\n"); + + if (info->model_year != -1) + printf ("Model Year: %d\n", info->model_year); + else + printf ("Model Year: unspecified\n"); + + printf ("EDID revision: %d.%d\n", info->major_version, info->minor_version); + + printf ("Display is %s\n", info->is_digital? "digital" : "analog"); + if (info->is_digital) + { + const char *interface; + if (info->digital.bits_per_primary != -1) + printf ("Bits Per Primary: %d\n", info->digital.bits_per_primary); + else + printf ("Bits Per Primary: undefined\n"); + + switch (info->digital.interface) + { + case DVI: interface = "DVI"; break; + case HDMI_A: interface = "HDMI-a"; break; + case HDMI_B: interface = "HDMI-b"; break; + case MDDI: interface = "MDDI"; break; + case DISPLAY_PORT: interface = "DisplayPort"; break; + case UNDEFINED: interface = "undefined"; break; + default: interface = "unknown"; break; + } + printf ("Interface: %s\n", interface); + + printf ("RGB 4:4:4: %s\n", yesno (info->digital.rgb444)); + printf ("YCrCb 4:4:4: %s\n", yesno (info->digital.ycrcb444)); + printf ("YCrCb 4:2:2: %s\n", yesno (info->digital.ycrcb422)); + } + else + { + printf ("Video Signal Level: %f\n", info->analog.video_signal_level); + printf ("Sync Signal Level: %f\n", info->analog.sync_signal_level); + printf ("Total Signal Level: %f\n", info->analog.total_signal_level); + + printf ("Blank to Black: %s\n", + yesno (info->analog.blank_to_black)); + printf ("Separate HV Sync: %s\n", + yesno (info->analog.separate_hv_sync)); + printf ("Composite Sync on H: %s\n", + yesno (info->analog.composite_sync_on_h)); + printf ("Serration on VSync: %s\n", + yesno (info->analog.serration_on_vsync)); + + switch (info->analog.color_type) + { + case UNDEFINED_COLOR: s = "undefined"; break; + case MONOCHROME: s = "monochrome"; break; + case RGB: s = "rgb"; break; + case OTHER_COLOR: s = "other color"; break; + default: s = "unknown"; break; + }; + + printf ("Color: %s\n", s); + } + + if (info->width_mm == -1) + printf ("Width: undefined\n"); + else + printf ("Width: %d mm\n", info->width_mm); + + if (info->height_mm == -1) + printf ("Height: undefined\n"); + else + printf ("Height: %d mm\n", info->height_mm); + + if (info->aspect_ratio > 0) + printf ("Aspect Ratio: %f\n", info->aspect_ratio); + else + printf ("Aspect Ratio: undefined\n"); + + if (info->gamma >= 0) + printf ("Gamma: %f\n", info->gamma); + else + printf ("Gamma: undefined\n"); + + printf ("Standby: %s\n", yesno (info->standby)); + printf ("Suspend: %s\n", yesno (info->suspend)); + printf ("Active Off: %s\n", yesno (info->active_off)); + + printf ("SRGB is Standard: %s\n", yesno (info->srgb_is_standard)); + printf ("Preferred Timing Includes Native: %s\n", + yesno (info->preferred_timing_includes_native)); + printf ("Continuous Frequency: %s\n", yesno (info->continuous_frequency)); + + printf ("Red X: %f\n", info->red_x); + printf ("Red Y: %f\n", info->red_y); + printf ("Green X: %f\n", info->green_x); + printf ("Green Y: %f\n", info->green_y); + printf ("Blue X: %f\n", info->blue_x); + printf ("Blue Y: %f\n", info->blue_y); + printf ("White X: %f\n", info->white_x); + printf ("White Y: %f\n", info->white_y); + + printf ("Established Timings:\n"); + + for (i = 0; i < 24; ++i) + { + Timing *timing = &(info->established[i]); + + if (timing->frequency == 0) + break; + + printf (" %d x %d @ %d Hz\n", + timing->width, timing->height, timing->frequency); + + } + + printf ("Standard Timings:\n"); + for (i = 0; i < 8; ++i) + { + Timing *timing = &(info->standard[i]); + + if (timing->frequency == 0) + break; + + printf (" %d x %d @ %d Hz\n", + timing->width, timing->height, timing->frequency); + } + + for (i = 0; i < info->n_detailed_timings; ++i) + { + DetailedTiming *timing = &(info->detailed_timings[i]); + const char *s; + + printf ("Timing%s: \n", + (i == 0 && info->preferred_timing_includes_native)? + " (Preferred)" : ""); + printf (" Pixel Clock: %d\n", timing->pixel_clock); + printf (" H Addressable: %d\n", timing->h_addr); + printf (" H Blank: %d\n", timing->h_blank); + printf (" H Front Porch: %d\n", timing->h_front_porch); + printf (" H Sync: %d\n", timing->h_sync); + printf (" V Addressable: %d\n", timing->v_addr); + printf (" V Blank: %d\n", timing->v_blank); + printf (" V Front Porch: %d\n", timing->v_front_porch); + printf (" V Sync: %d\n", timing->v_sync); + printf (" Width: %d mm\n", timing->width_mm); + printf (" Height: %d mm\n", timing->height_mm); + printf (" Right Border: %d\n", timing->right_border); + printf (" Top Border: %d\n", timing->top_border); + switch (timing->stereo) + { + default: + case NO_STEREO: s = "No Stereo"; break; + case FIELD_RIGHT: s = "Field Sequential, Right on Sync"; break; + case FIELD_LEFT: s = "Field Sequential, Left on Sync"; break; + case TWO_WAY_RIGHT_ON_EVEN: s = "Two-way, Right on Even"; break; + case TWO_WAY_LEFT_ON_EVEN: s = "Two-way, Left on Even"; break; + case FOUR_WAY_INTERLEAVED: s = "Four-way Interleaved"; break; + case SIDE_BY_SIDE: s = "Side-by-Side"; break; + } + printf (" Stereo: %s\n", s); + + if (timing->digital_sync) + { + printf (" Digital Sync:\n"); + printf (" composite: %s\n", yesno (timing->digital.composite)); + printf (" serrations: %s\n", yesno (timing->digital.serrations)); + printf (" negative vsync: %s\n", + yesno (timing->digital.negative_vsync)); + printf (" negative hsync: %s\n", + yesno (timing->digital.negative_hsync)); + } + else + { + printf (" Analog Sync:\n"); + printf (" bipolar: %s\n", yesno (timing->analog.bipolar)); + printf (" serrations: %s\n", yesno (timing->analog.serrations)); + printf (" sync on green: %s\n", yesno ( + timing->analog.sync_on_green)); + } + } + + printf ("Detailed Product information:\n"); + printf (" Product Name: %s\n", info->dsc_product_name); + printf (" Serial Number: %s\n", info->dsc_serial_number); + printf (" Unspecified String: %s\n", info->dsc_string); +} + diff --git a/src/eepp/helper/SDL2/src/video/x11/edid.h b/src/eepp/helper/SDL2/src/video/x11/edid.h new file mode 100644 index 000000000..8c217eba2 --- /dev/null +++ b/src/eepp/helper/SDL2/src/video/x11/edid.h @@ -0,0 +1,167 @@ +typedef unsigned char uchar; +typedef struct MonitorInfo MonitorInfo; +typedef struct Timing Timing; +typedef struct DetailedTiming DetailedTiming; + +typedef enum +{ + UNDEFINED, + DVI, + HDMI_A, + HDMI_B, + MDDI, + DISPLAY_PORT +} Interface; + +typedef enum +{ + UNDEFINED_COLOR, + MONOCHROME, + RGB, + OTHER_COLOR +} ColorType; + +typedef enum +{ + NO_STEREO, + FIELD_RIGHT, + FIELD_LEFT, + TWO_WAY_RIGHT_ON_EVEN, + TWO_WAY_LEFT_ON_EVEN, + FOUR_WAY_INTERLEAVED, + SIDE_BY_SIDE +} StereoType; + +struct Timing +{ + int width; + int height; + int frequency; +}; + +struct DetailedTiming +{ + int pixel_clock; + int h_addr; + int h_blank; + int h_sync; + int h_front_porch; + int v_addr; + int v_blank; + int v_sync; + int v_front_porch; + int width_mm; + int height_mm; + int right_border; + int top_border; + int interlaced; + StereoType stereo; + + int digital_sync; + union + { + struct + { + int bipolar; + int serrations; + int sync_on_green; + } analog; + + struct + { + int composite; + int serrations; + int negative_vsync; + int negative_hsync; + } digital; + }; +}; + +struct MonitorInfo +{ + int checksum; + char manufacturer_code[4]; + int product_code; + unsigned int serial_number; + + int production_week; /* -1 if not specified */ + int production_year; /* -1 if not specified */ + int model_year; /* -1 if not specified */ + + int major_version; + int minor_version; + + int is_digital; + + union + { + struct + { + int bits_per_primary; + Interface interface; + int rgb444; + int ycrcb444; + int ycrcb422; + } digital; + + struct + { + double video_signal_level; + double sync_signal_level; + double total_signal_level; + + int blank_to_black; + + int separate_hv_sync; + int composite_sync_on_h; + int composite_sync_on_green; + int serration_on_vsync; + ColorType color_type; + } analog; + }; + + int width_mm; /* -1 if not specified */ + int height_mm; /* -1 if not specified */ + double aspect_ratio; /* -1.0 if not specififed */ + + double gamma; /* -1.0 if not specified */ + + int standby; + int suspend; + int active_off; + + int srgb_is_standard; + int preferred_timing_includes_native; + int continuous_frequency; + + double red_x; + double red_y; + double green_x; + double green_y; + double blue_x; + double blue_y; + double white_x; + double white_y; + + Timing established[24]; /* Terminated by 0x0x0 */ + Timing standard[8]; + + int n_detailed_timings; + DetailedTiming detailed_timings[4]; /* If monitor has a preferred + * mode, it is the first one + * (whether it has, is + * determined by the + * preferred_timing_includes + * bit. + */ + + /* Optional product description */ + char dsc_serial_number[14]; + char dsc_product_name[14]; + char dsc_string[14]; /* Unspecified ASCII data */ +}; + +MonitorInfo *decode_edid (const uchar *data); +void dump_monitor_info (MonitorInfo *info); +char * make_display_name (const char *output_name, + const MonitorInfo *info); diff --git a/src/eepp/window/backend/SDL2/base.hpp b/src/eepp/window/backend/SDL2/base.hpp index 93893c661..0d04c226e 100644 --- a/src/eepp/window/backend/SDL2/base.hpp +++ b/src/eepp/window/backend/SDL2/base.hpp @@ -10,7 +10,11 @@ #define EE_BACKEND_SDL2 #endif - #include + #if EE_PLATFORM != EE_PLATFORM_ANDROID + #include + #else + #include + #endif #else #ifndef EE_BACKEND_SDL_1_2 #define EE_BACKEND_SDL_1_2 diff --git a/src/eepp/window/backend/SDL2/cbackendsdl2.cpp b/src/eepp/window/backend/SDL2/cbackendsdl2.cpp index 5e2e22d76..2e8d5aa11 100644 --- a/src/eepp/window/backend/SDL2/cbackendsdl2.cpp +++ b/src/eepp/window/backend/SDL2/cbackendsdl2.cpp @@ -2,7 +2,11 @@ #ifdef EE_BACKEND_SDL2 -#include +#if EE_PLATFORM != EE_PLATFORM_ANDROID + #include +#else + #include +#endif namespace EE { namespace Window { namespace Backend { namespace SDL2 { diff --git a/src/eepp/window/backend/SDL2/cinputsdl2.cpp b/src/eepp/window/backend/SDL2/cinputsdl2.cpp index f97782f52..cb984c766 100644 --- a/src/eepp/window/backend/SDL2/cinputsdl2.cpp +++ b/src/eepp/window/backend/SDL2/cinputsdl2.cpp @@ -203,7 +203,6 @@ void cInputSDL::Update() { EEEvent.finger.timestamp = SDLEvent.tfinger.timestamp; EEEvent.finger.touchId = SDLEvent.tfinger.touchId; EEEvent.finger.fingerId = SDLEvent.tfinger.fingerId; - EEEvent.finger.state = SDLEvent.tfinger.state; EEEvent.finger.x = SDLEvent.tfinger.x; EEEvent.finger.y = SDLEvent.tfinger.y; EEEvent.finger.dx = SDLEvent.tfinger.dx; @@ -217,7 +216,6 @@ void cInputSDL::Update() { EEEvent.finger.timestamp = SDLEvent.tfinger.timestamp; EEEvent.finger.touchId = SDLEvent.tfinger.touchId; EEEvent.finger.fingerId = SDLEvent.tfinger.fingerId; - EEEvent.finger.state = SDLEvent.tfinger.state; EEEvent.finger.x = SDLEvent.tfinger.x; EEEvent.finger.y = SDLEvent.tfinger.y; EEEvent.finger.dx = SDLEvent.tfinger.dx; @@ -231,7 +229,6 @@ void cInputSDL::Update() { EEEvent.finger.timestamp = SDLEvent.tfinger.timestamp; EEEvent.finger.touchId = SDLEvent.tfinger.touchId; EEEvent.finger.fingerId = SDLEvent.tfinger.fingerId; - EEEvent.finger.state = SDLEvent.tfinger.state; EEEvent.finger.x = SDLEvent.tfinger.x; EEEvent.finger.y = SDLEvent.tfinger.y; EEEvent.finger.dx = SDLEvent.tfinger.dx; @@ -333,10 +330,8 @@ void cInputSDL::Init() { mMousePos.y = (eeInt)mTempMouse.y; InitializeTables(); - - #if EE_PLATFORM != EE_PLATFORM_ANDROID + mJoystickManager->Open(); - #endif } void cInputSDL::InitializeTables() { diff --git a/src/eepp/window/backend/SDL2/cjoysticksdl2.cpp b/src/eepp/window/backend/SDL2/cjoysticksdl2.cpp index 95ec0fcc7..65c613338 100644 --- a/src/eepp/window/backend/SDL2/cjoysticksdl2.cpp +++ b/src/eepp/window/backend/SDL2/cjoysticksdl2.cpp @@ -2,6 +2,12 @@ #ifdef EE_BACKEND_SDL2 +#if EE_PLATFORM != EE_PLATFORM_ANDROID + #include +#else + #include +#endif + namespace EE { namespace Window { namespace Backend { namespace SDL2 { cJoystickSDL::cJoystickSDL( const Uint32& index ) : @@ -19,9 +25,12 @@ void cJoystickSDL::Open() { mJoystick = SDL_JoystickOpen( mIndex ); if ( NULL != mJoystick ) { - // @TODO SDL2 changed the API, i'll wait until the new changes became stable - //mName = SDL_JoystickName( mJoystick ); - mName = std::string( "USB Joysick " ) + String::ToStr( mIndex ); + #if defined(SDL_REVISION_NUMBER) && SDL_REVISION_NUMBER >= 7236 + mName = SDL_JoystickName( mJoystick ); + #else + mName = std::string( "USB Joysick " ) + String::ToStr( mIndex ); + #endif + mHats = SDL_JoystickNumHats( mJoystick ); mButtons = eemin( SDL_JoystickNumButtons( mJoystick ), 32 ); mAxes = SDL_JoystickNumAxes( mJoystick ); diff --git a/src/eepp/window/cinput.cpp b/src/eepp/window/cinput.cpp index 0b627a5ed..e31feea05 100644 --- a/src/eepp/window/cinput.cpp +++ b/src/eepp/window/cinput.cpp @@ -157,8 +157,8 @@ void cInput::ProcessEvent( InputEvent * Event ) { cInputFinger * Finger = GetFingerId( Event->finger.fingerId ); Finger->WriteLast(); - Finger->x = (Uint16)( ( (eeFloat)Event->finger.x / (eeFloat)32768 ) * (eeFloat)mWindow->GetWidth() ); - Finger->y = (Uint16)( ( (eeFloat)Event->finger.y / (eeFloat)32768 ) * (eeFloat)mWindow->GetHeight() ); + Finger->x = (Uint16)( Event->finger.x * (eeFloat)mWindow->GetWidth() ); + Finger->y = (Uint16)( Event->finger.y * (eeFloat)mWindow->GetHeight() ); Finger->pressure = Event->finger.pressure; Finger->down = true; Finger->xdelta = Event->finger.dx; @@ -171,8 +171,8 @@ void cInput::ProcessEvent( InputEvent * Event ) { cInputFinger * Finger = GetFingerId( Event->finger.fingerId ); Finger->WriteLast(); - Finger->x = (Uint16)( ( (eeFloat)Event->finger.x / (eeFloat)32768 ) * (eeFloat)mWindow->GetWidth() ); - Finger->y = (Uint16)( ( (eeFloat)Event->finger.y / (eeFloat)32768 ) * (eeFloat)mWindow->GetHeight() ); + Finger->x = (Uint16)( Event->finger.x * (eeFloat)mWindow->GetWidth() ); + Finger->y = (Uint16)( Event->finger.y * (eeFloat)mWindow->GetHeight() ); Finger->pressure = Event->finger.pressure; Finger->down = false; Finger->was_down = true; @@ -186,8 +186,8 @@ void cInput::ProcessEvent( InputEvent * Event ) { cInputFinger * Finger = GetFingerId( Event->finger.fingerId ); Finger->WriteLast(); - Finger->x = (Uint16)( ( (eeFloat)Event->finger.x / (eeFloat)32768 ) * (eeFloat)mWindow->GetWidth() ); - Finger->y = (Uint16)( ( (eeFloat)Event->finger.y / (eeFloat)32768 ) * (eeFloat)mWindow->GetHeight() ); + Finger->x = (Uint16)( Event->finger.x * (eeFloat)mWindow->GetWidth() ); + Finger->y = (Uint16)( Event->finger.y * (eeFloat)mWindow->GetHeight() ); Finger->pressure = Event->finger.pressure; Finger->down = true; Finger->xdelta = Event->finger.dx;