mirror of https://github.com/libsdl-org/SDL.git
Compare commits
39 Commits
3f97a7dedb
...
4f4c007621
| Author | SHA1 | Date |
|---|---|---|
|
|
4f4c007621 | |
|
|
9ed83e71f6 | |
|
|
603118c340 | |
|
|
aa4f916b71 | |
|
|
6cfe211142 | |
|
|
274aa0242e | |
|
|
af8bee2dd1 | |
|
|
bbc674b9e7 | |
|
|
796961acec | |
|
|
3a6f9e01f8 | |
|
|
038a3806eb | |
|
|
e6c2649afc | |
|
|
e80d084766 | |
|
|
6aedc488d3 | |
|
|
81e3066303 | |
|
|
7d9fd48557 | |
|
|
e68f5ca99a | |
|
|
051ce0ff89 | |
|
|
5fcc83d93b | |
|
|
1bd5110ff0 | |
|
|
eb04219efe | |
|
|
d06b6e42d2 | |
|
|
c19ad189dc | |
|
|
7882e60f0e | |
|
|
e4e29b8601 | |
|
|
d7939abf42 | |
|
|
390fe65323 | |
|
|
ca9b7c8ea3 | |
|
|
c04624972e | |
|
|
b4ac5f43f5 | |
|
|
3896b1b3f4 | |
|
|
efed3c63b3 | |
|
|
d6bae53341 | |
|
|
f62c982bcf | |
|
|
b833c618a9 | |
|
|
0e262dfd44 | |
|
|
6c406dd122 | |
|
|
42c9fe119d | |
|
|
656b5cd042 |
|
|
@ -9,6 +9,7 @@ versionfname = include/SDL3/SDL_version.h
|
|||
versionmajorregex = \A\#define\s+SDL_MAJOR_VERSION\s+(\d+)\Z
|
||||
versionminorregex = \A\#define\s+SDL_MINOR_VERSION\s+(\d+)\Z
|
||||
versionmicroregex = \A\#define\s+SDL_MICRO_VERSION\s+(\d+)\Z
|
||||
apipropertyregex = \A\s*\#\s*define\s+SDL_PROP_
|
||||
selectheaderregex = \ASDL.*?\.h\Z
|
||||
projecturl = https://libsdl.org/
|
||||
wikiurl = https://wiki.libsdl.org
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ my $wikisubdir = '';
|
|||
my $incsubdir = 'include';
|
||||
my $readmesubdir = undef;
|
||||
my $apiprefixregex = undef;
|
||||
my $apipropertyregex = undef;
|
||||
my $versionfname = 'include/SDL_version.h';
|
||||
my $versionmajorregex = '\A\#define\s+SDL_MAJOR_VERSION\s+(\d+)\Z';
|
||||
my $versionminorregex = '\A\#define\s+SDL_MINOR_VERSION\s+(\d+)\Z';
|
||||
|
|
@ -110,6 +111,7 @@ if (defined $optionsfname) {
|
|||
$srcpath = $val, next if $key eq 'srcpath';
|
||||
$wikipath = $val, next if $key eq 'wikipath';
|
||||
$apiprefixregex = $val, next if $key eq 'apiprefixregex';
|
||||
$apipropertyregex = $val, next if $key eq 'apipropertyregex';
|
||||
$projectfullname = $val, next if $key eq 'projectfullname';
|
||||
$projectshortname = $val, next if $key eq 'projectshortname';
|
||||
$wikisubdir = $val, next if $key eq 'wikisubdir';
|
||||
|
|
@ -1366,7 +1368,7 @@ while (my $d = readdir(DH)) {
|
|||
# update strings now that we know everything pending is to be applied to this declaration. Add pending blank lines and the new text.
|
||||
|
||||
# At Sam's request, don't list property defines with functions. (See #9440)
|
||||
my $is_property = /\A\s*\#\s*define\s+SDL_PROP_/;
|
||||
my $is_property = (defined $apipropertyregex) ? /$apipropertyregex/ : 0;
|
||||
if (!$is_property) {
|
||||
if ($blank_lines > 0) {
|
||||
while ($blank_lines > 0) {
|
||||
|
|
|
|||
|
|
@ -1021,7 +1021,8 @@ extern SDL_DECLSPEC void SDLCALL SDL_UnbindAudioStream(SDL_AudioStream *stream);
|
|||
/**
|
||||
* Query an audio stream for its currently-bound device.
|
||||
*
|
||||
* This reports the audio device that an audio stream is currently bound to.
|
||||
* This reports the logical audio device that an audio stream is currently
|
||||
* bound to.
|
||||
*
|
||||
* If not bound, or invalid, this returns zero, which is not a valid device
|
||||
* ID.
|
||||
|
|
@ -1063,6 +1064,17 @@ extern SDL_DECLSPEC SDL_AudioStream * SDLCALL SDL_CreateAudioStream(const SDL_Au
|
|||
/**
|
||||
* Get the properties associated with an audio stream.
|
||||
*
|
||||
* The application can hang any data it wants here, but the following
|
||||
* properties are understood by SDL:
|
||||
*
|
||||
* - `SDL_PROP_AUDIOSTREAM_AUTO_CLEANUP_BOOLEAN`: if true (the default), the
|
||||
* stream be automatically cleaned up when the audio subsystem quits. If set
|
||||
* to false, the streams will persist beyond that. This property is ignored
|
||||
* for streams created through SDL_OpenAudioDeviceStream(), and will always
|
||||
* be cleaned up. Streams that are not cleaned up will still be unbound from
|
||||
* devices when the audio subsystem quits. This property was added in SDL
|
||||
* 3.4.0.
|
||||
*
|
||||
* \param stream the SDL_AudioStream to query.
|
||||
* \returns a valid property ID on success or 0 on failure; call
|
||||
* SDL_GetError() for more information.
|
||||
|
|
@ -1073,6 +1085,9 @@ extern SDL_DECLSPEC SDL_AudioStream * SDLCALL SDL_CreateAudioStream(const SDL_Au
|
|||
*/
|
||||
extern SDL_DECLSPEC SDL_PropertiesID SDLCALL SDL_GetAudioStreamProperties(SDL_AudioStream *stream);
|
||||
|
||||
#define SDL_PROP_AUDIOSTREAM_AUTO_CLEANUP_BOOLEAN "SDL.audiostream.auto_cleanup"
|
||||
|
||||
|
||||
/**
|
||||
* Query the current format of an audio stream.
|
||||
*
|
||||
|
|
@ -1149,14 +1164,14 @@ extern SDL_DECLSPEC float SDLCALL SDL_GetAudioStreamFrequencyRatio(SDL_AudioStre
|
|||
*
|
||||
* The frequency ratio is used to adjust the rate at which input data is
|
||||
* consumed. Changing this effectively modifies the speed and pitch of the
|
||||
* audio. A value greater than 1.0 will play the audio faster, and at a higher
|
||||
* pitch. A value less than 1.0 will play the audio slower, and at a lower
|
||||
* pitch.
|
||||
* audio. A value greater than 1.0f will play the audio faster, and at a
|
||||
* higher pitch. A value less than 1.0f will play the audio slower, and at a
|
||||
* lower pitch. 1.0f means play at normal speed.
|
||||
*
|
||||
* This is applied during SDL_GetAudioStreamData, and can be continuously
|
||||
* changed to create various effects.
|
||||
*
|
||||
* \param stream the stream the frequency ratio is being changed.
|
||||
* \param stream the stream on which the frequency ratio is being changed.
|
||||
* \param ratio the frequency ratio. 1.0 is normal speed. Must be between 0.01
|
||||
* and 100.
|
||||
* \returns true on success or false on failure; call SDL_GetError() for more
|
||||
|
|
@ -1332,7 +1347,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetAudioStreamInputChannelMap(SDL_AudioStre
|
|||
* Channel maps are optional; most things do not need them, instead passing
|
||||
* data in the [order that SDL expects](CategoryAudio#channel-layouts).
|
||||
*
|
||||
* The output channel map reorders data that leaving a stream via
|
||||
* The output channel map reorders data that is leaving a stream via
|
||||
* SDL_GetAudioStreamData.
|
||||
*
|
||||
* Each item in the array represents an input channel, and its value is the
|
||||
|
|
|
|||
|
|
@ -135,7 +135,8 @@ typedef enum SDL_EventType
|
|||
/* 0x201 was SDL_SYSWMEVENT, reserve the number for sdl2-compat */
|
||||
SDL_EVENT_WINDOW_SHOWN = 0x202, /**< Window has been shown */
|
||||
SDL_EVENT_WINDOW_HIDDEN, /**< Window has been hidden */
|
||||
SDL_EVENT_WINDOW_EXPOSED, /**< Window has been exposed and should be redrawn, and can be redrawn directly from event watchers for this event */
|
||||
SDL_EVENT_WINDOW_EXPOSED, /**< Window has been exposed and should be redrawn, and can be redrawn directly from event watchers for this event.
|
||||
data1 is 1 for live-resize expose events, 0 otherwise. */
|
||||
SDL_EVENT_WINDOW_MOVED, /**< Window has been moved to data1, data2 */
|
||||
SDL_EVENT_WINDOW_RESIZED, /**< Window has been resized to data1xdata2 */
|
||||
SDL_EVENT_WINDOW_PIXEL_SIZE_CHANGED,/**< The pixel size of the window has changed to data1xdata2 */
|
||||
|
|
|
|||
|
|
@ -823,7 +823,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ReadS8(SDL_IOStream *src, Sint8 *value);
|
|||
*
|
||||
* \param src the stream from which to read data.
|
||||
* \param value a pointer filled in with the data read.
|
||||
* \returns true on successful write or false on failure; call SDL_GetError()
|
||||
* \returns true on successful read or false on failure; call SDL_GetError()
|
||||
* for more information.
|
||||
*
|
||||
* \threadsafety This function is not thread safe.
|
||||
|
|
@ -846,7 +846,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ReadU16LE(SDL_IOStream *src, Uint16 *value)
|
|||
*
|
||||
* \param src the stream from which to read data.
|
||||
* \param value a pointer filled in with the data read.
|
||||
* \returns true on successful write or false on failure; call SDL_GetError()
|
||||
* \returns true on successful read or false on failure; call SDL_GetError()
|
||||
* for more information.
|
||||
*
|
||||
* \threadsafety This function is not thread safe.
|
||||
|
|
@ -869,7 +869,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ReadS16LE(SDL_IOStream *src, Sint16 *value)
|
|||
*
|
||||
* \param src the stream from which to read data.
|
||||
* \param value a pointer filled in with the data read.
|
||||
* \returns true on successful write or false on failure; call SDL_GetError()
|
||||
* \returns true on successful read or false on failure; call SDL_GetError()
|
||||
* for more information.
|
||||
*
|
||||
* \threadsafety This function is not thread safe.
|
||||
|
|
@ -892,7 +892,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ReadU16BE(SDL_IOStream *src, Uint16 *value)
|
|||
*
|
||||
* \param src the stream from which to read data.
|
||||
* \param value a pointer filled in with the data read.
|
||||
* \returns true on successful write or false on failure; call SDL_GetError()
|
||||
* \returns true on successful read or false on failure; call SDL_GetError()
|
||||
* for more information.
|
||||
*
|
||||
* \threadsafety This function is not thread safe.
|
||||
|
|
@ -915,7 +915,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ReadS16BE(SDL_IOStream *src, Sint16 *value)
|
|||
*
|
||||
* \param src the stream from which to read data.
|
||||
* \param value a pointer filled in with the data read.
|
||||
* \returns true on successful write or false on failure; call SDL_GetError()
|
||||
* \returns true on successful read or false on failure; call SDL_GetError()
|
||||
* for more information.
|
||||
*
|
||||
* \threadsafety This function is not thread safe.
|
||||
|
|
@ -938,7 +938,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ReadU32LE(SDL_IOStream *src, Uint32 *value)
|
|||
*
|
||||
* \param src the stream from which to read data.
|
||||
* \param value a pointer filled in with the data read.
|
||||
* \returns true on successful write or false on failure; call SDL_GetError()
|
||||
* \returns true on successful read or false on failure; call SDL_GetError()
|
||||
* for more information.
|
||||
*
|
||||
* \threadsafety This function is not thread safe.
|
||||
|
|
@ -961,7 +961,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ReadS32LE(SDL_IOStream *src, Sint32 *value)
|
|||
*
|
||||
* \param src the stream from which to read data.
|
||||
* \param value a pointer filled in with the data read.
|
||||
* \returns true on successful write or false on failure; call SDL_GetError()
|
||||
* \returns true on successful read or false on failure; call SDL_GetError()
|
||||
* for more information.
|
||||
*
|
||||
* \threadsafety This function is not thread safe.
|
||||
|
|
@ -984,7 +984,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ReadU32BE(SDL_IOStream *src, Uint32 *value)
|
|||
*
|
||||
* \param src the stream from which to read data.
|
||||
* \param value a pointer filled in with the data read.
|
||||
* \returns true on successful write or false on failure; call SDL_GetError()
|
||||
* \returns true on successful read or false on failure; call SDL_GetError()
|
||||
* for more information.
|
||||
*
|
||||
* \threadsafety This function is not thread safe.
|
||||
|
|
@ -1007,7 +1007,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ReadS32BE(SDL_IOStream *src, Sint32 *value)
|
|||
*
|
||||
* \param src the stream from which to read data.
|
||||
* \param value a pointer filled in with the data read.
|
||||
* \returns true on successful write or false on failure; call SDL_GetError()
|
||||
* \returns true on successful read or false on failure; call SDL_GetError()
|
||||
* for more information.
|
||||
*
|
||||
* \threadsafety This function is not thread safe.
|
||||
|
|
@ -1030,7 +1030,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ReadU64LE(SDL_IOStream *src, Uint64 *value)
|
|||
*
|
||||
* \param src the stream from which to read data.
|
||||
* \param value a pointer filled in with the data read.
|
||||
* \returns true on successful write or false on failure; call SDL_GetError()
|
||||
* \returns true on successful read or false on failure; call SDL_GetError()
|
||||
* for more information.
|
||||
*
|
||||
* \threadsafety This function is not thread safe.
|
||||
|
|
@ -1053,7 +1053,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ReadS64LE(SDL_IOStream *src, Sint64 *value)
|
|||
*
|
||||
* \param src the stream from which to read data.
|
||||
* \param value a pointer filled in with the data read.
|
||||
* \returns true on successful write or false on failure; call SDL_GetError()
|
||||
* \returns true on successful read or false on failure; call SDL_GetError()
|
||||
* for more information.
|
||||
*
|
||||
* \threadsafety This function is not thread safe.
|
||||
|
|
@ -1076,7 +1076,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ReadU64BE(SDL_IOStream *src, Uint64 *value)
|
|||
*
|
||||
* \param src the stream from which to read data.
|
||||
* \param value a pointer filled in with the data read.
|
||||
* \returns true on successful write or false on failure; call SDL_GetError()
|
||||
* \returns true on successful read or false on failure; call SDL_GetError()
|
||||
* for more information.
|
||||
*
|
||||
* \threadsafety This function is not thread safe.
|
||||
|
|
|
|||
|
|
@ -1894,7 +1894,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetWindowSafeArea(SDL_Window *window, SDL_R
|
|||
extern SDL_DECLSPEC bool SDLCALL SDL_SetWindowAspectRatio(SDL_Window *window, float min_aspect, float max_aspect);
|
||||
|
||||
/**
|
||||
* Get the size of a window's client area.
|
||||
* Get the aspect ratio of a window's client area.
|
||||
*
|
||||
* \param window the window to query the width and height from.
|
||||
* \param min_aspect a pointer filled in with the minimum aspect ratio of the
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ static void SDLCALL CleanupHintProperty(void *userdata, void *value)
|
|||
SDL_free(hint);
|
||||
}
|
||||
|
||||
static const char* GetHintEnvironmentVariable(const char *name)
|
||||
static const char *GetHintEnvironmentVariable(const char *name)
|
||||
{
|
||||
const char *result = SDL_getenv(name);
|
||||
if (!result && name && *name) {
|
||||
|
|
|
|||
|
|
@ -163,7 +163,7 @@ bool SDL_CompareAndSwapAtomicU32(SDL_AtomicU32 *a, Uint32 oldval, Uint32 newval)
|
|||
#elif defined(HAVE_GCC_ATOMICS)
|
||||
return __sync_bool_compare_and_swap(&a->value, oldval, newval);
|
||||
#elif defined(SDL_PLATFORM_MACOS) // this is deprecated in 10.12 sdk; favor gcc atomics.
|
||||
return OSAtomicCompareAndSwap32Barrier((int32_t)oldval, (int32_t)newval, (int32_t*)&a->value);
|
||||
return OSAtomicCompareAndSwap32Barrier((int32_t)oldval, (int32_t)newval, (int32_t *)&a->value);
|
||||
#elif defined(SDL_PLATFORM_SOLARIS)
|
||||
SDL_COMPILE_TIME_ASSERT(atomic_cas, sizeof(uint_t) == sizeof(a->value));
|
||||
return ((Uint32)atomic_cas_uint((volatile uint_t *)&a->value, (uint_t)oldval, (uint_t)newval) == oldval);
|
||||
|
|
|
|||
|
|
@ -1073,9 +1073,16 @@ void SDL_QuitAudio(void)
|
|||
|
||||
current_audio.impl.DeinitializeStart();
|
||||
|
||||
// Destroy any audio streams that still exist...
|
||||
while (current_audio.existing_streams) {
|
||||
SDL_DestroyAudioStream(current_audio.existing_streams);
|
||||
// Destroy any audio streams that still exist...unless app asked to keep it.
|
||||
SDL_AudioStream *next = NULL;
|
||||
for (SDL_AudioStream *i = current_audio.existing_streams; i; i = next) {
|
||||
next = i->next;
|
||||
if (i->simplified || SDL_GetBooleanProperty(i->props, SDL_PROP_AUDIOSTREAM_AUTO_CLEANUP_BOOLEAN, true)) {
|
||||
SDL_DestroyAudioStream(i);
|
||||
} else {
|
||||
i->prev = NULL;
|
||||
i->next = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
SDL_LockRWLockForWriting(current_audio.device_hash_lock);
|
||||
|
|
@ -1415,6 +1422,7 @@ static int SDLCALL RecordingAudioThread(void *devicep) // thread entry point
|
|||
typedef struct CountAudioDevicesData
|
||||
{
|
||||
int devs_seen;
|
||||
int devs_skipped;
|
||||
const int num_devices;
|
||||
SDL_AudioDeviceID *result;
|
||||
const bool recording;
|
||||
|
|
@ -1430,7 +1438,13 @@ static bool SDLCALL CountAudioDevices(void *userdata, const SDL_HashTable *table
|
|||
const bool isphysical = !!(devid & (1<<1));
|
||||
if (isphysical && (devid_recording == data->recording)) {
|
||||
SDL_assert(data->devs_seen < data->num_devices);
|
||||
data->result[data->devs_seen++] = devid;
|
||||
SDL_AudioDevice *device = (SDL_AudioDevice *) value; // this is normally risky, but we hold the device_hash_lock here.
|
||||
const bool zombie = SDL_GetAtomicInt(&device->zombie) != 0;
|
||||
if (zombie) {
|
||||
data->devs_skipped++;
|
||||
} else {
|
||||
data->result[data->devs_seen++] = devid;
|
||||
}
|
||||
}
|
||||
return true; // keep iterating.
|
||||
}
|
||||
|
|
@ -1446,10 +1460,11 @@ static SDL_AudioDeviceID *GetAudioDevices(int *count, bool recording)
|
|||
num_devices = SDL_GetAtomicInt(recording ? ¤t_audio.recording_device_count : ¤t_audio.playback_device_count);
|
||||
result = (SDL_AudioDeviceID *) SDL_malloc((num_devices + 1) * sizeof (SDL_AudioDeviceID));
|
||||
if (result) {
|
||||
CountAudioDevicesData data = { 0, num_devices, result, recording };
|
||||
CountAudioDevicesData data = { 0, 0, num_devices, result, recording };
|
||||
SDL_IterateHashTable(current_audio.device_hash, CountAudioDevices, &data);
|
||||
SDL_assert(data.devs_seen == num_devices);
|
||||
result[data.devs_seen] = 0; // null-terminated.
|
||||
SDL_assert((data.devs_seen + data.devs_skipped) == num_devices);
|
||||
num_devices = data.devs_seen; // might be less if we skipped any.
|
||||
result[num_devices] = 0; // null-terminated.
|
||||
}
|
||||
}
|
||||
SDL_UnlockRWLock(current_audio.device_hash_lock);
|
||||
|
|
|
|||
|
|
@ -280,7 +280,7 @@ void ConvertAudio(int num_frames,
|
|||
|
||||
// swizzle input to "standard" format if necessary.
|
||||
if (src_map) {
|
||||
void* buf = scratch ? scratch : dst; // use scratch if available, since it has to be big enough to hold src, unless it's NULL, then dst has to be.
|
||||
void *buf = scratch ? scratch : dst; // use scratch if available, since it has to be big enough to hold src, unless it's NULL, then dst has to be.
|
||||
SwizzleAudio(num_frames, buf, src, src_channels, src_map, src_format);
|
||||
src = buf;
|
||||
}
|
||||
|
|
@ -318,7 +318,7 @@ void ConvertAudio(int num_frames,
|
|||
|
||||
// get us to float format.
|
||||
if (srcconvert) {
|
||||
void* buf = (channelconvert || dstconvert) ? scratch : dst;
|
||||
void *buf = (channelconvert || dstconvert) ? scratch : dst;
|
||||
ConvertAudioToFloat((float *) buf, src, num_frames * src_channels, src_format);
|
||||
src = buf;
|
||||
}
|
||||
|
|
@ -368,7 +368,7 @@ void ConvertAudio(int num_frames,
|
|||
channel_converter = override;
|
||||
}
|
||||
|
||||
void* buf = dstconvert ? scratch : dst;
|
||||
void *buf = dstconvert ? scratch : dst;
|
||||
channel_converter((float *) buf, (const float *) src, num_frames);
|
||||
src = buf;
|
||||
}
|
||||
|
|
@ -399,7 +399,7 @@ static int CalculateMaxFrameSize(SDL_AudioFormat src_format, int src_channels, S
|
|||
return max_format_size * max_channels;
|
||||
}
|
||||
|
||||
static Sint64 GetAudioStreamResampleRate(SDL_AudioStream* stream, int src_freq, Sint64 resample_offset)
|
||||
static Sint64 GetAudioStreamResampleRate(SDL_AudioStream *stream, int src_freq, Sint64 resample_offset)
|
||||
{
|
||||
src_freq = (int)((float)src_freq * stream->freq_ratio);
|
||||
|
||||
|
|
@ -778,9 +778,9 @@ static bool CheckAudioStreamIsFullySetup(SDL_AudioStream *stream)
|
|||
}
|
||||
|
||||
// you MUST hold `stream->lock` when calling this, and validate your parameters!
|
||||
static bool PutAudioStreamBufferInternal(SDL_AudioStream *stream, const SDL_AudioSpec *spec, const int *chmap, const void *buf, int len, SDL_ReleaseAudioBufferCallback callback, void* userdata)
|
||||
static bool PutAudioStreamBufferInternal(SDL_AudioStream *stream, const SDL_AudioSpec *spec, const int *chmap, const void *buf, int len, SDL_ReleaseAudioBufferCallback callback, void *userdata)
|
||||
{
|
||||
SDL_AudioTrack* track = NULL;
|
||||
SDL_AudioTrack *track = NULL;
|
||||
|
||||
if (callback) {
|
||||
track = SDL_CreateAudioTrack(stream->queue, spec, chmap, (Uint8 *)buf, len, len, callback, userdata);
|
||||
|
|
@ -809,7 +809,7 @@ static bool PutAudioStreamBufferInternal(SDL_AudioStream *stream, const SDL_Audi
|
|||
return retval;
|
||||
}
|
||||
|
||||
static bool PutAudioStreamBuffer(SDL_AudioStream *stream, const void *buf, int len, SDL_ReleaseAudioBufferCallback callback, void* userdata)
|
||||
static bool PutAudioStreamBuffer(SDL_AudioStream *stream, const void *buf, int len, SDL_ReleaseAudioBufferCallback callback, void *userdata)
|
||||
{
|
||||
#if DEBUG_AUDIOSTREAM
|
||||
SDL_Log("AUDIOSTREAM: wants to put %d bytes", len);
|
||||
|
|
@ -836,7 +836,7 @@ static bool PutAudioStreamBuffer(SDL_AudioStream *stream, const void *buf, int l
|
|||
|
||||
static void SDLCALL FreeAllocatedAudioBuffer(void *userdata, const void *buf, int len)
|
||||
{
|
||||
SDL_free((void*) buf);
|
||||
SDL_free((void *)buf);
|
||||
}
|
||||
|
||||
bool SDL_PutAudioStreamData(SDL_AudioStream *stream, const void *buf, int len)
|
||||
|
|
@ -1081,8 +1081,8 @@ static Uint8 *EnsureAudioStreamWorkBufferSize(SDL_AudioStream *stream, size_t ne
|
|||
return ptr;
|
||||
}
|
||||
|
||||
static Sint64 NextAudioStreamIter(SDL_AudioStream* stream, void** inout_iter,
|
||||
Sint64* inout_resample_offset, SDL_AudioSpec* out_spec, int **out_chmap, bool* out_flushed)
|
||||
static Sint64 NextAudioStreamIter(SDL_AudioStream *stream, void **inout_iter,
|
||||
Sint64 *inout_resample_offset, SDL_AudioSpec *out_spec, int **out_chmap, bool *out_flushed)
|
||||
{
|
||||
SDL_AudioSpec spec;
|
||||
bool flushed;
|
||||
|
|
@ -1136,9 +1136,9 @@ static Sint64 NextAudioStreamIter(SDL_AudioStream* stream, void** inout_iter,
|
|||
return output_frames;
|
||||
}
|
||||
|
||||
static Sint64 GetAudioStreamAvailableFrames(SDL_AudioStream* stream, Sint64* out_resample_offset)
|
||||
static Sint64 GetAudioStreamAvailableFrames(SDL_AudioStream *stream, Sint64 *out_resample_offset)
|
||||
{
|
||||
void* iter = SDL_BeginAudioQueueIter(stream->queue);
|
||||
void *iter = SDL_BeginAudioQueueIter(stream->queue);
|
||||
|
||||
Sint64 resample_offset = stream->resample_offset;
|
||||
Sint64 output_frames = 0;
|
||||
|
|
@ -1160,9 +1160,9 @@ static Sint64 GetAudioStreamAvailableFrames(SDL_AudioStream* stream, Sint64* out
|
|||
return output_frames;
|
||||
}
|
||||
|
||||
static Sint64 GetAudioStreamHead(SDL_AudioStream* stream, SDL_AudioSpec* out_spec, int **out_chmap, bool* out_flushed)
|
||||
static Sint64 GetAudioStreamHead(SDL_AudioStream *stream, SDL_AudioSpec *out_spec, int **out_chmap, bool *out_flushed)
|
||||
{
|
||||
void* iter = SDL_BeginAudioQueueIter(stream->queue);
|
||||
void *iter = SDL_BeginAudioQueueIter(stream->queue);
|
||||
|
||||
if (!iter) {
|
||||
SDL_zerop(out_spec);
|
||||
|
|
@ -1178,8 +1178,8 @@ static Sint64 GetAudioStreamHead(SDL_AudioStream* stream, SDL_AudioSpec* out_spe
|
|||
// Enough input data MUST be available!
|
||||
static bool GetAudioStreamDataInternal(SDL_AudioStream *stream, void *buf, int output_frames, float gain)
|
||||
{
|
||||
const SDL_AudioSpec* src_spec = &stream->input_spec;
|
||||
const SDL_AudioSpec* dst_spec = &stream->dst_spec;
|
||||
const SDL_AudioSpec *src_spec = &stream->input_spec;
|
||||
const SDL_AudioSpec *dst_spec = &stream->dst_spec;
|
||||
|
||||
const SDL_AudioFormat src_format = src_spec->format;
|
||||
const int src_channels = src_spec->channels;
|
||||
|
|
@ -1199,7 +1199,7 @@ static bool GetAudioStreamDataInternal(SDL_AudioStream *stream, void *buf, int o
|
|||
|
||||
// Not resampling? It's an easy conversion (and maybe not even that!)
|
||||
if (resample_rate == 0) {
|
||||
Uint8* work_buffer = NULL;
|
||||
Uint8 *work_buffer = NULL;
|
||||
|
||||
// Ensure we have enough scratch space for any conversions
|
||||
if ((src_format != dst_format) || (src_channels != dst_channels) || (gain != 1.0f)) {
|
||||
|
|
@ -1269,7 +1269,7 @@ static bool GetAudioStreamDataInternal(SDL_AudioStream *stream, void *buf, int o
|
|||
work_buffer_capacity += resample_bytes;
|
||||
}
|
||||
|
||||
Uint8* work_buffer = EnsureAudioStreamWorkBufferSize(stream, work_buffer_capacity);
|
||||
Uint8 *work_buffer = EnsureAudioStreamWorkBufferSize(stream, work_buffer_capacity);
|
||||
|
||||
if (!work_buffer) {
|
||||
return false;
|
||||
|
|
@ -1281,7 +1281,7 @@ static bool GetAudioStreamDataInternal(SDL_AudioStream *stream, void *buf, int o
|
|||
const float postresample_gain = (input_frames > output_frames) ? gain : 1.0f;
|
||||
|
||||
// (dst channel map is NULL because we'll do the final swizzle on ConvertAudio after resample.)
|
||||
const Uint8* input_buffer = SDL_ReadFromAudioQueue(stream->queue,
|
||||
const Uint8 *input_buffer = SDL_ReadFromAudioQueue(stream->queue,
|
||||
NULL, resample_format, resample_channels, NULL,
|
||||
padding_frames, input_frames, padding_frames, work_buffer, preresample_gain);
|
||||
|
||||
|
|
@ -1292,11 +1292,11 @@ static bool GetAudioStreamDataInternal(SDL_AudioStream *stream, void *buf, int o
|
|||
input_buffer += padding_frames * resample_frame_size;
|
||||
|
||||
// Decide where the resampled output goes
|
||||
void* resample_buffer = (resample_buffer_offset != -1) ? (work_buffer + resample_buffer_offset) : buf;
|
||||
void *resample_buffer = (resample_buffer_offset != -1) ? (work_buffer + resample_buffer_offset) : buf;
|
||||
|
||||
SDL_ResampleAudio(resample_channels,
|
||||
(const float *) input_buffer, input_frames,
|
||||
(float*) resample_buffer, output_frames,
|
||||
(const float *)input_buffer, input_frames,
|
||||
(float *)resample_buffer, output_frames,
|
||||
resample_rate, &stream->resample_offset);
|
||||
|
||||
// Convert to the final format, if necessary (src channel map is NULL because SDL_ReadFromAudioQueue already handled this).
|
||||
|
|
|
|||
|
|
@ -185,7 +185,7 @@ static void SDL_Convert_F32_to_S32_Scalar(Sint32 *dst, const float *src, int num
|
|||
|
||||
#undef SIGNMASK
|
||||
|
||||
static void SDL_Convert_Swap16_Scalar(Uint16* dst, const Uint16* src, int num_samples)
|
||||
static void SDL_Convert_Swap16_Scalar(Uint16 *dst, const Uint16 *src, int num_samples)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
|
@ -194,7 +194,7 @@ static void SDL_Convert_Swap16_Scalar(Uint16* dst, const Uint16* src, int num_sa
|
|||
}
|
||||
}
|
||||
|
||||
static void SDL_Convert_Swap32_Scalar(Uint32* dst, const Uint32* src, int num_samples)
|
||||
static void SDL_Convert_Swap32_Scalar(Uint32 *dst, const Uint32 *src, int num_samples)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
|
@ -375,7 +375,7 @@ static void SDL_TARGETING("sse2") SDL_Convert_F32_to_S8_SSE2(Sint8 *dst, const f
|
|||
|
||||
const __m128i bytes = _mm_packus_epi16(shorts0, shorts1);
|
||||
|
||||
_mm_store_si128((__m128i*)&dst[i], bytes);
|
||||
_mm_store_si128((__m128i *)&dst[i], bytes);
|
||||
})
|
||||
}
|
||||
|
||||
|
|
@ -409,7 +409,7 @@ static void SDL_TARGETING("sse2") SDL_Convert_F32_to_U8_SSE2(Uint8 *dst, const f
|
|||
|
||||
const __m128i bytes = _mm_packus_epi16(shorts0, shorts1);
|
||||
|
||||
_mm_store_si128((__m128i*)&dst[i], bytes);
|
||||
_mm_store_si128((__m128i *)&dst[i], bytes);
|
||||
})
|
||||
}
|
||||
|
||||
|
|
@ -441,8 +441,8 @@ static void SDL_TARGETING("sse2") SDL_Convert_F32_to_S16_SSE2(Sint16 *dst, const
|
|||
const __m128i shorts0 = _mm_packs_epi32(ints0, ints1);
|
||||
const __m128i shorts1 = _mm_packs_epi32(ints2, ints3);
|
||||
|
||||
_mm_store_si128((__m128i*)&dst[i], shorts0);
|
||||
_mm_store_si128((__m128i*)&dst[i + 8], shorts1);
|
||||
_mm_store_si128((__m128i *)&dst[i], shorts0);
|
||||
_mm_store_si128((__m128i *)&dst[i + 8], shorts1);
|
||||
})
|
||||
}
|
||||
|
||||
|
|
@ -477,55 +477,55 @@ static void SDL_TARGETING("sse2") SDL_Convert_F32_to_S32_SSE2(Sint32 *dst, const
|
|||
const __m128i ints2 = _mm_xor_si128(_mm_cvttps_epi32(values3), _mm_castps_si128(_mm_cmpge_ps(values3, limit)));
|
||||
const __m128i ints3 = _mm_xor_si128(_mm_cvttps_epi32(values4), _mm_castps_si128(_mm_cmpge_ps(values4, limit)));
|
||||
|
||||
_mm_store_si128((__m128i*)&dst[i], ints0);
|
||||
_mm_store_si128((__m128i*)&dst[i + 4], ints1);
|
||||
_mm_store_si128((__m128i*)&dst[i + 8], ints2);
|
||||
_mm_store_si128((__m128i*)&dst[i + 12], ints3);
|
||||
_mm_store_si128((__m128i *)&dst[i], ints0);
|
||||
_mm_store_si128((__m128i *)&dst[i + 4], ints1);
|
||||
_mm_store_si128((__m128i *)&dst[i + 8], ints2);
|
||||
_mm_store_si128((__m128i *)&dst[i + 12], ints3);
|
||||
})
|
||||
}
|
||||
#endif
|
||||
|
||||
// FIXME: SDL doesn't have SSSE3 detection, so use the next one up
|
||||
#ifdef SDL_SSE4_1_INTRINSICS
|
||||
static void SDL_TARGETING("ssse3") SDL_Convert_Swap16_SSSE3(Uint16* dst, const Uint16* src, int num_samples)
|
||||
static void SDL_TARGETING("ssse3") SDL_Convert_Swap16_SSSE3(Uint16 *dst, const Uint16 *src, int num_samples)
|
||||
{
|
||||
const __m128i shuffle = _mm_set_epi8(14, 15, 12, 13, 10, 11, 8, 9, 6, 7, 4, 5, 2, 3, 0, 1);
|
||||
|
||||
CONVERT_16_FWD({
|
||||
dst[i] = SDL_Swap16(src[i]);
|
||||
}, {
|
||||
__m128i ints0 = _mm_loadu_si128((const __m128i*)&src[i]);
|
||||
__m128i ints1 = _mm_loadu_si128((const __m128i*)&src[i + 8]);
|
||||
__m128i ints0 = _mm_loadu_si128((const __m128i *)&src[i]);
|
||||
__m128i ints1 = _mm_loadu_si128((const __m128i *)&src[i + 8]);
|
||||
|
||||
ints0 = _mm_shuffle_epi8(ints0, shuffle);
|
||||
ints1 = _mm_shuffle_epi8(ints1, shuffle);
|
||||
|
||||
_mm_store_si128((__m128i*)&dst[i], ints0);
|
||||
_mm_store_si128((__m128i*)&dst[i + 8], ints1);
|
||||
_mm_store_si128((__m128i *)&dst[i], ints0);
|
||||
_mm_store_si128((__m128i *)&dst[i + 8], ints1);
|
||||
})
|
||||
}
|
||||
|
||||
static void SDL_TARGETING("ssse3") SDL_Convert_Swap32_SSSE3(Uint32* dst, const Uint32* src, int num_samples)
|
||||
static void SDL_TARGETING("ssse3") SDL_Convert_Swap32_SSSE3(Uint32 *dst, const Uint32 *src, int num_samples)
|
||||
{
|
||||
const __m128i shuffle = _mm_set_epi8(12, 13, 14, 15, 8, 9, 10, 11, 4, 5, 6, 7, 0, 1, 2, 3);
|
||||
|
||||
CONVERT_16_FWD({
|
||||
dst[i] = SDL_Swap32(src[i]);
|
||||
}, {
|
||||
__m128i ints0 = _mm_loadu_si128((const __m128i*)&src[i]);
|
||||
__m128i ints1 = _mm_loadu_si128((const __m128i*)&src[i + 4]);
|
||||
__m128i ints2 = _mm_loadu_si128((const __m128i*)&src[i + 8]);
|
||||
__m128i ints3 = _mm_loadu_si128((const __m128i*)&src[i + 12]);
|
||||
__m128i ints0 = _mm_loadu_si128((const __m128i *)&src[i]);
|
||||
__m128i ints1 = _mm_loadu_si128((const __m128i *)&src[i + 4]);
|
||||
__m128i ints2 = _mm_loadu_si128((const __m128i *)&src[i + 8]);
|
||||
__m128i ints3 = _mm_loadu_si128((const __m128i *)&src[i + 12]);
|
||||
|
||||
ints0 = _mm_shuffle_epi8(ints0, shuffle);
|
||||
ints1 = _mm_shuffle_epi8(ints1, shuffle);
|
||||
ints2 = _mm_shuffle_epi8(ints2, shuffle);
|
||||
ints3 = _mm_shuffle_epi8(ints3, shuffle);
|
||||
|
||||
_mm_store_si128((__m128i*)&dst[i], ints0);
|
||||
_mm_store_si128((__m128i*)&dst[i + 4], ints1);
|
||||
_mm_store_si128((__m128i*)&dst[i + 8], ints2);
|
||||
_mm_store_si128((__m128i*)&dst[i + 12], ints3);
|
||||
_mm_store_si128((__m128i *)&dst[i], ints0);
|
||||
_mm_store_si128((__m128i *)&dst[i + 4], ints1);
|
||||
_mm_store_si128((__m128i *)&dst[i + 8], ints2);
|
||||
_mm_store_si128((__m128i *)&dst[i + 12], ints3);
|
||||
})
|
||||
}
|
||||
#endif
|
||||
|
|
@ -774,41 +774,41 @@ static void SDL_Convert_F32_to_S32_NEON(Sint32 *dst, const float *src, int num_s
|
|||
fesetenv(&fenv);
|
||||
}
|
||||
|
||||
static void SDL_Convert_Swap16_NEON(Uint16* dst, const Uint16* src, int num_samples)
|
||||
static void SDL_Convert_Swap16_NEON(Uint16 *dst, const Uint16 *src, int num_samples)
|
||||
{
|
||||
CONVERT_16_FWD({
|
||||
dst[i] = SDL_Swap16(src[i]);
|
||||
}, {
|
||||
uint8x16_t ints0 = vld1q_u8((const Uint8*)&src[i]);
|
||||
uint8x16_t ints1 = vld1q_u8((const Uint8*)&src[i + 8]);
|
||||
uint8x16_t ints0 = vld1q_u8((const Uint8 *)&src[i]);
|
||||
uint8x16_t ints1 = vld1q_u8((const Uint8 *)&src[i + 8]);
|
||||
|
||||
ints0 = vrev16q_u8(ints0);
|
||||
ints1 = vrev16q_u8(ints1);
|
||||
|
||||
vst1q_u8((Uint8*)&dst[i], ints0);
|
||||
vst1q_u8((Uint8*)&dst[i + 8], ints1);
|
||||
vst1q_u8((Uint8 *)&dst[i], ints0);
|
||||
vst1q_u8((Uint8 *)&dst[i + 8], ints1);
|
||||
})
|
||||
}
|
||||
|
||||
static void SDL_Convert_Swap32_NEON(Uint32* dst, const Uint32* src, int num_samples)
|
||||
static void SDL_Convert_Swap32_NEON(Uint32 *dst, const Uint32 *src, int num_samples)
|
||||
{
|
||||
CONVERT_16_FWD({
|
||||
dst[i] = SDL_Swap32(src[i]);
|
||||
}, {
|
||||
uint8x16_t ints0 = vld1q_u8((const Uint8*)&src[i]);
|
||||
uint8x16_t ints1 = vld1q_u8((const Uint8*)&src[i + 4]);
|
||||
uint8x16_t ints2 = vld1q_u8((const Uint8*)&src[i + 8]);
|
||||
uint8x16_t ints3 = vld1q_u8((const Uint8*)&src[i + 12]);
|
||||
uint8x16_t ints0 = vld1q_u8((const Uint8 *)&src[i]);
|
||||
uint8x16_t ints1 = vld1q_u8((const Uint8 *)&src[i + 4]);
|
||||
uint8x16_t ints2 = vld1q_u8((const Uint8 *)&src[i + 8]);
|
||||
uint8x16_t ints3 = vld1q_u8((const Uint8 *)&src[i + 12]);
|
||||
|
||||
ints0 = vrev32q_u8(ints0);
|
||||
ints1 = vrev32q_u8(ints1);
|
||||
ints2 = vrev32q_u8(ints2);
|
||||
ints3 = vrev32q_u8(ints3);
|
||||
|
||||
vst1q_u8((Uint8*)&dst[i], ints0);
|
||||
vst1q_u8((Uint8*)&dst[i + 4], ints1);
|
||||
vst1q_u8((Uint8*)&dst[i + 8], ints2);
|
||||
vst1q_u8((Uint8*)&dst[i + 12], ints3);
|
||||
vst1q_u8((Uint8 *)&dst[i], ints0);
|
||||
vst1q_u8((Uint8 *)&dst[i + 4], ints1);
|
||||
vst1q_u8((Uint8 *)&dst[i + 8], ints2);
|
||||
vst1q_u8((Uint8 *)&dst[i + 12], ints3);
|
||||
})
|
||||
}
|
||||
|
||||
|
|
@ -839,8 +839,8 @@ static void (*SDL_Convert_F32_to_U8)(Uint8 *dst, const float *src, int num_sampl
|
|||
static void (*SDL_Convert_F32_to_S16)(Sint16 *dst, const float *src, int num_samples) = NULL;
|
||||
static void (*SDL_Convert_F32_to_S32)(Sint32 *dst, const float *src, int num_samples) = NULL;
|
||||
|
||||
static void (*SDL_Convert_Swap16)(Uint16* dst, const Uint16* src, int num_samples) = NULL;
|
||||
static void (*SDL_Convert_Swap32)(Uint32* dst, const Uint32* src, int num_samples) = NULL;
|
||||
static void (*SDL_Convert_Swap16)(Uint16 *dst, const Uint16 *src, int num_samples) = NULL;
|
||||
static void (*SDL_Convert_Swap32)(Uint32 *dst, const Uint32 *src, int num_samples) = NULL;
|
||||
|
||||
void ConvertAudioToFloat(float *dst, const void *src, int num_samples, SDL_AudioFormat src_fmt)
|
||||
{
|
||||
|
|
@ -858,7 +858,7 @@ void ConvertAudioToFloat(float *dst, const void *src, int num_samples, SDL_Audio
|
|||
break;
|
||||
|
||||
case SDL_AUDIO_S16 ^ SDL_AUDIO_MASK_BIG_ENDIAN:
|
||||
SDL_Convert_Swap16((Uint16*) dst, (const Uint16*) src, num_samples);
|
||||
SDL_Convert_Swap16((Uint16 *)dst, (const Uint16 *)src, num_samples);
|
||||
SDL_Convert_S16_to_F32(dst, (const Sint16 *) dst, num_samples);
|
||||
break;
|
||||
|
||||
|
|
@ -867,12 +867,12 @@ void ConvertAudioToFloat(float *dst, const void *src, int num_samples, SDL_Audio
|
|||
break;
|
||||
|
||||
case SDL_AUDIO_S32 ^ SDL_AUDIO_MASK_BIG_ENDIAN:
|
||||
SDL_Convert_Swap32((Uint32*) dst, (const Uint32*) src, num_samples);
|
||||
SDL_Convert_Swap32((Uint32 *)dst, (const Uint32 *)src, num_samples);
|
||||
SDL_Convert_S32_to_F32(dst, (const Sint32 *) dst, num_samples);
|
||||
break;
|
||||
|
||||
case SDL_AUDIO_F32 ^ SDL_AUDIO_MASK_BIG_ENDIAN:
|
||||
SDL_Convert_Swap32((Uint32*) dst, (const Uint32*) src, num_samples);
|
||||
SDL_Convert_Swap32((Uint32 *)dst, (const Uint32 *)src, num_samples);
|
||||
break;
|
||||
|
||||
default: SDL_assert(!"Unexpected audio format!"); break;
|
||||
|
|
@ -896,7 +896,7 @@ void ConvertAudioFromFloat(void *dst, const float *src, int num_samples, SDL_Aud
|
|||
|
||||
case SDL_AUDIO_S16 ^ SDL_AUDIO_MASK_BIG_ENDIAN:
|
||||
SDL_Convert_F32_to_S16((Sint16 *) dst, src, num_samples);
|
||||
SDL_Convert_Swap16((Uint16*) dst, (const Uint16*) dst, num_samples);
|
||||
SDL_Convert_Swap16((Uint16 *)dst, (const Uint16 *)dst, num_samples);
|
||||
break;
|
||||
|
||||
case SDL_AUDIO_S32:
|
||||
|
|
@ -905,22 +905,22 @@ void ConvertAudioFromFloat(void *dst, const float *src, int num_samples, SDL_Aud
|
|||
|
||||
case SDL_AUDIO_S32 ^ SDL_AUDIO_MASK_BIG_ENDIAN:
|
||||
SDL_Convert_F32_to_S32((Sint32 *) dst, src, num_samples);
|
||||
SDL_Convert_Swap32((Uint32*) dst, (const Uint32*) dst, num_samples);
|
||||
SDL_Convert_Swap32((Uint32 *)dst, (const Uint32 *)dst, num_samples);
|
||||
break;
|
||||
|
||||
case SDL_AUDIO_F32 ^ SDL_AUDIO_MASK_BIG_ENDIAN:
|
||||
SDL_Convert_Swap32((Uint32*) dst, (const Uint32*) src, num_samples);
|
||||
SDL_Convert_Swap32((Uint32 *)dst, (const Uint32 *)src, num_samples);
|
||||
break;
|
||||
|
||||
default: SDL_assert(!"Unexpected audio format!"); break;
|
||||
}
|
||||
}
|
||||
|
||||
void ConvertAudioSwapEndian(void* dst, const void* src, int num_samples, int bitsize)
|
||||
void ConvertAudioSwapEndian(void *dst, const void *src, int num_samples, int bitsize)
|
||||
{
|
||||
switch (bitsize) {
|
||||
case 16: SDL_Convert_Swap16((Uint16*) dst, (const Uint16*) src, num_samples); break;
|
||||
case 32: SDL_Convert_Swap32((Uint32*) dst, (const Uint32*) src, num_samples); break;
|
||||
case 16: SDL_Convert_Swap16((Uint16 *)dst, (const Uint16 *)src, num_samples); break;
|
||||
case 32: SDL_Convert_Swap32((Uint32 *)dst, (const Uint32 *)src, num_samples); break;
|
||||
default: SDL_assert(!"Unexpected audio format!"); break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ extern void SDL_AudioThreadFinalize(SDL_AudioDevice *device);
|
|||
|
||||
extern void ConvertAudioToFloat(float *dst, const void *src, int num_samples, SDL_AudioFormat src_fmt);
|
||||
extern void ConvertAudioFromFloat(void *dst, const float *src, int num_samples, SDL_AudioFormat dst_fmt);
|
||||
extern void ConvertAudioSwapEndian(void* dst, const void* src, int num_samples, int bitsize);
|
||||
extern void ConvertAudioSwapEndian(void *dst, const void *src, int num_samples, int bitsize);
|
||||
|
||||
extern bool SDL_ChannelMapIsDefault(const int *map, int channels);
|
||||
extern bool SDL_ChannelMapIsBogus(const int *map, int channels);
|
||||
|
|
@ -121,7 +121,7 @@ extern bool SDL_ChannelMapIsBogus(const int *map, int channels);
|
|||
extern void ConvertAudio(int num_frames,
|
||||
const void *src, SDL_AudioFormat src_format, int src_channels, const int *src_map,
|
||||
void *dst, SDL_AudioFormat dst_format, int dst_channels, const int *dst_map,
|
||||
void* scratch, float gain);
|
||||
void *scratch, float gain);
|
||||
|
||||
// Compare two SDL_AudioSpecs, return true if they match exactly.
|
||||
// Using SDL_memcmp directly isn't safe, since potential padding might not be initialized.
|
||||
|
|
@ -201,7 +201,7 @@ struct SDL_AudioQueue; // forward decl.
|
|||
|
||||
struct SDL_AudioStream
|
||||
{
|
||||
SDL_Mutex* lock;
|
||||
SDL_Mutex *lock;
|
||||
|
||||
SDL_PropertiesID props;
|
||||
|
||||
|
|
@ -217,7 +217,7 @@ struct SDL_AudioStream
|
|||
float freq_ratio;
|
||||
float gain;
|
||||
|
||||
struct SDL_AudioQueue* queue;
|
||||
struct SDL_AudioQueue *queue;
|
||||
|
||||
SDL_AudioSpec input_spec; // The spec of input data currently being processed
|
||||
int *input_chmap;
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@
|
|||
|
||||
#include "../SDL_sysaudio.h"
|
||||
#include "SDL_alsa_audio.h"
|
||||
#include "../../core/linux/SDL_udev.h"
|
||||
|
||||
#if SDL_ALSA_DEBUG
|
||||
#define LOGDEBUG(...) SDL_LogDebug(SDL_LOG_CATEGORY_AUDIO, "ALSA: " __VA_ARGS__)
|
||||
|
|
@ -87,7 +88,7 @@ static int (*ALSA_snd_device_name_free_hint)(void **);
|
|||
static snd_pcm_sframes_t (*ALSA_snd_pcm_avail)(snd_pcm_t *);
|
||||
static size_t (*ALSA_snd_ctl_card_info_sizeof)(void);
|
||||
static size_t (*ALSA_snd_pcm_info_sizeof)(void);
|
||||
static int (*ALSA_snd_card_next)(int*);
|
||||
static int (*ALSA_snd_card_next)(int *);
|
||||
static int (*ALSA_snd_ctl_open)(snd_ctl_t **,const char *,int);
|
||||
static int (*ALSA_snd_ctl_close)(snd_ctl_t *);
|
||||
static int (*ALSA_snd_ctl_card_info)(snd_ctl_t *, snd_ctl_card_info_t *);
|
||||
|
|
@ -348,28 +349,25 @@ static char *get_pcm_str(void *handle)
|
|||
// This function waits until it is possible to write a full sound buffer
|
||||
static bool ALSA_WaitDevice(SDL_AudioDevice *device)
|
||||
{
|
||||
const int fulldelay = (int) ((((Uint64) device->sample_frames) * 1000) / device->spec.freq);
|
||||
const int delay = SDL_max(fulldelay, 10);
|
||||
const int sample_frames = device->sample_frames;
|
||||
const int fulldelay = (int) ((((Uint64) sample_frames) * 1000) / device->spec.freq);
|
||||
const int delay = SDL_clamp(fulldelay, 1, 5);
|
||||
|
||||
while (!SDL_GetAtomicInt(&device->shutdown)) {
|
||||
const int rc = ALSA_snd_pcm_wait(device->hidden->pcm, delay);
|
||||
if (rc < 0 && (rc != -EAGAIN)) {
|
||||
const int rc = ALSA_snd_pcm_avail(device->hidden->pcm);
|
||||
if (rc < 0) {
|
||||
const int status = ALSA_snd_pcm_recover(device->hidden->pcm, rc, 0);
|
||||
if (status < 0) {
|
||||
// Hmm, not much we can do - abort
|
||||
SDL_LogError(SDL_LOG_CATEGORY_AUDIO, "ALSA: snd_pcm_wait failed (unrecoverable): %s", ALSA_snd_strerror(rc));
|
||||
SDL_LogError(SDL_LOG_CATEGORY_AUDIO, "ALSA wait failed (unrecoverable): %s", ALSA_snd_strerror(rc));
|
||||
return false;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
if (rc > 0) {
|
||||
break; // ready to go!
|
||||
if (rc >= sample_frames) {
|
||||
break;
|
||||
}
|
||||
|
||||
// Timed out! Make sure we aren't shutting down and then wait again.
|
||||
SDL_Delay(delay);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -431,8 +429,11 @@ static int ALSA_RecordDevice(SDL_AudioDevice *device, void *buffer, int buflen)
|
|||
SDL_assert((buflen % frame_size) == 0);
|
||||
|
||||
const snd_pcm_sframes_t total_available = ALSA_snd_pcm_avail(device->hidden->pcm);
|
||||
const int total_frames = SDL_min(buflen / frame_size, total_available);
|
||||
if (total_available == 0) {
|
||||
return 0; // go back to WaitDevice and try again.
|
||||
}
|
||||
|
||||
const int total_frames = SDL_min(buflen / frame_size, total_available);
|
||||
const int rc = ALSA_snd_pcm_readi(device->hidden->pcm, buffer, total_frames);
|
||||
|
||||
SDL_assert(rc != -EAGAIN); // assuming this can't happen if we used snd_pcm_wait and queried for available space. snd_pcm_recover won't handle it!
|
||||
|
|
@ -671,7 +672,7 @@ static void swizzle_map_compute(const struct ALSA_pcm_cfg_ctx *ctx, int *swizzle
|
|||
static int alsa_chmap_install(struct ALSA_pcm_cfg_ctx *ctx, const unsigned int *chmap)
|
||||
{
|
||||
bool isstack;
|
||||
snd_pcm_chmap_t *chmap_to_install = (snd_pcm_chmap_t*)SDL_small_alloc(unsigned int, 1 + ctx->chans_n, &isstack);
|
||||
snd_pcm_chmap_t *chmap_to_install = (snd_pcm_chmap_t *)SDL_small_alloc(unsigned int, 1 + ctx->chans_n, &isstack);
|
||||
if (!chmap_to_install) {
|
||||
return -1;
|
||||
}
|
||||
|
|
@ -1156,7 +1157,7 @@ static bool ALSA_OpenDevice(SDL_AudioDevice *device)
|
|||
#if SDL_ALSA_DEBUG
|
||||
snd_pcm_uframes_t bufsize;
|
||||
ALSA_snd_pcm_hw_params_get_buffer_size(cfg_ctx.hwparams, &bufsize);
|
||||
SDL_LogError(SDL_LOG_CATEGORY_AUDIO,
|
||||
SDL_LogDebug(SDL_LOG_CATEGORY_AUDIO,
|
||||
"ALSA: period size = %ld, periods = %u, buffer size = %lu",
|
||||
cfg_ctx.persize, cfg_ctx.periods, bufsize);
|
||||
#endif
|
||||
|
|
@ -1215,7 +1216,7 @@ static int hotplug_device_process(snd_ctl_t *ctl, snd_ctl_card_info_t *ctl_card_
|
|||
unsigned int subdev_idx = 0;
|
||||
const bool recording = direction == SND_PCM_STREAM_CAPTURE ? true : false; // used for the unicity of the device
|
||||
bool isstack;
|
||||
snd_pcm_info_t *pcm_info = (snd_pcm_info_t*)SDL_small_alloc(Uint8, ALSA_snd_pcm_info_sizeof(), &isstack);
|
||||
snd_pcm_info_t *pcm_info = (snd_pcm_info_t *)SDL_small_alloc(Uint8, ALSA_snd_pcm_info_sizeof(), &isstack);
|
||||
SDL_memset(pcm_info, 0, ALSA_snd_pcm_info_sizeof());
|
||||
|
||||
while (true) {
|
||||
|
|
@ -1445,6 +1446,65 @@ static int SDLCALL ALSA_HotplugThread(void *arg)
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef SDL_USE_LIBUDEV
|
||||
|
||||
static bool udev_initialized;
|
||||
|
||||
static void ALSA_udev_callback(SDL_UDEV_deviceevent udev_type, int udev_class, const char *devpath)
|
||||
{
|
||||
if (!devpath) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch (udev_type) {
|
||||
case SDL_UDEV_DEVICEADDED:
|
||||
ALSA_HotplugIteration(NULL, NULL);
|
||||
break;
|
||||
|
||||
case SDL_UDEV_DEVICEREMOVED:
|
||||
ALSA_HotplugIteration(NULL, NULL);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static bool ALSA_start_udev()
|
||||
{
|
||||
udev_initialized = SDL_UDEV_Init();
|
||||
if (udev_initialized) {
|
||||
// Set up the udev callback
|
||||
if (!SDL_UDEV_AddCallback(ALSA_udev_callback)) {
|
||||
SDL_UDEV_Quit();
|
||||
udev_initialized = false;
|
||||
}
|
||||
}
|
||||
return udev_initialized;
|
||||
}
|
||||
|
||||
static void ALSA_stop_udev()
|
||||
{
|
||||
if (udev_initialized) {
|
||||
SDL_UDEV_DelCallback(ALSA_udev_callback);
|
||||
SDL_UDEV_Quit();
|
||||
udev_initialized = false;
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
static bool ALSA_start_udev()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
static void ALSA_stop_udev()
|
||||
{
|
||||
}
|
||||
|
||||
#endif // SDL_USE_LIBUDEV
|
||||
|
||||
static void ALSA_DetectDevices(SDL_AudioDevice **default_playback, SDL_AudioDevice **default_recording)
|
||||
{
|
||||
ALSA_guess_device_prefix();
|
||||
|
|
@ -1454,17 +1514,19 @@ static void ALSA_DetectDevices(SDL_AudioDevice **default_playback, SDL_AudioDevi
|
|||
bool has_default_playback = false, has_default_recording = false;
|
||||
ALSA_HotplugIteration(&has_default_playback, &has_default_recording); // run once now before a thread continues to check.
|
||||
if (has_default_playback) {
|
||||
*default_playback = SDL_AddAudioDevice(/*recording=*/false, "ALSA default playback device", NULL, (void*)&default_playback_handle);
|
||||
*default_playback = SDL_AddAudioDevice(/*recording=*/false, "ALSA default playback device", NULL, (void *)&default_playback_handle);
|
||||
}
|
||||
if (has_default_recording) {
|
||||
*default_recording = SDL_AddAudioDevice(/*recording=*/true, "ALSA default recording device", NULL, (void*)&default_recording_handle);
|
||||
*default_recording = SDL_AddAudioDevice(/*recording=*/true, "ALSA default recording device", NULL, (void *)&default_recording_handle);
|
||||
}
|
||||
|
||||
if (!ALSA_start_udev()) {
|
||||
#if SDL_ALSA_HOTPLUG_THREAD
|
||||
SDL_SetAtomicInt(&ALSA_hotplug_shutdown, 0);
|
||||
ALSA_hotplug_thread = SDL_CreateThread(ALSA_HotplugThread, "SDLHotplugALSA", NULL);
|
||||
// if the thread doesn't spin, oh well, you just don't get further hotplug events.
|
||||
SDL_SetAtomicInt(&ALSA_hotplug_shutdown, 0);
|
||||
ALSA_hotplug_thread = SDL_CreateThread(ALSA_HotplugThread, "SDLHotplugALSA", NULL);
|
||||
// if the thread doesn't spin, oh well, you just don't get further hotplug events.
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
static void ALSA_DeinitializeStart(void)
|
||||
|
|
@ -1479,6 +1541,7 @@ static void ALSA_DeinitializeStart(void)
|
|||
ALSA_hotplug_thread = NULL;
|
||||
}
|
||||
#endif
|
||||
ALSA_stop_udev();
|
||||
|
||||
// Shutting down! Clean up any data we've gathered.
|
||||
for (dev = hotplug_devices; dev; dev = next) {
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ static bool EMSCRIPTENAUDIO_PlayDevice(SDL_AudioDevice *device, const Uint8 *buf
|
|||
}
|
||||
|
||||
for (var j = 0; j < $1; ++j) {
|
||||
channelData[j] = HEAPF32[buf + (j*numChannels + c)];
|
||||
channelData[j] = HEAPF32[buf + (j * numChannels + c)];
|
||||
}
|
||||
}
|
||||
}, buffer, buffer_size / framelen);
|
||||
|
|
|
|||
|
|
@ -546,7 +546,7 @@ static void node_event_info(void *object, const struct pw_node_info *info)
|
|||
|
||||
// Need to parse the parameters to get the sample rate
|
||||
for (i = 0; i < info->n_params; ++i) {
|
||||
pw_node_enum_params((struct pw_node*)node->proxy, 0, info->params[i].id, 0, 0, NULL);
|
||||
pw_node_enum_params((struct pw_node *)node->proxy, 0, info->params[i].id, 0, 0, NULL);
|
||||
}
|
||||
|
||||
hotplug_core_sync(node);
|
||||
|
|
|
|||
|
|
@ -750,7 +750,7 @@ static bool mgmtthrtask_PrepDevice(void *userdata)
|
|||
// Try querying IAudioClient3 if sharemode is AUDCLNT_SHAREMODE_SHARED
|
||||
if (sharemode == AUDCLNT_SHAREMODE_SHARED) {
|
||||
IAudioClient3 *client3 = NULL;
|
||||
ret = IAudioClient_QueryInterface(client, &SDL_IID_IAudioClient3, (void**)&client3);
|
||||
ret = IAudioClient_QueryInterface(client, &SDL_IID_IAudioClient3, (void **)&client3);
|
||||
if (SUCCEEDED(ret)) {
|
||||
UINT32 default_period_in_frames = 0;
|
||||
UINT32 fundamental_period_in_frames = 0;
|
||||
|
|
|
|||
|
|
@ -239,7 +239,7 @@ static void COREMEDIA_CloseDevice(SDL_Camera *device)
|
|||
hidden.session = nil;
|
||||
[session stopRunning];
|
||||
[session removeInput:[session.inputs objectAtIndex:0]];
|
||||
[session removeOutput:(AVCaptureVideoDataOutput*)[session.outputs objectAtIndex:0]];
|
||||
[session removeOutput:(AVCaptureVideoDataOutput *)[session.outputs objectAtIndex:0]];
|
||||
session = nil;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -675,7 +675,7 @@ static HRESULT GetDefaultStride(IMFMediaType *pType, LONG *plStride)
|
|||
LONG lStride = 0;
|
||||
|
||||
// Try to get the default stride from the media type.
|
||||
HRESULT ret = IMFMediaType_GetUINT32(pType, &SDL_MF_MT_DEFAULT_STRIDE, (UINT32*)&lStride);
|
||||
HRESULT ret = IMFMediaType_GetUINT32(pType, &SDL_MF_MT_DEFAULT_STRIDE, (UINT32 *)&lStride);
|
||||
if (FAILED(ret)) {
|
||||
// Attribute not set. Try to calculate the default stride.
|
||||
|
||||
|
|
@ -1001,7 +1001,7 @@ static void MaybeAddDevice(IMFActivate *activation)
|
|||
if (name && symlink) {
|
||||
IMFMediaSource *source = NULL;
|
||||
// "activating" here only creates an object, it doesn't open the actual camera hardware or start recording.
|
||||
HRESULT ret = IMFActivate_ActivateObject(activation, &SDL_IID_IMFMediaSource, (void**)&source);
|
||||
HRESULT ret = IMFActivate_ActivateObject(activation, &SDL_IID_IMFMediaSource, (void **)&source);
|
||||
if (SUCCEEDED(ret) && source) {
|
||||
CameraFormatAddData add_data;
|
||||
GatherCameraSpecs(source, &add_data);
|
||||
|
|
|
|||
|
|
@ -838,7 +838,7 @@ static void node_event_info(void *object, const struct pw_node_info *info)
|
|||
if (!(info->params[i].flags & SPA_PARAM_INFO_READ))
|
||||
continue;
|
||||
|
||||
res = pw_node_enum_params((struct pw_node*)g->proxy,
|
||||
res = pw_node_enum_params((struct pw_node *)g->proxy,
|
||||
++SPA_PARAMS_INFO_SEQ(info->params[i]), id, 0, -1, NULL);
|
||||
if (SPA_RESULT_IS_ASYNC(res))
|
||||
SPA_PARAMS_INFO_SEQ(info->params[i]) = res;
|
||||
|
|
|
|||
|
|
@ -193,7 +193,7 @@ static SDL_CameraFrameResult V4L2_AcquireFrame(SDL_Camera *device, SDL_Surface *
|
|||
*timestampNS = (((Uint64) buf.timestamp.tv_sec) * SDL_NS_PER_SECOND) + SDL_US_TO_NS(buf.timestamp.tv_usec);
|
||||
|
||||
#if DEBUG_CAMERA
|
||||
SDL_Log("CAMERA: debug mmap: image %d/%d data[0]=%p", buf.index, device->hidden->nb_buffers, (void*)frame->pixels);
|
||||
SDL_Log("CAMERA: debug mmap: image %d/%d data[0]=%p", buf.index, device->hidden->nb_buffers, (void *)frame->pixels);
|
||||
#endif
|
||||
break;
|
||||
|
||||
|
|
@ -230,7 +230,7 @@ static SDL_CameraFrameResult V4L2_AcquireFrame(SDL_Camera *device, SDL_Surface *
|
|||
return SDL_CAMERA_FRAME_ERROR;
|
||||
}
|
||||
|
||||
frame->pixels = (void*)buf.m.userptr;
|
||||
frame->pixels = (void *)buf.m.userptr;
|
||||
if (device->hidden->driver_pitch) {
|
||||
frame->pitch = device->hidden->driver_pitch;
|
||||
} else {
|
||||
|
|
@ -241,7 +241,7 @@ static SDL_CameraFrameResult V4L2_AcquireFrame(SDL_Camera *device, SDL_Surface *
|
|||
*timestampNS = (((Uint64) buf.timestamp.tv_sec) * SDL_NS_PER_SECOND) + SDL_US_TO_NS(buf.timestamp.tv_usec);
|
||||
|
||||
#if DEBUG_CAMERA
|
||||
SDL_Log("CAMERA: debug userptr: image %d/%d data[0]=%p", buf.index, device->hidden->nb_buffers, (void*)frame->pixels);
|
||||
SDL_Log("CAMERA: debug userptr: image %d/%d data[0]=%p", buf.index, device->hidden->nb_buffers, (void *)frame->pixels);
|
||||
#endif
|
||||
break;
|
||||
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ static void MaybeAddDevice(Sint32 devid)
|
|||
GatherCameraSpecs(devid, &add_data, &fullname, &position);
|
||||
|
||||
if (add_data.num_specs > 0) {
|
||||
SDL_AddCamera(fullname, position, add_data.num_specs, add_data.specs, (void*)devid);
|
||||
SDL_AddCamera(fullname, position, add_data.num_specs, add_data.specs, (void *)devid);
|
||||
}
|
||||
|
||||
SDL_free(fullname);
|
||||
|
|
@ -102,7 +102,7 @@ static void MaybeAddDevice(Sint32 devid)
|
|||
|
||||
static SceUID imbUid = -1;
|
||||
|
||||
static void freeBuffers(SceCameraInfo* info)
|
||||
static void freeBuffers(SceCameraInfo *info)
|
||||
{
|
||||
if (imbUid != -1) {
|
||||
sceKernelFreeMemBlock(imbUid);
|
||||
|
|
@ -118,7 +118,7 @@ static bool VITACAMERA_OpenDevice(SDL_Camera *device, const SDL_CameraSpec *spec
|
|||
return SDL_SetError("Only one camera can be active");
|
||||
}
|
||||
|
||||
SceCameraInfo* info = (SceCameraInfo*)SDL_calloc(1, sizeof(SceCameraInfo));
|
||||
SceCameraInfo *info = (SceCameraInfo *)SDL_calloc(1, sizeof(SceCameraInfo));
|
||||
|
||||
info->size = sizeof(SceCameraInfo);
|
||||
info->priority = SCE_CAMERA_PRIORITY_SHARE;
|
||||
|
|
@ -139,12 +139,12 @@ static bool VITACAMERA_OpenDevice(SDL_Camera *device, const SDL_CameraSpec *spec
|
|||
info->format = SCE_CAMERA_FORMAT_YUV420_PLANE;
|
||||
info->pitch = 0; // same size surface
|
||||
|
||||
info->sizeIBase = spec->width*spec->height;;
|
||||
info->sizeIBase = spec->width * spec->height;;
|
||||
info->sizeUBase = ((spec->width+1)/2) * ((spec->height+1) / 2);
|
||||
info->sizeVBase = ((spec->width+1)/2) * ((spec->height+1) / 2);
|
||||
|
||||
// PHYCONT memory size *must* be a multiple of 1MB, we can just always spend 2MB, since we don't use PHYCONT anywhere else
|
||||
imbUid = sceKernelAllocMemBlock("CameraI", SCE_KERNEL_MEMBLOCK_TYPE_USER_MAIN_PHYCONT_NC_RW, 2*1024*1024 , NULL);
|
||||
imbUid = sceKernelAllocMemBlock("CameraI", SCE_KERNEL_MEMBLOCK_TYPE_USER_MAIN_PHYCONT_NC_RW, 2 * 1024 * 1024 , NULL);
|
||||
if (imbUid < 0)
|
||||
{
|
||||
return SDL_SetError("sceKernelAllocMemBlock error: 0x%08X", imbUid);
|
||||
|
|
@ -179,7 +179,7 @@ static void VITACAMERA_CloseDevice(SDL_Camera *device)
|
|||
if (device->hidden) {
|
||||
sceCameraStop((int)device->handle);
|
||||
sceCameraClose((int)device->handle);
|
||||
freeBuffers((SceCameraInfo*)device->hidden);
|
||||
freeBuffers((SceCameraInfo *)device->hidden);
|
||||
SDL_free(device->hidden);
|
||||
}
|
||||
}
|
||||
|
|
@ -205,7 +205,7 @@ static SDL_CameraFrameResult VITACAMERA_AcquireFrame(SDL_Camera *device, SDL_Sur
|
|||
|
||||
*timestampNS = read.timestamp;
|
||||
|
||||
SceCameraInfo* info = (SceCameraInfo*)(device->hidden);
|
||||
SceCameraInfo *info = (SceCameraInfo *)(device->hidden);
|
||||
|
||||
frame->pitch = info->width;
|
||||
frame->pixels = SDL_aligned_alloc(SDL_GetSIMDAlignment(), info->sizeIBase + info->sizeUBase + info->sizeVBase);
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@ void *SDL_GetAndroidActivity(void)
|
|||
}
|
||||
|
||||
SDL_DECLSPEC const char * SDLCALL SDL_GetAndroidCachePath(void);
|
||||
const char* SDL_GetAndroidCachePath(void)
|
||||
const char *SDL_GetAndroidCachePath(void)
|
||||
{
|
||||
SDL_Unsupported();
|
||||
return NULL;
|
||||
|
|
@ -127,7 +127,7 @@ const char* SDL_GetAndroidCachePath(void)
|
|||
|
||||
|
||||
SDL_DECLSPEC const char * SDLCALL SDL_GetAndroidExternalStoragePath(void);
|
||||
const char* SDL_GetAndroidExternalStoragePath(void)
|
||||
const char *SDL_GetAndroidExternalStoragePath(void)
|
||||
{
|
||||
SDL_Unsupported();
|
||||
return NULL;
|
||||
|
|
@ -172,7 +172,7 @@ bool SDL_SendAndroidMessage(Uint32 command, int param)
|
|||
}
|
||||
|
||||
SDL_DECLSPEC bool SDLCALL SDL_ShowAndroidToast(const char *message, int duration, int gravity, int xoffset, int yoffset);
|
||||
bool SDL_ShowAndroidToast(const char* message, int duration, int gravity, int xoffset, int yoffset)
|
||||
bool SDL_ShowAndroidToast(const char *message, int duration, int gravity, int xoffset, int yoffset)
|
||||
{
|
||||
(void)message;
|
||||
(void)duration;
|
||||
|
|
|
|||
|
|
@ -2691,7 +2691,7 @@ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeFileDialog)(
|
|||
|
||||
// Convert fileList to string
|
||||
size_t count = (*env)->GetArrayLength(env, fileList);
|
||||
char **charFileList = SDL_calloc(count + 1, sizeof(char*));
|
||||
char **charFileList = SDL_calloc(count + 1, sizeof(char *));
|
||||
|
||||
if (charFileList == NULL) {
|
||||
mAndroidFileDialogData.callback(mAndroidFileDialogData.userdata, NULL, -1);
|
||||
|
|
@ -2747,7 +2747,7 @@ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeFileDialog)(
|
|||
}
|
||||
|
||||
bool Android_JNI_OpenFileDialog(
|
||||
SDL_DialogFileCallback callback, void* userdata,
|
||||
SDL_DialogFileCallback callback, void *userdata,
|
||||
const SDL_DialogFileFilter *filters, int nfilters, bool forwrite,
|
||||
bool multiple)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -151,7 +151,7 @@ bool SDL_IsAndroidTablet(void);
|
|||
bool SDL_IsAndroidTV(void);
|
||||
|
||||
// File Dialogs
|
||||
bool Android_JNI_OpenFileDialog(SDL_DialogFileCallback callback, void* userdata,
|
||||
bool Android_JNI_OpenFileDialog(SDL_DialogFileCallback callback, void *userdata,
|
||||
const SDL_DialogFileFilter *filters, int nfilters, bool forwrite,
|
||||
bool multiple);
|
||||
|
||||
|
|
|
|||
|
|
@ -324,7 +324,7 @@ void SDL_EVDEV_kbd_set_muted(SDL_EVDEV_keyboard_state *state, bool muted)
|
|||
{
|
||||
}
|
||||
|
||||
void SDL_EVDEV_kbd_set_vt_switch_callbacks(SDL_EVDEV_keyboard_state *state, void (*release_callback)(void*), void *release_callback_data, void (*acquire_callback)(void*), void *acquire_callback_data)
|
||||
void SDL_EVDEV_kbd_set_vt_switch_callbacks(SDL_EVDEV_keyboard_state *state, void (*release_callback)(void *), void *release_callback_data, void (*acquire_callback)(void *), void *acquire_callback_data)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ extern "C" SDL_BLooper *SDL_Looper;
|
|||
class SDL_BLooper : public BLooper
|
||||
{
|
||||
public:
|
||||
SDL_BLooper(const char* name) : BLooper(name)
|
||||
SDL_BLooper(const char *name) : BLooper(name)
|
||||
{
|
||||
#ifdef SDL_VIDEO_OPENGL
|
||||
_current_context = NULL;
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ const char *SDL_signature = "application/x-SDL-executable";
|
|||
// Create a descendant of BApplication
|
||||
class SDL_BApp : public BApplication {
|
||||
public:
|
||||
SDL_BApp(const char* signature) :
|
||||
SDL_BApp(const char *signature) :
|
||||
BApplication(signature) {
|
||||
}
|
||||
|
||||
|
|
@ -65,7 +65,7 @@ public:
|
|||
}
|
||||
|
||||
|
||||
virtual void RefsReceived(BMessage* message) {
|
||||
virtual void RefsReceived(BMessage *message) {
|
||||
entry_ref entryRef;
|
||||
for (int32 i = 0; message->FindRef("refs", i, &entryRef) == B_OK; i++) {
|
||||
BPath referencePath = BPath(&entryRef);
|
||||
|
|
|
|||
|
|
@ -287,8 +287,8 @@ static void SDL_EVDEV_udev_callback(SDL_UDEV_deviceevent udev_event, int udev_cl
|
|||
}
|
||||
#endif // SDL_USE_LIBUDEV
|
||||
|
||||
void SDL_EVDEV_SetVTSwitchCallbacks(void (*release_callback)(void*), void *release_callback_data,
|
||||
void (*acquire_callback)(void*), void *acquire_callback_data)
|
||||
void SDL_EVDEV_SetVTSwitchCallbacks(void (*release_callback)(void *), void *release_callback_data,
|
||||
void (*acquire_callback)(void *), void *acquire_callback_data)
|
||||
{
|
||||
SDL_EVDEV_kbd_set_vt_switch_callbacks(_this->kbd,
|
||||
release_callback, release_callback_data,
|
||||
|
|
|
|||
|
|
@ -30,8 +30,8 @@ struct input_event;
|
|||
|
||||
extern bool SDL_EVDEV_Init(void);
|
||||
extern void SDL_EVDEV_Quit(void);
|
||||
extern void SDL_EVDEV_SetVTSwitchCallbacks(void (*release_callback)(void*), void *release_callback_data,
|
||||
void (*acquire_callback)(void*), void *acquire_callback_data);
|
||||
extern void SDL_EVDEV_SetVTSwitchCallbacks(void (*release_callback)(void *), void *release_callback_data,
|
||||
void (*acquire_callback)(void *), void *acquire_callback_data);
|
||||
extern int SDL_EVDEV_GetDeviceCount(int device_class);
|
||||
extern void SDL_EVDEV_Poll(void);
|
||||
extern Uint64 SDL_EVDEV_GetEventTimestamp(struct input_event *event);
|
||||
|
|
|
|||
|
|
@ -495,7 +495,7 @@ void SDL_EVDEV_kbd_set_muted(SDL_EVDEV_keyboard_state *state, bool muted)
|
|||
state->muted = muted;
|
||||
}
|
||||
|
||||
void SDL_EVDEV_kbd_set_vt_switch_callbacks(SDL_EVDEV_keyboard_state *state, void (*release_callback)(void*), void *release_callback_data, void (*acquire_callback)(void*), void *acquire_callback_data)
|
||||
void SDL_EVDEV_kbd_set_vt_switch_callbacks(SDL_EVDEV_keyboard_state *state, void (*release_callback)(void *), void *release_callback_data, void (*acquire_callback)(void *), void *acquire_callback_data)
|
||||
{
|
||||
if (state == NULL) {
|
||||
return;
|
||||
|
|
@ -978,7 +978,7 @@ void SDL_EVDEV_kbd_set_muted(SDL_EVDEV_keyboard_state *state, bool muted)
|
|||
{
|
||||
}
|
||||
|
||||
void SDL_EVDEV_kbd_set_vt_switch_callbacks(SDL_EVDEV_keyboard_state *state, void (*release_callback)(void*), void *release_callback_data, void (*acquire_callback)(void*), void *acquire_callback_data)
|
||||
void SDL_EVDEV_kbd_set_vt_switch_callbacks(SDL_EVDEV_keyboard_state *state, void (*release_callback)(void *), void *release_callback_data, void (*acquire_callback)(void *), void *acquire_callback_data)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ typedef struct SDL_EVDEV_keyboard_state SDL_EVDEV_keyboard_state;
|
|||
|
||||
extern SDL_EVDEV_keyboard_state *SDL_EVDEV_kbd_init(void);
|
||||
extern void SDL_EVDEV_kbd_set_muted(SDL_EVDEV_keyboard_state *state, bool muted);
|
||||
extern void SDL_EVDEV_kbd_set_vt_switch_callbacks(SDL_EVDEV_keyboard_state *state, void (*release_callback)(void*), void *release_callback_data, void (*acquire_callback)(void*), void *acquire_callback_data);
|
||||
extern void SDL_EVDEV_kbd_set_vt_switch_callbacks(SDL_EVDEV_keyboard_state *state, void (*release_callback)(void *), void *release_callback_data, void (*acquire_callback)(void *), void *acquire_callback_data);
|
||||
extern void SDL_EVDEV_kbd_update(SDL_EVDEV_keyboard_state *state);
|
||||
extern void SDL_EVDEV_kbd_keycode(SDL_EVDEV_keyboard_state *state, unsigned int keycode, int down);
|
||||
extern void SDL_EVDEV_kbd_quit(SDL_EVDEV_keyboard_state *state);
|
||||
|
|
|
|||
|
|
@ -224,7 +224,7 @@ bool SDL_UDEV_GetProductInfo(const char *device_path, Uint16 *vendor, Uint16 *pr
|
|||
struct stat statbuf;
|
||||
char type;
|
||||
struct udev_device *dev;
|
||||
const char* val;
|
||||
const char *val;
|
||||
int class_temp;
|
||||
|
||||
if (!_this) {
|
||||
|
|
|
|||
|
|
@ -58,13 +58,13 @@ static void ReactivateAfterDialog(void)
|
|||
|
||||
void SDL_SYS_ShowFileDialogWithProperties(SDL_FileDialogType type, SDL_DialogFileCallback callback, void *userdata, SDL_PropertiesID props)
|
||||
{
|
||||
SDL_Window* window = SDL_GetPointerProperty(props, SDL_PROP_FILE_DIALOG_WINDOW_POINTER, NULL);
|
||||
SDL_Window *window = SDL_GetPointerProperty(props, SDL_PROP_FILE_DIALOG_WINDOW_POINTER, NULL);
|
||||
SDL_DialogFileFilter *filters = SDL_GetPointerProperty(props, SDL_PROP_FILE_DIALOG_FILTERS_POINTER, NULL);
|
||||
int nfilters = (int) SDL_GetNumberProperty(props, SDL_PROP_FILE_DIALOG_NFILTERS_NUMBER, 0);
|
||||
bool allow_many = SDL_GetBooleanProperty(props, SDL_PROP_FILE_DIALOG_MANY_BOOLEAN, false);
|
||||
const char* default_location = SDL_GetStringProperty(props, SDL_PROP_FILE_DIALOG_LOCATION_STRING, NULL);
|
||||
const char* title = SDL_GetStringProperty(props, SDL_PROP_FILE_DIALOG_TITLE_STRING, NULL);
|
||||
const char* accept = SDL_GetStringProperty(props, SDL_PROP_FILE_DIALOG_ACCEPT_STRING, NULL);
|
||||
const char *default_location = SDL_GetStringProperty(props, SDL_PROP_FILE_DIALOG_LOCATION_STRING, NULL);
|
||||
const char *title = SDL_GetStringProperty(props, SDL_PROP_FILE_DIALOG_TITLE_STRING, NULL);
|
||||
const char *accept = SDL_GetStringProperty(props, SDL_PROP_FILE_DIALOG_ACCEPT_STRING, NULL);
|
||||
|
||||
if (filters) {
|
||||
const char *msg = validate_filters(filters, nfilters);
|
||||
|
|
@ -170,7 +170,7 @@ void SDL_SYS_ShowFileDialogWithProperties(SDL_FileDialogType type, SDL_DialogFil
|
|||
[dialog beginSheetModalForWindow:w completionHandler:^(NSInteger result) {
|
||||
if (result == NSModalResponseOK) {
|
||||
if (dialog_as_open) {
|
||||
NSArray* urls = [dialog_as_open URLs];
|
||||
NSArray *urls = [dialog_as_open URLs];
|
||||
const char *files[[urls count] + 1];
|
||||
for (int i = 0; i < [urls count]; i++) {
|
||||
files[i] = [[[urls objectAtIndex:i] path] UTF8String];
|
||||
|
|
@ -191,7 +191,7 @@ void SDL_SYS_ShowFileDialogWithProperties(SDL_FileDialogType type, SDL_DialogFil
|
|||
} else {
|
||||
if ([dialog runModal] == NSModalResponseOK) {
|
||||
if (dialog_as_open) {
|
||||
NSArray* urls = [dialog_as_open URLs];
|
||||
NSArray *urls = [dialog_as_open URLs];
|
||||
const char *files[[urls count] + 1];
|
||||
for (int i = 0; i < [urls count]; i++) {
|
||||
files[i] = [[[urls objectAtIndex:i] path] UTF8String];
|
||||
|
|
|
|||
|
|
@ -163,7 +163,7 @@ public:
|
|||
case B_CANCEL: // Whenever the dialog is closed (Cancel but also after Open and Save)
|
||||
{
|
||||
nFiles = m_files.size();
|
||||
const char* files[nFiles + 1];
|
||||
const char *files[nFiles + 1];
|
||||
for (int i = 0; i < nFiles; i++) {
|
||||
files[i] = m_files[i].c_str();
|
||||
}
|
||||
|
|
@ -194,14 +194,14 @@ private:
|
|||
|
||||
void SDL_SYS_ShowFileDialogWithProperties(SDL_FileDialogType type, SDL_DialogFileCallback callback, void *userdata, SDL_PropertiesID props)
|
||||
{
|
||||
SDL_Window* window = (SDL_Window*) SDL_GetPointerProperty(props, SDL_PROP_FILE_DIALOG_WINDOW_POINTER, NULL);
|
||||
SDL_DialogFileFilter* filters = (SDL_DialogFileFilter*) SDL_GetPointerProperty(props, SDL_PROP_FILE_DIALOG_FILTERS_POINTER, NULL);
|
||||
SDL_Window *window = (SDL_Window *)SDL_GetPointerProperty(props, SDL_PROP_FILE_DIALOG_WINDOW_POINTER, NULL);
|
||||
SDL_DialogFileFilter *filters = (SDL_DialogFileFilter *)SDL_GetPointerProperty(props, SDL_PROP_FILE_DIALOG_FILTERS_POINTER, NULL);
|
||||
int nfilters = (int) SDL_GetNumberProperty(props, SDL_PROP_FILE_DIALOG_NFILTERS_NUMBER, 0);
|
||||
bool many = SDL_GetBooleanProperty(props, SDL_PROP_FILE_DIALOG_MANY_BOOLEAN, false);
|
||||
const char* location = SDL_GetStringProperty(props, SDL_PROP_FILE_DIALOG_LOCATION_STRING, NULL);
|
||||
const char* title = SDL_GetStringProperty(props, SDL_PROP_FILE_DIALOG_TITLE_STRING, NULL);
|
||||
const char* accept = SDL_GetStringProperty(props, SDL_PROP_FILE_DIALOG_ACCEPT_STRING, NULL);
|
||||
const char* cancel = SDL_GetStringProperty(props, SDL_PROP_FILE_DIALOG_CANCEL_STRING, NULL);
|
||||
const char *location = SDL_GetStringProperty(props, SDL_PROP_FILE_DIALOG_LOCATION_STRING, NULL);
|
||||
const char *title = SDL_GetStringProperty(props, SDL_PROP_FILE_DIALOG_TITLE_STRING, NULL);
|
||||
const char *accept = SDL_GetStringProperty(props, SDL_PROP_FILE_DIALOG_ACCEPT_STRING, NULL);
|
||||
const char *cancel = SDL_GetStringProperty(props, SDL_PROP_FILE_DIALOG_CANCEL_STRING, NULL);
|
||||
|
||||
bool modal = !!window;
|
||||
|
||||
|
|
@ -222,7 +222,7 @@ void SDL_SYS_ShowFileDialogWithProperties(SDL_FileDialogType type, SDL_DialogFil
|
|||
};
|
||||
|
||||
if (!SDL_InitBeApp()) {
|
||||
char* err = SDL_strdup(SDL_GetError());
|
||||
char *err = SDL_strdup(SDL_GetError());
|
||||
SDL_SetError("Couldn't init Be app: %s", err);
|
||||
SDL_free(err);
|
||||
callback(userdata, NULL, -1);
|
||||
|
|
|
|||
|
|
@ -288,12 +288,12 @@ void SDL_Portal_ShowFileDialogWithProperties(SDL_FileDialogType type, SDL_Dialog
|
|||
const char *method;
|
||||
const char *method_title;
|
||||
|
||||
SDL_Window* window = SDL_GetPointerProperty(props, SDL_PROP_FILE_DIALOG_WINDOW_POINTER, NULL);
|
||||
SDL_Window *window = SDL_GetPointerProperty(props, SDL_PROP_FILE_DIALOG_WINDOW_POINTER, NULL);
|
||||
SDL_DialogFileFilter *filters = SDL_GetPointerProperty(props, SDL_PROP_FILE_DIALOG_FILTERS_POINTER, NULL);
|
||||
int nfilters = (int) SDL_GetNumberProperty(props, SDL_PROP_FILE_DIALOG_NFILTERS_NUMBER, 0);
|
||||
bool allow_many = SDL_GetBooleanProperty(props, SDL_PROP_FILE_DIALOG_MANY_BOOLEAN, false);
|
||||
const char* default_location = SDL_GetStringProperty(props, SDL_PROP_FILE_DIALOG_LOCATION_STRING, NULL);
|
||||
const char* accept = SDL_GetStringProperty(props, SDL_PROP_FILE_DIALOG_ACCEPT_STRING, NULL);
|
||||
const char *default_location = SDL_GetStringProperty(props, SDL_PROP_FILE_DIALOG_LOCATION_STRING, NULL);
|
||||
const char *accept = SDL_GetStringProperty(props, SDL_PROP_FILE_DIALOG_ACCEPT_STRING, NULL);
|
||||
bool open_folders = false;
|
||||
|
||||
switch (type) {
|
||||
|
|
|
|||
|
|
@ -277,7 +277,7 @@ void windows_ShowFileDialog(void *ptr)
|
|||
|
||||
while (*file_ptr) {
|
||||
nfiles++;
|
||||
char **new_cfl = (char **) SDL_realloc(chosen_files_list, sizeof(char*) * (nfiles + 1));
|
||||
char **new_cfl = (char **) SDL_realloc(chosen_files_list, sizeof(char *) * (nfiles + 1));
|
||||
|
||||
if (!new_cfl) {
|
||||
for (size_t i = 0; i < nfiles - 1; i++) {
|
||||
|
|
@ -327,7 +327,7 @@ void windows_ShowFileDialog(void *ptr)
|
|||
// If the user chose only one file, it's all just one string
|
||||
if (nfiles == 0) {
|
||||
nfiles++;
|
||||
char **new_cfl = (char **) SDL_realloc(chosen_files_list, sizeof(char*) * (nfiles + 1));
|
||||
char **new_cfl = (char **) SDL_realloc(chosen_files_list, sizeof(char *) * (nfiles + 1));
|
||||
|
||||
if (!new_cfl) {
|
||||
SDL_free(chosen_files_list);
|
||||
|
|
@ -348,7 +348,7 @@ void windows_ShowFileDialog(void *ptr)
|
|||
}
|
||||
}
|
||||
|
||||
callback(userdata, (const char * const*) chosen_files_list, getFilterIndex(dialog.nFilterIndex));
|
||||
callback(userdata, (const char * const *) chosen_files_list, getFilterIndex(dialog.nFilterIndex));
|
||||
|
||||
for (size_t i = 0; i < nfiles; i++) {
|
||||
SDL_free(chosen_files_list[i]);
|
||||
|
|
@ -443,11 +443,11 @@ void windows_ShowFolderDialog(void *ptr)
|
|||
SHGetPathFromIDListW(lpItem, buffer);
|
||||
char *chosen_file = WIN_StringToUTF8W(buffer);
|
||||
const char *files[2] = { chosen_file, NULL };
|
||||
callback(userdata, (const char * const*) files, -1);
|
||||
callback(userdata, (const char * const *) files, -1);
|
||||
SDL_free(chosen_file);
|
||||
} else {
|
||||
const char *files[1] = { NULL };
|
||||
callback(userdata, (const char * const*) files, -1);
|
||||
callback(userdata, (const char * const *) files, -1);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -371,10 +371,10 @@ static const SDL_Scancode xfree86_scancode_table2[] = {
|
|||
/* 188, 0x0bc */ SDL_SCANCODE_F18, // XF86Launch9
|
||||
/* 189, 0x0bd */ SDL_SCANCODE_F19, // NoSymbol
|
||||
/* 190, 0x0be */ SDL_SCANCODE_F20, // XF86AudioMicMute
|
||||
/* 191, 0x0bf */ SDL_SCANCODE_UNKNOWN, // XF86TouchpadToggle
|
||||
/* 192, 0x0c0 */ SDL_SCANCODE_UNKNOWN, // XF86TouchpadOn
|
||||
/* 193, 0x0c1 */ SDL_SCANCODE_UNKNOWN, // XF86TouchpadOff
|
||||
/* 194, 0x0c2 */ SDL_SCANCODE_UNKNOWN, // NoSymbol
|
||||
/* 191, 0x0bf */ SDL_SCANCODE_F21, // XF86TouchpadToggle
|
||||
/* 192, 0x0c0 */ SDL_SCANCODE_F22, // XF86TouchpadOn
|
||||
/* 193, 0x0c1 */ SDL_SCANCODE_F23, // XF86TouchpadOff
|
||||
/* 194, 0x0c2 */ SDL_SCANCODE_F24, // NoSymbol
|
||||
/* 195, 0x0c3 */ SDL_SCANCODE_MODE, // Mode_switch
|
||||
/* 196, 0x0c4 */ SDL_SCANCODE_UNKNOWN, // NoSymbol
|
||||
/* 197, 0x0c5 */ SDL_SCANCODE_UNKNOWN, // NoSymbol
|
||||
|
|
|
|||
|
|
@ -136,7 +136,7 @@ char *SDL_SYS_GetUserFolder(SDL_Folder folder)
|
|||
return NULL;
|
||||
#else
|
||||
char *result = NULL;
|
||||
const char* base;
|
||||
const char *base;
|
||||
NSArray *array;
|
||||
NSSearchPathDirectory dir;
|
||||
NSString *str;
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ char *SDL_SYS_GetPrefPath(const char *org, const char *app)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
folderPath = (char*) SDL_malloc(MAX_PATH);
|
||||
folderPath = (char *)SDL_malloc(MAX_PATH);
|
||||
do {
|
||||
result = XGameSaveFilesGetFolderWithUiResult(&block, MAX_PATH, folderPath);
|
||||
} while (result == E_PENDING);
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
*/
|
||||
#include "SDL_internal.h"
|
||||
|
||||
extern void NGAGE_GetAppPath(char* path);
|
||||
extern void NGAGE_GetAppPath(char *path);
|
||||
|
||||
char *SDL_SYS_GetBasePath(void)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ extern "C" {
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
void NGAGE_GetAppPath(char* path)
|
||||
void NGAGE_GetAppPath(char *path)
|
||||
{
|
||||
TBuf<512> aPath;
|
||||
|
||||
|
|
@ -50,7 +50,7 @@ void NGAGE_GetAppPath(char* path)
|
|||
CnvUtfConverter::ConvertFromUnicodeToUtf8(utf8Path, aPath);
|
||||
|
||||
// Copy UTF-8 data to the provided char* buffer.
|
||||
strncpy(path, (const char*)utf8Path.Ptr(), utf8Path.Length());
|
||||
strncpy(path, (const char *)utf8Path.Ptr(), utf8Path.Length());
|
||||
path[utf8Path.Length()] = '\0';
|
||||
|
||||
// Replace backslashes with forward slashes.
|
||||
|
|
|
|||
|
|
@ -377,7 +377,7 @@ static char *xdg_user_dir_lookup_with_fallback (const char *type, const char *fa
|
|||
if (!config_home || config_home[0] == 0)
|
||||
{
|
||||
l = SDL_strlen (home_dir) + SDL_strlen ("/.config/user-dirs.dirs") + 1;
|
||||
config_file = (char*) SDL_malloc (l);
|
||||
config_file = (char *)SDL_malloc (l);
|
||||
if (!config_file)
|
||||
goto error;
|
||||
|
||||
|
|
@ -387,7 +387,7 @@ static char *xdg_user_dir_lookup_with_fallback (const char *type, const char *fa
|
|||
else
|
||||
{
|
||||
l = SDL_strlen (config_home) + SDL_strlen ("/user-dirs.dirs") + 1;
|
||||
config_file = (char*) SDL_malloc (l);
|
||||
config_file = (char *)SDL_malloc (l);
|
||||
if (!config_file)
|
||||
goto error;
|
||||
|
||||
|
|
@ -449,7 +449,7 @@ static char *xdg_user_dir_lookup_with_fallback (const char *type, const char *fa
|
|||
if (relative)
|
||||
{
|
||||
l = SDL_strlen (home_dir) + 1 + SDL_strlen (p) + 1;
|
||||
user_dir = (char*) SDL_malloc (l);
|
||||
user_dir = (char *)SDL_malloc (l);
|
||||
if (!user_dir)
|
||||
goto error2;
|
||||
|
||||
|
|
@ -458,7 +458,7 @@ static char *xdg_user_dir_lookup_with_fallback (const char *type, const char *fa
|
|||
}
|
||||
else
|
||||
{
|
||||
user_dir = (char*) SDL_malloc (SDL_strlen (p) + 1);
|
||||
user_dir = (char *)SDL_malloc (SDL_strlen (p) + 1);
|
||||
if (!user_dir)
|
||||
goto error2;
|
||||
|
||||
|
|
@ -503,7 +503,7 @@ static char *xdg_user_dir_lookup (const char *type)
|
|||
// Special case desktop for historical compatibility
|
||||
if (SDL_strcmp(type, "DESKTOP") == 0) {
|
||||
size_t length = SDL_strlen(home_dir) + SDL_strlen("/Desktop") + 1;
|
||||
user_dir = (char*) SDL_malloc(length);
|
||||
user_dir = (char *)SDL_malloc(length);
|
||||
if (!user_dir)
|
||||
return NULL;
|
||||
|
||||
|
|
|
|||
|
|
@ -1954,7 +1954,7 @@ void SDL_BindGPUVertexSamplers(
|
|||
if (RENDERPASS_DEVICE->debug_mode) {
|
||||
CHECK_RENDERPASS
|
||||
|
||||
if (!((CommandBufferCommonHeader*)RENDERPASS_COMMAND_BUFFER)->ignore_render_pass_texture_validation)
|
||||
if (!((CommandBufferCommonHeader *)RENDERPASS_COMMAND_BUFFER)->ignore_render_pass_texture_validation)
|
||||
{
|
||||
CHECK_SAMPLER_TEXTURES
|
||||
}
|
||||
|
|
@ -2050,7 +2050,7 @@ void SDL_BindGPUFragmentSamplers(
|
|||
if (RENDERPASS_DEVICE->debug_mode) {
|
||||
CHECK_RENDERPASS
|
||||
|
||||
if (!((CommandBufferCommonHeader*)RENDERPASS_COMMAND_BUFFER)->ignore_render_pass_texture_validation) {
|
||||
if (!((CommandBufferCommonHeader *)RENDERPASS_COMMAND_BUFFER)->ignore_render_pass_texture_validation) {
|
||||
CHECK_SAMPLER_TEXTURES
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1210,7 +1210,7 @@ static ID3D12CommandQueue *s_CommandQueue;
|
|||
|
||||
#if defined(SDL_PLATFORM_XBOXONE)
|
||||
// These are not defined in d3d12_x.h.
|
||||
typedef HRESULT (D3DAPI* PFN_D3D12_XBOX_CREATE_DEVICE)(_In_opt_ IGraphicsUnknown*, _In_ const D3D12XBOX_CREATE_DEVICE_PARAMETERS*, _In_ REFIID, _Outptr_opt_ void**);
|
||||
typedef HRESULT (D3DAPI* PFN_D3D12_XBOX_CREATE_DEVICE)(_In_opt_ IGraphicsUnknown *, _In_ const D3D12XBOX_CREATE_DEVICE_PARAMETERS*, _In_ REFIID, _Outptr_opt_ void **);
|
||||
#define D3D12_STANDARD_MULTISAMPLE_PATTERN DXGI_STANDARD_MULTISAMPLE_QUALITY_PATTERN
|
||||
#endif
|
||||
|
||||
|
|
@ -2212,15 +2212,15 @@ static D3D12StagingDescriptorPool *D3D12_INTERNAL_CreateStagingDescriptorPool(
|
|||
return NULL;
|
||||
}
|
||||
|
||||
D3D12StagingDescriptorPool *pool = (D3D12StagingDescriptorPool*) SDL_calloc(1, sizeof(D3D12StagingDescriptorPool));
|
||||
D3D12StagingDescriptorPool *pool = (D3D12StagingDescriptorPool *)SDL_calloc(1, sizeof(D3D12StagingDescriptorPool));
|
||||
|
||||
pool->heapCount = 1;
|
||||
pool->heaps = (D3D12DescriptorHeap**) SDL_malloc(sizeof(D3D12DescriptorHeap*));
|
||||
pool->heaps = (D3D12DescriptorHeap **)SDL_malloc(sizeof(D3D12DescriptorHeap *));
|
||||
pool->heaps[0] = heap;
|
||||
|
||||
pool->freeDescriptorCapacity = STAGING_HEAP_DESCRIPTOR_COUNT;
|
||||
pool->freeDescriptorCount = STAGING_HEAP_DESCRIPTOR_COUNT;
|
||||
pool->freeDescriptors = (D3D12StagingDescriptor*) SDL_malloc(STAGING_HEAP_DESCRIPTOR_COUNT * sizeof(D3D12StagingDescriptor));
|
||||
pool->freeDescriptors = (D3D12StagingDescriptor *)SDL_malloc(STAGING_HEAP_DESCRIPTOR_COUNT * sizeof(D3D12StagingDescriptor));
|
||||
|
||||
for (Uint32 i = 0; i < STAGING_HEAP_DESCRIPTOR_COUNT; i += 1) {
|
||||
pool->freeDescriptors[i].pool = pool;
|
||||
|
|
@ -2250,12 +2250,12 @@ static bool D3D12_INTERNAL_ExpandStagingDescriptorPool(
|
|||
}
|
||||
|
||||
pool->heapCount += 1;
|
||||
pool->heaps = (D3D12DescriptorHeap**) SDL_realloc(pool->heaps, pool->heapCount * sizeof(D3D12DescriptorHeap*));
|
||||
pool->heaps = (D3D12DescriptorHeap **)SDL_realloc(pool->heaps, pool->heapCount * sizeof(D3D12DescriptorHeap *));
|
||||
pool->heaps[pool->heapCount - 1] = heap;
|
||||
|
||||
pool->freeDescriptorCapacity += STAGING_HEAP_DESCRIPTOR_COUNT;
|
||||
pool->freeDescriptorCount += STAGING_HEAP_DESCRIPTOR_COUNT;
|
||||
pool->freeDescriptors = (D3D12StagingDescriptor*) SDL_realloc(pool->freeDescriptors, pool->freeDescriptorCapacity * sizeof(D3D12StagingDescriptor));
|
||||
pool->freeDescriptors = (D3D12StagingDescriptor *)SDL_realloc(pool->freeDescriptors, pool->freeDescriptorCapacity * sizeof(D3D12StagingDescriptor));
|
||||
|
||||
for (Uint32 i = 0; i < STAGING_HEAP_DESCRIPTOR_COUNT; i += 1) {
|
||||
pool->freeDescriptors[i].pool = pool;
|
||||
|
|
@ -7521,7 +7521,7 @@ static bool D3D12_INTERNAL_AcquireSwapchainTexture(
|
|||
1,
|
||||
&barrierDesc);
|
||||
|
||||
*swapchainTexture = (SDL_GPUTexture*)&windowData->textureContainers[swapchainIndex];
|
||||
*swapchainTexture = (SDL_GPUTexture *)&windowData->textureContainers[swapchainIndex];
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -7933,7 +7933,7 @@ static bool D3D12_Submit(
|
|||
ID3D12Resource_Release(windowData->textureContainers[presentData->swapchainImageIndex].activeTexture->resource);
|
||||
#endif
|
||||
|
||||
windowData->inFlightFences[windowData->frameCounter] = (SDL_GPUFence*)d3d12CommandBuffer->inFlightFence;
|
||||
windowData->inFlightFences[windowData->frameCounter] = (SDL_GPUFence *)d3d12CommandBuffer->inFlightFence;
|
||||
(void)SDL_AtomicIncRef(&d3d12CommandBuffer->inFlightFence->referenceCount);
|
||||
windowData->frameCounter = (windowData->frameCounter + 1) % renderer->allowedFramesInFlight;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3297,7 +3297,7 @@ static void SDLCALL VULKAN_INTERNAL_GraphicsPipelineResourceLayoutHashDestroy(vo
|
|||
VulkanRenderer *renderer = (VulkanRenderer *)userdata;
|
||||
VulkanGraphicsPipelineResourceLayout *resourceLayout = (VulkanGraphicsPipelineResourceLayout *)value;
|
||||
VULKAN_INTERNAL_DestroyGraphicsPipelineResourceLayout(renderer, resourceLayout);
|
||||
SDL_free((void*)key);
|
||||
SDL_free((void *)key);
|
||||
}
|
||||
|
||||
static Uint32 SDLCALL VULKAN_INTERNAL_ComputePipelineResourceLayoutHashFunction(void *userdata, const void *key)
|
||||
|
|
@ -3328,7 +3328,7 @@ static void SDLCALL VULKAN_INTERNAL_ComputePipelineResourceLayoutHashDestroy(voi
|
|||
VulkanRenderer *renderer = (VulkanRenderer *)userdata;
|
||||
VulkanComputePipelineResourceLayout *resourceLayout = (VulkanComputePipelineResourceLayout *)value;
|
||||
VULKAN_INTERNAL_DestroyComputePipelineResourceLayout(renderer, resourceLayout);
|
||||
SDL_free((void*)key);
|
||||
SDL_free((void *)key);
|
||||
}
|
||||
|
||||
static Uint32 SDLCALL VULKAN_INTERNAL_DescriptorSetLayoutHashFunction(void *userdata, const void *key)
|
||||
|
|
@ -3361,7 +3361,7 @@ static void SDLCALL VULKAN_INTERNAL_DescriptorSetLayoutHashDestroy(void *userdat
|
|||
VulkanRenderer *renderer = (VulkanRenderer *)userdata;
|
||||
DescriptorSetLayout *layout = (DescriptorSetLayout *)value;
|
||||
VULKAN_INTERNAL_DestroyDescriptorSetLayout(renderer, layout);
|
||||
SDL_free((void*)key);
|
||||
SDL_free((void *)key);
|
||||
}
|
||||
|
||||
static Uint32 SDLCALL VULKAN_INTERNAL_CommandPoolHashFunction(void *userdata, const void *key)
|
||||
|
|
@ -10111,7 +10111,7 @@ static SDL_GPUTextureFormat VULKAN_GetSwapchainTextureFormat(
|
|||
SDL_GPURenderer *driverData,
|
||||
SDL_Window *window)
|
||||
{
|
||||
VulkanRenderer *renderer = (VulkanRenderer*)driverData;
|
||||
VulkanRenderer *renderer = (VulkanRenderer *)driverData;
|
||||
WindowData *windowData = VULKAN_INTERNAL_FetchWindowData(window);
|
||||
|
||||
if (windowData == NULL) {
|
||||
|
|
@ -10622,7 +10622,7 @@ static bool VULKAN_Submit(
|
|||
|
||||
if (presentResult == VK_SUCCESS || presentResult == VK_SUBOPTIMAL_KHR || presentResult == VK_ERROR_OUT_OF_DATE_KHR) {
|
||||
// If presenting, the swapchain is using the in-flight fence
|
||||
presentData->windowData->inFlightFences[presentData->windowData->frameCounter] = (SDL_GPUFence*)vulkanCommandBuffer->inFlightFence;
|
||||
presentData->windowData->inFlightFences[presentData->windowData->frameCounter] = (SDL_GPUFence *)vulkanCommandBuffer->inFlightFence;
|
||||
(void)SDL_AtomicIncRef(&vulkanCommandBuffer->inFlightFence->referenceCount);
|
||||
|
||||
if (presentResult == VK_SUBOPTIMAL_KHR || presentResult == VK_ERROR_OUT_OF_DATE_KHR) {
|
||||
|
|
|
|||
|
|
@ -319,7 +319,7 @@ private:
|
|||
hid_buffer_entry *m_pFree;
|
||||
};
|
||||
|
||||
static jbyteArray NewByteArray( JNIEnv* env, const uint8_t *pData, size_t nDataLen )
|
||||
static jbyteArray NewByteArray( JNIEnv *env, const uint8_t *pData, size_t nDataLen )
|
||||
{
|
||||
jbyteArray array = env->NewByteArray( (jsize)nDataLen );
|
||||
jbyte *pBuf = env->GetByteArrayElements( array, NULL );
|
||||
|
|
@ -333,7 +333,7 @@ static char *CreateStringFromJString( JNIEnv *env, const jstring &sString )
|
|||
{
|
||||
size_t nLength = env->GetStringUTFLength( sString );
|
||||
const char *pjChars = env->GetStringUTFChars( sString, NULL );
|
||||
char *psString = (char*)malloc( nLength + 1 );
|
||||
char *psString = (char *)malloc( nLength + 1 );
|
||||
SDL_memcpy( psString, pjChars, nLength );
|
||||
psString[ nLength ] = '\0';
|
||||
env->ReleaseStringUTFChars( sString, pjChars );
|
||||
|
|
@ -344,7 +344,7 @@ static wchar_t *CreateWStringFromJString( JNIEnv *env, const jstring &sString )
|
|||
{
|
||||
size_t nLength = env->GetStringLength( sString );
|
||||
const jchar *pjChars = env->GetStringChars( sString, NULL );
|
||||
wchar_t *pwString = (wchar_t*)malloc( ( nLength + 1 ) * sizeof( wchar_t ) );
|
||||
wchar_t *pwString = (wchar_t *)malloc( ( nLength + 1 ) * sizeof( wchar_t ) );
|
||||
wchar_t *pwChars = pwString;
|
||||
for ( size_t iIndex = 0; iIndex < nLength; ++iIndex )
|
||||
{
|
||||
|
|
@ -358,7 +358,7 @@ static wchar_t *CreateWStringFromJString( JNIEnv *env, const jstring &sString )
|
|||
static wchar_t *CreateWStringFromWString( const wchar_t *pwSrc )
|
||||
{
|
||||
size_t nLength = SDL_wcslen( pwSrc );
|
||||
wchar_t *pwString = (wchar_t*)malloc( ( nLength + 1 ) * sizeof( wchar_t ) );
|
||||
wchar_t *pwString = (wchar_t *)malloc( ( nLength + 1 ) * sizeof( wchar_t ) );
|
||||
SDL_memcpy( pwString, pwSrc, nLength * sizeof( wchar_t ) );
|
||||
pwString[ nLength ] = '\0';
|
||||
return pwString;
|
||||
|
|
@ -997,7 +997,7 @@ JNIEXPORT void JNICALL HID_DEVICE_MANAGER_JAVA_INTERFACE(HIDDeviceInputReport)(J
|
|||
hid_device_ref<CHIDDevice> pDevice = FindDevice( nDeviceID );
|
||||
if ( pDevice )
|
||||
{
|
||||
pDevice->ProcessInput( reinterpret_cast< const uint8_t* >( pBuf ), nBufSize );
|
||||
pDevice->ProcessInput( reinterpret_cast< const uint8_t * >( pBuf ), nBufSize );
|
||||
}
|
||||
|
||||
env->ReleaseByteArrayElements(value, pBuf, 0);
|
||||
|
|
@ -1013,7 +1013,7 @@ JNIEXPORT void JNICALL HID_DEVICE_MANAGER_JAVA_INTERFACE(HIDDeviceReportResponse
|
|||
hid_device_ref<CHIDDevice> pDevice = FindDevice( nDeviceID );
|
||||
if ( pDevice )
|
||||
{
|
||||
pDevice->ProcessReportResponse( reinterpret_cast< const uint8_t* >( pBuf ), nBufSize );
|
||||
pDevice->ProcessReportResponse( reinterpret_cast< const uint8_t * >( pBuf ), nBufSize );
|
||||
}
|
||||
|
||||
env->ReleaseByteArrayElements(value, pBuf, 0);
|
||||
|
|
@ -1375,7 +1375,7 @@ int hid_get_report_descriptor(hid_device *device, unsigned char *buf, size_t buf
|
|||
return -1;
|
||||
}
|
||||
|
||||
HID_API_EXPORT const wchar_t* HID_API_CALL hid_error(hid_device *device)
|
||||
HID_API_EXPORT const wchar_t * HID_API_CALL hid_error(hid_device *device)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,6 +71,11 @@ extern "C" {
|
|||
#define DETACH_KERNEL_DRIVER
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable:5287) /* operands are different enum types */
|
||||
#endif
|
||||
|
||||
/* Uncomment to enable the retrieval of Usage and Usage Page in
|
||||
hid_enumerate(). Warning, on platforms different from FreeBSD
|
||||
this is very invasive as it requires the detach
|
||||
|
|
@ -2144,6 +2149,10 @@ uint16_t get_usb_code_for_current_locale(void)
|
|||
return 0x0;
|
||||
}
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma warning (pop)
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ static void *ioring_handle = NULL;
|
|||
SDL_IORING_FUNC(BOOL, IsIoRingOpSupported, (HIORING ioRing, IORING_OP_CODE op)) \
|
||||
SDL_IORING_FUNC(HRESULT, CreateIoRing, (IORING_VERSION ioringVersion, IORING_CREATE_FLAGS flags, UINT32 submissionQueueSize, UINT32 completionQueueSize, HIORING* h)) \
|
||||
SDL_IORING_FUNC(HRESULT, GetIoRingInfo, (HIORING ioRing, IORING_INFO* info)) \
|
||||
SDL_IORING_FUNC(HRESULT, SubmitIoRing, (HIORING ioRing, UINT32 waitOperations, UINT32 milliseconds, UINT32* submittedEntries)) \
|
||||
SDL_IORING_FUNC(HRESULT, SubmitIoRing, (HIORING ioRing, UINT32 waitOperations, UINT32 milliseconds, UINT32 * submittedEntries)) \
|
||||
SDL_IORING_FUNC(HRESULT, CloseIoRing, (HIORING ioRing)) \
|
||||
SDL_IORING_FUNC(HRESULT, PopIoRingCompletion, (HIORING ioRing, IORING_CQE* cqe)) \
|
||||
SDL_IORING_FUNC(HRESULT, SetIoRingCompletionEvent, (HIORING ioRing, HANDLE hEvent)) \
|
||||
|
|
|
|||
|
|
@ -841,6 +841,7 @@ static GamepadMapping_t *SDL_CreateMappingForHIDAPIGamepad(SDL_GUID guid)
|
|||
case 80:
|
||||
case 81:
|
||||
case 85:
|
||||
case 105:
|
||||
// Vader series of controllers have C/Z buttons
|
||||
SDL_strlcat(mapping_string, "misc2:b15,misc3:b16,", sizeof(mapping_string));
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -209,8 +209,8 @@ static GAMEINPUT_InternalDevice *GAMEINPUT_InternalFindByIndex(int idx)
|
|||
|
||||
static void CALLBACK GAMEINPUT_InternalJoystickDeviceCallback(
|
||||
_In_ GameInputCallbackToken callbackToken,
|
||||
_In_ void* context,
|
||||
_In_ IGameInputDevice* device,
|
||||
_In_ void *context,
|
||||
_In_ IGameInputDevice *device,
|
||||
_In_ uint64_t timestamp,
|
||||
_In_ GameInputDeviceStatus currentStatus,
|
||||
_In_ GameInputDeviceStatus previousStatus)
|
||||
|
|
@ -697,7 +697,7 @@ static void GAMEINPUT_JoystickUpdate(SDL_Joystick *joystick)
|
|||
GAMEINPUT_UpdatePowerInfo(joystick, device);
|
||||
}
|
||||
|
||||
static void GAMEINPUT_JoystickClose(SDL_Joystick* joystick)
|
||||
static void GAMEINPUT_JoystickClose(SDL_Joystick *joystick)
|
||||
{
|
||||
GAMEINPUT_InternalJoystickHwdata *hwdata = joystick->hwdata;
|
||||
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ typedef struct
|
|||
bool sensors_supported;
|
||||
bool sensors_enabled;
|
||||
Uint16 firmware_version;
|
||||
Uint64 sensor_timestamp_ns; // Simulate onboard clock. Advance by known time step. Nanoseconds.
|
||||
Uint64 sensor_timestamp_ns; // Simulate onboard clock. Advance by known time step. Nanoseconds.
|
||||
Uint64 sensor_timestamp_step_ns; // Based on observed rate of receipt of IMU sensor packets.
|
||||
float accelScale;
|
||||
Uint8 last_state[USB_PACKET_LENGTH];
|
||||
|
|
@ -95,19 +95,18 @@ static void UpdateDeviceIdentity(SDL_HIDAPI_Device *device)
|
|||
{
|
||||
SDL_DriverFlydigi_Context *ctx = (SDL_DriverFlydigi_Context *)device->context;
|
||||
|
||||
for (int attempt = 0; ctx->deviceID == 0 && attempt < 3; ++attempt) {
|
||||
// Detecting the Vader 2 can take over 1000 read retries, so be generous here
|
||||
for (int attempt = 0; ctx->deviceID == 0 && attempt < 30; ++attempt) {
|
||||
const Uint8 request[] = { FLYDIGI_CMD_REPORT_ID, FLYDIGI_GET_INFO_COMMAND, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
int size = SDL_hid_write(device->dev, request, sizeof(request));
|
||||
if (size < 0) {
|
||||
break;
|
||||
}
|
||||
// This write will occasionally return -1, so ignore failure here and try again
|
||||
(void)SDL_hid_write(device->dev, request, sizeof(request));
|
||||
|
||||
// Read the reply
|
||||
for (int i = 0; i < 100; ++i) {
|
||||
SDL_Delay(1);
|
||||
|
||||
Uint8 data[USB_PACKET_LENGTH];
|
||||
size = SDL_hid_read_timeout(device->dev, data, sizeof(data), 0);
|
||||
int size = SDL_hid_read_timeout(device->dev, data, sizeof(data), 0);
|
||||
if (size < 0) {
|
||||
break;
|
||||
}
|
||||
|
|
@ -211,6 +210,7 @@ static void UpdateDeviceIdentity(SDL_HIDAPI_Device *device)
|
|||
ctx->sensor_timestamp_step_ns = ctx->wireless ? SENSOR_INTERVAL_VADER4_PRO_DONGLE_NS : SENSOR_INTERVAL_VADER_PRO4_WIRED_NS;
|
||||
break;
|
||||
case 85:
|
||||
case 105:
|
||||
HIDAPI_SetDeviceName(device, "Flydigi Vader 4 Pro");
|
||||
ctx->has_cz = true;
|
||||
ctx->sensors_supported = true;
|
||||
|
|
@ -218,6 +218,7 @@ static void UpdateDeviceIdentity(SDL_HIDAPI_Device *device)
|
|||
ctx->sensor_timestamp_step_ns = ctx->wireless ? SENSOR_INTERVAL_VADER4_PRO_DONGLE_NS : SENSOR_INTERVAL_VADER_PRO4_WIRED_NS;
|
||||
break;
|
||||
default:
|
||||
SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, "Unknown FlyDigi controller with ID %d, name '%s'", ctx->deviceID, device->name);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -901,7 +901,7 @@ static bool GIP_ParseDeviceMetadata(GIP_Metadata *metadata, const Uint8 *bytes,
|
|||
}
|
||||
if (buffer_offset > 0) {
|
||||
device->num_preferred_types = bytes[buffer_offset];
|
||||
device->preferred_types = SDL_calloc(device->num_preferred_types, sizeof(char*));
|
||||
device->preferred_types = SDL_calloc(device->num_preferred_types, sizeof(char *));
|
||||
buffer_offset++;
|
||||
for (i = 0; i < device->num_preferred_types; i++) {
|
||||
if (buffer_offset + 2 >= length) {
|
||||
|
|
@ -1013,7 +1013,7 @@ static bool GIP_ParseMessageMetadata(GIP_MessageMetadata *metadata, const Uint8
|
|||
return true;
|
||||
}
|
||||
|
||||
static bool GIP_ParseMetadata(GIP_Metadata *metadata, const Uint8* bytes, int num_bytes)
|
||||
static bool GIP_ParseMetadata(GIP_Metadata *metadata, const Uint8 *bytes, int num_bytes)
|
||||
{
|
||||
int header_size;
|
||||
int metadata_size;
|
||||
|
|
@ -2427,7 +2427,7 @@ static void GIP_ReceivePacket(GIP_Device *device, const Uint8 *bytes, int num_by
|
|||
Uint16 bytes_remaining = 0;
|
||||
bool is_fragment;
|
||||
Uint8 attachment_index;
|
||||
GIP_Attachment* attachment;
|
||||
GIP_Attachment *attachment;
|
||||
|
||||
if (num_bytes < 5) {
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -928,13 +928,14 @@ static bool SetIMUEnabled(SDL_DriverSwitch_Context *ctx, bool enabled)
|
|||
|
||||
static bool LoadStickCalibration(SDL_DriverSwitch_Context *ctx)
|
||||
{
|
||||
Uint8 *pLeftStickCal;
|
||||
Uint8 *pRightStickCal;
|
||||
Uint8 *pLeftStickCal = NULL;
|
||||
Uint8 *pRightStickCal = NULL;
|
||||
size_t stick, axis;
|
||||
SwitchSubcommandInputPacket_t *user_reply = NULL;
|
||||
SwitchSubcommandInputPacket_t *factory_reply = NULL;
|
||||
SwitchSPIOpData_t readUserParams;
|
||||
SwitchSPIOpData_t readFactoryParams;
|
||||
Uint8 userParamsReadSuccessCount = 0;
|
||||
|
||||
// Read User Calibration Info
|
||||
readUserParams.unAddress = k_unSPIStickUserCalibrationStartOffset;
|
||||
|
|
@ -947,33 +948,46 @@ static bool LoadStickCalibration(SDL_DriverSwitch_Context *ctx)
|
|||
readFactoryParams.unAddress = k_unSPIStickFactoryCalibrationStartOffset;
|
||||
readFactoryParams.ucLength = k_unSPIStickFactoryCalibrationLength;
|
||||
|
||||
const int MAX_ATTEMPTS = 3;
|
||||
for (int attempt = 0; ; ++attempt) {
|
||||
if (!WriteSubcommand(ctx, k_eSwitchSubcommandIDs_SPIFlashRead, (uint8_t *)&readFactoryParams, sizeof(readFactoryParams), &factory_reply)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (factory_reply->stickFactoryCalibration.opData.unAddress == k_unSPIStickFactoryCalibrationStartOffset) {
|
||||
// We successfully read the calibration data
|
||||
break;
|
||||
}
|
||||
|
||||
if (attempt == MAX_ATTEMPTS) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Automatically select the user calibration if magic bytes are set
|
||||
if (user_reply && user_reply->stickUserCalibration.rgucLeftMagic[0] == 0xB2 && user_reply->stickUserCalibration.rgucLeftMagic[1] == 0xA1) {
|
||||
userParamsReadSuccessCount += 1;
|
||||
pLeftStickCal = user_reply->stickUserCalibration.rgucLeftCalibration;
|
||||
} else {
|
||||
pLeftStickCal = factory_reply->stickFactoryCalibration.rgucLeftCalibration;
|
||||
}
|
||||
|
||||
if (user_reply && user_reply->stickUserCalibration.rgucRightMagic[0] == 0xB2 && user_reply->stickUserCalibration.rgucRightMagic[1] == 0xA1) {
|
||||
userParamsReadSuccessCount += 1;
|
||||
pRightStickCal = user_reply->stickUserCalibration.rgucRightCalibration;
|
||||
} else {
|
||||
pRightStickCal = factory_reply->stickFactoryCalibration.rgucRightCalibration;
|
||||
}
|
||||
|
||||
// Only read the factory calibration info if we failed to receive the correct magic bytes
|
||||
if (userParamsReadSuccessCount < 2) {
|
||||
// Read Factory Calibration Info
|
||||
readFactoryParams.unAddress = k_unSPIStickFactoryCalibrationStartOffset;
|
||||
readFactoryParams.ucLength = k_unSPIStickFactoryCalibrationLength;
|
||||
|
||||
const int MAX_ATTEMPTS = 3;
|
||||
for (int attempt = 0;; ++attempt) {
|
||||
if (!WriteSubcommand(ctx, k_eSwitchSubcommandIDs_SPIFlashRead, (uint8_t *)&readFactoryParams, sizeof(readFactoryParams), &factory_reply)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (factory_reply->stickFactoryCalibration.opData.unAddress == k_unSPIStickFactoryCalibrationStartOffset) {
|
||||
// We successfully read the calibration data
|
||||
pLeftStickCal = factory_reply->stickFactoryCalibration.rgucLeftCalibration;
|
||||
pRightStickCal = factory_reply->stickFactoryCalibration.rgucRightCalibration;
|
||||
break;
|
||||
}
|
||||
|
||||
if (attempt == MAX_ATTEMPTS) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If we still don't have calibration data, return false
|
||||
if (pLeftStickCal == NULL || pRightStickCal == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Stick calibration values are 12-bits each and are packed by bit
|
||||
|
|
@ -1109,14 +1123,17 @@ static Sint16 ApplyStickCalibration(SDL_DriverSwitch_Context *ctx, int nStick, i
|
|||
{
|
||||
sRawValue -= ctx->m_StickCalData[nStick].axis[nAxis].sCenter;
|
||||
|
||||
if (sRawValue > ctx->m_StickExtents[nStick].axis[nAxis].sMax) {
|
||||
ctx->m_StickExtents[nStick].axis[nAxis].sMax = sRawValue;
|
||||
if (sRawValue >= 0) {
|
||||
if (sRawValue > ctx->m_StickExtents[nStick].axis[nAxis].sMax) {
|
||||
ctx->m_StickExtents[nStick].axis[nAxis].sMax = sRawValue;
|
||||
}
|
||||
return (Sint16)HIDAPI_RemapVal(sRawValue, 0, ctx->m_StickExtents[nStick].axis[nAxis].sMax, 0, SDL_MAX_SINT16);
|
||||
} else {
|
||||
if (sRawValue < ctx->m_StickExtents[nStick].axis[nAxis].sMin) {
|
||||
ctx->m_StickExtents[nStick].axis[nAxis].sMin = sRawValue;
|
||||
}
|
||||
return (Sint16)HIDAPI_RemapVal(sRawValue, ctx->m_StickExtents[nStick].axis[nAxis].sMin, 0, SDL_MIN_SINT16, 0);
|
||||
}
|
||||
if (sRawValue < ctx->m_StickExtents[nStick].axis[nAxis].sMin) {
|
||||
ctx->m_StickExtents[nStick].axis[nAxis].sMin = sRawValue;
|
||||
}
|
||||
|
||||
return (Sint16)HIDAPI_RemapVal(sRawValue, ctx->m_StickExtents[nStick].axis[nAxis].sMin, ctx->m_StickExtents[nStick].axis[nAxis].sMax, SDL_MIN_SINT16, SDL_MAX_SINT16);
|
||||
}
|
||||
|
||||
static Sint16 ApplySimpleStickCalibration(SDL_DriverSwitch_Context *ctx, int nStick, int nAxis, Sint16 sRawValue)
|
||||
|
|
@ -1126,14 +1143,17 @@ static Sint16 ApplySimpleStickCalibration(SDL_DriverSwitch_Context *ctx, int nSt
|
|||
|
||||
sRawValue -= usJoystickCenter;
|
||||
|
||||
if (sRawValue > ctx->m_SimpleStickExtents[nStick].axis[nAxis].sMax) {
|
||||
ctx->m_SimpleStickExtents[nStick].axis[nAxis].sMax = sRawValue;
|
||||
if (sRawValue >= 0) {
|
||||
if (sRawValue > ctx->m_SimpleStickExtents[nStick].axis[nAxis].sMax) {
|
||||
ctx->m_SimpleStickExtents[nStick].axis[nAxis].sMax = sRawValue;
|
||||
}
|
||||
return (Sint16)HIDAPI_RemapVal(sRawValue, 0, ctx->m_SimpleStickExtents[nStick].axis[nAxis].sMax, 0, SDL_MAX_SINT16);
|
||||
} else {
|
||||
if (sRawValue < ctx->m_SimpleStickExtents[nStick].axis[nAxis].sMin) {
|
||||
ctx->m_SimpleStickExtents[nStick].axis[nAxis].sMin = sRawValue;
|
||||
}
|
||||
return (Sint16)HIDAPI_RemapVal(sRawValue, ctx->m_SimpleStickExtents[nStick].axis[nAxis].sMin, 0, SDL_MIN_SINT16, 0);
|
||||
}
|
||||
if (sRawValue < ctx->m_SimpleStickExtents[nStick].axis[nAxis].sMin) {
|
||||
ctx->m_SimpleStickExtents[nStick].axis[nAxis].sMin = sRawValue;
|
||||
}
|
||||
|
||||
return (Sint16)HIDAPI_RemapVal(sRawValue, ctx->m_SimpleStickExtents[nStick].axis[nAxis].sMin, ctx->m_SimpleStickExtents[nStick].axis[nAxis].sMax, SDL_MIN_SINT16, SDL_MAX_SINT16);
|
||||
}
|
||||
|
||||
static Uint8 RemapButton(SDL_DriverSwitch_Context *ctx, Uint8 button)
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ bool SDL_HasMainCallbacks(void)
|
|||
return false;
|
||||
}
|
||||
|
||||
SDL_AppResult SDL_InitMainCallbacks(int argc, char* argv[], SDL_AppInit_func appinit, SDL_AppIterate_func appiter, SDL_AppEvent_func appevent, SDL_AppQuit_func appquit)
|
||||
SDL_AppResult SDL_InitMainCallbacks(int argc, char *argv[], SDL_AppInit_func appinit, SDL_AppIterate_func appiter, SDL_AppEvent_func appevent, SDL_AppQuit_func appquit)
|
||||
{
|
||||
SDL_main_iteration_callback = appiter;
|
||||
SDL_main_event_callback = appevent;
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
* If not, you can special case it here by appending || defined(__YOUR_PLATFORM__) */
|
||||
#if ( !defined(SDL_MAIN_NEEDED) && !defined(SDL_MAIN_AVAILABLE) ) || defined(SDL_PLATFORM_ANDROID)
|
||||
|
||||
int SDL_RunApp(int argc, char* argv[], SDL_main_func mainFunction, void * reserved)
|
||||
int SDL_RunApp(int argc, char *argv[], SDL_main_func mainFunction, void * reserved)
|
||||
{
|
||||
(void)reserved;
|
||||
|
||||
|
|
@ -32,7 +32,7 @@ int SDL_RunApp(int argc, char* argv[], SDL_main_func mainFunction, void * reserv
|
|||
{
|
||||
// make sure argv isn't NULL, in case some user code doesn't like that
|
||||
static char dummyargv0[] = { 'S', 'D', 'L', '_', 'a', 'p', 'p', '\0' };
|
||||
static char* argvdummy[2] = { dummyargv0, NULL };
|
||||
static char *argvdummy[2] = { dummyargv0, NULL };
|
||||
argc = 1;
|
||||
argv = argvdummy;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ static void EmscriptenInternalMainloop(void)
|
|||
}
|
||||
}
|
||||
|
||||
int SDL_EnterAppMainCallbacks(int argc, char* argv[], SDL_AppInit_func appinit, SDL_AppIterate_func appiter, SDL_AppEvent_func appevent, SDL_AppQuit_func appquit)
|
||||
int SDL_EnterAppMainCallbacks(int argc, char *argv[], SDL_AppInit_func appinit, SDL_AppIterate_func appiter, SDL_AppEvent_func appevent, SDL_AppQuit_func appquit)
|
||||
{
|
||||
const SDL_AppResult rc = SDL_InitMainCallbacks(argc, argv, appinit, appiter, appevent, appquit);
|
||||
if (rc == SDL_APP_CONTINUE) {
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@
|
|||
|
||||
EM_JS_DEPS(sdlrunapp, "$dynCall,$stringToNewUTF8");
|
||||
|
||||
int SDL_RunApp(int argc, char* argv[], SDL_main_func mainFunction, void * reserved)
|
||||
int SDL_RunApp(int argc, char *argv[], SDL_main_func mainFunction, void * reserved)
|
||||
{
|
||||
(void)reserved;
|
||||
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ static BOOL OutOfMemory(void)
|
|||
/* Gets the arguments with GetCommandLine, converts them to argc and argv
|
||||
and calls SDL_main */
|
||||
extern "C"
|
||||
int SDL_RunApp(int, char**, SDL_main_func mainFunction, void *reserved)
|
||||
int SDL_RunApp(int, char **, SDL_main_func mainFunction, void *reserved)
|
||||
{
|
||||
LPWSTR *argvw;
|
||||
char **argv;
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ static SDL_AppResult GenericIterateMainCallbacks(void)
|
|||
return SDL_IterateMainCallbacks(!iterate_after_waitevent);
|
||||
}
|
||||
|
||||
int SDL_EnterAppMainCallbacks(int argc, char* argv[], SDL_AppInit_func appinit, SDL_AppIterate_func appiter, SDL_AppEvent_func appevent, SDL_AppQuit_func appquit)
|
||||
int SDL_EnterAppMainCallbacks(int argc, char *argv[], SDL_AppInit_func appinit, SDL_AppIterate_func appiter, SDL_AppEvent_func appevent, SDL_AppQuit_func appquit)
|
||||
{
|
||||
SDL_AppResult rc = SDL_InitMainCallbacks(argc, argv, appinit, appiter, appevent, appquit);
|
||||
if (rc == 0) {
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ static SDLIosMainCallbacksDisplayLink *globalDisplayLink;
|
|||
|
||||
// SDL_RunApp will land in UIApplicationMain, which calls SDL_main from postFinishLaunch, which calls this.
|
||||
// When we return from here, we're living in the RunLoop, and a CADisplayLink is firing regularly for us.
|
||||
int SDL_EnterAppMainCallbacks(int argc, char* argv[], SDL_AppInit_func appinit, SDL_AppIterate_func appiter, SDL_AppEvent_func appevent, SDL_AppQuit_func appquit)
|
||||
int SDL_EnterAppMainCallbacks(int argc, char *argv[], SDL_AppInit_func appinit, SDL_AppIterate_func appiter, SDL_AppEvent_func appevent, SDL_AppQuit_func appquit)
|
||||
{
|
||||
SDL_AppResult rc = SDL_InitMainCallbacks(argc, argv, appinit, appiter, appevent, appquit);
|
||||
if (rc == SDL_APP_CONTINUE) {
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
#include <3ds.h>
|
||||
|
||||
int SDL_RunApp(int argc, char* argv[], SDL_main_func mainFunction, void * reserved)
|
||||
int SDL_RunApp(int argc, char *argv[], SDL_main_func mainFunction, void * reserved)
|
||||
{
|
||||
int result;
|
||||
// init
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
#ifdef SDL_PLATFORM_NGAGE
|
||||
|
||||
int SDL_EnterAppMainCallbacks(int argc, char* argv[], SDL_AppInit_func appinit, SDL_AppIterate_func appiter, SDL_AppEvent_func appevent, SDL_AppQuit_func appquit)
|
||||
int SDL_EnterAppMainCallbacks(int argc, char *argv[], SDL_AppInit_func appinit, SDL_AppIterate_func appiter, SDL_AppEvent_func appevent, SDL_AppQuit_func appquit)
|
||||
{
|
||||
// Intentionally does nothing; Callbacks are called using the RunL() method.
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -24,10 +24,10 @@ extern "C" {
|
|||
|
||||
#include "SDL_internal.h"
|
||||
|
||||
extern SDL_AppResult SDL_AppInit(void** appstate, int argc, char* argv[]);
|
||||
extern SDL_AppResult SDL_AppEvent(void* appstate, SDL_Event* event);
|
||||
extern SDL_AppResult SDL_AppIterate(void* appstate);
|
||||
extern void SDL_AppQuit(void* appstate, SDL_AppResult result);
|
||||
extern SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[]);
|
||||
extern SDL_AppResult SDL_AppEvent(void *appstate, SDL_Event *event);
|
||||
extern SDL_AppResult SDL_AppIterate(void *appstate);
|
||||
extern void SDL_AppQuit(void *appstate, SDL_AppResult result);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
@ -48,14 +48,14 @@ GLDEF_C TInt E32Main()
|
|||
{
|
||||
// Get args and environment.
|
||||
int argc = 1;
|
||||
char* argv[] = { "game", NULL };
|
||||
char** envp = NULL;
|
||||
char *argv[] = { "game", NULL };
|
||||
char **envp = NULL;
|
||||
|
||||
// Create lvalue variables for __crt0 arguments.
|
||||
char** argv_lvalue = argv;
|
||||
char** envp_lvalue = envp;
|
||||
char **argv_lvalue = argv;
|
||||
char **envp_lvalue = envp;
|
||||
|
||||
CTrapCleanup* cleanup = CTrapCleanup::New();
|
||||
CTrapCleanup *cleanup = CTrapCleanup::New();
|
||||
if (!cleanup)
|
||||
{
|
||||
return KErrNoMemory;
|
||||
|
|
@ -63,7 +63,7 @@ GLDEF_C TInt E32Main()
|
|||
|
||||
TRAPD(err,
|
||||
{
|
||||
CActiveScheduler* scheduler = new (ELeave) CActiveScheduler();
|
||||
CActiveScheduler *scheduler = new (ELeave) CActiveScheduler();
|
||||
CleanupStack::PushL(scheduler);
|
||||
CActiveScheduler::Install(scheduler);
|
||||
|
||||
|
|
@ -77,7 +77,7 @@ GLDEF_C TInt E32Main()
|
|||
__crt0(argc, argv_lvalue, envp_lvalue);
|
||||
|
||||
// Increase heap size.
|
||||
RHeap* newHeap = User::ChunkHeap(NULL, 7500000, 7500000, KMinHeapGrowBy);
|
||||
RHeap *newHeap = User::ChunkHeap(NULL, 7500000, 7500000, KMinHeapGrowBy);
|
||||
if (!newHeap)
|
||||
{
|
||||
SDL_Log("Error: Failed to create new heap");
|
||||
|
|
@ -85,7 +85,7 @@ GLDEF_C TInt E32Main()
|
|||
}
|
||||
CleanupStack::PushL(newHeap);
|
||||
|
||||
RHeap* oldHeap = User::SwitchHeap(newHeap);
|
||||
RHeap *oldHeap = User::SwitchHeap(newHeap);
|
||||
|
||||
TInt targetLatency = 225;
|
||||
InitAudio(&targetLatency);
|
||||
|
|
@ -101,7 +101,7 @@ GLDEF_C TInt E32Main()
|
|||
CleanupStack::PushL(gRenderer);
|
||||
|
||||
// Create and start the SDL main runner.
|
||||
CSDLmain* mainApp = CSDLmain::NewL();
|
||||
CSDLmain *mainApp = CSDLmain::NewL();
|
||||
CleanupStack::PushL(mainApp);
|
||||
mainApp->Start();
|
||||
|
||||
|
|
@ -125,9 +125,9 @@ GLDEF_C TInt E32Main()
|
|||
return err;
|
||||
}
|
||||
|
||||
CSDLmain* CSDLmain::NewL()
|
||||
CSDLmain *CSDLmain::NewL()
|
||||
{
|
||||
CSDLmain* self = new (ELeave) CSDLmain();
|
||||
CSDLmain *self = new (ELeave) CSDLmain();
|
||||
CleanupStack::PushL(self);
|
||||
self->ConstructL();
|
||||
CleanupStack::Pop(self);
|
||||
|
|
@ -149,7 +149,7 @@ CSDLmain::~CSDLmain()
|
|||
void CSDLmain::Start()
|
||||
{
|
||||
SetActive();
|
||||
TRequestStatus* status = &iStatus;
|
||||
TRequestStatus *status = &iStatus;
|
||||
User::RequestComplete(status, KErrNone);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@
|
|||
class CSDLmain : public CActive
|
||||
{
|
||||
public:
|
||||
static CSDLmain* NewL();
|
||||
static CSDLmain *NewL();
|
||||
~CSDLmain();
|
||||
|
||||
void Start();
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ static void deinit_drivers(void)
|
|||
deinit_ps2_filesystem_driver();
|
||||
}
|
||||
|
||||
int SDL_RunApp(int argc, char* argv[], SDL_main_func mainFunction, void * reserved)
|
||||
int SDL_RunApp(int argc, char *argv[], SDL_main_func mainFunction, void * reserved)
|
||||
{
|
||||
int res;
|
||||
(void)reserved;
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ int sdl_psp_setup_callbacks(void)
|
|||
return thid;
|
||||
}
|
||||
|
||||
int SDL_RunApp(int argc, char* argv[], SDL_main_func mainFunction, void * reserved)
|
||||
int SDL_RunApp(int argc, char *argv[], SDL_main_func mainFunction, void * reserved)
|
||||
{
|
||||
(void)reserved;
|
||||
sdl_psp_setup_callbacks();
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ static int OutOfMemory(void)
|
|||
return -1;
|
||||
}
|
||||
|
||||
int MINGW32_FORCEALIGN SDL_RunApp(int _argc, char* _argv[], SDL_main_func mainFunction, void * reserved)
|
||||
int MINGW32_FORCEALIGN SDL_RunApp(int _argc, char *_argv[], SDL_main_func mainFunction, void * reserved)
|
||||
{
|
||||
/* Gets the arguments with GetCommandLine, converts them to argc and argv
|
||||
and calls SDL_main */
|
||||
|
|
|
|||
|
|
@ -1512,7 +1512,7 @@ static void D3D12_FreeSRVIndex(SDL_Renderer *renderer, SIZE_T index)
|
|||
|
||||
static bool GetTextureProperty(SDL_PropertiesID props, const char *name, ID3D12Resource **texture)
|
||||
{
|
||||
IUnknown *unknown = (IUnknown*)SDL_GetPointerProperty(props, name, NULL);
|
||||
IUnknown *unknown = (IUnknown *)SDL_GetPointerProperty(props, name, NULL);
|
||||
if (unknown) {
|
||||
#if defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES)
|
||||
HRESULT result = unknown->QueryInterface(D3D_GUID(SDL_IID_ID3D12Resource), (void **)texture);
|
||||
|
|
|
|||
|
|
@ -48,10 +48,10 @@ void ApplyColorMod(void *dest, void *source, int pitch, int width, int height, S
|
|||
}
|
||||
}
|
||||
|
||||
void ApplyFlip(void* dest, void* source, int pitch, int width, int height, SDL_FlipMode flip)
|
||||
void ApplyFlip(void *dest, void *source, int pitch, int width, int height, SDL_FlipMode flip)
|
||||
{
|
||||
TUint16* src_pixels = static_cast<TUint16*>(source);
|
||||
TUint16* dst_pixels = static_cast<TUint16*>(dest);
|
||||
TUint16 *src_pixels = static_cast<TUint16 *>(source);
|
||||
TUint16 *dst_pixels = static_cast<TUint16 *>(dest);
|
||||
|
||||
for (int y = 0; y < height; ++y)
|
||||
{
|
||||
|
|
@ -75,10 +75,10 @@ void ApplyFlip(void* dest, void* source, int pitch, int width, int height, SDL_F
|
|||
}
|
||||
}
|
||||
|
||||
void ApplyRotation(void* dest, void* source, int pitch, int width, int height, TFixed center_x, TFixed center_y, TFixed angle)
|
||||
void ApplyRotation(void *dest, void *source, int pitch, int width, int height, TFixed center_x, TFixed center_y, TFixed angle)
|
||||
{
|
||||
TUint16* src_pixels = static_cast<TUint16*>(source);
|
||||
TUint16* dst_pixels = static_cast<TUint16*>(dest);
|
||||
TUint16 *src_pixels = static_cast<TUint16 *>(source);
|
||||
TUint16 *dst_pixels = static_cast<TUint16 *>(dest);
|
||||
|
||||
TFixed cos_angle = 0;
|
||||
TFixed sin_angle = 0;
|
||||
|
|
@ -117,10 +117,10 @@ void ApplyRotation(void* dest, void* source, int pitch, int width, int height, T
|
|||
}
|
||||
}
|
||||
|
||||
void ApplyScale(void* dest, void* source, int pitch, int width, int height, TFixed center_x, TFixed center_y, TFixed scale_x, TFixed scale_y)
|
||||
void ApplyScale(void *dest, void *source, int pitch, int width, int height, TFixed center_x, TFixed center_y, TFixed scale_x, TFixed scale_y)
|
||||
{
|
||||
TUint16* src_pixels = static_cast<TUint16*>(source);
|
||||
TUint16* dst_pixels = static_cast<TUint16*>(dest);
|
||||
TUint16 *src_pixels = static_cast<TUint16 *>(source);
|
||||
TUint16 *dst_pixels = static_cast<TUint16 *>(dest);
|
||||
|
||||
for (int y = 0; y < height; ++y)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -24,9 +24,9 @@
|
|||
|
||||
#include <3dtypes.h>
|
||||
|
||||
void ApplyColorMod(void* dest, void* source, int pitch, int width, int height, SDL_FColor color);
|
||||
void ApplyFlip(void* dest, void* source, int pitch, int width, int height, SDL_FlipMode flip);
|
||||
void ApplyRotation(void* dest, void* source, int pitch, int width, int height, TFixed center_x, TFixed center_y, TFixed angle);
|
||||
void ApplyScale(void* dest, void* source, int pitch, int width, int height, TFixed center_x, TFixed center_y, TFixed scale_x, TFixed scale_y);
|
||||
void ApplyColorMod(void *dest, void *source, int pitch, int width, int height, SDL_FColor color);
|
||||
void ApplyFlip(void *dest, void *source, int pitch, int width, int height, SDL_FlipMode flip);
|
||||
void ApplyRotation(void *dest, void *source, int pitch, int width, int height, TFixed center_x, TFixed center_y, TFixed angle);
|
||||
void ApplyScale(void *dest, void *source, int pitch, int width, int height, TFixed center_x, TFixed center_y, TFixed scale_x, TFixed scale_y);
|
||||
|
||||
#endif // ngage_video_render_ops_hpp
|
||||
|
|
|
|||
|
|
@ -820,6 +820,35 @@ static SceGxmTextureAddrMode TranslateAddressMode(SDL_TextureAddressMode mode)
|
|||
}
|
||||
}
|
||||
|
||||
static void ClampCliprectToViewport(SDL_Rect *clip, const SDL_Rect *viewport)
|
||||
{
|
||||
int max_x_v, max_y_v, max_x_c, max_y_c;
|
||||
|
||||
if (clip->x < 0) {
|
||||
clip->w += clip->x;
|
||||
clip->x = 0;
|
||||
}
|
||||
|
||||
if (clip->y < 0) {
|
||||
clip->h += clip->y;
|
||||
clip->y = 0;
|
||||
}
|
||||
|
||||
max_x_c = clip->x + clip->w;
|
||||
max_y_c = clip->y + clip->h;
|
||||
|
||||
max_x_v = viewport->x + viewport->w;
|
||||
max_y_v = viewport->y + viewport->h;
|
||||
|
||||
if (max_x_c > max_x_v) {
|
||||
clip->w -= (max_x_v - max_x_c);
|
||||
}
|
||||
|
||||
if (max_y_c > max_y_v) {
|
||||
clip->h -= (max_y_v - max_y_c);
|
||||
}
|
||||
}
|
||||
|
||||
static bool SetDrawState(VITA_GXM_RenderData *data, const SDL_RenderCommand *cmd)
|
||||
{
|
||||
SDL_Texture *texture = cmd->data.draw.texture;
|
||||
|
|
@ -862,9 +891,13 @@ static bool SetDrawState(VITA_GXM_RenderData *data, const SDL_RenderCommand *cmd
|
|||
data->drawstate.cliprect_enabled_dirty = false;
|
||||
}
|
||||
|
||||
if (data->drawstate.cliprect_enabled && data->drawstate.cliprect_dirty) {
|
||||
const SDL_Rect *rect = &data->drawstate.cliprect;
|
||||
set_clip_rectangle(data, rect->x, rect->y, rect->x + rect->w, rect->y + rect->h);
|
||||
if ((data->drawstate.cliprect_enabled || data->drawstate.viewport_is_set) && data->drawstate.cliprect_dirty) {
|
||||
SDL_Rect rect;
|
||||
SDL_copyp(&rect, &data->drawstate.cliprect);
|
||||
if (data->drawstate.viewport_is_set) {
|
||||
ClampCliprectToViewport(&rect, &data->drawstate.viewport);
|
||||
}
|
||||
set_clip_rectangle(data, rect.x, rect.y, rect.x + rect.w, rect.y + rect.h);
|
||||
data->drawstate.cliprect_dirty = false;
|
||||
}
|
||||
|
||||
|
|
@ -952,20 +985,31 @@ static void VITA_GXM_InvalidateCachedState(SDL_Renderer *renderer)
|
|||
static bool VITA_GXM_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd, void *vertices, size_t vertsize)
|
||||
{
|
||||
VITA_GXM_RenderData *data = (VITA_GXM_RenderData *)renderer->internal;
|
||||
int w, h;
|
||||
|
||||
StartDrawing(renderer);
|
||||
|
||||
data->drawstate.target = renderer->target;
|
||||
if (!data->drawstate.target) {
|
||||
int w, h;
|
||||
SDL_GetWindowSizeInPixels(renderer->window, &w, &h);
|
||||
if ((w != data->drawstate.drawablew) || (h != data->drawstate.drawableh)) {
|
||||
data->drawstate.viewport_dirty = true; // if the window dimensions changed, invalidate the current viewport, etc.
|
||||
data->drawstate.cliprect_dirty = true;
|
||||
data->drawstate.drawablew = w;
|
||||
data->drawstate.drawableh = h;
|
||||
} else {
|
||||
float fw, fh;
|
||||
if (!SDL_GetTextureSize(renderer->target, &fw, &fh)) {
|
||||
w = data->drawstate.drawablew;
|
||||
h = data->drawstate.drawableh;
|
||||
} else {
|
||||
w = (int)SDL_roundf(fw);
|
||||
h = (int)SDL_roundf(fh);
|
||||
}
|
||||
}
|
||||
|
||||
if ((w != data->drawstate.drawablew) || (h != data->drawstate.drawableh)) {
|
||||
data->drawstate.viewport_dirty = true; // if the window dimensions changed, invalidate the current viewport, etc.
|
||||
data->drawstate.cliprect_dirty = true;
|
||||
data->drawstate.drawablew = w;
|
||||
data->drawstate.drawableh = h;
|
||||
}
|
||||
|
||||
while (cmd) {
|
||||
switch (cmd->command) {
|
||||
|
||||
|
|
@ -976,6 +1020,16 @@ static bool VITA_GXM_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *
|
|||
SDL_copyp(viewport, &cmd->data.viewport.rect);
|
||||
data->drawstate.viewport_dirty = true;
|
||||
data->drawstate.cliprect_dirty = true;
|
||||
data->drawstate.viewport_is_set = viewport->x != 0 || viewport->y != 0 || viewport->w != data->drawstate.drawablew || viewport->h != data->drawstate.drawableh;
|
||||
if (!data->drawstate.cliprect_enabled) {
|
||||
if (data->drawstate.viewport_is_set) {
|
||||
SDL_copyp(&data->drawstate.cliprect, viewport);
|
||||
data->drawstate.cliprect.x = 0;
|
||||
data->drawstate.cliprect.y = 0;
|
||||
} else {
|
||||
data->drawstate.cliprect_enabled_dirty = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
@ -983,9 +1037,15 @@ static bool VITA_GXM_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *
|
|||
case SDL_RENDERCMD_SETCLIPRECT:
|
||||
{
|
||||
const SDL_Rect *rect = &cmd->data.cliprect.rect;
|
||||
const SDL_Rect *viewport = &data->drawstate.viewport;
|
||||
if (data->drawstate.cliprect_enabled != cmd->data.cliprect.enabled) {
|
||||
data->drawstate.cliprect_enabled = cmd->data.cliprect.enabled;
|
||||
data->drawstate.cliprect_enabled_dirty = true;
|
||||
if (!data->drawstate.cliprect_enabled && data->drawstate.viewport_is_set) {
|
||||
SDL_copyp(&data->drawstate.cliprect, viewport);
|
||||
data->drawstate.cliprect.x = 0;
|
||||
data->drawstate.cliprect.y = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (SDL_memcmp(&data->drawstate.cliprect, rect, sizeof(*rect)) != 0) {
|
||||
|
|
|
|||
|
|
@ -105,6 +105,7 @@ typedef struct
|
|||
{
|
||||
SDL_Rect viewport;
|
||||
bool viewport_dirty;
|
||||
bool viewport_is_set;
|
||||
SDL_Texture *texture;
|
||||
SDL_Texture *target;
|
||||
SDL_FColor color;
|
||||
|
|
|
|||
|
|
@ -1607,7 +1607,7 @@ static VkSemaphore VULKAN_CreateSemaphore(VULKAN_RenderData *rendererData)
|
|||
return semaphore;
|
||||
}
|
||||
|
||||
static bool VULKAN_DeviceExtensionsFound(VULKAN_RenderData *rendererData, int extensionsToCheck, const char* const* extNames)
|
||||
static bool VULKAN_DeviceExtensionsFound(VULKAN_RenderData *rendererData, int extensionsToCheck, const char * const *extNames)
|
||||
{
|
||||
uint32_t extensionCount;
|
||||
bool foundExtensions = true;
|
||||
|
|
@ -2364,7 +2364,7 @@ static VkResult VULKAN_CreateSwapChain(SDL_Renderer *renderer, int w, int h)
|
|||
}
|
||||
|
||||
// Create descriptor pools - start by allocating one per swapchain image, let it grow if more are needed
|
||||
rendererData->descriptorPools = (VkDescriptorPool **)SDL_calloc(rendererData->swapchainImageCount, sizeof(VkDescriptorPool*));
|
||||
rendererData->descriptorPools = (VkDescriptorPool **)SDL_calloc(rendererData->swapchainImageCount, sizeof(VkDescriptorPool *));
|
||||
rendererData->numDescriptorPools = (uint32_t *)SDL_calloc(rendererData->swapchainImageCount, sizeof(uint32_t));
|
||||
for (uint32_t i = 0; i < rendererData->swapchainImageCount; i++) {
|
||||
// Start by just allocating one pool, it will grow if needed
|
||||
|
|
@ -2394,7 +2394,7 @@ static VkResult VULKAN_CreateSwapChain(SDL_Renderer *renderer, int w, int h)
|
|||
}
|
||||
|
||||
// Upload buffers
|
||||
rendererData->uploadBuffers = (VULKAN_Buffer **)SDL_calloc(rendererData->swapchainImageCount, sizeof(VULKAN_Buffer*));
|
||||
rendererData->uploadBuffers = (VULKAN_Buffer **)SDL_calloc(rendererData->swapchainImageCount, sizeof(VULKAN_Buffer *));
|
||||
for (uint32_t i = 0; i < rendererData->swapchainImageCount; i++) {
|
||||
rendererData->uploadBuffers[i] = (VULKAN_Buffer *)SDL_calloc(SDL_VULKAN_NUM_UPLOAD_BUFFERS, sizeof(VULKAN_Buffer));
|
||||
}
|
||||
|
|
@ -2402,7 +2402,7 @@ static VkResult VULKAN_CreateSwapChain(SDL_Renderer *renderer, int w, int h)
|
|||
rendererData->currentUploadBuffer = (int *)SDL_calloc(rendererData->swapchainImageCount, sizeof(int));
|
||||
|
||||
// Constant buffers
|
||||
rendererData->constantBuffers = (VULKAN_Buffer **)SDL_calloc(rendererData->swapchainImageCount, sizeof(VULKAN_Buffer*));
|
||||
rendererData->constantBuffers = (VULKAN_Buffer **)SDL_calloc(rendererData->swapchainImageCount, sizeof(VULKAN_Buffer *));
|
||||
rendererData->numConstantBuffers = (uint32_t *)SDL_calloc(rendererData->swapchainImageCount, sizeof(uint32_t));
|
||||
for (uint32_t i = 0; i < rendererData->swapchainImageCount; i++) {
|
||||
// Start with just allocating one, will grow if needed
|
||||
|
|
@ -3939,7 +3939,7 @@ static bool VULKAN_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cm
|
|||
return true;
|
||||
}
|
||||
|
||||
static SDL_Surface* VULKAN_RenderReadPixels(SDL_Renderer *renderer, const SDL_Rect *rect)
|
||||
static SDL_Surface *VULKAN_RenderReadPixels(SDL_Renderer *renderer, const SDL_Rect *rect)
|
||||
{
|
||||
VULKAN_RenderData *rendererData = (VULKAN_RenderData *)renderer->internal;
|
||||
VkImage backBuffer;
|
||||
|
|
|
|||
|
|
@ -535,8 +535,8 @@ void *SDL_aligned_alloc(size_t alignment, size_t size)
|
|||
Uint8 *result = NULL;
|
||||
size_t requested_size = size;
|
||||
|
||||
if (alignment < sizeof(void*)) {
|
||||
alignment = sizeof(void*);
|
||||
if (alignment < sizeof(void *)) {
|
||||
alignment = sizeof(void *);
|
||||
}
|
||||
padding = (alignment - (size % alignment));
|
||||
|
||||
|
|
|
|||
|
|
@ -28,14 +28,14 @@ typedef struct TitleStorageBootStrap
|
|||
{
|
||||
const char *name;
|
||||
const char *desc;
|
||||
SDL_Storage *(*create)(const char*, SDL_PropertiesID);
|
||||
SDL_Storage *(*create)(const char *, SDL_PropertiesID);
|
||||
} TitleStorageBootStrap;
|
||||
|
||||
typedef struct UserStorageBootStrap
|
||||
{
|
||||
const char *name;
|
||||
const char *desc;
|
||||
SDL_Storage *(*create)(const char*, const char*, SDL_PropertiesID);
|
||||
SDL_Storage *(*create)(const char *, const char *, SDL_PropertiesID);
|
||||
} UserStorageBootStrap;
|
||||
|
||||
// Not all of these are available in a given build. Use #ifdefs, etc.
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ typedef struct STEAM_RemoteStorage
|
|||
static bool STEAM_CloseStorage(void *userdata)
|
||||
{
|
||||
bool result = true;
|
||||
STEAM_RemoteStorage *steam = (STEAM_RemoteStorage*) userdata;
|
||||
STEAM_RemoteStorage *steam = (STEAM_RemoteStorage *)userdata;
|
||||
void *steamremotestorage = steam->SteamAPI_SteamRemoteStorage_v016();
|
||||
if (steamremotestorage == NULL) {
|
||||
result = SDL_SetError("SteamRemoteStorage unavailable");
|
||||
|
|
@ -60,7 +60,7 @@ static bool STEAM_StorageReady(void *userdata)
|
|||
|
||||
static bool STEAM_GetStoragePathInfo(void *userdata, const char *path, SDL_PathInfo *info)
|
||||
{
|
||||
STEAM_RemoteStorage *steam = (STEAM_RemoteStorage*) userdata;
|
||||
STEAM_RemoteStorage *steam = (STEAM_RemoteStorage *)userdata;
|
||||
void *steamremotestorage = steam->SteamAPI_SteamRemoteStorage_v016();
|
||||
if (steamremotestorage == NULL) {
|
||||
return SDL_SetError("SteamRemoteStorage unavailable");
|
||||
|
|
@ -77,7 +77,7 @@ static bool STEAM_GetStoragePathInfo(void *userdata, const char *path, SDL_PathI
|
|||
static bool STEAM_ReadStorageFile(void *userdata, const char *path, void *destination, Uint64 length)
|
||||
{
|
||||
bool result = false;
|
||||
STEAM_RemoteStorage *steam = (STEAM_RemoteStorage*) userdata;
|
||||
STEAM_RemoteStorage *steam = (STEAM_RemoteStorage *)userdata;
|
||||
void *steamremotestorage = steam->SteamAPI_SteamRemoteStorage_v016();
|
||||
if (steamremotestorage == NULL) {
|
||||
return SDL_SetError("SteamRemoteStorage unavailable");
|
||||
|
|
@ -96,7 +96,7 @@ static bool STEAM_ReadStorageFile(void *userdata, const char *path, void *destin
|
|||
static bool STEAM_WriteStorageFile(void *userdata, const char *path, const void *source, Uint64 length)
|
||||
{
|
||||
bool result = false;
|
||||
STEAM_RemoteStorage *steam = (STEAM_RemoteStorage*) userdata;
|
||||
STEAM_RemoteStorage *steam = (STEAM_RemoteStorage *)userdata;
|
||||
void *steamremotestorage = steam->SteamAPI_SteamRemoteStorage_v016();
|
||||
if (steamremotestorage == NULL) {
|
||||
return SDL_SetError("SteamRemoteStorage unavailable");
|
||||
|
|
@ -115,7 +115,7 @@ static bool STEAM_WriteStorageFile(void *userdata, const char *path, const void
|
|||
static Uint64 STEAM_GetStorageSpaceRemaining(void *userdata)
|
||||
{
|
||||
Uint64 total, remaining;
|
||||
STEAM_RemoteStorage *steam = (STEAM_RemoteStorage*) userdata;
|
||||
STEAM_RemoteStorage *steam = (STEAM_RemoteStorage *)userdata;
|
||||
void *steamremotestorage = steam->SteamAPI_SteamRemoteStorage_v016();
|
||||
if (steamremotestorage == NULL) {
|
||||
SDL_SetError("SteamRemoteStorage unavailable");
|
||||
|
|
@ -149,7 +149,7 @@ static SDL_Storage *STEAM_User_Create(const char *org, const char *app, SDL_Prop
|
|||
STEAM_RemoteStorage *steam;
|
||||
void *steamremotestorage;
|
||||
|
||||
steam = (STEAM_RemoteStorage*) SDL_malloc(sizeof(STEAM_RemoteStorage));
|
||||
steam = (STEAM_RemoteStorage *)SDL_malloc(sizeof(STEAM_RemoteStorage));
|
||||
if (steam == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ static unsigned int get_allocation_bucket(void *mem)
|
|||
return index;
|
||||
}
|
||||
|
||||
static SDL_tracked_allocation* SDL_GetTrackedAllocation(void *mem)
|
||||
static SDL_tracked_allocation *SDL_GetTrackedAllocation(void *mem)
|
||||
{
|
||||
SDL_tracked_allocation *entry;
|
||||
LOCK_ALLOCATOR();
|
||||
|
|
@ -216,9 +216,9 @@ static void SDL_UntrackAllocation(void *mem)
|
|||
UNLOCK_ALLOCATOR();
|
||||
}
|
||||
|
||||
static void rand_fill_memory(void* ptr, size_t start, size_t end)
|
||||
static void rand_fill_memory(void *ptr, size_t start, size_t end)
|
||||
{
|
||||
Uint8* mem = (Uint8*) ptr;
|
||||
Uint8 *mem = (Uint8 *)ptr;
|
||||
size_t i;
|
||||
|
||||
if (!s_randfill_allocations)
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@
|
|||
/* Glib 2.0 */
|
||||
|
||||
typedef unsigned long gulong;
|
||||
typedef void* gpointer;
|
||||
typedef void *gpointer;
|
||||
typedef char gchar;
|
||||
typedef int gint;
|
||||
typedef unsigned int guint;
|
||||
|
|
@ -88,11 +88,11 @@ typedef struct _GtkCheckMenuItem GtkCheckMenuItem;
|
|||
|
||||
static gboolean (*gtk_init_check)(int *argc, char ***argv);
|
||||
static gboolean (*gtk_main_iteration_do)(gboolean blocking);
|
||||
static GtkWidget* (*gtk_menu_new)(void);
|
||||
static GtkWidget* (*gtk_separator_menu_item_new)(void);
|
||||
static GtkWidget* (*gtk_menu_item_new_with_label)(const gchar *label);
|
||||
static GtkWidget *(*gtk_menu_new)(void);
|
||||
static GtkWidget *(*gtk_separator_menu_item_new)(void);
|
||||
static GtkWidget *(*gtk_menu_item_new_with_label)(const gchar *label);
|
||||
static void (*gtk_menu_item_set_submenu)(GtkMenuItem *menu_item, GtkWidget *submenu);
|
||||
static GtkWidget* (*gtk_check_menu_item_new_with_label)(const gchar *label);
|
||||
static GtkWidget *(*gtk_check_menu_item_new_with_label)(const gchar *label);
|
||||
static void (*gtk_check_menu_item_set_active)(GtkCheckMenuItem *check_menu_item, gboolean is_active);
|
||||
static void (*gtk_widget_set_sensitive)(GtkWidget *widget, gboolean sensitive);
|
||||
static void (*gtk_widget_show)(GtkWidget *widget);
|
||||
|
|
|
|||
|
|
@ -486,8 +486,8 @@ static void SDL_TARGETING("mmx") Blit565to565SurfaceAlphaMMX(SDL_BlitInfo *info)
|
|||
d &= 0x07e0f81f;
|
||||
*dstp++ = (Uint16)(d | d >> 16);
|
||||
},{
|
||||
src1 = *(__m64*)srcp; // 4 src pixels -> src1
|
||||
dst1 = *(__m64*)dstp; // 4 dst pixels -> dst1
|
||||
src1 = *(__m64 *)srcp; // 4 src pixels -> src1
|
||||
dst1 = *(__m64 *)dstp; // 4 dst pixels -> dst1
|
||||
|
||||
// red
|
||||
src2 = src1;
|
||||
|
|
@ -536,7 +536,7 @@ static void SDL_TARGETING("mmx") Blit565to565SurfaceAlphaMMX(SDL_BlitInfo *info)
|
|||
|
||||
mm_res = _mm_or_si64(mm_res, dst2); // RED | GREEN | BLUE -> mm_res
|
||||
|
||||
*(__m64*)dstp = mm_res; // mm_res -> 4 dst pixels
|
||||
*(__m64 *)dstp = mm_res; // mm_res -> 4 dst pixels
|
||||
|
||||
srcp += 4;
|
||||
dstp += 4;
|
||||
|
|
@ -624,8 +624,8 @@ static void SDL_TARGETING("mmx") Blit555to555SurfaceAlphaMMX(SDL_BlitInfo *info)
|
|||
d &= 0x03e07c1f;
|
||||
*dstp++ = (Uint16)(d | d >> 16);
|
||||
},{
|
||||
src1 = *(__m64*)srcp; // 4 src pixels -> src1
|
||||
dst1 = *(__m64*)dstp; // 4 dst pixels -> dst1
|
||||
src1 = *(__m64 *)srcp; // 4 src pixels -> src1
|
||||
dst1 = *(__m64 *)dstp; // 4 dst pixels -> dst1
|
||||
|
||||
// red -- process the bits in place
|
||||
src2 = src1;
|
||||
|
|
@ -674,7 +674,7 @@ static void SDL_TARGETING("mmx") Blit555to555SurfaceAlphaMMX(SDL_BlitInfo *info)
|
|||
|
||||
mm_res = _mm_or_si64(mm_res, dst2); // RED | GREEN | BLUE -> mm_res
|
||||
|
||||
*(__m64*)dstp = mm_res; // mm_res -> 4 dst pixels
|
||||
*(__m64 *)dstp = mm_res; // mm_res -> 4 dst pixels
|
||||
|
||||
srcp += 4;
|
||||
dstp += 4;
|
||||
|
|
@ -1061,8 +1061,8 @@ static void SDL_TARGETING("sse4.1") Blit8888to8888PixelAlphaSwizzleSSE41(SDL_Bli
|
|||
__m128i dst_hi = _mm_maddubs_epi16(srca_hi, _mm_unpackhi_epi8(src128, dst128));
|
||||
|
||||
// dst += 0x1U (use 0x80 to round instead of floor) + 128*255 (to fix maddubs result)
|
||||
dst_lo = _mm_add_epi16(dst_lo, _mm_set1_epi16(1 + 128*255));
|
||||
dst_hi = _mm_add_epi16(dst_hi, _mm_set1_epi16(1 + 128*255));
|
||||
dst_lo = _mm_add_epi16(dst_lo, _mm_set1_epi16(1 + 128 * 255));
|
||||
dst_hi = _mm_add_epi16(dst_hi, _mm_set1_epi16(1 + 128 * 255));
|
||||
|
||||
// dst = (dst + (dst >> 8)) >> 8 = (dst * 257) >> 16
|
||||
dst_lo = _mm_mulhi_epu16(dst_lo, _mm_set1_epi16(257));
|
||||
|
|
@ -1165,8 +1165,8 @@ static void SDL_TARGETING("avx2") Blit8888to8888PixelAlphaSwizzleAVX2(SDL_BlitIn
|
|||
__m256i dst_hi = _mm256_maddubs_epi16(alpha_hi, _mm256_unpackhi_epi8(src256, dst256));
|
||||
|
||||
// dst += 0x1U (use 0x80 to round instead of floor) + 128*255 (to fix maddubs result)
|
||||
dst_lo = _mm256_add_epi16(dst_lo, _mm256_set1_epi16(1 + 128*255));
|
||||
dst_hi = _mm256_add_epi16(dst_hi, _mm256_set1_epi16(1 + 128*255));
|
||||
dst_lo = _mm256_add_epi16(dst_lo, _mm256_set1_epi16(1 + 128 * 255));
|
||||
dst_hi = _mm256_add_epi16(dst_hi, _mm256_set1_epi16(1 + 128 * 255));
|
||||
|
||||
// dst = (dst + (dst >> 8)) >> 8 = (dst * 257) >> 16
|
||||
dst_lo = _mm256_mulhi_epu16(dst_lo, _mm256_set1_epi16(257));
|
||||
|
|
@ -1290,8 +1290,8 @@ static void Blit8888to8888PixelAlphaSwizzleNEON(SDL_BlitInfo *info)
|
|||
// Process 1 pixel per iteration, max 3 iterations, same calculations as above
|
||||
for (; i < width; ++i) {
|
||||
// Top 32-bits will be not used in src32 & dst32
|
||||
uint8x8_t src32 = vreinterpret_u8_u32(vld1_dup_u32((Uint32*)src));
|
||||
uint8x8_t dst32 = vreinterpret_u8_u32(vld1_dup_u32((Uint32*)dst));
|
||||
uint8x8_t src32 = vreinterpret_u8_u32(vld1_dup_u32((Uint32 *)src));
|
||||
uint8x8_t dst32 = vreinterpret_u8_u32(vld1_dup_u32((Uint32 *)dst));
|
||||
|
||||
uint8x8_t srcA = vtbl1_u8(src32, vget_low_u8(alpha_splat_mask));
|
||||
src32 = vtbl1_u8(src32, vget_low_u8(convert_mask));
|
||||
|
|
@ -1309,7 +1309,7 @@ static void Blit8888to8888PixelAlphaSwizzleNEON(SDL_BlitInfo *info)
|
|||
}
|
||||
|
||||
// Save the result, only low 32-bits
|
||||
vst1_lane_u32((Uint32*)dst, vreinterpret_u32_u8(dst32), 0);
|
||||
vst1_lane_u32((Uint32 *)dst, vreinterpret_u32_u8(dst32), 0);
|
||||
|
||||
src += 4;
|
||||
dst += 4;
|
||||
|
|
|
|||
|
|
@ -2258,7 +2258,7 @@ static void BlitNtoNKey(SDL_BlitInfo *info)
|
|||
/* *INDENT-OFF* */ // clang-format off
|
||||
DUFFS_LOOP(
|
||||
{
|
||||
Uint32 *src32 = (Uint32*)src;
|
||||
Uint32 *src32 = (Uint32 *)src;
|
||||
|
||||
if ((*src32 & rgbmask) != ckey) {
|
||||
dst[0] = src[p0];
|
||||
|
|
@ -2366,7 +2366,7 @@ static void BlitNtoNKey(SDL_BlitInfo *info)
|
|||
/* *INDENT-OFF* */ // clang-format off
|
||||
DUFFS_LOOP(
|
||||
{
|
||||
Uint32 *src32 = (Uint32*)src;
|
||||
Uint32 *src32 = (Uint32 *)src;
|
||||
if ((*src32 & rgbmask) != ckey) {
|
||||
dst[0] = src[p0];
|
||||
dst[1] = src[p1];
|
||||
|
|
@ -2516,7 +2516,7 @@ static void BlitNtoNKeyCopyAlpha(SDL_BlitInfo *info)
|
|||
/* *INDENT-OFF* */ // clang-format off
|
||||
DUFFS_LOOP(
|
||||
{
|
||||
Uint32 *src32 = (Uint32*)src;
|
||||
Uint32 *src32 = (Uint32 *)src;
|
||||
if ((*src32 & rgbmask) != ckey) {
|
||||
dst[0] = src[p0];
|
||||
dst[1] = src[p1];
|
||||
|
|
@ -2777,7 +2777,7 @@ static void Blit8888to8888PixelSwizzleNEON(SDL_BlitInfo *info)
|
|||
// Process 1 pixel per iteration, max 3 iterations, same calculations as above
|
||||
for (; i < width; ++i) {
|
||||
// Top 32-bits will be not used in src32
|
||||
uint8x8_t src32 = vreinterpret_u8_u32(vld1_dup_u32((Uint32*)src));
|
||||
uint8x8_t src32 = vreinterpret_u8_u32(vld1_dup_u32((Uint32 *)src));
|
||||
|
||||
// Convert to dst format
|
||||
src32 = vtbl1_u8(src32, vget_low_u8(convert_mask));
|
||||
|
|
@ -2788,7 +2788,7 @@ static void Blit8888to8888PixelSwizzleNEON(SDL_BlitInfo *info)
|
|||
}
|
||||
|
||||
// Save the result, only low 32-bits
|
||||
vst1_lane_u32((Uint32*)dst, vreinterpret_u32_u8(src32), 0);
|
||||
vst1_lane_u32((Uint32 *)dst, vreinterpret_u32_u8(src32), 0);
|
||||
|
||||
src += 4;
|
||||
dst += 4;
|
||||
|
|
@ -2829,7 +2829,7 @@ static void Blit_3or4_to_3or4__same_rgb(SDL_BlitInfo *info)
|
|||
/* *INDENT-OFF* */ // clang-format off
|
||||
DUFFS_LOOP(
|
||||
{
|
||||
Uint32 *dst32 = (Uint32*)dst;
|
||||
Uint32 *dst32 = (Uint32 *)dst;
|
||||
Uint8 s0 = src[i0];
|
||||
Uint8 s1 = src[i1];
|
||||
Uint8 s2 = src[i2];
|
||||
|
|
@ -2901,7 +2901,7 @@ static void Blit_3or4_to_3or4__inversed_rgb(SDL_BlitInfo *info)
|
|||
/* *INDENT-OFF* */ // clang-format off
|
||||
DUFFS_LOOP(
|
||||
{
|
||||
Uint32 *dst32 = (Uint32*)dst;
|
||||
Uint32 *dst32 = (Uint32 *)dst;
|
||||
Uint8 s0 = src[i0];
|
||||
Uint8 s1 = src[i1];
|
||||
Uint8 s2 = src[i2];
|
||||
|
|
@ -2929,7 +2929,7 @@ static void Blit_3or4_to_3or4__inversed_rgb(SDL_BlitInfo *info)
|
|||
/* *INDENT-OFF* */ // clang-format off
|
||||
DUFFS_LOOP(
|
||||
{
|
||||
Uint32 *dst32 = (Uint32*)dst;
|
||||
Uint32 *dst32 = (Uint32 *)dst;
|
||||
Uint8 s0 = src[i0];
|
||||
Uint8 s1 = src[i1];
|
||||
Uint8 s2 = src[i2];
|
||||
|
|
|
|||
|
|
@ -288,7 +288,7 @@ typedef struct color_t
|
|||
#if 0
|
||||
static void printf_64(const char *str, void *var)
|
||||
{
|
||||
uint8_t *val = (uint8_t*) var;
|
||||
uint8_t *val = (uint8_t *)var;
|
||||
printf(" * %s: %02x %02x %02x %02x _ %02x %02x %02x %02x\n",
|
||||
str, val[0], val[1], val[2], val[3], val[4], val[5], val[6], val[7]);
|
||||
}
|
||||
|
|
@ -394,7 +394,7 @@ static bool scale_mat(const Uint32 *src, int src_w, int src_h, int src_pitch, Ui
|
|||
#if 0
|
||||
static void SDL_TARGETING("sse2") printf_128(const char *str, __m128i var)
|
||||
{
|
||||
uint16_t *val = (uint16_t*) &var;
|
||||
uint16_t *val = (uint16_t *)&var;
|
||||
printf(" * %s: %04x %04x %04x %04x _ %04x %04x %04x %04x\n",
|
||||
str, val[0], val[1], val[2], val[3], val[4], val[5], val[6], val[7]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -336,7 +336,7 @@ struct SDL_VideoDevice
|
|||
*/
|
||||
bool (*Vulkan_LoadLibrary)(SDL_VideoDevice *_this, const char *path);
|
||||
void (*Vulkan_UnloadLibrary)(SDL_VideoDevice *_this);
|
||||
char const* const* (*Vulkan_GetInstanceExtensions)(SDL_VideoDevice *_this, Uint32 *count);
|
||||
char const * const *(*Vulkan_GetInstanceExtensions)(SDL_VideoDevice *_this, Uint32 *count);
|
||||
bool (*Vulkan_CreateSurface)(SDL_VideoDevice *_this, SDL_Window *window, VkInstance instance, const struct VkAllocationCallbacks *allocator, VkSurfaceKHR *surface);
|
||||
void (*Vulkan_DestroySurface)(SDL_VideoDevice *_this, VkInstance instance, VkSurfaceKHR surface, const struct VkAllocationCallbacks *allocator);
|
||||
bool (*Vulkan_GetPresentationSupport)(SDL_VideoDevice *_this, VkInstance instance, VkPhysicalDevice physicalDevice, Uint32 queueFamilyIndex);
|
||||
|
|
|
|||
|
|
@ -3672,6 +3672,10 @@ bool SDL_SetWindowParent(SDL_Window *window, SDL_Window *parent)
|
|||
CHECK_WINDOW_NOT_POPUP(parent, false);
|
||||
}
|
||||
|
||||
if (window == parent) {
|
||||
return SDL_SetError("Cannot set the parent of a window to itself.");
|
||||
}
|
||||
|
||||
if (!_this->SetWindowParent) {
|
||||
return SDL_Unsupported();
|
||||
}
|
||||
|
|
@ -4135,7 +4139,7 @@ void SDL_OnWindowLiveResizeUpdate(SDL_Window *window)
|
|||
SDL_IterateMainCallbacks(false);
|
||||
} else {
|
||||
// Send an expose event so the application can redraw
|
||||
SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_EXPOSED, 0, 0);
|
||||
SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_EXPOSED, 1, 0);
|
||||
}
|
||||
|
||||
SDL_PumpEventMaintenance();
|
||||
|
|
@ -6020,7 +6024,7 @@ void SDL_Vulkan_UnloadLibrary(void)
|
|||
}
|
||||
}
|
||||
|
||||
char const* const* SDL_Vulkan_GetInstanceExtensions(Uint32 *count)
|
||||
char const * const *SDL_Vulkan_GetInstanceExtensions(Uint32 *count)
|
||||
{
|
||||
return _this->Vulkan_GetInstanceExtensions(_this, count);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -110,8 +110,7 @@ void Android_Vulkan_UnloadLibrary(SDL_VideoDevice *_this)
|
|||
}
|
||||
}
|
||||
|
||||
char const* const* Android_Vulkan_GetInstanceExtensions(SDL_VideoDevice *_this,
|
||||
Uint32 *count)
|
||||
char const * const *Android_Vulkan_GetInstanceExtensions(SDL_VideoDevice *_this, Uint32 *count)
|
||||
{
|
||||
static const char *const extensionsForAndroid[] = {
|
||||
VK_KHR_SURFACE_EXTENSION_NAME, VK_KHR_ANDROID_SURFACE_EXTENSION_NAME
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@
|
|||
|
||||
extern bool Android_Vulkan_LoadLibrary(SDL_VideoDevice *_this, const char *path);
|
||||
extern void Android_Vulkan_UnloadLibrary(SDL_VideoDevice *_this);
|
||||
extern char const* const* Android_Vulkan_GetInstanceExtensions(SDL_VideoDevice *_this, Uint32 *count);
|
||||
extern char const * const *Android_Vulkan_GetInstanceExtensions(SDL_VideoDevice *_this, Uint32 *count);
|
||||
extern bool Android_Vulkan_CreateSurface(SDL_VideoDevice *_this,
|
||||
SDL_Window *window,
|
||||
VkInstance instance,
|
||||
|
|
|
|||
|
|
@ -244,7 +244,7 @@ void Cocoa_VideoQuit(SDL_VideoDevice *_this)
|
|||
SDL_SystemTheme Cocoa_GetSystemTheme(void)
|
||||
{
|
||||
if (@available(macOS 10.14, *)) {
|
||||
NSAppearance* appearance = [[NSApplication sharedApplication] effectiveAppearance];
|
||||
NSAppearance *appearance = [[NSApplication sharedApplication] effectiveAppearance];
|
||||
|
||||
if ([appearance.name containsString: @"Dark"]) {
|
||||
return SDL_SYSTEM_THEME_DARK;
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@
|
|||
|
||||
extern bool Cocoa_Vulkan_LoadLibrary(SDL_VideoDevice *_this, const char *path);
|
||||
extern void Cocoa_Vulkan_UnloadLibrary(SDL_VideoDevice *_this);
|
||||
extern char const* const* Cocoa_Vulkan_GetInstanceExtensions(SDL_VideoDevice *_this, Uint32 *count);
|
||||
extern char const * const *Cocoa_Vulkan_GetInstanceExtensions(SDL_VideoDevice *_this, Uint32 *count);
|
||||
extern bool Cocoa_Vulkan_CreateSurface(SDL_VideoDevice *_this,
|
||||
SDL_Window *window,
|
||||
VkInstance instance,
|
||||
|
|
|
|||
|
|
@ -161,8 +161,7 @@ void Cocoa_Vulkan_UnloadLibrary(SDL_VideoDevice *_this)
|
|||
}
|
||||
}
|
||||
|
||||
char const* const* Cocoa_Vulkan_GetInstanceExtensions(SDL_VideoDevice *_this,
|
||||
Uint32 *count)
|
||||
char const * const *Cocoa_Vulkan_GetInstanceExtensions(SDL_VideoDevice *_this, Uint32 *count)
|
||||
{
|
||||
static const char *const extensionsForCocoa[] = {
|
||||
VK_KHR_SURFACE_EXTENSION_NAME, VK_EXT_METAL_SURFACE_EXTENSION_NAME, VK_KHR_PORTABILITY_ENUMERATION_EXTENSION_NAME
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ bool Emscripten_UpdateWindowFramebuffer(SDL_VideoDevice *_this, SDL_Window *wind
|
|||
data32.set(HEAP32.subarray(src, src + num));
|
||||
var data8 = SDL3.data8;
|
||||
var i = 3;
|
||||
var j = i + 4*num;
|
||||
var j = i + 4 * num;
|
||||
if (num % 8 == 0) {
|
||||
// unrolling gives big speedups
|
||||
while (i < j) {
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ char *HAIKU_GetClipboardText(SDL_VideoDevice *_this) {
|
|||
if (be_clipboard->Lock()) {
|
||||
if ((clip = be_clipboard->Data())) {
|
||||
// Presumably the string of characters is ascii-format
|
||||
clip->FindData("text/plain", B_MIME_TYPE, (const void**)&text,
|
||||
clip->FindData("text/plain", B_MIME_TYPE, (const void **)&text,
|
||||
&length);
|
||||
}
|
||||
be_clipboard->Unlock();
|
||||
|
|
|
|||
|
|
@ -324,7 +324,7 @@ protected:
|
|||
}
|
||||
|
||||
virtual void
|
||||
SetTitle(const char* aTitle)
|
||||
SetTitle(const char *aTitle)
|
||||
{
|
||||
fTitle = aTitle;
|
||||
BAlert::SetTitle(aTitle);
|
||||
|
|
|
|||
|
|
@ -178,7 +178,7 @@ static void _BDisplayModeToSdlDisplayMode(display_mode *bmode, SDL_DisplayMode *
|
|||
get_refresh_rate(*bmode, &mode->refresh_rate_numerator, &mode->refresh_rate_denominator);
|
||||
|
||||
#if WRAP_BMODE
|
||||
SDL_DisplayModeData *data = (SDL_DisplayModeData*)SDL_calloc(1, sizeof(SDL_DisplayModeData));
|
||||
SDL_DisplayModeData *data = (SDL_DisplayModeData *)SDL_calloc(1, sizeof(SDL_DisplayModeData));
|
||||
data->bmode = bmode;
|
||||
|
||||
mode->internal = data;
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ bool HAIKU_GL_SwapWindow(SDL_VideoDevice *_this, SDL_Window * window)
|
|||
|
||||
bool HAIKU_GL_MakeCurrent(SDL_VideoDevice *_this, SDL_Window * window, SDL_GLContext context)
|
||||
{
|
||||
BGLView* glView = (BGLView*)context;
|
||||
BGLView *glView = (BGLView *)context;
|
||||
// printf("HAIKU_GL_MakeCurrent(%llx), win = %llx, thread = %d\n", (uint64)context, (uint64)window, find_thread(NULL));
|
||||
if (glView) {
|
||||
if ((glView->Window() == NULL) || (!window) || (_ToBeWin(window)->GetGLView() != glView)) {
|
||||
|
|
@ -150,8 +150,8 @@ SDL_GLContext HAIKU_GL_CreateContext(SDL_VideoDevice *_this, SDL_Window * window
|
|||
bool HAIKU_GL_DestroyContext(SDL_VideoDevice *_this, SDL_GLContext context)
|
||||
{
|
||||
// printf("HAIKU_GL_DestroyContext(%llx), thread = %d\n", (uint64)context, find_thread(NULL));
|
||||
BGLView* glView = (BGLView*)context;
|
||||
SDL_BWin *bwin = (SDL_BWin*)glView->Window();
|
||||
BGLView *glView = (BGLView *)context;
|
||||
SDL_BWin *bwin = (SDL_BWin *)glView->Window();
|
||||
if (!bwin) {
|
||||
delete glView;
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -588,88 +588,51 @@ static void KMSDRM_DeinitDisplays(SDL_VideoDevice *_this)
|
|||
}
|
||||
}
|
||||
|
||||
static uint32_t KMSDRM_CrtcGetPropId(uint32_t drm_fd,
|
||||
drmModeObjectPropertiesPtr props,
|
||||
char const *name)
|
||||
static bool KMSDRM_ConnectorCheckVrrCapable(uint32_t drm_fd, uint32_t output_id)
|
||||
{
|
||||
uint32_t i, prop_id = 0;
|
||||
|
||||
for (i = 0; !prop_id && i < props->count_props; ++i) {
|
||||
drmModePropertyPtr drm_prop =
|
||||
KMSDRM_drmModeGetProperty(drm_fd, props->props[i]);
|
||||
|
||||
if (!drm_prop) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (SDL_strcmp(drm_prop->name, name) == 0) {
|
||||
prop_id = drm_prop->prop_id;
|
||||
}
|
||||
|
||||
KMSDRM_drmModeFreeProperty(drm_prop);
|
||||
}
|
||||
|
||||
return prop_id;
|
||||
}
|
||||
|
||||
static bool KMSDRM_VrrPropId(uint32_t drm_fd, uint32_t crtc_id, uint32_t *vrr_prop_id)
|
||||
{
|
||||
drmModeObjectPropertiesPtr drm_props;
|
||||
|
||||
drm_props = KMSDRM_drmModeObjectGetProperties(drm_fd,
|
||||
crtc_id,
|
||||
DRM_MODE_OBJECT_CRTC);
|
||||
|
||||
if (!drm_props) {
|
||||
return false;
|
||||
}
|
||||
|
||||
*vrr_prop_id = KMSDRM_CrtcGetPropId(drm_fd,
|
||||
drm_props,
|
||||
"VRR_ENABLED");
|
||||
|
||||
KMSDRM_drmModeFreeObjectProperties(drm_props);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool KMSDRM_ConnectorCheckVrrCapable(uint32_t drm_fd,
|
||||
uint32_t output_id,
|
||||
char const *name)
|
||||
{
|
||||
uint32_t i;
|
||||
bool found = false;
|
||||
uint64_t prop_value = 0;
|
||||
|
||||
drmModeObjectPropertiesPtr props = KMSDRM_drmModeObjectGetProperties(drm_fd,
|
||||
output_id,
|
||||
DRM_MODE_OBJECT_CONNECTOR);
|
||||
|
||||
if (!props) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (i = 0; !found && i < props->count_props; ++i) {
|
||||
drmModePropertyPtr drm_prop = KMSDRM_drmModeGetProperty(drm_fd, props->props[i]);
|
||||
|
||||
if (!drm_prop) {
|
||||
continue;
|
||||
drmModeObjectPropertiesPtr props = KMSDRM_drmModeObjectGetProperties(drm_fd, output_id, DRM_MODE_OBJECT_CONNECTOR);
|
||||
if (props) {
|
||||
for (uint32_t i = 0; !found && i < props->count_props; ++i) {
|
||||
drmModePropertyPtr prop = KMSDRM_drmModeGetProperty(drm_fd, props->props[i]);
|
||||
if (prop) {
|
||||
if (SDL_strcasecmp(prop->name, "VRR_CAPABLE") == 0) {
|
||||
prop_value = props->prop_values[i];
|
||||
found = true;
|
||||
}
|
||||
KMSDRM_drmModeFreeProperty(prop);
|
||||
}
|
||||
}
|
||||
|
||||
if (SDL_strcasecmp(drm_prop->name, name) == 0) {
|
||||
prop_value = props->prop_values[i];
|
||||
found = true;
|
||||
}
|
||||
|
||||
KMSDRM_drmModeFreeProperty(drm_prop);
|
||||
KMSDRM_drmModeFreeObjectProperties(props);
|
||||
}
|
||||
if (found) {
|
||||
return prop_value ? true : false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool KMSDRM_VrrPropId(uint32_t drm_fd, uint32_t crtc_id, uint32_t *vrr_prop_id)
|
||||
{
|
||||
bool found = false;
|
||||
drmModeObjectPropertiesPtr props = KMSDRM_drmModeObjectGetProperties(drm_fd, crtc_id, DRM_MODE_OBJECT_CRTC);
|
||||
if (props) {
|
||||
for (uint32_t i = 0; !found && i < props->count_props; ++i) {
|
||||
drmModePropertyPtr prop = KMSDRM_drmModeGetProperty(drm_fd, props->props[i]);
|
||||
if (prop) {
|
||||
if (SDL_strcmp(prop->name, "VRR_ENABLED") == 0) {
|
||||
*vrr_prop_id = prop->prop_id;
|
||||
found = true;
|
||||
}
|
||||
KMSDRM_drmModeFreeProperty(prop);
|
||||
}
|
||||
}
|
||||
KMSDRM_drmModeFreeObjectProperties(props);
|
||||
}
|
||||
return found;
|
||||
}
|
||||
|
||||
static void KMSDRM_CrtcSetVrr(uint32_t drm_fd, uint32_t crtc_id, bool enabled)
|
||||
{
|
||||
uint32_t vrr_prop_id;
|
||||
|
|
@ -677,119 +640,67 @@ static void KMSDRM_CrtcSetVrr(uint32_t drm_fd, uint32_t crtc_id, bool enabled)
|
|||
return;
|
||||
}
|
||||
|
||||
KMSDRM_drmModeObjectSetProperty(drm_fd,
|
||||
crtc_id,
|
||||
DRM_MODE_OBJECT_CRTC,
|
||||
vrr_prop_id,
|
||||
enabled);
|
||||
KMSDRM_drmModeObjectSetProperty(drm_fd, crtc_id, DRM_MODE_OBJECT_CRTC, vrr_prop_id, enabled);
|
||||
}
|
||||
|
||||
static bool KMSDRM_CrtcGetVrr(uint32_t drm_fd, uint32_t crtc_id)
|
||||
{
|
||||
uint32_t object_prop_id, vrr_prop_id;
|
||||
drmModeObjectPropertiesPtr props;
|
||||
bool object_prop_value;
|
||||
int i;
|
||||
uint32_t vrr_prop_id = 0;
|
||||
bool found = false;
|
||||
uint64_t prop_value = 0;
|
||||
|
||||
if (!KMSDRM_VrrPropId(drm_fd, crtc_id, &vrr_prop_id)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
props = KMSDRM_drmModeObjectGetProperties(drm_fd,
|
||||
crtc_id,
|
||||
DRM_MODE_OBJECT_CRTC);
|
||||
|
||||
if (!props) {
|
||||
return false;
|
||||
drmModeObjectPropertiesPtr props = KMSDRM_drmModeObjectGetProperties(drm_fd, crtc_id, DRM_MODE_OBJECT_CRTC);
|
||||
if (props) {
|
||||
for (uint32_t i = 0; !found && i < props->count_props; ++i) {
|
||||
drmModePropertyPtr prop = KMSDRM_drmModeGetProperty(drm_fd, props->props[i]);
|
||||
if (prop) {
|
||||
if (prop->prop_id == vrr_prop_id) {
|
||||
prop_value = props->prop_values[i];
|
||||
found = true;
|
||||
}
|
||||
KMSDRM_drmModeFreeProperty(prop);
|
||||
}
|
||||
}
|
||||
KMSDRM_drmModeFreeObjectProperties(props);
|
||||
}
|
||||
|
||||
for (i = 0; i < props->count_props; ++i) {
|
||||
drmModePropertyPtr drm_prop = KMSDRM_drmModeGetProperty(drm_fd, props->props[i]);
|
||||
|
||||
if (!drm_prop) {
|
||||
continue;
|
||||
}
|
||||
|
||||
object_prop_id = drm_prop->prop_id;
|
||||
object_prop_value = props->prop_values[i] ? true : false;
|
||||
|
||||
KMSDRM_drmModeFreeProperty(drm_prop);
|
||||
|
||||
if (object_prop_id == vrr_prop_id) {
|
||||
return object_prop_value;
|
||||
}
|
||||
if (found) {
|
||||
return prop_value ? true : false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool KMSDRM_OrientationPropId(uint32_t drm_fd, uint32_t crtc_id, uint32_t *orientation_prop_id)
|
||||
{
|
||||
drmModeObjectPropertiesPtr drm_props;
|
||||
|
||||
drm_props = KMSDRM_drmModeObjectGetProperties(drm_fd,
|
||||
crtc_id,
|
||||
DRM_MODE_OBJECT_CONNECTOR);
|
||||
|
||||
if (!drm_props) {
|
||||
return false;
|
||||
}
|
||||
|
||||
*orientation_prop_id = KMSDRM_CrtcGetPropId(drm_fd,
|
||||
drm_props,
|
||||
"panel orientation");
|
||||
|
||||
KMSDRM_drmModeFreeObjectProperties(drm_props);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static int KMSDRM_CrtcGetOrientation(uint32_t drm_fd, uint32_t crtc_id)
|
||||
{
|
||||
uint32_t orientation_prop_id;
|
||||
drmModeObjectPropertiesPtr props;
|
||||
int i;
|
||||
bool done = false;
|
||||
bool found = false;
|
||||
int orientation = 0;
|
||||
|
||||
if (!KMSDRM_OrientationPropId(drm_fd, crtc_id, &orientation_prop_id)) {
|
||||
return orientation;
|
||||
}
|
||||
|
||||
props = KMSDRM_drmModeObjectGetProperties(drm_fd,
|
||||
crtc_id,
|
||||
DRM_MODE_OBJECT_CONNECTOR);
|
||||
|
||||
if (!props) {
|
||||
return orientation;
|
||||
}
|
||||
|
||||
for (i = 0; i < props->count_props && !done; ++i) {
|
||||
drmModePropertyPtr drm_prop = KMSDRM_drmModeGetProperty(drm_fd, props->props[i]);
|
||||
|
||||
if (!drm_prop) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (drm_prop->prop_id == orientation_prop_id && (drm_prop->flags & DRM_MODE_PROP_ENUM)) {
|
||||
if (drm_prop->count_enums) {
|
||||
// "Normal" is the default of no rotation (0 degrees)
|
||||
if (SDL_strcmp(drm_prop->enums[0].name, "Left Side Up") == 0) {
|
||||
orientation = 90;
|
||||
} else if (SDL_strcmp(drm_prop->enums[0].name, "Upside Down") == 0) {
|
||||
orientation = 180;
|
||||
} else if (SDL_strcmp(drm_prop->enums[0].name, "Right Side Up") == 0) {
|
||||
orientation = 270;
|
||||
drmModeObjectPropertiesPtr props = KMSDRM_drmModeObjectGetProperties(drm_fd, crtc_id, DRM_MODE_OBJECT_CONNECTOR);
|
||||
if (props) {
|
||||
for (uint32_t i = 0; !found && i < props->count_props; ++i) {
|
||||
drmModePropertyPtr prop = KMSDRM_drmModeGetProperty(drm_fd, props->props[i]);
|
||||
if (prop) {
|
||||
if (SDL_strcasecmp(prop->name, "panel orientation") == 0 && (prop->flags & DRM_MODE_PROP_ENUM)) {
|
||||
if (prop->count_enums) {
|
||||
// "Normal" is the default of no rotation (0 degrees)
|
||||
if (SDL_strcmp(prop->enums[0].name, "Left Side Up") == 0) {
|
||||
orientation = 90;
|
||||
} else if (SDL_strcmp(prop->enums[0].name, "Upside Down") == 0) {
|
||||
orientation = 180;
|
||||
} else if (SDL_strcmp(prop->enums[0].name, "Right Side Up") == 0) {
|
||||
orientation = 270;
|
||||
}
|
||||
}
|
||||
found = true;
|
||||
}
|
||||
KMSDRM_drmModeFreeProperty(prop);
|
||||
}
|
||||
|
||||
done = true;
|
||||
}
|
||||
|
||||
KMSDRM_drmModeFreeProperty(drm_prop);
|
||||
KMSDRM_drmModeFreeObjectProperties(props);
|
||||
}
|
||||
|
||||
KMSDRM_drmModeFreeObjectProperties(props);
|
||||
|
||||
return orientation;
|
||||
}
|
||||
|
||||
|
|
@ -964,7 +875,7 @@ static void KMSDRM_AddDisplay(SDL_VideoDevice *_this, drmModeConnector *connecto
|
|||
// save previous vrr state
|
||||
dispdata->saved_vrr = KMSDRM_CrtcGetVrr(viddata->drm_fd, crtc->crtc_id);
|
||||
// try to enable vrr
|
||||
if (KMSDRM_ConnectorCheckVrrCapable(viddata->drm_fd, connector->connector_id, "VRR_CAPABLE")) {
|
||||
if (KMSDRM_ConnectorCheckVrrCapable(viddata->drm_fd, connector->connector_id)) {
|
||||
SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "Enabling VRR");
|
||||
KMSDRM_CrtcSetVrr(viddata->drm_fd, crtc->crtc_id, true);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -140,8 +140,7 @@ void KMSDRM_Vulkan_UnloadLibrary(SDL_VideoDevice *_this)
|
|||
// members of the VkInstanceCreateInfo struct passed to
|
||||
// vkCreateInstance().
|
||||
/*********************************************************************/
|
||||
char const* const* KMSDRM_Vulkan_GetInstanceExtensions(SDL_VideoDevice *_this,
|
||||
Uint32 *count)
|
||||
char const * const *KMSDRM_Vulkan_GetInstanceExtensions(SDL_VideoDevice *_this, Uint32 *count)
|
||||
{
|
||||
static const char *const extensionsForKMSDRM[] = {
|
||||
VK_KHR_SURFACE_EXTENSION_NAME, VK_KHR_DISPLAY_EXTENSION_NAME
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@
|
|||
|
||||
extern bool KMSDRM_Vulkan_LoadLibrary(SDL_VideoDevice *_this, const char *path);
|
||||
extern void KMSDRM_Vulkan_UnloadLibrary(SDL_VideoDevice *_this);
|
||||
extern char const* const* KMSDRM_Vulkan_GetInstanceExtensions(SDL_VideoDevice *_this, Uint32 *count);
|
||||
extern char const * const *KMSDRM_Vulkan_GetInstanceExtensions(SDL_VideoDevice *_this, Uint32 *count);
|
||||
extern bool KMSDRM_Vulkan_CreateSurface(SDL_VideoDevice *_this,
|
||||
SDL_Window *window,
|
||||
VkInstance instance,
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ static void CopyFramebuffertoN3DS_24(u8 *dest, const Dimensions dest_dim, const
|
|||
static void CopyFramebuffertoN3DS_32(u32 *dest, const Dimensions dest_dim, const u32 *source, const Dimensions source_dim);
|
||||
static int GetDestOffset(int x, int y, int dest_width);
|
||||
static int GetSourceOffset(int x, int y, int source_width);
|
||||
static void FlushN3DSBuffer(const void *buffer, u32 bufsize, gfxScreen_t screen);
|
||||
static void FlushN3DSBuffer(const void *buffer, u32 bufsize, gfxScreen_t screen, bool swap);
|
||||
|
||||
|
||||
bool SDL_N3DS_CreateWindowFramebuffer(SDL_VideoDevice *_this, SDL_Window *window, SDL_PixelFormat *format, void **pixels, int *pitch)
|
||||
|
|
@ -67,6 +67,7 @@ bool SDL_N3DS_CreateWindowFramebuffer(SDL_VideoDevice *_this, SDL_Window *window
|
|||
|
||||
bool SDL_N3DS_UpdateWindowFramebuffer(SDL_VideoDevice *_this, SDL_Window *window, const SDL_Rect *rects, int numrects)
|
||||
{
|
||||
SDL_VideoData *internal = (SDL_VideoData *)_this->internal;
|
||||
SDL_WindowData *drv_data = window->internal;
|
||||
SDL_Surface *surface;
|
||||
u16 width, height;
|
||||
|
|
@ -79,7 +80,7 @@ bool SDL_N3DS_UpdateWindowFramebuffer(SDL_VideoDevice *_this, SDL_Window *window
|
|||
}
|
||||
|
||||
// Get the N3DS internal framebuffer and its size
|
||||
framebuffer = gfxGetFramebuffer(drv_data->screen, GFX_LEFT, &width, &height);
|
||||
framebuffer = gfxGetFramebuffer(drv_data->screen, drv_data->side, &width, &height);
|
||||
bufsize = width * height * 4;
|
||||
|
||||
if (SDL_BYTESPERPIXEL(surface->format) == 2)
|
||||
|
|
@ -91,7 +92,32 @@ bool SDL_N3DS_UpdateWindowFramebuffer(SDL_VideoDevice *_this, SDL_Window *window
|
|||
else
|
||||
CopyFramebuffertoN3DS_32(framebuffer, (Dimensions){ width, height },
|
||||
surface->pixels, (Dimensions){ surface->w, surface->h });
|
||||
FlushN3DSBuffer(framebuffer, bufsize, drv_data->screen);
|
||||
|
||||
if(gfxIs3D() == false || drv_data->screen == GFX_BOTTOM)
|
||||
FlushN3DSBuffer(framebuffer, bufsize, drv_data->screen, true);
|
||||
|
||||
else if(drv_data->screen == GFX_TOP) {
|
||||
// We have to check if both screens are ready because if we can only
|
||||
// swap both at the same time.
|
||||
|
||||
if(drv_data->side == GFX_LEFT)
|
||||
internal->top_left_ready = true;
|
||||
|
||||
else if(drv_data->side == GFX_RIGHT)
|
||||
internal->top_right_ready = true;
|
||||
|
||||
if(internal->top_left_ready && internal->top_right_ready) {
|
||||
internal->top_left_ready = false;
|
||||
internal->top_right_ready = false;
|
||||
|
||||
// This is safe because both screens share the same size
|
||||
framebuffer = gfxGetFramebuffer(GFX_TOP, GFX_LEFT, &width, &height);
|
||||
FlushN3DSBuffer(framebuffer, bufsize, GFX_TOP, false);
|
||||
|
||||
framebuffer = gfxGetFramebuffer(GFX_TOP, GFX_RIGHT, &width, &height);
|
||||
FlushN3DSBuffer(framebuffer, bufsize, GFX_TOP, true);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -147,10 +173,11 @@ static int GetSourceOffset(int x, int y, int source_width)
|
|||
return x + y * source_width;
|
||||
}
|
||||
|
||||
static void FlushN3DSBuffer(const void *buffer, u32 bufsize, gfxScreen_t screen)
|
||||
static void FlushN3DSBuffer(const void *buffer, u32 bufsize, gfxScreen_t screen, bool swap)
|
||||
{
|
||||
GSPGPU_FlushDataCache(buffer, bufsize);
|
||||
gfxScreenSwapBuffers(screen, false);
|
||||
if(swap)
|
||||
gfxScreenSwapBuffers(screen, gfxIs3D());
|
||||
}
|
||||
|
||||
void SDL_N3DS_DestroyWindowFramebuffer(SDL_VideoDevice *_this, SDL_Window *window)
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@
|
|||
|
||||
#define N3DSVID_DRIVER_NAME "n3ds"
|
||||
|
||||
static bool AddN3DSDisplay(gfxScreen_t screen);
|
||||
static bool AddN3DSDisplay(gfxScreen_t screen, gfx3dSide_t side);
|
||||
|
||||
static bool N3DS_VideoInit(SDL_VideoDevice *_this);
|
||||
static void N3DS_VideoQuit(SDL_VideoDevice *_this);
|
||||
|
|
@ -44,6 +44,7 @@ static void N3DS_DestroyWindow(SDL_VideoDevice *_this, SDL_Window *window);
|
|||
struct SDL_DisplayData
|
||||
{
|
||||
gfxScreen_t screen;
|
||||
gfx3dSide_t side;
|
||||
};
|
||||
|
||||
struct SDL_DisplayModeData
|
||||
|
|
@ -127,8 +128,9 @@ static bool N3DS_VideoInit(SDL_VideoDevice *_this)
|
|||
gfxInit(GSP_RGBA8_OES, GSP_RGBA8_OES, false);
|
||||
hidInit();
|
||||
|
||||
internal->top_display = AddN3DSDisplay(GFX_TOP);
|
||||
internal->touch_display = AddN3DSDisplay(GFX_BOTTOM);
|
||||
internal->top_left_display = AddN3DSDisplay(GFX_TOP, GFX_LEFT);
|
||||
internal->top_right_display = AddN3DSDisplay(GFX_TOP, GFX_RIGHT);
|
||||
internal->touch_display = AddN3DSDisplay(GFX_BOTTOM, GFX_LEFT); // Bottom screen is always left
|
||||
|
||||
N3DS_InitTouch();
|
||||
N3DS_SwkbInit();
|
||||
|
|
@ -136,7 +138,7 @@ static bool N3DS_VideoInit(SDL_VideoDevice *_this)
|
|||
return true;
|
||||
}
|
||||
|
||||
static bool AddN3DSDisplay(gfxScreen_t screen)
|
||||
static bool AddN3DSDisplay(gfxScreen_t screen, gfx3dSide_t side)
|
||||
{
|
||||
SDL_DisplayMode mode;
|
||||
SDL_DisplayModeData *modedata;
|
||||
|
|
@ -150,6 +152,7 @@ static bool AddN3DSDisplay(gfxScreen_t screen)
|
|||
SDL_zero(display);
|
||||
|
||||
display_driver_data->screen = screen;
|
||||
display_driver_data->side = side;
|
||||
|
||||
modedata = SDL_malloc(sizeof(SDL_DisplayModeData));
|
||||
if (!modedata) {
|
||||
|
|
@ -163,7 +166,7 @@ static bool AddN3DSDisplay(gfxScreen_t screen)
|
|||
mode.internal = modedata;
|
||||
modedata->fmt = GSP_RGBA8_OES;
|
||||
|
||||
display.name = (screen == GFX_TOP) ? "N3DS top screen" : "N3DS bottom screen";
|
||||
display.name = (screen == GFX_BOTTOM) ? "N3DS bottom screen" : (side == GFX_LEFT) ? "N3DS top screen" : "N3DS right screen";
|
||||
display.desktop_mode = mode;
|
||||
display.internal = display_driver_data;
|
||||
|
||||
|
|
@ -228,7 +231,12 @@ static bool N3DS_GetDisplayBounds(SDL_VideoDevice *_this, SDL_VideoDisplay *disp
|
|||
}
|
||||
|
||||
rect->x = 0;
|
||||
rect->y = (driver_data->screen == GFX_TOP) ? 0 : GSP_SCREEN_WIDTH;
|
||||
rect->y = 0;
|
||||
if(driver_data->screen == GFX_BOTTOM)
|
||||
rect->y = GSP_SCREEN_WIDTH;
|
||||
if(driver_data->screen == GFX_TOP && driver_data->side == GFX_RIGHT)
|
||||
rect->y = GSP_SCREEN_WIDTH * 2;
|
||||
|
||||
rect->w = display->current_mode->w;
|
||||
rect->h = display->current_mode->h;
|
||||
return true;
|
||||
|
|
@ -243,6 +251,7 @@ static bool N3DS_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_Pr
|
|||
}
|
||||
display_data = SDL_GetDisplayDriverDataForWindow(window);
|
||||
window_data->screen = display_data->screen;
|
||||
window_data->side = display_data->side;
|
||||
window->internal = window_data;
|
||||
SDL_SetKeyboardFocus(window);
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -29,13 +29,19 @@
|
|||
|
||||
struct SDL_VideoData
|
||||
{
|
||||
int top_display;
|
||||
int top_left_display;
|
||||
int top_right_display;
|
||||
int touch_display;
|
||||
|
||||
// The following two variables keep track of if it is ready to swap the buffers
|
||||
bool top_left_ready;
|
||||
bool top_right_ready;
|
||||
};
|
||||
|
||||
struct SDL_WindowData
|
||||
{
|
||||
gfxScreen_t screen; /**< Keeps track of which N3DS screen is targeted */
|
||||
gfx3dSide_t side;
|
||||
};
|
||||
|
||||
#endif // SDL_n3dsvideo_h_
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@ static BOOL (*ov_wglMakeCurrent)(HDC, HGLRC);
|
|||
#define OPENVR_DEFAULT_WIDTH 1920
|
||||
#define OPENVR_DEFAULT_HEIGHT 1080
|
||||
|
||||
#define OPENVR_SetupProc(proc) { proc = (void*)SDL_GL_GetProcAddress((#proc)+3); if (!proc) { failed_extension = (#proc)+3; } }
|
||||
#define OPENVR_SetupProc(proc) { proc = (void *)SDL_GL_GetProcAddress((#proc)+3); if (!proc) { failed_extension = (#proc)+3; } }
|
||||
|
||||
static bool OPENVR_InitExtensions(SDL_VideoDevice *_this)
|
||||
{
|
||||
|
|
@ -211,7 +211,7 @@ static bool OPENVR_VideoInit(SDL_VideoDevice *_this)
|
|||
}
|
||||
|
||||
display.internal = (SDL_DisplayData *)data;
|
||||
display.name = (char*)"OpenVRDisplay";
|
||||
display.name = (char *)"OpenVRDisplay";
|
||||
SDL_AddVideoDisplay(&display, false);
|
||||
|
||||
return true;
|
||||
|
|
@ -250,7 +250,7 @@ static uint32_t *ImageSDLToOpenVRGL(SDL_Surface * surf, bool bFlipY)
|
|||
int x, y;
|
||||
uint32_t * pxd = SDL_malloc(4 * surf->w * surf->h);
|
||||
for(y = 0; y < h; y++) {
|
||||
uint32_t * iline = (uint32_t*)&(((uint8_t*)surf->pixels)[y*pitch]);
|
||||
uint32_t * iline = (uint32_t *)&(((uint8_t *)surf->pixels)[y * pitch]);
|
||||
uint32_t * oline = &pxd[(bFlipY?(h-y-1):y)*w];
|
||||
for(x = 0; x < w; x++)
|
||||
{
|
||||
|
|
@ -430,7 +430,7 @@ static void OPENVR_VirtualControllerUpdate(void *userdata)
|
|||
xval *= -1.0f;
|
||||
if (a == SDL_GAMEPAD_AXIS_LEFT_TRIGGER || a == SDL_GAMEPAD_AXIS_RIGHT_TRIGGER)
|
||||
xval = xval * 2.0f - 1.0f;
|
||||
//SDL_SetJoystickVirtualAxis(joystick, a, analog_input_action.x*32767);
|
||||
//SDL_SetJoystickVirtualAxis(joystick, a, analog_input_action.x * 32767);
|
||||
xval *= SDL_JOYSTICK_AXIS_MAX;
|
||||
SDL_SetJoystickVirtualAxis(joystick, a, xval);
|
||||
#ifdef DEBUG_OPENVR
|
||||
|
|
@ -1039,7 +1039,7 @@ static SDL_GLContext OVR_EGL_CreateContext(SDL_VideoDevice *_this, SDL_Window *
|
|||
|
||||
ov_glGetIntegerv(GL_NUM_EXTENSIONS, &numExtensions);
|
||||
for(int i = 0; i < numExtensions; i++) {
|
||||
const char * ccc = (const char*)ov_glGetStringi(GL_EXTENSIONS, i);
|
||||
const char * ccc = (const char *)ov_glGetStringi(GL_EXTENSIONS, i);
|
||||
if (SDL_strcmp(ccc, "GL_KHR_debug") == 0) {
|
||||
#ifdef DEBUG_OPENVR
|
||||
SDL_Log("Found renderdoc debug extension.");
|
||||
|
|
@ -1327,7 +1327,7 @@ static bool OPENVR_ShowCursor(SDL_Cursor * cursor)
|
|||
hotspot.v[0] = (float)ovrc->hot_x / (float)ovrc->w;
|
||||
hotspot.v[1] = (float)ovrc->hot_y / (float)ovrc->h;
|
||||
|
||||
texture.handle = (void*)(intptr_t)(ovrc->texture_id_handle);
|
||||
texture.handle = (void *)(intptr_t)(ovrc->texture_id_handle);
|
||||
texture.eType = ETextureType_TextureType_OpenGL;
|
||||
texture.eColorSpace = EColorSpace_ColorSpace_Auto;
|
||||
|
||||
|
|
@ -1395,7 +1395,7 @@ static bool OPENVR_SetWindowIcon(SDL_VideoDevice *_this, SDL_Window * window, SD
|
|||
SDL_free(pixels);
|
||||
ov_glBindTexture(GL_TEXTURE_2D, 0);
|
||||
|
||||
texture.handle = (void*)(intptr_t)(texture_id_handle);
|
||||
texture.handle = (void *)(intptr_t)(texture_id_handle);
|
||||
texture.eType = ETextureType_TextureType_OpenGL;
|
||||
texture.eColorSpace = EColorSpace_ColorSpace_Auto;
|
||||
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue