Nice... I'll try that.To flush to a file use this its exactly what you want and the normal thing to do when you really need to make sure a file is written now!! rather than when the app closes its a very under used function but applications where data integrity is vital will normaly call it after every write.
Drmd Loosing Its Savestates...
#16
Posted 12 December 2005 - 04:59 PM
#17
Posted 12 December 2005 - 05:49 PM
Nice... I'll try that.To flush to a file use this its exactly what you want and the normal thing to do when you really need to make sure a file is written now!! rather than when the app closes its a very under used function but applications where data integrity is vital will normaly call it after every write.
fclose() will perform fflush() automatically - so your buffered data will be written to the file system. However, that's not the problem - what you really need to do is call sync() after fclose(), which causes all filesystems to flush their writeback caches to the physical device.
http://seth.positivi.../man.cgi/2/sync
is a link to the man page, but it's just void sync(void); and can be found in unistd.h
#18
Posted 12 December 2005 - 05:55 PM
Nice... I'll try that.To flush to a file use this its exactly what you want and the normal thing to do when you really need to make sure a file is written now!! rather than when the app closes its a very under used function but applications where data integrity is vital will normaly call it after every write.
fclose() will perform fflush() automatically - so your buffered data will be written to the file system. However, that's not the problem - what you really need to do is call sync() after fclose(), which causes all filesystems to flush their writeback caches to the physical device.
http://seth.positivi.../man.cgi/2/sync
is a link to the man page, but it's just void sync(void); and can be found in unistd.h
Oh, forgot to mention that you can download a .gpu script which will do the same thing. Just run it after leaving your emulator and before switching off the gp2x and your savestate will be fine.
http://www.gp32x.com...showtopic=22938
#24
Posted 12 December 2005 - 09:53 PM
Just to confirm that it works. I opened Tilematch, played for one minute, saved my score, and immediately after that, I turned GP2X off without quitting. After starting again, that score was there. Thanks!fclose() will perform fflush() automatically - so your buffered data will be written to the file system. However, that's not the problem - what you really need to do is call sync() after fclose(), which causes all filesystems to flush their writeback caches to the physical device.
#25
Posted 12 December 2005 - 10:38 PM
Heya guys,
I'm having trouble with DrMD. I am launching a rom ( for instance, Sonic3), playing a tad, then making a savestate ( L+R to go back in menu, i select "save state", choose slot0, menu says slot is used, perfect, fine).
I can then load it just fine, it works flawlessly.
However, sometimes, when i load back DrMD, it says that no savestate is used... i know somebody which had the same bug, all savestates disappearing.
I have trouble reproducing it though ( sorry reeesy, can't give you more info).
Anyone else has the very same problems ?
First off, why are you using Savestates with Sonic 3? I'm pretty sure that ROM can save onto itself, no save state required. (If it's not a dirty rom that is)
#26
Guest_Reesy_*
Posted 12 December 2005 - 10:41 PM
I've just tested sync and it looks like it fixes the problem. I'll release another version a bit later then you lot can do your worst to it
#27
Posted 13 December 2005 - 04:51 AM
#28
Posted 13 December 2005 - 06:14 AM
Heya guys,
I'm having trouble with DrMD. I am launching a rom ( for instance, Sonic3), playing a tad, then making a savestate ( L+R to go back in menu, i select "save state", choose slot0, menu says slot is used, perfect, fine).
I can then load it just fine, it works flawlessly.
However, sometimes, when i load back DrMD, it says that no savestate is used... i know somebody which had the same bug, all savestates disappearing.
I have trouble reproducing it though ( sorry reeesy, can't give you more info).
Anyone else has the very same problems ?
First off, why are you using Savestates with Sonic 3? I'm pretty sure that ROM can save onto itself, no save state required. (If it's not a dirty rom that is)
Because i'd rather loose a sonic3 savestate than a Story of thor
I'm happy this is fixed
#29
Posted 13 December 2005 - 09:26 AM
Because you would have the same problem. I never use sync(), so even after saving a sram file, if you switch the gp2x before linux decides to actually write the file to disk you will be buggered.
I've just tested sync and it looks like it fixes the problem. I'll release another version a bit later then you lot can do your worst to it
I think we ought to put a reminder to call sync() after fclose() somewhere in the development help docs...












