ES: Make it fail on unsupported installed IOSes

This commit is contained in:
Sepalani 2018-02-11 06:49:20 +01:00
parent c30ac55cf4
commit 2ce7fff819
4 changed files with 37 additions and 2 deletions

View File

@ -26,6 +26,7 @@
#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/IOS/VersionInfo.h"
#include "Core/ec_wii.h" #include "Core/ec_wii.h"
namespace IOS namespace IOS
@ -586,6 +587,10 @@ IPCCommandResult ES::Launch(const IOCtlVRequest& request)
INFO_LOG(IOS_ES, "IOCTL_ES_LAUNCH %016" PRIx64 " %08x %016" PRIx64 " %08x %016" PRIx64 " %04x", INFO_LOG(IOS_ES, "IOCTL_ES_LAUNCH %016" PRIx64 " %08x %016" PRIx64 " %08x %016" PRIx64 " %04x",
TitleID, view, ticketid, devicetype, titleid, access); TitleID, view, ticketid, devicetype, titleid, access);
// Prevent loading installed IOSes that are not emulated.
if (!IOS::HLE::IsEmulated(TitleID))
return GetDefaultReply(FS_ENOENT);
// IOS replies to the request through the mailbox on failure, and acks if the launch succeeds. // IOS replies to the request through the mailbox on failure, and acks if the launch succeeds.
// Note: Launch will potentially reset the whole IOS state -- including this ES instance. // Note: Launch will potentially reset the whole IOS state -- including this ES instance.
if (!LaunchTitle(TitleID)) if (!LaunchTitle(TitleID))

View File

@ -17,6 +17,7 @@
#include "Core/Core.h" #include "Core/Core.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/VersionInfo.h"
namespace IOS namespace IOS
{ {
@ -51,7 +52,12 @@ IPCCommandResult ES::GetTicketViewCount(const IOCtlVRequest& request)
const IOS::ES::TicketReader ticket = FindSignedTicket(TitleID); const IOS::ES::TicketReader ticket = FindSignedTicket(TitleID);
u32 view_count = ticket.IsValid() ? static_cast<u32>(ticket.GetNumberOfTickets()) : 0; u32 view_count = ticket.IsValid() ? static_cast<u32>(ticket.GetNumberOfTickets()) : 0;
if (ShouldReturnFakeViewsForIOSes(TitleID, m_title_context)) if (!IOS::HLE::IsEmulated(TitleID))
{
view_count = 0;
ERROR_LOG(IOS_ES, "GetViewCount: Dolphin doesn't emulate IOS title %016" PRIx64, TitleID);
}
else if (ShouldReturnFakeViewsForIOSes(TitleID, m_title_context))
{ {
view_count = 1; view_count = 1;
WARN_LOG(IOS_ES, "GetViewCount: Faking IOS title %016" PRIx64 " being present", TitleID); WARN_LOG(IOS_ES, "GetViewCount: Faking IOS title %016" PRIx64 " being present", TitleID);
@ -74,7 +80,11 @@ IPCCommandResult ES::GetTicketViews(const IOCtlVRequest& request)
const IOS::ES::TicketReader ticket = FindSignedTicket(TitleID); const IOS::ES::TicketReader ticket = FindSignedTicket(TitleID);
if (ticket.IsValid()) if (!IOS::HLE::IsEmulated(TitleID))
{
ERROR_LOG(IOS_ES, "GetViews: Dolphin doesn't emulate IOS title %016" PRIx64, TitleID);
}
else if (ticket.IsValid())
{ {
u32 number_of_views = std::min(maxViews, static_cast<u32>(ticket.GetNumberOfTickets())); u32 number_of_views = std::min(maxViews, static_cast<u32>(ticket.GetNumberOfTickets()));
for (u32 view = 0; view < number_of_views; ++view) for (u32 view = 0; view < number_of_views; ++view)

View File

@ -4,9 +4,12 @@
#include "Core/IOS/VersionInfo.h" #include "Core/IOS/VersionInfo.h"
#include <algorithm>
#include <array> #include <array>
#include "Common/CommonTypes.h" #include "Common/CommonTypes.h"
#include "Core/CommonTitles.h"
#include "Core/IOS/ES/Formats.h"
namespace IOS namespace IOS
{ {
@ -374,5 +377,20 @@ bool HasFeature(u32 major_version, Feature feature)
{ {
return HasFeature(GetFeatures(major_version), feature); return HasFeature(GetFeatures(major_version), feature);
} }
bool IsEmulated(u32 major_version)
{
return std::any_of(
ios_memory_values.begin(), ios_memory_values.end(),
[major_version](const MemoryValues& values) { return values.ios_number == major_version; });
}
bool IsEmulated(u64 title_id)
{
const bool ios =
IsTitleType(title_id, IOS::ES::TitleType::System) && title_id != Titles::SYSTEM_MENU;
const u32 version = static_cast<u32>(title_id);
return ios && IsEmulated(version);
}
} }
} }

View File

@ -83,5 +83,7 @@ constexpr bool HasFeature(Feature features, Feature feature)
bool HasFeature(u32 major_version, Feature feature); bool HasFeature(u32 major_version, Feature feature);
Feature GetFeatures(u32 major_version); Feature GetFeatures(u32 major_version);
bool IsEmulated(u32 major_version);
bool IsEmulated(u64 title_id);
} }
} }