diff --git a/arm7/source/main.c b/arm7/source/main.c index 96c43bd..05500c7 100644 --- a/arm7/source/main.c +++ b/arm7/source/main.c @@ -29,6 +29,8 @@ ---------------------------------------------------------------------------------*/ #include +//static u8 aesIvValues[0x10] = {0x80,0x6B,0xCF,0x4F,0x93,0xEE,0x6F,0x21,0xF9,0x86,0xDF,0x98,0x7D,0xE7,0xFD,0x07}; + unsigned int * SCFG_EXT=(unsigned int*)0x4004008; //--------------------------------------------------------------------------------- @@ -97,6 +99,34 @@ int main() { for (int i = 0; i < 8; i++) { *(u8*)(0x2FFFD00+i) = *(u8*)(0x4004D07-i); // Get ConsoleID } + // Get ConsoleID + /*for (int i = 0; i < 0x10; i++) { + REG_AES_IV[i] = aesIvValues[i]; + } + *(vu16*)0x4004406 = 1;*/ + + /* *(u32*)(0x4004104+(0*0x1C)) = REG_AES_RDFIFO; + *(u32*)(0x4004108+(0*0x1C)) = 0x2FFFD00; + + *(u32*)(0x4004110+(0*0x1C)) = 2; + + *(u32*)(0x4004114+(0*0x1C)) = 0x1; + + *(u32*)(0x400411C+(0*0x1C)) = (1<<19 | 11<<28); */ + + /*REG_AES_WRFIFO = 0xFFFFFFFF; + REG_AES_WRFIFO = 0xEEEEEEEE; + REG_AES_WRFIFO = 0xDDDDDDDD; + REG_AES_WRFIFO = 0xCCCCCCCC; + REG_AES_CNT = (AES_RDFIFO_FLUSH | AES_CNT_DMA_READ_SIZE(1) | AES_CNT_KEY_APPLY | AES_CNT_KEYSLOT(3) | AES_CNT_MODE(0) | AES_CNT_IRQ | AES_CNT_ENABLE); + */ + /* *(u32*)(0x2FFFD00) = REG_AES_RDFIFO; + for (int i = 0; i < 3; i++) { + *(u32*)(0x2FFFD04) = REG_AES_RDFIFO; + }*/ + /*for (int i = 0; i < 4; i++) { + *(u8*)(0x2FFFD04+i) = *(u8*)(0x40044EC+i); + }*/ fifoSendValue32(FIFO_USER_03, *SCFG_EXT); fifoSendValue32(FIFO_USER_07, *(u16*)(0x4004700)); diff --git a/arm9/source/dumpOperations.cpp b/arm9/source/dumpOperations.cpp index 092d6f0..8547102 100644 --- a/arm9/source/dumpOperations.cpp +++ b/arm9/source/dumpOperations.cpp @@ -13,6 +13,8 @@ #include "read_card.h" #include "tonccpy.h" +extern u8 copyBuf[]; + extern bool expansionPakFound; extern PrintConsole topConsole, bottomConsole; @@ -53,7 +55,7 @@ void ndsCardSaveDump(const char* filename) { void ndsCardDump(void) { int pressed = 0; - bool showGameCardMsgAgain = false; + //bool showGameCardMsgAgain = false; consoleSelect(&bottomConsole); consoleClear(); @@ -132,7 +134,6 @@ void ndsCardDump(void) { char gameCode[7] = {0}; tonccpy(gameCode, ndsCardHeader.gameCode, 6); bool trimRom = (pressed & KEY_Y); - char romBuffer[0x200]; char destPath[256]; sprintf(destPath, "%s:/gm9i/out/%s_%s_%x%s.nds", (sdMounted ? "sd" : "fat"), gameTitle, gameCode, ndsCardHeader.romversion, (trimRom ? "_trim" : "")); char destSavPath[256]; @@ -289,8 +290,9 @@ void ndsCardDump(void) { fclose(destinationFile); } else {*/ remove(destPath); + u32 currentSize = romSize; FILE* destinationFile = fopen(destPath, "wb"); - for (u32 src = 0; src < romSize; src += 0x200) { + for (u32 src = 0; src < romSize; src += 0x8000) { consoleSelect(&topConsole); printf ("\x1B[30m"); // Print black color // Move to right side of screen @@ -303,8 +305,11 @@ void ndsCardDump(void) { printf ("\x1b[8;0H"); printf ("Progress:\n"); printf ("%i/%i Bytes", (int)src, (int)romSize); - cardRead (src, romBuffer); - fwrite(romBuffer, 1, 0x200, destinationFile); + for (u32 i = 0; i < 0x8000; i += 0x200) { + cardRead (src+i, copyBuf+i); + } + fwrite(copyBuf, 1, (currentSize>=0x8000 ? 0x8000 : currentSize), destinationFile); + currentSize -= 0x8000; } fclose(destinationFile); ndsCardSaveDump(destSavPath); diff --git a/arm9/source/main.cpp b/arm9/source/main.cpp index f36f4ed..ff8ef9b 100644 --- a/arm9/source/main.cpp +++ b/arm9/source/main.cpp @@ -139,7 +139,7 @@ int main(int argc, char **argv) { bool yHeld = false; - sprintf(titleName, "GodMode9i v%i.%i.%i", 2, 2, 0); + sprintf(titleName, "GodMode9i v%i.%i.%i", 2, 2, 1); // initialize video mode videoSetMode(MODE_4_2D); @@ -191,6 +191,7 @@ int main(int argc, char **argv) { } printf ("\x1b[22;11H"); printf ("mounting drive(s)..."); + //printf ("%X %X", *(u32*)0x2FFFD00, *(u32*)0x2FFFD04); sysSetCartOwner (BUS_OWNER_ARM9); // Allow arm9 to access GBA ROM