Merge pull request #4375 from leoetlino/ipc-hle-small-cleanup
IPC_HLE: Small cleanup
This commit is contained in:
commit
c84ab13e81
|
@ -137,6 +137,8 @@ set(SRCS ActionReplay.cpp
|
|||
IPC_HLE/ICMPLin.cpp
|
||||
IPC_HLE/NWC24Config.cpp
|
||||
IPC_HLE/WII_IPC_HLE.cpp
|
||||
IPC_HLE/WII_IPC_HLE_Device.cpp
|
||||
IPC_HLE/WII_IPC_HLE_Device_stub.cpp
|
||||
IPC_HLE/WII_IPC_HLE_Device_DI.cpp
|
||||
IPC_HLE/WII_IPC_HLE_Device_es.cpp
|
||||
IPC_HLE/WII_IPC_HLE_Device_FileIO.cpp
|
||||
|
|
|
@ -171,6 +171,8 @@
|
|||
<ClCompile Include="IPC_HLE\NWC24Config.cpp" />
|
||||
<ClCompile Include="IPC_HLE\WiiMote_HID_Attr.cpp" />
|
||||
<ClCompile Include="IPC_HLE\WII_IPC_HLE.cpp" />
|
||||
<ClCompile Include="IPC_HLE\WII_IPC_HLE_Device.cpp" />
|
||||
<ClCompile Include="IPC_HLE\WII_IPC_HLE_Device_stub.cpp" />
|
||||
<ClCompile Include="IPC_HLE\WII_IPC_HLE_Device_DI.cpp" />
|
||||
<ClCompile Include="IPC_HLE\WII_IPC_HLE_Device_es.cpp" />
|
||||
<ClCompile Include="IPC_HLE\WII_IPC_HLE_Device_FileIO.cpp" />
|
||||
|
@ -388,6 +390,7 @@
|
|||
<ClInclude Include="IPC_HLE\WiiMote_HID_Attr.h" />
|
||||
<ClInclude Include="IPC_HLE\WII_IPC_HLE.h" />
|
||||
<ClInclude Include="IPC_HLE\WII_IPC_HLE_Device.h" />
|
||||
<ClInclude Include="IPC_HLE\WII_IPC_HLE_Device_stub.h" />
|
||||
<ClInclude Include="IPC_HLE\WII_IPC_HLE_Device_DI.h" />
|
||||
<ClInclude Include="IPC_HLE\WII_IPC_HLE_Device_es.h" />
|
||||
<ClInclude Include="IPC_HLE\WII_IPC_HLE_Device_FileIO.h" />
|
||||
|
|
|
@ -555,6 +555,12 @@
|
|||
<ClCompile Include="IPC_HLE\WII_IPC_HLE.cpp">
|
||||
<Filter>IPC HLE %28IOS/Starlet%29</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="IPC_HLE\WII_IPC_HLE_Device.cpp">
|
||||
<Filter>IPC HLE %28IOS/Starlet%29</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="IPC_HLE\WII_IPC_HLE_Device_stub.cpp">
|
||||
<Filter>IPC HLE %28IOS/Starlet%29</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="IPC_HLE\WII_IPC_HLE_Device_DI.cpp">
|
||||
<Filter>IPC HLE %28IOS/Starlet%29\DI</Filter>
|
||||
</ClCompile>
|
||||
|
@ -1127,6 +1133,9 @@
|
|||
<ClInclude Include="IPC_HLE\WII_IPC_HLE_Device.h">
|
||||
<Filter>IPC HLE %28IOS/Starlet%29</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="IPC_HLE\WII_IPC_HLE_Device_stub.h">
|
||||
<Filter>IPC HLE %28IOS/Starlet%29</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="IPC_HLE\WII_IPC_HLE_Device_stm.h">
|
||||
<Filter>IPC HLE %28IOS/Starlet%29</Filter>
|
||||
</ClInclude>
|
||||
|
|
|
@ -20,27 +20,23 @@ in case of success they are
|
|||
They will also generate a true or false return for UpdateInterrupts() in WII_IPC.cpp.
|
||||
*/
|
||||
|
||||
#include <list>
|
||||
#include <deque>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "Common/Assert.h"
|
||||
#include "Common/ChunkFile.h"
|
||||
#include "Common/CommonPaths.h"
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Common/FileUtil.h"
|
||||
#include "Common/Thread.h"
|
||||
|
||||
#include "Common/Logging/Log.h"
|
||||
#include "Core/ConfigManager.h"
|
||||
#include "Core/Core.h"
|
||||
#include "Core/CoreTiming.h"
|
||||
#include "Core/Debugger/Debugger_SymbolMap.h"
|
||||
#include "Core/HW/CPU.h"
|
||||
#include "Core/HW/Memmap.h"
|
||||
#include "Core/HW/SystemTimers.h"
|
||||
#include "Core/HW/WII_IPC.h"
|
||||
|
||||
#include "Core/IPC_HLE/WII_IPC_HLE.h"
|
||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device.h"
|
||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device_DI.h"
|
||||
|
@ -51,17 +47,21 @@ They will also generate a true or false return for UpdateInterrupts() in WII_IPC
|
|||
#include "Core/IPC_HLE/WII_IPC_HLE_Device_net_ssl.h"
|
||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device_sdio_slot0.h"
|
||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device_stm.h"
|
||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device_stub.h"
|
||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device_usb_bt_emu.h"
|
||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device_usb_bt_real.h"
|
||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device_usb_kbd.h"
|
||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device_usb_ven.h"
|
||||
|
||||
namespace CoreTiming
|
||||
{
|
||||
struct EventType;
|
||||
} // namespace CoreTiming
|
||||
|
||||
#if defined(__LIBUSB__)
|
||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device_hid.h"
|
||||
#endif
|
||||
|
||||
#include "Core/PowerPC/PowerPC.h"
|
||||
|
||||
namespace WII_IPC_HLE_Interface
|
||||
{
|
||||
static std::map<u32, std::shared_ptr<IWII_IPC_HLE_Device>> s_device_map;
|
||||
|
@ -553,14 +553,7 @@ void ExecuteCommand(u32 address)
|
|||
s_last_reply_time = CoreTiming::GetTicks() + result.reply_delay_ticks;
|
||||
|
||||
if (result.send_reply)
|
||||
{
|
||||
// The original hardware overwrites the command type with the async reply type.
|
||||
Memory::Write_U32(IPC_REP_ASYNC, address);
|
||||
// IOS also seems to write back the command that was responded to in the FD field.
|
||||
Memory::Write_U32(Command, address + 8);
|
||||
// Generate a reply to the IPC command
|
||||
EnqueueReply(address, (int)result.reply_delay_ticks);
|
||||
}
|
||||
EnqueueReply(address, static_cast<int>(result.reply_delay_ticks));
|
||||
}
|
||||
|
||||
// Happens AS SOON AS IPC gets a new pointer!
|
||||
|
@ -569,12 +562,13 @@ void EnqueueRequest(u32 address)
|
|||
CoreTiming::ScheduleEvent(1000, s_event_enqueue, address | ENQUEUE_REQUEST_FLAG);
|
||||
}
|
||||
|
||||
// Called when IOS module has some reply
|
||||
// NOTE: Only call this if you have correctly handled
|
||||
// CommandAddress+0 and CommandAddress+8.
|
||||
// Please search for examples of this being called elsewhere.
|
||||
// Called to send a reply to an IOS syscall
|
||||
void EnqueueReply(u32 address, int cycles_in_future, CoreTiming::FromThread from)
|
||||
{
|
||||
// IOS writes back the command that was responded to in the FD field.
|
||||
Memory::Write_U32(Memory::Read_U32(address), address + 8);
|
||||
// IOS also overwrites the command type with the async reply type.
|
||||
Memory::Write_U32(IPC_REP_ASYNC, address);
|
||||
CoreTiming::ScheduleEvent(cycles_in_future, s_event_enqueue, address, from);
|
||||
}
|
||||
|
||||
|
@ -631,12 +625,3 @@ void UpdateDevices()
|
|||
}
|
||||
|
||||
} // end of namespace WII_IPC_HLE_Interface
|
||||
|
||||
// TODO: create WII_IPC_HLE_Device.cpp ?
|
||||
void IWII_IPC_HLE_Device::DoStateShared(PointerWrap& p)
|
||||
{
|
||||
p.Do(m_Name);
|
||||
p.Do(m_DeviceID);
|
||||
p.Do(m_Hardware);
|
||||
p.Do(m_Active);
|
||||
}
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
#include <vector>
|
||||
|
||||
#include "Common/CommonTypes.h"
|
||||
|
||||
#include "Core/CoreTiming.h"
|
||||
#include "Core/HW/SystemTimers.h"
|
||||
|
||||
|
|
|
@ -0,0 +1,181 @@
|
|||
// Copyright 2016 Dolphin Emulator Project
|
||||
// Licensed under GPLv2+
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include "Core/IPC_HLE/WII_IPC_HLE.h"
|
||||
#include "Common/StringUtil.h"
|
||||
#include "Core/HW/Memmap.h"
|
||||
#include "Core/HW/SystemTimers.h"
|
||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device.h"
|
||||
|
||||
SIOCtlVBuffer::SIOCtlVBuffer(const u32 address) : m_Address(address)
|
||||
{
|
||||
// These are the Ioctlv parameters in the IOS communication. The BufferVector
|
||||
// is a memory address offset at where the in and out buffer addresses are
|
||||
// stored.
|
||||
Parameter = Memory::Read_U32(m_Address + 0x0C); // command 3, arg0
|
||||
NumberInBuffer = Memory::Read_U32(m_Address + 0x10); // 4, arg1
|
||||
NumberPayloadBuffer = Memory::Read_U32(m_Address + 0x14); // 5, arg2
|
||||
BufferVector = Memory::Read_U32(m_Address + 0x18); // 6, arg3
|
||||
|
||||
// The start of the out buffer
|
||||
u32 BufferVectorOffset = BufferVector;
|
||||
|
||||
// Write the address and size for all in messages
|
||||
for (u32 i = 0; i < NumberInBuffer; i++)
|
||||
{
|
||||
SBuffer Buffer;
|
||||
Buffer.m_Address = Memory::Read_U32(BufferVectorOffset);
|
||||
BufferVectorOffset += 4;
|
||||
Buffer.m_Size = Memory::Read_U32(BufferVectorOffset);
|
||||
BufferVectorOffset += 4;
|
||||
InBuffer.push_back(Buffer);
|
||||
DEBUG_LOG(WII_IPC_HLE, "SIOCtlVBuffer in%i: 0x%08x, 0x%x", i, Buffer.m_Address, Buffer.m_Size);
|
||||
}
|
||||
|
||||
// Write the address and size for all out or in-out messages
|
||||
for (u32 i = 0; i < NumberPayloadBuffer; i++)
|
||||
{
|
||||
SBuffer Buffer;
|
||||
Buffer.m_Address = Memory::Read_U32(BufferVectorOffset);
|
||||
BufferVectorOffset += 4;
|
||||
Buffer.m_Size = Memory::Read_U32(BufferVectorOffset);
|
||||
BufferVectorOffset += 4;
|
||||
PayloadBuffer.push_back(Buffer);
|
||||
DEBUG_LOG(WII_IPC_HLE, "SIOCtlVBuffer io%i: 0x%08x, 0x%x", i, Buffer.m_Address, Buffer.m_Size);
|
||||
}
|
||||
}
|
||||
|
||||
IWII_IPC_HLE_Device::IWII_IPC_HLE_Device(const u32 device_id, const std::string& device_name,
|
||||
const bool hardware)
|
||||
: m_Name(device_name), m_DeviceID(device_id), m_Hardware(hardware)
|
||||
{
|
||||
}
|
||||
|
||||
void IWII_IPC_HLE_Device::DoState(PointerWrap& p)
|
||||
{
|
||||
DoStateShared(p);
|
||||
p.Do(m_Active);
|
||||
}
|
||||
|
||||
void IWII_IPC_HLE_Device::DoStateShared(PointerWrap& p)
|
||||
{
|
||||
p.Do(m_Name);
|
||||
p.Do(m_DeviceID);
|
||||
p.Do(m_Hardware);
|
||||
p.Do(m_Active);
|
||||
}
|
||||
|
||||
IPCCommandResult IWII_IPC_HLE_Device::Open(u32 command_address, u32 mode)
|
||||
{
|
||||
WARN_LOG(WII_IPC_HLE, "%s does not support Open()", m_Name.c_str());
|
||||
Memory::Write_U32(FS_ENOENT, command_address + 4);
|
||||
m_Active = true;
|
||||
return GetDefaultReply();
|
||||
}
|
||||
|
||||
IPCCommandResult IWII_IPC_HLE_Device::Close(u32 command_address, bool force)
|
||||
{
|
||||
WARN_LOG(WII_IPC_HLE, "%s does not support Close()", m_Name.c_str());
|
||||
if (!force)
|
||||
Memory::Write_U32(FS_EINVAL, command_address + 4);
|
||||
m_Active = false;
|
||||
return GetDefaultReply();
|
||||
}
|
||||
|
||||
IPCCommandResult IWII_IPC_HLE_Device::Seek(u32 command_address)
|
||||
{
|
||||
WARN_LOG(WII_IPC_HLE, "%s does not support Seek()", m_Name.c_str());
|
||||
return GetDefaultReply();
|
||||
}
|
||||
|
||||
IPCCommandResult IWII_IPC_HLE_Device::Read(u32 command_address)
|
||||
{
|
||||
WARN_LOG(WII_IPC_HLE, "%s does not support Read()", m_Name.c_str());
|
||||
return GetDefaultReply();
|
||||
}
|
||||
|
||||
IPCCommandResult IWII_IPC_HLE_Device::Write(u32 command_address)
|
||||
{
|
||||
WARN_LOG(WII_IPC_HLE, "%s does not support Write()", m_Name.c_str());
|
||||
return GetDefaultReply();
|
||||
}
|
||||
|
||||
IPCCommandResult IWII_IPC_HLE_Device::IOCtl(u32 command_address)
|
||||
{
|
||||
WARN_LOG(WII_IPC_HLE, "%s does not support IOCtl()", m_Name.c_str());
|
||||
return GetDefaultReply();
|
||||
}
|
||||
|
||||
IPCCommandResult IWII_IPC_HLE_Device::IOCtlV(u32 command_address)
|
||||
{
|
||||
WARN_LOG(WII_IPC_HLE, "%s does not support IOCtlV()", m_Name.c_str());
|
||||
return GetDefaultReply();
|
||||
}
|
||||
|
||||
// Returns an IPCCommandResult for a reply that takes 250 us (arbitrarily chosen value)
|
||||
IPCCommandResult IWII_IPC_HLE_Device::GetDefaultReply()
|
||||
{
|
||||
return {true, SystemTimers::GetTicksPerSecond() / 4000};
|
||||
}
|
||||
|
||||
// Returns an IPCCommandResult with no reply. Useful for async commands that will generate a reply
|
||||
// later
|
||||
IPCCommandResult IWII_IPC_HLE_Device::GetNoReply()
|
||||
{
|
||||
return {false, 0};
|
||||
}
|
||||
|
||||
// Write out the IPC struct from command_address to num_commands numbers
|
||||
// of 4 byte commands.
|
||||
void IWII_IPC_HLE_Device::DumpCommands(u32 command_address, size_t num_commands,
|
||||
LogTypes::LOG_TYPE log_type, LogTypes::LOG_LEVELS verbosity)
|
||||
{
|
||||
GENERIC_LOG(log_type, verbosity, "CommandDump of %s", GetDeviceName().c_str());
|
||||
for (u32 i = 0; i < num_commands; i++)
|
||||
{
|
||||
GENERIC_LOG(log_type, verbosity, " Command%02i: 0x%08x", i,
|
||||
Memory::Read_U32(command_address + i * 4));
|
||||
}
|
||||
}
|
||||
|
||||
void IWII_IPC_HLE_Device::DumpAsync(u32 buffer_vector, u32 number_in_buffer, u32 number_io_buffer,
|
||||
LogTypes::LOG_TYPE log_type, LogTypes::LOG_LEVELS verbosity)
|
||||
{
|
||||
GENERIC_LOG(log_type, verbosity, "======= DumpAsync ======");
|
||||
|
||||
u32 BufferOffset = buffer_vector;
|
||||
for (u32 i = 0; i < number_in_buffer; i++)
|
||||
{
|
||||
u32 InBuffer = Memory::Read_U32(BufferOffset);
|
||||
BufferOffset += 4;
|
||||
u32 InBufferSize = Memory::Read_U32(BufferOffset);
|
||||
BufferOffset += 4;
|
||||
|
||||
GENERIC_LOG(log_type, LogTypes::LINFO, "%s - IOCtlV InBuffer[%i]:", GetDeviceName().c_str(), i);
|
||||
|
||||
std::string Temp;
|
||||
for (u32 j = 0; j < InBufferSize; j++)
|
||||
{
|
||||
Temp += StringFromFormat("%02x ", Memory::Read_U8(InBuffer + j));
|
||||
}
|
||||
|
||||
GENERIC_LOG(log_type, LogTypes::LDEBUG, " Buffer: %s", Temp.c_str());
|
||||
}
|
||||
|
||||
for (u32 i = 0; i < number_io_buffer; i++)
|
||||
{
|
||||
u32 OutBuffer = Memory::Read_U32(BufferOffset);
|
||||
BufferOffset += 4;
|
||||
u32 OutBufferSize = Memory::Read_U32(BufferOffset);
|
||||
BufferOffset += 4;
|
||||
|
||||
GENERIC_LOG(log_type, LogTypes::LINFO, "%s - IOCtlV OutBuffer[%i]:", GetDeviceName().c_str(),
|
||||
i);
|
||||
GENERIC_LOG(log_type, LogTypes::LINFO, " OutBuffer: 0x%08x (0x%x):", OutBuffer,
|
||||
OutBufferSize);
|
||||
|
||||
if (verbosity >= LogTypes::LOG_LEVELS::LINFO)
|
||||
DumpCommands(OutBuffer, OutBufferSize, log_type, verbosity);
|
||||
}
|
||||
}
|
|
@ -4,13 +4,14 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <queue>
|
||||
#include <cstddef>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "Common/ChunkFile.h"
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Common/Logging/Log.h"
|
||||
#include "Common/StringUtil.h"
|
||||
#include "Core/HW/Memmap.h"
|
||||
#include "Core/IPC_HLE/WII_IPC_HLE.h"
|
||||
|
||||
#define FS_SUCCESS (u32)0 // Success
|
||||
|
@ -41,53 +42,13 @@
|
|||
// A struct for IOS ioctlv calls
|
||||
struct SIOCtlVBuffer
|
||||
{
|
||||
SIOCtlVBuffer(u32 _Address) : m_Address(_Address)
|
||||
{
|
||||
// These are the Ioctlv parameters in the IOS communication. The BufferVector
|
||||
// is a memory address offset at where the in and out buffer addresses are
|
||||
// stored.
|
||||
Parameter = Memory::Read_U32(m_Address + 0x0C); // command 3, arg0
|
||||
NumberInBuffer = Memory::Read_U32(m_Address + 0x10); // 4, arg1
|
||||
NumberPayloadBuffer = Memory::Read_U32(m_Address + 0x14); // 5, arg2
|
||||
BufferVector = Memory::Read_U32(m_Address + 0x18); // 6, arg3
|
||||
|
||||
// The start of the out buffer
|
||||
u32 BufferVectorOffset = BufferVector;
|
||||
|
||||
// Write the address and size for all in messages
|
||||
for (u32 i = 0; i < NumberInBuffer; i++)
|
||||
{
|
||||
SBuffer Buffer;
|
||||
Buffer.m_Address = Memory::Read_U32(BufferVectorOffset);
|
||||
BufferVectorOffset += 4;
|
||||
Buffer.m_Size = Memory::Read_U32(BufferVectorOffset);
|
||||
BufferVectorOffset += 4;
|
||||
InBuffer.push_back(Buffer);
|
||||
DEBUG_LOG(WII_IPC_HLE, "SIOCtlVBuffer in%i: 0x%08x, 0x%x", i, Buffer.m_Address,
|
||||
Buffer.m_Size);
|
||||
}
|
||||
|
||||
// Write the address and size for all out or in-out messages
|
||||
for (u32 i = 0; i < NumberPayloadBuffer; i++)
|
||||
{
|
||||
SBuffer Buffer;
|
||||
Buffer.m_Address = Memory::Read_U32(BufferVectorOffset);
|
||||
BufferVectorOffset += 4;
|
||||
Buffer.m_Size = Memory::Read_U32(BufferVectorOffset);
|
||||
BufferVectorOffset += 4;
|
||||
PayloadBuffer.push_back(Buffer);
|
||||
DEBUG_LOG(WII_IPC_HLE, "SIOCtlVBuffer io%i: 0x%08x, 0x%x", i, Buffer.m_Address,
|
||||
Buffer.m_Size);
|
||||
}
|
||||
}
|
||||
explicit SIOCtlVBuffer(u32 address);
|
||||
|
||||
const u32 m_Address;
|
||||
|
||||
u32 Parameter;
|
||||
u32 NumberInBuffer;
|
||||
u32 NumberPayloadBuffer;
|
||||
u32 BufferVector;
|
||||
|
||||
struct SBuffer
|
||||
{
|
||||
u32 m_Address, m_Size;
|
||||
|
@ -99,164 +60,45 @@ struct SIOCtlVBuffer
|
|||
class IWII_IPC_HLE_Device
|
||||
{
|
||||
public:
|
||||
IWII_IPC_HLE_Device(u32 _DeviceID, const std::string& _rName, bool _Hardware = true)
|
||||
: m_Name(_rName), m_DeviceID(_DeviceID), m_Hardware(_Hardware), m_Active(false)
|
||||
{
|
||||
}
|
||||
IWII_IPC_HLE_Device(u32 device_id, const std::string& device_name, bool hardware = true);
|
||||
|
||||
virtual ~IWII_IPC_HLE_Device() {}
|
||||
virtual ~IWII_IPC_HLE_Device() = default;
|
||||
// Release any resources which might interfere with savestating.
|
||||
virtual void PrepareForState(PointerWrap::Mode mode) {}
|
||||
virtual void DoState(PointerWrap& p)
|
||||
{
|
||||
DoStateShared(p);
|
||||
p.Do(m_Active);
|
||||
}
|
||||
|
||||
virtual void DoState(PointerWrap& p);
|
||||
void DoStateShared(PointerWrap& p);
|
||||
|
||||
const std::string& GetDeviceName() const { return m_Name; }
|
||||
u32 GetDeviceID() const { return m_DeviceID; }
|
||||
virtual IPCCommandResult Open(u32 _CommandAddress, u32 _Mode)
|
||||
{
|
||||
(void)_Mode;
|
||||
WARN_LOG(WII_IPC_HLE, "%s does not support Open()", m_Name.c_str());
|
||||
Memory::Write_U32(FS_ENOENT, _CommandAddress + 4);
|
||||
m_Active = true;
|
||||
return GetDefaultReply();
|
||||
}
|
||||
|
||||
virtual IPCCommandResult Close(u32 _CommandAddress, bool _bForce = false)
|
||||
{
|
||||
WARN_LOG(WII_IPC_HLE, "%s does not support Close()", m_Name.c_str());
|
||||
if (!_bForce)
|
||||
Memory::Write_U32(FS_EINVAL, _CommandAddress + 4);
|
||||
m_Active = false;
|
||||
return GetDefaultReply();
|
||||
}
|
||||
|
||||
#define UNIMPLEMENTED_CMD(cmd) \
|
||||
WARN_LOG(WII_IPC_HLE, "%s does not support " #cmd "()", m_Name.c_str()); \
|
||||
return GetDefaultReply();
|
||||
virtual IPCCommandResult Seek(u32) { UNIMPLEMENTED_CMD(Seek) }
|
||||
virtual IPCCommandResult Read(u32) { UNIMPLEMENTED_CMD(Read) }
|
||||
virtual IPCCommandResult Write(u32) { UNIMPLEMENTED_CMD(Write) }
|
||||
virtual IPCCommandResult IOCtl(u32) { UNIMPLEMENTED_CMD(IOCtl) }
|
||||
virtual IPCCommandResult IOCtlV(u32) { UNIMPLEMENTED_CMD(IOCtlV) }
|
||||
#undef UNIMPLEMENTED_CMD
|
||||
virtual IPCCommandResult Open(u32 command_address, u32 mode);
|
||||
virtual IPCCommandResult Close(u32 command_address, bool force = false);
|
||||
virtual IPCCommandResult Seek(u32 command_address);
|
||||
virtual IPCCommandResult Read(u32 command_address);
|
||||
virtual IPCCommandResult Write(u32 command_address);
|
||||
virtual IPCCommandResult IOCtl(u32 command_address);
|
||||
virtual IPCCommandResult IOCtlV(u32 command_address);
|
||||
|
||||
virtual u32 Update() { return 0; }
|
||||
virtual bool IsHardware() { return m_Hardware; }
|
||||
virtual bool IsOpened() { return m_Active; }
|
||||
// Returns an IPCCommandResult for a reply that takes 250 us (arbitrarily chosen value)
|
||||
static IPCCommandResult GetDefaultReply()
|
||||
{
|
||||
return {true, SystemTimers::GetTicksPerSecond() / 4000};
|
||||
}
|
||||
// Returns an IPCCommandResult with no reply. Useful for async commands that will generate a reply
|
||||
// later
|
||||
static IPCCommandResult GetNoReply() { return {false, 0}; }
|
||||
virtual bool IsHardware() const { return m_Hardware; }
|
||||
virtual bool IsOpened() const { return m_Active; }
|
||||
static IPCCommandResult GetDefaultReply();
|
||||
static IPCCommandResult GetNoReply();
|
||||
|
||||
std::string m_Name;
|
||||
|
||||
protected:
|
||||
// STATE_TO_SAVE
|
||||
u32 m_DeviceID;
|
||||
bool m_Hardware;
|
||||
bool m_Active;
|
||||
bool m_Active = false;
|
||||
|
||||
// Write out the IPC struct from _CommandAddress to _NumberOfCommands numbers
|
||||
// Write out the IPC struct from command_address to number_of_commands numbers
|
||||
// of 4 byte commands.
|
||||
void DumpCommands(u32 _CommandAddress, size_t _NumberOfCommands = 8,
|
||||
LogTypes::LOG_TYPE LogType = LogTypes::WII_IPC_HLE,
|
||||
LogTypes::LOG_LEVELS Verbosity = LogTypes::LDEBUG)
|
||||
{
|
||||
GENERIC_LOG(LogType, Verbosity, "CommandDump of %s", GetDeviceName().c_str());
|
||||
for (u32 i = 0; i < _NumberOfCommands; i++)
|
||||
{
|
||||
GENERIC_LOG(LogType, Verbosity, " Command%02i: 0x%08x", i,
|
||||
Memory::Read_U32(_CommandAddress + i * 4));
|
||||
}
|
||||
}
|
||||
void DumpCommands(u32 command_address, size_t number_of_commands = 8,
|
||||
LogTypes::LOG_TYPE log_type = LogTypes::WII_IPC_HLE,
|
||||
LogTypes::LOG_LEVELS verbosity = LogTypes::LDEBUG);
|
||||
|
||||
void DumpAsync(u32 BufferVector, u32 NumberInBuffer, u32 NumberOutBuffer,
|
||||
LogTypes::LOG_TYPE LogType = LogTypes::WII_IPC_HLE,
|
||||
LogTypes::LOG_LEVELS Verbosity = LogTypes::LDEBUG)
|
||||
{
|
||||
GENERIC_LOG(LogType, Verbosity, "======= DumpAsync ======");
|
||||
|
||||
u32 BufferOffset = BufferVector;
|
||||
for (u32 i = 0; i < NumberInBuffer; i++)
|
||||
{
|
||||
u32 InBuffer = Memory::Read_U32(BufferOffset);
|
||||
BufferOffset += 4;
|
||||
u32 InBufferSize = Memory::Read_U32(BufferOffset);
|
||||
BufferOffset += 4;
|
||||
|
||||
GENERIC_LOG(LogType, LogTypes::LINFO, "%s - IOCtlV InBuffer[%i]:", GetDeviceName().c_str(),
|
||||
i);
|
||||
|
||||
std::string Temp;
|
||||
for (u32 j = 0; j < InBufferSize; j++)
|
||||
{
|
||||
Temp += StringFromFormat("%02x ", Memory::Read_U8(InBuffer + j));
|
||||
}
|
||||
|
||||
GENERIC_LOG(LogType, LogTypes::LDEBUG, " Buffer: %s", Temp.c_str());
|
||||
}
|
||||
|
||||
for (u32 i = 0; i < NumberOutBuffer; i++)
|
||||
{
|
||||
u32 OutBuffer = Memory::Read_U32(BufferOffset);
|
||||
BufferOffset += 4;
|
||||
u32 OutBufferSize = Memory::Read_U32(BufferOffset);
|
||||
BufferOffset += 4;
|
||||
|
||||
GENERIC_LOG(LogType, LogTypes::LINFO, "%s - IOCtlV OutBuffer[%i]:", GetDeviceName().c_str(),
|
||||
i);
|
||||
GENERIC_LOG(LogType, LogTypes::LINFO, " OutBuffer: 0x%08x (0x%x):", OutBuffer,
|
||||
OutBufferSize);
|
||||
|
||||
if (Verbosity >= LogTypes::LOG_LEVELS::LINFO)
|
||||
DumpCommands(OutBuffer, OutBufferSize, LogType, Verbosity);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
class CWII_IPC_HLE_Device_stub : public IWII_IPC_HLE_Device
|
||||
{
|
||||
public:
|
||||
CWII_IPC_HLE_Device_stub(u32 DeviceID, const std::string& Name)
|
||||
: IWII_IPC_HLE_Device(DeviceID, Name)
|
||||
{
|
||||
}
|
||||
|
||||
IPCCommandResult Open(u32 CommandAddress, u32 Mode) override
|
||||
{
|
||||
(void)Mode;
|
||||
WARN_LOG(WII_IPC_HLE, "%s faking Open()", m_Name.c_str());
|
||||
Memory::Write_U32(GetDeviceID(), CommandAddress + 4);
|
||||
m_Active = true;
|
||||
return GetDefaultReply();
|
||||
}
|
||||
IPCCommandResult Close(u32 CommandAddress, bool bForce = false) override
|
||||
{
|
||||
WARN_LOG(WII_IPC_HLE, "%s faking Close()", m_Name.c_str());
|
||||
if (!bForce)
|
||||
Memory::Write_U32(FS_SUCCESS, CommandAddress + 4);
|
||||
m_Active = false;
|
||||
return GetDefaultReply();
|
||||
}
|
||||
|
||||
IPCCommandResult IOCtl(u32 CommandAddress) override
|
||||
{
|
||||
WARN_LOG(WII_IPC_HLE, "%s faking IOCtl()", m_Name.c_str());
|
||||
Memory::Write_U32(FS_SUCCESS, CommandAddress + 4);
|
||||
return GetDefaultReply();
|
||||
}
|
||||
IPCCommandResult IOCtlV(u32 CommandAddress) override
|
||||
{
|
||||
WARN_LOG(WII_IPC_HLE, "%s faking IOCtlV()", m_Name.c_str());
|
||||
Memory::Write_U32(FS_SUCCESS, CommandAddress + 4);
|
||||
return GetDefaultReply();
|
||||
}
|
||||
void DumpAsync(u32 buffer_vector, u32 number_in_buffer, u32 number_io_buffer,
|
||||
LogTypes::LOG_TYPE log_type = LogTypes::WII_IPC_HLE,
|
||||
LogTypes::LOG_LEVELS verbosity = LogTypes::LDEBUG);
|
||||
};
|
||||
|
|
|
@ -4,15 +4,15 @@
|
|||
|
||||
#include <cinttypes>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include "Common/Assert.h"
|
||||
#include "Common/ChunkFile.h"
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Common/Logging/LogManager.h"
|
||||
#include "Core/ConfigManager.h"
|
||||
#include "Core/CoreTiming.h"
|
||||
#include "Common/Logging/Log.h"
|
||||
#include "Common/MsgHandler.h"
|
||||
#include "Core/HW/DVDInterface.h"
|
||||
#include "Core/HW/Memmap.h"
|
||||
#include "Core/HW/SystemTimers.h"
|
||||
#include "Core/IPC_HLE/WII_IPC_HLE.h"
|
||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device_DI.h"
|
||||
#include "DiscIO/Volume.h"
|
||||
|
@ -107,12 +107,6 @@ void CWII_IPC_HLE_Device_di::FinishIOCtl(DVDInterface::DIInterruptType interrupt
|
|||
|
||||
// The DI interrupt type is used as a return value
|
||||
Memory::Write_U32(interrupt_type, command_address + 4);
|
||||
|
||||
// The original hardware overwrites the command type with the async reply type.
|
||||
Memory::Write_U32(IPC_REP_ASYNC, command_address);
|
||||
// IOS also seems to write back the command that was responded to in the FD field.
|
||||
Memory::Write_U32(Memory::Read_U32(command_address), command_address + 8);
|
||||
// Generate a reply to the IPC command
|
||||
WII_IPC_HLE_Interface::EnqueueReply(command_address);
|
||||
|
||||
// DVDInterface is now ready to execute another command,
|
||||
|
|
|
@ -5,9 +5,14 @@
|
|||
#pragma once
|
||||
|
||||
#include <deque>
|
||||
#include <string>
|
||||
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Core/IPC_HLE/WII_IPC_HLE.h"
|
||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device.h"
|
||||
|
||||
class PointerWrap;
|
||||
|
||||
namespace DVDInterface
|
||||
{
|
||||
enum DIInterruptType : int;
|
||||
|
|
|
@ -2,18 +2,18 @@
|
|||
// Licensed under GPLv2+
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstdio>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
|
||||
#include "Common/ChunkFile.h"
|
||||
#include "Common/CommonPaths.h"
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Common/FileUtil.h"
|
||||
#include "Common/Logging/Log.h"
|
||||
#include "Common/MsgHandler.h"
|
||||
#include "Common/NandPaths.h"
|
||||
#include "Common/StringUtil.h"
|
||||
|
||||
#include "Core/Core.h"
|
||||
#include "Core/HW/Memmap.h"
|
||||
#include "Core/IPC_HLE/WII_IPC_HLE.h"
|
||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device_FileIO.h"
|
||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device_fs.h"
|
||||
|
@ -93,11 +93,9 @@ void HLE_IPC_CreateVirtualFATFilesystem()
|
|||
}
|
||||
}
|
||||
|
||||
CWII_IPC_HLE_Device_FileIO::CWII_IPC_HLE_Device_FileIO(u32 _DeviceID,
|
||||
const std::string& _rDeviceName)
|
||||
: IWII_IPC_HLE_Device(_DeviceID, _rDeviceName, false) // not a real hardware
|
||||
,
|
||||
m_Mode(0), m_SeekPos(0), m_file()
|
||||
CWII_IPC_HLE_Device_FileIO::CWII_IPC_HLE_Device_FileIO(u32 device_id,
|
||||
const std::string& device_name)
|
||||
: IWII_IPC_HLE_Device(device_id, device_name, false) // not a real hardware
|
||||
{
|
||||
Common::ReadReplacements(replacements);
|
||||
}
|
||||
|
|
|
@ -5,9 +5,14 @@
|
|||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "Common/ChunkFile.h"
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Core/IPC_HLE/WII_IPC_HLE.h"
|
||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device.h"
|
||||
|
||||
class PointerWrap;
|
||||
|
||||
namespace File
|
||||
{
|
||||
class IOFile;
|
||||
|
@ -75,8 +80,8 @@ private:
|
|||
ISFS_IOCTL_SHUTDOWN = 13
|
||||
};
|
||||
|
||||
u32 m_Mode;
|
||||
u32 m_SeekPos;
|
||||
u32 m_Mode = 0;
|
||||
u32 m_SeekPos = 0;
|
||||
|
||||
std::string m_filepath;
|
||||
std::shared_ptr<File::IOFile> m_file;
|
||||
|
|
|
@ -31,21 +31,27 @@
|
|||
*/
|
||||
// =============
|
||||
|
||||
// need to include this before mbedtls/aes.h,
|
||||
// otherwise we may not get __STDC_FORMAT_MACROS
|
||||
#include <cinttypes>
|
||||
#include <mbedtls/aes.h>
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include <mbedtls/aes.h>
|
||||
|
||||
#include "Common/Assert.h"
|
||||
#include "Common/ChunkFile.h"
|
||||
#include "Common/CommonPaths.h"
|
||||
#include "Common/CommonFuncs.h"
|
||||
#include "Common/FileUtil.h"
|
||||
#include "Common/Logging/Log.h"
|
||||
#include "Common/MsgHandler.h"
|
||||
#include "Common/NandPaths.h"
|
||||
#include "Common/StringUtil.h"
|
||||
#include "Core/Boot/Boot_DOL.h"
|
||||
#include "Core/ConfigManager.h"
|
||||
#include "Core/HW/DVDInterface.h"
|
||||
#include "Core/HW/Memmap.h"
|
||||
#include "Core/HW/Wiimote.h"
|
||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device_es.h"
|
||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device_usb_bt_emu.h"
|
||||
#include "Core/IPC_HLE/WII_IPC_HLE_WiiMote.h"
|
||||
|
|
|
@ -9,9 +9,12 @@
|
|||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Core/IPC_HLE/WII_IPC_HLE.h"
|
||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device.h"
|
||||
|
||||
class PointerWrap;
|
||||
|
||||
namespace DiscIO
|
||||
{
|
||||
class CNANDContentLoader;
|
||||
|
|
|
@ -4,14 +4,20 @@
|
|||
|
||||
#include <algorithm>
|
||||
#include <cstring>
|
||||
#include <deque>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include "Common/Assert.h"
|
||||
#include "Common/ChunkFile.h"
|
||||
#include "Common/CommonPaths.h"
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Common/FileUtil.h"
|
||||
#include "Common/Logging/Log.h"
|
||||
#include "Common/MsgHandler.h"
|
||||
#include "Common/NandPaths.h"
|
||||
#include "Common/StringUtil.h"
|
||||
|
||||
#include "Core/HW/Memmap.h"
|
||||
#include "Core/HW/SystemTimers.h"
|
||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device_FileIO.h"
|
||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device_fs.h"
|
||||
|
@ -28,6 +34,13 @@ CWII_IPC_HLE_Device_fs::~CWII_IPC_HLE_Device_fs()
|
|||
{
|
||||
}
|
||||
|
||||
// ~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
|
||||
{
|
||||
return {true, SystemTimers::GetTicksPerSecond() / 500};
|
||||
}
|
||||
|
||||
IPCCommandResult CWII_IPC_HLE_Device_fs::Open(u32 _CommandAddress, u32 _Mode)
|
||||
{
|
||||
// clear tmp folder
|
||||
|
|
|
@ -4,6 +4,10 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Core/IPC_HLE/WII_IPC_HLE.h"
|
||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device.h"
|
||||
|
||||
class PointerWrap;
|
||||
|
@ -60,9 +64,7 @@ private:
|
|||
IOCTL_SHUTDOWN = 0x0D
|
||||
};
|
||||
|
||||
// ~1/1000th of a second is too short and causes hangs in Wii Party
|
||||
// Play it safe at 1/500th
|
||||
IPCCommandResult GetFSReply() const { return {true, SystemTimers::GetTicksPerSecond() / 500}; }
|
||||
IPCCommandResult GetFSReply() const;
|
||||
s32 ExecuteCommand(u32 Parameter, u32 _BufferIn, u32 _BufferInSize, u32 _BufferOut,
|
||||
u32 _BufferOutSize);
|
||||
};
|
||||
|
|
|
@ -2,14 +2,20 @@
|
|||
// Licensed under GPLv2+
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include <cerrno>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include <libusb.h>
|
||||
|
||||
#include "Common/Thread.h"
|
||||
#include "Common/CommonFuncs.h"
|
||||
#include "Common/Logging/Log.h"
|
||||
#include "Core/Core.h"
|
||||
#include "Core/CoreTiming.h"
|
||||
#include "Core/Debugger/Debugger_SymbolMap.h"
|
||||
#include "Core/HW/WII_IPC.h"
|
||||
#include "Core/HW/Memmap.h"
|
||||
#include "Core/IPC_HLE/WII_IPC_HLE.h"
|
||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device_hid.h"
|
||||
|
||||
|
@ -33,14 +39,8 @@ void CWII_IPC_HLE_Device_hid::checkUsbUpdates(CWII_IPC_HLE_Device_hid* hid)
|
|||
hid->FillOutDevices(Memory::Read_U32(hid->deviceCommandAddress + 0x18),
|
||||
Memory::Read_U32(hid->deviceCommandAddress + 0x1C));
|
||||
|
||||
// The original hardware overwrites the command type with the async reply type.
|
||||
Memory::Write_U32(IPC_REP_ASYNC, hid->deviceCommandAddress);
|
||||
// IOS also seems to write back the command that was responded to in the FD field.
|
||||
Memory::Write_U32(IPC_CMD_IOCTL, hid->deviceCommandAddress + 8);
|
||||
|
||||
// Return value
|
||||
Memory::Write_U32(0, hid->deviceCommandAddress + 4);
|
||||
|
||||
WII_IPC_HLE_Interface::EnqueueReply(hid->deviceCommandAddress, 0,
|
||||
CoreTiming::FromThread::NON_CPU);
|
||||
hid->deviceCommandAddress = 0;
|
||||
|
@ -62,17 +62,9 @@ void CWII_IPC_HLE_Device_hid::handleUsbUpdates(struct libusb_transfer* transfer)
|
|||
ret = transfer->length;
|
||||
}
|
||||
|
||||
// The original hardware overwrites the command type with the async reply type.
|
||||
Memory::Write_U32(IPC_REP_ASYNC, replyAddress);
|
||||
// IOS also seems to write back the command that was responded to in the FD field.
|
||||
Memory::Write_U32(IPC_CMD_IOCTL, replyAddress + 8);
|
||||
|
||||
// Return value
|
||||
Memory::Write_U32(ret, replyAddress + 4);
|
||||
|
||||
WII_IPC_HLE_Interface::EnqueueReply(replyAddress, 0, CoreTiming::FromThread::NON_CPU);
|
||||
// DEBUG_LOG(WII_IPC_HID, "OMG OMG OMG I GOT A CALLBACK, IMMA BE FAMOUS %d %d %d",
|
||||
// transfer->actual_length, transfer->length, transfer->status);
|
||||
}
|
||||
|
||||
CWII_IPC_HLE_Device_hid::CWII_IPC_HLE_Device_hid(u32 _DeviceID, const std::string& _rDeviceName)
|
||||
|
@ -259,11 +251,6 @@ IPCCommandResult CWII_IPC_HLE_Device_hid::IOCtl(u32 _CommandAddress)
|
|||
{
|
||||
Memory::Write_U32(0xFFFFFFFF, Memory::Read_U32(deviceCommandAddress + 0x18));
|
||||
|
||||
// The original hardware overwrites the command type with the async reply type.
|
||||
Memory::Write_U32(IPC_REP_ASYNC, deviceCommandAddress);
|
||||
// IOS also seems to write back the command that was responded to in the FD field.
|
||||
Memory::Write_U32(IPC_CMD_IOCTL, deviceCommandAddress + 8);
|
||||
|
||||
// Return value
|
||||
Memory::Write_U32(-1, deviceCommandAddress + 4);
|
||||
WII_IPC_HLE_Interface::EnqueueReply(deviceCommandAddress);
|
||||
|
|
|
@ -7,8 +7,10 @@
|
|||
#include <list>
|
||||
#include <map>
|
||||
#include <mutex>
|
||||
#include <string>
|
||||
#include <thread>
|
||||
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Core/IPC_HLE/WII_IPC_HLE.h"
|
||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device.h"
|
||||
|
||||
|
@ -19,11 +21,11 @@
|
|||
#else
|
||||
#define LIBUSB_CALL
|
||||
#endif
|
||||
struct libusb_device_handle;
|
||||
struct libusb_device_descriptor;
|
||||
struct libusb_config_descriptor;
|
||||
struct libusb_interface_descriptor;
|
||||
struct libusb_device_descriptor;
|
||||
struct libusb_device_handle;
|
||||
struct libusb_endpoint_descriptor;
|
||||
struct libusb_interface_descriptor;
|
||||
struct libusb_transfer;
|
||||
|
||||
#define HID_ID_MASK 0x0000FFFFFFFFFFFF
|
||||
|
|
|
@ -6,14 +6,19 @@
|
|||
#include <cinttypes>
|
||||
#include <cstddef>
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
#ifndef _WIN32
|
||||
#include <arpa/inet.h>
|
||||
#include <netdb.h>
|
||||
#include <poll.h>
|
||||
#endif
|
||||
|
||||
#include "Common/Assert.h"
|
||||
#include "Common/CommonFuncs.h"
|
||||
#include "Common/CommonPaths.h"
|
||||
#include "Common/FileUtil.h"
|
||||
#include "Common/Logging/Log.h"
|
||||
|
@ -21,11 +26,9 @@
|
|||
#include "Common/Network.h"
|
||||
#include "Common/SettingsHandler.h"
|
||||
#include "Common/StringUtil.h"
|
||||
|
||||
#include "Core/ConfigManager.h"
|
||||
#include "Core/Core.h"
|
||||
#include "Core/IPC_HLE/ICMP.h"
|
||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device_es.h"
|
||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device_net.h"
|
||||
#include "Core/IPC_HLE/WII_Socket.h"
|
||||
#include "Core/ec_wii.h"
|
||||
|
@ -38,16 +41,8 @@
|
|||
#define FREE(x) HeapFree(GetProcessHeap(), 0, (x))
|
||||
|
||||
#elif defined(__linux__) or defined(__APPLE__)
|
||||
#include <arpa/inet.h>
|
||||
#include <errno.h>
|
||||
#include <net/if.h>
|
||||
#include <netdb.h>
|
||||
#include <netinet/in.h>
|
||||
#include <poll.h>
|
||||
#include <string.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
typedef struct pollfd pollfd_t;
|
||||
#else
|
||||
|
|
|
@ -4,13 +4,14 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Common/Logging/Log.h"
|
||||
#include "Common/Timer.h"
|
||||
|
||||
#include "Core/HW/EXI_DeviceIPL.h"
|
||||
#include "Core/HW/Memmap.h"
|
||||
#include "Core/IPC_HLE/NWC24Config.h"
|
||||
#include "Core/IPC_HLE/WII_IPC_HLE.h"
|
||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device.h"
|
||||
#include "Core/IPC_HLE/WiiNetConfig.h"
|
||||
|
||||
|
|
|
@ -2,12 +2,17 @@
|
|||
// Licensed under GPLv2+
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstring>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include <mbedtls/md.h>
|
||||
|
||||
#include "Common/FileUtil.h"
|
||||
#include "Common/NandPaths.h"
|
||||
#include "Common/Logging/Log.h"
|
||||
#include "Core/ConfigManager.h"
|
||||
#include "Core/Core.h"
|
||||
#include "Core/HW/Memmap.h"
|
||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device_net_ssl.h"
|
||||
#include "Core/IPC_HLE/WII_Socket.h"
|
||||
|
||||
|
|
|
@ -7,15 +7,19 @@
|
|||
// These imports need to be in this order for mbed to be included correctly.
|
||||
// clang-format off
|
||||
|
||||
#include <mbedtls/platform.h>
|
||||
#include <mbedtls/ctr_drbg.h>
|
||||
#include <mbedtls/entropy.h>
|
||||
#include <mbedtls/net.h>
|
||||
#include <mbedtls/pk.h>
|
||||
#include <mbedtls/platform.h>
|
||||
#include <mbedtls/ssl.h>
|
||||
#include <mbedtls/x509_crt.h>
|
||||
#include <string>
|
||||
|
||||
// clang-format on
|
||||
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Core/IPC_HLE/WII_IPC_HLE.h"
|
||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device.h"
|
||||
|
||||
#define NET_SSL_MAXINSTANCES 4
|
||||
|
|
|
@ -2,35 +2,24 @@
|
|||
// Licensed under GPLv2+
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include "Common/ChunkFile.h"
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Common/FileUtil.h"
|
||||
#include "Common/Logging/Log.h"
|
||||
#include "Common/SDCardUtil.h"
|
||||
|
||||
#include "Core/ConfigManager.h"
|
||||
#include "Core/Core.h"
|
||||
#include "Core/HW/CPU.h"
|
||||
#include "Core/HW/Memmap.h"
|
||||
#include "Core/IPC_HLE/WII_IPC_HLE.h"
|
||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device_sdio_slot0.h"
|
||||
|
||||
void CWII_IPC_HLE_Device_sdio_slot0::EnqueueReply(u32 CommandAddress, u32 ReturnValue)
|
||||
{
|
||||
// IOS seems to write back the command that was responded to, this class does not
|
||||
// overwrite the command so it is safe to read.
|
||||
Memory::Write_U32(Memory::Read_U32(CommandAddress), CommandAddress + 8);
|
||||
// The original hardware overwrites the command type with the async reply type.
|
||||
Memory::Write_U32(IPC_REP_ASYNC, CommandAddress);
|
||||
|
||||
Memory::Write_U32(ReturnValue, CommandAddress + 4);
|
||||
|
||||
WII_IPC_HLE_Interface::EnqueueReply(CommandAddress);
|
||||
}
|
||||
|
||||
CWII_IPC_HLE_Device_sdio_slot0::CWII_IPC_HLE_Device_sdio_slot0(u32 _DeviceID,
|
||||
const std::string& _rDeviceName)
|
||||
: IWII_IPC_HLE_Device(_DeviceID, _rDeviceName), m_Status(CARD_NOT_EXIST), m_BlockLength(0),
|
||||
m_BusWidth(0), m_Card(nullptr)
|
||||
CWII_IPC_HLE_Device_sdio_slot0::CWII_IPC_HLE_Device_sdio_slot0(const u32 device_id,
|
||||
const std::string& device_name)
|
||||
: IWII_IPC_HLE_Device(device_id, device_name)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -54,7 +43,8 @@ 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))
|
||||
{
|
||||
EnqueueReply(m_event.addr, m_event.type);
|
||||
Memory::Write_U32(m_event.type, m_event.addr + 4);
|
||||
WII_IPC_HLE_Interface::EnqueueReply(m_event.addr);
|
||||
m_event.addr = 0;
|
||||
m_event.type = EVENT_NONE;
|
||||
}
|
||||
|
@ -236,7 +226,8 @@ IPCCommandResult CWII_IPC_HLE_Device_sdio_slot0::IOCtl(u32 _CommandAddress)
|
|||
// release returns 0
|
||||
// unknown sd int
|
||||
// technically we do it out of order, oh well
|
||||
EnqueueReply(m_event.addr, EVENT_INVALID);
|
||||
Memory::Write_U32(EVENT_INVALID, m_event.addr + 4);
|
||||
WII_IPC_HLE_Interface::EnqueueReply(m_event.addr);
|
||||
m_event.addr = 0;
|
||||
m_event.type = EVENT_NONE;
|
||||
Memory::Write_U32(0, _CommandAddress + 0x4);
|
||||
|
|
|
@ -8,18 +8,18 @@
|
|||
|
||||
#include <array>
|
||||
#include <string>
|
||||
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Common/FileUtil.h"
|
||||
#include "Core/IPC_HLE/WII_IPC_HLE.h"
|
||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device.h"
|
||||
|
||||
class PointerWrap;
|
||||
namespace File
|
||||
{
|
||||
class IOFile;
|
||||
}
|
||||
|
||||
class CWII_IPC_HLE_Device_sdio_slot0 : public IWII_IPC_HLE_Device
|
||||
{
|
||||
public:
|
||||
CWII_IPC_HLE_Device_sdio_slot0(u32 _DeviceID, const std::string& _rDeviceName);
|
||||
CWII_IPC_HLE_Device_sdio_slot0(u32 device_id, const std::string& device_name);
|
||||
|
||||
void DoState(PointerWrap& p) override;
|
||||
|
||||
|
@ -29,7 +29,6 @@ public:
|
|||
IPCCommandResult IOCtl(u32 _CommandAddress) override;
|
||||
IPCCommandResult IOCtlV(u32 _CommandAddress) override;
|
||||
|
||||
static void EnqueueReply(u32 CommandAddress, u32 ReturnValue);
|
||||
void EventNotify();
|
||||
|
||||
private:
|
||||
|
@ -111,14 +110,13 @@ private:
|
|||
// TODO do we need more than one?
|
||||
struct Event
|
||||
{
|
||||
EventType type;
|
||||
u32 addr;
|
||||
Event() : type(EVENT_NONE), addr() {}
|
||||
EventType type = EVENT_NONE;
|
||||
u32 addr = 0;
|
||||
} m_event;
|
||||
|
||||
u32 m_Status;
|
||||
u32 m_BlockLength;
|
||||
u32 m_BusWidth;
|
||||
u32 m_Status = CARD_NOT_EXIST;
|
||||
u32 m_BlockLength = 0;
|
||||
u32 m_BusWidth = 0;
|
||||
|
||||
std::array<u32, 0x200 / sizeof(u32)> m_registers;
|
||||
|
||||
|
|
|
@ -4,6 +4,12 @@
|
|||
|
||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device_stm.h"
|
||||
|
||||
#include <functional>
|
||||
|
||||
#include "Common/Assert.h"
|
||||
#include "Common/Logging/Log.h"
|
||||
#include "Core/HW/Memmap.h"
|
||||
|
||||
namespace Core
|
||||
{
|
||||
void QueueHostJob(std::function<void()> job, bool run_during_stop);
|
||||
|
@ -58,8 +64,6 @@ IPCCommandResult CWII_IPC_HLE_Device_stm_immediate::IOCtl(u32 command_address)
|
|||
}
|
||||
Memory::Write_U32(0, Memory::Read_U32(s_event_hook_address + 0x18));
|
||||
Memory::Write_U32(FS_SUCCESS, s_event_hook_address + 4);
|
||||
Memory::Write_U32(IPC_REP_ASYNC, s_event_hook_address);
|
||||
Memory::Write_U32(IPC_CMD_IOCTL, s_event_hook_address + 8);
|
||||
WII_IPC_HLE_Interface::EnqueueReply(s_event_hook_address);
|
||||
s_event_hook_address = 0;
|
||||
break;
|
||||
|
@ -152,12 +156,7 @@ void CWII_IPC_HLE_Device_stm_eventhook::TriggerEvent(const u32 event) const
|
|||
u32 buffer_out = Memory::Read_U32(s_event_hook_address + 0x18);
|
||||
Memory::Write_U32(event, buffer_out);
|
||||
|
||||
// Fill in command buffer.
|
||||
Memory::Write_U32(FS_SUCCESS, s_event_hook_address + 4);
|
||||
Memory::Write_U32(IPC_REP_ASYNC, s_event_hook_address);
|
||||
Memory::Write_U32(IPC_CMD_IOCTL, s_event_hook_address + 8);
|
||||
|
||||
// Generate a reply to the IPC command.
|
||||
WII_IPC_HLE_Interface::EnqueueReply(s_event_hook_address);
|
||||
s_event_hook_address = 0;
|
||||
}
|
||||
|
|
|
@ -4,6 +4,10 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Core/IPC_HLE/WII_IPC_HLE.h"
|
||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device.h"
|
||||
|
||||
enum
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
// Copyright 2016 Dolphin Emulator Project
|
||||
// Licensed under GPLv2+
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device_stub.h"
|
||||
#include "Common/Logging/Log.h"
|
||||
#include "Core/HW/Memmap.h"
|
||||
|
||||
CWII_IPC_HLE_Device_stub::CWII_IPC_HLE_Device_stub(u32 device_id, const std::string& device_name)
|
||||
: IWII_IPC_HLE_Device(device_id, device_name)
|
||||
{
|
||||
}
|
||||
|
||||
IPCCommandResult CWII_IPC_HLE_Device_stub::Open(u32 command_address, u32 mode)
|
||||
{
|
||||
WARN_LOG(WII_IPC_HLE, "%s faking Open()", m_Name.c_str());
|
||||
Memory::Write_U32(GetDeviceID(), command_address + 4);
|
||||
m_Active = true;
|
||||
return GetDefaultReply();
|
||||
}
|
||||
|
||||
IPCCommandResult CWII_IPC_HLE_Device_stub::Close(u32 command_address, bool force)
|
||||
{
|
||||
WARN_LOG(WII_IPC_HLE, "%s faking Close()", m_Name.c_str());
|
||||
if (!force)
|
||||
Memory::Write_U32(FS_SUCCESS, command_address + 4);
|
||||
m_Active = false;
|
||||
return GetDefaultReply();
|
||||
}
|
||||
|
||||
IPCCommandResult CWII_IPC_HLE_Device_stub::IOCtl(u32 command_address)
|
||||
{
|
||||
WARN_LOG(WII_IPC_HLE, "%s faking IOCtl()", m_Name.c_str());
|
||||
Memory::Write_U32(FS_SUCCESS, command_address + 4);
|
||||
return GetDefaultReply();
|
||||
}
|
||||
|
||||
IPCCommandResult CWII_IPC_HLE_Device_stub::IOCtlV(u32 command_address)
|
||||
{
|
||||
WARN_LOG(WII_IPC_HLE, "%s faking IOCtlV()", m_Name.c_str());
|
||||
Memory::Write_U32(FS_SUCCESS, command_address + 4);
|
||||
return GetDefaultReply();
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
// Copyright 2016 Dolphin Emulator Project
|
||||
// Licensed under GPLv2+
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Core/IPC_HLE/WII_IPC_HLE.h"
|
||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device.h"
|
||||
|
||||
class CWII_IPC_HLE_Device_stub : public IWII_IPC_HLE_Device
|
||||
{
|
||||
public:
|
||||
CWII_IPC_HLE_Device_stub(u32 device_id, const std::string& device_name);
|
||||
|
||||
IPCCommandResult Open(u32 command_address, u32 mode) override;
|
||||
IPCCommandResult Close(u32 command_address, bool force = false) override;
|
||||
IPCCommandResult IOCtl(u32 command_address) override;
|
||||
IPCCommandResult IOCtlV(u32 command_address) override;
|
||||
};
|
|
@ -2,6 +2,7 @@
|
|||
// Licensed under GPLv2+
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
@ -12,8 +13,6 @@
|
|||
#include "Common/FileUtil.h"
|
||||
#include "Common/Logging/Log.h"
|
||||
#include "Common/SysConf.h"
|
||||
#include "Core/ConfigManager.h"
|
||||
#include "Core/Core.h"
|
||||
#include "Core/HW/Memmap.h"
|
||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device_usb_bt_base.h"
|
||||
|
||||
|
@ -86,3 +85,8 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305_base::CtrlBuffer::FillBuffer(const u8*
|
|||
m_length);
|
||||
Memory::CopyToEmu(m_payload_addr, src, size);
|
||||
}
|
||||
|
||||
void CWII_IPC_HLE_Device_usb_oh1_57e_305_base::CtrlBuffer::SetRetVal(const u32 retval) const
|
||||
{
|
||||
Memory::Write_U32(retval, m_cmd_address + 4);
|
||||
}
|
||||
|
|
|
@ -4,9 +4,14 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <cstddef>
|
||||
#include <string>
|
||||
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Core/IPC_HLE/WII_IPC_HLE.h"
|
||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device.h"
|
||||
|
||||
class PointerWrap;
|
||||
class SysConf;
|
||||
|
||||
void BackUpBTInfoSection(SysConf* sysconf);
|
||||
|
@ -74,7 +79,7 @@ protected:
|
|||
CtrlBuffer(const SIOCtlVBuffer& cmd_buffer, u32 command_address);
|
||||
|
||||
void FillBuffer(const u8* src, size_t size) const;
|
||||
void SetRetVal(const u32 retval) const { Memory::Write_U32(retval, m_cmd_address + 4); }
|
||||
void SetRetVal(const u32 retval) const;
|
||||
bool IsValid() const { return m_cmd_address != 0; }
|
||||
void Invalidate() { m_cmd_address = m_payload_addr = 0; }
|
||||
u8 m_endpoint = 0;
|
||||
|
|
|
@ -2,31 +2,35 @@
|
|||
// Licensed under GPLv2+
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include "Core/HW/WII_IPC.h"
|
||||
#include <algorithm>
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
#include <memory>
|
||||
|
||||
#include "Common/Assert.h"
|
||||
#include "Common/CommonPaths.h"
|
||||
#include "Common/FileUtil.h"
|
||||
#include "Common/Logging/Log.h"
|
||||
#include "Common/MsgHandler.h"
|
||||
#include "Common/StringUtil.h"
|
||||
#include "Common/SysConf.h"
|
||||
#include "Core/ConfigManager.h"
|
||||
#include "Core/Core.h"
|
||||
#include "Core/CoreTiming.h"
|
||||
#include "Core/Debugger/Debugger_SymbolMap.h"
|
||||
#include "Core/HW/Memmap.h"
|
||||
#include "Core/HW/SystemTimers.h"
|
||||
#include "Core/HW/Wiimote.h"
|
||||
#include "Core/Host.h"
|
||||
#include "Core/IPC_HLE/WII_IPC_HLE.h"
|
||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device.h"
|
||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device_usb_bt_emu.h"
|
||||
#include "Core/IPC_HLE/WII_IPC_HLE_WiiMote.h"
|
||||
#include "Core/Movie.h"
|
||||
#include "InputCommon/ControllerInterface/ControllerInterface.h"
|
||||
|
||||
void CWII_IPC_HLE_Device_usb_oh1_57e_305_emu::EnqueueReply(u32 CommandAddress)
|
||||
SQueuedEvent::SQueuedEvent(u32 size, u16 handle) : m_size(size), m_connectionHandle(handle)
|
||||
{
|
||||
// IOS seems to write back the command that was responded to in the FD field, this
|
||||
// class does not overwrite the command so it is safe to read back.
|
||||
Memory::Write_U32(Memory::Read_U32(CommandAddress), CommandAddress + 8);
|
||||
// The original hardware overwrites the command type with the async reply type.
|
||||
Memory::Write_U32(IPC_REP_ASYNC, CommandAddress);
|
||||
|
||||
WII_IPC_HLE_Interface::EnqueueReply(CommandAddress);
|
||||
if (m_size > 1024)
|
||||
PanicAlert("SQueuedEvent: The size is too large.");
|
||||
}
|
||||
|
||||
// The device class
|
||||
|
@ -181,20 +185,6 @@ IPCCommandResult CWII_IPC_HLE_Device_usb_oh1_57e_305_emu::IOCtl(u32 _CommandAddr
|
|||
|
||||
IPCCommandResult CWII_IPC_HLE_Device_usb_oh1_57e_305_emu::IOCtlV(u32 _CommandAddress)
|
||||
{
|
||||
/*
|
||||
Memory::Write_U8(255, 0x80149950); // BTM LOG // 3 logs L2Cap // 4 logs l2_csm$
|
||||
Memory::Write_U8(255, 0x80149949); // Security Manager
|
||||
Memory::Write_U8(255, 0x80149048); // HID
|
||||
Memory::Write_U8(3, 0x80152058); // low ?? // >= 4 and you will get a lot of event messages
|
||||
of the same type
|
||||
Memory::Write_U8(1, 0x80152018); // WUD
|
||||
Memory::Write_U8(1, 0x80151FC8); // DEBUGPrint
|
||||
Memory::Write_U8(1, 0x80151488); // WPAD_LOG
|
||||
Memory::Write_U8(1, 0x801514A8); // USB_LOG
|
||||
Memory::Write_U8(1, 0x801514D8); // WUD_DEBUGPrint
|
||||
Memory::Write_U8(1, 0x80148E09); // HID LOG
|
||||
*/
|
||||
|
||||
bool _SendReply = false;
|
||||
|
||||
SIOCtlVBuffer CommandBuffer(_CommandAddress);
|
||||
|
@ -218,17 +208,6 @@ IPCCommandResult CWII_IPC_HLE_Device_usb_oh1_57e_305_emu::IOCtlV(u32 _CommandAdd
|
|||
*(u8*)Memory::GetPointer(CommandBuffer.InBuffer[5].m_Address) == 0,
|
||||
"WIIMOTE: Termination != 0");
|
||||
|
||||
#if 0 // this log can get really annoying
|
||||
DEBUG_LOG(WII_IPC_WIIMOTE, "USB_IOCTL_CTRLMSG (0x%08x) - execute command", _CommandAddress);
|
||||
DEBUG_LOG(WII_IPC_WIIMOTE, " bRequestType: 0x%x", m_CtrlSetup.bRequestType);
|
||||
DEBUG_LOG(WII_IPC_WIIMOTE, " bRequest: 0x%x", m_CtrlSetup.bRequest);
|
||||
DEBUG_LOG(WII_IPC_WIIMOTE, " wValue: 0x%x", m_CtrlSetup.wValue);
|
||||
DEBUG_LOG(WII_IPC_WIIMOTE, " wIndex: 0x%x", m_CtrlSetup.wIndex);
|
||||
DEBUG_LOG(WII_IPC_WIIMOTE, " wLength: 0x%x", m_CtrlSetup.wLength);
|
||||
DEBUG_LOG(WII_IPC_WIIMOTE, " m_PayLoadAddr: 0x%x", m_CtrlSetup.m_PayLoadAddr);
|
||||
DEBUG_LOG(WII_IPC_WIIMOTE, " m_PayLoadSize: 0x%x", m_CtrlSetup.m_PayLoadSize);
|
||||
#endif
|
||||
|
||||
// Replies are generated inside
|
||||
ExecuteHCICommandMessage(m_CtrlSetup);
|
||||
}
|
||||
|
@ -335,16 +314,6 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305_emu::SendToDevice(u16 _ConnectionHandle
|
|||
void CWII_IPC_HLE_Device_usb_oh1_57e_305_emu::IncDataPacket(u16 _ConnectionHandle)
|
||||
{
|
||||
m_PacketCount[_ConnectionHandle & 0xff]++;
|
||||
|
||||
// I don't think this makes sense or should be necessary
|
||||
// m_PacketCount refers to "completed" packets and is not related to some buffer size, yes?
|
||||
#if 0
|
||||
if (m_PacketCount[_ConnectionHandle & 0xff] > (unsigned int)m_acl_pkts_num)
|
||||
{
|
||||
DEBUG_LOG(WII_IPC_WIIMOTE, "ACL buffer overflow");
|
||||
m_PacketCount[_ConnectionHandle & 0xff] = m_acl_pkts_num;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// Here we send ACL packets to CPU. They will consist of header + data.
|
||||
|
@ -368,7 +337,7 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305_emu::SendACLPacket(u16 connection_handl
|
|||
memcpy(reinterpret_cast<u8*>(header) + sizeof(hci_acldata_hdr_t), data, header->length);
|
||||
|
||||
m_ACLEndpoint.SetRetVal(sizeof(hci_acldata_hdr_t) + size);
|
||||
EnqueueReply(m_ACLEndpoint.m_cmd_address);
|
||||
WII_IPC_HLE_Interface::EnqueueReply(m_ACLEndpoint.m_cmd_address);
|
||||
m_ACLEndpoint.Invalidate();
|
||||
}
|
||||
else
|
||||
|
@ -397,7 +366,7 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305_emu::AddEventToQueue(const SQueuedEvent
|
|||
m_HCIEndpoint.FillBuffer(_event.m_buffer, _event.m_size);
|
||||
m_HCIEndpoint.SetRetVal(_event.m_size);
|
||||
// Send a reply to indicate HCI buffer is filled
|
||||
EnqueueReply(m_HCIEndpoint.m_cmd_address);
|
||||
WII_IPC_HLE_Interface::EnqueueReply(m_HCIEndpoint.m_cmd_address);
|
||||
m_HCIEndpoint.Invalidate();
|
||||
}
|
||||
else // push new one, pop oldest
|
||||
|
@ -413,7 +382,7 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305_emu::AddEventToQueue(const SQueuedEvent
|
|||
m_HCIEndpoint.FillBuffer(event.m_buffer, event.m_size);
|
||||
m_HCIEndpoint.SetRetVal(event.m_size);
|
||||
// Send a reply to indicate HCI buffer is filled
|
||||
EnqueueReply(m_HCIEndpoint.m_cmd_address);
|
||||
WII_IPC_HLE_Interface::EnqueueReply(m_HCIEndpoint.m_cmd_address);
|
||||
m_HCIEndpoint.Invalidate();
|
||||
m_EventQueue.pop_front();
|
||||
}
|
||||
|
@ -441,7 +410,7 @@ u32 CWII_IPC_HLE_Device_usb_oh1_57e_305_emu::Update()
|
|||
m_HCIEndpoint.FillBuffer(event.m_buffer, event.m_size);
|
||||
m_HCIEndpoint.SetRetVal(event.m_size);
|
||||
// Send a reply to indicate HCI buffer is filled
|
||||
EnqueueReply(m_HCIEndpoint.m_cmd_address);
|
||||
WII_IPC_HLE_Interface::EnqueueReply(m_HCIEndpoint.m_cmd_address);
|
||||
m_HCIEndpoint.Invalidate();
|
||||
m_EventQueue.pop_front();
|
||||
packet_transferred = true;
|
||||
|
@ -542,7 +511,7 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305_emu::ACLPool::WriteToEndpoint(CtrlBuffe
|
|||
|
||||
m_queue.pop_front();
|
||||
|
||||
EnqueueReply(endpoint.m_cmd_address);
|
||||
WII_IPC_HLE_Interface::EnqueueReply(endpoint.m_cmd_address);
|
||||
endpoint.Invalidate();
|
||||
}
|
||||
|
||||
|
@ -999,7 +968,6 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305_emu::SendEventLinkKeyNotification(const
|
|||
DEBUG_LOG(WII_IPC_WIIMOTE, " bd: %02x:%02x:%02x:%02x:%02x:%02x", link_key_info->bdaddr.b[0],
|
||||
link_key_info->bdaddr.b[1], link_key_info->bdaddr.b[2], link_key_info->bdaddr.b[3],
|
||||
link_key_info->bdaddr.b[4], link_key_info->bdaddr.b[5]);
|
||||
LOG_LinkKey(link_key_info->key);
|
||||
}
|
||||
|
||||
AddEventToQueue(Event);
|
||||
|
@ -1264,7 +1232,7 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305_emu::ExecuteHCICommandMessage(
|
|||
}
|
||||
|
||||
// HCI command is finished, send a reply to command
|
||||
EnqueueReply(_rHCICommandMessage.m_Address);
|
||||
WII_IPC_HLE_Interface::EnqueueReply(_rHCICommandMessage.m_Address);
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -1374,7 +1342,6 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305_emu::CommandLinkKeyRep(const u8* input)
|
|||
DEBUG_LOG(WII_IPC_WIIMOTE, " bd: %02x:%02x:%02x:%02x:%02x:%02x", key_rep->bdaddr.b[0],
|
||||
key_rep->bdaddr.b[1], key_rep->bdaddr.b[2], key_rep->bdaddr.b[3], key_rep->bdaddr.b[4],
|
||||
key_rep->bdaddr.b[5]);
|
||||
LOG_LinkKey(key_rep->key);
|
||||
|
||||
hci_link_key_rep_rp reply;
|
||||
reply.status = 0x00;
|
||||
|
@ -1919,13 +1886,3 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305_emu::DisplayDisconnectMessage(const int
|
|||
Core::DisplayMessage(
|
||||
StringFromFormat("Wii Remote %i disconnected by emulated software", wiimoteNumber), 3000);
|
||||
}
|
||||
|
||||
void CWII_IPC_HLE_Device_usb_oh1_57e_305_emu::LOG_LinkKey(const u8* _pLinkKey)
|
||||
{
|
||||
DEBUG_LOG(WII_IPC_WIIMOTE, " link key: "
|
||||
"0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x "
|
||||
"0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x ",
|
||||
_pLinkKey[0], _pLinkKey[1], _pLinkKey[2], _pLinkKey[3], _pLinkKey[4], _pLinkKey[5],
|
||||
_pLinkKey[6], _pLinkKey[7], _pLinkKey[8], _pLinkKey[9], _pLinkKey[10], _pLinkKey[11],
|
||||
_pLinkKey[12], _pLinkKey[13], _pLinkKey[14], _pLinkKey[15]);
|
||||
}
|
||||
|
|
|
@ -7,32 +7,27 @@
|
|||
#include <algorithm>
|
||||
#include <deque>
|
||||
#include <queue>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Core/HW/Wiimote.h"
|
||||
#include "Core/IPC_HLE/WII_IPC_HLE.h"
|
||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device.h"
|
||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device_usb_bt_base.h"
|
||||
#include "Core/IPC_HLE/WII_IPC_HLE_WiiMote.h"
|
||||
#include "Core/IPC_HLE/hci.h"
|
||||
|
||||
class CWII_IPC_HLE_WiiMote;
|
||||
class PointerWrap;
|
||||
|
||||
struct SQueuedEvent
|
||||
{
|
||||
u8 m_buffer[1024];
|
||||
u8 m_buffer[1024] = {0};
|
||||
u32 m_size = 0;
|
||||
u16 m_connectionHandle = 0;
|
||||
|
||||
SQueuedEvent(u32 size, u16 connectionHandle) : m_size(size), m_connectionHandle(connectionHandle)
|
||||
{
|
||||
if (m_size > 1024)
|
||||
{
|
||||
// i know this code sux...
|
||||
PanicAlert("SQueuedEvent: allocate too big buffer!!");
|
||||
}
|
||||
memset(m_buffer, 0, 1024);
|
||||
}
|
||||
|
||||
SQueuedEvent(u32 size, u16 handle);
|
||||
SQueuedEvent() = default;
|
||||
};
|
||||
|
||||
|
@ -56,8 +51,6 @@ public:
|
|||
|
||||
u32 Update() override;
|
||||
|
||||
static void EnqueueReply(u32 CommandAddress);
|
||||
|
||||
// Send ACL data back to Bluetooth stack
|
||||
void SendACLPacket(u16 connection_handle, const u8* data, u32 size);
|
||||
|
||||
|
@ -195,9 +188,6 @@ private:
|
|||
|
||||
static void DisplayDisconnectMessage(const int wiimoteNumber, const int reason);
|
||||
|
||||
// Debugging
|
||||
void LOG_LinkKey(const u8* _pLinkKey);
|
||||
|
||||
#pragma pack(push, 1)
|
||||
#define CONF_PAD_MAX_REGISTERED 10
|
||||
|
||||
|
|
|
@ -3,19 +3,30 @@
|
|||
// Refer to the license.txt file included.
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
#include <iomanip>
|
||||
#include <iterator>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include <libusb.h>
|
||||
|
||||
#include "Common/Assert.h"
|
||||
#include "Common/ChunkFile.h"
|
||||
#include "Common/Logging/Log.h"
|
||||
#include "Common/MsgHandler.h"
|
||||
#include "Common/Network.h"
|
||||
#include "Common/StringUtil.h"
|
||||
#include "Common/Thread.h"
|
||||
#include "Core/ConfigManager.h"
|
||||
#include "Core/Core.h"
|
||||
#include "Core/CoreTiming.h"
|
||||
#include "Core/HW/Memmap.h"
|
||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device.h"
|
||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device_usb_bt_real.h"
|
||||
#include "Core/IPC_HLE/hci.h"
|
||||
|
||||
|
@ -29,13 +40,6 @@ static Common::Flag s_need_reset_keys;
|
|||
// and we showed an OSD message about it.
|
||||
static Common::Flag s_showed_failed_transfer;
|
||||
|
||||
static void EnqueueReply(const u32 command_address)
|
||||
{
|
||||
Memory::Write_U32(Memory::Read_U32(command_address), command_address + 8);
|
||||
Memory::Write_U32(IPC_REP_ASYNC, command_address);
|
||||
WII_IPC_HLE_Interface::EnqueueReply(command_address, 0, CoreTiming::FromThread::ANY);
|
||||
}
|
||||
|
||||
static bool IsWantedDevice(const libusb_device_descriptor& descriptor)
|
||||
{
|
||||
const int vid = SConfig::GetInstance().m_bt_passthrough_vid;
|
||||
|
@ -394,7 +398,7 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305_real::FakeVendorCommandReply(const Ctrl
|
|||
hci_event->PacketIndicator = 0x01;
|
||||
hci_event->Opcode = m_fake_vendor_command_reply_opcode;
|
||||
ctrl.SetRetVal(sizeof(SHCIEventCommand));
|
||||
EnqueueReply(ctrl.m_cmd_address);
|
||||
WII_IPC_HLE_Interface::EnqueueReply(ctrl.m_cmd_address);
|
||||
}
|
||||
|
||||
// Due to how the widcomm stack which Nintendo uses is coded, we must never
|
||||
|
@ -420,7 +424,7 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305_real::FakeReadBufferSizeReply(const Ctr
|
|||
|
||||
memcpy(packet + sizeof(SHCIEventCommand), &reply, sizeof(hci_read_buffer_size_rp));
|
||||
ctrl.SetRetVal(sizeof(SHCIEventCommand) + sizeof(hci_read_buffer_size_rp));
|
||||
EnqueueReply(ctrl.m_cmd_address);
|
||||
WII_IPC_HLE_Interface::EnqueueReply(ctrl.m_cmd_address);
|
||||
}
|
||||
|
||||
void CWII_IPC_HLE_Device_usb_oh1_57e_305_real::FakeSyncButtonEvent(const CtrlBuffer& ctrl,
|
||||
|
@ -432,7 +436,7 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305_real::FakeSyncButtonEvent(const CtrlBuf
|
|||
hci_event->length = size;
|
||||
memcpy(packet + sizeof(hci_event_hdr_t), payload, size);
|
||||
ctrl.SetRetVal(sizeof(hci_event_hdr_t) + size);
|
||||
EnqueueReply(ctrl.m_cmd_address);
|
||||
WII_IPC_HLE_Interface::EnqueueReply(ctrl.m_cmd_address);
|
||||
}
|
||||
|
||||
// When the red sync button is pressed, a HCI event is generated:
|
||||
|
@ -578,7 +582,7 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305_real::CommandCallback(libusb_transfer*
|
|||
s_showed_failed_transfer.Clear();
|
||||
}
|
||||
|
||||
EnqueueReply(cmd->address);
|
||||
WII_IPC_HLE_Interface::EnqueueReply(cmd->address, 0, CoreTiming::FromThread::NON_CPU);
|
||||
}
|
||||
|
||||
void CWII_IPC_HLE_Device_usb_oh1_57e_305_real::TransferCallback(libusb_transfer* tr)
|
||||
|
@ -623,5 +627,5 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305_real::TransferCallback(libusb_transfer*
|
|||
}
|
||||
|
||||
ctrl->SetRetVal(tr->actual_length);
|
||||
EnqueueReply(ctrl->m_cmd_address);
|
||||
WII_IPC_HLE_Interface::EnqueueReply(ctrl->m_cmd_address, 0, CoreTiming::FromThread::NON_CPU);
|
||||
}
|
||||
|
|
|
@ -7,15 +7,19 @@
|
|||
#if defined(__LIBUSB__)
|
||||
#include <array>
|
||||
#include <atomic>
|
||||
#include <string>
|
||||
#include <thread>
|
||||
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Common/Flag.h"
|
||||
#include "Common/Timer.h"
|
||||
#include "Core/IPC_HLE/WII_IPC_HLE.h"
|
||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device_usb_bt_base.h"
|
||||
|
||||
class PointerWrap;
|
||||
struct libusb_context;
|
||||
struct libusb_device;
|
||||
struct libusb_device_handle;
|
||||
struct libusb_context;
|
||||
struct libusb_transfer;
|
||||
|
||||
enum class SyncButtonState
|
||||
|
@ -96,5 +100,6 @@ private:
|
|||
|
||||
#else
|
||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device_usb_bt_stub.h"
|
||||
|
||||
using CWII_IPC_HLE_Device_usb_oh1_57e_305_real = CWII_IPC_HLE_Device_usb_oh1_57e_305_stub;
|
||||
#endif
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
// Refer to the license.txt file included.
|
||||
|
||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device_usb_bt_stub.h"
|
||||
|
||||
#include "Common/ChunkFile.h"
|
||||
#include "Common/MsgHandler.h"
|
||||
|
||||
namespace Core
|
||||
|
|
|
@ -4,8 +4,14 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Core/IPC_HLE/WII_IPC_HLE.h"
|
||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device_usb_bt_base.h"
|
||||
|
||||
class PointerWrap;
|
||||
|
||||
class CWII_IPC_HLE_Device_usb_oh1_57e_305_stub final
|
||||
: public CWII_IPC_HLE_Device_usb_oh1_57e_305_base
|
||||
{
|
||||
|
|
|
@ -2,17 +2,34 @@
|
|||
// Licensed under GPLv2+
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include "Common/FileUtil.h"
|
||||
#include <cstring>
|
||||
|
||||
#include "Common/CommonFuncs.h"
|
||||
#include "Common/FileUtil.h"
|
||||
#include "Common/IniFile.h"
|
||||
#include "Common/Logging/Log.h"
|
||||
#include "Core/ConfigManager.h"
|
||||
#include "Core/Core.h" // Local core functions
|
||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device_usb_bt_emu.h"
|
||||
#include "Core/HW/Memmap.h"
|
||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device_usb_kbd.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
CWII_IPC_HLE_Device_usb_kbd::SMessageData::SMessageData(u32 type, u8 modifiers, u8* pressed_keys)
|
||||
{
|
||||
MsgType = Common::swap32(type);
|
||||
Unk1 = 0; // swapped
|
||||
Modifiers = modifiers;
|
||||
Unk2 = 0;
|
||||
|
||||
if (pressed_keys) // Doesn't need to be in a specific order
|
||||
memcpy(PressedKeys, pressed_keys, sizeof(PressedKeys));
|
||||
else
|
||||
memset(PressedKeys, 0, sizeof(PressedKeys));
|
||||
}
|
||||
|
||||
// TODO: support in netplay/movies.
|
||||
|
||||
CWII_IPC_HLE_Device_usb_kbd::CWII_IPC_HLE_Device_usb_kbd(u32 _DeviceID,
|
||||
|
@ -27,7 +44,7 @@ CWII_IPC_HLE_Device_usb_kbd::~CWII_IPC_HLE_Device_usb_kbd()
|
|||
|
||||
IPCCommandResult CWII_IPC_HLE_Device_usb_kbd::Open(u32 _CommandAddress, u32 _Mode)
|
||||
{
|
||||
INFO_LOG(WII_IPC_STM, "CWII_IPC_HLE_Device_usb_kbd: Open");
|
||||
INFO_LOG(WII_IPC_HLE, "CWII_IPC_HLE_Device_usb_kbd: Open");
|
||||
IniFile ini;
|
||||
ini.Load(File::GetUserPath(F_DOLPHINCONFIG_IDX));
|
||||
ini.GetOrCreateSection("USB Keyboard")->Get("Layout", &m_KeyboardLayout, KBD_LAYOUT_QWERTY);
|
||||
|
@ -47,7 +64,7 @@ IPCCommandResult CWII_IPC_HLE_Device_usb_kbd::Open(u32 _CommandAddress, u32 _Mod
|
|||
|
||||
IPCCommandResult CWII_IPC_HLE_Device_usb_kbd::Close(u32 _CommandAddress, bool _bForce)
|
||||
{
|
||||
INFO_LOG(WII_IPC_STM, "CWII_IPC_HLE_Device_usb_kbd: Close");
|
||||
INFO_LOG(WII_IPC_HLE, "CWII_IPC_HLE_Device_usb_kbd: Close");
|
||||
while (!m_MessageQueue.empty())
|
||||
m_MessageQueue.pop();
|
||||
if (!_bForce)
|
||||
|
@ -58,9 +75,9 @@ IPCCommandResult CWII_IPC_HLE_Device_usb_kbd::Close(u32 _CommandAddress, bool _b
|
|||
|
||||
IPCCommandResult CWII_IPC_HLE_Device_usb_kbd::Write(u32 _CommandAddress)
|
||||
{
|
||||
DEBUG_LOG(WII_IPC_STM, "Ignoring write to CWII_IPC_HLE_Device_usb_kbd");
|
||||
DEBUG_LOG(WII_IPC_HLE, "Ignoring write to CWII_IPC_HLE_Device_usb_kbd");
|
||||
#if defined(_DEBUG) || defined(DEBUGFAST)
|
||||
DumpCommands(_CommandAddress, 10, LogTypes::WII_IPC_STM, LogTypes::LDEBUG);
|
||||
DumpCommands(_CommandAddress, 10, LogTypes::WII_IPC_HLE, LogTypes::LDEBUG);
|
||||
#endif
|
||||
return GetDefaultReply();
|
||||
}
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
#include <queue>
|
||||
#include <string>
|
||||
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Core/IPC_HLE/WII_IPC_HLE.h"
|
||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device.h"
|
||||
|
||||
class CWII_IPC_HLE_Device_usb_kbd : public IWII_IPC_HLE_Device
|
||||
|
@ -38,18 +40,7 @@ private:
|
|||
u8 Unk2;
|
||||
u8 PressedKeys[6];
|
||||
|
||||
SMessageData(u32 _MsgType, u8 _Modifiers, u8* _PressedKeys)
|
||||
{
|
||||
MsgType = Common::swap32(_MsgType);
|
||||
Unk1 = 0; // swapped
|
||||
Modifiers = _Modifiers;
|
||||
Unk2 = 0;
|
||||
|
||||
if (_PressedKeys) // Doesn't need to be in a specific order
|
||||
memcpy(PressedKeys, _PressedKeys, sizeof(PressedKeys));
|
||||
else
|
||||
memset(PressedKeys, 0, sizeof(PressedKeys));
|
||||
}
|
||||
SMessageData(u32 msg_type, u8 modifiers, u8* pressed_keys);
|
||||
};
|
||||
#pragma pack(pop)
|
||||
std::queue<SMessageData> m_MessageQueue;
|
||||
|
|
|
@ -2,13 +2,13 @@
|
|||
// Licensed under GPLv2+
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include "Common/StringUtil.h"
|
||||
|
||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device_usb_ven.h"
|
||||
#include "Common/Logging/Log.h"
|
||||
#include "Core/HW/Memmap.h"
|
||||
|
||||
CWII_IPC_HLE_Device_usb_ven::CWII_IPC_HLE_Device_usb_ven(u32 _DeviceID,
|
||||
const std::string& _rDeviceName)
|
||||
: IWII_IPC_HLE_Device(_DeviceID, _rDeviceName)
|
||||
CWII_IPC_HLE_Device_usb_ven::CWII_IPC_HLE_Device_usb_ven(const u32 device_id,
|
||||
const std::string& device_name)
|
||||
: IWII_IPC_HLE_Device(device_id, device_name)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -16,55 +16,55 @@ CWII_IPC_HLE_Device_usb_ven::~CWII_IPC_HLE_Device_usb_ven()
|
|||
{
|
||||
}
|
||||
|
||||
IPCCommandResult CWII_IPC_HLE_Device_usb_ven::Open(u32 _CommandAddress, u32 _Mode)
|
||||
IPCCommandResult CWII_IPC_HLE_Device_usb_ven::Open(u32 command_address, u32 mode)
|
||||
{
|
||||
Memory::Write_U32(GetDeviceID(), _CommandAddress + 4);
|
||||
Memory::Write_U32(GetDeviceID(), command_address + 4);
|
||||
m_Active = true;
|
||||
return GetDefaultReply();
|
||||
}
|
||||
|
||||
IPCCommandResult CWII_IPC_HLE_Device_usb_ven::Close(u32 _CommandAddress, bool _bForce)
|
||||
IPCCommandResult CWII_IPC_HLE_Device_usb_ven::Close(u32 command_address, bool force)
|
||||
{
|
||||
if (!_bForce)
|
||||
Memory::Write_U32(0, _CommandAddress + 4);
|
||||
if (!force)
|
||||
Memory::Write_U32(0, command_address + 4);
|
||||
|
||||
m_Active = false;
|
||||
return GetDefaultReply();
|
||||
}
|
||||
|
||||
IPCCommandResult CWII_IPC_HLE_Device_usb_ven::IOCtlV(u32 _CommandAddress)
|
||||
IPCCommandResult CWII_IPC_HLE_Device_usb_ven::IOCtlV(u32 command_address)
|
||||
{
|
||||
SIOCtlVBuffer CommandBuffer(_CommandAddress);
|
||||
SIOCtlVBuffer command_buffer(command_address);
|
||||
|
||||
INFO_LOG(OSHLE, "%s - IOCtlV:", GetDeviceName().c_str());
|
||||
INFO_LOG(OSHLE, " Parameter: 0x%x", CommandBuffer.Parameter);
|
||||
INFO_LOG(OSHLE, " NumberIn: 0x%08x", CommandBuffer.NumberInBuffer);
|
||||
INFO_LOG(OSHLE, " NumberOut: 0x%08x", CommandBuffer.NumberPayloadBuffer);
|
||||
INFO_LOG(OSHLE, " BufferVector: 0x%08x", CommandBuffer.BufferVector);
|
||||
DumpAsync(CommandBuffer.BufferVector, CommandBuffer.NumberInBuffer,
|
||||
CommandBuffer.NumberPayloadBuffer);
|
||||
INFO_LOG(OSHLE, " Parameter: 0x%x", command_buffer.Parameter);
|
||||
INFO_LOG(OSHLE, " NumberIn: 0x%08x", command_buffer.NumberInBuffer);
|
||||
INFO_LOG(OSHLE, " NumberOut: 0x%08x", command_buffer.NumberPayloadBuffer);
|
||||
INFO_LOG(OSHLE, " BufferVector: 0x%08x", command_buffer.BufferVector);
|
||||
DumpAsync(command_buffer.BufferVector, command_buffer.NumberInBuffer,
|
||||
command_buffer.NumberPayloadBuffer);
|
||||
|
||||
Memory::Write_U32(0, _CommandAddress + 4);
|
||||
Memory::Write_U32(0, command_address + 4);
|
||||
return GetNoReply();
|
||||
}
|
||||
|
||||
IPCCommandResult CWII_IPC_HLE_Device_usb_ven::IOCtl(u32 _CommandAddress)
|
||||
IPCCommandResult CWII_IPC_HLE_Device_usb_ven::IOCtl(u32 command_address)
|
||||
{
|
||||
IPCCommandResult Reply = GetNoReply();
|
||||
u32 Command = Memory::Read_U32(_CommandAddress + 0x0c);
|
||||
u32 BufferIn = Memory::Read_U32(_CommandAddress + 0x10);
|
||||
u32 BufferInSize = Memory::Read_U32(_CommandAddress + 0x14);
|
||||
u32 BufferOut = Memory::Read_U32(_CommandAddress + 0x18);
|
||||
u32 BufferOutSize = Memory::Read_U32(_CommandAddress + 0x1c);
|
||||
IPCCommandResult reply = GetNoReply();
|
||||
u32 command = Memory::Read_U32(command_address + 0x0c);
|
||||
u32 buffer_in = Memory::Read_U32(command_address + 0x10);
|
||||
u32 buffer_in_size = Memory::Read_U32(command_address + 0x14);
|
||||
u32 buffer_out = Memory::Read_U32(command_address + 0x18);
|
||||
u32 buffer_out_size = Memory::Read_U32(command_address + 0x1c);
|
||||
|
||||
INFO_LOG(OSHLE, "%s - IOCtl: %x", GetDeviceName().c_str(), Command);
|
||||
INFO_LOG(OSHLE, "%x:%x %x:%x", BufferIn, BufferInSize, BufferOut, BufferOutSize);
|
||||
INFO_LOG(OSHLE, "%s - IOCtl: %x", GetDeviceName().c_str(), command);
|
||||
INFO_LOG(OSHLE, "%x:%x %x:%x", buffer_in, buffer_in_size, buffer_out, buffer_out_size);
|
||||
|
||||
switch (Command)
|
||||
switch (command)
|
||||
{
|
||||
case USBV5_IOCTL_GETVERSION:
|
||||
Memory::Write_U32(0x50001, BufferOut);
|
||||
Reply = GetDefaultReply();
|
||||
Memory::Write_U32(0x50001, buffer_out);
|
||||
reply = GetDefaultReply();
|
||||
break;
|
||||
|
||||
case USBV5_IOCTL_GETDEVICECHANGE:
|
||||
|
@ -73,51 +73,46 @@ IPCCommandResult CWII_IPC_HLE_Device_usb_ven::IOCtl(u32 _CommandAddress)
|
|||
static bool firstcall = true;
|
||||
if (firstcall)
|
||||
{
|
||||
Reply = GetDefaultReply();
|
||||
reply = GetDefaultReply();
|
||||
firstcall = false;
|
||||
}
|
||||
|
||||
// num devices
|
||||
Memory::Write_U32(0, _CommandAddress + 4);
|
||||
return Reply;
|
||||
Memory::Write_U32(0, command_address + 4);
|
||||
return reply;
|
||||
}
|
||||
break;
|
||||
|
||||
case USBV5_IOCTL_ATTACHFINISH:
|
||||
Reply = GetDefaultReply();
|
||||
reply = GetDefaultReply();
|
||||
break;
|
||||
|
||||
case USBV5_IOCTL_SUSPEND_RESUME:
|
||||
DEBUG_LOG(OSHLE, "Device: %i Resumed: %i", Memory::Read_U32(BufferIn),
|
||||
Memory::Read_U32(BufferIn + 4));
|
||||
Reply = GetDefaultReply();
|
||||
DEBUG_LOG(OSHLE, "Device: %i Resumed: %i", Memory::Read_U32(buffer_in),
|
||||
Memory::Read_U32(buffer_in + 4));
|
||||
reply = GetDefaultReply();
|
||||
break;
|
||||
|
||||
case USBV5_IOCTL_GETDEVPARAMS:
|
||||
{
|
||||
s32 device = Memory::Read_U32(BufferIn);
|
||||
u32 unk = Memory::Read_U32(BufferIn + 4);
|
||||
s32 device = Memory::Read_U32(buffer_in);
|
||||
u32 unk = Memory::Read_U32(buffer_in + 4);
|
||||
|
||||
DEBUG_LOG(OSHLE, "USBV5_IOCTL_GETDEVPARAMS device: %i unk: %i", device, unk);
|
||||
|
||||
Memory::Write_U32(0, BufferOut);
|
||||
Memory::Write_U32(0, buffer_out);
|
||||
|
||||
Reply = GetDefaultReply();
|
||||
reply = GetDefaultReply();
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
DEBUG_LOG(OSHLE, "%x:%x %x:%x", BufferIn, BufferInSize, BufferOut, BufferOutSize);
|
||||
DEBUG_LOG(OSHLE, "%x:%x %x:%x", buffer_in, buffer_in_size, buffer_out, buffer_out_size);
|
||||
break;
|
||||
}
|
||||
|
||||
Memory::Write_U32(0, _CommandAddress + 4);
|
||||
return Reply;
|
||||
}
|
||||
|
||||
u32 CWII_IPC_HLE_Device_usb_ven::Update()
|
||||
{
|
||||
return IWII_IPC_HLE_Device::Update();
|
||||
Memory::Write_U32(0, command_address + 4);
|
||||
return reply;
|
||||
}
|
||||
|
||||
void CWII_IPC_HLE_Device_usb_ven::DoState(PointerWrap& p)
|
||||
|
|
|
@ -4,23 +4,26 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Core/IPC_HLE/WII_IPC_HLE.h"
|
||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device.h"
|
||||
|
||||
class CWII_IPC_HLE_Device_usb_ven : public IWII_IPC_HLE_Device
|
||||
class PointerWrap;
|
||||
|
||||
class CWII_IPC_HLE_Device_usb_ven final : public IWII_IPC_HLE_Device
|
||||
{
|
||||
public:
|
||||
CWII_IPC_HLE_Device_usb_ven(u32 _DeviceID, const std::string& _rDeviceName);
|
||||
CWII_IPC_HLE_Device_usb_ven(u32 device_id, const std::string& device_name);
|
||||
|
||||
~CWII_IPC_HLE_Device_usb_ven() override;
|
||||
|
||||
IPCCommandResult Open(u32 _CommandAddress, u32 _Mode) override;
|
||||
IPCCommandResult Close(u32 _CommandAddress, bool _bForce) override;
|
||||
IPCCommandResult Open(u32 command_address, u32 mode) override;
|
||||
IPCCommandResult Close(u32 command_address, bool force) override;
|
||||
|
||||
IPCCommandResult IOCtlV(u32 _CommandAddress) override;
|
||||
IPCCommandResult IOCtl(u32 _CommandAddress) override;
|
||||
|
||||
u32 Update() override;
|
||||
IPCCommandResult IOCtlV(u32 command_address) override;
|
||||
IPCCommandResult IOCtl(u32 command_address) override;
|
||||
|
||||
void DoState(PointerWrap& p) override;
|
||||
|
||||
|
|
|
@ -2,11 +2,17 @@
|
|||
// Licensed under GPLv2+
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include <cstring>
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "Common/Assert.h"
|
||||
#include "Common/ChunkFile.h"
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Common/Logging/Log.h"
|
||||
#include "Common/MsgHandler.h"
|
||||
#include "Common/StringUtil.h"
|
||||
|
||||
#include "Core/ConfigManager.h"
|
||||
#include "Core/Core.h"
|
||||
#include "Core/HW/Wiimote.h"
|
||||
#include "Core/Host.h"
|
||||
|
@ -27,20 +33,17 @@ void SetUsbPointer(CWII_IPC_HLE_Device_usb_oh1_57e_305_emu* ptr)
|
|||
s_Usb = ptr;
|
||||
}
|
||||
|
||||
CWII_IPC_HLE_WiiMote::CWII_IPC_HLE_WiiMote(CWII_IPC_HLE_Device_usb_oh1_57e_305_emu* _pHost,
|
||||
int _Number, bdaddr_t _BD, bool ready)
|
||||
: m_HIDControlChannel_Connected(false), m_HIDControlChannel_ConnectedWait(false),
|
||||
m_HIDControlChannel_Config(false), m_HIDControlChannel_ConfigWait(false),
|
||||
m_HIDInterruptChannel_Connected(false), m_HIDInterruptChannel_ConnectedWait(false),
|
||||
m_HIDInterruptChannel_Config(false), m_HIDInterruptChannel_ConfigWait(false), m_BD(_BD),
|
||||
m_Name(_Number == WIIMOTE_BALANCE_BOARD ? "Nintendo RVL-WBC-01" : "Nintendo RVL-CNT-01"),
|
||||
m_pHost(_pHost)
|
||||
CWII_IPC_HLE_WiiMote::CWII_IPC_HLE_WiiMote(CWII_IPC_HLE_Device_usb_oh1_57e_305_emu* host,
|
||||
int number, bdaddr_t bd, bool ready)
|
||||
: m_BD(bd),
|
||||
m_Name(number == WIIMOTE_BALANCE_BOARD ? "Nintendo RVL-WBC-01" : "Nintendo RVL-CNT-01"),
|
||||
m_pHost(host)
|
||||
{
|
||||
INFO_LOG(WII_IPC_WIIMOTE, "Wiimote: #%i Constructed", _Number);
|
||||
INFO_LOG(WII_IPC_WIIMOTE, "Wiimote: #%i Constructed", number);
|
||||
|
||||
m_ConnectionState = (ready) ? CONN_READY : CONN_INACTIVE;
|
||||
m_ConnectionHandle = 0x100 + _Number;
|
||||
memset(m_LinkKey, 0xA0 + _Number, HCI_KEY_SIZE);
|
||||
m_ConnectionHandle = 0x100 + number;
|
||||
memset(m_LinkKey, 0xA0 + number, HCI_KEY_SIZE);
|
||||
|
||||
bdaddr_t _nullBD = BDADDR_ANY;
|
||||
if (memcmp(&m_BD, &_nullBD, sizeof(bdaddr_t)) == 0)
|
||||
|
@ -50,7 +53,7 @@ CWII_IPC_HLE_WiiMote::CWII_IPC_HLE_WiiMote(CWII_IPC_HLE_Device_usb_oh1_57e_305_e
|
|||
m_BD.b[2] = 0x19;
|
||||
m_BD.b[3] = 0x79;
|
||||
m_BD.b[4] = 0x00;
|
||||
m_BD.b[5] = _Number;
|
||||
m_BD.b[5] = number;
|
||||
}
|
||||
uclass[0] = 0x00;
|
||||
uclass[1] = 0x04;
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
||||
|
@ -75,14 +76,14 @@ private:
|
|||
};
|
||||
ConnectionState m_ConnectionState;
|
||||
|
||||
bool m_HIDControlChannel_Connected;
|
||||
bool m_HIDControlChannel_ConnectedWait;
|
||||
bool m_HIDControlChannel_Config;
|
||||
bool m_HIDControlChannel_ConfigWait;
|
||||
bool m_HIDInterruptChannel_Connected;
|
||||
bool m_HIDInterruptChannel_ConnectedWait;
|
||||
bool m_HIDInterruptChannel_Config;
|
||||
bool m_HIDInterruptChannel_ConfigWait;
|
||||
bool m_HIDControlChannel_Connected = false;
|
||||
bool m_HIDControlChannel_ConnectedWait = false;
|
||||
bool m_HIDControlChannel_Config = false;
|
||||
bool m_HIDControlChannel_ConfigWait = false;
|
||||
bool m_HIDInterruptChannel_Connected = false;
|
||||
bool m_HIDInterruptChannel_ConnectedWait = false;
|
||||
bool m_HIDInterruptChannel_Config = false;
|
||||
bool m_HIDInterruptChannel_ConfigWait = false;
|
||||
|
||||
// STATE_TO_SAVE
|
||||
bdaddr_t m_BD;
|
||||
|
|
|
@ -576,7 +576,8 @@ 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);
|
||||
WiiSockMan::EnqueueReply(it->_CommandAddress, ReturnValue, ct);
|
||||
Memory::Write_U32(ReturnValue, it->_CommandAddress + 4);
|
||||
WII_IPC_HLE_Interface::EnqueueReply(it->_CommandAddress);
|
||||
it = pending_sockops.erase(it);
|
||||
}
|
||||
else
|
||||
|
@ -674,19 +675,6 @@ void WiiSockMan::Update()
|
|||
}
|
||||
}
|
||||
|
||||
void WiiSockMan::EnqueueReply(u32 CommandAddress, s32 ReturnValue, IPCCommandType CommandType)
|
||||
{
|
||||
// The original hardware overwrites the command type with the async reply type.
|
||||
Memory::Write_U32(IPC_REP_ASYNC, CommandAddress);
|
||||
// IOS also seems to write back the command that was responded to in the FD field.
|
||||
Memory::Write_U32(CommandType, CommandAddress + 8);
|
||||
|
||||
// Return value
|
||||
Memory::Write_U32(ReturnValue, CommandAddress + 4);
|
||||
|
||||
WII_IPC_HLE_Interface::EnqueueReply(CommandAddress);
|
||||
}
|
||||
|
||||
void WiiSockMan::Convert(WiiSockAddrIn const& from, sockaddr_in& to)
|
||||
{
|
||||
to.sin_addr.s_addr = from.addr.addr;
|
||||
|
|
|
@ -46,9 +46,12 @@ typedef struct pollfd pollfd_t;
|
|||
#include <list>
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
#include <utility>
|
||||
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Common/Logging/Log.h"
|
||||
#include "Common/NonCopyable.h"
|
||||
#include "Core/HW/Memmap.h"
|
||||
#include "Core/IPC_HLE/WII_IPC_HLE.h"
|
||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device_net.h"
|
||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device_net_ssl.h"
|
||||
|
@ -209,7 +212,6 @@ public:
|
|||
return instance; // Instantiated on first use.
|
||||
}
|
||||
void Update();
|
||||
static void EnqueueReply(u32 CommandAddress, s32 ReturnValue, IPCCommandType CommandType);
|
||||
static void Convert(WiiSockAddrIn const& from, sockaddr_in& to);
|
||||
static void Convert(sockaddr_in const& from, WiiSockAddrIn& to, s32 addrlen = -1);
|
||||
// NON-BLOCKING FUNCTIONS
|
||||
|
@ -225,10 +227,10 @@ public:
|
|||
auto socket_entry = WiiSockets.find(sock);
|
||||
if (socket_entry == WiiSockets.end())
|
||||
{
|
||||
IPCCommandType ct = static_cast<IPCCommandType>(Memory::Read_U32(CommandAddress));
|
||||
ERROR_LOG(WII_IPC_NET, "DoSock: Error, fd not found (%08x, %08X, %08X)", sock, CommandAddress,
|
||||
type);
|
||||
EnqueueReply(CommandAddress, -SO_EBADF, ct);
|
||||
Memory::Write_U32(-SO_EBADF, CommandAddress + 4);
|
||||
WII_IPC_HLE_Interface::EnqueueReply(CommandAddress);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -2,148 +2,9 @@
|
|||
// Licensed under GPLv2+
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "Core/IPC_HLE/WiiMote_HID_Attr.h"
|
||||
#include "Common/Assert.h"
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Common/Logging/Log.h"
|
||||
#include "Common/MsgHandler.h"
|
||||
#include "Core/IPC_HLE/WiiMote_HID_Attr.h"
|
||||
|
||||
#if 0
|
||||
// 0x00 (checked)
|
||||
u8 ServiceRecordHandle[] = { 0x0a, 0x00, 0x01, 0x00, 0x00 };
|
||||
|
||||
// 0x01 (checked)
|
||||
u8 SrvClassIDList[] = {
|
||||
0x35, 0x03,
|
||||
0x19, 0x11, 0x24
|
||||
};
|
||||
|
||||
// 0x04 (checked)
|
||||
u8 ProtocolDescriptorList[] = {
|
||||
0x35, 0x0D,
|
||||
0x35, 0x06,
|
||||
0x19, 0x01, 0x00, // Element 0
|
||||
0x09, 0x00, 0x11, // Element 1
|
||||
0x35, 0x03,
|
||||
0x19, 0x00, 0x11 // Element 0
|
||||
};
|
||||
|
||||
// 0x5 (checked)
|
||||
u8 BrowseGroupList[] = {
|
||||
0x35, 0x03,
|
||||
0x19, 0x10, 0x02
|
||||
};
|
||||
|
||||
// 0x6 (checked)
|
||||
u8 LanguageBaseAttributeIDList[] = {
|
||||
0x35, 0x09,
|
||||
0x09, 0x65, 0x6e,
|
||||
0x09, 0x00, 0x6a,
|
||||
0x09, 0x01, 0x00
|
||||
};
|
||||
|
||||
// 0x09 (checked)
|
||||
u8 BluetoothProfileDescriptorList[] = {
|
||||
0x35, 0x08,
|
||||
0x35, 0x06,
|
||||
0x19, 0x11, 0x24,
|
||||
0x09, 0x01, 0x00
|
||||
};
|
||||
|
||||
// 0x0D (checked)
|
||||
u8 AdditionalProtocolDescriptorLists[] = {
|
||||
0x35, 0x0F,
|
||||
0x35, 0x0D,
|
||||
0x35, 0x06,
|
||||
0x19, 0x01, 0x00,
|
||||
0x09, 0x00, 0x13,
|
||||
0x35, 0x03,
|
||||
0x19, 0x00, 0x11
|
||||
};
|
||||
|
||||
// 0x100
|
||||
u8 ServiceName[] = { 0x25, 0x13, 'N','i','n','t','e','n','d','o',' ','R','V','L','-','C','N','T','-','0','1' };
|
||||
// 0x101
|
||||
u8 ServiceDescription[] = { 0x25, 0x13, 'N','i','n','t','e','n','d','o',' ','R','V','L','-','C','N','T','-','0','1' };
|
||||
// 0x102
|
||||
u8 ProviderName [] = { 0x25, 0x8, 'N','i','n','t','e','n','d','o'};
|
||||
|
||||
// 0x200
|
||||
u8 HIDDeviceReleaseNumber[] = { 0x09, 0x01, 0x00 };
|
||||
// 0x201
|
||||
u8 HIDParserVersion[] = { 0x09, 0x01, 0x11 };
|
||||
// 0x202
|
||||
u8 HIDDeviceSubclass[] = { 0x09, 0x00, 0x04 };
|
||||
// 0x203
|
||||
u8 HIDCountryCode[] = { 0x09, 0x00, 0x33 };
|
||||
// 0x204
|
||||
u8 HIDVirtualCable[] = { 0x09, 0x00, 0x00 };
|
||||
// 0x205
|
||||
u8 HIDReconnectInitiate[] = { 0x09, 0x00, 0x01 };
|
||||
|
||||
// 0x206
|
||||
u8 HIDDescriptorList[] = {
|
||||
0x35, 0xDF,
|
||||
0x35, 0xDD,
|
||||
0x08, 0x22, // Element 0
|
||||
0x25, 0xD9, // hmm... <- 0x25 is a string but there is Data
|
||||
|
||||
// 0xD9 Bytes - Element 1
|
||||
0x05, 0x01, 0x09, 0x05, 0xa1, 0x01, 0x85, 0x10,
|
||||
0x15, 0x00, 0x26, 0xff, 0x00, 0x75, 0x08, 0x95,
|
||||
0x01, 0x06, 0x00, 0xff, 0x09, 0x01, 0x91, 0x00,
|
||||
0x85, 0x11, 0x95, 0x01, 0x09, 0x01, 0x91, 0x00,
|
||||
0x85, 0x12, 0x95, 0x02, 0x09, 0x01, 0x91, 0x00,
|
||||
0x85, 0x13, 0x95, 0x01, 0x09, 0x01, 0x91, 0x00,
|
||||
0x85, 0x14, 0x95, 0x01, 0x09, 0x01, 0x91, 0x00,
|
||||
0x85, 0x15, 0x95, 0x01, 0x09, 0x01, 0x91, 0x00,
|
||||
0x85, 0x16, 0x95, 0x15, 0x09, 0x01, 0x91, 0x00,
|
||||
0x85, 0x17, 0x95, 0x06, 0x09, 0x01, 0x91, 0x00,
|
||||
0x85, 0x18, 0x95, 0x15, 0x09, 0x01, 0x91, 0x00,
|
||||
0x85, 0x19, 0x95, 0x01, 0x09, 0x01, 0x91, 0x00,
|
||||
0x85, 0x1a, 0x95, 0x01, 0x09, 0x01, 0x91, 0x00,
|
||||
0x85, 0x20, 0x95, 0x06, 0x09, 0x01, 0x81, 0x00,
|
||||
0x85, 0x21, 0x95, 0x15, 0x09, 0x01, 0x81, 0x00,
|
||||
0x85, 0x22, 0x95, 0x04, 0x09, 0x01, 0x81, 0x00,
|
||||
0x85, 0x30, 0x95, 0x02, 0x09, 0x01, 0x81, 0x00,
|
||||
0x85, 0x31, 0x95, 0x05, 0x09, 0x01, 0x81, 0x00,
|
||||
0x85, 0x32, 0x95, 0x0a, 0x09, 0x01, 0x81, 0x00,
|
||||
0x85, 0x33, 0x95, 0x11, 0x09, 0x01, 0x81, 0x00,
|
||||
0x85, 0x34, 0x95, 0x15, 0x09, 0x01, 0x81, 0x00,
|
||||
0x85, 0x35, 0x95, 0x15, 0x09, 0x01, 0x81, 0x00,
|
||||
0x85, 0x36, 0x95, 0x15, 0x09, 0x01, 0x81, 0x00,
|
||||
0x85, 0x37, 0x95, 0x15, 0x09, 0x01, 0x81, 0x00,
|
||||
0x85, 0x3d, 0x95, 0x15, 0x09, 0x01, 0x81, 0x00,
|
||||
0x85, 0x3e, 0x95, 0x15, 0x09, 0x01, 0x81, 0x00,
|
||||
0x85, 0x3f, 0x95, 0x15, 0x09, 0x01, 0x81, 0x00,
|
||||
0xc0 // end tag
|
||||
};
|
||||
|
||||
// 0x207
|
||||
u8 HIDLANGIDBaseList[] = {
|
||||
0x35, 0x08,
|
||||
0x35, 0x06,
|
||||
0x09, 0x04, 0x09,
|
||||
0x09, 0x01, 0x00
|
||||
};
|
||||
|
||||
// 0x208
|
||||
u8 HIDSDPDisable[] = { 0x28, 0x00 };
|
||||
// 0x209
|
||||
u8 HIDBatteryPower[] = { 0x28, 0x01 };
|
||||
// 0x20a
|
||||
u8 HIDRemoteWake[] = { 0x28, 0x01 };
|
||||
// 0x20b
|
||||
u8 HIDUnk_020B[] = { 0x09, 0x01, 0x00 };
|
||||
// 0x20c
|
||||
u8 HIDUnk_020C[] = { 0x09, 0x0c, 0x80 };
|
||||
// 0x20d
|
||||
u8 HIDUnk_020D[] = { 0x28, 0x00 };
|
||||
// 0x20e
|
||||
u8 HIDBootDevice[] = { 0x28, 0x00 };
|
||||
#endif
|
||||
|
||||
static u8 packet1[] = {
|
||||
0x00, 0x7b, 0x00, 0x76, 0x36, 0x01, 0xcc, 0x09, 0x00, 0x00, 0x0a, 0x00, 0x01, 0x00, 0x00, 0x09,
|
||||
|
@ -235,50 +96,3 @@ const u8* GetAttribPacket(u32 serviceHandle, u32 cont, u32& _size)
|
|||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// XXX keep these?
|
||||
#if 0
|
||||
CAttribTable m_AttribTable;
|
||||
|
||||
void InitAttribTable()
|
||||
{
|
||||
m_AttribTable.push_back(SAttrib(0x00, ServiceRecordHandle, sizeof(ServiceRecordHandle)));
|
||||
m_AttribTable.push_back(SAttrib(0x01, SrvClassIDList, sizeof(SrvClassIDList)));
|
||||
m_AttribTable.push_back(SAttrib(0x04, ProtocolDescriptorList, sizeof(ProtocolDescriptorList)));
|
||||
m_AttribTable.push_back(SAttrib(0x05, BrowseGroupList, sizeof(BrowseGroupList)));
|
||||
m_AttribTable.push_back(SAttrib(0x06, LanguageBaseAttributeIDList, sizeof(LanguageBaseAttributeIDList)));
|
||||
m_AttribTable.push_back(SAttrib(0x09, BluetoothProfileDescriptorList, sizeof(BluetoothProfileDescriptorList)));
|
||||
m_AttribTable.push_back(SAttrib(0x0D, AdditionalProtocolDescriptorLists, sizeof(AdditionalProtocolDescriptorLists)));
|
||||
|
||||
|
||||
m_AttribTable.push_back(SAttrib(0x100, ServiceName, sizeof(ServiceName)));
|
||||
m_AttribTable.push_back(SAttrib(0x101, ServiceDescription, sizeof(ServiceDescription)));
|
||||
m_AttribTable.push_back(SAttrib(0x102, ProviderName, sizeof(ProviderName)));
|
||||
|
||||
m_AttribTable.push_back(SAttrib(0x200, HIDDeviceReleaseNumber, sizeof(HIDDeviceReleaseNumber)));
|
||||
m_AttribTable.push_back(SAttrib(0x201, HIDParserVersion, sizeof(HIDParserVersion)));
|
||||
m_AttribTable.push_back(SAttrib(0x202, HIDDeviceSubclass, sizeof(HIDDeviceSubclass)));
|
||||
m_AttribTable.push_back(SAttrib(0x203, HIDCountryCode, sizeof(HIDCountryCode)));
|
||||
m_AttribTable.push_back(SAttrib(0x204, HIDVirtualCable, sizeof(HIDVirtualCable)));
|
||||
m_AttribTable.push_back(SAttrib(0x205, HIDReconnectInitiate, sizeof(HIDReconnectInitiate)));
|
||||
m_AttribTable.push_back(SAttrib(0x206, HIDDescriptorList, sizeof(HIDDescriptorList)));
|
||||
m_AttribTable.push_back(SAttrib(0x207, HIDLANGIDBaseList, sizeof(HIDLANGIDBaseList)));
|
||||
m_AttribTable.push_back(SAttrib(0x208, HIDSDPDisable, sizeof(HIDSDPDisable)));
|
||||
m_AttribTable.push_back(SAttrib(0x209, HIDBatteryPower, sizeof(HIDBatteryPower)));
|
||||
m_AttribTable.push_back(SAttrib(0x20a, HIDRemoteWake, sizeof(HIDRemoteWake)));
|
||||
m_AttribTable.push_back(SAttrib(0x20b, HIDUnk_020B, sizeof(HIDUnk_020B)));
|
||||
m_AttribTable.push_back(SAttrib(0x20c, HIDUnk_020C, sizeof(HIDUnk_020C)));
|
||||
m_AttribTable.push_back(SAttrib(0x20d, HIDUnk_020D, sizeof(HIDUnk_020D)));
|
||||
m_AttribTable.push_back(SAttrib(0x20e, HIDBootDevice, sizeof(HIDBootDevice)));
|
||||
}
|
||||
|
||||
const CAttribTable& GetAttribTable()
|
||||
{
|
||||
if (m_AttribTable.empty())
|
||||
{
|
||||
InitAttribTable();
|
||||
}
|
||||
|
||||
return m_AttribTable;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -6,23 +6,4 @@
|
|||
|
||||
#include "Common/CommonTypes.h"
|
||||
|
||||
#if 0
|
||||
struct SAttrib
|
||||
{
|
||||
u16 ID;
|
||||
u8* pData;
|
||||
u16 size;
|
||||
|
||||
SAttrib(u16 _ID, u8* _Data, u16 _size)
|
||||
: ID(_ID)
|
||||
, pData(_Data)
|
||||
, size(_size)
|
||||
{ }
|
||||
};
|
||||
|
||||
typedef std::vector<SAttrib> CAttribTable;
|
||||
|
||||
const CAttribTable& GetAttribTable();
|
||||
#endif
|
||||
|
||||
const u8* GetAttribPacket(u32 serviceHandle, u32 cont, u32& _size);
|
||||
|
|
Loading…
Reference in New Issue