From f0bacff91a458f1bf8f87891b7c1c346fd74bba8 Mon Sep 17 00:00:00 2001 From: David Guillen Fandos Date: Thu, 14 Sep 2023 21:46:57 +0200 Subject: [PATCH] Remove gpsp savegame method in favour of libretro's one This generates 128KB save files (instead of variable sized ones) to prevent truncated savegames under some circumstances. Most other emulators have no trouble loading them (and the unused data is simply ignored). Remove also config txt file that's now unused. --- game_config.txt | 1143 ------------------------------------------- gba_memory.c | 132 +---- gba_memory.h | 3 - libretro/libretro.c | 69 +-- main.c | 1 - main.h | 1 - 6 files changed, 9 insertions(+), 1340 deletions(-) delete mode 100644 game_config.txt diff --git a/game_config.txt b/game_config.txt deleted file mode 100644 index 7c8cea4..0000000 --- a/game_config.txt +++ /dev/null @@ -1,1143 +0,0 @@ -# gpSP game settings database - -# What is this file??? game_config.txt is a database of settings on a -# per-game basis. A couple of the settings are required to make games -# work at all, but most of them are there to improve the performance of -# a game. If a game doesn't work then look through the settings here, -# but keep in mind that this file can not be used to fix a majority of -# games, the ones that don't work because of emulator bugs. For those -# you'll have to wait for a new release and hope it someday gets fixed. - -# This file is meant to be edited in plain text, with a normal editor. -# game_name, game_code, and vender_code can be found in the game's header. -# All three must match for the game to be used, and those setting must be -# in that order. Be sure to use [!] ROMs (verified by GoodGBA) when -# building this list. Right now I don't know how much overlap there is -# between different region games, but usually idle loops don't apply to -# them. If you're using a different region than the one in here you can -# try copying the entry, it might improve it. - -# You can also find the three identifying codes on the second line from -# the top in gpSP's main menu. So anyone should be able to add settings -# to this file if they know what to set, but for some options it'll take -# a lot of special knowledge for them to be of any use. Be sure to see if -# your game is already here, but only if the game_name/game_code/ -# vender_code all match. Only the first full match's settings will be used. - -# Everything here is case sensitive. Don't mess with this file unless -# you know what you're doing - if in doubt sooner ask someone who does. - -# I mainly focus on USA versions, so try those first. And, just because -# a game is on here doesn't mean the game actually works in the current -# version. :/ - -# These are the following options: - -# idle_loop_eliminate_target - tells the recompiler that this branch -# is an idle loop and thus a hardware update should follow it every -# time. This is purely a speed improvement and is not meant to improve -# compatibility - if it does it represents a strange timing problem in -# the game. You can only set one of these for now. Don't use this if -# you don't know what you're doing, it can break the game. Some games -# will run miserably slowly without this option. - -# translation_gate_target - tells the recompiler to put an indirect -# branch (gate) at this point, so artificially stop the current block. -# This is useful if the game performs self modifying code from within -# the same block it is currently executing - this can prevent it from -# causing SMC hits far more times than it should. This is also only a -# speed hack; you can have up to 8 of these. Don't use this if you don't -# know what you're doing, they'll just make the game slower and are -# rarely helpful (good for Camelot games). - -# iwram_stack_optimize - set this to "no" to turn it off. By default this -# is set on. It will turn off an optimization that assumes that the stack -# is always in IWRAM, and thus makes ldm/stm relative to the stack much -# faster. Turning it off will degrade game speed slightly, but is -# necessary for a few games that don't follow this convention. - -# flash_rom_type - set this to 128KB if the game has a 128KB flash ROM, -# otherwise leave it alone or you might break game saving. If you get -# a white screen when the game starts try this option. - -# bios_rom_hack_39 - a hack that allows "roll" to work with the correct BIOS -# in Zelda: Minish Cap. - -# bios_rom_hack_2C - like the above but allows Rayman Advance to work. - -# [!] - covered in gbaover - -# 007 - Nightfire (U) [!] -game_name = NIGHTFIRE -game_code = A7OE -vender_code = 69 -idle_loop_eliminate_target = 080031d6 - -# Advance Wars (E) [!] -# This one was really annoying to find, I hope it's okay.. there -# might be a better one somewhere. -game_name = ADVANCEWARSP -game_code = AWRP -vender_code = 01 -idle_loop_eliminate_target = 0803880a - -# Advance Wars (U) [!] -# This one was really annoying to find, I hope it's okay.. there -# might be a better one somewhere. -game_name = ADVANCEWARS -game_code = AWRE -vender_code = 01 -idle_loop_eliminate_target = 0803880a - -# Advance Wars 2 - Black Hole Rising (E) [!] -game_name = ADVANCEWARS2 -game_code = AW2P -vender_code = 01 -idle_loop_eliminate_target = 080371be - -# Advance Wars 2: Black Hole Rising (U) [!] -game_name = ADVANCEWARS2 -game_code = AW2E -vender_code = 01 -idle_loop_eliminate_target = 08036e2a - -# Animal Yokochou Dokidoki Shinkyuu Shiken (J) [!] -game_name = ANIYOKO2 -game_code = BAXJ -vender_code = A4 -iwram_stack_optimize = no - -# This is needed to make the game work. -# Another World (Homebrew) [!] -game_name = FoxAnWorld -game_code = Home -vender_code = 00 -translation_gate_target = 03000f1c - -# Asterix & Obelix XXL (E) [!] -game_name = ASTERIX -game_code = BLXP -vender_code = 70 -idle_loop_eliminate_target = 0846d060 - -# Battle Network RockMan EXE (J) [!] -game_name = ROCKMAN_EXE -game_code = AREJ -vender_code = 08 -idle_loop_eliminate_target = 08000338 - -# Bleach Advance (J) [!] -game_name = BLEACH ADV1 -game_code = BLEJ -vender_code = 8P -iwram_stack_optimize = no - -# Bomberman Tournament (U) [!] -game_name = BOMSTORYUSA -game_code = ABSE -vender_code = 52 -idle_loop_eliminate_target = 08000526 - -# Bookworm (U) [!] -game_name = BOOKWORM -game_code = BKWE -vender_code = 5G -idle_loop_eliminate_target = 0800397c - -# Broken Sword - The Shadow of the Templars (U) [!] -game_name = BROKENSWORD -game_code = ABJE -vender_code = 6L -idle_loop_eliminate_target = 08000a26 - -# Castlevania: Circle of the Moon (E) [!] -game_name = DRACULA AGB1 -game_code = AAMP -vender_code = A4 -idle_loop_eliminate_target = 080003d2 - -# Castlevania: Circle of the Moon (U) [!] -game_name = DRACULA AGB1 -game_code = AAME -vender_code = A4 -idle_loop_eliminate_target = 080003d2 - -# Defender of The Crown (U) [!] -game_name = DOTC -game_code = ADHE -vender_code = 5N -idle_loop_eliminate_target = 080007ec - -# Disney's Aladdin (J) [!] -game_name = ALADDIN -game_code = AJ6J -vender_code = 08 -iwram_stack_optimize = no - -# Disney's Aladdin (E) [!] -game_name = ALADDIN -game_code = BADP -vender_code = 08 -iwram_stack_optimize = no - -# Disney's Aladdin (U) [!] -game_name = ALADDIN -game_code = BADE -vender_code = 08 -iwram_stack_optimize = no - -# Drill Dozer (U) [!] -game_name = DRILL DOZER -game_code = V49E -vender_code = 01 -idle_loop_eliminate_target = 080006c2 - -# Doom 2 (U) [!] -game_name = DOOM II -game_code = A9DE -vender_code = 52 -translation_gate_target = 030041c8 -translation_gate_target = 03004fa0 - -# Digimon Battle Spirit (U) [!] -game_name = DIGIMON BTSP -game_code = A8SE -vender_code = B2 -idle_loop_eliminate_target = 08011208 - -# Digimon Battle Spirit 2 (U) [!] -game_name = DIGIMON BS2 -game_code = BDSE -vender_code = B2 -idle_loop_eliminate_target = 08010eb0 - -# Donald Duck Advance (U) [!] -game_name = DISNEY'S DON -game_code = ADKE -vender_code = 41 -idle_loop_eliminate_target = 08002f30 - -# Kirby: Nightmare in Dreamland (U) [!] -game_name = AGB KIRBY DX -game_code = A7KE -vender_code = 01 -idle_loop_eliminate_target = 08000fae -iwram_stack_optimize = no - -# Hoshi no Kirby: Yume no Izumi Deluxe (J) [!] -game_name = AGB KIRBY DX -game_code = A7KJ -vender_code = 01 -idle_loop_eliminate_target = 08000f92 -iwram_stack_optimize = no - -# Kirby: Nightmare in Dreamland (E) [!] -game_name = AGB KIRBY DX -game_code = A7KP -vender_code = 01 -idle_loop_eliminate_target = 08000fae -iwram_stack_optimize = no - -# F-Zero for Game Boy Advance (J) [!] -game_name = F-ZERO ADVAN -game_code = AFZJ -vender_code = 01 -idle_loop_eliminate_target = 08000c2e - -# F-Zero - Maximum Velocity (U) [!] -game_name = F-ZERO ADVAN -game_code = AFZE -vender_code = 01 -idle_loop_eliminate_target = 08000c2e - -# F-Zero: Climax (J) [!] -game_name = F-ZEROCLIMAX -game_code = BFTJ -vender_code = 01 -flash_rom_type = 128KB - -# Final Fantasy Tactics Advance (U) [!] -game_name = FFTA_USVER. -game_code = AFXE -vender_code = 01 -idle_loop_eliminate_target = 0800041e - -# Game Boy Wars Advance 1+2 (J) [!] -game_name = GBWARS1+2 -game_code = BGWJ -vender_code = 01 -flash_rom_type = 128KB - -# Gradius Galaxies (U) [!] -# Badly coded game with several idle loops. This one works for level -# one at least. -game_name = GRADIUSGALAX -game_code = AGAE -vender_code = A4 -idle_loop_eliminate_target = 08013844 - -# Golden Sun (U) [!] -game_name = Golden_Sun_A -game_code = AGSE -vender_code = 01 -translation_gate_target = 03000820 -translation_gate_target = 030009ac -translation_gate_target = 03007dac - -# Golden Sun: The Lost Age (U) [!] -# Probably the most horrifically coded GBA game in existence. -game_name = GOLDEN_SUN_B -game_code = AGFE -vender_code = 01 -idle_loop_eliminate_target = 08013542 -translation_gate_target = 030009ac -#translation_gate_target = 03007d70 - -# Mario & Luigi: Superstar Saga (U) -game_name = MARIO&LUIGIU -game_code = A88E -vender_code = 01 - -# Mario Party Advance (U) [!] -game_name = MARIOPARTYUS -game_code = B8ME -vender_code = 01 -iwram_stack_optimize = no - -# Mario Party Advance (J) [!] -game_name = MARIOPARTYJA -game_code = B8MJ -vender_code = 01 -iwram_stack_optimize = no - -# Mario Party Advance (E) [!] -game_name = MARIOPARTYEU -game_code = B8MP -vender_code = 01 -iwram_stack_optimize = no - -# Mario Golf: Advance Tour (U) [!] -game_name = MARIOGOLFGBA -game_code = BMGE -vender_code = 01 -iwram_stack_optimize = no -idle_loop_eliminate_target = 08014e0a -translation_gate_target = 03000d00 -translation_gate_target = 03000a30 - -# Mario Golf: GBA Tour (J) [!] -game_name = MARIOGOLFGBA -game_code = BMGJ -vender_code = 01 -iwram_stack_optimize = no -idle_loop_eliminate_target = 08014e0a -translation_gate_target = 03000d00 -translation_gate_target = 03000a30 - -# Mario Golf: Advance Tour (E) [!] -game_name = MARIOGOLFGBA -game_code = BMGP -vender_code = 01 -iwram_stack_optimize = no -idle_loop_eliminate_target = 08014e0a -translation_gate_target = 03000d00 -translation_gate_target = 03000a30 - -# Mario Golf: Advance Tour (S) [!] -game_name = MARIOGOLFGBA -game_code = BMGS -vender_code = 01 -iwram_stack_optimize = no -idle_loop_eliminate_target = 08014e0a -translation_gate_target = 03000d00 -translation_gate_target = 03000a30 - -# Mario Golf: Advance Tour (F) [!] -game_name = MARIOGOLFGBA -game_code = BMGF -vender_code = 01 -iwram_stack_optimize = no -idle_loop_eliminate_target = 08014e0a -translation_gate_target = 03000d00 -translation_gate_target = 03000a30 - -# Mario Golf: Advance Tour (I) [!] -game_name = MARIOGOLFGBA -game_code = BMGI -vender_code = 01 -iwram_stack_optimize = no -idle_loop_eliminate_target = 08014e0a -translation_gate_target = 03000d00 -translation_gate_target = 03000a30 - -# Mario Golf: Advance Tour (G) [!] -game_name = MARIOGOLFGBA -game_code = BMGD -vender_code = 01 -iwram_stack_optimize = no -idle_loop_eliminate_target = 08014e0a -translation_gate_target = 03000d00 -translation_gate_target = 03000a30 - -# Mario Golf: Advance Tour (A) [!] -game_name = MARIOGOLFGBA -game_code = BMGU -vender_code = 01 -iwram_stack_optimize = no -idle_loop_eliminate_target = 08014e0a -translation_gate_target = 03000d00 -translation_gate_target = 03000a30 - -# Mario Vs Donkey Kong (U) [!] -game_name = MARIOVSDK -game_code = BM5E -vender_code = 01 -idle_loop_eliminate_target = 08033eec - -# Megaman Battle Network (E) [!] -game_name = MEGAMANEXEBN -game_code = AREP -vender_code = 08 -idle_loop_eliminate_target = 08000338 - -# Megaman Battle Network (U) [!] -game_name = MEGAMAN_BN -game_code = AREE -vender_code = 08 -idle_loop_eliminate_target = 08000338 - - -# Megaman Battle Network 2 (U) [!] -game_name = MEGAMAN_EXE2 -game_code = AE2E -vender_code = 08 -idle_loop_eliminate_target = 08000358 - -# Megaman Battle Network 3 White (U) [!] -game_name = MEGA_EXE3_WH -game_code = A6BE -vender_code = 08 -idle_loop_eliminate_target = 0800036c - -# Megaman Battle Network 3 Blue (U) [!] -game_name = MEGA_EXE3_BL -game_code = A3XE -vender_code = 08 -idle_loop_eliminate_target = 0800036c - -# Megaman Battle Network 4 Red Sun (U) [!] -game_name = MEGAMANBN4RS -game_code = B4WE -vender_code = 08 -idle_loop_eliminate_target = 080003a6 - -# Megaman Battle Network 4 Blue Moon (U) [!] -game_name = MEGAMANBN4BM -game_code = B4BE -vender_code = 08 -idle_loop_eliminate_target = 080003a6 - -# Megaman Battle Network 5 Team Protoman (U) [!] -game_name = MEGAMAN5_TP_ -game_code = BRBE -vender_code = 08 -idle_loop_eliminate_target = 080003ca - -# Megaman Battle Network 5 Team Colonel (U) [!] -game_name = MEGAMAN5_TC_ -game_code = BRKE -vender_code = 08 -idle_loop_eliminate_target = 080003ca - -# Megaman Battle Network 6 Cybeast Gregar (U) [!] -game_name = MEGAMAN6_GXX -game_code = BR5E -vender_code = 08 -idle_loop_eliminate_target = 080003da - -# Megaman Zero (U/E) [!] -game_name = MEGAMAN ZERO -game_code = AZCE -vender_code = 08 -idle_loop_eliminate_target = 080004ee - -# Megaman Zero 2 (U) [!] -game_name = MEGAMANZERO2 -game_code = A62E -vender_code = 08 -idle_loop_eliminate_target = 08000664 - -# Megaman Zero 3 (U) [!] -game_name = MEGAMANZERO3 -game_code = BZ3E -vender_code = 08 -idle_loop_eliminate_target = 08001a08 - -# Megaman Zero 4 (U) [!] -game_name = MEGAMANZERO4 -game_code = B4ZP -vender_code = 08 -idle_loop_eliminate_target = 0800090c - -# Momotarou Densetsu G - Gold Deck wo Tsukure! (J) [!] -game_name = MOMOTETSU-G -game_code = BM2J -vender_code = 18 -iwram_stack_optimize = no - -# Magical Houshin (J) [!] -game_name = M HOUSHIN -game_code = AJOJ -vender_code = C8 -iwram_stack_optimize = no - -# Medal of Honor (J) [!] -game_name = INFILTRATOR -game_code = BMHJ -vender_code = 13 -iwram_stack_optimize = no - -# Metal Slug Advance (U) [!] -game_name = METAL SLUG -game_code = BSME -vender_code = B7 -idle_loop_eliminate_target = 08000298 - -# Magical Quest 2 Starring Mickey & Minnie (U) [!] -game_name = M&M MAGICAL2 -game_code = AQME -vender_code = 08 -idle_loop_eliminate_target = 0801d340 - -# Magical Quest 3 Starring Mickey & Donald (U) [!] -game_name = M&D MAGICAL3 -game_code = BMQE -vender_code = 08 -idle_loop_eliminate_target = 08016064 - -# Tales of Phantasia (U) [!] -game_name = PHANTASIA -game_code = AN8E -vender_code = 01 -iwram_stack_optimize = no - -# Tales of Phantasia (J) [!] -game_name = PHANTASIA -game_code = AN8J -vender_code = AF -iwram_stack_optimize = no - -# Tales of Phantasia (E) [!] -game_name = PHANTASIA -game_code = AN8P -vender_code = 01 -iwram_stack_optimize = no - -# Tom Clancy's Splinter Cell (U) [!] -game_name = SPLINTERCELL -game_code = AO4E -vender_code = 41 -idle_loop_eliminate_target = 0807a0c4 - -# Tom Clancy's Splinter Cell - Pandora Tomorrow (U) [!] -game_name = TOM CLANCY'S -game_code = BSLE -vender_code = 41 -idle_loop_eliminate_target = 0807785e - -# The Pinball of The Dead [!] -game_name = PINBALL DEAD -game_code = APDE -vender_code = 78 -idle_loop_eliminate_target = 08000300 - -# Tringo (U) [!] -game_name = TRINGO -game_code = BTJE -vender_code = 4Z -idle_loop_eliminate_target = 080009a4 - -# Tottoko Hamutaro Hamuhamu Sports (JU) [!] -game_name = HAMSPORTS -game_code = B85A -vender_code = 01 -iwram_stack_optimize = no - -# Pinball Challenge Deluxe (E) [!] -game_name = PINBALL CHAL -game_code = APLP -vender_code = 41 -idle_loop_eliminate_target = 080075a6 - -# Prince of Persia - The Sands of Time (U) [!] -game_name = PRINCEPERSIA -game_code = BPYE -vender_code = 41 -idle_loop_eliminate_target = 0808ff3a - -# Pokemon Emerald (E/U) [!] -# I don't know why this has an idle loop when Ruby doesn't.... -game_name = POKEMON EMER -game_code = BPEE -vender_code = 01 -idle_loop_eliminate_target = 080008ce -flash_rom_type = 128KB - -# Pokemon Emerald (J) [!] -game_name = POKEMON EMER -game_code = BPEJ -vender_code = 01 -idle_loop_eliminate_target = 080008ce -flash_rom_type = 128KB - -# Pokemon Emerald (G) [!] -game_name = POKEMON EMER -game_code = BPED -vender_code = 01 -idle_loop_eliminate_target = 080008ce -flash_rom_type = 128KB - -# Pokemon Emerald (F) [!] -game_name = POKEMON EMER -game_code = BPEF -vender_code = 01 -idle_loop_eliminate_target = 080008ce -flash_rom_type = 128KB - -# Pokemon Emerald (S) [!] -game_name = POKEMON EMER -game_code = BPES -vender_code = 01 -idle_loop_eliminate_target = 080008ce -flash_rom_type = 128KB - -# Pokemon Emerald (I) [!] -game_name = POKEMON EMER -game_code = BPEI -vender_code = 01 -idle_loop_eliminate_target = 080008ce -flash_rom_type = 128KB - -# Pokemon Sapphire (U) [!] -game_name = POKEMON SAPP -game_code = AXPE -vender_code = 01 -flash_rom_type = 128KB - -# Pokemon Sapphire (J) [!] -game_name = POKEMON SAPP -game_code = AXPJ -vender_code = 01 -flash_rom_type = 128KB - -# Pokemon Sapphire (G) [!] -game_name = POKEMON SAPP -game_code = AXPD -vender_code = 01 -flash_rom_type = 128KB - -# Pokemon Sapphire (I) [!] -game_name = POKEMON SAPP -game_code = AXPI -vender_code = 01 -flash_rom_type = 128KB - -# Pokemon Sapphire (S) [!] -game_name = POKEMON SAPP -game_code = AXPS -vender_code = 01 -flash_rom_type = 128KB - -# Pokemon Sapphire (F) [!] -game_name = POKEMON SAPP -game_code = AXPF -vender_code = 01 -flash_rom_type = 128KB - -# Pokemon Ruby (U) [!] -game_name = POKEMON RUBY -game_code = AXVE -vender_code = 01 -flash_rom_type = 128KB - -# Pokemon Ruby (J) [!] -game_name = POKEMON RUBY -game_code = AXVJ -vender_code = 01 -flash_rom_type = 128KB - -# Pokemon Ruby (G) [!] -game_name = POKEMON RUBY -game_code = AXVD -vender_code = 01 -flash_rom_type = 128KB - -# Pokemon Ruby (I) [!] -game_name = POKEMON RUBY -game_code = AXVI -vender_code = 01 -flash_rom_type = 128KB - -# Pokemon Ruby (S) [!] -game_name = POKEMON RUBY -game_code = AXVS -vender_code = 01 -flash_rom_type = 128KB - -# Pokemon Ruby (F) [!] -game_name = POKEMON RUBY -game_code = AXVF -vender_code = 01 -flash_rom_type = 128KB - -# Pokemon: Fire Red (J) [!] -game_name = POKEMON FIRE -game_code = BPRJ -vender_code = 01 -idle_loop_eliminate_target = 080008b2 -flash_rom_type = 128KB - -# Pokemon: Fire Red (E/U) [!] -game_name = POKEMON FIRE -game_code = BPRE -vender_code = 01 -idle_loop_eliminate_target = 080008c6 -flash_rom_type = 128KB - -# Pokemon: Fire Red (S) [!} -game_name = POKEMON FIRE -game_code = BPRS -vender_code = 01 -idle_loop_eliminate_target = 080008c6 -flash_rom_type = 128KB - -# Pokemon: Fire Red (G) [!] -game_name = POKEMON FIRE -game_code = BPRD -vender_code = 01 -idle_loop_eliminate_target = 080008c6 -flash_rom_type = 128KB - -# Pokemon: Fire Red (I) [!] -game_name = POKEMON FIRE -game_code = BPRI -vender_code = 01 -idle_loop_eliminate_target = 080008c6 -flash_rom_type = 128KB - -# Pokemon: Fire Red (F) [!] -game_name = POKEMON FIRE -game_code = BPRE -vender_code = 01 -idle_loop_eliminate_target = 080008c6 -flash_rom_type = 128KB - -# Pokemon: Leaf Green (E/U) [!] -# Hey, this one is the same as Fire Red, who'd have thought? :B -game_name = POKEMON LEAF -game_code = BPGE -vender_code = 01 -idle_loop_eliminate_target = 080008b2 -flash_rom_type = 128KB - -# Pokemon: Leaf Green (S) [!] -game_name = POKEMON LEAF -game_code = BPGS -vender_code = 01 -idle_loop_eliminate_target = 080008b6 -flash_rom_type = 128KB - -# Pokemon: Leaf Green (G) [!] -game_name = POKEMON LEAF -game_code = BPGD -vender_code = 01 -idle_loop_eliminate_target = 080008b6 -flash_rom_type = 128KB - -# Pokemon: Leaf Green (I) [!] -game_name = POKEMON LEAF -game_code = BPGI -vender_code = 01 -idle_loop_eliminate_target = 080008b6 -flash_rom_type = 128KB - -# Pokemon: Leaf Green (F) [!] -game_name = POKEMON LEAF -game_code = BPGF -vender_code = 01 -idle_loop_eliminate_target = 080008b6 -flash_rom_type = 128KB - -# Pokemon: Fushigi no Dungeon Aka no Kyuujotai (J) [!] -game_name = POKE DUNGEON -game_code = B24J -vender_code = 01 -flash_rom_type = 128KB - -# Pokemon: Red Rescue Team (U) [!] -game_name = POKE DUNGEON -game_code = B24E -vender_code = 01 -flash_rom_type = 128KB - -# Pokemon: Red Rescue Team (E) [!] -game_name = POKE DUNGEON -game_code = B24P -vender_code = 01 -flash_rom_type = 128KB - -# Pokemon Leaf Green (J) [!] -game_name = POKEMON LEAF -game_code = BPGJ -vender_code = 01 -flash_rom_type = 128KB - -# Rockman Zero (J) [!] -game_name = ROCKMAN ZERO -game_code = ARZJ -vender_code = 08 -idle_loop_eliminate_target = 080004ee - -# Rebelstar: Tactical Command (U) [!] -# Badly coded game with several idle loops. I don't think any are -# even close to dominant, and it jumps around too much when things -# matter.... -game_name = REBELSTAR -game_code = BRLE -vender_code = AF -idle_loop_eliminate_target = 0800041a - -# Rhythm Tengoku (J) [!] -game_name = RHYTHMTENGOK -game_code = BRIJ -vender_code = 01 -idle_loop_eliminate_target = 080013d4 - -# River City Ransom EX (J) [!] -game_name = DOWNTOWN -game_code = BDTJ -vender_code = EB -idle_loop_eliminate_target = 0800065a - -# River City Ransom EX (U) [!] -game_name = RIVERCRANSOM -game_code = BDTE -vender_code = EB -idle_loop_eliminate_target = 0800065a - -# Super Mario Advance (Demo/Kiosk) (U) [!] -game_name = SUPER MARIOA -game_code = AMZE -vender_code = 01 -idle_loop_eliminate_target = 08001cf2 - -# Super Mario Advance (E/U) [!] -game_name = SUPER MARIOA -game_code = AMAE -vender_code = 01 -idle_loop_eliminate_target = 08001cf2 - -# Super Mario Advance 2 (E) [!] -game_name = SUPER MARIOB -game_code = AA2P -vender_code = 01 -idle_loop_eliminate_target = 08000534 - -# Super Mario Advance 2 (U) [!] -game_name = SUPER MARIOB -game_code = AA2E -vender_code = 01 -idle_loop_eliminate_target = 08000534 - -# Super Mario Advance 3 (J) [!] -game_name = SUPER MARIOC -game_code = A3AJ -vender_code = 01 -idle_loop_eliminate_target = 08002ba4 - -# Super Mario Advance 3 (U) [!] -game_name = SUPER MARIOC -game_code = A3AE -vender_code = 01 -idle_loop_eliminate_target = 08002ba4 - -# Super Mario Advance 4 (U) [!] -game_name = SUPER MARIOD -game_code = AX4E -vender_code = 01 -idle_loop_eliminate_target = 08000732 -flash_rom_type = 128KB - -# Super Mario Advance 4 (J) [!] -game_name = SUPER MARIOD -game_code = AX4J -vender_code = 01 -idle_loop_eliminate_target = 08000732 -flash_rom_type = 128KB - -# Super Mario Advance 4 (E) [!] -game_name = SUPER MARIOD -game_code = AX4P -vender_code = 01 -idle_loop_eliminate_target = 08000732 -flash_rom_type = 128KB - - -# Super Puzzle Fighter II Turbo (E) [!] -game_name = PUZZLEFIGHT2 -game_code = AZ8P -vender_code = 08 -idle_loop_eliminate_target = 08002b5e - -# Super Puzzle Fighter II Turbo (U) [!] -game_name = PUZZLEFIGHT2 -game_code = AZ8E -vender_code = 08 -idle_loop_eliminate_target = 08002b5e - -# Yu-Gi-Oh! - Dungeon Dice Monsters (U) [!] -game_name = YU-GI-OH DDM -game_code = AYDE -vender_code = A4 -idle_loop_eliminate_target = 0802cc6a - -# Yu-Gi-Oh! - The Eternal Duelist Soul (U) [!] -game_name = YU-GI-OH!EDS -game_code = AY5E -vender_code = A4 -idle_loop_eliminate_target = 08075d96 - -# Yu-Gi-Oh! - The Sacred Cards (U) [!] -game_name = YUGIOH DM7 -game_code = AY7E -vender_code = A4 -idle_loop_eliminate_target = 08003bd6 - -# Yu-Gi-Oh! - World Championship Tournament 2004 (U) [!] -game_name = YWCT2004USA -game_code = BYWE -vender_code = A4 -idle_loop_eliminate_target = 080831da - -# Yu-Gi-Oh! - Worldwide Edition - Stairway to the Destined Duel (U) [!] -game_name = YUGIOHWWE -game_code = AYWE -vender_code = A4 -idle_loop_eliminate_target = 08089792 - -# Final Fantasy IV Advance (U) [!] -game_name = FF4ADVANCE -game_code = BZ4E -vender_code = 01 -idle_loop_eliminate_target = 0800fabe -# or try 00000430 - - -# Final Fight One (E) [!] -game_name = FINAL FIGHT -game_code = AFFP -vender_code = 08 -idle_loop_eliminate_target = 0800b428 - -# Final Fight One (U) [!] -game_name = FINAL FIGHT -game_code = AFFE -vender_code = 08 -idle_loop_eliminate_target = 0800b428 - -# Megaman Battle Chip Challenge (U) [!] -game_name = BATTLECHIPGP -game_code = A89E -vender_code = 08 -idle_loop_eliminate_target = 08000544 - -# Monster Force (U) [!] -game_name = MONSTERFORCE -game_code = AM8E -vender_code = 7D -idle_loop_eliminate_target = 08000b00 - -# Monster Rancher Advance (U) [!] -game_name = MONSRANCHERA -game_code = AMFE -vender_code = 9B -idle_loop_eliminate_target = 0809f394 - -# Monster Rancher Advance 2 (U) [!] -game_name = MONSTERRANC2 -game_code = A2QE -vender_code = 9B -idle_loop_eliminate_target = 081c7290 - -# Motoracer Advance (E) [!] -game_name = MOTORACERADV -game_code = A9MP -vender_code = 41 -idle_loop_eliminate_target = 03001cf8 - -# Ninja Five-0 (U) [!] -game_name = NINJA FIVE 0 -game_code = ANXE -vender_code = A4 -iwram_stack_optimize = no - -# Ninja Cop (E) [!] -game_name = NINJA COP -game_code = ANXP -vender_code = A4 -iwram_stack_optimize = no - -# Nishihara Rieko no Dendou Mahjong (J) [!] -game_name = DENDOHMAJANG -game_code = ASMJ -vender_code = AG -iwram_stack_optimize = no - -# Sennen Kazoku (J) [!] -game_name = SENNENKAZOKU -game_code = BKAJ -vender_code = 01 -flash_rom_type = 128KB - - - -# Shining Soul (J) [!] -game_name = SHINING SOUL -game_code = AHUJ -vender_code = 8P -iwram_stack_optimize = no - -# Shining Soul (U) [!] -game_name = SHINING SOUL -game_code = AHUE -vender_code = EB -iwram_stack_optimize = no - -# Shining Soul (E) [!] -game_name = SHINING SOUL -game_code = AHUP -vender_code = 8P -iwram_stack_optimize = no - -# Shining Soul 2 (J) [!] -game_name = SHININGSOUL2 -game_code = AU2J -vender_code = 8P -iwram_stack_optimize = no - -# Shining Soul 2 (U) [!] -game_name = SHININGSOUL2 -game_code = AU2E -vender_code = EB -iwram_stack_optimize = no - -# Shining Soul 2 (E) [!] -game_name = SHININGSOUL2 -game_code = AU2P -vender_code = 8P -iwram_stack_optimize = no - -# Kim Possible 2 (U) [!] -game_name = KIMPOSSIBLE2 -game_code = BKME -vender_code = 4Q -idle_loop_eliminate_target = 080008a2 - -# Kim Possible 2 (E) [!] -game_name = KIMPOSSIBLE2 -game_code = BKMP -vender_code = 4Q -idle_loop_eliminate_target = 080008a2 - -# J League Pro Soccer Club wo Tsukurou Advance (J) [!] -game_name = SAKATUKUADV -game_code = AC2J -vender_code = 8P -iwram_stack_optimize = no - -# Oriental Blue - Ao no Tengai (J) [!] -game_name = ORIENTALBLUE -game_code = AORJ -vender_code = 01 -iwram_stack_optimize = no - -# Calciobit (J) [!] -game_name = CALCIOBIT01 -game_code = BIXJ -vender_code = 01 -flash_rom_type = 128KB - - -# Koinu-Chan no Hajimete no Osanpo (J) [!] -game_name = OSANPO -game_code = BISJ -vender_code = 1Q -iwram_stack_optimize = no - -# Chicken Little (J) [!] -game_name = CLITTLEJ -game_code = BCHJ -vender_code = G9 -iwram_stack_optimize = no - -# Bomberman Jetters Game Collection (J) [!] -game_name = BOMBERMANJGC -game_code = BOMJ -vender_code = 18 -iwram_stack_optimize = no - -# Robot Ponkotto 2 - Cross Version (J) [!] -game_name = ROBOPON2CROS -game_code = ACVJ -vender_code = 18 -iwram_stack_optimize = no - -# Robot Ponkotto 2 - Ring Version (J) [!] -game_name = ROBOPON2RING -game_code = ARPJ -vender_code = 18 -iwram_stack_optimize = no - -# Open Season (U) [!] -game_name = OPEN SEASON -game_code = BOAE -vender_code = 41 -idle_loop_eliminate_target = 08066378 - -# Robopon 2 Cross Version (U) [!] -game_name = ROBOPON2CROS -game_code = ACVE -vender_code = EB -iwram_stack_optimize = no -flash_rom_type = 512KB - -# Robopon 2 Ring Version (U) [!] -game_name = ROBOPON2RING -game_code = ARPE -vender_code = EB -iwram_stack_optimize = no -flash_rom_type = 512KB - -# Ueki no Housoku Jingi Sakuretsu! Nouryokusya Battle (J) [!] -game_name = UEKIJINGIBTL -game_code = BUHJ -vender_code = D9 -iwram_stack_optimize = no - -# V-Rally 3 (E) [!] -game_name = V-RALLY 3 -game_code = AVRP -vender_code = 70 -idle_loop_eliminate_target = 080aa920 - -# Virtual Kasparov (U) [!] -game_name = VIRTKASPAROV -game_code = AVKE -vender_code = 60 -idle_loop_eliminate_target = 0800093a - -# Wario Ware, Inc. Mega Microgames (U) [!] -game_name = WARIOWAREINC -game_code = AZWE -vender_code = 01 -idle_loop_eliminate_target = 08000f66 diff --git a/gba_memory.c b/gba_memory.c index 7da1e54..978c58f 100644 --- a/gba_memory.c +++ b/gba_memory.c @@ -384,7 +384,6 @@ u32 gbc_sound_wave_update = 0; // Keep it 32KB until the upper 64KB is accessed, then make it 64KB. u32 backup_type = BACKUP_NONE; -u32 sram_bankcount = SRAM_SIZE_32KB; u32 flash_mode = FLASH_BASE_MODE; u32 flash_command_position = 0; @@ -1032,7 +1031,6 @@ void function_cc write_backup(u32 address, u32 value) if(backup_type == BACKUP_NONE) backup_type = BACKUP_SRAM; - // gamepak SRAM or Flash ROM if((address == 0x5555) && (flash_mode != FLASH_WRITE_MODE)) { @@ -1085,7 +1083,7 @@ void function_cc write_backup(u32 address, u32 value) // Erase chip if(flash_mode == FLASH_ERASE_MODE) { - memset(gamepak_backup, 0xFF, 1024 * 64 * flash_bank_cnt); + memset(gamepak_backup, 0xFF, 1024 * 128); flash_mode = FLASH_BASE_MODE; } break; @@ -1137,9 +1135,6 @@ void function_cc write_backup(u32 address, u32 value) if(backup_type == BACKUP_SRAM) { // Write value to SRAM - // Hit 64KB territory? - if(address >= 0x8000) - sram_bankcount = SRAM_SIZE_64KB; gamepak_backup[address] = value; } } @@ -1555,104 +1550,6 @@ cpu_alert_type function_cc write_memory32(u32 address, u32 value) return CPU_ALERT_NONE; } -char backup_filename[512]; - -u32 load_backup(char *name) -{ - RFILE *fd = filestream_open(name, RETRO_VFS_FILE_ACCESS_READ, - RETRO_VFS_FILE_ACCESS_HINT_NONE); - - if(fd) - { - int64_t backup_size = filestream_get_size(fd); - - filestream_read(fd, gamepak_backup, backup_size); - filestream_close(fd); - - // The size might give away what kind of backup it is. - switch(backup_size) - { - case 0x200: - backup_type = BACKUP_EEPROM; - eeprom_size = EEPROM_512_BYTE; - break; - - case 0x2000: - backup_type = BACKUP_EEPROM; - eeprom_size = EEPROM_8_KBYTE; - break; - - case 0x8000: - backup_type = BACKUP_SRAM; - sram_bankcount = SRAM_SIZE_32KB; - break; - - // Could be either flash or SRAM, go with flash - case 0x10000: - backup_type = BACKUP_FLASH; - sram_bankcount = SRAM_SIZE_64KB; - break; - - case 0x20000: - backup_type = BACKUP_FLASH; - flash_bank_cnt = FLASH_SIZE_128KB; - break; - } - return 1; - } - else - { - backup_type = BACKUP_NONE; - memset(gamepak_backup, 0xFF, 1024 * 128); - } - - return 0; -} - -u32 save_backup(char *name) -{ - if(backup_type != BACKUP_NONE) - { - RFILE *fd = filestream_open(name, RETRO_VFS_FILE_ACCESS_WRITE, - RETRO_VFS_FILE_ACCESS_HINT_NONE); - - if(fd) - { - u32 backup_size = 0; - - switch(backup_type) - { - case BACKUP_SRAM: - backup_size = 0x8000 * sram_bankcount; - break; - - case BACKUP_FLASH: - backup_size = 0x10000 * flash_bank_cnt; - break; - - case BACKUP_EEPROM: - backup_size = 0x200 * eeprom_size; - break; - - default: - break; - } - - filestream_write(fd, gamepak_backup, backup_size); - filestream_close(fd); - return 1; - } - } - - return 0; -} - -void update_backup(void) -{ - if (!use_libretro_save_method) - save_backup(backup_filename); -} - typedef struct { char gamepak_title[13]; @@ -2383,7 +2280,6 @@ void init_memory(void) backup_type = BACKUP_NONE; - sram_bankcount = SRAM_SIZE_32KB; //flash_size = FLASH_SIZE_64KB; flash_bank_num = 0; @@ -2417,9 +2313,8 @@ void memory_term(void) bool memory_check_savestate(const u8 *src) { static const char *vars32[] = { - "backup-type", "sram-size", - "flash-mode", "flash-cmd-pos", "flash-bank-num", "flash-dev-id", "flash-size", - "eeprom-size", "eeprom-mode", "eeprom-addr", "eeprom-counter", + "backup-type","flash-mode", "flash-cmd-pos", "flash-bank-num", "flash-dev-id", + "flash-size", "eeprom-size", "eeprom-mode", "eeprom-addr", "eeprom-counter", "rtc-state", "rtc-write-mode", "rtc-cmd", "rtc-status", "rtc-data-byte-cnt", "rtc-bit-cnt", }; static const char *dmavars32[] = { @@ -2484,7 +2379,6 @@ bool memory_read_savestate(const u8 *src) bson_read_bytes(memdoc, "ioregs", io_registers, sizeof(io_registers)) && bson_read_int32(bakdoc, "backup-type", &backup_type) && - bson_read_int32(bakdoc, "sram-size", &sram_bankcount) && bson_read_int32(bakdoc, "flash-mode", &flash_mode) && bson_read_int32(bakdoc, "flash-cmd-pos", &flash_command_position) && @@ -2544,7 +2438,6 @@ unsigned memory_write_savestate(u8 *dst) bson_start_document(dst, "backup", wbptr); bson_write_int32(dst, "backup-type", (u32)backup_type); - bson_write_int32(dst, "sram-size", sram_bankcount); bson_write_int32(dst, "flash-mode", flash_mode); bson_write_int32(dst, "flash-cmd-pos", flash_command_position); @@ -2634,30 +2527,11 @@ static s32 load_gamepak_raw(const char *name) u32 load_gamepak(const struct retro_game_info* info, const char *name) { - char *p; - char gamepak_filename[512]; gamepak_info_t gpinfo; if (load_gamepak_raw(name)) return -1; - strncpy(gamepak_filename, name, sizeof(gamepak_filename)); - gamepak_filename[sizeof(gamepak_filename) - 1] = 0; - - p = strrchr(gamepak_filename, PATH_SEPARATOR_CHAR); - if (p) - p++; - else - p = gamepak_filename; - - snprintf(backup_filename, sizeof(backup_filename), "%s%c%s", save_path, PATH_SEPARATOR_CHAR, p); - p = strrchr(backup_filename, '.'); - if (p) - strcpy(p, ".sav"); - - if (!use_libretro_save_method) - load_backup(backup_filename); - // Buffer 0 always has the first 1MB chunk of the ROM memset(&gpinfo, 0, sizeof(gpinfo)); memcpy(gpinfo.gamepak_title, &gamepak_buffers[0][0xA0], 12); diff --git a/gba_memory.h b/gba_memory.h index 656fd98..7292b38 100644 --- a/gba_memory.h +++ b/gba_memory.h @@ -21,7 +21,6 @@ #define MEMORY_H #include "libretro.h" -extern int use_libretro_save_method; #define DMA_CHAN_CNT 4 @@ -239,9 +238,7 @@ extern char gamepak_filename[512]; cpu_alert_type dma_transfer(unsigned dma_chan, int *cycles); u8 *memory_region(u32 address, u32 *memory_limit); u32 load_gamepak(const struct retro_game_info* info, const char *name); -u32 load_backup(char *name); s32 load_bios(char *name); -void update_backup(void); void init_memory(void); void init_gamepak_buffer(void); bool gamepak_must_swap(void); diff --git a/libretro/libretro.c b/libretro/libretro.c index 6db33ed..8cd96e5 100644 --- a/libretro/libretro.c +++ b/libretro/libretro.c @@ -88,7 +88,6 @@ static retro_environment_t environ_cb; struct retro_perf_callback perf_cb; int dynarec_enable; -int use_libretro_save_method = 0; boot_mode selected_boot_mode = boot_game; int sprite_limit = 1; @@ -676,7 +675,6 @@ void retro_set_controller_port_device(unsigned port, unsigned device) {} void retro_reset(void) { - update_backup(); reset_gba(); } @@ -875,19 +873,6 @@ static void check_variables(int started_from_load) (post_process_mix != post_process_mix_prev)) init_post_processing(); - if (started_from_load) - { - var.key = "gpsp_save_method"; - var.value = NULL; - if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) - { - if (!strcmp(var.value, "libretro")) - use_libretro_save_method = 1; - else - use_libretro_save_method = 0; - } - } - var.key = "gpsp_turbo_period"; var.value = NULL; turbo_period = TURBO_PERIOD_MIN; @@ -971,7 +956,6 @@ bool retro_load_game(const struct retro_game_info* info) if (!info) return false; - use_libretro_save_method = 0; check_variables(1); set_input_descriptors(); @@ -984,11 +968,6 @@ bool retro_load_game(const struct retro_game_info* info) extract_directory(main_path, info->path, sizeof(main_path)); - if (environ_cb(RETRO_ENVIRONMENT_GET_SAVE_DIRECTORY, &dir) && dir) - strcpy(save_path, dir); - else - strcpy(save_path, main_path); - if (environ_cb(RETRO_ENVIRONMENT_GET_SYSTEM_DIRECTORY, &dir) && dir) strcpy(filename_bios, dir); else @@ -1020,7 +999,7 @@ bool retro_load_game(const struct retro_game_info* info) memcpy(bios_rom, open_gba_bios_rom, sizeof(bios_rom)); } - memset(gamepak_backup, -1, sizeof(gamepak_backup)); + memset(gamepak_backup, 0xff, sizeof(gamepak_backup)); if (load_gamepak(info, info->path) != 0) { error_msg("Could not load the game file."); @@ -1042,8 +1021,6 @@ bool retro_load_game_special(unsigned game_type, void retro_unload_game(void) { - update_backup(); - if (libretro_ff_enabled) set_fastforward_override(false); @@ -1065,50 +1042,16 @@ unsigned retro_get_region(void) void* retro_get_memory_data(unsigned id) { - switch (id) - { - case RETRO_MEMORY_SAVE_RAM: - if (use_libretro_save_method) - return gamepak_backup; - break; - default: - break; - } + if (id == RETRO_MEMORY_SAVE_RAM) + return gamepak_backup; - return 0; + return NULL; } size_t retro_get_memory_size(unsigned id) { - switch (id) - { - case RETRO_MEMORY_SAVE_RAM: - if (use_libretro_save_method) - { - switch(backup_type) - { - case BACKUP_SRAM: - return sram_bankcount * 0x8000; - - case BACKUP_FLASH: - return 0x10000 * flash_bank_cnt; - - case BACKUP_EEPROM: - return 0x200 * eeprom_size; - - // assume 128KB save, regardless if rom supports battery saves - // this is needed because gba cannot provide initially the backup save size - // until a few cycles has passed (unless provided by a database) - case BACKUP_NONE: - default: - return (1024 * 128); - break; - } - } - break; - default: - break; - } + if (id == RETRO_MEMORY_SAVE_RAM) + return 0x20000; /* Assume 128KiB, biggest possible save */ return 0; } diff --git a/main.c b/main.c index 3df7ca0..e475828 100644 --- a/main.c +++ b/main.c @@ -32,7 +32,6 @@ u32 gbc_update_count = 0; u32 oam_update_count = 0; char main_path[512]; -char save_path[512]; void trigger_ext_event(void); diff --git a/main.h b/main.h index 33ca5aa..dc9f4a2 100644 --- a/main.h +++ b/main.h @@ -75,7 +75,6 @@ extern u32 skip_next_frame; extern u32 flush_ram_count; extern char main_path[512]; -extern char save_path[512]; #define cycles_to_run(c) ((c) & 0x7FFF) #define completed_frame(c) ((c) & 0x80000000)