Skip to main content

Save System

MD Engine supports saving on both the Flash memory and the SRAM memory, you can change the way of saving on the Settings.

For you there won't be any difference between using Flash or SRAM saving, as MD Engine manages that internally.

You only need to select what you want in the settings menu. Nonetheless, we have outlined a few important things about each system so you can make an informed choice.

Saving Procedure

The saving procedure consists of either Game Data Save or Game Data Load events.

Each of these events takes a process script.

Process Script

The process script has the responsibility of processing the variables and arrays to the save system.

warning

If you need to patch the game, be aware removing variables from the process script is very risky.

Adding a new variable is less risky, but make sure to test properly.

Saving Types

There are two types of saving systems: Flash Saving and SRAM Saving.

Flash Saving

Flash saving relies on modifying the end part of the flash chip where the game is stored.

MD Engine uses the SGDK flash saving module and save manager which supports the following features:

  • Wear leveling - The module intelligently appends data in an efficient way to avoid flash chip wear as much as possible. The mechanism is specially efficient if you use small slots with big flash sectors.
  • Safe save - The module avoids data loss even in the case of a power cut while data is being saved. In this case, the incomplete save condition is detected on initialization, and data is corrected, so you can keep the last data set properly recorded before the incomplete save was initiated.

You can back up and restore flash save data directly from hardware using the Flash ROM to Cart tool.

Flash Saving restrictions

Saving directly to the flash has one clear advantage: you don't need extra parts on your PCB like SRAM, a battery, or an FRAM chip. Your data will also last longer since there’s no battery to run out.

On the other hand, there are a few limitations you should be aware of:

  • Smaller ROM space - The save data area takes space from your game. It's something to plan for if your game is going to be large.
  • No Music or Sounds while saving - Most save functions stop the audio. This means you can't play music or sound during saving.

These are normally not a big deal, but sometimes they can be serious enough that you might prefer using an SRAM saving instead.

warning

If you use our desktop or web exports, this won't affect you. That's why this is not on the restrictions list, but it's still worth mentioning.

There is no emulator support currently for flash saving!

So if you were planning on using any other emulator besides our desktop or web export, be aware of this!

SRAM Saving

You can read and write SRAM save data directly from hardware using the Flash ROM to Cart tool. It exports emulator-compatible .srm files and can import them back.

SRAM saving falls back to the use of the classic static RAM (SRAM) chip + battery module or ferroelectric RAM (FRAM) chip, which does not need a battery but is more expensive.

You need to be aware of this if you are planning to produce your own games and ship them to your players as SRAM normally relies on CR2032 lithium batteries, which may have complicated shipping procedures.

Beyond the shipping concerns, cartridge costs may be higher than when using regular flash saving, but you won't be limited to the previous restrictions.