Allow -L/--libsnes from command line.

This commit is contained in:
Themaister 2011-11-15 21:15:12 +01:00
parent 66e1179503
commit 88c870dcfa
4 changed files with 31 additions and 8 deletions

View File

@ -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).

View File

@ -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

View File

@ -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))

20
ssnes.c
View File

@ -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;