GP32X.com - GP32 GP2X Pandora The Wiz - open source entertainment: Drmd Loosing Its Savestates... - GP32X.com - GP32 GP2X Pandora The Wiz - open source entertainment

Jump to content

  • (3 Pages)
  • +
  • 1
  • 2
  • 3
  • You cannot start a new topic
  • You cannot reply to this topic

Drmd Loosing Its Savestates... boohoohoo

#1 User is offline   Tetedeiench

  • GP32 User
  • PipPipPip
Group:
Members
Posts:
73
Joined:
07-December 05

Posted 12 December 2005 - 07:13 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 ?
0

#2 User is offline   Tobriand

  • Mega GP Mania
  • Icon
Group:
X-treme Team
Posts:
3,997
Joined:
27-December 02
Location:
Croydon (UK)
Interests:
Gibbering as I walk down corridors,<br>Trying to bend people to my will over long periods of time, and generally being completely insane...<br><br><br>Mwahahahahahaha

Posted 12 December 2005 - 08:22 AM

I've certainly got one where a savestate became corrupted after turning the unit off (loaded fine beforehand). But it does definitely still appear to be there... it just crashes DrMD when I try to load it...
0

#3 User is offline   Quiest

  • I like turtles!
  • Icon
Group:
GP Guru
Posts:
3,053
Joined:
02-September 04
Gender:
Male
Location:
Dteuschland ;)
Interests:
Bla. Blabla. Blablabla. Blablablabla. Do you really have to read every crap?

Posted 12 December 2005 - 09:59 AM

It happened to me that I overwrite an older savestate an switched the unit off.
As I wanted to continue the game, I loaded the save state from that slot and it was still the old one, not the new one I saved recently :huh:

Strange things going on!
0

#4 User is offline   barnesy

  • GP Mania
  • PipPipPipPipPip
Group:
GP32 Hardcore
Posts:
410
Joined:
05-September 03
Interests:
x

Posted 12 December 2005 - 10:41 AM

I've just tried some quick experiments and I think it's a sync issue. It seems to work fine if you exit DrMD properly, but not if you turn the GP2X off while still in the emulator.

Perhaps it's more complicated than that, but I'm guessing that there's something in there to make DrMD commit changes to the SD card when you exit. Maybe it could do that for each write instead? That'd be one for Reesy - it seems right to me but may have other consequences I don't know about.

But yeah - see if you have more success if you make sure you exit the emu properly when you've finished with it.
0

#5 User is offline   nik166

  • GP Mania
  • PipPipPipPipPip
Group:
GP32 Hardcore
Posts:
496
Joined:
03-March 03

Posted 12 December 2005 - 11:57 AM

i saved one thing, then when i got back to drmd, it said "read error" when i tried to load the save,


and then, the save was gone :P
0

#6 User is offline   Tobriand

  • Mega GP Mania
  • Icon
Group:
X-treme Team
Posts:
3,997
Joined:
27-December 02
Location:
Croydon (UK)
Interests:
Gibbering as I walk down corridors,<br>Trying to bend people to my will over long periods of time, and generally being completely insane...<br><br><br>Mwahahahahahaha

Posted 12 December 2005 - 12:13 PM

Yeah, that's probably it... I've always been turning off from the menu. Might also explain the corrupt files from other games as well (most notably, Narcissu).
0

#7 User is offline   OCA|

  • GP32 Hardcore
  • PipPipPipPip
Group:
Members
Posts:
105
Joined:
23-October 05

Posted 12 December 2005 - 12:43 PM

I've had it happen without powering down the device.

The first time, I went to save state in a game I had saved in once before, on the same slot, overwriting the save, and it simply said "failed" and locked up. This was in Phantasy Star IV

The second time, I was playing Shining Force II and hit L+R to go into the menu. It said "auto-saving SRAM" at the bottom of the screen, and locked up.

I've been really impressed with DrMD so far, but I think I'm going to give it a little more time before I start playing serious RPGs in the thing <_<

-OCA|
0

#8 User is offline   declaration

  • " "
  • PipPipPipPipPipPip
Group:
GP32 Hardcore
Posts:
1,621
Joined:
07-September 03
Location:
UK

Posted 12 December 2005 - 01:19 PM

Yeah, the same happened to me in Shining Force 2.

I have had disappearing savestates as well as currupted save states upon loading.
0

#9 Guest_Reesy_*

Group:
Guests

Posted 12 December 2005 - 01:42 PM

barnesy, on Dec 12 2005, 10:41 AM, said:

I've just tried some quick experiments and I think it's a sync issue.  It seems to work fine if you exit DrMD properly, but not if you turn the GP2X off while still in the emulator. 

Perhaps it's more complicated than that, but I'm guessing that there's something in there to make DrMD commit changes to the SD card when you exit.  Maybe it could do that for each write instead?  That'd be one for Reesy - it seems right to me but may have other consequences I don't know about.

But yeah - see if you have more success if you make sure you exit the emu properly when you've finished with it.
View Post


Interesting idea. At the moment I'm just using the standard file system api:

fopen - open file
fwrite/fread - write or read file
fclose - close file

I'm assuming that when I call fclose it should finalise all of the changes and update the file correctly. I never leave a file opened for more than a nano second. I have no idea if there's another linux command I should be using to force an update, maybe there is something you change. I know in WinXP you can change a setting to make removeable media be written to straight away, so you can remove the media as soon as you see the file copy process has ended. Maybe there is something similar in Linux but I have no idea.
0

#10 User is offline   Quiest

  • I like turtles!
  • Icon
Group:
GP Guru
Posts:
3,053
Joined:
02-September 04
Gender:
Male
Location:
Dteuschland ;)
Interests:
Bla. Blabla. Blablabla. Blablablabla. Do you really have to read every crap?

Posted 12 December 2005 - 02:11 PM

Also, my rom directory file got corrupted - It was just displaying weird names :o Did a rescan and everything was back to normal.
0

#11 User is offline   Mysterial

  • Member
  • PipPip
Group:
Members
Posts:
7
Joined:
27-November 05

Posted 12 December 2005 - 02:20 PM

Reesy, on Dec 12 2005, 08:42 AM, said:

I'm assuming that when I call fclose it should finalise all of the changes and update the file correctly.  I never leave a file opened for more than a nano second.  I have no idea if there's another linux command I should be using to force an update, maybe there is something you change.  I know in WinXP you can change a setting to make removeable media be written to straight away, so you can remove the media as soon as you see the file copy process has ended.  Maybe there is something similar in Linux but I have no idea.
View Post


I think they have write caching enabled, although I have no idea why. IIRC you can call:

system("sync");

to force it to write the data out.

BTW, pretty much everything I have that saves data out has this problem, including all the other emulators, so don't feel like it's a bug that's specific to yours. ;)
0

#12 User is offline   miq01

  • GP32 Hardcore
  • PipPipPipPip
Group:
GP32 Hardcore
Posts:
259
Joined:
27-November 05
Location:
Barcelona, Catalonia

Posted 12 December 2005 - 02:34 PM

Reesy, on Dec 12 2005, 03:42 PM, said:

Interesting idea.  At the moment I'm just using the standard file system api:

fopen - open file
fwrite/fread - write or read file
fclose - close file

I'm assuming that when I call fclose it should finalise all of the changes and update the file correctly.  I never leave a file opened for more than a nano second.  I have no idea if there's another linux command I should be using to force an update, maybe there is something you change.  I know in WinXP you can change a setting to make removeable media be written to straight away, so you can remove the media as soon as you see the file copy process has ended.  Maybe there is something similar in Linux but I have no idea.
View Post

Same behaviour on Tilematch. I noticed that sometimes turning the console off while Tilematch is open doesn't write the hi-scores table to disk, even though I fopen, fwrite, and fclose each time the player gets a high score and enters his/her name. Exiting Tilematch and then turning off seems to work fine.

As Mysterial says, it's probably due to asynchronous writing, so using system("sync"); should do (but I haven't tested it yet), as it turns writing to synchronous.
0

#13 User is offline   Quiest

  • I like turtles!
  • Icon
Group:
GP Guru
Posts:
3,053
Joined:
02-September 04
Gender:
Male
Location:
Dteuschland ;)
Interests:
Bla. Blabla. Blablabla. Blablablabla. Do you really have to read every crap?

Posted 12 December 2005 - 03:40 PM

Yeah I also noticed it for Tilematch, I have to exit for my scores being saved - I lost my best highscore cause of this :(

Great game, btw ^^
0

#14 User is offline   babbagesmachine

  • Member
  • PipPip
Group:
Members
Posts:
24
Joined:
30-November 05

Post icon  Posted 12 December 2005 - 04:34 PM

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.

Maybe not clear ... fclose does not call fflush it lets the os flush the stream when it wants - which might be straight away or in 1 to whatever seconds, calling fflush causes an interupt (slow in relative terms) and demands :o the os flush the steam now... therefore call it before fclose to avaid the problem people are haveing

#include <stdio>;
void lba_game_save(void) {
    FILE *file;
    char *save_location;
    asprintf (&save_location, "%s/.lba/saved_state.lba", getenv ("HOME"));//GNU_LINUX printf to allocated string 
    file = fopen(save_location,"wb+");
    if(!file) {
        fprintf (stderr, "Error writting savegame!: %s\n", save_location);
        exit (1);
    }
    free (save_location);//deallocate file location now its been used
    fprintf (file, "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA");
    fflush (file);//flush file
    fclose (file);
}

This post has been edited by babbagesmachine: 12 December 2005 - 04:45 PM

0

#15 User is offline   EvilDragon

  • There can't be enough evil in this world!
  • PipPipPipPipPipPip
Group:
Admin
Posts:
5,198
Joined:
04-March 03
Location:
Ingolstadt, Germany... somewhere near Munich

Posted 12 December 2005 - 04:55 PM

Yep, it's Linux.
Always sync after saving :)
0

  • (3 Pages)
  • +
  • 1
  • 2
  • 3
  • You cannot start a new topic
  • You cannot reply to this topic