reuse common strings, remove duplicate

This commit is contained in:
smesgr9000 2024-05-30 08:00:13 +02:00
parent d039c590cc
commit 5b43a162b8
13 changed files with 23 additions and 19 deletions

View File

@ -596,7 +596,7 @@ void setup_GB() {
void showCartInfo_GB() {
display_Clear();
if (strcmp(checksumStr, "00") != 0) {
print_Msg(F("Title: "));
print_Msg(FS(FSTRING_NAME));
println_Msg(romName);
if (cartID[0] != 0) {
print_Msg(F("Serial: "));
@ -1276,7 +1276,7 @@ void compare_checksums_GB() {
char calcsumStr[5];
sprintf(calcsumStr, "%04X", calc_checksum_GB(fileName));
print_Msg(F("Checksum: "));
print_Msg(FS(FSTRING_CHECKSUM));
print_Msg(calcsumStr);
if (strcmp(calcsumStr, checksumStr) == 0) {
println_Msg(F(" -> OK"));

View File

@ -252,7 +252,7 @@ void setup_GBA() {
display_Clear();
// Print start page
print_Msg(F("Title: "));
print_Msg(FS(FSTRING_NAME));
println_Msg(romName);
print_Msg(F("Serial: "));
println_Msg(cartID);
@ -865,7 +865,7 @@ void readROM_GBA() {
// Calculate the checksum of the dumped rom
boolean compare_checksum_GBA() {
print_Msg(F("Checksum: "));
print_Msg(FS(FSTRING_CHECKSUM));
display_Update();
strcpy(fileName, romName);

View File

@ -494,9 +494,9 @@ void getCartInfo_LOOPY() {
println_Msg(F("Cart Info"));
println_Msg(FS(FSTRING_SPACE));
print_Msg(F("Name: "));
print_Msg(FS(FSTRING_NAME));
println_Msg(loopyRomNameLong);
print_Msg(F("Checksum: "));
print_Msg(FS(FSTRING_CHECKSUM));
println_Msg(checksumStr);
print_Msg(FS(FSTRING_SIZE));
print_Msg(cartSize * 8 / 1024 / 1024);

View File

@ -1295,7 +1295,7 @@ void getCartInfo_MD() {
display_Clear();
println_Msg(F("Cart Info"));
println_Msg(FS(FSTRING_SPACE));
print_Msg(F("Name: "));
print_Msg(FS(FSTRING_NAME));
println_Msg(romName);
if (bramCheck != 0x00FF) {
print_Msg(F("bramCheck: "));

View File

@ -1926,7 +1926,7 @@ void printCartInfo_N64() {
// Print start page
if (cartSize != 0) {
display_Clear();
print_Msg(F("Title: "));
print_Msg(FS(FSTRING_NAME));
println_Msg(romName);
print_Msg(F("Serial: "));
println_Msg(cartID);
@ -1970,7 +1970,7 @@ void printCartInfo_N64() {
display_Clear();
println_Msg(F("GAMEPAK ERROR"));
println_Msg("");
print_Msg(F("Title: "));
print_Msg(FS(FSTRING_NAME));
println_Msg(romName);
print_Msg(F("Serial: "));
println_Msg(cartID);

View File

@ -171,7 +171,7 @@ void printCartInfo_NGP() {
println_Msg(F("NGP Cart Info"));
print_Msg(F("Name: "));
print_Msg(FS(FSTRING_NAME));
println_Msg(romName);
print_Msg(F("App ID: "));

View File

@ -74,6 +74,8 @@ constexpr char PROGMEM FSTRING_SET_SIZE[] = "Set Size";
constexpr char PROGMEM FSTRING_REFRESH_CART[] = "Refresh Cart";
constexpr char PROGMEM FSTRING_MAPPER[] = "Mapper: ";
constexpr char PROGMEM FSTRING_SIZE[] = "Size: ";
constexpr char PROGMEM FSTRING_NAME[] = "Name: ";
constexpr char PROGMEM FSTRING_CHECKSUM[] = "Checksum: ";
constexpr char PROGMEM FSTRING_ROM_SIZE[] ="ROM SIZE: ";
/*==== /CONSTANTS =================================================*/

View File

@ -55,6 +55,8 @@ extern const char PROGMEM FSTRING_REFRESH_CART[];
extern const char PROGMEM FSTRING_MAPPER[];
extern const char PROGMEM FSTRING_SIZE[];
extern const char PROGMEM FSTRING_ROM_SIZE[];
extern const char PROGMEM FSTRING_NAME[];
extern const char PROGMEM FSTRING_CHECKSUM[];
#define FS(pmem_string) (reinterpret_cast<const __FlashStringHelper *>(pmem_string))

View File

@ -735,14 +735,14 @@ void getCartInfo_SFM() {
}
display_Clear();
print_Msg(F("Name: "));
print_Msg(FS(FSTRING_NAME));
println_Msg(romName);
println_Msg(FS(FSTRING_SPACE));
print_Msg(F("Version: 1."));
println_Msg(romVersion);
print_Msg(F("Checksum: "));
print_Msg(FS(FSTRING_CHECKSUM));
println_Msg(checksumStr);
print_Msg(FS(FSTRING_SIZE));

View File

@ -507,7 +507,7 @@ void getCartInfo_SMS() {
display_Clear();
println_Msg(F("SMS/GG header not found"));
println_Msg(FS(FSTRING_SPACE));
print_Msg(F("Name: "));
print_Msg(FS(FSTRING_NAME));
println_Msg(romName);
print_Msg(F("Selected Size: "));
print_Msg(cartSize / 1024);
@ -525,7 +525,7 @@ void getCartInfo_SMS() {
println_Msg(F("GG header info"));
}
println_Msg(FS(FSTRING_SPACE));
print_Msg(F("Name: "));
print_Msg(FS(FSTRING_NAME));
println_Msg(romName);
print_Msg(FS(FSTRING_SIZE));
print_Msg(cartSize / 1024);

View File

@ -758,7 +758,7 @@ void getCartInfo_SNES() {
}
display_Clear();
print_Msg(F("Title: "));
print_Msg(FS(FSTRING_NAME));
println_Msg(romName);
print_Msg(F("Revision: "));
@ -846,7 +846,7 @@ void getCartInfo_SNES() {
print_Msg(sramSize >> 3);
println_Msg(F(" KB"));
print_Msg(F("Checksum: "));
print_Msg(FS(FSTRING_CHECKSUM));
println_Msg(checksumStr);
display_Update();
@ -876,7 +876,7 @@ void checkAltConf(char crcStr[9]) {
// Get cart info
display_Clear();
println_Msg(F("Searching database..."));
print_Msg(F("Checksum: "));
print_Msg(FS(FSTRING_CHECKSUM));
println_Msg(checksumStr);
display_Update();

View File

@ -381,7 +381,7 @@ void getCartInfo_VB() {
display_Clear();
println_Msg(F("Cart Info"));
println_Msg(FS(FSTRING_SPACE));
print_Msg(F("Name: "));
print_Msg(FS(FSTRING_NAME));
println_Msg(romName);
print_Msg(FS(FSTRING_SIZE));
print_Msg(cartSize * 8 / 1024 / 1024);

View File

@ -403,7 +403,7 @@ static void showCartInfo_WS() {
print_Msg(F("Version: 1."));
println_Msg(romVersion, HEX);
print_Msg(F("Checksum: "));
print_Msg(FS(FSTRING_CHECKSUM));
println_Msg(checksumStr);
// Prints string out of the common strings array either with or without newline