mirror of
https://github.com/libretro/RetroArch.git
synced 2025-04-02 10:51:52 -04:00
Syntax style nits
This commit is contained in:
parent
4ab58f66ec
commit
442b9bc3da
30 changed files with 378 additions and 354 deletions
|
@ -501,10 +501,12 @@ static void audio_driver_flush(
|
||||||
if (is_slowmotion)
|
if (is_slowmotion)
|
||||||
src_data.ratio *= slowmotion_ratio;
|
src_data.ratio *= slowmotion_ratio;
|
||||||
|
|
||||||
if (is_fastforward && config_get_ptr()->bools.audio_fastforward_speedup) {
|
if (is_fastforward && config_get_ptr()->bools.audio_fastforward_speedup)
|
||||||
|
{
|
||||||
const retro_time_t flush_time = cpu_features_get_time_usec();
|
const retro_time_t flush_time = cpu_features_get_time_usec();
|
||||||
|
|
||||||
if (audio_st->last_flush_time > 0) {
|
if (audio_st->last_flush_time > 0)
|
||||||
|
{
|
||||||
/* What we should see if the speed was 1.0x, converted to microsecs */
|
/* What we should see if the speed was 1.0x, converted to microsecs */
|
||||||
const double expected_flush_delta =
|
const double expected_flush_delta =
|
||||||
(src_data.input_frames / audio_st->input * 1000000);
|
(src_data.input_frames / audio_st->input * 1000000);
|
||||||
|
@ -517,16 +519,17 @@ static void audio_driver_flush(
|
||||||
compression and decompression every single frame, which would make
|
compression and decompression every single frame, which would make
|
||||||
sounds irrecognizable.
|
sounds irrecognizable.
|
||||||
|
|
||||||
https://en.wikipedia.org/wiki/Moving_average#Exponential_moving_average */
|
https://en.wikipedia.org/wiki/Moving_average#Exponential_moving_average
|
||||||
|
*/
|
||||||
const retro_time_t n = AUDIO_FF_EXP_AVG_SAMPLES;
|
const retro_time_t n = AUDIO_FF_EXP_AVG_SAMPLES;
|
||||||
audio_st->avg_flush_delta = audio_st->avg_flush_delta * (n - 1) / n +
|
audio_st->avg_flush_delta = audio_st->avg_flush_delta * (n - 1) / n +
|
||||||
(flush_time - audio_st->last_flush_time) / n;
|
(flush_time - audio_st->last_flush_time) / n;
|
||||||
|
|
||||||
/* How much does the avg_flush_delta deviate from the delta at 1.0x speed? */
|
/* How much does the avg_flush_delta deviate from the delta at 1.0x speed? */
|
||||||
src_data.ratio *=
|
src_data.ratio *=
|
||||||
MAX(AUDIO_MIN_RATIO,
|
MAX(AUDIO_MIN_RATIO,
|
||||||
MIN(AUDIO_MAX_RATIO,
|
MIN(AUDIO_MAX_RATIO,
|
||||||
audio_st->avg_flush_delta / expected_flush_delta));
|
audio_st->avg_flush_delta / expected_flush_delta));
|
||||||
}
|
}
|
||||||
|
|
||||||
audio_st->last_flush_time = flush_time;
|
audio_st->last_flush_time = flush_time;
|
||||||
|
|
|
@ -55,17 +55,16 @@ static void ctr_dsp_audio_loop(void* data)
|
||||||
if (!ctr)
|
if (!ctr)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
while (1)
|
for (;;)
|
||||||
{
|
{
|
||||||
size_t buf_avail, avail, to_write;
|
size_t buf_avail, avail, to_write;
|
||||||
slock_lock(ctr->fifo_lock);
|
slock_lock(ctr->fifo_lock);
|
||||||
|
|
||||||
do {
|
do
|
||||||
|
{
|
||||||
avail = FIFO_READ_AVAIL(ctr->fifo);
|
avail = FIFO_READ_AVAIL(ctr->fifo);
|
||||||
|
if (!avail)
|
||||||
if (!avail) {
|
|
||||||
scond_wait(ctr->fifo_avail, ctr->fifo_lock);
|
scond_wait(ctr->fifo_avail, ctr->fifo_lock);
|
||||||
}
|
|
||||||
} while (!avail && ctr->running);
|
} while (!avail && ctr->running);
|
||||||
|
|
||||||
slock_unlock(ctr->fifo_lock);
|
slock_unlock(ctr->fifo_lock);
|
||||||
|
@ -81,7 +80,8 @@ static void ctr_dsp_audio_loop(void* data)
|
||||||
|
|
||||||
slock_lock(ctr->fifo_lock);
|
slock_lock(ctr->fifo_lock);
|
||||||
|
|
||||||
if (to_write > 0) {
|
if (to_write > 0)
|
||||||
|
{
|
||||||
fifo_read(ctr->fifo, ctr->dsp_buf.data_pcm8 + pos, to_write);
|
fifo_read(ctr->fifo, ctr->dsp_buf.data_pcm8 + pos, to_write);
|
||||||
DSP_FlushDataCache(ctr->dsp_buf.data_pcm8 + pos, to_write);
|
DSP_FlushDataCache(ctr->dsp_buf.data_pcm8 + pos, to_write);
|
||||||
scond_signal(ctr->fifo_done);
|
scond_signal(ctr->fifo_done);
|
||||||
|
@ -89,7 +89,8 @@ static void ctr_dsp_audio_loop(void* data)
|
||||||
|
|
||||||
slock_unlock(ctr->fifo_lock);
|
slock_unlock(ctr->fifo_lock);
|
||||||
|
|
||||||
if (buf_pos == pos) {
|
if (buf_pos == pos)
|
||||||
|
{
|
||||||
svcSleepThread(100000);
|
svcSleepThread(100000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -142,10 +143,10 @@ static void *ctr_dsp_thread_audio_init(const char *device, unsigned rate, unsign
|
||||||
|
|
||||||
ctr->fifo = fifo_new(ctr->fifo_size);
|
ctr->fifo = fifo_new(ctr->fifo_size);
|
||||||
|
|
||||||
if (!(ctr->fifo_lock = slock_new()) ||
|
if ( !(ctr->fifo_lock = slock_new())
|
||||||
!(ctr->fifo_avail = scond_new()) ||
|
|| !(ctr->fifo_avail = scond_new())
|
||||||
!(ctr->fifo_done = scond_new()) ||
|
|| !(ctr->fifo_done = scond_new())
|
||||||
!(ctr->thread = sthread_create(ctr_dsp_audio_loop, ctr)))
|
|| !(ctr->thread = sthread_create(ctr_dsp_audio_loop, ctr)))
|
||||||
{
|
{
|
||||||
RARCH_LOG("[Audio]: thread creation failed.\n");
|
RARCH_LOG("[Audio]: thread creation failed.\n");
|
||||||
ctr->running = false;
|
ctr->running = false;
|
||||||
|
@ -229,7 +230,8 @@ static ssize_t ctr_dsp_thread_audio_write(void *data, const void *buf, size_t si
|
||||||
if (ctr->running)
|
if (ctr->running)
|
||||||
{
|
{
|
||||||
/* Wait a maximum of one frame, skip the write if the thread is still busy */
|
/* Wait a maximum of one frame, skip the write if the thread is still busy */
|
||||||
if (!scond_wait_timeout(ctr->fifo_done, ctr->fifo_lock, ctr->frame_time)) {
|
if (!scond_wait_timeout(ctr->fifo_done, ctr->fifo_lock, ctr->frame_time))
|
||||||
|
{
|
||||||
slock_unlock(ctr->fifo_lock);
|
slock_unlock(ctr->fifo_lock);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -282,11 +284,11 @@ static bool ctr_dsp_thread_audio_start(void *data, bool is_shutdown)
|
||||||
|
|
||||||
/* Prevents restarting audio when the menu
|
/* Prevents restarting audio when the menu
|
||||||
* is toggled off on shutdown */
|
* is toggled off on shutdown */
|
||||||
if (is_shutdown)
|
if (!is_shutdown)
|
||||||
return true;
|
{
|
||||||
|
ndspSetMasterVol(1.0);
|
||||||
ndspSetMasterVol(1.0);
|
ctr->playing = true;
|
||||||
ctr->playing = true;
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -298,11 +300,7 @@ static void ctr_dsp_thread_audio_set_nonblock_state(void *data, bool state)
|
||||||
ctr->nonblocking = state;
|
ctr->nonblocking = state;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool ctr_dsp_thread_audio_use_float(void *data)
|
static bool ctr_dsp_thread_audio_use_float(void *data) { return false; }
|
||||||
{
|
|
||||||
(void)data;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
static size_t ctr_dsp_thread_audio_write_avail(void *data)
|
static size_t ctr_dsp_thread_audio_write_avail(void *data)
|
||||||
{
|
{
|
||||||
|
|
|
@ -229,12 +229,13 @@ static const struct pw_stream_events playback_stream_events = {
|
||||||
|
|
||||||
static int wait_resync(pw_t *pw)
|
static int wait_resync(pw_t *pw)
|
||||||
{
|
{
|
||||||
|
int res;
|
||||||
|
|
||||||
retro_assert(pw != NULL);
|
retro_assert(pw != NULL);
|
||||||
|
|
||||||
int res;
|
|
||||||
pw->pending_seq = pw_core_sync(pw->core, PW_ID_CORE, pw->pending_seq);
|
pw->pending_seq = pw_core_sync(pw->core, PW_ID_CORE, pw->pending_seq);
|
||||||
|
|
||||||
while (true)
|
for (;;)
|
||||||
{
|
{
|
||||||
pw_thread_loop_wait(pw->thread_loop);
|
pw_thread_loop_wait(pw->thread_loop);
|
||||||
|
|
||||||
|
|
|
@ -68,20 +68,19 @@ typedef struct psp_audio
|
||||||
#define AUDIO_BUFFER_SIZE_MASK (AUDIO_BUFFER_SIZE-1)
|
#define AUDIO_BUFFER_SIZE_MASK (AUDIO_BUFFER_SIZE-1)
|
||||||
|
|
||||||
/* Return port used */
|
/* Return port used */
|
||||||
static int configureAudio(unsigned rate) {
|
static int configureAudio(unsigned rate)
|
||||||
int port;
|
{
|
||||||
#if defined(VITA)
|
#if defined(VITA)
|
||||||
port = sceAudioOutOpenPort(
|
return sceAudioOutOpenPort(
|
||||||
SCE_AUDIO_OUT_PORT_TYPE_MAIN, AUDIO_OUT_COUNT,
|
SCE_AUDIO_OUT_PORT_TYPE_MAIN, AUDIO_OUT_COUNT,
|
||||||
rate, SCE_AUDIO_OUT_MODE_STEREO);
|
rate, SCE_AUDIO_OUT_MODE_STEREO);
|
||||||
#elif defined(ORBIS)
|
#elif defined(ORBIS)
|
||||||
port = sceAudioOutOpen(0xff,
|
return sceAudioOutOpen(0xff,
|
||||||
SCE_AUDIO_OUT_PORT_TYPE_MAIN, 0, AUDIO_OUT_COUNT,
|
SCE_AUDIO_OUT_PORT_TYPE_MAIN, 0, AUDIO_OUT_COUNT,
|
||||||
rate, SCE_AUDIO_OUT_MODE_STEREO);
|
rate, SCE_AUDIO_OUT_MODE_STEREO);
|
||||||
#else
|
#else
|
||||||
port = sceAudioSRCChReserve(AUDIO_OUT_COUNT, rate, 2);
|
return sceAudioSRCChReserve(AUDIO_OUT_COUNT, rate, 2);
|
||||||
#endif
|
#endif
|
||||||
return port;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void audioMainLoop(void *data)
|
static void audioMainLoop(void *data)
|
||||||
|
|
|
@ -92,21 +92,22 @@ static void context_state_cb(pa_context *c, void *data)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void pa_sinklist_cb(pa_context *c, const pa_sink_info *l, int eol, void *data)
|
static void pa_sinklist_cb(pa_context *c, const pa_sink_info *l, int eol, void *data)
|
||||||
{
|
{
|
||||||
union string_list_elem_attr attr;
|
union string_list_elem_attr attr;
|
||||||
attr.i = 0;
|
attr.i = 0;
|
||||||
pa_t *pa = (pa_t*)data;
|
pa_t *pa = (pa_t*)data;
|
||||||
|
|
||||||
if (!pa->devicelist)
|
if (!pa->devicelist)
|
||||||
pa->devicelist = string_list_new();
|
pa->devicelist = string_list_new();
|
||||||
if (!pa->devicelist)
|
if (!pa->devicelist)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// If eol is set to a positive number, you're at the end of the list
|
/* If EOL is set to a positive number,
|
||||||
if (eol > 0) {
|
* you're at the end of the list */
|
||||||
|
if (eol > 0)
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
RARCH_DBG("[PulseAudio]: Sink detected: %s\n",l->name);
|
RARCH_DBG("[PulseAudio]: Sink detected: %s\n",l->name);
|
||||||
string_list_append(pa->devicelist, l->name, attr);
|
string_list_append(pa->devicelist, l->name, attr);
|
||||||
}
|
}
|
||||||
|
@ -213,7 +214,7 @@ static void *pulse_init(const char *device, unsigned rate,
|
||||||
/* Checking device against sink list would be tricky due to callback, so it is just set. */
|
/* Checking device against sink list would be tricky due to callback, so it is just set. */
|
||||||
if (device)
|
if (device)
|
||||||
pa_context_set_default_sink(pa->context, device, NULL, NULL);
|
pa_context_set_default_sink(pa->context, device, NULL, NULL);
|
||||||
|
|
||||||
spec.format = is_little_endian() ? PA_SAMPLE_FLOAT32LE : PA_SAMPLE_FLOAT32BE;
|
spec.format = is_little_endian() ? PA_SAMPLE_FLOAT32LE : PA_SAMPLE_FLOAT32BE;
|
||||||
spec.channels = 2;
|
spec.channels = 2;
|
||||||
spec.rate = rate;
|
spec.rate = rate;
|
||||||
|
|
|
@ -155,7 +155,7 @@ static void rcheevos_filter_url_param(char* url, char* param)
|
||||||
else
|
else
|
||||||
++start;
|
++start;
|
||||||
|
|
||||||
do
|
for (;;)
|
||||||
{
|
{
|
||||||
next = strchr(start, '&');
|
next = strchr(start, '&');
|
||||||
|
|
||||||
|
@ -175,7 +175,7 @@ static void rcheevos_filter_url_param(char* url, char* param)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
start = next + 1;
|
start = next + 1;
|
||||||
} while (1);
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -409,8 +409,6 @@ static void frontend_ctr_init(void* data)
|
||||||
#ifndef IS_SALAMANDER
|
#ifndef IS_SALAMANDER
|
||||||
extern audio_driver_t audio_null;
|
extern audio_driver_t audio_null;
|
||||||
|
|
||||||
(void)data;
|
|
||||||
|
|
||||||
verbosity_enable();
|
verbosity_enable();
|
||||||
|
|
||||||
gfxInit(GSP_BGR8_OES, GSP_BGR8_OES, false);
|
gfxInit(GSP_BGR8_OES, GSP_BGR8_OES, false);
|
||||||
|
@ -465,7 +463,8 @@ static void frontend_ctr_init(void* data)
|
||||||
if (csndInit() != 0)
|
if (csndInit() != 0)
|
||||||
audio_ctr_csnd = audio_null;
|
audio_ctr_csnd = audio_null;
|
||||||
ctr_check_dspfirm();
|
ctr_check_dspfirm();
|
||||||
if (ndspInit() != 0) {
|
if (ndspInit() != 0)
|
||||||
|
{
|
||||||
audio_ctr_dsp = audio_null;
|
audio_ctr_dsp = audio_null;
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
audio_ctr_dsp_thread = audio_null;
|
audio_ctr_dsp_thread = audio_null;
|
||||||
|
|
|
@ -419,17 +419,15 @@ static void frontend_darwin_get_env(int *argc, char *argv[],
|
||||||
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_DATABASE], application_data, "database/rdb", sizeof(g_defaults.dirs[DEFAULT_DIR_DATABASE]));
|
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_DATABASE], application_data, "database/rdb", sizeof(g_defaults.dirs[DEFAULT_DIR_DATABASE]));
|
||||||
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CORE_ASSETS], application_data, "downloads", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE_ASSETS]));
|
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CORE_ASSETS], application_data, "downloads", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE_ASSETS]));
|
||||||
NSURL *url = [[NSBundle mainBundle] URLForResource:nil withExtension:@"dsp" subdirectory:@"filters/audio"];
|
NSURL *url = [[NSBundle mainBundle] URLForResource:nil withExtension:@"dsp" subdirectory:@"filters/audio"];
|
||||||
if (url) {
|
if (url)
|
||||||
strlcpy(g_defaults.dirs[DEFAULT_DIR_AUDIO_FILTER], [[url baseURL] fileSystemRepresentation], sizeof(g_defaults.dirs[DEFAULT_DIR_AUDIO_FILTER]));
|
strlcpy(g_defaults.dirs[DEFAULT_DIR_AUDIO_FILTER], [[url baseURL] fileSystemRepresentation], sizeof(g_defaults.dirs[DEFAULT_DIR_AUDIO_FILTER]));
|
||||||
} else {
|
else
|
||||||
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_AUDIO_FILTER], application_data, "filters/audio", sizeof(g_defaults.dirs[DEFAULT_DIR_AUDIO_FILTER]));
|
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_AUDIO_FILTER], application_data, "filters/audio", sizeof(g_defaults.dirs[DEFAULT_DIR_AUDIO_FILTER]));
|
||||||
}
|
|
||||||
url = [[NSBundle mainBundle] URLForResource:nil withExtension:@"filt" subdirectory:@"filters/video"];
|
url = [[NSBundle mainBundle] URLForResource:nil withExtension:@"filt" subdirectory:@"filters/video"];
|
||||||
if (url) {
|
if (url)
|
||||||
strlcpy(g_defaults.dirs[DEFAULT_DIR_VIDEO_FILTER], [[url baseURL] fileSystemRepresentation], sizeof(g_defaults.dirs[DEFAULT_DIR_VIDEO_FILTER]));
|
strlcpy(g_defaults.dirs[DEFAULT_DIR_VIDEO_FILTER], [[url baseURL] fileSystemRepresentation], sizeof(g_defaults.dirs[DEFAULT_DIR_VIDEO_FILTER]));
|
||||||
} else {
|
else
|
||||||
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_VIDEO_FILTER], application_data, "filters/video", sizeof(g_defaults.dirs[DEFAULT_DIR_VIDEO_FILTER]));
|
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_VIDEO_FILTER], application_data, "filters/video", sizeof(g_defaults.dirs[DEFAULT_DIR_VIDEO_FILTER]));
|
||||||
}
|
|
||||||
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CORE_INFO], application_data, "info", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE_INFO]));
|
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CORE_INFO], application_data, "info", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE_INFO]));
|
||||||
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_OVERLAY], application_data, "overlays", sizeof(g_defaults.dirs[DEFAULT_DIR_OVERLAY]));
|
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_OVERLAY], application_data, "overlays", sizeof(g_defaults.dirs[DEFAULT_DIR_OVERLAY]));
|
||||||
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_OSK_OVERLAY], application_data, "overlays/keyboards", sizeof(g_defaults.dirs[DEFAULT_DIR_OSK_OVERLAY]));
|
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_OSK_OVERLAY], application_data, "overlays/keyboards", sizeof(g_defaults.dirs[DEFAULT_DIR_OSK_OVERLAY]));
|
||||||
|
|
|
@ -209,11 +209,11 @@ void x11_set_window_attr(Display *dpy, Window win)
|
||||||
static bool xss_screensaver_inhibit(Display *dpy, bool enable)
|
static bool xss_screensaver_inhibit(Display *dpy, bool enable)
|
||||||
{
|
{
|
||||||
int dummy, min, maj;
|
int dummy, min, maj;
|
||||||
if (!XScreenSaverQueryExtension(dpy, &dummy, &dummy) ||
|
if ( !XScreenSaverQueryExtension(dpy, &dummy, &dummy)
|
||||||
!XScreenSaverQueryVersion(dpy, &maj, &min) ||
|
|| !XScreenSaverQueryVersion(dpy, &maj, &min)
|
||||||
maj < 1 || (maj == 1 && min < 1)) {
|
|| (maj < 1)
|
||||||
|
|| (maj == 1 && min < 1))
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
XScreenSaverSuspend(dpy, enable);
|
XScreenSaverSuspend(dpy, enable);
|
||||||
XResetScreenSaver(dpy);
|
XResetScreenSaver(dpy);
|
||||||
return true;
|
return true;
|
||||||
|
@ -276,10 +276,13 @@ bool x11_suspend_screensaver(void *data, bool enable)
|
||||||
return true;
|
return true;
|
||||||
#endif
|
#endif
|
||||||
if (!xss_screensaver_inhibit(g_x11_dpy, enable) && enable)
|
if (!xss_screensaver_inhibit(g_x11_dpy, enable) && enable)
|
||||||
if (xdg_screensaver_available) {
|
{
|
||||||
|
if (xdg_screensaver_available)
|
||||||
|
{
|
||||||
xdg_screensaver_inhibit(wnd);
|
xdg_screensaver_inhibit(wnd);
|
||||||
return xdg_screensaver_available;
|
return xdg_screensaver_available;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -257,7 +257,7 @@ static bool d3d10_init_shader(
|
||||||
D3DBlob ps_code = NULL;
|
D3DBlob ps_code = NULL;
|
||||||
D3DBlob gs_code = NULL;
|
D3DBlob gs_code = NULL;
|
||||||
|
|
||||||
bool success = true;
|
bool success = true;
|
||||||
|
|
||||||
if (!src) /* LPCWSTR filename */
|
if (!src) /* LPCWSTR filename */
|
||||||
{
|
{
|
||||||
|
@ -1366,17 +1366,16 @@ static bool d3d10_gfx_set_shader(void* data,
|
||||||
size_t _len = strlcpy(_path, slang_path, sizeof(_path));
|
size_t _len = strlcpy(_path, slang_path, sizeof(_path));
|
||||||
strlcpy(_path + _len, ".vs.hlsl", sizeof(_path) - _len);
|
strlcpy(_path + _len, ".vs.hlsl", sizeof(_path) - _len);
|
||||||
|
|
||||||
if (!d3d10_init_shader(
|
d3d10_init_shader(d3d10->device, vs_src, 0,
|
||||||
d3d10->device, vs_src, 0, _path, "main",
|
_path, "main", NULL, NULL, desc,
|
||||||
NULL, NULL, desc, countof(desc),
|
countof(desc), &d3d10->pass[i].shader);
|
||||||
&d3d10->pass[i].shader)) { }
|
|
||||||
|
|
||||||
strlcpy(_path + _len, ".ps.hlsl", sizeof(_path) - _len);
|
strlcpy(_path + _len, ".ps.hlsl", sizeof(_path) - _len);
|
||||||
|
|
||||||
if (!d3d10_init_shader(
|
d3d10_init_shader(d3d10->device, ps_src,
|
||||||
d3d10->device, ps_src, 0, _path, NULL, "main",
|
0, _path, NULL, "main",
|
||||||
NULL, NULL, 0,
|
NULL, NULL, 0,
|
||||||
&d3d10->pass[i].shader)) { }
|
&d3d10->pass[i].shader);
|
||||||
|
|
||||||
free(d3d10->shader_preset->pass[i].source.string.vertex);
|
free(d3d10->shader_preset->pass[i].source.string.vertex);
|
||||||
free(d3d10->shader_preset->pass[i].source.string.fragment);
|
free(d3d10->shader_preset->pass[i].source.string.fragment);
|
||||||
|
|
|
@ -1568,19 +1568,15 @@ static bool d3d11_gfx_set_shader(void* data, enum rarch_shader_type type, const
|
||||||
size_t _len = strlcpy(_path, slang_path, sizeof(_path));
|
size_t _len = strlcpy(_path, slang_path, sizeof(_path));
|
||||||
strlcpy(_path + _len, ".vs.hlsl", sizeof(_path) - _len);
|
strlcpy(_path + _len, ".vs.hlsl", sizeof(_path) - _len);
|
||||||
|
|
||||||
if (!d3d11_init_shader(
|
d3d11_init_shader(d3d11->device, vs_src, 0,
|
||||||
d3d11->device, vs_src, 0, _path, "main", NULL, NULL, desc, countof(desc),
|
_path, "main", NULL, NULL, desc, countof(desc),
|
||||||
&d3d11->pass[i].shader,
|
&d3d11->pass[i].shader, feat_level_hint);
|
||||||
feat_level_hint
|
|
||||||
)) { }
|
|
||||||
|
|
||||||
strlcpy(_path + _len, ".ps.hlsl", sizeof(_path) - _len);
|
strlcpy(_path + _len, ".ps.hlsl", sizeof(_path) - _len);
|
||||||
|
|
||||||
if (!d3d11_init_shader(
|
d3d11_init_shader(d3d11->device, ps_src, 0, _path,
|
||||||
d3d11->device, ps_src, 0, _path, NULL, "main", NULL, NULL, 0,
|
NULL, "main", NULL, NULL, 0,
|
||||||
&d3d11->pass[i].shader,
|
&d3d11->pass[i].shader, feat_level_hint);
|
||||||
feat_level_hint
|
|
||||||
)) { }
|
|
||||||
|
|
||||||
free(d3d11->shader_preset->pass[i].source.string.vertex);
|
free(d3d11->shader_preset->pass[i].source.string.vertex);
|
||||||
free(d3d11->shader_preset->pass[i].source.string.fragment);
|
free(d3d11->shader_preset->pass[i].source.string.fragment);
|
||||||
|
|
|
@ -1783,13 +1783,11 @@ static void gl2_renderchain_recompute_pass_sizes(
|
||||||
|
|
||||||
case RARCH_SCALE_VIEWPORT:
|
case RARCH_SCALE_VIEWPORT:
|
||||||
if (gl->rotation % 180 == 90)
|
if (gl->rotation % 180 == 90)
|
||||||
{
|
fbo_rect->img_width = fbo_rect->max_img_width =
|
||||||
fbo_rect->img_width = fbo_rect->max_img_width =
|
|
||||||
fbo_scale->scale_x * vp_height;
|
fbo_scale->scale_x * vp_height;
|
||||||
} else {
|
else
|
||||||
fbo_rect->img_width = fbo_rect->max_img_width =
|
fbo_rect->img_width = fbo_rect->max_img_width =
|
||||||
fbo_scale->scale_x * vp_width;
|
fbo_scale->scale_x * vp_width;
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1807,13 +1805,11 @@ static void gl2_renderchain_recompute_pass_sizes(
|
||||||
|
|
||||||
case RARCH_SCALE_VIEWPORT:
|
case RARCH_SCALE_VIEWPORT:
|
||||||
if (gl->rotation % 180 == 90)
|
if (gl->rotation % 180 == 90)
|
||||||
{
|
fbo_rect->img_height = fbo_rect->max_img_height =
|
||||||
fbo_rect->img_height = fbo_rect->max_img_height =
|
|
||||||
fbo_scale->scale_y * vp_width;
|
fbo_scale->scale_y * vp_width;
|
||||||
} else {
|
else
|
||||||
fbo_rect->img_height = fbo_rect->max_img_height =
|
fbo_rect->img_height = fbo_rect->max_img_height =
|
||||||
fbo_scale->scale_y * vp_height;
|
fbo_scale->scale_y * vp_height;
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -308,8 +308,7 @@ static void *video_null_init(const video_info_t *video,
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool video_null_frame(void *a, const void *b, unsigned c, unsigned d,
|
static bool video_null_frame(void *a, const void *b, unsigned c, unsigned d,
|
||||||
uint64_t e,
|
uint64_t e, unsigned f, const char *g, video_frame_info_t *h) { return true; }
|
||||||
unsigned f, const char *g, video_frame_info_t *h) { return true; }
|
|
||||||
static void video_null_free(void *a) { }
|
static void video_null_free(void *a) { }
|
||||||
static void video_null_set_nonblock_state(void *a, bool b, bool c, unsigned d) { }
|
static void video_null_set_nonblock_state(void *a, bool b, bool c, unsigned d) { }
|
||||||
static bool video_null_alive(void *a) { return frontend_driver_get_signal_handler_state() != 1; }
|
static bool video_null_alive(void *a) { return frontend_driver_get_signal_handler_state() != 1; }
|
||||||
|
@ -2090,7 +2089,8 @@ void video_driver_set_aspect_ratio(void)
|
||||||
video_st->poke->set_aspect_ratio(video_st->data, aspect_ratio_idx);
|
video_st->poke->set_aspect_ratio(video_st->data, aspect_ratio_idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
void video_viewport_get_scaled_aspect(struct video_viewport *vp, unsigned viewport_width, unsigned viewport_height, bool ydown) {
|
void video_viewport_get_scaled_aspect(struct video_viewport *vp, unsigned viewport_width, unsigned viewport_height, bool ydown)
|
||||||
|
{
|
||||||
float device_aspect = (float)viewport_width / viewport_height;
|
float device_aspect = (float)viewport_width / viewport_height;
|
||||||
float desired_aspect = video_driver_get_aspect_ratio();
|
float desired_aspect = video_driver_get_aspect_ratio();
|
||||||
video_viewport_get_scaled_aspect2(vp, viewport_width, viewport_height, ydown, device_aspect, desired_aspect);
|
video_viewport_get_scaled_aspect2(vp, viewport_width, viewport_height, ydown, device_aspect, desired_aspect);
|
||||||
|
|
|
@ -107,7 +107,8 @@ scalers h:
|
||||||
/* scale 4:5 */
|
/* scale 4:5 */
|
||||||
#define PICOSCALE_H_UPSCALE_SNN_4_5(di,ds,si,ss,w,f) do { \
|
#define PICOSCALE_H_UPSCALE_SNN_4_5(di,ds,si,ss,w,f) do { \
|
||||||
uint16_t i; \
|
uint16_t i; \
|
||||||
for (i = w/4; i > 0; i--, si += 4, di += 5) { \
|
for (i = w/4; i > 0; i--, si += 4, di += 5) \
|
||||||
|
{ \
|
||||||
di[0] = f(si[0]); \
|
di[0] = f(si[0]); \
|
||||||
di[1] = f(si[1]); \
|
di[1] = f(si[1]); \
|
||||||
PICOSCALE_P_05(di[2], f(si[1]),f(si[2])); \
|
PICOSCALE_P_05(di[2], f(si[1]),f(si[2])); \
|
||||||
|
@ -120,7 +121,8 @@ scalers h:
|
||||||
|
|
||||||
#define PICOSCALE_H_UPSCALE_BL2_4_5(di,ds,si,ss,w,f) do { \
|
#define PICOSCALE_H_UPSCALE_BL2_4_5(di,ds,si,ss,w,f) do { \
|
||||||
uint16_t i; \
|
uint16_t i; \
|
||||||
for (i = w/4; i > 0; i--, si += 4, di += 5) { \
|
for (i = w/4; i > 0; i--, si += 4, di += 5) \
|
||||||
|
{ \
|
||||||
di[0] = f(si[0]); \
|
di[0] = f(si[0]); \
|
||||||
PICOSCALE_P_05(di[1], f(si[0]),f(si[1])); \
|
PICOSCALE_P_05(di[1], f(si[0]),f(si[1])); \
|
||||||
PICOSCALE_P_05(di[2], f(si[1]),f(si[2])); \
|
PICOSCALE_P_05(di[2], f(si[1]),f(si[2])); \
|
||||||
|
@ -133,7 +135,8 @@ scalers h:
|
||||||
|
|
||||||
#define PICOSCALE_H_UPSCALE_BL4_4_5(di,ds,si,ss,w,f) do { \
|
#define PICOSCALE_H_UPSCALE_BL4_4_5(di,ds,si,ss,w,f) do { \
|
||||||
uint16_t i, t; uint16_t p = f(si[0]); \
|
uint16_t i, t; uint16_t p = f(si[0]); \
|
||||||
for (i = w/4; i > 0; i--, si += 4, di += 5) { \
|
for (i = w/4; i > 0; i--, si += 4, di += 5) \
|
||||||
|
{ \
|
||||||
PICOSCALE_P_025(di[0], p, f(si[0])); \
|
PICOSCALE_P_025(di[0], p, f(si[0])); \
|
||||||
PICOSCALE_P_05 (di[1], f(si[0]),f(si[1])); \
|
PICOSCALE_P_05 (di[1], f(si[0]),f(si[1])); \
|
||||||
PICOSCALE_P_05 (di[2], f(si[1]),f(si[2])); \
|
PICOSCALE_P_05 (di[2], f(si[1]),f(si[2])); \
|
||||||
|
@ -150,7 +153,8 @@ scalers v:
|
||||||
|
|
||||||
#define PICOSCALE_V_MIX(di,li,ri,w,p_mix,f) do { \
|
#define PICOSCALE_V_MIX(di,li,ri,w,p_mix,f) do { \
|
||||||
uint16_t i, t, u; (void)t, (void)u; \
|
uint16_t i, t, u; (void)t, (void)u; \
|
||||||
for (i = 0; i < w; i += 4) { \
|
for (i = 0; i < w; i += 4) \
|
||||||
|
{ \
|
||||||
p_mix((di)[i ], f((li)[i ]),f((ri)[i ])); \
|
p_mix((di)[i ], f((li)[i ]),f((ri)[i ])); \
|
||||||
p_mix((di)[i+1], f((li)[i+1]),f((ri)[i+1])); \
|
p_mix((di)[i+1], f((li)[i+1]),f((ri)[i+1])); \
|
||||||
p_mix((di)[i+2], f((li)[i+2]),f((ri)[i+2])); \
|
p_mix((di)[i+2], f((li)[i+2]),f((ri)[i+2])); \
|
||||||
|
@ -240,7 +244,7 @@ void picoscale_upscale_rgb_snn_256_320x192_240(uint16_t *PICOSCALE_restrict di,
|
||||||
/* Next two lines */
|
/* Next two lines */
|
||||||
PICOSCALE_H_UPSCALE_SNN_4_5(di, ds, si, ss, 256, PICOSCALE_F_NOP);
|
PICOSCALE_H_UPSCALE_SNN_4_5(di, ds, si, ss, 256, PICOSCALE_F_NOP);
|
||||||
PICOSCALE_H_UPSCALE_SNN_4_5(di, ds, si, ss, 256, PICOSCALE_F_NOP);
|
PICOSCALE_H_UPSCALE_SNN_4_5(di, ds, si, ss, 256, PICOSCALE_F_NOP);
|
||||||
|
|
||||||
/* mix lines 2-4 */
|
/* mix lines 2-4 */
|
||||||
|
|
||||||
di -= ds*3;
|
di -= ds*3;
|
||||||
|
@ -411,8 +415,11 @@ static void picoscale_256x_320x240_generic_output(void *data,
|
||||||
unsigned *out_width, unsigned *out_height,
|
unsigned *out_width, unsigned *out_height,
|
||||||
unsigned width, unsigned height)
|
unsigned width, unsigned height)
|
||||||
{
|
{
|
||||||
if ((width == 256) &&
|
if ( (width == 256)
|
||||||
((height == 224) || (height == 240) || (height == 192) || (height == 239)))
|
&& ((height == 224)
|
||||||
|
|| (height == 240)
|
||||||
|
|| (height == 192)
|
||||||
|
|| (height == 239)))
|
||||||
{
|
{
|
||||||
*out_width = 320;
|
*out_width = 320;
|
||||||
*out_height = 240;
|
*out_height = 240;
|
||||||
|
|
|
@ -170,7 +170,8 @@ static void gfx_widget_leaderboard_display_frame(void* data, void* userdata)
|
||||||
- p_dispwidget->gfx_widget_fonts.regular.line_descender);
|
- p_dispwidget->gfx_widget_fonts.regular.line_descender);
|
||||||
|
|
||||||
ptr = state->tracker_info[i].display;
|
ptr = state->tracker_info[i].display;
|
||||||
while (*ptr) {
|
while (*ptr)
|
||||||
|
{
|
||||||
float next_char_x = char_x + state->fixed_char_width;
|
float next_char_x = char_x + state->fixed_char_width;
|
||||||
const char c = *ptr++;
|
const char c = *ptr++;
|
||||||
if (c >= CHEEVO_LBOARD_FIRST_FIXED_CHAR && c <= CHEEVO_LBOARD_LAST_FIXED_CHAR)
|
if (c >= CHEEVO_LBOARD_FIRST_FIXED_CHAR && c <= CHEEVO_LBOARD_LAST_FIXED_CHAR)
|
||||||
|
@ -182,9 +183,7 @@ static void gfx_widget_leaderboard_display_frame(void* data, void* userdata)
|
||||||
char_x += padding;
|
char_x += padding;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
next_char_x = char_x + char_width;
|
next_char_x = char_x + char_width;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
buffer[0] = c;
|
buffer[0] = c;
|
||||||
|
@ -348,16 +347,17 @@ static void gfx_widget_leaderboard_display_frame(void* data, void* userdata)
|
||||||
if (state->disconnected || state->loading)
|
if (state->disconnected || state->loading)
|
||||||
{
|
{
|
||||||
char loading_buffer[8] = "RA ...";
|
char loading_buffer[8] = "RA ...";
|
||||||
const char* disconnected_text = state->disconnected ? "! RA !" : loading_buffer;
|
const char *disconnected_text = state->disconnected ? "! RA !" : loading_buffer;
|
||||||
const unsigned disconnect_widget_width = font_driver_get_message_width(
|
const unsigned disconnect_widget_width = font_driver_get_message_width(
|
||||||
state->dispwidget_ptr->gfx_widget_fonts.msg_queue.font,
|
state->dispwidget_ptr->gfx_widget_fonts.msg_queue.font,
|
||||||
disconnected_text, 0, 1) + CHEEVO_LBOARD_DISPLAY_PADDING * 2;
|
disconnected_text, 0, 1) + CHEEVO_LBOARD_DISPLAY_PADDING * 2;
|
||||||
const unsigned disconnect_widget_height =
|
const unsigned disconnect_widget_height =
|
||||||
p_dispwidget->gfx_widget_fonts.msg_queue.line_height + (CHEEVO_LBOARD_DISPLAY_PADDING - 1) * 2;
|
p_dispwidget->gfx_widget_fonts.msg_queue.line_height + (CHEEVO_LBOARD_DISPLAY_PADDING - 1) * 2;
|
||||||
x = video_width - disconnect_widget_width - spacing;
|
x = video_width - disconnect_widget_width - spacing;
|
||||||
y -= disconnect_widget_height + spacing;
|
y -= disconnect_widget_height + spacing;
|
||||||
|
|
||||||
if (state->loading) {
|
if (state->loading)
|
||||||
|
{
|
||||||
const uint16_t loading_shift = 5;
|
const uint16_t loading_shift = 5;
|
||||||
loading_buffer[((state->loading - 1) >> loading_shift) + 3] = '\0';
|
loading_buffer[((state->loading - 1) >> loading_shift) + 3] = '\0';
|
||||||
state->loading &= (1 << (loading_shift + 2)) - 1;
|
state->loading &= (1 << (loading_shift + 2)) - 1;
|
||||||
|
|
|
@ -464,14 +464,10 @@ static void handle_relative_motion(void *data,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
locked_pointer_locked(void *data, struct zwp_locked_pointer_v1 *locked_pointer)
|
locked_pointer_locked(void *data, struct zwp_locked_pointer_v1 *lockptr) { }
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
locked_pointer_unlocked(void *data, struct zwp_locked_pointer_v1 *locked_pointer)
|
locked_pointer_unlocked(void *data, struct zwp_locked_pointer_v1 *lockptr) { }
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
static void wl_touch_handle_frame(void *data, struct wl_touch *wl_touch) { }
|
static void wl_touch_handle_frame(void *data, struct wl_touch *wl_touch) { }
|
||||||
|
|
||||||
|
@ -551,13 +547,15 @@ static bool wl_update_scale(gfx_ctx_wayland_data_t *wl)
|
||||||
|
|
||||||
wl_list_for_each(os, &wl->current_outputs, link)
|
wl_list_for_each(os, &wl->current_outputs, link)
|
||||||
{
|
{
|
||||||
if (os->output->scale > largest_scale) {
|
if (os->output->scale > largest_scale)
|
||||||
|
{
|
||||||
largest_scale = os->output->scale;
|
largest_scale = os->output->scale;
|
||||||
new_output = os->output;
|
new_output = os->output;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if (new_output && wl->current_output != new_output) {
|
if (new_output && wl->current_output != new_output)
|
||||||
|
{
|
||||||
wl->current_output = new_output;
|
wl->current_output = new_output;
|
||||||
wl->pending_buffer_scale = new_output->scale;
|
wl->pending_buffer_scale = new_output->scale;
|
||||||
return true;
|
return true;
|
||||||
|
@ -1125,7 +1123,7 @@ const struct zwp_relative_pointer_v1_listener relative_pointer_listener = {
|
||||||
};
|
};
|
||||||
|
|
||||||
const struct zwp_locked_pointer_v1_listener locked_pointer_listener = {
|
const struct zwp_locked_pointer_v1_listener locked_pointer_listener = {
|
||||||
.locked = locked_pointer_locked,
|
.locked = locked_pointer_locked,
|
||||||
.unlocked = locked_pointer_unlocked,
|
.unlocked = locked_pointer_unlocked,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -81,7 +81,7 @@ static void apple_gamecontroller_joypad_poll_internal(GCController *controller,
|
||||||
{
|
{
|
||||||
uint32_t *buttons = &mfi_buttons[slot];
|
uint32_t *buttons = &mfi_buttons[slot];
|
||||||
/* Retain the values from the paused controller handler and pass them through.
|
/* Retain the values from the paused controller handler and pass them through.
|
||||||
* The menu button can be pressed/unpressed
|
* The menu button can be pressed/unpressed
|
||||||
* like any other button in iOS 13,
|
* like any other button in iOS 13,
|
||||||
* so no need to passthrough anything */
|
* so no need to passthrough anything */
|
||||||
if (@available(iOS 13, *))
|
if (@available(iOS 13, *))
|
||||||
|
@ -231,7 +231,7 @@ static void apple_gamecontroller_joypad_register(GCController *controller)
|
||||||
{
|
{
|
||||||
#ifdef __IPHONE_14_0
|
#ifdef __IPHONE_14_0
|
||||||
/* Don't let tvOS or iOS do anything with **our** buttons!!
|
/* Don't let tvOS or iOS do anything with **our** buttons!!
|
||||||
* iOS will start a screen recording if you hold or doubleclick
|
* iOS will start a screen recording if you hold or doubleclick
|
||||||
* the OPTIONS button, we don't want that. */
|
* the OPTIONS button, we don't want that. */
|
||||||
if (@available(iOS 14.0, tvOS 14.0, macOS 11, *))
|
if (@available(iOS 14.0, tvOS 14.0, macOS 11, *))
|
||||||
{
|
{
|
||||||
|
@ -241,8 +241,8 @@ static void apple_gamecontroller_joypad_register(GCController *controller)
|
||||||
gp.buttonHome.preferredSystemGestureState = GCSystemGestureStateDisabled;
|
gp.buttonHome.preferredSystemGestureState = GCSystemGestureStateDisabled;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* controllerPausedHandler is deprecated in favor
|
/* controllerPausedHandler is deprecated in favor
|
||||||
* of being able to deal with the menu
|
* of being able to deal with the menu
|
||||||
* button as any other button */
|
* button as any other button */
|
||||||
if (@available(iOS 13, *))
|
if (@available(iOS 13, *))
|
||||||
|
@ -257,16 +257,16 @@ static void apple_gamecontroller_joypad_register(GCController *controller)
|
||||||
{
|
{
|
||||||
uint32_t slot = (uint32_t)controller.playerIndex;
|
uint32_t slot = (uint32_t)controller.playerIndex;
|
||||||
|
|
||||||
/* Support buttons that aren't supported by the mFi
|
/* Support buttons that aren't supported by the mFi
|
||||||
* controller via "hotkey" combinations:
|
* controller via "hotkey" combinations:
|
||||||
*
|
*
|
||||||
* LS + Menu => Select
|
* LS + Menu => Select
|
||||||
* LT + Menu => L3
|
* LT + Menu => L3
|
||||||
* RT + Menu => R3
|
* RT + Menu => R3
|
||||||
* Note that these are just button presses, and it
|
* Note that these are just button presses, and it
|
||||||
* does not simulate holding down the button
|
* does not simulate holding down the button
|
||||||
*/
|
*/
|
||||||
if ( controller.gamepad.leftShoulder.pressed
|
if ( controller.gamepad.leftShoulder.pressed
|
||||||
|| controller.extendedGamepad.leftShoulder.pressed )
|
|| controller.extendedGamepad.leftShoulder.pressed )
|
||||||
{
|
{
|
||||||
mfi_buttons[slot] &= ~(1 << RETRO_DEVICE_ID_JOYPAD_START);
|
mfi_buttons[slot] &= ~(1 << RETRO_DEVICE_ID_JOYPAD_START);
|
||||||
|
@ -703,14 +703,14 @@ static int16_t apple_gamecontroller_joypad_state(
|
||||||
? binds[i].joykey : joypad_info->auto_binds[i].joykey;
|
? binds[i].joykey : joypad_info->auto_binds[i].joykey;
|
||||||
const uint32_t joyaxis = (binds[i].joyaxis != AXIS_NONE)
|
const uint32_t joyaxis = (binds[i].joyaxis != AXIS_NONE)
|
||||||
? binds[i].joyaxis : joypad_info->auto_binds[i].joyaxis;
|
? binds[i].joyaxis : joypad_info->auto_binds[i].joyaxis;
|
||||||
if ( (uint16_t)joykey != NO_BTN
|
if ( (uint16_t)joykey != NO_BTN
|
||||||
&& !GET_HAT_DIR(i)
|
&& !GET_HAT_DIR(i)
|
||||||
&& (i < 32)
|
&& (i < 32)
|
||||||
&& ((mfi_buttons[port_idx] & (1 << i)) != 0)
|
&& ((mfi_buttons[port_idx] & (1 << i)) != 0)
|
||||||
)
|
)
|
||||||
ret |= ( 1 << i);
|
ret |= ( 1 << i);
|
||||||
else if (joyaxis != AXIS_NONE &&
|
else if (joyaxis != AXIS_NONE &&
|
||||||
((float)abs(apple_gamecontroller_joypad_axis(port_idx, joyaxis))
|
((float)abs(apple_gamecontroller_joypad_axis(port_idx, joyaxis))
|
||||||
/ 0x8000) > joypad_info->axis_threshold)
|
/ 0x8000) > joypad_info->axis_threshold)
|
||||||
ret |= (1 << i);
|
ret |= (1 << i);
|
||||||
}
|
}
|
||||||
|
@ -726,7 +726,8 @@ static bool apple_gamecontroller_joypad_set_rumble(unsigned pad,
|
||||||
settings_t *settings = config_get_ptr();
|
settings_t *settings = config_get_ptr();
|
||||||
bool enable_device_vibration = settings->bools.enable_device_vibration;
|
bool enable_device_vibration = settings->bools.enable_device_vibration;
|
||||||
|
|
||||||
if (@available(iOS 14, *)) {
|
if (@available(iOS 14, *))
|
||||||
|
{
|
||||||
if (enable_device_vibration && pad == 0)
|
if (enable_device_vibration && pad == 0)
|
||||||
{
|
{
|
||||||
NSError *error;
|
NSError *error;
|
||||||
|
|
|
@ -190,7 +190,7 @@ static void sdl_pad_connect(unsigned id)
|
||||||
}
|
}
|
||||||
|
|
||||||
pad->haptic = NULL;
|
pad->haptic = NULL;
|
||||||
|
|
||||||
if (g_has_haptic)
|
if (g_has_haptic)
|
||||||
{
|
{
|
||||||
pad->haptic = SDL_HapticOpenFromJoystick(pad->joypad);
|
pad->haptic = SDL_HapticOpenFromJoystick(pad->joypad);
|
||||||
|
@ -217,7 +217,8 @@ static void sdl_pad_connect(unsigned id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if SDL_VERSION_ATLEAST(2, 0, 9)
|
#if SDL_VERSION_ATLEAST(2, 0, 9)
|
||||||
if (!pad->haptic || pad->rumble_effect == -2) {
|
if (!pad->haptic || pad->rumble_effect == -2)
|
||||||
|
{
|
||||||
pad->rumble_effect = -3;
|
pad->rumble_effect = -3;
|
||||||
RARCH_LOG("[SDL]: Falling back to joystick rumble\n");
|
RARCH_LOG("[SDL]: Falling back to joystick rumble\n");
|
||||||
}
|
}
|
||||||
|
@ -296,7 +297,7 @@ static void *sdl_joypad_init(void *data)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
g_has_haptic = true;
|
g_has_haptic = true;
|
||||||
|
|
||||||
#if SDL_VERSION_ATLEAST(2, 0, 9)
|
#if SDL_VERSION_ATLEAST(2, 0, 9)
|
||||||
/* enable extended hid reports to support ps4/ps5 rumble over bluetooth */
|
/* enable extended hid reports to support ps4/ps5 rumble over bluetooth */
|
||||||
SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_PS4_RUMBLE, "1");
|
SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_PS4_RUMBLE, "1");
|
||||||
|
@ -389,7 +390,7 @@ static int16_t sdl_joypad_axis_state(
|
||||||
if (val < 0)
|
if (val < 0)
|
||||||
{
|
{
|
||||||
/* Clamp - -0x8000 can cause trouble if we later abs() it. */
|
/* Clamp - -0x8000 can cause trouble if we later abs() it. */
|
||||||
if (val < -0x7fff)
|
if (val < -0x7fff)
|
||||||
return -0x7fff;
|
return -0x7fff;
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
@ -435,12 +436,12 @@ static int16_t sdl_joypad_state(
|
||||||
const uint32_t joyaxis = (binds[i].joyaxis != AXIS_NONE)
|
const uint32_t joyaxis = (binds[i].joyaxis != AXIS_NONE)
|
||||||
? binds[i].joyaxis : joypad_info->auto_binds[i].joyaxis;
|
? binds[i].joyaxis : joypad_info->auto_binds[i].joyaxis;
|
||||||
if (
|
if (
|
||||||
(uint16_t)joykey != NO_BTN
|
(uint16_t)joykey != NO_BTN
|
||||||
&& sdl_joypad_button_state(pad, port_idx, (uint16_t)joykey)
|
&& sdl_joypad_button_state(pad, port_idx, (uint16_t)joykey)
|
||||||
)
|
)
|
||||||
ret |= ( 1 << i);
|
ret |= ( 1 << i);
|
||||||
else if (joyaxis != AXIS_NONE &&
|
else if (joyaxis != AXIS_NONE &&
|
||||||
((float)abs(sdl_joypad_axis_state(pad, port_idx, joyaxis))
|
((float)abs(sdl_joypad_axis_state(pad, port_idx, joyaxis))
|
||||||
/ 0x8000) > joypad_info->axis_threshold)
|
/ 0x8000) > joypad_info->axis_threshold)
|
||||||
ret |= (1 << i);
|
ret |= (1 << i);
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,7 @@ static HidVibrationDeviceHandle vibration_handles[DEFAULT_MAX_PADS][2];
|
||||||
static HidVibrationDeviceHandle vibration_handleheld[2];
|
static HidVibrationDeviceHandle vibration_handleheld[2];
|
||||||
static HidVibrationValue vibration_values[DEFAULT_MAX_PADS][2];
|
static HidVibrationValue vibration_values[DEFAULT_MAX_PADS][2];
|
||||||
static HidVibrationValue vibration_stop;
|
static HidVibrationValue vibration_stop;
|
||||||
static int previous_handheld = -1;
|
static int previous_handheld = -1;
|
||||||
/* 1 = handheld, 0 = docked, -1 = first use */
|
/* 1 = handheld, 0 = docked, -1 = first use */
|
||||||
static uint previous_split_joycon_setting[MAX_USERS] = { 0 };
|
static uint previous_split_joycon_setting[MAX_USERS] = { 0 };
|
||||||
#endif
|
#endif
|
||||||
|
@ -59,7 +59,7 @@ static void *switch_joypad_init(void *data)
|
||||||
hidSetNpadJoyHoldType(HidNpadJoyHoldType_Horizontal);
|
hidSetNpadJoyHoldType(HidNpadJoyHoldType_Horizontal);
|
||||||
padConfigureInput(DEFAULT_MAX_PADS, HidNpadStyleSet_NpadStandard);
|
padConfigureInput(DEFAULT_MAX_PADS, HidNpadStyleSet_NpadStandard);
|
||||||
|
|
||||||
/* Switch like stop behavior with muted band channels
|
/* Switch like stop behavior with muted band channels
|
||||||
* and frequencies set to default. */
|
* and frequencies set to default. */
|
||||||
vibration_stop.amp_low = 0.0f;
|
vibration_stop.amp_low = 0.0f;
|
||||||
vibration_stop.freq_low = 160.0f;
|
vibration_stop.freq_low = 160.0f;
|
||||||
|
@ -181,12 +181,12 @@ static int16_t switch_joypad_state(
|
||||||
const uint32_t joyaxis = (binds[i].joyaxis != AXIS_NONE)
|
const uint32_t joyaxis = (binds[i].joyaxis != AXIS_NONE)
|
||||||
? binds[i].joyaxis : joypad_info->auto_binds[i].joyaxis;
|
? binds[i].joyaxis : joypad_info->auto_binds[i].joyaxis;
|
||||||
if (
|
if (
|
||||||
(uint16_t)joykey != NO_BTN
|
(uint16_t)joykey != NO_BTN
|
||||||
&& (button_state[port_idx] & (1 << (uint16_t)joykey))
|
&& (button_state[port_idx] & (1 << (uint16_t)joykey))
|
||||||
)
|
)
|
||||||
ret |= ( 1 << i);
|
ret |= ( 1 << i);
|
||||||
else if (joyaxis != AXIS_NONE &&
|
else if (joyaxis != AXIS_NONE &&
|
||||||
((float)abs(switch_joypad_axis_state(port_idx, joyaxis))
|
((float)abs(switch_joypad_axis_state(port_idx, joyaxis))
|
||||||
/ 0x8000) > joypad_info->axis_threshold)
|
/ 0x8000) > joypad_info->axis_threshold)
|
||||||
ret |= (1 << i);
|
ret |= (1 << i);
|
||||||
}
|
}
|
||||||
|
@ -237,20 +237,20 @@ static void switch_joypad_poll(void)
|
||||||
|
|
||||||
if (previous_handheld == -1)
|
if (previous_handheld == -1)
|
||||||
{
|
{
|
||||||
/* First call of this function, apply joycon settings
|
/* First call of this function, apply joycon settings
|
||||||
* according to preferences, init variables */
|
* according to preferences, init variables */
|
||||||
if (!handheld)
|
if (!handheld)
|
||||||
{
|
{
|
||||||
for (i = 0; i < MAX_USERS; i += 2)
|
for (i = 0; i < MAX_USERS; i += 2)
|
||||||
{
|
{
|
||||||
unsigned input_split_joycon =
|
unsigned input_split_joycon =
|
||||||
settings->uints.input_split_joycon[i];
|
settings->uints.input_split_joycon[i];
|
||||||
|
|
||||||
if (input_split_joycon)
|
if (input_split_joycon)
|
||||||
{
|
{
|
||||||
hidSetNpadJoyAssignmentModeSingleByDefault(i);
|
hidSetNpadJoyAssignmentModeSingleByDefault(i);
|
||||||
hidSetNpadJoyAssignmentModeSingleByDefault(i + 1);
|
hidSetNpadJoyAssignmentModeSingleByDefault(i + 1);
|
||||||
}
|
}
|
||||||
else if (!input_split_joycon)
|
else if (!input_split_joycon)
|
||||||
{
|
{
|
||||||
hidSetNpadJoyAssignmentModeDual(i);
|
hidSetNpadJoyAssignmentModeDual(i);
|
||||||
|
@ -266,7 +266,7 @@ static void switch_joypad_poll(void)
|
||||||
|
|
||||||
if (!handheld && previous_handheld)
|
if (!handheld && previous_handheld)
|
||||||
{
|
{
|
||||||
/* switching out of handheld, so make sure
|
/* switching out of handheld, so make sure
|
||||||
* joycons are correctly split. */
|
* joycons are correctly split. */
|
||||||
for (i = 0; i < MAX_USERS; i += 2)
|
for (i = 0; i < MAX_USERS; i += 2)
|
||||||
{
|
{
|
||||||
|
@ -297,7 +297,7 @@ static void switch_joypad_poll(void)
|
||||||
{
|
{
|
||||||
hidSetNpadJoyAssignmentModeSingleByDefault(i);
|
hidSetNpadJoyAssignmentModeSingleByDefault(i);
|
||||||
hidSetNpadJoyAssignmentModeSingleByDefault(i + 1);
|
hidSetNpadJoyAssignmentModeSingleByDefault(i + 1);
|
||||||
}
|
}
|
||||||
else if (!input_split_joycon
|
else if (!input_split_joycon
|
||||||
&& previous_split_joycon_setting[i])
|
&& previous_split_joycon_setting[i])
|
||||||
{
|
{
|
||||||
|
@ -310,19 +310,20 @@ static void switch_joypad_poll(void)
|
||||||
|
|
||||||
for (i = 0; i < MAX_USERS; i += 2)
|
for (i = 0; i < MAX_USERS; i += 2)
|
||||||
previous_split_joycon_setting[i] = settings->uints.input_split_joycon[i];
|
previous_split_joycon_setting[i] = settings->uints.input_split_joycon[i];
|
||||||
|
|
||||||
previous_handheld = handheld;
|
previous_handheld = handheld;
|
||||||
|
|
||||||
for (i = 0; i < DEFAULT_MAX_PADS; i++)
|
for (i = 0; i < DEFAULT_MAX_PADS; i++)
|
||||||
{
|
{
|
||||||
HidAnalogStickState stick_left_state = padGetStickPos(&pad_states[i], 0);
|
HidAnalogStickState stick_left_state = padGetStickPos(&pad_states[i], 0);
|
||||||
HidAnalogStickState stick_right_state = padGetStickPos(&pad_states[i], 1);
|
HidAnalogStickState stick_right_state = padGetStickPos(&pad_states[i], 1);
|
||||||
unsigned input_split_joycon = settings->uints.input_split_joycon[i];
|
unsigned input_split_joycon = settings->uints.input_split_joycon[i];
|
||||||
int pad_button = padGetButtons(&pad_states[i]);
|
int pad_button = padGetButtons(&pad_states[i]);
|
||||||
if (input_split_joycon && !handheld) {
|
if (input_split_joycon && !handheld)
|
||||||
|
{
|
||||||
button_state[i] = 0;
|
button_state[i] = 0;
|
||||||
|
if (hidGetNpadDeviceType((HidNpadIdType)i) & HidDeviceTypeBits_JoyLeft)
|
||||||
if (hidGetNpadDeviceType((HidNpadIdType)i) & HidDeviceTypeBits_JoyLeft) {
|
{
|
||||||
if (pad_button & HidNpadButton_Left)
|
if (pad_button & HidNpadButton_Left)
|
||||||
button_state[i] |= (uint16_t)HidNpadButton_B;
|
button_state[i] |= (uint16_t)HidNpadButton_B;
|
||||||
if (pad_button & HidNpadButton_Up)
|
if (pad_button & HidNpadButton_Up)
|
||||||
|
@ -342,7 +343,9 @@ static void switch_joypad_poll(void)
|
||||||
|
|
||||||
analog_state[i][RETRO_DEVICE_INDEX_ANALOG_LEFT][RETRO_DEVICE_ID_ANALOG_X] = -stick_left_state.y;
|
analog_state[i][RETRO_DEVICE_INDEX_ANALOG_LEFT][RETRO_DEVICE_ID_ANALOG_X] = -stick_left_state.y;
|
||||||
analog_state[i][RETRO_DEVICE_INDEX_ANALOG_LEFT][RETRO_DEVICE_ID_ANALOG_Y] = -stick_left_state.x;
|
analog_state[i][RETRO_DEVICE_INDEX_ANALOG_LEFT][RETRO_DEVICE_ID_ANALOG_Y] = -stick_left_state.x;
|
||||||
} else if (hidGetNpadDeviceType((HidNpadIdType)i) & HidDeviceTypeBits_JoyRight) {
|
}
|
||||||
|
else if (hidGetNpadDeviceType((HidNpadIdType)i) & HidDeviceTypeBits_JoyRight)
|
||||||
|
{
|
||||||
if (pad_button & HidNpadButton_A)
|
if (pad_button & HidNpadButton_A)
|
||||||
button_state[i] |= (uint16_t)HidNpadButton_B;
|
button_state[i] |= (uint16_t)HidNpadButton_B;
|
||||||
if (pad_button & HidNpadButton_B)
|
if (pad_button & HidNpadButton_B)
|
||||||
|
@ -363,10 +366,9 @@ static void switch_joypad_poll(void)
|
||||||
/* Throw JoyRight state into retro left analog */
|
/* Throw JoyRight state into retro left analog */
|
||||||
analog_state[i][RETRO_DEVICE_INDEX_ANALOG_LEFT][RETRO_DEVICE_ID_ANALOG_X] = stick_right_state.y;
|
analog_state[i][RETRO_DEVICE_INDEX_ANALOG_LEFT][RETRO_DEVICE_ID_ANALOG_X] = stick_right_state.y;
|
||||||
analog_state[i][RETRO_DEVICE_INDEX_ANALOG_LEFT][RETRO_DEVICE_ID_ANALOG_Y] = stick_right_state.x;
|
analog_state[i][RETRO_DEVICE_INDEX_ANALOG_LEFT][RETRO_DEVICE_ID_ANALOG_Y] = stick_right_state.x;
|
||||||
} else {
|
|
||||||
/* Handle other types via Default Input Handling */
|
|
||||||
goto lblDefaultInputHandling;
|
|
||||||
}
|
}
|
||||||
|
else /* Handle other types via Default Input Handling */
|
||||||
|
goto lblDefaultInputHandling;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -375,7 +377,7 @@ lblDefaultInputHandling:
|
||||||
button_state[i] = pad_button;
|
button_state[i] = pad_button;
|
||||||
analog_state[i][RETRO_DEVICE_INDEX_ANALOG_LEFT][RETRO_DEVICE_ID_ANALOG_X] = stick_left_state.x;
|
analog_state[i][RETRO_DEVICE_INDEX_ANALOG_LEFT][RETRO_DEVICE_ID_ANALOG_X] = stick_left_state.x;
|
||||||
analog_state[i][RETRO_DEVICE_INDEX_ANALOG_LEFT][RETRO_DEVICE_ID_ANALOG_Y] = -stick_left_state.y;
|
analog_state[i][RETRO_DEVICE_INDEX_ANALOG_LEFT][RETRO_DEVICE_ID_ANALOG_Y] = -stick_left_state.y;
|
||||||
|
|
||||||
analog_state[i][RETRO_DEVICE_INDEX_ANALOG_RIGHT][RETRO_DEVICE_ID_ANALOG_X] = stick_right_state.x;
|
analog_state[i][RETRO_DEVICE_INDEX_ANALOG_RIGHT][RETRO_DEVICE_ID_ANALOG_X] = stick_right_state.x;
|
||||||
analog_state[i][RETRO_DEVICE_INDEX_ANALOG_RIGHT][RETRO_DEVICE_ID_ANALOG_Y] = -stick_right_state.y;
|
analog_state[i][RETRO_DEVICE_INDEX_ANALOG_RIGHT][RETRO_DEVICE_ID_ANALOG_Y] = -stick_right_state.y;
|
||||||
}
|
}
|
||||||
|
|
|
@ -225,17 +225,19 @@ struct reverb_data
|
||||||
|
|
||||||
static void reverb_free(void *data)
|
static void reverb_free(void *data)
|
||||||
{
|
{
|
||||||
struct reverb_data *rev = (struct reverb_data*)data;
|
|
||||||
unsigned i;
|
unsigned i;
|
||||||
|
struct reverb_data *rev = (struct reverb_data*)data;
|
||||||
|
|
||||||
for (i = 0; i < numcombs; i++) {
|
for (i = 0; i < numcombs; i++)
|
||||||
free(rev->left.bufcomb[i]);
|
{
|
||||||
free(rev->right.bufcomb[i]);
|
free(rev->left.bufcomb[i]);
|
||||||
|
free(rev->right.bufcomb[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < numallpasses; i++) {
|
for (i = 0; i < numallpasses; i++)
|
||||||
free(rev->left.bufallpass[i]);
|
{
|
||||||
free(rev->right.bufallpass[i]);
|
free(rev->left.bufallpass[i]);
|
||||||
|
free(rev->right.bufallpass[i]);
|
||||||
}
|
}
|
||||||
free(data);
|
free(data);
|
||||||
}
|
}
|
||||||
|
|
|
@ -156,7 +156,8 @@ static bool zlib_stream_decompress_data_to_file_init(
|
||||||
zip_context->zstream->zfree = NULL;
|
zip_context->zstream->zfree = NULL;
|
||||||
zip_context->zstream->opaque = NULL;
|
zip_context->zstream->opaque = NULL;
|
||||||
|
|
||||||
if (inflateInit2(zip_context->zstream, -MAX_WBITS) != Z_OK) {
|
if (inflateInit2(zip_context->zstream, -MAX_WBITS) != Z_OK)
|
||||||
|
{
|
||||||
free(zip_context->zstream);
|
free(zip_context->zstream);
|
||||||
zip_context->zstream = NULL;
|
zip_context->zstream = NULL;
|
||||||
goto error;
|
goto error;
|
||||||
|
|
|
@ -427,9 +427,8 @@ int huffman_build_tree(struct huffman_decoder* decoder, uint32_t totaldata, uint
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
fprintf(stderr, "Post-sort:\n");
|
fprintf(stderr, "Post-sort:\n");
|
||||||
for (int i = 0; i < listitems; i++) {
|
for (int i = 0; i < listitems; i++)
|
||||||
fprintf(stderr, "weight: %d code: %d\n", list[i]->m_weight, list[i]->m_bits);
|
fprintf(stderr, "weight: %d code: %d\n", list[i]->m_weight, list[i]->m_bits);
|
||||||
}
|
|
||||||
fprintf(stderr, "===================\n");
|
fprintf(stderr, "===================\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -416,8 +416,9 @@ typedef struct retro_unaligned_uint64_s retro_unaligned_uint64_t;
|
||||||
* @return The first two bytes of \c addr as a 16-bit unsigned integer,
|
* @return The first two bytes of \c addr as a 16-bit unsigned integer,
|
||||||
* byteswapped from big-endian to host-native order if necessary.
|
* byteswapped from big-endian to host-native order if necessary.
|
||||||
*/
|
*/
|
||||||
static INLINE uint16_t retro_get_unaligned_16be(void *addr) {
|
static INLINE uint16_t retro_get_unaligned_16be(void *addr)
|
||||||
return retro_be_to_cpu16(retro_unaligned16(addr));
|
{
|
||||||
|
return retro_be_to_cpu16(retro_unaligned16(addr));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -431,8 +432,9 @@ static INLINE uint16_t retro_get_unaligned_16be(void *addr) {
|
||||||
* @return The first four bytes of \c addr as a 32-bit unsigned integer,
|
* @return The first four bytes of \c addr as a 32-bit unsigned integer,
|
||||||
* byteswapped from big-endian to host-native order if necessary.
|
* byteswapped from big-endian to host-native order if necessary.
|
||||||
*/
|
*/
|
||||||
static INLINE uint32_t retro_get_unaligned_32be(void *addr) {
|
static INLINE uint32_t retro_get_unaligned_32be(void *addr)
|
||||||
return retro_be_to_cpu32(retro_unaligned32(addr));
|
{
|
||||||
|
return retro_be_to_cpu32(retro_unaligned32(addr));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -446,8 +448,9 @@ static INLINE uint32_t retro_get_unaligned_32be(void *addr) {
|
||||||
* @return The first eight bytes of \c addr as a 64-bit unsigned integer,
|
* @return The first eight bytes of \c addr as a 64-bit unsigned integer,
|
||||||
* byteswapped from big-endian to host-native order if necessary.
|
* byteswapped from big-endian to host-native order if necessary.
|
||||||
*/
|
*/
|
||||||
static INLINE uint64_t retro_get_unaligned_64be(void *addr) {
|
static INLINE uint64_t retro_get_unaligned_64be(void *addr)
|
||||||
return retro_be_to_cpu64(retro_unaligned64(addr));
|
{
|
||||||
|
return retro_be_to_cpu64(retro_unaligned64(addr));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -461,8 +464,9 @@ static INLINE uint64_t retro_get_unaligned_64be(void *addr) {
|
||||||
* @return The first two bytes of \c addr as a 16-bit unsigned integer,
|
* @return The first two bytes of \c addr as a 16-bit unsigned integer,
|
||||||
* byteswapped from little-endian to host-native order if necessary.
|
* byteswapped from little-endian to host-native order if necessary.
|
||||||
*/
|
*/
|
||||||
static INLINE uint16_t retro_get_unaligned_16le(void *addr) {
|
static INLINE uint16_t retro_get_unaligned_16le(void *addr)
|
||||||
return retro_le_to_cpu16(retro_unaligned16(addr));
|
{
|
||||||
|
return retro_le_to_cpu16(retro_unaligned16(addr));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -476,8 +480,9 @@ static INLINE uint16_t retro_get_unaligned_16le(void *addr) {
|
||||||
* @return The first four bytes of \c addr as a 32-bit unsigned integer,
|
* @return The first four bytes of \c addr as a 32-bit unsigned integer,
|
||||||
* byteswapped from little-endian to host-native order if necessary.
|
* byteswapped from little-endian to host-native order if necessary.
|
||||||
*/
|
*/
|
||||||
static INLINE uint32_t retro_get_unaligned_32le(void *addr) {
|
static INLINE uint32_t retro_get_unaligned_32le(void *addr)
|
||||||
return retro_le_to_cpu32(retro_unaligned32(addr));
|
{
|
||||||
|
return retro_le_to_cpu32(retro_unaligned32(addr));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -491,8 +496,9 @@ static INLINE uint32_t retro_get_unaligned_32le(void *addr) {
|
||||||
* @return The first eight bytes of \c addr as a 64-bit unsigned integer,
|
* @return The first eight bytes of \c addr as a 64-bit unsigned integer,
|
||||||
* byteswapped from little-endian to host-native order if necessary.
|
* byteswapped from little-endian to host-native order if necessary.
|
||||||
*/
|
*/
|
||||||
static INLINE uint64_t retro_get_unaligned_64le(void *addr) {
|
static INLINE uint64_t retro_get_unaligned_64le(void *addr)
|
||||||
return retro_le_to_cpu64(retro_unaligned64(addr));
|
{
|
||||||
|
return retro_le_to_cpu64(retro_unaligned64(addr));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -505,8 +511,9 @@ static INLINE uint64_t retro_get_unaligned_64le(void *addr) {
|
||||||
* the way a \c uint16_t* usually would be.
|
* the way a \c uint16_t* usually would be.
|
||||||
* @param v The value to write.
|
* @param v The value to write.
|
||||||
*/
|
*/
|
||||||
static INLINE void retro_set_unaligned_16le(void *addr, uint16_t v) {
|
static INLINE void retro_set_unaligned_16le(void *addr, uint16_t v)
|
||||||
retro_unaligned16(addr) = retro_cpu_to_le16(v);
|
{
|
||||||
|
retro_unaligned16(addr) = retro_cpu_to_le16(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -519,8 +526,9 @@ static INLINE void retro_set_unaligned_16le(void *addr, uint16_t v) {
|
||||||
* the way a \c uint32_t* usually would be.
|
* the way a \c uint32_t* usually would be.
|
||||||
* @param v The value to write.
|
* @param v The value to write.
|
||||||
*/
|
*/
|
||||||
static INLINE void retro_set_unaligned_32le(void *addr, uint32_t v) {
|
static INLINE void retro_set_unaligned_32le(void *addr, uint32_t v)
|
||||||
retro_unaligned32(addr) = retro_cpu_to_le32(v);
|
{
|
||||||
|
retro_unaligned32(addr) = retro_cpu_to_le32(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -533,8 +541,9 @@ static INLINE void retro_set_unaligned_32le(void *addr, uint32_t v) {
|
||||||
* the way a \c uint64_t* usually would be.
|
* the way a \c uint64_t* usually would be.
|
||||||
* @param v The value to write.
|
* @param v The value to write.
|
||||||
*/
|
*/
|
||||||
static INLINE void retro_set_unaligned_64le(void *addr, uint64_t v) {
|
static INLINE void retro_set_unaligned_64le(void *addr, uint64_t v)
|
||||||
retro_unaligned64(addr) = retro_cpu_to_le64(v);
|
{
|
||||||
|
retro_unaligned64(addr) = retro_cpu_to_le64(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -547,8 +556,9 @@ static INLINE void retro_set_unaligned_64le(void *addr, uint64_t v) {
|
||||||
* the way a \c uint16_t* usually would be.
|
* the way a \c uint16_t* usually would be.
|
||||||
* @param v The value to write.
|
* @param v The value to write.
|
||||||
*/
|
*/
|
||||||
static INLINE void retro_set_unaligned_16be(void *addr, uint16_t v) {
|
static INLINE void retro_set_unaligned_16be(void *addr, uint16_t v)
|
||||||
retro_unaligned16(addr) = retro_cpu_to_be16(v);
|
{
|
||||||
|
retro_unaligned16(addr) = retro_cpu_to_be16(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -561,8 +571,9 @@ static INLINE void retro_set_unaligned_16be(void *addr, uint16_t v) {
|
||||||
* the way a \c uint32_t* usually would be.
|
* the way a \c uint32_t* usually would be.
|
||||||
* @param v The value to write.
|
* @param v The value to write.
|
||||||
*/
|
*/
|
||||||
static INLINE void retro_set_unaligned_32be(void *addr, uint32_t v) {
|
static INLINE void retro_set_unaligned_32be(void *addr, uint32_t v)
|
||||||
retro_unaligned32(addr) = retro_cpu_to_be32(v);
|
{
|
||||||
|
retro_unaligned32(addr) = retro_cpu_to_be32(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -575,8 +586,9 @@ static INLINE void retro_set_unaligned_32be(void *addr, uint32_t v) {
|
||||||
* the way a \c uint64_t* usually would be.
|
* the way a \c uint64_t* usually would be.
|
||||||
* @param v The value to write.
|
* @param v The value to write.
|
||||||
*/
|
*/
|
||||||
static INLINE void retro_set_unaligned_64be(void *addr, uint64_t v) {
|
static INLINE void retro_set_unaligned_64be(void *addr, uint64_t v)
|
||||||
retro_unaligned64(addr) = retro_cpu_to_be64(v);
|
{
|
||||||
|
retro_unaligned64(addr) = retro_cpu_to_be64(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -688,7 +688,7 @@ static void menu_action_cpu_managed_freq_label(
|
||||||
MENU_ENUM_LABEL_VALUE_CPU_MANAGED_MAX_FREQ), len2);
|
MENU_ENUM_LABEL_VALUE_CPU_MANAGED_MAX_FREQ), len2);
|
||||||
freq = opts.max_freq;
|
freq = opts.max_freq;
|
||||||
break;
|
break;
|
||||||
};
|
}
|
||||||
|
|
||||||
if (freq == 1)
|
if (freq == 1)
|
||||||
strlcpy(s, "Min.", len);
|
strlcpy(s, "Min.", len);
|
||||||
|
@ -727,7 +727,7 @@ static void menu_action_cpu_freq_label(
|
||||||
MENU_ENUM_LABEL_VALUE_CPU_POLICY_GOVERNOR), len2);
|
MENU_ENUM_LABEL_VALUE_CPU_POLICY_GOVERNOR), len2);
|
||||||
strlcpy(s, d->scaling_governor, len);
|
strlcpy(s, d->scaling_governor, len);
|
||||||
break;
|
break;
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void menu_action_cpu_governor_label(
|
static void menu_action_cpu_governor_label(
|
||||||
|
@ -1160,7 +1160,7 @@ static void menu_action_setting_disp_set_label_menu_video_resolution(
|
||||||
char *s2, size_t len2)
|
char *s2, size_t len2)
|
||||||
{
|
{
|
||||||
unsigned width = 0, height = 0;
|
unsigned width = 0, height = 0;
|
||||||
char desc[64] = {0};
|
char desc[64] = {0};
|
||||||
*w = 19;
|
*w = 19;
|
||||||
*s = '\0';
|
*s = '\0';
|
||||||
|
|
||||||
|
|
|
@ -697,18 +697,19 @@ static int cpu_policy_freq_managed_tweak(unsigned type, const char *label,
|
||||||
cpu_scaling_opts_t opts;
|
cpu_scaling_opts_t opts;
|
||||||
enum cpu_scaling_mode mode = get_cpu_scaling_mode(&opts);
|
enum cpu_scaling_mode mode = get_cpu_scaling_mode(&opts);
|
||||||
|
|
||||||
switch (type) {
|
switch (type)
|
||||||
case MENU_SETTINGS_CPU_MANAGED_SET_MINFREQ:
|
{
|
||||||
opts.min_freq = get_cpu_scaling_next_frequency_limit(
|
case MENU_SETTINGS_CPU_MANAGED_SET_MINFREQ:
|
||||||
opts.min_freq, -1);
|
opts.min_freq = get_cpu_scaling_next_frequency_limit(
|
||||||
set_cpu_scaling_mode(mode, &opts);
|
opts.min_freq, -1);
|
||||||
break;
|
set_cpu_scaling_mode(mode, &opts);
|
||||||
case MENU_SETTINGS_CPU_MANAGED_SET_MAXFREQ:
|
break;
|
||||||
opts.max_freq = get_cpu_scaling_next_frequency_limit(
|
case MENU_SETTINGS_CPU_MANAGED_SET_MAXFREQ:
|
||||||
opts.max_freq, -1);
|
opts.max_freq = get_cpu_scaling_next_frequency_limit(
|
||||||
set_cpu_scaling_mode(mode, &opts);
|
opts.max_freq, -1);
|
||||||
break;
|
set_cpu_scaling_mode(mode, &opts);
|
||||||
};
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -726,30 +727,31 @@ static int cpu_policy_freq_managed_gov(unsigned type, const char *label,
|
||||||
if (!drivers || !drivers[0])
|
if (!drivers || !drivers[0])
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
switch (atoi(label)) {
|
switch (atoi(label))
|
||||||
case 0:
|
{
|
||||||
pidx = string_list_find_elem(drivers[0]->available_governors,
|
case 0:
|
||||||
opts.main_policy);
|
pidx = string_list_find_elem(drivers[0]->available_governors,
|
||||||
if (pidx > 1)
|
opts.main_policy);
|
||||||
{
|
if (pidx > 1)
|
||||||
strlcpy(opts.main_policy,
|
{
|
||||||
drivers[0]->available_governors->elems[pidx-2].data,
|
strlcpy(opts.main_policy,
|
||||||
sizeof(opts.main_policy));
|
drivers[0]->available_governors->elems[pidx-2].data,
|
||||||
set_cpu_scaling_mode(mode, &opts);
|
sizeof(opts.main_policy));
|
||||||
}
|
set_cpu_scaling_mode(mode, &opts);
|
||||||
break;
|
}
|
||||||
case 1:
|
break;
|
||||||
pidx = string_list_find_elem(drivers[0]->available_governors,
|
case 1:
|
||||||
opts.menu_policy);
|
pidx = string_list_find_elem(drivers[0]->available_governors,
|
||||||
if (pidx > 1)
|
opts.menu_policy);
|
||||||
{
|
if (pidx > 1)
|
||||||
strlcpy(opts.menu_policy,
|
{
|
||||||
drivers[0]->available_governors->elems[pidx-2].data,
|
strlcpy(opts.menu_policy,
|
||||||
sizeof(opts.menu_policy));
|
drivers[0]->available_governors->elems[pidx-2].data,
|
||||||
set_cpu_scaling_mode(mode, &opts);
|
sizeof(opts.menu_policy));
|
||||||
}
|
set_cpu_scaling_mode(mode, &opts);
|
||||||
break;
|
}
|
||||||
};
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -764,29 +766,30 @@ static int cpu_policy_freq_tweak(unsigned type, const char *label,
|
||||||
if (!drivers)
|
if (!drivers)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
switch (type) {
|
switch (type)
|
||||||
case MENU_SETTINGS_CPU_POLICY_SET_MINFREQ:
|
|
||||||
next_freq = get_cpu_scaling_next_frequency(drivers[policyid],
|
|
||||||
drivers[policyid]->min_policy_freq, -1);
|
|
||||||
set_cpu_scaling_min_frequency(drivers[policyid], next_freq);
|
|
||||||
break;
|
|
||||||
case MENU_SETTINGS_CPU_POLICY_SET_MAXFREQ:
|
|
||||||
next_freq = get_cpu_scaling_next_frequency(drivers[policyid],
|
|
||||||
drivers[policyid]->max_policy_freq, -1);
|
|
||||||
set_cpu_scaling_max_frequency(drivers[policyid], next_freq);
|
|
||||||
break;
|
|
||||||
case MENU_SETTINGS_CPU_POLICY_SET_GOVERNOR:
|
|
||||||
{
|
{
|
||||||
int pidx = string_list_find_elem(drivers[policyid]->available_governors,
|
case MENU_SETTINGS_CPU_POLICY_SET_MINFREQ:
|
||||||
drivers[policyid]->scaling_governor);
|
next_freq = get_cpu_scaling_next_frequency(drivers[policyid],
|
||||||
if (pidx > 1)
|
drivers[policyid]->min_policy_freq, -1);
|
||||||
{
|
set_cpu_scaling_min_frequency(drivers[policyid], next_freq);
|
||||||
set_cpu_scaling_governor(drivers[policyid],
|
break;
|
||||||
drivers[policyid]->available_governors->elems[pidx-2].data);
|
case MENU_SETTINGS_CPU_POLICY_SET_MAXFREQ:
|
||||||
}
|
next_freq = get_cpu_scaling_next_frequency(drivers[policyid],
|
||||||
break;
|
drivers[policyid]->max_policy_freq, -1);
|
||||||
|
set_cpu_scaling_max_frequency(drivers[policyid], next_freq);
|
||||||
|
break;
|
||||||
|
case MENU_SETTINGS_CPU_POLICY_SET_GOVERNOR:
|
||||||
|
{
|
||||||
|
int pidx = string_list_find_elem(drivers[policyid]->available_governors,
|
||||||
|
drivers[policyid]->scaling_governor);
|
||||||
|
if (pidx > 1)
|
||||||
|
{
|
||||||
|
set_cpu_scaling_governor(drivers[policyid],
|
||||||
|
drivers[policyid]->available_governors->elems[pidx-2].data);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -11883,7 +11883,8 @@ static unsigned menu_displaylist_build_shader_parameter(
|
||||||
current_value = min;
|
current_value = min;
|
||||||
original_value = param->current;
|
original_value = param->current;
|
||||||
|
|
||||||
if (half_step <= 0.0) { /* safety check */
|
if (half_step <= 0.0) /* safety check */
|
||||||
|
{
|
||||||
char val_s[16], val_d[16];
|
char val_s[16], val_d[16];
|
||||||
snprintf(val_s, sizeof(val_s), "%.2f", current_value);
|
snprintf(val_s, sizeof(val_s), "%.2f", current_value);
|
||||||
snprintf(val_d, sizeof(val_d), "%d", 0);
|
snprintf(val_d, sizeof(val_d), "%d", 0);
|
||||||
|
@ -12793,7 +12794,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
|
||||||
case CPUSCALING_BALANCED:
|
case CPUSCALING_BALANCED:
|
||||||
/* No settings for these modes */
|
/* No settings for these modes */
|
||||||
break;
|
break;
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
info->flags |= MD_FLAG_NEED_REFRESH
|
info->flags |= MD_FLAG_NEED_REFRESH
|
||||||
|
|
|
@ -9508,38 +9508,39 @@ static void systemd_service_toggle(const char *path, char *unit, bool enable)
|
||||||
static void switch_oc_enable_toggle_change_handler(rarch_setting_t *setting)
|
static void switch_oc_enable_toggle_change_handler(rarch_setting_t *setting)
|
||||||
{
|
{
|
||||||
FILE* f = fopen(SWITCH_OC_TOGGLE_PATH, "w");
|
FILE* f = fopen(SWITCH_OC_TOGGLE_PATH, "w");
|
||||||
if (*setting->value.target.boolean == true) {
|
if (*setting->value.target.boolean)
|
||||||
fprintf(f, "1\n");
|
fprintf(f, "1\n");
|
||||||
} else {
|
else
|
||||||
fprintf(f, "0\n");
|
fprintf(f, "0\n");
|
||||||
}
|
fclose(f);
|
||||||
fclose(f);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void switch_cec_enable_toggle_change_handler(rarch_setting_t *setting)
|
static void switch_cec_enable_toggle_change_handler(rarch_setting_t *setting)
|
||||||
{
|
{
|
||||||
if (*setting->value.target.boolean == true) {
|
if (*setting->value.target.boolean)
|
||||||
|
{
|
||||||
FILE* f = fopen(SWITCH_CEC_TOGGLE_PATH, "w");
|
FILE* f = fopen(SWITCH_CEC_TOGGLE_PATH, "w");
|
||||||
fprintf(f, "\n");
|
fprintf(f, "\n");
|
||||||
fclose(f);
|
fclose(f);
|
||||||
} else {
|
}
|
||||||
filestream_delete(SWITCH_CEC_TOGGLE_PATH);
|
else
|
||||||
}
|
filestream_delete(SWITCH_CEC_TOGGLE_PATH);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void bluetooth_ertm_disable_toggle_change_handler(rarch_setting_t *setting)
|
static void bluetooth_ertm_disable_toggle_change_handler(rarch_setting_t *setting)
|
||||||
{
|
{
|
||||||
if (*setting->value.target.boolean == true) {
|
if (*setting->value.target.boolean)
|
||||||
|
{
|
||||||
FILE* f = fopen(BLUETOOTH_ERTM_TOGGLE_PATH, "w");
|
FILE* f = fopen(BLUETOOTH_ERTM_TOGGLE_PATH, "w");
|
||||||
fprintf(f, "1\n");
|
fprintf(f, "1\n");
|
||||||
fclose(f);
|
fclose(f);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
FILE* f = fopen(BLUETOOTH_ERTM_TOGGLE_PATH, "w");
|
FILE* f = fopen(BLUETOOTH_ERTM_TOGGLE_PATH, "w");
|
||||||
fprintf(f, "0\n");
|
fprintf(f, "0\n");
|
||||||
fclose(f);
|
fclose(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -185,7 +185,7 @@ void cocoa_file_load_with_detect_core(const char *filename);
|
||||||
*/
|
*/
|
||||||
self.controllerUserInteractionEnabled = YES;
|
self.controllerUserInteractionEnabled = YES;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if TARGET_OS_IOS
|
#if TARGET_OS_IOS
|
||||||
self.shouldLockCurrentInterfaceOrientation = NO;
|
self.shouldLockCurrentInterfaceOrientation = NO;
|
||||||
#endif
|
#endif
|
||||||
|
@ -227,51 +227,52 @@ void cocoa_file_load_with_detect_core(const char *filename);
|
||||||
|
|
||||||
bool foundSiri = false;
|
bool foundSiri = false;
|
||||||
bool nonSiriPress = false;
|
bool nonSiriPress = false;
|
||||||
for (GCController *controller in controllers) {
|
for (GCController *controller in controllers)
|
||||||
if ([self isSiri:controller])
|
{
|
||||||
{
|
if ([self isSiri:controller])
|
||||||
foundSiri = true;
|
{
|
||||||
if (type == UIPressTypeSelect)
|
foundSiri = true;
|
||||||
return controller.microGamepad.buttonA.pressed;
|
if (type == UIPressTypeSelect)
|
||||||
else if (type == UIPressTypePlayPause)
|
return controller.microGamepad.buttonA.pressed;
|
||||||
return controller.microGamepad.buttonX.pressed;
|
else if (type == UIPressTypePlayPause)
|
||||||
}
|
return controller.microGamepad.buttonX.pressed;
|
||||||
else if (controller.extendedGamepad)
|
}
|
||||||
{
|
else if (controller.extendedGamepad)
|
||||||
if (type == UIPressTypeUpArrow)
|
{
|
||||||
nonSiriPress |= controller.extendedGamepad.dpad.up.pressed
|
if (type == UIPressTypeUpArrow)
|
||||||
|| controller.extendedGamepad.leftThumbstick.up.pressed
|
nonSiriPress |= controller.extendedGamepad.dpad.up.pressed
|
||||||
|| controller.extendedGamepad.rightThumbstick.up.pressed;
|
|| controller.extendedGamepad.leftThumbstick.up.pressed
|
||||||
else if (type == UIPressTypeDownArrow)
|
|| controller.extendedGamepad.rightThumbstick.up.pressed;
|
||||||
nonSiriPress |= controller.extendedGamepad.dpad.down.pressed
|
else if (type == UIPressTypeDownArrow)
|
||||||
|| controller.extendedGamepad.leftThumbstick.down.pressed
|
nonSiriPress |= controller.extendedGamepad.dpad.down.pressed
|
||||||
|| controller.extendedGamepad.rightThumbstick.down.pressed;
|
|| controller.extendedGamepad.leftThumbstick.down.pressed
|
||||||
else if (type == UIPressTypeLeftArrow)
|
|| controller.extendedGamepad.rightThumbstick.down.pressed;
|
||||||
nonSiriPress |= controller.extendedGamepad.dpad.left.pressed
|
else if (type == UIPressTypeLeftArrow)
|
||||||
|| controller.extendedGamepad.leftShoulder.pressed
|
nonSiriPress |= controller.extendedGamepad.dpad.left.pressed
|
||||||
|| controller.extendedGamepad.leftTrigger.pressed
|
|| controller.extendedGamepad.leftShoulder.pressed
|
||||||
|| controller.extendedGamepad.leftThumbstick.left.pressed
|
|| controller.extendedGamepad.leftTrigger.pressed
|
||||||
|| controller.extendedGamepad.rightThumbstick.left.pressed;
|
|| controller.extendedGamepad.leftThumbstick.left.pressed
|
||||||
else if (type == UIPressTypeRightArrow)
|
|| controller.extendedGamepad.rightThumbstick.left.pressed;
|
||||||
nonSiriPress |= controller.extendedGamepad.dpad.right.pressed
|
else if (type == UIPressTypeRightArrow)
|
||||||
|| controller.extendedGamepad.rightShoulder.pressed
|
nonSiriPress |= controller.extendedGamepad.dpad.right.pressed
|
||||||
|| controller.extendedGamepad.rightTrigger.pressed
|
|| controller.extendedGamepad.rightShoulder.pressed
|
||||||
|| controller.extendedGamepad.leftThumbstick.right.pressed
|
|| controller.extendedGamepad.rightTrigger.pressed
|
||||||
|| controller.extendedGamepad.rightThumbstick.right.pressed;
|
|| controller.extendedGamepad.leftThumbstick.right.pressed
|
||||||
else if (type == UIPressTypeSelect)
|
|| controller.extendedGamepad.rightThumbstick.right.pressed;
|
||||||
nonSiriPress |= controller.extendedGamepad.buttonA.pressed;
|
else if (type == UIPressTypeSelect)
|
||||||
else if (type == UIPressTypeMenu)
|
nonSiriPress |= controller.extendedGamepad.buttonA.pressed;
|
||||||
nonSiriPress |= controller.extendedGamepad.buttonB.pressed;
|
else if (type == UIPressTypeMenu)
|
||||||
else if (type == UIPressTypePlayPause)
|
nonSiriPress |= controller.extendedGamepad.buttonB.pressed;
|
||||||
nonSiriPress |= controller.extendedGamepad.buttonX.pressed;
|
else if (type == UIPressTypePlayPause)
|
||||||
}
|
nonSiriPress |= controller.extendedGamepad.buttonX.pressed;
|
||||||
else
|
}
|
||||||
{
|
else
|
||||||
/* we have a remote that is not extended. some of these remotes send
|
{
|
||||||
* spurious presses. the only way to get them to work properly is to
|
/* we have a remote that is not extended. some of these remotes send
|
||||||
* make the siri remote work improperly. */
|
* spurious presses. the only way to get them to work properly is to
|
||||||
nonSiriPress = true;
|
* make the siri remote work improperly. */
|
||||||
}
|
nonSiriPress = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!foundSiri || [controllers count] == 1)
|
if (!foundSiri || [controllers count] == 1)
|
||||||
|
@ -332,13 +333,14 @@ void cocoa_file_load_with_detect_core(const char *filename);
|
||||||
|
|
||||||
-(void)pressesEnded:(NSSet<UIPress *> *)presses withEvent:(UIPressesEvent *)event
|
-(void)pressesEnded:(NSSet<UIPress *> *)presses withEvent:(UIPressesEvent *)event
|
||||||
{
|
{
|
||||||
for (UIPress *press in presses) {
|
for (UIPress *press in presses)
|
||||||
if (press.type == UIPressTypeSelect || press.type == UIPressTypePlayPause)
|
{
|
||||||
[self sendKeyForPress:press.type down:false];
|
if (press.type == UIPressTypeSelect || press.type == UIPressTypePlayPause)
|
||||||
else
|
[self sendKeyForPress:press.type down:false];
|
||||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, NSEC_PER_MSEC), dispatch_get_main_queue(), ^{
|
else
|
||||||
|
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, NSEC_PER_MSEC), dispatch_get_main_queue(), ^{
|
||||||
[[CocoaView get] sendKeyForPress:press.type down:false];
|
[[CocoaView get] sendKeyForPress:press.type down:false];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -578,22 +580,20 @@ void cocoa_file_load_with_detect_core(const char *filename);
|
||||||
/* NOTE: This version runs on iOS6+. */
|
/* NOTE: This version runs on iOS6+. */
|
||||||
- (UIInterfaceOrientationMask)supportedInterfaceOrientations
|
- (UIInterfaceOrientationMask)supportedInterfaceOrientations
|
||||||
{
|
{
|
||||||
if (@available(iOS 16, *)) {
|
if (@available(iOS 16, *))
|
||||||
if (self.shouldLockCurrentInterfaceOrientation) {
|
{
|
||||||
|
if (self.shouldLockCurrentInterfaceOrientation)
|
||||||
return 1 << self.lockInterfaceOrientation;
|
return 1 << self.lockInterfaceOrientation;
|
||||||
} else {
|
|
||||||
return (UIInterfaceOrientationMask)apple_frontend_settings.orientation_flags;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return (UIInterfaceOrientationMask)apple_frontend_settings.orientation_flags;
|
return (UIInterfaceOrientationMask)apple_frontend_settings.orientation_flags;
|
||||||
}
|
}
|
||||||
|
return (UIInterfaceOrientationMask)apple_frontend_settings.orientation_flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* NOTE: This does not run on iOS 16+ */
|
/* NOTE: This does not run on iOS 16+ */
|
||||||
-(BOOL)shouldAutorotate {
|
-(BOOL)shouldAutorotate
|
||||||
if (self.shouldLockCurrentInterfaceOrientation) {
|
{
|
||||||
|
if (self.shouldLockCurrentInterfaceOrientation)
|
||||||
return NO;
|
return NO;
|
||||||
}
|
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -458,7 +458,7 @@ static ui_application_t ui_application_cocoa = {
|
||||||
CGFloat delta_x = event.deltaX;
|
CGFloat delta_x = event.deltaX;
|
||||||
CGFloat delta_y = event.deltaY;
|
CGFloat delta_y = event.deltaY;
|
||||||
NSPoint pos = CONVERT_POINT();
|
NSPoint pos = CONVERT_POINT();
|
||||||
cocoa_input_data_t
|
cocoa_input_data_t
|
||||||
*apple = (cocoa_input_data_t*)
|
*apple = (cocoa_input_data_t*)
|
||||||
input_state_get_ptr()->current_data;
|
input_state_get_ptr()->current_data;
|
||||||
if (!apple)
|
if (!apple)
|
||||||
|
@ -471,10 +471,13 @@ static ui_application_t ui_application_cocoa = {
|
||||||
apple->touches[0].screen_x = (int16_t)pos.x;
|
apple->touches[0].screen_x = (int16_t)pos.x;
|
||||||
apple->touches[0].screen_y = (int16_t)pos.y;
|
apple->touches[0].screen_y = (int16_t)pos.y;
|
||||||
|
|
||||||
if (apple->mouse_grabbed) {
|
if (apple->mouse_grabbed)
|
||||||
|
{
|
||||||
apple->window_pos_x += (int16_t)delta_x;
|
apple->window_pos_x += (int16_t)delta_x;
|
||||||
apple->window_pos_y += (int16_t)delta_y;
|
apple->window_pos_y += (int16_t)delta_y;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
apple->window_pos_x = (int16_t)pos.x;
|
apple->window_pos_x = (int16_t)pos.x;
|
||||||
apple->window_pos_y = (int16_t)pos.y;
|
apple->window_pos_y = (int16_t)pos.y;
|
||||||
}
|
}
|
||||||
|
@ -493,7 +496,7 @@ static ui_application_t ui_application_cocoa = {
|
||||||
{
|
{
|
||||||
NSInteger number = event.buttonNumber;
|
NSInteger number = event.buttonNumber;
|
||||||
NSPoint pos = CONVERT_POINT();
|
NSPoint pos = CONVERT_POINT();
|
||||||
cocoa_input_data_t
|
cocoa_input_data_t
|
||||||
*apple = (cocoa_input_data_t*)
|
*apple = (cocoa_input_data_t*)
|
||||||
input_state_get_ptr()->current_data;
|
input_state_get_ptr()->current_data;
|
||||||
if (!apple || pos.y < 0)
|
if (!apple || pos.y < 0)
|
||||||
|
@ -508,7 +511,7 @@ static ui_application_t ui_application_cocoa = {
|
||||||
{
|
{
|
||||||
NSInteger number = event.buttonNumber;
|
NSInteger number = event.buttonNumber;
|
||||||
NSPoint pos = CONVERT_POINT();
|
NSPoint pos = CONVERT_POINT();
|
||||||
cocoa_input_data_t
|
cocoa_input_data_t
|
||||||
*apple = (cocoa_input_data_t*)
|
*apple = (cocoa_input_data_t*)
|
||||||
input_state_get_ptr()->current_data;
|
input_state_get_ptr()->current_data;
|
||||||
if (!apple || pos.y < 0)
|
if (!apple || pos.y < 0)
|
||||||
|
@ -709,7 +712,7 @@ static ui_application_t ui_application_cocoa = {
|
||||||
|
|
||||||
- (void)setVideoMode:(gfx_ctx_mode_t)mode
|
- (void)setVideoMode:(gfx_ctx_mode_t)mode
|
||||||
{
|
{
|
||||||
BOOL is_fullscreen = (self.window.styleMask
|
BOOL is_fullscreen = (self.window.styleMask
|
||||||
& NSWindowStyleMaskFullScreen) == NSWindowStyleMaskFullScreen;
|
& NSWindowStyleMaskFullScreen) == NSWindowStyleMaskFullScreen;
|
||||||
if (mode.fullscreen)
|
if (mode.fullscreen)
|
||||||
{
|
{
|
||||||
|
@ -806,7 +809,7 @@ static ui_application_t ui_application_cocoa = {
|
||||||
steam_poll();
|
steam_poll();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
while (CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0.002, FALSE)
|
while (CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0.002, FALSE)
|
||||||
== kCFRunLoopRunHandledSource);
|
== kCFRunLoopRunHandledSource);
|
||||||
if (ret == -1)
|
if (ret == -1)
|
||||||
{
|
{
|
||||||
|
@ -860,7 +863,7 @@ static ui_application_t ui_application_cocoa = {
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const ui_msg_window_t *msg_window =
|
const ui_msg_window_t *msg_window =
|
||||||
ui_companion_driver_get_msg_window_ptr();
|
ui_companion_driver_get_msg_window_ptr();
|
||||||
if (msg_window)
|
if (msg_window)
|
||||||
{
|
{
|
||||||
|
@ -880,7 +883,7 @@ static void open_core_handler(ui_browser_window_state_t *state, bool result)
|
||||||
{
|
{
|
||||||
rarch_system_info_t *sys_info = &runloop_state_get_ptr()->system;
|
rarch_system_info_t *sys_info = &runloop_state_get_ptr()->system;
|
||||||
settings_t *settings = config_get_ptr();
|
settings_t *settings = config_get_ptr();
|
||||||
bool set_supports_no_game_enable =
|
bool set_supports_no_game_enable =
|
||||||
settings->bools.set_supports_no_game_enable;
|
settings->bools.set_supports_no_game_enable;
|
||||||
if (!state || string_is_empty(state->result))
|
if (!state || string_is_empty(state->result))
|
||||||
return;
|
return;
|
||||||
|
@ -930,7 +933,7 @@ static void open_document_handler(
|
||||||
|
|
||||||
- (IBAction)openCore:(id)sender
|
- (IBAction)openCore:(id)sender
|
||||||
{
|
{
|
||||||
const ui_browser_window_t *browser =
|
const ui_browser_window_t *browser =
|
||||||
ui_companion_driver_get_browser_window_ptr();
|
ui_companion_driver_get_browser_window_ptr();
|
||||||
|
|
||||||
if (browser)
|
if (browser)
|
||||||
|
@ -957,7 +960,7 @@ static void open_document_handler(
|
||||||
|
|
||||||
- (void)openDocument:(id)sender
|
- (void)openDocument:(id)sender
|
||||||
{
|
{
|
||||||
const ui_browser_window_t *browser =
|
const ui_browser_window_t *browser =
|
||||||
ui_companion_driver_get_browser_window_ptr();
|
ui_companion_driver_get_browser_window_ptr();
|
||||||
|
|
||||||
if (browser)
|
if (browser)
|
||||||
|
|
|
@ -462,10 +462,11 @@ enum
|
||||||
- (void)sendEvent:(UIEvent *)event
|
- (void)sendEvent:(UIEvent *)event
|
||||||
{
|
{
|
||||||
[super sendEvent:event];
|
[super sendEvent:event];
|
||||||
if (@available(iOS 13.4, tvOS 13.4, *)) {
|
if (@available(iOS 13.4, tvOS 13.4, *))
|
||||||
if (event.type == UIEventTypeHover)
|
{
|
||||||
return;
|
if (event.type == UIEventTypeHover)
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
if (event.allTouches.count)
|
if (event.allTouches.count)
|
||||||
handle_touch_event(event.allTouches.allObjects);
|
handle_touch_event(event.allTouches.allObjects);
|
||||||
|
|
||||||
|
@ -479,16 +480,16 @@ enum
|
||||||
/* Keyboard event hack for iOS versions prior to iOS 7.
|
/* Keyboard event hack for iOS versions prior to iOS 7.
|
||||||
*
|
*
|
||||||
* Derived from:
|
* Derived from:
|
||||||
* http://nacho4d-nacho4d.blogspot.com/2012/01/
|
* http://nacho4d-nacho4d.blogspot.com/2012/01/
|
||||||
* catching-keyboard-events-in-ios.html
|
* catching-keyboard-events-in-ios.html
|
||||||
*/
|
*/
|
||||||
const uint8_t *eventMem = objc_unretainedPointer([event performSelector:@selector(_gsEvent)]);
|
const uint8_t *eventMem = objc_unretainedPointer([event performSelector:@selector(_gsEvent)]);
|
||||||
int eventType = eventMem ? *(int*)&eventMem[8] : 0;
|
int eventType = eventMem ? *(int*)&eventMem[8] : 0;
|
||||||
|
|
||||||
switch (eventType)
|
switch (eventType)
|
||||||
{
|
{
|
||||||
case GSEVENT_TYPE_KEYDOWN:
|
case GSEVENT_TYPE_KEYDOWN:
|
||||||
case GSEVENT_TYPE_KEYUP:
|
case GSEVENT_TYPE_KEYUP:
|
||||||
apple_input_keyboard_event(eventType == GSEVENT_TYPE_KEYDOWN,
|
apple_input_keyboard_event(eventType == GSEVENT_TYPE_KEYDOWN,
|
||||||
*(uint16_t*)&eventMem[0x3C], 0, 0, RETRO_DEVICE_KEYBOARD);
|
*(uint16_t*)&eventMem[0x3C], 0, 0, RETRO_DEVICE_KEYBOARD);
|
||||||
break;
|
break;
|
||||||
|
@ -509,17 +510,15 @@ enum
|
||||||
|
|
||||||
- (instancetype)init {
|
- (instancetype)init {
|
||||||
self = [super init];
|
self = [super init];
|
||||||
if (self) {
|
if (self)
|
||||||
[self setupMetalLayer];
|
[self setupMetalLayer];
|
||||||
}
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (instancetype)initWithFrame:(CGRect)frame {
|
- (instancetype)initWithFrame:(CGRect)frame {
|
||||||
self = [super initWithFrame:frame];
|
self = [super initWithFrame:frame];
|
||||||
if (self) {
|
if (self)
|
||||||
[self setupMetalLayer];
|
[self setupMetalLayer];
|
||||||
}
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -694,16 +693,16 @@ enum
|
||||||
NSFileManager *fileManager = [NSFileManager defaultManager];
|
NSFileManager *fileManager = [NSFileManager defaultManager];
|
||||||
|
|
||||||
// Check if the file exists and rename it
|
// Check if the file exists and rename it
|
||||||
if ([fileManager fileExistsAtPath:originalPath]) {
|
if ([fileManager fileExistsAtPath:originalPath])
|
||||||
|
{
|
||||||
NSError *error = nil;
|
NSError *error = nil;
|
||||||
if ([fileManager moveItemAtPath:originalPath toPath:newPath error:&error]) {
|
if ([fileManager moveItemAtPath:originalPath toPath:newPath error:&error])
|
||||||
NSLog(@"File renamed to %@", newPath);
|
NSLog(@"File renamed to %@", newPath);
|
||||||
} else {
|
else
|
||||||
NSLog(@"Error renaming file: %@", error.localizedDescription);
|
NSLog(@"Error renaming file: %@", error.localizedDescription);
|
||||||
}
|
|
||||||
} else {
|
|
||||||
NSLog(@"File does not exist at path %@", originalPath);
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
NSLog(@"File does not exist at path %@", originalPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
[self setDelegate:self];
|
[self setDelegate:self];
|
||||||
|
@ -874,7 +873,8 @@ enum
|
||||||
NSString *destination = [NSString stringWithUTF8String:fullpath];
|
NSString *destination = [NSString stringWithUTF8String:fullpath];
|
||||||
/* Copy file to documents directory if it's not already
|
/* Copy file to documents directory if it's not already
|
||||||
* inside Documents directory */
|
* inside Documents directory */
|
||||||
if ([url startAccessingSecurityScopedResource]) {
|
if ([url startAccessingSecurityScopedResource])
|
||||||
|
{
|
||||||
if (![[url path] containsString: self.documentsDirectory])
|
if (![[url path] containsString: self.documentsDirectory])
|
||||||
if (![manager fileExistsAtPath:destination])
|
if (![manager fileExistsAtPath:destination])
|
||||||
[manager copyItemAtPath:[url path] toPath:destination error:&error];
|
[manager copyItemAtPath:[url path] toPath:destination error:&error];
|
||||||
|
|
Loading…
Add table
Reference in a new issue