mirror of
https://github.com/ApacheThunder/nrioTool.git
synced 2025-06-18 19:15:34 -04:00
1.8 Release Commit ...
* Final D2 init command now uses the value from the cart's header (found at offset 0x8) instead of the hardcoded value found with most 16g and 8g carts.
This commit is contained in:
parent
ebfa1b81ab
commit
6fa7430f62
2
.gitignore
vendored
2
.gitignore
vendored
@ -38,6 +38,8 @@
|
||||
*.cmd
|
||||
*.nds
|
||||
*.app
|
||||
*.tmd
|
||||
*.zip
|
||||
*.arm7
|
||||
*.arm9
|
||||
*.elf
|
||||
|
@ -24,7 +24,7 @@ DATA :=
|
||||
#---------------------------------------------------------------------------------
|
||||
ARCH := -mthumb -mthumb-interwork
|
||||
|
||||
CFLAGS := -g -Wall -Os \
|
||||
CFLAGS := -g -Wall -Oz \
|
||||
-mcpu=arm7tdmi -mtune=arm7tdmi -fomit-frame-pointer\
|
||||
-ffast-math \
|
||||
$(ARCH)
|
||||
|
@ -155,12 +155,16 @@ void CardInit(bool Silent = true, bool SkipSlotReset = false) {
|
||||
tonccpy(gameTitle, cartHeader->ndshdr.gameTitle, 12);
|
||||
tonccpy(gameCode, cartHeader->ndshdr.gameCode, 6);
|
||||
ndsHeader = loadHeader(cartHeader); // copy twlHeaderTemp to ndsHeader location
|
||||
InitCartNandReadMode();
|
||||
u32 CardType = *(u32*)(DSI_HEADER + 0x08);
|
||||
InitCartNandReadMode(CardType);
|
||||
DoWait();
|
||||
if (!Silent) {
|
||||
if (wasDSi && SCFGUnlocked) { iprintf("SCFG_MC Status: %2x \n\n", REG_SCFG_MC); }
|
||||
iprintf("Detected Cart Name: %12s \n\n", gameTitle);
|
||||
iprintf("Detected Cart Game Id: %6s \n\n", gameCode);
|
||||
iprintf("Detected Cart Type: %8x \n\n", (unsigned int)CardType);
|
||||
printf("Press any button to continue...");
|
||||
do { swiWaitForVBlank(); scanKeys(); } while (!keysDown());
|
||||
}
|
||||
}
|
||||
|
||||
@ -790,7 +794,7 @@ void DoUdiskDump() {
|
||||
}*/
|
||||
|
||||
int UtilityMenu() {
|
||||
LoadTopScreenUtilitySplash();
|
||||
if(!WarningPosted)LoadTopScreenUtilitySplash();
|
||||
int value = -1;
|
||||
consoleClear();
|
||||
printf("Press [A] to build update file\n");
|
||||
|
@ -43,12 +43,21 @@ void nrioSendCommand(u32 cmdbuffer, u32 cmdData, u8 cmd, u32 cmdflags) {
|
||||
}
|
||||
}*/
|
||||
|
||||
// Final C1 command now reads from 0x08 location of header like origional stage1 main rom does instead of hardcoding.
|
||||
// Some different capacity cards are known to use different values. 1080 = what most 16g carts use. Some 2G carts also use this value
|
||||
|
||||
void InitCartNandReadMode(u32 CardType) {
|
||||
// Only bricked carts would present values like these. Hard Code 1083 if this is the case
|
||||
switch (CardType) {
|
||||
case 0x00000000: { CardType = 0x10830000; }break;
|
||||
case 0xFFFFFFFF: { CardType = 0x10830000; }break;
|
||||
}
|
||||
|
||||
void InitCartNandReadMode() {
|
||||
cardParamCommand (0x66, 0, CARD_ACTIVATE | CARD_nRESET | CARD_BLK_SIZE(7) | CARD_SEC_CMD | BIT(20) | BIT(19) | BIT(14) | BIT(13), (u32*)INITBUFFER, 128);
|
||||
cardParamCommand (0xC1, 0x0D210000, CARD_ACTIVATE | CARD_nRESET | CARD_BLK_SIZE(7) | BIT(17), (u32*)(INITBUFFER + 0x10), 128);
|
||||
cardParamCommand (0xC1, 0x0FB00000, CARD_ACTIVATE | CARD_nRESET | CARD_BLK_SIZE(7) | BIT(17), (u32*)(INITBUFFER + 0x10), 128);
|
||||
cardParamCommand (0xC1, 0x10830000, CARD_ACTIVATE | CARD_nRESET | CARD_BLK_SIZE(7) | BIT(17), (u32*)(INITBUFFER + 0x20), 128);
|
||||
cardParamCommand (0xC1, CardType, CARD_ACTIVATE | CARD_nRESET | CARD_BLK_SIZE(7) | BIT(17), (u32*)(INITBUFFER + 0x20), 128);
|
||||
// cardParamCommand (0xC1, 0x10830000, CARD_ACTIVATE | CARD_nRESET | CARD_BLK_SIZE(7) | BIT(17), (u32*)(INITBUFFER + 0x20), 128);
|
||||
// DoWait(8);
|
||||
/**(vu32*)INITBUFFER = nrioInit(0x66, 0xAF586000);
|
||||
nrioSendCommand((u32)(INITBUFFER + 0x10), 0x0D210000, 0xC1, 0xA7020000);
|
||||
|
@ -5,8 +5,7 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void InitCartNandReadMode(void);
|
||||
void InitCartNandReadModeALT(void);
|
||||
void InitCartNandReadMode(u32 CardType);
|
||||
ITCM_CODE void nrio_readSectors(void* destination, u32 rom_offset, u32 num_words);
|
||||
ITCM_CODE void nrio_readSector(void* destination, u32 rom_offset);
|
||||
ITCM_CODE void nrio_readSectorB7(void* destination, u32 rom_offset);
|
||||
|
Loading…
Reference in New Issue
Block a user