Skip to content

Commit

Permalink
reuse common strings, remove duplicate
Browse files Browse the repository at this point in the history
  • Loading branch information
smesgr9000 committed May 30, 2024
1 parent d039c59 commit 5b43a16
Show file tree
Hide file tree
Showing 13 changed files with 23 additions and 19 deletions.
4 changes: 2 additions & 2 deletions Cart_Reader/GB.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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: "));
Expand Down Expand Up @@ -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"));
Expand Down
4 changes: 2 additions & 2 deletions Cart_Reader/GBA.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions Cart_Reader/LOOPY.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion Cart_Reader/MD.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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: "));
Expand Down
4 changes: 2 additions & 2 deletions Cart_Reader/N64.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion Cart_Reader/NGP.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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: "));
Expand Down
2 changes: 2 additions & 0 deletions Cart_Reader/OSCR.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 =================================================*/
Expand Down
2 changes: 2 additions & 0 deletions Cart_Reader/OSCR.h
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand Down
4 changes: 2 additions & 2 deletions Cart_Reader/SFM.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
4 changes: 2 additions & 2 deletions Cart_Reader/SMS.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions Cart_Reader/SNES.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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: "));
Expand Down Expand Up @@ -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();

Expand Down Expand Up @@ -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();

Expand Down
2 changes: 1 addition & 1 deletion Cart_Reader/VBOY.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion Cart_Reader/WS.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 5b43a16

Please sign in to comment.