Win32: Show whether save state exists when slot selected.

This commit is contained in:
BearOso 2024-05-07 14:01:37 -05:00
parent 77f86ef4b6
commit 73cb8014f1
2 changed files with 20 additions and 10 deletions

View File

@ -360,7 +360,7 @@ Nintendo is a trademark.")
// Save Messages
#define FREEZE_INFO_SET_SLOT_N "Set save slot %03d"
#define FREEZE_INFO_SET_SLOT_N "Set save slot %03d [%s]"
#define FREEZE_INFO_SET_BANK_N "Set save bank %03d"
// AVI Messages

View File

@ -727,6 +727,22 @@ static char InfoString [100];
static uint32 prevPadReadFrame = (uint32)-1;
static bool skipNextFrameStop = false;
static void ShowStatusSlotInfo()
{
static char str[64];
char filename[_MAX_PATH + 1]
GetSlotFilename(GUI.CurrentSaveBank * SAVE_SLOTS_PER_BANK + GUI.CurrentSaveSlot, filename);
bool exists = false;
struct stat stats;
if (stat(filename, &stats) == 0)
exists = true;
sprintf(str, FREEZE_INFO_SET_SLOT_N, GUI.CurrentSaveSlot, exists ? "used" : "empty");
S9xSetInfoString(str);
}
int HandleKeyMessage(WPARAM wParam, LPARAM lParam)
{
// update toggles
@ -889,9 +905,7 @@ int HandleKeyMessage(WPARAM wParam, LPARAM lParam)
if(GUI.CurrentSaveSlot > LAST_SAVE_SLOT_IN_BANK)
GUI.CurrentSaveSlot = 0;
static char str [64];
sprintf(str, FREEZE_INFO_SET_SLOT_N, GUI.CurrentSaveSlot);
S9xSetInfoString(str);
ShowStatusSlotInfo();
hitHotKey = true;
}
@ -902,9 +916,7 @@ int HandleKeyMessage(WPARAM wParam, LPARAM lParam)
if(GUI.CurrentSaveSlot < 0)
GUI.CurrentSaveSlot = 9;
static char str [64];
sprintf(str, FREEZE_INFO_SET_SLOT_N, GUI.CurrentSaveSlot);
S9xSetInfoString(str);
ShowStatusSlotInfo();
hitHotKey = true;
}
@ -1270,9 +1282,7 @@ int HandleKeyMessage(WPARAM wParam, LPARAM lParam)
{
GUI.CurrentSaveSlot = GUI.CurrentSaveBank * SAVE_SLOTS_PER_BANK + i;
static char str [64];
sprintf(str, FREEZE_INFO_SET_SLOT_N, GUI.CurrentSaveSlot);
S9xSetInfoString(str);
ShowStatusSlotInfo();
hitHotKey = true;
}