add sram support to gbagame addon
This commit is contained in:
parent
bb1e85a546
commit
ab0af7fa7e
|
@ -1505,7 +1505,7 @@ void FASTCALL _MMU_ARM9_write08(u32 adr, u8 val)
|
|||
}
|
||||
|
||||
#ifdef EXPERIMENTAL_GBASLOT
|
||||
if ( (adr >= 0x08000000) && (adr < 0x0A000000) )
|
||||
if ( (adr >= 0x08000000) && (adr < 0x0A010000) )
|
||||
{
|
||||
addon.write08(adr, val);
|
||||
return;
|
||||
|
@ -1719,7 +1719,7 @@ void FASTCALL _MMU_ARM9_write16(u32 adr, u16 val)
|
|||
}
|
||||
|
||||
#ifdef EXPERIMENTAL_GBASLOT
|
||||
if ( (adr >= 0x08000000) && (adr < 0x0A000000) )
|
||||
if ( (adr >= 0x08000000) && (adr < 0x0A010000) )
|
||||
{
|
||||
addon.write16(adr, val);
|
||||
return;
|
||||
|
@ -2313,7 +2313,7 @@ void FASTCALL _MMU_ARM9_write32(u32 adr, u32 val)
|
|||
}
|
||||
|
||||
#ifdef EXPERIMENTAL_GBASLOT
|
||||
if ( (adr >= 0x08000000) && (adr < 0x0A000000) )
|
||||
if ( (adr >= 0x08000000) && (adr < 0x0A010000) )
|
||||
{
|
||||
addon.write32(adr, val);
|
||||
return;
|
||||
|
@ -2875,7 +2875,7 @@ u8 FASTCALL _MMU_ARM9_read08(u32 adr)
|
|||
return T1ReadByte(ARM9Mem.ARM9_ITCM, adr&0x7FFF);
|
||||
|
||||
#ifdef EXPERIMENTAL_GBASLOT
|
||||
if ( (adr >= 0x08000000) && (adr < 0x0A000000) )
|
||||
if ( (adr >= 0x08000000) && (adr < 0x0A010000) )
|
||||
return addon.read08(adr);
|
||||
#else
|
||||
// CFlash reading, Mic
|
||||
|
@ -2906,7 +2906,7 @@ u16 FASTCALL _MMU_ARM9_read16(u32 adr)
|
|||
return T1ReadWord(ARM9Mem.ARM9_ITCM, adr & 0x7FFF);
|
||||
|
||||
#ifdef EXPERIMENTAL_GBASLOT
|
||||
if ( (adr >= 0x08000000) && (adr < 0x0A000000) )
|
||||
if ( (adr >= 0x08000000) && (adr < 0x0A010000) )
|
||||
return addon.read16(adr);
|
||||
#else
|
||||
// CFlash reading, Mic
|
||||
|
@ -2996,7 +2996,7 @@ u32 FASTCALL _MMU_ARM9_read32(u32 adr)
|
|||
return T1ReadLong(ARM9Mem.ARM9_ITCM, adr&0x7FFF);
|
||||
|
||||
#ifdef EXPERIMENTAL_GBASLOT
|
||||
if ( (adr >= 0x08000000) && (adr < 0x0A000000) )
|
||||
if ( (adr >= 0x08000000) && (adr < 0x0A010000) )
|
||||
return addon.read32(adr);
|
||||
#else
|
||||
// CFlash reading, Mic
|
||||
|
@ -3177,7 +3177,7 @@ u32 FASTCALL _MMU_ARM9_read32(u32 adr)
|
|||
void FASTCALL _MMU_ARM7_write08(u32 adr, u8 val)
|
||||
{
|
||||
#ifdef EXPERIMENTAL_GBASLOT
|
||||
if ( (adr >= 0x08000000) && (adr < 0x0A000000) )
|
||||
if ( (adr >= 0x08000000) && (adr < 0x0A010000) )
|
||||
{
|
||||
addon.write08(adr, val);
|
||||
return;
|
||||
|
@ -3230,7 +3230,7 @@ void FASTCALL _MMU_ARM7_write08(u32 adr, u8 val)
|
|||
void FASTCALL _MMU_ARM7_write16(u32 adr, u16 val)
|
||||
{
|
||||
#ifdef EXPERIMENTAL_GBASLOT
|
||||
if ( (adr >= 0x08000000) && (adr < 0x0A000000) )
|
||||
if ( (adr >= 0x08000000) && (adr < 0x0A010000) )
|
||||
{
|
||||
addon.write16(adr, val);
|
||||
return;
|
||||
|
@ -3652,7 +3652,7 @@ void FASTCALL _MMU_ARM7_write16(u32 adr, u16 val)
|
|||
void FASTCALL _MMU_ARM7_write32(u32 adr, u32 val)
|
||||
{
|
||||
#ifdef EXPERIMENTAL_GBASLOT
|
||||
if ( (adr >= 0x08000000) && (adr < 0x0A000000) )
|
||||
if ( (adr >= 0x08000000) && (adr < 0x0A010000) )
|
||||
{
|
||||
addon.write32(adr, val);
|
||||
return;
|
||||
|
@ -3949,7 +3949,7 @@ u8 FASTCALL _MMU_ARM7_read08(u32 adr)
|
|||
#endif
|
||||
|
||||
#ifdef EXPERIMENTAL_GBASLOT
|
||||
if ( (adr >= 0x08000000) && (adr < 0x0A000000) )
|
||||
if ( (adr >= 0x08000000) && (adr < 0x0A010000) )
|
||||
return addon.read08(adr);
|
||||
#else
|
||||
// CFlash reading, Mic
|
||||
|
@ -3976,7 +3976,7 @@ u16 FASTCALL _MMU_ARM7_read16(u32 adr)
|
|||
#endif
|
||||
|
||||
#ifdef EXPERIMENTAL_GBASLOT
|
||||
if ( (adr >= 0x08000000) && (adr < 0x0A000000) )
|
||||
if ( (adr >= 0x08000000) && (adr < 0x0A010000) )
|
||||
return addon.read16(adr);
|
||||
#else
|
||||
// CFlash reading, Mic
|
||||
|
@ -4044,7 +4044,7 @@ u32 FASTCALL _MMU_ARM7_read32(u32 adr)
|
|||
#endif
|
||||
|
||||
#ifdef EXPERIMENTAL_GBASLOT
|
||||
if ( (adr >= 0x08000000) && (adr < 0x0A000000) )
|
||||
if ( (adr >= 0x08000000) && (adr < 0x0A010000) )
|
||||
return addon.read32(adr);
|
||||
#else
|
||||
// CFlash reading, Mic
|
||||
|
|
|
@ -27,17 +27,24 @@
|
|||
#include <string.h>
|
||||
#include "../MMU.h"
|
||||
|
||||
//SRAM is going to be stored just above the rom.
|
||||
//that is convenient for us, since it mirrors the nds memory map
|
||||
|
||||
static u8 *GBArom = NULL;
|
||||
|
||||
#define GBA_ROMSIZE (32 * 1024 * 1024)
|
||||
#define GBA_RAMSIZE (64 * 1024)
|
||||
#define GBA_SIZE (GBA_ROMSIZE+GBA_RAMSIZE)
|
||||
|
||||
static BOOL GBAgame_init(void)
|
||||
{
|
||||
GBArom = new u8 [32 * 1024 * 1024];
|
||||
GBArom = new u8 [GBA_SIZE];
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
static void GBAgame_reset(void)
|
||||
{
|
||||
memset(GBArom, 0, 32 * 1024 * 1024);
|
||||
memset(GBArom, 0, GBA_SIZE);
|
||||
|
||||
if (!strlen(GBAgameName)) return;
|
||||
FILE *fgame = 0;
|
||||
|
@ -56,15 +63,26 @@ static void GBAgame_reset(void)
|
|||
}
|
||||
|
||||
fclose(fgame);
|
||||
|
||||
//try loading the sram
|
||||
char * dot = strrchr(GBAgameName,'.');
|
||||
if(!dot) return;
|
||||
std::string sram_fname = GBAgameName;
|
||||
sram_fname.resize(dot-GBAgameName);
|
||||
sram_fname += ".sav";
|
||||
fgame = fopen(sram_fname.c_str(),"rb");
|
||||
if(fgame)
|
||||
{
|
||||
fread(GBArom+GBA_ROMSIZE,1,GBA_RAMSIZE,fgame);
|
||||
}
|
||||
fclose(fgame);
|
||||
|
||||
}
|
||||
|
||||
static void GBAgame_close(void)
|
||||
{
|
||||
if (GBArom)
|
||||
{
|
||||
delete [] GBArom;
|
||||
GBArom = NULL;
|
||||
}
|
||||
delete[] GBArom;
|
||||
GBArom = NULL;
|
||||
}
|
||||
|
||||
static void GBAgame_config(void) {}
|
||||
|
|
|
@ -1568,7 +1568,7 @@ FONT 8, "MS Shell Dlg", 400, 0, 1
|
|||
BEGIN
|
||||
EDITTEXT IDC_PATHGAME, 7, 34, 236, 14, ES_AUTOHSCROLL | ES_READONLY
|
||||
PUSHBUTTON "Browse...", IDC_BBROWSE, 245, 33, 50, 14, BS_PUSHBUTTON
|
||||
CTEXT "Select file name for GBA game rom:", IDC_STATIC, 7, 7, 288, 14, SS_CENTER
|
||||
CTEXT "Select file name for GBA game rom:\n(Please make save file matching name with extension .sav)", IDC_STATIC, 7, 7, 288, 21, SS_CENTER
|
||||
END
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue