mirror of
https://github.com/dborth/fceugx.git
synced 2025-01-07 14:28:18 +01:00
sync
This commit is contained in:
parent
799e9b0b05
commit
251be42e0b
@ -243,7 +243,8 @@ uint8 GetMem(uint16 A) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ((A >= 0x4000) && (A < 0x6000)) return 0xFF; //fix me
|
else if ((A >= 0x4000) && (A < 0x6000)) return 0xFF; //fix me
|
||||||
return ARead[A](A);
|
if (GameInfo) return ARead[A](A); //adelikat: 11/17/09: Prevent crash if this is called with no game loaded.
|
||||||
|
else return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8 GetPPUMem(uint8 A) {
|
uint8 GetPPUMem(uint8 A) {
|
||||||
|
@ -191,8 +191,10 @@ int frameAdvanceDelay;
|
|||||||
//indicates that the emulation core just frame advanced (consumed the frame advance state and paused)
|
//indicates that the emulation core just frame advanced (consumed the frame advance state and paused)
|
||||||
bool JustFrameAdvanced=false;
|
bool JustFrameAdvanced=false;
|
||||||
|
|
||||||
static int AutosaveStatus[4] = {0, 0, 0, 0}; //is it safe to load Auto-savestate
|
static int *AutosaveStatus; //is it safe to load Auto-savestate
|
||||||
static int AutosaveIndex = 0; //which Auto-savestate we're on
|
static int AutosaveIndex = 0; //which Auto-savestate we're on
|
||||||
|
int AutosaveQty = 4; // Number of Autosaves to store
|
||||||
|
int AutosaveFrequency = 256; // Number of frames between autosaves
|
||||||
|
|
||||||
// Flag that indicates whether the Auto-save option is enabled or not
|
// Flag that indicates whether the Auto-save option is enabled or not
|
||||||
int EnableAutosave = 0;
|
int EnableAutosave = 0;
|
||||||
@ -414,8 +416,10 @@ FCEUGI *FCEUI_LoadGameVirtual(const char *name, int OverwriteVidMode)
|
|||||||
|
|
||||||
ResetGameLoaded();
|
ResetGameLoaded();
|
||||||
|
|
||||||
AutosaveStatus[0] = AutosaveStatus[1] = 0;
|
if (!AutosaveStatus)
|
||||||
AutosaveStatus[2] = AutosaveStatus[3] = 0;
|
AutosaveStatus = (int*)malloc(sizeof(int)*AutosaveQty);
|
||||||
|
for (AutosaveIndex=0; AutosaveIndex<AutosaveQty; ++AutosaveIndex)
|
||||||
|
AutosaveStatus[AutosaveIndex] = 0;
|
||||||
|
|
||||||
CloseGame();
|
CloseGame();
|
||||||
GameInfo = new FCEUGI();
|
GameInfo = new FCEUGI();
|
||||||
@ -945,10 +949,10 @@ void UpdateAutosave(void)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
char * f;
|
char * f;
|
||||||
AutosaveCounter = (AutosaveCounter + 1) % 256;
|
if(++AutosaveCounter >= AutosaveFrequency)
|
||||||
if(AutosaveCounter == 0)
|
|
||||||
{
|
{
|
||||||
AutosaveIndex = (AutosaveIndex + 1) % 4;
|
AutosaveCounter = 0;
|
||||||
|
AutosaveIndex = (AutosaveIndex + 1) % AutosaveQty;
|
||||||
f = strdup(FCEU_MakeFName(FCEUMKF_AUTOSTATE,AutosaveIndex,0).c_str());
|
f = strdup(FCEU_MakeFName(FCEUMKF_AUTOSTATE,AutosaveIndex,0).c_str());
|
||||||
FCEUSS_Save(f);
|
FCEUSS_Save(f);
|
||||||
AutoSS = true; //Flag that an auto-savestate was made
|
AutoSS = true; //Flag that an auto-savestate was made
|
||||||
@ -970,9 +974,9 @@ void FCEUI_Autosave(void)
|
|||||||
free(f);
|
free(f);
|
||||||
|
|
||||||
//Set pointer to previous available slot
|
//Set pointer to previous available slot
|
||||||
if(AutosaveStatus[(AutosaveIndex + 3)%4] == 1)
|
if(AutosaveStatus[(AutosaveIndex + AutosaveQty-1)%AutosaveQty] == 1)
|
||||||
{
|
{
|
||||||
AutosaveIndex = (AutosaveIndex + 3)%4;
|
AutosaveIndex = (AutosaveIndex + AutosaveQty-1)%AutosaveQty;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Reset time to next Auto-save
|
//Reset time to next Auto-save
|
||||||
|
Loading…
Reference in New Issue
Block a user