Merge pull request #1 from libretro/master

Update to Latest
This commit is contained in:
HyperspaceMadness 2020-07-08 11:00:12 -04:00 committed by GitHub
commit f82b2ef9a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
70 changed files with 5301 additions and 991 deletions

View File

@ -1,5 +1,6 @@
# Future
- BLUETOOTH: Add a Bluetooth driver (Lakka-only for now)
- CHEEVOS: Upgrade to rcheevos 9.1
- CHEEVOS: Restore display of unlocked achievements across hardcore modes
- CHEEVOS: Hash buffered data when available
- CONFIG FILE: Optimise parsing of configuration files
@ -11,6 +12,7 @@
- MENU: Enlarged INT/UINT selection limit from 999 to 9999
- MENU: Fix cursor forced to first entry after displaying lists
- ODROID GO ADVANCE: Video driver - fix race condition with RGUI callback
- SHADERS/SLANG: Increased Slang max Parameters, Textures & Passes
- X11: Add lightgun support
# 1.8.9

View File

@ -1611,7 +1611,6 @@ ifeq ($(HAVE_BUILTINGLSLANG), 1)
GLSLANG_SOURCES := \
gfx/drivers_shader/glslang.cpp \
$(DEPS_DIR)/glslang/glslang/SPIRV/doc.cpp \
$(DEPS_DIR)/glslang/glslang/SPIRV/GlslangToSpv.cpp \
$(DEPS_DIR)/glslang/glslang/SPIRV/InReadableOrder.cpp \
$(DEPS_DIR)/glslang/glslang/SPIRV/Logger.cpp \

View File

@ -187,7 +187,8 @@ $(TARGET).elf: $(OBJ) libretro_vita.a libSceShaccCg_stub.a
vita-pack-vpk -s param.sfo -b $< $@
clean:
rm -f $(OBJ) $(TARGET).elf $(TARGET).elf.unstripped.elf $(TARGET).velf $(TARGET).self param.sfo $(TARGET).vpk libSceShaccCg_stub.a deps/vitaShaRK/SceShaccCg
rm -f $(OBJ) $(TARGET).elf $(TARGET).elf.unstripped.elf $(TARGET).velf $(TARGET).self param.sfo $(TARGET).vpk libSceShaccCg_stub.a
rm -rf deps/vitaShaRK/SceShaccCg
rm -f $(OBJ:.o=.depend)
# Useful for developers

View File

@ -66,7 +66,7 @@ static void alsa_worker_thread(void *data)
size_t fifo_size;
snd_pcm_sframes_t frames;
slock_lock(alsa->fifo_lock);
avail = fifo_read_avail(alsa->buffer);
avail = FIFO_READ_AVAIL(alsa->buffer);
fifo_size = MIN(alsa->period_size, avail);
fifo_read(alsa->buffer, buf, fifo_size);
scond_signal(alsa->cond);
@ -256,7 +256,7 @@ static ssize_t alsa_thread_write(void *data, const void *buf, size_t size)
size_t write_amt;
slock_lock(alsa->fifo_lock);
avail = fifo_write_avail(alsa->buffer);
avail = FIFO_WRITE_AVAIL(alsa->buffer);
write_amt = MIN(avail, size);
fifo_write(alsa->buffer, buf, write_amt);
@ -271,7 +271,7 @@ static ssize_t alsa_thread_write(void *data, const void *buf, size_t size)
{
size_t avail;
slock_lock(alsa->fifo_lock);
avail = fifo_write_avail(alsa->buffer);
avail = FIFO_WRITE_AVAIL(alsa->buffer);
if (avail == 0)
{
@ -334,7 +334,7 @@ static size_t alsa_thread_write_avail(void *data)
if (alsa->thread_dead)
return 0;
slock_lock(alsa->fifo_lock);
val = fifo_write_avail(alsa->buffer);
val = FIFO_WRITE_AVAIL(alsa->buffer);
slock_unlock(alsa->fifo_lock);
return val;
}

View File

@ -103,7 +103,7 @@ static OSStatus audio_write_cb(void *userdata,
slock_lock(dev->lock);
if (fifo_read_avail(dev->buffer) < write_avail)
if (FIFO_READ_AVAIL(dev->buffer) < write_avail)
{
*action_flags = kAudioUnitRenderAction_OutputIsSilence;
@ -356,14 +356,14 @@ static ssize_t coreaudio_write(void *data, const void *buf_, size_t size)
slock_lock(dev->lock);
write_avail = fifo_write_avail(dev->buffer);
write_avail = FIFO_WRITE_AVAIL(dev->buffer);
if (write_avail > size)
write_avail = size;
fifo_write(dev->buffer, buf, write_avail);
buf += write_avail;
buf += write_avail;
written += write_avail;
size -= write_avail;
size -= write_avail;
if (dev->nonblock)
{
@ -430,7 +430,7 @@ static size_t coreaudio_write_avail(void *data)
coreaudio_t *dev = (coreaudio_t*)data;
slock_lock(dev->lock);
avail = fifo_write_avail(dev->buffer);
avail = FIFO_WRITE_AVAIL(dev->buffer);
slock_unlock(dev->lock);
return avail;

View File

@ -155,7 +155,7 @@ static DWORD CALLBACK dsound_thread(PVOID data)
avail = write_avail(read_ptr, write_ptr, ds->buffer_size);
EnterCriticalSection(&ds->crit);
fifo_avail = fifo_read_avail(ds->buffer);
fifo_avail = FIFO_READ_AVAIL(ds->buffer);
LeaveCriticalSection(&ds->crit);
if (avail < CHUNK_SIZE || ((fifo_avail < CHUNK_SIZE) && (avail < ds->buffer_size / 2)))
@ -511,7 +511,7 @@ static ssize_t dsound_write(void *data, const void *buf_, size_t size)
size_t avail;
EnterCriticalSection(&ds->crit);
avail = fifo_write_avail(ds->buffer);
avail = FIFO_WRITE_AVAIL(ds->buffer);
if (avail > size)
avail = size;
@ -530,7 +530,7 @@ static ssize_t dsound_write(void *data, const void *buf_, size_t size)
size_t avail;
EnterCriticalSection(&ds->crit);
avail = fifo_write_avail(ds->buffer);
avail = FIFO_WRITE_AVAIL(ds->buffer);
if (avail > size)
avail = size;
@ -558,7 +558,7 @@ static size_t dsound_write_avail(void *data)
dsound_t *ds = (dsound_t*)data;
EnterCriticalSection(&ds->crit);
avail = fifo_write_avail(ds->buffer);
avail = FIFO_WRITE_AVAIL(ds->buffer);
LeaveCriticalSection(&ds->crit);
return avail;
}

View File

@ -61,7 +61,7 @@ static void event_loop(uint64_t data)
sys_event_queue_receive(id, &event, SYS_NO_TIMEOUT);
sys_lwmutex_lock(&aud->lock, SYS_NO_TIMEOUT);
if (fifo_read_avail(aud->buffer) >= sizeof(out_tmp))
if (FIFO_READ_AVAIL(aud->buffer) >= sizeof(out_tmp))
fifo_read(aud->buffer, out_tmp, sizeof(out_tmp));
else
memset(out_tmp, 0, sizeof(out_tmp));
@ -152,11 +152,11 @@ static ssize_t ps3_audio_write(void *data, const void *buf, size_t size)
if (aud->nonblock)
{
if (fifo_write_avail(aud->buffer) < size)
if (FIFO_WRITE_AVAIL(aud->buffer) < size)
return 0;
}
while (fifo_write_avail(aud->buffer) < size)
while (FIFO_WRITE_AVAIL(aud->buffer) < size)
sys_lwcond_wait(&aud->cond, 0);
sys_lwmutex_lock(&aud->lock, SYS_NO_TIMEOUT);

View File

@ -39,9 +39,8 @@ typedef struct rsd
static ssize_t rsound_audio_cb(void *data, size_t bytes, void *userdata)
{
rsd_t *rsd = (rsd_t*)userdata;
size_t avail = fifo_read_avail(rsd->buffer);
rsd_t *rsd = (rsd_t*)userdata;
size_t avail = FIFO_READ_AVAIL(rsd->buffer);
size_t write_size = bytes > avail ? avail : bytes;
fifo_read(rsd->buffer, data, write_size);
scond_signal(rsd->cond);
@ -115,7 +114,7 @@ static ssize_t rs_write(void *data, const void *buf, size_t size)
rsd_callback_lock(rsd->rd);
avail = fifo_write_avail(rsd->buffer);
avail = FIFO_WRITE_AVAIL(rsd->buffer);
write_amt = avail > size ? size : avail;
fifo_write(rsd->buffer, buf, write_amt);
@ -130,7 +129,7 @@ static ssize_t rs_write(void *data, const void *buf, size_t size)
size_t avail;
rsd_callback_lock(rsd->rd);
avail = fifo_write_avail(rsd->buffer);
avail = FIFO_WRITE_AVAIL(rsd->buffer);
if (avail == 0)
{
@ -209,7 +208,7 @@ static size_t rs_write_avail(void *data)
if (rsd->has_error)
return 0;
rsd_callback_lock(rsd->rd);
val = fifo_write_avail(rsd->buffer);
val = FIFO_WRITE_AVAIL(rsd->buffer);
rsd_callback_unlock(rsd->rd);
return val;
}

View File

@ -46,7 +46,7 @@ typedef struct sdl_audio
static void sdl_audio_cb(void *data, Uint8 *stream, int len)
{
sdl_audio_t *sdl = (sdl_audio_t*)data;
size_t avail = fifo_read_avail(sdl->buffer);
size_t avail = FIFO_READ_AVAIL(sdl->buffer);
size_t write_size = len > (int)avail ? avail : len;
fifo_read(sdl->buffer, stream, write_size);
@ -151,7 +151,7 @@ static ssize_t sdl_audio_write(void *data, const void *buf, size_t size)
size_t avail, write_amt;
SDL_LockAudio();
avail = fifo_write_avail(sdl->buffer);
avail = FIFO_WRITE_AVAIL(sdl->buffer);
write_amt = avail > size ? size : avail;
fifo_write(sdl->buffer, buf, write_amt);
SDL_UnlockAudio();
@ -166,7 +166,7 @@ static ssize_t sdl_audio_write(void *data, const void *buf, size_t size)
size_t avail;
SDL_LockAudio();
avail = fifo_write_avail(sdl->buffer);
avail = FIFO_WRITE_AVAIL(sdl->buffer);
if (avail == 0)
{

View File

@ -96,7 +96,7 @@ static void thread_job(void* data)
if (current_wavebuf)
{
mutexLock(&aud->fifo_lock);
available = aud->paused ? 0 : fifo_read_avail(aud->fifo);
available = aud->paused ? 0 : FIFO_READ_AVAIL(aud->fifo);
written_tmp = MIN(available, aud->buffer_size - current_size);
dstbuf = current_pool_ptr + current_size;
if (written_tmp > 0)
@ -295,7 +295,7 @@ static ssize_t libnx_audren_thread_audio_write(void *data,
if (aud->nonblock)
{
mutexLock(&aud->fifo_lock);
available = fifo_write_avail(aud->fifo);
available = FIFO_WRITE_AVAIL(aud->fifo);
written = MIN(available, size);
if (written > 0)
fifo_write(aud->fifo, buf, written);
@ -307,7 +307,7 @@ static ssize_t libnx_audren_thread_audio_write(void *data,
while (written < size && aud->running)
{
mutexLock(&aud->fifo_lock);
available = fifo_write_avail(aud->fifo);
available = FIFO_WRITE_AVAIL(aud->fifo);
if (available)
{
written_tmp = MIN(size - written, available);
@ -407,7 +407,7 @@ static size_t libnx_audren_thread_audio_write_avail(void *data)
return 0;
mutexLock(&aud->fifo_lock);
available = fifo_write_avail(aud->fifo);
available = FIFO_WRITE_AVAIL(aud->fifo);
mutexUnlock(&aud->fifo_lock);
return available;

View File

@ -107,7 +107,7 @@ static void mainLoop(void* data)
compat_mutex_lock(&swa->fifoLock);
avail = fifo_read_avail(swa->fifo);
avail = FIFO_READ_AVAIL(swa->fifo);
to_write = MIN(avail, buf_avail);
if (to_write > 0)
{
@ -349,7 +349,7 @@ static ssize_t switch_thread_audio_write(void *data, const void *buf, size_t siz
if (swa->nonblock)
{
compat_mutex_lock(&swa->fifoLock);
avail = fifo_write_avail(swa->fifo);
avail = FIFO_WRITE_AVAIL(swa->fifo);
written = MIN(avail, size);
if (written > 0)
fifo_write(swa->fifo, buf, written);
@ -361,7 +361,7 @@ static ssize_t switch_thread_audio_write(void *data, const void *buf, size_t siz
while (written < size && swa->running)
{
compat_mutex_lock(&swa->fifoLock);
avail = fifo_write_avail(swa->fifo);
avail = FIFO_WRITE_AVAIL(swa->fifo);
if (avail == 0)
{
compat_mutex_unlock(&swa->fifoLock);
@ -413,7 +413,7 @@ static size_t switch_thread_audio_write_avail(void *data)
switch_thread_audio_t* swa = (switch_thread_audio_t*)data;
compat_mutex_lock(&swa->fifoLock);
val = fifo_write_avail(swa->fifo);
val = FIFO_WRITE_AVAIL(swa->fifo);
compat_mutex_unlock(&swa->fifoLock);
return val;

View File

@ -632,7 +632,7 @@ static ssize_t wasapi_write_sh_buffer(wasapi_t *w, const void * data, size_t siz
{
ssize_t written = -1;
UINT32 padding = 0;
size_t write_avail = fifo_write_avail(w->buffer);
size_t write_avail = FIFO_WRITE_AVAIL(w->buffer);
if (!write_avail)
{
@ -643,7 +643,7 @@ static ssize_t wasapi_write_sh_buffer(wasapi_t *w, const void * data, size_t siz
if (FAILED(_IAudioClient_GetCurrentPadding(w->client, &padding)))
return -1;
read_avail = fifo_read_avail(w->buffer);
read_avail = FIFO_READ_AVAIL(w->buffer);
write_avail = w->engine_buffer_size - padding * w->frame_size;
written = read_avail < write_avail ? read_avail : write_avail;
if (written)
@ -651,7 +651,7 @@ static ssize_t wasapi_write_sh_buffer(wasapi_t *w, const void * data, size_t siz
return -1;
}
write_avail = fifo_write_avail(w->buffer);
write_avail = FIFO_WRITE_AVAIL(w->buffer);
written = size < write_avail ? size : write_avail;
if (written)
fifo_write(w->buffer, data, written);
@ -685,20 +685,20 @@ static ssize_t wasapi_write_sh(wasapi_t *w, const void * data, size_t size)
static ssize_t wasapi_write_sh_nonblock(wasapi_t *w, const void * data, size_t size)
{
size_t write_avail = 0;
ssize_t written = -1;
UINT32 padding = 0;
size_t write_avail = 0;
ssize_t written = -1;
UINT32 padding = 0;
if (w->buffer)
{
write_avail = fifo_write_avail(w->buffer);
write_avail = FIFO_WRITE_AVAIL(w->buffer);
if (!write_avail)
{
size_t read_avail = 0;
if (FAILED(_IAudioClient_GetCurrentPadding(w->client, &padding)))
return -1;
read_avail = fifo_read_avail(w->buffer);
read_avail = FIFO_READ_AVAIL(w->buffer);
write_avail = w->engine_buffer_size - padding * w->frame_size;
written = read_avail < write_avail ? read_avail : write_avail;
if (written)
@ -706,7 +706,7 @@ static ssize_t wasapi_write_sh_nonblock(wasapi_t *w, const void * data, size_t s
return -1;
}
write_avail = fifo_write_avail(w->buffer);
write_avail = FIFO_WRITE_AVAIL(w->buffer);
written = size < write_avail ? size : write_avail;
if (written)
fifo_write(w->buffer, data, written);
@ -731,7 +731,7 @@ static ssize_t wasapi_write_sh_nonblock(wasapi_t *w, const void * data, size_t s
static ssize_t wasapi_write_ex(wasapi_t *w, const void * data, size_t size, DWORD ms)
{
ssize_t written = 0;
size_t write_avail = fifo_write_avail(w->buffer);
size_t write_avail = FIFO_WRITE_AVAIL(w->buffer);
if (!write_avail)
{
@ -890,7 +890,7 @@ static size_t wasapi_write_avail(void *wh)
UINT32 padding = 0;
if (w->buffer)
return fifo_write_avail(w->buffer);
return FIFO_WRITE_AVAIL(w->buffer);
if (FAILED(_IAudioClient_GetCurrentPadding(w->client, &padding)))
return 0;

View File

@ -765,13 +765,13 @@ static void rsnd_drain(rsound_t *rd)
delta /= 1000000;
/* Calculates the amount of data we have in our virtual buffer. Only used to calculate delay. */
slock_lock(rd->thread.mutex);
rd->bytes_in_buffer = (int)((int64_t)rd->total_written + (int64_t)fifo_read_avail(rd->fifo_buffer) - delta);
rd->bytes_in_buffer = (int)((int64_t)rd->total_written + (int64_t)FIFO_READ_AVAIL(rd->fifo_buffer) - delta);
slock_unlock(rd->thread.mutex);
}
else
{
slock_lock(rd->thread.mutex);
rd->bytes_in_buffer = fifo_read_avail(rd->fifo_buffer);
rd->bytes_in_buffer = FIFO_READ_AVAIL(rd->fifo_buffer);
slock_unlock(rd->thread.mutex);
}
}
@ -789,7 +789,7 @@ static size_t rsnd_fill_buffer(rsound_t *rd, const char *buf, size_t size)
return 0;
slock_lock(rd->thread.mutex);
if ( fifo_write_avail(rd->fifo_buffer) >= size )
if (FIFO_WRITE_AVAIL(rd->fifo_buffer) >= size)
{
slock_unlock(rd->thread.mutex);
break;
@ -886,7 +886,7 @@ static size_t rsnd_get_ptr(rsound_t *rd)
{
int ptr;
slock_lock(rd->thread.mutex);
ptr = fifo_read_avail(rd->fifo_buffer);
ptr = FIFO_READ_AVAIL(rd->fifo_buffer);
slock_unlock(rd->thread.mutex);
return ptr;
@ -1060,7 +1060,7 @@ static int rsnd_update_server_info(rsound_t *rd)
int delay = rsd_delay(rd);
int delta = (int)(client_ptr - serv_ptr);
slock_lock(rd->thread.mutex);
delta += fifo_read_avail(rd->fifo_buffer);
delta += FIFO_READ_AVAIL(rd->fifo_buffer);
slock_unlock(rd->thread.mutex);
RSD_DEBUG("[RSound] Delay: %d, Delta: %d.\n", delay, delta);
@ -1116,7 +1116,7 @@ static void rsnd_thread ( void * thread_data )
/* If the buffer is empty or we've stopped the stream, jump out of this for loop */
slock_lock(rd->thread.mutex);
if ( fifo_read_avail(rd->fifo_buffer) < rd->backend_info.chunk_size || !rd->thread_active )
if (FIFO_READ_AVAIL(rd->fifo_buffer) < rd->backend_info.chunk_size || !rd->thread_active)
{
slock_unlock(rd->thread.mutex);
break;
@ -1382,11 +1382,10 @@ int rsd_exec(rsound_t *rsound)
fcntl(rsound->conn.socket, F_SETFL, O_NONBLOCK);
#endif
// Flush the buffer
if ( fifo_read_avail(rsound->fifo_buffer) > 0 )
/* Flush the buffer */
if (FIFO_READ_AVAIL(rsound->fifo_buffer) > 0 )
{
char buffer[fifo_read_avail(rsound->fifo_buffer)];
char buffer[FIFO_READ_AVAIL(rsound->fifo_buffer)];
fifo_read(rsound->fifo_buffer, buffer, sizeof(buffer));
if ( rsnd_send_chunk(fd, buffer, sizeof(buffer), 1) != (ssize_t)sizeof(buffer) )
{

4092
autoconfig.diff Normal file

File diff suppressed because it is too large Load Diff

View File

@ -258,6 +258,18 @@
#endif
#define DEFAULT_CHECK_FIRMWARE_BEFORE_LOADING false
/* Specifies whether to 'reload' (fork and quit)
* RetroArch when launching content with the
* currently loaded core
* > Only relevant on platforms without dynamic core
* loading support
* > Setting this to 'false' will decrease loading
* times when required core is already running,
* but may cause stability issues (if core misbehaves) */
#ifndef HAVE_DYNAMIC
#define DEFAULT_ALWAYS_RELOAD_CORE_ON_RUN_CONTENT true
#endif
/* Forcibly disable composition.
* Only valid on Windows Vista/7/8 for now. */
#define DEFAULT_DISABLE_COMPOSITION false

View File

@ -1422,6 +1422,9 @@ static struct config_bool_setting *populate_settings_bool(
SETTING_BOOL("input_descriptor_hide_unbound", &settings->bools.input_descriptor_hide_unbound, true, input_descriptor_hide_unbound, false);
SETTING_BOOL("load_dummy_on_core_shutdown", &settings->bools.load_dummy_on_core_shutdown, true, DEFAULT_LOAD_DUMMY_ON_CORE_SHUTDOWN, false);
SETTING_BOOL("check_firmware_before_loading", &settings->bools.check_firmware_before_loading, true, DEFAULT_CHECK_FIRMWARE_BEFORE_LOADING, false);
#ifndef HAVE_DYNAMIC
SETTING_BOOL("always_reload_core_on_run_content", &settings->bools.always_reload_core_on_run_content, true, DEFAULT_ALWAYS_RELOAD_CORE_ON_RUN_CONTENT, false);
#endif
SETTING_BOOL("builtin_mediaplayer_enable", &settings->bools.multimedia_builtin_mediaplayer_enable, false, false /* TODO */, false);
SETTING_BOOL("builtin_imageviewer_enable", &settings->bools.multimedia_builtin_imageviewer_enable, true, true, false);
SETTING_BOOL("fps_show", &settings->bools.video_fps_show, true, DEFAULT_FPS_SHOW, false);
@ -1486,7 +1489,6 @@ static struct config_bool_setting *populate_settings_bool(
SETTING_BOOL("core_updater_show_experimental_cores", &settings->bools.network_buildbot_show_experimental_cores, true, DEFAULT_NETWORK_BUILDBOT_SHOW_EXPERIMENTAL_CORES, false);
SETTING_BOOL("core_updater_auto_backup", &settings->bools.core_updater_auto_backup, true, DEFAULT_CORE_UPDATER_AUTO_BACKUP, false);
SETTING_BOOL("camera_allow", &settings->bools.camera_allow, true, false, false);
SETTING_BOOL("add_null_drivers", &settings->bools.add_null_drivers, true, false, false);
SETTING_BOOL("discord_allow", &settings->bools.discord_enable, true, false, false);
#if defined(VITA)
SETTING_BOOL("input_backtouch_enable", &settings->bools.input_backtouch_enable, false, false, false);

View File

@ -331,7 +331,6 @@ typedef struct settings
bool driver_switch_enable;
/* Misc. */
bool add_null_drivers;
bool discord_enable;
bool threaded_data_runloop_enable;
bool set_supports_no_game_enable;
@ -360,6 +359,9 @@ typedef struct settings
bool network_remote_enable_user[MAX_USERS];
bool load_dummy_on_core_shutdown;
bool check_firmware_before_loading;
#ifndef HAVE_DYNAMIC
bool always_reload_core_on_run_content;
#endif
bool game_specific_options;
bool auto_overrides_enable;

View File

@ -703,7 +703,7 @@ void CORE_PREFIX(retro_run)(void)
to_read_bytes = to_read_frames * sizeof(int16_t) * 2;
slock_lock(fifo_lock);
while (!decode_thread_dead && fifo_read_avail(audio_decode_fifo) < to_read_bytes)
while (!decode_thread_dead && FIFO_READ_AVAIL(audio_decode_fifo) < to_read_bytes)
{
main_sleeping = true;
scond_signal(fifo_decode_cond);
@ -712,7 +712,7 @@ void CORE_PREFIX(retro_run)(void)
}
reading_pts = decode_last_audio_time -
(double)fifo_read_avail(audio_decode_fifo) / (media.sample_rate * sizeof(int16_t) * 2);
(double)FIFO_READ_AVAIL(audio_decode_fifo) / (media.sample_rate * sizeof(int16_t) * 2);
expected_pts = (double)audio_frames / media.sample_rate;
old_pts_bias = pts_bias;
pts_bias = reading_pts - expected_pts;
@ -1574,7 +1574,8 @@ static int16_t *decode_audio(AVCodecContext *ctx, AVPacket *pkt,
pts = frame->best_effort_timestamp;
slock_lock(fifo_lock);
while (!decode_thread_dead && fifo_write_avail(audio_decode_fifo) < required_buffer)
while (!decode_thread_dead &&
FIFO_WRITE_AVAIL(audio_decode_fifo) < required_buffer)
{
if (!main_sleeping)
scond_wait(fifo_decode_cond, fifo_lock);

View File

@ -63,7 +63,7 @@ video_buffer_t *video_buffer_create(
if (!b->buffer)
goto fail;
for (int i = 0; i < capacity; i++)
for (i = 0; i < (unsigned)capacity; i++)
{
b->buffer[i].index = i;
b->buffer[i].pts = 0;

View File

@ -22,6 +22,24 @@ int rc_strncasecmp(const char* left, const char* right, size_t length)
return 0;
}
int rc_strcasecmp(const char* left, const char* right)
{
while (*left || *right)
{
if (*left != *right)
{
const int diff = tolower(*left) - tolower(*right);
if (diff != 0)
return diff;
}
++left;
++right;
}
return 0;
}
char* rc_strdup(const char* str)
{
const size_t length = strlen(str);

View File

@ -41,6 +41,11 @@ extern "C" {
#define strncasecmp rc_strncasecmp
#endif
#ifndef strcasecmp
extern int rc_strcasecmp(const char* left, const char* right);
#define strcasecmp rc_strcasecmp
#endif
#ifndef strdup
extern char* rc_strdup(const char* str);
#define strdup rc_strdup

View File

@ -213,9 +213,20 @@ int rc_evaluate_condition_value(rc_condition_t* self, rc_eval_state_t* eval_stat
case RC_OPERATOR_DIV:
if (self->operand2.type == RC_OPERAND_FP)
value = (int)((double)value / self->operand2.value.dbl);
{
if (self->operand2.value.dbl == 0.0)
value = 0;
else
value = (int)((double)value / self->operand2.value.dbl);
}
else
value /= rc_evaluate_operand(&self->operand2, eval_state);
{
unsigned value2 = rc_evaluate_operand(&self->operand2, eval_state);
if (value2 == 0)
value = 0;
else
value /= value2;
}
break;
case RC_OPERATOR_AND:

View File

@ -114,6 +114,7 @@ static int rc_test_condset_internal(rc_condset_t* self, int processing_pause, rc
rc_condition_t* condition;
int set_valid, cond_valid, and_next, or_next;
unsigned measured_value = 0;
unsigned total_hits = 0;
int can_measure = 1, measured_from_hits = 0;
eval_state->primed = 1;
@ -207,12 +208,14 @@ static int rc_test_condset_internal(rc_condset_t* self, int processing_pause, rc
break;
}
/* STEP 4: calculate total hits */
total_hits = condition->current_hits;
if (eval_state->add_hits) {
if (condition->required_hits != 0) {
/* if the condition has a target hit count, we have to recalculate cond_valid including the AddHits counter */
measured_from_hits = 1;
measured_value = condition->current_hits + eval_state->add_hits;
cond_valid = (measured_value >= condition->required_hits);
total_hits = condition->current_hits + eval_state->add_hits;
cond_valid = (total_hits >= condition->required_hits);
}
else {
/* no target hit count. we can't tell if the add_hits value is from this frame or not, so ignore it.
@ -221,13 +224,8 @@ static int rc_test_condset_internal(rc_condset_t* self, int processing_pause, rc
eval_state->add_hits = 0;
}
else if (condition->required_hits != 0) {
/* if there's a hit target, capture the current hits for recording Measured value later */
measured_from_hits = 1;
measured_value = condition->current_hits;
}
/* STEP 4: handle special flags */
/* STEP 5: handle special flags */
switch (condition->type) {
case RC_CONDITION_PAUSE_IF:
/* as soon as we find a PauseIf that evaluates to true, stop processing the rest of the group */
@ -256,6 +254,14 @@ static int rc_test_condset_internal(rc_condset_t* self, int processing_pause, rc
}
continue;
case RC_CONDITION_MEASURED:
if (condition->required_hits != 0) {
/* if there's a hit target, capture the current hits for recording Measured value later */
measured_from_hits = 1;
measured_value = total_hits;
}
break;
case RC_CONDITION_MEASURED_IF:
if (!cond_valid)
can_measure = 0;

View File

@ -113,7 +113,7 @@ const char* rc_console_name(int console_id)
return "PC-9800";
case RC_CONSOLE_PCFX:
return "PCFX";
return "PC-FX";
case RC_CONSOLE_PC_ENGINE:
return "PCEngine";
@ -394,6 +394,15 @@ static const rc_memory_region_t _rc_memory_regions_pcengine[] = {
};
static const rc_memory_regions_t rc_memory_regions_pcengine = { _rc_memory_regions_pcengine, 4 };
/* ===== PC-FX ===== */
/* http://daifukkat.su/pcfx/data/memmap.html */
static const rc_memory_region_t _rc_memory_regions_pcfx[] = {
{ 0x000000U, 0x1FFFFFU, 0x00000000U, RC_MEMORY_TYPE_SYSTEM_RAM, "System RAM" },
{ 0x200000U, 0x207FFFU, 0xE0000000U, RC_MEMORY_TYPE_SAVE_RAM, "Internal Backup Memory" },
{ 0x208000U, 0x20FFFFU, 0xE8000000U, RC_MEMORY_TYPE_SAVE_RAM, "External Backup Memory" },
};
static const rc_memory_regions_t rc_memory_regions_pcfx = { _rc_memory_regions_pcfx, 3 };
/* ===== PlayStation ===== */
/* http://www.raphnet.net/electronique/psx_adaptor/Playstation.txt */
static const rc_memory_region_t _rc_memory_regions_playstation[] = {
@ -421,7 +430,7 @@ static const rc_memory_regions_t rc_memory_regions_segacd = { _rc_memory_regions
/* https://segaretro.org/Sega_Saturn_hardware_notes_(2004-04-27) */
static const rc_memory_region_t _rc_memory_regions_saturn[] = {
{ 0x000000U, 0x0FFFFFU, 0x00200000U, RC_MEMORY_TYPE_SYSTEM_RAM, "Work RAM Low" },
{ 0x100000U, 0x1FFFFFU, 0x06000000U, RC_MEMORY_TYPE_SAVE_RAM, "Work RAM High" }
{ 0x100000U, 0x1FFFFFU, 0x06000000U, RC_MEMORY_TYPE_SYSTEM_RAM, "Work RAM High" }
};
static const rc_memory_regions_t rc_memory_regions_saturn = { _rc_memory_regions_saturn, 2 };
@ -455,15 +464,6 @@ static const rc_memory_region_t _rc_memory_regions_snes[] = {
};
static const rc_memory_regions_t rc_memory_regions_snes = { _rc_memory_regions_snes, 2 };
/* ===== WonderSwan ===== */
/* http://daifukkat.su/docs/wsman/#ovr_memmap */
static const rc_memory_region_t _rc_memory_regions_wonderswan[] = {
/* RAM ends at 0x3FFF for WonderSwan, WonderSwan color uses all 64KB */
{ 0x000000U, 0x00FFFFU, 0x000000U, RC_MEMORY_TYPE_SYSTEM_RAM, "System RAM" },
{ 0x010000U, 0x01FFFFU, 0x000000U, RC_MEMORY_TYPE_SAVE_RAM, "Cartridge RAM" }
};
static const rc_memory_regions_t rc_memory_regions_wonderswan = { _rc_memory_regions_wonderswan, 2 };
/* ===== Vectrex ===== */
/* https://roadsidethoughts.com/vectrex/vectrex-memory-map.htm */
static const rc_memory_region_t _rc_memory_regions_vectrex[] = {
@ -478,6 +478,23 @@ static const rc_memory_region_t _rc_memory_regions_virtualboy[] = {
};
static const rc_memory_regions_t rc_memory_regions_virtualboy = { _rc_memory_regions_virtualboy, 2 };
/* ===== WonderSwan ===== */
/* http://daifukkat.su/docs/wsman/#ovr_memmap */
static const rc_memory_region_t _rc_memory_regions_wonderswan[] = {
/* RAM ends at 0x3FFF for WonderSwan, WonderSwan color uses all 64KB */
{ 0x000000U, 0x00FFFFU, 0x000000U, RC_MEMORY_TYPE_SYSTEM_RAM, "System RAM" },
/* Only 64KB of SRAM is accessible via the addressing scheme, but the cartridge
* may have up to 512KB of SRAM. http://daifukkat.su/docs/wsman/#cart_meta
* Since beetle_wswan exposes it as a contiguous block, assume its contiguous
* even though the documentation says $20000-$FFFFF is ROM data. If this causes
* a conflict in the future, we can revisit. A new region with a virtual address
* could be added to pick up the additional SRAM data. As long as it immediately
* follows the 64KB at $10000, all existing achievements should be unaffected.
*/
{ 0x010000U, 0x08FFFFU, 0x010000U, RC_MEMORY_TYPE_SAVE_RAM, "Cartridge RAM" }
};
static const rc_memory_regions_t rc_memory_regions_wonderswan = { _rc_memory_regions_wonderswan, 2 };
/* ===== default ===== */
static const rc_memory_regions_t rc_memory_regions_none = { 0, 0 };
@ -554,6 +571,9 @@ const rc_memory_regions_t* rc_console_memory_regions(int console_id)
case RC_CONSOLE_PC_ENGINE:
return &rc_memory_regions_pcengine;
case RC_CONSOLE_PCFX:
return &rc_memory_regions_pcfx;
case RC_CONSOLE_PLAYSTATION:
return &rc_memory_regions_playstation;
@ -575,15 +595,15 @@ const rc_memory_regions_t* rc_console_memory_regions(int console_id)
case RC_CONSOLE_SUPER_NINTENDO:
return &rc_memory_regions_snes;
case RC_CONSOLE_WONDERSWAN:
return &rc_memory_regions_wonderswan;
case RC_CONSOLE_VECTREX:
return &rc_memory_regions_vectrex;
case RC_CONSOLE_VIRTUAL_BOY:
return &rc_memory_regions_virtualboy;
case RC_CONSOLE_WONDERSWAN:
return &rc_memory_regions_wonderswan;
default:
return &rc_memory_regions_none;
}

View File

@ -399,7 +399,7 @@ static int rc_hash_3do(char hash[33], const char* path)
{
if (buffer[offset + 0x03] == 0x02) /* file */
{
if (strcasecmp((char*)&buffer[offset + 0x20], "LaunchMe") == 0)
if (strcasecmp((const char*)&buffer[offset + 0x20], "LaunchMe") == 0)
{
/* the block size is at offset 0x0C (assume 0x0C is always 0) */
block_size = buffer[offset + 0x0D] * 65536 + buffer[offset + 0x0E] * 256 + buffer[offset + 0x0F];
@ -710,7 +710,7 @@ static int rc_hash_pce_cd(char hash[33], const char* path)
rc_cd_read_sector(track_handle, 1, buffer, 128);
/* normal PC Engine CD will have a header block in sector 1 */
if (strncmp("PC Engine CD-ROM SYSTEM", (const char*)&buffer[32], 23) == 0)
if (memcmp("PC Engine CD-ROM SYSTEM", &buffer[32], 23) == 0)
{
/* the title of the disc is the last 22 bytes of the header */
md5_init(&md5);
@ -727,7 +727,7 @@ static int rc_hash_pce_cd(char hash[33], const char* path)
/* the first three bytes specify the sector of the program data, and the fourth byte
* is the number of sectors.
*/
sector = buffer[0] * 65536 + buffer[1] * 256 + buffer[2];
sector = (buffer[0] << 16) + (buffer[1] << 8) + buffer[2];
num_sectors = buffer[3];
if (verbose_message_callback)
@ -776,6 +776,78 @@ static int rc_hash_pce_cd(char hash[33], const char* path)
return rc_hash_finalize(&md5, hash);
}
static int rc_hash_pcfx_cd(char hash[33], const char* path)
{
uint8_t buffer[2048];
void* track_handle;
md5_state_t md5;
int sector, num_sectors;
track_handle = rc_cd_open_track(path, 0);
if (!track_handle)
return rc_hash_error("Could not open track");
/* PC-FX boot header fills the first two sectors of the disc
* https://bitbucket.org/trap15/pcfxtools/src/master/pcfx-cdlink.c
*/
/* PC-FX CD will have a header marker in sector 0 */
rc_cd_read_sector(track_handle, 0, buffer, 32);
if (memcmp("PC-FX:Hu_CD-ROM", &buffer[0], 15) == 0)
{
/* the important stuff is the first 128 bytes of the second sector (title being the first 32) */
rc_cd_read_sector(track_handle, 1, buffer, 128);
md5_init(&md5);
md5_append(&md5, buffer, 128);
if (verbose_message_callback)
{
char message[128];
buffer[128] = '\0';
snprintf(message, sizeof(message), "Found PC-FX CD, title=%.32s", &buffer[0]);
verbose_message_callback(message);
}
/* the program sector is in bytes 33-36 (assume byte 36 is 0) */
sector = (buffer[34] << 16) + (buffer[33] << 8) + buffer[32];
/* the number of sectors the program occupies is in bytes 37-40 (assume byte 40 is 0) */
num_sectors = (buffer[38] << 16) + (buffer[37] << 8) + buffer[36];
if (verbose_message_callback)
{
char message[128];
snprintf(message, sizeof(message), "Hashing %d sectors starting at sector %d", num_sectors, sector);
verbose_message_callback(message);
}
while (num_sectors > 0)
{
rc_cd_read_sector(track_handle, sector, buffer, sizeof(buffer));
md5_append(&md5, buffer, sizeof(buffer));
++sector;
--num_sectors;
}
}
else
{
rc_cd_read_sector(track_handle, 1, buffer, 128);
rc_cd_close_track(track_handle);
/* some PC-FX CDs still identify as PCE CDs */
if (memcmp("PC Engine CD-ROM SYSTEM", &buffer[32], 23) == 0)
return rc_hash_pce_cd(hash, path);
return rc_hash_error("Not a PC-FX CD");
}
rc_cd_close_track(track_handle);
return rc_hash_finalize(&md5, hash);
}
static int rc_hash_psx(char hash[33], const char* path)
{
uint8_t buffer[2048];
@ -1297,6 +1369,12 @@ int rc_hash_generate_from_file(char hash[33], int console_id, const char* path)
return rc_hash_whole_file(hash, console_id, path);
case RC_CONSOLE_PCFX:
if (rc_path_compare_extension(path, "m3u"))
return rc_hash_generate_from_playlist(hash, console_id, path);
return rc_hash_pcfx_cd(hash, path);
case RC_CONSOLE_PLAYSTATION:
if (rc_path_compare_extension(path, "m3u"))
return rc_hash_generate_from_playlist(hash, console_id, path);
@ -1452,8 +1530,9 @@ void rc_hash_initialize_iterator(struct rc_hash_iterator* iterator, const char*
iterator->consoles[0] = RC_CONSOLE_PLAYSTATION;
iterator->consoles[1] = RC_CONSOLE_PC_ENGINE;
iterator->consoles[2] = RC_CONSOLE_3DO;
iterator->consoles[3] = RC_CONSOLE_PCFX;
/* SEGA CD hash doesn't have any logic to ensure it's being used against a SEGA CD, so it should always be last */
iterator->consoles[3] = RC_CONSOLE_SEGA_CD;
iterator->consoles[4] = RC_CONSOLE_SEGA_CD;
need_path = 1;
}
else if (rc_path_compare_extension(ext, "col"))

View File

@ -153,7 +153,7 @@ fi
if [ $SALAMANDER = "yes" ]; then
make -C ../ -f Makefile.${platform}.salamander $OPTS || exit 1
if [ $PLATFORM = "ps2" ] ; then
mv -f ../raboot.elf ../pkg/${platform}/raboot.PBP
mv -f ../raboot.elf ../pkg/${platform}/raboot.elf
fi
if [ $PLATFORM = "psp1" ] ; then
mv -f ../EBOOT.PBP ../pkg/${platform}/EBOOT.PBP

View File

@ -134,11 +134,6 @@ static frontend_ctx_driver_t *frontend_ctx_drivers[] = {
NULL
};
#ifndef IS_SALAMANDER
/* TODO/FIXME - static public global variable */
static frontend_ctx_driver_t *current_frontend_ctx;
#endif
/**
* frontend_ctx_find_driver:
* @ident : Identifier name of driver to find.
@ -280,294 +275,3 @@ bool frontend_driver_get_salamander_basename(char *s, size_t len)
#endif
}
#ifndef IS_SALAMANDER
frontend_ctx_driver_t *frontend_get_ptr(void)
{
return current_frontend_ctx;
}
int frontend_driver_parse_drive_list(void *data, bool load_content)
{
frontend_ctx_driver_t *frontend = frontend_get_ptr();
if (!frontend || !frontend->parse_drive_list)
return -1;
return frontend->parse_drive_list(data, load_content);
}
void frontend_driver_content_loaded(void)
{
frontend_ctx_driver_t *frontend = frontend_get_ptr();
if (!frontend || !frontend->content_loaded)
return;
frontend->content_loaded();
}
bool frontend_driver_has_fork(void)
{
frontend_ctx_driver_t *frontend = frontend_get_ptr();
if (!frontend || !frontend->set_fork)
return false;
return true;
}
bool frontend_driver_set_fork(enum frontend_fork fork_mode)
{
frontend_ctx_driver_t *frontend = frontend_get_ptr();
if (!frontend_driver_has_fork())
return false;
return frontend->set_fork(fork_mode);
}
void frontend_driver_process_args(int *argc, char *argv[])
{
frontend_ctx_driver_t *frontend = frontend_get_ptr();
if (!frontend || !frontend->process_args)
return;
frontend->process_args(argc, argv);
}
bool frontend_driver_is_inited(void)
{
frontend_ctx_driver_t *frontend = frontend_get_ptr();
if (!frontend)
return false;
return true;
}
void frontend_driver_init_first(void *args)
{
current_frontend_ctx = (frontend_ctx_driver_t*)frontend_ctx_init_first();
if (current_frontend_ctx && current_frontend_ctx->init)
current_frontend_ctx->init(args);
}
void frontend_driver_free(void)
{
current_frontend_ctx = NULL;
}
environment_get_t frontend_driver_environment_get_ptr(void)
{
frontend_ctx_driver_t *frontend = frontend_get_ptr();
if (!frontend)
return NULL;
return frontend->environment_get;
}
bool frontend_driver_has_get_video_driver_func(void)
{
frontend_ctx_driver_t *frontend = frontend_get_ptr();
if (!frontend || !frontend->get_video_driver)
return false;
return true;
}
const struct video_driver *frontend_driver_get_video_driver(void)
{
frontend_ctx_driver_t *frontend = frontend_get_ptr();
if (!frontend || !frontend->get_video_driver)
return NULL;
return frontend->get_video_driver();
}
void frontend_driver_exitspawn(char *s, size_t len, char *args)
{
frontend_ctx_driver_t *frontend = frontend_get_ptr();
if (!frontend || !frontend->exitspawn)
return;
frontend->exitspawn(s, len, args);
}
void frontend_driver_deinit(void *args)
{
frontend_ctx_driver_t *frontend = frontend_get_ptr();
if (!frontend || !frontend->deinit)
return;
frontend->deinit(args);
}
void frontend_driver_shutdown(bool a)
{
frontend_ctx_driver_t *frontend = frontend_get_ptr();
if (!frontend || !frontend->shutdown)
return;
frontend->shutdown(a);
}
enum frontend_architecture frontend_driver_get_cpu_architecture(void)
{
frontend_ctx_driver_t *frontend = frontend_get_ptr();
if (!frontend || !frontend->get_architecture)
return FRONTEND_ARCH_NONE;
return frontend->get_architecture();
}
const void *frontend_driver_get_cpu_architecture_str(
char *architecture, size_t size)
{
const frontend_ctx_driver_t
*frontend = frontend_get_ptr();
enum frontend_architecture arch = frontend_driver_get_cpu_architecture();
switch (arch)
{
case FRONTEND_ARCH_X86:
strlcpy(architecture, "x86", size);
break;
case FRONTEND_ARCH_X86_64:
strlcpy(architecture, "x64", size);
break;
case FRONTEND_ARCH_PPC:
strlcpy(architecture, "PPC", size);
break;
case FRONTEND_ARCH_ARM:
strlcpy(architecture, "ARM", size);
break;
case FRONTEND_ARCH_ARMV7:
strlcpy(architecture, "ARMv7", size);
break;
case FRONTEND_ARCH_ARMV8:
strlcpy(architecture, "ARMv8", size);
break;
case FRONTEND_ARCH_MIPS:
strlcpy(architecture, "MIPS", size);
break;
case FRONTEND_ARCH_TILE:
strlcpy(architecture, "Tilera", size);
break;
case FRONTEND_ARCH_NONE:
default:
strlcpy(architecture, "N/A", size);
break;
}
return frontend;
}
uint64_t frontend_driver_get_total_memory(void)
{
frontend_ctx_driver_t *frontend = frontend_get_ptr();
if (!frontend || !frontend->get_total_mem)
return 0;
return frontend->get_total_mem();
}
uint64_t frontend_driver_get_free_memory(void)
{
frontend_ctx_driver_t *frontend = frontend_get_ptr();
if (!frontend || !frontend->get_free_mem)
return 0;
return frontend->get_free_mem();
}
void frontend_driver_install_signal_handler(void)
{
frontend_ctx_driver_t *frontend = frontend_get_ptr();
if (!frontend || !frontend->install_signal_handler)
return;
frontend->install_signal_handler();
}
int frontend_driver_get_signal_handler_state(void)
{
frontend_ctx_driver_t *frontend = frontend_get_ptr();
if (!frontend || !frontend->get_signal_handler_state)
return -1;
return frontend->get_signal_handler_state();
}
void frontend_driver_set_signal_handler_state(int value)
{
frontend_ctx_driver_t *frontend = frontend_get_ptr();
if (!frontend || !frontend->set_signal_handler_state)
return;
frontend->set_signal_handler_state(value);
}
void frontend_driver_attach_console(void)
{
frontend_ctx_driver_t *frontend = frontend_get_ptr();
if (!frontend || !frontend->attach_console)
return;
frontend->attach_console();
}
void frontend_driver_detach_console(void)
{
frontend_ctx_driver_t *frontend = frontend_get_ptr();
if (!frontend || !frontend->detach_console)
return;
frontend->detach_console();
}
void frontend_driver_destroy_signal_handler_state(void)
{
frontend_ctx_driver_t *frontend = frontend_get_ptr();
if (!frontend || !frontend->destroy_signal_handler_state)
return;
frontend->destroy_signal_handler_state();
}
bool frontend_driver_can_watch_for_changes(void)
{
frontend_ctx_driver_t *frontend = frontend_get_ptr();
if (!frontend || !frontend->watch_path_for_changes)
return false;
return true;
}
void frontend_driver_watch_path_for_changes(struct string_list *list, int flags, path_change_data_t **change_data)
{
frontend_ctx_driver_t *frontend = frontend_get_ptr();
if (!frontend || !frontend->watch_path_for_changes)
return;
frontend->watch_path_for_changes(list, flags, change_data);
}
bool frontend_driver_check_for_path_changes(path_change_data_t *change_data)
{
frontend_ctx_driver_t *frontend = frontend_get_ptr();
if (!frontend || !frontend->check_for_path_changes)
return false;
return frontend->check_for_path_changes(change_data);
}
void frontend_driver_set_sustained_performance_mode(bool on)
{
frontend_ctx_driver_t *frontend = frontend_get_ptr();
if (!frontend || !frontend->set_sustained_performance_mode)
return;
frontend->set_sustained_performance_mode(on);
}
const char* frontend_driver_get_cpu_model_name(void)
{
frontend_ctx_driver_t *frontend = frontend_get_ptr();
if (!frontend || !frontend->get_cpu_model_name)
return NULL;
return frontend->get_cpu_model_name();
}
enum retro_language frontend_driver_get_user_language(void)
{
frontend_ctx_driver_t *frontend = frontend_get_ptr();
if (!frontend || !frontend->get_user_language)
return RETRO_LANGUAGE_ENGLISH;
return frontend->get_user_language();
}
bool frontend_driver_is_narrator_running(void)
{
frontend_ctx_driver_t *frontend = frontend_get_ptr();
if (!frontend || !frontend->is_narrator_running)
return false;
return frontend->is_narrator_running();
}
#endif

View File

@ -27,6 +27,7 @@
#if defined(HAVE_DYNAMIC) && !defined(__WINRT__)
#include <dynamic/dylib.h>
/* TODO/FIXME - static globals */
static dylib_t d3dcompiler_dll;
static const char* d3dcompiler_dll_list[] = {
"D3DCompiler_47.dll", "D3DCompiler_46.dll", "D3DCompiler_45.dll", "D3DCompiler_44.dll",

View File

@ -19,6 +19,7 @@
#ifdef HAVE_DBUS
#include <dbus/dbus.h>
/* TODO/FIXME - static globals */
static DBusConnection* dbus_connection = NULL;
static unsigned int dbus_screensaver_cookie = 0;
#endif

View File

@ -21,6 +21,7 @@
#include "drm_common.h"
/* TODO/FIXME - globals */
struct pollfd g_drm_fds;
uint32_t g_connector_id = 0;

View File

@ -33,6 +33,7 @@
#include "../../verbosity.h"
#include "../../frontend/frontend_driver.h"
/* TODO/FIXME - globals */
bool g_egl_inited = false;
unsigned g_egl_major = 0;

View File

@ -46,6 +46,7 @@
#define VULKAN_EMULATE_MAILBOX
#endif
/* TODO/FIXME - static globals */
static dylib_t vulkan_library;
static VkInstance cached_instance_vk;
static VkDevice cached_device_vk;

View File

@ -230,39 +230,6 @@ typedef struct DISPLAYCONFIG_PATH_INFO_CUSTOM
typedef LONG (WINAPI *QUERYDISPLAYCONFIG)(UINT32, UINT32*, DISPLAYCONFIG_PATH_INFO_CUSTOM*, UINT32*, DISPLAYCONFIG_MODE_INFO_CUSTOM*, UINT32*);
typedef LONG (WINAPI *GETDISPLAYCONFIGBUFFERSIZES)(UINT32, UINT32*, UINT32*);
bool g_win32_restore_desktop = false;
static bool taskbar_is_created = false;
bool g_win32_inited = false;
typedef struct win32_common_state
{
int pos_x;
int pos_y;
unsigned pos_width;
unsigned pos_height;
unsigned taskbar_message;
bool quit;
unsigned monitor_count;
bool resized;
} win32_common_state_t;
static win32_common_state_t win32_st =
{
CW_USEDEFAULT, /* pos_x */
CW_USEDEFAULT, /* pos_y */
0, /* pos_width */
0, /* pos_height */
0, /* taskbar_message */
false, /* quit */
0, /* monitor_count */
false /* resized */
};
unsigned g_win32_resize_width = 0;
unsigned g_win32_resize_height = 0;
ui_window_win32_t main_window;
/* Power Request APIs */
#if !defined(_XBOX) && (_MSC_VER == 1310)
@ -310,9 +277,45 @@ typedef REASON_CONTEXT POWER_REQUEST_CONTEXT, *PPOWER_REQUEST_CONTEXT, *LPPOWER_
#define INT_PTR_COMPAT INT_PTR
#endif
/* TODO/FIXME - globals */
bool g_win32_restore_desktop = false;
static bool taskbar_is_created = false;
bool g_win32_inited = false;
unsigned g_win32_resize_width = 0;
unsigned g_win32_resize_height = 0;
ui_window_win32_t main_window;
static HMONITOR win32_monitor_last;
static HMONITOR win32_monitor_all[MAX_MONITORS];
typedef struct win32_common_state
{
int pos_x;
int pos_y;
unsigned pos_width;
unsigned pos_height;
unsigned taskbar_message;
bool quit;
unsigned monitor_count;
bool resized;
} win32_common_state_t;
static win32_common_state_t win32_st =
{
CW_USEDEFAULT, /* pos_x */
CW_USEDEFAULT, /* pos_y */
0, /* pos_width */
0, /* pos_height */
0, /* taskbar_message */
false, /* quit */
0, /* monitor_count */
false /* resized */
};
bool win32_taskbar_is_created(void)
{
return taskbar_is_created;

View File

@ -59,6 +59,7 @@
#define V_DBLSCAN 0x20
/* TODO/FIXME - globals */
static XF86VidModeModeInfo desktop_mode;
static bool xdg_screensaver_available = true;
bool g_x11_entered = false;
@ -81,11 +82,11 @@ static XIC g_x11_xic;
static void x11_hide_mouse(Display *dpy, Window win)
{
static char bm_no_data[] = {0, 0, 0, 0, 0, 0, 0, 0};
Cursor no_ptr;
Pixmap bm_no;
XColor black, dummy;
Colormap colormap = DefaultColormap(dpy, DefaultScreen(dpy));
static char bm_no_data[] = {0, 0, 0, 0, 0, 0, 0, 0};
Colormap colormap = DefaultColormap(dpy, DefaultScreen(dpy));
if (!XAllocNamedColor(dpy, colormap, "black", &black, &dummy))
return;

View File

@ -30,7 +30,8 @@
#include "../../verbosity.h"
static XineramaScreenInfo *xinerama_query_screens(Display *dpy, int *num_screens)
static XineramaScreenInfo *xinerama_query_screens(
Display *dpy, int *num_screens)
{
int major, minor;

View File

@ -306,8 +306,8 @@ static bool win32_display_server_set_resolution(void *data,
return true;
}
void *win32_display_server_get_resolution_list(void *data,
unsigned *len)
static void *win32_display_server_get_resolution_list(
void *data, unsigned *len)
{
DEVMODE dm = {0};
unsigned i, j, count = 0;

View File

@ -40,6 +40,7 @@
#include "../video_crt_switch.h" /* needed to set aspect for low res in linux */
#ifdef HAVE_XRANDR
/* TODO/FIXME - static globals */
static char xrandr[1024] = {0};
static char crt_name[16] = {0};
static int crt_name_id = 0;

View File

@ -236,7 +236,7 @@ void gfx_widgets_msg_queue_push(
disp_widget_msg_t *msg_widget = NULL;
dispgfx_widget_t *p_dispwidget = (dispgfx_widget_t*)data;
if (fifo_write_avail(p_dispwidget->msg_queue) > 0)
if (FIFO_WRITE_AVAIL(p_dispwidget->msg_queue) > 0)
{
/* Get current msg if it exists */
if (task && task->frontend_userdata)
@ -861,7 +861,7 @@ void gfx_widgets_iterate(
/* Messages queue */
/* Consume one message if available */
if ((fifo_read_avail(p_dispwidget->msg_queue) > 0)
if ((FIFO_READ_AVAIL(p_dispwidget->msg_queue) > 0)
&& !p_dispwidget->widgets_moving
&& (p_dispwidget->current_msgs_size < ARRAY_SIZE(p_dispwidget->current_msgs)))
{
@ -871,7 +871,7 @@ void gfx_widgets_iterate(
if (p_dispwidget->current_msgs_size < ARRAY_SIZE(p_dispwidget->current_msgs))
{
if (fifo_read_avail(p_dispwidget->msg_queue) > 0)
if (FIFO_READ_AVAIL(p_dispwidget->msg_queue) > 0)
fifo_read(p_dispwidget->msg_queue, &msg_widget, sizeof(msg_widget));
if (msg_widget)
@ -2078,7 +2078,7 @@ static void gfx_widgets_free(dispgfx_widget_t *p_dispwidget)
/* Purge everything from the fifo */
if (p_dispwidget->msg_queue)
{
while (fifo_read_avail(p_dispwidget->msg_queue) > 0)
while (FIFO_READ_AVAIL(p_dispwidget->msg_queue) > 0)
{
disp_widget_msg_t *msg_widget;

View File

@ -44,7 +44,6 @@ enum aspect_ratio
ASPECT_RATIO_4_4,
ASPECT_RATIO_5_4,
ASPECT_RATIO_6_5,
ASPECT_RATIO_7_3,
ASPECT_RATIO_7_9,
ASPECT_RATIO_8_3,
ASPECT_RATIO_8_7,

View File

@ -9,7 +9,6 @@
#endif
#include "../gfx/drivers_shader/glslang.cpp"
#include "../deps/glslang/glslang/SPIRV/doc.cpp"
#include "../deps/glslang/glslang/SPIRV/GlslangToSpv.cpp"
#include "../deps/glslang/glslang/SPIRV/InReadableOrder.cpp"
#include "../deps/glslang/glslang/SPIRV/Logger.cpp"

View File

@ -18,7 +18,7 @@
enum gamepad_pad_axes
{
AXIS_LEFT_ANALOG_X,
AXIS_LEFT_ANALOG_X = 0,
AXIS_LEFT_ANALOG_Y,
AXIS_RIGHT_ANALOG_X,
AXIS_RIGHT_ANALOG_Y,

View File

@ -18,6 +18,7 @@
#include "input_x11_common.h"
/* TODO/FIXME - static globals */
static bool x11_mouse_wu;
static bool x11_mouse_wd;
static bool x11_mouse_hwu;

View File

@ -25,6 +25,7 @@
#include "linux_common.h"
/* TODO/FIXME - static globals */
static struct termios oldTerm, newTerm;
static long oldKbmd = 0xffff;
static bool linux_stdin_claimed = false;

View File

@ -94,13 +94,13 @@ static void adapter_thread(void *data)
int size = 0;
slock_lock(adapter->send_control_lock);
if (fifo_read_avail(adapter->send_control_buffer)
if (FIFO_READ_AVAIL(adapter->send_control_buffer)
>= sizeof(send_command_size))
{
fifo_read(adapter->send_control_buffer,
&send_command_size, sizeof(send_command_size));
if (fifo_read_avail(adapter->send_control_buffer)
if (FIFO_READ_AVAIL(adapter->send_control_buffer)
>= sizeof(send_command_size))
{
fifo_read(adapter->send_control_buffer,
@ -132,7 +132,7 @@ static void libusb_hid_device_send_control(void *data,
slock_lock(adapter->send_control_lock);
if (fifo_write_avail(adapter->send_control_buffer) >= size + sizeof(size))
if (FIFO_WRITE_AVAIL(adapter->send_control_buffer) >= size + sizeof(size))
{
fifo_write(adapter->send_control_buffer, &size, sizeof(size));
fifo_write(adapter->send_control_buffer, data_buf, size);

View File

@ -29,7 +29,8 @@
#include "keyboard_event_apple.h"
#if TARGET_OS_IPHONE
static bool small_keyboard_active;
/* TODO/FIXME - static globals */
static bool small_keyboard_active = false;
#define HIDKEY(X) X
#else

View File

@ -29,6 +29,7 @@
#define MOD_MAP_SIZE 5
/* TODO/FIXME - static globals */
static struct xkb_context *xkb_ctx = NULL;
static struct xkb_keymap *xkb_map = NULL;
static struct xkb_state *xkb_state = NULL;

View File

@ -1088,6 +1088,12 @@ MSG_HASH(
MENU_ENUM_LABEL_DUMMY_ON_CORE_SHUTDOWN,
"dummy_on_core_shutdown"
)
#ifndef HAVE_DYNAMIC
MSG_HASH(
MENU_ENUM_LABEL_ALWAYS_RELOAD_CORE_ON_RUN_CONTENT,
"always_reload_core_on_run_content"
)
#endif
MSG_HASH(
MENU_ENUM_LABEL_DYNAMIC_WALLPAPER,
"menu_dynamic_wallpaper_enable"
@ -3122,10 +3128,6 @@ MSG_HASH(
MENU_ENUM_LABEL_VIDEO_SHARED_CONTEXT,
"video_shared_context"
)
MSG_HASH(
MENU_ENUM_LABEL_ADD_NULL_DRIVERS,
"ignore_null_drivers"
)
MSG_HASH(
MENU_ENUM_LABEL_VIDEO_SMOOTH,
"video_smooth"

View File

@ -2716,6 +2716,16 @@ MSG_HASH(
MENU_ENUM_SUBLABEL_CHECK_FOR_MISSING_FIRMWARE,
"Check if all the required firmware is present before attempting to load content."
)
#ifndef HAVE_DYNAMIC
MSG_HASH(
MENU_ENUM_LABEL_VALUE_ALWAYS_RELOAD_CORE_ON_RUN_CONTENT,
"Always Reload Core on Run Content"
)
MSG_HASH(
MENU_ENUM_SUBLABEL_ALWAYS_RELOAD_CORE_ON_RUN_CONTENT,
"Restart RetroArch when launching content, even when the requested core is already loaded. This may improve system stability, at the expense of increased loading times."
)
#endif
MSG_HASH(
MENU_ENUM_LABEL_VALUE_VIDEO_ALLOW_ROTATE,
"Allow Rotation"
@ -11192,14 +11202,7 @@ MSG_HASH(
MSG_READ_ONLY,
"Read-Only"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_ADD_NULL_DRIVERS,
"Ignore null drivers"
)
MSG_HASH(
MENU_ENUM_SUBLABEL_ADD_NULL_DRIVERS,
"Don't allow the user to set a driver to nothing. Can prevent the user from locking him/herself out of the program."
)
#ifdef HAVE_LAKKA_SWITCH
MSG_HASH(
MENU_ENUM_LABEL_VALUE_SWITCH_GPU_PROFILE,

View File

@ -46,7 +46,8 @@
#endif
#endif
struct sevenzip_context_t {
struct sevenzip_context_t
{
CFileInStream archiveStream;
CLookToRead lookStream;
ISzAlloc allocImp;

View File

@ -109,6 +109,7 @@
#endif
/* TODO/FIXME - globals */
static retro_vfs_stat_t path_stat_cb = retro_vfs_stat_impl;
static retro_vfs_mkdir_t path_mkdir_cb = retro_vfs_mkdir_impl;

View File

@ -31,35 +31,39 @@
#define VFS_FRONTEND
#include <vfs/vfs_implementation.h>
static retro_vfs_opendir_t dirent_opendir_cb = NULL;
static retro_vfs_readdir_t dirent_readdir_cb = NULL;
/* TODO/FIXME - static globals */
static retro_vfs_opendir_t dirent_opendir_cb = NULL;
static retro_vfs_readdir_t dirent_readdir_cb = NULL;
static retro_vfs_dirent_get_name_t dirent_dirent_get_name_cb = NULL;
static retro_vfs_dirent_is_dir_t dirent_dirent_is_dir_cb = NULL;
static retro_vfs_closedir_t dirent_closedir_cb = NULL;
static retro_vfs_dirent_is_dir_t dirent_dirent_is_dir_cb = NULL;
static retro_vfs_closedir_t dirent_closedir_cb = NULL;
void dirent_vfs_init(const struct retro_vfs_interface_info* vfs_info)
{
const struct retro_vfs_interface* vfs_iface;
dirent_opendir_cb = NULL;
dirent_readdir_cb = NULL;
dirent_opendir_cb = NULL;
dirent_readdir_cb = NULL;
dirent_dirent_get_name_cb = NULL;
dirent_dirent_is_dir_cb = NULL;
dirent_closedir_cb = NULL;
dirent_dirent_is_dir_cb = NULL;
dirent_closedir_cb = NULL;
vfs_iface = vfs_info->iface;
vfs_iface = vfs_info->iface;
if (vfs_info->required_interface_version < DIRENT_REQUIRED_VFS_VERSION || !vfs_iface)
if (
vfs_info->required_interface_version < DIRENT_REQUIRED_VFS_VERSION ||
!vfs_iface)
return;
dirent_opendir_cb = vfs_iface->opendir;
dirent_readdir_cb = vfs_iface->readdir;
dirent_opendir_cb = vfs_iface->opendir;
dirent_readdir_cb = vfs_iface->readdir;
dirent_dirent_get_name_cb = vfs_iface->dirent_get_name;
dirent_dirent_is_dir_cb = vfs_iface->dirent_is_dir;
dirent_closedir_cb = vfs_iface->closedir;
dirent_dirent_is_dir_cb = vfs_iface->dirent_is_dir;
dirent_closedir_cb = vfs_iface->closedir;
}
struct RDIR *retro_opendir_include_hidden(const char *name, bool include_hidden)
struct RDIR *retro_opendir_include_hidden(
const char *name, bool include_hidden)
{
if (dirent_opendir_cb)
return (struct RDIR *)dirent_opendir_cb(name, include_hidden);

View File

@ -63,15 +63,9 @@ static INLINE void fifo_free(fifo_buffer_t *buffer)
free(buffer);
}
static INLINE size_t fifo_read_avail(fifo_buffer_t *buffer)
{
return (buffer->end + ((buffer->end < buffer->first) ? buffer->size : 0)) - buffer->first;
}
#define FIFO_READ_AVAIL(buffer) (((buffer)->end + (((buffer)->end < (buffer)->first) ? (buffer)->size : 0)) - (buffer)->first)
static INLINE size_t fifo_write_avail(fifo_buffer_t *buffer)
{
return (buffer->size - 1) - ((buffer->end + ((buffer->end < buffer->first) ? buffer->size : 0)) - buffer->first);
}
#define FIFO_WRITE_AVAIL(buffer) (((buffer)->size - 1) - (((buffer)->end + (((buffer)->end < (buffer)->first) ? (buffer)->size : 0)) - (buffer)->first))
RETRO_END_DECLS

View File

@ -57,15 +57,27 @@ struct retro_task_impl
void (*deinit)(void);
};
static retro_task_queue_msg_t msg_push_bak;
static task_queue_t tasks_running = {NULL, NULL};
static task_queue_t tasks_finished = {NULL, NULL};
/* TODO/FIXME - static globals */
static retro_task_queue_msg_t msg_push_bak = NULL;
static task_queue_t tasks_running = {NULL, NULL};
static task_queue_t tasks_finished = {NULL, NULL};
static struct retro_task_impl *impl_current = NULL;
static bool task_threaded_enable = false;
static uint32_t task_count = 0;
#ifdef HAVE_THREADS
static slock_t *running_lock = NULL;
static slock_t *finished_lock = NULL;
static slock_t *property_lock = NULL;
static slock_t *queue_lock = NULL;
static scond_t *worker_cond = NULL;
static sthread_t *worker_thread = NULL;
static bool worker_continue = true;
/* use running_lock when touching it */
#endif
static void task_queue_msg_push(retro_task_t *task,
unsigned prio, unsigned duration,
bool flush, const char *fmt, ...)
@ -266,7 +278,8 @@ static void retro_task_regular_retrieve(task_retriever_data_t *data)
continue;
/* Create new link */
info = (task_retriever_info_t*)malloc(sizeof(task_retriever_info_t));
info = (task_retriever_info_t*)
malloc(sizeof(task_retriever_info_t));
info->data = malloc(data->element_size);
info->next = NULL;
@ -311,13 +324,6 @@ static struct retro_task_impl impl_regular = {
};
#ifdef HAVE_THREADS
static slock_t *running_lock = NULL;
static slock_t *finished_lock = NULL;
static slock_t *property_lock = NULL;
static slock_t *queue_lock = NULL;
static scond_t *worker_cond = NULL;
static sthread_t *worker_thread = NULL;
static bool worker_continue = true; /* use running_lock when touching it */
/* 'queue_lock' must be held for the duration of this function */
static void task_queue_remove(task_queue_t *queue, retro_task_t *task)
@ -489,7 +495,7 @@ static void threaded_worker(void *userdata)
if (task->when)
{
retro_time_t now = cpu_features_get_time_usec();
retro_time_t now = cpu_features_get_time_usec();
retro_time_t delay = task->when - now - 500; /* allow half a millisecond for context switching */
if (delay > 0)
{
@ -511,10 +517,13 @@ static void threaded_worker(void *userdata)
if (!finished)
{
/* Move the task to the back of the queue */
/* mimics retro_task_threaded_push_running, but also includes a task_queue_remove */
/* mimics retro_task_threaded_push_running,
* but also includes a task_queue_remove */
slock_lock(running_lock);
slock_lock(queue_lock);
if (task->next != NULL) /* do nothing if only item in queue */
/* do nothing if only item in queue */
if (task->next)
{
task_queue_remove(&tasks_running, task);
task_queue_put(&tasks_running, task);
@ -542,17 +551,17 @@ static void threaded_worker(void *userdata)
static void retro_task_threaded_init(void)
{
running_lock = slock_new();
finished_lock = slock_new();
property_lock = slock_new();
queue_lock = slock_new();
worker_cond = scond_new();
running_lock = slock_new();
finished_lock = slock_new();
property_lock = slock_new();
queue_lock = slock_new();
worker_cond = scond_new();
slock_lock(running_lock);
worker_continue = true;
slock_unlock(running_lock);
worker_thread = sthread_create(threaded_worker, NULL);
worker_thread = sthread_create(threaded_worker, NULL);
}
static void retro_task_threaded_deinit(void)
@ -570,12 +579,12 @@ static void retro_task_threaded_deinit(void)
slock_free(property_lock);
slock_free(queue_lock);
worker_thread = NULL;
worker_cond = NULL;
running_lock = NULL;
finished_lock = NULL;
property_lock = NULL;
queue_lock = NULL;
worker_thread = NULL;
worker_cond = NULL;
running_lock = NULL;
finished_lock = NULL;
property_lock = NULL;
queue_lock = NULL;
}
static struct retro_task_impl impl_threaded = {

View File

@ -39,7 +39,14 @@
#define VFS_FRONTEND
#include <vfs/vfs_implementation.h>
static const int64_t vfs_error_return_value = -1;
#define VFS_ERROR_RETURN_VALUE -1
struct RFILE
{
struct retro_vfs_file_handle *hfile;
bool error_flag;
bool eof_flag;
};
static retro_vfs_get_path_t filestream_get_path_cb = NULL;
static retro_vfs_open_t filestream_open_cb = NULL;
@ -54,18 +61,12 @@ static retro_vfs_flush_t filestream_flush_cb = NULL;
static retro_vfs_remove_t filestream_remove_cb = NULL;
static retro_vfs_rename_t filestream_rename_cb = NULL;
struct RFILE
{
struct retro_vfs_file_handle *hfile;
bool error_flag;
bool eof_flag;
};
/* VFS Initialization */
void filestream_vfs_init(const struct retro_vfs_interface_info* vfs_info)
{
const struct retro_vfs_interface* vfs_iface;
const struct retro_vfs_interface *
vfs_iface = vfs_info->iface;
filestream_get_path_cb = NULL;
filestream_open_cb = NULL;
@ -80,9 +81,9 @@ void filestream_vfs_init(const struct retro_vfs_interface_info* vfs_info)
filestream_remove_cb = NULL;
filestream_rename_cb = NULL;
vfs_iface = vfs_info->iface;
if (vfs_info->required_interface_version < FILESTREAM_REQUIRED_VFS_VERSION
if (
(vfs_info->required_interface_version <
FILESTREAM_REQUIRED_VFS_VERSION)
|| !vfs_iface)
return;
@ -103,12 +104,13 @@ void filestream_vfs_init(const struct retro_vfs_interface_info* vfs_info)
/* Callback wrappers */
bool filestream_exists(const char *path)
{
RFILE *dummy = NULL;
RFILE *dummy = NULL;
if (!path || !*path)
return false;
dummy = filestream_open(path,
dummy = filestream_open(
path,
RETRO_VFS_FILE_ACCESS_READ,
RETRO_VFS_FILE_ACCESS_HINT_NONE);
@ -130,9 +132,10 @@ int64_t filestream_get_size(RFILE *stream)
if (filestream_size_cb)
output = filestream_size_cb(stream->hfile);
else
output = retro_vfs_file_size_impl((libretro_vfs_implementation_file*)stream->hfile);
output = retro_vfs_file_size_impl(
(libretro_vfs_implementation_file*)stream->hfile);
if (output == vfs_error_return_value)
if (output == VFS_ERROR_RETURN_VALUE)
stream->error_flag = true;
return output;
@ -145,9 +148,10 @@ int64_t filestream_truncate(RFILE *stream, int64_t length)
if (filestream_truncate_cb)
output = filestream_truncate_cb(stream->hfile, length);
else
output = retro_vfs_file_truncate_impl((libretro_vfs_implementation_file*)stream->hfile, length);
output = retro_vfs_file_truncate_impl(
(libretro_vfs_implementation_file*)stream->hfile, length);
if (output == vfs_error_return_value)
if (output == VFS_ERROR_RETURN_VALUE)
stream->error_flag = true;
return output;
@ -222,8 +226,8 @@ int filestream_scanf(RFILE *stream, const char* format, ...)
char subfmt[64];
va_list args;
const char * bufiter = buf;
int64_t startpos = filestream_tell(stream);
int ret = 0;
int64_t startpos = filestream_tell(stream);
int64_t maxlen = filestream_read(stream, buf, sizeof(buf)-1);
if (maxlen <= 0)
@ -284,20 +288,24 @@ int filestream_scanf(RFILE *stream, const char* format, ...)
*subfmtiter++ = 'n';
*subfmtiter++ = '\0';
if (sizeof(void*) != sizeof(long*)) abort(); /* all pointers must have the same size */
if (sizeof(void*) != sizeof(long*))
abort(); /* all pointers must have the same size */
if (asterisk)
{
int v = sscanf(bufiter, subfmt, &sublen);
if (v == EOF)
return EOF;
if (v != 0) break;
if (v != 0)
break;
}
else
{
int v = sscanf(bufiter, subfmt, va_arg(args, void*), &sublen);
if (v == EOF)
return EOF;
if (v != 1) break;
if (v != 1)
break;
}
ret++;
@ -305,7 +313,8 @@ int filestream_scanf(RFILE *stream, const char* format, ...)
}
else if (isspace(*format))
{
while (isspace(*bufiter)) bufiter++;
while (isspace(*bufiter))
bufiter++;
format++;
}
else
@ -318,7 +327,8 @@ int filestream_scanf(RFILE *stream, const char* format, ...)
}
va_end(args);
filestream_seek(stream, startpos+(bufiter-buf), RETRO_VFS_SEEK_POSITION_START);
filestream_seek(stream, startpos+(bufiter-buf),
RETRO_VFS_SEEK_POSITION_START);
return ret;
}
@ -330,11 +340,14 @@ int64_t filestream_seek(RFILE *stream, int64_t offset, int seek_position)
if (filestream_seek_cb)
output = filestream_seek_cb(stream->hfile, offset, seek_position);
else
output = retro_vfs_file_seek_impl((libretro_vfs_implementation_file*)stream->hfile, offset, seek_position);
output = retro_vfs_file_seek_impl(
(libretro_vfs_implementation_file*)stream->hfile,
offset, seek_position);
if (output == vfs_error_return_value)
if (output == VFS_ERROR_RETURN_VALUE)
stream->error_flag = true;
stream->eof_flag = false;
stream->eof_flag = false;
return output;
}
@ -351,9 +364,10 @@ int64_t filestream_tell(RFILE *stream)
if (filestream_size_cb)
output = filestream_tell_cb(stream->hfile);
else
output = retro_vfs_file_tell_impl((libretro_vfs_implementation_file*)stream->hfile);
output = retro_vfs_file_tell_impl(
(libretro_vfs_implementation_file*)stream->hfile);
if (output == vfs_error_return_value)
if (output == VFS_ERROR_RETURN_VALUE)
stream->error_flag = true;
return output;
@ -365,7 +379,7 @@ void filestream_rewind(RFILE *stream)
return;
filestream_seek(stream, 0L, RETRO_VFS_SEEK_POSITION_START);
stream->error_flag = false;
stream->eof_flag = false;
stream->eof_flag = false;
}
int64_t filestream_read(RFILE *stream, void *s, int64_t len)
@ -378,10 +392,10 @@ int64_t filestream_read(RFILE *stream, void *s, int64_t len)
output = retro_vfs_file_read_impl(
(libretro_vfs_implementation_file*)stream->hfile, s, len);
if (output == vfs_error_return_value)
if (output == VFS_ERROR_RETURN_VALUE)
stream->error_flag = true;
if (output < len)
stream->eof_flag = true;
stream->eof_flag = true;
return output;
}
@ -393,9 +407,10 @@ int filestream_flush(RFILE *stream)
if (filestream_flush_cb)
output = filestream_flush_cb(stream->hfile);
else
output = retro_vfs_file_flush_impl((libretro_vfs_implementation_file*)stream->hfile);
output = retro_vfs_file_flush_impl(
(libretro_vfs_implementation_file*)stream->hfile);
if (output == vfs_error_return_value)
if (output == VFS_ERROR_RETURN_VALUE)
stream->error_flag = true;
return output;
@ -422,7 +437,8 @@ const char* filestream_get_path(RFILE *stream)
if (filestream_get_path_cb)
return filestream_get_path_cb(stream->hfile);
return retro_vfs_file_get_path_impl((libretro_vfs_implementation_file*)stream->hfile);
return retro_vfs_file_get_path_impl(
(libretro_vfs_implementation_file*)stream->hfile);
}
int64_t filestream_write(RFILE *stream, const void *s, int64_t len)
@ -432,9 +448,10 @@ int64_t filestream_write(RFILE *stream, const void *s, int64_t len)
if (filestream_write_cb)
output = filestream_write_cb(stream->hfile, s, len);
else
output = retro_vfs_file_write_impl((libretro_vfs_implementation_file*)stream->hfile, s, len);
output = retro_vfs_file_write_impl(
(libretro_vfs_implementation_file*)stream->hfile, s, len);
if (output == vfs_error_return_value)
if (output == VFS_ERROR_RETURN_VALUE)
stream->error_flag = true;
return output;
@ -445,7 +462,9 @@ int filestream_putc(RFILE *stream, int c)
char c_char = (char)c;
if (!stream)
return EOF;
return filestream_write(stream, &c_char, 1)==1 ? (int)(unsigned char)c : EOF;
return filestream_write(stream, &c_char, 1) == 1
? (int)(unsigned char)c
: EOF;
}
int filestream_vprintf(RFILE *stream, const char* format, va_list args)
@ -487,7 +506,8 @@ int filestream_close(RFILE *stream)
if (filestream_close_cb)
output = filestream_close_cb(fp);
else
output = retro_vfs_file_close_impl((libretro_vfs_implementation_file*)fp);
output = retro_vfs_file_close_impl(
(libretro_vfs_implementation_file*)fp);
if (output == 0)
free(stream);

View File

@ -77,12 +77,16 @@ struct rzipstream
* file/chunk sizes */
static bool rzipstream_read_file_header(rzipstream_t *stream)
{
uint8_t header_bytes[RZIP_HEADER_SIZE] = {0};
unsigned i;
int64_t length;
uint8_t header_bytes[RZIP_HEADER_SIZE];
if (!stream)
return false;
for (i = 0; i < RZIP_HEADER_SIZE; i++)
header_bytes[i] = 0;
/* Attempt to read header bytes */
length = filestream_read(stream->file, header_bytes, sizeof(header_bytes));
if (length <= 0)
@ -145,45 +149,49 @@ file_uncompressed:
* file/chunk sizes */
static bool rzipstream_write_file_header(rzipstream_t *stream)
{
uint8_t header_bytes[RZIP_HEADER_SIZE] = {0};
unsigned i;
int64_t length;
uint8_t header_bytes[RZIP_HEADER_SIZE];
if (!stream)
return false;
/* Populate header array */
for (i = 0; i < RZIP_HEADER_SIZE; i++)
header_bytes[i] = 0;
/* > 'Magic numbers' - first 8 bytes */
header_bytes[0] = 35; /* # */
header_bytes[1] = 82; /* R */
header_bytes[2] = 90; /* Z */
header_bytes[3] = 73; /* I */
header_bytes[4] = 80; /* P */
header_bytes[5] = 118; /* v */
header_bytes[6] = RZIP_VERSION; /* file format version number */
header_bytes[7] = 35; /* # */
header_bytes[0] = 35; /* # */
header_bytes[1] = 82; /* R */
header_bytes[2] = 90; /* Z */
header_bytes[3] = 73; /* I */
header_bytes[4] = 80; /* P */
header_bytes[5] = 118; /* v */
header_bytes[6] = RZIP_VERSION; /* file format version number */
header_bytes[7] = 35; /* # */
/* > Uncompressed chunk size - next 4 bytes */
header_bytes[11] = (stream->chunk_size >> 24) & 0xFF;
header_bytes[10] = (stream->chunk_size >> 16) & 0xFF;
header_bytes[9] = (stream->chunk_size >> 8) & 0xFF;
header_bytes[8] = stream->chunk_size & 0xFF;
header_bytes[11] = (stream->chunk_size >> 24) & 0xFF;
header_bytes[10] = (stream->chunk_size >> 16) & 0xFF;
header_bytes[9] = (stream->chunk_size >> 8) & 0xFF;
header_bytes[8] = stream->chunk_size & 0xFF;
/* > Total uncompressed data size - next 8 bytes */
header_bytes[19] = (stream->size >> 56) & 0xFF;
header_bytes[18] = (stream->size >> 48) & 0xFF;
header_bytes[17] = (stream->size >> 40) & 0xFF;
header_bytes[16] = (stream->size >> 32) & 0xFF;
header_bytes[15] = (stream->size >> 24) & 0xFF;
header_bytes[14] = (stream->size >> 16) & 0xFF;
header_bytes[13] = (stream->size >> 8) & 0xFF;
header_bytes[12] = stream->size & 0xFF;
header_bytes[19] = (stream->size >> 56) & 0xFF;
header_bytes[18] = (stream->size >> 48) & 0xFF;
header_bytes[17] = (stream->size >> 40) & 0xFF;
header_bytes[16] = (stream->size >> 32) & 0xFF;
header_bytes[15] = (stream->size >> 24) & 0xFF;
header_bytes[14] = (stream->size >> 16) & 0xFF;
header_bytes[13] = (stream->size >> 8) & 0xFF;
header_bytes[12] = stream->size & 0xFF;
/* Reset file to start */
filestream_seek(stream->file, 0, SEEK_SET);
/* Write header bytes */
length = filestream_write(stream->file, header_bytes, sizeof(header_bytes));
length = filestream_write(stream->file,
header_bytes, sizeof(header_bytes));
if (length != RZIP_HEADER_SIZE)
return false;
@ -447,15 +455,19 @@ rzipstream_t* rzipstream_open(const char *path, unsigned mode)
* in the RZIP file */
static bool rzipstream_read_chunk(rzipstream_t *stream)
{
uint8_t chunk_header_bytes[RZIP_CHUNK_HEADER_SIZE] = {0};
unsigned i;
int64_t length;
uint8_t chunk_header_bytes[RZIP_CHUNK_HEADER_SIZE];
uint32_t compressed_chunk_size;
uint32_t inflate_read;
uint32_t inflate_written;
int64_t length;
if (!stream || !stream->inflate_backend || !stream->inflate_stream)
return false;
for (i = 0; i < RZIP_CHUNK_HEADER_SIZE; i++)
chunk_header_bytes[i] = 0;
/* Attempt to read chunk header bytes */
length = filestream_read(
stream->file, chunk_header_bytes, sizeof(chunk_header_bytes));
@ -613,9 +625,9 @@ int rzipstream_getc(rzipstream_t *stream)
* have been read, returns NULL. */
char* rzipstream_gets(rzipstream_t *stream, char *s, size_t len)
{
size_t str_len;
int c = 0;
char *str_ptr = s;
size_t str_len;
if (!stream || stream->is_writing || (len == 0))
return NULL;
@ -732,14 +744,18 @@ error:
* as the next RZIP file chunk */
static bool rzipstream_write_chunk(rzipstream_t *stream)
{
uint8_t chunk_header_bytes[RZIP_CHUNK_HEADER_SIZE] = {0};
unsigned i;
int64_t length;
uint8_t chunk_header_bytes[RZIP_CHUNK_HEADER_SIZE];
uint32_t deflate_read;
uint32_t deflate_written;
int64_t length;
if (!stream || !stream->deflate_backend || !stream->deflate_stream)
return false;
for (i = 0; i < RZIP_CHUNK_HEADER_SIZE; i++)
chunk_header_bytes[i] = 0;
/* Compress data currently held in input buffer */
stream->deflate_backend->set_in(
stream->deflate_stream,
@ -1030,8 +1046,7 @@ int64_t rzipstream_get_size(rzipstream_t *stream)
if (stream->is_compressed)
return stream->size;
else
return filestream_get_size(stream->file);
return filestream_get_size(stream->file);
}
/* Returns EOF when no further *uncompressed* data
@ -1044,8 +1059,7 @@ int rzipstream_eof(rzipstream_t *stream)
if (stream->is_compressed)
return (stream->virtual_ptr >= stream->size) ?
EOF : 0;
else
return filestream_eof(stream->file);
return filestream_eof(stream->file);
}
/* Returns the offset of the current byte of *uncompressed*

View File

@ -30,6 +30,7 @@
#include <time/rtime.h>
#ifdef HAVE_THREADS
/* TODO/FIXME - global */
slock_t *rtime_localtime_lock = NULL;
#endif

View File

@ -116,28 +116,6 @@ static void menu_action_setting_disp_set_label_cheat_num_passes(
}
#endif
static void menu_action_setting_disp_add_null_drivers(
file_list_t* list,
unsigned *w, unsigned type, unsigned i,
const char *label,
char *s, size_t len,
const char *path,
char *s2, size_t len2)
{
menu_file_list_cbs_t *cbs = (menu_file_list_cbs_t*)
list->list[i].actiondata;
bool val = *cbs->setting->value.target.boolean;
*s = '\0';
*w = 19;
strlcpy(s2, path, len2);
if (val)
strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OFF), len);
else
strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_ON), len);
}
#ifdef HAVE_CHEEVOS
static void menu_action_setting_disp_set_label_cheevos_entry(
file_list_t* list,
@ -1563,9 +1541,6 @@ static int menu_cbs_init_bind_get_string_representation_compare_label(
{
switch (cbs->enum_idx)
{
case MENU_ENUM_LABEL_ADD_NULL_DRIVERS:
BIND_ACTION_GET_VALUE(cbs, menu_action_setting_disp_add_null_drivers);
break;
case MENU_ENUM_LABEL_VIDEO_DRIVER:
case MENU_ENUM_LABEL_AUDIO_DRIVER:
case MENU_ENUM_LABEL_INPUT_DRIVER:

View File

@ -6437,10 +6437,7 @@ int action_ok_core_lock(const char *path,
static int action_ok_core_delete(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
const char *core_path = label;
const char *core = NULL;
const char *loaded_core_path = NULL;
const char *loaded_core = NULL;
const char *core_path = label;
if (string_is_empty(core_path))
return -1;
@ -6483,20 +6480,9 @@ static int action_ok_core_delete(const char *path,
return 0;
}
/* Get core file name */
core = path_basename(core_path);
if (string_is_empty(core))
return -1;
/* Get loaded core file name */
loaded_core_path = path_get(RARCH_PATH_CORE);
if (!string_is_empty(loaded_core_path))
loaded_core = path_basename(loaded_core_path);
/* Check if core to be deleted is currently
* loaded - if so, unload it */
if (!string_is_empty(loaded_core) &&
string_is_equal(core, loaded_core))
if (rarch_ctl(RARCH_CTL_IS_CORE_LOADED, (void*)core_path))
generic_action_ok_command(CMD_EVENT_UNLOAD_CORE);
/* Delete core file */

View File

@ -327,6 +327,9 @@ DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_video_adaptive_vsync, MENU_
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_core_allow_rotate, MENU_ENUM_SUBLABEL_VIDEO_ALLOW_ROTATE)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_dummy_on_core_shutdown, MENU_ENUM_SUBLABEL_DUMMY_ON_CORE_SHUTDOWN)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_dummy_check_missing_firmware, MENU_ENUM_SUBLABEL_CHECK_FOR_MISSING_FIRMWARE)
#ifndef HAVE_DYNAMIC
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_always_reload_core_on_run_content, MENU_ENUM_SUBLABEL_ALWAYS_RELOAD_CORE_ON_RUN_CONTENT)
#endif
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_video_refresh_rate, MENU_ENUM_SUBLABEL_VIDEO_REFRESH_RATE)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_video_refresh_rate_polled, MENU_ENUM_SUBLABEL_VIDEO_REFRESH_RATE_POLLED)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_audio_enable, MENU_ENUM_SUBLABEL_AUDIO_ENABLE)
@ -335,7 +338,6 @@ DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_audio_max_timing_skew, MENU_
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_pause_nonactive, MENU_ENUM_SUBLABEL_PAUSE_NONACTIVE)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_video_disable_composition, MENU_ENUM_SUBLABEL_VIDEO_DISABLE_COMPOSITION)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_video_smooth, MENU_ENUM_SUBLABEL_VIDEO_SMOOTH)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_add_null_drivers, MENU_ENUM_SUBLABEL_ADD_NULL_DRIVERS)
#ifdef HAVE_ODROIDGO2
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_video_ctx_scaling, MENU_ENUM_SUBLABEL_VIDEO_RGA_SCALING)
#else
@ -3023,9 +3025,6 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs,
case MENU_ENUM_LABEL_VIDEO_CROP_OVERSCAN:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_video_crop_overscan);
break;
case MENU_ENUM_LABEL_ADD_NULL_DRIVERS:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_add_null_drivers);
break;
case MENU_ENUM_LABEL_VIDEO_SMOOTH:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_video_smooth);
break;
@ -3059,6 +3058,11 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs,
case MENU_ENUM_LABEL_CHECK_FOR_MISSING_FIRMWARE:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_dummy_check_missing_firmware);
break;
#ifndef HAVE_DYNAMIC
case MENU_ENUM_LABEL_ALWAYS_RELOAD_CORE_ON_RUN_CONTENT:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_always_reload_core_on_run_content);
break;
#endif
case MENU_ENUM_LABEL_VIDEO_ALLOW_ROTATE:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_core_allow_rotate);
break;

View File

@ -7824,7 +7824,6 @@ unsigned menu_displaylist_build_list(
{
menu_displaylist_build_info_t build_list[] = {
{MENU_ENUM_LABEL_SETTINGS_SHOW_DRIVERS, PARSE_ONLY_BOOL},
{MENU_ENUM_LABEL_ADD_NULL_DRIVERS, PARSE_ONLY_BOOL},
{MENU_ENUM_LABEL_SETTINGS_SHOW_VIDEO, PARSE_ONLY_BOOL},
{MENU_ENUM_LABEL_SETTINGS_SHOW_AUDIO, PARSE_ONLY_BOOL},
{MENU_ENUM_LABEL_SETTINGS_SHOW_INPUT, PARSE_ONLY_BOOL},
@ -7930,6 +7929,9 @@ unsigned menu_displaylist_build_list(
{MENU_ENUM_LABEL_DUMMY_ON_CORE_SHUTDOWN, PARSE_ONLY_BOOL},
{MENU_ENUM_LABEL_CHECK_FOR_MISSING_FIRMWARE, PARSE_ONLY_BOOL},
{MENU_ENUM_LABEL_VIDEO_ALLOW_ROTATE, PARSE_ONLY_BOOL},
#ifndef HAVE_DYNAMIC
{MENU_ENUM_LABEL_ALWAYS_RELOAD_CORE_ON_RUN_CONTENT, PARSE_ONLY_BOOL},
#endif
};
for (i = 0; i < ARRAY_SIZE(build_list); i++)

View File

@ -4870,6 +4870,25 @@ static void setting_get_string_representation_uint_video_3ds_display_mode(
}
#endif
/* A protected driver is such that the user cannot set to "null" using the UI.
* Can prevent the user from locking him/herself out of the program. */
static bool setting_is_protected_driver(rarch_setting_t *setting)
{
if (!setting)
return false;
switch (setting->enum_idx)
{
case MENU_ENUM_LABEL_INPUT_DRIVER:
case MENU_ENUM_LABEL_JOYPAD_DRIVER:
case MENU_ENUM_LABEL_VIDEO_DRIVER:
case MENU_ENUM_LABEL_MENU_DRIVER:
return true;
default:
return false;
}
}
static int setting_action_left_analog_dpad_mode(
rarch_setting_t *setting, size_t idx, bool wraparound)
{
@ -5140,6 +5159,7 @@ static int setting_string_action_left_driver(
rarch_setting_t *setting, size_t idx, bool wraparound)
{
driver_ctx_info_t drv;
bool success = false;
if (!setting)
return -1;
@ -5148,17 +5168,47 @@ static int setting_string_action_left_driver(
drv.s = setting->value.target.string;
drv.len = setting->size;
if (!driver_ctl(RARCH_DRIVER_CTL_FIND_PREV, &drv))
/* Find the previous driver in the array of drivers.
* If the driver is protected, keep finding more previous drivers while the
* driver is null or until there are no more previous drivers. */
success = driver_ctl(RARCH_DRIVER_CTL_FIND_PREV, &drv);
if (setting_is_protected_driver(setting))
{
while (success &&
string_is_equal(drv.s, "null") &&
(success = driver_ctl(RARCH_DRIVER_CTL_FIND_PREV, &drv)));
}
if (!success)
{
settings_t *settings = config_get_ptr();
bool menu_navigation_wraparound_enable = settings ? settings->bools.menu_navigation_wraparound_enable: false;
if (menu_navigation_wraparound_enable)
{
/* If wraparound is enabled, find the LAST driver in the array of drivers.
* If the driver is protected, find the previous driver and keep finding more
* previous drivers while the driver is null or until there are no more previous drivers. */
drv.label = setting->name;
drv.s = setting->value.target.string;
drv.len = setting->size;
driver_ctl(RARCH_DRIVER_CTL_FIND_LAST, &drv);
success = driver_ctl(RARCH_DRIVER_CTL_FIND_LAST, &drv);
if (setting_is_protected_driver(setting))
{
while (success &&
string_is_equal(drv.s, "null") &&
(success = driver_ctl(RARCH_DRIVER_CTL_FIND_PREV, &drv)));
}
}
else if (setting_is_protected_driver(setting))
{
/* If wraparound is disabled and if the driver is protected,
* find the next driver in the array of drivers and keep finding more
* next drivers while the driver is null or until there are no more next drivers. */
success = driver_ctl(RARCH_DRIVER_CTL_FIND_NEXT, &drv);
while (success &&
string_is_equal(drv.s, "null") &&
(success = driver_ctl(RARCH_DRIVER_CTL_FIND_NEXT, &drv)));
}
}
@ -5376,6 +5426,7 @@ static int setting_string_action_right_driver(
rarch_setting_t *setting, size_t idx, bool wraparound)
{
driver_ctx_info_t drv;
bool success = false;
if (!setting)
return -1;
@ -5384,17 +5435,47 @@ static int setting_string_action_right_driver(
drv.s = setting->value.target.string;
drv.len = setting->size;
if (!driver_ctl(RARCH_DRIVER_CTL_FIND_NEXT, &drv))
/* Find the next driver in the array of drivers.
* If the driver is protected, keep finding next drivers while the
* driver is null or until there are no more next drivers. */
success = driver_ctl(RARCH_DRIVER_CTL_FIND_NEXT, &drv);
if (setting_is_protected_driver(setting))
{
while (success &&
string_is_equal(drv.s, "null") &&
(success = driver_ctl(RARCH_DRIVER_CTL_FIND_NEXT, &drv)));
}
if (!success)
{
settings_t *settings = config_get_ptr();
bool menu_navigation_wraparound_enable = settings ? settings->bools.menu_navigation_wraparound_enable: false;
if (menu_navigation_wraparound_enable)
{
/* If wraparound is enabled, find the first driver in the array of drivers.
* If the driver is protected, find the next driver and keep finding more
* next drivers while the driver is null or until there are no more next drivers. */
drv.label = setting->name;
drv.s = setting->value.target.string;
drv.len = setting->size;
driver_ctl(RARCH_DRIVER_CTL_FIND_FIRST, &drv);
success = driver_ctl(RARCH_DRIVER_CTL_FIND_FIRST, &drv);
if (setting_is_protected_driver(setting))
{
while (success &&
string_is_equal(drv.s, "null") &&
(success = driver_ctl(RARCH_DRIVER_CTL_FIND_NEXT, &drv)));
}
}
else if (setting_is_protected_driver(setting))
{
/* If wraparound is disabled and if the driver is protected,
* find the previous driver in the array of drivers and keep finding more
* previous drivers while the driver is null or until there are no more previous drivers. */
success = driver_ctl(RARCH_DRIVER_CTL_FIND_PREV, &drv);
while (success &&
string_is_equal(drv.s, "null") &&
(success = driver_ctl(RARCH_DRIVER_CTL_FIND_PREV, &drv)));
}
}
@ -8587,8 +8668,11 @@ static bool setting_append_list(
case SETTINGS_LIST_CORE:
{
unsigned i, listing = 0;
#ifndef HAVE_DYNAMIC
struct bool_entry bool_entries[7];
#else
struct bool_entry bool_entries[6];
#endif
START_GROUP(list, list_info, &group_info,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CORE_SETTINGS), parent_group);
MENU_SETTINGS_LIST_CURRENT_ADD_ENUM_IDX_PTR(list, list_info, MENU_ENUM_LABEL_CORE_SETTINGS);
@ -8642,6 +8726,14 @@ static bool setting_append_list(
bool_entries[listing].flags = SD_FLAG_ADVANCED;
listing++;
#ifndef HAVE_DYNAMIC
bool_entries[listing].target = &settings->bools.always_reload_core_on_run_content;
bool_entries[listing].name_enum_idx = MENU_ENUM_LABEL_ALWAYS_RELOAD_CORE_ON_RUN_CONTENT;
bool_entries[listing].SHORT_enum_idx = MENU_ENUM_LABEL_VALUE_ALWAYS_RELOAD_CORE_ON_RUN_CONTENT;
bool_entries[listing].default_value = DEFAULT_ALWAYS_RELOAD_CORE_ON_RUN_CONTENT;
bool_entries[listing].flags = SD_FLAG_ADVANCED;
listing++;
#endif
for (i = 0; i < ARRAY_SIZE(bool_entries); i++)
{
CONFIG_BOOL(
@ -14951,21 +15043,6 @@ static bool setting_append_list(
general_read_handler,
SD_FLAG_NONE);
CONFIG_BOOL(
list, list_info,
&settings->bools.add_null_drivers,
MENU_ENUM_LABEL_ADD_NULL_DRIVERS,
MENU_ENUM_LABEL_VALUE_ADD_NULL_DRIVERS,
false,
MENU_ENUM_LABEL_VALUE_OFF,
MENU_ENUM_LABEL_VALUE_ON,
&group_info,
&subgroup_info,
parent_group,
general_write_handler,
general_read_handler,
SD_FLAG_NONE);
CONFIG_BOOL(
list, list_info,
&settings->bools.settings_show_video,

View File

@ -977,7 +977,6 @@ enum msg_hash_enums
MENU_LABEL(SCREEN_ORIENTATION),
MENU_LABEL(VIDEO_SCALE),
MENU_LABEL(VIDEO_RECORD_THREADS),
MENU_LABEL(ADD_NULL_DRIVERS),
MENU_LABEL(VIDEO_SMOOTH),
MENU_LABEL(VIDEO_CTX_SCALING),
#ifdef HAVE_ODROIDGO2
@ -1954,6 +1953,9 @@ enum msg_hash_enums
MENU_LABEL(DUMMY_ON_CORE_SHUTDOWN),
MENU_LABEL(CHECK_FOR_MISSING_FIRMWARE),
#ifndef HAVE_DYNAMIC
MENU_LABEL(ALWAYS_RELOAD_CORE_ON_RUN_CONTENT),
#endif
MENU_LABEL(DETECT_CORE_LIST_OK_CURRENT_CORE),
MENU_LABEL(DETECT_CORE_LIST_OK),

View File

@ -527,14 +527,14 @@ else
fi
if [ "$HAVE_MENU" != 'no' ]; then
if [ "$HAVE_OPENGL" = 'no' ] &&
if [ "$HAVE_OPENGL" = 'no' ] &&
[ "$HAVE_OPENGL1" = 'no' ] &&
[ "$HAVE_OPENGLES" = 'no' ] &&
[ "$HAVE_OPENGLES" = 'no' ] &&
[ "$HAVE_OPENGL_CORE" = 'no' ] &&
[ "$HAVE_VULKAN" = 'no' ] &&
[ "$HAVE_D3D10" = 'no' ] &&
[ "$HAVE_D3D11" = 'no' ] &&
[ "$HAVE_D3D12" = 'no' ] &&
[ "$HAVE_VULKAN" = 'no' ] &&
[ "$HAVE_D3D10" = 'no' ] &&
[ "$HAVE_D3D11" = 'no' ] &&
[ "$HAVE_D3D12" = 'no' ] &&
[ "$HAVE_METAL" = 'no' ]; then
if [ "$OS" = 'Win32' ]; then
HAVE_SHADERPIPELINE=no
@ -570,10 +570,10 @@ if [ "$HAVE_GLSLANG" != no ]; then
glslang/Public/ShaderLang.h \
glslang/SPIRV/GlslangToSpv.h
check_lib cxx GLSLANG -lglslang
check_lib cxx GLSLANG -lglslang '' '-lSPIRV'
check_lib cxx GLSLANG_OSDEPENDENT -lOSDependent
check_lib cxx GLSLANG_OGLCOMPILER -lOGLCompiler
check_lib cxx GLSLANG_HLSL -lHLSL
check_lib cxx GLSLANG_HLSL -lHLSL '' '-lglslang -lSPIRV'
check_lib cxx GLSLANG_SPIRV -lSPIRV
check_lib cxx GLSLANG_SPIRV_TOOLS_OPT -lSPIRV-Tools-opt
check_lib cxx GLSLANG_SPIRV_TOOLS -lSPIRV-Tools

View File

@ -1121,7 +1121,7 @@ static bool ffmpeg_push_video(void *data,
unsigned avail;
slock_lock(handle->lock);
avail = fifo_write_avail(handle->attr_fifo);
avail = FIFO_WRITE_AVAIL(handle->attr_fifo);
slock_unlock(handle->lock);
if (!handle->alive)
@ -1183,7 +1183,7 @@ static bool ffmpeg_push_audio(void *data,
unsigned avail;
slock_lock(handle->lock);
avail = fifo_write_avail(handle->audio_fifo);
avail = FIFO_WRITE_AVAIL(handle->audio_fifo);
slock_unlock(handle->lock);
if (!handle->alive)
@ -1578,7 +1578,7 @@ static bool ffmpeg_push_audio_thread(ffmpeg_t *handle,
static void ffmpeg_flush_audio(ffmpeg_t *handle, void *audio_buf,
size_t audio_buf_size)
{
size_t avail = fifo_read_avail(handle->audio_fifo);
size_t avail = FIFO_READ_AVAIL(handle->audio_fifo);
if (avail)
{
@ -1624,7 +1624,7 @@ static void ffmpeg_flush_buffers(ffmpeg_t *handle)
if (handle->config.audio_enable)
{
if (fifo_read_avail(handle->audio_fifo) >= audio_buf_size)
if (FIFO_READ_AVAIL(handle->audio_fifo) >= audio_buf_size)
{
struct record_audio_data aud = {0};
@ -1637,7 +1637,7 @@ static void ffmpeg_flush_buffers(ffmpeg_t *handle)
}
}
if (fifo_read_avail(handle->attr_fifo) >= sizeof(attr_buf))
if (FIFO_READ_AVAIL(handle->attr_fifo) >= sizeof(attr_buf))
{
fifo_read(handle->attr_fifo, &attr_buf, sizeof(attr_buf));
fifo_read(handle->video_fifo, video_buf,
@ -1705,11 +1705,11 @@ static void ffmpeg_thread(void *data)
bool avail_audio = false;
slock_lock(ff->lock);
if (fifo_read_avail(ff->attr_fifo) >= sizeof(attr_buf))
if (FIFO_READ_AVAIL(ff->attr_fifo) >= sizeof(attr_buf))
avail_video = true;
if (ff->config.audio_enable)
if (fifo_read_avail(ff->audio_fifo) >= audio_buf_size)
if (FIFO_READ_AVAIL(ff->audio_fifo) >= audio_buf_size)
avail_audio = true;
slock_unlock(ff->lock);

View File

@ -2398,6 +2398,7 @@ struct rarch_state
struct retro_callbacks retro_ctx;
struct retro_core_t current_core;
struct global g_extern;
content_state_t content_st;
jmp_buf error_sjlj_context;
@ -2541,6 +2542,7 @@ struct rarch_state
#if defined(HAVE_CG) || defined(HAVE_GLSL) || defined(HAVE_SLANG) || defined(HAVE_HLSL)
struct video_shader *menu_driver_shader;
#endif
frontend_ctx_driver_t *current_frontend_ctx;
};
static struct rarch_state rarch_st;
@ -2579,7 +2581,6 @@ struct aspect_ratio_elem aspectratio_lut[ASPECT_RATIO_END] = {
{ "9:16", 0.5625f },
{ "5:4", 1.25f },
{ "6:5", 1.2f },
{ "7:3", 2.3333f },
{ "7:9", 0.7777f },
{ "8:3", 2.6666f },
{ "8:7", 1.1428f },
@ -2898,6 +2899,28 @@ static void menu_input_post_iterate(
static void menu_input_reset(struct rarch_state *p_rarch);
#endif
content_state_t *content_state_get_ptr(void)
{
struct rarch_state *p_rarch = &rarch_st;
return &p_rarch->content_st;
}
/* Get the current subsystem rom id */
unsigned content_get_subsystem_rom_id(void)
{
struct rarch_state *p_rarch = &rarch_st;
content_state_t *p_content = &p_rarch->content_st;
return p_content->pending_subsystem_rom_id;
}
/* Get the current subsystem */
int content_get_subsystem(void)
{
struct rarch_state *p_rarch = &rarch_st;
content_state_t *p_content = &p_rarch->content_st;
return p_content->pending_subsystem_id;
}
int input_event_get_osk_ptr(void)
{
struct rarch_state *p_rarch = &rarch_st;
@ -10532,9 +10555,6 @@ struct string_list *string_list_new_special(enum string_list_type type,
unsigned i;
core_info_list_t *core_info_list = NULL;
const core_info_t *core_info = NULL;
struct rarch_state *p_rarch = &rarch_st;
settings_t *settings = p_rarch->configuration_settings;
bool add_null_entries = settings->bools.add_null_drivers;
struct string_list *s = string_list_new();
if (!s || !len)
@ -10549,33 +10569,23 @@ struct string_list *string_list_new_special(enum string_list_type type,
#ifdef HAVE_MENU
for (i = 0; menu_ctx_drivers[i]; i++)
{
if (menu_ctx_drivers[i])
{
bool add_null = add_null_entries;
const char *opt = menu_ctx_drivers[i]->ident;
*len += strlen(opt) + 1;
const char *opt = menu_ctx_drivers[i]->ident;
*len += strlen(opt) + 1;
if (!add_null)
add_null = (i == 0) || !string_is_equal(opt, "null");
if (add_null)
string_list_append(s, opt, attr);
}
/* Don't allow the user to set menu driver to "null" using the UI.
* Can prevent the user from locking him/herself out of the program. */
if (string_is_not_equal(opt, "null"))
string_list_append(s, opt, attr);
}
break;
#endif
case STRING_LIST_CAMERA_DRIVERS:
for (i = 0; camera_drivers[i]; i++)
{
bool add_null = add_null_entries;
const char *opt = camera_drivers[i]->ident;
*len += strlen(opt) + 1;
if (!add_null)
add_null = (i == 0) || !string_is_equal(opt, "null");
if (add_null)
string_list_append(s, opt, attr);
string_list_append(s, opt, attr);
}
break;
case STRING_LIST_BLUETOOTH_DRIVERS:
@ -10585,11 +10595,7 @@ struct string_list *string_list_new_special(enum string_list_type type,
const char *opt = bluetooth_drivers[i]->ident;
*len += strlen(opt) + 1;
if (!add_null_entries)
add_null_entries = (i == 0) || !string_is_equal(opt, "null");
if (add_null_entries)
string_list_append(s, opt, attr);
string_list_append(s, opt, attr);
}
break;
#endif
@ -10597,85 +10603,61 @@ struct string_list *string_list_new_special(enum string_list_type type,
#ifdef HAVE_WIFI
for (i = 0; wifi_drivers[i]; i++)
{
bool add_null = add_null_entries;
const char *opt = wifi_drivers[i]->ident;
*len += strlen(opt) + 1;
if (!add_null)
add_null = (i == 0) || !string_is_equal(opt, "null");
if (add_null)
string_list_append(s, opt, attr);
string_list_append(s, opt, attr);
}
break;
#endif
case STRING_LIST_LOCATION_DRIVERS:
for (i = 0; location_drivers[i]; i++)
{
bool add_null = add_null_entries;
const char *opt = location_drivers[i]->ident;
*len += strlen(opt) + 1;
if (!add_null)
add_null = (i == 0) || !string_is_equal(opt, "null");
if (add_null)
string_list_append(s, opt, attr);
string_list_append(s, opt, attr);
}
break;
case STRING_LIST_AUDIO_DRIVERS:
for (i = 0; audio_drivers[i]; i++)
{
bool add_null = add_null_entries;
const char *opt = audio_drivers[i]->ident;
*len += strlen(opt) + 1;
if (!add_null)
add_null = (i == 0) || !string_is_equal(opt, "null");
if (add_null)
string_list_append(s, opt, attr);
string_list_append(s, opt, attr);
}
break;
case STRING_LIST_AUDIO_RESAMPLER_DRIVERS:
for (i = 0; audio_resampler_driver_find_handle(i); i++)
{
bool add_null = add_null_entries;
const char *opt = audio_resampler_driver_find_ident(i);
*len += strlen(opt) + 1;
if (!add_null)
add_null = (i == 0) || !string_is_equal(opt, "null");
if (add_null)
string_list_append(s, opt, attr);
string_list_append(s, opt, attr);
}
break;
case STRING_LIST_VIDEO_DRIVERS:
for (i = 0; video_drivers[i]; i++)
{
bool add_null = add_null_entries;
const char *opt = video_drivers[i]->ident;
*len += strlen(opt) + 1;
if (!add_null)
add_null = (i == 0) || !string_is_equal(opt, "null");
if (add_null)
/* Don't allow the user to set video driver to "null" using the UI.
* Can prevent the user from locking him/herself out of the program. */
if (string_is_not_equal(opt, "null"))
string_list_append(s, opt, attr);
}
break;
case STRING_LIST_INPUT_DRIVERS:
for (i = 0; input_drivers[i]; i++)
{
bool add_null = add_null_entries;
const char *opt = input_drivers[i]->ident;
*len += strlen(opt) + 1;
if (!add_null)
add_null = (i == 0) || !string_is_equal(opt, "null");
if (add_null)
/* Don't allow the user to set input driver to "null" using the UI.
* Can prevent the user from locking him/herself out of the program. */
if (string_is_not_equal(opt, "null"))
string_list_append(s, opt, attr);
}
break;
@ -10683,14 +10665,12 @@ struct string_list *string_list_new_special(enum string_list_type type,
#ifdef HAVE_HID
for (i = 0; hid_drivers[i]; i++)
{
bool add_null = add_null_entries;
const char *opt = hid_drivers[i]->ident;
*len += strlen(opt) + 1;
if (!add_null)
add_null = (i == 0) || !string_is_equal(opt, "null");
if (add_null)
/* Don't allow the user to set input HID driver to "null" using the UI.
* Can prevent the user from locking him/herself out of the program. */
if (string_is_not_equal(opt, "null"))
string_list_append(s, opt, attr);
}
#endif
@ -10698,43 +10678,31 @@ struct string_list *string_list_new_special(enum string_list_type type,
case STRING_LIST_INPUT_JOYPAD_DRIVERS:
for (i = 0; joypad_drivers[i]; i++)
{
bool add_null = add_null_entries;
const char *opt = joypad_drivers[i]->ident;
*len += strlen(opt) + 1;
if (!add_null)
add_null = (i == 0) || !string_is_equal(opt, "null");
if (add_null)
/* Don't allow the user to set input joypad driver to "null" using the UI.
* Can prevent the user from locking him/herself out of the program. */
if (string_is_not_equal(opt, "null"))
string_list_append(s, opt, attr);
}
break;
case STRING_LIST_RECORD_DRIVERS:
for (i = 0; record_drivers[i]; i++)
{
bool add_null = add_null_entries;
const char *opt = record_drivers[i]->ident;
*len += strlen(opt) + 1;
if (!add_null)
add_null = (i == 0) || !string_is_equal(opt, "null");
if (add_null)
string_list_append(s, opt, attr);
string_list_append(s, opt, attr);
}
break;
case STRING_LIST_MIDI_DRIVERS:
for (i = 0; midi_driver_find_handle(i); i++)
{
bool add_null = add_null_entries;
const char *opt = midi_drivers[i]->ident;
*len += strlen(opt) + 1;
if (!add_null)
add_null = (i == 0) || !string_is_equal(opt, "null");
if (add_null)
string_list_append(s, opt, attr);
string_list_append(s, opt, attr);
}
break;
case STRING_LIST_SUPPORTED_CORES_PATHS:
@ -33635,25 +33603,17 @@ static void camera_driver_find_driver(struct rarch_state *p_rarch)
* pointer to driver.
**/
static const void *find_driver_nonempty(
bool add_null_entries,
const char *label, int i,
char *s, size_t len)
{
bool add_entry = add_null_entries;
if (string_is_equal(label, "camera_driver"))
{
if (camera_drivers[i])
{
const char *ident = camera_drivers[i]->ident;
if (!add_entry)
add_entry = i == 0 || !string_is_equal(ident, "null");
if (add_entry)
{
strlcpy(s, ident, len);
return camera_drivers[i];
}
strlcpy(s, ident, len);
return camera_drivers[i];
}
}
else if (string_is_equal(label, "location_driver"))
@ -33661,14 +33621,9 @@ static const void *find_driver_nonempty(
if (location_drivers[i])
{
const char *ident = location_drivers[i]->ident;
if (!add_entry)
add_entry = i == 0 || !string_is_equal(ident, "null");
if (add_entry)
{
strlcpy(s, ident, len);
return location_drivers[i];
}
strlcpy(s, ident, len);
return location_drivers[i];
}
}
#ifdef HAVE_MENU
@ -33677,14 +33632,9 @@ static const void *find_driver_nonempty(
if (menu_ctx_drivers[i])
{
const char *ident = menu_ctx_drivers[i]->ident;
if (!add_entry)
add_entry = i == 0 || !string_is_equal(ident, "null");
if (add_entry)
{
strlcpy(s, ident, len);
return menu_ctx_drivers[i];
}
strlcpy(s, ident, len);
return menu_ctx_drivers[i];
}
}
#endif
@ -33693,14 +33643,9 @@ static const void *find_driver_nonempty(
if (input_drivers[i])
{
const char *ident = input_drivers[i]->ident;
if (!add_entry)
add_entry = i == 0 || !string_is_equal(ident, "null");
if (add_entry)
{
strlcpy(s, ident, len);
return input_drivers[i];
}
strlcpy(s, ident, len);
return input_drivers[i];
}
}
else if (string_is_equal(label, "input_joypad_driver"))
@ -33708,14 +33653,9 @@ static const void *find_driver_nonempty(
if (joypad_drivers[i])
{
const char *ident = joypad_drivers[i]->ident;
if (!add_entry)
add_entry = i == 0 || !string_is_equal(ident, "null");
if (add_entry)
{
strlcpy(s, ident, len);
return joypad_drivers[i];
}
strlcpy(s, ident, len);
return joypad_drivers[i];
}
}
else if (string_is_equal(label, "video_driver"))
@ -33723,14 +33663,9 @@ static const void *find_driver_nonempty(
if (video_drivers[i])
{
const char *ident = video_drivers[i]->ident;
if (!add_entry)
add_entry = i == 0 || !string_is_equal(ident, "null");
if (add_entry)
{
strlcpy(s, ident, len);
return video_drivers[i];
}
strlcpy(s, ident, len);
return video_drivers[i];
}
}
else if (string_is_equal(label, "audio_driver"))
@ -33738,14 +33673,9 @@ static const void *find_driver_nonempty(
if (audio_drivers[i])
{
const char *ident = audio_drivers[i]->ident;
if (!add_entry)
add_entry = i == 0 || !string_is_equal(ident, "null");
if (add_entry)
{
strlcpy(s, ident, len);
return audio_drivers[i];
}
strlcpy(s, ident, len);
return audio_drivers[i];
}
}
else if (string_is_equal(label, "record_driver"))
@ -33753,14 +33683,9 @@ static const void *find_driver_nonempty(
if (record_drivers[i])
{
const char *ident = record_drivers[i]->ident;
if (!add_entry)
add_entry = i == 0 || !string_is_equal(ident, "null");
if (add_entry)
{
strlcpy(s, ident, len);
return record_drivers[i];
}
strlcpy(s, ident, len);
return record_drivers[i];
}
}
else if (string_is_equal(label, "midi_driver"))
@ -33768,14 +33693,9 @@ static const void *find_driver_nonempty(
if (midi_driver_find_handle(i))
{
const char *ident = midi_drivers[i]->ident;
if (!add_entry)
add_entry = i == 0 || !string_is_equal(ident, "null");
if (add_entry)
{
strlcpy(s, ident, len);
return midi_drivers[i];
}
strlcpy(s, ident, len);
return midi_drivers[i];
}
}
else if (string_is_equal(label, "audio_resampler_driver"))
@ -33783,14 +33703,9 @@ static const void *find_driver_nonempty(
if (audio_resampler_driver_find_handle(i))
{
const char *ident = audio_resampler_driver_find_ident(i);
if (!add_entry)
add_entry = i == 0 || !string_is_equal(ident, "null");
if (add_entry)
{
strlcpy(s, ident, len);
return audio_resampler_driver_find_handle(i);
}
strlcpy(s, ident, len);
return audio_resampler_driver_find_handle(i);
}
}
else if (string_is_equal(label, "bluetooth_driver"))
@ -33798,14 +33713,9 @@ static const void *find_driver_nonempty(
if (bluetooth_drivers[i])
{
const char *ident = bluetooth_drivers[i]->ident;
if (!add_entry)
add_entry = i == 0 || !string_is_equal(ident, "null");
if (add_entry)
{
strlcpy(s, ident, len);
return bluetooth_drivers[i];
}
strlcpy(s, ident, len);
return bluetooth_drivers[i];
}
}
else if (string_is_equal(label, "wifi_driver"))
@ -33813,14 +33723,9 @@ static const void *find_driver_nonempty(
if (wifi_drivers[i])
{
const char *ident = wifi_drivers[i]->ident;
if (!add_entry)
add_entry = i == 0 || !string_is_equal(ident, "null");
if (add_entry)
{
strlcpy(s, ident, len);
return wifi_drivers[i];
}
strlcpy(s, ident, len);
return wifi_drivers[i];
}
}
@ -33837,8 +33742,7 @@ static const void *find_driver_nonempty(
* Returns: -1 if no driver based on @label and @drv found, otherwise
* index number of the driver found in the array.
**/
static int driver_find_index(bool add_null_entries,
const char * label, const char *drv)
static int driver_find_index(const char *label, const char *drv)
{
unsigned i;
char str[256];
@ -33846,8 +33750,7 @@ static int driver_find_index(bool add_null_entries,
str[0] = '\0';
for (i = 0;
find_driver_nonempty(add_null_entries,
label, i, str, sizeof(str)) != NULL; i++)
find_driver_nonempty(label, i, str, sizeof(str)) != NULL; i++)
{
if (string_is_empty(str))
break;
@ -33866,15 +33769,12 @@ static int driver_find_index(bool add_null_entries,
*
* Find last driver in driver array.
**/
static bool driver_find_last(
bool add_null_entries,
const char *label, char *s, size_t len)
static bool driver_find_last(const char *label, char *s, size_t len)
{
unsigned i;
for (i = 0;
find_driver_nonempty(add_null_entries,
label, i, s, len) != NULL; i++)
find_driver_nonempty(label, i, s, len) != NULL; i++)
{}
if (i)
@ -33882,7 +33782,7 @@ static bool driver_find_last(
else
i = 0;
find_driver_nonempty(add_null_entries, label, i, s, len);
find_driver_nonempty(label, i, s, len);
return true;
}
@ -33894,17 +33794,13 @@ static bool driver_find_last(
*
* Find previous driver in driver array.
**/
static bool driver_find_prev(
bool add_null_entries,
const char *label, char *s, size_t len)
static bool driver_find_prev(const char *label, char *s, size_t len)
{
int i = driver_find_index(add_null_entries, label, s);
int i = driver_find_index(label, s);
if (i > 0)
{
find_driver_nonempty(
add_null_entries,
label, i - 1, s, len);
find_driver_nonempty(label, i - 1, s, len);
return true;
}
@ -33921,17 +33817,13 @@ static bool driver_find_prev(
*
* Find next driver in driver array.
**/
static bool driver_find_next(
bool add_null_entries,
const char *label, char *s, size_t len)
static bool driver_find_next(const char *label, char *s, size_t len)
{
int i = driver_find_index(add_null_entries, label, s);
int i = driver_find_index(label, s);
if (i >= 0 && string_is_not_equal(s, "null"))
{
find_driver_nonempty(
add_null_entries,
label, i + 1, s, len);
find_driver_nonempty(label, i + 1, s, len);
return true;
}
@ -34343,8 +34235,6 @@ static void retroarch_deinit_drivers(struct rarch_state *p_rarch)
bool driver_ctl(enum driver_ctl_state state, void *data)
{
struct rarch_state *p_rarch = &rarch_st;
settings_t *settings = p_rarch->configuration_settings;
bool add_null_entries = settings->bools.add_null_drivers;
switch (state)
{
@ -34361,8 +34251,7 @@ bool driver_ctl(enum driver_ctl_state state, void *data)
driver_ctx_info_t *drv = (driver_ctx_info_t*)data;
if (!drv)
return false;
find_driver_nonempty(add_null_entries,
drv->label, 0, drv->s, drv->len);
find_driver_nonempty(drv->label, 0, drv->s, drv->len);
}
break;
case RARCH_DRIVER_CTL_FIND_LAST:
@ -34370,32 +34259,28 @@ bool driver_ctl(enum driver_ctl_state state, void *data)
driver_ctx_info_t *drv = (driver_ctx_info_t*)data;
if (!drv)
return false;
return driver_find_last(add_null_entries,
drv->label, drv->s, drv->len);
return driver_find_last(drv->label, drv->s, drv->len);
}
case RARCH_DRIVER_CTL_FIND_PREV:
{
driver_ctx_info_t *drv = (driver_ctx_info_t*)data;
if (!drv)
return false;
return driver_find_prev(add_null_entries,
drv->label, drv->s, drv->len);
return driver_find_prev(drv->label, drv->s, drv->len);
}
case RARCH_DRIVER_CTL_FIND_NEXT:
{
driver_ctx_info_t *drv = (driver_ctx_info_t*)data;
if (!drv)
return false;
return driver_find_next(add_null_entries,
drv->label, drv->s, drv->len);
return driver_find_next(drv->label, drv->s, drv->len);
}
case RARCH_DRIVER_CTL_FIND_INDEX:
{
driver_ctx_info_t *drv = (driver_ctx_info_t*)data;
if (!drv)
return false;
drv->len = driver_find_index(add_null_entries,
drv->label, drv->s);
drv->len = driver_find_index(drv->label, drv->s);
}
break;
case RARCH_DRIVER_CTL_NONE:
@ -36880,6 +36765,35 @@ bool rarch_ctl(enum rarch_ctl_state state, void *data)
#endif
case RARCH_CTL_IS_DUMMY_CORE:
return (p_rarch->current_core_type == CORE_TYPE_DUMMY);
case RARCH_CTL_IS_CORE_LOADED:
{
const char *core_path = (const char*)data;
const char *core_file = NULL;
const char *loaded_core_path = NULL;
const char *loaded_core_file = NULL;
if (string_is_empty(core_path))
return false;
/* Get core file name */
core_file = path_basename(core_path);
if (string_is_empty(core_file))
return false;
/* Get loaded core file name */
loaded_core_path = path_get(RARCH_PATH_CORE);
if (!string_is_empty(loaded_core_path))
loaded_core_file = path_basename(loaded_core_path);
/* Check whether specified core and currently
* loaded core are the same */
if (!string_is_empty(loaded_core_file) &&
string_is_equal(core_file, loaded_core_file))
return true;
return false;
}
break;
case RARCH_CTL_HAS_SET_USERNAME:
return p_rarch->has_set_username;
case RARCH_CTL_IS_INITED:
@ -39880,7 +39794,7 @@ static bool accessibility_speak_priority(
if (is_accessibility_enabled(p_rarch))
{
frontend_ctx_driver_t *frontend = frontend_get_ptr();
frontend_ctx_driver_t *frontend = p_rarch->current_frontend_ctx;
if (frontend && frontend->accessibility_speak)
{
int speed = settings->uints.accessibility_narrator_speech_speed;
@ -39910,7 +39824,7 @@ static bool is_narrator_running(struct rarch_state *p_rarch)
{
if (is_accessibility_enabled(p_rarch))
{
frontend_ctx_driver_t *frontend = frontend_get_ptr();
frontend_ctx_driver_t *frontend = p_rarch->current_frontend_ctx;
if (frontend && frontend->is_narrator_running)
return frontend->is_narrator_running();
}
@ -40005,3 +39919,319 @@ void menu_content_environment_get(int *argc, char *argv[],
wrap_args->libretro_path = string_is_empty(path_get(RARCH_PATH_CORE)) ? NULL :
path_get(RARCH_PATH_CORE);
}
frontend_ctx_driver_t *frontend_get_ptr(void)
{
struct rarch_state *p_rarch = &rarch_st;
return p_rarch->current_frontend_ctx;
}
int frontend_driver_parse_drive_list(void *data, bool load_content)
{
struct rarch_state *p_rarch = &rarch_st;
frontend_ctx_driver_t *frontend = p_rarch->current_frontend_ctx;
if (!frontend || !frontend->parse_drive_list)
return -1;
return frontend->parse_drive_list(data, load_content);
}
void frontend_driver_content_loaded(void)
{
struct rarch_state *p_rarch = &rarch_st;
frontend_ctx_driver_t *frontend = p_rarch->current_frontend_ctx;
if (!frontend || !frontend->content_loaded)
return;
frontend->content_loaded();
}
bool frontend_driver_has_fork(void)
{
struct rarch_state *p_rarch = &rarch_st;
frontend_ctx_driver_t *frontend = p_rarch->current_frontend_ctx;
if (!frontend || !frontend->set_fork)
return false;
return true;
}
bool frontend_driver_set_fork(enum frontend_fork fork_mode)
{
struct rarch_state *p_rarch = &rarch_st;
frontend_ctx_driver_t *frontend = p_rarch->current_frontend_ctx;
if (!frontend_driver_has_fork())
return false;
return frontend->set_fork(fork_mode);
}
void frontend_driver_process_args(int *argc, char *argv[])
{
struct rarch_state *p_rarch = &rarch_st;
frontend_ctx_driver_t *frontend = p_rarch->current_frontend_ctx;
if (!frontend || !frontend->process_args)
return;
frontend->process_args(argc, argv);
}
bool frontend_driver_is_inited(void)
{
struct rarch_state *p_rarch = &rarch_st;
frontend_ctx_driver_t *frontend = p_rarch->current_frontend_ctx;
if (!frontend)
return false;
return true;
}
void frontend_driver_init_first(void *args)
{
struct rarch_state *p_rarch = &rarch_st;
p_rarch->current_frontend_ctx = (frontend_ctx_driver_t*)
frontend_ctx_init_first();
if (p_rarch->current_frontend_ctx && p_rarch->current_frontend_ctx->init)
p_rarch->current_frontend_ctx->init(args);
}
void frontend_driver_free(void)
{
struct rarch_state *p_rarch = &rarch_st;
if (p_rarch)
p_rarch->current_frontend_ctx = NULL;
}
environment_get_t frontend_driver_environment_get_ptr(void)
{
struct rarch_state *p_rarch = &rarch_st;
frontend_ctx_driver_t *frontend = p_rarch->current_frontend_ctx;
if (!frontend)
return NULL;
return frontend->environment_get;
}
bool frontend_driver_has_get_video_driver_func(void)
{
struct rarch_state *p_rarch = &rarch_st;
frontend_ctx_driver_t *frontend = p_rarch->current_frontend_ctx;
if (!frontend || !frontend->get_video_driver)
return false;
return true;
}
const struct video_driver *frontend_driver_get_video_driver(void)
{
struct rarch_state *p_rarch = &rarch_st;
frontend_ctx_driver_t *frontend = p_rarch->current_frontend_ctx;
if (!frontend || !frontend->get_video_driver)
return NULL;
return frontend->get_video_driver();
}
void frontend_driver_exitspawn(char *s, size_t len, char *args)
{
struct rarch_state *p_rarch = &rarch_st;
frontend_ctx_driver_t *frontend = p_rarch->current_frontend_ctx;
if (!frontend || !frontend->exitspawn)
return;
frontend->exitspawn(s, len, args);
}
void frontend_driver_deinit(void *args)
{
struct rarch_state *p_rarch = &rarch_st;
frontend_ctx_driver_t *frontend = p_rarch->current_frontend_ctx;
if (!frontend || !frontend->deinit)
return;
frontend->deinit(args);
}
void frontend_driver_shutdown(bool a)
{
struct rarch_state *p_rarch = &rarch_st;
frontend_ctx_driver_t *frontend = p_rarch->current_frontend_ctx;
if (!frontend || !frontend->shutdown)
return;
frontend->shutdown(a);
}
enum frontend_architecture frontend_driver_get_cpu_architecture(void)
{
struct rarch_state *p_rarch = &rarch_st;
frontend_ctx_driver_t *frontend = p_rarch->current_frontend_ctx;
if (!frontend || !frontend->get_architecture)
return FRONTEND_ARCH_NONE;
return frontend->get_architecture();
}
const void *frontend_driver_get_cpu_architecture_str(
char *architecture, size_t size)
{
struct rarch_state *p_rarch = &rarch_st;
frontend_ctx_driver_t *frontend = p_rarch->current_frontend_ctx;
enum frontend_architecture arch = frontend_driver_get_cpu_architecture();
switch (arch)
{
case FRONTEND_ARCH_X86:
strlcpy(architecture, "x86", size);
break;
case FRONTEND_ARCH_X86_64:
strlcpy(architecture, "x64", size);
break;
case FRONTEND_ARCH_PPC:
strlcpy(architecture, "PPC", size);
break;
case FRONTEND_ARCH_ARM:
strlcpy(architecture, "ARM", size);
break;
case FRONTEND_ARCH_ARMV7:
strlcpy(architecture, "ARMv7", size);
break;
case FRONTEND_ARCH_ARMV8:
strlcpy(architecture, "ARMv8", size);
break;
case FRONTEND_ARCH_MIPS:
strlcpy(architecture, "MIPS", size);
break;
case FRONTEND_ARCH_TILE:
strlcpy(architecture, "Tilera", size);
break;
case FRONTEND_ARCH_NONE:
default:
strlcpy(architecture, "N/A", size);
break;
}
return frontend;
}
uint64_t frontend_driver_get_total_memory(void)
{
struct rarch_state *p_rarch = &rarch_st;
frontend_ctx_driver_t *frontend = p_rarch->current_frontend_ctx;
if (!frontend || !frontend->get_total_mem)
return 0;
return frontend->get_total_mem();
}
uint64_t frontend_driver_get_free_memory(void)
{
struct rarch_state *p_rarch = &rarch_st;
frontend_ctx_driver_t *frontend = p_rarch->current_frontend_ctx;
if (!frontend || !frontend->get_free_mem)
return 0;
return frontend->get_free_mem();
}
void frontend_driver_install_signal_handler(void)
{
struct rarch_state *p_rarch = &rarch_st;
frontend_ctx_driver_t *frontend = p_rarch->current_frontend_ctx;
if (!frontend || !frontend->install_signal_handler)
return;
frontend->install_signal_handler();
}
int frontend_driver_get_signal_handler_state(void)
{
struct rarch_state *p_rarch = &rarch_st;
frontend_ctx_driver_t *frontend = p_rarch->current_frontend_ctx;
if (!frontend || !frontend->get_signal_handler_state)
return -1;
return frontend->get_signal_handler_state();
}
void frontend_driver_set_signal_handler_state(int value)
{
struct rarch_state *p_rarch = &rarch_st;
frontend_ctx_driver_t *frontend = p_rarch->current_frontend_ctx;
if (!frontend || !frontend->set_signal_handler_state)
return;
frontend->set_signal_handler_state(value);
}
void frontend_driver_attach_console(void)
{
struct rarch_state *p_rarch = &rarch_st;
frontend_ctx_driver_t *frontend = p_rarch->current_frontend_ctx;
if (!frontend || !frontend->attach_console)
return;
frontend->attach_console();
}
void frontend_driver_detach_console(void)
{
struct rarch_state *p_rarch = &rarch_st;
frontend_ctx_driver_t *frontend = p_rarch->current_frontend_ctx;
if (!frontend || !frontend->detach_console)
return;
frontend->detach_console();
}
void frontend_driver_destroy_signal_handler_state(void)
{
struct rarch_state *p_rarch = &rarch_st;
frontend_ctx_driver_t *frontend = p_rarch->current_frontend_ctx;
if (!frontend || !frontend->destroy_signal_handler_state)
return;
frontend->destroy_signal_handler_state();
}
bool frontend_driver_can_watch_for_changes(void)
{
struct rarch_state *p_rarch = &rarch_st;
frontend_ctx_driver_t *frontend = p_rarch->current_frontend_ctx;
if (!frontend || !frontend->watch_path_for_changes)
return false;
return true;
}
void frontend_driver_watch_path_for_changes(
struct string_list *list, int flags,
path_change_data_t **change_data)
{
struct rarch_state *p_rarch = &rarch_st;
frontend_ctx_driver_t *frontend = p_rarch->current_frontend_ctx;
if (!frontend || !frontend->watch_path_for_changes)
return;
frontend->watch_path_for_changes(list, flags, change_data);
}
bool frontend_driver_check_for_path_changes(path_change_data_t *change_data)
{
struct rarch_state *p_rarch = &rarch_st;
frontend_ctx_driver_t *frontend = p_rarch->current_frontend_ctx;
if (!frontend || !frontend->check_for_path_changes)
return false;
return frontend->check_for_path_changes(change_data);
}
void frontend_driver_set_sustained_performance_mode(bool on)
{
struct rarch_state *p_rarch = &rarch_st;
frontend_ctx_driver_t *frontend = p_rarch->current_frontend_ctx;
if (!frontend || !frontend->set_sustained_performance_mode)
return;
frontend->set_sustained_performance_mode(on);
}
const char* frontend_driver_get_cpu_model_name(void)
{
struct rarch_state *p_rarch = &rarch_st;
frontend_ctx_driver_t *frontend = p_rarch->current_frontend_ctx;
if (!frontend || !frontend->get_cpu_model_name)
return NULL;
return frontend->get_cpu_model_name();
}
enum retro_language frontend_driver_get_user_language(void)
{
struct rarch_state *p_rarch = &rarch_st;
frontend_ctx_driver_t *frontend = p_rarch->current_frontend_ctx;
if (!frontend || !frontend->get_user_language)
return RETRO_LANGUAGE_ENGLISH;
return frontend->get_user_language();
}

View File

@ -31,6 +31,7 @@
#include "config.h"
#endif
#include <lists/string_list.h>
#include <queues/task_queue.h>
#include <queues/message_queue.h>
#ifdef HAVE_AUDIOMIXER
@ -88,6 +89,7 @@ enum rarch_ctl_state
RARCH_CTL_IS_INITED,
RARCH_CTL_IS_DUMMY_CORE,
RARCH_CTL_IS_CORE_LOADED,
RARCH_CTL_IS_BPS_PREF,
RARCH_CTL_UNSET_BPS_PREF,
@ -291,6 +293,27 @@ typedef struct global
#endif
} global_t;
typedef struct content_state
{
bool is_inited;
bool core_does_not_need_content;
bool pending_subsystem_init;
bool pending_rom_crc;
int pending_subsystem_rom_num;
int pending_subsystem_id;
unsigned pending_subsystem_rom_id;
uint32_t rom_crc;
char companion_ui_crc32[32];
char pending_subsystem_ident[255];
char pending_rom_crc_path[PATH_MAX_LENGTH];
char companion_ui_db_name[PATH_MAX_LENGTH];
char *pending_subsystem_roms[RARCH_MAX_SUBSYSTEM_ROMS];
struct string_list *temporary_content;
} content_state_t;
bool rarch_ctl(enum rarch_ctl_state state, void *data);
int retroarch_get_capabilities(enum rarch_capabilities type,
@ -329,6 +352,12 @@ bool retroarch_main_quit(void);
global_t *global_get_ptr(void);
content_state_t *content_state_get_ptr(void);
unsigned content_get_subsystem_rom_id(void);
int content_get_subsystem(void);
/**
* runloop_iterate:
*

View File

@ -185,29 +185,6 @@ struct content_information_ctx
struct string_list *temporary_content;
};
typedef struct content_state
{
bool is_inited;
bool core_does_not_need_content;
bool pending_subsystem_init;
bool pending_rom_crc;
int pending_subsystem_rom_num;
int pending_subsystem_id;
unsigned pending_subsystem_rom_id;
uint32_t rom_crc;
char companion_ui_crc32[32];
char pending_subsystem_ident[255];
char pending_rom_crc_path[PATH_MAX_LENGTH];
char companion_ui_db_name[PATH_MAX_LENGTH];
char *pending_subsystem_roms[RARCH_MAX_SUBSYSTEM_ROMS];
struct string_list *temporary_content;
} content_state_t;
static content_state_t content_st;
#ifdef HAVE_CDROM
static void task_cdrom_dump_handler(retro_task_t *task)
{
@ -1445,7 +1422,6 @@ static bool command_event_cmd_exec(
content_info.argc = 0;
content_info.argv = NULL;
content_info.args = NULL;
content_info.environ_get = NULL;
content_info.environ_get = menu_content_environment_get;
#endif
@ -1530,7 +1506,7 @@ static bool firmware_update_status(
bool task_push_start_dummy_core(content_ctx_info_t *content_info)
{
content_information_ctx_t content_ctx;
content_state_t *p_content = (content_state_t*)&content_st;
content_state_t *p_content = content_state_get_ptr();
bool ret = true;
char *error_string = NULL;
global_t *global = global_get_ptr();
@ -1628,13 +1604,16 @@ bool task_push_load_content_from_playlist_from_menu(
{
content_information_ctx_t content_ctx;
content_state_t *p_content = (content_state_t*)&content_st;
content_state_t *p_content = content_state_get_ptr();
bool ret = true;
char *error_string = NULL;
global_t *global = global_get_ptr();
settings_t *settings = config_get_ptr();
rarch_system_info_t *sys_info = runloop_get_system_info();
const char *path_dir_system = settings->paths.directory_system;
#ifndef HAVE_DYNAMIC
bool force_core_reload = settings->bools.always_reload_core_on_run_content;
#endif
content_ctx.check_firmware_before_loading = settings->bools.check_firmware_before_loading;
#ifdef HAVE_PATCH
@ -1674,19 +1653,73 @@ bool task_push_load_content_from_playlist_from_menu(
if (!string_is_empty(path_dir_system))
content_ctx.directory_system = strdup(path_dir_system);
path_set(RARCH_PATH_CORE, core_path);
/* Is content required by this core? */
if (fullpath)
sys_info->load_no_content = false;
else
sys_info->load_no_content = true;
/* On targets that have no dynamic core loading support, we'd
* execute the new core from this point. If this returns false,
* we assume we can dynamically load the core. */
if (!command_event_cmd_exec(p_content,
fullpath, &content_ctx, CONTENT_MODE_LOAD_NONE, &error_string))
#ifndef HAVE_DYNAMIC
/* Check whether specified core is already loaded
* > If so, content can be launched directly with
* the currently loaded core */
if (!force_core_reload &&
rarch_ctl(RARCH_CTL_IS_CORE_LOADED, (void*)core_path))
{
if (!content_info->environ_get)
content_info->environ_get = menu_content_environment_get;
/* Register content path */
path_clear(RARCH_PATH_CONTENT);
if (!string_is_empty(fullpath))
path_set(RARCH_PATH_CONTENT, fullpath);
/* Load content */
ret = content_load(content_info, p_content);
if (!ret)
goto end;
/* Update content history */
task_push_to_history_list(p_content, true, false, false);
goto end;
}
#endif
/* Specified core is not loaded
* > Load it */
path_set(RARCH_PATH_CORE, core_path);
#ifdef HAVE_DYNAMIC
command_event(CMD_EVENT_LOAD_CORE, NULL);
#endif
/* Load content
* > On targets that do not support dynamic core loading,
* command_event_cmd_exec() will fork a new instance */
ret = command_event_cmd_exec(p_content,
fullpath, &content_ctx, false, &error_string);
if (!ret)
goto end;
#ifdef HAVE_COCOATOUCH
/* This seems to be needed for iOS for some reason
* to show the quick menu after the menu is shown */
menu_driver_ctl(RARCH_MENU_CTL_SET_PENDING_QUICK_MENU, NULL);
#endif
#ifndef HAVE_DYNAMIC
/* No dynamic core loading support: if we reach
* this point then a new instance has been
* forked - have to shut down this one */
rarch_ctl(RARCH_CTL_SET_SHUTDOWN, NULL);
retroarch_menu_running_finished(true);
#endif
end:
/* Handle load content failure */
if (!ret)
{
if (error_string)
{
@ -1696,25 +1729,8 @@ bool task_push_load_content_from_playlist_from_menu(
}
retroarch_menu_running();
ret = false;
goto end;
}
/* Load core */
#ifdef HAVE_DYNAMIC
command_event(CMD_EVENT_LOAD_CORE, NULL);
#ifdef HAVE_COCOATOUCH
/* This seems to be needed for iOS for some reason to show the
* quick menu after the menu is shown */
menu_driver_ctl(RARCH_MENU_CTL_SET_PENDING_QUICK_MENU, NULL);
#endif
#else
rarch_ctl(RARCH_CTL_SET_SHUTDOWN, NULL);
retroarch_menu_running_finished(true);
#endif
end:
if (content_ctx.name_ips)
free(content_ctx.name_ips);
if (content_ctx.name_bps)
@ -1732,8 +1748,7 @@ bool task_push_start_current_core(content_ctx_info_t *content_info)
{
content_information_ctx_t content_ctx;
content_state_t *p_content = (content_state_t*)&content_st;
content_state_t *p_content = content_state_get_ptr();
bool ret = true;
char *error_string = NULL;
global_t *global = global_get_ptr();
@ -1865,14 +1880,26 @@ bool task_push_load_content_with_new_core_from_menu(
{
content_information_ctx_t content_ctx;
content_state_t *p_content = (content_state_t*)&content_st;
content_state_t *p_content = content_state_get_ptr();
bool ret = true;
char *error_string = NULL;
global_t *global = global_get_ptr();
settings_t *settings = config_get_ptr();
bool check_firmware_before_loading = settings->bools.check_firmware_before_loading;
const char *path_dir_system = settings->paths.directory_system;
#ifndef HAVE_DYNAMIC
bool force_core_reload = settings->bools.always_reload_core_on_run_content;
/* Check whether specified core is already loaded
* > If so, we can skip loading the core and
* just load the content directly */
if (!force_core_reload &&
(type == CORE_TYPE_PLAIN) &&
rarch_ctl(RARCH_CTL_IS_CORE_LOADED, (void*)core_path))
return task_push_load_content_with_core_from_menu(
fullpath, content_info,
type, cb, user_data);
#endif
content_ctx.check_firmware_before_loading = check_firmware_before_loading;
#ifdef HAVE_PATCH
@ -1976,8 +2003,7 @@ static bool task_load_content_internal(
{
content_information_ctx_t content_ctx;
content_state_t *p_content = (content_state_t*)&content_st;
content_state_t *p_content = content_state_get_ptr();
bool ret = false;
char *error_string = NULL;
global_t *global = global_get_ptr();
@ -2104,7 +2130,7 @@ bool task_push_load_content_with_new_core_from_companion_ui(
void *user_data)
{
global_t *global = global_get_ptr();
content_state_t *p_content = (content_state_t*)&content_st;
content_state_t *p_content = content_state_get_ptr();
path_set(RARCH_PATH_CONTENT, fullpath);
path_set(RARCH_PATH_CORE, core_path);
@ -2196,7 +2222,7 @@ bool task_push_load_content_with_current_core_from_companion_ui(
retro_task_callback_t cb,
void *user_data)
{
content_state_t *p_content = (content_state_t*)&content_st;
content_state_t *p_content = content_state_get_ptr();
path_set(RARCH_PATH_CONTENT, fullpath);
@ -2253,7 +2279,7 @@ bool task_push_load_subsystem_with_core_from_menu(
retro_task_callback_t cb,
void *user_data)
{
content_state_t *p_content = (content_state_t*)&content_st;
content_state_t *p_content = content_state_get_ptr();
p_content->pending_subsystem_init = true;
@ -2277,7 +2303,7 @@ void content_get_status(
bool *contentless,
bool *is_inited)
{
content_state_t *p_content = (content_state_t*)&content_st;
content_state_t *p_content = content_state_get_ptr();
*contentless = p_content->core_does_not_need_content;
*is_inited = p_content->is_inited;
@ -2287,7 +2313,7 @@ void content_get_status(
void content_clear_subsystem(void)
{
unsigned i;
content_state_t *p_content = (content_state_t*)&content_st;
content_state_t *p_content = content_state_get_ptr();
p_content->pending_subsystem_rom_id = 0;
p_content->pending_subsystem_init = false;
@ -2302,19 +2328,12 @@ void content_clear_subsystem(void)
}
}
/* Get the current subsystem */
int content_get_subsystem(void)
{
content_state_t *p_content = (content_state_t*)&content_st;
return p_content->pending_subsystem_id;
}
/* Set the current subsystem*/
void content_set_subsystem(unsigned idx)
{
const struct retro_subsystem_info *subsystem;
rarch_system_info_t *system = runloop_get_system_info();
content_state_t *p_content = (content_state_t*)&content_st;
content_state_t *p_content = content_state_get_ptr();
/* Core fully loaded, use the subsystem data */
if (system->subsystem.data)
@ -2393,7 +2412,7 @@ void content_get_subsystem_friendly_name(const char* subsystem_name, char* subsy
/* Add a rom to the subsystem rom buffer */
void content_add_subsystem(const char* path)
{
content_state_t *p_content = (content_state_t*)&content_st;
content_state_t *p_content = content_state_get_ptr();
size_t pending_size = PATH_MAX_LENGTH * sizeof(char);
p_content->pending_subsystem_roms[p_content->pending_subsystem_rom_id] = (char*)malloc(pending_size);
@ -2410,28 +2429,21 @@ void content_add_subsystem(const char* path)
p_content->pending_subsystem_rom_id++;
}
/* Get the current subsystem rom id */
unsigned content_get_subsystem_rom_id(void)
{
content_state_t *p_content = (content_state_t*)&content_st;
return p_content->pending_subsystem_rom_id;
}
void content_set_does_not_need_content(void)
{
content_state_t *p_content = (content_state_t*)&content_st;
content_state_t *p_content = content_state_get_ptr();
p_content->core_does_not_need_content = true;
}
void content_unset_does_not_need_content(void)
{
content_state_t *p_content = (content_state_t*)&content_st;
content_state_t *p_content = content_state_get_ptr();
p_content->core_does_not_need_content = false;
}
uint32_t content_get_crc(void)
{
content_state_t *p_content = (content_state_t*)&content_st;
content_state_t *p_content = content_state_get_ptr();
if (p_content->pending_rom_crc)
{
p_content->pending_rom_crc = false;
@ -2444,20 +2456,20 @@ uint32_t content_get_crc(void)
char* content_get_subsystem_rom(unsigned index)
{
content_state_t *p_content = (content_state_t*)&content_st;
content_state_t *p_content = content_state_get_ptr();
return p_content->pending_subsystem_roms[index];
}
bool content_is_inited(void)
{
content_state_t *p_content = (content_state_t*)&content_st;
content_state_t *p_content = content_state_get_ptr();
return p_content->is_inited;
}
void content_deinit(void)
{
unsigned i;
content_state_t *p_content = (content_state_t*)&content_st;
content_state_t *p_content = content_state_get_ptr();
if (p_content->temporary_content)
{
@ -2485,7 +2497,7 @@ void content_deinit(void)
/* Set environment variables before a subsystem load */
void content_set_subsystem_info(void)
{
content_state_t *p_content = (content_state_t*)&content_st;
content_state_t *p_content = content_state_get_ptr();
if (!p_content->pending_subsystem_init)
return;
@ -2499,7 +2511,7 @@ void content_set_subsystem_info(void)
bool content_init(void)
{
content_information_ctx_t content_ctx;
content_state_t *p_content = (content_state_t*)&content_st;
content_state_t *p_content = content_state_get_ptr();
bool ret = true;
char *error_string = NULL;

View File

@ -138,6 +138,7 @@ static void free_core_backup_handle(core_backup_handle_t *backup_handle)
/* Forward declarations, required for task_core_backup_finder() */
static void task_core_backup_handler(retro_task_t *task);
static void task_core_restore_handler(retro_task_t *task);
static bool task_core_backup_finder(retro_task_t *task, void *user_data)
@ -645,41 +646,6 @@ error:
/* Core Restore */
/****************/
/* Unloads core if it is currently loaded
* > Returns true if core was unloaded */
static bool task_core_restore_unload_core(const char *core_path)
{
const char *core_filename = NULL;
const char *loaded_core_path = NULL;
const char *loaded_core_filename = NULL;
if (string_is_empty(core_path))
return false;
/* Get core file name */
core_filename = path_basename(core_path);
if (string_is_empty(core_filename))
return false;
/* Get loaded core file name */
loaded_core_path = path_get(RARCH_PATH_CORE);
if (string_is_empty(loaded_core_path))
return false;
loaded_core_filename = path_basename(loaded_core_path);
if (string_is_empty(loaded_core_filename))
return false;
/* Check if whether file names match */
if (string_is_equal(core_filename, loaded_core_filename))
{
command_event(CMD_EVENT_UNLOAD_CORE, NULL);
return true;
}
return false;
}
static void cb_task_core_restore(
retro_task_t *task, void *task_data,
void *user_data, const char *err)
@ -1085,7 +1051,13 @@ bool task_push_core_restore(const char *backup_path, const char *dir_libretro,
/* If core to be restored is currently loaded, must
* unload it before pushing the task */
*core_loaded = task_core_restore_unload_core(core_path);
if (rarch_ctl(RARCH_CTL_IS_CORE_LOADED, (void*)core_path))
{
command_event(CMD_EVENT_UNLOAD_CORE, NULL);
*core_loaded = true;
}
else
*core_loaded = false;
/* Push task */
task_queue_push(task);

View File

@ -74,6 +74,18 @@ enum core_updater_download_status
CORE_UPDATER_DOWNLOAD_END
};
/* Update installed cores */
enum update_installed_cores_status
{
UPDATE_INSTALLED_CORES_BEGIN = 0,
UPDATE_INSTALLED_CORES_WAIT_LIST,
UPDATE_INSTALLED_CORES_ITERATE,
UPDATE_INSTALLED_CORES_UPDATE_CORE,
UPDATE_INSTALLED_CORES_WAIT_DOWNLOAD,
UPDATE_INSTALLED_CORES_END
};
typedef struct core_updater_download_handle
{
bool auto_backup;
@ -99,17 +111,6 @@ typedef struct core_updater_download_handle
enum core_updater_download_status status;
} core_updater_download_handle_t;
/* Update installed cores */
enum update_installed_cores_status
{
UPDATE_INSTALLED_CORES_BEGIN = 0,
UPDATE_INSTALLED_CORES_WAIT_LIST,
UPDATE_INSTALLED_CORES_ITERATE,
UPDATE_INSTALLED_CORES_UPDATE_CORE,
UPDATE_INSTALLED_CORES_WAIT_DOWNLOAD,
UPDATE_INSTALLED_CORES_END
};
typedef struct update_installed_cores_handle
{
bool auto_backup;

View File

@ -657,6 +657,12 @@ void ShaderParamsDialog::onShaderAddPassClicked()
if (path.isEmpty())
return;
/* Qt uses '/' as a directory separator regardless
* of host platform. Have to convert to native separators,
* or video_shader_resolve_parameters() will fail on
* non-Linux platforms */
path = QDir::toNativeSeparators(path);
pathArray = path.toUtf8();
pathData = pathArray.constData();