mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-30 15:32:47 +00:00
Merge pull request #6374 from sepalani/ios-reload
ES: Make it fail on unsupported installed IOSes
This commit is contained in:
commit
8e06257f19
@ -184,10 +184,10 @@ IPCCommandResult Device::Unsupported(const Request& request)
|
||||
return GetDefaultReply(IPC_EINVAL);
|
||||
}
|
||||
|
||||
// Returns an IPCCommandResult for a reply that takes 250 us (arbitrarily chosen value)
|
||||
// Returns an IPCCommandResult for a reply that takes 25 us (based on ES::GetTicketViews)
|
||||
IPCCommandResult Device::GetDefaultReply(const s32 return_value)
|
||||
{
|
||||
return {return_value, true, SystemTimers::GetTicksPerSecond() / 4000};
|
||||
return {return_value, true, SystemTimers::GetTicksPerSecond() / 40000};
|
||||
}
|
||||
|
||||
// Returns an IPCCommandResult with no reply. Useful for async commands that will generate a reply
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "Core/HW/Memmap.h"
|
||||
#include "Core/IOS/ES/Formats.h"
|
||||
#include "Core/IOS/IOSC.h"
|
||||
#include "Core/IOS/VersionInfo.h"
|
||||
#include "Core/ec_wii.h"
|
||||
|
||||
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",
|
||||
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.
|
||||
// Note: Launch will potentially reset the whole IOS state -- including this ES instance.
|
||||
if (!LaunchTitle(TitleID))
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include "Core/Core.h"
|
||||
#include "Core/HW/Memmap.h"
|
||||
#include "Core/IOS/ES/Formats.h"
|
||||
#include "Core/IOS/VersionInfo.h"
|
||||
|
||||
namespace IOS
|
||||
{
|
||||
@ -51,7 +52,12 @@ IPCCommandResult ES::GetTicketViewCount(const IOCtlVRequest& request)
|
||||
const IOS::ES::TicketReader ticket = FindSignedTicket(TitleID);
|
||||
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;
|
||||
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);
|
||||
|
||||
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()));
|
||||
for (u32 view = 0; view < number_of_views; ++view)
|
||||
|
@ -4,9 +4,12 @@
|
||||
|
||||
#include "Core/IOS/VersionInfo.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Core/CommonTitles.h"
|
||||
#include "Core/IOS/ES/Formats.h"
|
||||
|
||||
namespace IOS
|
||||
{
|
||||
@ -374,5 +377,20 @@ bool HasFeature(u32 major_version, Feature 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -83,5 +83,7 @@ constexpr bool HasFeature(Feature features, Feature feature)
|
||||
|
||||
bool HasFeature(u32 major_version, Feature feature);
|
||||
Feature GetFeatures(u32 major_version);
|
||||
bool IsEmulated(u32 major_version);
|
||||
bool IsEmulated(u64 title_id);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user