mirror of
https://github.com/ApacheThunder/GBA-Exploader.git
synced 2025-06-18 11:35:38 -04:00
Improve file browser ...
* File browser no longer displays "." directory while in sub directories. Like original builds of GBA Exploader only ".." is a visible while in sub directories. * TTMenu is now a folder checked when looking for gbaframe.bmp if one is not found in the other possible locations. This allows using gbaframe currently setup with YSMenu if user also has that setup.
This commit is contained in:
parent
bc45a204e8
commit
a2e7393e3e
2
Makefile
2
Makefile
@ -9,7 +9,7 @@ export TARGET := GBA_ExpLoader
|
||||
export TOPDIR := $(CURDIR)
|
||||
|
||||
export VERSION_MAJOR := 0
|
||||
export VERSION_MINOR := 61b
|
||||
export VERSION_MINOR := 62
|
||||
export VERSTRING := $(VERSION_MAJOR).$(VERSION_MINOR)
|
||||
|
||||
# GMAE_ICON is the image used to create the game icon, leave blank to use default rule
|
||||
|
@ -33,7 +33,7 @@ LDFLAGS = -specs=ds_arm9.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
|
||||
#---------------------------------------------------------------------------------
|
||||
# any extra libraries we wish to link with the project
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBS := -lfat -lnds329
|
||||
LIBS := -lfat -lnds9
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# list of directories containing libraries, this must be the top level containing
|
||||
|
@ -17,8 +17,8 @@ int PatchCntS;
|
||||
u32 PatchType[28];
|
||||
u32 PatchAddr[28];
|
||||
|
||||
u8 *RemainPtr;
|
||||
u32 RemainByte;
|
||||
u8 *RemainPtr;
|
||||
u32 RemainByte;
|
||||
|
||||
|
||||
static int _type_chk(u32 *pbuf, u32 c, u32 ofs) {
|
||||
@ -723,9 +723,7 @@ static bool _get_sign(char *name, char *sign) {
|
||||
|
||||
sprintf(sign, "%s/%s", ini.sign_dir, name);
|
||||
ln = strlen(sign) - 3;
|
||||
if(sign[ln] != 'G' && sign[ln] != 'g')
|
||||
return false;
|
||||
|
||||
if(sign[ln] != 'G' && sign[ln] != 'g')return false;
|
||||
|
||||
sign[ln+0] = 's';
|
||||
sign[ln+1] = 'g';
|
||||
@ -791,11 +789,7 @@ u32 gba_check_Ram1(u8 *buf, u32 bufsize, u32 size, u32 ofs) {
|
||||
if(PatchVer == PATCH_VER)return(SaveSize);
|
||||
|
||||
pbuf = (u32*)buf;
|
||||
if(PatchCnt > 1) {
|
||||
oldtype = PatchType[PatchCnt-1]/0x10;
|
||||
} else {
|
||||
oldtype = 0;
|
||||
}
|
||||
if(PatchCnt > 1) { oldtype = PatchType[PatchCnt-1]/0x10; } else { oldtype = 0; }
|
||||
|
||||
i = ofs;
|
||||
for(ii = 0; ii < bufsize / 4; ii++) {
|
||||
@ -849,19 +843,19 @@ void gba_check_Ram2(u32 exp, u8 *buf, u32 bufsize, u32 size) {
|
||||
u32 *pbuf;
|
||||
// int cnt;
|
||||
|
||||
|
||||
if(SaveType == 0) { // UNKNOWN Famicom Mini
|
||||
if(PatchCnt > 2 && PatchType[1] == 0x81 && PatchType[2] == 0x84) {
|
||||
SaveType = 8;
|
||||
PatchCnt = 3;
|
||||
strcpy((char*)SaveVer, "FaMini");
|
||||
}
|
||||
}
|
||||
|
||||
if(SaveType == 8) {
|
||||
PatchType[PatchCnt] = 0x86; // Patch
|
||||
PatchAddr[PatchCnt] = 0x100000 - 0x800;
|
||||
PatchCnt++;
|
||||
switch (SaveType) {
|
||||
case 0: // UNKNOWN Famicom Mini
|
||||
if(PatchCnt > 2 && PatchType[1] == 0x81 && PatchType[2] == 0x84) {
|
||||
SaveType = 8;
|
||||
PatchCnt = 3;
|
||||
strcpy((char*)SaveVer, "FaMini");
|
||||
}
|
||||
break;
|
||||
case 8:
|
||||
PatchType[PatchCnt] = 0x86; // Patch
|
||||
PatchAddr[PatchCnt] = 0x100000 - 0x800;
|
||||
PatchCnt++;
|
||||
break;
|
||||
}
|
||||
|
||||
if(SaveType < 2 || PatchCnt <= 1 || SaveType == PatchType[1]/0x10)return;
|
||||
@ -874,20 +868,11 @@ void gba_check_Ram2(u32 exp, u8 *buf, u32 bufsize, u32 size) {
|
||||
// dmaCopyWords(3, buf, (void *)exp, 0x100000);
|
||||
// cnt = PatchCnt;
|
||||
for(ii = 0; ii < bufsize / 4; ii++) {
|
||||
if(SaveType == 2) {
|
||||
ii = _eeprom_chk(pbuf, ii, i, size);
|
||||
}
|
||||
|
||||
if(SaveType == 3) {
|
||||
ii = _flash512_chk(pbuf, ii, i);
|
||||
}
|
||||
|
||||
if(SaveType == 4) {
|
||||
ii = _flash_chk(pbuf, ii, i);
|
||||
}
|
||||
|
||||
if(SaveType == 5) {
|
||||
ii = _flash1M_chk(pbuf, ii, i);
|
||||
switch (SaveType) {
|
||||
case 2: ii = _eeprom_chk(pbuf, ii, i, size); break;
|
||||
case 3: ii = _flash512_chk(pbuf, ii, i); break;
|
||||
case 4: ii = _flash_chk(pbuf, ii, i); break;
|
||||
case 5: ii = _flash1M_chk(pbuf, ii, i); break;
|
||||
}
|
||||
}
|
||||
// if(PatchCnt > 1 && cnt == PatchCnt)
|
||||
@ -895,7 +880,6 @@ void gba_check_Ram2(u32 exp, u8 *buf, u32 bufsize, u32 size) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
u32 gba_check(FILE *gbaFile, u32 size, u8 *buf, u32 bufsize) {
|
||||
u32 i, ii;
|
||||
u32 *pbuf;
|
||||
@ -929,39 +913,32 @@ u32 gba_check(FILE *gbaFile, u32 size, u8 *buf, u32 bufsize) {
|
||||
|
||||
for(ii = 0; ii < bufsize / 4; ii++) {
|
||||
|
||||
if(SaveType == 0) {
|
||||
ii = _type_chk(pbuf, ii, i);
|
||||
}
|
||||
if(SaveType == 8) break;
|
||||
if(SaveType == 0)ii = _type_chk(pbuf, ii, i);
|
||||
if(SaveType == 8)break;
|
||||
|
||||
if(oldtype == 0 || oldtype == 2) {
|
||||
ii = _eeprom_chk(pbuf, ii, i, size);
|
||||
if(oldtype == 0)
|
||||
oldtype = PatchType[PatchCnt-1]/0x10;
|
||||
if(oldtype == 0)oldtype = PatchType[PatchCnt-1]/0x10;
|
||||
}
|
||||
|
||||
if(oldtype == 0 || oldtype == 3) {
|
||||
ii = _flash512_chk(pbuf, ii, i);
|
||||
if(oldtype == 0)
|
||||
oldtype = PatchType[PatchCnt-1]/0x10;
|
||||
if(oldtype == 0)oldtype = PatchType[PatchCnt-1]/0x10;
|
||||
}
|
||||
|
||||
if(oldtype == 0 || oldtype == 4) {
|
||||
ii = _flash_chk(pbuf, ii, i);
|
||||
if(oldtype == 0)
|
||||
oldtype = PatchType[PatchCnt-1]/0x10;
|
||||
if(oldtype == 0)oldtype = PatchType[PatchCnt-1]/0x10;
|
||||
}
|
||||
|
||||
if(oldtype == 0 || oldtype == 5) {
|
||||
ii = _flash1M_chk(pbuf, ii, i);
|
||||
if(oldtype == 0)
|
||||
oldtype = PatchType[PatchCnt-1]/0x10;
|
||||
if(oldtype == 0)oldtype = PatchType[PatchCnt-1]/0x10;
|
||||
}
|
||||
|
||||
if(oldtype == 0 || oldtype == 8) {
|
||||
ii = _fmini_chk(pbuf, ii, i);
|
||||
if(oldtype == 0)
|
||||
oldtype = PatchType[PatchCnt-1]/0x10;
|
||||
if(oldtype == 0)oldtype = PatchType[PatchCnt-1]/0x10;
|
||||
}
|
||||
}
|
||||
if(SaveType == 0) { // UNKNOWN Famicom Mini
|
||||
@ -995,20 +972,11 @@ u32 gba_check(FILE *gbaFile, u32 size, u8 *buf, u32 bufsize) {
|
||||
|
||||
// cnt = PatchCnt;
|
||||
for(ii = 0; ii < bufsize / 4; ii++) {
|
||||
if(SaveType == 2) {
|
||||
ii = _eeprom_chk(pbuf, ii, i, size);
|
||||
}
|
||||
|
||||
if(SaveType == 3) {
|
||||
ii = _flash512_chk(pbuf, ii, i);
|
||||
}
|
||||
|
||||
if(SaveType == 4) {
|
||||
ii = _flash_chk(pbuf, ii, i);
|
||||
}
|
||||
|
||||
if(SaveType == 5) {
|
||||
ii = _flash1M_chk(pbuf, ii, i);
|
||||
switch (SaveType) {
|
||||
case 2: ii = _eeprom_chk(pbuf, ii, i, size); break;
|
||||
case 3: ii = _flash512_chk(pbuf, ii, i); break;
|
||||
case 4: ii = _flash_chk(pbuf, ii, i); break;
|
||||
case 5: ii = _flash1M_chk(pbuf, ii, i); break;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -80,6 +80,8 @@ bool is3in1Plus = false;
|
||||
|
||||
extern int save_sel(int mod, char *name);
|
||||
|
||||
char const *Rudolph = "GBA ExpLoader by Rudolph (LocalCode v0.1)";
|
||||
|
||||
using namespace std;
|
||||
|
||||
void SetEWINRam(u8 page) {
|
||||
@ -101,15 +103,12 @@ void SetEWINRam(u8 page) {
|
||||
}
|
||||
|
||||
|
||||
int cehck_EWIN() {
|
||||
vu32 wait;
|
||||
int check_EWIN() {
|
||||
vu32 wait;
|
||||
vu8 a, a8, a9, aa, org;
|
||||
|
||||
|
||||
for(wait = 0; wait < 15000; wait++) {
|
||||
a = *(vu8*)(0x0A000000 + wait);
|
||||
}
|
||||
|
||||
for(wait = 0; wait < 15000; wait++)a = *(vu8*)(0x0A000000 + wait);
|
||||
|
||||
org = *(vu8*)0x0A000000;
|
||||
|
||||
SetEWINRam(0);
|
||||
@ -129,7 +128,7 @@ int cehck_EWIN() {
|
||||
a = *(vu8*)0x0A000000;
|
||||
if(a != 0xB8) {
|
||||
*(vu8*)0x0A000000 = org;
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
SetEWINRam(0x08);
|
||||
@ -146,13 +145,12 @@ int cehck_EWIN() {
|
||||
|
||||
if(a != a8) {
|
||||
*(vu8*)0x0A000000 = org;
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
SetEWINRam(0x09);
|
||||
*(vu8*)0x0A000600 = a9;
|
||||
|
||||
|
||||
SetEWINRam(0x0A);
|
||||
aa = *(vu8*)0x0A000600;
|
||||
|
||||
@ -161,15 +159,14 @@ int cehck_EWIN() {
|
||||
SetEWINRam(0x08);
|
||||
a = *(vu8*)0x0A000600;
|
||||
*(vu8*)0x0A000600 = a8;
|
||||
if(a != a8)
|
||||
return(2);
|
||||
if(a != a8)return 2;
|
||||
|
||||
SetEWINRam(0x0A);
|
||||
*(vu8*)0x0A000600 = aa;
|
||||
|
||||
SetEWINRam(0x08);
|
||||
|
||||
return(1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
bool Close_EWIN() {
|
||||
@ -184,7 +181,7 @@ bool Close_EWIN() {
|
||||
|
||||
a = *(vu8*)0x0A000000;
|
||||
|
||||
if(a != 0xBC) return false;
|
||||
if(a != 0xBC)return false;
|
||||
a = *(vu8*)0x0A000000;
|
||||
|
||||
return true;
|
||||
@ -364,7 +361,7 @@ bool Close_M3() {
|
||||
return true;
|
||||
}
|
||||
|
||||
int cehck_M3() {
|
||||
int check_M3() {
|
||||
vu16 tmp;
|
||||
|
||||
_set_M3(1);
|
||||
@ -415,7 +412,7 @@ void _RamSave(int bnk) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(carttype >= 4) {
|
||||
if((carttype >= 4) && !isSuperCard) {
|
||||
SetEWINRam(USE_SRAM_PSR_EWN + bnk);
|
||||
return;
|
||||
}
|
||||
@ -441,12 +438,16 @@ int checkFlashID() {
|
||||
|
||||
switch (id) {
|
||||
case 0:
|
||||
if (cehck_M3()) {
|
||||
if (check_M3()) {
|
||||
carttype = 6; // M3/G6
|
||||
is3in1Plus = false;
|
||||
isSuperCard = false;
|
||||
return carttype;
|
||||
}
|
||||
ewin = cehck_EWIN();
|
||||
if(ewin > 0)carttype = 3 + ewin; // EWIN
|
||||
ewin = check_EWIN();
|
||||
if(ewin > 0)carttype = (3 + ewin); // EWIN
|
||||
is3in1Plus = false;
|
||||
isSuperCard = false;
|
||||
return carttype;
|
||||
case 0x227E2218: carttype = 1; return carttype; // 3in1
|
||||
case 0x227E2202: carttype = 2; return carttype; // New3in1
|
||||
@ -465,10 +466,6 @@ int checkFlashID() {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
char const *Rudolph = "GBA ExpLoader by Rudolph (LocalCode v0.1)";
|
||||
|
||||
bool checkSRAM_cnf() {
|
||||
int i;
|
||||
|
||||
@ -479,29 +476,25 @@ bool checkSRAM_cnf() {
|
||||
}
|
||||
|
||||
// _RamSave(0);
|
||||
if(Rudolph[i] != 0)
|
||||
return false;
|
||||
if(Rudolph[i] != 0)return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
int checkSRAM(char *name) {
|
||||
int i, ln;
|
||||
|
||||
|
||||
ctrl_get();
|
||||
|
||||
for(i = 0; ctrl.sign[i] != 0; i++) {
|
||||
if(ctrl.sign[i] != Rudolph[i])break;
|
||||
}
|
||||
|
||||
if(carttype < 4)OpenNorWrite();
|
||||
if((carttype < 4) && !isSuperCard)OpenNorWrite();
|
||||
|
||||
if(Rudolph[i] != 0) {
|
||||
strcpy((char *)ctrl.sign, Rudolph);
|
||||
ctrl_set();
|
||||
if(carttype < 4)
|
||||
CloseNorWrite();
|
||||
if((carttype < 4) && !isSuperCard)CloseNorWrite();
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -513,18 +506,18 @@ int checkSRAM(char *name) {
|
||||
|
||||
strcpy(name, (char *)ctrl.sav_nam[GBAmode]);
|
||||
ln = strlen(name) - 3;
|
||||
if((name[ln-1] != '.') || (name[ln] != 's' && name[ln] != 'S')) {
|
||||
// if((name[ln] != 's' && name[ln] != 'S') || (name[ln+1] != 'a' && name[ln+1] != 'A') || (name[ln+2] != 'v' && name[ln+2] != 'V')) {
|
||||
if((name[ln-1] != '.') || (name[ln] != 's' && name[ln] != 'S')) {
|
||||
memset(ctrl.sav_nam[GBAmode], 0, 512);
|
||||
name[0] = 0;
|
||||
savesize = 0x10000;
|
||||
ctrl.save_siz[GBAmode] = savesize;
|
||||
ctrl_set();
|
||||
if(carttype < 4)CloseNorWrite();
|
||||
if((carttype < 4) && !isSuperCard)CloseNorWrite();
|
||||
return false;
|
||||
}
|
||||
|
||||
if(carttype < 4)CloseNorWrite();
|
||||
if((carttype < 4) && !isSuperCard)CloseNorWrite();
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -550,9 +543,8 @@ void getGBAmode() {
|
||||
|
||||
void setcurpath() {
|
||||
memset(ctrl.path, 0, 256);
|
||||
strcpy((char *)ctrl.path, curpath);
|
||||
strcpy((char*)ctrl.path, curpath);
|
||||
ctrl_set();
|
||||
|
||||
}
|
||||
|
||||
void getcurpath() {
|
||||
@ -563,7 +555,7 @@ void getcurpath() {
|
||||
strcpy(curpath, (char *)ctrl.path);
|
||||
}
|
||||
|
||||
extern void err_cnf(int n1, int n2);
|
||||
extern void err_cnf(int n1, int n2);
|
||||
|
||||
/*************
|
||||
bool getSaveFilename(int sel, char *savename)
|
||||
@ -649,14 +641,14 @@ void writeSramToFile(char *savename) {
|
||||
|
||||
ctrl.save_flg[GBAmode] = 0xFF;
|
||||
|
||||
if(carttype < 4)OpenNorWrite();
|
||||
if((carttype < 4) && !isSuperCard)OpenNorWrite();
|
||||
|
||||
ctrl_set();
|
||||
|
||||
if(carttype < 4)CloseNorWrite();
|
||||
if((carttype < 4) && !isSuperCard)CloseNorWrite();
|
||||
}
|
||||
|
||||
void _WritePSram(uint32 address, u8* data , uint32 size );
|
||||
// void _WritePSram(uint32 address, u8* data , uint32 size);
|
||||
|
||||
void SRAMdump(int cmd) {
|
||||
FILE *dmp;
|
||||
@ -680,9 +672,11 @@ void SRAMdump(int cmd) {
|
||||
if(carttype == 6) {
|
||||
SetM3Ram(i);
|
||||
} else {
|
||||
if(carttype >= 4)
|
||||
if((carttype >= 4) && !isSuperCard) {
|
||||
SetEWINRam(8 + i);
|
||||
else SetRampage(i * 16);
|
||||
} else {
|
||||
SetRampage(i * 16);
|
||||
}
|
||||
}
|
||||
ReadSram(SRAM_ADDR, rwbuf, USE_SRAM / 2);
|
||||
if(dmp != NULL)
|
||||
@ -690,8 +684,7 @@ void SRAMdump(int cmd) {
|
||||
}
|
||||
} else {
|
||||
dmp = fopen(name, "rb");
|
||||
if(carttype < 4)
|
||||
OpenNorWrite();
|
||||
if((carttype < 4) && !isSuperCard)OpenNorWrite();
|
||||
|
||||
for(i = 0; i < mx; i++) {
|
||||
memset(rwbuf, 0, USE_SRAM / 2);
|
||||
@ -700,15 +693,16 @@ void SRAMdump(int cmd) {
|
||||
if(carttype == 6) {
|
||||
SetM3Ram(i);
|
||||
} else {
|
||||
if(carttype >= 4)
|
||||
if((carttype >= 4) && !isSuperCard) {
|
||||
SetEWINRam(8 + i);
|
||||
else SetRampage(i * 16);
|
||||
} else {
|
||||
SetRampage(i * 16);
|
||||
}
|
||||
}
|
||||
WriteSram(SRAM_ADDR, rwbuf, USE_SRAM / 2);
|
||||
}
|
||||
|
||||
if(carttype < 4)
|
||||
CloseNorWrite();
|
||||
if((carttype < 4) && !isSuperCard)CloseNorWrite();
|
||||
}
|
||||
fclose(dmp);
|
||||
_RamSave(0);
|
||||
@ -718,8 +712,7 @@ void blankSRAM(char *savename) {
|
||||
|
||||
memset(rwbuf, 0xFF, USE_SRAM / 2);
|
||||
|
||||
if(carttype < 4)
|
||||
OpenNorWrite();
|
||||
if((carttype < 4) && !isSuperCard)OpenNorWrite();
|
||||
|
||||
_RamSave(0);
|
||||
WriteSram(SRAM_ADDR, rwbuf, USE_SRAM / 2);
|
||||
@ -735,8 +728,7 @@ void blankSRAM(char *savename) {
|
||||
strcpy((char *)ctrl.sav_nam[GBAmode], savename);
|
||||
ctrl_set();
|
||||
|
||||
if(carttype < 4)
|
||||
CloseNorWrite();
|
||||
if((carttype < 4) && !isSuperCard)CloseNorWrite();
|
||||
}
|
||||
|
||||
void writeSramFromFile(char *savename) {
|
||||
@ -755,8 +747,7 @@ void writeSramFromFile(char *savename) {
|
||||
}
|
||||
|
||||
|
||||
if(carttype < 4)
|
||||
OpenNorWrite();
|
||||
if((carttype < 4) && !isSuperCard)OpenNorWrite();
|
||||
|
||||
ctrl.save_siz[GBAmode] = savesize;
|
||||
ctrl.save_flg[GBAmode] = 0x00;
|
||||
@ -782,23 +773,21 @@ void writeSramFromFile(char *savename) {
|
||||
}
|
||||
// }
|
||||
|
||||
if(carttype < 4)
|
||||
CloseNorWrite();
|
||||
if((carttype < 4) && !isSuperCard)CloseNorWrite();
|
||||
|
||||
fclose(saver);
|
||||
}
|
||||
|
||||
|
||||
void _ReadPSram(uint32 address, u8* data , uint32 size ) {
|
||||
void _ReadPSram(uint32 address, u8* data , uint32 size) {
|
||||
u32 i;
|
||||
u16* pData = (u16*)data;
|
||||
u16* sData = (u16*)address;
|
||||
|
||||
for(i = 0; i < size / 2; i++)
|
||||
pData[i] = sData[i];
|
||||
for(i = 0; i < size / 2; i++)pData[i] = sData[i];
|
||||
}
|
||||
|
||||
void _WritePSram(uint32 address, u8* data , uint32 size ) {
|
||||
void _WritePSram(uint32 address, u8* data , uint32 size) {
|
||||
u32 i;
|
||||
u16* sData = (u16*)data;
|
||||
u16* pData = (u16*)address;
|
||||
@ -812,13 +801,13 @@ extern void dsp_bar(int mod, int per);
|
||||
|
||||
|
||||
int writeFileToNor(int sel) {
|
||||
FILE *gbaFile;
|
||||
char savName[512];
|
||||
FILE *gbaFile;
|
||||
char savName[512];
|
||||
u32 siz, wsz;
|
||||
u32 exp, ofs;
|
||||
u32 fsz;
|
||||
int cmd;
|
||||
bool gba;
|
||||
bool gba;
|
||||
|
||||
if (is3in1Plus) { fsz = MAX_NORPLUS; } else { fsz = MAX_NOR; }
|
||||
|
||||
@ -826,18 +815,13 @@ int writeFileToNor(int sel) {
|
||||
|
||||
if(fs[sel].filesize > fsz)return 1;
|
||||
|
||||
if(checkSRAM(savName) == false) {
|
||||
err_cnf(4, 5);
|
||||
} else {
|
||||
if(!checkSRAM(savName)) {
|
||||
err_cnf(4, 5);
|
||||
} else {
|
||||
if(save_sel(1, savName) >= 0)writeSramToFile(savName);
|
||||
}
|
||||
|
||||
// if((fs[sel].Alias[strlen(fs[sel].Alias) - 3] != 'G') || (fs[sel].Alias[strlen(fs[sel].Alias) - 3] != 'g')) {
|
||||
if((fs[sel].filename[strlen(fs[sel].filename) - 3] != 'G') || (fs[sel].filename[strlen(fs[sel].filename) - 3] != 'g')) {
|
||||
gba = false;
|
||||
} else {
|
||||
gba = true;
|
||||
}
|
||||
if((fs[sel].filename[strlen(fs[sel].filename) - 3] != 'G') || (fs[sel].filename[strlen(fs[sel].filename) - 3] != 'g')) { gba = false; } else { gba = true; }
|
||||
|
||||
sprintf(tbuf, "%s%s", curpath, fs[sel].filename);
|
||||
|
||||
@ -911,7 +895,7 @@ int writeFileToRam(int sel) {
|
||||
u32 exp, exps;
|
||||
u32 fsz;
|
||||
int cmd;
|
||||
bool gba;
|
||||
bool gba;
|
||||
|
||||
if(carttype >= 3) { fsz = MAX_NOR; } else { fsz = MAX_PSRAM; }
|
||||
|
||||
@ -937,7 +921,7 @@ int writeFileToRam(int sel) {
|
||||
cmd = save_sel(0, savName);
|
||||
|
||||
// SetRampage(USE_SRAM_PSR);
|
||||
if(carttype < 4) {
|
||||
if((carttype < 4) && !isSuperCard) {
|
||||
if(carttype == 3) { SetRompage(0x300 - 3); } else { SetRompage(384 - 3); }
|
||||
OpenNorWrite();
|
||||
}
|
||||
@ -979,7 +963,7 @@ int writeFileToRam(int sel) {
|
||||
|
||||
dsp_bar(-1, 100);
|
||||
|
||||
if(carttype < 4)CloseNorWrite();
|
||||
if((carttype < 4) && !isSuperCard)CloseNorWrite();
|
||||
|
||||
_RamSave(0);
|
||||
if(carttype >= 4 && !isSuperCard) {
|
||||
@ -1075,6 +1059,8 @@ void FileListGBA() {
|
||||
struct stat st;
|
||||
FILE *gbaFile;
|
||||
int i;
|
||||
const char* GBAEXT = ".GBA";
|
||||
const char* BINEXT = ".BIN";
|
||||
|
||||
numFiles = 0;
|
||||
numGames = 0;
|
||||
@ -1082,24 +1068,25 @@ void FileListGBA() {
|
||||
chdir (curpath);
|
||||
dir = opendir(curpath);
|
||||
|
||||
if(dir == NULL) {
|
||||
// if(dir == NULL) {
|
||||
if(!dir) {
|
||||
strcpy(curpath, "/");
|
||||
dir = opendir(curpath);
|
||||
}
|
||||
|
||||
const char* GBAEXT = ".GBA";
|
||||
const char* BINEXT = ".BIN";
|
||||
|
||||
if (dir != NULL) {
|
||||
while(true) {
|
||||
// if (dir != NULL) {
|
||||
if (dir) {
|
||||
while(1) {
|
||||
dirent* pent = readdir(dir);
|
||||
if(pent == NULL)break;
|
||||
// if(pent == NULL)break;
|
||||
if(!pent)break;
|
||||
stat(pent->d_name, &st);
|
||||
if (((st.st_mode & S_IFMT) == S_IFDIR) || nameEndsWith(pent->d_name, GBAEXT) || nameEndsWith(pent->d_name, BINEXT)) {
|
||||
if ((((st.st_mode & S_IFMT) == S_IFDIR) && (((string)pent->d_name).compare(".") != 0)) || nameEndsWith(pent->d_name, GBAEXT) || nameEndsWith(pent->d_name, BINEXT)) {
|
||||
strcpy(fs[numFiles].filename, pent->d_name);
|
||||
// strcpy(fs[numFiles].Alias, pent->d_name);
|
||||
fs[numFiles].type = st.st_mode;
|
||||
if ((((string)pent->d_name).compare(".") != 0) && ((st.st_mode & S_IFMT) != S_IFDIR)) {
|
||||
if ((((string)pent->d_name).compare(".") != 0) && (((string)pent->d_name).compare("..") != 0) && ((st.st_mode & S_IFMT) != S_IFDIR)) {
|
||||
FILE *file = fopen(pent->d_name, "rb");
|
||||
if (file) {
|
||||
fseek(file, 0, SEEK_END);
|
||||
@ -1112,24 +1099,34 @@ void FileListGBA() {
|
||||
}
|
||||
}
|
||||
closedir(dir);
|
||||
}
|
||||
|
||||
for(i = 0; i < numFiles; i++) {
|
||||
sortfile[i] = i;
|
||||
if(fs[i].type & S_IFDIR) {
|
||||
fs[i].gamecode[0] = 0;
|
||||
fs[i].gametitle[0] = 0;
|
||||
} else {
|
||||
sprintf(tbuf, "%s%s", curpath, fs[i].filename);
|
||||
gbaFile = fopen(tbuf, "rb");
|
||||
memset(tbuf, 0, 256);
|
||||
if(gbaFile != NULL)fread(tbuf, 1, 256, gbaFile);
|
||||
tbuf[0xB0] = 0;
|
||||
strcpy(fs[i].gamecode, tbuf + 0xAC);
|
||||
tbuf[0xAC] = 0;
|
||||
strcpy(fs[i].gametitle, tbuf + 0xA0);
|
||||
fclose(gbaFile);
|
||||
numGames++;
|
||||
|
||||
for(i = 0; i < numFiles; i++) {
|
||||
sortfile[i] = i;
|
||||
if(fs[i].type & S_IFDIR) {
|
||||
fs[i].gamecode[0] = 0;
|
||||
fs[i].gametitle[0] = 0;
|
||||
} else {
|
||||
sprintf(tbuf, "%s%s", curpath, fs[i].filename);
|
||||
if (access(tbuf, F_OK) == 0) {
|
||||
gbaFile = fopen(tbuf, "rb");
|
||||
memset(tbuf, 0, 256);
|
||||
if(gbaFile != NULL) {
|
||||
fread(tbuf, 1, 256, gbaFile);
|
||||
tbuf[0xB0] = 0;
|
||||
strcpy(fs[i].gamecode, tbuf + 0xAC);
|
||||
tbuf[0xAC] = 0;
|
||||
strcpy(fs[i].gametitle, tbuf + 0xA0);
|
||||
fclose(gbaFile);
|
||||
} else {
|
||||
fs[i].gamecode[0] = 0;
|
||||
fs[i].gametitle[0] = 0;
|
||||
}
|
||||
} else {
|
||||
fs[i].gamecode[0] = 0;
|
||||
fs[i].gametitle[0] = 0;
|
||||
}
|
||||
numGames++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -32,8 +32,6 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "maindef.h"
|
||||
|
||||
#include "tarosa/tarosa_Graphic.h"
|
||||
#include "tarosa/tarosa_Shinofont.h"
|
||||
|
||||
@ -50,7 +48,7 @@ extern uint16* SubScreen;
|
||||
|
||||
#define BG_256_COLOR (BIT(7))
|
||||
|
||||
#define VERSTRING "v0.61b"
|
||||
#define VERSTRING "v0.62"
|
||||
|
||||
int numFiles = 0;
|
||||
int numGames = 0;
|
||||
@ -70,7 +68,6 @@ bool softReset;
|
||||
extern int carttype;
|
||||
extern bool isSuperCard;
|
||||
extern bool is3in1Plus;
|
||||
extern bool finishedNorFlash;
|
||||
|
||||
u32 inp_key() {
|
||||
u32 ky;
|
||||
@ -79,13 +76,13 @@ u32 inp_key() {
|
||||
swiWaitForVBlank();
|
||||
scanKeys();
|
||||
ky = keysDown();
|
||||
if(ky & KEY_A) break;
|
||||
if(ky & KEY_B) break;
|
||||
if(ky & KEY_A)break;
|
||||
if(ky & KEY_B)break;
|
||||
}
|
||||
while(1) {
|
||||
swiWaitForVBlank();
|
||||
scanKeys();
|
||||
if(keysHeld() != ky) break;
|
||||
if(keysHeld() != ky)break;
|
||||
}
|
||||
return(ky);
|
||||
}
|
||||
@ -103,7 +100,7 @@ void turn_off(bool softReset) {
|
||||
} else {
|
||||
systemShutDown();
|
||||
}
|
||||
while(1);
|
||||
while(1)swiWaitForVBlank();
|
||||
}
|
||||
|
||||
|
||||
@ -128,6 +125,11 @@ void gba_frame() {
|
||||
ret = LoadSkin(2, "/_system_/gbaframe.bmp");
|
||||
if(ret)return;
|
||||
}
|
||||
|
||||
if (access("/ttmenu/gbaframe.bmp", F_OK) == 0) {
|
||||
ret = LoadSkin(2, "/ttmenu/gbaframe.bmp");
|
||||
if(ret)return;
|
||||
}
|
||||
|
||||
pDstBuf1 = (u16*)0x06000000;
|
||||
pDstBuf2 = (u16*)0x06020000;
|
||||
@ -175,7 +177,7 @@ void gbaMode() {
|
||||
sysSetBusOwners(ARM7_OWNS_CARD, ARM7_OWNS_ROM);
|
||||
fifoSendValue32(FIFO_USER_01, 1);
|
||||
REG_IME = 0;
|
||||
while(1);
|
||||
while(1)swiWaitForVBlank();
|
||||
}
|
||||
|
||||
|
||||
@ -932,7 +934,7 @@ int gba_sel() {
|
||||
|
||||
// extern u32 _io_dldi;
|
||||
|
||||
extern void setLang(void);
|
||||
extern void setLang(void);
|
||||
|
||||
|
||||
void mainloop(void) {
|
||||
@ -952,8 +954,8 @@ void mainloop(void) {
|
||||
DrawBox_SUB(SubScreen, 21, 4, 234, 26, 5, 1);
|
||||
DrawBox_SUB(SubScreen, 22, 5, 233, 25, 0, 0);
|
||||
ShinoPrint_SUB( SubScreen, 9*6, 1*12-2, (u8*)"GBA ExpLoader", 0, 0, 0);
|
||||
// ShinoPrint_SUB( SubScreen, 34*6-2, 12, (u8*)VERSTRING, 0, 0, 0);
|
||||
ShinoPrint_SUB( SubScreen, 33*6-2, 12, (u8*)VERSTRING, 0, 0, 0);
|
||||
// ShinoPrint_SUB( SubScreen, 33*6-2, 12, (u8*)VERSTRING, 0, 0, 0);
|
||||
ShinoPrint_SUB( SubScreen, 34*6-2, 12, (u8*)VERSTRING, 0, 0, 0);
|
||||
|
||||
|
||||
DrawBox_SUB(SubScreen, 6, 125, 249, 190, 5, 0);
|
||||
@ -1036,36 +1038,12 @@ REG_EXMEMCNT = (reg & 0xFFE0) | (1 << 4) | (1 << 2) | 1;
|
||||
ShinoPrint_SUB( SubScreen, 8*6, 5*12, (u8*)tbuf, 3, 0, 1);
|
||||
**********************/
|
||||
|
||||
if (ret_menu_chk()) {
|
||||
softReset = true;
|
||||
} else {
|
||||
softReset = false;
|
||||
}
|
||||
|
||||
/*if(ret_menu_chk()) {
|
||||
r4tf = 3;
|
||||
} else {
|
||||
r4tf = 0;
|
||||
if(_io_dldi == 0x46543452) { // R4TF
|
||||
if((*(vu32*)0x027FFE18) == 0x00000000) {
|
||||
r4dt = fopen("/_DS_MENU.DAT", "rb");
|
||||
if(r4dt != NULL) {
|
||||
handle = (__handle *)r4dt->_file;
|
||||
file = (FILE_STRUCT *)handle->fileStruct;
|
||||
part = file->partition;
|
||||
(*(vu32*)0x027FFE18) = (part->rootDirStart + file->dirEntryStart.sector) * 512 + file->dirEntryStart.offset * 32;
|
||||
fclose(r4dt);
|
||||
r4tf = 1;
|
||||
}
|
||||
} else {
|
||||
r4tf = 1;
|
||||
}
|
||||
}
|
||||
if(io_dldi_data->ioInterface.ioType == 0x534D4C44)r4tf = 2; // DLMS
|
||||
}*/
|
||||
|
||||
// SuperCard does not support 3in1's Rumble commands. :P
|
||||
if (isSuperCard)softReset = false;
|
||||
if (isSuperCard) {
|
||||
softReset = false;
|
||||
} else {
|
||||
softReset = ret_menu_chk();
|
||||
}
|
||||
|
||||
/******************************
|
||||
sprintf(tbuf, "0x27FFE18 = %08X", (*(vu32*)0x027FFE18));
|
||||
|
@ -1,10 +0,0 @@
|
||||
|
||||
#ifndef maindef_h
|
||||
#define maindef_h
|
||||
|
||||
#define ROMTITLE "GBA ExpLoader"
|
||||
#define ROMVERSION "Version 0.61b by Rudolph."
|
||||
#define ROMDATE ""__DATE__" "__TIME__
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user