Fixed a few bugs.

This commit is contained in:
luigi__ 2009-03-05 22:44:18 +00:00
parent 7a998d0d38
commit e548c3c257
2 changed files with 14 additions and 26 deletions

View File

@ -57,6 +57,8 @@ char ROMserial[20];
/* the count of bytes copied from the firmware into memory */ /* the count of bytes copied from the firmware into memory */
#define NDS_FW_USER_SETTINGS_MEM_BYTE_COUNT 0x70 #define NDS_FW_USER_SETTINGS_MEM_BYTE_COUNT 0x70
BOOL fw_success = FALSE;
NDSSystem nds; NDSSystem nds;
/* ------------------------------------------------------------------------- */ /* ------------------------------------------------------------------------- */
@ -74,19 +76,8 @@ u32 bswap32(u32 val)
BOOL getKeyBuf() BOOL getKeyBuf()
{ {
/* TODO: make the BIOS image name configurable */
FILE *file = fopen("./biosnds7.bin", "rb");
int dummy; int dummy;
FILE *file = fopen(CommonSettings.ARM7BIOS, "rb");
if(file == NULL)
file = fopen("./bios7.bin", "rb");
if(file == NULL)
file = fopen("./biosnds7.rom", "rb");
if(file == NULL)
file = fopen("./bios7.rom", "rb");
if(file == NULL) if(file == NULL)
return FALSE; return FALSE;
@ -375,18 +366,6 @@ BOOL decryptFirmware(u8 *data)
return FALSE; return FALSE;
} }
/* u32 i;
for(i = 0; i < nds.FW_ARM9BootCodeSize; i += 4)
{
_MMU_write32(0, (part1ram + i), T1ReadLong(nds.FW_ARM9BootCode, i));
}
for(i = 0; i < nds.FW_ARM7BootCodeSize; i += 4)
{
_MMU_write32(1, (part2ram + i), T1ReadLong(nds.FW_ARM7BootCode, i));
}*/
return TRUE; return TRUE;
} }
@ -876,7 +855,7 @@ void NDS_Reset( void)
if(CommonSettings.UseExtFirmware == true) if(CommonSettings.UseExtFirmware == true)
NDS_LoadFirmware(CommonSettings.Firmware); NDS_LoadFirmware(CommonSettings.Firmware);
if((CommonSettings.UseExtFirmware == true) && (CommonSettings.BootFromFirmware == true)) if((CommonSettings.UseExtFirmware == true) && (CommonSettings.BootFromFirmware == true) && (fw_success == TRUE))
{ {
for(i = 0; i < nds.FW_ARM9BootCodeSize; i += 4) for(i = 0; i < nds.FW_ARM9BootCodeSize; i += 4)
{ {
@ -1377,6 +1356,7 @@ int NDS_LoadFirmware(const char *filename)
if(size > MMU.fw.size) if(size > MMU.fw.size)
{ {
fclose(file); fclose(file);
fw_success = FALSE;
return -1; return -1;
} }
@ -1386,9 +1366,15 @@ int NDS_LoadFirmware(const char *filename)
INFO("Firmware: decrypting NDS firmware %s...\n", filename); INFO("Firmware: decrypting NDS firmware %s...\n", filename);
if(decryptFirmware(MMU.fw.data) == FALSE) if(decryptFirmware(MMU.fw.data) == FALSE)
{
INFO("Firmware: decryption failed.\n"); INFO("Firmware: decryption failed.\n");
fw_success = FALSE;
}
else else
{
INFO("Firmware: decryption successful.\n"); INFO("Firmware: decryption successful.\n");
fw_success = TRUE;
}
return i; return i;
} }

View File

@ -3062,6 +3062,8 @@ LRESULT CALLBACK EmulationSettingsDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, L
EnableWindow(cur, enable); EnableWindow(cur, enable);
cur = GetDlgItem(hDlg, IDC_BIOSSWIS); cur = GetDlgItem(hDlg, IDC_BIOSSWIS);
EnableWindow(cur, enable); EnableWindow(cur, enable);
cur = GetDlgItem(hDlg, IDC_FIRMWAREBOOT);
EnableWindow(cur, enable);
} }
return TRUE; return TRUE;
@ -3075,7 +3077,7 @@ LRESULT CALLBACK EmulationSettingsDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, L
cur = GetDlgItem(hDlg, IDC_FIRMWAREBROWSE); cur = GetDlgItem(hDlg, IDC_FIRMWAREBROWSE);
EnableWindow(cur, enable); EnableWindow(cur, enable);
cur = GetDlgItem(hDlg, IDC_FIRMWAREBOOT); cur = GetDlgItem(hDlg, IDC_FIRMWAREBOOT);
EnableWindow(cur, enable); EnableWindow(cur, (enable && IsDlgButtonChecked(hDlg, IDC_USEEXTBIOS)));
} }
return TRUE; return TRUE;