From d52179c4d5233d7e0ae52af2130b1eb7410c59b3 Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Fri, 10 Nov 2017 17:31:06 +0000 Subject: [PATCH] cleaned up savedb renamed sram128 to sram96 --- inc/everdrive.h | 2 +- inc/rom.h | 2 +- inc/utils.h | 4 +- src/everdrive.c | 2 +- src/utils.c | 153 ++++++++++++++++++------------------------------ 5 files changed, 63 insertions(+), 100 deletions(-) diff --git a/inc/everdrive.h b/inc/everdrive.h index 143a3a8..922a3f6 100644 --- a/inc/everdrive.h +++ b/inc/everdrive.h @@ -18,7 +18,7 @@ #define SAVE_TYPE_OFF 0 #define SAVE_TYPE_SRAM 1 -#define SAVE_TYPE_SRAM128 2 +#define SAVE_TYPE_SRAM96 2 #define SAVE_TYPE_EEP4k 3 #define SAVE_TYPE_EEP16k 4 #define SAVE_TYPE_FLASH 5 diff --git a/inc/rom.h b/inc/rom.h index 75c521a..77b9cc3 100644 --- a/inc/rom.h +++ b/inc/rom.h @@ -129,7 +129,7 @@ #define IO_WRITE(addr,data) (*(volatile u32*)PHYS_TO_K1(addr)=(u32)(data)) #define SAVE_SIZE_SRAM 32768 -#define SAVE_SIZE_SRAM128 131072 +#define SAVE_SIZE_SRAM96 131072 #define SAVE_SIZE_EEP4k 4096 #define SAVE_SIZE_EEP16k 16384 #define SAVE_SIZE_FLASH 131072 diff --git a/inc/utils.h b/inc/utils.h index 8e2e891..d5445b2 100644 --- a/inc/utils.h +++ b/inc/utils.h @@ -45,14 +45,14 @@ int pushSaveToCart(int stype, uint8_t *buffer); int getSRAM( uint8_t *buffer,int size); int getSRAM32( uint8_t *buffer); -int getSRAM128( uint8_t *buffer); +int getSRAM96( uint8_t *buffer); int getEeprom4k( uint8_t *buffer); int getEeprom16k( uint8_t *buffer); int getFlashRAM( uint8_t *buffer); int setSRAM(uint8_t *buffer,int size); int setSRAM32( uint8_t *buffer); -int setSRAM128( uint8_t *buffer); +int setSRAM96( uint8_t *buffer); int setEeprom4k( uint8_t *buffer); int setEeprom16k( uint8_t *buffer); int setFlashRAM( uint8_t *buffer); diff --git a/src/everdrive.c b/src/everdrive.c index 5af6bac..7388119 100644 --- a/src/everdrive.c +++ b/src/everdrive.c @@ -536,7 +536,7 @@ void evd_setSaveType(u8 type) { case SAVE_TYPE_SRAM: sram_on = 1; break; - case SAVE_TYPE_SRAM128: + case SAVE_TYPE_SRAM96: sram_on = 1; sram_size = 1; break; diff --git a/src/utils.c b/src/utils.c index 50de29b..13bca57 100644 --- a/src/utils.c +++ b/src/utils.c @@ -30,97 +30,60 @@ int get_cic_save(char *cartid, int *cic, int *save) { int NUM_CARTS = 138; int i; - //data arrays - /* - char *names[] = { - "gnuboy64lite", "FRAMTestRom", "SRAMTestRom", "Worms Armageddon", - "Super Smash Bros.", "Banjo-Tooie", "Blast Corps", "Bomberman Hero", - "Body Harvest", "Banjo-Kazooie", "Bomberman 64", - "Bomberman 64: Second Attack", "Command & Conquer", "Chopper Attack", - "NBA Courtside 2 featuring Kobe Bryant", "Penny Racers", - "Chameleon Twist", "Cruis'n USA", "Cruis'n World", - "Legend of Zelda: Majora's Mask, The", "Donkey Kong 64", - "Donkey Kong 64", "Donald Duck: Goin' Quackers", - "Loony Toons: Duck Dodgers", "Diddy Kong Racing", "PGA European Tour", - "Star Wars Episode 1 Racer", "AeroFighters Assault", "Bass Hunter 64", - "Conker's Bad Fur Day", "F-1 World Grand Prix", "Star Fox 64", - "F-Zero X", "GT64 Championship Edition", "GoldenEye 007", "Glover", - "Bomberman 64", "Indy Racing 2000", - "Indiana Jones and the Infernal Machine", "Jet Force Gemini", - "Jet Force Gemini", "Earthworm Jim 3D", "Snowboard Kids 2", - "Kirby 64: The Crystal Shards", "Fighters Destiny", - "Major League Baseball featuring Ken Griffey Jr.", - "Killer Instinct Gold", "Ken Griffey Jr's Slugfest", "Mario Kart 64", - "Mario Party", "Lode Runner 3D", "Megaman 64", "Mario Tennis", - "Mario Golf", "Mission: Impossible", "Mickey's Speedway USA", - "Monopoly", "Paper Mario", "Multi-Racing Championship", - "Big Mountain 2000", "Mario Party 3", "Mario Party 2", "Excitebike 64", - "Dr. Mario 64", "Star Wars Episode 1: Battle for Naboo", - "Kobe Bryant in NBA Courtside", "Excitebike 64", - "Ogre Battle 64: Person of Lordly Caliber", "Pokémon Stadium 2", - "Pokémon Stadium 2", "Perfect Dark", "Pokémon Snap", - "Hey you, Pikachu!", "Pokémon Snap", "Pokémon Puzzle League", - "Pokémon Stadium", "Pokémon Stadium", "Pilotwings 64", - "Top Gear Overdrive", "Resident Evil 2", "New Tetris, The", - "Star Wars: Rogue Squadron", "Ridge Racer 64", - "Star Soldier: Vanishing Earth", "AeroFighters Assault", - "Starshot Space Circus", "Super Mario 64", "Starcraft 64", - "Rocket: Robot on Wheels", "Space Station Silicon Valley", - "Star Wars: Shadows of the Empire", "Tigger's Honey Hunt", - "1080º Snowboarding", "Tom & Jerry in Fists of Furry", - "Mischief Makers", "All-Star Tennis '99", "Tetrisphere", - "V-Rally Edition '99", "V-Rally Edition '99", "WCW/NWO Revenge", - "WWF: No Mercy", "Waialae Country Club: True Golf Classics", - "Wave Race 64", "Worms Armageddon", "WWF: Wrestlemania 2000", - "Cruis'n Exotica", "Yoshi's Story", "Harvest Moon 64", - "Legend of Zelda: Ocarina of Time, The", - "Legend of Zelda: Majora's Mask, The", "Airboarder 64", - "Bakuretsu Muteki Bangaioh", "Choro-Q 64 II", "Custom Robo", - "Custom Robo V2", "Densha de Go! 64", "Doraemon: Mittsu no Seireiseki", - "Dezaemon 3D", "Transformers Beast Wars", - "Transformers Beast Wars Metals", "64 Trump Collection", "Bass Rush", - "ECW Hardcore Revolution", "40 Winks", "Aero Gauge", - "Aidyn Chronicles The First Mage", "Derby Stallion 64", - "Doraemon 2 - Hikari no Shinden", "Doraemon 3 - Nobi Dai No Machi SOS", - "F-1 World Grand Prix II", "Fushigi no Dungeon - Furai no Shiren 2", - "Heiwa Pachinko World 64", "Neon Genesis Evangelion", - "Racing Simulation", "Tsumi to Batsu", "Sonic Wings Assault", - "Virtual Pro Wrestling", "Virtual Pro Wrestling 2", "Wild Choppers" - }; - */ char *cartIDs[] = { - "DZ", "B6", "ZY", "ZZ", "AD", "AL", "B7", "BC", "BD", "BH", "BK", "BM", - "BV", "CC", "CH", "CK", "CR", "CT", "CU", "CW", "DL", "DO", "DP", "DQ", - "DU", "DY", "EA", "EP", "ER", "FH", "FU", "FW", "FX", "FZ", "GC", "GE", - "GV", "HA", "IC", "IJ", "JD", "JF", "JM", "K2", "K4", "KA", "KG", "KI", - "KJ", "KT", "LB", "LR", "M6", "M8", "MF", "MI", "ML", "MO", "MQ", "MR", - "MU", "MV", "MW", "MX", "N6", "NA", "NB", "NX", "OB", "P2", "P3", "PD", - "PF", "PG", "PH", "PN", "PO", "PS", "PW", "RC", "RE", "RI", "RS", "RZ", - "S6", "SA", "SC", "SM", "SQ", "SU", "SV", "SW", "T9", "TE", "TJ", "TM", - "TN", "TP", "VL", "VY", "W2", "W4", "WL", "WR", "WU", "WX", "XO", "YS", - "YW", "ZL", "ZS", "AB", "BN", "CG", "CX", "CZ", "D6", "DR", "DZ", "OH", - "TB", "TC", "VB", "WI", "4W", "AG", "AY", "DA", "D2", "3D", "F2", "SI", - "HP", "EV", "MG", "GU", "SA", "VP", "A2", "WC", "GF" + "DZ", "B6", "ZY", "ZZ", "AD", "AL", "B7", "BC", "BD", "BH", + "BK", "BM", "BV", "CC", "CH", "CK", "CR", "CT", "CU", "CW", + "DL", "DO", "DP", "DQ", "DU", "DY", "EA", "EP", "ER", "FH", + "FU", "FW", "FX", "FZ", "GC", "GE", "GV", "HA", "IC", "IJ", + "JD", "JF", "JM", "K2", "K4", "KA", "KG", "KI", "KJ", "KT", + "LB", "LR", "M6", "M8", "MF", "MI", "ML", "MO", "MQ", "MR", + "MU", "MV", "MW", "MX", "N6", "NA", "NB", "NX", "OB", "P2", + "P3", "PD", "PF", "PG", "PH", "PN", "PO", "PS", "PW", "RC", + "RE", "RI", "RS", "RZ", "S6", "SA", "SC", "SM", "SQ", "SU", + "SV", "SW", "T9", "TE", "TJ", "TM", "TN", "TP", "VL", "VY", + "W2", "W4", "WL", "WR", "WU", "WX", "XO", "YS", "YW", "ZL", + "ZS", "AB", "BN", "CG", "CX", "CZ", "D6", "DR", "DZ", "OH", + "TB", "TC", "VB", "WI", "4W", "AG", "AY", "DA", "D2", "3D", + "F2", "SI", "HP", "EV", "MG", "GU", "SA", "VP", "A2", "WC", + "GF" }; // Banjo-Tooie (B7) -> if not using Ultra CIC set to sram, because the crack converts ek16/eep (4) -> sram (1) int saveTypes[] = { - 2, 1, 5, 1, 3, 1, 4, 3, 3, 3, 3, 3, 3, 5, 3, 5, 3, 3, 3, 4, 5, 4, 4, 3, - 3, 3, 3, 4, 3, 3, 4, 3, 3, 1, 3, 3, 3, 3, 3, 3, 5, 5, 3, 3, 3, 3, 1, 3, - 5, 3, 3, 3, 5, 4, 1, 3, 3, 3, 5, 3, 3, 4, 3, 4, 3, 3, 4, 4, 1, 5, 5, 4, - 5, 3, 5, 5, 5, 5, 3, 3, 1, 1, 3, 4, 3, 3, 3, 3, 5, 3, 3, 3, 5, 1, 3, 3, - 3, 3, 3, 3, 1, 5, 3, 3, 3, 1, 3, 4, 1, 1, 5, 3, 3, 3, 3, 4, 1, 3, 1, 3, - 3, 3, 1, 1, 3, 3, 1, 1, 4, 4, 4, 5, 3, 4, 3, 3, 3, 1, 1, 3, 3 + 0x02, 0x01, 0x05, 0x01, 0x03, 0x01, 0x04, 0x03, 0x03, 0x03, + 0x03, 0x03, 0x03, 0x05, 0x03, 0x05, 0x03, 0x03, 0x03, 0x04, + 0x05, 0x04, 0x04, 0x03, 0x03, 0x03, 0x03, 0x04, 0x03, 0x03, + 0x04, 0x03, 0x03, 0x01, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, + 0x05, 0x05, 0x03, 0x03, 0x03, 0x03, 0x01, 0x03, 0x05, 0x03, + 0x03, 0x03, 0x05, 0x04, 0x01, 0x03, 0x03, 0x03, 0x05, 0x03, + 0x03, 0x04, 0x03, 0x04, 0x03, 0x03, 0x04, 0x04, 0x01, 0x05, + 0x05, 0x04, 0x05, 0x03, 0x05, 0x05, 0x05, 0x05, 0x03, 0x03, + 0x01, 0x01, 0x03, 0x04, 0x03, 0x03, 0x03, 0x03, 0x05, 0x03, + 0x03, 0x03, 0x05, 0x01, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, + 0x01, 0x05, 0x03, 0x03, 0x03, 0x01, 0x03, 0x04, 0x01, 0x01, + 0x05, 0x03, 0x03, 0x03, 0x03, 0x04, 0x01, 0x03, 0x01, 0x03, + 0x03, 0x03, 0x01, 0x01, 0x03, 0x03, 0x01, 0x01, 0x04, 0x04, + 0x04, 0x05, 0x03, 0x04, 0x03, 0x03, 0x03, 0x01, 0x01, 0x03, + 0x03 }; // Banjo-Tooie (B7) -> if not using Ultra CIC set to 2 instead of 5 int cicTypes[] = { - 2, 2, 2, 2, 2, 3, 5, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 2, 6, 5, 5, 5, 2, - 2, 3, 2, 2, 2, 2, 5, 2, 1, 6, 2, 2, 2, 2, 2, 2, 5, 5, 2, 2, 3, 2, 3, 2, - 3, 2, 2, 2, 2, 2, 2, 2, 5, 2, 3, 2, 2, 2, 2, 3, 2, 2, 3, 3, 2, 3, 3, 5, - 3, 2, 3, 2, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 6, 2, 5, 5, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 + 0x02, 0x02, 0x02, 0x02, 0x02, 0x03, 0x05, 0x02, 0x02, 0x02, + 0x03, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x06, + 0x05, 0x05, 0x05, 0x02, 0x02, 0x03, 0x02, 0x02, 0x02, 0x02, + 0x05, 0x02, 0x01, 0x06, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, + 0x05, 0x05, 0x02, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, + 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x05, 0x02, 0x03, 0x02, + 0x02, 0x02, 0x02, 0x03, 0x02, 0x02, 0x03, 0x03, 0x02, 0x03, + 0x03, 0x05, 0x03, 0x02, 0x03, 0x02, 0x03, 0x03, 0x02, 0x02, + 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, + 0x02, 0x02, 0x02, 0x03, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, + 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x06, 0x02, 0x05, + 0x05, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, + 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, + 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, + 0x02 }; // search for cartid @@ -176,7 +139,7 @@ int saveTypeToSize(int type) { switch(type) { case 0: return 0; break; case 1: return SAVE_SIZE_SRAM; break; - case 2: return SAVE_SIZE_SRAM128; break; + case 2: return SAVE_SIZE_SRAM96; break; case 3: return SAVE_SIZE_EEP4k; break; case 4: return SAVE_SIZE_EEP16k; break; case 5: return SAVE_SIZE_FLASH; break; @@ -187,7 +150,7 @@ int saveTypeToSize(int type) { /* #define SAVE_TYPE_OFF 0 #define SAVE_TYPE_SRAM 1 -#define SAVE_TYPE_SRAM128 2 +#define SAVE_TYPE_SRAM96 2 #define SAVE_TYPE_EEP4k 3 #define SAVE_TYPE_EEP16k 4 #define SAVE_TYPE_FLASH 5 @@ -201,7 +164,7 @@ int getSaveFromCart(int stype, uint8_t *buffer) { switch(stype) { case 0: return 0; case 1: ret = getSRAM32(buffer); break; - case 2: ret = getSRAM128(buffer); break; + case 2: ret = getSRAM96(buffer); break; case 3: ret = getEeprom4k(buffer); break; case 4: ret = getEeprom16k(buffer); break; case 5: ret = getFlashRAM(buffer); break; @@ -219,7 +182,7 @@ int pushSaveToCart(int stype, uint8_t *buffer){ switch(stype) { case 0: return 0; case 1: ret = setSRAM32(buffer); break; - case 2: ret = setSRAM128(buffer); break; + case 2: ret = setSRAM96(buffer); break; case 3: ret = setEeprom4k(buffer); break; case 4: ret = setEeprom16k(buffer); break; case 5: ret = setFlashRAM(buffer); break; @@ -264,8 +227,8 @@ int getSRAM32( uint8_t *buffer) { } //TODO: is this now 96k? -int getSRAM128( uint8_t *buffer) { - return getSRAM(buffer, SAVE_SIZE_SRAM128); +int getSRAM96( uint8_t *buffer) { + return getSRAM(buffer, SAVE_SIZE_SRAM96); } @@ -292,11 +255,11 @@ int getEeprom16k( uint8_t *buffer){ } int getFlashRAM( uint8_t *buffer){ - evd_setSaveType(SAVE_TYPE_SRAM128); //2 + evd_setSaveType(SAVE_TYPE_SRAM96); //2 sleep(10); - int s = getSRAM(buffer, SAVE_SIZE_SRAM128); - data_cache_hit_writeback_invalidate(buffer,SAVE_SIZE_SRAM128); + int s = getSRAM(buffer, SAVE_SIZE_SRAM96); + data_cache_hit_writeback_invalidate(buffer,SAVE_SIZE_SRAM96); sleep(10); evd_setSaveType(SAVE_TYPE_FLASH); //5 @@ -334,8 +297,8 @@ int setSRAM32( uint8_t *buffer){ return setSRAM(buffer, SAVE_SIZE_SRAM); } -int setSRAM128( uint8_t *buffer){ - return setSRAM(buffer, SAVE_SIZE_SRAM128); +int setSRAM96( uint8_t *buffer){ + return setSRAM(buffer, SAVE_SIZE_SRAM96); } @@ -364,10 +327,10 @@ int setEeprom16k(uint8_t *buffer){ //isn't working nor finished int setFlashRAM(uint8_t *buffer){ - evd_setSaveType(SAVE_TYPE_SRAM128); //2 + evd_setSaveType(SAVE_TYPE_SRAM96); //2 sleep(10); - int s = setSRAM(buffer, SAVE_SIZE_SRAM128); + int s = setSRAM(buffer, SAVE_SIZE_SRAM96); evd_setSaveType(SAVE_TYPE_FLASH); //5