minor fix
This commit is contained in:
parent
c5c9434ac9
commit
0566c9e34c
|
@ -867,6 +867,11 @@ bool ReadROMParams(u32 gamecode, u32* params)
|
||||||
|
|
||||||
void DecryptSecureArea(u8* out)
|
void DecryptSecureArea(u8* out)
|
||||||
{
|
{
|
||||||
|
// TODO: source decryption data from different possible sources
|
||||||
|
// * original DS-mode ARM7 BIOS has the key data at 0x30
|
||||||
|
// * .srl ROMs (VC dumps) have encrypted secure areas but have precomputed
|
||||||
|
// decryption data at 0x1000 (and at the beginning of the DSi region if any)
|
||||||
|
|
||||||
u32 gamecode = *(u32*)&CartROM[0x0C];
|
u32 gamecode = *(u32*)&CartROM[0x0C];
|
||||||
u32 arm9base = *(u32*)&CartROM[0x20];
|
u32 arm9base = *(u32*)&CartROM[0x20];
|
||||||
|
|
||||||
|
|
|
@ -202,7 +202,7 @@ FILE* OpenLocalFile(const char* path, const char* mode)
|
||||||
#ifdef __WIN32__
|
#ifdef __WIN32__
|
||||||
if (pathlen > 3)
|
if (pathlen > 3)
|
||||||
{
|
{
|
||||||
if (path[1] == ':' && path[2] == '\\')
|
if (path[1] == ':' && (path[2] == '\\' || path[2] == '/'))
|
||||||
return OpenFile(path, mode);
|
return OpenFile(path, mode);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -915,74 +915,8 @@ int main(int argc, char** argv)
|
||||||
//if (Config::AudioVolume < 0) Config::AudioVolume = 0;
|
//if (Config::AudioVolume < 0) Config::AudioVolume = 0;
|
||||||
//else if (Config::AudioVolume > 256) Config::AudioVolume = 256;
|
//else if (Config::AudioVolume > 256) Config::AudioVolume = 256;
|
||||||
|
|
||||||
// TODO: those should be checked before running anything
|
// TODO: this should be checked before running anything
|
||||||
// (as to let the user specify their own BIOS/firmware path etc)
|
|
||||||
#if 0
|
#if 0
|
||||||
if (!Platform::LocalFileExists("bios7.bin") ||
|
|
||||||
!Platform::LocalFileExists("bios9.bin") ||
|
|
||||||
!Platform::LocalFileExists("firmware.bin"))
|
|
||||||
{
|
|
||||||
#if defined(__WIN32__) || defined(UNIX_PORTABLE)
|
|
||||||
const char* locationName = "the directory you run melonDS from";
|
|
||||||
#else
|
|
||||||
char* locationName = EmuDirectory;
|
|
||||||
#endif
|
|
||||||
char msgboxtext[512];
|
|
||||||
sprintf(msgboxtext,
|
|
||||||
"One or more of the following required files don't exist or couldn't be accessed:\n\n"
|
|
||||||
"bios7.bin -- ARM7 BIOS\n"
|
|
||||||
"bios9.bin -- ARM9 BIOS\n"
|
|
||||||
"firmware.bin -- firmware image\n\n"
|
|
||||||
"Dump the files from your DS and place them in %s.\n"
|
|
||||||
"Make sure that the files can be accessed.",
|
|
||||||
locationName
|
|
||||||
);
|
|
||||||
|
|
||||||
uiMsgBoxError(NULL, "BIOS/Firmware not found", msgboxtext);
|
|
||||||
|
|
||||||
uiUninit();
|
|
||||||
SDL_Quit();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
if (!Platform::LocalFileExists("firmware.bin.bak"))
|
|
||||||
{
|
|
||||||
// verify the firmware
|
|
||||||
//
|
|
||||||
// there are dumps of an old hacked firmware floating around on the internet
|
|
||||||
// and those are problematic
|
|
||||||
// the hack predates WFC, and, due to this, any game that alters the WFC
|
|
||||||
// access point data will brick that firmware due to it having critical
|
|
||||||
// data in the same area. it has the same problem on hardware.
|
|
||||||
//
|
|
||||||
// but this should help stop users from reporting that issue over and over
|
|
||||||
// again, when the issue is not from melonDS but from their firmware dump.
|
|
||||||
//
|
|
||||||
// I don't know about all the firmware hacks in existence, but the one I
|
|
||||||
// looked at has 0x180 bytes from the header repeated at 0x3FC80, but
|
|
||||||
// bytes 0x0C-0x14 are different.
|
|
||||||
|
|
||||||
FILE* f = Platform::OpenLocalFile("firmware.bin", "rb");
|
|
||||||
u8 chk1[0x180], chk2[0x180];
|
|
||||||
|
|
||||||
fseek(f, 0, SEEK_SET);
|
|
||||||
fread(chk1, 1, 0x180, f);
|
|
||||||
fseek(f, -0x380, SEEK_END);
|
|
||||||
fread(chk2, 1, 0x180, f);
|
|
||||||
|
|
||||||
memset(&chk1[0x0C], 0, 8);
|
|
||||||
memset(&chk2[0x0C], 0, 8);
|
|
||||||
|
|
||||||
fclose(f);
|
|
||||||
|
|
||||||
if (!memcmp(chk1, chk2, 0x180))
|
|
||||||
{
|
|
||||||
uiMsgBoxError(NULL,
|
|
||||||
"Problematic firmware dump",
|
|
||||||
"You are using an old hacked firmware dump.\n"
|
|
||||||
"Firmware boot will stop working if you run any game that alters WFC settings.\n\n"
|
|
||||||
"Note that the issue is not from melonDS, it would also happen on an actual DS.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
{
|
{
|
||||||
const char* romlist_missing = "Save memory type detection will not work correctly.\n\n"
|
const char* romlist_missing = "Save memory type detection will not work correctly.\n\n"
|
||||||
"You should use the latest version of romlist.bin (provided in melonDS release packages).";
|
"You should use the latest version of romlist.bin (provided in melonDS release packages).";
|
||||||
|
|
Loading…
Reference in New Issue