mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-05-30 21:37:43 +08:00
Updated source to match SDL function prototype style
This commit is contained in:
@@ -442,8 +442,7 @@ void SDL_QuitSubSystem(Uint32 flags)
|
||||
#endif
|
||||
}
|
||||
|
||||
Uint32
|
||||
SDL_WasInit(Uint32 flags)
|
||||
Uint32 SDL_WasInit(Uint32 flags)
|
||||
{
|
||||
int i;
|
||||
int num_subsystems = SDL_arraysize(SDL_SubsystemRefCount);
|
||||
@@ -531,22 +530,19 @@ void SDL_GetVersion(SDL_version *ver)
|
||||
}
|
||||
|
||||
/* Get the library source revision */
|
||||
const char *
|
||||
SDL_GetRevision(void)
|
||||
const char *SDL_GetRevision(void)
|
||||
{
|
||||
return SDL_REVISION;
|
||||
}
|
||||
|
||||
/* Get the library source revision number */
|
||||
int
|
||||
SDL_GetRevisionNumber(void)
|
||||
int SDL_GetRevisionNumber(void)
|
||||
{
|
||||
return 0; /* doesn't make sense without Mercurial. */
|
||||
}
|
||||
|
||||
/* Get the name of the platform */
|
||||
const char *
|
||||
SDL_GetPlatform(void)
|
||||
const char *SDL_GetPlatform(void)
|
||||
{
|
||||
#if __AIX__
|
||||
return "AIX";
|
||||
@@ -619,8 +615,7 @@ SDL_GetPlatform(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
SDL_bool
|
||||
SDL_IsTablet(void)
|
||||
SDL_bool SDL_IsTablet(void)
|
||||
{
|
||||
#if __ANDROID__
|
||||
extern SDL_bool SDL_IsAndroidTablet(void);
|
||||
@@ -638,9 +633,7 @@ SDL_IsTablet(void)
|
||||
#if (!defined(HAVE_LIBC) || defined(__WATCOMC__)) && !defined(SDL_STATIC_LIB)
|
||||
/* Need to include DllMain() on Watcom C for some reason.. */
|
||||
|
||||
BOOL APIENTRY
|
||||
_DllMainCRTStartup(HANDLE hModule,
|
||||
DWORD ul_reason_for_call, LPVOID lpReserved)
|
||||
BOOL APIENTRY _DllMainCRTStartup(HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
|
||||
{
|
||||
switch (ul_reason_for_call) {
|
||||
case DLL_PROCESS_ATTACH:
|
||||
|
||||
+1
-3
@@ -326,9 +326,7 @@ static SDL_assert_state SDLCALL SDL_PromptAssertion(const SDL_assert_data *data,
|
||||
return state;
|
||||
}
|
||||
|
||||
SDL_assert_state
|
||||
SDL_ReportAssertion(SDL_assert_data *data, const char *func, const char *file,
|
||||
int line)
|
||||
SDL_assert_state SDL_ReportAssertion(SDL_assert_data *data, const char *func, const char *file, int line)
|
||||
{
|
||||
SDL_assert_state state = SDL_ASSERTION_IGNORE;
|
||||
static int assertion_running = 0;
|
||||
|
||||
+2
-4
@@ -50,8 +50,7 @@ static void SDL_FreeDataQueueList(SDL_DataQueuePacket *packet)
|
||||
}
|
||||
}
|
||||
|
||||
SDL_DataQueue *
|
||||
SDL_NewDataQueue(const size_t _packetlen, const size_t initialslack)
|
||||
SDL_DataQueue *SDL_NewDataQueue(const size_t _packetlen, const size_t initialslack)
|
||||
{
|
||||
SDL_DataQueue *queue = (SDL_DataQueue *)SDL_calloc(1, sizeof(SDL_DataQueue));
|
||||
|
||||
@@ -316,8 +315,7 @@ SDL_CountDataQueue(SDL_DataQueue *queue)
|
||||
return retval;
|
||||
}
|
||||
|
||||
SDL_mutex *
|
||||
SDL_GetDataQueueMutex(SDL_DataQueue *queue)
|
||||
SDL_mutex *SDL_GetDataQueueMutex(SDL_DataQueue *queue)
|
||||
{
|
||||
return queue ? queue->lock : NULL;
|
||||
}
|
||||
|
||||
+2
-4
@@ -61,8 +61,7 @@ int SDL_SetError(SDL_PRINTF_FORMAT_STRING const char *fmt, ...)
|
||||
}
|
||||
|
||||
/* Available for backwards compatibility */
|
||||
const char *
|
||||
SDL_GetError(void)
|
||||
const char *SDL_GetError(void)
|
||||
{
|
||||
const SDL_error *error = SDL_GetErrBuf();
|
||||
return error->error ? error->str : "";
|
||||
@@ -108,8 +107,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
#endif
|
||||
|
||||
char *
|
||||
SDL_GetErrorMsg(char *errstr, int maxlen)
|
||||
char *SDL_GetErrorMsg(char *errstr, int maxlen)
|
||||
{
|
||||
const SDL_error *error = SDL_GetErrBuf();
|
||||
|
||||
|
||||
+6
-13
@@ -45,9 +45,7 @@ typedef struct SDL_Hint
|
||||
|
||||
static SDL_Hint *SDL_hints;
|
||||
|
||||
SDL_bool
|
||||
SDL_SetHintWithPriority(const char *name, const char *value,
|
||||
SDL_HintPriority priority)
|
||||
SDL_bool SDL_SetHintWithPriority(const char *name, const char *value, SDL_HintPriority priority)
|
||||
{
|
||||
const char *env;
|
||||
SDL_Hint *hint;
|
||||
@@ -97,8 +95,7 @@ SDL_SetHintWithPriority(const char *name, const char *value,
|
||||
return SDL_TRUE;
|
||||
}
|
||||
|
||||
SDL_bool
|
||||
SDL_ResetHint(const char *name)
|
||||
SDL_bool SDL_ResetHint(const char *name)
|
||||
{
|
||||
const char *env;
|
||||
SDL_Hint *hint;
|
||||
@@ -154,14 +151,12 @@ void SDL_ResetHints(void)
|
||||
}
|
||||
}
|
||||
|
||||
SDL_bool
|
||||
SDL_SetHint(const char *name, const char *value)
|
||||
SDL_bool SDL_SetHint(const char *name, const char *value)
|
||||
{
|
||||
return SDL_SetHintWithPriority(name, value, SDL_HINT_NORMAL);
|
||||
}
|
||||
|
||||
const char *
|
||||
SDL_GetHint(const char *name)
|
||||
const char *SDL_GetHint(const char *name)
|
||||
{
|
||||
const char *env;
|
||||
SDL_Hint *hint;
|
||||
@@ -178,8 +173,7 @@ SDL_GetHint(const char *name)
|
||||
return env;
|
||||
}
|
||||
|
||||
SDL_bool
|
||||
SDL_GetStringBoolean(const char *value, SDL_bool default_value)
|
||||
SDL_bool SDL_GetStringBoolean(const char *value, SDL_bool default_value)
|
||||
{
|
||||
if (value == NULL || !*value) {
|
||||
return default_value;
|
||||
@@ -190,8 +184,7 @@ SDL_GetStringBoolean(const char *value, SDL_bool default_value)
|
||||
return SDL_TRUE;
|
||||
}
|
||||
|
||||
SDL_bool
|
||||
SDL_GetHintBoolean(const char *name, SDL_bool default_value)
|
||||
SDL_bool SDL_GetHintBoolean(const char *name, SDL_bool default_value)
|
||||
{
|
||||
const char *hint = SDL_GetHint(name);
|
||||
return SDL_GetStringBoolean(hint, default_value);
|
||||
|
||||
+1
-2
@@ -154,8 +154,7 @@ void SDL_LogSetPriority(int category, SDL_LogPriority priority)
|
||||
}
|
||||
}
|
||||
|
||||
SDL_LogPriority
|
||||
SDL_LogGetPriority(int category)
|
||||
SDL_LogPriority SDL_LogGetPriority(int category)
|
||||
{
|
||||
SDL_LogLevel *entry;
|
||||
|
||||
|
||||
@@ -124,8 +124,7 @@ static SDL_INLINE void leaveLock(void *a)
|
||||
}
|
||||
#endif
|
||||
|
||||
SDL_bool
|
||||
SDL_AtomicCAS(SDL_atomic_t *a, int oldval, int newval)
|
||||
SDL_bool SDL_AtomicCAS(SDL_atomic_t *a, int oldval, int newval)
|
||||
{
|
||||
#ifdef HAVE_MSC_ATOMICS
|
||||
SDL_COMPILE_TIME_ASSERT(atomic_cas, sizeof(long) == sizeof(a->value));
|
||||
@@ -154,8 +153,7 @@ SDL_AtomicCAS(SDL_atomic_t *a, int oldval, int newval)
|
||||
#endif
|
||||
}
|
||||
|
||||
SDL_bool
|
||||
SDL_AtomicCASPtr(void **a, void *oldval, void *newval)
|
||||
SDL_bool SDL_AtomicCASPtr(void **a, void *oldval, void *newval)
|
||||
{
|
||||
#if defined(HAVE_MSC_ATOMICS)
|
||||
return _InterlockedCompareExchangePointer(a, newval, oldval) == oldval;
|
||||
@@ -205,8 +203,7 @@ int SDL_AtomicSet(SDL_atomic_t *a, int v)
|
||||
#endif
|
||||
}
|
||||
|
||||
void *
|
||||
SDL_AtomicSetPtr(void **a, void *v)
|
||||
void *SDL_AtomicSetPtr(void **a, void *v)
|
||||
{
|
||||
#if defined(HAVE_MSC_ATOMICS)
|
||||
return _InterlockedExchangePointer(a, v);
|
||||
@@ -272,8 +269,7 @@ int SDL_AtomicGet(SDL_atomic_t *a)
|
||||
#endif
|
||||
}
|
||||
|
||||
void *
|
||||
SDL_AtomicGetPtr(void **a)
|
||||
void *SDL_AtomicGetPtr(void **a)
|
||||
{
|
||||
#ifdef HAVE_ATOMIC_LOAD_N
|
||||
return __atomic_load_n(a, __ATOMIC_SEQ_CST);
|
||||
|
||||
@@ -61,8 +61,7 @@ extern __inline int _SDL_xchg_watcom(volatile int *a, int v);
|
||||
/* *INDENT-ON* */ /* clang-format on */
|
||||
|
||||
/* This function is where all the magic happens... */
|
||||
SDL_bool
|
||||
SDL_AtomicTryLock(SDL_SpinLock *lock)
|
||||
SDL_bool SDL_AtomicTryLock(SDL_SpinLock *lock)
|
||||
{
|
||||
#if SDL_ATOMIC_DISABLED
|
||||
/* Terrible terrible damage */
|
||||
|
||||
+11
-22
@@ -603,8 +603,7 @@ int SDL_QueueAudio(SDL_AudioDeviceID devid, const void *data, Uint32 len)
|
||||
return rc;
|
||||
}
|
||||
|
||||
Uint32
|
||||
SDL_DequeueAudio(SDL_AudioDeviceID devid, void *data, Uint32 len)
|
||||
Uint32 SDL_DequeueAudio(SDL_AudioDeviceID devid, void *data, Uint32 len)
|
||||
{
|
||||
SDL_AudioDevice *device = get_audio_device(devid);
|
||||
Uint32 rc;
|
||||
@@ -622,8 +621,7 @@ SDL_DequeueAudio(SDL_AudioDeviceID devid, void *data, Uint32 len)
|
||||
return rc;
|
||||
}
|
||||
|
||||
Uint32
|
||||
SDL_GetQueuedAudioSize(SDL_AudioDeviceID devid)
|
||||
Uint32 SDL_GetQueuedAudioSize(SDL_AudioDeviceID devid)
|
||||
{
|
||||
Uint32 retval = 0;
|
||||
SDL_AudioDevice *device = get_audio_device(devid);
|
||||
@@ -904,8 +902,7 @@ int SDL_GetNumAudioDrivers(void)
|
||||
return SDL_arraysize(bootstrap) - 1;
|
||||
}
|
||||
|
||||
const char *
|
||||
SDL_GetAudioDriver(int index)
|
||||
const char *SDL_GetAudioDriver(int index)
|
||||
{
|
||||
if (index >= 0 && index < SDL_GetNumAudioDrivers()) {
|
||||
return bootstrap[index]->name;
|
||||
@@ -1012,8 +1009,7 @@ int SDL_AudioInit(const char *driver_name)
|
||||
/*
|
||||
* Get the current audio driver name
|
||||
*/
|
||||
const char *
|
||||
SDL_GetCurrentAudioDriver()
|
||||
const char *SDL_GetCurrentAudioDriver()
|
||||
{
|
||||
return current_audio.name;
|
||||
}
|
||||
@@ -1073,8 +1069,7 @@ int SDL_GetNumAudioDevices(int iscapture)
|
||||
return retval;
|
||||
}
|
||||
|
||||
const char *
|
||||
SDL_GetAudioDeviceName(int index, int iscapture)
|
||||
const char *SDL_GetAudioDeviceName(int index, int iscapture)
|
||||
{
|
||||
SDL_AudioDeviceItem *item;
|
||||
int i;
|
||||
@@ -1191,8 +1186,7 @@ static void close_audio_device(SDL_AudioDevice *device)
|
||||
SDL_free(device);
|
||||
}
|
||||
|
||||
static Uint16
|
||||
GetDefaultSamplesFromFreq(int freq)
|
||||
static Uint16 GetDefaultSamplesFromFreq(int freq)
|
||||
{
|
||||
/* Pick a default of ~46 ms at desired frequency */
|
||||
/* !!! FIXME: remove this when the non-Po2 resampling is in. */
|
||||
@@ -1560,8 +1554,7 @@ int SDL_OpenAudio(SDL_AudioSpec *desired, SDL_AudioSpec *obtained)
|
||||
return (id == 0) ? -1 : 0;
|
||||
}
|
||||
|
||||
SDL_AudioDeviceID
|
||||
SDL_OpenAudioDevice(const char *device, int iscapture,
|
||||
SDL_AudioDeviceID SDL_OpenAudioDevice(const char *device, int iscapture,
|
||||
const SDL_AudioSpec *desired, SDL_AudioSpec *obtained,
|
||||
int allowed_changes)
|
||||
{
|
||||
@@ -1569,8 +1562,7 @@ SDL_OpenAudioDevice(const char *device, int iscapture,
|
||||
allowed_changes, 2);
|
||||
}
|
||||
|
||||
SDL_AudioStatus
|
||||
SDL_GetAudioDeviceStatus(SDL_AudioDeviceID devid)
|
||||
SDL_AudioStatus SDL_GetAudioDeviceStatus(SDL_AudioDeviceID devid)
|
||||
{
|
||||
SDL_AudioDevice *device = get_audio_device(devid);
|
||||
SDL_AudioStatus status = SDL_AUDIO_STOPPED;
|
||||
@@ -1584,8 +1576,7 @@ SDL_GetAudioDeviceStatus(SDL_AudioDeviceID devid)
|
||||
return status;
|
||||
}
|
||||
|
||||
SDL_AudioStatus
|
||||
SDL_GetAudioStatus(void)
|
||||
SDL_AudioStatus SDL_GetAudioStatus(void)
|
||||
{
|
||||
return SDL_GetAudioDeviceStatus(1);
|
||||
}
|
||||
@@ -1697,8 +1688,7 @@ static SDL_AudioFormat format_list[NUM_FORMATS][NUM_FORMATS] = {
|
||||
AUDIO_S16LSB, AUDIO_U16MSB, AUDIO_U16LSB, AUDIO_U8, AUDIO_S8 },
|
||||
};
|
||||
|
||||
SDL_AudioFormat
|
||||
SDL_FirstAudioFormat(SDL_AudioFormat format)
|
||||
SDL_AudioFormat SDL_FirstAudioFormat(SDL_AudioFormat format)
|
||||
{
|
||||
for (format_idx = 0; format_idx < NUM_FORMATS; ++format_idx) {
|
||||
if (format_list[format_idx][0] == format) {
|
||||
@@ -1709,8 +1699,7 @@ SDL_FirstAudioFormat(SDL_AudioFormat format)
|
||||
return SDL_NextAudioFormat();
|
||||
}
|
||||
|
||||
SDL_AudioFormat
|
||||
SDL_NextAudioFormat(void)
|
||||
SDL_AudioFormat SDL_NextAudioFormat(void)
|
||||
{
|
||||
if ((format_idx == NUM_FORMATS) || (format_idx_sub == NUM_FORMATS)) {
|
||||
return 0;
|
||||
|
||||
@@ -1005,8 +1005,7 @@ static void SDL_CleanupAudioStreamResampler(SDL_AudioStream *stream)
|
||||
SDL_free(stream->resampler_state);
|
||||
}
|
||||
|
||||
SDL_AudioStream *
|
||||
SDL_NewAudioStream(const SDL_AudioFormat src_format,
|
||||
SDL_AudioStream *SDL_NewAudioStream(const SDL_AudioFormat src_format,
|
||||
const Uint8 src_channels,
|
||||
const int src_rate,
|
||||
const SDL_AudioFormat dst_format,
|
||||
|
||||
@@ -2077,8 +2077,7 @@ static int WaveLoad(SDL_RWops *src, WaveFile *file, SDL_AudioSpec *spec, Uint8 *
|
||||
return 0;
|
||||
}
|
||||
|
||||
SDL_AudioSpec *
|
||||
SDL_LoadWAV_RW(SDL_RWops *src, int freesrc, SDL_AudioSpec *spec, Uint8 **audio_buf, Uint32 *audio_len)
|
||||
SDL_AudioSpec *SDL_LoadWAV_RW(SDL_RWops *src, int freesrc, SDL_AudioSpec *spec, Uint8 **audio_buf, Uint32 *audio_len)
|
||||
{
|
||||
int result;
|
||||
WaveFile file;
|
||||
|
||||
@@ -86,8 +86,7 @@ static struct
|
||||
|
||||
#undef SDL_ARTS_SYM
|
||||
|
||||
static void
|
||||
UnloadARTSLibrary()
|
||||
static void UnloadARTSLibrary()
|
||||
{
|
||||
if (arts_handle != NULL) {
|
||||
SDL_UnloadObject(arts_handle);
|
||||
@@ -95,8 +94,7 @@ UnloadARTSLibrary()
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
LoadARTSLibrary(void)
|
||||
static int LoadARTSLibrary(void)
|
||||
{
|
||||
int i, retval = -1;
|
||||
|
||||
@@ -121,14 +119,12 @@ LoadARTSLibrary(void)
|
||||
|
||||
#else
|
||||
|
||||
static void
|
||||
UnloadARTSLibrary()
|
||||
static void UnloadARTSLibrary()
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
static int
|
||||
LoadARTSLibrary(void)
|
||||
static int LoadARTSLibrary(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@@ -136,8 +132,7 @@ LoadARTSLibrary(void)
|
||||
#endif /* SDL_AUDIO_DRIVER_ARTS_DYNAMIC */
|
||||
|
||||
/* This function waits until it is possible to write a full sound buffer */
|
||||
static void
|
||||
ARTS_WaitDevice(_THIS)
|
||||
static void ARTS_WaitDevice(_THIS)
|
||||
{
|
||||
Sint32 ticks;
|
||||
|
||||
@@ -163,8 +158,7 @@ ARTS_WaitDevice(_THIS)
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
ARTS_PlayDevice(_THIS)
|
||||
static void ARTS_PlayDevice(_THIS)
|
||||
{
|
||||
/* Write the audio data */
|
||||
int written = SDL_NAME(arts_write) (this->hidden->stream,
|
||||
@@ -185,15 +179,13 @@ ARTS_PlayDevice(_THIS)
|
||||
#endif
|
||||
}
|
||||
|
||||
static Uint8 *
|
||||
ARTS_GetDeviceBuf(_THIS)
|
||||
static Uint8 *ARTS_GetDeviceBuf(_THIS)
|
||||
{
|
||||
return (this->hidden->mixbuf);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
ARTS_CloseDevice(_THIS)
|
||||
static void ARTS_CloseDevice(_THIS)
|
||||
{
|
||||
if (this->hidden->stream) {
|
||||
SDL_NAME(arts_close_stream) (this->hidden->stream);
|
||||
@@ -203,8 +195,7 @@ ARTS_CloseDevice(_THIS)
|
||||
SDL_free(this->hidden);
|
||||
}
|
||||
|
||||
static int
|
||||
ARTS_Suspend(void)
|
||||
static int ARTS_Suspend(void)
|
||||
{
|
||||
const Uint32 abortms = SDL_GetTicks() + 3000; /* give up after 3 secs */
|
||||
while ( (!SDL_NAME(arts_suspended)()) && !SDL_TICKS_PASSED(SDL_GetTicks(), abortms) ) {
|
||||
@@ -215,8 +206,7 @@ ARTS_Suspend(void)
|
||||
return SDL_NAME(arts_suspended)();
|
||||
}
|
||||
|
||||
static int
|
||||
ARTS_OpenDevice(_THIS, const char *devname)
|
||||
static int ARTS_OpenDevice(_THIS, const char *devname)
|
||||
{
|
||||
int rc = 0;
|
||||
int bits, frag_spec = 0;
|
||||
@@ -304,15 +294,13 @@ ARTS_OpenDevice(_THIS, const char *devname)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
ARTS_Deinitialize(void)
|
||||
static void ARTS_Deinitialize(void)
|
||||
{
|
||||
UnloadARTSLibrary();
|
||||
}
|
||||
|
||||
|
||||
static SDL_bool
|
||||
ARTS_Init(SDL_AudioDriverImpl * impl)
|
||||
static SDL_bool ARTS_Init(SDL_AudioDriverImpl * impl)
|
||||
{
|
||||
if (LoadARTSLibrary() < 0) {
|
||||
return SDL_FALSE;
|
||||
|
||||
@@ -64,8 +64,7 @@ static struct
|
||||
|
||||
#undef SDL_ESD_SYM
|
||||
|
||||
static void
|
||||
UnloadESDLibrary()
|
||||
static void UnloadESDLibrary()
|
||||
{
|
||||
if (esd_handle != NULL) {
|
||||
SDL_UnloadObject(esd_handle);
|
||||
@@ -73,8 +72,7 @@ UnloadESDLibrary()
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
LoadESDLibrary(void)
|
||||
static int LoadESDLibrary(void)
|
||||
{
|
||||
int i, retval = -1;
|
||||
|
||||
@@ -98,14 +96,12 @@ LoadESDLibrary(void)
|
||||
|
||||
#else
|
||||
|
||||
static void
|
||||
UnloadESDLibrary()
|
||||
static void UnloadESDLibrary()
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
static int
|
||||
LoadESDLibrary(void)
|
||||
static int LoadESDLibrary(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@@ -114,8 +110,7 @@ LoadESDLibrary(void)
|
||||
|
||||
|
||||
/* This function waits until it is possible to write a full sound buffer */
|
||||
static void
|
||||
ESD_WaitDevice(_THIS)
|
||||
static void ESD_WaitDevice(_THIS)
|
||||
{
|
||||
Sint32 ticks;
|
||||
|
||||
@@ -140,8 +135,7 @@ ESD_WaitDevice(_THIS)
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
ESD_PlayDevice(_THIS)
|
||||
static void ESD_PlayDevice(_THIS)
|
||||
{
|
||||
int written = 0;
|
||||
|
||||
@@ -164,14 +158,12 @@ ESD_PlayDevice(_THIS)
|
||||
}
|
||||
}
|
||||
|
||||
static Uint8 *
|
||||
ESD_GetDeviceBuf(_THIS)
|
||||
static Uint8 *ESD_GetDeviceBuf(_THIS)
|
||||
{
|
||||
return (this->hidden->mixbuf);
|
||||
}
|
||||
|
||||
static void
|
||||
ESD_CloseDevice(_THIS)
|
||||
static void ESD_CloseDevice(_THIS)
|
||||
{
|
||||
if (this->hidden->audio_fd >= 0) {
|
||||
SDL_NAME(esd_close) (this->hidden->audio_fd);
|
||||
@@ -181,8 +173,7 @@ ESD_CloseDevice(_THIS)
|
||||
}
|
||||
|
||||
/* Try to get the name of the program */
|
||||
static char *
|
||||
get_progname(void)
|
||||
static char *get_progname(void)
|
||||
{
|
||||
char *progname = NULL;
|
||||
#ifdef __LINUX__
|
||||
@@ -207,8 +198,7 @@ get_progname(void)
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
ESD_OpenDevice(_THIS, const char *devname)
|
||||
static int ESD_OpenDevice(_THIS, const char *devname)
|
||||
{
|
||||
esd_format_t format = (ESD_STREAM | ESD_PLAY);
|
||||
SDL_AudioFormat test_format = 0;
|
||||
@@ -286,14 +276,12 @@ ESD_OpenDevice(_THIS, const char *devname)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
ESD_Deinitialize(void)
|
||||
static void ESD_Deinitialize(void)
|
||||
{
|
||||
UnloadESDLibrary();
|
||||
}
|
||||
|
||||
static SDL_bool
|
||||
ESD_Init(SDL_AudioDriverImpl * impl)
|
||||
static SDL_bool ESD_Init(SDL_AudioDriverImpl * impl)
|
||||
{
|
||||
if (LoadESDLibrary() < 0) {
|
||||
return SDL_FALSE;
|
||||
|
||||
@@ -77,8 +77,7 @@ static struct
|
||||
|
||||
#undef SDL_FS_SYM
|
||||
|
||||
static void
|
||||
UnloadFusionSoundLibrary()
|
||||
static void UnloadFusionSoundLibrary()
|
||||
{
|
||||
if (fs_handle != NULL) {
|
||||
SDL_UnloadObject(fs_handle);
|
||||
@@ -86,8 +85,7 @@ UnloadFusionSoundLibrary()
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
LoadFusionSoundLibrary(void)
|
||||
static int LoadFusionSoundLibrary(void)
|
||||
{
|
||||
int i, retval = -1;
|
||||
|
||||
@@ -112,14 +110,12 @@ LoadFusionSoundLibrary(void)
|
||||
|
||||
#else
|
||||
|
||||
static void
|
||||
UnloadFusionSoundLibrary()
|
||||
static void UnloadFusionSoundLibrary()
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
static int
|
||||
LoadFusionSoundLibrary(void)
|
||||
static int LoadFusionSoundLibrary(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@@ -127,15 +123,13 @@ LoadFusionSoundLibrary(void)
|
||||
#endif /* SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC */
|
||||
|
||||
/* This function waits until it is possible to write a full sound buffer */
|
||||
static void
|
||||
SDL_FS_WaitDevice(_THIS)
|
||||
static void SDL_FS_WaitDevice(_THIS)
|
||||
{
|
||||
this->hidden->stream->Wait(this->hidden->stream,
|
||||
this->hidden->mixsamples);
|
||||
}
|
||||
|
||||
static void
|
||||
SDL_FS_PlayDevice(_THIS)
|
||||
static void SDL_FS_PlayDevice(_THIS)
|
||||
{
|
||||
DirectResult ret;
|
||||
|
||||
@@ -152,15 +146,13 @@ SDL_FS_PlayDevice(_THIS)
|
||||
}
|
||||
|
||||
|
||||
static Uint8 *
|
||||
SDL_FS_GetDeviceBuf(_THIS)
|
||||
static Uint8 *SDL_FS_GetDeviceBuf(_THIS)
|
||||
{
|
||||
return (this->hidden->mixbuf);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
SDL_FS_CloseDevice(_THIS)
|
||||
static void SDL_FS_CloseDevice(_THIS)
|
||||
{
|
||||
if (this->hidden->stream) {
|
||||
this->hidden->stream->Release(this->hidden->stream);
|
||||
@@ -173,8 +165,7 @@ SDL_FS_CloseDevice(_THIS)
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
SDL_FS_OpenDevice(_THIS, const char *devname)
|
||||
static int SDL_FS_OpenDevice(_THIS, const char *devname)
|
||||
{
|
||||
int bytes;
|
||||
SDL_AudioFormat test_format;
|
||||
@@ -269,15 +260,13 @@ SDL_FS_OpenDevice(_THIS, const char *devname)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
SDL_FS_Deinitialize(void)
|
||||
static void SDL_FS_Deinitialize(void)
|
||||
{
|
||||
UnloadFusionSoundLibrary();
|
||||
}
|
||||
|
||||
|
||||
static SDL_bool
|
||||
SDL_FS_Init(SDL_AudioDriverImpl * impl)
|
||||
static SDL_bool SDL_FS_Init(SDL_AudioDriverImpl * impl)
|
||||
{
|
||||
if (LoadFusionSoundLibrary() < 0) {
|
||||
return SDL_FALSE;
|
||||
|
||||
@@ -45,7 +45,8 @@
|
||||
static void nacl_audio_callback(void* samples, uint32_t buffer_size, PP_TimeDelta latency, void* data);
|
||||
|
||||
/* FIXME: Make use of latency if needed */
|
||||
static void nacl_audio_callback(void* stream, uint32_t buffer_size, PP_TimeDelta latency, void* data) {
|
||||
static void nacl_audio_callback(void* stream, uint32_t buffer_size, PP_TimeDelta latency, void* data)
|
||||
{
|
||||
const int len = (int) buffer_size;
|
||||
SDL_AudioDevice* _this = (SDL_AudioDevice*) data;
|
||||
SDL_AudioCallback callback = _this->callbackspec.callback;
|
||||
@@ -85,7 +86,8 @@ static void nacl_audio_callback(void* stream, uint32_t buffer_size, PP_TimeDelta
|
||||
SDL_UnlockMutex(_this->mixer_lock);
|
||||
}
|
||||
|
||||
static void NACLAUDIO_CloseDevice(SDL_AudioDevice *device) {
|
||||
static void NACLAUDIO_CloseDevice(SDL_AudioDevice *device)
|
||||
{
|
||||
const PPB_Core *core = PSInterfaceCore();
|
||||
const PPB_Audio *ppb_audio = PSInterfaceAudio();
|
||||
SDL_PrivateAudioData *hidden = (SDL_PrivateAudioData *) device->hidden;
|
||||
@@ -94,8 +96,8 @@ static void NACLAUDIO_CloseDevice(SDL_AudioDevice *device) {
|
||||
core->ReleaseResource(hidden->audio);
|
||||
}
|
||||
|
||||
static int
|
||||
NACLAUDIO_OpenDevice(_THIS, const char *devname) {
|
||||
static int NACLAUDIO_OpenDevice(_THIS, const char *devname)
|
||||
{
|
||||
PP_Instance instance = PSGetInstanceId();
|
||||
const PPB_Audio *ppb_audio = PSInterfaceAudio();
|
||||
const PPB_AudioConfig *ppb_audiocfg = PSInterfaceAudioConfig();
|
||||
@@ -128,8 +130,7 @@ NACLAUDIO_OpenDevice(_THIS, const char *devname) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static SDL_bool
|
||||
NACLAUDIO_Init(SDL_AudioDriverImpl * impl)
|
||||
static SDL_bool NACLAUDIO_Init(SDL_AudioDriverImpl * impl)
|
||||
{
|
||||
if (PSGetInstanceId() == 0) {
|
||||
return SDL_FALSE;
|
||||
|
||||
@@ -56,8 +56,7 @@ static AuEventHandlerRec *(*NAS_AuRegisterEventHandler)
|
||||
static const char *nas_library = SDL_AUDIO_DRIVER_NAS_DYNAMIC;
|
||||
static void *nas_handle = NULL;
|
||||
|
||||
static int
|
||||
load_nas_sym(const char *fn, void **addr)
|
||||
static int load_nas_sym(const char *fn, void **addr)
|
||||
{
|
||||
*addr = SDL_LoadFunction(nas_handle, fn);
|
||||
if (*addr == NULL) {
|
||||
@@ -73,8 +72,7 @@ load_nas_sym(const char *fn, void **addr)
|
||||
#define SDL_NAS_SYM(x) NAS_##x = x
|
||||
#endif
|
||||
|
||||
static int
|
||||
load_nas_syms(void)
|
||||
static int load_nas_syms(void)
|
||||
{
|
||||
SDL_NAS_SYM(AuCloseServer);
|
||||
SDL_NAS_SYM(AuNextEvent);
|
||||
@@ -94,8 +92,7 @@ load_nas_syms(void)
|
||||
|
||||
#ifdef SDL_AUDIO_DRIVER_NAS_DYNAMIC
|
||||
|
||||
static void
|
||||
UnloadNASLibrary(void)
|
||||
static void UnloadNASLibrary(void)
|
||||
{
|
||||
if (nas_handle != NULL) {
|
||||
SDL_UnloadObject(nas_handle);
|
||||
@@ -103,8 +100,7 @@ UnloadNASLibrary(void)
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
LoadNASLibrary(void)
|
||||
static int LoadNASLibrary(void)
|
||||
{
|
||||
int retval = 0;
|
||||
if (nas_handle == NULL) {
|
||||
@@ -130,13 +126,11 @@ LoadNASLibrary(void)
|
||||
|
||||
#else
|
||||
|
||||
static void
|
||||
UnloadNASLibrary(void)
|
||||
static void UnloadNASLibrary(void)
|
||||
{
|
||||
}
|
||||
|
||||
static int
|
||||
LoadNASLibrary(void)
|
||||
static int LoadNASLibrary(void)
|
||||
{
|
||||
load_nas_syms();
|
||||
return 0;
|
||||
@@ -145,8 +139,7 @@ LoadNASLibrary(void)
|
||||
#endif /* SDL_AUDIO_DRIVER_NAS_DYNAMIC */
|
||||
|
||||
/* This function waits until it is possible to write a full sound buffer */
|
||||
static void
|
||||
NAS_WaitDevice(_THIS)
|
||||
static void NAS_WaitDevice(_THIS)
|
||||
{
|
||||
while (this->hidden->buf_free < this->hidden->mixlen) {
|
||||
AuEvent ev;
|
||||
@@ -155,8 +148,7 @@ NAS_WaitDevice(_THIS)
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
NAS_PlayDevice(_THIS)
|
||||
static void NAS_PlayDevice(_THIS)
|
||||
{
|
||||
while (this->hidden->mixlen > this->hidden->buf_free) {
|
||||
/*
|
||||
@@ -182,14 +174,12 @@ NAS_PlayDevice(_THIS)
|
||||
#endif
|
||||
}
|
||||
|
||||
static Uint8 *
|
||||
NAS_GetDeviceBuf(_THIS)
|
||||
static Uint8 *NAS_GetDeviceBuf(_THIS)
|
||||
{
|
||||
return (this->hidden->mixbuf);
|
||||
}
|
||||
|
||||
static int
|
||||
NAS_CaptureFromDevice(_THIS, void *buffer, int buflen)
|
||||
static int NAS_CaptureFromDevice(_THIS, void *buffer, int buflen)
|
||||
{
|
||||
struct SDL_PrivateAudioData *h = this->hidden;
|
||||
int retval;
|
||||
@@ -210,8 +200,7 @@ NAS_CaptureFromDevice(_THIS, void *buffer, int buflen)
|
||||
return retval;
|
||||
}
|
||||
|
||||
static void
|
||||
NAS_FlushCapture(_THIS)
|
||||
static void NAS_FlushCapture(_THIS)
|
||||
{
|
||||
struct SDL_PrivateAudioData *h = this->hidden;
|
||||
AuUint32 total = 0;
|
||||
@@ -227,8 +216,7 @@ NAS_FlushCapture(_THIS)
|
||||
} while ((br == sizeof(buf)) && (total < this->spec.size));
|
||||
}
|
||||
|
||||
static void
|
||||
NAS_CloseDevice(_THIS)
|
||||
static void NAS_CloseDevice(_THIS)
|
||||
{
|
||||
if (this->hidden->aud) {
|
||||
NAS_AuCloseServer(this->hidden->aud);
|
||||
@@ -237,8 +225,7 @@ NAS_CloseDevice(_THIS)
|
||||
SDL_free(this->hidden);
|
||||
}
|
||||
|
||||
static AuBool
|
||||
event_handler(AuServer * aud, AuEvent * ev, AuEventHandlerRec * hnd)
|
||||
static AuBool event_handler(AuServer * aud, AuEvent * ev, AuEventHandlerRec * hnd)
|
||||
{
|
||||
SDL_AudioDevice *this = (SDL_AudioDevice *) hnd->data;
|
||||
struct SDL_PrivateAudioData *h = this->hidden;
|
||||
@@ -281,8 +268,7 @@ event_handler(AuServer * aud, AuEvent * ev, AuEventHandlerRec * hnd)
|
||||
return AuTrue;
|
||||
}
|
||||
|
||||
static AuDeviceID
|
||||
find_device(_THIS)
|
||||
static AuDeviceID find_device(_THIS)
|
||||
{
|
||||
/* These "Au" things are all macros, not functions... */
|
||||
struct SDL_PrivateAudioData *h = this->hidden;
|
||||
@@ -310,8 +296,7 @@ find_device(_THIS)
|
||||
return AuNone;
|
||||
}
|
||||
|
||||
static int
|
||||
NAS_OpenDevice(_THIS, const char *devname)
|
||||
static int NAS_OpenDevice(_THIS, const char *devname)
|
||||
{
|
||||
AuElement elms[3];
|
||||
int buffer_size;
|
||||
@@ -414,14 +399,12 @@ NAS_OpenDevice(_THIS, const char *devname)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
NAS_Deinitialize(void)
|
||||
static void NAS_Deinitialize(void)
|
||||
{
|
||||
UnloadNASLibrary();
|
||||
}
|
||||
|
||||
static SDL_bool
|
||||
NAS_Init(SDL_AudioDriverImpl * impl)
|
||||
static SDL_bool NAS_Init(SDL_AudioDriverImpl * impl)
|
||||
{
|
||||
if (LoadNASLibrary() < 0) {
|
||||
return SDL_FALSE;
|
||||
|
||||
@@ -69,8 +69,7 @@ static char devsettings[][3] = {
|
||||
{'\0', '\0', '\0'}
|
||||
};
|
||||
|
||||
static int
|
||||
OpenUserDefinedDevice(char *path, int maxlen, int flags)
|
||||
static int OpenUserDefinedDevice(char *path, int maxlen, int flags)
|
||||
{
|
||||
const char *audiodev;
|
||||
int fd;
|
||||
@@ -90,8 +89,7 @@ OpenUserDefinedDevice(char *path, int maxlen, int flags)
|
||||
return fd;
|
||||
}
|
||||
|
||||
static int
|
||||
OpenAudioPath(char *path, int maxlen, int flags, int classic)
|
||||
static int OpenAudioPath(char *path, int maxlen, int flags, int classic)
|
||||
{
|
||||
struct stat sb;
|
||||
int cycle = 0;
|
||||
@@ -123,8 +121,7 @@ OpenAudioPath(char *path, int maxlen, int flags, int classic)
|
||||
}
|
||||
|
||||
/* This function waits until it is possible to write a full sound buffer */
|
||||
static void
|
||||
PAUDIO_WaitDevice(_THIS)
|
||||
static void PAUDIO_WaitDevice(_THIS)
|
||||
{
|
||||
fd_set fdset;
|
||||
|
||||
@@ -176,8 +173,7 @@ PAUDIO_WaitDevice(_THIS)
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
PAUDIO_PlayDevice(_THIS)
|
||||
static void PAUDIO_PlayDevice(_THIS)
|
||||
{
|
||||
int written = 0;
|
||||
const Uint8 *mixbuf = this->hidden->mixbuf;
|
||||
@@ -206,14 +202,12 @@ PAUDIO_PlayDevice(_THIS)
|
||||
#endif
|
||||
}
|
||||
|
||||
static Uint8 *
|
||||
PAUDIO_GetDeviceBuf(_THIS)
|
||||
static Uint8 *PAUDIO_GetDeviceBuf(_THIS)
|
||||
{
|
||||
return this->hidden->mixbuf;
|
||||
}
|
||||
|
||||
static void
|
||||
PAUDIO_CloseDevice(_THIS)
|
||||
static void PAUDIO_CloseDevice(_THIS)
|
||||
{
|
||||
if (this->hidden->audio_fd >= 0) {
|
||||
close(this->hidden->audio_fd);
|
||||
@@ -222,8 +216,7 @@ PAUDIO_CloseDevice(_THIS)
|
||||
SDL_free(this->hidden);
|
||||
}
|
||||
|
||||
static int
|
||||
PAUDIO_OpenDevice(_THIS, const char *devname)
|
||||
static int PAUDIO_OpenDevice(_THIS, const char *devname)
|
||||
{
|
||||
const char *workaround = SDL_getenv("SDL_DSP_NOSELECT");
|
||||
char audiodev[1024];
|
||||
@@ -462,8 +455,7 @@ PAUDIO_OpenDevice(_THIS, const char *devname)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static SDL_bool
|
||||
PAUDIO_Init(SDL_AudioDriverImpl * impl)
|
||||
static SDL_bool PAUDIO_Init(SDL_AudioDriverImpl * impl)
|
||||
{
|
||||
/* !!! FIXME: not right for device enum? */
|
||||
int fd = OpenAudioPath(NULL, 0, OPEN_FLAGS, 0);
|
||||
|
||||
@@ -74,15 +74,13 @@ uint32_t qsa_playback_devices;
|
||||
QSA_Device qsa_capture_device[QSA_MAX_DEVICES];
|
||||
uint32_t qsa_capture_devices;
|
||||
|
||||
static SDL_INLINE int
|
||||
QSA_SetError(const char *fn, int status)
|
||||
static int QSA_SetError(const char *fn, int status)
|
||||
{
|
||||
return SDL_SetError("QSA: %s() failed: %s", fn, snd_strerror(status));
|
||||
}
|
||||
|
||||
/* !!! FIXME: does this need to be here? Does the SDL version not work? */
|
||||
static void
|
||||
QSA_ThreadInit(_THIS)
|
||||
static void QSA_ThreadInit(_THIS)
|
||||
{
|
||||
/* Increase default 10 priority to 25 to avoid jerky sound */
|
||||
struct sched_param param;
|
||||
@@ -93,8 +91,7 @@ QSA_ThreadInit(_THIS)
|
||||
}
|
||||
|
||||
/* PCM channel parameters initialize function */
|
||||
static void
|
||||
QSA_InitAudioParams(snd_pcm_channel_params_t * cpars)
|
||||
static void QSA_InitAudioParams(snd_pcm_channel_params_t * cpars)
|
||||
{
|
||||
SDL_zerop(cpars);
|
||||
cpars->channel = SND_PCM_CHANNEL_PLAYBACK;
|
||||
@@ -111,8 +108,7 @@ QSA_InitAudioParams(snd_pcm_channel_params_t * cpars)
|
||||
}
|
||||
|
||||
/* This function waits until it is possible to write a full sound buffer */
|
||||
static void
|
||||
QSA_WaitDevice(_THIS)
|
||||
static void QSA_WaitDevice(_THIS)
|
||||
{
|
||||
int result;
|
||||
|
||||
@@ -137,8 +133,7 @@ QSA_WaitDevice(_THIS)
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
QSA_PlayDevice(_THIS)
|
||||
static void QSA_PlayDevice(_THIS)
|
||||
{
|
||||
snd_pcm_channel_status_t cstatus;
|
||||
int written;
|
||||
@@ -230,14 +225,12 @@ QSA_PlayDevice(_THIS)
|
||||
}
|
||||
}
|
||||
|
||||
static Uint8 *
|
||||
QSA_GetDeviceBuf(_THIS)
|
||||
static Uint8 *QSA_GetDeviceBuf(_THIS)
|
||||
{
|
||||
return this->hidden->pcm_buf;
|
||||
}
|
||||
|
||||
static void
|
||||
QSA_CloseDevice(_THIS)
|
||||
static void QSA_CloseDevice(_THIS)
|
||||
{
|
||||
if (this->hidden->audio_handle != NULL) {
|
||||
if (!this->iscapture) {
|
||||
@@ -256,8 +249,7 @@ QSA_CloseDevice(_THIS)
|
||||
SDL_free(this->hidden);
|
||||
}
|
||||
|
||||
static int
|
||||
QSA_OpenDevice(_THIS, const char *devname)
|
||||
static int QSA_OpenDevice(_THIS, const char *devname)
|
||||
{
|
||||
const QSA_Device *device = (const QSA_Device *) this->handle;
|
||||
SDL_bool iscapture = this->iscapture;
|
||||
@@ -435,8 +427,7 @@ QSA_OpenDevice(_THIS, const char *devname)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
QSA_DetectDevices(void)
|
||||
static void QSA_DetectDevices(void)
|
||||
{
|
||||
uint32_t it;
|
||||
uint32_t cards;
|
||||
@@ -581,8 +572,7 @@ QSA_DetectDevices(void)
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
QSA_Deinitialize(void)
|
||||
static void QSA_Deinitialize(void)
|
||||
{
|
||||
/* Clear devices array on shutdown */
|
||||
/* !!! FIXME: we zero these on init...any reason to do it here? */
|
||||
@@ -592,8 +582,7 @@ QSA_Deinitialize(void)
|
||||
qsa_capture_devices = 0;
|
||||
}
|
||||
|
||||
static SDL_bool
|
||||
QSA_Init(SDL_AudioDriverImpl * impl)
|
||||
static SDL_bool QSA_Init(SDL_AudioDriverImpl * impl)
|
||||
{
|
||||
/* Clear devices array */
|
||||
SDL_zeroa(qsa_playback_device);
|
||||
|
||||
@@ -55,15 +55,13 @@
|
||||
static Uint8 snd2au(int sample);
|
||||
|
||||
/* Audio driver bootstrap functions */
|
||||
static void
|
||||
SUNAUDIO_DetectDevices(void)
|
||||
static void SUNAUDIO_DetectDevices(void)
|
||||
{
|
||||
SDL_EnumUnixAudioDevices(1, (int (*)(int)) NULL);
|
||||
}
|
||||
|
||||
#ifdef DEBUG_AUDIO
|
||||
void
|
||||
CheckUnderflow(_THIS)
|
||||
void CheckUnderflow(_THIS)
|
||||
{
|
||||
#ifdef AUDIO_GETBUFINFO
|
||||
audio_info_t info;
|
||||
@@ -78,8 +76,7 @@ CheckUnderflow(_THIS)
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
SUNAUDIO_WaitDevice(_THIS)
|
||||
static void SUNAUDIO_WaitDevice(_THIS)
|
||||
{
|
||||
#ifdef AUDIO_GETBUFINFO
|
||||
#define SLEEP_FUDGE 10 /* 10 ms scheduling fudge factor */
|
||||
@@ -102,8 +99,7 @@ SUNAUDIO_WaitDevice(_THIS)
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
SUNAUDIO_PlayDevice(_THIS)
|
||||
static void SUNAUDIO_PlayDevice(_THIS)
|
||||
{
|
||||
/* Write the audio data */
|
||||
if (this->hidden->ulaw_only) {
|
||||
@@ -170,14 +166,12 @@ SUNAUDIO_PlayDevice(_THIS)
|
||||
}
|
||||
}
|
||||
|
||||
static Uint8 *
|
||||
SUNAUDIO_GetDeviceBuf(_THIS)
|
||||
static Uint8 *SUNAUDIO_GetDeviceBuf(_THIS)
|
||||
{
|
||||
return (this->hidden->mixbuf);
|
||||
}
|
||||
|
||||
static void
|
||||
SUNAUDIO_CloseDevice(_THIS)
|
||||
static void SUNAUDIO_CloseDevice(_THIS)
|
||||
{
|
||||
SDL_free(this->hidden->ulaw_buf);
|
||||
if (this->hidden->audio_fd >= 0) {
|
||||
@@ -187,8 +181,7 @@ SUNAUDIO_CloseDevice(_THIS)
|
||||
SDL_free(this->hidden);
|
||||
}
|
||||
|
||||
static int
|
||||
SUNAUDIO_OpenDevice(_THIS, const char *devname)
|
||||
static int SUNAUDIO_OpenDevice(_THIS, const char *devname)
|
||||
{
|
||||
#ifdef AUDIO_SETINFO
|
||||
int enc;
|
||||
@@ -359,8 +352,7 @@ SUNAUDIO_OpenDevice(_THIS, const char *devname)
|
||||
/* provided "as is" without express or implied warranty. */
|
||||
/************************************************************************/
|
||||
|
||||
static Uint8
|
||||
snd2au(int sample)
|
||||
static Uint8 snd2au(int sample)
|
||||
{
|
||||
|
||||
int mask;
|
||||
@@ -394,8 +386,7 @@ snd2au(int sample)
|
||||
return (mask & sample);
|
||||
}
|
||||
|
||||
static SDL_bool
|
||||
SUNAUDIO_Init(SDL_AudioDriverImpl * impl)
|
||||
static SDL_bool SUNAUDIO_Init(SDL_AudioDriverImpl * impl)
|
||||
{
|
||||
/* Set the function pointers */
|
||||
impl->DetectDevices = SUNAUDIO_DetectDevices;
|
||||
|
||||
+13
-28
@@ -97,16 +97,13 @@ static void DetectWave##typ##Devs(void) { \
|
||||
DETECT_DEV_IMPL(SDL_FALSE, Out, WAVEOUTCAPS)
|
||||
DETECT_DEV_IMPL(SDL_TRUE, In, WAVEINCAPS)
|
||||
|
||||
static void
|
||||
WINMM_DetectDevices(void)
|
||||
static void WINMM_DetectDevices(void)
|
||||
{
|
||||
DetectWaveInDevs();
|
||||
DetectWaveOutDevs();
|
||||
}
|
||||
|
||||
static void CALLBACK
|
||||
CaptureSound(HWAVEIN hwi, UINT uMsg, DWORD_PTR dwInstance,
|
||||
DWORD_PTR dwParam1, DWORD_PTR dwParam2)
|
||||
static void CALLBACK CaptureSound(HWAVEIN hwi, UINT uMsg, DWORD_PTR dwInstance, DWORD_PTR dwParam1, DWORD_PTR dwParam2)
|
||||
{
|
||||
SDL_AudioDevice *this = (SDL_AudioDevice *) dwInstance;
|
||||
|
||||
@@ -120,9 +117,7 @@ CaptureSound(HWAVEIN hwi, UINT uMsg, DWORD_PTR dwInstance,
|
||||
|
||||
|
||||
/* The Win32 callback for filling the WAVE device */
|
||||
static void CALLBACK
|
||||
FillSound(HWAVEOUT hwo, UINT uMsg, DWORD_PTR dwInstance,
|
||||
DWORD_PTR dwParam1, DWORD_PTR dwParam2)
|
||||
static void CALLBACK FillSound(HWAVEOUT hwo, UINT uMsg, DWORD_PTR dwInstance, DWORD_PTR dwParam1, DWORD_PTR dwParam2)
|
||||
{
|
||||
SDL_AudioDevice *this = (SDL_AudioDevice *) dwInstance;
|
||||
|
||||
@@ -134,8 +129,7 @@ FillSound(HWAVEOUT hwo, UINT uMsg, DWORD_PTR dwInstance,
|
||||
ReleaseSemaphore(this->hidden->audio_sem, 1, NULL);
|
||||
}
|
||||
|
||||
static int
|
||||
SetMMerror(const char *function, MMRESULT code)
|
||||
static int SetMMerror(const char *function, MMRESULT code)
|
||||
{
|
||||
int len;
|
||||
char errbuf[MAXERRORLENGTH];
|
||||
@@ -151,22 +145,19 @@ SetMMerror(const char *function, MMRESULT code)
|
||||
return SDL_SetError("%s", errbuf);
|
||||
}
|
||||
|
||||
static void
|
||||
WINMM_WaitDevice(_THIS)
|
||||
static void WINMM_WaitDevice(_THIS)
|
||||
{
|
||||
/* Wait for an audio chunk to finish */
|
||||
WaitForSingleObject(this->hidden->audio_sem, INFINITE);
|
||||
}
|
||||
|
||||
static Uint8 *
|
||||
WINMM_GetDeviceBuf(_THIS)
|
||||
static Uint8 *WINMM_GetDeviceBuf(_THIS)
|
||||
{
|
||||
return (Uint8 *) (this->hidden->
|
||||
wavebuf[this->hidden->next_buffer].lpData);
|
||||
}
|
||||
|
||||
static void
|
||||
WINMM_PlayDevice(_THIS)
|
||||
static void WINMM_PlayDevice(_THIS)
|
||||
{
|
||||
/* Queue it up */
|
||||
waveOutWrite(this->hidden->hout,
|
||||
@@ -175,8 +166,7 @@ WINMM_PlayDevice(_THIS)
|
||||
this->hidden->next_buffer = (this->hidden->next_buffer + 1) % NUM_BUFFERS;
|
||||
}
|
||||
|
||||
static int
|
||||
WINMM_CaptureFromDevice(_THIS, void *buffer, int buflen)
|
||||
static int WINMM_CaptureFromDevice(_THIS, void *buffer, int buflen)
|
||||
{
|
||||
const int nextbuf = this->hidden->next_buffer;
|
||||
MMRESULT result;
|
||||
@@ -202,8 +192,7 @@ WINMM_CaptureFromDevice(_THIS, void *buffer, int buflen)
|
||||
return this->spec.size;
|
||||
}
|
||||
|
||||
static void
|
||||
WINMM_FlushCapture(_THIS)
|
||||
static void WINMM_FlushCapture(_THIS)
|
||||
{
|
||||
/* Wait for an audio chunk to finish */
|
||||
if (WaitForSingleObject(this->hidden->audio_sem, 0) == WAIT_OBJECT_0) {
|
||||
@@ -216,8 +205,7 @@ WINMM_FlushCapture(_THIS)
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
WINMM_CloseDevice(_THIS)
|
||||
static void WINMM_CloseDevice(_THIS)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -258,8 +246,7 @@ WINMM_CloseDevice(_THIS)
|
||||
SDL_free(this->hidden);
|
||||
}
|
||||
|
||||
static SDL_bool
|
||||
PrepWaveFormat(_THIS, UINT devId, WAVEFORMATEX *pfmt, const int iscapture)
|
||||
static SDL_bool PrepWaveFormat(_THIS, UINT devId, WAVEFORMATEX *pfmt, const int iscapture)
|
||||
{
|
||||
SDL_zerop(pfmt);
|
||||
|
||||
@@ -282,8 +269,7 @@ PrepWaveFormat(_THIS, UINT devId, WAVEFORMATEX *pfmt, const int iscapture)
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
WINMM_OpenDevice(_THIS, const char *devname)
|
||||
static int WINMM_OpenDevice(_THIS, const char *devname)
|
||||
{
|
||||
SDL_AudioFormat test_format;
|
||||
SDL_bool iscapture = this->iscapture;
|
||||
@@ -431,8 +417,7 @@ WINMM_OpenDevice(_THIS, const char *devname)
|
||||
return 0; /* Ready to go! */
|
||||
}
|
||||
|
||||
static SDL_bool
|
||||
WINMM_Init(SDL_AudioDriverImpl * impl)
|
||||
static SDL_bool WINMM_Init(SDL_AudioDriverImpl * impl)
|
||||
{
|
||||
/* Set the function pointers */
|
||||
impl->DetectDevices = WINMM_DetectDevices;
|
||||
|
||||
@@ -221,8 +221,7 @@ static void kbd_register_emerg_cleanup(SDL_EVDEV_keyboard_state *kbd)
|
||||
}
|
||||
}
|
||||
|
||||
SDL_EVDEV_keyboard_state *
|
||||
SDL_EVDEV_kbd_init(void)
|
||||
SDL_EVDEV_keyboard_state *SDL_EVDEV_kbd_init(void)
|
||||
{
|
||||
SDL_EVDEV_keyboard_state *kbd;
|
||||
struct mouse_info mData;
|
||||
|
||||
@@ -193,8 +193,7 @@ void SDL_DBus_Quit(void)
|
||||
inhibit_handle = NULL;
|
||||
}
|
||||
|
||||
SDL_DBusContext *
|
||||
SDL_DBus_GetContext(void)
|
||||
SDL_DBusContext *SDL_DBus_GetContext(void)
|
||||
{
|
||||
if (dbus_handle == NULL || !dbus.session_conn) {
|
||||
SDL_DBus_Init();
|
||||
@@ -246,8 +245,7 @@ static SDL_bool SDL_DBus_CallMethodInternal(DBusConnection *conn, const char *no
|
||||
return retval;
|
||||
}
|
||||
|
||||
SDL_bool
|
||||
SDL_DBus_CallMethodOnConnection(DBusConnection *conn, const char *node, const char *path, const char *interface, const char *method, ...)
|
||||
SDL_bool SDL_DBus_CallMethodOnConnection(DBusConnection *conn, const char *node, const char *path, const char *interface, const char *method, ...)
|
||||
{
|
||||
SDL_bool retval;
|
||||
va_list ap;
|
||||
@@ -257,8 +255,7 @@ SDL_DBus_CallMethodOnConnection(DBusConnection *conn, const char *node, const ch
|
||||
return retval;
|
||||
}
|
||||
|
||||
SDL_bool
|
||||
SDL_DBus_CallMethod(const char *node, const char *path, const char *interface, const char *method, ...)
|
||||
SDL_bool SDL_DBus_CallMethod(const char *node, const char *path, const char *interface, const char *method, ...)
|
||||
{
|
||||
SDL_bool retval;
|
||||
va_list ap;
|
||||
@@ -315,8 +312,7 @@ static SDL_bool SDL_DBus_CallWithBasicReply(DBusConnection *conn, DBusMessage *m
|
||||
return retval;
|
||||
}
|
||||
|
||||
SDL_bool
|
||||
SDL_DBus_CallVoidMethodOnConnection(DBusConnection *conn, const char *node, const char *path, const char *interface, const char *method, ...)
|
||||
SDL_bool SDL_DBus_CallVoidMethodOnConnection(DBusConnection *conn, const char *node, const char *path, const char *interface, const char *method, ...)
|
||||
{
|
||||
SDL_bool retval;
|
||||
va_list ap;
|
||||
@@ -326,8 +322,7 @@ SDL_DBus_CallVoidMethodOnConnection(DBusConnection *conn, const char *node, cons
|
||||
return retval;
|
||||
}
|
||||
|
||||
SDL_bool
|
||||
SDL_DBus_CallVoidMethod(const char *node, const char *path, const char *interface, const char *method, ...)
|
||||
SDL_bool SDL_DBus_CallVoidMethod(const char *node, const char *path, const char *interface, const char *method, ...)
|
||||
{
|
||||
SDL_bool retval;
|
||||
va_list ap;
|
||||
@@ -337,8 +332,7 @@ SDL_DBus_CallVoidMethod(const char *node, const char *path, const char *interfac
|
||||
return retval;
|
||||
}
|
||||
|
||||
SDL_bool
|
||||
SDL_DBus_QueryPropertyOnConnection(DBusConnection *conn, const char *node, const char *path, const char *interface, const char *property, const int expectedtype, void *result)
|
||||
SDL_bool SDL_DBus_QueryPropertyOnConnection(DBusConnection *conn, const char *node, const char *path, const char *interface, const char *property, const int expectedtype, void *result)
|
||||
{
|
||||
SDL_bool retval = SDL_FALSE;
|
||||
|
||||
@@ -355,8 +349,7 @@ SDL_DBus_QueryPropertyOnConnection(DBusConnection *conn, const char *node, const
|
||||
return retval;
|
||||
}
|
||||
|
||||
SDL_bool
|
||||
SDL_DBus_QueryProperty(const char *node, const char *path, const char *interface, const char *property, const int expectedtype, void *result)
|
||||
SDL_bool SDL_DBus_QueryProperty(const char *node, const char *path, const char *interface, const char *property, const int expectedtype, void *result)
|
||||
{
|
||||
return SDL_DBus_QueryPropertyOnConnection(dbus.session_conn, node, path, interface, property, expectedtype, result);
|
||||
}
|
||||
@@ -407,8 +400,7 @@ failed:
|
||||
return SDL_FALSE;
|
||||
}
|
||||
|
||||
SDL_bool
|
||||
SDL_DBus_ScreensaverInhibit(SDL_bool inhibit)
|
||||
SDL_bool SDL_DBus_ScreensaverInhibit(SDL_bool inhibit)
|
||||
{
|
||||
const char *default_inhibit_reason = "Playing a game";
|
||||
|
||||
|
||||
@@ -296,8 +296,7 @@ static void kbd_register_emerg_cleanup(SDL_EVDEV_keyboard_state *kbd)
|
||||
}
|
||||
}
|
||||
|
||||
SDL_EVDEV_keyboard_state *
|
||||
SDL_EVDEV_kbd_init(void)
|
||||
SDL_EVDEV_keyboard_state *SDL_EVDEV_kbd_init(void)
|
||||
{
|
||||
SDL_EVDEV_keyboard_state *kbd;
|
||||
char flag_state;
|
||||
@@ -805,8 +804,7 @@ void SDL_EVDEV_kbd_keycode(SDL_EVDEV_keyboard_state *state, unsigned int keycode
|
||||
|
||||
#elif !defined(SDL_INPUT_FBSDKBIO) /* !SDL_INPUT_LINUXKD */
|
||||
|
||||
SDL_EVDEV_keyboard_state *
|
||||
SDL_EVDEV_kbd_init(void)
|
||||
SDL_EVDEV_keyboard_state *SDL_EVDEV_kbd_init(void)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -83,8 +83,7 @@ static char *GetAppName()
|
||||
return SDL_strdup("SDL_App");
|
||||
}
|
||||
|
||||
static size_t
|
||||
Fcitx_GetPreeditString(SDL_DBusContext *dbus,
|
||||
static size_t Fcitx_GetPreeditString(SDL_DBusContext *dbus,
|
||||
DBusMessage *msg,
|
||||
char **ret,
|
||||
Sint32 *start_pos,
|
||||
@@ -369,8 +368,7 @@ static Uint32 Fcitx_ModState(void)
|
||||
return fcitx_mods;
|
||||
}
|
||||
|
||||
SDL_bool
|
||||
SDL_Fcitx_Init()
|
||||
SDL_bool SDL_Fcitx_Init()
|
||||
{
|
||||
fcitx_client.dbus = SDL_DBus_GetContext();
|
||||
|
||||
@@ -406,8 +404,7 @@ void SDL_Fcitx_Reset(void)
|
||||
FcitxClientICCallMethod(&fcitx_client, "CloseIC");
|
||||
}
|
||||
|
||||
SDL_bool
|
||||
SDL_Fcitx_ProcessKeyEvent(Uint32 keysym, Uint32 keycode, Uint8 state)
|
||||
SDL_bool SDL_Fcitx_ProcessKeyEvent(Uint32 keysym, Uint32 keycode, Uint8 state)
|
||||
{
|
||||
Uint32 mod_state = Fcitx_ModState();
|
||||
Uint32 handled = SDL_FALSE;
|
||||
|
||||
@@ -555,8 +555,7 @@ static SDL_bool IBus_CheckConnection(SDL_DBusContext *dbus)
|
||||
return SDL_FALSE;
|
||||
}
|
||||
|
||||
SDL_bool
|
||||
SDL_IBus_Init(void)
|
||||
SDL_bool SDL_IBus_Init(void)
|
||||
{
|
||||
SDL_bool result = SDL_FALSE;
|
||||
SDL_DBusContext *dbus = SDL_DBus_GetContext();
|
||||
@@ -671,8 +670,7 @@ void SDL_IBus_Reset(void)
|
||||
IBus_SimpleMessage("Reset");
|
||||
}
|
||||
|
||||
SDL_bool
|
||||
SDL_IBus_ProcessKeyEvent(Uint32 keysym, Uint32 keycode, Uint8 state)
|
||||
SDL_bool SDL_IBus_ProcessKeyEvent(Uint32 keysym, Uint32 keycode, Uint8 state)
|
||||
{
|
||||
Uint32 result = 0;
|
||||
SDL_DBusContext *dbus = SDL_DBus_GetContext();
|
||||
@@ -717,16 +715,16 @@ void SDL_IBus_UpdateTextRect(const SDL_Rect *rect)
|
||||
}
|
||||
|
||||
SDL_GetWindowPosition(focused_win, &x, &y);
|
||||
|
||||
#if SDL_VIDEO_DRIVER_X11
|
||||
|
||||
#if SDL_VIDEO_DRIVER_X11
|
||||
if (info.subsystem == SDL_SYSWM_X11) {
|
||||
SDL_DisplayData *displaydata = (SDL_DisplayData *) SDL_GetDisplayForWindow(focused_win)->driverdata;
|
||||
|
||||
|
||||
Display *x_disp = info.info.x11.display;
|
||||
Window x_win = info.info.x11.window;
|
||||
int x_screen = displaydata->screen;
|
||||
Window unused;
|
||||
|
||||
|
||||
X11_XTranslateCoordinates(x_disp, x_win, RootWindow(x_disp, x_screen), 0, 0, &x, &y, &unused);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -83,8 +83,7 @@ static void InitIME()
|
||||
#endif /* HAVE_IBUS_IBUS_H */
|
||||
}
|
||||
|
||||
SDL_bool
|
||||
SDL_IME_Init(void)
|
||||
SDL_bool SDL_IME_Init(void)
|
||||
{
|
||||
InitIME();
|
||||
|
||||
@@ -127,8 +126,7 @@ void SDL_IME_Reset(void)
|
||||
}
|
||||
}
|
||||
|
||||
SDL_bool
|
||||
SDL_IME_ProcessKeyEvent(Uint32 keysym, Uint32 keycode, Uint8 state)
|
||||
SDL_bool SDL_IME_ProcessKeyEvent(Uint32 keysym, Uint32 keycode, Uint8 state)
|
||||
{
|
||||
if (SDL_IME_ProcessKeyEvent_Real) {
|
||||
return SDL_IME_ProcessKeyEvent_Real(keysym, keycode, state);
|
||||
|
||||
@@ -222,8 +222,7 @@ void SDL_UDEV_Scan(void)
|
||||
_this->syms.udev_enumerate_unref(enumerate);
|
||||
}
|
||||
|
||||
SDL_bool
|
||||
SDL_UDEV_GetProductInfo(const char *device_path, Uint16 *vendor, Uint16 *product, Uint16 *version)
|
||||
SDL_bool SDL_UDEV_GetProductInfo(const char *device_path, Uint16 *vendor, Uint16 *product, Uint16 *version)
|
||||
{
|
||||
struct udev_enumerate *enumerate = NULL;
|
||||
struct udev_list_entry *devs = NULL;
|
||||
@@ -550,8 +549,7 @@ void SDL_UDEV_DelCallback(SDL_UDEV_Callback cb)
|
||||
}
|
||||
}
|
||||
|
||||
const SDL_UDEV_Symbols *
|
||||
SDL_UDEV_GetUdevSyms(void)
|
||||
const SDL_UDEV_Symbols *SDL_UDEV_GetUdevSyms(void)
|
||||
{
|
||||
if (SDL_UDEV_Init() < 0) {
|
||||
SDL_SetError("Could not initialize UDEV");
|
||||
|
||||
@@ -505,8 +505,7 @@ int SDL_IMMDevice_GetDefaultAudioInfo(char **name, SDL_AudioSpec *spec, int isca
|
||||
return 0;
|
||||
}
|
||||
|
||||
SDL_AudioFormat
|
||||
WaveFormatToSDLFormat(WAVEFORMATEX *waveformat)
|
||||
SDL_AudioFormat WaveFormatToSDLFormat(WAVEFORMATEX *waveformat)
|
||||
{
|
||||
if ((waveformat->wFormatTag == WAVE_FORMAT_IEEE_FLOAT) && (waveformat->wBitsPerSample == 32)) {
|
||||
return AUDIO_F32SYS;
|
||||
|
||||
@@ -122,8 +122,7 @@ void WIN_CoUninitialize(void)
|
||||
}
|
||||
|
||||
#ifndef __WINRT__
|
||||
void *
|
||||
WIN_LoadComBaseFunction(const char *name)
|
||||
void *WIN_LoadComBaseFunction(const char *name)
|
||||
{
|
||||
static SDL_bool s_bLoaded;
|
||||
static HMODULE s_hComBase;
|
||||
@@ -248,8 +247,7 @@ has the same problem.)
|
||||
|
||||
WASAPI doesn't need this. This is just for DirectSound/WinMM.
|
||||
*/
|
||||
char *
|
||||
WIN_LookupAudioDeviceName(const WCHAR *name, const GUID *guid)
|
||||
char *WIN_LookupAudioDeviceName(const WCHAR *name, const GUID *guid)
|
||||
{
|
||||
#if defined(__WINRT__) || defined(__XBOXONE__) || defined(__XBOXSERIES__)
|
||||
return WIN_StringToUTF8(name); /* No registry access on WinRT/UWP and Xbox, go with what we've got. */
|
||||
@@ -370,8 +368,7 @@ int SDL_Direct3D9GetAdapterIndex(int displayIndex)
|
||||
return 0; /* D3DADAPTER_DEFAULT */
|
||||
}
|
||||
|
||||
SDL_bool
|
||||
SDL_DXGIGetOutputInfo(int displayIndex, int *adapterIndex, int *outputIndex)
|
||||
SDL_bool SDL_DXGIGetOutputInfo(int displayIndex, int *adapterIndex, int *outputIndex)
|
||||
{
|
||||
(void)displayIndex;
|
||||
if (adapterIndex) {
|
||||
|
||||
+18
-36
@@ -991,92 +991,77 @@ SDL_bool SDL_HasRDTSC(void)
|
||||
return CPU_FEATURE_AVAILABLE(CPU_HAS_RDTSC);
|
||||
}
|
||||
|
||||
SDL_bool
|
||||
SDL_HasAltiVec(void)
|
||||
SDL_bool SDL_HasAltiVec(void)
|
||||
{
|
||||
return CPU_FEATURE_AVAILABLE(CPU_HAS_ALTIVEC);
|
||||
}
|
||||
|
||||
SDL_bool
|
||||
SDL_HasMMX(void)
|
||||
SDL_bool SDL_HasMMX(void)
|
||||
{
|
||||
return CPU_FEATURE_AVAILABLE(CPU_HAS_MMX);
|
||||
}
|
||||
|
||||
SDL_bool
|
||||
SDL_Has3DNow(void)
|
||||
SDL_bool SDL_Has3DNow(void)
|
||||
{
|
||||
return CPU_FEATURE_AVAILABLE(CPU_HAS_3DNOW);
|
||||
}
|
||||
|
||||
SDL_bool
|
||||
SDL_HasSSE(void)
|
||||
SDL_bool SDL_HasSSE(void)
|
||||
{
|
||||
return CPU_FEATURE_AVAILABLE(CPU_HAS_SSE);
|
||||
}
|
||||
|
||||
SDL_bool
|
||||
SDL_HasSSE2(void)
|
||||
SDL_bool SDL_HasSSE2(void)
|
||||
{
|
||||
return CPU_FEATURE_AVAILABLE(CPU_HAS_SSE2);
|
||||
}
|
||||
|
||||
SDL_bool
|
||||
SDL_HasSSE3(void)
|
||||
SDL_bool SDL_HasSSE3(void)
|
||||
{
|
||||
return CPU_FEATURE_AVAILABLE(CPU_HAS_SSE3);
|
||||
}
|
||||
|
||||
SDL_bool
|
||||
SDL_HasSSE41(void)
|
||||
SDL_bool SDL_HasSSE41(void)
|
||||
{
|
||||
return CPU_FEATURE_AVAILABLE(CPU_HAS_SSE41);
|
||||
}
|
||||
|
||||
SDL_bool
|
||||
SDL_HasSSE42(void)
|
||||
SDL_bool SDL_HasSSE42(void)
|
||||
{
|
||||
return CPU_FEATURE_AVAILABLE(CPU_HAS_SSE42);
|
||||
}
|
||||
|
||||
SDL_bool
|
||||
SDL_HasAVX(void)
|
||||
SDL_bool SDL_HasAVX(void)
|
||||
{
|
||||
return CPU_FEATURE_AVAILABLE(CPU_HAS_AVX);
|
||||
}
|
||||
|
||||
SDL_bool
|
||||
SDL_HasAVX2(void)
|
||||
SDL_bool SDL_HasAVX2(void)
|
||||
{
|
||||
return CPU_FEATURE_AVAILABLE(CPU_HAS_AVX2);
|
||||
}
|
||||
|
||||
SDL_bool
|
||||
SDL_HasAVX512F(void)
|
||||
SDL_bool SDL_HasAVX512F(void)
|
||||
{
|
||||
return CPU_FEATURE_AVAILABLE(CPU_HAS_AVX512F);
|
||||
}
|
||||
|
||||
SDL_bool
|
||||
SDL_HasARMSIMD(void)
|
||||
SDL_bool SDL_HasARMSIMD(void)
|
||||
{
|
||||
return CPU_FEATURE_AVAILABLE(CPU_HAS_ARM_SIMD);
|
||||
}
|
||||
|
||||
SDL_bool
|
||||
SDL_HasNEON(void)
|
||||
SDL_bool SDL_HasNEON(void)
|
||||
{
|
||||
return CPU_FEATURE_AVAILABLE(CPU_HAS_NEON);
|
||||
}
|
||||
|
||||
SDL_bool
|
||||
SDL_HasLSX(void)
|
||||
SDL_bool SDL_HasLSX(void)
|
||||
{
|
||||
return CPU_FEATURE_AVAILABLE(CPU_HAS_LSX);
|
||||
}
|
||||
|
||||
SDL_bool
|
||||
SDL_HasLASX(void)
|
||||
SDL_bool SDL_HasLASX(void)
|
||||
{
|
||||
return CPU_FEATURE_AVAILABLE(CPU_HAS_LASX);
|
||||
}
|
||||
@@ -1155,8 +1140,7 @@ int SDL_GetSystemRAM(void)
|
||||
return SDL_SystemRAM;
|
||||
}
|
||||
|
||||
size_t
|
||||
SDL_SIMDGetAlignment(void)
|
||||
size_t SDL_SIMDGetAlignment(void)
|
||||
{
|
||||
if (SDL_SIMDAlignment == 0xFFFFFFFF) {
|
||||
SDL_GetCPUFeatures(); /* make sure this has been calculated */
|
||||
@@ -1165,8 +1149,7 @@ SDL_SIMDGetAlignment(void)
|
||||
return SDL_SIMDAlignment;
|
||||
}
|
||||
|
||||
void *
|
||||
SDL_SIMDAlloc(const size_t len)
|
||||
void *SDL_SIMDAlloc(const size_t len)
|
||||
{
|
||||
const size_t alignment = SDL_SIMDGetAlignment();
|
||||
const size_t padding = (alignment - (len % alignment)) % alignment;
|
||||
@@ -1190,8 +1173,7 @@ SDL_SIMDAlloc(const size_t len)
|
||||
return retval;
|
||||
}
|
||||
|
||||
void *
|
||||
SDL_SIMDRealloc(void *mem, const size_t len)
|
||||
void *SDL_SIMDRealloc(void *mem, const size_t len)
|
||||
{
|
||||
const size_t alignment = SDL_SIMDGetAlignment();
|
||||
const size_t padding = (alignment - (len % alignment)) % alignment;
|
||||
|
||||
@@ -350,8 +350,7 @@ static Sint32 initialize_jumptable(Uint32 apiver, void *table, Uint32 tablesize)
|
||||
typedef Sint32(SDLCALL *SDL_DYNAPI_ENTRYFN)(Uint32 apiver, void *table, Uint32 tablesize);
|
||||
extern DECLSPEC Sint32 SDLCALL SDL_DYNAPI_entry(Uint32, void *, Uint32);
|
||||
|
||||
Sint32
|
||||
SDL_DYNAPI_entry(Uint32 apiver, void *table, Uint32 tablesize)
|
||||
Sint32 SDL_DYNAPI_entry(Uint32 apiver, void *table, Uint32 tablesize)
|
||||
{
|
||||
return initialize_jumptable(apiver, table, tablesize);
|
||||
}
|
||||
|
||||
+11
-22
@@ -640,8 +640,7 @@ static const char *SDL_scancode_names[SDL_NUM_SCANCODES] = {
|
||||
};
|
||||
|
||||
/* Taken from SDL_iconv() */
|
||||
char *
|
||||
SDL_UCS4ToUTF8(Uint32 ch, char *dst)
|
||||
char *SDL_UCS4ToUTF8(Uint32 ch, char *dst)
|
||||
{
|
||||
Uint8 *p = (Uint8 *)dst;
|
||||
if (ch <= 0x7F) {
|
||||
@@ -756,8 +755,7 @@ void SDL_SetScancodeName(SDL_Scancode scancode, const char *name)
|
||||
SDL_scancode_names[scancode] = name;
|
||||
}
|
||||
|
||||
SDL_Window *
|
||||
SDL_GetKeyboardFocus(void)
|
||||
SDL_Window *SDL_GetKeyboardFocus(void)
|
||||
{
|
||||
SDL_Keyboard *keyboard = &SDL_keyboard;
|
||||
|
||||
@@ -1011,8 +1009,7 @@ void SDL_ReleaseAutoReleaseKeys(void)
|
||||
}
|
||||
}
|
||||
|
||||
SDL_bool
|
||||
SDL_HardwareKeyboardKeyPressed(void)
|
||||
SDL_bool SDL_HardwareKeyboardKeyPressed(void)
|
||||
{
|
||||
SDL_Keyboard *keyboard = &SDL_keyboard;
|
||||
SDL_Scancode scancode;
|
||||
@@ -1089,8 +1086,7 @@ void SDL_KeyboardQuit(void)
|
||||
{
|
||||
}
|
||||
|
||||
const Uint8 *
|
||||
SDL_GetKeyboardState(int *numkeys)
|
||||
const Uint8 *SDL_GetKeyboardState(int *numkeys)
|
||||
{
|
||||
SDL_Keyboard *keyboard = &SDL_keyboard;
|
||||
|
||||
@@ -1100,8 +1096,7 @@ SDL_GetKeyboardState(int *numkeys)
|
||||
return keyboard->keystate;
|
||||
}
|
||||
|
||||
SDL_Keymod
|
||||
SDL_GetModState(void)
|
||||
SDL_Keymod SDL_GetModState(void)
|
||||
{
|
||||
SDL_Keyboard *keyboard = &SDL_keyboard;
|
||||
|
||||
@@ -1126,8 +1121,7 @@ void SDL_ToggleModState(const SDL_Keymod modstate, const SDL_bool toggle)
|
||||
}
|
||||
}
|
||||
|
||||
SDL_Keycode
|
||||
SDL_GetKeyFromScancode(SDL_Scancode scancode)
|
||||
SDL_Keycode SDL_GetKeyFromScancode(SDL_Scancode scancode)
|
||||
{
|
||||
SDL_Keyboard *keyboard = &SDL_keyboard;
|
||||
|
||||
@@ -1139,8 +1133,7 @@ SDL_GetKeyFromScancode(SDL_Scancode scancode)
|
||||
return keyboard->keymap[scancode];
|
||||
}
|
||||
|
||||
SDL_Keycode
|
||||
SDL_GetDefaultKeyFromScancode(SDL_Scancode scancode)
|
||||
SDL_Keycode SDL_GetDefaultKeyFromScancode(SDL_Scancode scancode)
|
||||
{
|
||||
if (((int)scancode) < SDL_SCANCODE_UNKNOWN || scancode >= SDL_NUM_SCANCODES) {
|
||||
SDL_InvalidParamError("scancode");
|
||||
@@ -1150,8 +1143,7 @@ SDL_GetDefaultKeyFromScancode(SDL_Scancode scancode)
|
||||
return SDL_default_keymap[scancode];
|
||||
}
|
||||
|
||||
SDL_Scancode
|
||||
SDL_GetScancodeFromKey(SDL_Keycode key)
|
||||
SDL_Scancode SDL_GetScancodeFromKey(SDL_Keycode key)
|
||||
{
|
||||
SDL_Keyboard *keyboard = &SDL_keyboard;
|
||||
SDL_Scancode scancode;
|
||||
@@ -1165,8 +1157,7 @@ SDL_GetScancodeFromKey(SDL_Keycode key)
|
||||
return SDL_SCANCODE_UNKNOWN;
|
||||
}
|
||||
|
||||
const char *
|
||||
SDL_GetScancodeName(SDL_Scancode scancode)
|
||||
const char *SDL_GetScancodeName(SDL_Scancode scancode)
|
||||
{
|
||||
const char *name;
|
||||
if (((int)scancode) < SDL_SCANCODE_UNKNOWN || scancode >= SDL_NUM_SCANCODES) {
|
||||
@@ -1204,8 +1195,7 @@ SDL_Scancode SDL_GetScancodeFromName(const char *name)
|
||||
return SDL_SCANCODE_UNKNOWN;
|
||||
}
|
||||
|
||||
const char *
|
||||
SDL_GetKeyName(SDL_Keycode key)
|
||||
const char *SDL_GetKeyName(SDL_Keycode key)
|
||||
{
|
||||
static char name[8];
|
||||
char *end;
|
||||
@@ -1242,8 +1232,7 @@ SDL_GetKeyName(SDL_Keycode key)
|
||||
}
|
||||
}
|
||||
|
||||
SDL_Keycode
|
||||
SDL_GetKeyFromName(const char *name)
|
||||
SDL_Keycode SDL_GetKeyFromName(const char *name)
|
||||
{
|
||||
SDL_Keycode key;
|
||||
|
||||
|
||||
@@ -387,8 +387,7 @@ static const struct {
|
||||
};
|
||||
/* *INDENT-ON* */ /* clang-format on */
|
||||
|
||||
SDL_Scancode
|
||||
SDL_GetScancodeFromKeySym(Uint32 keysym, Uint32 keycode)
|
||||
SDL_Scancode SDL_GetScancodeFromKeySym(Uint32 keysym, Uint32 keycode)
|
||||
{
|
||||
int i;
|
||||
Uint32 linux_keycode = 0;
|
||||
|
||||
+12
-24
@@ -226,8 +226,7 @@ void SDL_SetDefaultCursor(SDL_Cursor *cursor)
|
||||
}
|
||||
}
|
||||
|
||||
SDL_Mouse *
|
||||
SDL_GetMouse(void)
|
||||
SDL_Mouse *SDL_GetMouse(void)
|
||||
{
|
||||
return &SDL_mouse;
|
||||
}
|
||||
@@ -245,8 +244,7 @@ static Uint32 GetButtonState(SDL_Mouse *mouse, SDL_bool include_touch)
|
||||
return buttonstate;
|
||||
}
|
||||
|
||||
SDL_Window *
|
||||
SDL_GetMouseFocus(void)
|
||||
SDL_Window *SDL_GetMouseFocus(void)
|
||||
{
|
||||
SDL_Mouse *mouse = SDL_GetMouse();
|
||||
|
||||
@@ -261,8 +259,7 @@ SDL_GetMouseFocus(void)
|
||||
* -flibit
|
||||
*/
|
||||
#if 0
|
||||
void
|
||||
SDL_ResetMouse(void)
|
||||
void SDL_ResetMouse(void)
|
||||
{
|
||||
SDL_Mouse *mouse = SDL_GetMouse();
|
||||
Uint32 buttonState = GetButtonState(mouse, SDL_FALSE);
|
||||
@@ -946,8 +943,7 @@ void SDL_MouseQuit(void)
|
||||
SDL_MouseRelativeWarpMotionChanged, mouse);
|
||||
}
|
||||
|
||||
Uint32
|
||||
SDL_GetMouseState(int *x, int *y)
|
||||
Uint32 SDL_GetMouseState(int *x, int *y)
|
||||
{
|
||||
SDL_Mouse *mouse = SDL_GetMouse();
|
||||
|
||||
@@ -960,8 +956,7 @@ SDL_GetMouseState(int *x, int *y)
|
||||
return GetButtonState(mouse, SDL_TRUE);
|
||||
}
|
||||
|
||||
Uint32
|
||||
SDL_GetRelativeMouseState(int *x, int *y)
|
||||
Uint32 SDL_GetRelativeMouseState(int *x, int *y)
|
||||
{
|
||||
SDL_Mouse *mouse = SDL_GetMouse();
|
||||
|
||||
@@ -976,8 +971,7 @@ SDL_GetRelativeMouseState(int *x, int *y)
|
||||
return GetButtonState(mouse, SDL_TRUE);
|
||||
}
|
||||
|
||||
Uint32
|
||||
SDL_GetGlobalMouseState(int *x, int *y)
|
||||
Uint32 SDL_GetGlobalMouseState(int *x, int *y)
|
||||
{
|
||||
SDL_Mouse *mouse = SDL_GetMouse();
|
||||
|
||||
@@ -1133,8 +1127,7 @@ int SDL_SetRelativeMouseMode(SDL_bool enabled)
|
||||
return 0;
|
||||
}
|
||||
|
||||
SDL_bool
|
||||
SDL_GetRelativeMouseMode()
|
||||
SDL_bool SDL_GetRelativeMouseMode()
|
||||
{
|
||||
SDL_Mouse *mouse = SDL_GetMouse();
|
||||
|
||||
@@ -1219,8 +1212,7 @@ int SDL_CaptureMouse(SDL_bool enabled)
|
||||
return SDL_UpdateMouseCapture(SDL_FALSE);
|
||||
}
|
||||
|
||||
SDL_Cursor *
|
||||
SDL_CreateCursor(const Uint8 *data, const Uint8 *mask,
|
||||
SDL_Cursor *SDL_CreateCursor(const Uint8 *data, const Uint8 *mask,
|
||||
int w, int h, int hot_x, int hot_y)
|
||||
{
|
||||
SDL_Surface *surface;
|
||||
@@ -1268,8 +1260,7 @@ SDL_CreateCursor(const Uint8 *data, const Uint8 *mask,
|
||||
return cursor;
|
||||
}
|
||||
|
||||
SDL_Cursor *
|
||||
SDL_CreateColorCursor(SDL_Surface *surface, int hot_x, int hot_y)
|
||||
SDL_Cursor *SDL_CreateColorCursor(SDL_Surface *surface, int hot_x, int hot_y)
|
||||
{
|
||||
SDL_Mouse *mouse = SDL_GetMouse();
|
||||
SDL_Surface *temp = NULL;
|
||||
@@ -1311,8 +1302,7 @@ SDL_CreateColorCursor(SDL_Surface *surface, int hot_x, int hot_y)
|
||||
return cursor;
|
||||
}
|
||||
|
||||
SDL_Cursor *
|
||||
SDL_CreateSystemCursor(SDL_SystemCursor id)
|
||||
SDL_Cursor *SDL_CreateSystemCursor(SDL_SystemCursor id)
|
||||
{
|
||||
SDL_Mouse *mouse = SDL_GetMouse();
|
||||
SDL_Cursor *cursor;
|
||||
@@ -1379,8 +1369,7 @@ void SDL_SetCursor(SDL_Cursor *cursor)
|
||||
}
|
||||
}
|
||||
|
||||
SDL_Cursor *
|
||||
SDL_GetCursor(void)
|
||||
SDL_Cursor *SDL_GetCursor(void)
|
||||
{
|
||||
SDL_Mouse *mouse = SDL_GetMouse();
|
||||
|
||||
@@ -1390,8 +1379,7 @@ SDL_GetCursor(void)
|
||||
return mouse->cur_cursor;
|
||||
}
|
||||
|
||||
SDL_Cursor *
|
||||
SDL_GetDefaultCursor(void)
|
||||
SDL_Cursor *SDL_GetDefaultCursor(void)
|
||||
{
|
||||
SDL_Mouse *mouse = SDL_GetMouse();
|
||||
|
||||
|
||||
+5
-10
@@ -50,8 +50,7 @@ int SDL_GetNumTouchDevices(void)
|
||||
return SDL_num_touch;
|
||||
}
|
||||
|
||||
SDL_TouchID
|
||||
SDL_GetTouchDevice(int index)
|
||||
SDL_TouchID SDL_GetTouchDevice(int index)
|
||||
{
|
||||
if (index < 0 || index >= SDL_num_touch) {
|
||||
SDL_SetError("Unknown touch device index %d", index);
|
||||
@@ -60,8 +59,7 @@ SDL_GetTouchDevice(int index)
|
||||
return SDL_touchDevices[index]->id;
|
||||
}
|
||||
|
||||
const char *
|
||||
SDL_GetTouchName(int index)
|
||||
const char *SDL_GetTouchName(int index)
|
||||
{
|
||||
if (index < 0 || index >= SDL_num_touch) {
|
||||
SDL_SetError("Unknown touch device");
|
||||
@@ -84,8 +82,7 @@ static int SDL_GetTouchIndex(SDL_TouchID id)
|
||||
return -1;
|
||||
}
|
||||
|
||||
SDL_Touch *
|
||||
SDL_GetTouch(SDL_TouchID id)
|
||||
SDL_Touch *SDL_GetTouch(SDL_TouchID id)
|
||||
{
|
||||
int index = SDL_GetTouchIndex(id);
|
||||
if (index < 0 || index >= SDL_num_touch) {
|
||||
@@ -100,8 +97,7 @@ SDL_GetTouch(SDL_TouchID id)
|
||||
return SDL_touchDevices[index];
|
||||
}
|
||||
|
||||
SDL_TouchDeviceType
|
||||
SDL_GetTouchDeviceType(SDL_TouchID id)
|
||||
SDL_TouchDeviceType SDL_GetTouchDeviceType(SDL_TouchID id)
|
||||
{
|
||||
SDL_Touch *touch = SDL_GetTouch(id);
|
||||
if (touch) {
|
||||
@@ -139,8 +135,7 @@ int SDL_GetNumTouchFingers(SDL_TouchID touchID)
|
||||
return 0;
|
||||
}
|
||||
|
||||
SDL_Finger *
|
||||
SDL_GetTouchFinger(SDL_TouchID touchID, int index)
|
||||
SDL_Finger *SDL_GetTouchFinger(SDL_TouchID touchID, int index)
|
||||
{
|
||||
SDL_Touch *touch = SDL_GetTouch(touchID);
|
||||
if (touch == NULL) {
|
||||
|
||||
+17
-34
@@ -522,8 +522,7 @@ static int SDLCALL mem_close(SDL_RWops *context)
|
||||
|
||||
/* Functions to create SDL_RWops structures from various data sources */
|
||||
|
||||
SDL_RWops *
|
||||
SDL_RWFromFile(const char *file, const char *mode)
|
||||
SDL_RWops *SDL_RWFromFile(const char *file, const char *mode)
|
||||
{
|
||||
SDL_RWops *rwops = NULL;
|
||||
if (file == NULL || !*file || mode == NULL || !*mode) {
|
||||
@@ -616,8 +615,7 @@ SDL_RWFromFile(const char *file, const char *mode)
|
||||
}
|
||||
|
||||
#ifdef HAVE_STDIO_H
|
||||
SDL_RWops *
|
||||
SDL_RWFromFP(FILE * fp, SDL_bool autoclose)
|
||||
SDL_RWops *SDL_RWFromFP(FILE * fp, SDL_bool autoclose)
|
||||
{
|
||||
SDL_RWops *rwops = NULL;
|
||||
|
||||
@@ -635,16 +633,14 @@ SDL_RWFromFP(FILE * fp, SDL_bool autoclose)
|
||||
return rwops;
|
||||
}
|
||||
#else
|
||||
SDL_RWops *
|
||||
SDL_RWFromFP(void * fp, SDL_bool autoclose)
|
||||
SDL_RWops *SDL_RWFromFP(void * fp, SDL_bool autoclose)
|
||||
{
|
||||
SDL_SetError("SDL not compiled with stdio support");
|
||||
return NULL;
|
||||
}
|
||||
#endif /* HAVE_STDIO_H */
|
||||
|
||||
SDL_RWops *
|
||||
SDL_RWFromMem(void *mem, int size)
|
||||
SDL_RWops *SDL_RWFromMem(void *mem, int size)
|
||||
{
|
||||
SDL_RWops *rwops = NULL;
|
||||
if (mem == NULL) {
|
||||
@@ -671,8 +667,7 @@ SDL_RWFromMem(void *mem, int size)
|
||||
return rwops;
|
||||
}
|
||||
|
||||
SDL_RWops *
|
||||
SDL_RWFromConstMem(const void *mem, int size)
|
||||
SDL_RWops *SDL_RWFromConstMem(const void *mem, int size)
|
||||
{
|
||||
SDL_RWops *rwops = NULL;
|
||||
if (mem == NULL) {
|
||||
@@ -699,8 +694,7 @@ SDL_RWFromConstMem(const void *mem, int size)
|
||||
return rwops;
|
||||
}
|
||||
|
||||
SDL_RWops *
|
||||
SDL_AllocRW(void)
|
||||
SDL_RWops *SDL_AllocRW(void)
|
||||
{
|
||||
SDL_RWops *area;
|
||||
|
||||
@@ -719,8 +713,7 @@ void SDL_FreeRW(SDL_RWops *area)
|
||||
}
|
||||
|
||||
/* Load all the data from an SDL data stream */
|
||||
void *
|
||||
SDL_LoadFile_RW(SDL_RWops *src, size_t *datasize, int freesrc)
|
||||
void *SDL_LoadFile_RW(SDL_RWops *src, size_t *datasize, int freesrc)
|
||||
{
|
||||
static const Sint64 FILE_CHUNK_SIZE = 1024;
|
||||
Sint64 size;
|
||||
@@ -771,26 +764,22 @@ done:
|
||||
return data;
|
||||
}
|
||||
|
||||
void *
|
||||
SDL_LoadFile(const char *file, size_t *datasize)
|
||||
void *SDL_LoadFile(const char *file, size_t *datasize)
|
||||
{
|
||||
return SDL_LoadFile_RW(SDL_RWFromFile(file, "rb"), datasize, 1);
|
||||
}
|
||||
|
||||
Sint64
|
||||
SDL_RWsize(SDL_RWops *context)
|
||||
Sint64 SDL_RWsize(SDL_RWops *context)
|
||||
{
|
||||
return context->size(context);
|
||||
}
|
||||
|
||||
Sint64
|
||||
SDL_RWseek(SDL_RWops *context, Sint64 offset, int whence)
|
||||
Sint64 SDL_RWseek(SDL_RWops *context, Sint64 offset, int whence)
|
||||
{
|
||||
return context->seek(context, offset, whence);
|
||||
}
|
||||
|
||||
Sint64
|
||||
SDL_RWtell(SDL_RWops *context)
|
||||
Sint64 SDL_RWtell(SDL_RWops *context)
|
||||
{
|
||||
return context->seek(context, 0, RW_SEEK_CUR);
|
||||
}
|
||||
@@ -822,8 +811,7 @@ Uint8 SDL_ReadU8(SDL_RWops *src)
|
||||
return value;
|
||||
}
|
||||
|
||||
Uint16
|
||||
SDL_ReadLE16(SDL_RWops *src)
|
||||
Uint16 SDL_ReadLE16(SDL_RWops *src)
|
||||
{
|
||||
Uint16 value = 0;
|
||||
|
||||
@@ -831,8 +819,7 @@ SDL_ReadLE16(SDL_RWops *src)
|
||||
return SDL_SwapLE16(value);
|
||||
}
|
||||
|
||||
Uint16
|
||||
SDL_ReadBE16(SDL_RWops *src)
|
||||
Uint16 SDL_ReadBE16(SDL_RWops *src)
|
||||
{
|
||||
Uint16 value = 0;
|
||||
|
||||
@@ -840,8 +827,7 @@ SDL_ReadBE16(SDL_RWops *src)
|
||||
return SDL_SwapBE16(value);
|
||||
}
|
||||
|
||||
Uint32
|
||||
SDL_ReadLE32(SDL_RWops *src)
|
||||
Uint32 SDL_ReadLE32(SDL_RWops *src)
|
||||
{
|
||||
Uint32 value = 0;
|
||||
|
||||
@@ -849,8 +835,7 @@ SDL_ReadLE32(SDL_RWops *src)
|
||||
return SDL_SwapLE32(value);
|
||||
}
|
||||
|
||||
Uint32
|
||||
SDL_ReadBE32(SDL_RWops *src)
|
||||
Uint32 SDL_ReadBE32(SDL_RWops *src)
|
||||
{
|
||||
Uint32 value = 0;
|
||||
|
||||
@@ -858,8 +843,7 @@ SDL_ReadBE32(SDL_RWops *src)
|
||||
return SDL_SwapBE32(value);
|
||||
}
|
||||
|
||||
Uint64
|
||||
SDL_ReadLE64(SDL_RWops *src)
|
||||
Uint64 SDL_ReadLE64(SDL_RWops *src)
|
||||
{
|
||||
Uint64 value = 0;
|
||||
|
||||
@@ -867,8 +851,7 @@ SDL_ReadLE64(SDL_RWops *src)
|
||||
return SDL_SwapLE64(value);
|
||||
}
|
||||
|
||||
Uint64
|
||||
SDL_ReadBE64(SDL_RWops *src)
|
||||
Uint64 SDL_ReadBE64(SDL_RWops *src)
|
||||
{
|
||||
Uint64 value = 0;
|
||||
|
||||
|
||||
@@ -23,21 +23,20 @@
|
||||
#include "SDL_error.h"
|
||||
|
||||
/* Checks if the mode is a kind of reading */
|
||||
SDL_FORCE_INLINE SDL_bool IsReadMode(const char *mode);
|
||||
static SDL_bool IsReadMode(const char *mode);
|
||||
|
||||
/* Checks if the file starts with the given prefix */
|
||||
SDL_FORCE_INLINE SDL_bool HasPrefix(const char *file, const char *prefix);
|
||||
static SDL_bool HasPrefix(const char *file, const char *prefix);
|
||||
|
||||
SDL_FORCE_INLINE FILE *TryOpenFile(const char *file, const char *mode);
|
||||
SDL_FORCE_INLINE FILE *TryOpenInRomfs(const char *file, const char *mode);
|
||||
static FILE *TryOpenFile(const char *file, const char *mode);
|
||||
static FILE *TryOpenInRomfs(const char *file, const char *mode);
|
||||
|
||||
/* Nintendo 3DS applications may embed resources in the executable. The
|
||||
resources are stored in a special read-only partition prefixed with
|
||||
'romfs:/'. As such, when opening a file, we should first try the romfs
|
||||
unless sdmc is specifically mentionned.
|
||||
*/
|
||||
FILE *
|
||||
N3DS_FileOpen(const char *file, const char *mode)
|
||||
FILE *N3DS_FileOpen(const char *file, const char *mode)
|
||||
{
|
||||
/* romfs are read-only */
|
||||
if (!IsReadMode(mode)) {
|
||||
@@ -52,20 +51,17 @@ N3DS_FileOpen(const char *file, const char *mode)
|
||||
return TryOpenFile(file, mode);
|
||||
}
|
||||
|
||||
SDL_FORCE_INLINE SDL_bool
|
||||
IsReadMode(const char *mode)
|
||||
static SDL_bool IsReadMode(const char *mode)
|
||||
{
|
||||
return SDL_strchr(mode, 'r') != NULL;
|
||||
}
|
||||
|
||||
SDL_FORCE_INLINE SDL_bool
|
||||
HasPrefix(const char *file, const char *prefix)
|
||||
static SDL_bool HasPrefix(const char *file, const char *prefix)
|
||||
{
|
||||
return SDL_strncmp(prefix, file, SDL_strlen(prefix)) == 0;
|
||||
}
|
||||
|
||||
SDL_FORCE_INLINE FILE *
|
||||
TryOpenFile(const char *file, const char *mode)
|
||||
static FILE *TryOpenFile(const char *file, const char *mode)
|
||||
{
|
||||
FILE *fp = NULL;
|
||||
|
||||
@@ -77,8 +73,7 @@ TryOpenFile(const char *file, const char *mode)
|
||||
return fp;
|
||||
}
|
||||
|
||||
SDL_FORCE_INLINE FILE *
|
||||
TryOpenInRomfs(const char *file, const char *mode)
|
||||
static FILE *TryOpenInRomfs(const char *file, const char *mode)
|
||||
{
|
||||
FILE *fp = NULL;
|
||||
char *prefixed_filepath = NULL;
|
||||
|
||||
@@ -32,16 +32,14 @@
|
||||
#include "SDL_system.h"
|
||||
|
||||
|
||||
char *
|
||||
SDL_GetBasePath(void)
|
||||
char *SDL_GetBasePath(void)
|
||||
{
|
||||
/* The current working directory is / on Android */
|
||||
SDL_Unsupported();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
char *
|
||||
SDL_GetPrefPath(const char *org, const char *app)
|
||||
char *SDL_GetPrefPath(const char *org, const char *app)
|
||||
{
|
||||
const char *path = SDL_AndroidGetInternalStoragePath();
|
||||
if (path) {
|
||||
|
||||
@@ -33,8 +33,7 @@
|
||||
#include "SDL_stdinc.h"
|
||||
#include "SDL_filesystem.h"
|
||||
|
||||
char *
|
||||
SDL_GetBasePath(void)
|
||||
char *SDL_GetBasePath(void)
|
||||
{
|
||||
@autoreleasepool {
|
||||
NSBundle *bundle = [NSBundle mainBundle];
|
||||
@@ -68,8 +67,7 @@ SDL_GetBasePath(void)
|
||||
}
|
||||
}
|
||||
|
||||
char *
|
||||
SDL_GetPrefPath(const char *org, const char *app)
|
||||
char *SDL_GetPrefPath(const char *org, const char *app)
|
||||
{
|
||||
@autoreleasepool {
|
||||
char *retval = NULL;
|
||||
|
||||
@@ -28,15 +28,13 @@
|
||||
#include "SDL_error.h"
|
||||
#include "SDL_filesystem.h"
|
||||
|
||||
char *
|
||||
SDL_GetBasePath(void)
|
||||
char *SDL_GetBasePath(void)
|
||||
{
|
||||
SDL_Unsupported();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
char *
|
||||
SDL_GetPrefPath(const char *org, const char *app)
|
||||
char *SDL_GetPrefPath(const char *org, const char *app)
|
||||
{
|
||||
SDL_Unsupported();
|
||||
return NULL;
|
||||
|
||||
@@ -32,15 +32,13 @@
|
||||
|
||||
#include <emscripten/emscripten.h>
|
||||
|
||||
char *
|
||||
SDL_GetBasePath(void)
|
||||
char *SDL_GetBasePath(void)
|
||||
{
|
||||
char *retval = "/";
|
||||
return SDL_strdup(retval);
|
||||
}
|
||||
|
||||
char *
|
||||
SDL_GetPrefPath(const char *org, const char *app)
|
||||
char *SDL_GetPrefPath(const char *org, const char *app)
|
||||
{
|
||||
const char *append = "/libsdl/";
|
||||
char *retval;
|
||||
|
||||
@@ -34,8 +34,7 @@
|
||||
#include "SDL_stdinc.h"
|
||||
#include "SDL_filesystem.h"
|
||||
|
||||
char *
|
||||
SDL_GetBasePath(void)
|
||||
char *SDL_GetBasePath(void)
|
||||
{
|
||||
image_info info;
|
||||
int32 cookie = 0;
|
||||
@@ -69,8 +68,7 @@ SDL_GetBasePath(void)
|
||||
}
|
||||
|
||||
|
||||
char *
|
||||
SDL_GetPrefPath(const char *org, const char *app)
|
||||
char *SDL_GetPrefPath(const char *org, const char *app)
|
||||
{
|
||||
// !!! FIXME: is there a better way to do this?
|
||||
const char *home = SDL_getenv("HOME");
|
||||
|
||||
@@ -35,15 +35,13 @@
|
||||
SDL_FORCE_INLINE char *MakePrefPath(const char *app);
|
||||
SDL_FORCE_INLINE int CreatePrefPathDir(const char *pref);
|
||||
|
||||
char *
|
||||
SDL_GetBasePath(void)
|
||||
char *SDL_GetBasePath(void)
|
||||
{
|
||||
char *base_path = SDL_strdup("romfs:/");
|
||||
return base_path;
|
||||
}
|
||||
|
||||
char *
|
||||
SDL_GetPrefPath(const char *org, const char *app)
|
||||
char *SDL_GetPrefPath(const char *org, const char *app)
|
||||
{
|
||||
char *pref_path = NULL;
|
||||
if (app == NULL) {
|
||||
|
||||
@@ -24,15 +24,13 @@
|
||||
|
||||
#ifdef SDL_FILESYSTEM_NACL
|
||||
|
||||
char *
|
||||
SDL_GetBasePath(void)
|
||||
char *SDL_GetBasePath(void)
|
||||
{
|
||||
SDL_Unsupported();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
char *
|
||||
SDL_GetPrefPath(const char *org, const char *app)
|
||||
char *SDL_GetPrefPath(const char *org, const char *app)
|
||||
{
|
||||
SDL_Unsupported();
|
||||
return NULL;
|
||||
|
||||
@@ -36,8 +36,7 @@
|
||||
#include <os2.h>
|
||||
|
||||
|
||||
char *
|
||||
SDL_GetBasePath(void)
|
||||
char *SDL_GetBasePath(void)
|
||||
{
|
||||
PTIB tib;
|
||||
PPIB pib;
|
||||
@@ -71,8 +70,7 @@ SDL_GetBasePath(void)
|
||||
return OS2_SysToUTF8(acBuf);
|
||||
}
|
||||
|
||||
char *
|
||||
SDL_GetPrefPath(const char *org, const char *app)
|
||||
char *SDL_GetPrefPath(const char *org, const char *app)
|
||||
{
|
||||
PSZ pszPath;
|
||||
CHAR acBuf[CCHMAXPATH];
|
||||
|
||||
@@ -31,8 +31,7 @@
|
||||
#include "SDL_error.h"
|
||||
#include "SDL_filesystem.h"
|
||||
|
||||
char *
|
||||
SDL_GetBasePath(void)
|
||||
char *SDL_GetBasePath(void)
|
||||
{
|
||||
char *retval;
|
||||
size_t len;
|
||||
@@ -78,8 +77,7 @@ static void recursive_mkdir(const char *dir)
|
||||
mkdir(tmp, S_IRWXU);
|
||||
}
|
||||
|
||||
char *
|
||||
SDL_GetPrefPath(const char *org, const char *app)
|
||||
char *SDL_GetPrefPath(const char *org, const char *app)
|
||||
{
|
||||
char *retval = NULL;
|
||||
size_t len;
|
||||
|
||||
@@ -31,8 +31,7 @@
|
||||
#include "SDL_error.h"
|
||||
#include "SDL_filesystem.h"
|
||||
|
||||
char *
|
||||
SDL_GetBasePath(void)
|
||||
char *SDL_GetBasePath(void)
|
||||
{
|
||||
char *retval = NULL;
|
||||
size_t len;
|
||||
@@ -46,8 +45,7 @@ SDL_GetBasePath(void)
|
||||
return retval;
|
||||
}
|
||||
|
||||
char *
|
||||
SDL_GetPrefPath(const char *org, const char *app)
|
||||
char *SDL_GetPrefPath(const char *org, const char *app)
|
||||
{
|
||||
char *retval = NULL;
|
||||
size_t len;
|
||||
|
||||
@@ -129,8 +129,7 @@ static _kernel_oserror *createDirectoryRecursive(char *path)
|
||||
return _kernel_swi(OS_File, ®s, ®s);
|
||||
}
|
||||
|
||||
char *
|
||||
SDL_GetBasePath(void)
|
||||
char *SDL_GetBasePath(void)
|
||||
{
|
||||
_kernel_swi_regs regs;
|
||||
_kernel_oserror *error;
|
||||
@@ -157,8 +156,7 @@ SDL_GetBasePath(void)
|
||||
return retval;
|
||||
}
|
||||
|
||||
char *
|
||||
SDL_GetPrefPath(const char *org, const char *app)
|
||||
char *SDL_GetPrefPath(const char *org, const char *app)
|
||||
{
|
||||
char *canon, *dir, *retval;
|
||||
size_t len;
|
||||
|
||||
@@ -45,8 +45,7 @@
|
||||
|
||||
/* QNX's /proc/self/exefile is a text file and not a symlink. */
|
||||
#if !defined(__QNXNTO__)
|
||||
static char *
|
||||
readSymLink(const char *path)
|
||||
static char *readSymLink(const char *path)
|
||||
{
|
||||
char *retval = NULL;
|
||||
ssize_t len = 64;
|
||||
@@ -129,8 +128,7 @@ static char *search_path_for_binary(const char *bin)
|
||||
}
|
||||
#endif
|
||||
|
||||
char *
|
||||
SDL_GetBasePath(void)
|
||||
char *SDL_GetBasePath(void)
|
||||
{
|
||||
char *retval = NULL;
|
||||
|
||||
@@ -271,8 +269,7 @@ SDL_GetBasePath(void)
|
||||
return retval;
|
||||
}
|
||||
|
||||
char *
|
||||
SDL_GetPrefPath(const char *org, const char *app)
|
||||
char *SDL_GetPrefPath(const char *org, const char *app)
|
||||
{
|
||||
/*
|
||||
* We use XDG's base directory spec, even if you're not on Linux.
|
||||
|
||||
@@ -39,16 +39,14 @@
|
||||
#include "SDL_filesystem.h"
|
||||
#include "SDL_rwops.h"
|
||||
|
||||
char *
|
||||
SDL_GetBasePath(void)
|
||||
char *SDL_GetBasePath(void)
|
||||
{
|
||||
const char *basepath = "app0:/";
|
||||
char *retval = SDL_strdup(basepath);
|
||||
return retval;
|
||||
}
|
||||
|
||||
char *
|
||||
SDL_GetPrefPath(const char *org, const char *app)
|
||||
char *SDL_GetPrefPath(const char *org, const char *app)
|
||||
{
|
||||
const char *envr = "ux0:/data/";
|
||||
char *retval = NULL;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user