mirror of
https://github.com/libretro/RetroArch.git
synced 2025-01-31 05:56:07 +00:00
Revert "Refactor core_system_info_* functions"
This reverts commit f637805c9edd0e17b72d459e319a195ded230276.
This commit is contained in:
parent
2ecd9f36c4
commit
c3ba0ba4e9
@ -603,7 +603,8 @@ static unsigned cheevos_parse_operator(const char **memaddr)
|
||||
|
||||
void cheevos_parse_guest_addr(cheevos_var_t *var, unsigned value)
|
||||
{
|
||||
rarch_system_info_t *system = core_system_info_get();
|
||||
rarch_system_info_t *system;
|
||||
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system);
|
||||
|
||||
var->bank_id = -1;
|
||||
var->value = value;
|
||||
@ -1088,7 +1089,8 @@ uint8_t *cheevos_get_memory(const cheevos_var_t *var)
|
||||
{
|
||||
if (var->bank_id >= 0)
|
||||
{
|
||||
rarch_system_info_t *system = core_system_info_get();
|
||||
rarch_system_info_t *system;
|
||||
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system);
|
||||
|
||||
if (system->mmaps.num_descriptors != 0)
|
||||
return (uint8_t *)system->mmaps.descriptors[var->bank_id].ptr + var->value;
|
||||
|
20
command.c
20
command.c
@ -834,8 +834,10 @@ static void command_event_disk_control_set_eject(bool new_state, bool print_log)
|
||||
{
|
||||
char msg[128] = {0};
|
||||
bool error = false;
|
||||
rarch_system_info_t *info = NULL;
|
||||
const struct retro_disk_control_callback *control = NULL;
|
||||
rarch_system_info_t *info = core_system_info_get();
|
||||
|
||||
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &info);
|
||||
|
||||
if (info)
|
||||
control = (const struct retro_disk_control_callback*)&info->disk_control_cb;
|
||||
@ -882,8 +884,10 @@ static void command_event_disk_control_set_index(unsigned idx)
|
||||
unsigned num_disks;
|
||||
bool error = false;
|
||||
char msg[128] = {0};
|
||||
rarch_system_info_t *info = NULL;
|
||||
const struct retro_disk_control_callback *control = NULL;
|
||||
rarch_system_info_t *info = core_system_info_get();
|
||||
|
||||
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &info);
|
||||
|
||||
if (info)
|
||||
control = (const struct retro_disk_control_callback*)&info->disk_control_cb;
|
||||
@ -938,7 +942,9 @@ static bool command_event_disk_control_append_image(const char *path)
|
||||
struct retro_game_info info = {0};
|
||||
global_t *global = global_get_ptr();
|
||||
const struct retro_disk_control_callback *control = NULL;
|
||||
rarch_system_info_t *sysinfo = core_system_info_get();
|
||||
rarch_system_info_t *sysinfo = NULL;
|
||||
|
||||
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &sysinfo);
|
||||
|
||||
if (sysinfo)
|
||||
control = (const struct retro_disk_control_callback*)
|
||||
@ -1081,7 +1087,9 @@ static void command_event_init_controllers(void)
|
||||
{
|
||||
unsigned i;
|
||||
settings_t *settings = config_get_ptr();
|
||||
rarch_system_info_t *info = core_system_info_get();
|
||||
rarch_system_info_t *info = NULL;
|
||||
|
||||
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &info);
|
||||
|
||||
for (i = 0; i < MAX_USERS; i++)
|
||||
{
|
||||
@ -1806,7 +1814,9 @@ bool command_event(enum event_command cmd, void *data)
|
||||
unsigned i = 0;
|
||||
bool boolean = false;
|
||||
settings_t *settings = config_get_ptr();
|
||||
rarch_system_info_t *info = core_system_info_get();
|
||||
rarch_system_info_t *info = NULL;
|
||||
|
||||
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &info);
|
||||
|
||||
(void)i;
|
||||
|
||||
|
@ -2132,8 +2132,10 @@ bool config_load_override(void)
|
||||
const char *core_name = NULL;
|
||||
const char *game_name = NULL;
|
||||
bool should_append = false;
|
||||
rarch_system_info_t *system = NULL;
|
||||
global_t *global = global_get_ptr();
|
||||
rarch_system_info_t *system = core_system_info_get();
|
||||
|
||||
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system);
|
||||
|
||||
if (system)
|
||||
core_name = system->info.library_name;
|
||||
@ -2290,7 +2292,9 @@ bool config_load_remap(void)
|
||||
const char *game_name = NULL;
|
||||
global_t *global = global_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
rarch_system_info_t *system = core_system_info_get();
|
||||
rarch_system_info_t *system = NULL;
|
||||
|
||||
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system);
|
||||
|
||||
if (system)
|
||||
core_name = system->info.library_name;
|
||||
@ -2411,7 +2415,9 @@ bool config_load_shader_preset(void)
|
||||
const char *game_name = NULL;
|
||||
global_t *global = global_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
rarch_system_info_t *system = core_system_info_get();
|
||||
rarch_system_info_t *system = NULL;
|
||||
|
||||
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system);
|
||||
|
||||
if (system)
|
||||
core_name = system->info.library_name;
|
||||
@ -3001,6 +3007,9 @@ bool config_save_overrides(int override_type)
|
||||
const char *game_name = NULL;
|
||||
config_file_t *conf = NULL;
|
||||
settings_t *settings = NULL;
|
||||
global_t *global = global_get_ptr();
|
||||
settings_t *overrides = config_get_ptr();
|
||||
rarch_system_info_t *system = NULL;
|
||||
struct config_bool_setting *bool_settings = NULL;
|
||||
struct config_bool_setting *bool_overrides = NULL;
|
||||
struct config_int_setting *int_settings = NULL;
|
||||
@ -3011,9 +3020,8 @@ bool config_save_overrides(int override_type)
|
||||
struct config_array_setting *array_overrides= NULL;
|
||||
struct config_path_setting *path_settings = NULL;
|
||||
struct config_path_setting *path_overrides = NULL;
|
||||
global_t *global = global_get_ptr();
|
||||
settings_t *overrides = config_get_ptr();
|
||||
rarch_system_info_t *system = core_system_info_get();
|
||||
|
||||
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system);
|
||||
|
||||
if (system)
|
||||
core_name = system->info.library_name;
|
||||
|
6
core.h
6
core.h
@ -228,12 +228,6 @@ bool core_is_inited(void);
|
||||
|
||||
bool core_is_game_loaded(void);
|
||||
|
||||
rarch_system_info_t *core_system_info_get(void);
|
||||
|
||||
void core_system_info_init(void);
|
||||
|
||||
void core_system_info_free(void);
|
||||
|
||||
RETRO_END_DECLS
|
||||
|
||||
#endif
|
||||
|
50
core_impl.c
50
core_impl.c
@ -23,7 +23,6 @@
|
||||
|
||||
#include <retro_inline.h>
|
||||
#include <boolean.h>
|
||||
#include <compat/strl.h>
|
||||
#include <lists/string_list.h>
|
||||
#include <libretro.h>
|
||||
|
||||
@ -41,12 +40,6 @@
|
||||
#include "network/netplay/netplay.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_ZLIB
|
||||
#define DEFAULT_EXT "zip"
|
||||
#else
|
||||
#define DEFAULT_EXT ""
|
||||
#endif
|
||||
|
||||
static struct retro_core_t core;
|
||||
static bool core_inited;
|
||||
static bool core_symbols_inited;
|
||||
@ -55,7 +48,6 @@ static unsigned core_poll_type;
|
||||
static bool core_input_polled;
|
||||
static bool core_has_set_input_descriptors = false;
|
||||
static struct retro_callbacks retro_ctx;
|
||||
static rarch_system_info_t core_system_info;
|
||||
|
||||
static void core_input_state_poll_maybe(void)
|
||||
{
|
||||
@ -456,45 +448,3 @@ bool core_is_game_loaded(void)
|
||||
{
|
||||
return core_game_loaded;
|
||||
}
|
||||
|
||||
rarch_system_info_t *core_system_info_get(void)
|
||||
{
|
||||
return &core_system_info;
|
||||
}
|
||||
|
||||
void core_system_info_init(void)
|
||||
{
|
||||
memset(&core_system_info, 0, sizeof(rarch_system_info_t));
|
||||
core_get_system_info(&core_system_info.info);
|
||||
|
||||
if (!core_system_info.info.library_name)
|
||||
core_system_info.info.library_name = msg_hash_to_str(MSG_UNKNOWN);
|
||||
if (!core_system_info.info.library_version)
|
||||
core_system_info.info.library_version = "v0";
|
||||
|
||||
strlcpy(core_system_info.valid_extensions,
|
||||
core_system_info.info.valid_extensions ?
|
||||
core_system_info.info.valid_extensions : DEFAULT_EXT,
|
||||
sizeof(core_system_info.valid_extensions));
|
||||
}
|
||||
|
||||
void core_system_info_free(void)
|
||||
{
|
||||
/* No longer valid. */
|
||||
if (core_system_info.subsystem.data)
|
||||
free(core_system_info.subsystem.data);
|
||||
core_system_info.subsystem.data = NULL;
|
||||
core_system_info.subsystem.size = 0;
|
||||
|
||||
if (core_system_info.ports.data)
|
||||
free(core_system_info.ports.data);
|
||||
core_system_info.ports.data = NULL;
|
||||
core_system_info.ports.size = 0;
|
||||
|
||||
if (core_system_info.mmaps.descriptors)
|
||||
free((void *)core_system_info.mmaps.descriptors);
|
||||
core_system_info.mmaps.descriptors = NULL;
|
||||
core_system_info.mmaps.num_descriptors = 0;
|
||||
|
||||
memset(&core_system_info, 0, sizeof(rarch_system_info_t));
|
||||
}
|
||||
|
@ -932,8 +932,10 @@ bool rarch_environment_cb(unsigned cmd, void *data)
|
||||
unsigned p;
|
||||
settings_t *settings = config_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
rarch_system_info_t *system = core_system_info_get();
|
||||
rarch_system_info_t *system = NULL;
|
||||
|
||||
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system);
|
||||
|
||||
if (ignore_environment_cb)
|
||||
return false;
|
||||
|
||||
|
@ -590,12 +590,14 @@ static bool init_video(void)
|
||||
video_viewport_t *custom_vp = NULL;
|
||||
const input_driver_t *tmp = NULL;
|
||||
const struct retro_game_geometry *geom = NULL;
|
||||
rarch_system_info_t *system = NULL;
|
||||
video_info_t video = {0};
|
||||
static uint16_t dummy_pixels[32] = {0};
|
||||
settings_t *settings = config_get_ptr();
|
||||
struct retro_system_av_info *av_info =
|
||||
video_viewport_get_system_av_info();
|
||||
rarch_system_info_t *system = core_system_info_get();
|
||||
|
||||
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system);
|
||||
|
||||
init_video_filter(video_driver_state.pix_fmt);
|
||||
command_event(CMD_EVENT_SHADER_DIR_INIT, NULL);
|
||||
|
@ -25,75 +25,75 @@ static struct mg_context* s_httpserver_ctx;
|
||||
/* Based on https://github.com/zeromq/rfc/blob/master/src/spec_32.c */
|
||||
static void httpserver_z85_encode_inplace(Bytef* data, size_t size)
|
||||
{
|
||||
static char digits[85 + 1] =
|
||||
{
|
||||
"0123456789"
|
||||
"abcdefghij"
|
||||
"klmnopqrst"
|
||||
"uvwxyzABCD"
|
||||
"EFGHIJKLMN"
|
||||
"OPQRSTUVWX"
|
||||
"YZ.-:+=^!/"
|
||||
"*?&<>()[]{"
|
||||
"}@%$#"
|
||||
};
|
||||
static char digits[85 + 1] =
|
||||
{
|
||||
"0123456789"
|
||||
"abcdefghij"
|
||||
"klmnopqrst"
|
||||
"uvwxyzABCD"
|
||||
"EFGHIJKLMN"
|
||||
"OPQRSTUVWX"
|
||||
"YZ.-:+=^!/"
|
||||
"*?&<>()[]{"
|
||||
"}@%$#"
|
||||
};
|
||||
|
||||
Bytef* source = data + size - 4;
|
||||
Bytef* dest = data + size * 5 / 4 - 5;
|
||||
uLong value;
|
||||
Bytef* source = data + size - 4;
|
||||
Bytef* dest = data + size * 5 / 4 - 5;
|
||||
uLong value;
|
||||
|
||||
dest[5] = 0;
|
||||
dest[5] = 0;
|
||||
|
||||
if (source >= data)
|
||||
{
|
||||
do
|
||||
{
|
||||
value = source[0] * 256 * 256 * 256;
|
||||
value += source[1] * 256 * 256;
|
||||
value += source[2] * 256;
|
||||
value += source[3];
|
||||
source -= 4;
|
||||
if (source >= data)
|
||||
{
|
||||
do
|
||||
{
|
||||
value = source[0] * 256 * 256 * 256;
|
||||
value += source[1] * 256 * 256;
|
||||
value += source[2] * 256;
|
||||
value += source[3];
|
||||
source -= 4;
|
||||
|
||||
dest[4] = digits[value % 85];
|
||||
value /= 85;
|
||||
dest[3] = digits[value % 85];
|
||||
value /= 85;
|
||||
dest[2] = digits[value % 85];
|
||||
value /= 85;
|
||||
dest[1] = digits[value % 85];
|
||||
dest[0] = digits[value / 85];
|
||||
dest -= 5;
|
||||
dest[4] = digits[value % 85];
|
||||
value /= 85;
|
||||
dest[3] = digits[value % 85];
|
||||
value /= 85;
|
||||
dest[2] = digits[value % 85];
|
||||
value /= 85;
|
||||
dest[1] = digits[value % 85];
|
||||
dest[0] = digits[value / 85];
|
||||
dest -= 5;
|
||||
|
||||
} while (source >= data);
|
||||
}
|
||||
} while (source >= data);
|
||||
}
|
||||
}
|
||||
|
||||
static void json_string_encode(char* output, size_t size, const char* input)
|
||||
{
|
||||
/* Don't use with UTF-8 strings. */
|
||||
char k;
|
||||
/* Don't use with UTF-8 strings. */
|
||||
char k;
|
||||
|
||||
if (*input != 0 && size != 0)
|
||||
{
|
||||
do
|
||||
if (*input != 0 && size != 0)
|
||||
{
|
||||
do
|
||||
{
|
||||
switch (k = *input++)
|
||||
{
|
||||
switch (k = *input++)
|
||||
{
|
||||
case '"': /* fall through */
|
||||
case '\\': /* fall through */
|
||||
case '/': if (size >= 3) { *output++ = '\\'; *output++ = k; size -= 2; } break;
|
||||
case '\b': if (size >= 3) { *output++ = '\\'; *output++ = 'b'; size -= 2; } break;
|
||||
case '\f': if (size >= 3) { *output++ = '\\'; *output++ = 'f'; size -= 2; } break;
|
||||
case '\n': if (size >= 3) { *output++ = '\\'; *output++ = 'n'; size -= 2; } break;
|
||||
case '\r': if (size >= 3) { *output++ = '\\'; *output++ = 'r'; size -= 2; } break;
|
||||
case '\t': if (size >= 3) { *output++ = '\\'; *output++ = 't'; size -= 2; } break;
|
||||
default: if (size >= 2) { *output++ = k; } size--; break;
|
||||
}
|
||||
case '"': /* fall through */
|
||||
case '\\': /* fall through */
|
||||
case '/': if (size >= 3) { *output++ = '\\'; *output++ = k; size -= 2; } break;
|
||||
case '\b': if (size >= 3) { *output++ = '\\'; *output++ = 'b'; size -= 2; } break;
|
||||
case '\f': if (size >= 3) { *output++ = '\\'; *output++ = 'f'; size -= 2; } break;
|
||||
case '\n': if (size >= 3) { *output++ = '\\'; *output++ = 'n'; size -= 2; } break;
|
||||
case '\r': if (size >= 3) { *output++ = '\\'; *output++ = 'r'; size -= 2; } break;
|
||||
case '\t': if (size >= 3) { *output++ = '\\'; *output++ = 't'; size -= 2; } break;
|
||||
default: if (size >= 2) { *output++ = k; } size--; break;
|
||||
}
|
||||
while (*input != 0);
|
||||
}
|
||||
}
|
||||
while (*input != 0);
|
||||
}
|
||||
|
||||
*output = 0;
|
||||
*output = 0;
|
||||
}
|
||||
|
||||
/*============================================================
|
||||
@ -102,35 +102,35 @@ HTTP ERRORS
|
||||
|
||||
static int httpserver_error(struct mg_connection* conn, unsigned code, const char* fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
char buffer[1024];
|
||||
const char* reason = NULL;
|
||||
const char* reason;
|
||||
char buffer[1024];
|
||||
va_list args;
|
||||
|
||||
switch (code)
|
||||
{
|
||||
case 404:
|
||||
reason = "Not Found";
|
||||
break;
|
||||
switch (code)
|
||||
{
|
||||
case 404:
|
||||
reason = "Not Found";
|
||||
break;
|
||||
|
||||
case 405:
|
||||
reason = "Method Not Allowed";
|
||||
break;
|
||||
case 405:
|
||||
reason = "Method Not Allowed";
|
||||
break;
|
||||
|
||||
default:
|
||||
/* Send unknown codes as 500 */
|
||||
code = 500;
|
||||
reason = "Internal Server Error";
|
||||
break;
|
||||
}
|
||||
default:
|
||||
/* Send unknown codes as 500 */
|
||||
code = 500;
|
||||
reason = "Internal Server Error";
|
||||
break;
|
||||
}
|
||||
|
||||
va_start(args, fmt);
|
||||
vsnprintf(buffer, sizeof(buffer), fmt, args);
|
||||
va_end(args);
|
||||
buffer[sizeof(buffer) - 1] = 0;
|
||||
va_start(args, fmt);
|
||||
vsnprintf(buffer, sizeof(buffer), fmt, args);
|
||||
va_end(args);
|
||||
buffer[sizeof(buffer) - 1] = 0;
|
||||
|
||||
mg_printf(conn, "HTTP/1.1 %u %s\r\nContent-Type: text/html\r\n\r\n", code, reason);
|
||||
mg_printf(conn, "<html><body><h1>%u %s</h1><p>%s</p></body></html>", code, reason, buffer);
|
||||
return 1;
|
||||
mg_printf(conn, "HTTP/1.1 %u %s\r\nContent-Type: text/html\r\n\r\n", code, reason);
|
||||
mg_printf(conn, "<html><body><h1>%u %s</h1><p>%s</p></body></html>", code, reason, buffer);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*============================================================
|
||||
@ -139,253 +139,251 @@ INFO
|
||||
|
||||
static int httpserver_handle_basic_info(struct mg_connection* conn, void* cbdata)
|
||||
{
|
||||
static const char *libretro_btn_desc[] = {
|
||||
"B (bottom)", "Y (left)", "Select", "Start",
|
||||
"D-Pad Up", "D-Pad Down", "D-Pad Left", "D-Pad Right",
|
||||
"A (right)", "X (up)",
|
||||
"L", "R", "L2", "R2", "L3", "R3",
|
||||
};
|
||||
static const char *libretro_btn_desc[] = {
|
||||
"B (bottom)", "Y (left)", "Select", "Start",
|
||||
"D-Pad Up", "D-Pad Down", "D-Pad Left", "D-Pad Right",
|
||||
"A (right)", "X (up)",
|
||||
"L", "R", "L2", "R2", "L3", "R3",
|
||||
};
|
||||
|
||||
unsigned p, q, r;
|
||||
char core_path[PATH_MAX_LENGTH];
|
||||
retro_ctx_api_info_t api;
|
||||
retro_ctx_region_info_t region;
|
||||
const char* pixel_format;
|
||||
retro_ctx_memory_info_t sram;
|
||||
retro_ctx_memory_info_t rtc;
|
||||
retro_ctx_memory_info_t sysram;
|
||||
retro_ctx_memory_info_t vram;
|
||||
const struct retro_subsystem_info* subsys = NULL;
|
||||
const struct retro_subsystem_rom_info* rom = NULL;
|
||||
const struct retro_subsystem_memory_info* mem = NULL;
|
||||
const struct retro_controller_description* ctrl = NULL;
|
||||
const struct retro_system_av_info* av_info = NULL;
|
||||
const core_option_manager_t* core_opts = NULL;
|
||||
const struct core_option* opts = NULL;
|
||||
const char* comma = NULL;
|
||||
const struct mg_request_info* req = mg_get_request_info(conn);
|
||||
const settings_t* settings = config_get_ptr();
|
||||
rarch_system_info_t *system = core_system_info_get();
|
||||
const struct mg_request_info* req = mg_get_request_info(conn);
|
||||
const settings_t* settings = config_get_ptr();
|
||||
const rarch_system_info_t* system;
|
||||
char core_path[PATH_MAX_LENGTH];
|
||||
retro_ctx_api_info_t api;
|
||||
retro_ctx_region_info_t region;
|
||||
const char* pixel_format;
|
||||
retro_ctx_memory_info_t sram;
|
||||
retro_ctx_memory_info_t rtc;
|
||||
retro_ctx_memory_info_t sysram;
|
||||
retro_ctx_memory_info_t vram;
|
||||
const struct retro_subsystem_info* subsys;
|
||||
const struct retro_subsystem_rom_info* rom;
|
||||
const struct retro_subsystem_memory_info* mem;
|
||||
const struct retro_controller_description* ctrl;
|
||||
const struct retro_system_av_info* av_info;
|
||||
const core_option_manager_t* core_opts;
|
||||
const struct core_option* opts;
|
||||
unsigned p, q, r;
|
||||
const char* comma;
|
||||
|
||||
if (!system)
|
||||
return httpserver_error(conn, 500, "Could not get system information in %s", __FUNCTION__);
|
||||
if (!runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system))
|
||||
{
|
||||
return httpserver_error(conn, 500, "Could not get system information in %s", __FUNCTION__);
|
||||
}
|
||||
|
||||
if (string_is_empty(system->info.library_name))
|
||||
return httpserver_error(conn, 500, "Core not initialized in %s", __FUNCTION__);
|
||||
if (string_is_empty(system->info.library_name))
|
||||
{
|
||||
return httpserver_error(conn, 500, "Core not initialized in %s", __FUNCTION__);
|
||||
}
|
||||
|
||||
if (!core_is_game_loaded())
|
||||
return httpserver_error(conn, 500, "Game not loaded in %s", __FUNCTION__);
|
||||
if (!core_is_game_loaded())
|
||||
{
|
||||
return httpserver_error(conn, 500, "Game not loaded in %s", __FUNCTION__);
|
||||
}
|
||||
|
||||
json_string_encode(core_path, sizeof(core_path), config_get_active_core_path());
|
||||
json_string_encode(core_path, sizeof(core_path), config_get_active_core_path());
|
||||
|
||||
core_api_version(&api);
|
||||
core_get_region(®ion);
|
||||
core_api_version(&api);
|
||||
core_get_region(®ion);
|
||||
|
||||
switch (video_driver_get_pixel_format())
|
||||
{
|
||||
case RETRO_PIXEL_FORMAT_0RGB1555:
|
||||
pixel_format = "RETRO_PIXEL_FORMAT_0RGB1555";
|
||||
break;
|
||||
case RETRO_PIXEL_FORMAT_XRGB8888:
|
||||
pixel_format = "RETRO_PIXEL_FORMAT_XRGB8888";
|
||||
break;
|
||||
case RETRO_PIXEL_FORMAT_RGB565:
|
||||
pixel_format = "RETRO_PIXEL_FORMAT_RGB565";
|
||||
break;
|
||||
default:
|
||||
pixel_format = "?";
|
||||
break;
|
||||
}
|
||||
switch (video_driver_get_pixel_format())
|
||||
{
|
||||
case RETRO_PIXEL_FORMAT_0RGB1555: pixel_format = "RETRO_PIXEL_FORMAT_0RGB1555"; break;
|
||||
case RETRO_PIXEL_FORMAT_XRGB8888: pixel_format = "RETRO_PIXEL_FORMAT_XRGB8888"; break;
|
||||
case RETRO_PIXEL_FORMAT_RGB565: pixel_format = "RETRO_PIXEL_FORMAT_RGB565"; break;
|
||||
default: pixel_format = "?"; break;
|
||||
}
|
||||
|
||||
sram.id = RETRO_MEMORY_SAVE_RAM;
|
||||
core_get_memory(&sram);
|
||||
sram.id = RETRO_MEMORY_SAVE_RAM;
|
||||
core_get_memory(&sram);
|
||||
|
||||
rtc.id = RETRO_MEMORY_RTC;
|
||||
core_get_memory(&rtc);
|
||||
rtc.id = RETRO_MEMORY_RTC;
|
||||
core_get_memory(&rtc);
|
||||
|
||||
sysram.id = RETRO_MEMORY_SYSTEM_RAM;
|
||||
core_get_memory(&sysram);
|
||||
sysram.id = RETRO_MEMORY_SYSTEM_RAM;
|
||||
core_get_memory(&sysram);
|
||||
|
||||
vram.id = RETRO_MEMORY_VIDEO_RAM;
|
||||
core_get_memory(&vram);
|
||||
vram.id = RETRO_MEMORY_VIDEO_RAM;
|
||||
core_get_memory(&vram);
|
||||
|
||||
mg_printf(conn,
|
||||
"HTTP/1.1 200 OK\r\nContent-Type: application/json\r\n\r\n"
|
||||
"{"
|
||||
"\"corePath\":\"%s\","
|
||||
"\"apiVersion\":%u,"
|
||||
"\"systemInfo\":"
|
||||
"{"
|
||||
"\"libraryName\":\"%s\","
|
||||
"\"libraryVersion\":\"%s\","
|
||||
"\"validExtensions\":\"%s\","
|
||||
"\"needsFullpath\":%s,"
|
||||
"\"blockExtract\":%s"
|
||||
"},"
|
||||
"\"region\":\"%s\","
|
||||
"\"pixelFormat\":\"%s\","
|
||||
"\"rotation\":%u,"
|
||||
"\"performaceLevel\":%u,"
|
||||
"\"supportsNoGame\":%s,"
|
||||
mg_printf(conn,
|
||||
"HTTP/1.1 200 OK\r\nContent-Type: application/json\r\n\r\n"
|
||||
"{"
|
||||
"\"corePath\":\"%s\","
|
||||
"\"apiVersion\":%u,"
|
||||
"\"systemInfo\":"
|
||||
"{"
|
||||
"\"libraryName\":\"%s\","
|
||||
"\"libraryVersion\":\"%s\","
|
||||
"\"validExtensions\":\"%s\","
|
||||
"\"needsFullpath\":%s,"
|
||||
"\"blockExtract\":%s"
|
||||
"},"
|
||||
"\"region\":\"%s\","
|
||||
"\"pixelFormat\":\"%s\","
|
||||
"\"rotation\":%u,"
|
||||
"\"performaceLevel\":%u,"
|
||||
"\"supportsNoGame\":%s,"
|
||||
#ifdef HAVE_CHEEVOS
|
||||
"\"frontendSupportsAchievements\":true,"
|
||||
"\"coreSupportsAchievements\":%s,"
|
||||
"\"frontendSupportsAchievements\":true,"
|
||||
"\"coreSupportsAchievements\":%s,"
|
||||
#else
|
||||
"\"frontendSupportsAchievements\":false,"
|
||||
"\"coreSupportsAchievements\":null,"
|
||||
"\"frontendSupportsAchievements\":false,"
|
||||
"\"coreSupportsAchievements\":null,"
|
||||
#endif
|
||||
"\"saveRam\":{\"pointer\":\"%" PRIXPTR "\",\"size\":" STRING_REP_UINT64 "},"
|
||||
"\"rtcRam\":{\"pointer\":\"%" PRIXPTR "\",\"size\":" STRING_REP_UINT64 "},"
|
||||
"\"systemRam\":{\"pointer\":\"%" PRIXPTR "\",\"size\":" STRING_REP_UINT64 "},"
|
||||
"\"videoRam\":{\"pointer\":\"%" PRIXPTR "\",\"size\":" STRING_REP_UINT64 "},",
|
||||
core_path,
|
||||
api.version,
|
||||
system->info.library_name,
|
||||
system->info.library_version,
|
||||
system->info.valid_extensions,
|
||||
system->info.need_fullpath ? "true" : "false",
|
||||
system->info.block_extract ? "true" : "false",
|
||||
region.region ? "RETRO_REGION_PAL" : "RETRO_REGION_NTSC",
|
||||
pixel_format,
|
||||
system->rotation,
|
||||
system->performance_level,
|
||||
content_does_not_need_content() ? "true" : "false",
|
||||
"\"saveRam\":{\"pointer\":\"%" PRIXPTR "\",\"size\":" STRING_REP_UINT64 "},"
|
||||
"\"rtcRam\":{\"pointer\":\"%" PRIXPTR "\",\"size\":" STRING_REP_UINT64 "},"
|
||||
"\"systemRam\":{\"pointer\":\"%" PRIXPTR "\",\"size\":" STRING_REP_UINT64 "},"
|
||||
"\"videoRam\":{\"pointer\":\"%" PRIXPTR "\",\"size\":" STRING_REP_UINT64 "},",
|
||||
core_path,
|
||||
api.version,
|
||||
system->info.library_name,
|
||||
system->info.library_version,
|
||||
system->info.valid_extensions,
|
||||
system->info.need_fullpath ? "true" : "false",
|
||||
system->info.block_extract ? "true" : "false",
|
||||
region.region ? "RETRO_REGION_PAL" : "RETRO_REGION_NTSC",
|
||||
pixel_format,
|
||||
system->rotation,
|
||||
system->performance_level,
|
||||
content_does_not_need_content() ? "true" : "false",
|
||||
#ifdef HAVE_CHEEVOS
|
||||
cheevos_get_support_cheevos() ? "true" : "false",
|
||||
cheevos_get_support_cheevos() ? "true" : "false",
|
||||
#endif
|
||||
(uintptr_t)sram.data, sram.size,
|
||||
(uintptr_t)rtc.data, rtc.size,
|
||||
(uintptr_t)sysram.data, sysram.size,
|
||||
(uintptr_t)vram.data, vram.size
|
||||
);
|
||||
(uintptr_t)sram.data, sram.size,
|
||||
(uintptr_t)rtc.data, rtc.size,
|
||||
(uintptr_t)sysram.data, sysram.size,
|
||||
(uintptr_t)vram.data, vram.size
|
||||
);
|
||||
|
||||
mg_printf(conn, "\"subSystems\":[");
|
||||
subsys = system->subsystem.data;
|
||||
mg_printf(conn, "\"subSystems\":[");
|
||||
subsys = system->subsystem.data;
|
||||
|
||||
for (p = 0; p < system->subsystem.size; p++, subsys++)
|
||||
{
|
||||
mg_printf(conn, "%s{\"id\":%u,\"description\":\"%s\",\"identifier\":\"%s\",\"roms\":[", p == 0 ? "" : ",", subsys->id, subsys->desc, subsys->ident);
|
||||
rom = subsys->roms;
|
||||
for (p = 0; p < system->subsystem.size; p++, subsys++)
|
||||
{
|
||||
mg_printf(conn, "%s{\"id\":%u,\"description\":\"%s\",\"identifier\":\"%s\",\"roms\":[", p == 0 ? "" : ",", subsys->id, subsys->desc, subsys->ident);
|
||||
rom = subsys->roms;
|
||||
|
||||
for (q = 0; q < subsys->num_roms; q++, rom++)
|
||||
{
|
||||
mg_printf(conn,
|
||||
"%s{"
|
||||
"\"description\":\"%s\","
|
||||
"\"extensions\":\"%s\","
|
||||
"\"needsFullpath\":%s,"
|
||||
"\"blockExtract\":%s,"
|
||||
"\"required\":%s,"
|
||||
"\"memory\":[",
|
||||
q == 0 ? "" : ",",
|
||||
rom->desc,
|
||||
rom->valid_extensions,
|
||||
rom->need_fullpath ? "true" : "false",
|
||||
rom->block_extract ? "true" : "false",
|
||||
rom->required ? "true" : "false"
|
||||
);
|
||||
for (q = 0; q < subsys->num_roms; q++, rom++)
|
||||
{
|
||||
mg_printf(conn,
|
||||
"%s{"
|
||||
"\"description\":\"%s\","
|
||||
"\"extensions\":\"%s\","
|
||||
"\"needsFullpath\":%s,"
|
||||
"\"blockExtract\":%s,"
|
||||
"\"required\":%s,"
|
||||
"\"memory\":[",
|
||||
q == 0 ? "" : ",",
|
||||
rom->desc,
|
||||
rom->valid_extensions,
|
||||
rom->need_fullpath ? "true" : "false",
|
||||
rom->block_extract ? "true" : "false",
|
||||
rom->required ? "true" : "false"
|
||||
);
|
||||
|
||||
mem = rom->memory;
|
||||
comma = "";
|
||||
|
||||
for (r = 0; r < rom->num_memory; r++, mem++)
|
||||
{
|
||||
mg_printf(conn, "%s{\"extension\":\"%s\",\"type\":%u}", comma, mem->extension, mem->type);
|
||||
comma = ",";
|
||||
}
|
||||
|
||||
mg_printf(conn, "]}");
|
||||
}
|
||||
|
||||
mg_printf(conn, "]}");
|
||||
}
|
||||
|
||||
av_info = video_viewport_get_system_av_info();
|
||||
|
||||
mg_printf(conn,
|
||||
"],\"avInfo\":{"
|
||||
"\"geometry\":{"
|
||||
"\"baseWidth\":%u,"
|
||||
"\"baseHeight\":%u,"
|
||||
"\"maxWidth\":%u,"
|
||||
"\"maxHeight\":%u,"
|
||||
"\"aspectRatio\":%f"
|
||||
"},"
|
||||
"\"timing\":{"
|
||||
"\"fps\":%f,"
|
||||
"\"sampleRate\":%f"
|
||||
"}"
|
||||
"},",
|
||||
av_info->geometry.base_width,
|
||||
av_info->geometry.base_height,
|
||||
av_info->geometry.max_width,
|
||||
av_info->geometry.max_height,
|
||||
av_info->geometry.aspect_ratio,
|
||||
av_info->timing.fps,
|
||||
av_info->timing.sample_rate
|
||||
);
|
||||
|
||||
mg_printf(conn, "\"ports\":[");
|
||||
comma = "";
|
||||
|
||||
for (p = 0; p < system->ports.size; p++)
|
||||
{
|
||||
ctrl = system->ports.data[p].types;
|
||||
|
||||
for (q = 0; q < system->ports.data[p].num_types; q++, ctrl++)
|
||||
{
|
||||
mg_printf(conn, "%s{\"id\":%u,\"description\":\"%s\"}", comma, ctrl->id, ctrl->desc);
|
||||
comma = ",";
|
||||
}
|
||||
}
|
||||
|
||||
mg_printf(conn, "],\"inputDescriptors\":[");
|
||||
comma = "";
|
||||
|
||||
if (core_has_set_input_descriptor())
|
||||
{
|
||||
for (p = 0; p < settings->input.max_users; p++)
|
||||
{
|
||||
for (q = 0; q < RARCH_FIRST_CUSTOM_BIND; q++)
|
||||
{
|
||||
const char* description = system->input_desc_btn[p][q];
|
||||
|
||||
if (description)
|
||||
{
|
||||
mg_printf(conn,
|
||||
"%s{\"player\":%u,\"button\":\"%s\",\"description\":\"%s\"}",
|
||||
comma,
|
||||
p + 1,
|
||||
libretro_btn_desc[q],
|
||||
description
|
||||
);
|
||||
|
||||
comma = ",";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mg_printf(conn, "],\"coreOptions\":[");
|
||||
runloop_ctl(RUNLOOP_CTL_CORE_OPTIONS_LIST_GET, (void*)&core_opts);
|
||||
opts = core_opts->opts;
|
||||
|
||||
for (p = 0; p < core_opts->size; p++, opts++)
|
||||
{
|
||||
mg_printf(conn, "%s{\"key\":\"%s\",\"description\":\"%s\",\"values\":[", p == 0 ? "" : ",", opts->key, opts->desc);
|
||||
mem = rom->memory;
|
||||
comma = "";
|
||||
|
||||
for (q = 0; q < opts->vals->size; q++)
|
||||
for (r = 0; r < rom->num_memory; r++, mem++)
|
||||
{
|
||||
mg_printf(conn, "%s\"%s\"", comma, opts->vals->elems[q].data);
|
||||
comma = ",";
|
||||
mg_printf(conn, "%s{\"extension\":\"%s\",\"type\":%u}", comma, mem->extension, mem->type);
|
||||
comma = ",";
|
||||
}
|
||||
|
||||
mg_printf(conn, "]}");
|
||||
}
|
||||
}
|
||||
|
||||
mg_printf(conn, "]}");
|
||||
return 1;
|
||||
mg_printf(conn, "]}");
|
||||
}
|
||||
|
||||
av_info = video_viewport_get_system_av_info();
|
||||
|
||||
mg_printf(conn,
|
||||
"],\"avInfo\":{"
|
||||
"\"geometry\":{"
|
||||
"\"baseWidth\":%u,"
|
||||
"\"baseHeight\":%u,"
|
||||
"\"maxWidth\":%u,"
|
||||
"\"maxHeight\":%u,"
|
||||
"\"aspectRatio\":%f"
|
||||
"},"
|
||||
"\"timing\":{"
|
||||
"\"fps\":%f,"
|
||||
"\"sampleRate\":%f"
|
||||
"}"
|
||||
"},",
|
||||
av_info->geometry.base_width,
|
||||
av_info->geometry.base_height,
|
||||
av_info->geometry.max_width,
|
||||
av_info->geometry.max_height,
|
||||
av_info->geometry.aspect_ratio,
|
||||
av_info->timing.fps,
|
||||
av_info->timing.sample_rate
|
||||
);
|
||||
|
||||
mg_printf(conn, "\"ports\":[");
|
||||
comma = "";
|
||||
|
||||
for (p = 0; p < system->ports.size; p++)
|
||||
{
|
||||
ctrl = system->ports.data[p].types;
|
||||
|
||||
for (q = 0; q < system->ports.data[p].num_types; q++, ctrl++)
|
||||
{
|
||||
mg_printf(conn, "%s{\"id\":%u,\"description\":\"%s\"}", comma, ctrl->id, ctrl->desc);
|
||||
comma = ",";
|
||||
}
|
||||
}
|
||||
|
||||
mg_printf(conn, "],\"inputDescriptors\":[");
|
||||
comma = "";
|
||||
|
||||
if (core_has_set_input_descriptor())
|
||||
{
|
||||
for (p = 0; p < settings->input.max_users; p++)
|
||||
{
|
||||
for (q = 0; q < RARCH_FIRST_CUSTOM_BIND; q++)
|
||||
{
|
||||
const char* description = system->input_desc_btn[p][q];
|
||||
|
||||
if (description)
|
||||
{
|
||||
mg_printf(conn,
|
||||
"%s{\"player\":%u,\"button\":\"%s\",\"description\":\"%s\"}",
|
||||
comma,
|
||||
p + 1,
|
||||
libretro_btn_desc[q],
|
||||
description
|
||||
);
|
||||
|
||||
comma = ",";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mg_printf(conn, "],\"coreOptions\":[");
|
||||
runloop_ctl(RUNLOOP_CTL_CORE_OPTIONS_LIST_GET, (void*)&core_opts);
|
||||
opts = core_opts->opts;
|
||||
|
||||
for (p = 0; p < core_opts->size; p++, opts++)
|
||||
{
|
||||
mg_printf(conn, "%s{\"key\":\"%s\",\"description\":\"%s\",\"values\":[", p == 0 ? "" : ",", opts->key, opts->desc);
|
||||
comma = "";
|
||||
|
||||
for (q = 0; q < opts->vals->size; q++)
|
||||
{
|
||||
mg_printf(conn, "%s\"%s\"", comma, opts->vals->elems[q].data);
|
||||
comma = ",";
|
||||
}
|
||||
|
||||
mg_printf(conn, "]}");
|
||||
}
|
||||
|
||||
mg_printf(conn, "]}");
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*============================================================
|
||||
@ -394,21 +392,25 @@ MMAPS
|
||||
|
||||
static int httpserver_handle_get_mmaps(struct mg_connection* conn, void* cbdata)
|
||||
{
|
||||
const struct mg_request_info* req = mg_get_request_info(conn);
|
||||
const char* comma = "";
|
||||
rarch_system_info_t* system;
|
||||
const struct retro_memory_map* mmaps;
|
||||
const struct retro_memory_descriptor* mmap;
|
||||
unsigned id;
|
||||
const char* comma = "";
|
||||
const struct retro_memory_map* mmaps = NULL;
|
||||
const struct retro_memory_descriptor* mmap = NULL;
|
||||
const struct mg_request_info* req = mg_get_request_info(conn);
|
||||
rarch_system_info_t *system = core_system_info_get();
|
||||
|
||||
if (strcmp(req->request_method, "GET"))
|
||||
{
|
||||
return httpserver_error(conn, 405, "Unimplemented method in %s: %s", __FUNCTION__, req->request_method);
|
||||
}
|
||||
|
||||
if (!system)
|
||||
if (!runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system))
|
||||
{
|
||||
return httpserver_error(conn, 500, "Could not get system information in %s", __FUNCTION__);
|
||||
}
|
||||
|
||||
mmaps = &system->mmaps;
|
||||
mmap = mmaps->descriptors;
|
||||
mmap = mmaps->descriptors;
|
||||
|
||||
mg_printf(conn, "HTTP/1.1 200 OK\r\nContent-Type: application/json\r\n\r\n");
|
||||
mg_printf(conn, "[");
|
||||
@ -448,33 +450,42 @@ static int httpserver_handle_get_mmaps(struct mg_connection* conn, void* cbdata)
|
||||
|
||||
static int httpserver_handle_get_mmap(struct mg_connection* conn, void* cbdata)
|
||||
{
|
||||
const struct mg_request_info* req = mg_get_request_info(conn);
|
||||
const char* comma = "";
|
||||
rarch_system_info_t* system;
|
||||
const struct retro_memory_map* mmaps;
|
||||
const struct retro_memory_descriptor* mmap;
|
||||
size_t start, length;
|
||||
const char* param;
|
||||
unsigned id;
|
||||
uLong buflen;
|
||||
const char* comma = "";
|
||||
const char* param = NULL;
|
||||
Bytef* buffer = NULL;
|
||||
const struct retro_memory_map* mmaps = NULL;
|
||||
const struct retro_memory_descriptor* mmap = NULL;
|
||||
const struct mg_request_info* req = mg_get_request_info(conn);
|
||||
rarch_system_info_t *system = core_system_info_get();
|
||||
Bytef* buffer;
|
||||
|
||||
if (strcmp(req->request_method, "GET"))
|
||||
{
|
||||
return httpserver_error(conn, 405, "Unimplemented method in %s: %s", __FUNCTION__, req->request_method);
|
||||
}
|
||||
|
||||
if (sscanf(req->request_uri, "/" MEMORY_MAP "/%u", &id) != 1)
|
||||
{
|
||||
return httpserver_error(conn, 500, "Malformed request in %s: %s", __FUNCTION__, req->request_uri);
|
||||
}
|
||||
|
||||
if (!system)
|
||||
if (!runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system))
|
||||
{
|
||||
return httpserver_error(conn, 500, "Could not get system information in %s", __FUNCTION__);
|
||||
}
|
||||
|
||||
mmaps = &system->mmaps;
|
||||
|
||||
if (id >= mmaps->num_descriptors)
|
||||
{
|
||||
return httpserver_error(conn, 404, "Invalid memory map id in %s: %u", __FUNCTION__, id);
|
||||
}
|
||||
|
||||
mmap = mmaps->descriptors + id;
|
||||
start = 0;
|
||||
mmap = mmaps->descriptors + id;
|
||||
|
||||
start = 0;
|
||||
length = mmap->len;
|
||||
|
||||
if (req->query_string != NULL)
|
||||
@ -482,25 +493,35 @@ static int httpserver_handle_get_mmap(struct mg_connection* conn, void* cbdata)
|
||||
param = strstr(req->query_string, "start=");
|
||||
|
||||
if (param != NULL)
|
||||
{
|
||||
start = atoll(param + 6);
|
||||
}
|
||||
|
||||
param = strstr(req->query_string, "length=");
|
||||
|
||||
if (param != NULL)
|
||||
{
|
||||
length = atoll(param + 7);
|
||||
}
|
||||
}
|
||||
|
||||
if (start >= mmap->len)
|
||||
{
|
||||
start = mmap->len - 1;
|
||||
}
|
||||
|
||||
if (length > mmap->len - start)
|
||||
{
|
||||
length = mmap->len - start;
|
||||
}
|
||||
|
||||
buflen = compressBound(length);
|
||||
buffer = (Bytef*)malloc(((buflen + 3) / 4) * 5);
|
||||
|
||||
if (buffer == NULL)
|
||||
{
|
||||
return httpserver_error(conn, 500, "Out of memory in %s", __FUNCTION__);
|
||||
}
|
||||
|
||||
if (compress2(buffer, &buflen, (Bytef*)mmap->ptr + start, length, Z_BEST_COMPRESSION) != Z_OK)
|
||||
{
|
||||
@ -535,13 +556,17 @@ static int httpserver_handle_get_mmap(struct mg_connection* conn, void* cbdata)
|
||||
|
||||
static int httpserver_handle_mmaps(struct mg_connection* conn, void* cbdata)
|
||||
{
|
||||
unsigned id;
|
||||
const struct mg_request_info* req = mg_get_request_info(conn);
|
||||
unsigned id;
|
||||
|
||||
if (sscanf(req->request_uri, "/" MEMORY_MAP "/%u", &id) == 1)
|
||||
{
|
||||
return httpserver_handle_get_mmap(conn, cbdata);
|
||||
|
||||
return httpserver_handle_get_mmaps(conn, cbdata);
|
||||
}
|
||||
else
|
||||
{
|
||||
return httpserver_handle_get_mmaps(conn, cbdata);
|
||||
}
|
||||
}
|
||||
|
||||
/*============================================================
|
||||
@ -550,32 +575,33 @@ HTTP SERVER
|
||||
|
||||
int httpserver_init(unsigned port)
|
||||
{
|
||||
char str[16];
|
||||
char str[16];
|
||||
snprintf(str, sizeof(str), "%u", port);
|
||||
str[sizeof(str) - 1] = 0;
|
||||
|
||||
snprintf(str, sizeof(str), "%u", port);
|
||||
str[sizeof(str) - 1] = 0;
|
||||
const char* options[] =
|
||||
{
|
||||
"listening_ports", str,
|
||||
NULL, NULL
|
||||
};
|
||||
|
||||
const char* options[] =
|
||||
{
|
||||
"listening_ports", str,
|
||||
NULL, NULL
|
||||
};
|
||||
memset(&s_httpserver_callbacks, 0, sizeof(s_httpserver_callbacks));
|
||||
s_httpserver_ctx = mg_start(&s_httpserver_callbacks, NULL, options);
|
||||
|
||||
memset(&s_httpserver_callbacks, 0, sizeof(s_httpserver_callbacks));
|
||||
s_httpserver_ctx = mg_start(&s_httpserver_callbacks, NULL, options);
|
||||
if (s_httpserver_ctx == NULL)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (s_httpserver_ctx == NULL)
|
||||
return -1;
|
||||
mg_set_request_handler(s_httpserver_ctx, "/" BASIC_INFO, httpserver_handle_basic_info, NULL);
|
||||
|
||||
mg_set_request_handler(s_httpserver_ctx, "/" BASIC_INFO, httpserver_handle_basic_info, NULL);
|
||||
mg_set_request_handler(s_httpserver_ctx, "/" MEMORY_MAP, httpserver_handle_mmaps, NULL);
|
||||
mg_set_request_handler(s_httpserver_ctx, "/" MEMORY_MAP "/", httpserver_handle_mmaps, NULL);
|
||||
|
||||
mg_set_request_handler(s_httpserver_ctx, "/" MEMORY_MAP, httpserver_handle_mmaps, NULL);
|
||||
mg_set_request_handler(s_httpserver_ctx, "/" MEMORY_MAP "/", httpserver_handle_mmaps, NULL);
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void httpserver_destroy(void)
|
||||
void httpserver_destroy()
|
||||
{
|
||||
mg_stop(s_httpserver_ctx);
|
||||
mg_stop(s_httpserver_ctx);
|
||||
}
|
||||
|
@ -206,8 +206,10 @@ bool driver_location_get_position(double *lat, double *lon,
|
||||
|
||||
void init_location(void)
|
||||
{
|
||||
rarch_system_info_t *system = core_system_info_get();
|
||||
rarch_system_info_t *system = NULL;
|
||||
|
||||
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system);
|
||||
|
||||
/* Resource leaks will follow if location interface is initialized twice. */
|
||||
if (location_data)
|
||||
return;
|
||||
@ -228,7 +230,9 @@ void init_location(void)
|
||||
|
||||
static void uninit_location(void)
|
||||
{
|
||||
rarch_system_info_t *system = core_system_info_get();
|
||||
rarch_system_info_t *system = NULL;
|
||||
|
||||
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system);
|
||||
|
||||
if (location_data && location_driver)
|
||||
{
|
||||
|
@ -443,10 +443,10 @@ static int general_push(menu_displaylist_info_t *info,
|
||||
unsigned id, enum menu_displaylist_ctl_state state)
|
||||
{
|
||||
struct retro_system_info *system_menu = NULL;
|
||||
settings_t *settings = config_get_ptr();
|
||||
rarch_system_info_t *system = NULL;
|
||||
core_info_list_t *list = NULL;
|
||||
menu_handle_t *menu = NULL;
|
||||
settings_t *settings = config_get_ptr();
|
||||
rarch_system_info_t *system = core_system_info_get();
|
||||
|
||||
if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu))
|
||||
return menu_cbs_exit();
|
||||
@ -454,6 +454,7 @@ static int general_push(menu_displaylist_info_t *info,
|
||||
core_info_get_list(&list);
|
||||
|
||||
menu_driver_ctl(RARCH_MENU_CTL_SYSTEM_INFO_GET, &system_menu);
|
||||
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system);
|
||||
|
||||
switch (id)
|
||||
{
|
||||
|
@ -933,9 +933,10 @@ static void menu_action_setting_disp_set_label_menu_disk_index(
|
||||
char *s2, size_t len2)
|
||||
{
|
||||
unsigned images = 0, current = 0;
|
||||
rarch_system_info_t *system = NULL;
|
||||
struct retro_disk_control_callback *control = NULL;
|
||||
rarch_system_info_t *system = core_system_info_get();
|
||||
|
||||
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system);
|
||||
if (!system)
|
||||
return;
|
||||
|
||||
@ -1318,9 +1319,10 @@ static void menu_action_setting_disp_set_label_core_option_create(
|
||||
const char *path,
|
||||
char *s2, size_t len2)
|
||||
{
|
||||
rarch_system_info_t *system = NULL;
|
||||
global_t *global = global_get_ptr();
|
||||
rarch_system_info_t *system = core_system_info_get();
|
||||
|
||||
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system);
|
||||
if (!system)
|
||||
return;
|
||||
|
||||
|
@ -1540,9 +1540,11 @@ static int generic_action_ok_shader_preset_save(const char *path,
|
||||
char directory[PATH_MAX_LENGTH] = {0};
|
||||
char file[PATH_MAX_LENGTH] = {0};
|
||||
char tmp[PATH_MAX_LENGTH] = {0};
|
||||
const char *core_name = NULL;
|
||||
settings_t *settings = config_get_ptr();
|
||||
rarch_system_info_t *info = core_system_info_get();
|
||||
rarch_system_info_t *info = NULL;
|
||||
const char *core_name = NULL;
|
||||
|
||||
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &info);
|
||||
|
||||
if (info)
|
||||
core_name = info->info.library_name;
|
||||
@ -1658,9 +1660,11 @@ static int generic_action_ok_remap_file_save(const char *path,
|
||||
{
|
||||
char directory[PATH_MAX_LENGTH] = {0};
|
||||
char file[PATH_MAX_LENGTH] = {0};
|
||||
const char *core_name = NULL;
|
||||
settings_t *settings = config_get_ptr();
|
||||
rarch_system_info_t *info = core_system_info_get();
|
||||
rarch_system_info_t *info = NULL;
|
||||
const char *core_name = NULL;
|
||||
|
||||
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &info);
|
||||
|
||||
if (info)
|
||||
core_name = info->info.library_name;
|
||||
|
@ -704,21 +704,30 @@ static size_t mui_list_get_size(void *data, enum menu_list_type type)
|
||||
|
||||
static int mui_get_core_title(char *s, size_t len)
|
||||
{
|
||||
struct retro_system_info*system= NULL;
|
||||
struct retro_system_info *system = NULL;
|
||||
rarch_system_info_t *info = NULL;
|
||||
settings_t *settings = config_get_ptr();
|
||||
rarch_system_info_t *info = core_system_info_get();
|
||||
const char *core_name = system->library_name;
|
||||
const char *core_version = system->library_version;
|
||||
const char *core_name = NULL;
|
||||
const char *core_version = NULL;
|
||||
|
||||
menu_driver_ctl(RARCH_MENU_CTL_SYSTEM_INFO_GET,
|
||||
&system);
|
||||
|
||||
core_name = system->library_name;
|
||||
core_version = system->library_version;
|
||||
|
||||
if (!settings->menu.core_enable)
|
||||
return -1;
|
||||
|
||||
if (info)
|
||||
if (runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &info))
|
||||
{
|
||||
if (string_is_empty(core_name))
|
||||
core_name = info->info.library_name;
|
||||
if (!core_version)
|
||||
core_version = info->info.library_version;
|
||||
if (info)
|
||||
{
|
||||
if (string_is_empty(core_name))
|
||||
core_name = info->info.library_name;
|
||||
if (!core_version)
|
||||
core_version = info->info.library_version;
|
||||
}
|
||||
}
|
||||
|
||||
if (string_is_empty(core_name))
|
||||
|
@ -2531,7 +2531,9 @@ static int menu_displaylist_parse_load_content_settings(
|
||||
|
||||
if (!rarch_ctl(RARCH_CTL_IS_DUMMY_CORE, NULL))
|
||||
{
|
||||
rarch_system_info_t *system = core_system_info_get();
|
||||
rarch_system_info_t *system = NULL;
|
||||
|
||||
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system);
|
||||
|
||||
menu_entries_append_enum(info->list,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_RESUME_CONTENT),
|
||||
@ -2947,9 +2949,9 @@ static int menu_displaylist_parse_options_remappings(
|
||||
menu_displaylist_info_t *info)
|
||||
{
|
||||
unsigned p, retro_id;
|
||||
rarch_system_info_t *system = NULL;
|
||||
menu_handle_t *menu = NULL;
|
||||
settings_t *settings = config_get_ptr();
|
||||
rarch_system_info_t *system = core_system_info_get();
|
||||
|
||||
if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu))
|
||||
return -1;
|
||||
@ -2986,34 +2988,36 @@ static int menu_displaylist_parse_options_remappings(
|
||||
MENU_ENUM_LABEL_REMAP_FILE_SAVE_GAME,
|
||||
MENU_SETTING_ACTION, 0, 0);
|
||||
|
||||
if (!system)
|
||||
return 0;
|
||||
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system);
|
||||
|
||||
for (p = 0; p < settings->input.max_users; p++)
|
||||
if (system)
|
||||
{
|
||||
for (retro_id = 0; retro_id < RARCH_FIRST_CUSTOM_BIND + 4; retro_id++)
|
||||
for (p = 0; p < settings->input.max_users; p++)
|
||||
{
|
||||
char desc_label[64] = {0};
|
||||
unsigned user = p + 1;
|
||||
unsigned desc_offset = retro_id;
|
||||
const char *description = NULL;
|
||||
for (retro_id = 0; retro_id < RARCH_FIRST_CUSTOM_BIND + 4; retro_id++)
|
||||
{
|
||||
char desc_label[64] = {0};
|
||||
unsigned user = p + 1;
|
||||
unsigned desc_offset = retro_id;
|
||||
const char *description = NULL;
|
||||
|
||||
if (desc_offset >= RARCH_FIRST_CUSTOM_BIND)
|
||||
desc_offset = RARCH_FIRST_CUSTOM_BIND
|
||||
+ (desc_offset - RARCH_FIRST_CUSTOM_BIND) * 2;
|
||||
if (desc_offset >= RARCH_FIRST_CUSTOM_BIND)
|
||||
desc_offset = RARCH_FIRST_CUSTOM_BIND
|
||||
+ (desc_offset - RARCH_FIRST_CUSTOM_BIND) * 2;
|
||||
|
||||
description = system->input_desc_btn[p][desc_offset];
|
||||
|
||||
description = system->input_desc_btn[p][desc_offset];
|
||||
if (!description)
|
||||
continue;
|
||||
|
||||
if (!description)
|
||||
continue;
|
||||
|
||||
snprintf(desc_label, sizeof(desc_label),
|
||||
"%s %u %s : ", msg_hash_to_str(MENU_ENUM_LABEL_VALUE_USER),
|
||||
user, description);
|
||||
menu_entries_append_enum(info->list, desc_label, "",
|
||||
MSG_UNKNOWN,
|
||||
MENU_SETTINGS_INPUT_DESC_BEGIN +
|
||||
(p * (RARCH_FIRST_CUSTOM_BIND + 4)) + retro_id, 0, 0);
|
||||
snprintf(desc_label, sizeof(desc_label),
|
||||
"%s %u %s : ", msg_hash_to_str(MENU_ENUM_LABEL_VALUE_USER),
|
||||
user, description);
|
||||
menu_entries_append_enum(info->list, desc_label, "",
|
||||
MSG_UNKNOWN,
|
||||
MENU_SETTINGS_INPUT_DESC_BEGIN +
|
||||
(p * (RARCH_FIRST_CUSTOM_BIND + 4)) + retro_id, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -4191,7 +4195,8 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data)
|
||||
return true;
|
||||
case DISPLAYLIST_MAIN_MENU:
|
||||
{
|
||||
rarch_system_info_t *system = core_system_info_get();
|
||||
rarch_system_info_t *system = NULL;
|
||||
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system);
|
||||
|
||||
if (!rarch_ctl(RARCH_CTL_IS_DUMMY_CORE, NULL))
|
||||
menu_displaylist_parse_settings_enum(menu, info,
|
||||
|
@ -440,18 +440,19 @@ int menu_entries_get_title(char *s, size_t len)
|
||||
* (shown at the top of the UI). */
|
||||
int menu_entries_get_core_title(char *s, size_t len)
|
||||
{
|
||||
struct retro_system_info*system= NULL;
|
||||
struct retro_system_info *system = NULL;
|
||||
rarch_system_info_t *info = NULL;
|
||||
settings_t *settings = config_get_ptr();
|
||||
const char *core_name = NULL;
|
||||
const char *core_version = NULL;
|
||||
settings_t *settings = config_get_ptr();
|
||||
rarch_system_info_t *info = core_system_info_get();
|
||||
|
||||
if (menu_driver_ctl(RARCH_MENU_CTL_SYSTEM_INFO_GET, &system)
|
||||
&& system)
|
||||
{
|
||||
core_name = system->library_name;
|
||||
core_version = system->library_version;
|
||||
}
|
||||
menu_driver_ctl(RARCH_MENU_CTL_SYSTEM_INFO_GET,
|
||||
&system);
|
||||
|
||||
core_name = system->library_name;
|
||||
core_version = system->library_version;
|
||||
|
||||
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &info);
|
||||
|
||||
if (!settings->menu.core_enable)
|
||||
return -1;
|
||||
|
@ -340,16 +340,17 @@ static void setting_get_string_representation_uint_libretro_device(void *data,
|
||||
unsigned index_offset;
|
||||
const struct retro_controller_description *desc = NULL;
|
||||
const char *name = NULL;
|
||||
rarch_system_info_t *system = NULL;
|
||||
rarch_setting_t *setting = (rarch_setting_t*)data;
|
||||
settings_t *settings = config_get_ptr();
|
||||
rarch_system_info_t *system = core_system_info_get();
|
||||
|
||||
if (!setting)
|
||||
return;
|
||||
|
||||
index_offset = setting_get_index_offset(setting);
|
||||
|
||||
if (system)
|
||||
if (runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system)
|
||||
&& system)
|
||||
{
|
||||
if (index_offset < system->ports.size)
|
||||
desc = libretro_find_controller_description(
|
||||
@ -957,9 +958,9 @@ static int setting_action_start_libretro_device_type(void *data)
|
||||
unsigned index_offset, current_device;
|
||||
unsigned devices[128], types = 0, port = 0;
|
||||
const struct retro_controller_info *desc = NULL;
|
||||
rarch_system_info_t *system = NULL;
|
||||
settings_t *settings = config_get_ptr();
|
||||
rarch_setting_t *setting = (rarch_setting_t*)data;
|
||||
rarch_system_info_t *system = core_system_info_get();
|
||||
|
||||
if (setting_generic_action_start_default(setting) != 0)
|
||||
return -1;
|
||||
@ -970,7 +971,8 @@ static int setting_action_start_libretro_device_type(void *data)
|
||||
devices[types++] = RETRO_DEVICE_NONE;
|
||||
devices[types++] = RETRO_DEVICE_JOYPAD;
|
||||
|
||||
if (system)
|
||||
if (runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system)
|
||||
&& system)
|
||||
{
|
||||
/* Only push RETRO_DEVICE_ANALOG as default if we use an
|
||||
* older core which doesn't use SET_CONTROLLER_INFO. */
|
||||
@ -1062,7 +1064,7 @@ static int setting_action_left_libretro_device_type(
|
||||
const struct retro_controller_info *desc = NULL;
|
||||
rarch_setting_t *setting = (rarch_setting_t*)data;
|
||||
settings_t *settings = config_get_ptr();
|
||||
rarch_system_info_t *system = core_system_info_get();
|
||||
rarch_system_info_t *system = NULL;
|
||||
|
||||
if (!setting)
|
||||
return -1;
|
||||
@ -1072,6 +1074,8 @@ static int setting_action_left_libretro_device_type(
|
||||
devices[types++] = RETRO_DEVICE_NONE;
|
||||
devices[types++] = RETRO_DEVICE_JOYPAD;
|
||||
|
||||
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system);
|
||||
|
||||
if (system)
|
||||
{
|
||||
/* Only push RETRO_DEVICE_ANALOG as default if we use an
|
||||
@ -1128,7 +1132,7 @@ static int setting_action_right_libretro_device_type(
|
||||
const struct retro_controller_info *desc = NULL;
|
||||
rarch_setting_t *setting = (rarch_setting_t*)data;
|
||||
settings_t *settings = config_get_ptr();
|
||||
rarch_system_info_t *system = core_system_info_get();
|
||||
rarch_system_info_t *system = NULL;
|
||||
|
||||
if (!setting)
|
||||
return -1;
|
||||
@ -1138,7 +1142,8 @@ static int setting_action_right_libretro_device_type(
|
||||
devices[types++] = RETRO_DEVICE_NONE;
|
||||
devices[types++] = RETRO_DEVICE_JOYPAD;
|
||||
|
||||
if (system)
|
||||
if (runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system)
|
||||
&& system)
|
||||
{
|
||||
/* Only push RETRO_DEVICE_ANALOG as default if we use an
|
||||
* older core which doesn't use SET_CONTROLLER_INFO. */
|
||||
@ -1661,8 +1666,8 @@ void general_write_handler(void *data)
|
||||
break;
|
||||
case MENU_ENUM_LABEL_VIDEO_ROTATION:
|
||||
{
|
||||
rarch_system_info_t *system = core_system_info_get();
|
||||
|
||||
rarch_system_info_t *system = NULL;
|
||||
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system);
|
||||
if (system)
|
||||
video_driver_set_rotation(
|
||||
(*setting->value.target.unsigned_integer +
|
||||
@ -1912,14 +1917,17 @@ static bool setting_append_list_input_player_options(
|
||||
static char buffer[MAX_USERS][13+2+1];
|
||||
static char group_lbl[MAX_USERS][PATH_MAX_LENGTH];
|
||||
unsigned i;
|
||||
rarch_setting_group_info_t group_info = {0};
|
||||
rarch_setting_group_info_t subgroup_info = {0};
|
||||
settings_t *settings = config_get_ptr();
|
||||
rarch_setting_group_info_t group_info = {0};
|
||||
rarch_setting_group_info_t subgroup_info = {0};
|
||||
settings_t *settings = config_get_ptr();
|
||||
const char *temp_value = NULL;
|
||||
const struct retro_keybind* const defaults =
|
||||
(user == 0) ? retro_keybinds_1 : retro_keybinds_rest;
|
||||
rarch_system_info_t *system = core_system_info_get();
|
||||
const char *temp_value = msg_hash_to_str((enum msg_hash_enums)
|
||||
(MENU_ENUM_LABEL_INPUT_USER_1_BINDS + user));
|
||||
rarch_system_info_t *system = NULL;
|
||||
|
||||
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system);
|
||||
|
||||
temp_value =msg_hash_to_str((enum msg_hash_enums)(MENU_ENUM_LABEL_INPUT_USER_1_BINDS + user));
|
||||
|
||||
snprintf(buffer[user], sizeof(buffer[user]),
|
||||
"%s %u", msg_hash_to_str(MENU_ENUM_LABEL_VALUE_USER), user + 1);
|
||||
|
@ -170,14 +170,16 @@ uint32_t netplay_impl_magic(void)
|
||||
retro_ctx_api_info_t api_info;
|
||||
unsigned api;
|
||||
uint32_t res = 0;
|
||||
rarch_system_info_t *info = NULL;
|
||||
const char *lib = NULL;
|
||||
const char *ver = PACKAGE_VERSION;
|
||||
rarch_system_info_t *info = core_system_info_get();
|
||||
|
||||
core_api_version(&api_info);
|
||||
|
||||
api = api_info.version;
|
||||
|
||||
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &info);
|
||||
|
||||
if (info)
|
||||
lib = info->info.library_name;
|
||||
|
||||
|
12
retroarch.c
12
retroarch.c
@ -413,7 +413,9 @@ static void retroarch_set_paths_redirect(void)
|
||||
bool check_global_library_name_hash = false;
|
||||
global_t *global = global_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
rarch_system_info_t *info = core_system_info_get();
|
||||
rarch_system_info_t *info = NULL;
|
||||
|
||||
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &info);
|
||||
|
||||
if (!global)
|
||||
return;
|
||||
@ -1086,7 +1088,9 @@ static void retroarch_parse_input(int argc, char *argv[])
|
||||
static void retroarch_init_savefile_paths(void)
|
||||
{
|
||||
global_t *global = global_get_ptr();
|
||||
rarch_system_info_t *system = core_system_info_get();
|
||||
rarch_system_info_t *system = NULL;
|
||||
|
||||
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system);
|
||||
|
||||
command_event(CMD_EVENT_SAVEFILES_DEINIT, NULL);
|
||||
|
||||
@ -1195,8 +1199,10 @@ bool retroarch_validate_game_options(char *s, size_t len, bool mkdir)
|
||||
char config_directory[PATH_MAX_LENGTH] = {0};
|
||||
const char *core_name = NULL;
|
||||
const char *game_name = NULL;
|
||||
rarch_system_info_t *system = NULL;
|
||||
global_t *global = global_get_ptr();
|
||||
rarch_system_info_t *system = core_system_info_get();
|
||||
|
||||
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system);
|
||||
|
||||
if (system)
|
||||
core_name = system->info.library_name;
|
||||
|
48
runloop.c
48
runloop.c
@ -75,6 +75,12 @@
|
||||
|
||||
#include "verbosity.h"
|
||||
|
||||
#ifdef HAVE_ZLIB
|
||||
#define DEFAULT_EXT "zip"
|
||||
#else
|
||||
#define DEFAULT_EXT ""
|
||||
#endif
|
||||
|
||||
#define runloop_cmd_triggered(cmd, id) BIT64_GET(cmd->state[2].state, id)
|
||||
|
||||
#define runloop_cmd_press(cmd, id) BIT64_GET(cmd->state[0].state, id)
|
||||
@ -100,6 +106,7 @@ typedef struct event_cmd_state
|
||||
static struct rarch_dir_list runloop_shader_dir;
|
||||
static char runloop_fullpath[PATH_MAX_LENGTH];
|
||||
static char runloop_default_shader_preset[PATH_MAX_LENGTH];
|
||||
static rarch_system_info_t runloop_system;
|
||||
static unsigned runloop_pending_windowed_scale;
|
||||
static struct retro_frame_time_callback runloop_frame_time;
|
||||
static retro_keyboard_event_t runloop_key_event = NULL;
|
||||
@ -749,7 +756,6 @@ static bool runloop_is_frame_count_end(void)
|
||||
return runloop_max_frames && (*frame_count >= runloop_max_frames);
|
||||
}
|
||||
|
||||
|
||||
bool runloop_ctl(enum runloop_ctl_state state, void *data)
|
||||
{
|
||||
|
||||
@ -761,8 +767,19 @@ bool runloop_ctl(enum runloop_ctl_state state, void *data)
|
||||
case RUNLOOP_CTL_SHADER_DIR_INIT:
|
||||
return shader_dir_init(&runloop_shader_dir);
|
||||
case RUNLOOP_CTL_SYSTEM_INFO_INIT:
|
||||
core_system_info_init();
|
||||
core_get_system_info(&runloop_system.info);
|
||||
|
||||
if (!runloop_system.info.library_name)
|
||||
runloop_system.info.library_name = msg_hash_to_str(MSG_UNKNOWN);
|
||||
if (!runloop_system.info.library_version)
|
||||
runloop_system.info.library_version = "v0";
|
||||
|
||||
video_driver_set_title_buf();
|
||||
|
||||
strlcpy(runloop_system.valid_extensions,
|
||||
runloop_system.info.valid_extensions ?
|
||||
runloop_system.info.valid_extensions : DEFAULT_EXT,
|
||||
sizeof(runloop_system.valid_extensions));
|
||||
break;
|
||||
case RUNLOOP_CTL_GET_CORE_OPTION_SIZE:
|
||||
{
|
||||
@ -782,12 +799,37 @@ bool runloop_ctl(enum runloop_ctl_state state, void *data)
|
||||
*coreopts = runloop_core_options;
|
||||
}
|
||||
break;
|
||||
case RUNLOOP_CTL_SYSTEM_INFO_GET:
|
||||
{
|
||||
rarch_system_info_t **system = (rarch_system_info_t**)data;
|
||||
if (!system)
|
||||
return false;
|
||||
*system = &runloop_system;
|
||||
}
|
||||
break;
|
||||
case RUNLOOP_CTL_SYSTEM_INFO_FREE:
|
||||
core_system_info_free();
|
||||
|
||||
/* No longer valid. */
|
||||
if (runloop_system.subsystem.data)
|
||||
free(runloop_system.subsystem.data);
|
||||
runloop_system.subsystem.data = NULL;
|
||||
runloop_system.subsystem.size = 0;
|
||||
|
||||
if (runloop_system.ports.data)
|
||||
free(runloop_system.ports.data);
|
||||
runloop_system.ports.data = NULL;
|
||||
runloop_system.ports.size = 0;
|
||||
|
||||
if (runloop_system.mmaps.descriptors)
|
||||
free((void *)runloop_system.mmaps.descriptors);
|
||||
runloop_system.mmaps.descriptors = NULL;
|
||||
runloop_system.mmaps.num_descriptors = 0;
|
||||
|
||||
runloop_key_event = NULL;
|
||||
runloop_frontend_key_event = NULL;
|
||||
|
||||
audio_driver_unset_callback();
|
||||
memset(&runloop_system, 0, sizeof(rarch_system_info_t));
|
||||
break;
|
||||
case RUNLOOP_CTL_SET_FRAME_TIME_LAST:
|
||||
runloop_frame_time_last_enable = true;
|
||||
|
@ -127,6 +127,7 @@ enum runloop_ctl_state
|
||||
RUNLOOP_CTL_SHADER_DIR_INIT,
|
||||
|
||||
/* System info */
|
||||
RUNLOOP_CTL_SYSTEM_INFO_GET,
|
||||
RUNLOOP_CTL_SYSTEM_INFO_INIT,
|
||||
RUNLOOP_CTL_SYSTEM_INFO_FREE,
|
||||
|
||||
|
@ -1134,8 +1134,10 @@ static bool load_content_from_compressed_archive(
|
||||
char new_basedir[PATH_MAX_LENGTH] = {0};
|
||||
ssize_t new_path_len = 0;
|
||||
bool ret = false;
|
||||
rarch_system_info_t *sys_info= NULL;
|
||||
settings_t *settings = config_get_ptr();
|
||||
rarch_system_info_t *sys_info = core_system_info_get();
|
||||
|
||||
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &sys_info);
|
||||
|
||||
if (sys_info && sys_info->info.block_extract)
|
||||
return true;
|
||||
@ -1455,8 +1457,10 @@ static bool content_file_init(struct string_list *temporary_content)
|
||||
struct string_list* additional_path_allocs = NULL;
|
||||
struct string_list *content = NULL;
|
||||
const struct retro_subsystem_info *special = NULL;
|
||||
rarch_system_info_t *system = NULL;
|
||||
global_t *global = global_get_ptr();
|
||||
rarch_system_info_t *system = core_system_info_get();
|
||||
|
||||
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system);
|
||||
|
||||
if (!string_is_empty(global->subsystem))
|
||||
{
|
||||
@ -1664,8 +1668,9 @@ static bool task_load_content(content_ctx_info_t *content_info,
|
||||
{
|
||||
char tmp[PATH_MAX_LENGTH] = {0};
|
||||
struct retro_system_info *info = NULL;
|
||||
rarch_system_info_t *system = core_system_info_get();
|
||||
rarch_system_info_t *system = NULL;
|
||||
|
||||
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system);
|
||||
if (system)
|
||||
info = &system->info;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user