diff --git a/desmume/src/NDSSystem.cpp b/desmume/src/NDSSystem.cpp index d936cf902..3637c9d48 100644 --- a/desmume/src/NDSSystem.cpp +++ b/desmume/src/NDSSystem.cpp @@ -270,13 +270,6 @@ void debug() //if((NDS_ARM9.R[15]>>28)) emu_halt(); } -#define DSGBA_LOADER_SIZE 512 -enum -{ - ROM_NDS = 0, - ROM_DSGBA -}; - #if 0 /* not used */ //http://www.aggregate.org/MAGIC/#Population%20Count%20(Ones%20Count) static u32 ones32(u32 x) @@ -547,6 +540,8 @@ static int rom_init_path(const char *filename, const char *physicalName, const c return -1; } + gameInfo.romType = type; + return 1; } @@ -600,29 +595,17 @@ int NDS_LoadROM(const char *filename, const char *physicalName, const char *logi // gameInfo.chipID |= (0x40 << 24); gameInfo.chipID |= (0x00 << 24); - INFO("\nROM game code: %c%c%c%c\n", gameInfo.header.gameCode[0], gameInfo.header.gameCode[1], gameInfo.header.gameCode[2], gameInfo.header.gameCode[3]); - INFO("ROM crc: %08X\n", gameInfo.crc); - INFO("ROM serial: %s\n", gameInfo.ROMserial); - INFO("ROM chipID: %08X\n", gameInfo.chipID); - INFO("ROM internal name: %s\n", gameInfo.ROMname); - if (gameInfo.isDSiEnhanced()) INFO("ROM DSi Enhanced\n"); - INFO("ROM developer: %s\n", getDeveloperNameByID(gameInfo.header.makerCode).c_str()); + if (gameInfo.romType == ROM_NDS) + { + INFO("\nROM game code: %c%c%c%c\n", gameInfo.header.gameCode[0], gameInfo.header.gameCode[1], gameInfo.header.gameCode[2], gameInfo.header.gameCode[3]); + INFO("ROM crc: %08X\n", gameInfo.crc); + INFO("ROM serial: %s\n", gameInfo.ROMserial); + INFO("ROM chipID: %08X\n", gameInfo.chipID); + INFO("ROM internal name: %s\n", gameInfo.ROMname); + if (gameInfo.isDSiEnhanced()) INFO("ROM DSi Enhanced\n"); + INFO("ROM developer: %s\n", getDeveloperNameByID(gameInfo.header.makerCode).c_str()); + } -#if 1 - u32 mask = gameInfo.header.endROMoffset - 1; - mask |= (mask >> 1); - mask |= (mask >> 2); - mask |= (mask >> 4); - mask |= (mask >> 8); - mask |= (mask >> 16); - - printf("======================================================================\n"); - printf("card size %10u (%08Xh) mask %08Xh\n", gameInfo.cardSize, gameInfo.cardSize, gameInfo.mask); - printf("file size %10u (%08Xh)\n", gameInfo.romsize, gameInfo.romsize); - printf("endROMoffset %10u (%08Xh) mask %08Xh\n", gameInfo.header.endROMoffset, gameInfo.header.endROMoffset, mask); - printf("======================================================================\n"); -#endif - memset(buf, 0, MAX_PATH); strcpy(buf, path.pathToModule); strcat(buf, "desmume.ddb"); // DeSmuME database :) diff --git a/desmume/src/NDSSystem.h b/desmume/src/NDSSystem.h index f01107acb..3cde6dd6e 100644 --- a/desmume/src/NDSSystem.h +++ b/desmume/src/NDSSystem.h @@ -86,6 +86,13 @@ extern BOOL click; extern CFIRMWARE *firmware; +#define DSGBA_LOADER_SIZE 512 +enum +{ + ROM_NDS = 0, + ROM_DSGBA +}; + //#define LOG_ARM9 //#define LOG_ARM7 @@ -332,6 +339,7 @@ struct GameInfo u32 crc; u32 chipID; u32 lastReadPos; + u32 romType; char ROMserial[20]; char ROMname[20]; bool _isDSiEnhanced; @@ -350,6 +358,7 @@ struct GameInfo cardSize(0), mask(0), lastReadPos(0xFFFFFFFF), + romType(ROM_NDS), _isDSiEnhanced(false) { memset(&header, 0, sizeof(header)); diff --git a/desmume/src/windows/resource.h b/desmume/src/windows/resource.h index d584cb661..9d48d82b2 100644 --- a/desmume/src/windows/resource.h +++ b/desmume/src/windows/resource.h @@ -843,6 +843,8 @@ #define IDC_REGION 6000 #define IDC_IOREG 6001 #define IDC_CPU 6002 +#define IDC_R4_FOLDER 6003 +#define IDC_R4_ROM 6004 #define ID_LABEL_ZELDA_SHADOW_DEPTH_HACK 9000 #define IDC_ZELDA_SHADOW_DEPTH_HACK 9001 #define ID_LABEL_ZELDA_SHADOW_DEPTH_HACK2 9003 diff --git a/desmume/src/windows/resources.rc b/desmume/src/windows/resources.rc index bf59df28a..307dfc8fd 100644 --- a/desmume/src/windows/resources.rc +++ b/desmume/src/windows/resources.rc @@ -1393,8 +1393,8 @@ IDD_SLOT1_R4 DIALOGEX 7, 64, 302, 89 STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_VISIBLE | WS_SYSMENU FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN - CONTROL "Directory to scan:",IDC_RFOLDER,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,9,22,35,10 - CONTROL "use path of the loaded ROM (not the same as ""ROM path"" in path configuration)",IDC_PATHDESMUME, + CONTROL "Directory to scan:",IDC_R4_FOLDER,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,9,22,35,10 + CONTROL "use path of the loaded ROM (not the same as ""ROM path"" in path configuration)",IDC_R4_ROM, "Button",BS_AUTORADIOBUTTON,9,53,272,10 PUSHBUTTON "Browse...",IDC_BROWSE,245,33,50,14 EDITTEXT IDC_PATH,9,34,231,12,ES_AUTOHSCROLL | ES_READONLY | NOT WS_TABSTOP diff --git a/desmume/src/windows/slot1_config.cpp b/desmume/src/windows/slot1_config.cpp index bd781660a..2aa793214 100644 --- a/desmume/src/windows/slot1_config.cpp +++ b/desmume/src/windows/slot1_config.cpp @@ -137,17 +137,17 @@ INT_PTR CALLBACK Slot1R4(HWND dialog, UINT msg,WPARAM wparam,LPARAM lparam) if (!tmp_fat_path_type) { - CheckDlgButton(dialog, IDC_RFOLDER, BST_CHECKED); + CheckDlgButton(dialog, IDC_R4_FOLDER, BST_CHECKED); EnableWindow(GetDlgItem(dialog, IDC_BROWSE), true); EnableWindow(GetDlgItem(dialog, IDC_PATH), true); } else { - CheckDlgButton(dialog, IDC_PATHDESMUME, BST_CHECKED); + CheckDlgButton(dialog, IDC_R4_ROM, BST_CHECKED); EnableWindow(GetDlgItem(dialog, IDC_BROWSE), false); EnableWindow(GetDlgItem(dialog, IDC_PATH), false); } - return TRUE; + return FALSE; } case WM_COMMAND: @@ -182,13 +182,13 @@ INT_PTR CALLBACK Slot1R4(HWND dialog, UINT msg,WPARAM wparam,LPARAM lparam) break; } - case IDC_RFOLDER: + case IDC_R4_FOLDER: EnableWindow(GetDlgItem(dialog, IDC_BROWSE), true); EnableWindow(GetDlgItem(dialog, IDC_PATH), true); tmp_fat_path_type = false; return TRUE; - case IDC_PATHDESMUME: + case IDC_R4_ROM: EnableWindow(GetDlgItem(dialog, IDC_BROWSE), false); EnableWindow(GetDlgItem(dialog, IDC_PATH), false); tmp_fat_path_type = true; @@ -310,6 +310,7 @@ void slot1Dialog(HWND hwnd) tmp_fat_path_type = slot1_R4_path_type; _OKbutton_slot1 = false; needReset_slot1 = true; + u32 res=DialogBoxW(hAppInst, MAKEINTRESOURCEW(IDD_SLOT1CONFIG), hwnd, (DLGPROC)Slot1Box_Proc); if (res) { @@ -325,13 +326,16 @@ void slot1Dialog(HWND hwnd) case NDS_SLOT1_RETAIL_MCROM: break; case NDS_SLOT1_R4: - if (strlen(tmp_fat_path)) + WritePrivateProfileBool("Slot1","FAT_path_type",tmp_fat_path_type,IniName); + if (tmp_fat_path_type) { - slot1_SetFatDir(tmp_fat_path); + slot1_SetFatDir(slot1_GetFatDir(), true); + } + else + { + slot1_SetFatDir(tmp_fat_path, false); WritePrivateProfileString("Slot1","FAT_path",tmp_fat_path,IniName); } - WritePrivateProfileBool("Slot1","FAT_path_type",tmp_fat_path_type,IniName); - slot1_R4_path_type = tmp_fat_path_type; break; case NDS_SLOT1_RETAIL_NAND: break;