Fix error #002 for Wad games, also fix the Wii menu black screen, this is still a bit hacky as we don't know where to read the IOS rev, but hey it works :p

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3378 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
sl1nk3.s 2009-06-08 18:07:45 +00:00
parent 1a6b9d8174
commit e384c91313
3 changed files with 25 additions and 2 deletions

View File

@ -20,12 +20,14 @@
#include "../HLE/HLE.h" #include "../HLE/HLE.h"
#include "../HW/Memmap.h" #include "../HW/Memmap.h"
#include "../ConfigManager.h" #include "../ConfigManager.h"
#include "../PatchEngine.h"
#include "../IPC_HLE/WII_IPC_HLE.h" #include "../IPC_HLE/WII_IPC_HLE.h"
#include "NANDContentLoader.h" #include "NANDContentLoader.h"
#include "FileUtil.h" #include "FileUtil.h"
#include "Boot_DOL.h" #include "Boot_DOL.h"
#include "Volume.h" #include "Volume.h"
#include "VolumeCreator.h"
bool CBoot::IsWiiWAD(const char *filename) bool CBoot::IsWiiWAD(const char *filename)
@ -62,6 +64,21 @@ bool CBoot::Boot_WiiWAD(const char* _pFilename)
CDolLoader DolLoader(pContent->m_pData, pContent->m_Size); CDolLoader DolLoader(pContent->m_pData, pContent->m_Size);
PC = DolLoader.GetEntryPoint() | 0x80000000; PC = DolLoader.GetEntryPoint() | 0x80000000;
// Pass the "#002 check"
// Apploader should write the IOS version and revision to 0x3140, and compare it
// to 0x3188 to pass the check, but we don't do it, and i don't know where to read the IOS rev...
// Currently we just write 0xFFFF for the revision, copy manually and it works fine :p
// TODO : figure it correctly : where should we read the IOS rev that the wad "needs" ?
Memory::Write_U16(ContentLoader.GetIosVersion(), 0x00003140);
Memory::Write_U16(0xFFFF, 0x00003142);
Memory::Write_U32(Memory::Read_U32(0x00003140), 0x00003188);
// Load patches and run startup patches
const DiscIO::IVolume* pVolume = DiscIO::CreateVolumeFromFilename(_pFilename);
if (pVolume != NULL)
PatchEngine::LoadPatches(pVolume->GetUniqueID().c_str());
return true; return true;
} }

View File

@ -123,6 +123,7 @@ public:
bool IsValid() const { return m_Valid; } bool IsValid() const { return m_Valid; }
u64 GetTitleID() const { return m_TitleID; } u64 GetTitleID() const { return m_TitleID; }
u16 GetIosVersion() const { return m_IosVersion; }
u32 GetBootIndex() const { return m_BootIndex; } u32 GetBootIndex() const { return m_BootIndex; }
size_t GetContentSize() const { return m_Content.size(); } size_t GetContentSize() const { return m_Content.size(); }
const SNANDContent* GetContentByIndex(int _Index) const; const SNANDContent* GetContentByIndex(int _Index) const;
@ -138,6 +139,7 @@ private:
bool m_Valid; bool m_Valid;
u64 m_TitleID; u64 m_TitleID;
u16 m_IosVersion;
u32 m_BootIndex; u32 m_BootIndex;
u16 m_numEntries; u16 m_numEntries;
u16 m_TileVersion; u16 m_TileVersion;
@ -166,6 +168,7 @@ CNANDContentLoader::CNANDContentLoader(const std::string& _rName)
: m_TitleID(-1) : m_TitleID(-1)
, m_BootIndex(-1) , m_BootIndex(-1)
, m_Valid(false) , m_Valid(false)
, m_IosVersion(0x09)
{ {
if (File::IsDirectory(_rName.c_str())) if (File::IsDirectory(_rName.c_str()))
{ {
@ -233,7 +236,8 @@ bool CNANDContentLoader::CreateFromDirectory(const std::string& _rPath)
m_TileVersion = Common::swap16(pTMD + 0x01dc); m_TileVersion = Common::swap16(pTMD + 0x01dc);
m_numEntries = Common::swap16(pTMD + 0x01de); m_numEntries = Common::swap16(pTMD + 0x01de);
m_BootIndex = Common::swap16(pTMD + 0x01e0); m_BootIndex = Common::swap16(pTMD + 0x01e0);
m_TitleID = Common::swap64(pTMD + 0x018C); m_TitleID = Common::swap64(pTMD + 0x018c);
m_IosVersion = Common::swap16(pTMD + 0x018a);
m_Content.resize(m_numEntries); m_Content.resize(m_numEntries);
@ -325,7 +329,8 @@ bool CNANDContentLoader::ParseTMD(u8* pDataApp, u32 pDataAppSize, u8* pTicket, u
u32 numEntries = Common::swap16(pTMD + 0x01de); u32 numEntries = Common::swap16(pTMD + 0x01de);
m_BootIndex = Common::swap16(pTMD + 0x01e0); m_BootIndex = Common::swap16(pTMD + 0x01e0);
m_TitleID = Common::swap64(pTMD + 0x018C); m_TitleID = Common::swap64(pTMD + 0x018c);
m_IosVersion = Common::swap16(pTMD + 0x018a);
u8* p = pDataApp; u8* p = pDataApp;

View File

@ -50,6 +50,7 @@ public:
virtual bool IsValid() const = 0; virtual bool IsValid() const = 0;
virtual u64 GetTitleID() const = 0; virtual u64 GetTitleID() const = 0;
virtual u16 GetIosVersion() const = 0;
virtual u32 GetBootIndex() const = 0; virtual u32 GetBootIndex() const = 0;
virtual size_t GetContentSize() const = 0; virtual size_t GetContentSize() const = 0;
virtual const SNANDContent* GetContentByIndex(int _Index) const = 0; virtual const SNANDContent* GetContentByIndex(int _Index) const = 0;