IOS HLE: Specify the return code when replying
This makes more sense than setting the return code on the request struct first before replying. Ref: https://github.com/dolphin-emu/dolphin/pull/4661#discussion_r96273253
This commit is contained in:
parent
c6b1cfb222
commit
25f89ccae8
|
@ -393,24 +393,19 @@ static IPCCommandResult HandleCommand(const IOSRequest& request)
|
|||
{
|
||||
IOSOpenRequest open_request{request.address};
|
||||
const s32 new_fd = OpenDevice(open_request);
|
||||
open_request.SetReturnValue(new_fd);
|
||||
return IWII_IPC_HLE_Device::GetDefaultReply();
|
||||
return IWII_IPC_HLE_Device::GetDefaultReply(new_fd);
|
||||
}
|
||||
|
||||
const auto device = (request.fd < IPC_MAX_FDS) ? s_fdmap[request.fd] : nullptr;
|
||||
if (!device)
|
||||
{
|
||||
request.SetReturnValue(IPC_EINVAL);
|
||||
return IWII_IPC_HLE_Device::GetDefaultReply();
|
||||
}
|
||||
return IWII_IPC_HLE_Device::GetDefaultReply(IPC_EINVAL);
|
||||
|
||||
switch (request.command)
|
||||
{
|
||||
case IPC_CMD_CLOSE:
|
||||
s_fdmap[request.fd].reset();
|
||||
device->Close();
|
||||
request.SetReturnValue(IPC_SUCCESS);
|
||||
return IWII_IPC_HLE_Device::GetDefaultReply();
|
||||
return IWII_IPC_HLE_Device::GetDefaultReply(IPC_SUCCESS);
|
||||
case IPC_CMD_READ:
|
||||
return device->Read(IOSReadWriteRequest{request.address});
|
||||
case IPC_CMD_WRITE:
|
||||
|
@ -423,7 +418,7 @@ static IPCCommandResult HandleCommand(const IOSRequest& request)
|
|||
return device->IOCtlV(IOSIOCtlVRequest{request.address});
|
||||
default:
|
||||
_assert_msg_(WII_IPC_HLE, false, "Unexpected command: %x", request.command);
|
||||
return IWII_IPC_HLE_Device::GetDefaultReply();
|
||||
return IWII_IPC_HLE_Device::GetDefaultReply(IPC_EINVAL);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -439,7 +434,7 @@ void ExecuteCommand(const u32 address)
|
|||
s_last_reply_time = CoreTiming::GetTicks() + result.reply_delay_ticks;
|
||||
|
||||
if (result.send_reply)
|
||||
EnqueueReply(request, static_cast<int>(result.reply_delay_ticks));
|
||||
EnqueueReply(request, result.return_value, static_cast<int>(result.reply_delay_ticks));
|
||||
}
|
||||
|
||||
// Happens AS SOON AS IPC gets a new pointer!
|
||||
|
@ -449,8 +444,10 @@ void EnqueueRequest(u32 address)
|
|||
}
|
||||
|
||||
// Called to send a reply to an IOS syscall
|
||||
void EnqueueReply(const IOSRequest& request, int cycles_in_future, CoreTiming::FromThread from)
|
||||
void EnqueueReply(const IOSRequest& request, const s32 return_value, int cycles_in_future,
|
||||
CoreTiming::FromThread from)
|
||||
{
|
||||
Memory::Write_U32(static_cast<u32>(return_value), request.address + 4);
|
||||
// IOS writes back the command that was responded to in the FD field.
|
||||
Memory::Write_U32(request.command, request.address + 8);
|
||||
// IOS also overwrites the command type with the reply type.
|
||||
|
|
|
@ -18,6 +18,7 @@ class PointerWrap;
|
|||
|
||||
struct IPCCommandResult
|
||||
{
|
||||
s32 return_value;
|
||||
bool send_reply;
|
||||
u64 reply_delay_ticks;
|
||||
};
|
||||
|
@ -70,7 +71,7 @@ void UpdateDevices();
|
|||
void ExecuteCommand(u32 address);
|
||||
|
||||
void EnqueueRequest(u32 address);
|
||||
void EnqueueReply(const IOSRequest& request, int cycles_in_future = 0,
|
||||
void EnqueueReply(const IOSRequest& request, s32 return_value, int cycles_in_future = 0,
|
||||
CoreTiming::FromThread from = CoreTiming::FromThread::CPU);
|
||||
void EnqueueCommandAcknowledgement(u32 address, int cycles_in_future = 0);
|
||||
|
||||
|
|
|
@ -18,11 +18,6 @@ IOSRequest::IOSRequest(const u32 address_) : address(address_)
|
|||
fd = Memory::Read_U32(address + 8);
|
||||
}
|
||||
|
||||
void IOSRequest::SetReturnValue(const s32 new_return_value) const
|
||||
{
|
||||
Memory::Write_U32(static_cast<u32>(new_return_value), address + 4);
|
||||
}
|
||||
|
||||
IOSOpenRequest::IOSOpenRequest(const u32 address_) : IOSRequest(address_)
|
||||
{
|
||||
path = Memory::GetString(Memory::Read_U32(address + 0xc));
|
||||
|
@ -161,19 +156,18 @@ IPCCommandResult IWII_IPC_HLE_Device::Unsupported(const IOSRequest& request)
|
|||
{IPC_CMD_IOCTL, "IOCtl"},
|
||||
{IPC_CMD_IOCTLV, "IOCtlV"}}};
|
||||
WARN_LOG(WII_IPC_HLE, "%s does not support %s()", m_name.c_str(), names[request.command].c_str());
|
||||
request.SetReturnValue(IPC_EINVAL);
|
||||
return GetDefaultReply();
|
||||
return GetDefaultReply(IPC_EINVAL);
|
||||
}
|
||||
|
||||
// Returns an IPCCommandResult for a reply that takes 250 us (arbitrarily chosen value)
|
||||
IPCCommandResult IWII_IPC_HLE_Device::GetDefaultReply()
|
||||
IPCCommandResult IWII_IPC_HLE_Device::GetDefaultReply(const s32 return_value)
|
||||
{
|
||||
return {true, SystemTimers::GetTicksPerSecond() / 4000};
|
||||
return {return_value, true, SystemTimers::GetTicksPerSecond() / 4000};
|
||||
}
|
||||
|
||||
// Returns an IPCCommandResult with no reply. Useful for async commands that will generate a reply
|
||||
// later
|
||||
// later. This takes no return value because it won't be used.
|
||||
IPCCommandResult IWII_IPC_HLE_Device::GetNoReply()
|
||||
{
|
||||
return {false, 0};
|
||||
return {IPC_SUCCESS, false, 0};
|
||||
}
|
||||
|
|
|
@ -47,7 +47,6 @@ struct IOSRequest
|
|||
u32 fd = 0;
|
||||
explicit IOSRequest(u32 address);
|
||||
virtual ~IOSRequest() = default;
|
||||
void SetReturnValue(s32 new_return_value) const;
|
||||
};
|
||||
|
||||
enum IOSOpenMode : s32
|
||||
|
@ -156,7 +155,7 @@ public:
|
|||
virtual void Update() {}
|
||||
virtual DeviceType GetDeviceType() const { return m_device_type; }
|
||||
virtual bool IsOpened() const { return m_is_active; }
|
||||
static IPCCommandResult GetDefaultReply();
|
||||
static IPCCommandResult GetDefaultReply(s32 return_value);
|
||||
static IPCCommandResult GetNoReply();
|
||||
|
||||
protected:
|
||||
|
|
|
@ -74,10 +74,7 @@ void CWII_IPC_HLE_Device_di::FinishIOCtl(DVDInterface::DIInterruptType interrupt
|
|||
// This command has been executed, so it's removed from the queue
|
||||
u32 command_address = m_commands_to_execute.front();
|
||||
m_commands_to_execute.pop_front();
|
||||
IOSIOCtlRequest request{command_address};
|
||||
|
||||
request.SetReturnValue(interrupt_type);
|
||||
WII_IPC_HLE_Interface::EnqueueReply(request);
|
||||
WII_IPC_HLE_Interface::EnqueueReply(IOSIOCtlRequest{command_address}, interrupt_type);
|
||||
|
||||
// DVDInterface is now ready to execute another command,
|
||||
// so we start executing a command from the queue if there is one
|
||||
|
@ -118,6 +115,5 @@ IPCCommandResult CWII_IPC_HLE_Device_di::IOCtlV(const IOSIOCtlVRequest& request)
|
|||
default:
|
||||
request.DumpUnknown(GetDeviceName(), LogTypes::WII_IPC_DVD);
|
||||
}
|
||||
request.SetReturnValue(return_value);
|
||||
return GetDefaultReply();
|
||||
return GetDefaultReply(return_value);
|
||||
}
|
||||
|
|
|
@ -207,8 +207,7 @@ IPCCommandResult CWII_IPC_HLE_Device_FileIO::Seek(const IOSSeekRequest& request)
|
|||
{
|
||||
return_value = FS_ENOENT;
|
||||
}
|
||||
request.SetReturnValue(return_value);
|
||||
return GetDefaultReply();
|
||||
return GetDefaultReply(return_value);
|
||||
}
|
||||
|
||||
IPCCommandResult CWII_IPC_HLE_Device_FileIO::Read(const IOSReadWriteRequest& request)
|
||||
|
@ -247,8 +246,7 @@ IPCCommandResult CWII_IPC_HLE_Device_FileIO::Read(const IOSReadWriteRequest& req
|
|||
return_value = FS_ENOENT;
|
||||
}
|
||||
|
||||
request.SetReturnValue(return_value);
|
||||
return GetDefaultReply();
|
||||
return GetDefaultReply(return_value);
|
||||
}
|
||||
|
||||
IPCCommandResult CWII_IPC_HLE_Device_FileIO::Write(const IOSReadWriteRequest& request)
|
||||
|
@ -283,8 +281,7 @@ IPCCommandResult CWII_IPC_HLE_Device_FileIO::Write(const IOSReadWriteRequest& re
|
|||
return_value = FS_ENOENT;
|
||||
}
|
||||
|
||||
request.SetReturnValue(return_value);
|
||||
return GetDefaultReply();
|
||||
return GetDefaultReply(return_value);
|
||||
}
|
||||
|
||||
IPCCommandResult CWII_IPC_HLE_Device_FileIO::IOCtl(const IOSIOCtlRequest& request)
|
||||
|
@ -314,8 +311,7 @@ IPCCommandResult CWII_IPC_HLE_Device_FileIO::IOCtl(const IOSIOCtlRequest& reques
|
|||
request.Log(GetDeviceName(), LogTypes::WII_IPC_FILEIO, LogTypes::LERROR);
|
||||
}
|
||||
|
||||
request.SetReturnValue(return_value);
|
||||
return GetDefaultReply();
|
||||
return GetDefaultReply(return_value);
|
||||
}
|
||||
|
||||
void CWII_IPC_HLE_Device_FileIO::PrepareForState(PointerWrap::Mode mode)
|
||||
|
|
|
@ -278,8 +278,7 @@ IPCCommandResult CWII_IPC_HLE_Device_es::IOCtlV(const IOSIOCtlVRequest& request)
|
|||
if (!m_addtitle_tmd.IsValid())
|
||||
{
|
||||
ERROR_LOG(WII_IPC_ES, "Invalid TMD while adding title (size = %zd)", tmd.size());
|
||||
request.SetReturnValue(ES_INVALID_TMD);
|
||||
return GetDefaultReply();
|
||||
return GetDefaultReply(ES_INVALID_TMD);
|
||||
}
|
||||
|
||||
// Write the TMD to title storage.
|
||||
|
@ -304,8 +303,7 @@ IPCCommandResult CWII_IPC_HLE_Device_es::IOCtlV(const IOSIOCtlVRequest& request)
|
|||
{
|
||||
ERROR_LOG(WII_IPC_ES, "Trying to add content when we haven't finished adding "
|
||||
"another content. Unsupported.");
|
||||
request.SetReturnValue(ES_WRITE_FAILURE);
|
||||
return GetDefaultReply();
|
||||
return GetDefaultReply(ES_WRITE_FAILURE);
|
||||
}
|
||||
m_addtitle_content_id = content_id;
|
||||
|
||||
|
@ -327,8 +325,7 @@ IPCCommandResult CWII_IPC_HLE_Device_es::IOCtlV(const IOSIOCtlVRequest& request)
|
|||
// no known content installer which performs content addition concurrently.
|
||||
// Instead we just log an error (see above) if this condition is detected.
|
||||
s32 content_fd = 0;
|
||||
request.SetReturnValue(content_fd);
|
||||
return GetDefaultReply();
|
||||
return GetDefaultReply(content_fd);
|
||||
}
|
||||
|
||||
case IOCTL_ES_ADDCONTENTDATA:
|
||||
|
@ -359,8 +356,7 @@ IPCCommandResult CWII_IPC_HLE_Device_es::IOCtlV(const IOSIOCtlVRequest& request)
|
|||
std::vector<u8> ticket = DiscIO::FindSignedTicket(m_addtitle_tmd.GetTitleId());
|
||||
if (ticket.size() == 0)
|
||||
{
|
||||
request.SetReturnValue(ES_NO_TICKET_INSTALLED);
|
||||
return GetDefaultReply();
|
||||
return GetDefaultReply(ES_NO_TICKET_INSTALLED);
|
||||
}
|
||||
|
||||
mbedtls_aes_context aes_ctx;
|
||||
|
@ -371,8 +367,7 @@ IPCCommandResult CWII_IPC_HLE_Device_es::IOCtlV(const IOSIOCtlVRequest& request)
|
|||
TMDReader::Content content_info;
|
||||
if (!m_addtitle_tmd.FindContentById(m_addtitle_content_id, &content_info))
|
||||
{
|
||||
request.SetReturnValue(ES_INVALID_TMD);
|
||||
return GetDefaultReply();
|
||||
return GetDefaultReply(ES_INVALID_TMD);
|
||||
}
|
||||
u8 iv[16] = {0};
|
||||
iv[0] = (content_info.index >> 8) & 0xFF;
|
||||
|
@ -407,8 +402,7 @@ IPCCommandResult CWII_IPC_HLE_Device_es::IOCtlV(const IOSIOCtlVRequest& request)
|
|||
EcWii& ec = EcWii::GetInstance();
|
||||
INFO_LOG(WII_IPC_ES, "IOCTL_ES_GETDEVICEID %08X", ec.getNgId());
|
||||
Memory::Write_U32(ec.getNgId(), request.io_vectors[0].address);
|
||||
request.SetReturnValue(IPC_SUCCESS);
|
||||
return GetDefaultReply();
|
||||
return GetDefaultReply(IPC_SUCCESS);
|
||||
}
|
||||
|
||||
case IOCTL_ES_GETTITLECONTENTSCNT:
|
||||
|
@ -420,6 +414,7 @@ IPCCommandResult CWII_IPC_HLE_Device_es::IOCtlV(const IOSIOCtlVRequest& request)
|
|||
|
||||
const DiscIO::CNANDContentLoader& rNANDContent = AccessContentDevice(TitleID);
|
||||
u16 NumberOfPrivateContent = 0;
|
||||
s32 return_value = IPC_SUCCESS;
|
||||
if (rNANDContent.IsValid()) // Not sure if dolphin will ever fail this check
|
||||
{
|
||||
NumberOfPrivateContent = rNANDContent.GetNumEntries();
|
||||
|
@ -428,19 +423,17 @@ IPCCommandResult CWII_IPC_HLE_Device_es::IOCtlV(const IOSIOCtlVRequest& request)
|
|||
Memory::Write_U32(0, request.io_vectors[0].address);
|
||||
else
|
||||
Memory::Write_U32(NumberOfPrivateContent, request.io_vectors[0].address);
|
||||
|
||||
request.SetReturnValue(IPC_SUCCESS);
|
||||
}
|
||||
else
|
||||
{
|
||||
request.SetReturnValue(static_cast<s32>(rNANDContent.GetContentSize()));
|
||||
return_value = static_cast<s32>(rNANDContent.GetContentSize());
|
||||
}
|
||||
|
||||
INFO_LOG(WII_IPC_ES, "IOCTL_ES_GETTITLECONTENTSCNT: TitleID: %08x/%08x content count %i",
|
||||
(u32)(TitleID >> 32), (u32)TitleID,
|
||||
rNANDContent.IsValid() ? NumberOfPrivateContent : (u32)rNANDContent.GetContentSize());
|
||||
|
||||
return GetDefaultReply();
|
||||
return GetDefaultReply(return_value);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -454,6 +447,7 @@ IPCCommandResult CWII_IPC_HLE_Device_es::IOCtlV(const IOSIOCtlVRequest& request)
|
|||
u64 TitleID = Memory::Read_U64(request.in_vectors[0].address);
|
||||
|
||||
const DiscIO::CNANDContentLoader& rNANDContent = AccessContentDevice(TitleID);
|
||||
s32 return_value = IPC_SUCCESS;
|
||||
if (rNANDContent.IsValid()) // Not sure if dolphin will ever fail this check
|
||||
{
|
||||
for (u16 i = 0; i < rNANDContent.GetNumEntries(); i++)
|
||||
|
@ -463,16 +457,15 @@ IPCCommandResult CWII_IPC_HLE_Device_es::IOCtlV(const IOSIOCtlVRequest& request)
|
|||
INFO_LOG(WII_IPC_ES, "IOCTL_ES_GETTITLECONTENTS: Index %d: %08x", i,
|
||||
rNANDContent.GetContentByIndex(i)->m_ContentID);
|
||||
}
|
||||
request.SetReturnValue(IPC_SUCCESS);
|
||||
}
|
||||
else
|
||||
{
|
||||
request.SetReturnValue(static_cast<s32>(rNANDContent.GetContentSize()));
|
||||
return_value = static_cast<s32>(rNANDContent.GetContentSize());
|
||||
ERROR_LOG(WII_IPC_ES, "IOCTL_ES_GETTITLECONTENTS: Unable to open content %zu",
|
||||
rNANDContent.GetContentSize());
|
||||
}
|
||||
|
||||
return GetDefaultReply();
|
||||
return GetDefaultReply(return_value);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -485,12 +478,11 @@ IPCCommandResult CWII_IPC_HLE_Device_es::IOCtlV(const IOSIOCtlVRequest& request)
|
|||
u32 Index = Memory::Read_U32(request.in_vectors[2].address);
|
||||
|
||||
s32 CFD = OpenTitleContent(m_AccessIdentID++, TitleID, Index);
|
||||
request.SetReturnValue(CFD);
|
||||
|
||||
INFO_LOG(WII_IPC_ES, "IOCTL_ES_OPENTITLECONTENT: TitleID: %08x/%08x Index %i -> got CFD %x",
|
||||
(u32)(TitleID >> 32), (u32)TitleID, Index, CFD);
|
||||
|
||||
return GetDefaultReply();
|
||||
return GetDefaultReply(CFD);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -501,10 +493,9 @@ IPCCommandResult CWII_IPC_HLE_Device_es::IOCtlV(const IOSIOCtlVRequest& request)
|
|||
u32 Index = Memory::Read_U32(request.in_vectors[0].address);
|
||||
|
||||
s32 CFD = OpenTitleContent(m_AccessIdentID++, m_TitleID, Index);
|
||||
request.SetReturnValue(CFD);
|
||||
INFO_LOG(WII_IPC_ES, "IOCTL_ES_OPENCONTENT: Index %i -> got CFD %x", Index, CFD);
|
||||
|
||||
return GetDefaultReply();
|
||||
return GetDefaultReply(CFD);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -520,8 +511,7 @@ IPCCommandResult CWII_IPC_HLE_Device_es::IOCtlV(const IOSIOCtlVRequest& request)
|
|||
auto itr = m_ContentAccessMap.find(CFD);
|
||||
if (itr == m_ContentAccessMap.end())
|
||||
{
|
||||
request.SetReturnValue(-1);
|
||||
return GetDefaultReply();
|
||||
return GetDefaultReply(-1);
|
||||
}
|
||||
SContentAccess& rContent = itr->second;
|
||||
|
||||
|
@ -558,8 +548,7 @@ IPCCommandResult CWII_IPC_HLE_Device_es::IOCtlV(const IOSIOCtlVRequest& request)
|
|||
"IOCTL_ES_READCONTENT: CFD %x, Address 0x%x, Size %i -> stream pos %i (Index %i)",
|
||||
CFD, Addr, Size, rContent.m_Position, rContent.m_Index);
|
||||
|
||||
request.SetReturnValue(Size);
|
||||
return GetDefaultReply();
|
||||
return GetDefaultReply(Size);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -575,8 +564,7 @@ IPCCommandResult CWII_IPC_HLE_Device_es::IOCtlV(const IOSIOCtlVRequest& request)
|
|||
auto itr = m_ContentAccessMap.find(CFD);
|
||||
if (itr == m_ContentAccessMap.end())
|
||||
{
|
||||
request.SetReturnValue(-1);
|
||||
return GetDefaultReply();
|
||||
return GetDefaultReply(-1);
|
||||
}
|
||||
|
||||
const DiscIO::CNANDContentLoader& ContentLoader = AccessContentDevice(itr->second.m_TitleID);
|
||||
|
@ -589,8 +577,7 @@ IPCCommandResult CWII_IPC_HLE_Device_es::IOCtlV(const IOSIOCtlVRequest& request)
|
|||
|
||||
m_ContentAccessMap.erase(itr);
|
||||
|
||||
request.SetReturnValue(IPC_SUCCESS);
|
||||
return GetDefaultReply();
|
||||
return GetDefaultReply(IPC_SUCCESS);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -606,8 +593,7 @@ IPCCommandResult CWII_IPC_HLE_Device_es::IOCtlV(const IOSIOCtlVRequest& request)
|
|||
auto itr = m_ContentAccessMap.find(CFD);
|
||||
if (itr == m_ContentAccessMap.end())
|
||||
{
|
||||
request.SetReturnValue(-1);
|
||||
return GetDefaultReply();
|
||||
return GetDefaultReply(-1);
|
||||
}
|
||||
SContentAccess& rContent = itr->second;
|
||||
|
||||
|
@ -629,8 +615,7 @@ IPCCommandResult CWII_IPC_HLE_Device_es::IOCtlV(const IOSIOCtlVRequest& request)
|
|||
DEBUG_LOG(WII_IPC_ES, "IOCTL_ES_SEEKCONTENT: CFD %x, Address 0x%x, Mode %i -> Pos %i", CFD,
|
||||
Addr, Mode, rContent.m_Position);
|
||||
|
||||
request.SetReturnValue(rContent.m_Position);
|
||||
return GetDefaultReply();
|
||||
return GetDefaultReply(rContent.m_Position);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -683,8 +668,7 @@ IPCCommandResult CWII_IPC_HLE_Device_es::IOCtlV(const IOSIOCtlVRequest& request)
|
|||
|
||||
INFO_LOG(WII_IPC_ES, "IOCTL_ES_GETTITLECNT: Number of Titles %zu", m_TitleIDs.size());
|
||||
|
||||
request.SetReturnValue(IPC_SUCCESS);
|
||||
return GetDefaultReply();
|
||||
return GetDefaultReply(IPC_SUCCESS);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -708,8 +692,7 @@ IPCCommandResult CWII_IPC_HLE_Device_es::IOCtlV(const IOSIOCtlVRequest& request)
|
|||
}
|
||||
|
||||
INFO_LOG(WII_IPC_ES, "IOCTL_ES_GETTITLES: Number of titles returned %i", Count);
|
||||
request.SetReturnValue(IPC_SUCCESS);
|
||||
return GetDefaultReply();
|
||||
return GetDefaultReply(IPC_SUCCESS);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -761,8 +744,7 @@ IPCCommandResult CWII_IPC_HLE_Device_es::IOCtlV(const IOSIOCtlVRequest& request)
|
|||
(u32)(TitleID >> 32), (u32)TitleID, ViewCount);
|
||||
|
||||
Memory::Write_U32(ViewCount, request.io_vectors[0].address);
|
||||
request.SetReturnValue(retVal);
|
||||
return GetDefaultReply();
|
||||
return GetDefaultReply(retVal);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -834,8 +816,7 @@ IPCCommandResult CWII_IPC_HLE_Device_es::IOCtlV(const IOSIOCtlVRequest& request)
|
|||
INFO_LOG(WII_IPC_ES, "IOCTL_ES_GETVIEWS for titleID: %08x/%08x (MaxViews = %i)",
|
||||
(u32)(TitleID >> 32), (u32)TitleID, maxViews);
|
||||
|
||||
request.SetReturnValue(retVal);
|
||||
return GetDefaultReply();
|
||||
return GetDefaultReply(retVal);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -861,11 +842,9 @@ IPCCommandResult CWII_IPC_HLE_Device_es::IOCtlV(const IOSIOCtlVRequest& request)
|
|||
}
|
||||
Memory::Write_U32(TMDViewCnt, request.io_vectors[0].address);
|
||||
|
||||
request.SetReturnValue(IPC_SUCCESS);
|
||||
|
||||
INFO_LOG(WII_IPC_ES, "IOCTL_ES_GETTMDVIEWCNT: title: %08x/%08x (view size %i)",
|
||||
(u32)(TitleID >> 32), (u32)TitleID, TMDViewCnt);
|
||||
return GetDefaultReply();
|
||||
return GetDefaultReply(IPC_SUCCESS);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -912,52 +891,40 @@ IPCCommandResult CWII_IPC_HLE_Device_es::IOCtlV(const IOSIOCtlVRequest& request)
|
|||
_dbg_assert_(WII_IPC_ES,
|
||||
(Address - request.io_vectors[0].address) == request.io_vectors[0].size);
|
||||
}
|
||||
request.SetReturnValue(IPC_SUCCESS);
|
||||
|
||||
INFO_LOG(WII_IPC_ES, "IOCTL_ES_GETTMDVIEWS: title: %08x/%08x (buffer size: %i)",
|
||||
(u32)(TitleID >> 32), (u32)TitleID, MaxCount);
|
||||
return GetDefaultReply();
|
||||
return GetDefaultReply(IPC_SUCCESS);
|
||||
}
|
||||
break;
|
||||
|
||||
case IOCTL_ES_GETCONSUMPTION: // This is at least what crediar's ES module does
|
||||
Memory::Write_U32(0, request.io_vectors[1].address);
|
||||
request.SetReturnValue(IPC_SUCCESS);
|
||||
INFO_LOG(WII_IPC_ES, "IOCTL_ES_GETCONSUMPTION");
|
||||
return GetDefaultReply();
|
||||
return GetDefaultReply(IPC_SUCCESS);
|
||||
|
||||
case IOCTL_ES_DELETETICKET:
|
||||
{
|
||||
u64 TitleID = Memory::Read_U64(request.in_vectors[0].address);
|
||||
INFO_LOG(WII_IPC_ES, "IOCTL_ES_DELETETICKET: title: %08x/%08x", (u32)(TitleID >> 32),
|
||||
(u32)TitleID);
|
||||
if (File::Delete(Common::GetTicketFileName(TitleID, Common::FROM_SESSION_ROOT)))
|
||||
{
|
||||
request.SetReturnValue(IPC_SUCCESS);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Presumably return -1017 when delete fails
|
||||
request.SetReturnValue(ES_PARAMETER_SIZE_OR_ALIGNMENT);
|
||||
if (!File::Delete(Common::GetTicketFileName(TitleID, Common::FROM_SESSION_ROOT)))
|
||||
return GetDefaultReply(ES_PARAMETER_SIZE_OR_ALIGNMENT);
|
||||
return GetDefaultReply(IPC_SUCCESS);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case IOCTL_ES_DELETETITLECONTENT:
|
||||
{
|
||||
u64 TitleID = Memory::Read_U64(request.in_vectors[0].address);
|
||||
INFO_LOG(WII_IPC_ES, "IOCTL_ES_DELETETITLECONTENT: title: %08x/%08x", (u32)(TitleID >> 32),
|
||||
(u32)TitleID);
|
||||
if (DiscIO::CNANDContentManager::Access().RemoveTitle(TitleID, Common::FROM_SESSION_ROOT))
|
||||
{
|
||||
request.SetReturnValue(IPC_SUCCESS);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Presumably return -1017 when title not installed TODO verify
|
||||
request.SetReturnValue(ES_PARAMETER_SIZE_OR_ALIGNMENT);
|
||||
if (!DiscIO::CNANDContentManager::Access().RemoveTitle(TitleID, Common::FROM_SESSION_ROOT))
|
||||
return GetDefaultReply(ES_PARAMETER_SIZE_OR_ALIGNMENT);
|
||||
return GetDefaultReply(IPC_SUCCESS);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case IOCTL_ES_GETSTOREDTMDSIZE:
|
||||
{
|
||||
_dbg_assert_msg_(WII_IPC_ES, request.in_vectors.size() == 1,
|
||||
|
@ -978,11 +945,9 @@ IPCCommandResult CWII_IPC_HLE_Device_es::IOCtlV(const IOSIOCtlVRequest& request)
|
|||
if (request.io_vectors.size())
|
||||
Memory::Write_U32(TMDCnt, request.io_vectors[0].address);
|
||||
|
||||
request.SetReturnValue(IPC_SUCCESS);
|
||||
|
||||
INFO_LOG(WII_IPC_ES, "IOCTL_ES_GETSTOREDTMDSIZE: title: %08x/%08x (view size %i)",
|
||||
(u32)(TitleID >> 32), (u32)TitleID, TMDCnt);
|
||||
return GetDefaultReply();
|
||||
return GetDefaultReply(IPC_SUCCESS);
|
||||
}
|
||||
break;
|
||||
case IOCTL_ES_GETSTOREDTMD:
|
||||
|
@ -1026,11 +991,10 @@ IPCCommandResult CWII_IPC_HLE_Device_es::IOCtlV(const IOSIOCtlVRequest& request)
|
|||
_dbg_assert_(WII_IPC_ES,
|
||||
(Address - request.io_vectors[0].address) == request.io_vectors[0].size);
|
||||
}
|
||||
request.SetReturnValue(IPC_SUCCESS);
|
||||
|
||||
INFO_LOG(WII_IPC_ES, "IOCTL_ES_GETSTOREDTMD: title: %08x/%08x (buffer size: %i)",
|
||||
(u32)(TitleID >> 32), (u32)TitleID, MaxCount);
|
||||
return GetDefaultReply();
|
||||
return GetDefaultReply(IPC_SUCCESS);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -1182,13 +1146,8 @@ IPCCommandResult CWII_IPC_HLE_Device_es::IOCtlV(const IOSIOCtlVRequest& request)
|
|||
Memory::Write_U16(0xFFFF, 0x00003142);
|
||||
Memory::Write_U32(Memory::Read_U32(0x00003140), 0x00003188);
|
||||
|
||||
// TODO: provide correct return code when bSuccess= false
|
||||
// Note: If we just reset the PPC, don't write anything to the command buffer. This
|
||||
// could clobber the DOL we just loaded.
|
||||
if (!bReset)
|
||||
{
|
||||
request.SetReturnValue(IPC_SUCCESS);
|
||||
}
|
||||
|
||||
ERROR_LOG(WII_IPC_ES,
|
||||
"IOCTL_ES_LAUNCH %016" PRIx64 " %08x %016" PRIx64 " %08x %016" PRIx64 " %04x",
|
||||
|
@ -1219,8 +1178,7 @@ IPCCommandResult CWII_IPC_HLE_Device_es::IOCtlV(const IOSIOCtlVRequest& request)
|
|||
// -1017
|
||||
// if the IOS didn't find the Korean keys and 0 if it does. 0 leads to a error 003
|
||||
INFO_LOG(WII_IPC_ES, "IOCTL_ES_CHECKKOREAREGION: Title checked for Korean keys.");
|
||||
request.SetReturnValue(ES_PARAMETER_SIZE_OR_ALIGNMENT);
|
||||
return GetDefaultReply();
|
||||
return GetDefaultReply(ES_PARAMETER_SIZE_OR_ALIGNMENT);
|
||||
|
||||
case IOCTL_ES_GETDEVICECERT: // (Input: none, Output: 384 bytes)
|
||||
{
|
||||
|
@ -1272,8 +1230,7 @@ IPCCommandResult CWII_IPC_HLE_Device_es::IOCtlV(const IOSIOCtlVRequest& request)
|
|||
request.DumpUnknown(GetDeviceName(), LogTypes::WII_IPC_HLE);
|
||||
}
|
||||
|
||||
request.SetReturnValue(IPC_SUCCESS);
|
||||
return GetDefaultReply();
|
||||
return GetDefaultReply(IPC_SUCCESS);
|
||||
}
|
||||
|
||||
const DiscIO::CNANDContentLoader& CWII_IPC_HLE_Device_es::AccessContentDevice(u64 title_id)
|
||||
|
|
|
@ -34,9 +34,9 @@ CWII_IPC_HLE_Device_fs::CWII_IPC_HLE_Device_fs(u32 _DeviceID, const std::string&
|
|||
|
||||
// ~1/1000th of a second is too short and causes hangs in Wii Party
|
||||
// Play it safe at 1/500th
|
||||
IPCCommandResult CWII_IPC_HLE_Device_fs::GetFSReply() const
|
||||
IPCCommandResult CWII_IPC_HLE_Device_fs::GetFSReply(const s32 return_value) const
|
||||
{
|
||||
return {true, SystemTimers::GetTicksPerSecond() / 500};
|
||||
return {return_value, true, SystemTimers::GetTicksPerSecond() / 500};
|
||||
}
|
||||
|
||||
IOSReturnCode CWII_IPC_HLE_Device_fs::Open(const IOSOpenRequest& request)
|
||||
|
@ -224,16 +224,14 @@ IPCCommandResult CWII_IPC_HLE_Device_fs::IOCtlV(const IOSIOCtlVRequest& request)
|
|||
break;
|
||||
}
|
||||
|
||||
request.SetReturnValue(return_value);
|
||||
return GetFSReply();
|
||||
return GetFSReply(return_value);
|
||||
}
|
||||
|
||||
IPCCommandResult CWII_IPC_HLE_Device_fs::IOCtl(const IOSIOCtlRequest& request)
|
||||
{
|
||||
Memory::Memset(request.buffer_out, 0, request.buffer_out_size);
|
||||
const s32 return_value = ExecuteCommand(request);
|
||||
request.SetReturnValue(return_value);
|
||||
return GetFSReply();
|
||||
return GetFSReply(return_value);
|
||||
}
|
||||
|
||||
s32 CWII_IPC_HLE_Device_fs::ExecuteCommand(const IOSIOCtlRequest& request)
|
||||
|
|
|
@ -49,6 +49,6 @@ private:
|
|||
IOCTL_SHUTDOWN = 0x0D
|
||||
};
|
||||
|
||||
IPCCommandResult GetFSReply() const;
|
||||
IPCCommandResult GetFSReply(s32 return_value) const;
|
||||
s32 ExecuteCommand(const IOSIOCtlRequest& request);
|
||||
};
|
||||
|
|
|
@ -39,8 +39,8 @@ void CWII_IPC_HLE_Device_hid::checkUsbUpdates(CWII_IPC_HLE_Device_hid* hid)
|
|||
{
|
||||
IOSIOCtlRequest request{hid->deviceCommandAddress};
|
||||
hid->FillOutDevices(request);
|
||||
request.SetReturnValue(IPC_SUCCESS);
|
||||
WII_IPC_HLE_Interface::EnqueueReply(request, 0, CoreTiming::FromThread::NON_CPU);
|
||||
WII_IPC_HLE_Interface::EnqueueReply(request, IPC_SUCCESS, 0,
|
||||
CoreTiming::FromThread::NON_CPU);
|
||||
hid->deviceCommandAddress = 0;
|
||||
}
|
||||
}
|
||||
|
@ -61,8 +61,7 @@ void CWII_IPC_HLE_Device_hid::handleUsbUpdates(struct libusb_transfer* transfer)
|
|||
}
|
||||
|
||||
IOSIOCtlRequest request{replyAddress};
|
||||
request.SetReturnValue(ret);
|
||||
WII_IPC_HLE_Interface::EnqueueReply(request, 0, CoreTiming::FromThread::NON_CPU);
|
||||
WII_IPC_HLE_Interface::EnqueueReply(request, ret, 0, CoreTiming::FromThread::NON_CPU);
|
||||
}
|
||||
|
||||
CWII_IPC_HLE_Device_hid::CWII_IPC_HLE_Device_hid(u32 _DeviceID, const std::string& _rDeviceName)
|
||||
|
@ -106,8 +105,7 @@ IPCCommandResult CWII_IPC_HLE_Device_hid::IOCtl(const IOSIOCtlRequest& request)
|
|||
{
|
||||
if (Core::g_want_determinism)
|
||||
{
|
||||
request.SetReturnValue(-1);
|
||||
return GetDefaultReply();
|
||||
return GetDefaultReply(IPC_EACCES);
|
||||
}
|
||||
|
||||
s32 return_value = IPC_SUCCESS;
|
||||
|
@ -213,8 +211,7 @@ IPCCommandResult CWII_IPC_HLE_Device_hid::IOCtl(const IOSIOCtlRequest& request)
|
|||
{
|
||||
IOSIOCtlRequest pending_request{deviceCommandAddress};
|
||||
Memory::Write_U32(0xFFFFFFFF, pending_request.buffer_out);
|
||||
pending_request.SetReturnValue(-1);
|
||||
WII_IPC_HLE_Interface::EnqueueReply(pending_request);
|
||||
WII_IPC_HLE_Interface::EnqueueReply(pending_request, -1);
|
||||
deviceCommandAddress = 0;
|
||||
}
|
||||
INFO_LOG(WII_IPC_HID, "HID::IOCtl(Shutdown) (BufferIn: (%08x, %i), BufferOut: (%08x, %i)",
|
||||
|
@ -226,8 +223,7 @@ IPCCommandResult CWII_IPC_HLE_Device_hid::IOCtl(const IOSIOCtlRequest& request)
|
|||
request.Log(GetDeviceName(), LogTypes::WII_IPC_HID);
|
||||
}
|
||||
|
||||
request.SetReturnValue(return_value);
|
||||
return GetDefaultReply();
|
||||
return GetDefaultReply(return_value);
|
||||
}
|
||||
|
||||
bool CWII_IPC_HLE_Device_hid::ClaimDevice(libusb_device_handle* dev)
|
||||
|
@ -260,8 +256,7 @@ IPCCommandResult CWII_IPC_HLE_Device_hid::IOCtlV(const IOSIOCtlVRequest& request
|
|||
{
|
||||
Dolphin_Debugger::PrintCallstack(LogTypes::WII_IPC_HID, LogTypes::LWARNING);
|
||||
request.DumpUnknown(GetDeviceName(), LogTypes::WII_IPC_HID);
|
||||
request.SetReturnValue(IPC_SUCCESS);
|
||||
return GetDefaultReply();
|
||||
return GetDefaultReply(IPC_SUCCESS);
|
||||
}
|
||||
|
||||
void CWII_IPC_HLE_Device_hid::ConvertDeviceToWii(WiiHIDDeviceDescriptor* dest,
|
||||
|
|
|
@ -190,8 +190,7 @@ IPCCommandResult CWII_IPC_HLE_Device_net_kd_request::IOCtl(const IOSIOCtlRequest
|
|||
request.Log(GetDeviceName(), LogTypes::WII_IPC_WC24);
|
||||
}
|
||||
|
||||
request.SetReturnValue(return_value);
|
||||
return GetDefaultReply();
|
||||
return GetDefaultReply(return_value);
|
||||
}
|
||||
|
||||
u8 CWII_IPC_HLE_Device_net_kd_request::GetAreaCode(const std::string& area) const
|
||||
|
@ -390,8 +389,7 @@ IPCCommandResult CWII_IPC_HLE_Device_net_ncd_manage::IOCtlV(const IOSIOCtlVReque
|
|||
{
|
||||
Memory::Write_U32(common_result, request.io_vectors.at(common_vector).address + 4);
|
||||
}
|
||||
request.SetReturnValue(return_value);
|
||||
return GetDefaultReply();
|
||||
return GetDefaultReply(return_value);
|
||||
}
|
||||
|
||||
// **********************************************************************************
|
||||
|
@ -476,8 +474,7 @@ IPCCommandResult CWII_IPC_HLE_Device_net_wd_command::IOCtlV(const IOSIOCtlVReque
|
|||
request.Dump(GetDeviceName(), LogTypes::WII_IPC_NET, LogTypes::LINFO);
|
||||
}
|
||||
|
||||
request.SetReturnValue(return_value);
|
||||
return GetDefaultReply();
|
||||
return GetDefaultReply(return_value);
|
||||
}
|
||||
|
||||
// **********************************************************************************
|
||||
|
@ -553,8 +550,7 @@ IPCCommandResult CWII_IPC_HLE_Device_net_ip_top::IOCtl(const IOSIOCtlRequest& re
|
|||
{
|
||||
if (Core::g_want_determinism)
|
||||
{
|
||||
request.SetReturnValue(-1);
|
||||
return GetDefaultReply();
|
||||
return GetDefaultReply(IPC_EACCES);
|
||||
}
|
||||
|
||||
s32 return_value = 0;
|
||||
|
@ -1060,8 +1056,7 @@ IPCCommandResult CWII_IPC_HLE_Device_net_ip_top::IOCtl(const IOSIOCtlRequest& re
|
|||
request.DumpUnknown(GetDeviceName(), LogTypes::WII_IPC_NET);
|
||||
}
|
||||
|
||||
request.SetReturnValue(return_value);
|
||||
return GetDefaultReply();
|
||||
return GetDefaultReply(return_value);
|
||||
}
|
||||
|
||||
IPCCommandResult CWII_IPC_HLE_Device_net_ip_top::IOCtlV(const IOSIOCtlVRequest& request)
|
||||
|
@ -1371,8 +1366,7 @@ IPCCommandResult CWII_IPC_HLE_Device_net_ip_top::IOCtlV(const IOSIOCtlVRequest&
|
|||
request.DumpUnknown(GetDeviceName(), LogTypes::WII_IPC_NET);
|
||||
}
|
||||
|
||||
request.SetReturnValue(return_value);
|
||||
return GetDefaultReply();
|
||||
return GetDefaultReply(return_value);
|
||||
}
|
||||
|
||||
void CWII_IPC_HLE_Device_net_ip_top::Update()
|
||||
|
|
|
@ -124,8 +124,7 @@ public:
|
|||
|
||||
// write return values
|
||||
Memory::Write_U32(common_result, request.buffer_out);
|
||||
request.SetReturnValue(result);
|
||||
return GetDefaultReply();
|
||||
return GetDefaultReply(result);
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
|
@ -78,8 +78,7 @@ int CWII_IPC_HLE_Device_net_ssl::GetSSLFreeID() const
|
|||
IPCCommandResult CWII_IPC_HLE_Device_net_ssl::IOCtl(const IOSIOCtlRequest& request)
|
||||
{
|
||||
request.Log(GetDeviceName(), LogTypes::WII_IPC_SSL, LogTypes::LINFO);
|
||||
request.SetReturnValue(IPC_SUCCESS);
|
||||
return GetDefaultReply();
|
||||
return GetDefaultReply(IPC_SUCCESS);
|
||||
}
|
||||
|
||||
IPCCommandResult CWII_IPC_HLE_Device_net_ssl::IOCtlV(const IOSIOCtlVRequest& request)
|
||||
|
@ -125,10 +124,7 @@ IPCCommandResult CWII_IPC_HLE_Device_net_ssl::IOCtlV(const IOSIOCtlVRequest& req
|
|||
// I don't trust SSL to be deterministic, and this is never going to sync
|
||||
// as such (as opposed to forwarding IPC results or whatever), so -
|
||||
if (Core::g_want_determinism)
|
||||
{
|
||||
request.SetReturnValue(-1);
|
||||
return GetDefaultReply();
|
||||
}
|
||||
return GetDefaultReply(IPC_EACCES);
|
||||
|
||||
switch (request.request)
|
||||
{
|
||||
|
@ -496,6 +492,5 @@ IPCCommandResult CWII_IPC_HLE_Device_net_ssl::IOCtlV(const IOSIOCtlVRequest& req
|
|||
}
|
||||
|
||||
// SSL return codes are written to BufferIn
|
||||
request.SetReturnValue(IPC_SUCCESS);
|
||||
return GetDefaultReply();
|
||||
return GetDefaultReply(IPC_SUCCESS);
|
||||
}
|
||||
|
|
|
@ -45,8 +45,7 @@ void CWII_IPC_HLE_Device_sdio_slot0::EventNotify()
|
|||
if ((SConfig::GetInstance().m_WiiSDCard && m_event->type == EVENT_INSERT) ||
|
||||
(!SConfig::GetInstance().m_WiiSDCard && m_event->type == EVENT_REMOVE))
|
||||
{
|
||||
m_event->request.SetReturnValue(m_event->type);
|
||||
WII_IPC_HLE_Interface::EnqueueReply(m_event->request);
|
||||
WII_IPC_HLE_Interface::EnqueueReply(m_event->request, m_event->type);
|
||||
m_event.reset();
|
||||
}
|
||||
}
|
||||
|
@ -198,8 +197,7 @@ IPCCommandResult CWII_IPC_HLE_Device_sdio_slot0::IOCtl(const IOSIOCtlRequest& re
|
|||
EventNotify();
|
||||
return GetNoReply();
|
||||
}
|
||||
request.SetReturnValue(return_value);
|
||||
return GetDefaultReply();
|
||||
return GetDefaultReply(return_value);
|
||||
}
|
||||
|
||||
IPCCommandResult CWII_IPC_HLE_Device_sdio_slot0::IOCtlV(const IOSIOCtlVRequest& request)
|
||||
|
@ -220,8 +218,7 @@ IPCCommandResult CWII_IPC_HLE_Device_sdio_slot0::IOCtlV(const IOSIOCtlVRequest&
|
|||
ERROR_LOG(WII_IPC_SD, "Unknown SD IOCtlV command 0x%08x", request.request);
|
||||
}
|
||||
|
||||
request.SetReturnValue(return_value);
|
||||
return GetDefaultReply();
|
||||
return GetDefaultReply(return_value);
|
||||
}
|
||||
|
||||
u32 CWII_IPC_HLE_Device_sdio_slot0::ExecuteCommand(const IOSRequest& request, u32 _BufferIn,
|
||||
|
@ -394,8 +391,7 @@ u32 CWII_IPC_HLE_Device_sdio_slot0::ExecuteCommand(const IOSRequest& request, u3
|
|||
// release returns 0
|
||||
// unknown sd int
|
||||
// technically we do it out of order, oh well
|
||||
m_event->request.SetReturnValue(EVENT_INVALID);
|
||||
WII_IPC_HLE_Interface::EnqueueReply(m_event->request);
|
||||
WII_IPC_HLE_Interface::EnqueueReply(m_event->request, EVENT_INVALID);
|
||||
m_event.reset();
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -37,8 +37,7 @@ IPCCommandResult CWII_IPC_HLE_Device_stm_immediate::IOCtl(const IOSIOCtlRequest&
|
|||
break;
|
||||
}
|
||||
Memory::Write_U32(0, s_event_hook_request->buffer_out);
|
||||
s_event_hook_request->SetReturnValue(IPC_SUCCESS);
|
||||
WII_IPC_HLE_Interface::EnqueueReply(*s_event_hook_request);
|
||||
WII_IPC_HLE_Interface::EnqueueReply(*s_event_hook_request, IPC_SUCCESS);
|
||||
s_event_hook_request.reset();
|
||||
break;
|
||||
|
||||
|
@ -63,8 +62,7 @@ IPCCommandResult CWII_IPC_HLE_Device_stm_immediate::IOCtl(const IOSIOCtlRequest&
|
|||
request.DumpUnknown(GetDeviceName(), LogTypes::WII_IPC_STM);
|
||||
}
|
||||
|
||||
request.SetReturnValue(return_value);
|
||||
return GetDefaultReply();
|
||||
return GetDefaultReply(return_value);
|
||||
}
|
||||
|
||||
void CWII_IPC_HLE_Device_stm_eventhook::Close()
|
||||
|
@ -78,15 +76,11 @@ IPCCommandResult CWII_IPC_HLE_Device_stm_eventhook::IOCtl(const IOSIOCtlRequest&
|
|||
if (request.request != IOCTL_STM_EVENTHOOK)
|
||||
{
|
||||
ERROR_LOG(WII_IPC_STM, "Bad IOCtl in CWII_IPC_HLE_Device_stm_eventhook");
|
||||
request.SetReturnValue(IPC_EINVAL);
|
||||
return GetDefaultReply();
|
||||
return GetDefaultReply(IPC_EINVAL);
|
||||
}
|
||||
|
||||
if (s_event_hook_request)
|
||||
{
|
||||
request.SetReturnValue(IPC_EEXIST);
|
||||
return GetDefaultReply();
|
||||
}
|
||||
return GetDefaultReply(IPC_EEXIST);
|
||||
|
||||
// IOCTL_STM_EVENTHOOK waits until the reset button or power button is pressed.
|
||||
s_event_hook_request = std::make_unique<IOSIOCtlRequest>(request.address);
|
||||
|
@ -105,8 +99,7 @@ void CWII_IPC_HLE_Device_stm_eventhook::TriggerEvent(const u32 event) const
|
|||
return;
|
||||
|
||||
Memory::Write_U32(event, s_event_hook_request->buffer_out);
|
||||
s_event_hook_request->SetReturnValue(IPC_SUCCESS);
|
||||
WII_IPC_HLE_Interface::EnqueueReply(*s_event_hook_request);
|
||||
WII_IPC_HLE_Interface::EnqueueReply(*s_event_hook_request, IPC_SUCCESS);
|
||||
s_event_hook_request.reset();
|
||||
}
|
||||
|
||||
|
|
|
@ -26,13 +26,11 @@ void CWII_IPC_HLE_Device_stub::Close()
|
|||
IPCCommandResult CWII_IPC_HLE_Device_stub::IOCtl(const IOSIOCtlRequest& request)
|
||||
{
|
||||
WARN_LOG(WII_IPC_HLE, "%s faking IOCtl()", m_name.c_str());
|
||||
request.SetReturnValue(IPC_SUCCESS);
|
||||
return GetDefaultReply();
|
||||
return GetDefaultReply(IPC_SUCCESS);
|
||||
}
|
||||
|
||||
IPCCommandResult CWII_IPC_HLE_Device_stub::IOCtlV(const IOSIOCtlVRequest& request)
|
||||
{
|
||||
WARN_LOG(WII_IPC_HLE, "%s faking IOCtlV()", m_name.c_str());
|
||||
request.SetReturnValue(IPC_SUCCESS);
|
||||
return GetDefaultReply();
|
||||
return GetDefaultReply(IPC_SUCCESS);
|
||||
}
|
||||
|
|
|
@ -226,8 +226,7 @@ IPCCommandResult CWII_IPC_HLE_Device_usb_oh1_57e_305_emu::IOCtlV(const IOSIOCtlV
|
|||
request.DumpUnknown(GetDeviceName(), LogTypes::WII_IPC_WIIMOTE);
|
||||
}
|
||||
|
||||
request.SetReturnValue(IPC_SUCCESS);
|
||||
return send_reply ? GetDefaultReply() : GetNoReply();
|
||||
return send_reply ? GetDefaultReply(IPC_SUCCESS) : GetNoReply();
|
||||
}
|
||||
|
||||
// Here we handle the USBV0_IOCTL_BLKMSG Ioctlv
|
||||
|
@ -268,8 +267,8 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305_emu::SendACLPacket(u16 connection_handl
|
|||
// Write the packet to the buffer
|
||||
memcpy(reinterpret_cast<u8*>(header) + sizeof(hci_acldata_hdr_t), data, header->length);
|
||||
|
||||
m_ACLEndpoint->ios_request.SetReturnValue(sizeof(hci_acldata_hdr_t) + size);
|
||||
WII_IPC_HLE_Interface::EnqueueReply(m_ACLEndpoint->ios_request);
|
||||
WII_IPC_HLE_Interface::EnqueueReply(m_ACLEndpoint->ios_request,
|
||||
sizeof(hci_acldata_hdr_t) + size);
|
||||
m_ACLEndpoint.reset();
|
||||
}
|
||||
else
|
||||
|
@ -296,9 +295,8 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305_emu::AddEventToQueue(const SQueuedEvent
|
|||
DEBUG_LOG(WII_IPC_WIIMOTE, "HCI endpoint valid, sending packet to %08x",
|
||||
m_HCIEndpoint->ios_request.address);
|
||||
m_HCIEndpoint->FillBuffer(_event.m_buffer, _event.m_size);
|
||||
m_HCIEndpoint->ios_request.SetReturnValue(_event.m_size);
|
||||
// Send a reply to indicate HCI buffer is filled
|
||||
WII_IPC_HLE_Interface::EnqueueReply(m_HCIEndpoint->ios_request);
|
||||
WII_IPC_HLE_Interface::EnqueueReply(m_HCIEndpoint->ios_request, _event.m_size);
|
||||
m_HCIEndpoint.reset();
|
||||
}
|
||||
else // push new one, pop oldest
|
||||
|
@ -312,9 +310,8 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305_emu::AddEventToQueue(const SQueuedEvent
|
|||
((hci_event_hdr_t*)event.m_buffer)->event, m_EventQueue.size() - 1,
|
||||
m_HCIEndpoint->ios_request.address);
|
||||
m_HCIEndpoint->FillBuffer(event.m_buffer, event.m_size);
|
||||
m_HCIEndpoint->ios_request.SetReturnValue(event.m_size);
|
||||
// Send a reply to indicate HCI buffer is filled
|
||||
WII_IPC_HLE_Interface::EnqueueReply(m_HCIEndpoint->ios_request);
|
||||
WII_IPC_HLE_Interface::EnqueueReply(m_HCIEndpoint->ios_request, event.m_size);
|
||||
m_HCIEndpoint.reset();
|
||||
m_EventQueue.pop_front();
|
||||
}
|
||||
|
@ -338,9 +335,8 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305_emu::Update()
|
|||
((hci_event_hdr_t*)event.m_buffer)->event, m_EventQueue.size() - 1,
|
||||
m_HCIEndpoint->ios_request.address);
|
||||
m_HCIEndpoint->FillBuffer(event.m_buffer, event.m_size);
|
||||
m_HCIEndpoint->ios_request.SetReturnValue(event.m_size);
|
||||
// Send a reply to indicate HCI buffer is filled
|
||||
WII_IPC_HLE_Interface::EnqueueReply(m_HCIEndpoint->ios_request);
|
||||
WII_IPC_HLE_Interface::EnqueueReply(m_HCIEndpoint->ios_request, event.m_size);
|
||||
m_HCIEndpoint.reset();
|
||||
m_EventQueue.pop_front();
|
||||
}
|
||||
|
@ -434,11 +430,9 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305_emu::ACLPool::WriteToEndpoint(CtrlBuffe
|
|||
// Write the packet to the buffer
|
||||
std::copy(data, data + size, (u8*)pHeader + sizeof(hci_acldata_hdr_t));
|
||||
|
||||
endpoint.ios_request.SetReturnValue(sizeof(hci_acldata_hdr_t) + size);
|
||||
|
||||
m_queue.pop_front();
|
||||
|
||||
WII_IPC_HLE_Interface::EnqueueReply(endpoint.ios_request);
|
||||
WII_IPC_HLE_Interface::EnqueueReply(endpoint.ios_request, sizeof(hci_acldata_hdr_t) + size);
|
||||
}
|
||||
|
||||
bool CWII_IPC_HLE_Device_usb_oh1_57e_305_emu::SendEventInquiryComplete()
|
||||
|
@ -1158,7 +1152,7 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305_emu::ExecuteHCICommandMessage(
|
|||
}
|
||||
|
||||
// HCI command is finished, send a reply to command
|
||||
WII_IPC_HLE_Interface::EnqueueReply(ctrl_message.ios_request);
|
||||
WII_IPC_HLE_Interface::EnqueueReply(ctrl_message.ios_request, ctrl_message.length);
|
||||
}
|
||||
|
||||
//
|
||||
|
|
|
@ -393,8 +393,7 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305_real::FakeVendorCommandReply(CtrlBuffer
|
|||
hci_event->PayloadLength = sizeof(SHCIEventCommand) - 2;
|
||||
hci_event->PacketIndicator = 0x01;
|
||||
hci_event->Opcode = m_fake_vendor_command_reply_opcode;
|
||||
ctrl.ios_request.SetReturnValue(sizeof(SHCIEventCommand));
|
||||
WII_IPC_HLE_Interface::EnqueueReply(ctrl.ios_request);
|
||||
WII_IPC_HLE_Interface::EnqueueReply(ctrl.ios_request, static_cast<s32>(sizeof(SHCIEventCommand)));
|
||||
}
|
||||
|
||||
// Due to how the widcomm stack which Nintendo uses is coded, we must never
|
||||
|
@ -419,8 +418,9 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305_real::FakeReadBufferSizeReply(CtrlBuffe
|
|||
reply.num_sco_pkts = SCO_PKT_NUM;
|
||||
|
||||
memcpy(packet + sizeof(SHCIEventCommand), &reply, sizeof(hci_read_buffer_size_rp));
|
||||
ctrl.ios_request.SetReturnValue(sizeof(SHCIEventCommand) + sizeof(hci_read_buffer_size_rp));
|
||||
WII_IPC_HLE_Interface::EnqueueReply(ctrl.ios_request);
|
||||
WII_IPC_HLE_Interface::EnqueueReply(
|
||||
ctrl.ios_request,
|
||||
static_cast<s32>(sizeof(SHCIEventCommand) + sizeof(hci_read_buffer_size_rp)));
|
||||
}
|
||||
|
||||
void CWII_IPC_HLE_Device_usb_oh1_57e_305_real::FakeSyncButtonEvent(CtrlBuffer& ctrl,
|
||||
|
@ -431,8 +431,8 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305_real::FakeSyncButtonEvent(CtrlBuffer& c
|
|||
hci_event->event = HCI_EVENT_VENDOR;
|
||||
hci_event->length = size;
|
||||
memcpy(packet + sizeof(hci_event_hdr_t), payload, size);
|
||||
ctrl.ios_request.SetReturnValue(sizeof(hci_event_hdr_t) + size);
|
||||
WII_IPC_HLE_Interface::EnqueueReply(ctrl.ios_request);
|
||||
WII_IPC_HLE_Interface::EnqueueReply(ctrl.ios_request,
|
||||
static_cast<s32>(sizeof(hci_event_hdr_t) + size));
|
||||
}
|
||||
|
||||
// When the red sync button is pressed, a HCI event is generated:
|
||||
|
@ -578,7 +578,8 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305_real::CommandCallback(libusb_transfer*
|
|||
s_showed_failed_transfer.Clear();
|
||||
}
|
||||
|
||||
WII_IPC_HLE_Interface::EnqueueReply(cmd->ios_request, 0, CoreTiming::FromThread::NON_CPU);
|
||||
WII_IPC_HLE_Interface::EnqueueReply(cmd->ios_request, tr->actual_length, 0,
|
||||
CoreTiming::FromThread::NON_CPU);
|
||||
}
|
||||
|
||||
void CWII_IPC_HLE_Device_usb_oh1_57e_305_real::TransferCallback(libusb_transfer* tr)
|
||||
|
@ -622,6 +623,6 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305_real::TransferCallback(libusb_transfer*
|
|||
}
|
||||
}
|
||||
|
||||
ctrl->ios_request.SetReturnValue(tr->actual_length);
|
||||
WII_IPC_HLE_Interface::EnqueueReply(ctrl->ios_request, 0, CoreTiming::FromThread::NON_CPU);
|
||||
WII_IPC_HLE_Interface::EnqueueReply(ctrl->ios_request, tr->actual_length, 0,
|
||||
CoreTiming::FromThread::NON_CPU);
|
||||
}
|
||||
|
|
|
@ -65,8 +65,7 @@ IPCCommandResult CWII_IPC_HLE_Device_usb_kbd::IOCtl(const IOSIOCtlRequest& reque
|
|||
Memory::CopyToEmu(request.buffer_out, &m_MessageQueue.front(), sizeof(SMessageData));
|
||||
m_MessageQueue.pop();
|
||||
}
|
||||
request.SetReturnValue(IPC_SUCCESS);
|
||||
return GetDefaultReply();
|
||||
return GetDefaultReply(IPC_SUCCESS);
|
||||
}
|
||||
|
||||
bool CWII_IPC_HLE_Device_usb_kbd::IsKeyPressed(int _Key)
|
||||
|
|
|
@ -15,21 +15,19 @@ CWII_IPC_HLE_Device_usb_ven::CWII_IPC_HLE_Device_usb_ven(const u32 device_id,
|
|||
IPCCommandResult CWII_IPC_HLE_Device_usb_ven::IOCtlV(const IOSIOCtlVRequest& request)
|
||||
{
|
||||
request.Dump(GetDeviceName());
|
||||
request.SetReturnValue(IPC_SUCCESS);
|
||||
return GetNoReply();
|
||||
}
|
||||
|
||||
IPCCommandResult CWII_IPC_HLE_Device_usb_ven::IOCtl(const IOSIOCtlRequest& request)
|
||||
{
|
||||
request.Log(GetDeviceName(), LogTypes::OSHLE);
|
||||
request.SetReturnValue(IPC_SUCCESS);
|
||||
|
||||
IPCCommandResult reply = GetDefaultReply();
|
||||
IPCCommandResult reply = GetDefaultReply(IPC_SUCCESS);
|
||||
switch (request.request)
|
||||
{
|
||||
case USBV5_IOCTL_GETVERSION:
|
||||
Memory::Write_U32(0x50001, request.buffer_out);
|
||||
reply = GetDefaultReply();
|
||||
reply = GetDefaultReply(IPC_SUCCESS);
|
||||
break;
|
||||
|
||||
case USBV5_IOCTL_GETDEVICECHANGE:
|
||||
|
@ -38,24 +36,24 @@ IPCCommandResult CWII_IPC_HLE_Device_usb_ven::IOCtl(const IOSIOCtlRequest& reque
|
|||
static bool firstcall = true;
|
||||
if (firstcall)
|
||||
{
|
||||
reply = GetDefaultReply();
|
||||
reply = GetDefaultReply(IPC_SUCCESS);
|
||||
firstcall = false;
|
||||
}
|
||||
|
||||
// num devices
|
||||
request.SetReturnValue(0);
|
||||
reply = GetDefaultReply(0);
|
||||
return reply;
|
||||
}
|
||||
break;
|
||||
|
||||
case USBV5_IOCTL_ATTACHFINISH:
|
||||
reply = GetDefaultReply();
|
||||
reply = GetDefaultReply(IPC_SUCCESS);
|
||||
break;
|
||||
|
||||
case USBV5_IOCTL_SUSPEND_RESUME:
|
||||
DEBUG_LOG(OSHLE, "Device: %i Resumed: %i", Memory::Read_U32(request.buffer_in),
|
||||
Memory::Read_U32(request.buffer_in + 4));
|
||||
reply = GetDefaultReply();
|
||||
reply = GetDefaultReply(IPC_SUCCESS);
|
||||
break;
|
||||
|
||||
case USBV5_IOCTL_GETDEVPARAMS:
|
||||
|
@ -67,7 +65,7 @@ IPCCommandResult CWII_IPC_HLE_Device_usb_ven::IOCtl(const IOSIOCtlRequest& reque
|
|||
|
||||
Memory::Write_U32(0, request.buffer_out);
|
||||
|
||||
reply = GetDefaultReply();
|
||||
reply = GetDefaultReply(IPC_SUCCESS);
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
|
@ -157,8 +157,7 @@ IPCCommandResult CWII_IPC_HLE_Device_usb_wfssrv::IOCtl(const IOSIOCtlRequest& re
|
|||
break;
|
||||
}
|
||||
|
||||
request.SetReturnValue(return_error_code);
|
||||
return GetDefaultReply();
|
||||
return GetDefaultReply(return_error_code);
|
||||
}
|
||||
|
||||
CWII_IPC_HLE_Device_usb_wfssrv::FileDescriptor*
|
||||
|
|
|
@ -238,6 +238,5 @@ IPCCommandResult CWII_IPC_HLE_Device_wfsi::IOCtl(const IOSIOCtlRequest& request)
|
|||
break;
|
||||
}
|
||||
|
||||
request.SetReturnValue(return_error_code);
|
||||
return GetDefaultReply();
|
||||
return GetDefaultReply(return_error_code);
|
||||
}
|
||||
|
|
|
@ -567,8 +567,7 @@ void WiiSocket::Update(bool read, bool write, bool except)
|
|||
"IOCTL(V) Sock: %08x ioctl/v: %d returned: %d nonBlock: %d forceNonBlock: %d", fd,
|
||||
it->is_ssl ? (int)it->ssl_type : (int)it->net_type, ReturnValue, nonBlock,
|
||||
forceNonBlock);
|
||||
it->request.SetReturnValue(ReturnValue);
|
||||
WII_IPC_HLE_Interface::EnqueueReply(it->request);
|
||||
WII_IPC_HLE_Interface::EnqueueReply(it->request, ReturnValue);
|
||||
it = pending_sockops.erase(it);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -230,8 +230,7 @@ public:
|
|||
{
|
||||
ERROR_LOG(WII_IPC_NET, "DoSock: Error, fd not found (%08x, %08X, %08X)", sock,
|
||||
request.address, type);
|
||||
request.SetReturnValue(-SO_EBADF);
|
||||
WII_IPC_HLE_Interface::EnqueueReply(request);
|
||||
WII_IPC_HLE_Interface::EnqueueReply(request, -SO_EBADF);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue