mirror of https://github.com/mgba-emu/mgba.git
Unmask savedata if reseting while a movie is not recording or replaying
This commit is contained in:
parent
f8fff828e3
commit
d979e04606
|
@ -18,6 +18,7 @@ void GBASavedataInit(struct GBASavedata* savedata, struct VFile* vf) {
|
||||||
savedata->command = EEPROM_COMMAND_NULL;
|
savedata->command = EEPROM_COMMAND_NULL;
|
||||||
savedata->flashState = FLASH_STATE_RAW;
|
savedata->flashState = FLASH_STATE_RAW;
|
||||||
savedata->vf = vf;
|
savedata->vf = vf;
|
||||||
|
savedata->realVf = vf;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GBASavedataDeinit(struct GBASavedata* savedata) {
|
void GBASavedataDeinit(struct GBASavedata* savedata) {
|
||||||
|
@ -57,12 +58,18 @@ void GBASavedataDeinit(struct GBASavedata* savedata) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
savedata->data = 0;
|
||||||
savedata->type = SAVEDATA_NONE;
|
savedata->type = SAVEDATA_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GBASavedataMask(struct GBASavedata* savedata, struct VFile* vf) {
|
void GBASavedataMask(struct GBASavedata* savedata, struct VFile* vf) {
|
||||||
GBASavedataDeinit(savedata);
|
GBASavedataDeinit(savedata);
|
||||||
GBASavedataInit(savedata, vf);
|
savedata->vf = vf;
|
||||||
|
}
|
||||||
|
|
||||||
|
void GBASavedataUnmask(struct GBASavedata* savedata) {
|
||||||
|
GBASavedataDeinit(savedata);
|
||||||
|
savedata->vf = savedata->realVf;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GBASavedataInitFlash(struct GBASavedata* savedata) {
|
void GBASavedataInitFlash(struct GBASavedata* savedata) {
|
||||||
|
|
|
@ -57,6 +57,7 @@ struct GBASavedata {
|
||||||
uint8_t* data;
|
uint8_t* data;
|
||||||
enum SavedataCommand command;
|
enum SavedataCommand command;
|
||||||
struct VFile* vf;
|
struct VFile* vf;
|
||||||
|
struct VFile* realVf;
|
||||||
|
|
||||||
int readBitsRemaining;
|
int readBitsRemaining;
|
||||||
int readAddress;
|
int readAddress;
|
||||||
|
@ -71,7 +72,9 @@ struct GBASavedata {
|
||||||
|
|
||||||
void GBASavedataInit(struct GBASavedata* savedata, struct VFile* vf);
|
void GBASavedataInit(struct GBASavedata* savedata, struct VFile* vf);
|
||||||
void GBASavedataDeinit(struct GBASavedata* savedata);
|
void GBASavedataDeinit(struct GBASavedata* savedata);
|
||||||
|
|
||||||
void GBASavedataMask(struct GBASavedata* savedata, struct VFile* vf);
|
void GBASavedataMask(struct GBASavedata* savedata, struct VFile* vf);
|
||||||
|
void GBASavedataUnmask(struct GBASavedata* savedata);
|
||||||
|
|
||||||
void GBASavedataInitFlash(struct GBASavedata* savedata);
|
void GBASavedataInitFlash(struct GBASavedata* savedata);
|
||||||
void GBASavedataInitEEPROM(struct GBASavedata* savedata);
|
void GBASavedataInitEEPROM(struct GBASavedata* savedata);
|
||||||
|
|
|
@ -187,6 +187,9 @@ void GBAReset(struct ARMCore* cpu) {
|
||||||
cpu->gprs[ARM_SP] = SP_BASE_SYSTEM;
|
cpu->gprs[ARM_SP] = SP_BASE_SYSTEM;
|
||||||
|
|
||||||
struct GBA* gba = (struct GBA*) cpu->master;
|
struct GBA* gba = (struct GBA*) cpu->master;
|
||||||
|
if (!GBARRIsPlaying(gba->rr) && !GBARRIsRecording(gba->rr)) {
|
||||||
|
GBASavedataUnmask(&gba->memory.savedata);
|
||||||
|
}
|
||||||
GBAMemoryReset(gba);
|
GBAMemoryReset(gba);
|
||||||
GBAVideoReset(&gba->video);
|
GBAVideoReset(&gba->video);
|
||||||
GBAAudioReset(&gba->audio);
|
GBAAudioReset(&gba->audio);
|
||||||
|
|
Loading…
Reference in New Issue