N64: Flashram is now saved into Bizhawk's saveram file instead of m64p's own .fla file

This commit is contained in:
pjgat09 2013-11-16 20:53:51 +00:00
parent 309933322c
commit acdf9ca7a3
6 changed files with 18 additions and 13 deletions

View File

@ -757,12 +757,12 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64
else
{
// This shouldn't happen!!
return new byte[0x800 + 4 * 0x8000];
return new byte[0x800 + 4 * 0x8000 + 0x20000];
}
}
else
{
byte[] dest = new byte[0x800 + 4 * 0x8000];
byte[] dest = new byte[0x800 + 4 * 0x8000 + 0x20000];
m64psave_saveram(dest);
return dest;
}

View File

@ -45,19 +45,19 @@ typedef enum flashram_mode
STATUS_MODE
} Flashram_mode;
static unsigned char flashram[0x20000];
unsigned char flashram[0x20000];
static char *get_flashram_path(void)
/*static char *get_flashram_path(void)
{
return formatstr("%s%s.fla", get_savesrampath(), ROM_SETTINGS.goodname);
}
}*/
static void flashram_format(void)
void flashram_format(void)
{
memset(flashram, 0xff, sizeof(flashram));
}
static void flashram_read_file(void)
/*static void flashram_read_file(void)
{
char *filename = get_flashram_path();
@ -75,11 +75,11 @@ static void flashram_read_file(void)
}
free(filename);
}
}*/
static void flashram_write_file(void)
{
char *filename = get_flashram_path();
/*char *filename = get_flashram_path();
switch (write_to_file(filename, flashram, sizeof(flashram)))
{
@ -92,7 +92,7 @@ static void flashram_write_file(void)
default: break;
}
free(filename);
free(filename);*/
}
void init_flashram(void)
@ -132,7 +132,6 @@ void flashram_command(unsigned int command)
case ERASE_MODE:
{
unsigned int i;
flashram_read_file();
for (i=flashram_info.erase_offset; i<(flashram_info.erase_offset+128); i++)
{
flashram[i^S8] = 0xff;
@ -143,7 +142,6 @@ void flashram_command(unsigned int command)
case WRITE_MODE:
{
int i;
flashram_read_file();
for (i=0; i<128; i++)
{
flashram[(flashram_info.erase_offset+i)^S8]=
@ -186,7 +184,6 @@ void dma_read_flashram(void)
rdram[pi_register.pi_dram_addr_reg/4+1] = (unsigned int)(flashram_info.status);
break;
case READ_MODE:
flashram_read_file();
for (i=0; i<(pi_register.pi_wr_len_reg & 0x0FFFFFF)+1; i++)
{
((unsigned char*)rdram)[(pi_register.pi_dram_addr_reg+i)^S8]=

View File

@ -34,3 +34,4 @@ void flashram_command(unsigned int command);
unsigned int flashram_status(void);
void dma_read_flashram(void);
void dma_write_flashram(void);
void flashram_format(void);

View File

@ -26,6 +26,7 @@
#include "memory.h"
#include "pif.h"
#include "flashram.h"
#include "n64_cic_nus_6105.h"
#include "r4300/r4300.h"
@ -602,16 +603,20 @@ EXPORT void CALL init_saveram(void)
eeprom_format();
mempack_format();
saveramModified = 0;
flashram_format();
}
EXPORT void CALL save_saveram(unsigned char * dest)
{
memcpy(dest, eeprom, 0x800);
memcpy(dest + 0x800, mempack, 4 * 0x8000);
memcpy(dest + (0x800 + 4 * 0x8000), flashram, 0x20000);
}
EXPORT void CALL load_saveram(unsigned char * src)
{
memcpy(eeprom, src, 0x800);
memcpy(mempack, src + 0x800, 4 * 0x8000);
memcpy(flashram, src + (0x800 + 4 * 0x8000), 0x20000);
}

View File

@ -25,5 +25,7 @@
void update_pif_write(void);
void update_pif_read(void);
extern unsigned char flashram[];
#endif

Binary file not shown.