mirror of https://github.com/snes9xgit/snes9x.git
[BS-X] Save Memory Pack option (Windows)
This commit is contained in:
parent
17fa454a1e
commit
50228801f1
26
memmap.cpp
26
memmap.cpp
|
@ -2210,6 +2210,32 @@ bool8 CMemory::SaveSRAM (const char *filename)
|
||||||
return (FALSE);
|
return (FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool8 CMemory::SaveMPAK (const char *filename)
|
||||||
|
{
|
||||||
|
if (Settings.BS || (Multi.cartSizeB && (Multi.cartType == 3)))
|
||||||
|
{
|
||||||
|
FILE *file;
|
||||||
|
int size;
|
||||||
|
char mempakName[PATH_MAX + 1];
|
||||||
|
|
||||||
|
strcpy(mempakName, filename);
|
||||||
|
size = 0x100000;
|
||||||
|
if (size)
|
||||||
|
{
|
||||||
|
file = fopen(mempakName, "wb");
|
||||||
|
if (file)
|
||||||
|
{
|
||||||
|
size_t ignore;
|
||||||
|
ignore = fwrite((char *)Memory.ROM + Multi.cartOffsetB, size, 1, file);
|
||||||
|
fclose(file);
|
||||||
|
|
||||||
|
return (TRUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return (FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
// initialization
|
// initialization
|
||||||
|
|
||||||
static uint32 caCRC32 (uint8 *array, uint32 size, uint32 crc32)
|
static uint32 caCRC32 (uint8 *array, uint32 size, uint32 crc32)
|
||||||
|
|
1
memmap.h
1
memmap.h
|
@ -291,6 +291,7 @@ struct CMemory
|
||||||
void ClearSRAM (bool8 onlyNonSavedSRAM = 0);
|
void ClearSRAM (bool8 onlyNonSavedSRAM = 0);
|
||||||
bool8 LoadSRTC (void);
|
bool8 LoadSRTC (void);
|
||||||
bool8 SaveSRTC (void);
|
bool8 SaveSRTC (void);
|
||||||
|
bool8 SaveMPAK (const char *);
|
||||||
|
|
||||||
char * Safe (const char *);
|
char * Safe (const char *);
|
||||||
char * SafeANK (const char *);
|
char * SafeANK (const char *);
|
||||||
|
|
|
@ -496,13 +496,14 @@
|
||||||
#define ID_WINDOW_SIZE_4X 40172
|
#define ID_WINDOW_SIZE_4X 40172
|
||||||
#define ID_DEBUG_APU_TRACE 40173
|
#define ID_DEBUG_APU_TRACE 40173
|
||||||
#define ID_EMULATION_BACKGROUNDINPUT 40174
|
#define ID_EMULATION_BACKGROUNDINPUT 40174
|
||||||
|
#define ID_SAVEMEMPACK 40175
|
||||||
|
|
||||||
// Next default values for new objects
|
// Next default values for new objects
|
||||||
//
|
//
|
||||||
#ifdef APSTUDIO_INVOKED
|
#ifdef APSTUDIO_INVOKED
|
||||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||||
#define _APS_NEXT_RESOURCE_VALUE 151
|
#define _APS_NEXT_RESOURCE_VALUE 151
|
||||||
#define _APS_NEXT_COMMAND_VALUE 40175
|
#define _APS_NEXT_COMMAND_VALUE 40176
|
||||||
#define _APS_NEXT_CONTROL_VALUE 3018
|
#define _APS_NEXT_CONTROL_VALUE 3018
|
||||||
#define _APS_NEXT_SYMED_VALUE 101
|
#define _APS_NEXT_SYMED_VALUE 101
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -822,6 +822,7 @@ BEGIN
|
||||||
MENUITEM "S&ave SPC Data", ID_FILE_SAVE_SPC_DATA
|
MENUITEM "S&ave SPC Data", ID_FILE_SAVE_SPC_DATA
|
||||||
MENUITEM "Save Screenshot", ID_SAVESCREENSHOT
|
MENUITEM "Save Screenshot", ID_SAVESCREENSHOT
|
||||||
MENUITEM "Sa&ve S-RAM Data", ID_FILE_SAVE_SRAM_DATA
|
MENUITEM "Sa&ve S-RAM Data", ID_FILE_SAVE_SRAM_DATA
|
||||||
|
MENUITEM "Save Memory Pack", ID_SAVEMEMPACK
|
||||||
END
|
END
|
||||||
MENUITEM "ROM Information...", IDM_ROM_INFO
|
MENUITEM "ROM Information...", IDM_ROM_INFO
|
||||||
MENUITEM SEPARATOR
|
MENUITEM SEPARATOR
|
||||||
|
|
|
@ -588,6 +588,8 @@ Nintendo is a trade mark.")
|
||||||
|
|
||||||
#define INFO_SAVE_SPC "Saving SPC Data."
|
#define INFO_SAVE_SPC "Saving SPC Data."
|
||||||
|
|
||||||
|
#define MPAK_SAVE_FAILED "Failed to save Memory Pack."
|
||||||
|
|
||||||
#define CHEATS_INFO_ENABLED "Cheats enabled."
|
#define CHEATS_INFO_ENABLED "Cheats enabled."
|
||||||
#define CHEATS_INFO_DISABLED "Cheats disabled."
|
#define CHEATS_INFO_DISABLED "Cheats disabled."
|
||||||
#define CHEATS_INFO_ENABLED_NONE "Cheats enabled. (None are active.)"
|
#define CHEATS_INFO_ENABLED_NONE "Cheats enabled. (None are active.)"
|
||||||
|
|
|
@ -2239,6 +2239,17 @@ LRESULT CALLBACK WinProc(
|
||||||
if(!success)
|
if(!success)
|
||||||
S9xMessage(S9X_ERROR, S9X_FREEZE_FILE_INFO, SRM_SAVE_FAILED);
|
S9xMessage(S9X_ERROR, S9X_FREEZE_FILE_INFO, SRM_SAVE_FAILED);
|
||||||
} break;
|
} break;
|
||||||
|
case ID_SAVEMEMPACK: {
|
||||||
|
const char *filename = S9xGetFilenameInc(".bs", SRAM_DIR);
|
||||||
|
bool8 success = Memory.SaveMPAK(filename);
|
||||||
|
if (!success)
|
||||||
|
S9xMessage(S9X_ERROR, 0, MPAK_SAVE_FAILED);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sprintf(String, "Saved Memory Pack %s", filename);
|
||||||
|
S9xMessage(S9X_INFO, 0, String);
|
||||||
|
}
|
||||||
|
} break;
|
||||||
case ID_FILE_RESET:
|
case ID_FILE_RESET:
|
||||||
#ifdef NETPLAY_SUPPORT
|
#ifdef NETPLAY_SUPPORT
|
||||||
if (Settings.NetPlayServer)
|
if (Settings.NetPlayServer)
|
||||||
|
|
Loading…
Reference in New Issue