mgba-emu / mgba

mGBA Game Boy Advance Emulator
https://mgba.io/
Mozilla Public License 2.0
5.73k stars 794 forks source link

Multiple save profiles #106

Closed tony971 closed 2 years ago

tony971 commented 9 years ago

If you run multiple windows of the same game, they will use the same .sav file. This could be problematic for games like Four Swords Adventures or Pokemon, which are designed to be played with other cartridges of the same title.

Edit: My last mockup is much better.

endrift commented 9 years ago

I'm really not sure how users are expected to understand this functionality, and especially how to handle the file backing for it. I can try to figure something out, but I'm not entirely sure what the best approach is. At the moment, I'm just making a copy of the ROM and the save file, then loading both.

karasuhebi commented 9 years ago

I don't think this is intuitive enough for users. Needs to be made better. But I do support the general idea of it.

tony971 commented 9 years ago

I know that VBA-M just makes it so Player 2 always uses .sav2 files but that's even harder to use correctly than this setting. Because unless you always play a game as player 2, you'll be using the .sav slot all the way until you try to use it in multiplayer.

karasuhebi commented 9 years ago

Maybe make it so mGBA doesn't allow two ROMs to use the same .sav file (lock it maybe?) and just warn the user when they try to open a second copy of the game that they need to have a .sav2 for it.

tony971 commented 9 years ago

That still has the same problem as VBA-M, where you can't use the .sav2 file until you're in multiplayer (unless you edit file extensions in your ROM library).

karasuhebi commented 9 years ago

I agree that a .sav2 may not be the best solution, but I just think that your solution is making it more complicated than it needs to be. We have to keep it simple for end users. Maybe make it so instead of .sav2 its NAME_OF_GAME_2.sav

Actually now that I think about it, most of what you're saying is a non-issue. If a user has a second Pokémon FireRed save for example, they must have done something on their own already to make that possible since there's no way mGBA would organically allow you to have two .sav files for the same game. So if they're smart enough to figure that out, they're smart enough to figure out that they need to rename (or choose via the UI) their .sav file to use it on a second mGBA instance.

EDIT: Sorry I didn't see those last two replies before posting mine. I like that idea, seems straightforward enough.

tony971 commented 9 years ago

Had some more time to think about it. This is fairly simple now. For the sake of understanding, we'll be using "cartridge" and ".sav[x]" interchangeably.

Each ROM will have up to 4 saves associated with it. These could be .sav, .sav2, .sav3, and .sav4 (exactly the same as VBA-M). If a multiplayer window loads a ROM that's already running in another window, then it should load/create the first unused .sav[x] file by default. An OSD "Cartridge [x] loaded" should confirm this.

OSD

The menu dialogue below allows users to decide which cartridge to play with at any given time. This allows them to make significant progress on multiple .sav[x] files outside of multliplayer. If an active cartridge is selected and the .sav[x] file doesn't exist, it will be created.

Menu

Ideally, each "Cartridge" will have its own set of save states. Pressing "Continue" during the "New cartridge loaded" dialogue should copy over the save states into the new cartridge.

Cartridge 1 Cartridge 2 Cartridge 3 Cartridge 4
Slot 1 .ss1 .ss10 .ss19 .ss28
Slot 2 .ss2 .ss11 .ss20 .ss29
Slot 3 .ss3 .ss12 .ss21 .ss30
Slot 4 .ss4 .ss13 .ss22 .ss31
Slot 5 .ss5 .ss14 .ss23 .ss32
Slot 6 .ss6 .ss15 .ss24 .ss33
Slot 7 .ss7 .ss16 .ss25 .ss34
Slot 8 .ss8 .ss17 .ss26 .ss35
Slot 9 .ss9 .ss18 .ss27 .ss36

Thoughts? @karasuhebi @endrift

tony971 commented 9 years ago

Pinging @JMC47 because end-user relations is somewhat of a specialty of yours.

JMC47 commented 9 years ago

I've actually corrupted saves and crashed games with the multiplayer stuff loading the same game.

Here's my suggestion: If a save exists (let's pretend MegaMan(2).sav) then it uses that. If no save exists, we have two options.

1: Automatically copy the first save and use that either temporarily or permanently. 2: Make a new save that saves with a (2) at the end of it.

All I know is that as someone who's ran into issues with my cousin trying to set thigns up, this would be really, really nice.

tony971 commented 9 years ago

Personally, I'd rather use .sav2 files instead of (2).sav to maintain compatibility with VBA-M saves.

JMC47 commented 9 years ago

I was just making up a random naming scheme, any works for me.

tony971 commented 9 years ago

This should probably be done before finishing the Dolphin stuff because the flagship game for Dolphin connectivity is Four Swords Adventures. A lot of end users are going to fire up four instances of this game.

JMC47 commented 9 years ago

There's no saving on the GBA involved for Four Swords Adventures.

endrift commented 2 years ago

Added in 667dffe515e1b36384bc06a9cf88281e99aec0eb, though it doesn't affect save states.

profi200 commented 2 years ago

@endrift I saw this recently and wondered about the chosen extension. Many Windows users who don't know better probably don't have the option set to show file name extensions. So all they see is multiple identically named files. I got this idea from DS flashcards. They use this format: "whatever.X.sav" where X is the savegame slot number. 0 (default) is the exception and has the ".X" omitted for compatibility.