Some more needed stuff ...

This commit is contained in:
Themaister 2011-08-18 00:24:57 +02:00
parent 1ff9b6a375
commit 24e8ca6856
4 changed files with 25 additions and 4 deletions

View File

@ -138,6 +138,11 @@ Network port used for netplay. This defaults to 55435. This option affects both
Attempts to apply an UPS patch to the current ROM image. No files are altered.
If this flag is not specified, SSNES will look for a .ups file with same basename as ROM specified.
.TP
\fB--bps PATCH\fR
Attempts to apply a BPS patch to the current ROM image. No files are altered.
If this flag is not specified, SSNES will look for a .bps file with same basename as ROM specified.
.TP
\fB--xml MAP, -X MAP\fR
Specifies path to XML memory map for the given ROM.

12
file.c
View File

@ -133,14 +133,20 @@ static void patch_rom(uint8_t **buf, ssize_t *size)
void *patch_data = NULL;
enum patch_type type = PATCH_NONE;
if (*g_extern.ups_name && (patch_size = read_file(g_extern.ups_name, &patch_data)) >= 0)
if (g_extern.ups_pref && g_extern.bps_pref)
{
SSNES_WARN("Both UPS and BPS patch explicitly defined, ignoring both ...\n");
return;
}
if (!g_extern.bps_pref && *g_extern.ups_name && (patch_size = read_file(g_extern.ups_name, &patch_data)) >= 0)
type = PATCH_UPS;
else if (*g_extern.bps_name && (patch_size = read_file(g_extern.bps_name, &patch_data)) >= 0)
else if (!g_extern.ups_pref && *g_extern.bps_name && (patch_size = read_file(g_extern.bps_name, &patch_data)) >= 0)
type = PATCH_BPS;
if (type == PATCH_NONE)
{
SSNES_LOG("Could not find any ROM patch.\n");
SSNES_LOG("Did not find a valid ROM patch.\n");
return;
}

View File

@ -181,9 +181,12 @@ struct global
char savefile_name_asrm[512];
char savefile_name_bsrm[512];
char savestate_name[256];
char xml_name[512];
bool ups_pref;
bool bps_pref;
char ups_name[512];
char bps_name[512];
char xml_name[512];
unsigned state_slot;

View File

@ -429,6 +429,7 @@ static void print_help(void)
#endif
puts("\t-v/--verbose: Verbose logging.");
puts("\t-U/--ups: Specifies path for UPS patch that will be applied to ROM.");
puts("\t--bps: Specifies path for BPS patch that will be applied to ROM.");
puts("\t-X/--xml: Specifies path to XML memory map.");
puts("\t-D/--detach: Detach SSNES from the running console. Not relevant for all platforms.\n");
@ -484,6 +485,7 @@ static void parse_input(int argc, char *argv[])
{ "frames", 1, NULL, 'F' },
{ "port", 1, &val, 'p' },
{ "ups", 1, NULL, 'U' },
{ "bps", 1, &val, 'B' },
{ "xml", 1, NULL, 'X' },
{ "detach", 0, NULL, 'D' },
{ NULL, 0, NULL, 0 }
@ -635,6 +637,7 @@ static void parse_input(int argc, char *argv[])
case 'U':
strlcpy(g_extern.ups_name, optarg, sizeof(g_extern.ups_name));
g_extern.ups_pref = true;
break;
case 'X':
@ -653,6 +656,10 @@ static void parse_input(int argc, char *argv[])
case 'p':
g_extern.netplay_port = strtol(optarg, NULL, 0);
break;
case 'B':
strlcpy(g_extern.bps_name, optarg, sizeof(g_extern.bps_name));
g_extern.bps_pref = true;
break;
default:
break;
}