.sav file creation

Post Reply
radiodee1
Posts: 10
Joined: Sat Dec 05, 2009 8:50 pm

.sav file creation

Post by radiodee1 » Thu Dec 17, 2009 12:05 am

HI. Greetings.

I'm writing a small game program that I'd like to keep high scores on. I've read, on a separate note, about copying the saved states for the games you already have over to a ".sav" file for use on your slot-1 device. This is always for commercially produced games. I'm guessing that these techniques actually copy info from the eeprom. Here's my question.

If you have a slot-1 device, like an acekard2, and you write your own homebrew game, is there any way of making a ".sav" file for your game so that it acts just like other games with ".sav" files?

After reading posts on this forum and searching around the net I am interested in a way to do this. I've read that you can read and write directly to the eeprom via the functions in card.h. I tried the example program, called eeprom.nds, on my Acekard2 and got what I suspect is garbage. I don't know what that means. Was I seeing something that was encrypted or maybe some of the contents of the flash card? I don't have another game to try out

Thanks for your time.

User avatar
Izhido
Posts: 107
Joined: Fri Oct 19, 2007 10:57 pm
Location: Costa Rica
Contact:

Re: .sav file creation

Post by Izhido » Fri Dec 18, 2009 4:16 pm

Well... my game actually uses a double (triple?) approach:

- If there is a filesystem I can use, I go for it immediately, without even questioning it (scores are saved on a BITSWP.sco file at root);
- If there isn't, I attempt to write to EEPROM (I built a class specifically designed for that), without caring how the underlying hardware stores that data;
- If everything above fails, I simply do *not* keep scores of any kind.

It works for me :) . I don't actually worry about any implications of mixed storage here; you don't usually exchange card media while playing games like these.

Hope you find it useful.

radiodee1
Posts: 10
Joined: Sat Dec 05, 2009 8:50 pm

Re: .sav file creation

Post by radiodee1 » Fri Dec 18, 2009 9:58 pm

So getting specific to my situation... when you write to the eeprom, and you have an acekard2 like I do, does the hardware automatically write to a .sav file? What will an emulator like desmume or no$gba do?

User avatar
Izhido
Posts: 107
Joined: Fri Oct 19, 2007 10:57 pm
Location: Costa Rica
Contact:

Re: .sav file creation

Post by Izhido » Fri Dec 18, 2009 10:51 pm

Hard to say, since I don't actually own an acekard. However, if you have one of those, and can load .nds apps without making use of a SD card, you can always download my game to see what happens: http://dsotaku.drunkencoders.com/Bitswe ... weeper.zip

Either that, or you could grab the sources, set a boolean in main() to false (effectively "disabling" filesystem support), and load the .nds normally. Your choice :) .

radiodee1
Posts: 10
Joined: Sat Dec 05, 2009 8:50 pm

Re: .sav file creation

Post by radiodee1 » Sat Dec 19, 2009 2:12 pm

I'm not sure I know what you mean when you say; "if you have one of those, and can load .nds apps without making use of a SD card" BUT I downloaded the game and the source file... The game seems to work on my ds, but I couldn't get the source to compile. I'm using a linux system, so I had to rename the Make file (with a capital M), and then I got a lot of "XXX was not declared in this scope" errors for the MainEntryPoint.cpp file. I suppose it's an issue with what version of the toolchain I'm using. I did try to pass different arguments to the 'main' function, but since it wasn't compiling it was pretty pointless. Anyway, it's a nice game. Thanks also for replying to my post.

PS. How high a score in Bitsweeper do you have to get before it saves yours as a high score?

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest