mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 10:12:06 +00:00
Add option to disable padding in rgblink
Fixes #307 RGBFIX can handle padding, so there's no reason why we can't add an option to disable padding in rgblink. Signed-off-by: JL2210 <larrowe.semaj11@gmail.com>
This commit is contained in:
@@ -27,6 +27,7 @@ extern uint8_t padValue;
|
||||
extern bool is32kMode;
|
||||
extern bool beVerbose;
|
||||
extern bool isWRA0Mode;
|
||||
extern bool disablePadding;
|
||||
|
||||
/* Helper macro for printing verbose-mode messages */
|
||||
#define verbosePrint(...) do { \
|
||||
|
||||
@@ -34,6 +34,7 @@ uint8_t padValue; /* -p */
|
||||
bool is32kMode; /* -t */
|
||||
bool beVerbose; /* -v */
|
||||
bool isWRA0Mode; /* -w */
|
||||
bool disablePadding; /* -x */
|
||||
|
||||
static uint32_t nbErrors = 0;
|
||||
|
||||
@@ -83,7 +84,7 @@ FILE *openFile(char const *fileName, char const *mode)
|
||||
}
|
||||
|
||||
/* Short options */
|
||||
static char const *optstring = "dl:m:n:O:o:p:s:tVvw";
|
||||
static char const *optstring = "dl:m:n:O:o:p:s:tVvwx";
|
||||
|
||||
/*
|
||||
* Equivalent long options
|
||||
@@ -108,6 +109,7 @@ static struct option const longopts[] = {
|
||||
{ "version", no_argument, NULL, 'V' },
|
||||
{ "verbose", no_argument, NULL, 'v' },
|
||||
{ "wramx", no_argument, NULL, 'w' },
|
||||
{ "nopad", no_argument, NULL, 'x' },
|
||||
{ NULL, no_argument, NULL, 0 }
|
||||
};
|
||||
|
||||
@@ -126,6 +128,7 @@ static void printUsage(void)
|
||||
" -n, --sym <path> set the output symbol list file\n"
|
||||
" -o, --output <path> set the output file\n"
|
||||
" -p, --pad <value> set the value to pad between sections with\n"
|
||||
" -x, --nopad disable padding of output binary\n"
|
||||
" -V, --version print RGBLINK version and exits\n"
|
||||
"\n"
|
||||
"For help, use `man rgblink' or go to https://rednex.github.io/rgbds/\n",
|
||||
@@ -199,6 +202,11 @@ int main(int argc, char *argv[])
|
||||
case 'w':
|
||||
isWRA0Mode = true;
|
||||
break;
|
||||
case 'x':
|
||||
disablePadding = true;
|
||||
/* implies tiny mode */
|
||||
is32kMode = true;
|
||||
break;
|
||||
default:
|
||||
printUsage();
|
||||
exit(1);
|
||||
|
||||
@@ -175,9 +175,13 @@ static void writeBank(struct SortedSection *bankSections, uint16_t baseOffset,
|
||||
bankSections = bankSections->next;
|
||||
}
|
||||
|
||||
while (offset < size) {
|
||||
putc(overlayFile ? getc(overlayFile) : padValue, outputFile);
|
||||
offset++;
|
||||
if (!disablePadding) {
|
||||
while (offset < size) {
|
||||
putc(overlayFile ? getc(overlayFile)
|
||||
: padValue,
|
||||
outputFile);
|
||||
offset++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user