- auto-save profile when cheats are unlocked

This commit is contained in:
InspirationByte 2022-02-04 09:30:13 +03:00
parent 819597fba3
commit bd16f67cfd
5 changed files with 14 additions and 7 deletions

View File

@ -177,7 +177,7 @@ void LoadCurrentProfile(int init)
} }
// [A] saves config to file // [A] saves config to file
void SaveCurrentProfile() void SaveCurrentProfile(int showMessage)
{ {
#ifndef PSX #ifndef PSX
int dataSize; int dataSize;
@ -188,8 +188,11 @@ void SaveCurrentProfile()
strcat(filePath, "/config.dat"); strcat(filePath, "/config.dat");
SetTextColour(128, 128, 64); if (showMessage)
ShowSavingWaitMessage(G_LTXT(GTXT_SavingConfiguration), 0); {
SetTextColour(128, 128, 64);
ShowSavingWaitMessage(G_LTXT(GTXT_SavingConfiguration), 0);
}
dataSize = 0; dataSize = 0;
if (SaveConfigData((char*)_other_buffer)) if (SaveConfigData((char*)_other_buffer))
@ -207,7 +210,7 @@ void SaveCurrentProfile()
error = 0; error = 0;
} }
if (error) if (error && showMessage)
{ {
SetTextColour(128, 0, 0); SetTextColour(128, 0, 0);
ShowSavingWaitMessage(G_LTXT(GTXT_SavingError), 0); ShowSavingWaitMessage(G_LTXT(GTXT_SavingError), 0);

View File

@ -4,7 +4,7 @@
extern char gCurrentReplayFilename[64]; extern char gCurrentReplayFilename[64];
extern void LoadCurrentProfile(int init); extern void LoadCurrentProfile(int init);
extern void SaveCurrentProfile(); extern void SaveCurrentProfile(int showMessage);
extern int LoadCurrentGame(); extern int LoadCurrentGame();
extern void SaveCurrentGame(); extern void SaveCurrentGame();

View File

@ -2116,7 +2116,7 @@ int redriver2_main(int argc, char** argv)
DoStateLoop(); DoStateLoop();
#ifndef PSX #ifndef PSX
SaveCurrentProfile(); SaveCurrentProfile(1);
#endif #endif
return 1; return 1;

View File

@ -1661,6 +1661,10 @@ int MRCommand(MR_THREAD *thread, u_int cmd)
AvailableCheats.cheat4 = 1; AvailableCheats.cheat4 = 1;
} }
#ifndef PSX
SaveCurrentProfile(0);
#endif
return 1; return 1;
} }
else if (cmd == 0x1000090) // SetRaining else if (cmd == 0x1000090) // SetRaining

View File

@ -530,7 +530,7 @@ void SetVariable(int var)
if (value == 0) if (value == 0)
{ {
// [A] save configuration // [A] save configuration
SaveCurrentProfile(); SaveCurrentProfile(1);
} }
else else
{ {