Go through global_get_ptr
This commit is contained in:
parent
3d140cdb36
commit
e6f0d366cb
|
@ -97,6 +97,7 @@ static void compute_audio_buffer_statistics(void)
|
|||
unsigned low_water_count = 0, high_water_count = 0;
|
||||
unsigned samples = 0;
|
||||
runloop_t *runloop = rarch_main_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
samples = min(runloop->measure_data.buffer_free_samples_count,
|
||||
AUDIO_BUFFER_FREE_SAMPLES_COUNT);
|
||||
|
@ -116,11 +117,11 @@ static void compute_audio_buffer_statistics(void)
|
|||
}
|
||||
|
||||
stddev = (unsigned)sqrt((double)accum_var / (samples - 2));
|
||||
avg_filled = 1.0f - (float)avg / g_extern.audio_data.driver_buffer_size;
|
||||
deviation = (float)stddev / g_extern.audio_data.driver_buffer_size;
|
||||
avg_filled = 1.0f - (float)avg / global->audio_data.driver_buffer_size;
|
||||
deviation = (float)stddev / global->audio_data.driver_buffer_size;
|
||||
|
||||
low_water_size = g_extern.audio_data.driver_buffer_size * 3 / 4;
|
||||
high_water_size = g_extern.audio_data.driver_buffer_size / 4;
|
||||
low_water_size = global->audio_data.driver_buffer_size * 3 / 4;
|
||||
high_water_size = global->audio_data.driver_buffer_size / 4;
|
||||
|
||||
for (i = 1; i < samples; i++)
|
||||
{
|
||||
|
@ -240,17 +241,18 @@ void find_audio_driver(void)
|
|||
void uninit_audio(void)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
if (driver->audio_data && driver->audio)
|
||||
driver->audio->free(driver->audio_data);
|
||||
|
||||
free(g_extern.audio_data.conv_outsamples);
|
||||
g_extern.audio_data.conv_outsamples = NULL;
|
||||
g_extern.audio_data.data_ptr = 0;
|
||||
free(global->audio_data.conv_outsamples);
|
||||
global->audio_data.conv_outsamples = NULL;
|
||||
global->audio_data.data_ptr = 0;
|
||||
|
||||
free(g_extern.audio_data.rewind_buf);
|
||||
g_extern.audio_data.rewind_buf = NULL;
|
||||
free(global->audio_data.rewind_buf);
|
||||
global->audio_data.rewind_buf = NULL;
|
||||
|
||||
if (!settings->audio.enable)
|
||||
{
|
||||
|
@ -261,11 +263,11 @@ void uninit_audio(void)
|
|||
rarch_resampler_freep(&driver->resampler,
|
||||
&driver->resampler_data);
|
||||
|
||||
free(g_extern.audio_data.data);
|
||||
g_extern.audio_data.data = NULL;
|
||||
free(global->audio_data.data);
|
||||
global->audio_data.data = NULL;
|
||||
|
||||
free(g_extern.audio_data.outsamples);
|
||||
g_extern.audio_data.outsamples = NULL;
|
||||
free(global->audio_data.outsamples);
|
||||
global->audio_data.outsamples = NULL;
|
||||
|
||||
rarch_main_command(RARCH_CMD_DSP_FILTER_DEINIT);
|
||||
|
||||
|
@ -277,6 +279,7 @@ void init_audio(void)
|
|||
size_t outsamples_max, max_bufsamples = AUDIO_CHUNK_SIZE_NONBLOCKING * 2;
|
||||
runloop_t *runloop = rarch_main_get_ptr();
|
||||
driver_t *driver = driver_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
audio_convert_init_simd();
|
||||
|
@ -290,19 +293,25 @@ void init_audio(void)
|
|||
settings->slowmotion_ratio;
|
||||
|
||||
/* Used for recording even if audio isn't enabled. */
|
||||
rarch_assert(g_extern.audio_data.conv_outsamples =
|
||||
rarch_assert(global->audio_data.conv_outsamples =
|
||||
(int16_t*)malloc(outsamples_max * sizeof(int16_t)));
|
||||
|
||||
g_extern.audio_data.block_chunk_size = AUDIO_CHUNK_SIZE_BLOCKING;
|
||||
g_extern.audio_data.nonblock_chunk_size = AUDIO_CHUNK_SIZE_NONBLOCKING;
|
||||
g_extern.audio_data.chunk_size =
|
||||
g_extern.audio_data.block_chunk_size;
|
||||
if (!global->audio_data.conv_outsamples)
|
||||
goto error;
|
||||
|
||||
global->audio_data.block_chunk_size = AUDIO_CHUNK_SIZE_BLOCKING;
|
||||
global->audio_data.nonblock_chunk_size = AUDIO_CHUNK_SIZE_NONBLOCKING;
|
||||
global->audio_data.chunk_size = global->audio_data.block_chunk_size;
|
||||
|
||||
/* Needs to be able to hold full content of a full max_bufsamples
|
||||
* in addition to its own. */
|
||||
rarch_assert(g_extern.audio_data.rewind_buf = (int16_t*)
|
||||
rarch_assert(global->audio_data.rewind_buf = (int16_t*)
|
||||
malloc(max_bufsamples * sizeof(int16_t)));
|
||||
g_extern.audio_data.rewind_size = max_bufsamples;
|
||||
|
||||
if (!global->audio_data.rewind_buf)
|
||||
goto error;
|
||||
|
||||
global->audio_data.rewind_size = max_bufsamples;
|
||||
|
||||
if (!settings->audio.enable)
|
||||
{
|
||||
|
@ -312,7 +321,7 @@ void init_audio(void)
|
|||
|
||||
find_audio_driver();
|
||||
#ifdef HAVE_THREADS
|
||||
if (g_extern.system.audio_callback.callback)
|
||||
if (global->system.audio_callback.callback)
|
||||
{
|
||||
RARCH_LOG("Starting threaded audio driver ...\n");
|
||||
if (!rarch_threaded_audio_init(&driver->audio, &driver->audio_data,
|
||||
|
@ -338,57 +347,63 @@ void init_audio(void)
|
|||
driver->audio_active = false;
|
||||
}
|
||||
|
||||
g_extern.audio_data.use_float = false;
|
||||
global->audio_data.use_float = false;
|
||||
if (driver->audio_active && driver->audio->use_float(driver->audio_data))
|
||||
g_extern.audio_data.use_float = true;
|
||||
global->audio_data.use_float = true;
|
||||
|
||||
if (!settings->audio.sync && driver->audio_active)
|
||||
{
|
||||
rarch_main_command(RARCH_CMD_AUDIO_SET_NONBLOCKING_STATE);
|
||||
g_extern.audio_data.chunk_size =
|
||||
g_extern.audio_data.nonblock_chunk_size;
|
||||
global->audio_data.chunk_size =
|
||||
global->audio_data.nonblock_chunk_size;
|
||||
}
|
||||
|
||||
if (g_extern.audio_data.in_rate <= 0.0f)
|
||||
if (global->audio_data.in_rate <= 0.0f)
|
||||
{
|
||||
/* Should never happen. */
|
||||
RARCH_WARN("Input rate is invalid (%.3f Hz). Using output rate (%u Hz).\n",
|
||||
g_extern.audio_data.in_rate, settings->audio.out_rate);
|
||||
g_extern.audio_data.in_rate = settings->audio.out_rate;
|
||||
global->audio_data.in_rate, settings->audio.out_rate);
|
||||
global->audio_data.in_rate = settings->audio.out_rate;
|
||||
}
|
||||
|
||||
g_extern.audio_data.orig_src_ratio =
|
||||
g_extern.audio_data.src_ratio =
|
||||
(double)settings->audio.out_rate / g_extern.audio_data.in_rate;
|
||||
global->audio_data.orig_src_ratio =
|
||||
global->audio_data.src_ratio =
|
||||
(double)settings->audio.out_rate / global->audio_data.in_rate;
|
||||
|
||||
if (!rarch_resampler_realloc(&driver->resampler_data,
|
||||
&driver->resampler,
|
||||
settings->audio.resampler, g_extern.audio_data.orig_src_ratio))
|
||||
settings->audio.resampler, global->audio_data.orig_src_ratio))
|
||||
{
|
||||
RARCH_ERR("Failed to initialize resampler \"%s\".\n",
|
||||
settings->audio.resampler);
|
||||
driver->audio_active = false;
|
||||
}
|
||||
|
||||
rarch_assert(g_extern.audio_data.data = (float*)
|
||||
rarch_assert(global->audio_data.data = (float*)
|
||||
malloc(max_bufsamples * sizeof(float)));
|
||||
|
||||
g_extern.audio_data.data_ptr = 0;
|
||||
if (!global->audio_data.data)
|
||||
goto error;
|
||||
|
||||
global->audio_data.data_ptr = 0;
|
||||
|
||||
rarch_assert(settings->audio.out_rate <
|
||||
g_extern.audio_data.in_rate * AUDIO_MAX_RATIO);
|
||||
rarch_assert(g_extern.audio_data.outsamples = (float*)
|
||||
global->audio_data.in_rate * AUDIO_MAX_RATIO);
|
||||
rarch_assert(global->audio_data.outsamples = (float*)
|
||||
malloc(outsamples_max * sizeof(float)));
|
||||
|
||||
g_extern.audio_data.rate_control = false;
|
||||
if (!g_extern.system.audio_callback.callback && driver->audio_active &&
|
||||
if (!global->audio_data.outsamples)
|
||||
goto error;
|
||||
|
||||
global->audio_data.rate_control = false;
|
||||
if (!global->system.audio_callback.callback && driver->audio_active &&
|
||||
settings->audio.rate_control)
|
||||
{
|
||||
if (driver->audio->buffer_size && driver->audio->write_avail)
|
||||
{
|
||||
g_extern.audio_data.driver_buffer_size =
|
||||
global->audio_data.driver_buffer_size =
|
||||
driver->audio->buffer_size(driver->audio_data);
|
||||
g_extern.audio_data.rate_control = true;
|
||||
global->audio_data.rate_control = true;
|
||||
}
|
||||
else
|
||||
RARCH_WARN("Audio rate control was desired, but driver does not support needed features.\n");
|
||||
|
@ -399,11 +414,27 @@ void init_audio(void)
|
|||
runloop->measure_data.buffer_free_samples_count = 0;
|
||||
|
||||
if (driver->audio_active && !settings->audio.mute_enable &&
|
||||
g_extern.system.audio_callback.callback)
|
||||
global->system.audio_callback.callback)
|
||||
{
|
||||
/* Threaded driver is initially stopped. */
|
||||
driver->audio->start(driver->audio_data);
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
error:
|
||||
if (global->audio_data.conv_outsamples)
|
||||
free(global->audio_data.conv_outsamples);
|
||||
global->audio_data.conv_outsamples = NULL;
|
||||
if (global->audio_data.data)
|
||||
free(global->audio_data.data);
|
||||
global->audio_data.data = NULL;
|
||||
if (global->audio_data.rewind_buf)
|
||||
free(global->audio_data.rewind_buf);
|
||||
global->audio_data.rewind_buf = NULL;
|
||||
if (global->audio_data.outsamples)
|
||||
free(global->audio_data.outsamples);
|
||||
global->audio_data.outsamples = NULL;
|
||||
}
|
||||
|
||||
bool audio_driver_mute_toggle(void)
|
||||
|
@ -440,27 +471,28 @@ void audio_driver_readjust_input_rate(void)
|
|||
int avail = 0;
|
||||
runloop_t *runloop = rarch_main_get_ptr();
|
||||
driver_t *driver = driver_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
avail = driver->audio->write_avail(driver->audio_data);
|
||||
|
||||
#if 0
|
||||
RARCH_LOG_OUTPUT("Audio buffer is %u%% full\n",
|
||||
(unsigned)(100 - (avail * 100) / g_extern.audio_data.driver_buffer_size));
|
||||
(unsigned)(100 - (avail * 100) / global->audio_data.driver_buffer_size));
|
||||
#endif
|
||||
|
||||
write_idx = runloop->measure_data.buffer_free_samples_count++ &
|
||||
(AUDIO_BUFFER_FREE_SAMPLES_COUNT - 1);
|
||||
half_size = g_extern.audio_data.driver_buffer_size / 2;
|
||||
half_size = global->audio_data.driver_buffer_size / 2;
|
||||
delta_mid = avail - half_size;
|
||||
direction = (double)delta_mid / half_size;
|
||||
adjust = 1.0 + settings->audio.rate_control_delta * direction;
|
||||
|
||||
runloop->measure_data.buffer_free_samples[write_idx] = avail;
|
||||
g_extern.audio_data.src_ratio = g_extern.audio_data.orig_src_ratio * adjust;
|
||||
global->audio_data.src_ratio = global->audio_data.orig_src_ratio * adjust;
|
||||
|
||||
#if 0
|
||||
RARCH_LOG_OUTPUT("New rate: %lf, Orig rate: %lf\n",
|
||||
g_extern.audio_data.src_ratio, g_extern.audio_data.orig_src_ratio);
|
||||
global->audio_data.src_ratio, global->audio_data.orig_src_ratio);
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -20,8 +20,9 @@
|
|||
void audio_monitor_adjust_system_rates(void)
|
||||
{
|
||||
float timing_skew;
|
||||
global_t *global = global_get_ptr();
|
||||
const struct retro_system_timing *info =
|
||||
(const struct retro_system_timing*)&g_extern.system.av_info.timing;
|
||||
(const struct retro_system_timing*)&global->system.av_info.timing;
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
if (info->sample_rate <= 0.0)
|
||||
|
@ -29,13 +30,13 @@ void audio_monitor_adjust_system_rates(void)
|
|||
|
||||
timing_skew = fabs(1.0f - info->fps /
|
||||
settings->video.refresh_rate);
|
||||
g_extern.audio_data.in_rate = info->sample_rate;
|
||||
global->audio_data.in_rate = info->sample_rate;
|
||||
|
||||
if (timing_skew <= settings->audio.max_timing_skew)
|
||||
g_extern.audio_data.in_rate *= (settings->video.refresh_rate / info->fps);
|
||||
global->audio_data.in_rate *= (settings->video.refresh_rate / info->fps);
|
||||
|
||||
RARCH_LOG("Set audio input rate to: %.2f Hz.\n",
|
||||
g_extern.audio_data.in_rate);
|
||||
global->audio_data.in_rate);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -46,9 +47,11 @@ void audio_monitor_adjust_system_rates(void)
|
|||
void audio_monitor_set_refresh_rate(void)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
double new_src_ratio = (double)settings->audio.out_rate /
|
||||
g_extern.audio_data.in_rate;
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
g_extern.audio_data.orig_src_ratio = new_src_ratio;
|
||||
g_extern.audio_data.src_ratio = new_src_ratio;
|
||||
double new_src_ratio = (double)settings->audio.out_rate /
|
||||
global->audio_data.in_rate;
|
||||
|
||||
global->audio_data.orig_src_ratio = new_src_ratio;
|
||||
global->audio_data.src_ratio = new_src_ratio;
|
||||
}
|
||||
|
|
|
@ -73,6 +73,8 @@ static void audio_thread_loop(void *data)
|
|||
|
||||
for (;;)
|
||||
{
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
slock_lock(thr->lock);
|
||||
|
||||
if (!thr->alive)
|
||||
|
@ -91,7 +93,7 @@ static void audio_thread_loop(void *data)
|
|||
}
|
||||
|
||||
slock_unlock(thr->lock);
|
||||
g_extern.system.audio_callback.callback();
|
||||
global->system.audio_callback.callback();
|
||||
}
|
||||
|
||||
RARCH_LOG("[Audio Thread]: Tearing down driver.\n");
|
||||
|
@ -163,13 +165,14 @@ static bool audio_thread_alive(void *data)
|
|||
static bool audio_thread_stop(void *data)
|
||||
{
|
||||
audio_thread_t *thr = (audio_thread_t*)data;
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
if (!thr)
|
||||
return false;
|
||||
|
||||
audio_thread_block(thr);
|
||||
thr->is_paused = true;
|
||||
g_extern.system.audio_callback.set_state(false);
|
||||
global->system.audio_callback.set_state(false);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -177,11 +180,12 @@ static bool audio_thread_stop(void *data)
|
|||
static bool audio_thread_start(void *data)
|
||||
{
|
||||
audio_thread_t *thr = (audio_thread_t*)data;
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
if (!thr)
|
||||
return false;
|
||||
|
||||
g_extern.system.audio_callback.set_state(true);
|
||||
global->system.audio_callback.set_state(true);
|
||||
thr->is_paused = false;
|
||||
audio_thread_unblock(thr);
|
||||
|
||||
|
|
|
@ -80,7 +80,8 @@ static void *ps3_audio_init(const char *device,
|
|||
unsigned rate, unsigned latency)
|
||||
{
|
||||
CellAudioPortParam params;
|
||||
ps3_audio_t *data;
|
||||
ps3_audio_t *data = NULL;
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
(void)latency;
|
||||
(void)device;
|
||||
|
@ -95,7 +96,7 @@ static void *ps3_audio_init(const char *device,
|
|||
params.numChannels = AUDIO_CHANNELS;
|
||||
params.numBlocks = AUDIO_BLOCKS;
|
||||
#ifdef HAVE_HEADSET
|
||||
if(g_extern.console.sound.mode == SOUND_MODE_HEADSET)
|
||||
if(global->console.sound.mode == SOUND_MODE_HEADSET)
|
||||
params.param_attrib = CELL_AUDIO_PORTATTR_OUT_SECONDARY;
|
||||
else
|
||||
#endif
|
||||
|
|
|
@ -316,10 +316,11 @@ static size_t pulse_write_avail(void *data)
|
|||
{
|
||||
size_t length;
|
||||
pa_t *pa = (pa_t*)data;
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
pa_threaded_mainloop_lock(pa->mainloop);
|
||||
length = pa_stream_writable_size(pa->stream);
|
||||
g_extern.audio_data.driver_buffer_size = pa->buffer_size; /* Can change spuriously. */
|
||||
global->audio_data.driver_buffer_size = pa->buffer_size; /* Can change spuriously. */
|
||||
pa_threaded_mainloop_unlock(pa->mainloop);
|
||||
return length;
|
||||
}
|
||||
|
|
|
@ -30,8 +30,9 @@ typedef struct
|
|||
static void *xa_init(const char *device, unsigned rate, unsigned latency)
|
||||
{
|
||||
size_t bufsize;
|
||||
xa_t *xa;
|
||||
xa_t *xa = NULL;
|
||||
unsigned device_index = 0;
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
if (latency < 8)
|
||||
latency = 8; /* Do not allow shenanigans. */
|
||||
|
@ -58,7 +59,7 @@ static void *xa_init(const char *device, unsigned rate, unsigned latency)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
if (g_extern.verbosity)
|
||||
if (global->verbosity)
|
||||
xaudio2_enumerate_devices(xa->xa);
|
||||
|
||||
return xa;
|
||||
|
|
16
autosave.c
16
autosave.c
|
@ -194,10 +194,12 @@ void autosave_free(autosave_t *handle)
|
|||
void lock_autosave(void)
|
||||
{
|
||||
unsigned i;
|
||||
for (i = 0; i < g_extern.num_autosave; i++)
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
for (i = 0; i < global->num_autosave; i++)
|
||||
{
|
||||
if (g_extern.autosave[i])
|
||||
autosave_lock(g_extern.autosave[i]);
|
||||
if (global->autosave[i])
|
||||
autosave_lock(global->autosave[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -209,10 +211,12 @@ void lock_autosave(void)
|
|||
void unlock_autosave(void)
|
||||
{
|
||||
unsigned i;
|
||||
for (i = 0; i < g_extern.num_autosave; i++)
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
for (i = 0; i < global->num_autosave; i++)
|
||||
{
|
||||
if (g_extern.autosave[i])
|
||||
autosave_unlock(g_extern.autosave[i]);
|
||||
if (global->autosave[i])
|
||||
autosave_unlock(global->autosave[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -190,16 +190,19 @@ void driver_camera_stop(void)
|
|||
void driver_camera_poll(void)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
if (driver->camera && driver->camera->poll && driver->camera_data)
|
||||
driver->camera->poll(driver->camera_data,
|
||||
g_extern.system.camera_callback.frame_raw_framebuffer,
|
||||
g_extern.system.camera_callback.frame_opengl_texture);
|
||||
global->system.camera_callback.frame_raw_framebuffer,
|
||||
global->system.camera_callback.frame_opengl_texture);
|
||||
}
|
||||
|
||||
void init_camera(void)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
if (driver->camera_data)
|
||||
{
|
||||
|
@ -211,11 +214,11 @@ void init_camera(void)
|
|||
|
||||
driver->camera_data = driver->camera->init(
|
||||
*settings->camera.device ? settings->camera.device : NULL,
|
||||
g_extern.system.camera_callback.caps,
|
||||
global->system.camera_callback.caps,
|
||||
settings->camera.width ?
|
||||
settings->camera.width : g_extern.system.camera_callback.width,
|
||||
settings->camera.width : global->system.camera_callback.width,
|
||||
settings->camera.height ?
|
||||
settings->camera.height : g_extern.system.camera_callback.height);
|
||||
settings->camera.height : global->system.camera_callback.height);
|
||||
|
||||
if (!driver->camera_data)
|
||||
{
|
||||
|
@ -223,18 +226,19 @@ void init_camera(void)
|
|||
driver->camera_active = false;
|
||||
}
|
||||
|
||||
if (g_extern.system.camera_callback.initialized)
|
||||
g_extern.system.camera_callback.initialized();
|
||||
if (global->system.camera_callback.initialized)
|
||||
global->system.camera_callback.initialized();
|
||||
}
|
||||
|
||||
void uninit_camera(void)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
if (driver->camera_data && driver->camera)
|
||||
{
|
||||
if (g_extern.system.camera_callback.deinitialized)
|
||||
g_extern.system.camera_callback.deinitialized();
|
||||
if (global->system.camera_callback.deinitialized)
|
||||
global->system.camera_callback.deinitialized();
|
||||
|
||||
if (driver->camera->free)
|
||||
driver->camera->free(driver->camera_data);
|
||||
|
|
16
command.c
16
command.c
|
@ -598,12 +598,14 @@ static bool verify_command(const char *cmd)
|
|||
|
||||
bool network_cmd_send(const char *cmd_)
|
||||
{
|
||||
char *command, *save;
|
||||
bool ret;
|
||||
const char *cmd = NULL;
|
||||
const char *host = NULL;
|
||||
const char *port_ = NULL;
|
||||
bool old_verbose = g_extern.verbosity;
|
||||
char *command = NULL;
|
||||
char *save = NULL;
|
||||
const char *cmd = NULL;
|
||||
const char *host = NULL;
|
||||
const char *port_ = NULL;
|
||||
global_t *global = global_get_ptr();
|
||||
bool old_verbose = global->verbosity;
|
||||
uint16_t port = DEFAULT_NETWORK_CMD_PORT;
|
||||
|
||||
if (!network_init())
|
||||
|
@ -612,7 +614,7 @@ bool network_cmd_send(const char *cmd_)
|
|||
if (!(command = strdup(cmd_)))
|
||||
return false;
|
||||
|
||||
g_extern.verbosity = true;
|
||||
global->verbosity = true;
|
||||
|
||||
cmd = strtok_r(command, ";", &save);
|
||||
if (cmd)
|
||||
|
@ -638,7 +640,7 @@ bool network_cmd_send(const char *cmd_)
|
|||
ret = verify_command(cmd) && send_udp_packet(host, port, cmd);
|
||||
free(command);
|
||||
|
||||
g_extern.verbosity = old_verbose;
|
||||
global->verbosity = old_verbose;
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
|
76
content.c
76
content.c
|
@ -57,6 +57,7 @@ static bool read_content_file(unsigned i, const char *path, void **buf,
|
|||
ssize_t *length)
|
||||
{
|
||||
uint8_t *ret_buf = NULL;
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
RARCH_LOG("Loading content file: %s.\n", path);
|
||||
if (!read_file(path, (void**) &ret_buf, length))
|
||||
|
@ -69,12 +70,12 @@ static bool read_content_file(unsigned i, const char *path, void **buf,
|
|||
return true;
|
||||
|
||||
/* Attempt to apply a patch. */
|
||||
if (!g_extern.block_patch)
|
||||
if (!global->block_patch)
|
||||
patch_content(&ret_buf, length);
|
||||
|
||||
g_extern.content_crc = crc32_calculate(ret_buf, *length);
|
||||
global->content_crc = crc32_calculate(ret_buf, *length);
|
||||
|
||||
RARCH_LOG("CRC32: 0x%x .\n", (unsigned)g_extern.content_crc);
|
||||
RARCH_LOG("CRC32: 0x%x .\n", (unsigned)global->content_crc);
|
||||
*buf = ret_buf;
|
||||
|
||||
return true;
|
||||
|
@ -186,6 +187,7 @@ bool load_state(const char *path)
|
|||
void *buf = NULL;
|
||||
struct sram_block *blocks = NULL;
|
||||
settings_t *settings = config_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
bool ret = read_file(path, &buf, &size);
|
||||
|
||||
RARCH_LOG("Loading state: \"%s\".\n", path);
|
||||
|
@ -198,18 +200,18 @@ bool load_state(const char *path)
|
|||
|
||||
RARCH_LOG("State size: %u bytes.\n", (unsigned)size);
|
||||
|
||||
if (settings->block_sram_overwrite && g_extern.savefiles
|
||||
&& g_extern.savefiles->size)
|
||||
if (settings->block_sram_overwrite && global->savefiles
|
||||
&& global->savefiles->size)
|
||||
{
|
||||
RARCH_LOG("Blocking SRAM overwrite.\n");
|
||||
blocks = (struct sram_block*)
|
||||
calloc(g_extern.savefiles->size, sizeof(*blocks));
|
||||
calloc(global->savefiles->size, sizeof(*blocks));
|
||||
|
||||
if (blocks)
|
||||
{
|
||||
num_blocks = g_extern.savefiles->size;
|
||||
num_blocks = global->savefiles->size;
|
||||
for (i = 0; i < num_blocks; i++)
|
||||
blocks[i].type = g_extern.savefiles->elems[i].attr.i;
|
||||
blocks[i].type = global->savefiles->elems[i].attr.i;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -350,10 +352,11 @@ static bool load_content_need_fullpath(
|
|||
char new_path[PATH_MAX_LENGTH], new_basedir[PATH_MAX_LENGTH];
|
||||
ssize_t len;
|
||||
union string_list_elem_attr attributes;
|
||||
settings_t *settings = config_get_ptr();
|
||||
bool ret = false;
|
||||
settings_t *settings = config_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
if (g_extern.system.info.block_extract)
|
||||
if (global->system.info.block_extract)
|
||||
return true;
|
||||
|
||||
if (!need_fullpath)
|
||||
|
@ -396,12 +399,12 @@ static bool load_content_need_fullpath(
|
|||
additional_path_allocs->elems
|
||||
[additional_path_allocs->size -1 ].data;
|
||||
|
||||
/* g_extern.temporary_content is initialized in init_content_file
|
||||
/* global->temporary_content is initialized in init_content_file
|
||||
* The following part takes care of cleanup of the unzipped files
|
||||
* after exit.
|
||||
*/
|
||||
rarch_assert(g_extern.temporary_content != NULL);
|
||||
string_list_append(g_extern.temporary_content,
|
||||
rarch_assert(global->temporary_content != NULL);
|
||||
string_list_append(global->temporary_content,
|
||||
new_path, attributes);
|
||||
|
||||
#endif
|
||||
|
@ -492,7 +495,7 @@ end:
|
|||
* Initializes and loads a content file for the currently
|
||||
* selected libretro core.
|
||||
*
|
||||
* g_extern.content_is_init will be set to the return value
|
||||
* global->content_is_init will be set to the return value
|
||||
* on exit.
|
||||
*
|
||||
* Returns : true if successful, otherwise false.
|
||||
|
@ -505,44 +508,45 @@ bool init_content_file(void)
|
|||
struct string_list *content = NULL;
|
||||
const struct retro_subsystem_info *special = NULL;
|
||||
settings_t *settings = config_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
g_extern.temporary_content = string_list_new();
|
||||
global->temporary_content = string_list_new();
|
||||
|
||||
if (!g_extern.temporary_content)
|
||||
if (!global->temporary_content)
|
||||
goto error;
|
||||
|
||||
if (*g_extern.subsystem)
|
||||
if (*global->subsystem)
|
||||
{
|
||||
special = libretro_find_subsystem_info(g_extern.system.special,
|
||||
g_extern.system.num_special, g_extern.subsystem);
|
||||
special = libretro_find_subsystem_info(global->system.special,
|
||||
global->system.num_special, global->subsystem);
|
||||
|
||||
if (!special)
|
||||
{
|
||||
RARCH_ERR(
|
||||
"Failed to find subsystem \"%s\" in libretro implementation.\n",
|
||||
g_extern.subsystem);
|
||||
global->subsystem);
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (special->num_roms && !g_extern.subsystem_fullpaths)
|
||||
if (special->num_roms && !global->subsystem_fullpaths)
|
||||
{
|
||||
RARCH_ERR("libretro core requires special content, but none were provided.\n");
|
||||
goto error;
|
||||
}
|
||||
else if (special->num_roms && special->num_roms
|
||||
!= g_extern.subsystem_fullpaths->size)
|
||||
!= global->subsystem_fullpaths->size)
|
||||
{
|
||||
RARCH_ERR("libretro core requires %u content files for subsystem \"%s\", but %u content files were provided.\n",
|
||||
special->num_roms, special->desc,
|
||||
(unsigned)g_extern.subsystem_fullpaths->size);
|
||||
(unsigned)global->subsystem_fullpaths->size);
|
||||
goto error;
|
||||
}
|
||||
else if (!special->num_roms && g_extern.subsystem_fullpaths
|
||||
&& g_extern.subsystem_fullpaths->size)
|
||||
else if (!special->num_roms && global->subsystem_fullpaths
|
||||
&& global->subsystem_fullpaths->size)
|
||||
{
|
||||
RARCH_ERR("libretro core takes no content for subsystem \"%s\", but %u content files were provided.\n",
|
||||
special->desc,
|
||||
(unsigned)g_extern.subsystem_fullpaths->size);
|
||||
(unsigned)global->subsystem_fullpaths->size);
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
|
@ -554,24 +558,24 @@ bool init_content_file(void)
|
|||
if (!content)
|
||||
goto error;
|
||||
|
||||
if (*g_extern.subsystem)
|
||||
if (*global->subsystem)
|
||||
{
|
||||
for (i = 0; i < g_extern.subsystem_fullpaths->size; i++)
|
||||
for (i = 0; i < global->subsystem_fullpaths->size; i++)
|
||||
{
|
||||
attr.i = special->roms[i].block_extract;
|
||||
attr.i |= special->roms[i].need_fullpath << 1;
|
||||
attr.i |= special->roms[i].required << 2;
|
||||
string_list_append(content,
|
||||
g_extern.subsystem_fullpaths->elems[i].data, attr);
|
||||
global->subsystem_fullpaths->elems[i].data, attr);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
attr.i = g_extern.system.info.block_extract;
|
||||
attr.i |= g_extern.system.info.need_fullpath << 1;
|
||||
attr.i |= (!g_extern.system.no_content) << 2;
|
||||
attr.i = global->system.info.block_extract;
|
||||
attr.i |= global->system.info.need_fullpath << 1;
|
||||
attr.i |= (!global->system.no_content) << 2;
|
||||
string_list_append(content,
|
||||
g_extern.libretro_no_content ? "" : g_extern.fullpath, attr);
|
||||
global->libretro_no_content ? "" : global->fullpath, attr);
|
||||
}
|
||||
|
||||
#ifdef HAVE_ZLIB
|
||||
|
@ -587,7 +591,7 @@ bool init_content_file(void)
|
|||
|
||||
ext = path_get_extension(content->elems[i].data);
|
||||
valid_ext = special ? special->roms[i].valid_extensions :
|
||||
g_extern.system.info.valid_extensions;
|
||||
global->system.info.valid_extensions;
|
||||
|
||||
if (ext && !strcasecmp(ext, "zip"))
|
||||
{
|
||||
|
@ -606,7 +610,7 @@ bool init_content_file(void)
|
|||
goto error;
|
||||
}
|
||||
string_list_set(content, i, temporary_content);
|
||||
string_list_append(g_extern.temporary_content,
|
||||
string_list_append(global->temporary_content,
|
||||
temporary_content, attr);
|
||||
}
|
||||
}
|
||||
|
@ -616,7 +620,7 @@ bool init_content_file(void)
|
|||
ret = load_content(special, content);
|
||||
|
||||
error:
|
||||
g_extern.content_is_init = (ret) ? true : false;
|
||||
global->content_is_init = (ret) ? true : false;
|
||||
|
||||
if (content)
|
||||
string_list_free(content);
|
||||
|
|
|
@ -76,7 +76,7 @@ void save_ram_file(const char *path, int type);
|
|||
* Initializes and loads a content file for the currently
|
||||
* selected libretro core.
|
||||
*
|
||||
* g_extern.content_is_init will be set to the return value
|
||||
* global->content_is_init will be set to the return value
|
||||
* on exit.
|
||||
*
|
||||
* Returns : true if successful, otherwise false.
|
||||
|
|
|
@ -62,12 +62,13 @@ database_info_rdl_handle_t *database_info_write_rdl_init(const char *dir)
|
|||
{
|
||||
const char *exts = "";
|
||||
database_info_rdl_handle_t *dbl = (database_info_rdl_handle_t*)calloc(1, sizeof(*dbl));
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
if (!dbl)
|
||||
return NULL;
|
||||
|
||||
if (g_extern.core_info)
|
||||
exts = core_info_list_get_all_extensions(g_extern.core_info);
|
||||
if (global->core_info)
|
||||
exts = core_info_list_get_all_extensions(global->core_info);
|
||||
|
||||
dbl->list = dir_list_new(dir, exts, false);
|
||||
dbl->list_ptr = 0;
|
||||
|
|
30
driver.c
30
driver.c
|
@ -205,13 +205,15 @@ void init_drivers_pre(void)
|
|||
|
||||
static void driver_adjust_system_rates(void)
|
||||
{
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
audio_monitor_adjust_system_rates();
|
||||
video_monitor_adjust_system_rates();
|
||||
|
||||
if (!driver.video_data)
|
||||
return;
|
||||
|
||||
if (g_extern.system.force_nonblock)
|
||||
if (global->system.force_nonblock)
|
||||
rarch_main_command(RARCH_CMD_VIDEO_SET_NONBLOCKING_STATE);
|
||||
else
|
||||
driver_set_nonblock_state(driver.nonblock_state);
|
||||
|
@ -244,13 +246,14 @@ void driver_set_refresh_rate(float hz)
|
|||
void driver_set_nonblock_state(bool enable)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
/* Only apply non-block-state for video if we're using vsync. */
|
||||
if (driver.video_active && driver.video_data)
|
||||
{
|
||||
bool video_nonblock = enable;
|
||||
|
||||
if (!settings->video.vsync || g_extern.system.force_nonblock)
|
||||
if (!settings->video.vsync || global->system.force_nonblock)
|
||||
video_nonblock = true;
|
||||
driver.video->set_nonblock_state(driver.video_data, video_nonblock);
|
||||
}
|
||||
|
@ -259,9 +262,9 @@ void driver_set_nonblock_state(bool enable)
|
|||
driver.audio->set_nonblock_state(driver.audio_data,
|
||||
settings->audio.sync ? enable : true);
|
||||
|
||||
g_extern.audio_data.chunk_size = enable ?
|
||||
g_extern.audio_data.nonblock_chunk_size :
|
||||
g_extern.audio_data.block_chunk_size;
|
||||
global->audio_data.chunk_size = enable ?
|
||||
global->audio_data.nonblock_chunk_size :
|
||||
global->audio_data.block_chunk_size;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -276,7 +279,9 @@ void driver_set_nonblock_state(bool enable)
|
|||
**/
|
||||
bool driver_update_system_av_info(const struct retro_system_av_info *info)
|
||||
{
|
||||
g_extern.system.av_info = *info;
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
global->system.av_info = *info;
|
||||
rarch_main_command(RARCH_CMD_REINIT);
|
||||
|
||||
/* Cannot continue recording with different parameters.
|
||||
|
@ -324,17 +329,18 @@ void init_drivers(int flags)
|
|||
if (flags & DRIVER_VIDEO)
|
||||
{
|
||||
runloop_t *runloop = rarch_main_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
runloop->frames.video.count = 0;
|
||||
|
||||
init_video();
|
||||
|
||||
if (!driver.video_cache_context_ack
|
||||
&& g_extern.system.hw_render_callback.context_reset)
|
||||
g_extern.system.hw_render_callback.context_reset();
|
||||
&& global->system.hw_render_callback.context_reset)
|
||||
global->system.hw_render_callback.context_reset();
|
||||
driver.video_cache_context_ack = false;
|
||||
|
||||
g_extern.system.frame_time_last = 0;
|
||||
global->system.frame_time_last = 0;
|
||||
}
|
||||
|
||||
if (flags & DRIVER_AUDIO)
|
||||
|
@ -381,9 +387,11 @@ void uninit_drivers(int flags)
|
|||
|
||||
if (flags & DRIVER_VIDEO)
|
||||
{
|
||||
if (g_extern.system.hw_render_callback.context_destroy &&
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
if (global->system.hw_render_callback.context_destroy &&
|
||||
!driver.video_cache_context)
|
||||
g_extern.system.hw_render_callback.context_destroy();
|
||||
global->system.hw_render_callback.context_destroy();
|
||||
}
|
||||
|
||||
#ifdef HAVE_MENU
|
||||
|
|
146
dynamic.c
146
dynamic.c
|
@ -470,6 +470,7 @@ void init_libretro_sym(bool dummy)
|
|||
void uninit_libretro_sym(void)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
#ifdef HAVE_DYNAMIC
|
||||
if (lib_handle)
|
||||
|
@ -477,16 +478,16 @@ void uninit_libretro_sym(void)
|
|||
lib_handle = NULL;
|
||||
#endif
|
||||
|
||||
if (g_extern.system.core_options)
|
||||
if (global->system.core_options)
|
||||
{
|
||||
core_option_flush(g_extern.system.core_options);
|
||||
core_option_free(g_extern.system.core_options);
|
||||
core_option_flush(global->system.core_options);
|
||||
core_option_free(global->system.core_options);
|
||||
}
|
||||
|
||||
/* No longer valid. */
|
||||
free(g_extern.system.special);
|
||||
free(g_extern.system.ports);
|
||||
memset(&g_extern.system, 0, sizeof(g_extern.system));
|
||||
free(global->system.special);
|
||||
free(global->system.ports);
|
||||
memset(&global->system, 0, sizeof(global->system));
|
||||
driver->camera_active = false;
|
||||
driver->location_active = false;
|
||||
|
||||
|
@ -619,6 +620,7 @@ bool rarch_environment_cb(unsigned cmd, void *data)
|
|||
unsigned p;
|
||||
driver_t *driver = driver_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
if (ignore_environment_cb)
|
||||
return false;
|
||||
|
@ -641,8 +643,8 @@ bool rarch_environment_cb(unsigned cmd, void *data)
|
|||
struct retro_variable *var = (struct retro_variable*)data;
|
||||
RARCH_LOG("Environ GET_VARIABLE %s:\n", var->key);
|
||||
|
||||
if (g_extern.system.core_options)
|
||||
core_option_get(g_extern.system.core_options, var);
|
||||
if (global->system.core_options)
|
||||
core_option_get(global->system.core_options, var);
|
||||
else
|
||||
var->value = NULL;
|
||||
|
||||
|
@ -651,18 +653,18 @@ bool rarch_environment_cb(unsigned cmd, void *data)
|
|||
}
|
||||
|
||||
case RETRO_ENVIRONMENT_GET_VARIABLE_UPDATE:
|
||||
*(bool*)data = g_extern.system.core_options ?
|
||||
core_option_updated(g_extern.system.core_options) : false;
|
||||
*(bool*)data = global->system.core_options ?
|
||||
core_option_updated(global->system.core_options) : false;
|
||||
break;
|
||||
|
||||
case RETRO_ENVIRONMENT_SET_VARIABLES:
|
||||
{
|
||||
RARCH_LOG("Environ SET_VARIABLES.\n");
|
||||
|
||||
if (g_extern.system.core_options)
|
||||
if (global->system.core_options)
|
||||
{
|
||||
core_option_flush(g_extern.system.core_options);
|
||||
core_option_free(g_extern.system.core_options);
|
||||
core_option_flush(global->system.core_options);
|
||||
core_option_free(global->system.core_options);
|
||||
}
|
||||
|
||||
const struct retro_variable *vars =
|
||||
|
@ -670,13 +672,13 @@ bool rarch_environment_cb(unsigned cmd, void *data)
|
|||
|
||||
const char *options_path = settings->core_options_path;
|
||||
char buf[PATH_MAX_LENGTH];
|
||||
if (!*options_path && *g_extern.config_path)
|
||||
if (!*options_path && *global->config_path)
|
||||
{
|
||||
fill_pathname_resolve_relative(buf, g_extern.config_path,
|
||||
fill_pathname_resolve_relative(buf, global->config_path,
|
||||
"retroarch-core-options.cfg", sizeof(buf));
|
||||
options_path = buf;
|
||||
}
|
||||
g_extern.system.core_options = core_option_new(options_path, vars);
|
||||
global->system.core_options = core_option_new(options_path, vars);
|
||||
|
||||
break;
|
||||
}
|
||||
|
@ -696,7 +698,7 @@ bool rarch_environment_cb(unsigned cmd, void *data)
|
|||
if (!settings->video.allow_rotate)
|
||||
break;
|
||||
|
||||
g_extern.system.rotation = rotation;
|
||||
global->system.rotation = rotation;
|
||||
|
||||
if (driver->video && driver->video->set_rotation)
|
||||
{
|
||||
|
@ -710,14 +712,14 @@ bool rarch_environment_cb(unsigned cmd, void *data)
|
|||
|
||||
case RETRO_ENVIRONMENT_SHUTDOWN:
|
||||
RARCH_LOG("Environ SHUTDOWN.\n");
|
||||
g_extern.system.shutdown = true;
|
||||
g_extern.core_shutdown_initiated = true;
|
||||
global->system.shutdown = true;
|
||||
global->core_shutdown_initiated = true;
|
||||
break;
|
||||
|
||||
case RETRO_ENVIRONMENT_SET_PERFORMANCE_LEVEL:
|
||||
g_extern.system.performance_level = *(const unsigned*)data;
|
||||
global->system.performance_level = *(const unsigned*)data;
|
||||
RARCH_LOG("Environ PERFORMANCE_LEVEL: %u.\n",
|
||||
g_extern.system.performance_level);
|
||||
global->system.performance_level);
|
||||
break;
|
||||
|
||||
case RETRO_ENVIRONMENT_GET_SYSTEM_DIRECTORY:
|
||||
|
@ -728,10 +730,10 @@ bool rarch_environment_cb(unsigned cmd, void *data)
|
|||
break;
|
||||
|
||||
case RETRO_ENVIRONMENT_GET_SAVE_DIRECTORY:
|
||||
*(const char**)data = *g_extern.savefile_dir ?
|
||||
g_extern.savefile_dir : NULL;
|
||||
*(const char**)data = *global->savefile_dir ?
|
||||
global->savefile_dir : NULL;
|
||||
RARCH_LOG("Environ SAVE_DIRECTORY: \"%s\".\n",
|
||||
g_extern.savefile_dir);
|
||||
global->savefile_dir);
|
||||
break;
|
||||
|
||||
case RETRO_ENVIRONMENT_GET_USERNAME:
|
||||
|
@ -768,7 +770,7 @@ bool rarch_environment_cb(unsigned cmd, void *data)
|
|||
return false;
|
||||
}
|
||||
|
||||
g_extern.system.pix_fmt = pix_fmt;
|
||||
global->system.pix_fmt = pix_fmt;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -777,8 +779,8 @@ bool rarch_environment_cb(unsigned cmd, void *data)
|
|||
unsigned retro_id, retro_port;
|
||||
const struct retro_input_descriptor *desc = NULL;
|
||||
|
||||
memset(g_extern.system.input_desc_btn, 0,
|
||||
sizeof(g_extern.system.input_desc_btn));
|
||||
memset(global->system.input_desc_btn, 0,
|
||||
sizeof(global->system.input_desc_btn));
|
||||
|
||||
desc = (const struct retro_input_descriptor*)data;
|
||||
|
||||
|
@ -806,12 +808,12 @@ bool rarch_environment_cb(unsigned cmd, void *data)
|
|||
switch (desc->index)
|
||||
{
|
||||
case RETRO_DEVICE_INDEX_ANALOG_LEFT:
|
||||
g_extern.system.input_desc_btn[retro_port][RARCH_ANALOG_LEFT_X_PLUS] = desc->description;
|
||||
g_extern.system.input_desc_btn[retro_port][RARCH_ANALOG_LEFT_X_MINUS] = desc->description;
|
||||
global->system.input_desc_btn[retro_port][RARCH_ANALOG_LEFT_X_PLUS] = desc->description;
|
||||
global->system.input_desc_btn[retro_port][RARCH_ANALOG_LEFT_X_MINUS] = desc->description;
|
||||
break;
|
||||
case RETRO_DEVICE_INDEX_ANALOG_RIGHT:
|
||||
g_extern.system.input_desc_btn[retro_port][RARCH_ANALOG_RIGHT_X_PLUS] = desc->description;
|
||||
g_extern.system.input_desc_btn[retro_port][RARCH_ANALOG_RIGHT_X_MINUS] = desc->description;
|
||||
global->system.input_desc_btn[retro_port][RARCH_ANALOG_RIGHT_X_PLUS] = desc->description;
|
||||
global->system.input_desc_btn[retro_port][RARCH_ANALOG_RIGHT_X_MINUS] = desc->description;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
@ -819,21 +821,19 @@ bool rarch_environment_cb(unsigned cmd, void *data)
|
|||
switch (desc->index)
|
||||
{
|
||||
case RETRO_DEVICE_INDEX_ANALOG_LEFT:
|
||||
g_extern.system.input_desc_btn[retro_port][RARCH_ANALOG_LEFT_Y_PLUS] = desc->description;
|
||||
g_extern.system.input_desc_btn[retro_port][RARCH_ANALOG_LEFT_Y_MINUS] = desc->description;
|
||||
global->system.input_desc_btn[retro_port][RARCH_ANALOG_LEFT_Y_PLUS] = desc->description;
|
||||
global->system.input_desc_btn[retro_port][RARCH_ANALOG_LEFT_Y_MINUS] = desc->description;
|
||||
break;
|
||||
case RETRO_DEVICE_INDEX_ANALOG_RIGHT:
|
||||
g_extern.system.input_desc_btn[retro_port][RARCH_ANALOG_RIGHT_Y_PLUS] = desc->description;
|
||||
g_extern.system.input_desc_btn[retro_port][RARCH_ANALOG_RIGHT_Y_MINUS] = desc->description;
|
||||
global->system.input_desc_btn[retro_port][RARCH_ANALOG_RIGHT_Y_PLUS] = desc->description;
|
||||
global->system.input_desc_btn[retro_port][RARCH_ANALOG_RIGHT_Y_MINUS] = desc->description;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
g_extern.system.input_desc_btn[retro_port][retro_id] = desc->description;
|
||||
}
|
||||
global->system.input_desc_btn[retro_port][retro_id] = desc->description;
|
||||
}
|
||||
|
||||
static const char *libretro_btn_desc[] = {
|
||||
|
@ -848,7 +848,7 @@ bool rarch_environment_cb(unsigned cmd, void *data)
|
|||
{
|
||||
for (retro_id = 0; retro_id < RARCH_FIRST_CUSTOM_BIND; retro_id++)
|
||||
{
|
||||
const char *description = g_extern.system.input_desc_btn[p][retro_id];
|
||||
const char *description = global->system.input_desc_btn[p][retro_id];
|
||||
|
||||
if (!description)
|
||||
continue;
|
||||
|
@ -858,7 +858,7 @@ bool rarch_environment_cb(unsigned cmd, void *data)
|
|||
}
|
||||
}
|
||||
|
||||
g_extern.has_set_input_descriptors = true;
|
||||
global->has_set_input_descriptors = true;
|
||||
|
||||
break;
|
||||
}
|
||||
|
@ -869,14 +869,14 @@ bool rarch_environment_cb(unsigned cmd, void *data)
|
|||
(const struct retro_keyboard_callback*)data;
|
||||
|
||||
RARCH_LOG("Environ SET_KEYBOARD_CALLBACK.\n");
|
||||
g_extern.system.key_event = info->callback;
|
||||
g_extern.frontend_key_event = g_extern.system.key_event;
|
||||
global->system.key_event = info->callback;
|
||||
global->frontend_key_event = global->system.key_event;
|
||||
break;
|
||||
}
|
||||
|
||||
case RETRO_ENVIRONMENT_SET_DISK_CONTROL_INTERFACE:
|
||||
RARCH_LOG("Environ SET_DISK_CONTROL_INTERFACE.\n");
|
||||
g_extern.system.disk_control =
|
||||
global->system.disk_control =
|
||||
*(const struct retro_disk_control_callback*)data;
|
||||
break;
|
||||
|
||||
|
@ -944,10 +944,10 @@ bool rarch_environment_cb(unsigned cmd, void *data)
|
|||
cb->get_proc_address = video_driver_get_proc_address;
|
||||
|
||||
if (cmd & RETRO_ENVIRONMENT_EXPERIMENTAL) /* Old ABI. Don't copy garbage. */
|
||||
memcpy(&g_extern.system.hw_render_callback,
|
||||
memcpy(&global->system.hw_render_callback,
|
||||
cb, offsetof(struct retro_hw_render_callback, stencil));
|
||||
else
|
||||
memcpy(&g_extern.system.hw_render_callback, cb, sizeof(*cb));
|
||||
memcpy(&global->system.hw_render_callback, cb, sizeof(*cb));
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -955,7 +955,7 @@ bool rarch_environment_cb(unsigned cmd, void *data)
|
|||
{
|
||||
bool state = *(const bool*)data;
|
||||
RARCH_LOG("Environ SET_SUPPORT_NO_GAME: %s.\n", state ? "yes" : "no");
|
||||
g_extern.system.no_content = state;
|
||||
global->system.no_content = state;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -984,11 +984,11 @@ bool rarch_environment_cb(unsigned cmd, void *data)
|
|||
return false;
|
||||
|
||||
#ifdef HAVE_NETPLAY
|
||||
if (g_extern.netplay_enable)
|
||||
if (global->netplay_enable)
|
||||
return false;
|
||||
#endif
|
||||
|
||||
g_extern.system.audio_callback = *info;
|
||||
global->system.audio_callback = *info;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
@ -1003,11 +1003,11 @@ bool rarch_environment_cb(unsigned cmd, void *data)
|
|||
#ifdef HAVE_NETPLAY
|
||||
/* retro_run() will be called in very strange and
|
||||
* mysterious ways, have to disable it. */
|
||||
if (g_extern.netplay_enable)
|
||||
if (global->netplay_enable)
|
||||
return false;
|
||||
#endif
|
||||
|
||||
g_extern.system.frame_time = *info;
|
||||
global->system.frame_time = *info;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1051,9 +1051,9 @@ bool rarch_environment_cb(unsigned cmd, void *data)
|
|||
(struct retro_camera_callback*)data;
|
||||
|
||||
RARCH_LOG("Environ GET_CAMERA_INTERFACE.\n");
|
||||
cb->start = driver_camera_start;
|
||||
cb->stop = driver_camera_stop;
|
||||
g_extern.system.camera_callback = *cb;
|
||||
cb->start = driver_camera_start;
|
||||
cb->stop = driver_camera_stop;
|
||||
global->system.camera_callback = *cb;
|
||||
driver->camera_active = cb->caps != 0;
|
||||
break;
|
||||
}
|
||||
|
@ -1068,7 +1068,7 @@ bool rarch_environment_cb(unsigned cmd, void *data)
|
|||
cb->stop = driver_location_stop;
|
||||
cb->get_position = driver_location_get_position;
|
||||
cb->set_interval = driver_location_set_interval;
|
||||
g_extern.system.location_callback = *cb;
|
||||
global->system.location_callback = *cb;
|
||||
driver->location_active = true;
|
||||
break;
|
||||
}
|
||||
|
@ -1137,16 +1137,16 @@ bool rarch_environment_cb(unsigned cmd, void *data)
|
|||
}
|
||||
}
|
||||
|
||||
free(g_extern.system.special);
|
||||
g_extern.system.special = (struct retro_subsystem_info*)
|
||||
calloc(i, sizeof(*g_extern.system.special));
|
||||
free(global->system.special);
|
||||
global->system.special = (struct retro_subsystem_info*)
|
||||
calloc(i, sizeof(*global->system.special));
|
||||
|
||||
if (!g_extern.system.special)
|
||||
if (!global->system.special)
|
||||
return false;
|
||||
|
||||
memcpy(g_extern.system.special, info,
|
||||
i * sizeof(*g_extern.system.special));
|
||||
g_extern.system.num_special = i;
|
||||
memcpy(global->system.special, info,
|
||||
i * sizeof(*global->system.special));
|
||||
global->system.num_special = i;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1166,15 +1166,15 @@ bool rarch_environment_cb(unsigned cmd, void *data)
|
|||
info[i].types[j].id);
|
||||
}
|
||||
|
||||
free(g_extern.system.ports);
|
||||
g_extern.system.ports = (struct retro_controller_info*)
|
||||
calloc(i, sizeof(*g_extern.system.ports));
|
||||
if (!g_extern.system.ports)
|
||||
free(global->system.ports);
|
||||
global->system.ports = (struct retro_controller_info*)
|
||||
calloc(i, sizeof(*global->system.ports));
|
||||
if (!global->system.ports)
|
||||
return false;
|
||||
|
||||
memcpy(g_extern.system.ports, info,
|
||||
i * sizeof(*g_extern.system.ports));
|
||||
g_extern.system.num_ports = i;
|
||||
memcpy(global->system.ports, info,
|
||||
i * sizeof(*global->system.ports));
|
||||
global->system.num_ports = i;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1182,7 +1182,7 @@ bool rarch_environment_cb(unsigned cmd, void *data)
|
|||
{
|
||||
const struct retro_game_geometry *in_geom =
|
||||
(const struct retro_game_geometry*)data;
|
||||
struct retro_game_geometry *geom = &g_extern.system.av_info.geometry;
|
||||
struct retro_game_geometry *geom = &global->system.av_info.geometry;
|
||||
|
||||
RARCH_LOG("Environ SET_GEOMETRY.\n");
|
||||
|
||||
|
@ -1222,10 +1222,10 @@ bool rarch_environment_cb(unsigned cmd, void *data)
|
|||
case RETRO_ENVIRONMENT_EXEC_ESCAPE:
|
||||
|
||||
if (data)
|
||||
strlcpy(g_extern.fullpath, (const char*)data,
|
||||
sizeof(g_extern.fullpath));
|
||||
strlcpy(global->fullpath, (const char*)data,
|
||||
sizeof(global->fullpath));
|
||||
else
|
||||
*g_extern.fullpath = '\0';
|
||||
*global->fullpath = '\0';
|
||||
|
||||
#if defined(RARCH_CONSOLE)
|
||||
if (driver->frontend_ctx && driver->frontend_ctx->set_fork)
|
||||
|
@ -1237,7 +1237,7 @@ bool rarch_environment_cb(unsigned cmd, void *data)
|
|||
if (cmd == RETRO_ENVIRONMENT_EXEC_ESCAPE)
|
||||
{
|
||||
RARCH_LOG("Environ (Private) EXEC_ESCAPE.\n");
|
||||
g_extern.exec = true;
|
||||
global->exec = true;
|
||||
}
|
||||
else
|
||||
RARCH_LOG("Environ (Private) EXEC.\n");
|
||||
|
|
|
@ -37,6 +37,7 @@ void engine_handle_cmd(void *data)
|
|||
int8_t cmd;
|
||||
struct android_app *android_app = (struct android_app*)g_android;
|
||||
runloop_t *runloop = rarch_main_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
if (read(android_app->msgread, &cmd, sizeof(cmd)) != sizeof(cmd))
|
||||
cmd = -1;
|
||||
|
@ -94,7 +95,7 @@ void engine_handle_cmd(void *data)
|
|||
scond_broadcast(android_app->cond);
|
||||
slock_unlock(android_app->mutex);
|
||||
|
||||
if (!g_extern.system.shutdown)
|
||||
if (!global->system.shutdown)
|
||||
{
|
||||
RARCH_LOG("Pausing RetroArch.\n");
|
||||
runloop->is_paused = true;
|
||||
|
@ -150,7 +151,7 @@ void engine_handle_cmd(void *data)
|
|||
break;
|
||||
|
||||
case APP_CMD_DESTROY:
|
||||
g_extern.system.shutdown = true;
|
||||
global->system.shutdown = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -418,13 +419,14 @@ void ANativeActivity_onCreate(ANativeActivity* activity,
|
|||
|
||||
static bool android_run_events(void *data)
|
||||
{
|
||||
global_t *global = global_get_ptr();
|
||||
int id = ALooper_pollOnce(-1, NULL, NULL, NULL);
|
||||
|
||||
if (id == LOOPER_ID_MAIN)
|
||||
engine_handle_cmd(driver.input_data);
|
||||
|
||||
/* Check if we are exiting. */
|
||||
if (g_extern.system.shutdown)
|
||||
if (global->system.shutdown)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
|
|
@ -158,7 +158,9 @@ int gx_logger_net(struct _reent *r, int fd, const char *ptr, size_t len)
|
|||
#elif defined(HAVE_FILE_LOGGER)
|
||||
int gx_logger_file(struct _reent *r, int fd, const char *ptr, size_t len)
|
||||
{
|
||||
fwrite(ptr, 1, len, g_extern.log_file);
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
fwrite(ptr, 1, len, global->log_file);
|
||||
return len;
|
||||
}
|
||||
#endif
|
||||
|
@ -176,7 +178,8 @@ static void frontend_gx_get_environment_settings(int *argc, char *argv[],
|
|||
#if defined(HAVE_LOGGER)
|
||||
logger_init();
|
||||
#elif defined(HAVE_FILE_LOGGER)
|
||||
g_extern.log_file = fopen("/retroarch-log.txt", "w");
|
||||
global_t *global = global_get_ptr();
|
||||
global->log_file = fopen("/retroarch-log.txt", "w");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
|
|
@ -53,6 +53,7 @@ static bool exitspawn_start_game = false;
|
|||
static void callback_sysutil_exit(uint64_t status,
|
||||
uint64_t param, void *userdata)
|
||||
{
|
||||
|
||||
(void)param;
|
||||
(void)userdata;
|
||||
(void)status;
|
||||
|
@ -62,7 +63,10 @@ static void callback_sysutil_exit(uint64_t status,
|
|||
switch (status)
|
||||
{
|
||||
case CELL_SYSUTIL_REQUEST_EXITGAME:
|
||||
g_extern.system.shutdown = true;
|
||||
{
|
||||
global_t *global = global_get_ptr();
|
||||
global->system.shutdown = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
@ -73,8 +77,9 @@ static void frontend_ps3_get_environment_settings(int *argc, char *argv[],
|
|||
void *args, void *params_data)
|
||||
{
|
||||
#ifndef IS_SALAMANDER
|
||||
bool original_verbose = g_extern.verbosity;
|
||||
g_extern.verbosity = true;
|
||||
global_t *global = global_get_ptr();
|
||||
bool original_verbose = global->verbosity;
|
||||
global->verbosity = true;
|
||||
#endif
|
||||
|
||||
(void)args;
|
||||
|
@ -82,7 +87,7 @@ static void frontend_ps3_get_environment_settings(int *argc, char *argv[],
|
|||
#if defined(HAVE_LOGGER)
|
||||
logger_init();
|
||||
#elif defined(HAVE_FILE_LOGGER)
|
||||
g_extern.log_file = fopen("/retroarch-log.txt", "w");
|
||||
global->log_file = fopen("/retroarch-log.txt", "w");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -207,7 +212,7 @@ static void frontend_ps3_get_environment_settings(int *argc, char *argv[],
|
|||
}
|
||||
|
||||
#ifndef IS_SALAMANDER
|
||||
g_extern.verbosity = original_verbose;
|
||||
global->verbosity = original_verbose;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -311,8 +316,9 @@ static void frontend_ps3_exitspawn(char *core_path, size_t core_path_size)
|
|||
bool should_load_game = false;
|
||||
|
||||
#ifndef IS_SALAMANDER
|
||||
bool original_verbose = g_extern.verbosity;
|
||||
g_extern.verbosity = true;
|
||||
global_t *global = global_get_ptr();
|
||||
bool original_verbose = global->verbosity;
|
||||
global->verbosity = true;
|
||||
|
||||
should_load_game = exitspawn_start_game;
|
||||
|
||||
|
@ -331,7 +337,7 @@ static void frontend_ps3_exitspawn(char *core_path, size_t core_path_size)
|
|||
#endif
|
||||
|
||||
#ifndef IS_SALAMANDER
|
||||
g_extern.verbosity = original_verbose;
|
||||
global->verbosity = original_verbose;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
@ -352,8 +358,9 @@ static void frontend_ps3_exec(const char *path, bool should_load_game)
|
|||
(void)should_load_game;
|
||||
char spawn_data[256];
|
||||
#ifndef IS_SALAMANDER
|
||||
bool original_verbose = g_extern.verbosity;
|
||||
g_extern.verbosity = true;
|
||||
global_t *global = global_get_ptr();
|
||||
bool original_verbose = global->verbosity;
|
||||
global->verbosity = true;
|
||||
|
||||
char game_path[256];
|
||||
game_path[0] = '\0';
|
||||
|
@ -380,9 +387,9 @@ static void frontend_ps3_exec(const char *path, bool should_load_game)
|
|||
NULL, NULL, 0, 1000, SYS_PROCESS_PRIMARY_STACK_SIZE_1M);
|
||||
}
|
||||
#else
|
||||
if (should_load_game && g_extern.fullpath[0] != '\0')
|
||||
if (should_load_game && global->fullpath[0] != '\0')
|
||||
{
|
||||
strlcpy(game_path, g_extern.fullpath, sizeof(game_path));
|
||||
strlcpy(game_path, global->fullpath, sizeof(game_path));
|
||||
|
||||
const char * const spawn_argv[] = {
|
||||
game_path,
|
||||
|
@ -423,7 +430,7 @@ static void frontend_ps3_exec(const char *path, bool should_load_game)
|
|||
cellSysmoduleUnloadModule(CELL_SYSMODULE_NET);
|
||||
|
||||
#ifndef IS_SALAMANDER
|
||||
g_extern.verbosity = original_verbose;
|
||||
global->verbosity = original_verbose;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -57,7 +57,8 @@ static void frontend_psp_get_environment_settings(int *argc, char *argv[],
|
|||
#if defined(HAVE_LOGGER)
|
||||
logger_init();
|
||||
#elif defined(HAVE_FILE_LOGGER)
|
||||
g_extern.log_file = fopen("ms0:/retroarch-log.txt", "w");
|
||||
global_t *global = global_get_ptr();
|
||||
global->log_file = fopen("ms0:/retroarch-log.txt", "w");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -119,12 +120,13 @@ static void frontend_psp_deinit(void *data)
|
|||
{
|
||||
(void)data;
|
||||
#ifndef IS_SALAMANDER
|
||||
g_extern.verbosity = false;
|
||||
global_t *global = global_get_ptr();
|
||||
global->verbosity = false;
|
||||
|
||||
#ifdef HAVE_FILE_LOGGER
|
||||
if (g_extern.log_file)
|
||||
fclose(g_extern.log_file);
|
||||
g_extern.log_file = NULL;
|
||||
if (global->log_file)
|
||||
fclose(global->log_file);
|
||||
global->log_file = NULL;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -196,10 +198,12 @@ static void frontend_psp_exec(const char *path, bool should_load_game)
|
|||
args = strlen(argp) + 1;
|
||||
|
||||
#ifndef IS_SALAMANDER
|
||||
if (should_load_game && g_extern.fullpath[0] != '\0')
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
if (should_load_game && global->fullpath[0] != '\0')
|
||||
{
|
||||
argp[args] = '\0';
|
||||
strlcat(argp + args, g_extern.fullpath, sizeof(argp) - args);
|
||||
strlcat(argp + args, global->fullpath, sizeof(argp) - args);
|
||||
args += strlen(argp + args) + 1;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -106,8 +106,9 @@ static void dol_copy_argv_path(const char *dolpath, const char *argpath)
|
|||
void system_exec_wii(const char *_path, bool should_load_game)
|
||||
{
|
||||
#ifndef IS_SALAMANDER
|
||||
bool original_verbose = g_extern.verbosity;
|
||||
g_extern.verbosity = true;
|
||||
global_t *global = global_get_ptr();
|
||||
bool original_verbose = global->verbosity;
|
||||
global->verbosity = true;
|
||||
#endif
|
||||
|
||||
char path[PATH_MAX_LENGTH];
|
||||
|
@ -120,7 +121,7 @@ void system_exec_wii(const char *_path, bool should_load_game)
|
|||
#ifdef IS_SALAMANDER
|
||||
strlcpy(game_path, gx_rom_path, sizeof(game_path));
|
||||
#else
|
||||
strlcpy(game_path, g_extern.fullpath, sizeof(game_path));
|
||||
strlcpy(game_path, global->fullpath, sizeof(game_path));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -173,6 +174,6 @@ void system_exec_wii(const char *_path, bool should_load_game)
|
|||
exit:
|
||||
(void)0;
|
||||
#ifndef IS_SALAMANDER
|
||||
g_extern.verbosity = original_verbose;
|
||||
global->verbosity = original_verbose;
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -65,8 +65,9 @@ HRESULT xbox_io_mount(const char* szDrive, char* szDevice)
|
|||
static HRESULT xbox_io_mount(char *szDrive, char *szDevice)
|
||||
{
|
||||
#ifndef IS_SALAMANDER
|
||||
bool original_verbose = g_extern.verbosity;
|
||||
g_extern.verbosity = true;
|
||||
global_t *global = global_get_ptr();
|
||||
bool original_verbose = global->verbosity;
|
||||
global->verbosity = true;
|
||||
#endif
|
||||
char szSourceDevice[48];
|
||||
char szDestinationDrive[16];
|
||||
|
@ -97,7 +98,7 @@ static HRESULT xbox_io_mount(char *szDrive, char *szDevice)
|
|||
IoCreateSymbolicLink(&LinkName, &DeviceName);
|
||||
|
||||
#ifndef IS_SALAMANDER
|
||||
g_extern.verbosity = original_verbose;
|
||||
global->verbosity = original_verbose;
|
||||
#endif
|
||||
return S_OK;
|
||||
}
|
||||
|
@ -128,15 +129,16 @@ static void frontend_xdk_get_environment_settings(int *argc, char *argv[],
|
|||
(void)ret;
|
||||
|
||||
#ifndef IS_SALAMANDER
|
||||
bool original_verbose = g_extern.verbosity;
|
||||
g_extern.verbosity = true;
|
||||
global_t *global = global_get_ptr();
|
||||
bool original_verbose = global->verbosity;
|
||||
global->verbosity = true;
|
||||
#endif
|
||||
|
||||
#ifndef IS_SALAMANDER
|
||||
#if defined(HAVE_LOGGER)
|
||||
logger_init();
|
||||
#elif defined(HAVE_FILE_LOGGER)
|
||||
g_extern.log_file = fopen("/retroarch-log.txt", "w");
|
||||
global->log_file = fopen("/retroarch-log.txt", "w");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -278,7 +280,7 @@ static void frontend_xdk_get_environment_settings(int *argc, char *argv[],
|
|||
|
||||
#ifndef IS_SALAMANDER
|
||||
exit:
|
||||
g_extern.verbosity = original_verbose;
|
||||
global->verbosity = original_verbose;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -320,8 +322,9 @@ static void frontend_xdk_exitspawn(char *core_path,
|
|||
static void frontend_xdk_exec(const char *path, bool should_load_game)
|
||||
{
|
||||
#ifndef IS_SALAMANDER
|
||||
bool original_verbose = g_extern.verbosity;
|
||||
g_extern.verbosity = true;
|
||||
global_t *global = global_get_ptr();
|
||||
bool original_verbose = global->verbosity;
|
||||
global->verbosity = true;
|
||||
#endif
|
||||
(void)should_load_game;
|
||||
|
||||
|
@ -333,16 +336,16 @@ static void frontend_xdk_exec(const char *path, bool should_load_game)
|
|||
#if defined(_XBOX1)
|
||||
LAUNCH_DATA ptr;
|
||||
memset(&ptr, 0, sizeof(ptr));
|
||||
if (should_load_game && g_extern.fullpath[0] != '\0')
|
||||
snprintf((char*)ptr.Data, sizeof(ptr.Data), "%s", g_extern.fullpath);
|
||||
if (should_load_game && global->fullpath[0] != '\0')
|
||||
snprintf((char*)ptr.Data, sizeof(ptr.Data), "%s", global->fullpath);
|
||||
|
||||
if (path[0] != '\0')
|
||||
XLaunchNewImage(path, ptr.Data[0] != '\0' ? &ptr : NULL);
|
||||
#elif defined(_XBOX360)
|
||||
char game_path[1024];
|
||||
if (should_load_game && g_extern.fullpath[0] != '\0')
|
||||
if (should_load_game && global->fullpath[0] != '\0')
|
||||
{
|
||||
strlcpy(game_path, g_extern.fullpath, sizeof(game_path));
|
||||
strlcpy(game_path, global->fullpath, sizeof(game_path));
|
||||
XSetLaunchData(game_path, MAX_LAUNCH_DATA_SIZE);
|
||||
}
|
||||
|
||||
|
@ -351,7 +354,7 @@ static void frontend_xdk_exec(const char *path, bool should_load_game)
|
|||
#endif
|
||||
#endif
|
||||
#ifndef IS_SALAMANDER
|
||||
g_extern.verbosity = original_verbose;
|
||||
global->verbosity = original_verbose;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -58,18 +58,20 @@
|
|||
void main_exit_save_config(void)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
if (settings->config_save_on_exit && *g_extern.config_path)
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
if (settings->config_save_on_exit && *global->config_path)
|
||||
{
|
||||
/* Save last core-specific config to the default config location,
|
||||
* needed on consoles for core switching and reusing last good
|
||||
* config for new cores.
|
||||
*/
|
||||
config_save_file(g_extern.config_path);
|
||||
config_save_file(global->config_path);
|
||||
|
||||
/* Flush out the core specific config. */
|
||||
if (*g_extern.core_specific_config_path &&
|
||||
if (*global->core_specific_config_path &&
|
||||
settings->core_specific_config)
|
||||
config_save_file(g_extern.core_specific_config_path);
|
||||
config_save_file(global->core_specific_config_path);
|
||||
}
|
||||
|
||||
rarch_main_command(RARCH_CMD_AUTOSAVE_STATE);
|
||||
|
@ -87,12 +89,13 @@ void main_exit(args_type() args)
|
|||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
g_extern.system.shutdown = false;
|
||||
global->system.shutdown = false;
|
||||
|
||||
main_exit_save_config();
|
||||
|
||||
if (g_extern.main_is_init)
|
||||
if (global->main_is_init)
|
||||
{
|
||||
#ifdef HAVE_MENU
|
||||
/* Do not want menu context to live any more. */
|
||||
|
@ -169,8 +172,9 @@ static void history_playlist_push(content_playlist_t *playlist,
|
|||
struct retro_system_info *info)
|
||||
{
|
||||
char tmp[PATH_MAX_LENGTH];
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
if (!playlist || g_extern.libretro_dummy || !info)
|
||||
if (!playlist || global->libretro_dummy || !info)
|
||||
return;
|
||||
|
||||
/* Path can be relative here.
|
||||
|
@ -181,7 +185,7 @@ static void history_playlist_push(content_playlist_t *playlist,
|
|||
if (*tmp)
|
||||
path_resolve_realpath(tmp, sizeof(tmp));
|
||||
|
||||
if (g_extern.system.no_content || *tmp)
|
||||
if (global->system.no_content || *tmp)
|
||||
content_playlist_push(playlist,
|
||||
*tmp ? tmp : NULL,
|
||||
core_path,
|
||||
|
@ -207,22 +211,23 @@ bool main_load_content(int argc, char **argv, args_type() args,
|
|||
process_args_t process_args)
|
||||
{
|
||||
unsigned i;
|
||||
bool retval = true;
|
||||
int ret = 0, rarch_argc = 0;
|
||||
char *rarch_argv[MAX_ARGS] = {NULL};
|
||||
char *argv_copy [MAX_ARGS] = {NULL};
|
||||
char **rarch_argv_ptr = (char**)argv;
|
||||
int *rarch_argc_ptr = (int*)&argc;
|
||||
bool retval = true;
|
||||
int ret = 0, rarch_argc = 0;
|
||||
char *rarch_argv[MAX_ARGS] = {NULL};
|
||||
char *argv_copy [MAX_ARGS] = {NULL};
|
||||
char **rarch_argv_ptr = (char**)argv;
|
||||
int *rarch_argc_ptr = (int*)&argc;
|
||||
global_t *global = global_get_ptr();
|
||||
struct rarch_main_wrap *wrap_args = (struct rarch_main_wrap*)
|
||||
calloc(1, sizeof(*wrap_args));
|
||||
|
||||
if (!wrap_args)
|
||||
return false;
|
||||
|
||||
(void)rarch_argc_ptr;
|
||||
(void)rarch_argv_ptr;
|
||||
(void)ret;
|
||||
|
||||
if (!wrap_args)
|
||||
return false;
|
||||
|
||||
rarch_assert(wrap_args);
|
||||
|
||||
if (environ_get)
|
||||
|
@ -238,7 +243,7 @@ bool main_load_content(int argc, char **argv, args_type() args,
|
|||
rarch_argc_ptr = (int*)&rarch_argc;
|
||||
}
|
||||
|
||||
if (g_extern.main_is_init)
|
||||
if (global->main_is_init)
|
||||
rarch_main_deinit();
|
||||
|
||||
if ((ret = rarch_main_init(*rarch_argc_ptr, rarch_argv_ptr)))
|
||||
|
@ -305,11 +310,13 @@ returntype main_entry(signature())
|
|||
|
||||
if (settings->history_list_enable)
|
||||
{
|
||||
if (g_extern.content_is_init || g_extern.system.no_content)
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
if (global->content_is_init || global->system.no_content)
|
||||
history_playlist_push(g_defaults.history,
|
||||
g_extern.fullpath,
|
||||
global->fullpath,
|
||||
settings->libretro,
|
||||
&g_extern.system.info);
|
||||
&global->system.info);
|
||||
}
|
||||
|
||||
#if defined(HAVE_MAIN_LOOP)
|
||||
|
|
|
@ -660,6 +660,7 @@ static bool gl_init_hw_render(gl_t *gl, unsigned width, unsigned height)
|
|||
unsigned i;
|
||||
bool depth = false, stencil = false;
|
||||
GLint max_fbo_size = 0, max_renderbuffer_size = 0;
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
/* We can only share texture objects through contexts.
|
||||
* FBOs are "abstract" objects and are not shared. */
|
||||
|
@ -677,8 +678,8 @@ static bool gl_init_hw_render(gl_t *gl, unsigned width, unsigned height)
|
|||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
glGenFramebuffers(gl->textures, gl->hw_render_fbo);
|
||||
|
||||
depth = g_extern.system.hw_render_callback.depth;
|
||||
stencil = g_extern.system.hw_render_callback.stencil;
|
||||
depth = global->system.hw_render_callback.depth;
|
||||
stencil = global->system.hw_render_callback.stencil;
|
||||
|
||||
#ifdef HAVE_OPENGLES2
|
||||
if (stencil && !gl_query_extension(gl, "OES_packed_depth_stencil"))
|
||||
|
@ -773,6 +774,7 @@ void gl_set_viewport(gl_t *gl, unsigned width,
|
|||
float device_aspect = (float)width / height;
|
||||
struct gl_ortho ortho = {0, 1, 0, 1, -1, 1};
|
||||
settings_t *settings = config_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
if (gl->ctx_driver->translate_aspect)
|
||||
device_aspect = gl->ctx_driver->translate_aspect(gl, width, height);
|
||||
|
@ -780,19 +782,19 @@ void gl_set_viewport(gl_t *gl, unsigned width,
|
|||
if (settings->video.scale_integer && !force_full)
|
||||
{
|
||||
video_viewport_get_scaled_integer(&gl->vp, width, height,
|
||||
g_extern.system.aspect_ratio, gl->keep_aspect);
|
||||
global->system.aspect_ratio, gl->keep_aspect);
|
||||
width = gl->vp.width;
|
||||
height = gl->vp.height;
|
||||
}
|
||||
else if (gl->keep_aspect && !force_full)
|
||||
{
|
||||
float delta;
|
||||
float desired_aspect = g_extern.system.aspect_ratio;
|
||||
float desired_aspect = global->system.aspect_ratio;
|
||||
|
||||
#if defined(HAVE_MENU)
|
||||
if (settings->video.aspect_ratio_idx == ASPECT_RATIO_CUSTOM)
|
||||
{
|
||||
const struct video_viewport *custom = &g_extern.console.screen.viewports.custom_vp;
|
||||
const struct video_viewport *custom = &global->console.screen.viewports.custom_vp;
|
||||
|
||||
/* GL has bottom-left origin viewport. */
|
||||
x = custom->x;
|
||||
|
@ -1820,12 +1822,13 @@ static void gl_set_nonblock_state(void *data, bool state)
|
|||
static bool resolve_extensions(gl_t *gl)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
#ifndef HAVE_OPENGLES
|
||||
const char *vendor = NULL;
|
||||
const char *renderer = NULL;
|
||||
gl->core_context =
|
||||
(g_extern.system.hw_render_callback.context_type
|
||||
(global->system.hw_render_callback.context_type
|
||||
== RETRO_HW_CONTEXT_OPENGL_CORE);
|
||||
|
||||
if (gl->core_context)
|
||||
|
@ -1987,16 +1990,17 @@ static void gl_init_pbo_readback(gl_t *gl)
|
|||
{
|
||||
unsigned i;
|
||||
struct scaler_ctx *scaler = NULL;
|
||||
global_t *global = global_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
(void)scaler;
|
||||
/* Only bother with this if we're doing GPU recording.
|
||||
* Check g_extern.recording_enable and not
|
||||
* Check global->recording_enable and not
|
||||
* driver.recording_data, because recording is
|
||||
* not initialized yet.
|
||||
*/
|
||||
gl->pbo_readback_enable = settings->video.gpu_record
|
||||
&& g_extern.record.enable;
|
||||
&& global->record.enable;
|
||||
if (!gl->pbo_readback_enable)
|
||||
return;
|
||||
|
||||
|
@ -2036,9 +2040,10 @@ static void gl_init_pbo_readback(gl_t *gl)
|
|||
|
||||
static const gfx_ctx_driver_t *gl_get_context(gl_t *gl)
|
||||
{
|
||||
global_t *global = global_get_ptr();
|
||||
const struct retro_hw_render_callback *cb =
|
||||
(const struct retro_hw_render_callback*)
|
||||
&g_extern.system.hw_render_callback;
|
||||
&global->system.hw_render_callback;
|
||||
unsigned major = cb->version_major;
|
||||
unsigned minor = cb->version_minor;
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
@ -2216,6 +2221,7 @@ static void *gl_init(const video_info_t *video, const input_driver_t **input, vo
|
|||
const char *version = NULL;
|
||||
struct retro_hw_render_callback *hw_render = NULL;
|
||||
settings_t *settings = config_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
#ifdef _WIN32
|
||||
gfx_set_dwm();
|
||||
#endif
|
||||
|
@ -2299,7 +2305,7 @@ static void *gl_init(const video_info_t *video, const input_driver_t **input, vo
|
|||
gl->full_y = gl->win_height;
|
||||
}
|
||||
|
||||
hw_render = &g_extern.system.hw_render_callback;
|
||||
hw_render = &global->system.hw_render_callback;
|
||||
gl->vertex_ptr = hw_render->bottom_left_origin ? vertexes : vertexes_flipped;
|
||||
|
||||
/* Better pipelining with GPU due to synchronous glSubTexImage.
|
||||
|
@ -3066,14 +3072,15 @@ static retro_proc_address_t gl_get_proc_address(void *data, const char *sym)
|
|||
|
||||
static void gl_set_aspect_ratio(void *data, unsigned aspect_ratio_idx)
|
||||
{
|
||||
gl_t *gl = (gl_t*)data;
|
||||
gl_t *gl = (gl_t*)data;
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
switch (aspect_ratio_idx)
|
||||
{
|
||||
case ASPECT_RATIO_SQUARE:
|
||||
video_viewport_set_square_pixel(
|
||||
g_extern.system.av_info.geometry.base_width,
|
||||
g_extern.system.av_info.geometry.base_height);
|
||||
global->system.av_info.geometry.base_width,
|
||||
global->system.av_info.geometry.base_height);
|
||||
break;
|
||||
|
||||
case ASPECT_RATIO_CORE:
|
||||
|
@ -3088,7 +3095,7 @@ static void gl_set_aspect_ratio(void *data, unsigned aspect_ratio_idx)
|
|||
break;
|
||||
}
|
||||
|
||||
g_extern.system.aspect_ratio = aspectratio_lut[aspect_ratio_idx].value;
|
||||
global->system.aspect_ratio = aspectratio_lut[aspect_ratio_idx].value;
|
||||
|
||||
if (!gl)
|
||||
return;
|
||||
|
|
|
@ -263,6 +263,7 @@ static void *psp_init(const video_info_t *video,
|
|||
int pixel_format, lut_pixel_format, lut_block_count;
|
||||
unsigned int red_shift, color_mask;
|
||||
void *displayBuffer, *LUT_r, *LUT_b;
|
||||
global_t *global = global_get_ptr();
|
||||
psp1_video_t *psp = (psp1_video_t*)calloc(1, sizeof(psp1_video_t));
|
||||
|
||||
if (!psp)
|
||||
|
@ -358,7 +359,7 @@ static void *psp_init(const video_info_t *video,
|
|||
psp->bpp_log2 = 1;
|
||||
|
||||
pixel_format =
|
||||
(g_extern.system.pix_fmt == RETRO_PIXEL_FORMAT_0RGB1555)
|
||||
(global->system.pix_fmt == RETRO_PIXEL_FORMAT_0RGB1555)
|
||||
? GU_PSM_5551 : GU_PSM_5650 ;
|
||||
|
||||
lut_pixel_format = GU_PSM_T16;
|
||||
|
@ -698,24 +699,25 @@ static void psp_update_viewport(psp1_video_t* psp)
|
|||
float width = SCEGU_SCR_WIDTH;
|
||||
float height = SCEGU_SCR_HEIGHT;
|
||||
settings_t *settings = config_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
if (settings->video.scale_integer)
|
||||
{
|
||||
video_viewport_get_scaled_integer(&psp->vp, SCEGU_SCR_WIDTH,
|
||||
SCEGU_SCR_HEIGHT, g_extern.system.aspect_ratio, psp->keep_aspect);
|
||||
SCEGU_SCR_HEIGHT, global->system.aspect_ratio, psp->keep_aspect);
|
||||
width = psp->vp.width;
|
||||
height = psp->vp.height;
|
||||
}
|
||||
else if (psp->keep_aspect)
|
||||
{
|
||||
float delta;
|
||||
float desired_aspect = g_extern.system.aspect_ratio;
|
||||
float desired_aspect = global->system.aspect_ratio;
|
||||
|
||||
#if defined(HAVE_MENU)
|
||||
if (settings->video.aspect_ratio_idx == ASPECT_RATIO_CUSTOM)
|
||||
{
|
||||
const struct video_viewport *custom =
|
||||
&g_extern.console.screen.viewports.custom_vp;
|
||||
&global->console.screen.viewports.custom_vp;
|
||||
|
||||
if (custom)
|
||||
{
|
||||
|
@ -795,13 +797,14 @@ static void psp_set_filtering(void *data, unsigned index, bool smooth)
|
|||
static void psp_set_aspect_ratio(void *data, unsigned aspectratio_index)
|
||||
{
|
||||
psp1_video_t *psp = (psp1_video_t*)data;
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
switch (aspectratio_index)
|
||||
{
|
||||
case ASPECT_RATIO_SQUARE:
|
||||
video_viewport_set_square_pixel(
|
||||
g_extern.system.av_info.geometry.base_width,
|
||||
g_extern.system.av_info.geometry.base_height);
|
||||
global->system.av_info.geometry.base_width,
|
||||
global->system.av_info.geometry.base_height);
|
||||
break;
|
||||
|
||||
case ASPECT_RATIO_CORE:
|
||||
|
@ -816,7 +819,7 @@ static void psp_set_aspect_ratio(void *data, unsigned aspectratio_index)
|
|||
break;
|
||||
}
|
||||
|
||||
g_extern.system.aspect_ratio = aspectratio_lut[aspectratio_index].value;
|
||||
global->system.aspect_ratio = aspectratio_lut[aspectratio_index].value;
|
||||
|
||||
psp->keep_aspect = true;
|
||||
psp->should_resize = true;
|
||||
|
|
|
@ -291,7 +291,8 @@ static void vg_calculate_quad(vg_t *vg)
|
|||
// set viewport for aspect ratio, taken from the OpenGL driver
|
||||
if (vg->mKeepAspect)
|
||||
{
|
||||
float desired_aspect = g_extern.system.aspect_ratio;
|
||||
global_t *global = global_get_ptr();
|
||||
float desired_aspect = global->system.aspect_ratio;
|
||||
|
||||
// If the aspect ratios of screen and desired aspect ratio are sufficiently equal (floating point stuff),
|
||||
// assume they are actually equal.
|
||||
|
|
|
@ -149,10 +149,11 @@ void find_video_driver(void)
|
|||
{
|
||||
int i;
|
||||
driver_t *driver = driver_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
#if defined(HAVE_OPENGL) && defined(HAVE_FBO)
|
||||
if (g_extern.system.hw_render_callback.context_type)
|
||||
if (global->system.hw_render_callback.context_type)
|
||||
{
|
||||
RARCH_LOG("Using HW render, OpenGL driver forced.\n");
|
||||
driver->video = &video_gl;
|
||||
|
@ -202,11 +203,12 @@ void find_video_driver(void)
|
|||
void *video_driver_resolve(const video_driver_t **drv)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
#ifdef HAVE_THREADS
|
||||
if (settings->video.threaded
|
||||
&& !g_extern.system.hw_render_callback.context_type)
|
||||
&& !global->system.hw_render_callback.context_type)
|
||||
return rarch_threaded_video_resolve(drv);
|
||||
#endif
|
||||
if (drv)
|
||||
|
@ -275,15 +277,18 @@ bool video_driver_set_shader(enum rarch_shader_type type,
|
|||
|
||||
static void deinit_video_filter(void)
|
||||
{
|
||||
rarch_softfilter_free(g_extern.filter.filter);
|
||||
free(g_extern.filter.buffer);
|
||||
memset(&g_extern.filter, 0, sizeof(g_extern.filter));
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
rarch_softfilter_free(global->filter.filter);
|
||||
free(global->filter.buffer);
|
||||
memset(&global->filter, 0, sizeof(global->filter));
|
||||
}
|
||||
|
||||
static void init_video_filter(enum retro_pixel_format colfmt)
|
||||
{
|
||||
unsigned width, height, pow2_x, pow2_y, maxsize;
|
||||
struct retro_game_geometry *geom = NULL;
|
||||
global_t *global = global_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
deinit_video_filter();
|
||||
|
@ -295,43 +300,43 @@ static void init_video_filter(enum retro_pixel_format colfmt)
|
|||
if (colfmt == RETRO_PIXEL_FORMAT_0RGB1555)
|
||||
colfmt = RETRO_PIXEL_FORMAT_RGB565;
|
||||
|
||||
if (g_extern.system.hw_render_callback.context_type)
|
||||
if (global->system.hw_render_callback.context_type)
|
||||
{
|
||||
RARCH_WARN("Cannot use CPU filters when hardware rendering is used.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
geom = (struct retro_game_geometry*)&g_extern.system.av_info.geometry;
|
||||
geom = (struct retro_game_geometry*)&global->system.av_info.geometry;
|
||||
width = geom->max_width;
|
||||
height = geom->max_height;
|
||||
|
||||
g_extern.filter.filter = rarch_softfilter_new(
|
||||
global->filter.filter = rarch_softfilter_new(
|
||||
settings->video.softfilter_plugin,
|
||||
RARCH_SOFTFILTER_THREADS_AUTO, colfmt, width, height);
|
||||
|
||||
if (!g_extern.filter.filter)
|
||||
if (!global->filter.filter)
|
||||
{
|
||||
RARCH_ERR("Failed to load filter.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
rarch_softfilter_get_max_output_size(g_extern.filter.filter,
|
||||
rarch_softfilter_get_max_output_size(global->filter.filter,
|
||||
&width, &height);
|
||||
|
||||
pow2_x = next_pow2(width);
|
||||
pow2_y = next_pow2(height);
|
||||
maxsize = max(pow2_x, pow2_y);
|
||||
g_extern.filter.scale = maxsize / RARCH_SCALE_BASE;
|
||||
global->filter.scale = maxsize / RARCH_SCALE_BASE;
|
||||
|
||||
g_extern.filter.out_rgb32 = rarch_softfilter_get_output_format(
|
||||
g_extern.filter.filter) == RETRO_PIXEL_FORMAT_XRGB8888;
|
||||
global->filter.out_rgb32 = rarch_softfilter_get_output_format(
|
||||
global->filter.filter) == RETRO_PIXEL_FORMAT_XRGB8888;
|
||||
|
||||
g_extern.filter.out_bpp = g_extern.filter.out_rgb32 ?
|
||||
global->filter.out_bpp = global->filter.out_rgb32 ?
|
||||
sizeof(uint32_t) : sizeof(uint16_t);
|
||||
|
||||
/* TODO: Aligned output. */
|
||||
g_extern.filter.buffer = malloc(width * height * g_extern.filter.out_bpp);
|
||||
if (!g_extern.filter.buffer)
|
||||
global->filter.buffer = malloc(width * height * global->filter.out_bpp);
|
||||
if (!global->filter.buffer)
|
||||
goto error;
|
||||
|
||||
return;
|
||||
|
@ -409,18 +414,19 @@ void init_video(void)
|
|||
static uint16_t dummy_pixels[32] = {0};
|
||||
runloop_t *runloop = rarch_main_get_ptr();
|
||||
driver_t *driver = driver_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
init_video_filter(g_extern.system.pix_fmt);
|
||||
init_video_filter(global->system.pix_fmt);
|
||||
rarch_main_command(RARCH_CMD_SHADER_DIR_INIT);
|
||||
|
||||
geom = (const struct retro_game_geometry*)&g_extern.system.av_info.geometry;
|
||||
geom = (const struct retro_game_geometry*)&global->system.av_info.geometry;
|
||||
max_dim = max(geom->max_width, geom->max_height);
|
||||
scale = next_pow2(max_dim) / RARCH_SCALE_BASE;
|
||||
scale = max(scale, 1);
|
||||
|
||||
if (g_extern.filter.filter)
|
||||
scale = g_extern.filter.scale;
|
||||
if (global->filter.filter)
|
||||
scale = global->filter.scale;
|
||||
|
||||
/* Update core-dependent aspect ratio values. */
|
||||
video_viewport_set_square_pixel(geom->base_width, geom->base_height);
|
||||
|
@ -428,7 +434,8 @@ void init_video(void)
|
|||
video_viewport_set_config();
|
||||
|
||||
/* Update CUSTOM viewport. */
|
||||
custom_vp = &g_extern.console.screen.viewports.custom_vp;
|
||||
custom_vp = &global->console.screen.viewports.custom_vp;
|
||||
|
||||
if (settings->video.aspect_ratio_idx == ASPECT_RATIO_CUSTOM)
|
||||
{
|
||||
float default_aspect = aspectratio_lut[ASPECT_RATIO_CORE].value;
|
||||
|
@ -437,7 +444,7 @@ void init_video(void)
|
|||
(float)custom_vp->width / custom_vp->height : default_aspect;
|
||||
}
|
||||
|
||||
g_extern.system.aspect_ratio =
|
||||
global->system.aspect_ratio =
|
||||
aspectratio_lut[settings->video.aspect_ratio_idx].value;
|
||||
|
||||
if (settings->video.fullscreen)
|
||||
|
@ -451,13 +458,13 @@ void init_video(void)
|
|||
{
|
||||
/* Do rounding here to simplify integer scale correctness. */
|
||||
unsigned base_width = roundf(geom->base_height *
|
||||
g_extern.system.aspect_ratio);
|
||||
width = roundf(base_width * settings->video.scale);
|
||||
global->system.aspect_ratio);
|
||||
width = roundf(base_width * settings->video.scale);
|
||||
height = roundf(geom->base_height * settings->video.scale);
|
||||
}
|
||||
else
|
||||
{
|
||||
width = roundf(geom->base_width * settings->video.scale);
|
||||
width = roundf(geom->base_width * settings->video.scale);
|
||||
height = roundf(geom->base_height * settings->video.scale);
|
||||
}
|
||||
}
|
||||
|
@ -480,7 +487,7 @@ void init_video(void)
|
|||
video.width = width;
|
||||
video.height = height;
|
||||
video.fullscreen = settings->video.fullscreen;
|
||||
video.vsync = settings->video.vsync && !g_extern.system.force_nonblock;
|
||||
video.vsync = settings->video.vsync && !global->system.force_nonblock;
|
||||
video.force_aspect = settings->video.force_aspect;
|
||||
#ifdef GEKKO
|
||||
video.viwidth = settings->video.viwidth;
|
||||
|
@ -488,16 +495,16 @@ void init_video(void)
|
|||
#endif
|
||||
video.smooth = settings->video.smooth;
|
||||
video.input_scale = scale;
|
||||
video.rgb32 = g_extern.filter.filter ?
|
||||
g_extern.filter.out_rgb32 :
|
||||
(g_extern.system.pix_fmt == RETRO_PIXEL_FORMAT_XRGB8888);
|
||||
video.rgb32 = global->filter.filter ?
|
||||
global->filter.out_rgb32 :
|
||||
(global->system.pix_fmt == RETRO_PIXEL_FORMAT_XRGB8888);
|
||||
|
||||
tmp = (const input_driver_t*)driver->input;
|
||||
/* Need to grab the "real" video driver interface on a reinit. */
|
||||
find_video_driver();
|
||||
|
||||
#ifdef HAVE_THREADS
|
||||
if (settings->video.threaded && !g_extern.system.hw_render_callback.context_type)
|
||||
if (settings->video.threaded && !global->system.hw_render_callback.context_type)
|
||||
{
|
||||
/* Can't do hardware rendering with threaded driver currently. */
|
||||
RARCH_LOG("Starting threaded video driver ...\n");
|
||||
|
@ -536,7 +543,7 @@ void init_video(void)
|
|||
|
||||
if (driver->video->set_rotation)
|
||||
driver->video->set_rotation(driver->video_data,
|
||||
(settings->video.rotation + g_extern.system.rotation) % 4);
|
||||
(settings->video.rotation + global->system.rotation) % 4);
|
||||
|
||||
if (driver->video->suppress_screensaver)
|
||||
driver->video->suppress_screensaver(driver->video_data,
|
||||
|
@ -550,10 +557,10 @@ void init_video(void)
|
|||
|
||||
runloop->measure_data.frame_time_samples_count = 0;
|
||||
|
||||
g_extern.frame_cache.width = 4;
|
||||
g_extern.frame_cache.height = 4;
|
||||
g_extern.frame_cache.pitch = 8;
|
||||
g_extern.frame_cache.data = &dummy_pixels;
|
||||
global->frame_cache.width = 4;
|
||||
global->frame_cache.height = 4;
|
||||
global->frame_cache.pitch = 8;
|
||||
global->frame_cache.data = &dummy_pixels;
|
||||
|
||||
#if defined(PSP)
|
||||
if (driver->video_poke && driver->video_poke->set_texture_frame)
|
||||
|
|
|
@ -23,11 +23,12 @@
|
|||
void video_monitor_adjust_system_rates(void)
|
||||
{
|
||||
float timing_skew;
|
||||
global_t *global = global_get_ptr();
|
||||
const struct retro_system_timing *info =
|
||||
(const struct retro_system_timing*)&g_extern.system.av_info.timing;
|
||||
(const struct retro_system_timing*)&global->system.av_info.timing;
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
g_extern.system.force_nonblock = false;
|
||||
global->system.force_nonblock = false;
|
||||
|
||||
if (info->fps <= 0.0)
|
||||
return;
|
||||
|
@ -47,7 +48,7 @@ void video_monitor_adjust_system_rates(void)
|
|||
return;
|
||||
|
||||
/* We won't be able to do VSync reliably when game FPS > monitor FPS. */
|
||||
g_extern.system.force_nonblock = true;
|
||||
global->system.force_nonblock = true;
|
||||
RARCH_LOG("Game FPS > Monitor FPS. Cannot rely on VSync.\n");
|
||||
}
|
||||
|
||||
|
@ -186,6 +187,7 @@ bool video_monitor_get_fps(char *buf, size_t size,
|
|||
static retro_time_t curr_time;
|
||||
static retro_time_t fps_time;
|
||||
runloop_t *runloop = rarch_main_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
*buf = '\0';
|
||||
|
||||
|
@ -207,7 +209,7 @@ bool video_monitor_get_fps(char *buf, size_t size,
|
|||
curr_time = new_time;
|
||||
|
||||
snprintf(buf, size, "%s || FPS: %6.1f || Frames: %u",
|
||||
g_extern.title_buf, last_fps, runloop->frames.video.count);
|
||||
global->title_buf, last_fps, runloop->frames.video.count);
|
||||
ret = true;
|
||||
}
|
||||
|
||||
|
@ -219,7 +221,7 @@ bool video_monitor_get_fps(char *buf, size_t size,
|
|||
}
|
||||
|
||||
curr_time = fps_time = new_time;
|
||||
strlcpy(buf, g_extern.title_buf, size);
|
||||
strlcpy(buf, global->title_buf, size);
|
||||
if (buf_fps)
|
||||
strlcpy(buf_fps, "N/A", size_fps);
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@ void deinit_pixel_converter(void)
|
|||
bool init_video_pixel_converter(unsigned size)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
/* This function can be called multiple times
|
||||
* without deiniting first on consoles. */
|
||||
|
@ -38,7 +39,7 @@ bool init_video_pixel_converter(unsigned size)
|
|||
|
||||
/* If pixel format is not 0RGB1555, we don't need to do
|
||||
* any internal pixel conversion. */
|
||||
if (g_extern.system.pix_fmt != RETRO_PIXEL_FORMAT_0RGB1555)
|
||||
if (global->system.pix_fmt != RETRO_PIXEL_FORMAT_0RGB1555)
|
||||
return true;
|
||||
|
||||
RARCH_WARN("0RGB1555 pixel format is deprecated, and will be slower. For 15/16-bit, RGB565 format is preferred.\n");
|
||||
|
|
|
@ -84,9 +84,10 @@ unsigned video_texture_load(void *data,
|
|||
enum texture_filter_type filter_type)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
if (settings->video.threaded
|
||||
&& !g_extern.system.hw_render_callback.context_type)
|
||||
&& !global->system.hw_render_callback.context_type)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
thread_video_t *thr = (thread_video_t*)driver->video_data;
|
||||
|
|
|
@ -90,7 +90,8 @@ void video_viewport_set_square_pixel(unsigned width, unsigned height)
|
|||
**/
|
||||
void video_viewport_set_core(void)
|
||||
{
|
||||
struct retro_game_geometry *geom = &g_extern.system.av_info.geometry;
|
||||
global_t *global = global_get_ptr();
|
||||
struct retro_game_geometry *geom = &global->system.av_info.geometry;
|
||||
|
||||
if (!geom || geom->base_width <= 0.0f || geom->base_height <= 0.0f)
|
||||
return;
|
||||
|
@ -111,10 +112,11 @@ void video_viewport_set_core(void)
|
|||
void video_viewport_set_config(void)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
if (settings->video.aspect_ratio < 0.0f)
|
||||
{
|
||||
struct retro_game_geometry *geom = &g_extern.system.av_info.geometry;
|
||||
struct retro_game_geometry *geom = &global->system.av_info.geometry;
|
||||
|
||||
if (geom && geom->aspect_ratio > 0.0f && settings->video.aspect_ratio_auto)
|
||||
aspectratio_lut[ASPECT_RATIO_CONFIG].value = geom->aspect_ratio;
|
||||
|
@ -154,6 +156,7 @@ void video_viewport_get_scaled_integer(struct video_viewport *vp,
|
|||
{
|
||||
int padding_x = 0, padding_y = 0;
|
||||
settings_t *settings = config_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
if (!vp)
|
||||
return;
|
||||
|
@ -161,7 +164,7 @@ void video_viewport_get_scaled_integer(struct video_viewport *vp,
|
|||
if (settings->video.aspect_ratio_idx == ASPECT_RATIO_CUSTOM)
|
||||
{
|
||||
const struct video_viewport *custom =
|
||||
&g_extern.console.screen.viewports.custom_vp;
|
||||
&global->console.screen.viewports.custom_vp;
|
||||
|
||||
if (custom)
|
||||
{
|
||||
|
@ -176,7 +179,7 @@ void video_viewport_get_scaled_integer(struct video_viewport *vp,
|
|||
unsigned base_width;
|
||||
/* Use system reported sizes as these define the
|
||||
* geometry for the "normal" case. */
|
||||
unsigned base_height = g_extern.system.av_info.geometry.base_height;
|
||||
unsigned base_height = global->system.av_info.geometry.base_height;
|
||||
|
||||
if (base_height == 0)
|
||||
base_height = 1;
|
||||
|
@ -186,7 +189,7 @@ void video_viewport_get_scaled_integer(struct video_viewport *vp,
|
|||
* but it is desirable in some cases.
|
||||
*
|
||||
* If square pixels are used, base_height will be equal to
|
||||
* g_extern.system.av_info.base_height. */
|
||||
* global->system.av_info.base_height. */
|
||||
base_width = (unsigned)roundf(base_height * aspect_ratio);
|
||||
|
||||
/* Make sure that we don't get 0x scale ... */
|
||||
|
|
|
@ -44,12 +44,13 @@ static bool video_frame_scale(const void *data,
|
|||
size_t pitch)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
RARCH_PERFORMANCE_INIT(video_frame_conv);
|
||||
|
||||
if (!data)
|
||||
return false;
|
||||
if (g_extern.system.pix_fmt != RETRO_PIXEL_FORMAT_0RGB1555)
|
||||
if (global->system.pix_fmt != RETRO_PIXEL_FORMAT_0RGB1555)
|
||||
return false;
|
||||
if (data == RETRO_HW_FRAME_BUFFER_VALID)
|
||||
return false;
|
||||
|
@ -77,26 +78,28 @@ static bool video_frame_filter(const void *data,
|
|||
unsigned *output_pitch)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
RARCH_PERFORMANCE_INIT(softfilter_process);
|
||||
|
||||
if (!g_extern.filter.filter)
|
||||
if (!global->filter.filter)
|
||||
return false;
|
||||
if (!data)
|
||||
return false;
|
||||
|
||||
rarch_softfilter_get_output_size(g_extern.filter.filter,
|
||||
rarch_softfilter_get_output_size(global->filter.filter,
|
||||
output_width, output_height, width, height);
|
||||
|
||||
*output_pitch = (*output_width) * g_extern.filter.out_bpp;
|
||||
*output_pitch = (*output_width) * global->filter.out_bpp;
|
||||
|
||||
RARCH_PERFORMANCE_START(softfilter_process);
|
||||
rarch_softfilter_process(g_extern.filter.filter,
|
||||
g_extern.filter.buffer, *output_pitch,
|
||||
rarch_softfilter_process(global->filter.filter,
|
||||
global->filter.buffer, *output_pitch,
|
||||
data, width, height, pitch);
|
||||
RARCH_PERFORMANCE_STOP(softfilter_process);
|
||||
|
||||
if (settings->video.post_filter_record)
|
||||
recording_dump_frame(g_extern.filter.buffer,
|
||||
recording_dump_frame(global->filter.buffer,
|
||||
*output_width, *output_height, *output_pitch);
|
||||
|
||||
return true;
|
||||
|
@ -118,15 +121,16 @@ static void video_frame(const void *data, unsigned width,
|
|||
const char *msg = NULL;
|
||||
runloop_t *runloop = rarch_main_get_ptr();
|
||||
driver_t *driver = driver_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
if (!driver->video_active)
|
||||
return;
|
||||
|
||||
g_extern.frame_cache.data = data;
|
||||
g_extern.frame_cache.width = width;
|
||||
g_extern.frame_cache.height = height;
|
||||
g_extern.frame_cache.pitch = pitch;
|
||||
global->frame_cache.data = data;
|
||||
global->frame_cache.width = width;
|
||||
global->frame_cache.height = height;
|
||||
global->frame_cache.pitch = pitch;
|
||||
|
||||
if (video_frame_scale(data, width, height, pitch))
|
||||
{
|
||||
|
@ -138,9 +142,9 @@ static void video_frame(const void *data, unsigned width,
|
|||
* but we really need to do processing before blocking on VSync
|
||||
* for best possible scheduling.
|
||||
*/
|
||||
if ((!g_extern.filter.filter
|
||||
if ((!global->filter.filter
|
||||
|| !settings->video.post_filter_record || !data
|
||||
|| g_extern.record.gpu_buffer)
|
||||
|| global->record.gpu_buffer)
|
||||
)
|
||||
recording_dump_frame(data, width, height, pitch);
|
||||
|
||||
|
@ -150,7 +154,7 @@ static void video_frame(const void *data, unsigned width,
|
|||
if (video_frame_filter(data, width, height, pitch,
|
||||
&output_width, &output_height, &output_pitch))
|
||||
{
|
||||
data = g_extern.filter.buffer;
|
||||
data = global->filter.buffer;
|
||||
width = output_width;
|
||||
height = output_height;
|
||||
pitch = output_pitch;
|
||||
|
@ -185,6 +189,7 @@ bool retro_flush_audio(const int16_t *data, size_t samples)
|
|||
struct rarch_dsp_data dsp_data = {0};
|
||||
runloop_t *runloop = rarch_main_get_ptr();
|
||||
driver_t *driver = driver_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
if (driver->recording_data)
|
||||
|
@ -199,26 +204,26 @@ bool retro_flush_audio(const int16_t *data, size_t samples)
|
|||
|
||||
if (runloop->is_paused || settings->audio.mute_enable)
|
||||
return true;
|
||||
if (!driver->audio_active || !g_extern.audio_data.data)
|
||||
if (!driver->audio_active || !global->audio_data.data)
|
||||
return false;
|
||||
|
||||
RARCH_PERFORMANCE_INIT(audio_convert_s16);
|
||||
RARCH_PERFORMANCE_START(audio_convert_s16);
|
||||
audio_convert_s16_to_float(g_extern.audio_data.data, data, samples,
|
||||
g_extern.audio_data.volume_gain);
|
||||
audio_convert_s16_to_float(global->audio_data.data, data, samples,
|
||||
global->audio_data.volume_gain);
|
||||
RARCH_PERFORMANCE_STOP(audio_convert_s16);
|
||||
|
||||
src_data.data_in = g_extern.audio_data.data;
|
||||
src_data.data_in = global->audio_data.data;
|
||||
src_data.input_frames = samples >> 1;
|
||||
|
||||
dsp_data.input = g_extern.audio_data.data;
|
||||
dsp_data.input = global->audio_data.data;
|
||||
dsp_data.input_frames = samples >> 1;
|
||||
|
||||
if (g_extern.audio_data.dsp)
|
||||
if (global->audio_data.dsp)
|
||||
{
|
||||
RARCH_PERFORMANCE_INIT(audio_dsp);
|
||||
RARCH_PERFORMANCE_START(audio_dsp);
|
||||
rarch_dsp_filter_process(g_extern.audio_data.dsp, &dsp_data);
|
||||
rarch_dsp_filter_process(global->audio_data.dsp, &dsp_data);
|
||||
RARCH_PERFORMANCE_STOP(audio_dsp);
|
||||
|
||||
if (dsp_data.output)
|
||||
|
@ -228,12 +233,12 @@ bool retro_flush_audio(const int16_t *data, size_t samples)
|
|||
}
|
||||
}
|
||||
|
||||
src_data.data_out = g_extern.audio_data.outsamples;
|
||||
src_data.data_out = global->audio_data.outsamples;
|
||||
|
||||
if (g_extern.audio_data.rate_control)
|
||||
if (global->audio_data.rate_control)
|
||||
audio_driver_readjust_input_rate();
|
||||
|
||||
src_data.ratio = g_extern.audio_data.src_ratio;
|
||||
src_data.ratio = global->audio_data.src_ratio;
|
||||
if (runloop->is_slowmotion)
|
||||
src_data.ratio *= settings->slowmotion_ratio;
|
||||
|
||||
|
@ -243,18 +248,18 @@ bool retro_flush_audio(const int16_t *data, size_t samples)
|
|||
driver->resampler_data, &src_data);
|
||||
RARCH_PERFORMANCE_STOP(resampler_proc);
|
||||
|
||||
output_data = g_extern.audio_data.outsamples;
|
||||
output_data = global->audio_data.outsamples;
|
||||
output_frames = src_data.output_frames;
|
||||
|
||||
if (!g_extern.audio_data.use_float)
|
||||
if (!global->audio_data.use_float)
|
||||
{
|
||||
RARCH_PERFORMANCE_INIT(audio_convert_float);
|
||||
RARCH_PERFORMANCE_START(audio_convert_float);
|
||||
audio_convert_float_to_s16(g_extern.audio_data.conv_outsamples,
|
||||
audio_convert_float_to_s16(global->audio_data.conv_outsamples,
|
||||
(const float*)output_data, output_frames * 2);
|
||||
RARCH_PERFORMANCE_STOP(audio_convert_float);
|
||||
|
||||
output_data = g_extern.audio_data.conv_outsamples;
|
||||
output_data = global->audio_data.conv_outsamples;
|
||||
output_size = sizeof(int16_t);
|
||||
}
|
||||
|
||||
|
@ -279,15 +284,17 @@ bool retro_flush_audio(const int16_t *data, size_t samples)
|
|||
**/
|
||||
static void audio_sample(int16_t left, int16_t right)
|
||||
{
|
||||
g_extern.audio_data.conv_outsamples[g_extern.audio_data.data_ptr++] = left;
|
||||
g_extern.audio_data.conv_outsamples[g_extern.audio_data.data_ptr++] = right;
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
if (g_extern.audio_data.data_ptr < g_extern.audio_data.chunk_size)
|
||||
global->audio_data.conv_outsamples[global->audio_data.data_ptr++] = left;
|
||||
global->audio_data.conv_outsamples[global->audio_data.data_ptr++] = right;
|
||||
|
||||
if (global->audio_data.data_ptr < global->audio_data.chunk_size)
|
||||
return;
|
||||
|
||||
retro_flush_audio(g_extern.audio_data.conv_outsamples, g_extern.audio_data.data_ptr);
|
||||
retro_flush_audio(global->audio_data.conv_outsamples, global->audio_data.data_ptr);
|
||||
|
||||
g_extern.audio_data.data_ptr = 0;
|
||||
global->audio_data.data_ptr = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -320,8 +327,10 @@ static size_t audio_sample_batch(const int16_t *data, size_t frames)
|
|||
**/
|
||||
static void audio_sample_rewind(int16_t left, int16_t right)
|
||||
{
|
||||
g_extern.audio_data.rewind_buf[--g_extern.audio_data.rewind_ptr] = right;
|
||||
g_extern.audio_data.rewind_buf[--g_extern.audio_data.rewind_ptr] = left;
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
global->audio_data.rewind_buf[--global->audio_data.rewind_ptr] = right;
|
||||
global->audio_data.rewind_buf[--global->audio_data.rewind_ptr] = left;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -339,9 +348,10 @@ static size_t audio_sample_batch_rewind(const int16_t *data, size_t frames)
|
|||
{
|
||||
size_t i;
|
||||
size_t samples = frames << 1;
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
for (i = 0; i < samples; i++)
|
||||
g_extern.audio_data.rewind_buf[--g_extern.audio_data.rewind_ptr] = data[i];
|
||||
global->audio_data.rewind_buf[--global->audio_data.rewind_ptr] = data[i];
|
||||
|
||||
return frames;
|
||||
}
|
||||
|
@ -366,14 +376,15 @@ static size_t audio_sample_batch_rewind(const int16_t *data, size_t frames)
|
|||
static bool input_apply_turbo(unsigned port, unsigned id, bool res)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
if (res && g_extern.turbo_frame_enable[port])
|
||||
g_extern.turbo_enable[port] |= (1 << id);
|
||||
if (res && global->turbo_frame_enable[port])
|
||||
global->turbo_enable[port] |= (1 << id);
|
||||
else if (!res)
|
||||
g_extern.turbo_enable[port] &= ~(1 << id);
|
||||
global->turbo_enable[port] &= ~(1 << id);
|
||||
|
||||
if (g_extern.turbo_enable[port] & (1 << id))
|
||||
return res && ((g_extern.turbo_count % settings->input.turbo_period)
|
||||
if (global->turbo_enable[port] & (1 << id))
|
||||
return res && ((global->turbo_count % settings->input.turbo_period)
|
||||
< settings->input.turbo_duty_cycle);
|
||||
return res;
|
||||
}
|
||||
|
@ -396,6 +407,7 @@ static int16_t input_state(unsigned port, unsigned device,
|
|||
int16_t res = 0;
|
||||
settings_t *settings = config_get_ptr();
|
||||
driver_t *driver = driver_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
const struct retro_keybind *libretro_input_binds[MAX_USERS] = {
|
||||
settings->input.binds[0],
|
||||
settings->input.binds[1],
|
||||
|
@ -417,13 +429,13 @@ static int16_t input_state(unsigned port, unsigned device,
|
|||
|
||||
device &= RETRO_DEVICE_MASK;
|
||||
|
||||
if (g_extern.bsv.movie && g_extern.bsv.movie_playback)
|
||||
if (global->bsv.movie && global->bsv.movie_playback)
|
||||
{
|
||||
int16_t ret;
|
||||
if (bsv_movie_get_input(g_extern.bsv.movie, &ret))
|
||||
if (bsv_movie_get_input(global->bsv.movie, &ret))
|
||||
return ret;
|
||||
|
||||
g_extern.bsv.movie_end = true;
|
||||
global->bsv.movie_end = true;
|
||||
}
|
||||
|
||||
if (settings->input.remap_binds_enable)
|
||||
|
@ -480,8 +492,8 @@ static int16_t input_state(unsigned port, unsigned device,
|
|||
id > RETRO_DEVICE_ID_JOYPAD_RIGHT))
|
||||
res = input_apply_turbo(port, id, res);
|
||||
|
||||
if (g_extern.bsv.movie && !g_extern.bsv.movie_playback)
|
||||
bsv_movie_set_input(g_extern.bsv.movie, res);
|
||||
if (global->bsv.movie && !global->bsv.movie_playback)
|
||||
bsv_movie_set_input(global->bsv.movie, res);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
@ -679,6 +691,7 @@ void retro_init_libretro_cbs(void *data)
|
|||
{
|
||||
struct retro_callbacks *cbs = (struct retro_callbacks*)data;
|
||||
driver_t *driver = driver_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
if (!cbs)
|
||||
return;
|
||||
|
@ -697,10 +710,10 @@ void retro_init_libretro_cbs(void *data)
|
|||
if (!driver->netplay_data)
|
||||
return;
|
||||
|
||||
if (g_extern.netplay_is_spectate)
|
||||
if (global->netplay_is_spectate)
|
||||
{
|
||||
pretro_set_input_state(
|
||||
(g_extern.netplay_is_client ?
|
||||
(global->netplay_is_client ?
|
||||
input_state_spectate_client : input_state_spectate)
|
||||
);
|
||||
}
|
||||
|
@ -722,7 +735,9 @@ void retro_init_libretro_cbs(void *data)
|
|||
**/
|
||||
void retro_set_rewind_callbacks(void)
|
||||
{
|
||||
if (g_extern.rewind.frame_is_reverse)
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
if (global->rewind.frame_is_reverse)
|
||||
{
|
||||
pretro_set_audio_sample(audio_sample_rewind);
|
||||
pretro_set_audio_sample_batch(audio_sample_batch_rewind);
|
||||
|
|
|
@ -224,6 +224,8 @@ bool driver_location_get_position(double *lat, double *lon,
|
|||
void init_location(void)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
/* Resource leaks will follow if location interface is initialized twice. */
|
||||
if (driver->location_data)
|
||||
return;
|
||||
|
@ -238,17 +240,19 @@ void init_location(void)
|
|||
driver->location_active = false;
|
||||
}
|
||||
|
||||
if (g_extern.system.location_callback.initialized)
|
||||
g_extern.system.location_callback.initialized();
|
||||
if (global->system.location_callback.initialized)
|
||||
global->system.location_callback.initialized();
|
||||
}
|
||||
|
||||
void uninit_location(void)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
if (driver->location_data && driver->location)
|
||||
{
|
||||
if (g_extern.system.location_callback.deinitialized)
|
||||
g_extern.system.location_callback.deinitialized();
|
||||
if (global->system.location_callback.deinitialized)
|
||||
global->system.location_callback.deinitialized();
|
||||
|
||||
if (driver->location->free)
|
||||
driver->location->free(driver->location_data);
|
||||
|
|
63
menu/menu.c
63
menu/menu.c
|
@ -43,6 +43,7 @@ bool menu_display_update_pending(void)
|
|||
static void draw_frame(void)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
if (driver->video_data && driver->video_poke &&
|
||||
|
@ -52,7 +53,7 @@ static void draw_frame(void)
|
|||
|
||||
if (!settings->menu.pause_libretro)
|
||||
{
|
||||
if (g_extern.main_is_init && !g_extern.libretro_dummy)
|
||||
if (global->main_is_init && !global->libretro_dummy)
|
||||
{
|
||||
bool block_libretro_input = driver->block_libretro_input;
|
||||
driver->block_libretro_input = true;
|
||||
|
@ -91,19 +92,22 @@ static void menu_environment_get(int *argc, char *argv[],
|
|||
{
|
||||
struct rarch_main_wrap *wrap_args = (struct rarch_main_wrap*)params_data;
|
||||
driver_t *driver = driver_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
if (!wrap_args)
|
||||
return;
|
||||
|
||||
wrap_args->no_content = driver->menu->load_no_content;
|
||||
if (!g_extern.has_set_verbosity)
|
||||
wrap_args->verbose = g_extern.verbosity;
|
||||
wrap_args->config_path = *g_extern.config_path ? g_extern.config_path : NULL;
|
||||
wrap_args->sram_path = *g_extern.savefile_dir ? g_extern.savefile_dir : NULL;
|
||||
wrap_args->state_path = *g_extern.savestate_dir ? g_extern.savestate_dir : NULL;
|
||||
wrap_args->content_path = *g_extern.fullpath ? g_extern.fullpath : NULL;
|
||||
if (!g_extern.has_set_libretro)
|
||||
if (!global->has_set_verbosity)
|
||||
wrap_args->verbose = global->verbosity;
|
||||
|
||||
wrap_args->config_path = *global->config_path ? global->config_path : NULL;
|
||||
wrap_args->sram_path = *global->savefile_dir ? global->savefile_dir : NULL;
|
||||
wrap_args->state_path = *global->savestate_dir ? global->savestate_dir : NULL;
|
||||
wrap_args->content_path = *global->fullpath ? global->fullpath : NULL;
|
||||
|
||||
if (!global->has_set_libretro)
|
||||
wrap_args->libretro_path = *settings->libretro ? settings->libretro : NULL;
|
||||
wrap_args->touched = true;
|
||||
}
|
||||
|
@ -111,23 +115,25 @@ static void menu_environment_get(int *argc, char *argv[],
|
|||
static void push_to_history_playlist(void)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
if (!settings->history_list_enable)
|
||||
return;
|
||||
|
||||
if (*g_extern.fullpath)
|
||||
if (*global->fullpath)
|
||||
{
|
||||
char tmp[PATH_MAX_LENGTH];
|
||||
char str[PATH_MAX_LENGTH];
|
||||
|
||||
fill_pathname_base(tmp, g_extern.fullpath, sizeof(tmp));
|
||||
fill_pathname_base(tmp, global->fullpath, sizeof(tmp));
|
||||
snprintf(str, sizeof(str), "INFO - Loading %s ...", tmp);
|
||||
rarch_main_msg_queue_push(str, 1, 1, false);
|
||||
}
|
||||
|
||||
content_playlist_push(g_defaults.history,
|
||||
g_extern.fullpath,
|
||||
global->fullpath,
|
||||
settings->libretro,
|
||||
g_extern.menu.info.library_name);
|
||||
global->menu.info.library_name);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -140,9 +146,10 @@ static void push_to_history_playlist(void)
|
|||
**/
|
||||
bool menu_load_content(void)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
driver_t *driver = driver_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
if (*g_extern.fullpath || (driver->menu && driver->menu->load_no_content))
|
||||
if (*global->fullpath || (driver->menu && driver->menu->load_no_content))
|
||||
push_to_history_playlist();
|
||||
|
||||
/* redraw menu frame */
|
||||
|
@ -159,7 +166,7 @@ bool menu_load_content(void)
|
|||
{
|
||||
char name[PATH_MAX_LENGTH], msg[PATH_MAX_LENGTH];
|
||||
|
||||
fill_pathname_base(name, g_extern.fullpath, sizeof(name));
|
||||
fill_pathname_base(name, global->fullpath, sizeof(name));
|
||||
snprintf(msg, sizeof(msg), "Failed to load %s.\n", name);
|
||||
rarch_main_msg_queue_push(msg, 1, 90, false);
|
||||
|
||||
|
@ -169,7 +176,7 @@ bool menu_load_content(void)
|
|||
return false;
|
||||
}
|
||||
|
||||
menu_update_libretro_info(&g_extern.menu.info);
|
||||
menu_update_libretro_info(&global->menu.info);
|
||||
|
||||
menu_shader_manager_init(driver->menu);
|
||||
|
||||
|
@ -193,12 +200,13 @@ void *menu_init(const void *data)
|
|||
menu_handle_t *menu = NULL;
|
||||
menu_ctx_driver_t *menu_ctx = (menu_ctx_driver_t*)data;
|
||||
runloop_t *runloop = rarch_main_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
if (!menu_ctx)
|
||||
return NULL;
|
||||
|
||||
menu_update_libretro_info(&g_extern.menu.info);
|
||||
menu_update_libretro_info(&global->menu.info);
|
||||
|
||||
if (!(menu = (menu_handle_t*)menu_ctx->init()))
|
||||
return NULL;
|
||||
|
@ -209,8 +217,8 @@ void *menu_init(const void *data)
|
|||
if (!(menu->menu_list = (menu_list_t*)menu_list_new()))
|
||||
goto error;
|
||||
|
||||
g_extern.core_info_current = (core_info_t*)calloc(1, sizeof(core_info_t));
|
||||
if (!g_extern.core_info_current)
|
||||
global->core_info_current = (core_info_t*)calloc(1, sizeof(core_info_t));
|
||||
if (!global->core_info_current)
|
||||
goto error;
|
||||
|
||||
#ifdef HAVE_SHADER_MANAGER
|
||||
|
@ -237,9 +245,9 @@ error:
|
|||
if (menu->menu_list)
|
||||
menu_list_free(menu->menu_list);
|
||||
menu->menu_list = NULL;
|
||||
if (g_extern.core_info_current)
|
||||
free(g_extern.core_info_current);
|
||||
g_extern.core_info_current = NULL;
|
||||
if (global->core_info_current)
|
||||
free(global->core_info_current);
|
||||
global->core_info_current = NULL;
|
||||
if (menu->shader)
|
||||
free(menu->shader);
|
||||
menu->shader = NULL;
|
||||
|
@ -275,6 +283,7 @@ void menu_free(void *data)
|
|||
{
|
||||
menu_handle_t *menu = (menu_handle_t*)data;
|
||||
driver_t *driver = driver_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
if (!menu)
|
||||
return;
|
||||
|
@ -293,7 +302,7 @@ void menu_free(void *data)
|
|||
#endif
|
||||
|
||||
#ifdef HAVE_DYNAMIC
|
||||
libretro_free_system_info(&g_extern.menu.info);
|
||||
libretro_free_system_info(&global->menu.info);
|
||||
#endif
|
||||
|
||||
if (menu->msg_queue)
|
||||
|
@ -312,11 +321,11 @@ void menu_free(void *data)
|
|||
|
||||
rarch_main_command(RARCH_CMD_HISTORY_DEINIT);
|
||||
|
||||
if (g_extern.core_info)
|
||||
core_info_list_free(g_extern.core_info);
|
||||
if (global->core_info)
|
||||
core_info_list_free(global->core_info);
|
||||
|
||||
if (g_extern.core_info_current)
|
||||
free(g_extern.core_info_current);
|
||||
if (global->core_info_current)
|
||||
free(global->core_info_current);
|
||||
|
||||
free(data);
|
||||
}
|
||||
|
|
|
@ -199,7 +199,8 @@ int menu_entries_push_horizontal_menu_list(menu_handle_t *menu,
|
|||
unsigned menu_type)
|
||||
{
|
||||
core_info_t *info = NULL;
|
||||
core_info_list_t *info_list = (core_info_list_t*)g_extern.core_info;
|
||||
global_t *global = global_get_ptr();
|
||||
core_info_list_t *info_list = (core_info_list_t*)global->core_info;
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
if (!info_list)
|
||||
|
@ -327,6 +328,7 @@ int menu_entries_parse_list(
|
|||
int device = 0;
|
||||
struct string_list *str_list = NULL;
|
||||
settings_t *settings = config_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
(void)device;
|
||||
|
||||
|
@ -466,8 +468,8 @@ int menu_entries_parse_list(
|
|||
|
||||
fill_pathname_join(core_path, dir, path, sizeof(core_path));
|
||||
|
||||
if (g_extern.core_info &&
|
||||
core_info_list_get_display_name(g_extern.core_info,
|
||||
if (global->core_info &&
|
||||
core_info_list_get_display_name(global->core_info,
|
||||
core_path, display_name, sizeof(display_name)))
|
||||
menu_list_set_alt_at_offset(list, i, display_name);
|
||||
}
|
||||
|
|
|
@ -129,6 +129,7 @@ void menu_input_st_string_callback(void *userdata, const char *str)
|
|||
if (str && *str)
|
||||
{
|
||||
rarch_setting_t *current_setting = NULL;
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
if ((current_setting = (rarch_setting_t*)
|
||||
setting_find_setting(
|
||||
|
@ -141,7 +142,7 @@ void menu_input_st_string_callback(void *userdata, const char *str)
|
|||
else if (!strcmp(menu->keyboard.label_setting, "remap_file_save_as"))
|
||||
input_remapping_save_file(str);
|
||||
else if (!strcmp(menu->keyboard.label_setting, "cheat_file_save_as"))
|
||||
cheat_manager_save(g_extern.cheat, str);
|
||||
cheat_manager_save(global->cheat, str);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -150,7 +151,8 @@ void menu_input_st_string_callback(void *userdata, const char *str)
|
|||
|
||||
void menu_input_st_cheat_callback(void *userdata, const char *str)
|
||||
{
|
||||
cheat_manager_t *cheat = g_extern.cheat;
|
||||
global_t *global = global_get_ptr();
|
||||
cheat_manager_t *cheat = global->cheat;
|
||||
menu_handle_t *menu = (menu_handle_t*)userdata;
|
||||
|
||||
if (!menu)
|
||||
|
|
|
@ -33,17 +33,18 @@ void menu_shader_manager_init(menu_handle_t *menu)
|
|||
config_file_t *conf = NULL;
|
||||
const char *config_path = NULL;
|
||||
settings_t *settings = config_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
if (!menu)
|
||||
return;
|
||||
|
||||
shader = (struct video_shader*)menu->shader;
|
||||
|
||||
if (*g_extern.core_specific_config_path
|
||||
if (*global->core_specific_config_path
|
||||
&& settings->core_specific_config)
|
||||
config_path = g_extern.core_specific_config_path;
|
||||
else if (*g_extern.config_path)
|
||||
config_path = g_extern.config_path;
|
||||
config_path = global->core_specific_config_path;
|
||||
else if (*global->config_path)
|
||||
config_path = global->config_path;
|
||||
|
||||
/* In a multi-config setting, we can't have
|
||||
* conflicts on menu.cgp/menu.glslp. */
|
||||
|
@ -184,6 +185,7 @@ void menu_shader_manager_save_preset(
|
|||
config_file_t *conf = NULL;
|
||||
bool ret = false;
|
||||
driver_t *driver = driver_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
if (!driver->menu)
|
||||
|
@ -219,9 +221,9 @@ void menu_shader_manager_save_preset(
|
|||
strlcpy(buffer, conf_path, sizeof(buffer));
|
||||
}
|
||||
|
||||
if (*g_extern.config_path)
|
||||
if (*global->config_path)
|
||||
fill_pathname_basedir(config_directory,
|
||||
g_extern.config_path, sizeof(config_directory));
|
||||
global->config_path, sizeof(config_directory));
|
||||
|
||||
const char *dirs[] = {
|
||||
settings->video.shader_dir,
|
||||
|
|
6
movie.c
6
movie.c
|
@ -46,6 +46,7 @@ static bool init_playback(bsv_movie_t *handle, const char *path)
|
|||
{
|
||||
uint32_t state_size;
|
||||
uint32_t header[4] = {0};
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
handle->playback = true;
|
||||
handle->file = fopen(path, "rb");
|
||||
|
@ -70,7 +71,7 @@ static bool init_playback(bsv_movie_t *handle, const char *path)
|
|||
return false;
|
||||
}
|
||||
|
||||
if (swap_if_big32(header[CRC_INDEX]) != g_extern.content_crc)
|
||||
if (swap_if_big32(header[CRC_INDEX]) != global->content_crc)
|
||||
RARCH_WARN("CRC32 checksum mismatch between content file and saved content checksum in replay file header; replay highly likely to desync on playback.\n");
|
||||
|
||||
state_size = swap_if_big32(header[STATE_SIZE_INDEX]);
|
||||
|
@ -103,6 +104,7 @@ static bool init_record(bsv_movie_t *handle, const char *path)
|
|||
{
|
||||
uint32_t state_size;
|
||||
uint32_t header[4] = {0};
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
handle->file = fopen(path, "wb");
|
||||
if (!handle->file)
|
||||
|
@ -116,7 +118,7 @@ static bool init_record(bsv_movie_t *handle, const char *path)
|
|||
* BSV1 in a HEX editor, big-endian. */
|
||||
header[MAGIC_INDEX] = swap_if_little32(BSV_MAGIC);
|
||||
|
||||
header[CRC_INDEX] = swap_if_big32(g_extern.content_crc);
|
||||
header[CRC_INDEX] = swap_if_big32(global->content_crc);
|
||||
|
||||
state_size = pretro_serialize_size();
|
||||
|
||||
|
|
37
netplay.c
37
netplay.c
|
@ -815,10 +815,12 @@ static bool init_socket(netplay_t *netplay, const char *server, uint16_t port)
|
|||
static uint32_t implementation_magic_value(void)
|
||||
{
|
||||
size_t i, len;
|
||||
uint32_t res = 0;
|
||||
const char *lib = g_extern.system.info.library_name;
|
||||
const char *ver = PACKAGE_VERSION;
|
||||
unsigned api = pretro_api_version();
|
||||
uint32_t res = 0;
|
||||
const char *lib = NULL;
|
||||
const char *ver = PACKAGE_VERSION;
|
||||
unsigned api = pretro_api_version();
|
||||
global_t *global = global_get_ptr();
|
||||
lib = global->system.info.library_name;
|
||||
|
||||
res |= api;
|
||||
|
||||
|
@ -826,8 +828,9 @@ static uint32_t implementation_magic_value(void)
|
|||
for (i = 0; i < len; i++)
|
||||
res ^= lib[i] << (i & 0xf);
|
||||
|
||||
lib = g_extern.system.info.library_version;
|
||||
lib = global->system.info.library_version;
|
||||
len = strlen(lib);
|
||||
|
||||
for (i = 0; i < len; i++)
|
||||
res ^= lib[i] << (i & 0xf);
|
||||
|
||||
|
@ -887,11 +890,12 @@ static bool send_info(netplay_t *netplay)
|
|||
unsigned sram_size;
|
||||
char msg[512];
|
||||
void *sram = NULL;
|
||||
uint32_t header[3] = {
|
||||
htonl(g_extern.content_crc),
|
||||
htonl(implementation_magic_value()),
|
||||
htonl(pretro_get_memory_size(RETRO_MEMORY_SAVE_RAM))
|
||||
};
|
||||
uint32_t header[3];
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
header[0] = htonl(global->content_crc);
|
||||
header[1] = htonl(implementation_magic_value());
|
||||
header[2] = htonl(pretro_get_memory_size(RETRO_MEMORY_SAVE_RAM));
|
||||
|
||||
if (!socket_send_all_blocking(netplay->fd, header, sizeof(header)))
|
||||
return false;
|
||||
|
@ -930,6 +934,7 @@ static bool get_info(netplay_t *netplay)
|
|||
unsigned sram_size;
|
||||
uint32_t header[3];
|
||||
const void *sram = NULL;
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
if (!socket_receive_all_blocking(netplay->fd, header, sizeof(header)))
|
||||
{
|
||||
|
@ -937,7 +942,7 @@ static bool get_info(netplay_t *netplay)
|
|||
return false;
|
||||
}
|
||||
|
||||
if (g_extern.content_crc != ntohl(header[0]))
|
||||
if (global->content_crc != ntohl(header[0]))
|
||||
{
|
||||
RARCH_ERR("Content CRC32s differ. Cannot use different games.\n");
|
||||
return false;
|
||||
|
@ -989,6 +994,7 @@ static uint32_t *bsv_header_generate(size_t *size, uint32_t magic)
|
|||
uint32_t *header, bsv_header[4] = {0};
|
||||
size_t serialize_size = pretro_serialize_size();
|
||||
size_t header_size = sizeof(bsv_header) + serialize_size;
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
*size = header_size;
|
||||
|
||||
|
@ -996,9 +1002,9 @@ static uint32_t *bsv_header_generate(size_t *size, uint32_t magic)
|
|||
if (!header)
|
||||
return NULL;
|
||||
|
||||
bsv_header[MAGIC_INDEX] = swap_if_little32(BSV_MAGIC);
|
||||
bsv_header[MAGIC_INDEX] = swap_if_little32(BSV_MAGIC);
|
||||
bsv_header[SERIALIZER_INDEX] = swap_if_big32(magic);
|
||||
bsv_header[CRC_INDEX] = swap_if_big32(g_extern.content_crc);
|
||||
bsv_header[CRC_INDEX] = swap_if_big32(global->content_crc);
|
||||
bsv_header[STATE_SIZE_INDEX] = swap_if_big32(serialize_size);
|
||||
|
||||
if (serialize_size && !pretro_serialize(header + 4, serialize_size))
|
||||
|
@ -1015,6 +1021,7 @@ static bool bsv_parse_header(const uint32_t *header, uint32_t magic)
|
|||
{
|
||||
uint32_t in_crc, in_magic, in_state_size;
|
||||
uint32_t in_bsv = swap_if_little32(header[MAGIC_INDEX]);
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
if (in_bsv != BSV_MAGIC)
|
||||
{
|
||||
|
@ -1031,10 +1038,10 @@ static bool bsv_parse_header(const uint32_t *header, uint32_t magic)
|
|||
}
|
||||
|
||||
in_crc = swap_if_big32(header[CRC_INDEX]);
|
||||
if (in_crc != g_extern.content_crc)
|
||||
if (in_crc != global->content_crc)
|
||||
{
|
||||
RARCH_ERR("CRC32 mismatch, got 0x%x, expected 0x%x.\n", in_crc,
|
||||
g_extern.content_crc);
|
||||
global->content_crc);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
25
patch.c
25
patch.c
|
@ -497,40 +497,43 @@ error:
|
|||
|
||||
static bool try_bps_patch(uint8_t **buf, ssize_t *size)
|
||||
{
|
||||
bool allow_bps = !g_extern.ups_pref && !g_extern.ips_pref;
|
||||
global_t *global = global_get_ptr();
|
||||
bool allow_bps = !global->ups_pref && !global->ips_pref;
|
||||
|
||||
if (!allow_bps)
|
||||
return false;
|
||||
if (g_extern.bps_name[0] == '\0')
|
||||
if (global->bps_name[0] == '\0')
|
||||
return false;
|
||||
|
||||
return apply_patch_content(buf, size, "BPS", g_extern.bps_name,
|
||||
return apply_patch_content(buf, size, "BPS", global->bps_name,
|
||||
bps_apply_patch);
|
||||
}
|
||||
|
||||
static bool try_ups_patch(uint8_t **buf, ssize_t *size)
|
||||
{
|
||||
bool allow_ups = !g_extern.bps_pref && !g_extern.ips_pref;
|
||||
global_t *global = global_get_ptr();
|
||||
bool allow_ups = !global->bps_pref && !global->ips_pref;
|
||||
|
||||
if (!allow_ups)
|
||||
return false;
|
||||
if (g_extern.ups_name[0] == '\0')
|
||||
if (global->ups_name[0] == '\0')
|
||||
return false;
|
||||
|
||||
return apply_patch_content(buf, size, "UPS", g_extern.ups_name,
|
||||
return apply_patch_content(buf, size, "UPS", global->ups_name,
|
||||
ups_apply_patch);
|
||||
}
|
||||
|
||||
static bool try_ips_patch(uint8_t **buf, ssize_t *size)
|
||||
{
|
||||
bool allow_ips = !g_extern.ups_pref && !g_extern.bps_pref;
|
||||
global_t *global = global_get_ptr();
|
||||
bool allow_ips = !global->ups_pref && !global->bps_pref;
|
||||
|
||||
if (!allow_ips)
|
||||
return false;
|
||||
if (g_extern.ips_name[0] == '\0')
|
||||
if (global->ips_name[0] == '\0')
|
||||
return false;
|
||||
|
||||
return apply_patch_content(buf, size, "IPS", g_extern.ips_name,
|
||||
return apply_patch_content(buf, size, "IPS", global->ips_name,
|
||||
ips_apply_patch);
|
||||
}
|
||||
|
||||
|
@ -544,7 +547,9 @@ static bool try_ips_patch(uint8_t **buf, ssize_t *size)
|
|||
**/
|
||||
void patch_content(uint8_t **buf, ssize_t *size)
|
||||
{
|
||||
if (g_extern.ups_pref + g_extern.bps_pref + g_extern.ips_pref > 1)
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
if (global->ups_pref + global->bps_pref + global->ips_pref > 1)
|
||||
{
|
||||
RARCH_WARN("Several patches are explicitly defined, ignoring all ...\n");
|
||||
return;
|
||||
|
|
|
@ -104,7 +104,9 @@ unsigned perf_ptr_libretro;
|
|||
|
||||
void rarch_perf_register(struct retro_perf_counter *perf)
|
||||
{
|
||||
if (!g_extern.perfcnt_enable || perf->registered
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
if (!global->perfcnt_enable || perf->registered
|
||||
|| perf_ptr_rarch >= MAX_COUNTERS)
|
||||
return;
|
||||
|
||||
|
@ -146,7 +148,9 @@ static void log_counters(
|
|||
|
||||
void rarch_perf_log(void)
|
||||
{
|
||||
if (!g_extern.perfcnt_enable)
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
if (!global->perfcnt_enable)
|
||||
return;
|
||||
|
||||
RARCH_LOG("[PERF]: Performance counters (RetroArch):\n");
|
||||
|
|
|
@ -88,7 +88,8 @@ void retro_perf_log(void);
|
|||
**/
|
||||
static INLINE void rarch_perf_start(struct retro_perf_counter *perf)
|
||||
{
|
||||
if (!g_extern.perfcnt_enable || !perf)
|
||||
global_t *global = global_get_ptr();
|
||||
if (!global->perfcnt_enable || !perf)
|
||||
return;
|
||||
|
||||
perf->call_cnt++;
|
||||
|
@ -103,7 +104,8 @@ static INLINE void rarch_perf_start(struct retro_perf_counter *perf)
|
|||
**/
|
||||
static INLINE void rarch_perf_stop(struct retro_perf_counter *perf)
|
||||
{
|
||||
if (!g_extern.perfcnt_enable || !perf)
|
||||
global_t *global = global_get_ptr();
|
||||
if (!global->perfcnt_enable || !perf)
|
||||
return;
|
||||
|
||||
perf->total += rarch_get_perf_counter() - perf->start;
|
||||
|
|
|
@ -93,6 +93,7 @@ void recording_dump_frame(const void *data, unsigned width,
|
|||
{
|
||||
struct ffemu_video_data ffemu_data = {0};
|
||||
driver_t *driver = driver_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
if (!driver->recording_data)
|
||||
return;
|
||||
|
@ -102,7 +103,7 @@ void recording_dump_frame(const void *data, unsigned width,
|
|||
ffemu_data.height = height;
|
||||
ffemu_data.data = data;
|
||||
|
||||
if (g_extern.record.gpu_buffer)
|
||||
if (global->record.gpu_buffer)
|
||||
{
|
||||
struct video_viewport vp = {0};
|
||||
|
||||
|
@ -119,8 +120,8 @@ void recording_dump_frame(const void *data, unsigned width,
|
|||
}
|
||||
|
||||
/* User has resized. We kinda have a problem now. */
|
||||
if (vp.width != g_extern.record.gpu_width ||
|
||||
vp.height != g_extern.record.gpu_height)
|
||||
if (vp.width != global->record.gpu_width ||
|
||||
vp.height != global->record.gpu_height)
|
||||
{
|
||||
static const char msg[] = "Recording terminated due to resize.";
|
||||
RARCH_WARN("%s\n", msg);
|
||||
|
@ -135,19 +136,19 @@ void recording_dump_frame(const void *data, unsigned width,
|
|||
* it might take 3-4 times before this returns true. */
|
||||
if (driver->video && driver->video->read_viewport)
|
||||
if (!driver->video->read_viewport(driver->video_data,
|
||||
g_extern.record.gpu_buffer))
|
||||
global->record.gpu_buffer))
|
||||
return;
|
||||
|
||||
ffemu_data.pitch = g_extern.record.gpu_width * 3;
|
||||
ffemu_data.width = g_extern.record.gpu_width;
|
||||
ffemu_data.height = g_extern.record.gpu_height;
|
||||
ffemu_data.data = g_extern.record.gpu_buffer +
|
||||
ffemu_data.pitch = global->record.gpu_width * 3;
|
||||
ffemu_data.width = global->record.gpu_width;
|
||||
ffemu_data.height = global->record.gpu_height;
|
||||
ffemu_data.data = global->record.gpu_buffer +
|
||||
(ffemu_data.height - 1) * ffemu_data.pitch;
|
||||
|
||||
ffemu_data.pitch = -ffemu_data.pitch;
|
||||
}
|
||||
|
||||
if (!g_extern.record.gpu_buffer)
|
||||
if (!global->record.gpu_buffer)
|
||||
ffemu_data.is_dupe = !data;
|
||||
|
||||
if (driver->recording && driver->recording->push_video)
|
||||
|
@ -185,44 +186,45 @@ bool recording_deinit(void)
|
|||
bool recording_init(void)
|
||||
{
|
||||
struct ffemu_params params = {0};
|
||||
const struct retro_system_av_info *info = &g_extern.system.av_info;
|
||||
global_t *global = global_get_ptr();
|
||||
driver_t *driver = driver_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
const struct retro_system_av_info *info = &global->system.av_info;
|
||||
|
||||
if (!g_extern.record.enable)
|
||||
if (!global->record.enable)
|
||||
return false;
|
||||
|
||||
if (g_extern.libretro_dummy)
|
||||
if (global->libretro_dummy)
|
||||
{
|
||||
RARCH_WARN(RETRO_LOG_INIT_RECORDING_SKIPPED);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!settings->video.gpu_record
|
||||
&& g_extern.system.hw_render_callback.context_type)
|
||||
&& global->system.hw_render_callback.context_type)
|
||||
{
|
||||
RARCH_WARN("Libretro core is hardware rendered. Must use post-shaded recording as well.\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
RARCH_LOG("Custom timing given: FPS: %.4f, Sample rate: %.4f\n",
|
||||
(float)g_extern.system.av_info.timing.fps,
|
||||
(float)g_extern.system.av_info.timing.sample_rate);
|
||||
(float)global->system.av_info.timing.fps,
|
||||
(float)global->system.av_info.timing.sample_rate);
|
||||
|
||||
params.out_width = info->geometry.base_width;
|
||||
params.out_height = info->geometry.base_height;
|
||||
params.fb_width = info->geometry.max_width;
|
||||
params.fb_height = info->geometry.max_height;
|
||||
params.channels = 2;
|
||||
params.filename = g_extern.record.path;
|
||||
params.fps = g_extern.system.av_info.timing.fps;
|
||||
params.samplerate = g_extern.system.av_info.timing.sample_rate;
|
||||
params.pix_fmt = (g_extern.system.pix_fmt == RETRO_PIXEL_FORMAT_XRGB8888) ?
|
||||
params.filename = global->record.path;
|
||||
params.fps = global->system.av_info.timing.fps;
|
||||
params.samplerate = global->system.av_info.timing.sample_rate;
|
||||
params.pix_fmt = (global->system.pix_fmt == RETRO_PIXEL_FORMAT_XRGB8888) ?
|
||||
FFEMU_PIX_ARGB8888 : FFEMU_PIX_RGB565;
|
||||
params.config = NULL;
|
||||
|
||||
if (*g_extern.record.config)
|
||||
params.config = g_extern.record.config;
|
||||
if (*global->record.config)
|
||||
params.config = global->record.config;
|
||||
|
||||
if (settings->video.gpu_record && driver->video->read_viewport)
|
||||
{
|
||||
|
@ -244,20 +246,20 @@ bool recording_init(void)
|
|||
params.fb_height = next_pow2(vp.height);
|
||||
|
||||
if (settings->video.force_aspect &&
|
||||
(g_extern.system.aspect_ratio > 0.0f))
|
||||
params.aspect_ratio = g_extern.system.aspect_ratio;
|
||||
(global->system.aspect_ratio > 0.0f))
|
||||
params.aspect_ratio = global->system.aspect_ratio;
|
||||
else
|
||||
params.aspect_ratio = (float)vp.width / vp.height;
|
||||
|
||||
params.pix_fmt = FFEMU_PIX_BGR24;
|
||||
g_extern.record.gpu_width = vp.width;
|
||||
g_extern.record.gpu_height = vp.height;
|
||||
global->record.gpu_width = vp.width;
|
||||
global->record.gpu_height = vp.height;
|
||||
|
||||
RARCH_LOG("Detected viewport of %u x %u\n",
|
||||
vp.width, vp.height);
|
||||
|
||||
g_extern.record.gpu_buffer = (uint8_t*)malloc(vp.width * vp.height * 3);
|
||||
if (!g_extern.record.gpu_buffer)
|
||||
global->record.gpu_buffer = (uint8_t*)malloc(vp.width * vp.height * 3);
|
||||
if (!global->record.gpu_buffer)
|
||||
{
|
||||
RARCH_ERR("Failed to allocate GPU record buffer.\n");
|
||||
return false;
|
||||
|
@ -265,29 +267,29 @@ bool recording_init(void)
|
|||
}
|
||||
else
|
||||
{
|
||||
if (g_extern.record.width || g_extern.record.height)
|
||||
if (global->record.width || global->record.height)
|
||||
{
|
||||
params.out_width = g_extern.record.width;
|
||||
params.out_height = g_extern.record.height;
|
||||
params.out_width = global->record.width;
|
||||
params.out_height = global->record.height;
|
||||
}
|
||||
|
||||
if (settings->video.force_aspect &&
|
||||
(g_extern.system.aspect_ratio > 0.0f))
|
||||
params.aspect_ratio = g_extern.system.aspect_ratio;
|
||||
(global->system.aspect_ratio > 0.0f))
|
||||
params.aspect_ratio = global->system.aspect_ratio;
|
||||
else
|
||||
params.aspect_ratio = (float)params.out_width / params.out_height;
|
||||
|
||||
if (settings->video.post_filter_record && g_extern.filter.filter)
|
||||
if (settings->video.post_filter_record && global->filter.filter)
|
||||
{
|
||||
unsigned max_width = 0;
|
||||
unsigned max_height = 0;
|
||||
|
||||
if (g_extern.filter.out_rgb32)
|
||||
if (global->filter.out_rgb32)
|
||||
params.pix_fmt = FFEMU_PIX_ARGB8888;
|
||||
else
|
||||
params.pix_fmt = FFEMU_PIX_RGB565;
|
||||
|
||||
rarch_softfilter_get_max_output_size(g_extern.filter.filter,
|
||||
rarch_softfilter_get_max_output_size(global->filter.filter,
|
||||
&max_width, &max_height);
|
||||
params.fb_width = next_pow2(max_width);
|
||||
params.fb_height = next_pow2(max_height);
|
||||
|
@ -295,7 +297,7 @@ bool recording_init(void)
|
|||
}
|
||||
|
||||
RARCH_LOG("Recording to %s @ %ux%u. (FB size: %ux%u pix_fmt: %u)\n",
|
||||
g_extern.record.path,
|
||||
global->record.path,
|
||||
params.out_width, params.out_height,
|
||||
params.fb_width, params.fb_height,
|
||||
(unsigned)params.pix_fmt);
|
||||
|
|
753
retroarch.c
753
retroarch.c
File diff suppressed because it is too large
Load Diff
57
screenshot.c
57
screenshot.c
|
@ -124,20 +124,21 @@ static void dump_content(FILE *file, const void *frame,
|
|||
{
|
||||
size_t line_size;
|
||||
int i, j;
|
||||
uint8_t **lines;
|
||||
global_t *global = NULL;
|
||||
union
|
||||
{
|
||||
const uint8_t *u8;
|
||||
const uint16_t *u16;
|
||||
const uint32_t *u32;
|
||||
} u;
|
||||
u.u8 = (const uint8_t*)frame;
|
||||
uint8_t **lines = (uint8_t**)calloc(height, sizeof(uint8_t*));
|
||||
|
||||
lines = (uint8_t**)calloc(height, sizeof(uint8_t*));
|
||||
if (!lines)
|
||||
return;
|
||||
|
||||
u.u8 = (const uint8_t*)frame;
|
||||
line_size = (width * 3 + 3) & ~3;
|
||||
global = global_get_ptr();
|
||||
|
||||
for (i = 0; i < height; i++)
|
||||
{
|
||||
|
@ -151,7 +152,7 @@ static void dump_content(FILE *file, const void *frame,
|
|||
for (j = 0; j < height; j++, u.u8 += pitch)
|
||||
dump_line_bgr(lines[j], u.u8, width);
|
||||
}
|
||||
else if (g_extern.system.pix_fmt == RETRO_PIXEL_FORMAT_XRGB8888)
|
||||
else if (global->system.pix_fmt == RETRO_PIXEL_FORMAT_XRGB8888)
|
||||
{
|
||||
for (j = 0; j < height; j++, u.u8 += pitch)
|
||||
dump_line_32(lines[j], u.u32, width);
|
||||
|
@ -180,6 +181,7 @@ static bool take_screenshot_viewport(void)
|
|||
struct video_viewport vp = {0};
|
||||
driver_t *driver = driver_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
if (driver->video && driver->video->viewport_info)
|
||||
driver->video->viewport_info(driver->video_data, &vp);
|
||||
|
@ -198,7 +200,7 @@ static bool take_screenshot_viewport(void)
|
|||
|
||||
if (!*settings->screenshot_directory)
|
||||
{
|
||||
fill_pathname_basedir(screenshot_path, g_extern.basename,
|
||||
fill_pathname_basedir(screenshot_path, global->basename,
|
||||
sizeof(screenshot_path));
|
||||
screenshot_dir = screenshot_path;
|
||||
}
|
||||
|
@ -219,10 +221,11 @@ done:
|
|||
static bool take_screenshot_raw(void)
|
||||
{
|
||||
char screenshot_path[PATH_MAX_LENGTH];
|
||||
const void *data = g_extern.frame_cache.data;
|
||||
unsigned width = g_extern.frame_cache.width;
|
||||
unsigned height = g_extern.frame_cache.height;
|
||||
int pitch = g_extern.frame_cache.pitch;
|
||||
global_t *global = global_get_ptr();
|
||||
const void *data = global->frame_cache.data;
|
||||
unsigned width = global->frame_cache.width;
|
||||
unsigned height = global->frame_cache.height;
|
||||
int pitch = global->frame_cache.pitch;
|
||||
settings_t *settings = config_get_ptr();
|
||||
const char *screenshot_dir = NULL;
|
||||
|
||||
|
@ -230,7 +233,7 @@ static bool take_screenshot_raw(void)
|
|||
|
||||
if (!*settings->screenshot_directory)
|
||||
{
|
||||
fill_pathname_basedir(screenshot_path, g_extern.basename,
|
||||
fill_pathname_basedir(screenshot_path, global->basename,
|
||||
sizeof(screenshot_path));
|
||||
screenshot_dir = screenshot_path;
|
||||
}
|
||||
|
@ -256,13 +259,14 @@ bool take_screenshot(void)
|
|||
runloop_t *runloop = rarch_main_get_ptr();
|
||||
driver_t *driver = driver_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
/* No way to infer screenshot directory. */
|
||||
if ((!*settings->screenshot_directory) && (!*g_extern.basename))
|
||||
if ((!*settings->screenshot_directory) && (!*global->basename))
|
||||
return false;
|
||||
|
||||
viewport_read = (settings->video.gpu_screenshot ||
|
||||
((g_extern.system.hw_render_callback.context_type
|
||||
((global->system.hw_render_callback.context_type
|
||||
!= RETRO_HW_CONTEXT_NONE) && !driver->video->read_frame_raw))
|
||||
&& driver->video->read_viewport && driver->video->viewport_info;
|
||||
|
||||
|
@ -281,33 +285,33 @@ bool take_screenshot(void)
|
|||
|
||||
if (viewport_read)
|
||||
ret = take_screenshot_viewport();
|
||||
else if (g_extern.frame_cache.data &&
|
||||
(g_extern.frame_cache.data != RETRO_HW_FRAME_BUFFER_VALID))
|
||||
else if (global->frame_cache.data &&
|
||||
(global->frame_cache.data != RETRO_HW_FRAME_BUFFER_VALID))
|
||||
ret = take_screenshot_raw();
|
||||
else if (driver->video->read_frame_raw)
|
||||
{
|
||||
const void* old_data = g_extern.frame_cache.data;
|
||||
unsigned old_width = g_extern.frame_cache.width;
|
||||
unsigned old_height = g_extern.frame_cache.height;
|
||||
size_t old_pitch = g_extern.frame_cache.pitch;
|
||||
const void* old_data = global->frame_cache.data;
|
||||
unsigned old_width = global->frame_cache.width;
|
||||
unsigned old_height = global->frame_cache.height;
|
||||
size_t old_pitch = global->frame_cache.pitch;
|
||||
|
||||
void* frame_data = driver->video->read_frame_raw
|
||||
(driver->video_data, &g_extern.frame_cache.width,
|
||||
&g_extern.frame_cache.height, &g_extern.frame_cache.pitch);
|
||||
(driver->video_data, &global->frame_cache.width,
|
||||
&global->frame_cache.height, &global->frame_cache.pitch);
|
||||
|
||||
if (frame_data)
|
||||
{
|
||||
g_extern.frame_cache.data = frame_data;
|
||||
global->frame_cache.data = frame_data;
|
||||
ret = take_screenshot_raw();
|
||||
free(frame_data);
|
||||
}
|
||||
else
|
||||
ret = false;
|
||||
|
||||
g_extern.frame_cache.data = old_data;
|
||||
g_extern.frame_cache.width = old_width;
|
||||
g_extern.frame_cache.height = old_height;
|
||||
g_extern.frame_cache.pitch = old_pitch;
|
||||
global->frame_cache.data = old_data;
|
||||
global->frame_cache.width = old_width;
|
||||
global->frame_cache.height = old_height;
|
||||
global->frame_cache.pitch = old_pitch;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -346,6 +350,7 @@ bool screenshot_dump(const char *folder, const void *frame,
|
|||
FILE *file = NULL;
|
||||
uint8_t *out_buffer = NULL;
|
||||
bool ret = false;
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
(void)file;
|
||||
(void)out_buffer;
|
||||
|
@ -370,7 +375,7 @@ bool screenshot_dump(const char *folder, const void *frame,
|
|||
|
||||
if (bgr24)
|
||||
scaler.in_fmt = SCALER_FMT_BGR24;
|
||||
else if (g_extern.system.pix_fmt == RETRO_PIXEL_FORMAT_XRGB8888)
|
||||
else if (global->system.pix_fmt == RETRO_PIXEL_FORMAT_XRGB8888)
|
||||
scaler.in_fmt = SCALER_FMT_ARGB8888;
|
||||
else
|
||||
scaler.in_fmt = SCALER_FMT_RGB565;
|
||||
|
|
30
settings.c
30
settings.c
|
@ -336,8 +336,9 @@ static int setting_action_start_libretro_device_type(void *data)
|
|||
{
|
||||
unsigned current_device, i, devices[128], types = 0, port = 0;
|
||||
const struct retro_controller_info *desc = NULL;
|
||||
rarch_setting_t *setting = (rarch_setting_t*)data;
|
||||
rarch_setting_t *setting = (rarch_setting_t*)data;
|
||||
settings_t *settings = config_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
if (!setting)
|
||||
return -1;
|
||||
|
@ -351,11 +352,12 @@ static int setting_action_start_libretro_device_type(void *data)
|
|||
|
||||
/* Only push RETRO_DEVICE_ANALOG as default if we use an
|
||||
* older core which doesn't use SET_CONTROLLER_INFO. */
|
||||
if (!g_extern.system.num_ports)
|
||||
if (!global->system.num_ports)
|
||||
devices[types++] = RETRO_DEVICE_ANALOG;
|
||||
|
||||
desc = port < g_extern.system.num_ports ?
|
||||
&g_extern.system.ports[port] : NULL;
|
||||
desc = port < global->system.num_ports ?
|
||||
&global->system.ports[port] : NULL;
|
||||
|
||||
if (desc)
|
||||
{
|
||||
for (i = 0; i < desc->num_types; i++)
|
||||
|
@ -431,9 +433,10 @@ static int setting_string_action_start_allow_input(void *data)
|
|||
|
||||
static int setting_bind_action_start(void *data)
|
||||
{
|
||||
struct retro_keybind *keybind = NULL;
|
||||
rarch_setting_t *setting = (rarch_setting_t*)data;
|
||||
struct retro_keybind *def_binds = (struct retro_keybind *)retro_keybinds_1;
|
||||
struct retro_keybind *keybind = NULL;
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
if (!setting)
|
||||
return -1;
|
||||
|
@ -442,7 +445,7 @@ static int setting_bind_action_start(void *data)
|
|||
if (!keybind)
|
||||
return -1;
|
||||
|
||||
if (!g_extern.menu.bind_mode_keyboard)
|
||||
if (!global->menu.bind_mode_keyboard)
|
||||
{
|
||||
keybind->joykey = NO_BTN;
|
||||
keybind->joyaxis = AXIS_NONE;
|
||||
|
@ -524,6 +527,7 @@ static int setting_action_toggle_libretro_device_type(
|
|||
const struct retro_controller_info *desc = NULL;
|
||||
rarch_setting_t *setting = (rarch_setting_t*)data;
|
||||
settings_t *settings = config_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
if (!setting)
|
||||
return -1;
|
||||
|
@ -535,11 +539,12 @@ static int setting_action_toggle_libretro_device_type(
|
|||
|
||||
/* Only push RETRO_DEVICE_ANALOG as default if we use an
|
||||
* older core which doesn't use SET_CONTROLLER_INFO. */
|
||||
if (!g_extern.system.num_ports)
|
||||
if (!global->system.num_ports)
|
||||
devices[types++] = RETRO_DEVICE_ANALOG;
|
||||
|
||||
desc = port < g_extern.system.num_ports ?
|
||||
&g_extern.system.ports[port] : NULL;
|
||||
if (port < global->system.num_ports)
|
||||
desc = &global->system.ports[port];
|
||||
|
||||
if (desc)
|
||||
{
|
||||
for (i = 0; i < desc->num_types; i++)
|
||||
|
@ -827,16 +832,17 @@ static int load_content_action_toggle(void *data, unsigned action,
|
|||
{
|
||||
rarch_setting_t *setting = (rarch_setting_t *)data;
|
||||
settings_t *settings = config_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
if (!setting)
|
||||
return -1;
|
||||
|
||||
strlcpy(setting->value.string, settings->menu_content_directory, setting->size);
|
||||
|
||||
if (g_extern.menu.info.valid_extensions)
|
||||
setting->values = g_extern.menu.info.valid_extensions;
|
||||
if (global->menu.info.valid_extensions)
|
||||
setting->values = global->menu.info.valid_extensions;
|
||||
else
|
||||
setting->values = g_extern.system.valid_extensions;
|
||||
setting->values = global->system.valid_extensions;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue