diff --git a/dynamic.c b/dynamic.c index ec2c490664..a43dac8965 100644 --- a/dynamic.c +++ b/dynamic.c @@ -700,6 +700,17 @@ static bool environment_cb(unsigned cmd, void *data) break; } + case RETRO_ENVIRONMENT_GET_LIBRETRO_PATH: + { + const char **path = (const char**)data; +#ifdef HAVE_DYNAMIC + *path = g_settings.libretro; +#else + *path = NULL; +#endif + break; + } + default: RARCH_LOG("Environ UNSUPPORTED (#%u).\n", cmd); return false; diff --git a/libretro.h b/libretro.h index ff4f4fd99d..9f55186db5 100755 --- a/libretro.h +++ b/libretro.h @@ -480,6 +480,12 @@ enum retro_mod // If true, the libretro implementation supports calls to retro_load_game() with NULL as argument. // Used by cores which can run without particular game data. // This should be called within retro_set_environment() only. + // +#define RETRO_ENVIRONMENT_GET_LIBRETRO_PATH 19 + // const char ** -- + // Retrieves the absolute path from where this libretro implementation was loaded. + // NULL is returned if the libretro was loaded statically (i.e. linked statically to frontend), or if the path cannot be determined. + // Mostly useful in cooperation with SET_SUPPORT_NO_GAME as assets can be loaded without ugly hacks. // Pass this to retro_video_refresh_t if rendering to hardware.