diff --git a/Source/Core/Common/Src/Paths.h b/Source/Core/Common/Src/Paths.h index 44db86f37f..aa9eef5fd4 100644 --- a/Source/Core/Common/Src/Paths.h +++ b/Source/Core/Common/Src/Paths.h @@ -30,7 +30,7 @@ // Dirs in User #define GC_USER_DIR "GC" #define WII_USER_DIR "Wii" - #define WII_SYSCONF_DIR "shared2/sys" +#define WII_SYSCONF_DIR "shared2/sys" #define CONFIG_DIR "Config" #define GAMECONFIG_DIR "GameConfig" #define MAPS_DIR "Maps" @@ -76,7 +76,6 @@ // Shorts - dirs // User dirs #define FULL_USERDATA_DIR ROOT_DIR DIR_SEP USERDATA_DIR DIR_SEP - #define FULL_GC_USER_DIR FULL_USERDATA_DIR GC_USER_DIR DIR_SEP //#define GC_USER_EUR_DIR FULL_GC_USER_DIR EUR_DIR //#define GC_USER_USA_DIR FULL_GC_USER_DIR USA_DIR @@ -126,4 +125,6 @@ #define WII_JAP_SETTING_FILE FULL_WII_SYS_DIR WII_JAP_SETTING #define WII_SYSCONF_FILE FULL_WII_USER_DIR WII_SYSCONF_DIR DIR_SEP WII_SYSCONF +#define FULL_WII_MENU_DIR FULL_WII_USER_DIR "title" DIR_SEP "00000001" DIR_SEP "00000002" DIR_SEP "content" + #endif // PATHS_H diff --git a/Source/Core/Core/Src/Boot/Boot.cpp b/Source/Core/Core/Src/Boot/Boot.cpp index 358c4a7575..fa0369c9d4 100644 --- a/Source/Core/Core/Src/Boot/Boot.cpp +++ b/Source/Core/Core/Src/Boot/Boot.cpp @@ -292,7 +292,7 @@ bool CBoot::BootUp() // Wii WAD // =================================================================================== - case SCoreStartupParameter::BOOT_WIIWAD: + case SCoreStartupParameter::BOOT_WII_NAND: Boot_WiiWAD(_StartupPara.m_strFilename.c_str()); break; diff --git a/Source/Core/Core/Src/Boot/Boot_WiiWAD.cpp b/Source/Core/Core/Src/Boot/Boot_WiiWAD.cpp index 86bd7aad93..fe4a01f924 100644 --- a/Source/Core/Core/Src/Boot/Boot_WiiWAD.cpp +++ b/Source/Core/Core/Src/Boot/Boot_WiiWAD.cpp @@ -20,167 +20,11 @@ #include "../HLE/HLE.h" #include "../HW/Memmap.h" #include "../ConfigManager.h" -#include "Blob.h" -#include "MappedFile.h" -#include "Boot_DOL.h" -#include "Boot_WiiWAD.h" -#include "AES/aes.h" -#include "MathUtil.h" +#include "../IPC_HLE/WII_IPC_HLE.h" + +#include "NANDContentLoader.h" #include "FileUtil.h" - -class CBlobBigEndianReader -{ -public: - CBlobBigEndianReader(DiscIO::IBlobReader& _rReader) : m_rReader(_rReader) {} - - u32 Read32(u64 _Offset) - { - u32 Temp; - m_rReader.Read(_Offset, 4, (u8*)&Temp); - return(Common::swap32(Temp)); - } - -private: - DiscIO::IBlobReader& m_rReader; -}; - -std::vector m_TileMetaContent; -u16 m_BootIndex = -1; -u64 m_TitleID = -1; - -void AESDecode(u8* _pKey, u8* _IV, u8* _pSrc, u32 _Size, u8* _pDest) -{ - AES_KEY AESKey; - - AES_set_decrypt_key(_pKey, 128, &AESKey); - AES_cbc_encrypt(_pSrc, _pDest, _Size, &AESKey, _IV, AES_DECRYPT); -} - -u8* CreateWADEntry(DiscIO::IBlobReader& _rReader, u32 _Size, u64 _Offset) -{ - if (_Size > 0) - { - u8* pTmpBuffer = new u8[_Size]; - _dbg_assert_msg_(BOOT, pTmpBuffer!=0, "WiiWAD: Cant allocate memory for WAD entry"); - - if (!_rReader.Read(_Offset, _Size, pTmpBuffer)) - { - PanicAlert("WiiWAD: Could not read from file"); - } - return pTmpBuffer; - } - return NULL; -} - -void GetKeyFromTicket(u8* pTicket, u8* pTicketKey) -{ - u8 CommonKey[16] = {0xeb,0xe4,0x2a,0x22,0x5e,0x85,0x93,0xe4,0x48,0xd9,0xc5,0x45,0x73,0x81,0xaa,0xf7}; - u8 IV[16]; - memset(IV, 0, sizeof IV); - memcpy(IV, pTicket + 0x01dc, 8); - AESDecode(CommonKey, IV, pTicket + 0x01bf, 16, pTicketKey); -} - -bool ParseTMD(u8* pDataApp, u32 pDataAppSize, u8* pTicket, u8* pTMD) -{ - u8 DecryptTitleKey[16]; - u8 IV[16]; - - GetKeyFromTicket(pTicket, DecryptTitleKey); - - u32 numEntries = Common::swap16(pTMD + 0x01de); - m_BootIndex = Common::swap16(pTMD + 0x01e0); - m_TitleID = Common::swap64(pTMD + 0x018C); - - u8* p = pDataApp; - - m_TileMetaContent.resize(numEntries); - - for (u32 i=0; im_pData, pContent->m_Size); PC = DolLoader.GetEntryPoint() | 0x80000000; return true; diff --git a/Source/Core/Core/Src/Boot/Boot_WiiWAD.h b/Source/Core/Core/Src/Boot/Boot_WiiWAD.h index c60011be75..663692ee47 100644 --- a/Source/Core/Core/Src/Boot/Boot_WiiWAD.h +++ b/Source/Core/Core/Src/Boot/Boot_WiiWAD.h @@ -17,22 +17,3 @@ #pragma once -#include - -struct STileMetaContent -{ - u32 m_ContentID; - u16 m_Index; - u16 m_Type; - u32 m_Size; - u32 m_RoundedSize; - - u8* m_pData; -}; - - -// [TODO]: this global internal stuff sux... the whole data should be inside the ES -// but this is the easiest way atm -extern std::vector m_TileMetaContent; -extern u64 m_TitleID; - diff --git a/Source/Core/Core/Src/CoreParameter.cpp b/Source/Core/Core/Src/CoreParameter.cpp index 2339c03ec4..ff651590d8 100644 --- a/Source/Core/Core/Src/CoreParameter.cpp +++ b/Source/Core/Core/Src/CoreParameter.cpp @@ -19,6 +19,7 @@ #include "FileUtil.h" #include "StringUtil.h" #include "CDUtils.h" +#include "NANDContentLoader.h" #include "VolumeCreator.h" // DiscIO @@ -126,14 +127,6 @@ bool SCoreStartupParameter::AutoSetup(EBootBios _BootBios) m_BootType = BOOT_ELF; bNTSC = true; } - else if ((!strcasecmp(Extension.c_str(), ".wad")) && - CBoot::IsWiiWAD(m_strFilename.c_str())) - { - bWii = true; - Region = EUR_DIR; - m_BootType = BOOT_WIIWAD; - bNTSC = false; - } else if (!strcasecmp(Extension.c_str(), ".dol")) { bWii = CDolLoader::IsDolWii(m_strFilename.c_str()); @@ -141,6 +134,13 @@ bool SCoreStartupParameter::AutoSetup(EBootBios _BootBios) m_BootType = BOOT_DOL; bNTSC = true; } + else if (DiscIO::CNANDContentLoader(m_strFilename).IsValid()) + { + bWii = true; + Region = EUR_DIR; + m_BootType = BOOT_WII_NAND; + bNTSC = false; + } else { PanicAlert("Could not recognize ISO file %s", m_strFilename.c_str()); diff --git a/Source/Core/Core/Src/CoreParameter.h b/Source/Core/Core/Src/CoreParameter.h index 552e0ee567..c17a75e0fc 100644 --- a/Source/Core/Core/Src/CoreParameter.h +++ b/Source/Core/Core/Src/CoreParameter.h @@ -90,7 +90,7 @@ struct SCoreStartupParameter BOOT_ISO, BOOT_ELF, BOOT_DOL, - BOOT_WIIWAD, + BOOT_WII_NAND, BOOT_BIOS }; EBootType m_BootType; diff --git a/Source/Core/Core/Src/HLE/HLE_OS.cpp b/Source/Core/Core/Src/HLE/HLE_OS.cpp index 3d11783a8e..b03bbbe91f 100644 --- a/Source/Core/Core/Src/HLE/HLE_OS.cpp +++ b/Source/Core/Core/Src/HLE/HLE_OS.cpp @@ -44,30 +44,45 @@ void HLE_OSReport() { std::string ReportMessage; GetStringVA(ReportMessage); + NPC = LR; + + u32 hackPC = PC; + PC = LR; - // PanicAlert("(PC=%08x) OSReport: %s", LR, ReportMessage.c_str()); + PanicAlert("(PC=%08x) OSReport: %s", LR, ReportMessage.c_str()); + LOGV(OSREPORT,0,"(PC=%08x) OSReport: %s", LR, ReportMessage.c_str()); - LOG(OSREPORT,"(PC=%08x) OSReport: %s", LR, ReportMessage.c_str()); - NPC = LR; + PC = hackPC; } void HLE_vprintf() { std::string ReportMessage; GetStringVA(ReportMessage); + NPC = LR; - LOG(OSREPORT,"(PC=%08x) VPrintf: %s", LR, ReportMessage.c_str()); - NPC = LR; + u32 hackPC = PC; + PC = LR; + PanicAlert("(PC=%08x) VPrintf: %s", LR, ReportMessage.c_str()); + LOG(OSREPORT,"(PC=%08x) VPrintf: %s", LR, ReportMessage.c_str()); + + PC = hackPC; } void HLE_printf() { std::string ReportMessage; GetStringVA(ReportMessage); + NPC = LR; - LOG(OSREPORT,"(PC=%08x) Printf: %s ", LR, ReportMessage.c_str()); - NPC = LR; + u32 hackPC = PC; + PC = LR; + + PanicAlert("(PC=%08x) Printf: %s ", LR, ReportMessage.c_str()); + LOG(OSREPORT,"(PC=%08x) Printf: %s ", LR, ReportMessage.c_str()); + + PC = hackPC; } void GetStringVA(std::string& _rOutBuffer) diff --git a/Source/Core/Core/Src/HW/SystemTimers.cpp b/Source/Core/Core/Src/HW/SystemTimers.cpp index ab20fa9389..de74cf8a89 100644 --- a/Source/Core/Core/Src/HW/SystemTimers.cpp +++ b/Source/Core/Core/Src/HW/SystemTimers.cpp @@ -173,12 +173,13 @@ void AudioFifoCallback(u64 userdata, int cyclesLate) void IPC_HLE_UpdateCallback(u64 userdata, int cyclesLate) { - WII_IPC_HLE_Interface::Update(); + WII_IPC_HLE_Interface::UpdateDevices(); CoreTiming::ScheduleEvent(IPC_HLE_PERIOD-cyclesLate, et_IPC_HLE); } void VICallback(u64 userdata, int cyclesLate) { + WII_IPC_HLE_Interface::Update(); VideoInterface::Update(); CoreTiming::ScheduleEvent(VI_PERIOD-cyclesLate, et_VI); } @@ -212,6 +213,9 @@ void DecrementerSet() void AdvanceCallback(int cyclesExecuted) { + if (PowerPC::GetState() != PowerPC::CPU_RUNNING) + return; + fakeDec -= cyclesExecuted; u64 timebase_ticks = CoreTiming::GetTicks() / TIMER_RATIO; //works since we are little endian and TL comes first :) *(u64*)&TL = timebase_ticks + startTimeBaseTicks; diff --git a/Source/Core/Core/Src/HW/WII_IOB.cpp b/Source/Core/Core/Src/HW/WII_IOB.cpp index 218a05f9bc..edf64c4545 100644 --- a/Source/Core/Core/Src/HW/WII_IOB.cpp +++ b/Source/Core/Core/Src/HW/WII_IOB.cpp @@ -38,8 +38,13 @@ void HWCALL Read32(u32& _rReturnValue, const u32 _Address) { // NAND Loader ... no idea case 0x018: - LOGV(WII_IOB, 0, "IOP: Read32 from 0x18 = 0x%08x", _Address); + LOGV(WII_IOB, 0, "IOP: Read32 from 0x18 = 0x%08x (NANDLoader)", _Address); break; + // WiiMenu... no idea + case 0x24: + LOGV(WII_IOB, 0, "IOP: Read32 from 0x18 = 0x%08x (WiiMenu)", _Address); + break; + case 0xc0: // __VISendI2CData _rReturnValue = 0; @@ -96,9 +101,13 @@ void HWCALL Write32(const u32 _Value, const u32 _Address) { switch(_Address & 0xFFFF) { - // NAND Loader ... no idea + // NANDLoader ... no idea case 0x18: - LOGV(WII_IOB, 0, "IOP: Write32 0x%08x to 0x%08x", _Value, _Address); + LOGV(WII_IOB, 0, "IOP: Write32 0x%08x to 0x%08x (NANDLoader)", _Value, _Address); + break; + // WiiMenu... no idea + case 0x24: + LOGV(WII_IOB, 0, "IOP: Write32 0x%08x to 0x%08x (WiiMenu)", _Value, _Address); break; case 0xc0: // __VISendI2CData diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE.cpp b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE.cpp index da32d3ab7f..f7ef6f7c39 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE.cpp +++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE.cpp @@ -78,6 +78,8 @@ u32 g_AckNumber = 0; std::queue > g_ReplyQueue; void ExecuteCommand(u32 _Address); +std::string g_DefaultContentFile; + // General IPC functions void Init() { @@ -99,7 +101,7 @@ void Reset() g_ReplyQueue.pop(); } - g_Ack.clear(); + g_Ack.clear(); } void Shutdown() @@ -107,6 +109,13 @@ void Shutdown() Reset(); g_LastDeviceID = 0x13370000; g_AckNumber = 0; + g_DefaultContentFile.clear(); +} + +// Set default content file +void SetDefaultContentFile(const std::string& _rFilename) +{ + g_DefaultContentFile = _rFilename; } u32 GetDeviceIDByName(const std::string& _rDeviceName) @@ -185,7 +194,7 @@ IWII_IPC_HLE_Device* CreateDevice(u32 _DeviceID, const std::string& _rDeviceName } else if (_rDeviceName.c_str() == std::string("/dev/es")) { - pDevice = new CWII_IPC_HLE_Device_es(_DeviceID, _rDeviceName); + pDevice = new CWII_IPC_HLE_Device_es(_DeviceID, _rDeviceName, g_DefaultContentFile); } else if (_rDeviceName.find("/dev/usb/oh1/57e/305") != std::string::npos) { @@ -463,22 +472,28 @@ void ExecuteCommand(u32 _Address) /* This is called continuously from SystemTimers.cpp and WII_IPCInterface::IsReady() is controlled from WII_IPC.cpp. */ // ---------------- +void UpdateDevices() +{ + if (WII_IPCInterface::IsReady()) + { + // check if an executed must be updated + TDeviceMap::const_iterator itr = g_DeviceMap.begin(); + while(itr != g_DeviceMap.end()) + { + u32 CommandAddr = itr->second->Update(); + if (CommandAddr != 0) + { + g_ReplyQueue.push(std::pair(CommandAddr, itr->second->GetDeviceName())); + } + ++itr; + } + } +} + void Update() { if (WII_IPCInterface::IsReady()) { - // check if an executed must be updated - TDeviceMap::const_iterator itr = g_DeviceMap.begin(); - while(itr != g_DeviceMap.end()) - { - u32 CommandAddr = itr->second->Update(); - if (CommandAddr != 0) - { - g_ReplyQueue.push(std::pair(CommandAddr, itr->second->GetDeviceName())); - } - ++itr; - } - // Check if we have to execute an acknowledge command... if (!g_ReplyQueue.empty()) { diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE.h b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE.h index fb6145b4ed..617e47840a 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE.h +++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE.h @@ -30,9 +30,15 @@ void Shutdown(); // Reset void Reset(); +// Set default content file +void SetDefaultContentFile(const std::string& _rFilename); + // Update void Update(); +// Update Devices +void UpdateDevices(); + // Acknowledge command bool AckCommand(u32 _Address); diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_FileIO.cpp b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_FileIO.cpp index c41fb2cad6..d256cddd84 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_FileIO.cpp +++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_FileIO.cpp @@ -200,10 +200,9 @@ CWII_IPC_HLE_Device_FileIO::Write(u32 _CommandAddress) if (m_pFileHandle) { - fwrite(Memory::GetPointer(Address), Size, 1, m_pFileHandle); - - // Write always return the written bytes for success - ReturnValue = Size; + size_t Result = fwrite(Memory::GetPointer(Address), Size, 1, m_pFileHandle); + _dbg_assert_msg_(WII_IPC_FILEIO, Result == 1, "fwrite failed"); + ReturnValue = Size; } Memory::Write_U32(ReturnValue, _CommandAddress + 0x4); diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_net.cpp b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_net.cpp index 14c6a26255..d9a87dab0d 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_net.cpp +++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_net.cpp @@ -164,6 +164,10 @@ s32 CWII_IPC_HLE_Device_net_kd_request::ExecuteCommand(u32 _Parameter, u32 _Buff case IOCTL_NWC24_STARTUP: return 0; + case IOCTL_SO_GETSOCKOPT: // WiiMenu + case IOCTL_SO_SETSOCKOPT: + return 0; + case 0xf: // NWC24iRequestGenerateUserId (Input: none, Output: 32 bytes) //Memory::Write_U32(0, _BufferOut); return -1; @@ -209,6 +213,15 @@ bool CWII_IPC_HLE_Device_net_ncd_manage::IOCtlV(u32 _CommandAddress) switch (CommandBuffer.Parameter) { + // WiiMenu + case 0x03: + case 0x04: + case 0x05: + case 0x06: + case 0x07: + case 0x08: + break; + default: LOG(WII_IPC_NET, "NET_NCD_MANAGE IOCtlV: %i", CommandBuffer.Parameter); _dbg_assert_msg_(WII_IPC_NET, 0, "NET_NCD_MANAGE IOCtlV: %i", CommandBuffer.Parameter); diff --git a/Source/Core/DiscIO/DiscIO.vcproj b/Source/Core/DiscIO/DiscIO.vcproj index cdb2e797ec..9c2a14ffdb 100644 --- a/Source/Core/DiscIO/DiscIO.vcproj +++ b/Source/Core/DiscIO/DiscIO.vcproj @@ -1147,6 +1147,18 @@ > + + + + + + diff --git a/Source/Core/DiscIO/Src/NANDContentLoader.cpp b/Source/Core/DiscIO/Src/NANDContentLoader.cpp new file mode 100644 index 0000000000..4c4d562aa1 --- /dev/null +++ b/Source/Core/DiscIO/Src/NANDContentLoader.cpp @@ -0,0 +1,282 @@ +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#include "stdafx.h" +#include "NANDContentLoader.h" + + +#include "AES/aes.h" +#include "MathUtil.h" +#include "FileUtil.h" + +namespace DiscIO +{ + +class CBlobBigEndianReader +{ +public: + CBlobBigEndianReader(DiscIO::IBlobReader& _rReader) : m_rReader(_rReader) {} + + u32 Read32(u64 _Offset) + { + u32 Temp; + m_rReader.Read(_Offset, 4, (u8*)&Temp); + return(Common::swap32(Temp)); + } + +private: + DiscIO::IBlobReader& m_rReader; +}; + + + + +CNANDContentLoader::CNANDContentLoader(const std::string& _rName) + : m_TitleID(-1) + , m_BootIndex(-1) + , m_Valid(false) +{ + if (File::IsDirectory(_rName.c_str())) + { + m_Valid = CreateFromDirectory(_rName); + } + else if (File::Exists(_rName.c_str())) + { + m_Valid = CreateFromWAD(_rName); + } + else + { +// _dbg_assert_msg_(BOOT, 0, "CNANDContentLoader loads neither folder nor file"); + } + +} + +SNANDContent* CNANDContentLoader::GetContentByIndex(int _Index) +{ + for (size_t i=0; i 0) + { + u8* pTmpBuffer = new u8[_Size]; + _dbg_assert_msg_(BOOT, pTmpBuffer!=0, "WiiWAD: Cant allocate memory for WAD entry"); + + if (!_rReader.Read(_Offset, _Size, pTmpBuffer)) + { + PanicAlert("WiiWAD: Could not read from file"); + } + return pTmpBuffer; + } + return NULL; +} + +void CNANDContentLoader::GetKeyFromTicket(u8* pTicket, u8* pTicketKey) +{ + u8 CommonKey[16] = {0xeb,0xe4,0x2a,0x22,0x5e,0x85,0x93,0xe4,0x48,0xd9,0xc5,0x45,0x73,0x81,0xaa,0xf7}; + u8 IV[16]; + memset(IV, 0, sizeof IV); + memcpy(IV, pTicket + 0x01dc, 8); + AESDecode(CommonKey, IV, pTicket + 0x01bf, 16, pTicketKey); +} + +bool CNANDContentLoader::ParseTMD(u8* pDataApp, u32 pDataAppSize, u8* pTicket, u8* pTMD) +{ + u8 DecryptTitleKey[16]; + u8 IV[16]; + + GetKeyFromTicket(pTicket, DecryptTitleKey); + + u32 numEntries = Common::swap16(pTMD + 0x01de); + m_BootIndex = Common::swap16(pTMD + 0x01e0); + m_TitleID = Common::swap64(pTMD + 0x018C); + + u8* p = pDataApp; + + m_TileMetaContent.resize(numEntries); + + for (u32 i=0; i +#include "Common.h" +#include "Blob.h" + +namespace DiscIO +{ + +struct SNANDContent +{ + u32 m_ContentID; + u16 m_Index; + u16 m_Type; + u32 m_Size; + + u8* m_pData; +}; + +class CNANDContentLoader +{ +public: + + CNANDContentLoader(const std::string& _rName); + + bool IsValid() const { return m_Valid; } + + u64 GetTitleID() const { return m_TitleID; } + + u32 GetBootIndex() const { return m_BootIndex; } + + size_t GetContentSize() const { return m_TileMetaContent.size(); } + + SNANDContent* GetContentByIndex(int _Index); + + static bool IsWiiWAD(const std::string& _rName); + +private: + + bool m_Valid; + u64 m_TitleID; + u32 m_BootIndex; + + std::vector m_TileMetaContent; + + bool CreateFromDirectory(const std::string& _rPath); + bool CreateFromWAD(const std::string& _rName); + + bool ParseWAD(DiscIO::IBlobReader& _rReader); + + void AESDecode(u8* _pKey, u8* _IV, u8* _pSrc, u32 _Size, u8* _pDest); + + u8* CreateWADEntry(DiscIO::IBlobReader& _rReader, u32 _Size, u64 _Offset); + + void GetKeyFromTicket(u8* pTicket, u8* pTicketKey); + + bool ParseTMD(u8* pDataApp, u32 pDataAppSize, u8* pTicket, u8* pTMD); +}; + +} + +#endif \ No newline at end of file diff --git a/Source/Core/DolphinWX/Src/Frame.cpp b/Source/Core/DolphinWX/Src/Frame.cpp index 27bad78760..2701e49104 100644 --- a/Source/Core/DolphinWX/Src/Frame.cpp +++ b/Source/Core/DolphinWX/Src/Frame.cpp @@ -255,6 +255,7 @@ EVT_MENU(IDM_CONFIG_DSP_PLUGIN, CFrame::OnPluginDSP) EVT_MENU(IDM_CONFIG_PAD_PLUGIN, CFrame::OnPluginPAD) EVT_MENU(IDM_CONFIG_WIIMOTE_PLUGIN, CFrame::OnPluginWiimote) + #ifdef MUSICMOD EVT_MENU(IDM_MUTE, CFrame::MM_OnMute) EVT_MENU(IDM_MUSIC_PLAY, CFrame::MM_OnPause) @@ -267,11 +268,13 @@ EVT_MENU(IDM_MEMCARD, CFrame::OnMemcard) EVT_MENU(IDM_CHEATS, CFrame::OnShow_CheatsWindow) EVT_MENU(IDM_CHANGEDISC, CFrame::OnChangeDisc) EVT_MENU(IDM_SDCARD, CFrame::OnShow_SDCardWindow) +EVT_MENU(IDM_LOAD_WII_MENU, CFrame::OnLoadWiiMenu) EVT_MENU(IDM_TOGGLE_FULLSCREEN, CFrame::OnToggleFullscreen) EVT_MENU(IDM_TOGGLE_DUALCORE, CFrame::OnToggleDualCore) EVT_MENU(IDM_TOGGLE_SKIPIDLE, CFrame::OnToggleSkipIdle) EVT_MENU(IDM_TOGGLE_TOOLBAR, CFrame::OnToggleToolbar) EVT_MENU(IDM_TOGGLE_STATUSBAR, CFrame::OnToggleStatusbar) + EVT_MENU_RANGE(IDM_LOADSLOT1, IDM_LOADSLOT10, CFrame::OnLoadState) EVT_MENU_RANGE(IDM_SAVESLOT1, IDM_SAVESLOT10, CFrame::OnSaveState) EVT_MENU_RANGE(IDM_DRIVE1, IDM_DRIVE24, CFrame::OnBootDrive) diff --git a/Source/Core/DolphinWX/Src/Frame.h b/Source/Core/DolphinWX/Src/Frame.h index 36af0d5b2d..92dd666870 100644 --- a/Source/Core/DolphinWX/Src/Frame.h +++ b/Source/Core/DolphinWX/Src/Frame.h @@ -207,6 +207,7 @@ class CFrame : public wxFrame void OnMemcard(wxCommandEvent& event); // Misc void OnShow_CheatsWindow(wxCommandEvent& event); void OnShow_SDCardWindow(wxCommandEvent& event); + void OnLoadWiiMenu(wxCommandEvent& event); void OnGameListCtrl_ItemActivated(wxListEvent& event); diff --git a/Source/Core/DolphinWX/Src/FrameTools.cpp b/Source/Core/DolphinWX/Src/FrameTools.cpp index 944ec618ee..c75c7e32d8 100644 --- a/Source/Core/DolphinWX/Src/FrameTools.cpp +++ b/Source/Core/DolphinWX/Src/FrameTools.cpp @@ -56,6 +56,7 @@ be accessed from Core::GetWindowHandle(). #include "HW/DVDInterface.h" #include "State.h" #include "VolumeHandler.h" +#include "NANDContentLoader.h" #include // wxWidgets @@ -159,6 +160,12 @@ void CFrame::CreateMenu() miscMenu->Append(IDM_MEMCARD, _T("&Memcard Manager")); miscMenu->Append(IDM_CHEATS, _T("Action &Replay Manager")); // miscMenu->Append(IDM_SDCARD, _T("Mount &SDCard")); // Disable for now + + if (DiscIO::CNANDContentLoader(FULL_WII_MENU_DIR).IsValid()) + { + miscMenu->Append(IDM_LOAD_WII_MENU, _T("Load Wii Menu")); + } + m_pMenuBar->Append(miscMenu, _T("&Misc")); // Help menu @@ -675,6 +682,11 @@ void CFrame::OnShow_SDCardWindow(wxCommandEvent& WXUNUSED (event)) wxSDCardWindow SDWindow(this); SDWindow.ShowModal(); } +void CFrame::OnLoadWiiMenu(wxCommandEvent& WXUNUSED (event)) +{ + BootManager::BootCore(FULL_WII_MENU_DIR); +} + /* Toogle fullscreen. In Windows the fullscreen mode is accomplished by expanding the m_Panel to cover the entire screen (when we render to the main window). */ void CFrame::OnToggleFullscreen(wxCommandEvent& WXUNUSED (event)) diff --git a/Source/Core/DolphinWX/Src/Globals.h b/Source/Core/DolphinWX/Src/Globals.h index b55503a626..e9d4e9bcfd 100644 --- a/Source/Core/DolphinWX/Src/Globals.h +++ b/Source/Core/DolphinWX/Src/Globals.h @@ -62,6 +62,7 @@ enum IDM_CHANGEDISC, IDM_PROPERTIES, IDM_SDCARD, + IDM_LOAD_WII_MENU, IDM_HELPABOUT, // Help menu IDM_HELPWEBSITE, diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCodes.cpp b/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCodes.cpp index e066896663..2846519cb7 100644 --- a/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCodes.cpp +++ b/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCodes.cpp @@ -69,6 +69,7 @@ IUCode* UCodeFactory(u32 _CRC, CMailHandler& _rMailHandler) // WII CRCs case 0x6c3f6f94: // zelda - PAL case 0xd643001f: // mario galaxy - PAL + case 0xd9c4bf34: // WiiMenu ... pray Console::Print("Zelda Wii ucode chosen\n"); return new CUCode_Zelda(_rMailHandler); @@ -77,7 +78,7 @@ IUCode* UCodeFactory(u32 _CRC, CMailHandler& _rMailHandler) case 0xfa450138: // wii sports - PAL case 0xadbc06bd: // Elebits case 0xb7eb9a9c: // Wii Pikmin - JAP - case 0x4cc52064: // Bleach: Versus Crusade + case 0x4cc52064: // Bleach: Versus Crusade Console::Print("Wii - AXWii chosen\n"); return new CUCode_AXWii(_rMailHandler, _CRC); diff --git a/Source/Plugins/Plugin_Wiimote/Src/wiimote_real.cpp b/Source/Plugins/Plugin_Wiimote/Src/wiimote_real.cpp index 45629d18a0..01a5be326b 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/wiimote_real.cpp +++ b/Source/Plugins/Plugin_Wiimote/Src/wiimote_real.cpp @@ -286,7 +286,7 @@ void SendEvent(SEvent& _rEvent) g_WiimoteInitialize.pWiimoteInput(m_channelID, Buffer, Offset); // Debugging - ReadDebugging(false, Buffer, Offset); + // ReadDebugging(false, Buffer, Offset); } ///////////////////// };