MCPcopy Create free account
hub / github.com/dborth/vbagx / MemCPUWriteBatteryFile

Function MemCPUWriteBatteryFile

source/vbasupport.cpp:252–294  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

250extern int gbaSaveType;
251
252int MemCPUWriteBatteryFile(char * membuffer)
253{
254 int result = 0;
255 if(gbaSaveType == 0)
256 {
257 if(eepromInUse)
258 gbaSaveType = 3;
259 else
260 switch(saveType)
261 {
262 case 1:
263 gbaSaveType = 1;
264 break;
265 case 2:
266 gbaSaveType = 2;
267 break;
268 }
269 }
270
271 if((gbaSaveType) && (gbaSaveType!=5))
272 {
273 // only save if Flash/Sram in use or EEprom in use
274 if(gbaSaveType != 3)
275 {
276 if(gbaSaveType == 2)
277 {
278 memcpy(membuffer, flashSaveMemory, flashSize);
279 result = flashSize;
280 }
281 else
282 {
283 memcpy(membuffer, flashSaveMemory, 0x10000);
284 result = 0x10000;
285 }
286 }
287 else
288 {
289 memcpy(membuffer, eepromData, eepromSize);
290 result = eepromSize;
291 }
292 }
293 return result;
294}
295
296/****************************************************************************
297* LoadBatteryOrState

Callers 1

SaveBatteryOrStateFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected