mirror of
https://github.com/ApacheThunder/GBA-Exploader.git
synced 2025-06-18 11:35:38 -04:00
Implement second SRAM bank for SuperCards.
* Implemented unused second SRAM bank for SuperCards for storing GBA-Exploader metadata. Note that game patches are not yet updated for this so games like Pokémon can't use it yet.
This commit is contained in:
parent
c779a90200
commit
f9251ba0ce
2
Makefile
2
Makefile
@ -9,7 +9,7 @@ export TARGET := GBA_ExpLoader
|
||||
export TOPDIR := $(CURDIR)
|
||||
|
||||
export VERSION_MAJOR := 0
|
||||
export VERSION_MINOR := 66
|
||||
export VERSION_MINOR := 67
|
||||
export VERSTRING := $(VERSION_MAJOR).$(VERSION_MINOR)
|
||||
|
||||
# GMAE_ICON is the image used to create the game icon, leave blank to use default rule
|
||||
|
@ -265,6 +265,7 @@ u32 CheckSuperCardID() {
|
||||
// _SC_changeMode16(0x1510);
|
||||
*(vu16*)(FlashBase) = 0x4D54;
|
||||
if (*(vu16*)(FlashBase) == 0x4D54) {
|
||||
_SC_changeMode(SC_MODE_RAM_RO);
|
||||
ID = 0x227E2202;
|
||||
return 0x227E0000;
|
||||
}
|
||||
|
@ -34,7 +34,7 @@
|
||||
#endif
|
||||
|
||||
/*-----------------------------------------------------------------
|
||||
_SC_changeMode (was SC_Unlock)
|
||||
_SC_changeMode (was SC_Unlock) (toggling read/write of PSRAM also toggles SRAM bank!)
|
||||
Added by MightyMax
|
||||
Modified by Chishm
|
||||
Modified again by loopy
|
||||
|
@ -35,16 +35,16 @@ void ctrl_get() {
|
||||
|
||||
memset((u8*)&ctrl, 0, sizeof(struct ctrl_tbl));
|
||||
|
||||
if (((carttype != 5) && !isSuperCard && !isOmega) || isOmegaDE) {
|
||||
if (((carttype != 5) && /*!isSuperCard &&*/ !isOmega) || isOmegaDE) {
|
||||
_RamPG();
|
||||
ReadSram(SRAM_ADDR, (u8*)&ctrl, sizeof(struct ctrl_tbl));
|
||||
_RamSave(0);
|
||||
return;
|
||||
}
|
||||
|
||||
if (isSuperCard) {
|
||||
/*if (isSuperCard) {
|
||||
sprintf(expfile, "%s/SUPERCRD.dat", ini.sign_dir);
|
||||
} else if (isOmega) {
|
||||
} else */if (isOmega) {
|
||||
sprintf(expfile, "%s/OMEGA.dat", ini.sign_dir);
|
||||
} else {
|
||||
sprintf(expfile, "%s/EXP128K.dat", ini.sign_dir);
|
||||
@ -60,16 +60,16 @@ void ctrl_set() {
|
||||
FILE *exp;
|
||||
char expfile[64];
|
||||
|
||||
if (((carttype != 5) && !isSuperCard && !isOmega) || isOmegaDE) {
|
||||
if (((carttype != 5) && /*!isSuperCard && */!isOmega) || isOmegaDE) {
|
||||
_RamPG();
|
||||
WriteSram(SRAM_ADDR, (u8*)&ctrl, sizeof(struct ctrl_tbl));
|
||||
_RamSave(0);
|
||||
return;
|
||||
}
|
||||
|
||||
if (isSuperCard) {
|
||||
/*if (isSuperCard) {
|
||||
sprintf(expfile, "%s/SUPERCRD.dat", ini.sign_dir);
|
||||
} else if (isOmega) {
|
||||
} else */if (isOmega) {
|
||||
sprintf(expfile, "%s/OMEGA.dat", ini.sign_dir);
|
||||
} else {
|
||||
sprintf(expfile, "%s/EXP128K.dat", ini.sign_dir);
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include "dsCard.h"
|
||||
#include "sc_patches.h"
|
||||
#include "sc_sram.h"
|
||||
#include "io_sc_common.h"
|
||||
|
||||
//#include <nds/arm9/console.h> //basic print funcionality
|
||||
|
||||
@ -483,7 +484,7 @@ int checkFlashID() {
|
||||
|
||||
|
||||
void _RamPG() {
|
||||
if (isSuperCard)return;
|
||||
// if (isSuperCard)return;
|
||||
switch (carttype) {
|
||||
case 3:
|
||||
SetRampage(USE_SRAM_PG_EZ4);
|
||||
@ -495,7 +496,11 @@ void _RamPG() {
|
||||
SetEWINRam(USE_SRAM_PG_EWN128);
|
||||
return;
|
||||
case 6:
|
||||
if (isSuperCard) {
|
||||
_SC_changeMode(SC_MODE_RAM);
|
||||
} else {
|
||||
SetM3Ram(USE_SRAM_PG_M3);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (isOmega) {
|
||||
@ -511,13 +516,21 @@ void _RamPG() {
|
||||
}
|
||||
|
||||
void _RamSave(int bnk) {
|
||||
if (isSuperCard)return;
|
||||
if (isSuperCard && (bnk > 1))return;
|
||||
switch (carttype) {
|
||||
case 3:
|
||||
SetRampage(USE_SRAM_PSR_EZ4 + bnk * 16);
|
||||
return;
|
||||
case 6:
|
||||
if (isSuperCard) {
|
||||
if (bnk == 0) {
|
||||
_SC_changeMode(SC_MODE_RAM_RO);
|
||||
} else {
|
||||
_SC_changeMode(SC_MODE_RAM);
|
||||
}
|
||||
} else {
|
||||
SetM3Ram(USE_SRAM_PSR_M3 + bnk);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@ -590,6 +603,7 @@ int checkSRAM(char *name) {
|
||||
}
|
||||
|
||||
// if (isOmega && (savesize > 0x10000))savesize = 0x10000;
|
||||
if (isSuperCard && (savesize > 0x10000))savesize = 0x10000;
|
||||
|
||||
strcpy(name, (char *)ctrl.sav_nam[GBAmode]);
|
||||
ln = strlen(name) - 3;
|
||||
@ -708,8 +722,11 @@ void SRAMdump(int cmd) {
|
||||
case 4: mx = 4; break;
|
||||
case 5: mx = 2; break;
|
||||
case 6:
|
||||
if (isSuperCard) {
|
||||
mx = 2;
|
||||
} else {
|
||||
mx = 16;
|
||||
if (isSuperCard)mx = 1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@ -719,8 +736,16 @@ void SRAMdump(int cmd) {
|
||||
dsp_bar(4, -1);
|
||||
dmp = fopen(name, "wb");
|
||||
for(i = 0; i < mx; i++) {
|
||||
if((carttype == 6) && !isSuperCard) {
|
||||
if (carttype == 6) {
|
||||
if (isSuperCard) {
|
||||
if (i == 0) {
|
||||
_SC_changeMode(SC_MODE_RAM_RO);
|
||||
} else {
|
||||
_SC_changeMode(SC_MODE_RAM);
|
||||
}
|
||||
} else {
|
||||
SetM3Ram(i);
|
||||
}
|
||||
} else if (!isSuperCard) {
|
||||
if((carttype >= 4)) {
|
||||
SetEWINRam(8 + i);
|
||||
@ -767,8 +792,16 @@ void SRAMdump(int cmd) {
|
||||
memset(rwbuf, 0, USE_SRAM / 2);
|
||||
if(dmp != NULL)
|
||||
fread(rwbuf, 1, USE_SRAM / 2, dmp);
|
||||
if((carttype == 6) && !isSuperCard) {
|
||||
if (carttype == 6) {
|
||||
if (isSuperCard) {
|
||||
if (i == 0) {
|
||||
_SC_changeMode(SC_MODE_RAM_RO);
|
||||
} else {
|
||||
_SC_changeMode(SC_MODE_RAM);
|
||||
}
|
||||
} else {
|
||||
SetM3Ram(i);
|
||||
}
|
||||
} else {
|
||||
if((carttype >= 4) && !isSuperCard) {
|
||||
SetEWINRam(8 + i);
|
||||
@ -1081,6 +1114,8 @@ int writeFileToRam(int sel) {
|
||||
Set_RTC_status(1);
|
||||
SetPSRampage(0);
|
||||
// Omega_InitFatBuffer(OMEGA_UNKNOWN, Omega_SetSaveSize(OMEGA_UNKNOWN), fs[sel].filesize);
|
||||
} else if (isSuperCard) {
|
||||
_SC_changeMode(SC_MODE_RAM);
|
||||
}
|
||||
|
||||
// savesize = gba_check(gbaFile, fs[sel].filesize, rwbuf, 0x100000);
|
||||
|
@ -49,7 +49,7 @@ extern uint16* SubScreen;
|
||||
|
||||
#define BG_256_COLOR (BIT(7))
|
||||
|
||||
#define VERSTRING "v0.66"
|
||||
#define VERSTRING "v0.67"
|
||||
|
||||
int numFiles = 0;
|
||||
int numGames = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user