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; 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); CDolLoader(const char* _szFilename);
u32 GetEntryPoint(); u32 GetEntryPoint();
static bool IsDolWii(const char* filename);
private: private:
enum enum
{ {

View File

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