File style cleanup for the SDL 2.0 release
This commit is contained in:
parent
2ac8624930
commit
0cb6385637
376 changed files with 17562 additions and 17773 deletions
|
@ -92,9 +92,7 @@
|
|||
#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 */
|
||||
|
@ -152,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"
|
||||
|
||||
|
|
|
@ -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
|
||||
|
@ -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"
|
||||
|
||||
|
|
|
@ -72,9 +72,7 @@
|
|||
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
extern "C" {
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@ -304,9 +302,7 @@ SDL_FORCE_INLINE void* SDL_AtomicGetPtr(void* *a)
|
|||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
}
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
|
||||
#include "close_code.h"
|
||||
|
|
|
@ -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
|
||||
|
||||
/**
|
||||
|
@ -100,8 +98,6 @@ typedef Uint16 SDL_AudioFormat;
|
|||
|
||||
/**
|
||||
* \name int32 support
|
||||
*
|
||||
* New to SDL 1.3.
|
||||
*/
|
||||
/*@{*/
|
||||
#define AUDIO_S32LSB 0x8020 /**< 32-bit integer samples */
|
||||
|
@ -111,8 +107,6 @@ typedef Uint16 SDL_AudioFormat;
|
|||
|
||||
/**
|
||||
* \name float32 support
|
||||
*
|
||||
* New to SDL 1.3.
|
||||
*/
|
||||
/*@{*/
|
||||
#define AUDIO_F32LSB 0x8120 /**< 32-bit floating point samples */
|
||||
|
@ -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"
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
/**
|
||||
|
@ -83,9 +81,7 @@ SDL_MostSignificantBitIndex32(Uint32 x)
|
|||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
}
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
/**
|
||||
|
@ -232,9 +230,7 @@ SDL_SwapFloat(float x)
|
|||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
}
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
/* Public functions */
|
||||
|
@ -69,9 +67,7 @@ extern DECLSPEC int SDLCALL SDL_Error(SDL_errorcode code);
|
|||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
}
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
/* General keyboard/mouse state definitions */
|
||||
|
@ -714,9 +712,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"
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
/**
|
||||
|
@ -287,9 +285,7 @@ extern DECLSPEC void SDLCALL SDL_GameControllerClose(SDL_GameController *gamecon
|
|||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
}
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
|
|
@ -119,9 +119,7 @@
|
|||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
extern "C" {
|
||||
/* *INDENT-ON* */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/**
|
||||
|
@ -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"
|
||||
|
||||
|
|
|
@ -44,9 +44,7 @@
|
|||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
extern "C" {
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@ -279,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"
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
/**
|
||||
|
@ -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"
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
/**
|
||||
|
@ -208,9 +206,7 @@ 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"
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
||||
|
@ -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"
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
/**
|
||||
|
@ -137,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"
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
typedef struct SDL_Cursor SDL_Cursor; /* Implementation dependent */
|
||||
|
@ -217,9 +215,7 @@ extern DECLSPEC int SDLCALL SDL_ShowCursor(int toggle);
|
|||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
}
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
|
|
|
@ -34,9 +34,7 @@
|
|||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
extern "C" {
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@ -244,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"
|
||||
|
||||
|
|
|
@ -79,7 +79,6 @@
|
|||
*/
|
||||
|
||||
#if !defined(NO_SDL_GLEXT) && !defined(GL_GLEXT_LEGACY)
|
||||
/* *INDENT-OFF* */
|
||||
#ifndef __glext_h_
|
||||
#define __glext_h_
|
||||
|
||||
|
@ -11122,7 +11121,6 @@ typedef void (APIENTRYP PFNGLVDPAUUNMAPSURFACESNVPROC) (GLsizei numSurface, cons
|
|||
#endif
|
||||
|
||||
#endif
|
||||
/* *INDENT-ON* */
|
||||
#endif /* NO_SDL_GLEXT */
|
||||
|
||||
#endif /* !__IPHONEOS__ */
|
||||
|
|
|
@ -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
|
||||
|
||||
/**
|
||||
|
@ -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"
|
||||
|
||||
|
|
|
@ -126,9 +126,7 @@
|
|||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
extern "C" {
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@ -138,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"
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
/**
|
||||
|
@ -68,9 +66,7 @@ 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"
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
/**
|
||||
|
@ -131,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"
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
/**
|
||||
|
@ -830,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"
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
/* RWops Types */
|
||||
|
@ -225,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"
|
||||
|
||||
|
|
|
@ -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
|
||||
|
@ -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"
|
||||
|
||||
|
|
|
@ -194,9 +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
|
||||
|
||||
#if defined(HAVE_ALLOCA) && !defined(alloca)
|
||||
|
@ -785,9 +783,7 @@ extern DECLSPEC char *SDLCALL SDL_iconv_string(const char *tocode,
|
|||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
}
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
/**
|
||||
|
@ -498,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"
|
||||
|
||||
|
|
|
@ -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 */
|
||||
|
@ -98,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"
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
/**
|
||||
|
@ -230,9 +228,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"
|
||||
|
||||
|
|
|
@ -46,9 +46,7 @@
|
|||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
extern "C" {
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
|
||||
/* Global definitions */
|
||||
|
@ -61,9 +59,7 @@ extern "C" {
|
|||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
}
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
#include "close_code.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
|
||||
|
||||
/**
|
||||
|
@ -98,9 +96,7 @@ void SDLTest_LogAssertSummary();
|
|||
int SDLTest_AssertSummaryToTestResult();
|
||||
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
}
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
|
|
|
@ -109,9 +109,7 @@ typedef struct
|
|||
#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 */
|
||||
|
@ -175,9 +173,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"
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
/**
|
||||
|
@ -62,9 +60,7 @@ int SDLTest_CompareSurfaces(SDL_Surface *surface, SDL_Surface *referenceSurface,
|
|||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
}
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
#include "close_code.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
|
||||
|
||||
|
||||
|
@ -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"
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
||||
|
@ -377,9 +375,7 @@ int SDLTest_GetFuzzerInvocationCount();
|
|||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
}
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
#include "close_code.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
|
||||
|
||||
|
||||
|
@ -116,9 +114,7 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user
|
|||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
}
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
|
|
|
@ -41,9 +41,7 @@
|
|||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
extern "C" {
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@ -71,9 +69,7 @@ SDL_Surface *SDLTest_ImagePrimitivesBlend();
|
|||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
}
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
#include "close_code.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
|
||||
|
||||
/**
|
||||
|
@ -60,9 +58,7 @@ void SDLTest_LogError(const char *fmt, ...);
|
|||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
}
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
|
|
|
@ -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 --------- */
|
||||
|
@ -122,9 +120,7 @@ extern "C" {
|
|||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
}
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
#include "close_code.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 */
|
||||
|
@ -108,9 +106,7 @@ extern "C" {
|
|||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
}
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
|
|
|
@ -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 */
|
||||
|
@ -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"
|
||||
|
||||
|
|
|
@ -34,9 +34,7 @@
|
|||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
extern "C" {
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@ -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"
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
typedef Sint64 SDL_TouchID;
|
||||
|
@ -79,9 +77,7 @@ extern DECLSPEC SDL_Finger * SDLCALL SDL_GetTouchFinger(SDL_TouchID touchID, int
|
|||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
}
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
/**
|
||||
|
@ -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"
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
/**
|
||||
|
@ -936,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"
|
||||
|
||||
|
|
|
@ -138,7 +138,7 @@ SDL_InitSubSystem(Uint32 flags)
|
|||
}
|
||||
|
||||
if ((flags & SDL_INIT_GAMECONTROLLER)) {
|
||||
// Game controller implies Joystick.
|
||||
/* Game controller implies Joystick. */
|
||||
flags |= SDL_INIT_JOYSTICK;
|
||||
}
|
||||
|
||||
|
@ -221,7 +221,7 @@ SDL_QuitSubSystem(Uint32 flags)
|
|||
/* Shut down requested initialized subsystems */
|
||||
#if !SDL_JOYSTICK_DISABLED
|
||||
if ((flags & SDL_INIT_GAMECONTROLLER)) {
|
||||
// Game controller implies Joystick.
|
||||
/* Game controller implies Joystick. */
|
||||
flags |= SDL_INIT_JOYSTICK;
|
||||
|
||||
if (SDL_PrivateShouldQuitSubsystem(SDL_INIT_GAMECONTROLLER)) {
|
||||
|
|
|
@ -328,7 +328,6 @@ SDL_LogOutput(void *userdata, int category, SDL_LogPriority priority,
|
|||
}
|
||||
}
|
||||
#elif defined(__PSP__)
|
||||
//Simple Log System for PSP
|
||||
{
|
||||
unsigned int length;
|
||||
char* output;
|
||||
|
|
|
@ -61,4 +61,5 @@ typedef struct Chunk
|
|||
Uint32 length;
|
||||
Uint8 *data;
|
||||
} Chunk;
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
|
|
|
@ -40,7 +40,7 @@ AndroidAUD_OpenDevice(_THIS, const char *devname, int iscapture)
|
|||
SDL_AudioFormat test_format;
|
||||
|
||||
if (iscapture) {
|
||||
//TODO: implement capture
|
||||
/* TODO: implement capture */
|
||||
return SDL_SetError("Capture not supported on Android");
|
||||
}
|
||||
|
||||
|
@ -57,7 +57,7 @@ AndroidAUD_OpenDevice(_THIS, const char *devname, int iscapture)
|
|||
SDL_memset(this->hidden, 0, (sizeof *this->hidden));
|
||||
|
||||
test_format = SDL_FirstAudioFormat(this->spec.format);
|
||||
while (test_format != 0) { // no "UNKNOWN" constant
|
||||
while (test_format != 0) { /* no "UNKNOWN" constant */
|
||||
if ((test_format == AUDIO_U8) || (test_format == AUDIO_S16LSB)) {
|
||||
this->spec.format = test_format;
|
||||
break;
|
||||
|
@ -66,7 +66,7 @@ AndroidAUD_OpenDevice(_THIS, const char *devname, int iscapture)
|
|||
}
|
||||
|
||||
if (test_format == 0) {
|
||||
// Didn't find a compatible format :(
|
||||
/* Didn't find a compatible format :( */
|
||||
return SDL_SetError("No compatible audio format!");
|
||||
}
|
||||
|
||||
|
@ -83,12 +83,12 @@ AndroidAUD_OpenDevice(_THIS, const char *devname, int iscapture)
|
|||
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?
|
||||
/* Init failed? */
|
||||
return SDL_SetError("Java-side initialization failed!");
|
||||
}
|
||||
|
||||
|
@ -132,7 +132,7 @@ AndroidAUD_Init(SDL_AudioDriverImpl * impl)
|
|||
|
||||
/* and the capabilities */
|
||||
impl->ProvidesOwnCallbackThread = 1;
|
||||
impl->HasCaptureSupport = 0; //TODO
|
||||
impl->HasCaptureSupport = 0; /* TODO */
|
||||
impl->OnlyHasDefaultOutputDevice = 1;
|
||||
impl->OnlyHasDefaultInputDevice = 1;
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
|
||||
#include <fusionsound/fusionsound_version.h>
|
||||
|
||||
//#define SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC "libfusionsound.so"
|
||||
/* #define SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC "libfusionsound.so" */
|
||||
|
||||
#ifdef SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC
|
||||
#include "SDL_name.h"
|
||||
|
|
|
@ -35,13 +35,10 @@
|
|||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
|
||||
//TODO: Replace with malloc
|
||||
/* TODO: Replace with malloc */
|
||||
|
||||
#define MAXPATHSIZE 1024
|
||||
|
||||
|
||||
|
||||
|
||||
#define DOLLARNPOINTS 64
|
||||
#define DOLLARSIZE 256
|
||||
|
||||
|
|
|
@ -199,7 +199,7 @@ SDL_SendWindowEvent(SDL_Window * window, Uint8 windowevent, int data1,
|
|||
|
||||
if (windowevent == SDL_WINDOWEVENT_CLOSE) {
|
||||
if ( !window->prev && !window->next ) {
|
||||
// This is the last window in the list so send the SDL_QUIT event
|
||||
/* This is the last window in the list so send the SDL_QUIT event */
|
||||
SDL_SendQuit();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ 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 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);
|
||||
|
|
|
@ -506,7 +506,7 @@ SDL_SYS_ToDirection(SDL_HapticDirection * dir)
|
|||
180 deg -> 0x8000 (up)
|
||||
270 deg -> 0xC000 (right)
|
||||
*/
|
||||
tmp = (((18000 + dir->dir[0]) % 36000) * 0xFFFF) / 36000; // convert to range [0,0xFFFF]
|
||||
tmp = (((18000 + dir->dir[0]) % 36000) * 0xFFFF) / 36000; /* convert to range [0,0xFFFF] */
|
||||
return (Uint16) tmp;
|
||||
|
||||
case SDL_HAPTIC_SPHERICAL:
|
||||
|
@ -519,7 +519,7 @@ SDL_SYS_ToDirection(SDL_HapticDirection * dir)
|
|||
--> 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]
|
||||
tmp = (((18000 + tmp) % 36000) * 0xFFFF) / 36000; /* convert to range [0,0xFFFF] */
|
||||
return (Uint16) tmp;
|
||||
|
||||
case SDL_HAPTIC_CARTESIAN:
|
||||
|
@ -535,7 +535,7 @@ SDL_SYS_ToDirection(SDL_HapticDirection * dir)
|
|||
--> 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]
|
||||
tmp = (((18000 + tmp) % 36000) * 0xFFFF) / 36000; /* convert to range [0,0xFFFF] */
|
||||
return (Uint16) tmp;
|
||||
|
||||
default:
|
||||
|
|
|
@ -41,8 +41,8 @@ static struct
|
|||
char *name;
|
||||
SDL_Haptic *haptic;
|
||||
DIDEVCAPS capabilities;
|
||||
Uint8 bXInputHaptic; // Supports force feedback via XInput.
|
||||
Uint8 userid; // XInput userid index for this joystick
|
||||
Uint8 bXInputHaptic; /* Supports force feedback via XInput. */
|
||||
Uint8 userid; /* XInput userid index for this joystick */
|
||||
} SDL_hapticlist[MAX_HAPTICS];
|
||||
|
||||
|
||||
|
@ -54,8 +54,8 @@ struct haptic_hwdata
|
|||
LPDIRECTINPUTDEVICE8 device;
|
||||
DWORD axes[3]; /* Axes to use. */
|
||||
int is_joystick; /* Device is loaded as joystick. */
|
||||
Uint8 bXInputHaptic; // Supports force feedback via XInput.
|
||||
Uint8 userid; // XInput userid index for this joystick
|
||||
Uint8 bXInputHaptic; /* Supports force feedback via XInput. */
|
||||
Uint8 userid; /* XInput userid index for this joystick */
|
||||
};
|
||||
|
||||
|
||||
|
@ -1264,12 +1264,13 @@ SDL_SYS_HapticUpdateEffect(SDL_Haptic * haptic,
|
|||
DIEFFECT temp;
|
||||
|
||||
if (haptic->hwdata->bXInputHaptic) {
|
||||
// !!! FIXME: this isn't close to right. We only support "sine" effects,
|
||||
// !!! FIXME: we ignore most of the parameters, and we probably get
|
||||
// !!! FIXME: the ones we don't ignore wrong, too.
|
||||
// !!! FIXME: if I had a better understanding of how the two motors
|
||||
// !!! FIXME: could be used in unison, perhaps I could implement other
|
||||
// !!! FIXME: effect types?
|
||||
/* !!! FIXME: this isn't close to right. We only support "sine" effects,
|
||||
* !!! FIXME: we ignore most of the parameters, and we probably get
|
||||
* !!! FIXME: the ones we don't ignore wrong, too.
|
||||
* !!! FIXME: if I had a better understanding of how the two motors
|
||||
* !!! FIXME: could be used in unison, perhaps I could implement other
|
||||
* !!! FIXME: effect types?
|
||||
*/
|
||||
/* From MSDN:
|
||||
"Note that the right motor is the high-frequency motor, the left
|
||||
motor is the low-frequency motor. They do not always need to be
|
||||
|
@ -1528,5 +1529,6 @@ SDL_SYS_HapticStopAll(SDL_Haptic * haptic)
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
#endif /* SDL_HAPTIC_DINPUT */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
|
|
|
@ -57,7 +57,7 @@ struct _SDL_ControllerMapping
|
|||
SDL_JoystickGUID guid;
|
||||
const char *name;
|
||||
|
||||
// mapping of axis/button id to controller version
|
||||
/* mapping of axis/button id to controller version */
|
||||
int axes[SDL_CONTROLLER_AXIS_MAX];
|
||||
int buttonasaxis[SDL_CONTROLLER_AXIS_MAX];
|
||||
|
||||
|
@ -65,7 +65,7 @@ struct _SDL_ControllerMapping
|
|||
int axesasbutton[SDL_CONTROLLER_BUTTON_MAX];
|
||||
struct _SDL_HatMapping hatasbutton[SDL_CONTROLLER_BUTTON_MAX];
|
||||
|
||||
// reverse mapping, joystick indices to buttons
|
||||
/* reverse mapping, joystick indices to buttons */
|
||||
SDL_GameControllerAxis raxes[k_nMaxReverseEntries];
|
||||
SDL_GameControllerAxis rbuttonasaxis[k_nMaxReverseEntries];
|
||||
|
||||
|
@ -102,15 +102,15 @@ const char *s_ControllerMappings [] =
|
|||
"4c050000000000006802000000000000,PS3 Controller,a:b14,b:b13,x:b12,y:b15,start:b3,guide:b16,back:b0,leftstick:b1,rightstick:b2,leftshoulder:b10,rightshoulder:b11,dpup:b4,dpleft:b6,dpdown:b7,dpright:b5,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b8,righttrigger:b9",
|
||||
"0500000047532047616d657061640000,GameStop Gamepad,a:b0,b:b1,y:b3,x:b2,start:b9,guide:,back:b8,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7,",
|
||||
"6d040000000000001fc2000000000000,Logitech F710 Gamepad Controller (XInput),a:b0,b:b1,y:b3,x:b2,start:b8,guide:b10,back:b9,leftstick:b6,rightstick:b7,leftshoulder:b4,rightshoulder:b5,dpup:b11,dpleft:b13,dpdown:b12,dpright:b14,leftx:a0,lefty:a1,rightx:a3,righty:a4,lefttrigger:a2,righttrigger:a5,",
|
||||
"6d0400000000000016c2000000000000,Logitech F310 Gamepad Controller (DInput),a:b1,b:b2,y:b3,x:b0,start:b9,back:b8,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7,", // Guide button doesn't seem to be sent in DInput mode.
|
||||
"6d0400000000000019c2000000000000,Logitech Wireless Gamepad Controller (DInput),a:b1,b:b2,y:b3,x:b0,start:b9,back:b8,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7,", // This includes F710 in DInput mode and the "Logitech Cordless RumblePad 2", at the very least.
|
||||
"6d0400000000000016c2000000000000,Logitech F310 Gamepad Controller (DInput),a:b1,b:b2,y:b3,x:b0,start:b9,back:b8,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7,", /* Guide button doesn't seem to be sent in DInput mode. */
|
||||
"6d0400000000000019c2000000000000,Logitech Wireless Gamepad Controller (DInput),a:b1,b:b2,y:b3,x:b0,start:b9,back:b8,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7,", /* This includes F710 in DInput mode and the "Logitech Cordless RumblePad 2", at the very least. */
|
||||
#elif defined(__LINUX__)
|
||||
"030000005e0400008e02000014010000,X360 Controller,a:b0,b:b1,y:b3,x:b2,start:b7,guide:b8,back:b6,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftshoulder:b4,rightshoulder:b5,leftstick:b9,rightstick:b10,leftx:a0,lefty:a1,rightx:a3,righty:a4,lefttrigger:a2,righttrigger:a5",
|
||||
"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.
|
||||
"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,",
|
||||
|
@ -156,7 +156,7 @@ int SDL_GameControllerEventWatcher(void *userdata, SDL_Event * event)
|
|||
{
|
||||
if ( controllerlist->joystick->instance_id == event->jaxis.which )
|
||||
{
|
||||
if ( controllerlist->mapping.raxes[event->jaxis.axis] >= 0 ) // simple axis to axis, send it through
|
||||
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;
|
||||
|
@ -171,7 +171,7 @@ int SDL_GameControllerEventWatcher(void *userdata, SDL_Event * event)
|
|||
}
|
||||
SDL_PrivateGameControllerAxis( controllerlist, axis, value );
|
||||
}
|
||||
else if ( controllerlist->mapping.raxesasbutton[event->jaxis.axis] >= 0 ) // simulate an axis as a button
|
||||
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 );
|
||||
}
|
||||
|
@ -193,11 +193,11 @@ int SDL_GameControllerEventWatcher(void *userdata, SDL_Event * event)
|
|||
{
|
||||
if ( controllerlist->joystick->instance_id == event->jbutton.which )
|
||||
{
|
||||
if ( controllerlist->mapping.rbuttons[event->jbutton.button] >= 0 ) // simple button as button
|
||||
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
|
||||
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 );
|
||||
}
|
||||
|
@ -219,9 +219,9 @@ int SDL_GameControllerEventWatcher(void *userdata, SDL_Event * event)
|
|||
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)
|
||||
/* Get list of removed bits (button release) */
|
||||
Uint8 bChanged = controllerlist->hatState[event->jhat.hat] ^ bSame;
|
||||
// the hat idx in the high nibble
|
||||
/* the hat idx in the high nibble */
|
||||
int bHighHat = event->jhat.hat << 4;
|
||||
|
||||
if ( bChanged & SDL_HAT_DOWN )
|
||||
|
@ -233,7 +233,7 @@ int SDL_GameControllerEventWatcher(void *userdata, SDL_Event * event)
|
|||
if ( bChanged & SDL_HAT_RIGHT )
|
||||
SDL_PrivateGameControllerButton( controllerlist, controllerlist->mapping.rhatasbutton[bHighHat | SDL_HAT_RIGHT], SDL_RELEASED );
|
||||
|
||||
// Get list of added bits (button press)
|
||||
/* Get list of added bits (button press) */
|
||||
bChanged = event->jhat.value ^ bSame;
|
||||
|
||||
if ( bChanged & SDL_HAT_DOWN )
|
||||
|
@ -245,7 +245,7 @@ int SDL_GameControllerEventWatcher(void *userdata, SDL_Event * event)
|
|||
if ( bChanged & SDL_HAT_RIGHT )
|
||||
SDL_PrivateGameControllerButton( controllerlist, controllerlist->mapping.rhatasbutton[bHighHat | SDL_HAT_RIGHT], SDL_PRESSED );
|
||||
|
||||
// update our state cache
|
||||
/* update our state cache */
|
||||
controllerlist->hatState[event->jhat.hat] = event->jhat.value;
|
||||
|
||||
break;
|
||||
|
@ -570,7 +570,7 @@ void SDL_PrivateLoadButtonMapping( struct _SDL_ControllerMapping *pMapping, SDL_
|
|||
pMapping->guid = guid;
|
||||
pMapping->name = pchName;
|
||||
|
||||
// set all the button mappings to non defaults
|
||||
/* set all the button mappings to non defaults */
|
||||
for ( j = 0; j < SDL_CONTROLLER_AXIS_MAX; j++ )
|
||||
{
|
||||
pMapping->axes[j] = -1;
|
||||
|
@ -680,7 +680,7 @@ void SDL_PrivateGameControllerRefreshMapping( ControllerMapping_t *pControllerMa
|
|||
event.cdevice.which = gamecontrollerlist->joystick->instance_id;
|
||||
SDL_PushEvent(&event);
|
||||
|
||||
// Not really threadsafe. Should this lock access within SDL_GameControllerEventWatcher?
|
||||
/* Not really threadsafe. Should this lock access within SDL_GameControllerEventWatcher? */
|
||||
SDL_PrivateLoadButtonMapping(&gamecontrollerlist->mapping, pControllerMapping->guid, pControllerMapping->name, pControllerMapping->mapping);
|
||||
}
|
||||
|
||||
|
@ -727,12 +727,12 @@ SDL_GameControllerAddMapping( const char *mappingString )
|
|||
}
|
||||
|
||||
if (pControllerMapping) {
|
||||
// Update existing mapping
|
||||
/* Update existing mapping */
|
||||
SDL_free( pControllerMapping->name );
|
||||
pControllerMapping->name = pchName;
|
||||
SDL_free( pControllerMapping->mapping );
|
||||
pControllerMapping->mapping = pchMapping;
|
||||
// refresh open controllers
|
||||
/* refresh open controllers */
|
||||
SDL_PrivateGameControllerRefreshMapping( pControllerMapping );
|
||||
return 0;
|
||||
} else {
|
||||
|
@ -769,7 +769,7 @@ SDL_GameControllerMappingForGUID( SDL_JoystickGUID guid )
|
|||
char pchGUID[33];
|
||||
size_t needed;
|
||||
SDL_JoystickGetGUIDString(guid, pchGUID, sizeof(pchGUID));
|
||||
// allocate enough memory for GUID + ',' + name + ',' + mapping + \0
|
||||
/* 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 );
|
||||
|
@ -831,7 +831,7 @@ SDL_GameControllerInit(void)
|
|||
pMappingString = s_ControllerMappings[i];
|
||||
}
|
||||
|
||||
// load in any user supplied config
|
||||
/* load in any user supplied config */
|
||||
SDL_GameControllerLoadHints();
|
||||
|
||||
/* watch for joy events and fire controller ones if needed */
|
||||
|
@ -891,7 +891,7 @@ SDL_GameControllerOpen(int device_index)
|
|||
}
|
||||
|
||||
gamecontrollerlist = SDL_gamecontrollers;
|
||||
// If the controller is already open, return it
|
||||
/* If the controller is already open, return it */
|
||||
while ( gamecontrollerlist )
|
||||
{
|
||||
if ( SDL_SYS_GetInstanceIdOfDeviceIndex(device_index) == gamecontrollerlist->joystick->instance_id ) {
|
||||
|
@ -902,14 +902,14 @@ SDL_GameControllerOpen(int device_index)
|
|||
gamecontrollerlist = gamecontrollerlist->next;
|
||||
}
|
||||
|
||||
// Find a controller mapping
|
||||
/* 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
|
||||
/* Create and initialize the joystick */
|
||||
gamecontroller = (SDL_GameController *) SDL_malloc((sizeof *gamecontroller));
|
||||
if (gamecontroller == NULL) {
|
||||
SDL_OutOfMemory();
|
||||
|
@ -925,9 +925,9 @@ SDL_GameControllerOpen(int device_index)
|
|||
|
||||
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
|
||||
/* Link the joystick in the list */
|
||||
gamecontroller->next = SDL_gamecontrollers;
|
||||
SDL_gamecontrollers = gamecontroller;
|
||||
|
||||
|
@ -1113,7 +1113,7 @@ SDL_GameControllerClose(SDL_GameController * gamecontroller)
|
|||
if ( !gamecontroller )
|
||||
return;
|
||||
|
||||
// First decrement ref count
|
||||
/* First decrement ref count */
|
||||
if (--gamecontroller->ref_count > 0) {
|
||||
return;
|
||||
}
|
||||
|
@ -1128,7 +1128,7 @@ SDL_GameControllerClose(SDL_GameController * gamecontroller)
|
|||
{
|
||||
if ( gamecontrollerlistprev )
|
||||
{
|
||||
// unlink this entry
|
||||
/* unlink this entry */
|
||||
gamecontrollerlistprev->next = gamecontrollerlist->next;
|
||||
}
|
||||
else
|
||||
|
@ -1269,5 +1269,4 @@ SDL_GameControllerEventState(int state)
|
|||
#endif /* SDL_EVENTS_DISABLED */
|
||||
}
|
||||
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
|
|
|
@ -400,7 +400,7 @@ SDL_JoystickClose(SDL_Joystick * joystick)
|
|||
{
|
||||
if ( joysticklistprev )
|
||||
{
|
||||
// unlink this entry
|
||||
/* unlink this entry */
|
||||
joysticklistprev->next = joysticklist->next;
|
||||
}
|
||||
else
|
||||
|
@ -629,8 +629,9 @@ SDL_JoystickUpdate(void)
|
|||
joystick = joysticknext;
|
||||
}
|
||||
|
||||
// this needs to happen AFTER walking the joystick list above, so that any
|
||||
// dangling hardware data from removed devices can be free'd
|
||||
/* 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();
|
||||
}
|
||||
|
||||
|
@ -702,8 +703,8 @@ void SDL_JoystickGetGUIDString( SDL_JoystickGUID guid, char *pszGUID, int cbGUID
|
|||
|
||||
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
|
||||
/* 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 ];
|
||||
|
@ -713,11 +714,11 @@ void SDL_JoystickGetGUIDString( SDL_JoystickGUID guid, char *pszGUID, int cbGUID
|
|||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// 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' ) &&
|
||||
|
@ -738,8 +739,8 @@ static unsigned char nibble( char c )
|
|||
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 );
|
||||
/* received an invalid character, and no real way to return an error */
|
||||
/* AssertMsg1( false, "Q_nibble invalid hex character '%c' ", c ); */
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -753,7 +754,7 @@ SDL_JoystickGUID SDL_JoystickGetGUIDFromString(const char *pchGUID)
|
|||
Uint8 *p;
|
||||
int i;
|
||||
|
||||
// Make sure it's even
|
||||
/* Make sure it's even */
|
||||
len = ( len ) & ~0x1;
|
||||
|
||||
SDL_memset( &guid, 0x00, sizeof(guid) );
|
||||
|
|
|
@ -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 ) ) );
|
||||
|
|
|
@ -261,7 +261,7 @@ extern "C"
|
|||
SDL_JoystickGUID SDL_SYS_JoystickGetDeviceGUID( int device_index )
|
||||
{
|
||||
SDL_JoystickGUID guid;
|
||||
// the GUID is just the first 16 chars of the name for now
|
||||
/* the GUID is just the first 16 chars of the name for now */
|
||||
const char *name = SDL_SYS_JoystickNameForDeviceIndex( device_index );
|
||||
SDL_zero( guid );
|
||||
SDL_memcpy( &guid, name, SDL_min( sizeof(guid), SDL_strlen( name ) ) );
|
||||
|
@ -271,7 +271,7 @@ extern "C"
|
|||
SDL_JoystickGUID SDL_SYS_JoystickGetGUID(SDL_Joystick * joystick)
|
||||
{
|
||||
SDL_JoystickGUID guid;
|
||||
// the GUID is just the first 16 chars of the name for now
|
||||
/* the GUID is just the first 16 chars of the name for now */
|
||||
const char *name = joystick->name;
|
||||
SDL_zero( guid );
|
||||
SDL_memcpy( &guid, name, SDL_min( sizeof(guid), SDL_strlen( name ) ) );
|
||||
|
|
|
@ -589,7 +589,7 @@ SDL_SYS_JoystickQuit(void)
|
|||
SDL_JoystickGUID SDL_SYS_JoystickGetDeviceGUID( int device_index )
|
||||
{
|
||||
SDL_JoystickGUID guid;
|
||||
// the GUID is just the first 16 chars of the name for now
|
||||
/* the GUID is just the first 16 chars of the name for now */
|
||||
const char *name = SDL_SYS_JoystickNameForDeviceIndex( device_index );
|
||||
SDL_zero( guid );
|
||||
SDL_memcpy( &guid, name, SDL_min( sizeof(guid), SDL_strlen( name ) ) );
|
||||
|
@ -599,7 +599,7 @@ SDL_JoystickGUID SDL_SYS_JoystickGetDeviceGUID( int device_index )
|
|||
SDL_JoystickGUID SDL_SYS_JoystickGetGUID(SDL_Joystick * joystick)
|
||||
{
|
||||
SDL_JoystickGUID guid;
|
||||
// the GUID is just the first 16 chars of the name for now
|
||||
/* the GUID is just the first 16 chars of the name for now */
|
||||
const char *name = joystick->name;
|
||||
SDL_zero( guid );
|
||||
SDL_memcpy( &guid, name, SDL_min( sizeof(guid), SDL_strlen( name ) ) );
|
||||
|
|
|
@ -189,7 +189,7 @@ HIDCreateOpenDeviceInterface(io_object_t hidDevice, recDevice * pDevice)
|
|||
{
|
||||
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);
|
||||
|
@ -201,7 +201,7 @@ HIDCreateOpenDeviceInterface(io_object_t hidDevice, recDevice * pDevice)
|
|||
IONotificationPortGetRunLoopSource(pDevice->notificationPort),
|
||||
kCFRunLoopDefaultMode);
|
||||
|
||||
// Register for notifications when a serial port is added to the system
|
||||
/* Register for notifications when a serial port is added to the system */
|
||||
result = IOServiceAddInterestNotification(pDevice->notificationPort,
|
||||
hidDevice,
|
||||
kIOGeneralInterest,
|
||||
|
@ -786,14 +786,14 @@ SDL_SYS_JoystickInit(void)
|
|||
IONotificationPortGetRunLoopSource(notificationPort),
|
||||
kCFRunLoopDefaultMode);
|
||||
|
||||
// Register for notifications when a serial port is added to the system
|
||||
/* 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).
|
||||
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();
|
||||
}
|
||||
|
@ -826,7 +826,7 @@ SDL_SYS_JoystickDetect()
|
|||
s_bDeviceAdded = SDL_FALSE;
|
||||
s_bDeviceRemoved = SDL_FALSE;
|
||||
int device_index = 0;
|
||||
// send notifications
|
||||
/* send notifications */
|
||||
while ( device )
|
||||
{
|
||||
if ( device->send_open_event )
|
||||
|
|
|
@ -110,7 +110,7 @@ SDL_SYS_JoystickQuit(void)
|
|||
SDL_JoystickGUID SDL_SYS_JoystickGetDeviceGUID( int device_index )
|
||||
{
|
||||
SDL_JoystickGUID guid;
|
||||
// the GUID is just the first 16 chars of the name for now
|
||||
/* the GUID is just the first 16 chars of the name for now */
|
||||
const char *name = SDL_SYS_JoystickNameForDeviceIndex( device_index );
|
||||
SDL_zero( guid );
|
||||
SDL_memcpy( &guid, name, SDL_min( sizeof(guid), SDL_strlen( name ) ) );
|
||||
|
@ -121,7 +121,7 @@ SDL_JoystickGUID SDL_SYS_JoystickGetDeviceGUID( int device_index )
|
|||
SDL_JoystickGUID SDL_SYS_JoystickGetGUID(SDL_Joystick * joystick)
|
||||
{
|
||||
SDL_JoystickGUID guid;
|
||||
// the GUID is just the first 16 chars of the name for now
|
||||
/* the GUID is just the first 16 chars of the name for now */
|
||||
const char *name = joystick->name;
|
||||
SDL_zero( guid );
|
||||
SDL_memcpy( &guid, name, SDL_min( sizeof(guid), SDL_strlen( name ) ) );
|
||||
|
|
|
@ -133,7 +133,7 @@ SDL_SYS_JoystickQuit(void)
|
|||
SDL_JoystickGUID SDL_SYS_JoystickGetDeviceGUID( int device_index )
|
||||
{
|
||||
SDL_JoystickGUID guid;
|
||||
// the GUID is just the first 16 chars of the name for now
|
||||
/* the GUID is just the first 16 chars of the name for now */
|
||||
const char *name = SDL_SYS_JoystickNameForDeviceIndex( device_index );
|
||||
SDL_zero( guid );
|
||||
SDL_memcpy( &guid, name, SDL_min( sizeof(guid), SDL_strlen( name ) ) );
|
||||
|
@ -143,7 +143,7 @@ SDL_JoystickGUID SDL_SYS_JoystickGetDeviceGUID( int device_index )
|
|||
SDL_JoystickGUID SDL_SYS_JoystickGetGUID(SDL_Joystick * joystick)
|
||||
{
|
||||
SDL_JoystickGUID guid;
|
||||
// the GUID is just the first 16 chars of the name for now
|
||||
/* the GUID is just the first 16 chars of the name for now */
|
||||
const char *name = joystick->name;
|
||||
SDL_zero( guid );
|
||||
SDL_memcpy( &guid, name, SDL_min( sizeof(guid), SDL_strlen( name ) ) );
|
||||
|
|
|
@ -510,7 +510,7 @@ void SDL_SYS_JoystickDetect()
|
|||
SDL_PushEvent(&event);
|
||||
}
|
||||
}
|
||||
#endif // !SDL_EVENTS_DISABLED
|
||||
#endif /* !SDL_EVENTS_DISABLED */
|
||||
}
|
||||
} else if (SDL_strcmp(action, "remove") == 0) {
|
||||
const int inst = MaybeRemoveDevice(devnode);
|
||||
|
@ -527,7 +527,7 @@ void SDL_SYS_JoystickDetect()
|
|||
SDL_PushEvent(&event);
|
||||
}
|
||||
}
|
||||
#endif // !SDL_EVENTS_DISABLED
|
||||
#endif /* !SDL_EVENTS_DISABLED */
|
||||
}
|
||||
}
|
||||
UDEV_udev_device_unref(dev);
|
||||
|
@ -760,7 +760,7 @@ SDL_SYS_JoystickOpen(SDL_Joystick * joystick, int device_index)
|
|||
/* Get the number of buttons and axes on the joystick */
|
||||
ConfigJoystick(joystick, fd);
|
||||
|
||||
// mark joystick as fresh and ready
|
||||
/* mark joystick as fresh and ready */
|
||||
joystick->hwdata->fresh = 1;
|
||||
|
||||
return (0);
|
||||
|
@ -840,7 +840,7 @@ PollAllValues(SDL_Joystick * joystick)
|
|||
struct input_absinfo absinfo;
|
||||
int a, b = 0;
|
||||
|
||||
// Poll all axis
|
||||
/* Poll all axis */
|
||||
for (a = ABS_X; b < ABS_MAX; a++) {
|
||||
switch (a) {
|
||||
case ABS_HAT0X:
|
||||
|
@ -851,7 +851,7 @@ PollAllValues(SDL_Joystick * joystick)
|
|||
case ABS_HAT2Y:
|
||||
case ABS_HAT3X:
|
||||
case ABS_HAT3Y:
|
||||
// ingore hats
|
||||
/* ingore hats */
|
||||
break;
|
||||
default:
|
||||
if (joystick->hwdata->abs_correct[b].used) {
|
||||
|
|
|
@ -53,29 +53,29 @@ typedef struct
|
|||
int y;
|
||||
} point;
|
||||
|
||||
// 4 points define the bezier-curve.
|
||||
/* 4 points define the bezier-curve. */
|
||||
static point a = { 0, 0 };
|
||||
static point b = { 50, 0 };
|
||||
static point c = { 78, 32767 };
|
||||
static point d = { 128, 32767 };
|
||||
|
||||
// simple linear interpolation between two points
|
||||
/* simple linear interpolation between two points */
|
||||
static __inline__ void lerp (point *dest, point *a, point *b, float t)
|
||||
{
|
||||
dest->x = a->x + (b->x - a->x)*t;
|
||||
dest->y = a->y + (b->y - a->y)*t;
|
||||
}
|
||||
|
||||
// evaluate a point on a bezier-curve. t goes from 0 to 1.0
|
||||
/* evaluate a point on a bezier-curve. t goes from 0 to 1.0 */
|
||||
static int calc_bezier_y(float t)
|
||||
{
|
||||
point ab, bc, cd, abbc, bccd, dest;
|
||||
lerp (&ab, &a, &b, t); // point between a and b
|
||||
lerp (&bc, &b, &c, t); // point between b and c
|
||||
lerp (&cd, &c, &d, t); // point between c and d
|
||||
lerp (&abbc, &ab, &bc, t); // point between ab and bc
|
||||
lerp (&bccd, &bc, &cd, t); // point between bc and cd
|
||||
lerp (&dest, &abbc, &bccd, t); // point on the bezier-curve
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -105,7 +105,7 @@ int SDL_SYS_JoystickInit(void)
|
|||
{
|
||||
int i;
|
||||
|
||||
// SDL_numjoysticks = 1;
|
||||
/* SDL_numjoysticks = 1; */
|
||||
|
||||
/* Setup input */
|
||||
sceCtrlSetSamplingCycle(0);
|
||||
|
@ -253,7 +253,7 @@ 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
|
||||
/* the GUID is just the first 16 chars of the name for now */
|
||||
const char *name = SDL_SYS_JoystickNameForDeviceIndex( device_index );
|
||||
SDL_zero( guid );
|
||||
SDL_memcpy( &guid, name, SDL_min( sizeof(guid), SDL_strlen( name ) ) );
|
||||
|
@ -263,7 +263,7 @@ SDL_JoystickGUID SDL_SYS_JoystickGetDeviceGUID( int device_index )
|
|||
SDL_JoystickGUID SDL_SYS_JoystickGetGUID(SDL_Joystick * joystick)
|
||||
{
|
||||
SDL_JoystickGUID guid;
|
||||
// the GUID is just the first 16 chars of the name for now
|
||||
/* the GUID is just the first 16 chars of the name for now */
|
||||
const char *name = joystick->name;
|
||||
SDL_zero( guid );
|
||||
SDL_memcpy( &guid, name, SDL_min( sizeof(guid), SDL_strlen( name ) ) );
|
||||
|
|
|
@ -96,10 +96,10 @@ WIN_LoadXInputDLL(void)
|
|||
}
|
||||
|
||||
version = (1 << 16) | 4;
|
||||
s_pXInputDLL = LoadLibrary( L"XInput1_4.dll" ); // 1.4 Ships with Windows 8.
|
||||
s_pXInputDLL = LoadLibrary( L"XInput1_4.dll" ); /* 1.4 Ships with Windows 8. */
|
||||
if (!s_pXInputDLL) {
|
||||
version = (1 << 16) | 3;
|
||||
s_pXInputDLL = LoadLibrary( L"XInput1_3.dll" ); // 1.3 Ships with Vista and Win7, can be installed as a redistributable component.
|
||||
s_pXInputDLL = LoadLibrary( L"XInput1_3.dll" ); /* 1.3 Ships with Vista and Win7, can be installed as a redistributable component. */
|
||||
}
|
||||
if (!s_pXInputDLL) {
|
||||
s_pXInputDLL = LoadLibrary( L"bin\\XInput1_3.dll" );
|
||||
|
@ -173,7 +173,7 @@ static int SDL_PrivateJoystickHat_Int(SDL_Joystick * joystick, Uint8 hat,
|
|||
static int SDL_PrivateJoystickButton_Int(SDL_Joystick * joystick,
|
||||
Uint8 button, Uint8 state);
|
||||
|
||||
// Taken from Wine - Thanks!
|
||||
/* Taken from Wine - Thanks! */
|
||||
DIOBJECTDATAFORMAT dfDIJoystick2[] = {
|
||||
{ &GUID_XAxis,DIJOFS_X,DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0},
|
||||
{ &GUID_YAxis,DIJOFS_Y,DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0},
|
||||
|
@ -375,14 +375,14 @@ SetDIerror(const char *function, HRESULT code)
|
|||
DEFINE_GUID(CLSID_WbemLocator, 0x4590f811,0x1d3a,0x11d0,0x89,0x1F,0x00,0xaa,0x00,0x4b,0x2e,0x24);
|
||||
DEFINE_GUID(IID_IWbemLocator, 0xdc12a687,0x737f,0x11cf,0x88,0x4d,0x00,0xaa,0x00,0x4b,0x2e,0x24);
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// code from MSDN: http://msdn.microsoft.com/en-us/library/windows/desktop/ee417014(v=vs.85).aspx
|
||||
//
|
||||
// Enum each PNP device using WMI and check each device ID to see if it contains
|
||||
// "IG_" (ex. "VID_045E&PID_028E&IG_00"). If it does, then it's an XInput device
|
||||
// Unfortunately this information can not be found by just using DirectInput
|
||||
//-----------------------------------------------------------------------------
|
||||
/*-----------------------------------------------------------------------------
|
||||
*
|
||||
* code from MSDN: http://msdn.microsoft.com/en-us/library/windows/desktop/ee417014(v=vs.85).aspx
|
||||
*
|
||||
* Enum each PNP device using WMI and check each device ID to see if it contains
|
||||
* "IG_" (ex. "VID_045E&PID_028E&IG_00"). If it does, then it's an XInput device
|
||||
* Unfortunately this information can not be found by just using DirectInput
|
||||
*-----------------------------------------------------------------------------*/
|
||||
BOOL IsXInputDevice( const GUID* pGuidProductFromDirectInput )
|
||||
{
|
||||
IWbemLocator* pIWbemLocator = NULL;
|
||||
|
@ -406,11 +406,11 @@ BOOL IsXInputDevice( const GUID* pGuidProductFromDirectInput )
|
|||
|
||||
SDL_memset( pDevices, 0x0, sizeof(pDevices) );
|
||||
|
||||
// CoInit if needed
|
||||
/* CoInit if needed */
|
||||
hr = CoInitialize(NULL);
|
||||
bCleanupCOM = SUCCEEDED(hr);
|
||||
|
||||
// Create WMI
|
||||
/* Create WMI */
|
||||
hr = CoCreateInstance( &CLSID_WbemLocator,
|
||||
NULL,
|
||||
CLSCTX_INPROC_SERVER,
|
||||
|
@ -423,13 +423,13 @@ BOOL IsXInputDevice( const GUID* pGuidProductFromDirectInput )
|
|||
bstrClassName = SysAllocString( L"Win32_PNPEntity" ); if( bstrClassName == NULL ) goto LCleanup;
|
||||
bstrDeviceID = SysAllocString( L"DeviceID" ); if( bstrDeviceID == NULL ) goto LCleanup;
|
||||
|
||||
// Connect to WMI
|
||||
/* Connect to WMI */
|
||||
hr = IWbemLocator_ConnectServer( pIWbemLocator, bstrNamespace, NULL, NULL, 0L,
|
||||
0L, NULL, NULL, &pIWbemServices );
|
||||
if( FAILED(hr) || pIWbemServices == NULL )
|
||||
goto LCleanup;
|
||||
|
||||
// Switch security level to IMPERSONATE.
|
||||
/* 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 );
|
||||
|
||||
|
@ -437,10 +437,10 @@ BOOL IsXInputDevice( const GUID* pGuidProductFromDirectInput )
|
|||
if( FAILED(hr) || pEnumDevices == NULL )
|
||||
goto LCleanup;
|
||||
|
||||
// Loop over all devices
|
||||
/* Loop over all devices */
|
||||
for( ;; )
|
||||
{
|
||||
// Get 20 at a time
|
||||
/* Get 20 at a time */
|
||||
hr = IEnumWbemClassObject_Next( pEnumDevices, 10000, 20, pDevices, &uReturned );
|
||||
if( FAILED(hr) )
|
||||
goto LCleanup;
|
||||
|
@ -449,16 +449,16 @@ BOOL IsXInputDevice( const GUID* pGuidProductFromDirectInput )
|
|||
|
||||
for( iDevice=0; iDevice<uReturned; iDevice++ )
|
||||
{
|
||||
// For each device, get its device ID
|
||||
/* For each device, get its device ID */
|
||||
hr = IWbemClassObject_Get( pDevices[iDevice], bstrDeviceID, 0L, &var, NULL, NULL );
|
||||
if( SUCCEEDED( hr ) && var.vt == VT_BSTR && var.bstrVal != NULL )
|
||||
{
|
||||
// Check if the device ID contains "IG_". If it does, then it's an XInput device
|
||||
// This information can not be found from DirectInput
|
||||
/* Check if the device ID contains "IG_". If it does, then it's an XInput device */
|
||||
/* This information can not be found from DirectInput */
|
||||
char *pDeviceString = WIN_StringToUTF8( var.bstrVal );
|
||||
if( SDL_strstr( pDeviceString, "IG_" ) )
|
||||
{
|
||||
// If it does, then get the VID/PID from var.bstrVal
|
||||
/* If it does, then get the VID/PID from var.bstrVal */
|
||||
long dwPid = 0, dwVid = 0;
|
||||
char * strPid = NULL;
|
||||
DWORD dwVidPid = 0;
|
||||
|
@ -473,7 +473,7 @@ BOOL IsXInputDevice( const GUID* pGuidProductFromDirectInput )
|
|||
dwPid = SDL_strtol( strPid + 4, NULL, 16 );
|
||||
}
|
||||
|
||||
// Compare the VID/PID to the DInput device
|
||||
/* Compare the VID/PID to the DInput device */
|
||||
dwVidPid = MAKELONG( dwVid, dwPid );
|
||||
if( dwVidPid == pGuidProductFromDirectInput->Data1 )
|
||||
{
|
||||
|
@ -560,7 +560,7 @@ SDL_JoystickThread(void *_data)
|
|||
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.lpfnWndProc = SDL_PrivateJoystickDetectProc; /* This function is called by windows */
|
||||
wincl.cbSize = sizeof (WNDCLASSEX);
|
||||
|
||||
if (!RegisterClassEx (&wincl))
|
||||
|
@ -605,7 +605,7 @@ SDL_JoystickThread(void *_data)
|
|||
|
||||
if ( s_bXInputEnabled && XINPUTGETCAPABILITIES )
|
||||
{
|
||||
// scan for any change in XInput devices
|
||||
/* scan for any change in XInput devices */
|
||||
for ( userId = 0; userId < 4; userId++ )
|
||||
{
|
||||
XINPUT_CAPABILITIES capabilities;
|
||||
|
@ -629,7 +629,7 @@ SDL_JoystickThread(void *_data)
|
|||
|
||||
if ( s_pKnownJoystickGUIDs && ( s_bWindowsDeviceChanged || nNewOpenedXInputDevices != nCurrentOpenedXInputDevices ) )
|
||||
{
|
||||
SDL_Delay( 300 ); // wait for direct input to find out about this device
|
||||
SDL_Delay( 300 ); /* wait for direct input to find out about this device */
|
||||
|
||||
s_bDeviceRemoved = SDL_TRUE;
|
||||
s_bDeviceAdded = SDL_TRUE;
|
||||
|
@ -696,7 +696,7 @@ SDL_SYS_JoystickInit(void)
|
|||
|
||||
s_mutexJoyStickEnum = SDL_CreateMutex();
|
||||
s_condJoystickThread = SDL_CreateCond();
|
||||
s_bDeviceAdded = SDL_TRUE; // force a scan of the system for joysticks this first time
|
||||
s_bDeviceAdded = SDL_TRUE; /* force a scan of the system for joysticks this first time */
|
||||
SDL_SYS_JoystickDetect();
|
||||
|
||||
if ((s_bXInputEnabled) && (WIN_LoadXInputDLL() == -1)) {
|
||||
|
@ -761,7 +761,7 @@ static BOOL CALLBACK
|
|||
s_pKnownJoystickGUIDs[ s_iNewGUID ] = pdidInstance->guidInstance;
|
||||
s_iNewGUID++;
|
||||
if ( s_iNewGUID < MAX_JOYSTICKS )
|
||||
return DIENUM_CONTINUE; // already have this joystick loaded, just keep going
|
||||
return DIENUM_CONTINUE; /* already have this joystick loaded, just keep going */
|
||||
else
|
||||
return DIENUM_STOP;
|
||||
}
|
||||
|
@ -805,7 +805,7 @@ static BOOL CALLBACK
|
|||
s_iNewGUID++;
|
||||
|
||||
if ( s_iNewGUID < MAX_JOYSTICKS )
|
||||
return DIENUM_CONTINUE; // already have this joystick loaded, just keep going
|
||||
return DIENUM_CONTINUE; /* already have this joystick loaded, just keep going */
|
||||
else
|
||||
return DIENUM_STOP;
|
||||
}
|
||||
|
@ -856,7 +856,7 @@ void SDL_SYS_JoystickDetect()
|
|||
SDL_PushEvent(&event);
|
||||
}
|
||||
}
|
||||
#endif // !SDL_EVENTS_DISABLED
|
||||
#endif /* !SDL_EVENTS_DISABLED */
|
||||
|
||||
pListNext = pCurList->pNext;
|
||||
SDL_free(pCurList->joystickname);
|
||||
|
@ -970,7 +970,7 @@ SDL_SYS_JoystickOpen(SDL_Joystick * joystick, int device_index)
|
|||
Uint8 userId = 0;
|
||||
DWORD result;
|
||||
JoyStick_DeviceData *joysticklist = SYS_Joystick;
|
||||
// scan the opened joysticks and pick the next free xinput userid for this one
|
||||
/* 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 )
|
||||
|
@ -984,7 +984,7 @@ SDL_SYS_JoystickOpen(SDL_Joystick * joystick, int device_index)
|
|||
{
|
||||
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.
|
||||
/* 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 )
|
||||
|
@ -993,7 +993,7 @@ SDL_SYS_JoystickOpen(SDL_Joystick * joystick, int device_index)
|
|||
}
|
||||
else
|
||||
{
|
||||
// valid
|
||||
/* valid */
|
||||
joystick->hwdata->bXInputDevice = SDL_TRUE;
|
||||
if ((!bIs14OrLater) || (capabilities.Flags & XINPUT_CAPS_FFB_SUPPORTED)) {
|
||||
joystick->hwdata->bXInputHaptic = SDL_TRUE;
|
||||
|
@ -1002,7 +1002,7 @@ SDL_SYS_JoystickOpen(SDL_Joystick * joystick, int device_index)
|
|||
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
|
||||
/* The XInput API has a hard coded button/axis mapping, so we just match it */
|
||||
joystick->naxes = 6;
|
||||
joystick->nbuttons = 15;
|
||||
joystick->nballs = 0;
|
||||
|
@ -1223,7 +1223,7 @@ 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!
|
||||
/* 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) ) )
|
||||
|
@ -1243,7 +1243,7 @@ EnumDevObjectsCallback(LPCDIDEVICEOBJECTINSTANCE dev, LPVOID pvRef)
|
|||
}
|
||||
else
|
||||
{
|
||||
return DIENUM_CONTINUE; // not an axis we can grok
|
||||
return DIENUM_CONTINUE; /* not an axis we can grok */
|
||||
}
|
||||
|
||||
diprg.diph.dwSize = sizeof(diprg);
|
||||
|
@ -1464,7 +1464,7 @@ SDL_SYS_JoystickUpdate_XInput(SDL_Joystick * joystick)
|
|||
return;
|
||||
}
|
||||
|
||||
// only fire events if the data changed from last time
|
||||
/* 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 )
|
||||
{
|
||||
|
@ -1507,7 +1507,7 @@ SDL_SYS_JoystickUpdate_XInput(SDL_Joystick * joystick)
|
|||
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
|
||||
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;
|
||||
|
||||
|
@ -1610,7 +1610,7 @@ 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
|
||||
/* scan the opened joysticks and clear the userid for this instance */
|
||||
for( ; joysticklist; joysticklist = joysticklist->pNext)
|
||||
{
|
||||
if ( joysticklist->bXInputDevice && joysticklist->nInstanceID == joystick->instance_id )
|
||||
|
@ -1653,9 +1653,9 @@ SDL_SYS_JoystickQuit(void)
|
|||
{
|
||||
SDL_LockMutex( s_mutexJoyStickEnum );
|
||||
s_bJoystickThreadQuit = SDL_TRUE;
|
||||
SDL_CondBroadcast( s_condJoystickThread ); // signal the joystick thread to quit
|
||||
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_WaitThread( s_threadJoystick, NULL ); /* wait for it to bugger off */
|
||||
|
||||
SDL_DestroyMutex( s_mutexJoyStickEnum );
|
||||
SDL_DestroyCond( s_condJoystickThread );
|
||||
|
|
|
@ -66,21 +66,21 @@ typedef struct
|
|||
/* Forward decl's for XInput API's we load dynamically and use if available */
|
||||
typedef DWORD (WINAPI *XInputGetState_t)
|
||||
(
|
||||
DWORD dwUserIndex, // [in] Index of the gamer associated with the device
|
||||
XINPUT_STATE_EX* pState // [out] Receives the current state
|
||||
DWORD dwUserIndex, /* [in] Index of the gamer associated with the device */
|
||||
XINPUT_STATE_EX* pState /* [out] Receives the current state */
|
||||
);
|
||||
|
||||
typedef DWORD (WINAPI *XInputSetState_t)
|
||||
(
|
||||
DWORD dwUserIndex, // [in] Index of the gamer associated with the device
|
||||
XINPUT_VIBRATION* pVibration // [in, out] The vibration information to send to the controller
|
||||
DWORD dwUserIndex, /* [in] Index of the gamer associated with the device */
|
||||
XINPUT_VIBRATION* pVibration /* [in, out] The vibration information to send to the controller */
|
||||
);
|
||||
|
||||
typedef DWORD (WINAPI *XInputGetCapabilities_t)
|
||||
(
|
||||
DWORD dwUserIndex, // [in] Index of the gamer associated with the device
|
||||
DWORD dwFlags, // [in] Input flags that identify the device type
|
||||
XINPUT_CAPABILITIES* pCapabilities // [out] Receives the capabilities
|
||||
DWORD dwUserIndex, /* [in] Index of the gamer associated with the device */
|
||||
DWORD dwFlags, /* [in] Input flags that identify the device type */
|
||||
XINPUT_CAPABILITIES* pCapabilities /* [out] Receives the capabilities */
|
||||
);
|
||||
|
||||
extern int WIN_LoadXInputDLL(void);
|
||||
|
@ -89,7 +89,7 @@ extern void WIN_UnloadXInputDLL(void);
|
|||
extern XInputGetState_t SDL_XInputGetState;
|
||||
extern XInputSetState_t SDL_XInputSetState;
|
||||
extern XInputGetCapabilities_t SDL_XInputGetCapabilities;
|
||||
extern DWORD SDL_XInputVersion; // ((major << 16) & 0xFF00) | (minor & 0xFF)
|
||||
extern DWORD SDL_XInputVersion; /* ((major << 16) & 0xFF00) | (minor & 0xFF) */
|
||||
|
||||
#define XINPUTGETSTATE SDL_XInputGetState
|
||||
#define XINPUTSETSTATE SDL_XInputSetState
|
||||
|
@ -134,10 +134,10 @@ struct joystick_hwdata
|
|||
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
|
||||
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];
|
||||
};
|
||||
|
||||
|
|
|
@ -407,7 +407,7 @@ SDL_SYS_JoystickQuit(void)
|
|||
SDL_JoystickGUID SDL_SYS_JoystickGetDeviceGUID( int device_index )
|
||||
{
|
||||
SDL_JoystickGUID guid;
|
||||
// the GUID is just the first 16 chars of the name for now
|
||||
/* the GUID is just the first 16 chars of the name for now */
|
||||
const char *name = SDL_SYS_JoystickNameForDeviceIndex( device_index );
|
||||
SDL_zero( guid );
|
||||
SDL_memcpy( &guid, name, SDL_min( sizeof(guid), SDL_strlen( name ) ) );
|
||||
|
@ -417,7 +417,7 @@ SDL_JoystickGUID SDL_SYS_JoystickGetDeviceGUID( int device_index )
|
|||
SDL_JoystickGUID SDL_SYS_JoystickGetGUID(SDL_Joystick * joystick)
|
||||
{
|
||||
SDL_JoystickGUID guid;
|
||||
// the GUID is just the first 16 chars of the name for now
|
||||
/* the GUID is just the first 16 chars of the name for now */
|
||||
const char *name = joystick->name;
|
||||
SDL_zero( guid );
|
||||
SDL_memcpy( &guid, name, SDL_min( sizeof(guid), SDL_strlen( name ) ) );
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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])
|
||||
{
|
||||
|
|
|
@ -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),
|
||||
|
|
|
@ -121,22 +121,22 @@ 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}
|
||||
/* {8BA5FB08-5195-40e2-AC58-0D989C3A0102} */
|
||||
DEFINE_GUID(IID_ID3DXBuffer,
|
||||
0x8ba5fb08, 0x5195, 0x40e2, 0xac, 0x58, 0xd, 0x98, 0x9c, 0x3a, 0x1, 0x2);
|
||||
|
||||
|
@ -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;
|
||||
};
|
||||
|
@ -1338,7 +1338,7 @@ D3D_RenderCopyEx(SDL_Renderer * renderer, SDL_Texture * texture,
|
|||
|
||||
D3D_SetBlendMode(data, texture->blendMode);
|
||||
|
||||
// Rotate and translate
|
||||
/* Rotate and translate */
|
||||
ID3DXMatrixStack_Push(data->matrixStack);
|
||||
ID3DXMatrixStack_LoadIdentity(data->matrixStack);
|
||||
ID3DXMatrixStack_RotateYawPitchRoll(data->matrixStack, 0.0, 0.0, (float)(M_PI * (float) angle / 180.0f));
|
||||
|
@ -1491,7 +1491,7 @@ D3D_DestroyRenderer(SDL_Renderer * renderer)
|
|||
D3D_RenderData *data = (D3D_RenderData *) renderer->driverdata;
|
||||
|
||||
if (data) {
|
||||
// Release the render target
|
||||
/* Release the render target */
|
||||
if (data->defaultRenderTarget) {
|
||||
IDirect3DSurface9_Release(data->defaultRenderTarget);
|
||||
data->defaultRenderTarget = NULL;
|
||||
|
|
|
@ -1125,7 +1125,7 @@ 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->glRotated(angle, (GLdouble)0.0, (GLdouble)0.0, (GLdouble)1.0);
|
||||
|
|
|
@ -940,7 +940,7 @@ GLES_RenderCopyEx(SDL_Renderer * renderer, SDL_Texture * texture,
|
|||
centerx = center->x;
|
||||
centery = center->y;
|
||||
|
||||
// Rotate and translate
|
||||
/* Rotate and translate */
|
||||
data->glPushMatrix();
|
||||
data->glTranslatef(dstrect->x + centerx, dstrect->y + centery, 0.0f);
|
||||
data->glRotatef((GLfloat)angle, 0.0f, 0.0f, 1.0f);
|
||||
|
|
|
@ -1237,7 +1237,7 @@ GLES2_RenderCopy(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect *s
|
|||
break;
|
||||
}
|
||||
}
|
||||
else sourceType = GLES2_IMAGESOURCE_TEXTURE_ABGR; // Texture formats match, use the non color mapping shader (even if the formats are not ABGR)
|
||||
else sourceType = GLES2_IMAGESOURCE_TEXTURE_ABGR; /* Texture formats match, use the non color mapping shader (even if the formats are not ABGR) */
|
||||
}
|
||||
else {
|
||||
switch (texture->format)
|
||||
|
@ -1403,7 +1403,7 @@ GLES2_RenderCopyEx(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect
|
|||
break;
|
||||
}
|
||||
}
|
||||
else sourceType = GLES2_IMAGESOURCE_TEXTURE_ABGR; // Texture formats match, use the non color mapping shader (even if the formats are not ABGR)
|
||||
else sourceType = GLES2_IMAGESOURCE_TEXTURE_ABGR; /* Texture formats match, use the non color mapping shader (even if the formats are not ABGR) */
|
||||
}
|
||||
else {
|
||||
switch (texture->format)
|
||||
|
|
|
@ -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; \
|
||||
|
|
|
@ -168,7 +168,7 @@ typedef struct
|
|||
} VertTV;
|
||||
|
||||
|
||||
// Return next power of 2
|
||||
/* Return next power of 2 */
|
||||
static int
|
||||
TextureNextPow2(unsigned int w)
|
||||
{
|
||||
|
@ -190,9 +190,9 @@ GetScaleQuality(void)
|
|||
const char *hint = SDL_GetHint(SDL_HINT_RENDER_SCALE_QUALITY);
|
||||
|
||||
if (!hint || *hint == '0' || SDL_strcasecmp(hint, "nearest") == 0) {
|
||||
return GU_NEAREST; // GU_NEAREST good for tile-map
|
||||
return GU_NEAREST; /* GU_NEAREST good for tile-map */
|
||||
} else {
|
||||
return GU_LINEAR; // GU_LINEAR good for scaling
|
||||
return GU_LINEAR; /* GU_LINEAR good for scaling */
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -409,7 +409,7 @@ PSP_CreateRenderer(SDL_Window * window, Uint32 flags)
|
|||
}
|
||||
|
||||
sceGuInit();
|
||||
// setup GU
|
||||
/* 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);
|
||||
|
@ -421,20 +421,20 @@ PSP_CreateRenderer(SDL_Window * window, Uint32 flags)
|
|||
data->frontbuffer = vabsptr(data->frontbuffer);
|
||||
data->backbuffer = vabsptr(data->backbuffer);
|
||||
|
||||
// Scissoring
|
||||
/* Scissoring */
|
||||
sceGuScissor(0, 0, PSP_SCREEN_WIDTH, PSP_SCREEN_HEIGHT);
|
||||
sceGuEnable(GU_SCISSOR_TEST);
|
||||
|
||||
// Backface culling
|
||||
/* Backface culling */
|
||||
sceGuFrontFace(GU_CCW);
|
||||
sceGuEnable(GU_CULL_FACE);
|
||||
|
||||
// Texturing
|
||||
/* Texturing */
|
||||
sceGuEnable(GU_TEXTURE_2D);
|
||||
sceGuShadeModel(GU_SMOOTH);
|
||||
sceGuTexWrap(GU_REPEAT, GU_REPEAT);
|
||||
|
||||
// Blending
|
||||
/* Blending */
|
||||
sceGuEnable(GU_BLEND);
|
||||
sceGuBlendFunc(GU_ADD, GU_SRC_ALPHA, GU_ONE_MINUS_SRC_ALPHA, 0, 0);
|
||||
|
||||
|
@ -508,7 +508,7 @@ TextureActivate(SDL_Texture * texture)
|
|||
PSP_TextureData *psp_texture = (PSP_TextureData *) texture->driverdata;
|
||||
int scaleMode = GetScaleQuality();
|
||||
|
||||
// Swizzling is useless with small textures.
|
||||
/* Swizzling is useless with small textures. */
|
||||
if (texture->w >= 16 || texture->h >= 16)
|
||||
{
|
||||
TextureSwizzle(psp_texture);
|
||||
|
@ -517,8 +517,8 @@ TextureActivate(SDL_Texture * 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
|
||||
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);
|
||||
}
|
||||
|
@ -627,7 +627,7 @@ PSP_SetBlendMode(SDL_Renderer * renderer, int blendMode)
|
|||
static int
|
||||
PSP_RenderClear(SDL_Renderer * renderer)
|
||||
{
|
||||
//start list
|
||||
/* start list */
|
||||
StartDrawing(renderer);
|
||||
int color = renderer->a << 24 | renderer->b << 16 | renderer->g << 8 | renderer->r;
|
||||
sceGuClearColor(color);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 {
|
||||
/*
|
||||
|
|
|
@ -49,13 +49,13 @@ void SDLTest_Assert(int assertCondition, const char *assertDescription, ...)
|
|||
va_list list;
|
||||
char logMessage[SDLTEST_MAX_LOGMESSAGE_LENGTH];
|
||||
|
||||
// Print assert description into a buffer
|
||||
/* 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
|
||||
/* Log, then assert and break on failure */
|
||||
SDL_assert((SDLTest_AssertCheck(assertCondition, logMessage)));
|
||||
}
|
||||
|
||||
|
@ -67,13 +67,13 @@ int SDLTest_AssertCheck(int assertCondition, const char *assertDescription, ...)
|
|||
va_list list;
|
||||
char logMessage[SDLTEST_MAX_LOGMESSAGE_LENGTH];
|
||||
|
||||
// Print assert description into a buffer
|
||||
/* 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
|
||||
/* Log pass or fail message */
|
||||
if (assertCondition == ASSERT_FAIL)
|
||||
{
|
||||
SDLTest_AssertsFailed++;
|
||||
|
@ -96,13 +96,13 @@ void SDLTest_AssertPass(const char *assertDescription, ...)
|
|||
va_list list;
|
||||
char logMessage[SDLTEST_MAX_LOGMESSAGE_LENGTH];
|
||||
|
||||
// Print assert description into a buffer
|
||||
/* 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
|
||||
/* Log pass message */
|
||||
SDLTest_AssertsPassed++;
|
||||
SDLTest_Log(SDLTest_AssertCheckFormat, logMessage, "Pass");
|
||||
}
|
||||
|
|
|
@ -892,7 +892,7 @@ SDLTest_PrintEvent(SDL_Event * event)
|
|||
{
|
||||
if (event->type == SDL_MOUSEMOTION) {
|
||||
/* Mouse motion is really spammy */
|
||||
//return;
|
||||
return;
|
||||
}
|
||||
|
||||
fprintf(stderr, "SDL EVENT: ");
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
*/
|
||||
|
||||
// quiet windows compiler warnings
|
||||
/* quiet windows compiler warnings */
|
||||
#define _CRT_SECURE_NO_WARNINGS
|
||||
|
||||
#include "SDL_config.h"
|
||||
|
@ -72,13 +72,13 @@ void SDLTest_Log(const char *fmt, ...)
|
|||
va_list list;
|
||||
char logMessage[SDLTEST_MAX_LOGMESSAGE_LENGTH];
|
||||
|
||||
// Print log message into a buffer
|
||||
/* 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
|
||||
/* Log with timestamp and newline */
|
||||
SDL_LogMessage(SDL_LOG_CATEGORY_TEST, SDL_LOG_PRIORITY_INFO, " %s: %s", SDLTest_TimestampToString(time(0)), logMessage);
|
||||
}
|
||||
|
||||
|
@ -90,12 +90,12 @@ void SDLTest_LogError(const char *fmt, ...)
|
|||
va_list list;
|
||||
char logMessage[SDLTEST_MAX_LOGMESSAGE_LENGTH];
|
||||
|
||||
// Print log message into a buffer
|
||||
/* 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
|
||||
/* Log with timestamp and newline */
|
||||
SDL_LogMessage(SDL_LOG_CATEGORY_TEST, SDL_LOG_PRIORITY_ERROR, "%s: %s", SDLTest_TimestampToString(time(0)), logMessage);
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
#include <sys/resource.h>
|
||||
#include <sys/syscall.h>
|
||||
#include <unistd.h>
|
||||
#endif // __LINUX__
|
||||
#endif /* __LINUX__ */
|
||||
|
||||
#if defined(__LINUX__) || defined(__MACOSX__) || defined(__IPHONEOS__)
|
||||
#include <dlfcn.h>
|
||||
|
|
|
@ -118,9 +118,9 @@ SDL_SYS_CreateThread(SDL_Thread * thread, void *args)
|
|||
if (!pThreadParms) {
|
||||
return SDL_OutOfMemory();
|
||||
}
|
||||
// Save the function which we will have to call to clear the RTL of calling app!
|
||||
/* Save the function which we will have to call to clear the RTL of calling app! */
|
||||
pThreadParms->pfnCurrentEndThread = pfnEndThread;
|
||||
// Also save the real parameters we have to pass to thread function
|
||||
/* Also save the real parameters we have to pass to thread function */
|
||||
pThreadParms->args = args;
|
||||
|
||||
if (pfnBeginThread) {
|
||||
|
|
|
@ -30,7 +30,8 @@
|
|||
#include "SDL_shape_internals.h"
|
||||
|
||||
SDL_Window*
|
||||
SDL_CreateShapedWindow(const char *title,unsigned int x,unsigned int y,unsigned int w,unsigned int h,Uint32 flags) {
|
||||
SDL_CreateShapedWindow(const char *title,unsigned int x,unsigned int y,unsigned int w,unsigned int h,Uint32 flags)
|
||||
{
|
||||
SDL_Window *result = NULL;
|
||||
result = SDL_CreateWindow(title,-1000,-1000,w,h,(flags | SDL_WINDOW_BORDERLESS) & (~SDL_WINDOW_FULLSCREEN) & (~SDL_WINDOW_RESIZABLE) /*& (~SDL_WINDOW_SHOWN)*/);
|
||||
if(result != NULL) {
|
||||
|
@ -53,7 +54,8 @@ SDL_CreateShapedWindow(const char *title,unsigned int x,unsigned int y,unsigned
|
|||
}
|
||||
|
||||
SDL_bool
|
||||
SDL_IsShapedWindow(const SDL_Window *window) {
|
||||
SDL_IsShapedWindow(const SDL_Window *window)
|
||||
{
|
||||
if(window == NULL)
|
||||
return SDL_FALSE;
|
||||
else
|
||||
|
@ -62,7 +64,8 @@ SDL_IsShapedWindow(const SDL_Window *window) {
|
|||
|
||||
/* REQUIRES that bitmap point to a w-by-h bitmap with ppb pixels-per-byte. */
|
||||
void
|
||||
SDL_CalculateShapeBitmap(SDL_WindowShapeMode mode,SDL_Surface *shape,Uint8* bitmap,Uint8 ppb) {
|
||||
SDL_CalculateShapeBitmap(SDL_WindowShapeMode mode,SDL_Surface *shape,Uint8* bitmap,Uint8 ppb)
|
||||
{
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
Uint8 r = 0,g = 0,b = 0,alpha = 0;
|
||||
|
@ -163,34 +166,35 @@ RecursivelyCalculateShapeTree(SDL_WindowShapeMode mode,SDL_Surface* mask,SDL_Rec
|
|||
last_opaque = pixel_opaque;
|
||||
if(last_opaque != pixel_opaque) {
|
||||
result->kind = QuadShape;
|
||||
//These will stay the same.
|
||||
/* These will stay the same. */
|
||||
next.w = dimensions.w / 2;
|
||||
next.h = dimensions.h / 2;
|
||||
//These will change from recursion to recursion.
|
||||
/* These will change from recursion to recursion. */
|
||||
next.x = dimensions.x;
|
||||
next.y = dimensions.y;
|
||||
result->data.children.upleft = (struct SDL_ShapeTree *)RecursivelyCalculateShapeTree(mode,mask,next);
|
||||
next.x += next.w;
|
||||
//Unneeded: next.y = dimensions.y;
|
||||
/* Unneeded: next.y = dimensions.y; */
|
||||
result->data.children.upright = (struct SDL_ShapeTree *)RecursivelyCalculateShapeTree(mode,mask,next);
|
||||
next.x = dimensions.x;
|
||||
next.y += next.h;
|
||||
result->data.children.downleft = (struct SDL_ShapeTree *)RecursivelyCalculateShapeTree(mode,mask,next);
|
||||
next.x += next.w;
|
||||
//Unneeded: next.y = dimensions.y + dimensions.h /2;
|
||||
/* Unneeded: next.y = dimensions.y + dimensions.h /2; */
|
||||
result->data.children.downright = (struct SDL_ShapeTree *)RecursivelyCalculateShapeTree(mode,mask,next);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
//If we never recursed, all the pixels in this quadrant have the same "value".
|
||||
/* If we never recursed, all the pixels in this quadrant have the same "value". */
|
||||
result->kind = (last_opaque == SDL_TRUE ? OpaqueShape : TransparentShape);
|
||||
result->data.shape = dimensions;
|
||||
return result;
|
||||
}
|
||||
|
||||
SDL_ShapeTree*
|
||||
SDL_CalculateShapeTree(SDL_WindowShapeMode mode,SDL_Surface* shape) {
|
||||
SDL_CalculateShapeTree(SDL_WindowShapeMode mode,SDL_Surface* shape)
|
||||
{
|
||||
SDL_Rect dimensions = {0,0,shape->w,shape->h};
|
||||
SDL_ShapeTree* result = NULL;
|
||||
if(SDL_MUSTLOCK(shape))
|
||||
|
@ -202,7 +206,8 @@ SDL_CalculateShapeTree(SDL_WindowShapeMode mode,SDL_Surface* shape) {
|
|||
}
|
||||
|
||||
void
|
||||
SDL_TraverseShapeTree(SDL_ShapeTree *tree,SDL_TraversalFunction function,void* closure) {
|
||||
SDL_TraverseShapeTree(SDL_ShapeTree *tree,SDL_TraversalFunction function,void* closure)
|
||||
{
|
||||
SDL_assert(tree != NULL);
|
||||
if(tree->kind == QuadShape) {
|
||||
SDL_TraverseShapeTree((SDL_ShapeTree *)tree->data.children.upleft,function,closure);
|
||||
|
@ -215,7 +220,8 @@ SDL_TraverseShapeTree(SDL_ShapeTree *tree,SDL_TraversalFunction function,void* c
|
|||
}
|
||||
|
||||
void
|
||||
SDL_FreeShapeTree(SDL_ShapeTree** shape_tree) {
|
||||
SDL_FreeShapeTree(SDL_ShapeTree** shape_tree)
|
||||
{
|
||||
if((*shape_tree)->kind == QuadShape) {
|
||||
SDL_FreeShapeTree((SDL_ShapeTree **)&(*shape_tree)->data.children.upleft);
|
||||
SDL_FreeShapeTree((SDL_ShapeTree **)&(*shape_tree)->data.children.upright);
|
||||
|
@ -227,13 +233,14 @@ 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)
|
||||
|
@ -249,21 +256,23 @@ SDL_SetWindowShape(SDL_Window *window,SDL_Surface *shape,SDL_WindowShapeMode *sh
|
|||
}
|
||||
|
||||
static SDL_bool
|
||||
SDL_WindowHasAShape(SDL_Window *window) {
|
||||
SDL_WindowHasAShape(SDL_Window *window)
|
||||
{
|
||||
if (window == NULL || !SDL_IsShapedWindow(window))
|
||||
return SDL_FALSE;
|
||||
return window->shaper->hasshape;
|
||||
}
|
||||
|
||||
int
|
||||
SDL_GetShapedWindowMode(SDL_Window *window,SDL_WindowShapeMode *shape_mode) {
|
||||
SDL_GetShapedWindowMode(SDL_Window *window,SDL_WindowShapeMode *shape_mode)
|
||||
{
|
||||
if(window != NULL && SDL_IsShapedWindow(window)) {
|
||||
if(shape_mode == NULL) {
|
||||
if(SDL_WindowHasAShape(window))
|
||||
//The window given has a shape.
|
||||
/* The window given has a shape. */
|
||||
return 0;
|
||||
else
|
||||
//The window given is shapeable but lacks a shape.
|
||||
/* The window given is shapeable but lacks a shape. */
|
||||
return SDL_WINDOW_LACKS_SHAPE;
|
||||
}
|
||||
else {
|
||||
|
@ -272,6 +281,6 @@ SDL_GetShapedWindowMode(SDL_Window *window,SDL_WindowShapeMode *shape_mode) {
|
|||
}
|
||||
}
|
||||
else
|
||||
//The window given is not a valid shapeable window.
|
||||
/* The window given is not a valid shapeable window. */
|
||||
return SDL_NONSHAPEABLE_WINDOW;
|
||||
}
|
||||
|
|
|
@ -2779,7 +2779,7 @@ SDL_GL_DeleteContext(SDL_GLContext context)
|
|||
_this->GL_DeleteContext(_this, context);
|
||||
}
|
||||
|
||||
#if 0 // FIXME
|
||||
#if 0 /* FIXME */
|
||||
/*
|
||||
* Utility function used by SDL_WM_SetIcon(); flags & 1 for color key, flags
|
||||
* & 2 for alpha channel.
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
|
||||
#include <Carbon/Carbon.h>
|
||||
|
||||
//#define DEBUG_IME NSLog
|
||||
/*#define DEBUG_IME NSLog */
|
||||
#define DEBUG_IME(...)
|
||||
|
||||
#ifndef NX_DEVICERCTLKEYMASK
|
||||
|
@ -93,9 +93,10 @@
|
|||
|
||||
- (void) doCommandBySelector:(SEL) myselector
|
||||
{
|
||||
// No need to do anything since we are not using Cocoa
|
||||
// selectors to handle special keys, instead we use SDL
|
||||
// key events to do the same job.
|
||||
/* No need to do anything since we are not using Cocoa
|
||||
selectors to handle special keys, instead we use SDL
|
||||
key events to do the same job.
|
||||
*/
|
||||
}
|
||||
|
||||
- (BOOL) hasMarkedText
|
||||
|
@ -181,18 +182,20 @@
|
|||
return (long) self;
|
||||
}
|
||||
|
||||
// This method returns the index for character that is
|
||||
// nearest to thePoint. thPoint is in screen coordinate system.
|
||||
/* This method returns the index for character that is
|
||||
* nearest to thePoint. thPoint is in screen coordinate system.
|
||||
*/
|
||||
- (NSUInteger) characterIndexForPoint:(NSPoint) thePoint
|
||||
{
|
||||
DEBUG_IME(@"characterIndexForPoint: (%g, %g)", thePoint.x, thePoint.y);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// This method is the key to attribute extension.
|
||||
// We could add new attributes through this method.
|
||||
// NSInputServer examines the return value of this
|
||||
// method & constructs appropriate attributed string.
|
||||
/* This method is the key to attribute extension.
|
||||
* We could add new attributes through this method.
|
||||
* NSInputServer examines the return value of this
|
||||
* method & constructs appropriate attributed string.
|
||||
*/
|
||||
- (NSArray *) validAttributesForMarkedText
|
||||
{
|
||||
return [NSArray array];
|
||||
|
@ -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];
|
||||
|
|
|
@ -304,7 +304,7 @@ Cocoa_InitModes(_THIS)
|
|||
displaydata->display = displays[i];
|
||||
|
||||
SDL_zero(display);
|
||||
// this returns a stddup'ed string
|
||||
/* this returns a stddup'ed string */
|
||||
display.name = (char *)Cocoa_GetDisplayName(displays[i]);
|
||||
if (!GetDisplayMode (_this, moderef, &mode)) {
|
||||
Cocoa_ReleaseDisplayMode(_this, moderef);
|
||||
|
|
|
@ -153,7 +153,7 @@ Cocoa_CreateSystemCursor(SDL_SystemCursor id)
|
|||
if (nscursor) {
|
||||
cursor = SDL_calloc(1, sizeof(*cursor));
|
||||
if (cursor) {
|
||||
// We'll free it later, so retain it here
|
||||
/* We'll free it later, so retain it here */
|
||||
[nscursor retain];
|
||||
cursor->driverdata = nscursor;
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue