Can change shader with command line.

This commit is contained in:
Themaister 2010-11-13 15:14:30 +01:00
parent 065072e1fc
commit af48ea7165
2 changed files with 23 additions and 1 deletions

View File

@ -64,7 +64,10 @@ static const bool vsync = true;
static const bool video_smooth = true;
// Path to custom Cg shader. If using custom shaders, it is recommended to disable video_smooth.
static const char *cg_shader_path = "hqflt/cg/hq2x.cg";
#ifdef HAVE_CG
extern char cg_shader_path[];
#define DEFAULT_CG_SHADER "hqflt/cg/hq2x.cg"
#endif
// On resize and fullscreen, rendering area will stay 4:3
static const bool force_aspect = true;

19
ssnes.c
View File

@ -346,12 +346,18 @@ static void print_help(void)
puts("Usage: ssnes [rom file] [-h/--help | -s/--save]");
puts("\t-h/--help: Show this help message");
puts("\t-s/--save: Path for save file (*.srm). Required when rom is input from stdin");
#ifdef HAVE_CG
puts("\t-f/--shader: Path to Cg shader. Will be compiled at runtime.\n");
#endif
puts("\t-v/--verbose: Verbose logging");
}
static FILE* rom_file = NULL;
static char savefile_name_srm[256] = {0};
static bool verbose = false;
#ifdef HAVE_CG
char cg_shader_path[256] = DEFAULT_CG_SHADER;
#endif
#define SSNES_LOG(msg, args...) do { \
if (verbose) \
@ -374,11 +380,18 @@ static void parse_input(int argc, char *argv[])
{ "help", 0, NULL, 'h' },
{ "save", 1, NULL, 's' },
{ "verbose", 0, NULL, 'v' },
#ifdef HAVE_CG
{ "shader", 1, NULL, 'f' },
#endif
{ NULL, 0, NULL, 0 }
};
int option_index = 0;
#ifdef HAVE_CG
char optstring[] = "hs:vf:";
#else
char optstring[] = "hs:v";
#endif
for(;;)
{
int c = getopt_long(argc, argv, optstring, opts, &option_index);
@ -397,6 +410,12 @@ static void parse_input(int argc, char *argv[])
savefile_name_srm[sizeof(savefile_name_srm)-1] = '\0';
break;
#ifdef HAVE_CG
case 'f':
strncpy(cg_shader_path, optarg, sizeof(cg_shader_path) - 1);
break;
#endif
case 'v':
verbose = true;
break;