properly identify Wii-mode DOL files

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1848 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
bushing 2009-01-11 10:00:59 +00:00
parent 018cb993e3
commit 4d4ff5c8f5
3 changed files with 20 additions and 1 deletions

View File

@ -78,3 +78,19 @@ u32 CDolLoader::GetEntryPoint()
{
return m_dolheader.entryPoint;
}
bool CDolLoader::IsDolWii(const char* filename)
{
// try to open file
FILE* pStream = fopen(filename, "rb");
if (pStream)
{
fseek(pStream, 0xe0, SEEK_SET);
u32 entrypt = fgetc(pStream) << 24 | fgetc(pStream) << 16 |
fgetc(pStream) << 8 | fgetc(pStream);
fclose(pStream);
return entrypt >= 0x80004000;
}
return 0;
}

View File

@ -26,6 +26,7 @@ public:
CDolLoader(const char* _szFilename);
u32 GetEntryPoint();
static bool IsDolWii(const char* filename);
private:
enum
{

View File

@ -22,6 +22,7 @@
#include "VolumeCreator.h" // DiscIO
#include "Boot/Boot.h" // Core
#include "Boot/Boot_DOL.h"
#include "CoreParameter.h"
#include "Core.h" // for bWii
@ -114,13 +115,14 @@ bool SCoreStartupParameter::AutoSetup(EBootBios _BootBios)
}
else if (!strcasecmp(Extension.c_str(), ".elf"))
{
bWii = CBoot::IsElfWii(m_strFilename.c_str());
bWii = CBoot::IsElfWii(m_strFilename.c_str());
Region = USA_DIR;
m_BootType = BOOT_ELF;
bNTSC = true;
}
else if (!strcasecmp(Extension.c_str(), ".dol"))
{
bWii = CDolLoader::IsDolWii(m_strFilename.c_str());
Region = USA_DIR;
m_BootType = BOOT_DOL;
bNTSC = true;