Skip to content

Commit

Permalink
Merge pull request #10073 from eadmaster/patch-1
Browse files Browse the repository at this point in the history
added GET_STATUS network command
  • Loading branch information
inactive123 authored Jan 28, 2020
2 parents 764990b + 491c045 commit 255790b
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions retroarch.c
Original file line number Diff line number Diff line change
Expand Up @@ -3745,6 +3745,37 @@ static bool command_version(const char* arg)
return true;
}

static bool command_get_status(const char* arg)
{
char reply[4096] = {0};

bool contentless = false;
bool is_inited = false;
content_get_status(&contentless, &is_inited);

if(!is_inited) {
snprintf(reply, sizeof(reply), "GET_STATUS CONTENTLESS");
} else {
/* add some content info */
/* char* content_name = load_content_info->content->elems[0].data; */ /* full path */
const char* status = "RUNNING";
if( runloop_paused ) status = "PAUSED";
const char* content_name = path_basename(path_get(RARCH_PATH_BASENAME)); /* filename only without ext */
int content_crc32 = content_get_crc();
const char* system_id = NULL;
core_info_t *core_info = NULL;
core_info_get_current_core(&core_info);
if (core_info) system_id = core_info->system_id;
if (!system_id) system_id = runloop_system.info.library_name;

snprintf(reply, sizeof(reply), "GET_STATUS %s %s,%s,crc32=%x\n", status, system_id, content_name, content_crc32);
}

command_reply(reply, strlen(reply));

return true;
}

#if defined(HAVE_CHEEVOS)
static bool command_read_ram(const char *arg);
static bool command_write_ram(const char *arg);
Expand All @@ -3753,6 +3784,7 @@ static bool command_write_ram(const char *arg);
static const struct cmd_action_map action_map[] = {
{ "SET_SHADER", command_set_shader, "<shader path>" },
{ "VERSION", command_version, "No argument"},
{ "GET_STATUS", command_get_status, "No argument" },
#if defined(HAVE_CHEEVOS)
{ "READ_CORE_RAM", command_read_ram, "<address> <number of bytes>" },
{ "WRITE_CORE_RAM", command_write_ram, "<address> <byte1> <byte2> ..." },
Expand Down

0 comments on commit 255790b

Please sign in to comment.