@@ -106,6 +106,49 @@ EXPORTED void desmume_savestate_slot_save(int index);
106106EXPORTED BOOL desmume_savestate_slot_exists (int index);
107107EXPORTED char * desmume_savestate_slot_date (int index);
108108
109+ // Battery save (backup memory) import/export
110+
111+ /* *
112+ * Import battery save file with optional size override.
113+ * Supports .sav (raw), .dsv (DeSmuME), .duc (Action Replay), .dss (DSOrganize).
114+ * The emulator will automatically reset after successful import.
115+ *
116+ * Prerequisites:
117+ * - MMU_new.backupDevice is a global object initialized at program startup
118+ * - A ROM should be loaded via desmume_open() first - the BackupDevice constructor
119+ * checks gameInfo.romsize and returns early if no ROM is loaded, preventing
120+ * proper initialization of the save file path
121+ *
122+ * Typical usage:
123+ * desmume_init(); // Initialize emulator
124+ * desmume_open("game.nds"); // Load ROM (initializes backup device filename)
125+ * desmume_backup_import_file("save.sav", 0); // Now safe to import
126+ *
127+ * @param filename Path to battery save file
128+ * @param force_size Backup size in bytes (0 = auto-detect, or explicit size like 524288 for 512KB)
129+ * @return TRUE on success, FALSE on failure
130+ */
131+ EXPORTED BOOL desmume_backup_import_file (const char *filename, unsigned int force_size);
132+
133+ /* *
134+ * Export current battery save to .dsv file.
135+ *
136+ * Prerequisites:
137+ * - MMU_new.backupDevice is a global object initialized at program startup
138+ * - A ROM must be loaded via desmume_open() first - the BackupDevice needs
139+ * the ROM to be loaded to have a valid save filename and data
140+ *
141+ * Typical usage:
142+ * desmume_init(); // Initialize emulator
143+ * desmume_open("game.nds"); // Load ROM
144+ * // ... play game, save data is created ...
145+ * desmume_backup_export_file("backup.dsv"); // Export save data
146+ *
147+ * @param filename Destination path for .dsv file
148+ * @return TRUE on success, FALSE on failure
149+ */
150+ EXPORTED BOOL desmume_backup_export_file (const char *filename);
151+
109152EXPORTED BOOL desmume_gpu_get_layer_main_enable_state (int layer_index);
110153EXPORTED BOOL desmume_gpu_get_layer_sub_enable_state (int layer_index);
111154EXPORTED void desmume_gpu_set_layer_main_enable_state (int layer_index, BOOL the_state);
0 commit comments