IOS/ES: Refuse to launch the shop with default credentials

Prevents... misusing the shop.

We are not legally obliged to do this, but let's not make piracy
any easier.
This commit is contained in:
Léo Lam 2017-06-26 15:28:33 +02:00
parent 860f07f5a1
commit 70828916e6
4 changed files with 24 additions and 4 deletions

View File

@ -17,4 +17,6 @@ constexpr u64 SYSTEM_MENU_IOS = 0x0000000100000050;
constexpr u64 BC = 0x0000000100000100;
constexpr u64 MIOS = 0x0000000100000101;
constexpr u64 SHOP = 0x0001000248414241;
} // namespace Titles

View File

@ -26,6 +26,7 @@
#include "Core/HW/Memmap.h"
#include "Core/IOS/ES/Formats.h"
#include "Core/IOS/IOSC.h"
#include "Core/ec_wii.h"
#include "DiscIO/NANDContentLoader.h"
namespace IOS
@ -242,6 +243,22 @@ bool ES::LaunchTitle(u64 title_id, bool skip_reload)
// (supposedly when trying to re-open those files).
DiscIO::NANDContentManager::Access().ClearCache();
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 LaunchPPCTitle(title_id, skip_reload);

View File

@ -23,7 +23,6 @@
#include "Common/Logging/Log.h"
#include "Common/Swap.h"
constexpr u32 default_NG_id = 0x0403AC68;
constexpr u32 default_NG_key_id = 0x6AAB8C59;
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];
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_priv = default_NG_priv;
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))
{
NG_priv = default_NG_priv;
NG_id = default_NG_id;
NG_id = DEFAULT_WII_DEVICE_ID;
}
memset(ap_priv, 0, 0x1e);
@ -186,7 +185,7 @@ void EcWii::InitDefaults()
{
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);
memcpy(BootMiiKeysBin.ng_priv, default_NG_priv, sizeof(BootMiiKeysBin.ng_priv));

View File

@ -26,6 +26,8 @@
#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 MakeAPSigAndCert(u8* sig_out, u8* ap_cert_out, u64 title_id, u8* data, u32 data_size,
const u8* NG_priv, u32 NG_id);