diff --git a/src/drivers/libretro/libretro.c b/src/drivers/libretro/libretro.c index 18f8159..ab761f9 100644 --- a/src/drivers/libretro/libretro.c +++ b/src/drivers/libretro/libretro.c @@ -832,11 +832,272 @@ input_cheat: FCEUI_AddCheat(name, a, v, c, type); } +typedef struct cartridge_db +{ + char title[256]; + uint32_t crc; +} cartridge_db_t; + +static const struct cartridge_db fourscore_db_list[] = +{ + { + "Bomberman II (USA)", + 0x1ebb5b42 + }, +#if 0 + { + "Championship Bowling (USA)", + 0xeac38105 + }, +#endif + { + "Chris Evert & Ivan Lendl in Top Players' Tennis (USA)", + 0xf99e37eb + }, +#if 0 + { + "Crash 'n' the Boys - Street Challenge (USA)", + 0xc7f0c457 + }, +#endif + { + "Four Players' Tennis (Europe)", + 0x48b8ee58 + }, + { + "Danny Sullivan's Indy Heat (Europe)", + 0x27ca0679, + }, + { + "Gauntlet II (Europe)", + 0x79f688bc + }, + { + "Gauntlet II (USA)", + 0x1b71ccdb + }, + { + "Greg Norman's Golf Power (USA)", + 0x1352f1b9 + }, + { + "Harlem Globetrotters (USA)", + 0x2e6ee98d + }, + { + "Ivan 'Ironman' Stewart's Super Off Road (Europe)", + 0x05104517 + }, + { + "Ivan 'Ironman' Stewart's Super Off Road (USA)", + 0x4b041b6b + }, + { + "Kings of the Beach - Professional Beach Volleyball (USA)", + 0xf54b34bd + }, + { + "Magic Johnson's Fast Break (USA)", + 0xc6c2edb5 + }, + { + "M.U.L.E. (USA)", + 0x0939852f + }, + { + "Monster Truck Rally (USA)", + 0x2f698c4d + }, + { + "NES Play Action Football (USA)", + 0xb9b4d9e0 + }, + { + "Nightmare on Elm Street, A (USA)", + 0xda2cb59a + }, + { + "Nintendo World Cup (Europe)", + 0x8da6667d + }, + { + "Nintendo World Cup (Europe) (Rev A)", + 0x7c16f819 + }, + { + "Nintendo World Cup (Europe) (Rev B)", + 0x7f08d0d9 + }, + { + "Nintendo World Cup (USA)", + 0xa22657fa + }, + { + "R.C. Pro-Am II (Europe)", + 0x308da987 + }, + { + "R.C. Pro-Am II (USA)", + 0x9edd2159 + }, + { + "Rackets & Rivals (Europe)", + 0x8fa6e92c + }, + { + "Roundball - 2-on-2 Challenge (Europe)", + 0xad0394f0 + }, + { + "Roundball - 2-on-2 Challenge (USA)", + 0x6e4dcfd2 + }, + { + "Spot - The Video Game (Japan)", + 0x0abdd5ca + }, + { + "Spot - The Video Game (USA)", + 0xcfae9dfa + }, + { + "Smash T.V. (Europe)", + 0x0b8f8128 + }, + { + "Smash T.V. (USA)", + 0x6ee94d32 + }, + { + "Super Jeopardy! (USA)", + 0xcf4487a2 + }, + { + "Super Spike V'Ball (Europe)", + 0xc05a63b2 + }, + { + "Super Spike V'Ball (USA)", + 0xe840fd21 + }, + { + "Super Spike V'Ball + Nintendo World Cup (USA)", + 0x407d6ffd + }, + { + "Swords and Serpents (Europe)", + 0xd153caf6 + }, + { + "Swords and Serpents (France)", + 0x46135141 + }, + { + "Swords and Serpents (USA)", + 0x3417ec46 + }, + { + "Battle City (Japan) (4 Players Hack) http://www.romhacking.net/hacks/2142/", + 0x69977c9e + }, + { + "Bomberman 3 (Homebrew) http://tempect.de/senil/games.html", + 0x2da5ece0 + }, + { + "K.Y.F.F. (Homebrew) http://slydogstudios.org/index.php/k-y-f-f/", + 0x90d2e9f0 + }, + { + "Super PakPak (Homebrew) http://wiki.nesdev.com/w/index.php/Super_PakPak", + 0x1394ded0 + }, + { + "Super Mario Bros. + Tetris + Nintendo World Cup (Europe)", + 0x73298c87 + }, + { + "Super Mario Bros. + Tetris + Nintendo World Cup (Europe) (Rev A)", + 0xf46ef39a + } +}; + +static const struct cartridge_db famicom_4p_db_list[] = +{ + { + "Bakutoushi Patton-Kun (Japan) (FDS)", + 0xc39b3bb2 + }, + { + "Bomber Man II (Japan)", + 0x0c401790 + }, + { + "Championship Bowling (Japan)", + 0x9992f445 + }, + { + "Downtown - Nekketsu Koushinkyoku - Soreyuke Daiundoukai (Japan)", + 0x3e470fe0 + }, + { + "Ike Ike! Nekketsu Hockey-bu - Subette Koronde Dairantou (Japan)", + 0x4f032933 + }, + { + "Kunio-kun no Nekketsu Soccer League (Japan)", + 0x4b5177e9 + }, + { + "Moero TwinBee - Cinnamon Hakase o Sukue! (Japan)", + 0x9f03b11f + }, + { + "Moero TwinBee - Cinnamon Hakase wo Sukue! (Japan) (FDS)", + 0x13205221 + }, + { + "Nekketsu Kakutou Densetsu (Japan)", + 0x37e24797 + }, + { + "Nekketsu Koukou Dodgeball-bu (Japan)", + 0x62c67984 + }, + { + "Nekketsu! Street Basket - Ganbare Dunk Heroes (Japan)", + 0x88062d9a + }, + { + "Super Dodge Ball (USA) (3-4p with Game Genie code GEUOLZZA)", + 0x689971f9 + }, + { + "Super Dodge Ball (USA) (patched) http://www.romhacking.net/hacks/71/", + 0x4ff17864 + }, + { + "U.S. Championship V'Ball (Japan)", + 0x213cb3fb + }, + { + "U.S. Championship V'Ball (Japan) (Beta)", + 0xd7077d96 + }, + { + "Wit's (Japan)", + 0xb1b16b8a + } +}; + extern uint32_t iNESGameCRC32; bool retro_load_game(const struct retro_game_info *game) { + unsigned i; char* dir=NULL; + size_t fourscore_len = sizeof(fourscore_db_list) / sizeof(fourscore_db_list[0]); + size_t famicom_4p_len = sizeof(famicom_4p_db_list) / sizeof(famicom_4p_db_list[0]); struct retro_input_descriptor desc[] = { { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_LEFT, "D-Pad Left" }, @@ -903,6 +1164,26 @@ bool retro_load_game(const struct retro_game_info *game) if (!environ_cb(RETRO_ENVIRONMENT_GET_OVERSCAN, &use_overscan)) use_overscan = true; + FCEUI_DisableFourScore(1); + + for (i = 0; i < fourscore_len; i++) + { + if (fourscore_db_list[i].crc == iNESGameCRC32) + { + FCEUI_DisableFourScore(0); + break; + } + } + + for (i = 0; i < famicom_4p_len; i++) + { + if (famicom_4p_db_list[i].crc == iNESGameCRC32) + { + FCEUI_SetInputFC(SIFC_4PLAYER, &JSReturn[0], 0); + break; + } + } + return true; }