Skip to content

Commit

Permalink
added /info rest service to the embedded http server
Browse files Browse the repository at this point in the history
  • Loading branch information
leiradel committed Sep 3, 2016
1 parent ea84c8a commit 073d9aa
Show file tree
Hide file tree
Showing 7 changed files with 411 additions and 47 deletions.
5 changes: 5 additions & 0 deletions cheevos.c
Original file line number Diff line number Diff line change
Expand Up @@ -2365,3 +2365,8 @@ void cheevos_set_support_cheevos(bool state)
{
cheevos_locals.core_supports = state;
}

bool cheevos_get_support_cheevos(void)
{
return cheevos_locals.core_supports;
}
2 changes: 2 additions & 0 deletions cheevos.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ bool cheevos_set_cheats(void);

void cheevos_set_support_cheevos(bool state);

bool cheevos_get_support_cheevos(void);

void cheevos_parse_guest_addr(cheevos_var_t *var, unsigned value);

uint8_t *cheevos_get_memory(const cheevos_var_t *var);
Expand Down
9 changes: 9 additions & 0 deletions core.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ typedef struct retro_ctx_api_info
unsigned version;
} retro_ctx_api_info_t;

typedef struct retro_ctx_region_info
{
unsigned region;
} retro_ctx_region_info_t;

typedef struct retro_ctx_controller_info
{
unsigned port;
Expand Down Expand Up @@ -160,6 +165,8 @@ bool core_api_version(retro_ctx_api_info_t *api);
*/
bool core_verify_api_version(void);

bool core_get_region(retro_ctx_region_info_t *info);

bool core_get_memory(retro_ctx_memory_info_t *info);

/* Initialize system A/V information. */
Expand All @@ -184,6 +191,8 @@ void core_uninit_symbols(void);

void core_set_input_state(retro_ctx_input_state_info_t *info);

bool core_is_game_loaded(void);

RETRO_END_DECLS

#endif
22 changes: 20 additions & 2 deletions core_impl.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
#endif

static struct retro_core_t core;
static bool core_game_loaded;
static unsigned core_poll_type;
static bool core_input_polled;
static bool core_has_set_input_descriptors = false;
Expand Down Expand Up @@ -247,8 +248,11 @@ bool core_load_game(retro_ctx_load_content_info_t *load_info)
return false;

if (load_info->special)
return core.retro_load_game_special(load_info->special->id, load_info->info, load_info->content->size);
return core.retro_load_game(*load_info->content->elems[0].data ? load_info->info : NULL);
core_game_loaded = core.retro_load_game_special(load_info->special->id, load_info->info, load_info->content->size);
else
core_game_loaded = core.retro_load_game(*load_info->content->elems[0].data ? load_info->info : NULL);

return core_game_loaded;
}

bool core_get_system_info(struct retro_system_info *system)
Expand Down Expand Up @@ -343,6 +347,7 @@ bool core_unload_game(void)
video_driver_deinit_hw_context();
audio_driver_stop();
core.retro_unload_game();
core_game_loaded = false;
return true;
}

Expand Down Expand Up @@ -398,6 +403,14 @@ bool core_verify_api_version(void)
return true;
}

bool core_get_region(retro_ctx_region_info_t *info)
{
if (!info)
return false;
info->region = core.retro_get_region();
return true;
}

bool core_has_set_input_descriptor(void)
{
return core_has_set_input_descriptors;
Expand All @@ -412,3 +425,8 @@ void core_unset_input_descriptors(void)
{
core_has_set_input_descriptors = false;
}

bool core_is_game_loaded(void)
{
return core_game_loaded;
}
Loading

0 comments on commit 073d9aa

Please sign in to comment.