[subsystem] add a function to get the friendly name

This commit is contained in:
radius 2019-04-11 18:51:27 -05:00
parent 71bfd98012
commit d08779adf0
2 changed files with 25 additions and 0 deletions

View File

@ -112,6 +112,9 @@ char* content_get_subsystem_rom(unsigned index);
/* Sets the subsystem by name */
bool content_set_subsystem_by_name(const char* subsystem_name);
/* Get the current subsystem "friendly name" */
void content_get_subsystem_friendly_name(const char* subsystem_name, char* subsystem_friendly_name, size_t len);
RETRO_END_DECLS
#endif

View File

@ -1982,6 +1982,28 @@ bool content_set_subsystem_by_name(const char* subsystem_name)
return false;
}
void content_get_subsystem_friendly_name(const char* subsystem_name, char* subsystem_friendly_name, size_t len)
{
rarch_system_info_t *system = runloop_get_system_info();
const struct retro_subsystem_info *subsystem;
unsigned i = 0;
/* Core fully loaded, use the subsystem data */
if (system->subsystem.data)
subsystem = system->subsystem.data;
/* Core not loaded completely, use the data we peeked on load core */
else
subsystem = subsystem_data;
for (i = 0; i < subsystem_current_count; i++, subsystem++)
{
if (string_is_equal(subsystem_name, subsystem->ident))
strlcpy(subsystem_friendly_name, subsystem->desc, len);
}
return;
}
/* Add a rom to the subsystem rom buffer */
void content_add_subsystem(const char* path)
{