N64: sram is now saved into Bizhawk's saveram file instead of m64p's own .sra file
This commit is contained in:
parent
ef79dccc43
commit
7e7cb8e05b
|
@ -757,12 +757,12 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// This shouldn't happen!!
|
// This shouldn't happen!!
|
||||||
return new byte[0x800 + 4 * 0x8000 + 0x20000];
|
return new byte[0x800 + 4 * 0x8000 + 0x20000 + 0x8000];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
byte[] dest = new byte[0x800 + 4 * 0x8000 + 0x20000];
|
byte[] dest = new byte[0x800 + 4 * 0x8000 + 0x20000 + 0x8000];
|
||||||
m64psave_saveram(dest);
|
m64psave_saveram(dest);
|
||||||
return dest;
|
return dest;
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,19 +44,19 @@
|
||||||
#include "main/rom.h"
|
#include "main/rom.h"
|
||||||
#include "main/util.h"
|
#include "main/util.h"
|
||||||
|
|
||||||
static unsigned char sram[0x8000];
|
unsigned char sram[0x8000];
|
||||||
|
|
||||||
static char *get_sram_path(void)
|
/*static char *get_sram_path(void)
|
||||||
{
|
{
|
||||||
return formatstr("%s%s.sra", get_savesrampath(), ROM_SETTINGS.goodname);
|
return formatstr("%s%s.sra", get_savesrampath(), ROM_SETTINGS.goodname);
|
||||||
}
|
}*/
|
||||||
|
|
||||||
static void sram_format(void)
|
void sram_format(void)
|
||||||
{
|
{
|
||||||
memset(sram, 0, sizeof(sram));
|
memset(sram, 0, sizeof(sram));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sram_read_file(void)
|
/*static void sram_read_file(void)
|
||||||
{
|
{
|
||||||
char *filename = get_sram_path();
|
char *filename = get_sram_path();
|
||||||
|
|
||||||
|
@ -75,11 +75,11 @@ static void sram_read_file(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
free(filename);
|
free(filename);
|
||||||
}
|
}*/
|
||||||
|
|
||||||
static void sram_write_file(void)
|
static void sram_write_file(void)
|
||||||
{
|
{
|
||||||
char *filename = get_sram_path();
|
/*char *filename = get_sram_path();
|
||||||
|
|
||||||
switch (write_to_file(filename, sram, sizeof(sram)))
|
switch (write_to_file(filename, sram, sizeof(sram)))
|
||||||
{
|
{
|
||||||
|
@ -92,7 +92,7 @@ static void sram_write_file(void)
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
|
|
||||||
free(filename);
|
free(filename);*/
|
||||||
}
|
}
|
||||||
|
|
||||||
void dma_pi_read(void)
|
void dma_pi_read(void)
|
||||||
|
@ -104,8 +104,6 @@ void dma_pi_read(void)
|
||||||
{
|
{
|
||||||
if (flashram_info.use_flashram != 1)
|
if (flashram_info.use_flashram != 1)
|
||||||
{
|
{
|
||||||
sram_read_file();
|
|
||||||
|
|
||||||
for (i=0; i < (pi_register.pi_rd_len_reg & 0xFFFFFF)+1; i++)
|
for (i=0; i < (pi_register.pi_rd_len_reg & 0xFFFFFF)+1; i++)
|
||||||
{
|
{
|
||||||
sram[((pi_register.pi_cart_addr_reg-0x08000000)+i)^S8] =
|
sram[((pi_register.pi_cart_addr_reg-0x08000000)+i)^S8] =
|
||||||
|
@ -145,8 +143,6 @@ void dma_pi_write(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
sram_read_file();
|
|
||||||
|
|
||||||
for (i=0; i<(int)(pi_register.pi_wr_len_reg & 0xFFFFFF)+1; i++)
|
for (i=0; i<(int)(pi_register.pi_wr_len_reg & 0xFFFFFF)+1; i++)
|
||||||
{
|
{
|
||||||
((unsigned char*)rdram)[(pi_register.pi_dram_addr_reg+i)^S8]=
|
((unsigned char*)rdram)[(pi_register.pi_dram_addr_reg+i)^S8]=
|
||||||
|
|
|
@ -29,5 +29,7 @@ void dma_si_read(void);
|
||||||
void dma_sp_write(void);
|
void dma_sp_write(void);
|
||||||
void dma_sp_read(void);
|
void dma_sp_read(void);
|
||||||
|
|
||||||
|
void sram_format(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
#include "memory.h"
|
#include "memory.h"
|
||||||
#include "pif.h"
|
#include "pif.h"
|
||||||
#include "flashram.h"
|
#include "flashram.h"
|
||||||
|
#include "dma.h"
|
||||||
#include "n64_cic_nus_6105.h"
|
#include "n64_cic_nus_6105.h"
|
||||||
|
|
||||||
#include "r4300/r4300.h"
|
#include "r4300/r4300.h"
|
||||||
|
@ -605,6 +606,8 @@ EXPORT void CALL init_saveram(void)
|
||||||
saveramModified = 0;
|
saveramModified = 0;
|
||||||
|
|
||||||
flashram_format();
|
flashram_format();
|
||||||
|
|
||||||
|
sram_format();
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT void CALL save_saveram(unsigned char * dest)
|
EXPORT void CALL save_saveram(unsigned char * dest)
|
||||||
|
@ -612,6 +615,7 @@ EXPORT void CALL save_saveram(unsigned char * dest)
|
||||||
memcpy(dest, eeprom, 0x800);
|
memcpy(dest, eeprom, 0x800);
|
||||||
memcpy(dest + 0x800, mempack, 4 * 0x8000);
|
memcpy(dest + 0x800, mempack, 4 * 0x8000);
|
||||||
memcpy(dest + (0x800 + 4 * 0x8000), flashram, 0x20000);
|
memcpy(dest + (0x800 + 4 * 0x8000), flashram, 0x20000);
|
||||||
|
memcpy(dest + (0x800 + 4 * 0x8000 + 0x20000), sram, 0x8000);
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT void CALL load_saveram(unsigned char * src)
|
EXPORT void CALL load_saveram(unsigned char * src)
|
||||||
|
@ -619,4 +623,5 @@ EXPORT void CALL load_saveram(unsigned char * src)
|
||||||
memcpy(eeprom, src, 0x800);
|
memcpy(eeprom, src, 0x800);
|
||||||
memcpy(mempack, src + 0x800, 4 * 0x8000);
|
memcpy(mempack, src + 0x800, 4 * 0x8000);
|
||||||
memcpy(flashram, src + (0x800 + 4 * 0x8000), 0x20000);
|
memcpy(flashram, src + (0x800 + 4 * 0x8000), 0x20000);
|
||||||
|
memcpy(sram, src + (0x800 + 4 * 0x8000 + 0x20000), 0x8000);
|
||||||
}
|
}
|
|
@ -26,6 +26,6 @@ void update_pif_write(void);
|
||||||
void update_pif_read(void);
|
void update_pif_read(void);
|
||||||
|
|
||||||
extern unsigned char flashram[];
|
extern unsigned char flashram[];
|
||||||
|
extern unsigned char sram[];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Binary file not shown.
Loading…
Reference in New Issue