diff --git a/docs/ssnes.1 b/docs/ssnes.1 index 28e8817e62..59d26d776f 100644 --- a/docs/ssnes.1 +++ b/docs/ssnes.1 @@ -27,9 +27,16 @@ If no rom file path is defined on the command line, \fBssnes\fR will try to load \fB--help, -h\fR Prints help text. +.TP \fB--features\fR Prints available features compiled into SSNES, then exits. +.TP +\fB-L PATH, --libsnes PATH\fR +Path to a libsnes implementation which is to be used. +This option will override any setting in a config file. +This option is only available if SSNES is compiled with dynamic libsnes loading. + .TP \fB--save PATH, -s PATH\fR Overrides the path used for save ram (*.srm). diff --git a/qb/config.libs.sh b/qb/config.libs.sh index 90940e27f3..f4f8f12ad4 100644 --- a/qb/config.libs.sh +++ b/qb/config.libs.sh @@ -18,12 +18,6 @@ else DYLIB=-ldl fi -if [ $HAVE_DYNAMIC = yes ] && [ $HAVE_CONFIGFILE = no ]; then - echo "Cannot have dynamic loading of libsnes and no configfile support." - echo "Dynamic loading requires config file support." - exit 1 -fi - if [ -z "$LIBSNES" ]; then LIBSNES="-lsnes" else diff --git a/settings.c b/settings.c index 63509f7e43..eaec8a5f98 100644 --- a/settings.c +++ b/settings.c @@ -390,7 +390,11 @@ static void parse_config_file(void) CONFIG_GET_STRING(audio.driver, "audio_driver"); CONFIG_GET_STRING(audio.dsp_plugin, "audio_dsp_plugin"); CONFIG_GET_STRING(input.driver, "input_driver"); - CONFIG_GET_STRING(libsnes, "libsnes_path"); + + if (!*g_settings.libsnes) + { + CONFIG_GET_STRING(libsnes, "libsnes_path"); + } CONFIG_GET_STRING(screenshot_directory, "screenshot_directory"); if (*g_settings.screenshot_directory && !path_is_directory(g_settings.screenshot_directory)) diff --git a/ssnes.c b/ssnes.c index 2ce251660a..653de2b5d7 100644 --- a/ssnes.c +++ b/ssnes.c @@ -439,6 +439,9 @@ static void print_help(void) puts("\t-S/--savestate: Path to use for save states. If not selected, *.state will be assumed."); #ifdef HAVE_CONFIGFILE puts("\t-c/--config: Path for config file." SSNES_DEFAULT_CONF_PATH_STR); +#endif +#ifdef HAVE_DYNAMIC + puts("\t-L/--libsnes: Path to libsnes implementation. Overrides any config setting."); #endif puts("\t-g/--gameboy: Path to Gameboy ROM. Load SuperGameBoy as the regular rom."); puts("\t-b/--bsx: Path to BSX rom. Load BSX BIOS as the regular rom."); @@ -572,6 +575,9 @@ static void parse_input(int argc, char *argv[]) int val = 0; struct option opts[] = { +#ifdef HAVE_DYNAMIC + { "libsnes", 1, NULL, 'L' }, +#endif { "help", 0, NULL, 'h' }, { "save", 1, NULL, 's' }, { "fullscreen", 0, NULL, 'f' }, @@ -622,7 +628,13 @@ static void parse_input(int argc, char *argv[]) #define CONFIG_FILE_ARG #endif - char optstring[] = "hs:fvS:m:p4jJg:b:B:Y:Z:P:HC:F:U:DN:X:" FFMPEG_RECORD_ARG CONFIG_FILE_ARG; +#ifdef HAVE_DYNAMIC +#define DYNAMIC_ARG "L:" +#else +#define DYNAMIC_ARG +#endif + + char optstring[] = "hs:fvS:m:p4jJg:b:B:Y:Z:P:HC:F:U:DN:X:" DYNAMIC_ARG FFMPEG_RECORD_ARG CONFIG_FILE_ARG; for (;;) { val = 0; @@ -732,6 +744,12 @@ static void parse_input(int argc, char *argv[]) break; #endif +#ifdef HAVE_DYNAMIC + case 'L': + strlcpy(g_settings.libsnes, optarg, sizeof(g_settings.libsnes)); + break; +#endif + case 'P': strlcpy(g_extern.bsv_movie_path, optarg, sizeof(g_extern.bsv_movie_path)); g_extern.bsv_movie_playback = true;