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)
|
||||
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();
|
||||
|
||||
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 */
|
||||
const double expected_flush_delta =
|
||||
(src_data.input_frames / audio_st->input * 1000000);
|
||||
|
@ -517,7 +519,8 @@ static void audio_driver_flush(
|
|||
compression and decompression every single frame, which would make
|
||||
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;
|
||||
audio_st->avg_flush_delta = audio_st->avg_flush_delta * (n - 1) / n +
|
||||
(flush_time - audio_st->last_flush_time) / n;
|
||||
|
|
|
@ -55,17 +55,16 @@ static void ctr_dsp_audio_loop(void* data)
|
|||
if (!ctr)
|
||||
return;
|
||||
|
||||
while (1)
|
||||
for (;;)
|
||||
{
|
||||
size_t buf_avail, avail, to_write;
|
||||
slock_lock(ctr->fifo_lock);
|
||||
|
||||
do {
|
||||
do
|
||||
{
|
||||
avail = FIFO_READ_AVAIL(ctr->fifo);
|
||||
|
||||
if (!avail) {
|
||||
if (!avail)
|
||||
scond_wait(ctr->fifo_avail, ctr->fifo_lock);
|
||||
}
|
||||
} while (!avail && ctr->running);
|
||||
|
||||
slock_unlock(ctr->fifo_lock);
|
||||
|
@ -81,7 +80,8 @@ static void ctr_dsp_audio_loop(void* data)
|
|||
|
||||
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);
|
||||
DSP_FlushDataCache(ctr->dsp_buf.data_pcm8 + pos, to_write);
|
||||
scond_signal(ctr->fifo_done);
|
||||
|
@ -89,7 +89,8 @@ static void ctr_dsp_audio_loop(void* data)
|
|||
|
||||
slock_unlock(ctr->fifo_lock);
|
||||
|
||||
if (buf_pos == pos) {
|
||||
if (buf_pos == pos)
|
||||
{
|
||||
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);
|
||||
|
||||
if (!(ctr->fifo_lock = slock_new()) ||
|
||||
!(ctr->fifo_avail = scond_new()) ||
|
||||
!(ctr->fifo_done = scond_new()) ||
|
||||
!(ctr->thread = sthread_create(ctr_dsp_audio_loop, ctr)))
|
||||
if ( !(ctr->fifo_lock = slock_new())
|
||||
|| !(ctr->fifo_avail = scond_new())
|
||||
|| !(ctr->fifo_done = scond_new())
|
||||
|| !(ctr->thread = sthread_create(ctr_dsp_audio_loop, ctr)))
|
||||
{
|
||||
RARCH_LOG("[Audio]: thread creation failed.\n");
|
||||
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)
|
||||
{
|
||||
/* 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);
|
||||
break;
|
||||
}
|
||||
|
@ -282,11 +284,11 @@ static bool ctr_dsp_thread_audio_start(void *data, bool is_shutdown)
|
|||
|
||||
/* Prevents restarting audio when the menu
|
||||
* is toggled off on shutdown */
|
||||
if (is_shutdown)
|
||||
return true;
|
||||
|
||||
if (!is_shutdown)
|
||||
{
|
||||
ndspSetMasterVol(1.0);
|
||||
ctr->playing = true;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -298,11 +300,7 @@ static void ctr_dsp_thread_audio_set_nonblock_state(void *data, bool state)
|
|||
ctr->nonblocking = state;
|
||||
}
|
||||
|
||||
static bool ctr_dsp_thread_audio_use_float(void *data)
|
||||
{
|
||||
(void)data;
|
||||
return false;
|
||||
}
|
||||
static bool ctr_dsp_thread_audio_use_float(void *data) { return false; }
|
||||
|
||||
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)
|
||||
{
|
||||
int res;
|
||||
|
||||
retro_assert(pw != NULL);
|
||||
|
||||
int res;
|
||||
pw->pending_seq = pw_core_sync(pw->core, PW_ID_CORE, pw->pending_seq);
|
||||
|
||||
while (true)
|
||||
for (;;)
|
||||
{
|
||||
pw_thread_loop_wait(pw->thread_loop);
|
||||
|
||||
|
|
|
@ -68,20 +68,19 @@ typedef struct psp_audio
|
|||
#define AUDIO_BUFFER_SIZE_MASK (AUDIO_BUFFER_SIZE-1)
|
||||
|
||||
/* Return port used */
|
||||
static int configureAudio(unsigned rate) {
|
||||
int port;
|
||||
static int configureAudio(unsigned rate)
|
||||
{
|
||||
#if defined(VITA)
|
||||
port = sceAudioOutOpenPort(
|
||||
return sceAudioOutOpenPort(
|
||||
SCE_AUDIO_OUT_PORT_TYPE_MAIN, AUDIO_OUT_COUNT,
|
||||
rate, SCE_AUDIO_OUT_MODE_STEREO);
|
||||
#elif defined(ORBIS)
|
||||
port = sceAudioOutOpen(0xff,
|
||||
return sceAudioOutOpen(0xff,
|
||||
SCE_AUDIO_OUT_PORT_TYPE_MAIN, 0, AUDIO_OUT_COUNT,
|
||||
rate, SCE_AUDIO_OUT_MODE_STEREO);
|
||||
#else
|
||||
port = sceAudioSRCChReserve(AUDIO_OUT_COUNT, rate, 2);
|
||||
return sceAudioSRCChReserve(AUDIO_OUT_COUNT, rate, 2);
|
||||
#endif
|
||||
return port;
|
||||
}
|
||||
|
||||
static void audioMainLoop(void *data)
|
||||
|
|
|
@ -103,10 +103,11 @@ static void pa_sinklist_cb(pa_context *c, const pa_sink_info *l, int eol, void *
|
|||
if (!pa->devicelist)
|
||||
return;
|
||||
|
||||
// If eol is set to a positive number, you're at the end of the list
|
||||
if (eol > 0) {
|
||||
/* If EOL is set to a positive number,
|
||||
* you're at the end of the list */
|
||||
if (eol > 0)
|
||||
return;
|
||||
}
|
||||
|
||||
RARCH_DBG("[PulseAudio]: Sink detected: %s\n",l->name);
|
||||
string_list_append(pa->devicelist, l->name, attr);
|
||||
}
|
||||
|
|
|
@ -155,7 +155,7 @@ static void rcheevos_filter_url_param(char* url, char* param)
|
|||
else
|
||||
++start;
|
||||
|
||||
do
|
||||
for (;;)
|
||||
{
|
||||
next = strchr(start, '&');
|
||||
|
||||
|
@ -175,7 +175,7 @@ static void rcheevos_filter_url_param(char* url, char* param)
|
|||
return;
|
||||
|
||||
start = next + 1;
|
||||
} while (1);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -409,8 +409,6 @@ static void frontend_ctr_init(void* data)
|
|||
#ifndef IS_SALAMANDER
|
||||
extern audio_driver_t audio_null;
|
||||
|
||||
(void)data;
|
||||
|
||||
verbosity_enable();
|
||||
|
||||
gfxInit(GSP_BGR8_OES, GSP_BGR8_OES, false);
|
||||
|
@ -465,7 +463,8 @@ static void frontend_ctr_init(void* data)
|
|||
if (csndInit() != 0)
|
||||
audio_ctr_csnd = audio_null;
|
||||
ctr_check_dspfirm();
|
||||
if (ndspInit() != 0) {
|
||||
if (ndspInit() != 0)
|
||||
{
|
||||
audio_ctr_dsp = audio_null;
|
||||
#ifdef HAVE_THREADS
|
||||
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_CORE_ASSETS], application_data, "downloads", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE_ASSETS]));
|
||||
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]));
|
||||
} else {
|
||||
else
|
||||
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"];
|
||||
if (url) {
|
||||
if (url)
|
||||
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_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_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)
|
||||
{
|
||||
int dummy, min, maj;
|
||||
if (!XScreenSaverQueryExtension(dpy, &dummy, &dummy) ||
|
||||
!XScreenSaverQueryVersion(dpy, &maj, &min) ||
|
||||
maj < 1 || (maj == 1 && min < 1)) {
|
||||
if ( !XScreenSaverQueryExtension(dpy, &dummy, &dummy)
|
||||
|| !XScreenSaverQueryVersion(dpy, &maj, &min)
|
||||
|| (maj < 1)
|
||||
|| (maj == 1 && min < 1))
|
||||
return false;
|
||||
}
|
||||
XScreenSaverSuspend(dpy, enable);
|
||||
XResetScreenSaver(dpy);
|
||||
return true;
|
||||
|
@ -276,10 +276,13 @@ bool x11_suspend_screensaver(void *data, bool enable)
|
|||
return true;
|
||||
#endif
|
||||
if (!xss_screensaver_inhibit(g_x11_dpy, enable) && enable)
|
||||
if (xdg_screensaver_available) {
|
||||
{
|
||||
if (xdg_screensaver_available)
|
||||
{
|
||||
xdg_screensaver_inhibit(wnd);
|
||||
return xdg_screensaver_available;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -1366,17 +1366,16 @@ static bool d3d10_gfx_set_shader(void* data,
|
|||
size_t _len = strlcpy(_path, slang_path, sizeof(_path));
|
||||
strlcpy(_path + _len, ".vs.hlsl", sizeof(_path) - _len);
|
||||
|
||||
if (!d3d10_init_shader(
|
||||
d3d10->device, vs_src, 0, _path, "main",
|
||||
NULL, NULL, desc, countof(desc),
|
||||
&d3d10->pass[i].shader)) { }
|
||||
d3d10_init_shader(d3d10->device, vs_src, 0,
|
||||
_path, "main", NULL, NULL, desc,
|
||||
countof(desc), &d3d10->pass[i].shader);
|
||||
|
||||
strlcpy(_path + _len, ".ps.hlsl", sizeof(_path) - _len);
|
||||
|
||||
if (!d3d10_init_shader(
|
||||
d3d10->device, ps_src, 0, _path, NULL, "main",
|
||||
d3d10_init_shader(d3d10->device, ps_src,
|
||||
0, _path, NULL, "main",
|
||||
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.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));
|
||||
strlcpy(_path + _len, ".vs.hlsl", sizeof(_path) - _len);
|
||||
|
||||
if (!d3d11_init_shader(
|
||||
d3d11->device, vs_src, 0, _path, "main", NULL, NULL, desc, countof(desc),
|
||||
&d3d11->pass[i].shader,
|
||||
feat_level_hint
|
||||
)) { }
|
||||
d3d11_init_shader(d3d11->device, vs_src, 0,
|
||||
_path, "main", NULL, NULL, desc, countof(desc),
|
||||
&d3d11->pass[i].shader, feat_level_hint);
|
||||
|
||||
strlcpy(_path + _len, ".ps.hlsl", sizeof(_path) - _len);
|
||||
|
||||
if (!d3d11_init_shader(
|
||||
d3d11->device, ps_src, 0, _path, NULL, "main", NULL, NULL, 0,
|
||||
&d3d11->pass[i].shader,
|
||||
feat_level_hint
|
||||
)) { }
|
||||
d3d11_init_shader(d3d11->device, ps_src, 0, _path,
|
||||
NULL, "main", NULL, NULL, 0,
|
||||
&d3d11->pass[i].shader, feat_level_hint);
|
||||
|
||||
free(d3d11->shader_preset->pass[i].source.string.vertex);
|
||||
free(d3d11->shader_preset->pass[i].source.string.fragment);
|
||||
|
|
|
@ -1783,13 +1783,11 @@ static void gl2_renderchain_recompute_pass_sizes(
|
|||
|
||||
case RARCH_SCALE_VIEWPORT:
|
||||
if (gl->rotation % 180 == 90)
|
||||
{
|
||||
fbo_rect->img_width = fbo_rect->max_img_width =
|
||||
fbo_scale->scale_x * vp_height;
|
||||
} else {
|
||||
else
|
||||
fbo_rect->img_width = fbo_rect->max_img_width =
|
||||
fbo_scale->scale_x * vp_width;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1807,13 +1805,11 @@ static void gl2_renderchain_recompute_pass_sizes(
|
|||
|
||||
case RARCH_SCALE_VIEWPORT:
|
||||
if (gl->rotation % 180 == 90)
|
||||
{
|
||||
fbo_rect->img_height = fbo_rect->max_img_height =
|
||||
fbo_scale->scale_y * vp_width;
|
||||
} else {
|
||||
else
|
||||
fbo_rect->img_height = fbo_rect->max_img_height =
|
||||
fbo_scale->scale_y * vp_height;
|
||||
}
|
||||
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,
|
||||
uint64_t e,
|
||||
unsigned f, const char *g, video_frame_info_t *h) { return true; }
|
||||
uint64_t e, unsigned f, const char *g, video_frame_info_t *h) { return true; }
|
||||
static void video_null_free(void *a) { }
|
||||
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; }
|
||||
|
@ -2090,7 +2089,8 @@ void video_driver_set_aspect_ratio(void)
|
|||
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 desired_aspect = video_driver_get_aspect_ratio();
|
||||
video_viewport_get_scaled_aspect2(vp, viewport_width, viewport_height, ydown, device_aspect, desired_aspect);
|
||||
|
|
|
@ -107,7 +107,8 @@ scalers h:
|
|||
/* scale 4:5 */
|
||||
#define PICOSCALE_H_UPSCALE_SNN_4_5(di,ds,si,ss,w,f) do { \
|
||||
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[1] = f(si[1]); \
|
||||
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 { \
|
||||
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]); \
|
||||
PICOSCALE_P_05(di[1], f(si[0]),f(si[1])); \
|
||||
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 { \
|
||||
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_05 (di[1], f(si[0]),f(si[1])); \
|
||||
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 { \
|
||||
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+1], f((li)[i+1]),f((ri)[i+1])); \
|
||||
p_mix((di)[i+2], f((li)[i+2]),f((ri)[i+2])); \
|
||||
|
@ -411,8 +415,11 @@ static void picoscale_256x_320x240_generic_output(void *data,
|
|||
unsigned *out_width, unsigned *out_height,
|
||||
unsigned width, unsigned height)
|
||||
{
|
||||
if ((width == 256) &&
|
||||
((height == 224) || (height == 240) || (height == 192) || (height == 239)))
|
||||
if ( (width == 256)
|
||||
&& ((height == 224)
|
||||
|| (height == 240)
|
||||
|| (height == 192)
|
||||
|| (height == 239)))
|
||||
{
|
||||
*out_width = 320;
|
||||
*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);
|
||||
|
||||
ptr = state->tracker_info[i].display;
|
||||
while (*ptr) {
|
||||
while (*ptr)
|
||||
{
|
||||
float next_char_x = char_x + state->fixed_char_width;
|
||||
const char c = *ptr++;
|
||||
if (c >= CHEEVO_LBOARD_FIRST_FIXED_CHAR && c <= CHEEVO_LBOARD_LAST_FIXED_CHAR)
|
||||
|
@ -182,10 +183,8 @@ static void gfx_widget_leaderboard_display_frame(void* data, void* userdata)
|
|||
char_x += padding;
|
||||
}
|
||||
else
|
||||
{
|
||||
next_char_x = char_x + char_width;
|
||||
}
|
||||
}
|
||||
|
||||
buffer[0] = c;
|
||||
gfx_widgets_draw_text(&p_dispwidget->gfx_widget_fonts.regular,
|
||||
|
@ -348,7 +347,7 @@ static void gfx_widget_leaderboard_display_frame(void* data, void* userdata)
|
|||
if (state->disconnected || state->loading)
|
||||
{
|
||||
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(
|
||||
state->dispwidget_ptr->gfx_widget_fonts.msg_queue.font,
|
||||
disconnected_text, 0, 1) + CHEEVO_LBOARD_DISPLAY_PADDING * 2;
|
||||
|
@ -357,7 +356,8 @@ static void gfx_widget_leaderboard_display_frame(void* data, void* userdata)
|
|||
x = video_width - disconnect_widget_width - spacing;
|
||||
y -= disconnect_widget_height + spacing;
|
||||
|
||||
if (state->loading) {
|
||||
if (state->loading)
|
||||
{
|
||||
const uint16_t loading_shift = 5;
|
||||
loading_buffer[((state->loading - 1) >> loading_shift) + 3] = '\0';
|
||||
state->loading &= (1 << (loading_shift + 2)) - 1;
|
||||
|
|
|
@ -464,14 +464,10 @@ static void handle_relative_motion(void *data,
|
|||
}
|
||||
|
||||
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
|
||||
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) { }
|
||||
|
||||
|
@ -551,13 +547,15 @@ static bool wl_update_scale(gfx_ctx_wayland_data_t *wl)
|
|||
|
||||
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;
|
||||
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->pending_buffer_scale = new_output->scale;
|
||||
return true;
|
||||
|
|
|
@ -726,7 +726,8 @@ static bool apple_gamecontroller_joypad_set_rumble(unsigned pad,
|
|||
settings_t *settings = config_get_ptr();
|
||||
bool enable_device_vibration = settings->bools.enable_device_vibration;
|
||||
|
||||
if (@available(iOS 14, *)) {
|
||||
if (@available(iOS 14, *))
|
||||
{
|
||||
if (enable_device_vibration && pad == 0)
|
||||
{
|
||||
NSError *error;
|
||||
|
|
|
@ -217,7 +217,8 @@ static void sdl_pad_connect(unsigned id)
|
|||
}
|
||||
}
|
||||
#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;
|
||||
RARCH_LOG("[SDL]: Falling back to joystick rumble\n");
|
||||
}
|
||||
|
|
|
@ -319,10 +319,11 @@ static void switch_joypad_poll(void)
|
|||
HidAnalogStickState stick_right_state = padGetStickPos(&pad_states[i], 1);
|
||||
unsigned input_split_joycon = settings->uints.input_split_joycon[i];
|
||||
int pad_button = padGetButtons(&pad_states[i]);
|
||||
if (input_split_joycon && !handheld) {
|
||||
if (input_split_joycon && !handheld)
|
||||
{
|
||||
button_state[i] = 0;
|
||||
|
||||
if (hidGetNpadDeviceType((HidNpadIdType)i) & HidDeviceTypeBits_JoyLeft) {
|
||||
if (hidGetNpadDeviceType((HidNpadIdType)i) & HidDeviceTypeBits_JoyLeft)
|
||||
{
|
||||
if (pad_button & HidNpadButton_Left)
|
||||
button_state[i] |= (uint16_t)HidNpadButton_B;
|
||||
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_Y] = -stick_left_state.x;
|
||||
} else if (hidGetNpadDeviceType((HidNpadIdType)i) & HidDeviceTypeBits_JoyRight) {
|
||||
}
|
||||
else if (hidGetNpadDeviceType((HidNpadIdType)i) & HidDeviceTypeBits_JoyRight)
|
||||
{
|
||||
if (pad_button & HidNpadButton_A)
|
||||
button_state[i] |= (uint16_t)HidNpadButton_B;
|
||||
if (pad_button & HidNpadButton_B)
|
||||
|
@ -363,10 +366,9 @@ static void switch_joypad_poll(void)
|
|||
/* 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_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
|
||||
{
|
||||
|
|
|
@ -225,15 +225,17 @@ struct reverb_data
|
|||
|
||||
static void reverb_free(void *data)
|
||||
{
|
||||
struct reverb_data *rev = (struct reverb_data*)data;
|
||||
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]);
|
||||
}
|
||||
|
||||
for (i = 0; i < numallpasses; i++) {
|
||||
for (i = 0; i < numallpasses; i++)
|
||||
{
|
||||
free(rev->left.bufallpass[i]);
|
||||
free(rev->right.bufallpass[i]);
|
||||
}
|
||||
|
|
|
@ -156,7 +156,8 @@ static bool zlib_stream_decompress_data_to_file_init(
|
|||
zip_context->zstream->zfree = 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);
|
||||
zip_context->zstream = NULL;
|
||||
goto error;
|
||||
|
|
|
@ -427,9 +427,8 @@ int huffman_build_tree(struct huffman_decoder* decoder, uint32_t totaldata, uint
|
|||
|
||||
#if 0
|
||||
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, "===================\n");
|
||||
#endif
|
||||
|
||||
|
|
|
@ -416,7 +416,8 @@ typedef struct retro_unaligned_uint64_s retro_unaligned_uint64_t;
|
|||
* @return The first two bytes of \c addr as a 16-bit unsigned integer,
|
||||
* 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));
|
||||
}
|
||||
|
||||
|
@ -431,7 +432,8 @@ static INLINE uint16_t retro_get_unaligned_16be(void *addr) {
|
|||
* @return The first four bytes of \c addr as a 32-bit unsigned integer,
|
||||
* 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));
|
||||
}
|
||||
|
||||
|
@ -446,7 +448,8 @@ static INLINE uint32_t retro_get_unaligned_32be(void *addr) {
|
|||
* @return The first eight bytes of \c addr as a 64-bit unsigned integer,
|
||||
* 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));
|
||||
}
|
||||
|
||||
|
@ -461,7 +464,8 @@ static INLINE uint64_t retro_get_unaligned_64be(void *addr) {
|
|||
* @return The first two bytes of \c addr as a 16-bit unsigned integer,
|
||||
* 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));
|
||||
}
|
||||
|
||||
|
@ -476,7 +480,8 @@ static INLINE uint16_t retro_get_unaligned_16le(void *addr) {
|
|||
* @return The first four bytes of \c addr as a 32-bit unsigned integer,
|
||||
* 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));
|
||||
}
|
||||
|
||||
|
@ -491,7 +496,8 @@ static INLINE uint32_t retro_get_unaligned_32le(void *addr) {
|
|||
* @return The first eight bytes of \c addr as a 64-bit unsigned integer,
|
||||
* 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));
|
||||
}
|
||||
|
||||
|
@ -505,7 +511,8 @@ static INLINE uint64_t retro_get_unaligned_64le(void *addr) {
|
|||
* the way a \c uint16_t* usually would be.
|
||||
* @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);
|
||||
}
|
||||
|
||||
|
@ -519,7 +526,8 @@ static INLINE void retro_set_unaligned_16le(void *addr, uint16_t v) {
|
|||
* the way a \c uint32_t* usually would be.
|
||||
* @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);
|
||||
}
|
||||
|
||||
|
@ -533,7 +541,8 @@ static INLINE void retro_set_unaligned_32le(void *addr, uint32_t v) {
|
|||
* the way a \c uint64_t* usually would be.
|
||||
* @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);
|
||||
}
|
||||
|
||||
|
@ -547,7 +556,8 @@ static INLINE void retro_set_unaligned_64le(void *addr, uint64_t v) {
|
|||
* the way a \c uint16_t* usually would be.
|
||||
* @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);
|
||||
}
|
||||
|
||||
|
@ -561,7 +571,8 @@ static INLINE void retro_set_unaligned_16be(void *addr, uint16_t v) {
|
|||
* the way a \c uint32_t* usually would be.
|
||||
* @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);
|
||||
}
|
||||
|
||||
|
@ -575,7 +586,8 @@ static INLINE void retro_set_unaligned_32be(void *addr, uint32_t v) {
|
|||
* the way a \c uint64_t* usually would be.
|
||||
* @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);
|
||||
}
|
||||
|
||||
|
|
|
@ -688,7 +688,7 @@ static void menu_action_cpu_managed_freq_label(
|
|||
MENU_ENUM_LABEL_VALUE_CPU_MANAGED_MAX_FREQ), len2);
|
||||
freq = opts.max_freq;
|
||||
break;
|
||||
};
|
||||
}
|
||||
|
||||
if (freq == 1)
|
||||
strlcpy(s, "Min.", len);
|
||||
|
@ -727,7 +727,7 @@ static void menu_action_cpu_freq_label(
|
|||
MENU_ENUM_LABEL_VALUE_CPU_POLICY_GOVERNOR), len2);
|
||||
strlcpy(s, d->scaling_governor, len);
|
||||
break;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
static void menu_action_cpu_governor_label(
|
||||
|
|
|
@ -697,7 +697,8 @@ static int cpu_policy_freq_managed_tweak(unsigned type, const char *label,
|
|||
cpu_scaling_opts_t 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(
|
||||
opts.min_freq, -1);
|
||||
|
@ -708,7 +709,7 @@ static int cpu_policy_freq_managed_tweak(unsigned type, const char *label,
|
|||
opts.max_freq, -1);
|
||||
set_cpu_scaling_mode(mode, &opts);
|
||||
break;
|
||||
};
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -726,7 +727,8 @@ static int cpu_policy_freq_managed_gov(unsigned type, const char *label,
|
|||
if (!drivers || !drivers[0])
|
||||
return -1;
|
||||
|
||||
switch (atoi(label)) {
|
||||
switch (atoi(label))
|
||||
{
|
||||
case 0:
|
||||
pidx = string_list_find_elem(drivers[0]->available_governors,
|
||||
opts.main_policy);
|
||||
|
@ -749,7 +751,7 @@ static int cpu_policy_freq_managed_gov(unsigned type, const char *label,
|
|||
set_cpu_scaling_mode(mode, &opts);
|
||||
}
|
||||
break;
|
||||
};
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -764,7 +766,8 @@ static int cpu_policy_freq_tweak(unsigned type, const char *label,
|
|||
if (!drivers)
|
||||
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);
|
||||
|
@ -786,7 +789,7 @@ static int cpu_policy_freq_tweak(unsigned type, const char *label,
|
|||
}
|
||||
break;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -11883,7 +11883,8 @@ static unsigned menu_displaylist_build_shader_parameter(
|
|||
current_value = min;
|
||||
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];
|
||||
snprintf(val_s, sizeof(val_s), "%.2f", current_value);
|
||||
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:
|
||||
/* No settings for these modes */
|
||||
break;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
FILE* f = fopen(SWITCH_OC_TOGGLE_PATH, "w");
|
||||
if (*setting->value.target.boolean == true) {
|
||||
if (*setting->value.target.boolean)
|
||||
fprintf(f, "1\n");
|
||||
} else {
|
||||
else
|
||||
fprintf(f, "0\n");
|
||||
}
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
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");
|
||||
fprintf(f, "\n");
|
||||
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)
|
||||
{
|
||||
if (*setting->value.target.boolean == true) {
|
||||
if (*setting->value.target.boolean)
|
||||
{
|
||||
FILE* f = fopen(BLUETOOTH_ERTM_TOGGLE_PATH, "w");
|
||||
fprintf(f, "1\n");
|
||||
fclose(f);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
FILE* f = fopen(BLUETOOTH_ERTM_TOGGLE_PATH, "w");
|
||||
fprintf(f, "0\n");
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -227,7 +227,8 @@ void cocoa_file_load_with_detect_core(const char *filename);
|
|||
|
||||
bool foundSiri = false;
|
||||
bool nonSiriPress = false;
|
||||
for (GCController *controller in controllers) {
|
||||
for (GCController *controller in controllers)
|
||||
{
|
||||
if ([self isSiri:controller])
|
||||
{
|
||||
foundSiri = true;
|
||||
|
@ -332,7 +333,8 @@ void cocoa_file_load_with_detect_core(const char *filename);
|
|||
|
||||
-(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];
|
||||
else
|
||||
|
@ -578,22 +580,20 @@ void cocoa_file_load_with_detect_core(const char *filename);
|
|||
/* NOTE: This version runs on iOS6+. */
|
||||
- (UIInterfaceOrientationMask)supportedInterfaceOrientations
|
||||
{
|
||||
if (@available(iOS 16, *)) {
|
||||
if (self.shouldLockCurrentInterfaceOrientation) {
|
||||
if (@available(iOS 16, *))
|
||||
{
|
||||
if (self.shouldLockCurrentInterfaceOrientation)
|
||||
return 1 << self.lockInterfaceOrientation;
|
||||
} else {
|
||||
return (UIInterfaceOrientationMask)apple_frontend_settings.orientation_flags;
|
||||
}
|
||||
} else {
|
||||
return (UIInterfaceOrientationMask)apple_frontend_settings.orientation_flags;
|
||||
}
|
||||
}
|
||||
|
||||
/* NOTE: This does not run on iOS 16+ */
|
||||
-(BOOL)shouldAutorotate {
|
||||
if (self.shouldLockCurrentInterfaceOrientation) {
|
||||
-(BOOL)shouldAutorotate
|
||||
{
|
||||
if (self.shouldLockCurrentInterfaceOrientation)
|
||||
return NO;
|
||||
}
|
||||
return YES;
|
||||
}
|
||||
|
||||
|
|
|
@ -471,10 +471,13 @@ static ui_application_t ui_application_cocoa = {
|
|||
apple->touches[0].screen_x = (int16_t)pos.x;
|
||||
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_y += (int16_t)delta_y;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
apple->window_pos_x = (int16_t)pos.x;
|
||||
apple->window_pos_y = (int16_t)pos.y;
|
||||
}
|
||||
|
|
|
@ -462,7 +462,8 @@ enum
|
|||
- (void)sendEvent:(UIEvent *)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;
|
||||
}
|
||||
|
@ -509,17 +510,15 @@ enum
|
|||
|
||||
- (instancetype)init {
|
||||
self = [super init];
|
||||
if (self) {
|
||||
if (self)
|
||||
[self setupMetalLayer];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame {
|
||||
self = [super initWithFrame:frame];
|
||||
if (self) {
|
||||
if (self)
|
||||
[self setupMetalLayer];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
|
@ -694,17 +693,17 @@ enum
|
|||
NSFileManager *fileManager = [NSFileManager defaultManager];
|
||||
|
||||
// Check if the file exists and rename it
|
||||
if ([fileManager fileExistsAtPath:originalPath]) {
|
||||
if ([fileManager fileExistsAtPath:originalPath])
|
||||
{
|
||||
NSError *error = nil;
|
||||
if ([fileManager moveItemAtPath:originalPath toPath:newPath error:&error]) {
|
||||
if ([fileManager moveItemAtPath:originalPath toPath:newPath error:&error])
|
||||
NSLog(@"File renamed to %@", newPath);
|
||||
} else {
|
||||
else
|
||||
NSLog(@"Error renaming file: %@", error.localizedDescription);
|
||||
}
|
||||
} else {
|
||||
else
|
||||
NSLog(@"File does not exist at path %@", originalPath);
|
||||
}
|
||||
}
|
||||
|
||||
[self setDelegate:self];
|
||||
|
||||
|
@ -874,7 +873,8 @@ enum
|
|||
NSString *destination = [NSString stringWithUTF8String:fullpath];
|
||||
/* Copy file to documents directory if it's not already
|
||||
* inside Documents directory */
|
||||
if ([url startAccessingSecurityScopedResource]) {
|
||||
if ([url startAccessingSecurityScopedResource])
|
||||
{
|
||||
if (![[url path] containsString: self.documentsDirectory])
|
||||
if (![manager fileExistsAtPath:destination])
|
||||
[manager copyItemAtPath:[url path] toPath:destination error:&error];
|
||||
|
|
Loading…
Add table
Reference in a new issue