Enable RGBGFX's CLI "at-files" for all programs (#1848)

This commit is contained in:
Rangi
2025-10-22 17:05:59 -04:00
committed by GitHub
parent a0bb830679
commit f065243cd2
44 changed files with 1466 additions and 1334 deletions

View File

@@ -3,6 +3,7 @@
#ifndef RGBDS_ASM_MAIN_HPP
#define RGBDS_ASM_MAIN_HPP
#include <optional>
#include <stdint.h>
#include <stdio.h>
#include <string>
@@ -20,10 +21,10 @@ struct Options {
char binDigits[2] = {'0', '1'}; // -b
char gfxDigits[4] = {'0', '1', '2', '3'}; // -g
FILE *dependFile = nullptr; // -M
std::string targetFileName; // -MQ, -MT
std::optional<std::string> targetFileName{}; // -MQ, -MT
MissingInclude missingIncludeState = INC_ERROR; // -MC, -MG
bool generatePhonyDeps = false; // -MP
std::string objectFileName; // -o
std::optional<std::string> objectFileName{}; // -o
uint8_t padByte = 0; // -p
uint64_t maxErrors = 0; // -X
@@ -35,7 +36,7 @@ struct Options {
void printDep(std::string const &depName) {
if (dependFile) {
fprintf(dependFile, "%s: %s\n", targetFileName.c_str(), depName.c_str());
fprintf(dependFile, "%s: %s\n", targetFileName->c_str(), depName.c_str());
}
}
};

20
include/cli.hpp Normal file
View File

@@ -0,0 +1,20 @@
// SPDX-License-Identifier: MIT
#ifndef RGBDS_CLI_HPP
#define RGBDS_CLI_HPP
#include <stdarg.h>
#include <string>
#include "extern/getopt.hpp" // option
void cli_ParseArgs(
int argc,
char *argv[],
char const *shortOpts,
option const *longOpts,
void (*parseArg)(int, char *),
void (*fatal)(char const *, ...)
);
#endif // RGBDS_CLI_HPP

View File

@@ -3,7 +3,9 @@
#ifndef RGBDS_FIX_MAIN_HPP
#define RGBDS_FIX_MAIN_HPP
#include <optional>
#include <stdint.h>
#include <string>
#include "fix/mbc.hpp" // UNSPECIFIED, MbcType
@@ -28,19 +30,19 @@ struct Options {
uint16_t ramSize = UNSPECIFIED; // -r
bool sgb = false; // -s
char const *gameID = nullptr; // -i
std::optional<std::string> gameID; // -i
uint8_t gameIDLen;
char const *newLicensee = nullptr; // -k
std::optional<std::string> newLicensee; // -k
uint8_t newLicenseeLen;
char const *logoFilename = nullptr; // -L
std::optional<std::string> logoFilename; // -L
uint8_t logo[48] = {};
MbcType cartridgeType = MBC_NONE; // -m
uint8_t tpp1Rev[2];
char const *title = nullptr; // -t
std::optional<std::string> title; // -t
uint8_t titleLen;
};

View File

@@ -10,6 +10,6 @@ void lexer_TraceCurrent();
void lexer_IncludeFile(std::string &&path);
void lexer_IncLineNo();
bool lexer_Init(char const *linkerScriptName);
bool lexer_Init(std::string const &linkerScriptName);
#endif // RGBDS_LINK_LEXER_HPP

View File

@@ -3,16 +3,18 @@
#ifndef RGBDS_LINK_MAIN_HPP
#define RGBDS_LINK_MAIN_HPP
#include <optional>
#include <stdint.h>
#include <string>
struct Options {
bool isDmgMode; // -d
char const *mapFileName; // -m
bool noSymInMap; // -M
char const *symFileName; // -n
char const *overlayFileName; // -O
char const *outputFileName; // -o
uint8_t padValue; // -p
bool isDmgMode; // -d
std::optional<std::string> mapFileName; // -m
bool noSymInMap; // -M
std::optional<std::string> symFileName; // -n
std::optional<std::string> overlayFileName; // -O
std::optional<std::string> outputFileName; // -o
uint8_t padValue; // -p
bool hasPadValue = false;
// Setting these three to 0 disables the functionality
uint16_t scrambleROMX; // -S

View File

@@ -3,10 +3,13 @@
#ifndef RGBDS_LINK_OBJECT_HPP
#define RGBDS_LINK_OBJECT_HPP
#include <stddef.h>
#include <string>
// Read an object (.o) file, and add its info to the data structures.
void obj_ReadFile(char const *fileName, unsigned int fileID);
void obj_ReadFile(std::string const &filePath, size_t fileID);
// Sets up object file reading
void obj_Setup(unsigned int nbFiles);
void obj_Setup(size_t nbFiles);
#endif // RGBDS_LINK_OBJECT_HPP