aboutsummaryrefslogtreecommitdiffhomepage
path: root/Cart_Reader/WSV.ino
diff options
context:
space:
mode:
authorsmesgr9000 <smesgr9000>2024-05-03 19:12:48 +0200
committersmesgr9000 <smesgr9000>2024-05-03 19:12:48 +0200
commit990b61ca3a7dd65a6e1b90c57e5c01c2d5c8fc4c (patch)
treeefadc2d65dc35ec673f970c8c1598c4949eb4351 /Cart_Reader/WSV.ino
parente8e6d15a72a01e84b1d1c940165144e5602044e2 (diff)
downloadcartreader-990b61ca3a7dd65a6e1b90c57e5c01c2d5c8fc4c.tar.gz
cartreader-990b61ca3a7dd65a6e1b90c57e5c01c2d5c8fc4c.zip
make cast in read function explicit and reduce duplicate read functions
Diffstat (limited to 'Cart_Reader/WSV.ino')
-rw-r--r--Cart_Reader/WSV.ino15
1 files changed, 8 insertions, 7 deletions
diff --git a/Cart_Reader/WSV.ino b/Cart_Reader/WSV.ino
index c48cb16..e4e997a 100644
--- a/Cart_Reader/WSV.ino
+++ b/Cart_Reader/WSV.ino
@@ -330,8 +330,8 @@ struct database_entry_WSV {
byte gameSize;
};
-void readDataLine_WSV(FsFile& database, struct database_entry_WSV* entry) {
-
+void readDataLine_WSV(FsFile& database, void* entry) {
+ struct database_entry_WSV* castEntry = (database_entry_WSV*)entry;
// Read CRC32 checksum
for (byte i = 0; i < 8; i++) {
checksumStr[i] = char(database.read());
@@ -342,7 +342,7 @@ void readDataLine_WSV(FsFile& database, struct database_entry_WSV* entry) {
// Read CRC32 of first 512 bytes
for (byte i = 0; i < 8; i++) {
- entry->crc_search[i] = char(database.read());
+ castEntry->crc_search[i] = char(database.read());
}
// Skip over semicolon
@@ -350,18 +350,19 @@ void readDataLine_WSV(FsFile& database, struct database_entry_WSV* entry) {
// Read rom size
// Read the next ascii character and subtract 48 to convert to decimal
- entry->gameSize = ((database.read() - 48) * 10) + (database.read() - 48);
+ castEntry->gameSize = ((database.read() - 48) * 10) + (database.read() - 48);
// Skip rest of line
database.seekCur(2);
}
-void printDataLine_WSV(struct database_entry_WSV* entry) {
+void printDataLine_WSV(void* entry) {
+ struct database_entry_WSV* castEntry = (database_entry_WSV*)entry;
print_Msg(F("Size: "));
- if (entry->gameSize == 51)
+ if (castEntry->gameSize == 51)
print_Msg(F("512"));
else
- print_Msg(entry->gameSize);
+ print_Msg(castEntry->gameSize);
println_Msg(F("KB"));
}