diff options
author | Vincent Pelletier <[email protected]> | 2022-10-23 05:01:59 +0000 |
---|---|---|
committer | Vincent Pelletier <[email protected]> | 2022-10-28 05:29:20 +0000 |
commit | 0a627e5bd4010e36c32877a916da02d2213a2c1b (patch) | |
tree | 6cf8c44b0f91eba3eb32dda85aca7d19ad8fac98 /Cart_Reader/GBA.ino | |
parent | a555f2117f54ca50fb57b46f1bda7732a8eed18f (diff) | |
download | cartreader-0a627e5bd4010e36c32877a916da02d2213a2c1b.tar.gz cartreader-0a627e5bd4010e36c32877a916da02d2213a2c1b.zip |
All: Use f.seekCur(x) instead of f.seekSet(f.curPosition() + x)
Saves 450 bytes of program space.
Diffstat (limited to 'Cart_Reader/GBA.ino')
-rw-r--r-- | Cart_Reader/GBA.ino | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/Cart_Reader/GBA.ino b/Cart_Reader/GBA.ino index e435946..5b1054b 100644 --- a/Cart_Reader/GBA.ino +++ b/Cart_Reader/GBA.ino @@ -873,7 +873,7 @@ void getCartInfo_GBA() { skip_line(&myFile);
// Skip over the CRC checksum
- myFile.seekSet(myFile.curPosition() + 9);
+ myFile.seekCur(9);
// Read 4 bytes into String, do it one at a time so byte order doesn't get mixed up
sprintf(tempStr, "%c", myFile.read());
@@ -890,15 +890,15 @@ void getCartInfo_GBA() { if (myFile.curPosition() == 0) {
break;
} else if (myFile.peek() == '\n') {
- myFile.seekSet(myFile.curPosition() - 1);
+ myFile.seekCur(-1);
break;
} else {
- myFile.seekSet(myFile.curPosition() - 1);
+ myFile.seekCur(-1);
}
}
}
if (myFile.curPosition() != 0)
- myFile.seekSet(myFile.curPosition() + 2);
+ myFile.seekCur(2);
// Display database
while (myFile.available()) {
@@ -908,7 +908,7 @@ void getCartInfo_GBA() { get_line(gamename, &myFile, 96);
// Skip over the CRC checksum
- myFile.seekSet(myFile.curPosition() + 9);
+ myFile.seekCur(9);
// Read 4 bytes into String, do it one at a time so byte order doesn't get mixed up
sprintf(tempStr, "%c", myFile.read());
@@ -918,7 +918,7 @@ void getCartInfo_GBA() { }
// Skip the , in the file
- myFile.seekSet(myFile.curPosition() + 1);
+ myFile.seekCur(1);
// Read the next ascii character and subtract 48 to convert to decimal
cartSize = myFile.read() - 48;
@@ -930,7 +930,7 @@ void getCartInfo_GBA() { }
// Skip the , in the file
- myFile.seekSet(myFile.curPosition() + 1);
+ myFile.seekCur(1);
// Read save type into string
get_line(saveTypeStr, &myFile, 14);
@@ -980,15 +980,15 @@ void getCartInfo_GBA() { if (myFile.curPosition() == 0) {
break;
} else if (myFile.peek() == '\n') {
- myFile.seekSet(myFile.curPosition() - 1);
+ myFile.seekCur(-1);
break;
} else {
- myFile.seekSet(myFile.curPosition() - 1);
+ myFile.seekCur(-1);
}
}
}
if (myFile.curPosition() != 0)
- myFile.seekSet(myFile.curPosition() + 2);
+ myFile.seekCur(2);
break;
}
|