mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 10:12:06 +00:00
Add option to list accepted MBC names and clarify man page
Referring to "Pan Docs names" skims over a lot of details. Add `-m help` to list accepted names for clarity
This commit is contained in:
@@ -11,9 +11,10 @@
|
|||||||
#ifndef RGBDS_PLATFORM_H
|
#ifndef RGBDS_PLATFORM_H
|
||||||
#define RGBDS_PLATFORM_H
|
#define RGBDS_PLATFORM_H
|
||||||
|
|
||||||
/* MSVC doesn't have strncasecmp, use a suitable replacement */
|
// MSVC doesn't have str(n)casecmp, use a suitable replacement
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
# include <string.h>
|
# include <string.h>
|
||||||
|
# define strcasecmp _stricmp
|
||||||
# define strncasecmp _strnicmp
|
# define strncasecmp _strnicmp
|
||||||
#else
|
#else
|
||||||
# include <strings.h>
|
# include <strings.h>
|
||||||
|
|||||||
@@ -127,6 +127,25 @@ enum MbcType {
|
|||||||
MBC_BAD_RANGE, // MBC number out of range
|
MBC_BAD_RANGE, // MBC number out of range
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static void printAcceptedMBCNames(void)
|
||||||
|
{
|
||||||
|
fputs("\tROM ($00) [aka ROM_ONLY]\n", stderr);
|
||||||
|
fputs("\tMBC1 ($02), MBC1+RAM ($02), MBC1+RAM+BATTERY ($03)\n", stderr);
|
||||||
|
fputs("\tMBC2 ($05), MBC2+BATTERY ($06)\n", stderr);
|
||||||
|
fputs("\tROM+RAM ($08) [deprecated], ROM+RAM+BATTERY ($09) [deprecated]\n", stderr);
|
||||||
|
fputs("\tMMM01 ($0B), MMM01+RAM ($0C), MMM01+RAM+BATTERY ($0D)\n", stderr);
|
||||||
|
fputs("\tMBC3+TIMER+BATTERY ($0F), MBC3+TIMER+RAM+BATTERY ($10)\n", stderr);
|
||||||
|
fputs("\tMBC3 ($11), MBC3+RAM ($12), MBC3+RAM+BATTERY ($13)\n", stderr);
|
||||||
|
fputs("\tMBC5 ($19), MBC5+RAM ($1A), MBC5+RAM+BATTERY ($1B)\n", stderr);
|
||||||
|
fputs("\tMBC5+RUMBLE ($1C), MBC5+RUMBLE+RAM ($1D), MBC5+RUMBLE+RAM+BATTERY ($1E)\n", stderr);
|
||||||
|
fputs("\tMBC6 ($20)\n", stderr);
|
||||||
|
fputs("\tMBC7+SENSOR+RUMBLE+RAM+BATTERY ($22)\n", stderr);
|
||||||
|
fputs("\tPOCKET_CAMERA ($FC)\n", stderr);
|
||||||
|
fputs("\tBANDAI_TAMA5 ($FD)\n", stderr);
|
||||||
|
fputs("\tHUC3 ($FE)\n", stderr);
|
||||||
|
fputs("\tHUC1+RAM+BATTERY ($FF)\n", stderr);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return False on failure
|
* @return False on failure
|
||||||
*/
|
*/
|
||||||
@@ -151,6 +170,12 @@ static bool readMBCSlice(char const **name, char const *expected)
|
|||||||
|
|
||||||
static enum MbcType parseMBC(char const *name)
|
static enum MbcType parseMBC(char const *name)
|
||||||
{
|
{
|
||||||
|
if (!strcasecmp(name, "help")) {
|
||||||
|
fputs("Accepted MBC names:\n", stderr);
|
||||||
|
printAcceptedMBCNames();
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
if ((name[0] >= '0' && name[0] <= '9') || name[0] == '$') {
|
if ((name[0] >= '0' && name[0] <= '9') || name[0] == '$') {
|
||||||
int base = 0;
|
int base = 0;
|
||||||
|
|
||||||
@@ -1134,10 +1159,13 @@ do { \
|
|||||||
case 'm':
|
case 'm':
|
||||||
cartridgeType = parseMBC(musl_optarg);
|
cartridgeType = parseMBC(musl_optarg);
|
||||||
if (cartridgeType == MBC_BAD) {
|
if (cartridgeType == MBC_BAD) {
|
||||||
report("error: Unknown MBC \"%s\"\n", musl_optarg);
|
report("error: Unknown MBC \"%s\"\nAccepted MBC names:\n",
|
||||||
} else if (cartridgeType == MBC_WRONG_FEATURES) {
|
|
||||||
report("error: Features incompatible with MBC (\"%s\")\n",
|
|
||||||
musl_optarg);
|
musl_optarg);
|
||||||
|
printAcceptedMBCNames();
|
||||||
|
} else if (cartridgeType == MBC_WRONG_FEATURES) {
|
||||||
|
report("error: Features incompatible with MBC (\"%s\")\nAccepted combinations:\n",
|
||||||
|
musl_optarg);
|
||||||
|
printAcceptedMBCNames();
|
||||||
} else if (cartridgeType == MBC_BAD_RANGE) {
|
} else if (cartridgeType == MBC_BAD_RANGE) {
|
||||||
report("error: Specified MBC ID out of range 0-255: %s\n",
|
report("error: Specified MBC ID out of range 0-255: %s\n",
|
||||||
musl_optarg);
|
musl_optarg);
|
||||||
|
|||||||
@@ -112,7 +112,10 @@ This value is deprecated and should be set to 0x33 in all new software.
|
|||||||
Set the MBC type
|
Set the MBC type
|
||||||
.Pq Ad 0x147
|
.Pq Ad 0x147
|
||||||
to a given value from 0 to 0xFF.
|
to a given value from 0 to 0xFF.
|
||||||
This value may also be an MBC name from the Pan Docs.
|
.Pp
|
||||||
|
This value may also be an MBC name.
|
||||||
|
The list of accepted names can be obtained by passing "help" as the argument.
|
||||||
|
Any amount of whitespace (space and tabs) is allowed around plus signs, and the order of "components" is free, as long as the MBC name is first.
|
||||||
.It Fl n Ar rom_version , Fl Fl rom-version Ar rom_version
|
.It Fl n Ar rom_version , Fl Fl rom-version Ar rom_version
|
||||||
Set the ROM version
|
Set the ROM version
|
||||||
.Pq Ad 0x14C
|
.Pq Ad 0x14C
|
||||||
|
|||||||
Reference in New Issue
Block a user