mgba-emu / mgba

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

Glitch When Loading Rom on Second Multiplayer Window #854

Closed ackamp closed 3 years ago

ackamp commented 7 years ago

So I have a Rom for Pokemon Emerald and I wanted to trade with another save file I created on a copy of that ROM so I could have all three starters. I had everything ready on either account but whenever I wanted to load the copy of the ROM in the second multiplayer window, the ROM a) wouldn't load b) a white screen would show up.

bsngardner commented 6 years ago

I can confirm this bug. I am running the development version, but I downgraded to the newest release and it has the same problem. I tried changing video settings (opengl to software).

endrift commented 6 years ago

White screen is a sync issue. Try switching the audio driver or changing sync settings.

Fwiw, this is going to get heavily rewritten at some point.

Numero256 commented 6 years ago

Sync settings or drivers dont change anything. It will just get very laggy.

ghost commented 6 years ago

Regarding this issue, I can confirm I have the same issue in 0.7.0 (Arch Linux). I managed to get pokemon "working" the following way:

First, I mute the audio and turn off Sync to Audio, then turn on Sync to Video instead. I also turn off Frame skip. Then I load my pokemon ROM. Once load, I leave the intro running and I don't press any buttons in the pad. Instead, I open the multiplayer window, and load the other ROM. The game freezes at a white screen.

Then I disable Sync with video, and leave the intro loop. When it loops, the game syncs with the other window and both games are now working. I enable Sync with video again, and then proceed to play using a gamepad in one window, and the keyboard with the other.

However, there is a big issue with the FPS lock. I just noticed that while one window tries to keep it up at 60FPS, the other goes above 63FPS during trading. And that's when the desync happens and I get link errors in game. It's very unstable. Also the FPS target won't work when Sync to video is enabled, it will attempt to lock at 60FPS no matter what. Not sure if this is an intended feature.

I also tried to link with Sync to audio enabled and FPS locked to 45FPS, and upon entering the room, I got a communication error, so it's no good either. Also I got a speed up of 47FPS in one of the windows.

I also tried changing the audio engine to Qt, same results. Tried to lock at 59.7 (native) FPS. Got a speed up of 63FPS. Communication error when starting a duel. It sometimes let me do a trade or two, or even battle for a while, but it will eventually desync and show me a communication error. I also tried to switch to OpenGL version 1.1 (forced), nothing. Same results. And if I switch to Software (Qt), I get an error right when I attempt to enter the room. And don't even try to Sync to video while in software mode, the game soft locks.

chopfitzroy commented 6 years ago

Getting this issue also, any updates?

Cheers.

DataFlame commented 6 years ago

Can confirm.

On Linux Mint 19 Tara, mGBA 0.6.1.

seokgicom commented 5 years ago

you may try this 1.Open a multiplayer window and just load both of the roms you wanna play. (If you've loaded the rom and were playing it already, reset it so the emulator can play the intro) 2.After loading, intro of the first window will play. (second window will show white screen for now) Then uncheck [sync to audio] (uncheck [sync to video] also if it's checked) in the emulation tab

  1. wait for a while for the game on the second window to operate *make sure the emulator is not paused (it's in the emulation tab)
  2. check [sync to audio] again
basil-conto commented 5 years ago

With a build of latest master (0.8 5436 0c9802e4) on Debian Testing, trying to link Pokemon Gold/Silver does not result in any white screens, but I get similar hangs, speedups, and communication errors as described above, also when toggling sync settings.

i'm just curious as to what the status of this issue is and whether there is anything I can do to help debug it or figure out what's happening (with assistance/instruction, of course).

Either way, I'd like to take this opportunity to thank everyone working to provide this very fun project.

rtandy commented 5 years ago

This seems to be fixed (or at least working well enough) since a9e96c7d00f7816cebf1edf50575e7d9f59219d8, tried GB/GBC and GBA games and all good so far. Qt frontend on Debian 10 (Buster).

mathturtle commented 4 years ago

So do you have any idea when a9e96c7 will be included as part of a release? I was hoping it would be part of the next version, but checking the one released last month it is not included in 0.7.3 and I still see the issue in that release. I'd rather not build master from source just to play a game...

endrift commented 4 years ago

It will be in 0.8.0, which will have a beta out soon.

fancythedeveloper commented 4 years ago

@mathturtle If you really want to test that commit, just get the nightly/development version.

mathturtle commented 4 years ago

Thanks for pointing those out @fancythedeveloper. I grabbed the nightly build and tried trading between Pokemon Gold and Silver and it worked fine. However when I try to trading between Pokemon Gold and Crystal both sides see the other's Pokemon as corrupted. Not sure if that is a related issue or not though. I can't test the Gen 2 to Gen 1 trading thing because my quick tests of what works haven't got that far in the game yet. I'll update this if/when I get that far.

Rada81 commented 4 years ago

Hi,

I have 0.8.1 version of mgba, I can't load my save on the multiplayer windows, any advices, helps?

GhostoftheValley commented 4 years ago

im on 0.8.1 and can confirm trading up from fire red --> emerald at least causes the white screen trying to go open the 2nd game in a multiplayer window. tried opening the games in either order and it wont work no regardless of settings i played with.

grayeagle22 commented 4 years ago

@Rada81 @GhostoftheValley I recently downloaded and tried to trade with mGBA 0.8.1 and had the same issues.

I was able to get the trade to work when trading from Emerald to Emerald (for Machamp). I will list the general steps first, then the full description at the bottom.

Here is how I solved it: General steps

  1. You need to have 2 separate folders of save files that include the ROM, the .sav, and .ssx (the "x" being the number of the save state).
  2. Load the ROM from the new folder and play a second game to the point you get the initial pokedex and have at least 2 pokemon in your party (like 5 min with using the space bar to increase game speed).
  3. Save the game next to the trade center in any pokecenter 2nd floor...**VERY IMPORTANT Actually save the game "normally". Press enter, then save, then overwrite any existing file.** This writes to your .sav file. Do not save to a state for this.
  4. Change audio and video drivers to "QT", set frame skip to zero, and uncheck the audio and video sync.
  5. Open "new multiplayer window” and load the ROM from you original save folder.
  6. Reset both windows
  7. Load the game from the main screen after the intro for each window. Do not load a save state
  8. Go back and forth between the windows to bring each one to talk to the trade lady, save, and agree to enter the trade.
  9. From here it's the basic trade routine. Just need to hop between windows to issue commands.
  10. When done, save the game (.sav) or the state (.ssx). It does not matter at this point.
  11. Enjoy!

Longer description: I started with one set of saves for my "actual" game; the ROM, .sav, and .ssx ("x" being the number of the save state). Then simply created a new folder and copied the ROM to it. Start the ROM from the new folder to get a new .sav file. This new .sav file is crucial as it essentially creates a new player ID and makes it appear as if there are two different "people" trading. You cannot trade between the same player ID and is why I think I initially had issues when trying to use the same .sav file. Play the new game to the point you get the initial pokedex and have at least 2 pokemon in your party (like 5 min with using the space bar to increase game speed). Save the game on the second floor by the trace center in the pokecenter. Make sure to save the game "normally" by pressing enter, then going to "save", then overwriting any file there. Do no worry if it says a save already exists, this will not overwrite your "actual" game. Also, do not use a save state.

Next, we need to change the mGBA settings. Set audio and display drivers to “QT”, and uncheck video and audio sync.

Open a “new multiplayer window” which should leave you with two open windows. In the new window, load the ROM from the folder with your “actual” or “old” game. The two windows should now each have a “different” ROM and .sav file loaded. Do now worry if the new window shows up white right now. Reset each window and they should both start the game and be faster than normal. Don’t worry about this.

At this point, it’s easiest if you have both saves next to the trade center in any pokecenter. If not, load your original game and save the game as stated above with the pokemon in your party you want to trade.

Once you have the games saved as you want, get to the main screen in each window and load each save game from the main screen. Do not load a save state!

From here you will have to hop back and forth between the windows to get each one to talk to the trade lady and get set up for the trade. Once in the trade center it’s the same routine as normal.

I do not know how this works with FireRed, but I wouldn't be surprised if it is a similar process regarding the settings and .sav files.

Hope this helps!

grayeagle22 commented 4 years ago

Hi,

I have 0.8.1 version of mgba, I can't load my save on the multiplayer windows, any advices, helps?

For a more succinct reply: You need a second folder with the ROM, .sav, and .ssx ("x" being the save state number) in order to load them in a second window. My full comment regarding trading is above.

ccfman2004 commented 4 years ago

Issue is still in 0.8.3 and development build 0.9.0. macOS 10.14.6

It seems the problem mostly occurs if I try to load a different save file than the default one.

endrift commented 3 years ago

I fixed the most common case of this in 32a8a47de67c77579dfb5ce69aad54b9a8afae9d, though it can still happen in some (usually audio) sync-related cases.

PeeJayBonobo commented 3 years ago

Unfortunately, the commit breaks Advance Guardian Heroes multiplayer; when I boot it up on the second player's screen, it crashes both windows, whether BIOS is enabled or disabled. Every other game I tested works.

https://user-images.githubusercontent.com/3814426/107282373-dfbeed80-6a28-11eb-9d71-dd6d111c0417.mp4

endrift commented 3 years ago

Are you sure it's that commit in specific? Does it not happen on the commit prior?

PeeJayBonobo commented 3 years ago

Are you sure it's that commit in specific? Does it not happen on the commit prior?

It worked in every other commit before it, the only difference is, I had to load it on P1 window (which will boot perfectly fine), load it on P2 Window (which gets white-screened), and then reset P1 window for it to work (which will boot in both screens perfectly fine).

endrift commented 3 years ago

I'm able to reproduce. I'll look into it.

endrift commented 3 years ago

Ok, fixed and pushed.