Clean up load_no_rom grabbing interface.

This commit is contained in:
Themaister 2013-05-02 15:17:31 +02:00
parent 99990173cc
commit f3cd25ebb7
2 changed files with 18 additions and 4 deletions

View File

@ -119,6 +119,14 @@ static bool environ_cb_get_system_info(unsigned cmd, void *data)
return true;
}
void libretro_get_environment_info(void (*func)(retro_environment_t), bool *load_no_rom)
{
load_no_rom_hook = load_no_rom;
// load_no_rom gets set in this callback.
func(environ_cb_get_system_info);
}
static dylib_t libretro_get_system_info_lib(const char *path, struct retro_system_info *info, bool *load_no_rom)
{
dylib_t lib = dylib_load(path);
@ -145,10 +153,7 @@ static dylib_t libretro_get_system_info_lib(const char *path, struct retro_syste
if (!set_environ)
return lib;
load_no_rom_hook = load_no_rom;
// load_no_rom gets set in this callback.
set_environ(environ_cb_get_system_info);
libretro_get_environment_info(set_environ, load_no_rom);
}
return lib;

View File

@ -45,6 +45,15 @@ void dylib_close(dylib_t lib);
function_t dylib_proc(dylib_t lib, const char *proc);
#endif
// Sets environment callback in order to get statically known information from it.
// Fetched via environment callbacks instead of retro_get_system_info(), as this info
// is part of extensions.
// Should only be called once right after core load to avoid overwriting
// the "real" environ callback.
//
// For statically linked cores, pass retro_set_environment as argument.
void libretro_get_environment_info(void (*)(retro_environment_t), bool *load_no_rom);
#ifdef HAVE_DYNAMIC
// Gets system info from an arbitrary lib.
// The struct returned must be freed as strings are allocated dynamically.