diff options
author | smesgr9000 <smesgr9000> | 2024-05-03 19:12:48 +0200 |
---|---|---|
committer | smesgr9000 <smesgr9000> | 2024-05-03 19:12:48 +0200 |
commit | 990b61ca3a7dd65a6e1b90c57e5c01c2d5c8fc4c (patch) | |
tree | efadc2d65dc35ec673f970c8c1598c4949eb4351 /Cart_Reader/ODY2.ino | |
parent | e8e6d15a72a01e84b1d1c940165144e5602044e2 (diff) | |
download | cartreader-990b61ca3a7dd65a6e1b90c57e5c01c2d5c8fc4c.tar.gz cartreader-990b61ca3a7dd65a6e1b90c57e5c01c2d5c8fc4c.zip |
make cast in read function explicit and reduce duplicate read functions
Diffstat (limited to 'Cart_Reader/ODY2.ino')
-rw-r--r-- | Cart_Reader/ODY2.ino | 23 |
1 files changed, 2 insertions, 21 deletions
diff --git a/Cart_Reader/ODY2.ino b/Cart_Reader/ODY2.ino index 7388861..aaf7fcf 100644 --- a/Cart_Reader/ODY2.ino +++ b/Cart_Reader/ODY2.ino @@ -369,30 +369,11 @@ void checkStatus_ODY2() { //****************************************** // CART SELECT CODE //****************************************** -struct database_entry_ODY2 { - byte gameMapper; - byte gameSize; -}; - -void readDataLine_ODY2(FsFile& database, struct database_entry_ODY2* entry) { - // Read mapper - entry->gameMapper = database.read() - 48; - - // Skip over semicolon - database.seekCur(1); - - // Read rom size - entry->gameSize = database.read() - 48; - - // Skip rest of line - database.seekCur(2); -} - void setCart_ODY2() { //go to root sd.chdir(); - struct database_entry_ODY2 entry; + struct database_entry_mapper_size entry; // Select starting letter byte myLetter = starting_letter(); @@ -401,7 +382,7 @@ void setCart_ODY2() { if (myFile.open("ody2cart.txt", O_READ)) { seek_first_letter_in_database(myFile, myLetter); - if(checkCartSelection(myFile, &readDataLine_ODY2, &entry)) { + if(checkCartSelection(myFile, &readDataLineMapperSize, &entry)) { EEPROM_writeAnything(7, entry.gameMapper); EEPROM_writeAnything(8, entry.gameSize); } |