mirror of
https://github.com/izzy2lost/dolphin.git
synced 2026-06-19 01:16:48 -07:00
Merge pull request #9504 from leoetlino/ios-class-name-cleanup
IOS: Use less ambiguous names for classes
This commit is contained in:
@@ -471,8 +471,8 @@ bool CBoot::EmulatedBS2_Wii(const DiscIO::VolumeDisc& volume)
|
||||
if (!SetupWiiMemory(console_type) || !IOS::HLE::GetIOS()->BootIOS(tmd.GetIOSId()))
|
||||
return false;
|
||||
|
||||
auto di = std::static_pointer_cast<IOS::HLE::Device::DI>(
|
||||
IOS::HLE::GetIOS()->GetDeviceByName("/dev/di"));
|
||||
auto di =
|
||||
std::static_pointer_cast<IOS::HLE::DIDevice>(IOS::HLE::GetIOS()->GetDeviceByName("/dev/di"));
|
||||
|
||||
di->InitializeIfFirstTime();
|
||||
di->ChangePartition(data_partition);
|
||||
|
||||
@@ -561,8 +561,7 @@ bool UpdateRunningGameMetadata(std::optional<u64> title_id)
|
||||
if (!DVDThread::HasDisc())
|
||||
return false;
|
||||
|
||||
return DVDThread::UpdateRunningGameMetadata(IOS::HLE::Device::DI::GetCurrentPartition(),
|
||||
title_id);
|
||||
return DVDThread::UpdateRunningGameMetadata(IOS::HLE::DIDevice::GetCurrentPartition(), title_id);
|
||||
}
|
||||
|
||||
void RegisterMMIO(MMIO::Mapping* mmio, u32 base)
|
||||
@@ -1312,7 +1311,7 @@ void FinishExecutingCommand(ReplyType reply_type, DIInterruptType interrupt_type
|
||||
|
||||
case ReplyType::IOS:
|
||||
{
|
||||
IOS::HLE::Device::DI::InterruptFromDVDInterface(interrupt_type);
|
||||
IOS::HLE::DIDevice::InterruptFromDVDInterface(interrupt_type);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -233,7 +233,7 @@ static void IOSNotifyResetButtonCallback(u64 userdata, s64 cyclesLate)
|
||||
|
||||
auto stm = ios->GetDeviceByName("/dev/stm/eventhook");
|
||||
if (stm)
|
||||
std::static_pointer_cast<IOS::HLE::Device::STMEventHook>(stm)->ResetButton();
|
||||
std::static_pointer_cast<IOS::HLE::STMEventHookDevice>(stm)->ResetButton();
|
||||
}
|
||||
|
||||
static void IOSNotifyPowerButtonCallback(u64 userdata, s64 cyclesLate)
|
||||
@@ -244,7 +244,7 @@ static void IOSNotifyPowerButtonCallback(u64 userdata, s64 cyclesLate)
|
||||
|
||||
auto stm = ios->GetDeviceByName("/dev/stm/eventhook");
|
||||
if (stm)
|
||||
std::static_pointer_cast<IOS::HLE::Device::STMEventHook>(stm)->PowerButton();
|
||||
std::static_pointer_cast<IOS::HLE::STMEventHookDevice>(stm)->PowerButton();
|
||||
}
|
||||
|
||||
void ResetButton_Tap()
|
||||
|
||||
@@ -34,7 +34,7 @@ IPC_HLE_PERIOD: For the Wii Remote this is the call schedule:
|
||||
// If the AclFrameQue is empty this will call Wiimote_Update() and make it send
|
||||
the current input status to the game. I'm not sure if this occurs approximately
|
||||
once every frame or if the frequency is not exactly tied to rendered frames
|
||||
IOS::HLE::Device::BluetoothEmu::Update()
|
||||
IOS::HLE::BluetoothEmuDevice::Update()
|
||||
PluginWiimote::Wiimote_Update()
|
||||
|
||||
// This is also a device updated by IOS::HLE::Update() but it doesn't
|
||||
|
||||
@@ -53,7 +53,7 @@ void UpdateSource(unsigned int index)
|
||||
if (!ios)
|
||||
return;
|
||||
|
||||
const auto bluetooth = std::static_pointer_cast<IOS::HLE::Device::BluetoothEmu>(
|
||||
const auto bluetooth = std::static_pointer_cast<IOS::HLE::BluetoothEmuDevice>(
|
||||
ios->GetDeviceByName("/dev/usb/oh1/57e/305"));
|
||||
if (!bluetooth)
|
||||
return;
|
||||
|
||||
@@ -39,15 +39,15 @@ static RegisterWrapper<0x0D806018> DILENGTH;
|
||||
static RegisterWrapper<0x0D80601C> DICR;
|
||||
static RegisterWrapper<0x0D806020> DIIMMBUF;
|
||||
|
||||
namespace IOS::HLE::Device
|
||||
namespace IOS::HLE
|
||||
{
|
||||
CoreTiming::EventType* DI::s_finish_executing_di_command;
|
||||
CoreTiming::EventType* DIDevice::s_finish_executing_di_command;
|
||||
|
||||
DI::DI(Kernel& ios, const std::string& device_name) : Device(ios, device_name)
|
||||
DIDevice::DIDevice(Kernel& ios, const std::string& device_name) : Device(ios, device_name)
|
||||
{
|
||||
}
|
||||
|
||||
void DI::DoState(PointerWrap& p)
|
||||
void DIDevice::DoState(PointerWrap& p)
|
||||
{
|
||||
DoStateShared(p);
|
||||
p.Do(m_commands_to_execute);
|
||||
@@ -57,13 +57,13 @@ void DI::DoState(PointerWrap& p)
|
||||
p.Do(m_last_length);
|
||||
}
|
||||
|
||||
IPCCommandResult DI::Open(const OpenRequest& request)
|
||||
IPCCommandResult DIDevice::Open(const OpenRequest& request)
|
||||
{
|
||||
InitializeIfFirstTime();
|
||||
return Device::Open(request);
|
||||
}
|
||||
|
||||
IPCCommandResult DI::IOCtl(const IOCtlRequest& request)
|
||||
IPCCommandResult DIDevice::IOCtl(const IOCtlRequest& request)
|
||||
{
|
||||
InitializeIfFirstTime();
|
||||
|
||||
@@ -94,11 +94,11 @@ IPCCommandResult DI::IOCtl(const IOCtlRequest& request)
|
||||
return GetNoReply();
|
||||
}
|
||||
|
||||
void DI::ProcessQueuedIOCtl()
|
||||
void DIDevice::ProcessQueuedIOCtl()
|
||||
{
|
||||
if (m_commands_to_execute.empty())
|
||||
{
|
||||
PanicAlertFmt("IOS::HLE::Device::DI: There is no command to execute!");
|
||||
PanicAlertFmt("IOS::HLE::DIDevice: There is no command to execute!");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -115,7 +115,7 @@ void DI::ProcessQueuedIOCtl()
|
||||
}
|
||||
}
|
||||
|
||||
std::optional<DI::DIResult> DI::WriteIfFits(const IOCtlRequest& request, u32 value)
|
||||
std::optional<DIDevice::DIResult> DIDevice::WriteIfFits(const IOCtlRequest& request, u32 value)
|
||||
{
|
||||
if (request.buffer_out_size < 4)
|
||||
{
|
||||
@@ -129,7 +129,7 @@ std::optional<DI::DIResult> DI::WriteIfFits(const IOCtlRequest& request, u32 val
|
||||
}
|
||||
}
|
||||
|
||||
std::optional<DI::DIResult> DI::StartIOCtl(const IOCtlRequest& request)
|
||||
std::optional<DIDevice::DIResult> DIDevice::StartIOCtl(const IOCtlRequest& request)
|
||||
{
|
||||
if (request.buffer_in_size != 0x20)
|
||||
{
|
||||
@@ -482,7 +482,8 @@ std::optional<DI::DIResult> DI::StartIOCtl(const IOCtlRequest& request)
|
||||
}
|
||||
}
|
||||
|
||||
std::optional<DI::DIResult> DI::StartDMATransfer(u32 command_length, const IOCtlRequest& request)
|
||||
std::optional<DIDevice::DIResult> DIDevice::StartDMATransfer(u32 command_length,
|
||||
const IOCtlRequest& request)
|
||||
{
|
||||
if (request.buffer_out_size < command_length)
|
||||
{
|
||||
@@ -517,8 +518,8 @@ std::optional<DI::DIResult> DI::StartDMATransfer(u32 command_length, const IOCtl
|
||||
// Reply will be posted when done by FinishIOCtl.
|
||||
return {};
|
||||
}
|
||||
std::optional<DI::DIResult> DI::StartImmediateTransfer(const IOCtlRequest& request,
|
||||
bool write_to_buf)
|
||||
std::optional<DIDevice::DIResult> DIDevice::StartImmediateTransfer(const IOCtlRequest& request,
|
||||
bool write_to_buf)
|
||||
{
|
||||
if (write_to_buf && request.buffer_out_size < 4)
|
||||
{
|
||||
@@ -536,17 +537,17 @@ std::optional<DI::DIResult> DI::StartImmediateTransfer(const IOCtlRequest& reque
|
||||
return {};
|
||||
}
|
||||
|
||||
static std::shared_ptr<DI> GetDevice()
|
||||
static std::shared_ptr<DIDevice> GetDevice()
|
||||
{
|
||||
auto ios = IOS::HLE::GetIOS();
|
||||
if (!ios)
|
||||
return nullptr;
|
||||
auto di = ios->GetDeviceByName("/dev/di");
|
||||
// di may be empty, but static_pointer_cast returns empty in that case
|
||||
return std::static_pointer_cast<DI>(di);
|
||||
return std::static_pointer_cast<DIDevice>(di);
|
||||
}
|
||||
|
||||
void DI::InterruptFromDVDInterface(DVDInterface::DIInterruptType interrupt_type)
|
||||
void DIDevice::InterruptFromDVDInterface(DVDInterface::DIInterruptType interrupt_type)
|
||||
{
|
||||
DIResult result;
|
||||
switch (interrupt_type)
|
||||
@@ -558,7 +559,7 @@ void DI::InterruptFromDVDInterface(DVDInterface::DIInterruptType interrupt_type)
|
||||
result = DIResult::DriveError;
|
||||
break;
|
||||
default:
|
||||
PanicAlertFmt("IOS::HLE::Device::DI: Unexpected DVDInterface interrupt {0}!",
|
||||
PanicAlertFmt("IOS::HLE::DIDevice: Unexpected DVDInterface interrupt {0}!",
|
||||
static_cast<int>(interrupt_type));
|
||||
result = DIResult::DriveError;
|
||||
break;
|
||||
@@ -571,12 +572,12 @@ void DI::InterruptFromDVDInterface(DVDInterface::DIInterruptType interrupt_type)
|
||||
}
|
||||
else
|
||||
{
|
||||
PanicAlertFmt("IOS::HLE::Device::DI: Received interrupt from DVDInterface when device wasn't "
|
||||
PanicAlertFmt("IOS::HLE::DIDevice: Received interrupt from DVDInterface when device wasn't "
|
||||
"registered!");
|
||||
}
|
||||
}
|
||||
|
||||
void DI::FinishDICommandCallback(u64 userdata, s64 ticksbehind)
|
||||
void DIDevice::FinishDICommandCallback(u64 userdata, s64 ticksbehind)
|
||||
{
|
||||
const DIResult result = static_cast<DIResult>(userdata);
|
||||
|
||||
@@ -584,15 +585,14 @@ void DI::FinishDICommandCallback(u64 userdata, s64 ticksbehind)
|
||||
if (di)
|
||||
di->FinishDICommand(result);
|
||||
else
|
||||
PanicAlertFmt(
|
||||
"IOS::HLE::Device::DI: Received interrupt from DI when device wasn't registered!");
|
||||
PanicAlertFmt("IOS::HLE::DIDevice: Received interrupt from DI when device wasn't registered!");
|
||||
}
|
||||
|
||||
void DI::FinishDICommand(DIResult result)
|
||||
void DIDevice::FinishDICommand(DIResult result)
|
||||
{
|
||||
if (!m_executing_command.has_value())
|
||||
{
|
||||
PanicAlertFmt("IOS::HLE::Device::DI: There is no command to finish!");
|
||||
PanicAlertFmt("IOS::HLE::DIDevice: There is no command to finish!");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -612,7 +612,7 @@ void DI::FinishDICommand(DIResult result)
|
||||
}
|
||||
}
|
||||
|
||||
IPCCommandResult DI::IOCtlV(const IOCtlVRequest& request)
|
||||
IPCCommandResult DIDevice::IOCtlV(const IOCtlVRequest& request)
|
||||
{
|
||||
// IOCtlVs are not queued since they don't (currently) go into DVDInterface and act
|
||||
// asynchronously. This does mean that an IOCtlV can be executed while an IOCtl is in progress,
|
||||
@@ -707,12 +707,12 @@ IPCCommandResult DI::IOCtlV(const IOCtlVRequest& request)
|
||||
return GetDefaultReply(static_cast<s32>(return_value));
|
||||
}
|
||||
|
||||
void DI::ChangePartition(const DiscIO::Partition partition)
|
||||
void DIDevice::ChangePartition(const DiscIO::Partition partition)
|
||||
{
|
||||
m_current_partition = partition;
|
||||
}
|
||||
|
||||
DiscIO::Partition DI::GetCurrentPartition()
|
||||
DiscIO::Partition DIDevice::GetCurrentPartition()
|
||||
{
|
||||
auto di = GetDevice();
|
||||
// Note that this function is called in Gamecube mode for UpdateRunningGameMetadata,
|
||||
@@ -722,7 +722,7 @@ DiscIO::Partition DI::GetCurrentPartition()
|
||||
return di->m_current_partition;
|
||||
}
|
||||
|
||||
void DI::InitializeIfFirstTime()
|
||||
void DIDevice::InitializeIfFirstTime()
|
||||
{
|
||||
// Match the behavior of Nintendo's initDvdDriverStage2, which is called the first time
|
||||
// an open/ioctl/ioctlv occurs. This behavior is observable by directly reading the DI registers,
|
||||
@@ -738,7 +738,7 @@ void DI::InitializeIfFirstTime()
|
||||
}
|
||||
}
|
||||
|
||||
void DI::ResetDIRegisters()
|
||||
void DIDevice::ResetDIRegisters()
|
||||
{
|
||||
// Clear transfer complete and error interrupts (normally r/z, but here we just directly write
|
||||
// zero)
|
||||
@@ -751,4 +751,4 @@ void DI::ResetDIRegisters()
|
||||
// Close the current partition, if there is one
|
||||
ChangePartition(DiscIO::PARTITION_NONE);
|
||||
}
|
||||
} // namespace IOS::HLE::Device
|
||||
} // namespace IOS::HLE
|
||||
|
||||
@@ -30,12 +30,12 @@ namespace IOS::HLE
|
||||
void Init();
|
||||
}
|
||||
|
||||
namespace IOS::HLE::Device
|
||||
namespace IOS::HLE
|
||||
{
|
||||
class DI : public Device
|
||||
class DIDevice : public Device
|
||||
{
|
||||
public:
|
||||
DI(Kernel& ios, const std::string& device_name);
|
||||
DIDevice(Kernel& ios, const std::string& device_name);
|
||||
|
||||
static void InterruptFromDVDInterface(DVDInterface::DIInterruptType interrupt_type);
|
||||
static DiscIO::Partition GetCurrentPartition();
|
||||
@@ -145,4 +145,4 @@ private:
|
||||
bool m_has_initialized = false;
|
||||
u32 m_last_length = 0;
|
||||
};
|
||||
} // namespace IOS::HLE::Device
|
||||
} // namespace IOS::HLE
|
||||
|
||||
@@ -142,8 +142,6 @@ void IOCtlVRequest::DumpUnknown(const std::string& description, Common::Log::LOG
|
||||
Dump("Unknown IOCtlV - " + description, type, level);
|
||||
}
|
||||
|
||||
namespace Device
|
||||
{
|
||||
Device::Device(Kernel& ios, const std::string& device_name, const DeviceType type)
|
||||
: m_ios(ios), m_name(device_name), m_device_type(type)
|
||||
{
|
||||
@@ -208,5 +206,4 @@ IPCCommandResult Device::GetNoReply()
|
||||
{
|
||||
return {IPC_SUCCESS, false, 0};
|
||||
}
|
||||
} // namespace Device
|
||||
} // namespace IOS::HLE
|
||||
|
||||
@@ -166,8 +166,6 @@ struct IOCtlVRequest final : Request
|
||||
Common::Log::LOG_LEVELS level = Common::Log::LERROR) const;
|
||||
};
|
||||
|
||||
namespace Device
|
||||
{
|
||||
class Device
|
||||
{
|
||||
public:
|
||||
@@ -213,5 +211,4 @@ protected:
|
||||
private:
|
||||
IPCCommandResult Unsupported(const Request& request);
|
||||
};
|
||||
} // namespace Device
|
||||
} // namespace IOS::HLE
|
||||
|
||||
@@ -6,24 +6,24 @@
|
||||
|
||||
#include "Common/Logging/Log.h"
|
||||
|
||||
namespace IOS::HLE::Device
|
||||
namespace IOS::HLE
|
||||
{
|
||||
IPCCommandResult Stub::Open(const OpenRequest& request)
|
||||
IPCCommandResult DeviceStub::Open(const OpenRequest& request)
|
||||
{
|
||||
WARN_LOG_FMT(IOS, "{} faking Open()", m_name);
|
||||
m_is_active = true;
|
||||
return GetDefaultReply(IPC_SUCCESS);
|
||||
}
|
||||
|
||||
IPCCommandResult Stub::IOCtl(const IOCtlRequest& request)
|
||||
IPCCommandResult DeviceStub::IOCtl(const IOCtlRequest& request)
|
||||
{
|
||||
WARN_LOG_FMT(IOS, "{} faking IOCtl()", m_name);
|
||||
return GetDefaultReply(IPC_SUCCESS);
|
||||
}
|
||||
|
||||
IPCCommandResult Stub::IOCtlV(const IOCtlVRequest& request)
|
||||
IPCCommandResult DeviceStub::IOCtlV(const IOCtlVRequest& request)
|
||||
{
|
||||
WARN_LOG_FMT(IOS, "{} faking IOCtlV()", m_name);
|
||||
return GetDefaultReply(IPC_SUCCESS);
|
||||
}
|
||||
} // namespace IOS::HLE::Device
|
||||
} // namespace IOS::HLE
|
||||
|
||||
@@ -10,9 +10,9 @@
|
||||
#include "Core/IOS/Device.h"
|
||||
#include "Core/IOS/IOS.h"
|
||||
|
||||
namespace IOS::HLE::Device
|
||||
namespace IOS::HLE
|
||||
{
|
||||
class Stub final : public Device
|
||||
class DeviceStub final : public Device
|
||||
{
|
||||
public:
|
||||
// Inherit the constructor from the Device class, since we don't need to do anything special.
|
||||
@@ -21,4 +21,4 @@ public:
|
||||
IPCCommandResult IOCtl(const IOCtlRequest& request) override;
|
||||
IPCCommandResult IOCtlV(const IOCtlVRequest& request) override;
|
||||
};
|
||||
} // namespace IOS::HLE::Device
|
||||
} // namespace IOS::HLE
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
#include "Core/HW/Memmap.h"
|
||||
#include "Core/IOS/DolphinDevice.h"
|
||||
|
||||
namespace IOS::HLE::Device
|
||||
namespace IOS::HLE
|
||||
{
|
||||
namespace
|
||||
{
|
||||
@@ -187,4 +187,4 @@ IPCCommandResult DolphinDevice::IOCtlV(const IOCtlVRequest& request)
|
||||
return GetDefaultReply(IPC_EINVAL);
|
||||
}
|
||||
}
|
||||
} // namespace IOS::HLE::Device
|
||||
} // namespace IOS::HLE
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
#include "Core/IOS/Device.h"
|
||||
|
||||
namespace IOS::HLE::Device
|
||||
namespace IOS::HLE
|
||||
{
|
||||
class DolphinDevice final : public Device
|
||||
{
|
||||
@@ -15,4 +15,4 @@ public:
|
||||
using Device::Device;
|
||||
IPCCommandResult IOCtlV(const IOCtlVRequest& request) override;
|
||||
};
|
||||
} // namespace IOS::HLE::Device
|
||||
} // namespace IOS::HLE
|
||||
|
||||
@@ -26,10 +26,12 @@
|
||||
#include "Core/IOS/VersionInfo.h"
|
||||
#include "DiscIO/Enums.h"
|
||||
|
||||
namespace IOS::HLE::Device
|
||||
namespace IOS::HLE
|
||||
{
|
||||
namespace
|
||||
{
|
||||
// Title to launch after IOS has been reset and reloaded (similar to /sys/launch.sys).
|
||||
static u64 s_title_to_launch;
|
||||
u64 s_title_to_launch;
|
||||
|
||||
struct DirectoryToCreate
|
||||
{
|
||||
@@ -52,8 +54,9 @@ constexpr std::array<DirectoryToCreate, 9> s_directories_to_create = {{
|
||||
{"/meta", 0, public_modes, SYSMENU_UID, SYSMENU_GID},
|
||||
{"/wfs", 0, {FS::Mode::ReadWrite, FS::Mode::None, FS::Mode::None}, PID_UNKNOWN, PID_UNKNOWN},
|
||||
}};
|
||||
} // namespace
|
||||
|
||||
ES::ES(Kernel& ios, const std::string& device_name) : Device(ios, device_name)
|
||||
ESDevice::ESDevice(Kernel& ios, const std::string& device_name) : Device(ios, device_name)
|
||||
{
|
||||
for (const auto& directory : s_directories_to_create)
|
||||
{
|
||||
@@ -117,7 +120,7 @@ void TitleContext::Update(const IOS::ES::TMDReader& tmd_, const IOS::ES::TicketR
|
||||
}
|
||||
}
|
||||
|
||||
IPCCommandResult ES::GetTitleDirectory(const IOCtlVRequest& request)
|
||||
IPCCommandResult ESDevice::GetTitleDirectory(const IOCtlVRequest& request)
|
||||
{
|
||||
if (!request.HasNumberOfValidVectors(1, 1))
|
||||
return GetDefaultReply(ES_EINVAL);
|
||||
@@ -132,7 +135,7 @@ IPCCommandResult ES::GetTitleDirectory(const IOCtlVRequest& request)
|
||||
return GetDefaultReply(IPC_SUCCESS);
|
||||
}
|
||||
|
||||
ReturnCode ES::GetTitleId(u64* title_id) const
|
||||
ReturnCode ESDevice::GetTitleId(u64* title_id) const
|
||||
{
|
||||
if (!m_title_context.active)
|
||||
return ES_EINVAL;
|
||||
@@ -140,7 +143,7 @@ ReturnCode ES::GetTitleId(u64* title_id) const
|
||||
return IPC_SUCCESS;
|
||||
}
|
||||
|
||||
IPCCommandResult ES::GetTitleId(const IOCtlVRequest& request)
|
||||
IPCCommandResult ESDevice::GetTitleId(const IOCtlVRequest& request)
|
||||
{
|
||||
if (!request.HasNumberOfValidVectors(0, 1))
|
||||
return GetDefaultReply(ES_EINVAL);
|
||||
@@ -193,7 +196,7 @@ static ReturnCode CheckIsAllowedToSetUID(Kernel& kernel, const u32 caller_uid,
|
||||
return ES_EINVAL;
|
||||
}
|
||||
|
||||
IPCCommandResult ES::SetUID(u32 uid, const IOCtlVRequest& request)
|
||||
IPCCommandResult ESDevice::SetUID(u32 uid, const IOCtlVRequest& request)
|
||||
{
|
||||
if (!request.HasNumberOfValidVectors(1, 0) || request.in_vectors[0].size != 8)
|
||||
return GetDefaultReply(ES_EINVAL);
|
||||
@@ -220,7 +223,7 @@ IPCCommandResult ES::SetUID(u32 uid, const IOCtlVRequest& request)
|
||||
return GetDefaultReply(IPC_SUCCESS);
|
||||
}
|
||||
|
||||
bool ES::LaunchTitle(u64 title_id, bool skip_reload)
|
||||
bool ESDevice::LaunchTitle(u64 title_id, bool skip_reload)
|
||||
{
|
||||
m_title_context.Clear();
|
||||
INFO_LOG_FMT(IOS_ES, "ES_Launch: Title context changed: (none)");
|
||||
@@ -248,7 +251,7 @@ bool ES::LaunchTitle(u64 title_id, bool skip_reload)
|
||||
return LaunchPPCTitle(title_id, skip_reload);
|
||||
}
|
||||
|
||||
bool ES::LaunchIOS(u64 ios_title_id)
|
||||
bool ESDevice::LaunchIOS(u64 ios_title_id)
|
||||
{
|
||||
// A real Wii goes through several steps before getting to MIOS.
|
||||
//
|
||||
@@ -286,7 +289,7 @@ bool ES::LaunchIOS(u64 ios_title_id)
|
||||
return m_ios.BootIOS(ios_title_id);
|
||||
}
|
||||
|
||||
bool ES::LaunchPPCTitle(u64 title_id, bool skip_reload)
|
||||
bool ESDevice::LaunchPPCTitle(u64 title_id, bool skip_reload)
|
||||
{
|
||||
const IOS::ES::TMDReader tmd = FindInstalledTMD(title_id);
|
||||
const IOS::ES::TicketReader ticket = FindSignedTicket(title_id);
|
||||
@@ -336,7 +339,7 @@ bool ES::LaunchPPCTitle(u64 title_id, bool skip_reload)
|
||||
return m_ios.BootstrapPPC(GetContentPath(tmd.GetTitleId(), content));
|
||||
}
|
||||
|
||||
void ES::Context::DoState(PointerWrap& p)
|
||||
void ESDevice::Context::DoState(PointerWrap& p)
|
||||
{
|
||||
p.Do(uid);
|
||||
p.Do(gid);
|
||||
@@ -346,7 +349,7 @@ void ES::Context::DoState(PointerWrap& p)
|
||||
p.Do(ipc_fd);
|
||||
}
|
||||
|
||||
void ES::DoState(PointerWrap& p)
|
||||
void ESDevice::DoState(PointerWrap& p)
|
||||
{
|
||||
Device::DoState(p);
|
||||
|
||||
@@ -365,19 +368,19 @@ void ES::DoState(PointerWrap& p)
|
||||
context.DoState(p);
|
||||
}
|
||||
|
||||
ES::ContextArray::iterator ES::FindActiveContext(s32 fd)
|
||||
ESDevice::ContextArray::iterator ESDevice::FindActiveContext(s32 fd)
|
||||
{
|
||||
return std::find_if(m_contexts.begin(), m_contexts.end(),
|
||||
[fd](const auto& context) { return context.ipc_fd == fd && context.active; });
|
||||
}
|
||||
|
||||
ES::ContextArray::iterator ES::FindInactiveContext()
|
||||
ESDevice::ContextArray::iterator ESDevice::FindInactiveContext()
|
||||
{
|
||||
return std::find_if(m_contexts.begin(), m_contexts.end(),
|
||||
[](const auto& context) { return !context.active; });
|
||||
}
|
||||
|
||||
IPCCommandResult ES::Open(const OpenRequest& request)
|
||||
IPCCommandResult ESDevice::Open(const OpenRequest& request)
|
||||
{
|
||||
auto context = FindInactiveContext();
|
||||
if (context == m_contexts.end())
|
||||
@@ -390,7 +393,7 @@ IPCCommandResult ES::Open(const OpenRequest& request)
|
||||
return Device::Open(request);
|
||||
}
|
||||
|
||||
IPCCommandResult ES::Close(u32 fd)
|
||||
IPCCommandResult ESDevice::Close(u32 fd)
|
||||
{
|
||||
auto context = FindActiveContext(fd);
|
||||
if (context == m_contexts.end())
|
||||
@@ -404,7 +407,7 @@ IPCCommandResult ES::Close(u32 fd)
|
||||
return GetDefaultReply(IPC_SUCCESS);
|
||||
}
|
||||
|
||||
IPCCommandResult ES::IOCtlV(const IOCtlVRequest& request)
|
||||
IPCCommandResult ESDevice::IOCtlV(const IOCtlVRequest& request)
|
||||
{
|
||||
DEBUG_LOG_FMT(IOS_ES, "{} ({:#x})", GetDeviceName(), request.request);
|
||||
auto context = FindActiveContext(request.fd);
|
||||
@@ -567,7 +570,7 @@ IPCCommandResult ES::IOCtlV(const IOCtlVRequest& request)
|
||||
}
|
||||
}
|
||||
|
||||
IPCCommandResult ES::GetConsumption(const IOCtlVRequest& request)
|
||||
IPCCommandResult ESDevice::GetConsumption(const IOCtlVRequest& request)
|
||||
{
|
||||
if (!request.HasNumberOfValidVectors(1, 2))
|
||||
return GetDefaultReply(ES_EINVAL);
|
||||
@@ -578,7 +581,7 @@ IPCCommandResult ES::GetConsumption(const IOCtlVRequest& request)
|
||||
return GetDefaultReply(IPC_SUCCESS);
|
||||
}
|
||||
|
||||
IPCCommandResult ES::Launch(const IOCtlVRequest& request)
|
||||
IPCCommandResult ESDevice::Launch(const IOCtlVRequest& request)
|
||||
{
|
||||
if (!request.HasNumberOfValidVectors(2, 0))
|
||||
return GetDefaultReply(ES_EINVAL);
|
||||
@@ -608,7 +611,7 @@ IPCCommandResult ES::Launch(const IOCtlVRequest& request)
|
||||
return GetNoReply();
|
||||
}
|
||||
|
||||
IPCCommandResult ES::LaunchBC(const IOCtlVRequest& request)
|
||||
IPCCommandResult ESDevice::LaunchBC(const IOCtlVRequest& request)
|
||||
{
|
||||
if (!request.HasNumberOfValidVectors(0, 0))
|
||||
return GetDefaultReply(ES_EINVAL);
|
||||
@@ -627,7 +630,7 @@ IPCCommandResult ES::LaunchBC(const IOCtlVRequest& request)
|
||||
// This is technically an ioctlv in IOS's ES, but it is an internal API which cannot be
|
||||
// used from the PowerPC (for unpatched and up-to-date IOSes anyway).
|
||||
// So we block access to it from the IPC interface.
|
||||
IPCCommandResult ES::DIVerify(const IOCtlVRequest& request)
|
||||
IPCCommandResult ESDevice::DIVerify(const IOCtlVRequest& request)
|
||||
{
|
||||
return GetDefaultReply(ES_EINVAL);
|
||||
}
|
||||
@@ -656,7 +659,7 @@ static ReturnCode WriteTmdForDiVerify(FS::FileSystem* fs, const IOS::ES::TMDRead
|
||||
return FS::ConvertResult(fs->Rename(PID_KERNEL, PID_KERNEL, temp_path, tmd_path));
|
||||
}
|
||||
|
||||
ReturnCode ES::DIVerify(const IOS::ES::TMDReader& tmd, const IOS::ES::TicketReader& ticket)
|
||||
ReturnCode ESDevice::DIVerify(const IOS::ES::TMDReader& tmd, const IOS::ES::TicketReader& ticket)
|
||||
{
|
||||
m_title_context.Clear();
|
||||
INFO_LOG_FMT(IOS_ES, "ES_DIVerify: Title context changed: (none)");
|
||||
@@ -696,8 +699,8 @@ ReturnCode ES::DIVerify(const IOS::ES::TMDReader& tmd, const IOS::ES::TicketRead
|
||||
fs->SetMetadata(0, data_dir, m_ios.GetUidForPPC(), m_ios.GetGidForPPC(), 0, data_dir_modes));
|
||||
}
|
||||
|
||||
ReturnCode ES::CheckStreamKeyPermissions(const u32 uid, const u8* ticket_view,
|
||||
const IOS::ES::TMDReader& tmd) const
|
||||
ReturnCode ESDevice::CheckStreamKeyPermissions(const u32 uid, const u8* ticket_view,
|
||||
const IOS::ES::TMDReader& tmd) const
|
||||
{
|
||||
const u32 title_flags = tmd.GetTitleFlags();
|
||||
// Only allow using this function with some titles (WFS titles).
|
||||
@@ -739,8 +742,8 @@ ReturnCode ES::CheckStreamKeyPermissions(const u32 uid, const u8* ticket_view,
|
||||
return IPC_SUCCESS;
|
||||
}
|
||||
|
||||
ReturnCode ES::SetUpStreamKey(const u32 uid, const u8* ticket_view, const IOS::ES::TMDReader& tmd,
|
||||
u32* handle)
|
||||
ReturnCode ESDevice::SetUpStreamKey(const u32 uid, const u8* ticket_view,
|
||||
const IOS::ES::TMDReader& tmd, u32* handle)
|
||||
{
|
||||
ReturnCode ret = CheckStreamKeyPermissions(uid, ticket_view, tmd);
|
||||
if (ret != IPC_SUCCESS)
|
||||
@@ -794,7 +797,7 @@ ReturnCode ES::SetUpStreamKey(const u32 uid, const u8* ticket_view, const IOS::E
|
||||
PID_ES);
|
||||
}
|
||||
|
||||
IPCCommandResult ES::SetUpStreamKey(const Context& context, const IOCtlVRequest& request)
|
||||
IPCCommandResult ESDevice::SetUpStreamKey(const Context& context, const IOCtlVRequest& request)
|
||||
{
|
||||
if (!request.HasNumberOfValidVectors(2, 1) ||
|
||||
request.in_vectors[0].size != sizeof(IOS::ES::TicketView) ||
|
||||
@@ -818,7 +821,7 @@ IPCCommandResult ES::SetUpStreamKey(const Context& context, const IOCtlVRequest&
|
||||
return GetDefaultReply(ret);
|
||||
}
|
||||
|
||||
IPCCommandResult ES::DeleteStreamKey(const IOCtlVRequest& request)
|
||||
IPCCommandResult ESDevice::DeleteStreamKey(const IOCtlVRequest& request)
|
||||
{
|
||||
if (!request.HasNumberOfValidVectors(1, 0) || request.in_vectors[0].size != sizeof(u32))
|
||||
return GetDefaultReply(ES_EINVAL);
|
||||
@@ -827,7 +830,7 @@ IPCCommandResult ES::DeleteStreamKey(const IOCtlVRequest& request)
|
||||
return GetDefaultReply(m_ios.GetIOSC().DeleteObject(handle, PID_ES));
|
||||
}
|
||||
|
||||
bool ES::IsActiveTitlePermittedByTicket(const u8* ticket_view) const
|
||||
bool ESDevice::IsActiveTitlePermittedByTicket(const u8* ticket_view) const
|
||||
{
|
||||
if (!m_title_context.active)
|
||||
return false;
|
||||
@@ -840,7 +843,8 @@ bool ES::IsActiveTitlePermittedByTicket(const u8* ticket_view) const
|
||||
return title_identifier && (title_identifier & ~permitted_title_mask) == permitted_title_id;
|
||||
}
|
||||
|
||||
bool ES::IsIssuerCorrect(VerifyContainerType type, const IOS::ES::CertReader& issuer_cert) const
|
||||
bool ESDevice::IsIssuerCorrect(VerifyContainerType type,
|
||||
const IOS::ES::CertReader& issuer_cert) const
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
@@ -857,7 +861,7 @@ bool ES::IsIssuerCorrect(VerifyContainerType type, const IOS::ES::CertReader& is
|
||||
|
||||
static const std::string CERT_STORE_PATH = "/sys/cert.sys";
|
||||
|
||||
ReturnCode ES::ReadCertStore(std::vector<u8>* buffer) const
|
||||
ReturnCode ESDevice::ReadCertStore(std::vector<u8>* buffer) const
|
||||
{
|
||||
const auto store_file =
|
||||
m_ios.GetFS()->OpenFile(PID_KERNEL, PID_KERNEL, CERT_STORE_PATH, FS::Mode::Read);
|
||||
@@ -870,7 +874,7 @@ ReturnCode ES::ReadCertStore(std::vector<u8>* buffer) const
|
||||
return IPC_SUCCESS;
|
||||
}
|
||||
|
||||
ReturnCode ES::WriteNewCertToStore(const IOS::ES::CertReader& cert)
|
||||
ReturnCode ESDevice::WriteNewCertToStore(const IOS::ES::CertReader& cert)
|
||||
{
|
||||
// Read the current store to determine if the new cert needs to be written.
|
||||
std::vector<u8> current_store;
|
||||
@@ -895,9 +899,9 @@ ReturnCode ES::WriteNewCertToStore(const IOS::ES::CertReader& cert)
|
||||
return IPC_SUCCESS;
|
||||
}
|
||||
|
||||
ReturnCode ES::VerifyContainer(VerifyContainerType type, VerifyMode mode,
|
||||
const IOS::ES::SignedBlobReader& signed_blob,
|
||||
const std::vector<u8>& cert_chain, u32* issuer_handle_out)
|
||||
ReturnCode ESDevice::VerifyContainer(VerifyContainerType type, VerifyMode mode,
|
||||
const IOS::ES::SignedBlobReader& signed_blob,
|
||||
const std::vector<u8>& cert_chain, u32* issuer_handle_out)
|
||||
{
|
||||
if (!signed_blob.IsSignatureValid())
|
||||
return ES_EINVAL;
|
||||
@@ -987,9 +991,9 @@ ReturnCode ES::VerifyContainer(VerifyContainerType type, VerifyMode mode,
|
||||
return ret;
|
||||
}
|
||||
|
||||
ReturnCode ES::VerifyContainer(VerifyContainerType type, VerifyMode mode,
|
||||
const IOS::ES::CertReader& cert, const std::vector<u8>& cert_chain,
|
||||
u32 certificate_iosc_handle)
|
||||
ReturnCode ESDevice::VerifyContainer(VerifyContainerType type, VerifyMode mode,
|
||||
const IOS::ES::CertReader& cert,
|
||||
const std::vector<u8>& cert_chain, u32 certificate_iosc_handle)
|
||||
{
|
||||
IOSC::Handle issuer_handle;
|
||||
ReturnCode ret = VerifyContainer(type, mode, cert, cert_chain, &issuer_handle);
|
||||
@@ -1001,4 +1005,4 @@ ReturnCode ES::VerifyContainer(VerifyContainerType type, VerifyMode mode,
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
} // namespace IOS::HLE::Device
|
||||
} // namespace IOS::HLE
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace DiscIO
|
||||
enum class Platform;
|
||||
}
|
||||
|
||||
namespace IOS::HLE::Device
|
||||
namespace IOS::HLE
|
||||
{
|
||||
struct TitleContext
|
||||
{
|
||||
@@ -38,10 +38,10 @@ struct TitleContext
|
||||
bool first_change = true;
|
||||
};
|
||||
|
||||
class ES final : public Device
|
||||
class ESDevice final : public Device
|
||||
{
|
||||
public:
|
||||
ES(Kernel& ios, const std::string& device_name);
|
||||
ESDevice(Kernel& ios, const std::string& device_name);
|
||||
|
||||
ReturnCode DIVerify(const IOS::ES::TMDReader& tmd, const IOS::ES::TicketReader& ticket);
|
||||
bool LaunchTitle(u64 title_id, bool skip_reload = false);
|
||||
@@ -385,4 +385,4 @@ private:
|
||||
ContextArray m_contexts;
|
||||
TitleContext m_title_context{};
|
||||
};
|
||||
} // namespace IOS::HLE::Device
|
||||
} // namespace IOS::HLE
|
||||
|
||||
@@ -18,16 +18,16 @@
|
||||
#include "Core/IOS/IOSC.h"
|
||||
#include "Core/IOS/Uids.h"
|
||||
|
||||
namespace IOS::HLE::Device
|
||||
namespace IOS::HLE
|
||||
{
|
||||
ReturnCode ES::GetDeviceId(u32* device_id) const
|
||||
ReturnCode ESDevice::GetDeviceId(u32* device_id) const
|
||||
{
|
||||
*device_id = m_ios.GetIOSC().GetDeviceId();
|
||||
INFO_LOG_FMT(IOS_ES, "GetDeviceId: {:08X}", *device_id);
|
||||
return IPC_SUCCESS;
|
||||
}
|
||||
|
||||
IPCCommandResult ES::GetDeviceId(const IOCtlVRequest& request)
|
||||
IPCCommandResult ESDevice::GetDeviceId(const IOCtlVRequest& request)
|
||||
{
|
||||
if (!request.HasNumberOfValidVectors(0, 1) || request.io_vectors[0].size != sizeof(u32))
|
||||
return GetDefaultReply(ES_EINVAL);
|
||||
@@ -40,7 +40,7 @@ IPCCommandResult ES::GetDeviceId(const IOCtlVRequest& request)
|
||||
return GetDefaultReply(IPC_SUCCESS);
|
||||
}
|
||||
|
||||
IPCCommandResult ES::Encrypt(u32 uid, const IOCtlVRequest& request)
|
||||
IPCCommandResult ESDevice::Encrypt(u32 uid, const IOCtlVRequest& request)
|
||||
{
|
||||
if (!request.HasNumberOfValidVectors(3, 2))
|
||||
return GetDefaultReply(ES_EINVAL);
|
||||
@@ -57,7 +57,7 @@ IPCCommandResult ES::Encrypt(u32 uid, const IOCtlVRequest& request)
|
||||
return GetDefaultReply(ret);
|
||||
}
|
||||
|
||||
IPCCommandResult ES::Decrypt(u32 uid, const IOCtlVRequest& request)
|
||||
IPCCommandResult ESDevice::Decrypt(u32 uid, const IOCtlVRequest& request)
|
||||
{
|
||||
if (!request.HasNumberOfValidVectors(3, 2))
|
||||
return GetDefaultReply(ES_EINVAL);
|
||||
@@ -74,7 +74,7 @@ IPCCommandResult ES::Decrypt(u32 uid, const IOCtlVRequest& request)
|
||||
return GetDefaultReply(ret);
|
||||
}
|
||||
|
||||
IPCCommandResult ES::CheckKoreaRegion(const IOCtlVRequest& request)
|
||||
IPCCommandResult ESDevice::CheckKoreaRegion(const IOCtlVRequest& request)
|
||||
{
|
||||
if (!request.HasNumberOfValidVectors(0, 0))
|
||||
return GetDefaultReply(ES_EINVAL);
|
||||
@@ -87,7 +87,7 @@ IPCCommandResult ES::CheckKoreaRegion(const IOCtlVRequest& request)
|
||||
return GetDefaultReply(ES_EINVAL);
|
||||
}
|
||||
|
||||
IPCCommandResult ES::GetDeviceCertificate(const IOCtlVRequest& request)
|
||||
IPCCommandResult ESDevice::GetDeviceCertificate(const IOCtlVRequest& request)
|
||||
{
|
||||
if (!request.HasNumberOfValidVectors(0, 1) || request.io_vectors[0].size != 0x180)
|
||||
return GetDefaultReply(ES_EINVAL);
|
||||
@@ -99,7 +99,7 @@ IPCCommandResult ES::GetDeviceCertificate(const IOCtlVRequest& request)
|
||||
return GetDefaultReply(IPC_SUCCESS);
|
||||
}
|
||||
|
||||
IPCCommandResult ES::Sign(const IOCtlVRequest& request)
|
||||
IPCCommandResult ESDevice::Sign(const IOCtlVRequest& request)
|
||||
{
|
||||
if (!request.HasNumberOfValidVectors(1, 2))
|
||||
return GetDefaultReply(ES_EINVAL);
|
||||
@@ -117,8 +117,8 @@ IPCCommandResult ES::Sign(const IOCtlVRequest& request)
|
||||
return GetDefaultReply(IPC_SUCCESS);
|
||||
}
|
||||
|
||||
ReturnCode ES::VerifySign(const std::vector<u8>& hash, const std::vector<u8>& ecc_signature,
|
||||
const std::vector<u8>& certs_bytes)
|
||||
ReturnCode ESDevice::VerifySign(const std::vector<u8>& hash, const std::vector<u8>& ecc_signature,
|
||||
const std::vector<u8>& certs_bytes)
|
||||
{
|
||||
const std::map<std::string, IOS::ES::CertReader> certs = IOS::ES::ParseCertChain(certs_bytes);
|
||||
if (certs.empty())
|
||||
@@ -185,7 +185,7 @@ ReturnCode ES::VerifySign(const std::vector<u8>& hash, const std::vector<u8>& ec
|
||||
return IPC_SUCCESS;
|
||||
}
|
||||
|
||||
IPCCommandResult ES::VerifySign(const IOCtlVRequest& request)
|
||||
IPCCommandResult ESDevice::VerifySign(const IOCtlVRequest& request)
|
||||
{
|
||||
if (!request.HasNumberOfValidVectors(3, 0))
|
||||
return GetDefaultReply(ES_EINVAL);
|
||||
@@ -203,4 +203,4 @@ IPCCommandResult ES::VerifySign(const IOCtlVRequest& request)
|
||||
|
||||
return GetDefaultReply(VerifySign(hash, ecc_signature, certs));
|
||||
}
|
||||
} // namespace IOS::HLE::Device
|
||||
} // namespace IOS::HLE
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
#include "Core/IOS/ES/Formats.h"
|
||||
#include "Core/IOS/Uids.h"
|
||||
|
||||
namespace IOS::HLE::Device
|
||||
namespace IOS::HLE
|
||||
{
|
||||
static IOS::ES::TMDReader FindTMD(FS::FileSystem* fs, u64 title_id, const std::string& tmd_path)
|
||||
{
|
||||
@@ -37,18 +37,18 @@ static IOS::ES::TMDReader FindTMD(FS::FileSystem* fs, u64 title_id, const std::s
|
||||
return IOS::ES::TMDReader{std::move(tmd_bytes)};
|
||||
}
|
||||
|
||||
IOS::ES::TMDReader ES::FindImportTMD(u64 title_id) const
|
||||
IOS::ES::TMDReader ESDevice::FindImportTMD(u64 title_id) const
|
||||
{
|
||||
return FindTMD(m_ios.GetFS().get(), title_id,
|
||||
Common::GetImportTitlePath(title_id) + "/content/title.tmd");
|
||||
}
|
||||
|
||||
IOS::ES::TMDReader ES::FindInstalledTMD(u64 title_id) const
|
||||
IOS::ES::TMDReader ESDevice::FindInstalledTMD(u64 title_id) const
|
||||
{
|
||||
return FindTMD(m_ios.GetFS().get(), title_id, Common::GetTMDFileName(title_id));
|
||||
}
|
||||
|
||||
IOS::ES::TicketReader ES::FindSignedTicket(u64 title_id) const
|
||||
IOS::ES::TicketReader ESDevice::FindSignedTicket(u64 title_id) const
|
||||
{
|
||||
const std::string path = Common::GetTicketFileName(title_id);
|
||||
const auto ticket_file = m_ios.GetFS()->OpenFile(PID_KERNEL, PID_KERNEL, path, FS::Mode::Read);
|
||||
@@ -112,17 +112,17 @@ static std::vector<u64> GetTitlesInTitleOrImport(FS::FileSystem* fs, const std::
|
||||
return title_ids;
|
||||
}
|
||||
|
||||
std::vector<u64> ES::GetInstalledTitles() const
|
||||
std::vector<u64> ESDevice::GetInstalledTitles() const
|
||||
{
|
||||
return GetTitlesInTitleOrImport(m_ios.GetFS().get(), "/title");
|
||||
}
|
||||
|
||||
std::vector<u64> ES::GetTitleImports() const
|
||||
std::vector<u64> ESDevice::GetTitleImports() const
|
||||
{
|
||||
return GetTitlesInTitleOrImport(m_ios.GetFS().get(), "/import");
|
||||
}
|
||||
|
||||
std::vector<u64> ES::GetTitlesWithTickets() const
|
||||
std::vector<u64> ESDevice::GetTitlesWithTickets() const
|
||||
{
|
||||
const auto fs = m_ios.GetFS();
|
||||
const auto entries = fs->ReadDirectory(PID_KERNEL, PID_KERNEL, "/ticket");
|
||||
@@ -165,8 +165,8 @@ std::vector<u64> ES::GetTitlesWithTickets() const
|
||||
}
|
||||
|
||||
std::vector<IOS::ES::Content>
|
||||
ES::GetStoredContentsFromTMD(const IOS::ES::TMDReader& tmd,
|
||||
CheckContentHashes check_content_hashes) const
|
||||
ESDevice::GetStoredContentsFromTMD(const IOS::ES::TMDReader& tmd,
|
||||
CheckContentHashes check_content_hashes) const
|
||||
{
|
||||
if (!tmd.IsValid())
|
||||
return {};
|
||||
@@ -205,7 +205,7 @@ ES::GetStoredContentsFromTMD(const IOS::ES::TMDReader& tmd,
|
||||
return stored_contents;
|
||||
}
|
||||
|
||||
u32 ES::GetSharedContentsCount() const
|
||||
u32 ESDevice::GetSharedContentsCount() const
|
||||
{
|
||||
const auto entries = m_ios.GetFS()->ReadDirectory(PID_KERNEL, PID_KERNEL, "/shared1");
|
||||
return static_cast<u32>(
|
||||
@@ -215,7 +215,7 @@ u32 ES::GetSharedContentsCount() const
|
||||
}));
|
||||
}
|
||||
|
||||
std::vector<std::array<u8, 20>> ES::GetSharedContents() const
|
||||
std::vector<std::array<u8, 20>> ESDevice::GetSharedContents() const
|
||||
{
|
||||
const IOS::ES::SharedContentMap map{m_ios.GetFS()};
|
||||
return map.GetHashes();
|
||||
@@ -242,7 +242,7 @@ constexpr FS::Modes title_dir_modes{FS::Mode::ReadWrite, FS::Mode::ReadWrite, FS
|
||||
constexpr FS::Modes content_dir_modes{FS::Mode::ReadWrite, FS::Mode::ReadWrite, FS::Mode::None};
|
||||
constexpr FS::Modes data_dir_modes{FS::Mode::ReadWrite, FS::Mode::None, FS::Mode::None};
|
||||
|
||||
bool ES::CreateTitleDirectories(u64 title_id, u16 group_id) const
|
||||
bool ESDevice::CreateTitleDirectories(u64 title_id, u16 group_id) const
|
||||
{
|
||||
const auto fs = m_ios.GetFS();
|
||||
|
||||
@@ -278,7 +278,7 @@ bool ES::CreateTitleDirectories(u64 title_id, u16 group_id) const
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ES::InitImport(const IOS::ES::TMDReader& tmd)
|
||||
bool ESDevice::InitImport(const IOS::ES::TMDReader& tmd)
|
||||
{
|
||||
if (!CreateTitleDirectories(tmd.GetTitleId(), tmd.GetGroupId()))
|
||||
return false;
|
||||
@@ -310,7 +310,7 @@ bool ES::InitImport(const IOS::ES::TMDReader& tmd)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ES::FinishImport(const IOS::ES::TMDReader& tmd)
|
||||
bool ESDevice::FinishImport(const IOS::ES::TMDReader& tmd)
|
||||
{
|
||||
const auto fs = m_ios.GetFS();
|
||||
const u64 title_id = tmd.GetTitleId();
|
||||
@@ -343,7 +343,7 @@ bool ES::FinishImport(const IOS::ES::TMDReader& tmd)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ES::WriteImportTMD(const IOS::ES::TMDReader& tmd)
|
||||
bool ESDevice::WriteImportTMD(const IOS::ES::TMDReader& tmd)
|
||||
{
|
||||
const auto fs = m_ios.GetFS();
|
||||
const std::string tmd_path = "/tmp/title.tmd";
|
||||
@@ -358,7 +358,7 @@ bool ES::WriteImportTMD(const IOS::ES::TMDReader& tmd)
|
||||
return fs->Rename(PID_KERNEL, PID_KERNEL, tmd_path, dest) == FS::ResultCode::Success;
|
||||
}
|
||||
|
||||
void ES::FinishStaleImport(u64 title_id)
|
||||
void ESDevice::FinishStaleImport(u64 title_id)
|
||||
{
|
||||
const auto fs = m_ios.GetFS();
|
||||
const auto import_tmd = FindImportTMD(title_id);
|
||||
@@ -374,24 +374,24 @@ void ES::FinishStaleImport(u64 title_id)
|
||||
}
|
||||
}
|
||||
|
||||
void ES::FinishAllStaleImports()
|
||||
void ESDevice::FinishAllStaleImports()
|
||||
{
|
||||
const std::vector<u64> titles = GetTitleImports();
|
||||
for (const u64& title_id : titles)
|
||||
FinishStaleImport(title_id);
|
||||
}
|
||||
|
||||
std::string ES::GetContentPath(const u64 title_id, const IOS::ES::Content& content,
|
||||
const IOS::ES::SharedContentMap& content_map) const
|
||||
std::string ESDevice::GetContentPath(const u64 title_id, const IOS::ES::Content& content,
|
||||
const IOS::ES::SharedContentMap& content_map) const
|
||||
{
|
||||
if (content.IsShared())
|
||||
return content_map.GetFilenameFromSHA1(content.sha1).value_or("");
|
||||
return fmt::format("{}/{:08x}.app", Common::GetTitleContentPath(title_id), content.id);
|
||||
}
|
||||
|
||||
std::string ES::GetContentPath(const u64 title_id, const IOS::ES::Content& content) const
|
||||
std::string ESDevice::GetContentPath(const u64 title_id, const IOS::ES::Content& content) const
|
||||
{
|
||||
IOS::ES::SharedContentMap map{m_ios.GetFS()};
|
||||
return GetContentPath(title_id, content, map);
|
||||
}
|
||||
} // namespace IOS::HLE::Device
|
||||
} // namespace IOS::HLE
|
||||
|
||||
@@ -13,9 +13,9 @@
|
||||
#include "Core/IOS/ES/Formats.h"
|
||||
#include "Core/IOS/Uids.h"
|
||||
|
||||
namespace IOS::HLE::Device
|
||||
namespace IOS::HLE
|
||||
{
|
||||
s32 ES::OpenContent(const IOS::ES::TMDReader& tmd, u16 content_index, u32 uid)
|
||||
s32 ESDevice::OpenContent(const IOS::ES::TMDReader& tmd, u16 content_index, u32 uid)
|
||||
{
|
||||
const u64 title_id = tmd.GetTitleId();
|
||||
|
||||
@@ -46,7 +46,7 @@ s32 ES::OpenContent(const IOS::ES::TMDReader& tmd, u16 content_index, u32 uid)
|
||||
return FS_EFDEXHAUSTED;
|
||||
}
|
||||
|
||||
IPCCommandResult ES::OpenContent(u32 uid, const IOCtlVRequest& request)
|
||||
IPCCommandResult ESDevice::OpenContent(u32 uid, const IOCtlVRequest& request)
|
||||
{
|
||||
if (!request.HasNumberOfValidVectors(3, 0) || request.in_vectors[0].size != sizeof(u64) ||
|
||||
request.in_vectors[1].size != sizeof(IOS::ES::TicketView) ||
|
||||
@@ -66,7 +66,7 @@ IPCCommandResult ES::OpenContent(u32 uid, const IOCtlVRequest& request)
|
||||
return GetDefaultReply(OpenContent(tmd, content_index, uid));
|
||||
}
|
||||
|
||||
IPCCommandResult ES::OpenActiveTitleContent(u32 caller_uid, const IOCtlVRequest& request)
|
||||
IPCCommandResult ESDevice::OpenActiveTitleContent(u32 caller_uid, const IOCtlVRequest& request)
|
||||
{
|
||||
if (!request.HasNumberOfValidVectors(1, 0) || request.in_vectors[0].size != sizeof(u32))
|
||||
return GetDefaultReply(ES_EINVAL);
|
||||
@@ -84,7 +84,7 @@ IPCCommandResult ES::OpenActiveTitleContent(u32 caller_uid, const IOCtlVRequest&
|
||||
return GetDefaultReply(OpenContent(m_title_context.tmd, content_index, caller_uid));
|
||||
}
|
||||
|
||||
s32 ES::ReadContent(u32 cfd, u8* buffer, u32 size, u32 uid)
|
||||
s32 ESDevice::ReadContent(u32 cfd, u8* buffer, u32 size, u32 uid)
|
||||
{
|
||||
if (cfd >= m_content_table.size())
|
||||
return ES_EINVAL;
|
||||
@@ -99,7 +99,7 @@ s32 ES::ReadContent(u32 cfd, u8* buffer, u32 size, u32 uid)
|
||||
return result.Succeeded() ? *result : FS::ConvertResult(result.Error());
|
||||
}
|
||||
|
||||
IPCCommandResult ES::ReadContent(u32 uid, const IOCtlVRequest& request)
|
||||
IPCCommandResult ESDevice::ReadContent(u32 uid, const IOCtlVRequest& request)
|
||||
{
|
||||
if (!request.HasNumberOfValidVectors(1, 1) || request.in_vectors[0].size != sizeof(u32))
|
||||
return GetDefaultReply(ES_EINVAL);
|
||||
@@ -111,7 +111,7 @@ IPCCommandResult ES::ReadContent(u32 uid, const IOCtlVRequest& request)
|
||||
return GetDefaultReply(ReadContent(cfd, Memory::GetPointer(addr), size, uid));
|
||||
}
|
||||
|
||||
ReturnCode ES::CloseContent(u32 cfd, u32 uid)
|
||||
ReturnCode ESDevice::CloseContent(u32 cfd, u32 uid)
|
||||
{
|
||||
if (cfd >= m_content_table.size())
|
||||
return ES_EINVAL;
|
||||
@@ -128,7 +128,7 @@ ReturnCode ES::CloseContent(u32 cfd, u32 uid)
|
||||
return IPC_SUCCESS;
|
||||
}
|
||||
|
||||
IPCCommandResult ES::CloseContent(u32 uid, const IOCtlVRequest& request)
|
||||
IPCCommandResult ESDevice::CloseContent(u32 uid, const IOCtlVRequest& request)
|
||||
{
|
||||
if (!request.HasNumberOfValidVectors(1, 0) || request.in_vectors[0].size != sizeof(u32))
|
||||
return GetDefaultReply(ES_EINVAL);
|
||||
@@ -137,7 +137,7 @@ IPCCommandResult ES::CloseContent(u32 uid, const IOCtlVRequest& request)
|
||||
return GetDefaultReply(CloseContent(cfd, uid));
|
||||
}
|
||||
|
||||
s32 ES::SeekContent(u32 cfd, u32 offset, SeekMode mode, u32 uid)
|
||||
s32 ESDevice::SeekContent(u32 cfd, u32 offset, SeekMode mode, u32 uid)
|
||||
{
|
||||
if (cfd >= m_content_table.size())
|
||||
return ES_EINVAL;
|
||||
@@ -152,7 +152,7 @@ s32 ES::SeekContent(u32 cfd, u32 offset, SeekMode mode, u32 uid)
|
||||
return result.Succeeded() ? *result : FS::ConvertResult(result.Error());
|
||||
}
|
||||
|
||||
IPCCommandResult ES::SeekContent(u32 uid, const IOCtlVRequest& request)
|
||||
IPCCommandResult ESDevice::SeekContent(u32 uid, const IOCtlVRequest& request)
|
||||
{
|
||||
if (!request.HasNumberOfValidVectors(3, 0))
|
||||
return GetDefaultReply(ES_EINVAL);
|
||||
@@ -163,4 +163,4 @@ IPCCommandResult ES::SeekContent(u32 uid, const IOCtlVRequest& request)
|
||||
|
||||
return GetDefaultReply(SeekContent(cfd, offset, mode, uid));
|
||||
}
|
||||
} // namespace IOS::HLE::Device
|
||||
} // namespace IOS::HLE
|
||||
|
||||
@@ -12,12 +12,12 @@
|
||||
#include "Core/HW/Memmap.h"
|
||||
#include "Core/IOS/ES/Formats.h"
|
||||
|
||||
namespace IOS::HLE::Device
|
||||
namespace IOS::HLE
|
||||
{
|
||||
// Used by the GetStoredContents ioctlvs. This assumes that the first output vector
|
||||
// is used for the content count (u32).
|
||||
IPCCommandResult ES::GetStoredContentsCount(const IOS::ES::TMDReader& tmd,
|
||||
const IOCtlVRequest& request)
|
||||
IPCCommandResult ESDevice::GetStoredContentsCount(const IOS::ES::TMDReader& tmd,
|
||||
const IOCtlVRequest& request)
|
||||
{
|
||||
if (request.io_vectors[0].size != sizeof(u32) || !tmd.IsValid())
|
||||
return GetDefaultReply(ES_EINVAL);
|
||||
@@ -32,7 +32,8 @@ IPCCommandResult ES::GetStoredContentsCount(const IOS::ES::TMDReader& tmd,
|
||||
|
||||
// Used by the GetStoredContents ioctlvs. This assumes that the second input vector is used
|
||||
// for the content count and the output vector is used to store a list of content IDs (u32s).
|
||||
IPCCommandResult ES::GetStoredContents(const IOS::ES::TMDReader& tmd, const IOCtlVRequest& request)
|
||||
IPCCommandResult ESDevice::GetStoredContents(const IOS::ES::TMDReader& tmd,
|
||||
const IOCtlVRequest& request)
|
||||
{
|
||||
if (!tmd.IsValid())
|
||||
return GetDefaultReply(ES_EINVAL);
|
||||
@@ -51,7 +52,7 @@ IPCCommandResult ES::GetStoredContents(const IOS::ES::TMDReader& tmd, const IOCt
|
||||
return GetDefaultReply(IPC_SUCCESS);
|
||||
}
|
||||
|
||||
IPCCommandResult ES::GetStoredContentsCount(const IOCtlVRequest& request)
|
||||
IPCCommandResult ESDevice::GetStoredContentsCount(const IOCtlVRequest& request)
|
||||
{
|
||||
if (!request.HasNumberOfValidVectors(1, 1) || request.in_vectors[0].size != sizeof(u64))
|
||||
return GetDefaultReply(ES_EINVAL);
|
||||
@@ -63,7 +64,7 @@ IPCCommandResult ES::GetStoredContentsCount(const IOCtlVRequest& request)
|
||||
return GetStoredContentsCount(tmd, request);
|
||||
}
|
||||
|
||||
IPCCommandResult ES::GetStoredContents(const IOCtlVRequest& request)
|
||||
IPCCommandResult ESDevice::GetStoredContents(const IOCtlVRequest& request)
|
||||
{
|
||||
if (!request.HasNumberOfValidVectors(2, 1) || request.in_vectors[0].size != sizeof(u64))
|
||||
return GetDefaultReply(ES_EINVAL);
|
||||
@@ -75,7 +76,7 @@ IPCCommandResult ES::GetStoredContents(const IOCtlVRequest& request)
|
||||
return GetStoredContents(tmd, request);
|
||||
}
|
||||
|
||||
IPCCommandResult ES::GetTMDStoredContentsCount(const IOCtlVRequest& request)
|
||||
IPCCommandResult ESDevice::GetTMDStoredContentsCount(const IOCtlVRequest& request)
|
||||
{
|
||||
if (!request.HasNumberOfValidVectors(1, 1))
|
||||
return GetDefaultReply(ES_EINVAL);
|
||||
@@ -85,7 +86,7 @@ IPCCommandResult ES::GetTMDStoredContentsCount(const IOCtlVRequest& request)
|
||||
return GetStoredContentsCount(IOS::ES::TMDReader{std::move(tmd_bytes)}, request);
|
||||
}
|
||||
|
||||
IPCCommandResult ES::GetTMDStoredContents(const IOCtlVRequest& request)
|
||||
IPCCommandResult ESDevice::GetTMDStoredContents(const IOCtlVRequest& request)
|
||||
{
|
||||
if (!request.HasNumberOfValidVectors(2, 1))
|
||||
return GetDefaultReply(ES_EINVAL);
|
||||
@@ -109,7 +110,8 @@ IPCCommandResult ES::GetTMDStoredContents(const IOCtlVRequest& request)
|
||||
return GetStoredContents(tmd, request);
|
||||
}
|
||||
|
||||
IPCCommandResult ES::GetTitleCount(const std::vector<u64>& titles, const IOCtlVRequest& request)
|
||||
IPCCommandResult ESDevice::GetTitleCount(const std::vector<u64>& titles,
|
||||
const IOCtlVRequest& request)
|
||||
{
|
||||
if (!request.HasNumberOfValidVectors(0, 1) || request.io_vectors[0].size != 4)
|
||||
return GetDefaultReply(ES_EINVAL);
|
||||
@@ -119,7 +121,7 @@ IPCCommandResult ES::GetTitleCount(const std::vector<u64>& titles, const IOCtlVR
|
||||
return GetDefaultReply(IPC_SUCCESS);
|
||||
}
|
||||
|
||||
IPCCommandResult ES::GetTitles(const std::vector<u64>& titles, const IOCtlVRequest& request)
|
||||
IPCCommandResult ESDevice::GetTitles(const std::vector<u64>& titles, const IOCtlVRequest& request)
|
||||
{
|
||||
if (!request.HasNumberOfValidVectors(1, 1))
|
||||
return GetDefaultReply(ES_EINVAL);
|
||||
@@ -133,19 +135,19 @@ IPCCommandResult ES::GetTitles(const std::vector<u64>& titles, const IOCtlVReque
|
||||
return GetDefaultReply(IPC_SUCCESS);
|
||||
}
|
||||
|
||||
IPCCommandResult ES::GetTitleCount(const IOCtlVRequest& request)
|
||||
IPCCommandResult ESDevice::GetTitleCount(const IOCtlVRequest& request)
|
||||
{
|
||||
const std::vector<u64> titles = GetInstalledTitles();
|
||||
INFO_LOG_FMT(IOS_ES, "GetTitleCount: {} titles", titles.size());
|
||||
return GetTitleCount(titles, request);
|
||||
}
|
||||
|
||||
IPCCommandResult ES::GetTitles(const IOCtlVRequest& request)
|
||||
IPCCommandResult ESDevice::GetTitles(const IOCtlVRequest& request)
|
||||
{
|
||||
return GetTitles(GetInstalledTitles(), request);
|
||||
}
|
||||
|
||||
IPCCommandResult ES::GetStoredTMDSize(const IOCtlVRequest& request)
|
||||
IPCCommandResult ESDevice::GetStoredTMDSize(const IOCtlVRequest& request)
|
||||
{
|
||||
if (!request.HasNumberOfValidVectors(1, 1))
|
||||
return GetDefaultReply(ES_EINVAL);
|
||||
@@ -163,7 +165,7 @@ IPCCommandResult ES::GetStoredTMDSize(const IOCtlVRequest& request)
|
||||
return GetDefaultReply(IPC_SUCCESS);
|
||||
}
|
||||
|
||||
IPCCommandResult ES::GetStoredTMD(const IOCtlVRequest& request)
|
||||
IPCCommandResult ESDevice::GetStoredTMD(const IOCtlVRequest& request)
|
||||
{
|
||||
if (!request.HasNumberOfValidVectors(2, 1))
|
||||
return GetDefaultReply(ES_EINVAL);
|
||||
@@ -186,19 +188,19 @@ IPCCommandResult ES::GetStoredTMD(const IOCtlVRequest& request)
|
||||
return GetDefaultReply(IPC_SUCCESS);
|
||||
}
|
||||
|
||||
IPCCommandResult ES::GetOwnedTitleCount(const IOCtlVRequest& request)
|
||||
IPCCommandResult ESDevice::GetOwnedTitleCount(const IOCtlVRequest& request)
|
||||
{
|
||||
const std::vector<u64> titles = GetTitlesWithTickets();
|
||||
INFO_LOG_FMT(IOS_ES, "GetOwnedTitleCount: {} titles", titles.size());
|
||||
return GetTitleCount(titles, request);
|
||||
}
|
||||
|
||||
IPCCommandResult ES::GetOwnedTitles(const IOCtlVRequest& request)
|
||||
IPCCommandResult ESDevice::GetOwnedTitles(const IOCtlVRequest& request)
|
||||
{
|
||||
return GetTitles(GetTitlesWithTickets(), request);
|
||||
}
|
||||
|
||||
IPCCommandResult ES::GetBoot2Version(const IOCtlVRequest& request)
|
||||
IPCCommandResult ESDevice::GetBoot2Version(const IOCtlVRequest& request)
|
||||
{
|
||||
if (!request.HasNumberOfValidVectors(0, 1))
|
||||
return GetDefaultReply(ES_EINVAL);
|
||||
@@ -210,7 +212,7 @@ IPCCommandResult ES::GetBoot2Version(const IOCtlVRequest& request)
|
||||
return GetDefaultReply(IPC_SUCCESS);
|
||||
}
|
||||
|
||||
IPCCommandResult ES::GetSharedContentsCount(const IOCtlVRequest& request) const
|
||||
IPCCommandResult ESDevice::GetSharedContentsCount(const IOCtlVRequest& request) const
|
||||
{
|
||||
if (!request.HasNumberOfValidVectors(0, 1) || request.io_vectors[0].size != sizeof(u32))
|
||||
return GetDefaultReply(ES_EINVAL);
|
||||
@@ -222,7 +224,7 @@ IPCCommandResult ES::GetSharedContentsCount(const IOCtlVRequest& request) const
|
||||
return GetDefaultReply(IPC_SUCCESS);
|
||||
}
|
||||
|
||||
IPCCommandResult ES::GetSharedContents(const IOCtlVRequest& request) const
|
||||
IPCCommandResult ESDevice::GetSharedContents(const IOCtlVRequest& request) const
|
||||
{
|
||||
if (!request.HasNumberOfValidVectors(1, 1) || request.in_vectors[0].size != sizeof(u32))
|
||||
return GetDefaultReply(ES_EINVAL);
|
||||
@@ -238,4 +240,4 @@ IPCCommandResult ES::GetSharedContents(const IOCtlVRequest& request) const
|
||||
INFO_LOG_FMT(IOS_ES, "GetSharedContents: {} contents ({} requested)", count, max_count);
|
||||
return GetDefaultReply(IPC_SUCCESS);
|
||||
}
|
||||
} // namespace IOS::HLE::Device
|
||||
} // namespace IOS::HLE
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
#include "Core/IOS/FS/FileSystem.h"
|
||||
#include "Core/IOS/Uids.h"
|
||||
|
||||
namespace IOS::HLE::Device
|
||||
namespace IOS::HLE
|
||||
{
|
||||
static ReturnCode WriteTicket(FS::FileSystem* fs, const IOS::ES::TicketReader& ticket)
|
||||
{
|
||||
@@ -39,7 +39,7 @@ static ReturnCode WriteTicket(FS::FileSystem* fs, const IOS::ES::TicketReader& t
|
||||
return file->Write(raw_ticket.data(), raw_ticket.size()) ? IPC_SUCCESS : ES_EIO;
|
||||
}
|
||||
|
||||
void ES::TitleImportExportContext::DoState(PointerWrap& p)
|
||||
void ESDevice::TitleImportExportContext::DoState(PointerWrap& p)
|
||||
{
|
||||
p.Do(valid);
|
||||
p.Do(key_handle);
|
||||
@@ -50,8 +50,9 @@ void ES::TitleImportExportContext::DoState(PointerWrap& p)
|
||||
p.Do(content.buffer);
|
||||
}
|
||||
|
||||
ReturnCode ES::ImportTicket(const std::vector<u8>& ticket_bytes, const std::vector<u8>& cert_chain,
|
||||
TicketImportType type, VerifySignature verify_signature)
|
||||
ReturnCode ESDevice::ImportTicket(const std::vector<u8>& ticket_bytes,
|
||||
const std::vector<u8>& cert_chain, TicketImportType type,
|
||||
VerifySignature verify_signature)
|
||||
{
|
||||
IOS::ES::TicketReader ticket{ticket_bytes};
|
||||
if (!ticket.IsValid())
|
||||
@@ -92,7 +93,7 @@ ReturnCode ES::ImportTicket(const std::vector<u8>& ticket_bytes, const std::vect
|
||||
return IPC_SUCCESS;
|
||||
}
|
||||
|
||||
IPCCommandResult ES::ImportTicket(const IOCtlVRequest& request)
|
||||
IPCCommandResult ESDevice::ImportTicket(const IOCtlVRequest& request)
|
||||
{
|
||||
if (!request.HasNumberOfValidVectors(3, 0))
|
||||
return GetDefaultReply(ES_EINVAL);
|
||||
@@ -128,15 +129,15 @@ static ReturnCode InitBackupKey(u64 tid, u32 title_flags, IOSC& iosc, IOSC::Hand
|
||||
return ret == IPC_SUCCESS ? iosc.ImportSecretKey(*key, NULL_KEY.data(), PID_ES) : ret;
|
||||
}
|
||||
|
||||
static void ResetTitleImportContext(ES::Context* context, IOSC& iosc)
|
||||
static void ResetTitleImportContext(ESDevice::Context* context, IOSC& iosc)
|
||||
{
|
||||
if (context->title_import_export.key_handle)
|
||||
iosc.DeleteObject(context->title_import_export.key_handle, PID_ES);
|
||||
context->title_import_export = {};
|
||||
}
|
||||
|
||||
ReturnCode ES::ImportTmd(Context& context, const std::vector<u8>& tmd_bytes, u64 caller_title_id,
|
||||
u32 caller_title_flags)
|
||||
ReturnCode ESDevice::ImportTmd(Context& context, const std::vector<u8>& tmd_bytes,
|
||||
u64 caller_title_id, u32 caller_title_flags)
|
||||
{
|
||||
INFO_LOG_FMT(IOS_ES, "ImportTmd");
|
||||
|
||||
@@ -179,7 +180,7 @@ ReturnCode ES::ImportTmd(Context& context, const std::vector<u8>& tmd_bytes, u64
|
||||
return IPC_SUCCESS;
|
||||
}
|
||||
|
||||
IPCCommandResult ES::ImportTmd(Context& context, const IOCtlVRequest& request)
|
||||
IPCCommandResult ESDevice::ImportTmd(Context& context, const IOCtlVRequest& request)
|
||||
{
|
||||
if (!request.HasNumberOfValidVectors(1, 0))
|
||||
return GetDefaultReply(ES_EINVAL);
|
||||
@@ -210,8 +211,9 @@ static ReturnCode InitTitleImportKey(const std::vector<u8>& ticket_bytes, IOSC&
|
||||
&ticket_bytes[offsetof(IOS::ES::Ticket, title_key)], PID_ES);
|
||||
}
|
||||
|
||||
ReturnCode ES::ImportTitleInit(Context& context, const std::vector<u8>& tmd_bytes,
|
||||
const std::vector<u8>& cert_chain, VerifySignature verify_signature)
|
||||
ReturnCode ESDevice::ImportTitleInit(Context& context, const std::vector<u8>& tmd_bytes,
|
||||
const std::vector<u8>& cert_chain,
|
||||
VerifySignature verify_signature)
|
||||
{
|
||||
INFO_LOG_FMT(IOS_ES, "ImportTitleInit");
|
||||
ResetTitleImportContext(&context, m_ios.GetIOSC());
|
||||
@@ -264,7 +266,7 @@ ReturnCode ES::ImportTitleInit(Context& context, const std::vector<u8>& tmd_byte
|
||||
return IPC_SUCCESS;
|
||||
}
|
||||
|
||||
IPCCommandResult ES::ImportTitleInit(Context& context, const IOCtlVRequest& request)
|
||||
IPCCommandResult ESDevice::ImportTitleInit(Context& context, const IOCtlVRequest& request)
|
||||
{
|
||||
if (!request.HasNumberOfValidVectors(4, 0))
|
||||
return GetDefaultReply(ES_EINVAL);
|
||||
@@ -279,7 +281,7 @@ IPCCommandResult ES::ImportTitleInit(Context& context, const IOCtlVRequest& requ
|
||||
return GetDefaultReply(ImportTitleInit(context, tmd, certs));
|
||||
}
|
||||
|
||||
ReturnCode ES::ImportContentBegin(Context& context, u64 title_id, u32 content_id)
|
||||
ReturnCode ESDevice::ImportContentBegin(Context& context, u64 title_id, u32 content_id)
|
||||
{
|
||||
if (context.title_import_export.content.valid)
|
||||
{
|
||||
@@ -322,7 +324,7 @@ ReturnCode ES::ImportContentBegin(Context& context, u64 title_id, u32 content_id
|
||||
return static_cast<ReturnCode>(content_fd);
|
||||
}
|
||||
|
||||
IPCCommandResult ES::ImportContentBegin(Context& context, const IOCtlVRequest& request)
|
||||
IPCCommandResult ESDevice::ImportContentBegin(Context& context, const IOCtlVRequest& request)
|
||||
{
|
||||
if (!request.HasNumberOfValidVectors(2, 0))
|
||||
return GetDefaultReply(ES_EINVAL);
|
||||
@@ -332,7 +334,8 @@ IPCCommandResult ES::ImportContentBegin(Context& context, const IOCtlVRequest& r
|
||||
return GetDefaultReply(ImportContentBegin(context, title_id, content_id));
|
||||
}
|
||||
|
||||
ReturnCode ES::ImportContentData(Context& context, u32 content_fd, const u8* data, u32 data_size)
|
||||
ReturnCode ESDevice::ImportContentData(Context& context, u32 content_fd, const u8* data,
|
||||
u32 data_size)
|
||||
{
|
||||
INFO_LOG_FMT(IOS_ES, "ImportContentData: content fd {:08x}, size {}", content_fd, data_size);
|
||||
context.title_import_export.content.buffer.insert(
|
||||
@@ -340,7 +343,7 @@ ReturnCode ES::ImportContentData(Context& context, u32 content_fd, const u8* dat
|
||||
return IPC_SUCCESS;
|
||||
}
|
||||
|
||||
IPCCommandResult ES::ImportContentData(Context& context, const IOCtlVRequest& request)
|
||||
IPCCommandResult ESDevice::ImportContentData(Context& context, const IOCtlVRequest& request)
|
||||
{
|
||||
if (!request.HasNumberOfValidVectors(2, 0))
|
||||
return GetDefaultReply(ES_EINVAL);
|
||||
@@ -363,7 +366,7 @@ static std::string GetImportContentPath(u64 title_id, u32 content_id)
|
||||
return fmt::format("{}/content/{:08x}.app", Common::GetImportTitlePath(title_id), content_id);
|
||||
}
|
||||
|
||||
ReturnCode ES::ImportContentEnd(Context& context, u32 content_fd)
|
||||
ReturnCode ESDevice::ImportContentEnd(Context& context, u32 content_fd)
|
||||
{
|
||||
INFO_LOG_FMT(IOS_ES, "ImportContentEnd: content fd {:08x}", content_fd);
|
||||
|
||||
@@ -426,7 +429,7 @@ ReturnCode ES::ImportContentEnd(Context& context, u32 content_fd)
|
||||
return IPC_SUCCESS;
|
||||
}
|
||||
|
||||
IPCCommandResult ES::ImportContentEnd(Context& context, const IOCtlVRequest& request)
|
||||
IPCCommandResult ESDevice::ImportContentEnd(Context& context, const IOCtlVRequest& request)
|
||||
{
|
||||
if (!request.HasNumberOfValidVectors(1, 0))
|
||||
return GetDefaultReply(ES_EINVAL);
|
||||
@@ -454,7 +457,7 @@ static bool HasAllRequiredContents(IOS::HLE::Kernel& ios, const IOS::ES::TMDRead
|
||||
});
|
||||
}
|
||||
|
||||
ReturnCode ES::ImportTitleDone(Context& context)
|
||||
ReturnCode ESDevice::ImportTitleDone(Context& context)
|
||||
{
|
||||
if (!context.title_import_export.valid || context.title_import_export.content.valid)
|
||||
{
|
||||
@@ -489,7 +492,7 @@ ReturnCode ES::ImportTitleDone(Context& context)
|
||||
return IPC_SUCCESS;
|
||||
}
|
||||
|
||||
IPCCommandResult ES::ImportTitleDone(Context& context, const IOCtlVRequest& request)
|
||||
IPCCommandResult ESDevice::ImportTitleDone(Context& context, const IOCtlVRequest& request)
|
||||
{
|
||||
if (!request.HasNumberOfValidVectors(0, 0))
|
||||
return GetDefaultReply(ES_EINVAL);
|
||||
@@ -497,7 +500,7 @@ IPCCommandResult ES::ImportTitleDone(Context& context, const IOCtlVRequest& requ
|
||||
return GetDefaultReply(ImportTitleDone(context));
|
||||
}
|
||||
|
||||
ReturnCode ES::ImportTitleCancel(Context& context)
|
||||
ReturnCode ESDevice::ImportTitleCancel(Context& context)
|
||||
{
|
||||
// The TMD buffer can exist without a valid title import context.
|
||||
if (context.title_import_export.tmd.GetBytes().empty() ||
|
||||
@@ -515,7 +518,7 @@ ReturnCode ES::ImportTitleCancel(Context& context)
|
||||
return IPC_SUCCESS;
|
||||
}
|
||||
|
||||
IPCCommandResult ES::ImportTitleCancel(Context& context, const IOCtlVRequest& request)
|
||||
IPCCommandResult ESDevice::ImportTitleCancel(Context& context, const IOCtlVRequest& request)
|
||||
{
|
||||
if (!request.HasNumberOfValidVectors(0, 0))
|
||||
return GetDefaultReply(ES_EINVAL);
|
||||
@@ -529,7 +532,7 @@ static bool CanDeleteTitle(u64 title_id)
|
||||
return static_cast<u32>(title_id >> 32) != 0x00000001 || static_cast<u32>(title_id) > 0x101;
|
||||
}
|
||||
|
||||
ReturnCode ES::DeleteTitle(u64 title_id)
|
||||
ReturnCode ESDevice::DeleteTitle(u64 title_id)
|
||||
{
|
||||
if (!CanDeleteTitle(title_id))
|
||||
return ES_EINVAL;
|
||||
@@ -538,7 +541,7 @@ ReturnCode ES::DeleteTitle(u64 title_id)
|
||||
return FS::ConvertResult(m_ios.GetFS()->Delete(PID_KERNEL, PID_KERNEL, title_dir));
|
||||
}
|
||||
|
||||
IPCCommandResult ES::DeleteTitle(const IOCtlVRequest& request)
|
||||
IPCCommandResult ESDevice::DeleteTitle(const IOCtlVRequest& request)
|
||||
{
|
||||
if (!request.HasNumberOfValidVectors(1, 0) || request.in_vectors[0].size != 8)
|
||||
return GetDefaultReply(ES_EINVAL);
|
||||
@@ -547,7 +550,7 @@ IPCCommandResult ES::DeleteTitle(const IOCtlVRequest& request)
|
||||
return GetDefaultReply(DeleteTitle(title_id));
|
||||
}
|
||||
|
||||
ReturnCode ES::DeleteTicket(const u8* ticket_view)
|
||||
ReturnCode ESDevice::DeleteTicket(const u8* ticket_view)
|
||||
{
|
||||
const auto fs = m_ios.GetFS();
|
||||
const u64 title_id = Common::swap64(ticket_view + offsetof(IOS::ES::TicketView, title_id));
|
||||
@@ -587,7 +590,7 @@ ReturnCode ES::DeleteTicket(const u8* ticket_view)
|
||||
return IPC_SUCCESS;
|
||||
}
|
||||
|
||||
IPCCommandResult ES::DeleteTicket(const IOCtlVRequest& request)
|
||||
IPCCommandResult ESDevice::DeleteTicket(const IOCtlVRequest& request)
|
||||
{
|
||||
if (!request.HasNumberOfValidVectors(1, 0) ||
|
||||
request.in_vectors[0].size != sizeof(IOS::ES::TicketView))
|
||||
@@ -597,7 +600,7 @@ IPCCommandResult ES::DeleteTicket(const IOCtlVRequest& request)
|
||||
return GetDefaultReply(DeleteTicket(Memory::GetPointer(request.in_vectors[0].address)));
|
||||
}
|
||||
|
||||
ReturnCode ES::DeleteTitleContent(u64 title_id) const
|
||||
ReturnCode ESDevice::DeleteTitleContent(u64 title_id) const
|
||||
{
|
||||
if (!CanDeleteTitle(title_id))
|
||||
return ES_EINVAL;
|
||||
@@ -616,14 +619,14 @@ ReturnCode ES::DeleteTitleContent(u64 title_id) const
|
||||
return IPC_SUCCESS;
|
||||
}
|
||||
|
||||
IPCCommandResult ES::DeleteTitleContent(const IOCtlVRequest& request)
|
||||
IPCCommandResult ESDevice::DeleteTitleContent(const IOCtlVRequest& request)
|
||||
{
|
||||
if (!request.HasNumberOfValidVectors(1, 0) || request.in_vectors[0].size != sizeof(u64))
|
||||
return GetDefaultReply(ES_EINVAL);
|
||||
return GetDefaultReply(DeleteTitleContent(Memory::Read_U64(request.in_vectors[0].address)));
|
||||
}
|
||||
|
||||
ReturnCode ES::DeleteContent(u64 title_id, u32 content_id) const
|
||||
ReturnCode ESDevice::DeleteContent(u64 title_id, u32 content_id) const
|
||||
{
|
||||
if (!CanDeleteTitle(title_id))
|
||||
return ES_EINVAL;
|
||||
@@ -641,7 +644,7 @@ ReturnCode ES::DeleteContent(u64 title_id, u32 content_id) const
|
||||
return FS::ConvertResult(m_ios.GetFS()->Delete(PID_KERNEL, PID_KERNEL, path));
|
||||
}
|
||||
|
||||
IPCCommandResult ES::DeleteContent(const IOCtlVRequest& request)
|
||||
IPCCommandResult ESDevice::DeleteContent(const IOCtlVRequest& request)
|
||||
{
|
||||
if (!request.HasNumberOfValidVectors(2, 0) || request.in_vectors[0].size != sizeof(u64) ||
|
||||
request.in_vectors[1].size != sizeof(u32))
|
||||
@@ -652,8 +655,8 @@ IPCCommandResult ES::DeleteContent(const IOCtlVRequest& request)
|
||||
Memory::Read_U32(request.in_vectors[1].address)));
|
||||
}
|
||||
|
||||
ReturnCode ES::ExportTitleInit(Context& context, u64 title_id, u8* tmd_bytes, u32 tmd_size,
|
||||
u64 caller_title_id, u32 caller_title_flags)
|
||||
ReturnCode ESDevice::ExportTitleInit(Context& context, u64 title_id, u8* tmd_bytes, u32 tmd_size,
|
||||
u64 caller_title_id, u32 caller_title_flags)
|
||||
{
|
||||
// No concurrent title import/export is allowed.
|
||||
if (context.title_import_export.valid)
|
||||
@@ -681,7 +684,7 @@ ReturnCode ES::ExportTitleInit(Context& context, u64 title_id, u8* tmd_bytes, u3
|
||||
return IPC_SUCCESS;
|
||||
}
|
||||
|
||||
IPCCommandResult ES::ExportTitleInit(Context& context, const IOCtlVRequest& request)
|
||||
IPCCommandResult ESDevice::ExportTitleInit(Context& context, const IOCtlVRequest& request)
|
||||
{
|
||||
if (!request.HasNumberOfValidVectors(1, 1) || request.in_vectors[0].size != 8)
|
||||
return GetDefaultReply(ES_EINVAL);
|
||||
@@ -695,7 +698,7 @@ IPCCommandResult ES::ExportTitleInit(Context& context, const IOCtlVRequest& requ
|
||||
m_title_context.tmd.GetTitleFlags()));
|
||||
}
|
||||
|
||||
ReturnCode ES::ExportContentBegin(Context& context, u64 title_id, u32 content_id)
|
||||
ReturnCode ESDevice::ExportContentBegin(Context& context, u64 title_id, u32 content_id)
|
||||
{
|
||||
context.title_import_export.content = {};
|
||||
if (!context.title_import_export.valid ||
|
||||
@@ -726,7 +729,7 @@ ReturnCode ES::ExportContentBegin(Context& context, u64 title_id, u32 content_id
|
||||
return static_cast<ReturnCode>(ret);
|
||||
}
|
||||
|
||||
IPCCommandResult ES::ExportContentBegin(Context& context, const IOCtlVRequest& request)
|
||||
IPCCommandResult ESDevice::ExportContentBegin(Context& context, const IOCtlVRequest& request)
|
||||
{
|
||||
if (!request.HasNumberOfValidVectors(2, 0) || request.in_vectors[0].size != 8 ||
|
||||
request.in_vectors[1].size != 4)
|
||||
@@ -738,7 +741,7 @@ IPCCommandResult ES::ExportContentBegin(Context& context, const IOCtlVRequest& r
|
||||
return GetDefaultReply(ExportContentBegin(context, title_id, content_id));
|
||||
}
|
||||
|
||||
ReturnCode ES::ExportContentData(Context& context, u32 content_fd, u8* data, u32 data_size)
|
||||
ReturnCode ESDevice::ExportContentData(Context& context, u32 content_fd, u8* data, u32 data_size)
|
||||
{
|
||||
if (!context.title_import_export.valid || !context.title_import_export.content.valid || !data ||
|
||||
data_size == 0)
|
||||
@@ -772,7 +775,7 @@ ReturnCode ES::ExportContentData(Context& context, u32 content_fd, u8* data, u32
|
||||
return IPC_SUCCESS;
|
||||
}
|
||||
|
||||
IPCCommandResult ES::ExportContentData(Context& context, const IOCtlVRequest& request)
|
||||
IPCCommandResult ESDevice::ExportContentData(Context& context, const IOCtlVRequest& request)
|
||||
{
|
||||
if (!request.HasNumberOfValidVectors(1, 1) || request.in_vectors[0].size != 4 ||
|
||||
request.io_vectors[0].size == 0)
|
||||
@@ -787,14 +790,14 @@ IPCCommandResult ES::ExportContentData(Context& context, const IOCtlVRequest& re
|
||||
return GetDefaultReply(ExportContentData(context, content_fd, data, bytes_to_read));
|
||||
}
|
||||
|
||||
ReturnCode ES::ExportContentEnd(Context& context, u32 content_fd)
|
||||
ReturnCode ESDevice::ExportContentEnd(Context& context, u32 content_fd)
|
||||
{
|
||||
if (!context.title_import_export.valid || !context.title_import_export.content.valid)
|
||||
return ES_EINVAL;
|
||||
return CloseContent(content_fd, 0);
|
||||
}
|
||||
|
||||
IPCCommandResult ES::ExportContentEnd(Context& context, const IOCtlVRequest& request)
|
||||
IPCCommandResult ESDevice::ExportContentEnd(Context& context, const IOCtlVRequest& request)
|
||||
{
|
||||
if (!request.HasNumberOfValidVectors(1, 0) || request.in_vectors[0].size != 4)
|
||||
return GetDefaultReply(ES_EINVAL);
|
||||
@@ -803,18 +806,18 @@ IPCCommandResult ES::ExportContentEnd(Context& context, const IOCtlVRequest& req
|
||||
return GetDefaultReply(ExportContentEnd(context, content_fd));
|
||||
}
|
||||
|
||||
ReturnCode ES::ExportTitleDone(Context& context)
|
||||
ReturnCode ESDevice::ExportTitleDone(Context& context)
|
||||
{
|
||||
ResetTitleImportContext(&context, m_ios.GetIOSC());
|
||||
return IPC_SUCCESS;
|
||||
}
|
||||
|
||||
IPCCommandResult ES::ExportTitleDone(Context& context, const IOCtlVRequest& request)
|
||||
IPCCommandResult ESDevice::ExportTitleDone(Context& context, const IOCtlVRequest& request)
|
||||
{
|
||||
return GetDefaultReply(ExportTitleDone(context));
|
||||
}
|
||||
|
||||
ReturnCode ES::DeleteSharedContent(const std::array<u8, 20>& sha1) const
|
||||
ReturnCode ESDevice::DeleteSharedContent(const std::array<u8, 20>& sha1) const
|
||||
{
|
||||
IOS::ES::SharedContentMap map{m_ios.GetFS()};
|
||||
const auto content_path = map.GetFilenameFromSHA1(sha1);
|
||||
@@ -851,7 +854,7 @@ ReturnCode ES::DeleteSharedContent(const std::array<u8, 20>& sha1) const
|
||||
return IPC_SUCCESS;
|
||||
}
|
||||
|
||||
IPCCommandResult ES::DeleteSharedContent(const IOCtlVRequest& request)
|
||||
IPCCommandResult ESDevice::DeleteSharedContent(const IOCtlVRequest& request)
|
||||
{
|
||||
std::array<u8, 20> sha1;
|
||||
if (!request.HasNumberOfValidVectors(1, 0) || request.in_vectors[0].size != sha1.size())
|
||||
@@ -859,4 +862,4 @@ IPCCommandResult ES::DeleteSharedContent(const IOCtlVRequest& request)
|
||||
Memory::CopyFromEmu(sha1.data(), request.in_vectors[0].address, request.in_vectors[0].size);
|
||||
return GetDefaultReply(DeleteSharedContent(sha1));
|
||||
}
|
||||
} // namespace IOS::HLE::Device
|
||||
} // namespace IOS::HLE
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user