Merge pull request #5694 from leoetlino/dolphin-drm

Refuse to launch the shop with default credentials
This commit is contained in:
Leo Lam 2017-06-26 21:31:32 +02:00 committed by GitHub
commit 0ace7fd8f3
21 changed files with 107 additions and 49 deletions

View File

@ -10,9 +10,6 @@
#include "Common/CommonTypes.h" #include "Common/CommonTypes.h"
static const u64 TITLEID_SYSMENU = 0x0000000100000002;
static const std::string TITLEID_SYSMENU_STRING = "0000000100000002";
namespace Common namespace Common
{ {
enum FromWhichRoot enum FromWhichRoot

View File

@ -17,6 +17,7 @@
#include "Common/SettingsHandler.h" #include "Common/SettingsHandler.h"
#include "Core/Boot/Boot.h" #include "Core/Boot/Boot.h"
#include "Core/CommonTitles.h"
#include "Core/ConfigManager.h" #include "Core/ConfigManager.h"
#include "Core/Core.h" #include "Core/Core.h"
#include "Core/HLE/HLE.h" #include "Core/HLE/HLE.h"
@ -230,7 +231,7 @@ bool CBoot::SetupWiiMemory(const DiscIO::Volume* volume, u64 ios_title_id)
SettingsHandler gen; SettingsHandler gen;
std::string serno; std::string serno;
const std::string settings_file_path( const std::string settings_file_path(
Common::GetTitleDataPath(TITLEID_SYSMENU, Common::FROM_SESSION_ROOT) + WII_SETTING); Common::GetTitleDataPath(Titles::SYSTEM_MENU, Common::FROM_SESSION_ROOT) + WII_SETTING);
if (File::Exists(settings_file_path) && gen.Open(settings_file_path)) if (File::Exists(settings_file_path) && gen.Open(settings_file_path))
{ {
serno = gen.GetValue("SERNO"); serno = gen.GetValue("SERNO");

View File

@ -16,6 +16,7 @@
#include "Common/NandPaths.h" #include "Common/NandPaths.h"
#include "Core/Boot/Boot.h" #include "Core/Boot/Boot.h"
#include "Core/CommonTitles.h"
#include "Core/IOS/ES/ES.h" #include "Core/IOS/ES/ES.h"
#include "Core/IOS/ES/Formats.h" #include "Core/IOS/ES/Formats.h"
#include "Core/IOS/FS/FileIO.h" #include "Core/IOS/FS/FileIO.h"
@ -46,8 +47,8 @@ static u32 StateChecksum(const StateFlags& flags)
bool CBoot::Boot_WiiWAD(const std::string& _pFilename) bool CBoot::Boot_WiiWAD(const std::string& _pFilename)
{ {
std::string state_filename(Common::GetTitleDataPath(TITLEID_SYSMENU, Common::FROM_SESSION_ROOT) + std::string state_filename(
WII_STATE); Common::GetTitleDataPath(Titles::SYSTEM_MENU, Common::FROM_SESSION_ROOT) + WII_STATE);
if (File::Exists(state_filename)) if (File::Exists(state_filename))
{ {
@ -89,7 +90,7 @@ bool CBoot::Boot_WiiWAD(const std::string& _pFilename)
// create data directory // create data directory
File::CreateFullPath(Common::GetTitleDataPath(titleID, Common::FROM_SESSION_ROOT)); File::CreateFullPath(Common::GetTitleDataPath(titleID, Common::FROM_SESSION_ROOT));
if (titleID == TITLEID_SYSMENU) if (titleID == Titles::SYSTEM_MENU)
IOS::HLE::CreateVirtualFATFilesystem(); IOS::HLE::CreateVirtualFATFilesystem();
// setup Wii memory // setup Wii memory

View File

@ -0,0 +1,22 @@
// Copyright 2017 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#pragma once
#include "Common/CommonTypes.h"
namespace Titles
{
constexpr u64 BOOT2 = 0x0000000100000001;
constexpr u64 SYSTEM_MENU = 0x0000000100000002;
// IOS used by the latest System Menu (4.3). Corresponds to IOS80.
constexpr u64 SYSTEM_MENU_IOS = 0x0000000100000050;
constexpr u64 BC = 0x0000000100000100;
constexpr u64 MIOS = 0x0000000100000101;
constexpr u64 SHOP = 0x0001000248414241;
} // namespace Titles

View File

@ -521,6 +521,7 @@
<ClInclude Include="PowerPC\PPCTables.h" /> <ClInclude Include="PowerPC\PPCTables.h" />
<ClInclude Include="PowerPC\Profiler.h" /> <ClInclude Include="PowerPC\Profiler.h" />
<ClInclude Include="State.h" /> <ClInclude Include="State.h" />
<ClInclude Include="Titles.h" />
<ClInclude Include="TitleDatabase.h" /> <ClInclude Include="TitleDatabase.h" />
<ClInclude Include="WiiRoot.h" /> <ClInclude Include="WiiRoot.h" />
</ItemGroup> </ItemGroup>

View File

@ -895,6 +895,7 @@
<ClInclude Include="NetPlayServer.h" /> <ClInclude Include="NetPlayServer.h" />
<ClInclude Include="PatchEngine.h" /> <ClInclude Include="PatchEngine.h" />
<ClInclude Include="State.h" /> <ClInclude Include="State.h" />
<ClInclude Include="Titles.h" />
<ClInclude Include="TitleDatabase.h" /> <ClInclude Include="TitleDatabase.h" />
<ClInclude Include="WiiRoot.h" /> <ClInclude Include="WiiRoot.h" />
<ClInclude Include="ActionReplay.h"> <ClInclude Include="ActionReplay.h">

View File

@ -18,6 +18,7 @@
#include "Common/Logging/Log.h" #include "Common/Logging/Log.h"
#include "Common/NandPaths.h" #include "Common/NandPaths.h"
#include "Common/StringUtil.h" #include "Common/StringUtil.h"
#include "Core/CommonTitles.h"
#include "Core/ConfigManager.h" #include "Core/ConfigManager.h"
#include "Core/CoreTiming.h" #include "Core/CoreTiming.h"
#include "Core/HW/EXI/EXI.h" #include "Core/HW/EXI/EXI.h"
@ -160,7 +161,8 @@ void CEXIMemoryCard::SetupGciFolder(u16 sizeMb)
const std::string& game_id = SConfig::GetInstance().GetGameID(); const std::string& game_id = SConfig::GetInstance().GetGameID();
u32 CurrentGameId = 0; u32 CurrentGameId = 0;
if (game_id.length() >= 4 && game_id != "00000000" && game_id != TITLEID_SYSMENU_STRING) if (game_id.length() >= 4 && game_id != "00000000" &&
SConfig::GetInstance().GetTitleID() != Titles::SYSTEM_MENU)
CurrentGameId = BE32((u8*)game_id.c_str()); CurrentGameId = BE32((u8*)game_id.c_str());
const bool shift_jis = region == DiscIO::Region::NTSC_J; const bool shift_jis = region == DiscIO::Region::NTSC_J;

View File

@ -21,10 +21,12 @@
#include "Common/NandPaths.h" #include "Common/NandPaths.h"
#include "Common/ScopeGuard.h" #include "Common/ScopeGuard.h"
#include "Common/StringUtil.h" #include "Common/StringUtil.h"
#include "Core/CommonTitles.h"
#include "Core/ConfigManager.h" #include "Core/ConfigManager.h"
#include "Core/HW/Memmap.h" #include "Core/HW/Memmap.h"
#include "Core/IOS/ES/Formats.h" #include "Core/IOS/ES/Formats.h"
#include "Core/IOS/IOSC.h" #include "Core/IOS/IOSC.h"
#include "Core/ec_wii.h"
#include "DiscIO/NANDContentLoader.h" #include "DiscIO/NANDContentLoader.h"
namespace IOS namespace IOS
@ -196,7 +198,7 @@ static bool UpdateUIDAndGID(Kernel& kernel, const IOS::ES::TMDReader& tmd)
static ReturnCode CheckIsAllowedToSetUID(const u32 caller_uid) static ReturnCode CheckIsAllowedToSetUID(const u32 caller_uid)
{ {
IOS::ES::UIDSys uid_map{Common::FromWhichRoot::FROM_SESSION_ROOT}; IOS::ES::UIDSys uid_map{Common::FromWhichRoot::FROM_SESSION_ROOT};
const u32 system_menu_uid = uid_map.GetOrInsertUIDForTitle(TITLEID_SYSMENU); const u32 system_menu_uid = uid_map.GetOrInsertUIDForTitle(Titles::SYSTEM_MENU);
if (!system_menu_uid) if (!system_menu_uid)
return ES_SHORT_READ; return ES_SHORT_READ;
return caller_uid == system_menu_uid ? IPC_SUCCESS : ES_EINVAL; return caller_uid == system_menu_uid ? IPC_SUCCESS : ES_EINVAL;
@ -241,7 +243,23 @@ bool ES::LaunchTitle(u64 title_id, bool skip_reload)
// (supposedly when trying to re-open those files). // (supposedly when trying to re-open those files).
DiscIO::NANDContentManager::Access().ClearCache(); DiscIO::NANDContentManager::Access().ClearCache();
if (IsTitleType(title_id, IOS::ES::TitleType::System) && title_id != TITLEID_SYSMENU) u32 device_id;
if (title_id == Titles::SHOP &&
(GetDeviceId(&device_id) != IPC_SUCCESS || device_id == DEFAULT_WII_DEVICE_ID))
{
ERROR_LOG(IOS_ES, "Refusing to launch the shop channel with default device credentials");
CriticalAlertT("You cannot use the Wii Shop Channel without using your own device credentials."
"\nPlease refer to the NAND usage guide for setup instructions: "
"https://dolphin-emu.org/docs/guides/nand-usage-guide/");
// Send the user back to the system menu instead of returning an error, which would
// likely make the system menu crash. Doing this is okay as anyone who has the shop
// also has the system menu installed, and this behaviour is consistent with what
// ES does when its DRM system refuses the use of a particular title.
return LaunchTitle(Titles::SYSTEM_MENU);
}
if (IsTitleType(title_id, IOS::ES::TitleType::System) && title_id != Titles::SYSTEM_MENU)
return LaunchIOS(title_id); return LaunchIOS(title_id);
return LaunchPPCTitle(title_id, skip_reload); return LaunchPPCTitle(title_id, skip_reload);
} }
@ -256,7 +274,7 @@ bool ES::LaunchPPCTitle(u64 title_id, bool skip_reload)
const DiscIO::NANDContentLoader& content_loader = AccessContentDevice(title_id); const DiscIO::NANDContentLoader& content_loader = AccessContentDevice(title_id);
if (!content_loader.IsValid()) if (!content_loader.IsValid())
{ {
if (title_id == 0x0000000100000002) if (title_id == Titles::SYSTEM_MENU)
{ {
PanicAlertT("Could not launch the Wii Menu because it is missing from the NAND.\n" PanicAlertT("Could not launch the Wii Menu because it is missing from the NAND.\n"
"The emulated software will likely hang now."); "The emulated software will likely hang now.");
@ -422,7 +440,7 @@ IPCCommandResult ES::IOCtlV(const IOCtlVRequest& request)
case IOCTL_ES_ADDTITLECANCEL: case IOCTL_ES_ADDTITLECANCEL:
return ImportTitleCancel(*context, request); return ImportTitleCancel(*context, request);
case IOCTL_ES_GETDEVICEID: case IOCTL_ES_GETDEVICEID:
return GetConsoleID(request); return GetDeviceId(request);
case IOCTL_ES_OPENTITLECONTENT: case IOCTL_ES_OPENTITLECONTENT:
return OpenTitleContent(context->uid, request); return OpenTitleContent(context->uid, request);
case IOCTL_ES_OPENCONTENT: case IOCTL_ES_OPENCONTENT:

View File

@ -132,6 +132,8 @@ public:
ReturnCode DeleteSharedContent(const std::array<u8, 20>& sha1) const; ReturnCode DeleteSharedContent(const std::array<u8, 20>& sha1) const;
ReturnCode DeleteContent(u64 title_id, u32 content_id) const; ReturnCode DeleteContent(u64 title_id, u32 content_id) const;
ReturnCode GetDeviceId(u32* device_id) const;
// Views // Views
ReturnCode GetV0TicketFromView(const u8* ticket_view, u8* ticket) const; ReturnCode GetV0TicketFromView(const u8* ticket_view, u8* ticket) const;
ReturnCode GetTicketFromView(const u8* ticket_view, u8* ticket, u32* ticket_size) const; ReturnCode GetTicketFromView(const u8* ticket_view, u8* ticket, u32* ticket_size) const;
@ -237,7 +239,7 @@ private:
IPCCommandResult DeleteContent(const IOCtlVRequest& request); IPCCommandResult DeleteContent(const IOCtlVRequest& request);
// Device identity and encryption // Device identity and encryption
IPCCommandResult GetConsoleID(const IOCtlVRequest& request); IPCCommandResult GetDeviceId(const IOCtlVRequest& request);
IPCCommandResult GetDeviceCertificate(const IOCtlVRequest& request); IPCCommandResult GetDeviceCertificate(const IOCtlVRequest& request);
IPCCommandResult CheckKoreaRegion(const IOCtlVRequest& request); IPCCommandResult CheckKoreaRegion(const IOCtlVRequest& request);
IPCCommandResult Sign(const IOCtlVRequest& request); IPCCommandResult Sign(const IOCtlVRequest& request);

View File

@ -24,6 +24,7 @@
#include "Common/Logging/Log.h" #include "Common/Logging/Log.h"
#include "Common/StringUtil.h" #include "Common/StringUtil.h"
#include "Common/Swap.h" #include "Common/Swap.h"
#include "Core/CommonTitles.h"
#include "Core/IOS/Device.h" #include "Core/IOS/Device.h"
#include "Core/IOS/IOS.h" #include "Core/IOS/IOS.h"
#include "Core/IOS/IOSC.h" #include "Core/IOS/IOSC.h"
@ -47,7 +48,7 @@ bool IsDiscTitle(u64 title_id)
bool IsChannel(u64 title_id) bool IsChannel(u64 title_id)
{ {
if (title_id == TITLEID_SYSMENU) if (title_id == Titles::SYSTEM_MENU)
return true; return true;
return IsTitleType(title_id, TitleType::Channel) || return IsTitleType(title_id, TitleType::Channel) ||
@ -233,7 +234,7 @@ u64 TMDReader::GetIOSId() const
DiscIO::Region TMDReader::GetRegion() const DiscIO::Region TMDReader::GetRegion() const
{ {
if (GetTitleId() == 0x0000000100000002) if (GetTitleId() == Titles::SYSTEM_MENU)
return DiscIO::GetSysMenuRegion(GetTitleVersion()); return DiscIO::GetSysMenuRegion(GetTitleVersion());
return DiscIO::RegionSwitchWii(static_cast<u8>(GetTitleId() & 0xff)); return DiscIO::RegionSwitchWii(static_cast<u8>(GetTitleId() & 0xff));
@ -577,7 +578,7 @@ UIDSys::UIDSys(Common::FromWhichRoot root)
if (m_entries.empty()) if (m_entries.empty())
{ {
GetOrInsertUIDForTitle(TITLEID_SYSMENU); GetOrInsertUIDForTitle(Titles::SYSTEM_MENU);
} }
} }

View File

@ -18,14 +18,24 @@ namespace HLE
{ {
namespace Device namespace Device
{ {
IPCCommandResult ES::GetConsoleID(const IOCtlVRequest& request) ReturnCode ES::GetDeviceId(u32* device_id) const
{ {
if (!request.HasNumberOfValidVectors(0, 1)) const EcWii& ec = EcWii::GetInstance();
*device_id = ec.GetNGID();
INFO_LOG(IOS_ES, "GetDeviceId: %08X", *device_id);
return IPC_SUCCESS;
}
IPCCommandResult ES::GetDeviceId(const IOCtlVRequest& request)
{
if (!request.HasNumberOfValidVectors(0, 1) || request.io_vectors[0].size != sizeof(u32))
return GetDefaultReply(ES_EINVAL); return GetDefaultReply(ES_EINVAL);
const EcWii& ec = EcWii::GetInstance(); u32 device_id;
INFO_LOG(IOS_ES, "IOCTL_ES_GETDEVICEID %08X", ec.GetNGID()); const ReturnCode ret = GetDeviceId(&device_id);
Memory::Write_U32(ec.GetNGID(), request.io_vectors[0].address); if (ret != IPC_SUCCESS)
return GetDefaultReply(ret);
Memory::Write_U32(device_id, request.io_vectors[0].address);
return GetDefaultReply(IPC_SUCCESS); return GetDefaultReply(IPC_SUCCESS);
} }

View File

@ -12,6 +12,7 @@
#include "Common/Logging/Log.h" #include "Common/Logging/Log.h"
#include "Common/NandPaths.h" #include "Common/NandPaths.h"
#include "Core/CommonTitles.h"
#include "Core/ConfigManager.h" #include "Core/ConfigManager.h"
#include "Core/Core.h" #include "Core/Core.h"
#include "Core/HW/Memmap.h" #include "Core/HW/Memmap.h"
@ -34,7 +35,8 @@ namespace Device
// booted from the game list, though. // booted from the game list, though.
static bool ShouldReturnFakeViewsForIOSes(u64 title_id, const TitleContext& context) static bool ShouldReturnFakeViewsForIOSes(u64 title_id, const TitleContext& context)
{ {
const bool ios = IsTitleType(title_id, IOS::ES::TitleType::System) && title_id != TITLEID_SYSMENU; const bool ios =
IsTitleType(title_id, IOS::ES::TitleType::System) && title_id != Titles::SYSTEM_MENU;
const bool disc_title = context.active && IOS::ES::IsDiscTitle(context.tmd.GetTitleId()); const bool disc_title = context.active && IOS::ES::IsDiscTitle(context.tmd.GetTitleId());
return Core::WantsDeterminism() || return Core::WantsDeterminism() ||
(ios && SConfig::GetInstance().m_disc_booted_from_game_list && disc_title); (ios && SConfig::GetInstance().m_disc_booted_from_game_list && disc_title);

View File

@ -16,6 +16,7 @@
#include "Common/File.h" #include "Common/File.h"
#include "Common/FileUtil.h" #include "Common/FileUtil.h"
#include "Common/NandPaths.h" #include "Common/NandPaths.h"
#include "Core/CommonTitles.h"
#include "Core/HW/Memmap.h" #include "Core/HW/Memmap.h"
#include "Core/IOS/IOS.h" #include "Core/IOS/IOS.h"
@ -40,7 +41,7 @@ void CreateVirtualFATFilesystem()
{ {
const int cdbSize = 0x01400000; const int cdbSize = 0x01400000;
const std::string cdbPath = const std::string cdbPath =
Common::GetTitleDataPath(TITLEID_SYSMENU, Common::FROM_SESSION_ROOT) + "cdb.vff"; Common::GetTitleDataPath(Titles::SYSTEM_MENU, Common::FROM_SESSION_ROOT) + "cdb.vff";
if ((int)File::GetSize(cdbPath) < cdbSize) if ((int)File::GetSize(cdbPath) < cdbSize)
{ {
// cdb.vff is a virtual Fat filesystem created on first launch of sysmenu // cdb.vff is a virtual Fat filesystem created on first launch of sysmenu

View File

@ -19,6 +19,7 @@
#include "Common/CommonTypes.h" #include "Common/CommonTypes.h"
#include "Common/Logging/Log.h" #include "Common/Logging/Log.h"
#include "Core/Boot/DolReader.h" #include "Core/Boot/DolReader.h"
#include "Core/CommonTitles.h"
#include "Core/ConfigManager.h" #include "Core/ConfigManager.h"
#include "Core/Core.h" #include "Core/Core.h"
#include "Core/CoreTiming.h" #include "Core/CoreTiming.h"
@ -173,11 +174,6 @@ void WriteReturnValue(s32 value, u32 address)
Memory::Write_U32(static_cast<u32>(value), address); Memory::Write_U32(static_cast<u32>(value), address);
} }
// IOS used by the latest System Menu (4.3).
constexpr u64 IOS80_TITLE_ID = 0x0000000100000050;
constexpr u64 BC_TITLE_ID = 0x0000000100000100;
constexpr u64 MIOS_TITLE_ID = 0x0000000100000101;
Kernel::Kernel() Kernel::Kernel()
{ {
// Until the Wii root and NAND path stuff is entirely managed by IOS and made non-static, // Until the Wii root and NAND path stuff is entirely managed by IOS and made non-static,
@ -218,7 +214,7 @@ EmulationKernel::EmulationKernel(u64 title_id) : Kernel(title_id)
Core::InitializeWiiRoot(Core::WantsDeterminism()); Core::InitializeWiiRoot(Core::WantsDeterminism());
if (title_id == MIOS_TITLE_ID) if (title_id == Titles::MIOS)
{ {
MIOS::Load(); MIOS::Load();
return; return;
@ -319,10 +315,10 @@ bool Kernel::BootIOS(const u64 ios_title_id)
// //
// Because we currently don't have boot1 and boot2, and BC is only ever used to launch MIOS // Because we currently don't have boot1 and boot2, and BC is only ever used to launch MIOS
// (indirectly via boot2), we can just launch MIOS when BC is launched. // (indirectly via boot2), we can just launch MIOS when BC is launched.
if (ios_title_id == BC_TITLE_ID) if (ios_title_id == Titles::BC)
{ {
NOTICE_LOG(IOS, "BC: Launching MIOS..."); NOTICE_LOG(IOS, "BC: Launching MIOS...");
return BootIOS(MIOS_TITLE_ID); return BootIOS(Titles::MIOS);
} }
// Shut down the active IOS first before switching to the new one. // Shut down the active IOS first before switching to the new one.
@ -595,7 +591,7 @@ void Kernel::DoState(PointerWrap& p)
m_iosc.DoState(p); m_iosc.DoState(p);
if (m_title_id == MIOS_TITLE_ID) if (m_title_id == Titles::MIOS)
return; return;
// We need to make sure all file handles are closed so IOS::HLE::Device::FS::DoState can // We need to make sure all file handles are closed so IOS::HLE::Device::FS::DoState can
@ -686,13 +682,13 @@ void Init()
}); });
// Start with IOS80 to simulate part of the Wii boot process. // Start with IOS80 to simulate part of the Wii boot process.
s_ios = std::make_unique<EmulationKernel>(IOS80_TITLE_ID); s_ios = std::make_unique<EmulationKernel>(Titles::SYSTEM_MENU_IOS);
// On a Wii, boot2 launches the system menu IOS, which then launches the system menu // On a Wii, boot2 launches the system menu IOS, which then launches the system menu
// (which bootstraps the PPC). Bootstrapping the PPC results in memory values being set up. // (which bootstraps the PPC). Bootstrapping the PPC results in memory values being set up.
// This means that the constants in the 0x3100 region are always set up by the time // This means that the constants in the 0x3100 region are always set up by the time
// a game is launched. This is necessary because booting games from the game list skips // a game is launched. This is necessary because booting games from the game list skips
// a significant part of a Wii's boot process. // a significant part of a Wii's boot process.
SetupMemory(IOS80_TITLE_ID, MemorySetupType::Full); SetupMemory(Titles::SYSTEM_MENU_IOS, MemorySetupType::Full);
} }
void Shutdown() void Shutdown()

View File

@ -15,6 +15,7 @@
#include "Common/NandPaths.h" #include "Common/NandPaths.h"
#include "Common/Swap.h" #include "Common/Swap.h"
#include "Core/Boot/ElfReader.h" #include "Core/Boot/ElfReader.h"
#include "Core/CommonTitles.h"
#include "Core/ConfigManager.h" #include "Core/ConfigManager.h"
#include "Core/Core.h" #include "Core/Core.h"
#include "Core/DSPEmulator.h" #include "Core/DSPEmulator.h"
@ -34,8 +35,6 @@ namespace HLE
{ {
namespace MIOS namespace MIOS
{ {
constexpr u64 MIOS_TITLE_ID = 0x0000000100000101;
// Source: https://wiibrew.org/wiki/ARM_Binaries // Source: https://wiibrew.org/wiki/ARM_Binaries
struct ARMBinary final struct ARMBinary final
{ {
@ -92,7 +91,7 @@ u32 ARMBinary::GetElfSize() const
static std::vector<u8> GetMIOSBinary() static std::vector<u8> GetMIOSBinary()
{ {
const auto& loader = const auto& loader =
DiscIO::NANDContentManager::Access().GetNANDLoader(MIOS_TITLE_ID, Common::FROM_SESSION_ROOT); DiscIO::NANDContentManager::Access().GetNANDLoader(Titles::MIOS, Common::FROM_SESSION_ROOT);
if (!loader.IsValid()) if (!loader.IsValid())
return {}; return {};

View File

@ -14,6 +14,7 @@
#include "Common/NandPaths.h" #include "Common/NandPaths.h"
#include "Common/SettingsHandler.h" #include "Common/SettingsHandler.h"
#include "Core/CommonTitles.h"
#include "Core/HW/Memmap.h" #include "Core/HW/Memmap.h"
#include "Core/IOS/Network/Socket.h" #include "Core/IOS/Network/Socket.h"
#include "Core/ec_wii.h" #include "Core/ec_wii.h"
@ -83,7 +84,7 @@ IPCCommandResult NetKDRequest::IOCtl(const IOCtlRequest& request)
if (config.CreationStage() == NWC24::NWC24Config::NWC24_IDCS_INITIAL) if (config.CreationStage() == NWC24::NWC24Config::NWC24_IDCS_INITIAL)
{ {
const std::string settings_file_path( const std::string settings_file_path(
Common::GetTitleDataPath(TITLEID_SYSMENU, Common::FROM_SESSION_ROOT) + WII_SETTING); Common::GetTitleDataPath(Titles::SYSTEM_MENU, Common::FROM_SESSION_ROOT) + WII_SETTING);
SettingsHandler gen; SettingsHandler gen;
std::string area, model; std::string area, model;
bool got_settings = false; bool got_settings = false;

View File

@ -23,7 +23,6 @@
#include "Common/Logging/Log.h" #include "Common/Logging/Log.h"
#include "Common/Swap.h" #include "Common/Swap.h"
constexpr u32 default_NG_id = 0x0403AC68;
constexpr u32 default_NG_key_id = 0x6AAB8C59; constexpr u32 default_NG_key_id = 0x6AAB8C59;
constexpr u8 default_NG_priv[] = { constexpr u8 default_NG_priv[] = {
@ -65,7 +64,7 @@ void MakeNGCert(u8* ng_cert_out, u32 NG_id, u32 NG_key_id, const u8* NG_priv, co
char name[64]; char name[64];
if ((NG_id == 0) || (NG_key_id == 0) || (NG_priv == nullptr) || (NG_sig == nullptr)) if ((NG_id == 0) || (NG_key_id == 0) || (NG_priv == nullptr) || (NG_sig == nullptr))
{ {
NG_id = default_NG_id; NG_id = DEFAULT_WII_DEVICE_ID;
NG_key_id = default_NG_key_id; NG_key_id = default_NG_key_id;
NG_priv = default_NG_priv; NG_priv = default_NG_priv;
NG_sig = default_NG_sig; NG_sig = default_NG_sig;
@ -98,7 +97,7 @@ void MakeAPSigAndCert(u8* sig_out, u8* ap_cert_out, u64 title_id, u8* data, u32
if ((NG_id == 0) || (NG_priv == nullptr)) if ((NG_id == 0) || (NG_priv == nullptr))
{ {
NG_priv = default_NG_priv; NG_priv = default_NG_priv;
NG_id = default_NG_id; NG_id = DEFAULT_WII_DEVICE_ID;
} }
memset(ap_priv, 0, 0x1e); memset(ap_priv, 0, 0x1e);
@ -186,7 +185,7 @@ void EcWii::InitDefaults()
{ {
memset(&BootMiiKeysBin, 0, sizeof(BootMiiKeysBin)); memset(&BootMiiKeysBin, 0, sizeof(BootMiiKeysBin));
BootMiiKeysBin.ng_id = Common::swap32(default_NG_id); BootMiiKeysBin.ng_id = Common::swap32(DEFAULT_WII_DEVICE_ID);
BootMiiKeysBin.ng_key_id = Common::swap32(default_NG_key_id); BootMiiKeysBin.ng_key_id = Common::swap32(default_NG_key_id);
memcpy(BootMiiKeysBin.ng_priv, default_NG_priv, sizeof(BootMiiKeysBin.ng_priv)); memcpy(BootMiiKeysBin.ng_priv, default_NG_priv, sizeof(BootMiiKeysBin.ng_priv));

View File

@ -26,6 +26,8 @@
#include "Common/CommonTypes.h" #include "Common/CommonTypes.h"
constexpr u32 DEFAULT_WII_DEVICE_ID = 0x0403AC68;
void MakeNGCert(u8* ng_cert_out, u32 NG_id, u32 NG_key_id, const u8* NG_priv, const u8* NG_sig); void MakeNGCert(u8* ng_cert_out, u32 NG_id, u32 NG_key_id, const u8* NG_priv, const u8* NG_sig);
void MakeAPSigAndCert(u8* sig_out, u8* ap_cert_out, u64 title_id, u8* data, u32 data_size, void MakeAPSigAndCert(u8* sig_out, u8* ap_cert_out, u64 title_id, u8* data, u32 data_size,
const u8* NG_priv, u32 NG_id); const u8* NG_priv, u32 NG_id);

View File

@ -32,6 +32,7 @@
#include "Core/Boot/Boot.h" #include "Core/Boot/Boot.h"
#include "Core/BootManager.h" #include "Core/BootManager.h"
#include "Core/CommonTitles.h"
#include "Core/ConfigManager.h" #include "Core/ConfigManager.h"
#include "Core/Core.h" #include "Core/Core.h"
#include "Core/HW/CPU.h" #include "Core/HW/CPU.h"
@ -1214,7 +1215,7 @@ void CFrame::OnShowCheatsWindow(wxCommandEvent& WXUNUSED(event))
void CFrame::OnLoadWiiMenu(wxCommandEvent& WXUNUSED(event)) void CFrame::OnLoadWiiMenu(wxCommandEvent& WXUNUSED(event))
{ {
BootGame(Common::GetTitleContentPath(TITLEID_SYSMENU, Common::FROM_CONFIGURED_ROOT)); BootGame(Common::GetTitleContentPath(Titles::SYSTEM_MENU, Common::FROM_CONFIGURED_ROOT));
} }
void CFrame::OnInstallWAD(wxCommandEvent& event) void CFrame::OnInstallWAD(wxCommandEvent& event)
@ -1272,7 +1273,7 @@ void CFrame::OnUninstallWAD(wxCommandEvent&)
return; return;
} }
if (title_id == TITLEID_SYSMENU) if (title_id == Titles::SYSTEM_MENU)
UpdateLoadWiiMenuItem(); UpdateLoadWiiMenuItem();
} }
@ -1503,7 +1504,7 @@ void CFrame::UpdateGUI()
->FindItem(IDM_LOAD_GC_IPL_EUR) ->FindItem(IDM_LOAD_GC_IPL_EUR)
->Enable(!Initialized && File::Exists(SConfig::GetInstance().GetBootROMPath(EUR_DIR))); ->Enable(!Initialized && File::Exists(SConfig::GetInstance().GetBootROMPath(EUR_DIR)));
if (DiscIO::NANDContentManager::Access() if (DiscIO::NANDContentManager::Access()
.GetNANDLoader(TITLEID_SYSMENU, Common::FROM_CONFIGURED_ROOT) .GetNANDLoader(Titles::SYSTEM_MENU, Common::FROM_CONFIGURED_ROOT)
.IsValid()) .IsValid())
GetMenuBar()->FindItem(IDM_LOAD_WII_MENU)->Enable(!Initialized); GetMenuBar()->FindItem(IDM_LOAD_WII_MENU)->Enable(!Initialized);

View File

@ -8,6 +8,7 @@
#include <vector> #include <vector>
#include "Common/CDUtils.h" #include "Common/CDUtils.h"
#include "Core/CommonTitles.h"
#include "Core/ConfigManager.h" #include "Core/ConfigManager.h"
#include "Core/Core.h" #include "Core/Core.h"
#include "Core/PowerPC/PowerPC.h" #include "Core/PowerPC/PowerPC.h"
@ -582,7 +583,7 @@ void MainMenuBar::RefreshWiiSystemMenuLabel() const
auto* const item = FindItem(IDM_LOAD_WII_MENU); auto* const item = FindItem(IDM_LOAD_WII_MENU);
const auto& sys_menu_loader = DiscIO::NANDContentManager::Access().GetNANDLoader( const auto& sys_menu_loader = DiscIO::NANDContentManager::Access().GetNANDLoader(
TITLEID_SYSMENU, Common::FROM_CONFIGURED_ROOT); Titles::SYSTEM_MENU, Common::FROM_CONFIGURED_ROOT);
if (sys_menu_loader.IsValid()) if (sys_menu_loader.IsValid())
{ {

View File

@ -6,14 +6,14 @@
#include <vector> #include <vector>
#include "Core/CommonTitles.h"
#include "Core/IOS/ES/Formats.h" #include "Core/IOS/ES/Formats.h"
#include "TestBinaryData.h" #include "TestBinaryData.h"
TEST(ESFormats, TitleType) TEST(ESFormats, TitleType)
{ {
const u64 system_menu_title_id = 0x0000000100000002; EXPECT_TRUE(IOS::ES::IsTitleType(Titles::SYSTEM_MENU, IOS::ES::TitleType::System));
EXPECT_TRUE(IOS::ES::IsTitleType(system_menu_title_id, IOS::ES::TitleType::System)); EXPECT_FALSE(IOS::ES::IsDiscTitle(Titles::SYSTEM_MENU));
EXPECT_FALSE(IOS::ES::IsDiscTitle(system_menu_title_id));
const u64 ios59_title_id = 0x000000010000003b; const u64 ios59_title_id = 0x000000010000003b;
EXPECT_TRUE(IOS::ES::IsTitleType(ios59_title_id, IOS::ES::TitleType::System)); EXPECT_TRUE(IOS::ES::IsTitleType(ios59_title_id, IOS::ES::TitleType::System));