Gamer125 / genplus-gx

Automatically exported from code.google.com/p/genplus-gx
Other
0 stars 0 forks source link

Loading save state crashes emulator #144

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Load a random game (I tried Mortal Kombat, Mega Bomberman Sonic)
2. Load a save state for that game. If you don't have one, create it and load 
it.

What is the expected output? What do you see instead?
The emulator will crash and show a code dump.

What version of the emulator are you using (official, SVN revision,...)?
genplus-gx-1.4.1. - Gamecube

Please provide any additional information below (Video settings, Console
region,...)
Everything seemed to work fine in the beginning. I played Splatterhouse 2 (with 
game genie codes) and before reaching a certain boss, I saved my state and kept 
reloading it after dying. Then for some reason the emulator crashed. Since then 
I am not able to load a save state. 

Original issue reported on code.google.com by LeonKenn...@yahoo.de on 11 Dec 2010 at 10:49

GoogleCodeExporter commented 8 years ago
I need picture of the crash as it could be anything: the program cannot just 
"stop" loading state like that, the code always do the same thing so if it 
worked, the only possibilities are either the SD card where savestates are 
written/loaded is corrupt, or the crash is related to something else that 
happened at the same time...

Original comment by ekeeke31@gmail.com on 12 Dec 2010 at 12:07

GoogleCodeExporter commented 8 years ago

Original comment by ekeeke31@gmail.com on 12 Dec 2010 at 12:09

GoogleCodeExporter commented 8 years ago
I cannot reproduce this issue, saving & loading state files works fine for me 
on gamecube.

Unless you provide me additional informations I requested (device info, core 
dump screen shot, exact way used to reproduce the issue, etc), I will have to 
close it.

Original comment by ekeeke31@gmail.com on 13 Dec 2010 at 12:12

GoogleCodeExporter commented 8 years ago
PAL Gamecube
qoob Pro (sw1.3c)
SD Gecko with Intenso micro SD card (2GB)

Core dump screenshot is coming up in an hour or so. I have to find a camera to 
take a picture of the tv screen.

I was playing Splatterhouse 2 (with the game genie code "AX3A-AA2N" applied) 
and came to a point where I had to load a save state every 3 to 4 minutes. 
About the 15th time I tried to load, the emulator crashed. Since then it is not 
possible for me to load a save state. I tried loading a save state I created 
before the crash (Sonic) and creating a new one and loading that one (Mortal 
Kombat). I get a code dump every time.

As I said, screenshot is coming in a few moments...

Original comment by LeonKenn...@yahoo.de on 13 Dec 2010 at 2:46

GoogleCodeExporter commented 8 years ago
Please also attach those 3 save state files (Splatter House 2, Sonic & Mortal 
Kombat) here. 

Original comment by ekeeke31@gmail.com on 13 Dec 2010 at 3:35

GoogleCodeExporter commented 8 years ago
Here you go, all of the requested files...

Original comment by LeonKenn...@yahoo.de on 13 Dec 2010 at 4:08

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Ok, I think  I found the cause of the crash. It happens during the load of VDP 
state, while overwriting VDP registers. For a stupid reason, it causes a line 
of display to be redrawn but since the NTSC filter has not been initialized yet 
(it's initialized when you leave the menu), the NTSC filter rendering function 
crashes.

I bet save state worked fine until you activated the NTSC filter, disabling it 
back should fix the issue until next version comes out.

Original comment by ekeeke31@gmail.com on 13 Dec 2010 at 7:28

GoogleCodeExporter commented 8 years ago
Please test the attached dol and tell me if the issue is fixed (even with NTSC 
filter being enabled)

Original comment by ekeeke31@gmail.com on 13 Dec 2010 at 7:40

GoogleCodeExporter commented 8 years ago
Awesome! It seems you were totally right. I turned off the NTSC filter and my 
save states started to work again. 

The issue is fixed with the new dol! NTSC filters are working now with save 
states. 

Only my Splatter House 2 save state seems to be broken. It just freezes the 
emulator.  

Original comment by LeonKenn...@yahoo.de on 13 Dec 2010 at 9:05

GoogleCodeExporter commented 8 years ago
OK, it's not just the NTSC filter. Every now and then a save state gets 
corrupted. I played Battletoads and saved after every checkpoint in the surfing 
stage. Upon loading the most recent save state, the game worked for 1 second 
and then just froze accompanied by a humming noise.

It is the same issue as with Splatter House 2. Seems saving often results in a 
corrupted file every now and then. The save state for Battletoads is attached. 

Original comment by LeonKenn...@yahoo.de on 13 Dec 2010 at 10:31

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Ok, thanks to you, I spotted another bug in state loading. 

For the record, Z80 interrupt callback was saved as a function pointer and 
restored from the save state file which is not stable at all. Indeed, function 
addresses can potentially change every time you modify & recompile the 
application (which I did with the test version above) so the Z80 interrupt 
callback was actually pointing to code that had nothing to do with it, 
resulting in a crash.

Please tell me if this new test version fixes save state loading (it did for me)

Original comment by ekeeke31@gmail.com on 14 Dec 2010 at 8:54

GoogleCodeExporter commented 8 years ago
No, it doesn't work for me. I get a code dump every time I try to load a (new 
or old) save state.

Original comment by LeonKenn...@yahoo.de on 14 Dec 2010 at 5:37

Attachments:

GoogleCodeExporter commented 8 years ago
Oops, I forgot to report the NTSC filter fix in this dol. Try with NTSC filter 
disabled, I will post a new dol later.

Original comment by ekeeke31@gmail.com on 14 Dec 2010 at 6:16

GoogleCodeExporter commented 8 years ago

Original comment by ekeeke31@gmail.com on 14 Dec 2010 at 7:44

GoogleCodeExporter commented 8 years ago
I have been playing Battletoads for the last hour or so, with excessive saving 
and loading. Aproximately the 30th save state I made got corrupted. Again it 
froze the emulator leaving me with a humming sound.

Guess this problem has nothing to do with the loading process but with saving 
itself.

I will be out of town for the rest of the week, so unfortunately I won't be 
able to check out the progress you may make.

Original comment by LeonKenn...@yahoo.de on 14 Dec 2010 at 7:44

GoogleCodeExporter commented 8 years ago
I don't think so, I think it's the way they are loaded (you confirm that the 
freeze occurs only when loading, right ?). Here are fixed dols including the 2 
last fixes.

If you think you have a corrupted save state, please upload it so I can have a 
look and always report which version you were using (official or last beta)

Original comment by ekeeke31@gmail.com on 14 Dec 2010 at 7:51

GoogleCodeExporter commented 8 years ago
I reproduced the issue. The bug happens with state files that were saved with 
High-Quality FM option enabled, if you load them with this option disabled, the 
emulator freeze (I have yet to find why but I have some ideas).

Can you confirm that you changed this option or deleted your config.ini file ? 
Try reloading the "corrupted" state files with HQ FM enabled in audio settings.

Original comment by ekeeke31@gmail.com on 14 Dec 2010 at 10:51

GoogleCodeExporter commented 8 years ago
Here are new test builds which appeared to fix the "freeze" issue on my side, 
no matter of the state of High-Quality FM option. There was a bug when 
restoring FM chip cycle count value from state file, the value saved in HQ mode 
could lead to unpredictable behavior in non-HQ mode.

Original comment by ekeeke31@gmail.com on 14 Dec 2010 at 11:09

Attachments:

GoogleCodeExporter commented 8 years ago
The new DOL seems to work fine. I have played some games for a couple of hours 
and saved and loaded states like mad. No issues what so ever...

Even the savestates I thought were corrupted worked fine. That's strange 
because I only changed the HQ FM options only at the beginning and never 
touched them again, certainly not while saving and loading states.

Original comment by LeonKenn...@yahoo.de on 19 Dec 2010 at 11:16

GoogleCodeExporter commented 8 years ago

Original comment by ekeeke31@gmail.com on 29 Dec 2010 at 11:57

GoogleCodeExporter commented 8 years ago

Original comment by ekeeke31@gmail.com on 7 Jan 2011 at 11:10

GoogleCodeExporter commented 8 years ago
I still have a few save states that are crashing namely Virtua Racing and 
Castle of Illusion, i'll upload them later today.

Original comment by noddy...@hotmail.co.uk on 9 Jan 2011 at 6:01

GoogleCodeExporter commented 8 years ago

Original comment by noddy...@hotmail.co.uk on 10 Jan 2011 at 4:58

Attachments:

GoogleCodeExporter commented 8 years ago
Savestate are not game dependent (except Virtua Racing but it loaded/saved fine 
last time I tested... it was not working in earlier versions though, before I 
improved the savesate format so be sure to use files saved from the current 
version).

All games mentionned here save & load fine for me (I didn't try your files 
though, will try when I could access to my equipment)

Each previous crash were caused by incompatibilities when loading a state file 
that was saved with different emulator settings so please give me you current 
settings (system, audio & video) and try remembering if you changed some of 
them.

Also make sure  those files are not from older versions. Have you try to test 
tghose games by saving a state file, reset the emulator / reload the game, then 
load the same state file ?

Original comment by ekeeke31@gmail.com on 11 Jan 2011 at 2:07

GoogleCodeExporter commented 8 years ago
Ayrton Sennas Super Monaco GP II (U) [a1].gp0 = rev 502
I'm not sure what revisions the other ones where saved with but there dated 
eatlier.
All games save / load fine with latest version.
I'm still getting random crashes in gameplay with Castle of Illusion and Sonic 
games though which normally happens when backtracking.
The only thing i've changed throughout versions is the button config.

Original comment by noddy...@hotmail.co.uk on 12 Jan 2011 at 3:18

Attachments:

GoogleCodeExporter commented 8 years ago
What do you mean, by "All games save / load fine with latest version" ? I don't 
understand what issue you are having with those files then ?

You should use the DOL I posted above which fix savestate issues, to load AND 
save new files, old files are NOT reliable. 

Also, what do you exactly mean by "random crash in gameplay" and "backtracking" 
? how is it related to savestates ? again, there is nothing specific to "castle 
of illusion and sonic games" , and I need screenshot of the exception screen, I 
can't just guess what it is as those games work, save & load perfectly here for 
me.

Original comment by ekeeke31@gmail.com on 12 Jan 2011 at 8:43

GoogleCodeExporter commented 8 years ago
I meant fresh saves created with latest build work fine not my old saves from 
previous revisions that I uploaded.

I don't get any exeception screen it just freezes up in-game randomly where the 
chracter is no longer movable and nothing happens on screen, sorry I can't be 
more specific, it's not the saves that create the problem as it happens without 
saving too.

Also every newly created save is fragmented.

Original comment by noddy...@hotmail.co.uk on 12 Jan 2011 at 9:10

GoogleCodeExporter commented 8 years ago
As I said earlier, state files saved with previous versions can be buggy, this 
is pretty much expected (for example, in 1.4.0, Virtua racing was incompletely 
saved, resulting in crash when loaded... loading this state with the fixed 
emulator won't solve the issue since info is originally missing in the file. 
The same thing can happen with state files saved with 1.4.1 were additional 
infos were saved but some of them incorrectly, which is fixed for next version 
i.e in the version posted above) 

Freezes might me related to something else, I never experimented these on 
Gamecube though and therefore it could be very difficult to fix. I am not even 
sure it is an emulation issue and not an hardware issue . Are you able to get 
back to the menu when this happen ? Does the reset button still reset the game 
? What happens with sound ? This woudl also help if you could get back to 1.4.0 
and test if those random freeze already happened.

Lastly, I don't understand what you mean by "fragmented" saves ? How do I see 
that ? Files are created using an external library anyway, the program just 
call open/write/close functions like on any other platform so I hardly what I 
could do wrong ghere.

Original comment by ekeeke31@gmail.com on 12 Jan 2011 at 9:39

GoogleCodeExporter commented 8 years ago
Before I forget, state files created with unofficial builds (like rev 502) are 
subject to crash, this is expected. Remember that revisions between official 
builds are BETA and I warned many times about the fact the code is constantly 
evolving at this time, meaning that files saved with a revision might not be 
compatible anymore in the next revision.

Original comment by ekeeke31@gmail.com on 12 Jan 2011 at 9:44

GoogleCodeExporter commented 8 years ago
No i'm not not able to get back to the menu, buttons have no effect and I hear 
no sound, not enough memory free possibly taken up by previsouly loaded game? 
and yes they happened with v1.4.0 also.

Fragmentation could be possibly be down to SDML's mounting of the SD card, when 
I check my sd card in Auslogics Disk Defrag though every new save I create it's 
always fragmented, I'll try using sdload dol loader instead see if I get the 
same result.

Original comment by noddy...@hotmail.co.uk on 13 Jan 2011 at 1:16

GoogleCodeExporter commented 8 years ago
Same result with SD-Load :-(

Original comment by noddy...@hotmail.co.uk on 13 Jan 2011 at 1:32

GoogleCodeExporter commented 8 years ago
Why do you care about "fragmented" files indicated by a PC tool ? It's the way 
the library is writing to SD card and is probably perfectly normal. At least, 
there is absolutely nothing we can do against that and it has probably been 
like this since the beginning and for everybody, never damaged any SD card 
afaik... To sum up, it's not an issue and nothing you should worry about as 
long as files are readable.

Back to your "freeze" issue, I doubt it could be another memory leak (also, 
memory for games is allocated for once when the emulator starts, with the 
maximal ROM size) unless you tell me it usually happens when you switch a lot 
between game and menu. Even in that case, it would not crash randomly while you 
are playing, memory don't get allocated or freed during gameplay so it's most 
likely an exception occuring (but without the normal exception screen) for an 
unknown reason or an hardware failure on your side (I think I've heard that CPU 
or GPU could freeze when overheating, especially if ventilation circuitry is 
damaged).

Since I cannot reproduce this on my side and nobody else has reporting such 
crash so far, I'm afraid it's the later case.

Original comment by ekeeke31@gmail.com on 13 Jan 2011 at 3:00

GoogleCodeExporter commented 8 years ago
I don't care about it damagaing my sd card as I know it probably won't, I just 
think it's bad practice for the emulator to be saving / reading fragmented 
files it doesn't happpen on the saved config file so it shouldn't happen for 
saves.

Original comment by noddy...@hotmail.co.uk on 13 Jan 2011 at 10:15

GoogleCodeExporter commented 8 years ago
config file is way much smaller than save files, hence why it is not fragmented.

I guess it depends on the sector size of your SD card but anyway, as I said, 
it's tied to libfat implementation (i.e it's the same for ALL homebrew) and 
there is nothing I can do against that.

Bad practice or not, the emulator does not care (and does not even know) about 
fragmented chunks, it just uses classic open/read/write/close API, what happen 
at lower hardware level is and should remain transparent and it does not affect 
emulator behavior.

Original comment by ekeeke31@gmail.com on 14 Jan 2011 at 9:03

GoogleCodeExporter commented 8 years ago
I have the same problem with the metal sonic3 & knuckles REV01 hack.

Original comment by bennay...@gmail.com on 14 Jan 2011 at 9:44

GoogleCodeExporter commented 8 years ago
which problem and with which version of the emulator ? The beta version that 
fixes savestate issues is here in comment #20, give it a try.

Original comment by ekeeke31@gmail.com on 14 Jan 2011 at 10:34

GoogleCodeExporter commented 8 years ago
YESSSSS!!!!!!
It loaded the save-state fine after I pasted C20's download via wiixplorer 
transfer method (USB to SD).
THANK YOU!

Original comment by bennay...@gmail.com on 14 Jan 2011 at 11:45

GoogleCodeExporter commented 8 years ago
Having lots of fragmented files on the SD card causes problems for the loading 
of other .dol programs stored on the same SD card, i've noticed this before 
with SD-boot and all the various emulators where they either BlSoD or the R 
gets switched with B in the RGB colours.  

Original comment by noddy...@hotmail.co.uk on 19 Jan 2011 at 12:01

GoogleCodeExporter commented 8 years ago
I've already got BSOD too and it's definitively caused by the DOL file not 
being written properly (copying it back and properly disconnecting the SD 
adapter from PC generally fixes this), there is absolutely no proof that this 
is caused by fragmented files on SD, this is just a guess you made because you 
were looking for some explanation and noticed files were fragmented but to me, 
it does not make many sense, the problem is with the .dol file, not with .srm 
or .gpz files.

Video issues are hardware-related I'm sorry, no way reading stuff from SD and 
loading DOL into memory could switch R & B channels. You sometime got frozen 
green screen issues but it's the same as BSOD, it's the default screen color 
when video is not initialized by the program (because it crashed).

Original comment by ekeeke31@gmail.com on 19 Jan 2011 at 8:02

GoogleCodeExporter commented 8 years ago
Still does not load correctly,I loaded the save-state a second time and some 
sound went missing so I turned high quality FM off,loaded it again,sound worked 
fine,and in a special stage when I get the emerald,it crashes (no dump).

Original comment by bennay...@gmail.com on 19 Jan 2011 at 5:17

GoogleCodeExporter commented 8 years ago
Don't treat me as stupid, I know how write files & from a sd card as well 
properly removing the card reader from the pc, I'm not just throwing it out as 
a explanation, it's fact. If a dol file wasn't properly written to the sd card 
in the first place a defragmentation of over files on the same sd card wouldn't 
make a difference anyway.

Original comment by noddy...@hotmail.co.uk on 19 Jan 2011 at 8:06

GoogleCodeExporter commented 8 years ago
I treat nobody as stupid, I'm trying to explain you that it's impossible to 
prove that fragmented files can have any effect on SD Load: just because it 
worked after you defragmented your SD could be a coincidence, now matter how 
much you are convinced. It just indicates that SDLOAD have some issue with the 
SD file structure. 

As I told you, I got similar issues when trying to load dols and I fixed it by 
simply deleting the dol and copying it back again. There were no .srm or .gpz 
files on that card, only files copied from my PC (rom files) and the default 
ini file. Sometime it does not happen for a while then it happens without any 
reason. See, it could be anything, there is no way to tell what cause that 
issue.

What I'm sure though is that I'm not doing anything special to write files on 
SD, the code did not changed for a while and I think I'm using the fwrite 
function correctly, the only thing that could have an impact would be the 
libfat library and a compatibility issue with SD Load low-level functions 
(never had such problem on Wii for example) so this is out of the scope of this 
emulator.

Now we could discuss this endlessly but I'm afraid there is nothing I can do 
and I think I already took enough time to address your concerns.

Original comment by ekeeke31@gmail.com on 19 Jan 2011 at 10:00

GoogleCodeExporter commented 8 years ago
@bennayboy

your issue seems different than previous ones. If it does not crash when you 
load the state file but later during the game, it's something else. Again, this 
could be lot of things (bugged ROM hack, HBC network/reload bug, hardware 
issue, ...) and not necessarily related to the state file.

About the sound missing, does it happen every time you load that state file 
with HQ FM enabled ? Which version of the emulator did you use to make that 
state file ?

Attaching the problematic file would also help.

Original comment by ekeeke31@gmail.com on 19 Jan 2011 at 10:19

GoogleCodeExporter commented 8 years ago
Throughout everything,it is probably not the save-state itself but the method 
of loading save-states must have some problems.

My save-state was from the latest 1.4.1 commit mentioned before comment 20's 
test file.

I saved over it using c20's update after completing the fifth blue sphere 
special stage in hydrocity zone act 1 in case it wanted to crash again.

Original comment by bennay...@gmail.com on 21 Jan 2011 at 3:25

GoogleCodeExporter commented 8 years ago
The method is fine, it would crash directly when you load the state file 
otherwise.
If the file was saved with an older version, it could explain why sound went 
(FM state is now saved/retsored differntly) but still, it does not happen for 
me with old state files I tested.

AGAIN, can you upload the state file so I can test it ?

Original comment by ekeeke31@gmail.com on 21 Jan 2011 at 8:58

GoogleCodeExporter commented 8 years ago
My upload sucks and to make matters worse my internet is acting up as well.

Original comment by bennay...@gmail.com on 21 Jan 2011 at 8:04

GoogleCodeExporter commented 8 years ago
After I tried again it actually was uploading but then it failed on an error 
page when it hit 100%.

So its not my upload speed after all,I have charter internet that goes 
300kb-1400kb-max2000kb download,but I do not know my upload speed (pretty good).

Original comment by bennay...@gmail.com on 22 Jan 2011 at 5:22

GoogleCodeExporter commented 8 years ago
Fixed in 1.5.0

Original comment by ekeeke31@gmail.com on 31 Mar 2011 at 10:44