What's new

Diskfull savestate (+patch)

oliver

New member
Hello All.

I noticed yesterday after 30 minutes of messing around that mupen64 currently does not notify the user, in anyway, that it can't write a savestate because of a full disk.

Thing was, I could write 2 savestates earlier, and they worked just fine, just new states would work. So at first I thought it was because in the specific region I was in or the like. Obviously the first thing I did was running it from the console to see what was going on, but nothing. It wasn't until I tried to save my local_freevo.conf that it was complaining that I might be out of diskspace. D'oh.

So I started this little patch that checks wether the file was written. However it's not entirely done. Right now, it'll only fail if it could not write anything, which I belive is wrong, if you have 36bytes free and it tries to write the first 32bytes, it should still fill 'written' with 32bytes. OtH all statefiles where on my disk 0bytes whereas I did have about 40k free.

One idea was to only check if the last write would have worked, or even better, check against the amount of bytes we would have wanted to be written in the firstplace, however that would slow down writing savestates as it would have to do the little math needed to add up all those amounts.

Writing this I actually figured a nother option. init written explicitly with 0, add the amounts written as it is now, and subtract the amount that should have been written. It should then equal out to zero in the end.

(Note: gzwrite returns uncompressed bytes written so that should work out just fine)

Your thoughts would be appreciated.
 

Top