How does the bootloader know where to save the SAV file?

Understanding the language, error messages, etc.

How does the bootloader know where to save the SAV file?

Postby Zvoc47 » Thu Nov 19, 2015 5:38 pm

One thing that confuses me with the bootloader is how does it know where the save file of the previous game should be while loading the new game. Is this done by writing the filename into the EEPROM? How long is that entry? What if it's longer than expected? How does the game know how much space is used in the EEPROM? Does the save file path save into a file on the SD card?
Zvoc47
 
Posts: 56
Joined: Mon Oct 05, 2015 10:03 pm

Re: How does the bootloader know where to save the SAV file?

Postby Risike » Fri Nov 20, 2015 12:12 pm

I think it saves 1KB (all SRAM) and load 1KB (all SRAM) in the .sav file.
Risike
 
Posts: 24
Joined: Mon Sep 14, 2015 5:25 pm

Re: How does the bootloader know where to save the SAV file?

Postby Zvoc47 » Fri Nov 20, 2015 6:06 pm

Thanks for the information, but I asked how does the bootloader know the path of the SAV file.
Zvoc47
 
Posts: 56
Joined: Mon Oct 05, 2015 10:03 pm

Re: How does the bootloader know where to save the SAV file?

Postby Sutchig » Fri Nov 20, 2015 8:21 pm

The name of the current game is stored in flash (not eeprom). The path is the root directory of your sd-card. See https://github.com/Rodot/Gamebuino/blob ... Loader.ino If you load the loader, the content of eeprom is stored as Gamename + .SAV on sd-card
Sutchig
 
Posts: 67
Joined: Sat May 23, 2015 3:48 pm

Re: How does the bootloader know where to save the SAV file?

Postby Zvoc47 » Sat Nov 21, 2015 3:37 pm

I see. Thanks. So if a game is inside of a folder, then the SAV file won't be saved back to the folder, but into the root. Right?
Zvoc47
 
Posts: 56
Joined: Mon Oct 05, 2015 10:03 pm

Re: How does the bootloader know where to save the SAV file?

Postby mougino » Sat Nov 21, 2015 7:57 pm

Games cannot be inside a folder, they won't be listed by the bootloader, so you won't be able to load them, thus unable to save to eeprom.
User avatar
mougino
 
Posts: 75
Joined: Sat Jul 25, 2015 8:15 am
Location: Paris, France

Re: How does the bootloader know where to save the SAV file?

Postby Sorunome » Tue Nov 24, 2015 9:54 pm

On top of that the SAV files are only detected for loading to EEPROM if they are in the root, so basically everything needs to be in the root for it to work, except if you have your game have some additional data you could actually have that additional data be in some folder which you hard-coded in your source.
User avatar
Sorunome
 
Posts: 629
Joined: Sun Mar 01, 2015 1:58 pm

Re: How does the bootloader know where to save the SAV file?

Postby Zvoc47 » Tue Dec 08, 2015 11:56 am

I see.
Game knows its name > Game knows where to save its SAV
Games can only be in root > No folders detectable by bootloader
Games might use folders for data < Requires hard coding for the folder code

Is this correct?
Zvoc47
 
Posts: 56
Joined: Mon Oct 05, 2015 10:03 pm

Re: How does the bootloader know where to save the SAV file?

Postby jonnection » Tue Dec 08, 2015 9:45 pm

Zvoc47 wrote:Games might use folders for data < Requires hard coding for the folder code


The ability/inability to read folders comes from the SD library that you choose. For example in PetitFS library, you can choose to include the functions needed for folder navigation or you can leave them out. This is relevant only to your game program, it does not affect the bootloader or the LOADER.HEX program. Save games should be in the root, if you want loader.hex to be able to load them.
User avatar
jonnection
 
Posts: 317
Joined: Sun May 04, 2014 8:21 pm

Re: How does the bootloader know where to save the SAV file?

Postby Sorunome » Thu Dec 10, 2015 5:37 pm

Zvoc47 wrote:I see.
Game knows its name > Game knows where to save its SAV
No, the game itself doesn't know its name, only the loader does.
When you start a game via the loader it will store the gamename to a dedicated place in flash.
As soon as you return to the loader, it will notice that it returned from a game, read that gamename from flash, and then store all the eeprom to the sav. The game itself doesn't know of all that stuff, let alone its own name.
Games can only be in root > No folders detectable by bootloader

Correct, I thought of getting folders working by making the loader copy games to temporary files in the root but that would have been to big a hassle, rodot and me desided it's better this way
Games might use folders for data < Requires hard coding for the folder code

Again, wrong. They *can* use folders for data, and it is recommended to, but it isn't a must!
User avatar
Sorunome
 
Posts: 629
Joined: Sun Mar 01, 2015 1:58 pm

Next

Return to Programming Questions

Who is online

Users browsing this forum: No registered users and 5 guests

cron