diff --git a/Makefile b/Makefile index 2cb2bc1..1a2cc38 100644 --- a/Makefile +++ b/Makefile @@ -9,7 +9,7 @@ export TARGET := GBA_ExpLoader export TOPDIR := $(CURDIR) export VERSION_MAJOR := 0 -export VERSION_MINOR := 62 +export VERSION_MINOR := 63 export VERSTRING := $(VERSION_MAJOR).$(VERSION_MINOR) # GMAE_ICON is the image used to create the game icon, leave blank to use default rule diff --git a/arm9/include/dsCard.h b/arm9/include/dsCard.h index ae92f82..aef5f63 100644 --- a/arm9/include/dsCard.h +++ b/arm9/include/dsCard.h @@ -46,15 +46,25 @@ typedef bool BOOL ; //下面是访问震动卡的函数 #define FlashBase 0x08000000 -#define _Ez5PsRAM 0x08000000 +#define PSRAMBase_S98 0x08800000 +#define FlashBase_S98 0x09000000 +#define _Ez5PsRAM 0x08000000 +#define SAVE_sram_base 0x0E000000 void OpenNorWrite(); void CloseNorWrite(); - void SetRompage(u16 page); + void SetRompage(u16 page); void SetRampage(u16 page); - void OpenRamWrite(); + void SetSDControl(u16 control); + void Set_AUTO_save(u16 mode); + u16 Read_S71NOR_ID(); // For Reading EZFlash Omega ID + u16 Read_S98NOR_ID(); // For Reading EZFlash Omega ID + void SetPSRampage(u16 page); // EZFlash Omega uses this instead of regular SetRamPage + void Set_RTC_status(u16 status); // EZFlash Omega RTC thingy + u16 Read_SET_info(u32 offset); + void OpenRamWrite(); void CloseRamWrite(); - void SetSerialMode(); - uint32 ReadNorFlashID(); + void SetSerialMode(); + uint32 ReadNorFlashID(); void chip_reset(); void Block_EraseIntel(u32 blockAdd); void Block_Erase(u32 blockAdd); @@ -64,7 +74,9 @@ typedef bool BOOL ; void WriteSram(uint32 address, u8* data , uint32 size ); void ReadSram(uint32 address, u8* data , uint32 size ); void SetShake(u16 data); + void Omega_Bank_Switching(u8 bank); #ifdef __cplusplus } #endif #endif + diff --git a/arm9/include/dsCard.itcm.cpp b/arm9/include/dsCard.itcm.cpp index d61d3b2..942cb23 100644 --- a/arm9/include/dsCard.itcm.cpp +++ b/arm9/include/dsCard.itcm.cpp @@ -16,8 +16,13 @@ extern "C" { #endif +#define NOR_info_offset 0x7A0000 +#define SET_info_offset 0x7B0000 + static u32 ID = 0x227E2218; +u16 gl_ingame_RTC_open_status = 0; + static bool checkForSuperCard() { _SC_changeMode(SC_MODE_RAM); // Try again with SuperCard // _SC_changeMode16(0x1510); @@ -68,6 +73,67 @@ void SetRompage(u16 page) { *(vu16*)0x9fc0000 = 0x1500; } + +// EZ Flash Omega only +void SetSDControl(u16 control) { + *(u16 *)0x9fe0000 = 0xd200; + *(u16 *)0x8000000 = 0x1500; + *(u16 *)0x8020000 = 0xd200; + *(u16 *)0x8040000 = 0x1500; + *(u16 *)0x9400000 = control; + *(u16 *)0x9fc0000 = 0x1500; +} + +void Set_AUTO_save(u16 mode) { + *(u16*)0x9fe0000 = 0xd200; + *(u16*)0x8000000 = 0x1500; + *(u16*)0x8020000 = 0xd200; + *(u16*)0x8040000 = 0x1500; + *(u16*)0x96C0000 = mode; + *(u16*)0x9fc0000 = 0x1500; +} + +u16 Read_S71NOR_ID() { + *((vu16*)(FlashBase)) = 0xF0; + *((vu16*)(FlashBase+0x555*2)) = 0xAA; + *((vu16*)(FlashBase+0x2AA*2)) = 0x55; + *((vu16*)(FlashBase+0x555*2)) = 0x90; + u16 ID1 = *((vu16*)(FlashBase+0xE*2)); + *((vu16*)(FlashBase)) = 0xF0; + return ID1; +} + +u16 Read_S98NOR_ID() { + *((vu16*)(FlashBase_S98)) = 0xF0; + *((vu16*)(FlashBase_S98+0x555*2)) = 0xAA; + *((vu16*)(FlashBase_S98+0x2AA*2)) = 0x55; + *((vu16*)(FlashBase_S98+0x555*2)) = 0x90; + return *((vu16*)(FlashBase_S98+0xE*2)); +} + +// EZFlash Omega uses this +void SetPSRampage(u16 page) { + *(vu16*)0x9fe0000 = 0xd200; + *(vu16*)0x8000000 = 0x1500; + *(vu16*)0x8020000 = 0xd200; + *(vu16*)0x8040000 = 0x1500; + *(vu16*)0x9860000 = page; //C3 + *(vu16*)0x9fc0000 = 0x1500; +} + +u16 Read_SET_info(u32 offset) { return *((vu16 *)(FlashBase+SET_info_offset+offset*2)); } + +// EZFlash Omega RTC thingy +void Set_RTC_status(u16 status) { + *(u16*)0x9fe0000 = 0xd200; + *(u16*)0x8000000 = 0x1500; + *(u16*)0x8020000 = 0xd200; + *(u16*)0x8040000 = 0x1500; + *(u16*)0x96A0000 = status; + *(u16*)0x9fc0000 = 0x1500; +} + + void SetRampage(u16 page) { *(vu16*)0x9fe0000 = 0xd200; *(vu16*)0x8000000 = 0x1500; @@ -116,11 +182,26 @@ u32 ReadNorFlashID() { id1 = *((vu16*)(FlashBase+0x2)); id2 = *((vu16*)(FlashBase+0x2002)); + /*FILE *testFile = fopen("/gbacardID.bin", "wb"); + if (testFile) { + fwrite((void*)(FlashBase+0x2), 2, 1, testFile); + fwrite((void*)(FlashBase+0x2002), 2, 1, testFile); + fclose(testFile); + }*/ + + if ((id1 != 0x227E) || (id2 != 0x227E)) { if (checkForSuperCard()) { ID = 0x227E2202; return 0x227E0000; } + // Check For EZ Flash Omega + SetRompage(0x8002); + id1 = Read_S98NOR_ID(); + if ((id1 == 0x223D)) { + ID = 0x227EEA00; + return 0x227EEA00; + } return 0; } @@ -149,7 +230,10 @@ u32 ReadNorFlashID() { } void chip_reset() { - if(ID == 0x89168916) { + if (ID == 0x227EEA00) { + *((vu16*)(FlashBase_S98)) = 0xF0; + return; + } else if(ID == 0x89168916) { *((vu16*)(FlashBase+0)) = 0x50; *((vu16*)(FlashBase+0x1000*2)) = 0x50; *((vu16*)(FlashBase+0)) = 0xFF; @@ -403,8 +487,8 @@ void WriteNorFlashINTEL(u32 address,u8 *buffer,u32 size) { *((vu16*)(FlashBase+mapaddress+(loopwrite>>1)+0x2000)) = 0xFF; *((vu16*)(FlashBase+mapaddress+(loopwrite>>1))) = 0xE8; *((vu16*)(FlashBase+mapaddress+(loopwrite>>1)+0x2000)) = 0xE8; - *((vu16*)(FlashBase+mapaddress+(loopwrite>>1))) = 0x70; - *((vu16*)(FlashBase+mapaddress+(loopwrite>>1)+0x2000)) = 0x70; + // *((vu16*)(FlashBase+mapaddress+(loopwrite>>1))) = 0x70; + // *((vu16*)(FlashBase+mapaddress+(loopwrite>>1)+0x2000)) = 0x70; v1=v2=0; while((v1!= 0x80) || (v2 != 0x80)) { v1 = *((vu16 *)(FlashBase+mapaddress+(loopwrite>>1))); @@ -487,6 +571,13 @@ void WriteNorFlash(u32 address,u8 *buffer,u32 size) { } } +void Omega_Bank_Switching(u8 bank) { + *((vu8 *)(SAVE_sram_base+0x5555)) = 0xAA ; + *((vu8 *)(SAVE_sram_base+0x2AAA)) = 0x55 ; + *((vu8 *)(SAVE_sram_base+0x5555)) = 0xB0 ; + *((vu8 *)(SAVE_sram_base+0x0000)) = bank ; +} + void WriteSram(uint32 address, u8* data , uint32 size ) { uint32 i ; for(i=0;i 0x09000000 && (exp + PatchAddr[i]) < 0x09800000) { + SetPSRampage(0x1000); + } else if ((exp + PatchAddr[i]) > 0x0A000000 && (exp + PatchAddr[i]) < 0x0A800000) { + SetPSRampage(0x2000); + } else if ((exp + PatchAddr[i]) > 0x0B000000 && (exp + PatchAddr[i]) < 0x0B800000) { + SetPSRampage(0x3000); + } + } + switch(SaveType) { case 2: // EEPROM if(PatchType[i] == 0x21)_patch_ram(buf, ofs, patch_eeprom_1, sizeof(patch_eeprom_1)); @@ -1939,6 +1954,7 @@ void gba_patch_Ram(u32 exp, char *name, int cart) { break; } } + if (isOmega)SetPSRampage(0); } diff --git a/arm9/source/gbaldr.itcm.cpp b/arm9/source/gbaldr.itcm.cpp index f146cf4..34a36d6 100644 --- a/arm9/source/gbaldr.itcm.cpp +++ b/arm9/source/gbaldr.itcm.cpp @@ -45,6 +45,7 @@ #define USE_SRAM_NOR 16 // 0x0A010000-0A02FFFF +#define USE_SRAM_PSR_Omega 160 #define USE_SRAM_PSR 50 // 0x0A032000-0A051FFF #define USE_SRAM_PSR_EZ4 16 // 0x0A010000-0A02FFFF #define USE_SRAM_PSR_EWN 8 // 0x0A000000-0A01FFFF @@ -77,8 +78,11 @@ static u32 savesize; int carttype = 0; bool isSuperCard = false; bool is3in1Plus = false; +bool isOmega = false; extern int save_sel(int mod, char *name); +extern u16 gl_ingame_RTC_open_status; +extern void SetSDControl(u16 control); char const *Rudolph = "GBA ExpLoader by Rudolph (LocalCode v0.1)"; @@ -384,6 +388,8 @@ int check_M3() { void _RamPG() { + if (isSuperCard)return; + if (isOmega)return; switch (carttype) { case 3: SetRampage(USE_SRAM_PG_EZ4); @@ -403,6 +409,8 @@ void _RamPG() { } void _RamSave(int bnk) { + if (isSuperCard)return; + if (isOmega)return; switch (carttype) { case 3: SetRampage(USE_SRAM_PSR_EZ4 + bnk * 16); @@ -412,12 +420,20 @@ void _RamSave(int bnk) { return; } - if((carttype >= 4) && !isSuperCard) { + if(carttype >= 4) { SetEWINRam(USE_SRAM_PSR_EWN + bnk); return; } - if(GBAmode == 0) { SetRampage(USE_SRAM_PSR + bnk * 16); } else { SetRampage(USE_SRAM_NOR + bnk * 16); } + if(GBAmode == 0) { + if (isOmega) { + SetRampage(bnk * 16); + } else { + SetRampage(USE_SRAM_PSR + bnk * 16); + } + } else { + SetRampage(USE_SRAM_NOR + bnk * 16); + } return; } @@ -442,26 +458,41 @@ int checkFlashID() { carttype = 6; // M3/G6 is3in1Plus = false; isSuperCard = false; + isOmega = false; return carttype; } ewin = check_EWIN(); if(ewin > 0)carttype = (3 + ewin); // EWIN is3in1Plus = false; isSuperCard = false; + isOmega = false; return carttype; case 0x227E2218: carttype = 1; return carttype; // 3in1 case 0x227E2202: carttype = 2; return carttype; // New3in1 + case 0x89168916: // 3in1 Plus + is3in1Plus = true; + isSuperCard = false; + isOmega = false; + carttype = 1; + return carttype; case 0x227E2220: carttype = 3; return carttype; // EZ4 + case 0x227EEA00: // EZFlash Omega + carttype = 1; + is3in1Plus = false; + isSuperCard = false; + isOmega = true; + SetSDControl(0); + Set_RTC_status(1); + gl_ingame_RTC_open_status = Read_SET_info(13); + if( (gl_ingame_RTC_open_status != 0x0) && (gl_ingame_RTC_open_status != 0x1))gl_ingame_RTC_open_status = 0x1; + Omega_Bank_Switching(0); + Set_AUTO_save(0); + return carttype; case 0x227E0000: // SuperCard carttype = 6; is3in1Plus = false; isSuperCard = true; return carttype; - case 0x89168916: // 3in1 Plus - is3in1Plus = true; - isSuperCard = false; - carttype = 1; - return carttype; default: return 0; // Unsupported/Unimplemented Cart ID } } @@ -489,12 +520,12 @@ int checkSRAM(char *name) { if(ctrl.sign[i] != Rudolph[i])break; } - if((carttype < 4) && !isSuperCard)OpenNorWrite(); + if((carttype < 4) && !isSuperCard && !is3in1Plus && !isOmega)OpenNorWrite(); if(Rudolph[i] != 0) { strcpy((char *)ctrl.sign, Rudolph); ctrl_set(); - if((carttype < 4) && !isSuperCard)CloseNorWrite(); + if((carttype < 4) && !isSuperCard && !is3in1Plus && !isOmega)CloseNorWrite(); return false; } @@ -513,11 +544,11 @@ int checkSRAM(char *name) { savesize = 0x10000; ctrl.save_siz[GBAmode] = savesize; ctrl_set(); - if((carttype < 4) && !isSuperCard)CloseNorWrite(); + if((carttype < 4) && !isSuperCard && !is3in1Plus && !isOmega)CloseNorWrite(); return false; } - if((carttype < 4) && !isSuperCard)CloseNorWrite(); + if((carttype < 4) && !isSuperCard && !is3in1Plus && !isOmega)CloseNorWrite(); return true; } @@ -641,30 +672,27 @@ void writeSramToFile(char *savename) { ctrl.save_flg[GBAmode] = 0xFF; - if((carttype < 4) && !isSuperCard)OpenNorWrite(); + if((carttype < 4) && !isSuperCard && !isOmega && !is3in1Plus)OpenNorWrite(); ctrl_set(); - if((carttype < 4) && !isSuperCard)CloseNorWrite(); + if((carttype < 4) && !isSuperCard && !isOmega && !is3in1Plus)CloseNorWrite(); } -// void _WritePSram(uint32 address, u8* data , uint32 size); - void SRAMdump(int cmd) { - FILE *dmp; + FILE *dmp; int i; int mx; - char name[256]; + char name[256]; mx = 8; - if(carttype == 4) - mx = 4; - if(carttype == 5) - mx = 2; - if(carttype == 6) - mx = 16; - - + + switch (carttype) { + case 4: mx = 4; break; + case 5: mx = 2; break; + case 6: mx = 16; break; + } + sprintf(name, "%s/SRAM.BIN", ini.save_dir); if(cmd == 0) { dmp = fopen(name, "wb"); @@ -672,19 +700,19 @@ void SRAMdump(int cmd) { if(carttype == 6) { SetM3Ram(i); } else { - if((carttype >= 4) && !isSuperCard) { - SetEWINRam(8 + i); + if((carttype >= 4) && !isSuperCard) { + SetEWINRam(8 + i); } else { + if (isOmega && (i > 4))Omega_Bank_Switching(0x01); SetRampage(i * 16); } } ReadSram(SRAM_ADDR, rwbuf, USE_SRAM / 2); - if(dmp != NULL) - fwrite(rwbuf, 1, USE_SRAM / 2, dmp); + if(dmp != NULL)fwrite(rwbuf, 1, USE_SRAM / 2, dmp); } } else { dmp = fopen(name, "rb"); - if((carttype < 4) && !isSuperCard)OpenNorWrite(); + if((carttype < 4) && !isSuperCard && !isOmega && !is3in1Plus)OpenNorWrite(); for(i = 0; i < mx; i++) { memset(rwbuf, 0, USE_SRAM / 2); @@ -696,15 +724,17 @@ void SRAMdump(int cmd) { if((carttype >= 4) && !isSuperCard) { SetEWINRam(8 + i); } else { + if (isOmega && (i > 4))Omega_Bank_Switching(0x01); SetRampage(i * 16); } } WriteSram(SRAM_ADDR, rwbuf, USE_SRAM / 2); } - if((carttype < 4) && !isSuperCard)CloseNorWrite(); + if((carttype < 4) && !isSuperCard && !isOmega && !is3in1Plus)CloseNorWrite(); } fclose(dmp); + if (isOmega)Omega_Bank_Switching(0); _RamSave(0); } @@ -712,14 +742,14 @@ void blankSRAM(char *savename) { memset(rwbuf, 0xFF, USE_SRAM / 2); - if((carttype < 4) && !isSuperCard)OpenNorWrite(); + if((carttype < 4) && !isSuperCard && !isOmega && !is3in1Plus)OpenNorWrite(); _RamSave(0); WriteSram(SRAM_ADDR, rwbuf, USE_SRAM / 2); // if(carttype != 5) { - _RamSave(1); - WriteSram(SRAM_ADDR, rwbuf, USE_SRAM / 2); + _RamSave(1); + WriteSram(SRAM_ADDR, rwbuf, USE_SRAM / 2); // } ctrl.save_siz[GBAmode] = savesize; @@ -728,7 +758,7 @@ void blankSRAM(char *savename) { strcpy((char *)ctrl.sav_nam[GBAmode], savename); ctrl_set(); - if((carttype < 4) && !isSuperCard)CloseNorWrite(); + if((carttype < 4) && !isSuperCard && !isOmega && !is3in1Plus)CloseNorWrite(); } void writeSramFromFile(char *savename) { @@ -747,7 +777,7 @@ void writeSramFromFile(char *savename) { } - if((carttype < 4) && !isSuperCard)OpenNorWrite(); + if((carttype < 4) && !isSuperCard && !isOmega && !is3in1Plus)OpenNorWrite(); ctrl.save_siz[GBAmode] = savesize; ctrl.save_flg[GBAmode] = 0x00; @@ -764,16 +794,16 @@ void writeSramFromFile(char *savename) { WriteSram(SRAM_ADDR, rwbuf, USE_SRAM / 2); // if(carttype != 5) { - if(savesize > USE_SRAM / 2) { - _RamSave(1); - memset(rwbuf, 0xFF, USE_SRAM / 2); - fread(rwbuf, 1, USE_SRAM / 2, saver); - WriteSram(SRAM_ADDR, rwbuf, USE_SRAM / 2); - _RamSave(0); - } + if(savesize > USE_SRAM / 2) { + _RamSave(1); + memset(rwbuf, 0xFF, USE_SRAM / 2); + fread(rwbuf, 1, USE_SRAM / 2, saver); + WriteSram(SRAM_ADDR, rwbuf, USE_SRAM / 2); + _RamSave(0); + } // } - if((carttype < 4) && !isSuperCard)CloseNorWrite(); + if((carttype < 4) && !isSuperCard && !isOmega && !is3in1Plus)CloseNorWrite(); fclose(saver); } @@ -787,13 +817,13 @@ void _ReadPSram(uint32 address, u8* data , uint32 size) { 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; for(i = 0; i < size / 2; i++)pData[i] = sData[i]; -} +}*/ extern void turn_off(int cmd); @@ -816,7 +846,7 @@ int writeFileToNor(int sel) { if(fs[sel].filesize > fsz)return 1; if(!checkSRAM(savName)) { - err_cnf(4, 5); + err_cnf(4, 5); } else { if(save_sel(1, savName) >= 0)writeSramToFile(savName); } @@ -877,8 +907,8 @@ int writeFileToNor(int sel) { dsp_bar(1, 100); fclose(gbaFile); - - if (is3in1Plus)chip_reset(); + + // if (is3in1Plus)chip_reset(); CloseNorWrite(); @@ -886,7 +916,7 @@ int writeFileToNor(int sel) { if(cmd >= 0) { writeSramFromFile(savName); } else { blankSRAM(savName); } dsp_bar(-1, 100); -// SetRampage(USE_SRAM_NOR); + // SetRampage(USE_SRAM_NOR); return(0); } @@ -899,20 +929,21 @@ int writeFileToRam(int sel) { u32 fsz; int cmd; bool gba; + // Needed for EZFlash Omega + u32 PSRamPage = 0; - if(carttype >= 3) { fsz = MAX_NOR; } else { fsz = MAX_PSRAM; } + if (carttype >= 3) { fsz = MAX_NOR; } else if (isOmega) { fsz = MAX_NOR; } else { fsz = MAX_PSRAM; } - if(carttype >= 4) { exp = 0x08000000; } else { exp = 0x08060000; } + if (carttype >= 4) { exp = 0x08000000; } else if (isOmega) { exp = 0x08800000; } else { exp = 0x08060000; } + exps = exp; if(fs[sel].filesize > fsz)return 1; - // if(checkSRAM(savName) == false) { // err_cnf(4, 5); // } else 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; } sprintf(tbuf, "%s%s", curpath, fs[sel].filename); @@ -924,16 +955,19 @@ int writeFileToRam(int sel) { cmd = save_sel(0, savName); // SetRampage(USE_SRAM_PSR); - if((carttype < 4) && !isSuperCard) { + if((carttype < 4) && !isSuperCard && !isOmega) { if(carttype == 3) { SetRompage(0x300 - 3); } else { SetRompage(384 - 3); } OpenNorWrite(); } // savesize = gba_check(gbaFile, fs[sel].filesize, rwbuf, 0x100000); // if(savesize == 0)savesize = 0x8000; - dsp_bar(2, -1); gba_check_int(fs[sel].filename); + + if (isOmega)SetPSRampage(0); + + DC_FlushRange((void*)rwbuf, (0x100000 + 0x400)); for(siz = 0; siz < fs[sel].filesize; siz += 0x100000, exp += 0x100000) { fseek(gbaFile, siz, SEEK_SET); @@ -945,17 +979,31 @@ int writeFileToRam(int sel) { savesize = gba_check_Ram1(rwbuf, 0x100000, fs[sel].filesize, siz); - _WritePSram(exp, rwbuf, 0x100000); -// dmaCopy(rwbuf, (void *)exp, 0x100000); + if (isOmega) { + if (exp >= 0x09000000) { + PSRamPage += 0x1000; + SetPSRampage(PSRamPage); + exp = 0x08800000; + } + } + + // _WritePSram(exp, rwbuf, 0x100000); + + dmaCopy((void*)rwbuf, (void*)exp, 0x100000); // dmaCopyWords(3, rwbuf, (void *)exp, 0x100000); } - + + DC_FlushRange((void*)rwbuf, 0x100000); + + if (isOmega)SetPSRampage(0); + dsp_bar(2, 100); gba_check_Ram2(exps, rwbuf, 0x100000, fs[sel].filesize); gba_patch_Ram(exps, fs[sel].filename, carttype); fclose(gbaFile); + // if(carttype == 5 && savesize == 0x20000) { // dsp_bar(-1, 100); // return(2); @@ -966,16 +1014,28 @@ int writeFileToRam(int sel) { dsp_bar(-1, 100); - if((carttype < 4) && !isSuperCard)CloseNorWrite(); + if((carttype < 4) && !isSuperCard && !isOmega)CloseNorWrite(); _RamSave(0); + if(carttype >= 4 && !isSuperCard) { if(carttype == 6) { Close_M3(); } else { Close_EWIN(); } } - if(carttype == 3)SetRompage(0x300); - if(carttype <= 2)SetRompage(384); - - return(0); + + if (isSuperCard)return 0; + + if (isOmega) { + Set_RTC_status(gl_ingame_RTC_open_status); + SetRompage(0x200); + return 0; + } + + if(carttype == 3) { + SetRompage(0x300); + } else if(carttype <= 2) { + SetRompage(384); + } + return 0; } diff --git a/arm9/source/main.c b/arm9/source/main.c index 88bc33b..883bc89 100644 --- a/arm9/source/main.c +++ b/arm9/source/main.c @@ -48,7 +48,7 @@ extern uint16* SubScreen; #define BG_256_COLOR (BIT(7)) -#define VERSTRING "v0.62" +#define VERSTRING "v0.63" int numFiles = 0; int numGames = 0; @@ -68,6 +68,9 @@ bool softReset; extern int carttype; extern bool isSuperCard; extern bool is3in1Plus; +extern bool isOmega; +extern u16 gl_ingame_RTC_open_status; +extern void SetSDControl(u16 control); u32 inp_key() { u32 ky; @@ -808,6 +811,7 @@ int gba_sel() { if((ky & KEY_L) && !isSuperCard) { if(GBAmode > 0) { GBAmode--; + if ((GBAmode == 1) && isOmega)GBAmode--; setGBAmode(); _gba_sel_dsp(sel, yc, 0); // cmd = -1; @@ -818,9 +822,13 @@ int gba_sel() { if(softReset && (carttype > 2)) { cmd = 3; break; - } + } /*else if (softReset && isOmega) { + cmd = 3; + break; + }*/ if(GBAmode < cn && carttype <= 2) { GBAmode++; + if ((GBAmode == 1) && isOmega)GBAmode++; setGBAmode(); if(GBAmode == 2) { _gba_dsp(sel, 0, x, y+yc); @@ -861,7 +869,8 @@ int gba_sel() { if(ky & KEY_X) { if(GBAmode == 1) { - if (!is3in1Plus)SetRompage(0); + // if (!is3in1Plus)SetRompage(0); + SetRompage(0); SetRampage(16); gbaMode(); } else { @@ -911,6 +920,7 @@ int gba_sel() { } } else { if(GBAmode == 0) { + // if (is3in1Plus)SetRompage(0x100); // SetRompage(384); gbaMode(); } @@ -1006,7 +1016,9 @@ REG_EXMEMCNT = (reg & 0xFFE0) | (1 << 4) | (1 << 2) | 1; break; case 1: if (is3in1Plus) { - ShinoPrint_SUB( SubScreen, 23*6, 1*12-2, (u8*)"[3in1Pls]", 0, 0, 0 ); + ShinoPrint_SUB( SubScreen, 23*6, 1*12-2, (u8*)"[3in1Pls]", 0, 0, 0 ); + } else if (isOmega) { + ShinoPrint_SUB( SubScreen, 23*6, 1*12-2, (u8*)"[ Omega ]", 0, 0, 0 ); } else { ShinoPrint_SUB( SubScreen, 23*6, 1*12-2, (u8*)" [ 3in1 ]", 0, 0, 0 ); } @@ -1037,12 +1049,15 @@ REG_EXMEMCNT = (reg & 0xFFE0) | (1 << 4) | (1 << 2) | 1; ShinoPrint_SUB( SubScreen, 8*6, 5*12, (u8*)tbuf, 3, 0, 1); **********************/ - // SuperCard does not support 3in1's Rumble commands. :P - if (isSuperCard) { + // SuperCard and EZFlash Omega does not support 3in1's Rumble commands. :P + /*if (isOmega) { + softReset = false; + } else */ if (isSuperCard) { softReset = false; } else { softReset = ret_menu_chk(); } + /****************************** sprintf(tbuf, "0x27FFE18 = %08X", (*(vu32*)0x027FFE18)); @@ -1105,20 +1120,25 @@ inp_key(); *(vu8*)0x027FFC35 = 0x00; // 奼挘 switch(cmd) { case 0: - SetShake(0xF0); + if (!isSuperCard)SetShake(0xF0); break; case 1: - SetShake(0xF1); + if (!isSuperCard)SetShake(0xF1); break; case 2: - SetShake(0xF2); + if (!isSuperCard)SetShake(0xF2); break; case 3: - if(carttype != 4) { - SetRompage(0x300); + if((carttype != 4) && !isSuperCard && !isOmega) { + /*if (isOmega) { + Set_RTC_status(gl_ingame_RTC_open_status); + SetRompage(0x200);*/ + // } else { + if (is3in1Plus) { SetRompage(0x100); } else { SetRompage(0x300); } OpenNorWrite(); + // } } - RamClear(); + if(!isSuperCard)RamClear(); break; }